403Webshell
Server IP : 121.121.20.254  /  Your IP : 216.73.216.133
Web Server : Microsoft-IIS/10.0
System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64
User : IUSR ( 0)
PHP Version : 8.3.28
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /Program Files/Microsoft VS Code/ce099c1ed2/resources/app/out/vs/sessions/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /Program Files/Microsoft VS Code/ce099c1ed2/resources/app/out/vs/sessions/sessions.desktop.main.js
/*!--------------------------------------------------------
 * 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 NDo=Object.defineProperty;var ODo=Object.getOwnPropertyDescriptor;var XHi=a=>{throw TypeError(a)};var I=(a,i,e,t)=>{for(var o=t>1?void 0:t?ODo(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&&NDo(i,e,o),o},m=(a,i)=>(e,t)=>i(e,t,a);var R6t=(a,i,e)=>i.has(a)||XHi("Cannot "+e);var pf=(a,i,e)=>(R6t(a,i,"read from private field"),e?e.call(a):i.get(a)),Yve=(a,i,e)=>i.has(a)?XHi("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(a):i.set(a,e),j2e=(a,i,e,t)=>(R6t(a,i,"write to private field"),t?t.call(a,e):i.set(a,e),e),Q2e=(a,i,e)=>(R6t(a,i,"access private method"),e);function Y2e(){return globalThis._VSCODE_NLS_MESSAGES}function are(){return globalThis._VSCODE_NLS_LANGUAGE}var FDo=are()==="pseudo"||typeof document<"u"&&document.location&&typeof document.location.hash=="string"&&document.location.hash.indexOf("pseudo=true")>=0;function Tut(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}),FDo&&(e="\uFF3B"+e.replace(/[aouei]/g,"$&$&")+"\uFF3D"),e}function d(a,i,...e){return Tut(typeof a=="number"?JHi(a,i):i,e)}function JHi(a,i){let e=Y2e()?.[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=JHi(a,i):t=i;let o=Tut(t,e);return{value:o,original:i===t?o:Tut(i,e)}}function _ut(a,i){let e=a;typeof e.vscodeWindowId!="number"&&Object.defineProperty(e,"vscodeWindowId",{get:()=>i})}var It=window;function Cy(a){return a===It?!1:typeof a?.vscodeWindowId=="number"}function wI(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 tUi(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 HH(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 X2e(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 Dut(a,i){let e=new Set;for(let t of i)a.has(t)&&e.add(t);return e}var ZHi,eUi,lre=class{constructor(i,e){this.toKey=e;this._map=new Map;this[ZHi]="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))}[(eUi=Symbol.iterator,ZHi=Symbol.toStringTag,eUi)](){return this.values()}};var M6t=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(i){setTimeout(()=>{throw i.stack?Zs.isErrorNoTelemetry(i)?new Zs(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)}},i6=new M6t;function iUi(a){i6.setUnexpectedErrorHandler(a)}function o6(a){i6.onUnexpectedError(a)}function mt(a){so(a)||i6.onUnexpectedError(a)}function ss(a){so(a)||i6.onUnexpectedExternalError(a)}function QG(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:Zs.isErrorNoTelemetry(a),cause:t?QG(t):void 0,code:a.code}}return a}function n6(a){let i;return a.noTelemetry?i=new Zs:(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=n6(a.cause)),i}var t6="Canceled";function so(a){return a instanceof ho?!0:a instanceof Error&&a.name===t6&&a.message===t6}var ho=class extends Error{constructor(){super(t6),this.name=this.message}},Lut=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 CI(){let a=new Error(t6);return a.name=a.message,a}function Br(a){return a?new Error(`Illegal argument: ${a}`):new Error("Illegal argument")}function Xve(a){return a?new Error(`Illegal state: ${a}`):new Error("Illegal state")}function Cn(a){return a?a.message?a.message:a.stack?a.stack.split(`
`)[0]:String(a):"Error"}var jG=class extends Error{constructor(i){super("NotSupported"),i&&(this.message=i)}};var Zs=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"}},ni=class a extends Error{constructor(i){super(i||"An unexpected bug occurred."),Object.setPrototypeOf(this,a.prototype)}};function wd(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 ju(a,i,e=a.length-1){let t=Jve(a,i,e);if(t!==-1)return a[t]}function Jve(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 Rut(a,i,e=0){let t=VDo(a,i,e);if(t!==-1)return a[t]}function VDo(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 YG(a,i){let e=XG(a,i);return e===-1?void 0:a[e]}function XG(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 oUi(a,i){let e=xy(a,i);return e===a.length?void 0:a[e]}function xy(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 J2e=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=XG(this._array,i,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=e+1,e===-1?void 0:this._array[e]}};function Z2e(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 Mut(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 Put(a,i){return Z2e(a,(e,t)=>-i(e,t))}function nUi(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 DT(a,i){for(let e of a){let t=i(e);if(t!==void 0)return t}}function Mg(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 rUi(a,i){let e=a.length-1;i<e&&(a[i]=a[e]),a.pop()}function cx(a,i,e){return bM(a.length,t=>e(a[t],i))}function bM(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 r6(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?r6(a,o,e):a<o.length+r.length?r[0]:r6(a-(o.length+r.length),n,e)}function Pg(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*s6(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 Nut(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 sUi(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 Out(...a){return[].concat(...a)}function eGe(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 cre(a,i,e){let t=eGe(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 aUi(a,i,e){if(e===0)return[];let t=a.slice(0,e).sort(i);return BDo(a,i,t,e,a.length),t}function BDo(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=xy(e,l=>i(r,l)<0);e.splice(s,0,r)}}}function si(a){return a.filter(i=>!!i)}function ZG(a){let i=0;for(let e=0;e<a.length;e++)a[e]&&(a[i]=a[e],i+=1);a.length=i}function lUi(a,i,e){a.splice(e,0,a.splice(i,1)[0])}function JA(a){return!Array.isArray(a)||a.length===0}function dr(a){return Array.isArray(a)&&a.length>0}function Uo(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 cUi(a){let i=new Set;return e=>{let t=a(e);return i.has(t)?!1:(i.add(t),!0)}}function dUi(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 a6(a,i,e){return a.reduce((t,o)=>(t[i(o)]=e?e(o):o,t),Object.create(null))}function Zm(a,i){return a.push(i),()=>tGe(a,i)}function tGe(a,i){let e=a.indexOf(i);if(e>-1)return a.splice(e,1),i}function UH(a,i,e){let t=a.slice(0,i),o=a.slice(i);return t.concat(e,o)}function l6(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 Fut(a,i){let e=a.indexOf(i);e>-1&&(a.splice(e,1),a.unshift(i))}function iGe(a,i){let e=a.indexOf(i);e>-1&&(a.splice(e,1),a.push(i))}function e$(a,i){for(let e of i)a.push(e)}function uUi(a,i){return Array.isArray(a)?a.map(i):i(a)}function pUi(a,i){let e=[];for(let t of a){let o=i(t);o!==void 0&&e.push(o)}return e}function mUi(a){let i=new Set(a);return Array.from(i)}function Yl(a){return Array.isArray(a)?a:[a]}function dre(a,i,e){let t=hUi(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 ure(a,i,e,t){let o=hUi(a,i),n=a.splice(o,e);return n===void 0&&(n=[]),dre(a,o,t),n}function hUi(a,i){return i<0?Math.max(i+a.length,0):Math.min(i,a.length)}var Fw;(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})(Fw||={});function tl(a,i){return(e,t)=>i(a(e),a(t))}function Wut(...a){return(i,e)=>{for(let t of a){let o=t(i,e);if(!Fw.isNeitherLessOrGreaterThan(o))return o}return Fw.neitherLessOrGreaterThan}}var qd=(a,i)=>a-i,Vut=(a,i)=>qd(a?1:0,i?1:0);function pre(a){return(i,e)=>-a(i,e)}function gUi(a){return(i,e)=>i===void 0?e===void 0?Fw.neitherLessOrGreaterThan:Fw.lessThan:e===void 0?Fw.greaterThan:a(i,e)}var bS=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}},JG=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||Fw.isGreaterThan(i(o,e)))&&(t=!1,e=o),!0)),e}},Aut=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 fUi(a,i){return(await Promise.all(a.map(async(t,o)=>({element:t,ok:await i(t,o)})))).find(t=>t.ok)?.element}function Zve(a){return a.reduce((i,e)=>i+e,0)}function ky(a,i){return a.reduce((e,t)=>e+i(t),0)}function $H(a,i,e){let t=a.get(i);return t===void 0&&(t=e,a.set(i,t)),t}var P6t=class{constructor(i,e){this.uri=i;this.value=e}};function HDo(a){return Array.isArray(a)}var vUi,vt=class a{constructor(i,e){this[vUi]="ResourceMap";if(i instanceof a)this.map=new Map(i.map),this.toKey=e??a.defaultToKey;else if(HDo(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 P6t(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]}*[(vUi=Symbol.toStringTag,Symbol.iterator)](){for(let[,i]of this.map)yield[i.uri,i.value]}},bUi,Mn=class{constructor(i,e){this[bUi]="ResourceSet";!i||typeof i=="function"?this._map=new vt(i):(this._map=new vt(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()}[(bUi=Symbol.toStringTag,Symbol.iterator)](){return this.keys()}};var SUi,zH=class{constructor(){this[SUi]="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}[(SUi=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)}},But=class extends zH{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))}},il=class extends But{constructor(i,e=1){super(i,e)}trim(i){this.trimOld(i)}set(i,e){return super.set(i,e),this.checkTrim(),this}},Hut=class extends But{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}},ebe=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)}},Uut=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()}},KH=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 mre(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 GH=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 c6(a,i){if(!a)throw new Error(i?`Assertion failed (${i})`:"Assertion Failed")}function Hr(a,i="Unreachable"){throw new Error(i)}function Ey(a,i="unexpected state"){if(!a)throw typeof i=="string"?new ni(`Assertion Failed: ${i}`):i}function A6t(a,i="Soft Assertion Failed"){a||mt(new ni(i))}function eh(a){if(!a()){debugger;a(),mt(new ni("Assertion Failed"))}}function Ty(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 Ae(a){return typeof a=="string"}function SS(a){return N6t(a,Ae)}function N6t(a,i){return Array.isArray(a)&&a.every(i)}function yi(a){return typeof a=="object"&&a!==null&&!Array.isArray(a)&&!(a instanceof RegExp)&&!(a instanceof Date)}function yUi(a){let i=Object.getPrototypeOf(Uint8Array);return typeof a=="object"&&a instanceof i}function Xo(a){return typeof a=="number"&&!isNaN(a)}function oGe(a){return!!a&&typeof a[Symbol.iterator]=="function"}function Da(a){return a===!0||a===!1}function cn(a){return typeof a>"u"}function mo(a){return!Jn(a)}function Jn(a){return cn(a)||a===null}function So(a,i){if(!a)throw new Error(i?`Unexpected type, expected '${i}'`:"Unexpected type")}function Oi(a){return Ey(a!=null,"Argument is `undefined` or `null`."),a}function O6t(a,i){if(a==null)throw typeof i=="string"?new Error(i):i}function _y(...a){let i=[];for(let e=0;e<a.length;e++){let t=a[e];if(Jn(t))throw new Error(`Assertion Failed: argument at index ${e} is undefined or null`);i.push(t)}return i}var UDo=Object.prototype.hasOwnProperty;function mf(a){if(!yi(a))return!1;for(let i in a)if(UDo.call(a,i))return!1;return!0}function HD(a){return typeof a=="function"}function zut(...a){return a.length>0&&a.every(HD)}function wUi(a,i){let e=Math.min(a.length,i.length);for(let t=0;t<e;t++)zDo(a[t],i[t])}function zDo(a,i){if(Ae(i)){if(typeof a!==i)throw new Error(`argument does not match constraint: typeof ${i}`)}else if(HD(i)){try{if(a instanceof i)return}catch{}if(!Jn(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 Wo(a,i){for(let e in i)if(!(e in a))return!1;return!0}var ht;(N=>{function a(O){return!!O&&typeof O=="object"&&typeof O[Symbol.iterator]=="function"}N.is=a;let i=Object.freeze([]);function e(){return i}N.empty=e;function*t(O){yield O}N.single=t;function o(O){return a(O)?O:t(O)}N.wrap=o;function n(O){return O??i}N.from=n;function*r(O){for(let V=O.length-1;V>=0;V--)yield O[V]}N.reverse=r;function s(O){return!O||O[Symbol.iterator]().next().done===!0}N.isEmpty=s;function l(O){return O[Symbol.iterator]().next().value}N.first=l;function c(O,V){let U=0;for(let G of O)if(V(G,U++))return!0;return!1}N.some=c;function u(O,V){let U=0;for(let G of O)if(!V(G,U++))return!1;return!0}N.every=u;function p(O,V){for(let U of O)if(V(U))return U}N.find=p;function*h(O,V){for(let U of O)V(U)&&(yield U)}N.filter=h;function*g(O,V){let U=0;for(let G of O)yield V(G,U++)}N.map=g;function*f(O,V){let U=0;for(let G of O)yield*V(G,U++)}N.flatMap=f;function*v(...O){for(let V of O)oGe(V)?yield*V:yield V}N.concat=v;function b(O,V,U){let G=U;for(let $ of O)G=V(G,$);return G}N.reduce=b;function S(O){let V=0;for(let U of O)V++;return V}N.length=S;function*y(O,V,U=O.length){for(V<-O.length&&(V=0),V<0&&(V+=O.length),U<0?U+=O.length:U>O.length&&(U=O.length);V<U;V++)yield O[V]}N.slice=y;function w(O,V=Number.POSITIVE_INFINITY){let U=[];if(V===0)return[U,O];let G=O[Symbol.iterator]();for(let $=0;$<V;$++){let te=G.next();if(te.done)return[U,N.empty()];U.push(te.value)}return[U,{[Symbol.iterator](){return G}}]}N.consume=w;async function k(O){let V=[];for await(let U of O)V.push(U);return V}N.asyncToArray=k;async function T(O){let V=[];for await(let U of O)V=V.concat(U);return V}N.asyncToArrayFlat=T})(ht||={});var KDo=!1,hre=null,Kut=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)}},Gut=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 KH;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(tl(l=>l.idx,qd));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=wI([...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 obe(a){hre=a}if(KDo){let a="__is_disposable_tracked__";obe(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!==C.None)try{i[a]=!0}catch{}}markAsDisposed(i){if(i&&i!==C.None)try{i[a]=!0}catch{}}markAsSingleton(i){}})}function i$(a){return hre?.trackDisposable(a),a}function o$(a){hre?.markAsDisposed(a)}function t$(a,i){hre?.setParent(a,i)}function GDo(a,i){if(hre)for(let e of a)hre.setParent(e,i)}function Mp(a){return hre?.markAsSingleton(a),a}function Ac(a){return typeof a=="object"&&a!==null&&typeof a.dispose=="function"&&a.dispose.length===0}function Ue(a){if(ht.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 jH(a){for(let i of a)Ac(i)&&i.dispose();return[]}function hn(...a){let i=Z(()=>Ue(a));return GDo(a,i),i}var F6t=class{constructor(i){this._isDisposed=!1,this._fn=i,i$(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,o$(this),this._fn()}}};function Z(a){return new F6t(a)}var P=class a{constructor(){this._toDispose=new Set;this._isDisposed=!1;i$(this)}static{this.DISABLE_DISPOSED_WARNING=!1}dispose(){this._isDisposed||(o$(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Ue(this._toDispose)}finally{this._toDispose.clear()}}add(i){if(!i||i===C.None)return i;if(i===this)throw new Error("Cannot register a disposable on itself!");return t$(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)&&t$(i,null)}assertNotDisposed(){this._isDisposed&&mt(new ni("Object disposed"))}},C=class{constructor(){this._store=new P;i$(this),t$(this._store,this)}static{this.None=Object.freeze({dispose(){}})}dispose(){o$(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;i$(this)}get value(){return this._isDisposed?void 0:this._value}set value(i){this._isDisposed||i===this._value||(this._value?.dispose(),i&&t$(i,this),this._value=i)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,o$(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let i=this._value;return this._value=void 0,i&&t$(i,null),i}},$ut=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()}},qH=class{constructor(i){this._disposable=i;this._counter=1}acquire(){return this._counter++,this}release(){return--this._counter===0&&this._disposable.dispose(),this}},Ww=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=wd(()=>{--t.counter===0&&(this.destroyReferencedObject(i,t.object),this.references.delete(i))});return t.counter++,{object:o,dispose:n}}},tbe=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}}},qut=class{constructor(i){this.object=i}dispose(){}};var jt=class{constructor(i=new Map){this._isDisposed=!1;this._store=i,i$(this)}dispose(){o$(this),this._isDisposed=!0,this.clearAndDisposeAll()}clearAndDisposeAll(){if(this._store.size)try{Ue(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),t$(e,this)}deleteAndDispose(i){this._store.get(i)?.dispose(),this._store.delete(i)}deleteAndLeak(i){let e=this._store.get(i);return e&&t$(e,null),this._store.delete(i),e}keys(){return this._store.keys()}values(){return this._store.values()}[Symbol.iterator](){return this._store[Symbol.iterator]()}},ibe=class{constructor(i=new Set){this._isDisposed=!1;this._store=i,i$(this)}dispose(){o$(this),this._isDisposed=!0,this.clearAndDisposeAll()}clearAndDisposeAll(){if(this._store.size)try{Ue(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),t$(i,this)}deleteAndDispose(i){this._store.delete(i)&&i.dispose()}deleteAndLeak(i){if(this._store.delete(i))return t$(i,null),i}values(){return this._store.values()}[Symbol.iterator](){return this._store[Symbol.iterator]()}};function nbe(a,i){let e=!1;return a.then(t=>{e||i(t)}),Z(()=>{e=!0})}function jut(a,i){return a.then(e=>(i.isDisposed?e.dispose():i.add(e),e))}var UD=class extends jt{constructor(){super(new vt)}};var Ag=class a{static{this.Undefined=new a(void 0)}constructor(i){this.element=i,this.next=a.Undefined,this.prev=a.Undefined}},Vs=class{constructor(){this._first=Ag.Undefined;this._last=Ag.Undefined;this._size=0}get size(){return this._size}isEmpty(){return this._first===Ag.Undefined}clear(){let i=this._first;for(;i!==Ag.Undefined;){let e=i.next;i.prev=Ag.Undefined,i.next=Ag.Undefined,i=e}this._first=Ag.Undefined,this._last=Ag.Undefined,this._size=0}unshift(i){return this._insert(i,!1)}push(i){return this._insert(i,!0)}_insert(i,e){let t=new Ag(i);if(this._first===Ag.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!==Ag.Undefined){let i=this._first.element;return this._remove(this._first),i}}pop(){if(this._last!==Ag.Undefined){let i=this._last.element;return this._remove(this._last),i}}peek(){if(this._last!==Ag.Undefined)return this._last.element}_remove(i){if(i.prev!==Ag.Undefined&&i.next!==Ag.Undefined){let e=i.prev;e.next=i.next,i.next.prev=e}else i.prev===Ag.Undefined&&i.next===Ag.Undefined?(this._first=Ag.Undefined,this._last=Ag.Undefined):i.next===Ag.Undefined?(this._last=this._last.prev,this._last.next=Ag.Undefined):i.prev===Ag.Undefined&&(this._first=this._first.next,this._first.prev=Ag.Undefined);this._size-=1}*[Symbol.iterator](){let i=this._first;for(;i!==Ag.Undefined;)yield i.element,i=i.next}};var QH="en",sGe=!1,aGe=!1,rGe=!1,EUi=!1,TUi=!1,V6t=!1,_Ui=!1,B6t=!1,DUi=!1,LUi=!1,nGe,Qut=QH,W6t=QH,RUi,n$,r$=globalThis,zD;typeof r$.vscode<"u"&&typeof r$.vscode.process<"u"?zD=r$.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(zD=process);var MUi=typeof zD?.versions?.electron=="string",$Do=MUi&&zD?.type==="renderer";if(typeof zD=="object"){sGe=zD.platform==="win32",aGe=zD.platform==="darwin",rGe=zD.platform==="linux",EUi=rGe&&!!zD.env.SNAP&&!!zD.env.SNAP_REVISION,_Ui=MUi,DUi=!!zD.env.CI||!!zD.env.BUILD_ARTIFACTSTAGINGDIRECTORY||!!zD.env.GITHUB_WORKSPACE,nGe=QH,Qut=QH;let a=zD.env.VSCODE_NLS_CONFIG;if(a)try{let i=JSON.parse(a);nGe=i.userLocale,W6t=i.osLocale,Qut=i.resolvedLanguage||QH,RUi=i.languagePack?.translationsConfigFile}catch{}TUi=!0}else typeof navigator=="object"&&!$Do?(n$=navigator.userAgent,sGe=n$.indexOf("Windows")>=0,aGe=n$.indexOf("Macintosh")>=0,B6t=(n$.indexOf("Macintosh")>=0||n$.indexOf("iPad")>=0||n$.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,rGe=n$.indexOf("Linux")>=0,LUi=n$?.indexOf("Mobi")>=0,V6t=!0,Qut=are()||QH,nGe=navigator.language.toLowerCase(),W6t=nGe):console.error("Unable to resolve platform.");function LT(a){switch(a){case 0:return"Web";case 1:return"Mac";case 2:return"Linux";case 3:return"Windows"}}var Yut=0;aGe?Yut=1:sGe?Yut=3:rGe&&(Yut=2);var ri=sGe,it=aGe,Wn=rGe,rbe=EUi,kr=TUi,Xut=_Ui,Gt=V6t,qDo=V6t&&typeof r$.importScripts=="function",PUi=qDo?r$.origin:void 0,Nc=B6t,sbe=LUi,Zf=DUi,Pp=Yut,YH=n$,Dr=Qut,IS;(t=>{function a(){return Dr}t.value=a;function i(){return Dr.length===2?Dr==="en":Dr.length>=3?Dr[0]==="e"&&Dr[1]==="n"&&Dr[2]==="-":!1}t.isDefaultVariant=i;function e(){return Dr==="en"}t.isDefault=e})(IS||={});var abe=nGe,AUi=W6t,H6t=RUi,jDo=typeof r$.postMessage=="function"&&!r$.importScripts,Vw=(()=>{if(jDo){let a=[];r$.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}),r$.postMessage({vscodeScheduleAsyncWork:t},"*")}}return a=>setTimeout(a)})();var zo=aGe||B6t?2:sGe?1:3,xUi=!0,kUi=!1;function lGe(){if(!kUi){kUi=!0;let a=new Uint8Array(2);a[0]=1,a[1]=2,xUi=new Uint16Array(a.buffer)[0]===513}return xUi}var XH=!!(YH&&YH.indexOf("Chrome")>=0),lbe=!!(YH&&YH.indexOf("Firefox")>=0),cbe=!!(!XH&&YH&&YH.indexOf("Safari")>=0),dbe=!!(YH&&YH.indexOf("Edg/")>=0),Jut=!!(YH&&YH.indexOf("Android")>=0);function NUi(a){return parseFloat(a)>=25}var gre,U6t=globalThis.vscode;if(typeof U6t<"u"&&typeof U6t.process<"u"){let a=U6t.process;gre={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"?gre={get platform(){return process.platform},get arch(){return process.arch},get env(){return process.env},cwd(){return process.env.VSCODE_CWD||process.cwd()}}:gre={get platform(){return ri?"win32":it?"darwin":"linux"},get arch(){},get env(){return{}},cwd(){return"/"}};var fre=gre.cwd,fp=gre.env,ZA=gre.platform,ube=gre.arch;var QDo=globalThis.performance.now.bind(globalThis.performance),En=class a{static create(i){return new a(i)}constructor(i){this._now=i===!1?Date.now:QDo,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 FUi=!1,YDo=!1,XDo=100,WUi=6e4;function VUi(){return!!fp.VSCODE_DEV}var H;(de=>{de.None=()=>C.None;function i(se){if(YDo){let{onDidAddListener:Se}=se,ke=hbe.create(),Ee=0;se.onDidAddListener=()=>{++Ee===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),ke.print()),Se?.()}}}function e(se,Se,ke){return g(se,()=>{},0,void 0,Se??!0,void 0,ke)}de.defer=e;function t(se){return(Se,ke=null,Ee)=>{let He=!1,Ve;return Ve=se(Fe=>{if(!He)return Ve?Ve.dispose():He=!0,Se.call(ke,Fe)},null,Ee),He&&Ve.dispose(),Ve}}de.once=t;function o(se,Se){return de.once(de.filter(se,Se))}de.onceIf=o;function n(se,Se,ke){return p((Ee,He=null,Ve)=>se(Fe=>Ee.call(He,Se(Fe)),null,Ve),ke)}de.map=n;function r(se,Se,ke){return p((Ee,He=null,Ve)=>se(Fe=>{Se(Fe),Ee.call(He,Fe)},null,Ve),ke)}de.forEach=r;function s(se,Se,ke){return p((Ee,He=null,Ve)=>se(Fe=>Se(Fe)&&Ee.call(He,Fe),null,Ve),ke)}de.filter=s;function l(se){return se}de.signal=l;function c(...se){return(Se,ke=null,Ee)=>{let He=hn(...se.map(Ve=>Ve(Fe=>Se.call(ke,Fe))));return h(He,Ee)}}de.any=c;function u(se,Se,ke,Ee){let He=ke;return n(se,Ve=>(He=Se(He,Ve),He),Ee)}de.reduce=u;function p(se,Se){let ke,Ee={onWillAddFirstListener(){ke=se(He.fire,He)},onDidRemoveLastListener(){ke?.dispose()}};Se||i(Ee);let He=new E(Ee);return Se?.add(He),He.event}function h(se,Se){return Se instanceof Array?Se.push(se):Se&&Se.add(se),se}function g(se,Se,ke=100,Ee=!1,He=!1,Ve,Fe){let Qt,Ze,Ti,ti=0,bo,Ro={leakWarningThreshold:Ve,onWillAddFirstListener(){Qt=se(sr=>{ti++,Ze=Se(Ze,sr),Ee&&!Ti&&(_o.fire(Ze),Ze=void 0),bo=()=>{let ln=Ze;Ze=void 0,Ti=void 0,(!Ee||ti>1)&&_o.fire(ln),ti=0},typeof ke=="number"?(Ti&&clearTimeout(Ti),Ti=setTimeout(bo,ke)):Ti===void 0&&(Ti=null,queueMicrotask(bo))})},onWillRemoveListener(){He&&ti>0&&bo?.()},onDidRemoveLastListener(){bo=void 0,Qt.dispose()}};Fe||i(Ro);let _o=new E(Ro);return Fe?.add(_o),_o.event}de.debounce=g;function f(se,Se=0,ke,Ee){return de.debounce(se,(He,Ve)=>He?(He.push(Ve),He):[Ve],Se,void 0,ke??!0,void 0,Ee)}de.accumulate=f;function v(se,Se,ke=100,Ee=!0,He=!0,Ve,Fe){let Qt,Ze,Ti,ti=0,bo={leakWarningThreshold:Ve,onWillAddFirstListener(){Qt=se(_o=>{ti++,Ze=Se(Ze,_o),Ti===void 0&&(Ee&&(Ro.fire(Ze),Ze=void 0,ti=0),typeof ke=="number"?Ti=setTimeout(()=>{He&&ti>0&&Ro.fire(Ze),Ze=void 0,Ti=void 0,ti=0},ke):(Ti=0,queueMicrotask(()=>{He&&ti>0&&Ro.fire(Ze),Ze=void 0,Ti=void 0,ti=0})))})},onDidRemoveLastListener(){Qt.dispose()}};Fe||i(bo);let Ro=new E(bo);return Fe?.add(Ro),Ro.event}de.throttle=v;function b(se,Se=(Ee,He)=>Ee===He,ke){let Ee=!0,He;return s(se,Ve=>{let Fe=Ee||!Se(Ve,He);return Ee=!1,He=Ve,Fe},ke)}de.latch=b;function S(se,Se,ke){return[de.filter(se,Se,ke),de.filter(se,Ee=>!Se(Ee),ke)]}de.split=S;function y(se,Se,ke=!1,Ee=[],He){let Ve=Ee.slice(),Fe;VUi()&&(Fe={stack:hbe.create(),timerId:setTimeout(()=>{Ve&&Ve.length>0&&Fe&&!Fe.warned&&(Fe.warned=!0,console.warn(`[Event.buffer][${Se}] potential LEAK detected: ${Ve.length} events buffered for ${WUi/1e3}s without being consumed. Buffered here:`),Fe.stack.print())},WUi),warned:!1},He&&He.add(Z(()=>clearTimeout(Fe.timerId))));let Qt=()=>{Fe&&clearTimeout(Fe.timerId)},Ze=se(bo=>{Ve?(Ve.push(bo),VUi()&&Fe&&!Fe.warned&&Ve.length>=XDo&&(Fe.warned=!0,console.warn(`[Event.buffer][${Se}] potential LEAK detected: ${Ve.length} events buffered without being consumed. Buffered here:`),Fe.stack.print())):ti.fire(bo)});He&&He.add(Ze);let Ti=()=>{Ve?.forEach(bo=>ti.fire(bo)),Ve=null,Qt()},ti=new E({onWillAddFirstListener(){Ze||(Ze=se(bo=>ti.fire(bo)),He&&He.add(Ze))},onDidAddFirstListener(){Ve&&(ke?setTimeout(Ti):Ti())},onDidRemoveLastListener(){Ze&&Ze.dispose(),Ze=null,Qt()}});return He&&He.add(ti),ti.event}de.buffer=y;function w(se,Se){return(Ee,He,Ve)=>{let Fe=Se(new T);return se(function(Qt){let Ze=Fe.evaluate(Qt);Ze!==k&&Ee.call(He,Ze)},void 0,Ve)}}de.chain=w;let k=Symbol("HaltChainable");class T{constructor(){this.steps=[]}map(Se){return this.steps.push(Se),this}forEach(Se){return this.steps.push(ke=>(Se(ke),ke)),this}filter(Se){return this.steps.push(ke=>Se(ke)?ke:k),this}reduce(Se,ke){let Ee=ke;return this.steps.push(He=>(Ee=Se(Ee,He),Ee)),this}latch(Se=(ke,Ee)=>ke===Ee){let ke=!0,Ee;return this.steps.push(He=>{let Ve=ke||!Se(He,Ee);return ke=!1,Ee=He,Ve?He:k}),this}evaluate(Se){for(let ke of this.steps)if(Se=ke(Se),Se===k)break;return Se}}function N(se,Se,ke=Ee=>Ee){let Ee=(...Qt)=>Fe.fire(ke(...Qt)),He=()=>se.on(Se,Ee),Ve=()=>se.removeListener(Se,Ee),Fe=new E({onWillAddFirstListener:He,onDidRemoveLastListener:Ve});return Fe.event}de.fromNodeEventEmitter=N;function O(se,Se,ke=Ee=>Ee){let Ee=(...Qt)=>Fe.fire(ke(...Qt)),He=()=>se.addEventListener(Se,Ee),Ve=()=>se.removeEventListener(Se,Ee),Fe=new E({onWillAddFirstListener:He,onDidRemoveLastListener:Ve});return Fe.event}de.fromDOMEventEmitter=O;function V(se,Se){let ke,Ee,He=new Promise(Ve=>{Ee=t(se)(Ve),q6t(Ee,Se),ke=()=>{BUi(Ee,Se)}});return He.cancel=ke,Se&&He.finally(()=>BUi(Ee,Se)),He}de.toPromise=V;function U(se,Se){return se(ke=>Se.fire(ke))}de.forward=U;function G(se,Se,ke){return Se(ke),se(Ee=>Se(Ee))}de.runAndSubscribe=G;class ${constructor(Se,ke){this._observable=Se;this._counter=0;this._hasChanged=!1;let Ee={onWillAddFirstListener:()=>{Se.addObserver(this),this._observable.reportChanges()},onDidRemoveLastListener:()=>{Se.removeObserver(this)}};ke||i(Ee),this.emitter=new E(Ee),ke&&ke.add(this.emitter)}beginUpdate(Se){this._counter++}handlePossibleChange(Se){}handleChange(Se,ke){this._hasChanged=!0}endUpdate(Se){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function te(se,Se){return new $(se,Se).emitter.event}de.fromObservable=te;function pe(se){return(Se,ke,Ee)=>{let He=0,Ve=!1,Fe={beginUpdate(){He++},endUpdate(){He--,He===0&&(se.reportChanges(),Ve&&(Ve=!1,Se.call(ke)))},handlePossibleChange(){},handleChange(){Ve=!0}};se.addObserver(Fe),se.reportChanges();let Qt={dispose(){se.removeObserver(Fe)}};return q6t(Qt,Ee),Qt}}de.fromObservableLight=pe})(H||={});var mbe=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 En,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}}},cGe=-1;function HUi(a){let i=cGe;return cGe=a,{dispose(){cGe=i}}}var z6t=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=new K6t(s,n);this._errorHandler(l)}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}},hbe=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(`
`))}},K6t=class extends Error{constructor(i,e){super(i),this.name="ListenerLeakError",this.stack=e}},G6t=class extends Error{constructor(i,e){super(i),this.name="ListenerRefusalError",this.stack=e}},JDo=0,pbe=class{constructor(i){this.value=i;this.id=JDo++}},ZDo=2,UUi=(a,i)=>{if(a instanceof pbe)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=cGe>0||this._options?.leakWarningThreshold?new z6t(i?.onListenerError??mt,this._options?.leakWarningThreshold??cGe):void 0,this._perfMon=this._options?._profName?new mbe(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(FUi){let i=this._listeners;queueMicrotask(()=>{UUi(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=new G6t(`${l}. HINT: Stack shows most frequent listener (${c[1]}-times)`,c[0]);return(this._options?.onListenerError||mt)(u),C.None}if(this._disposed)return C.None;e&&(i=i.bind(e));let o=new pbe(i),n,r;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(o.stack=hbe.create(),n=this._leakageMon.check(o.stack,this._size+1)),FUi&&(o.stack=r??hbe.create()),this._listeners?this._listeners instanceof pbe?(this._deliveryQueue??=new Zut,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 q6t(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*ZDo<=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 pbe)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}},zUi=()=>new Zut,Zut=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}},JH=class extends E{async fireAsync(i,e,t){if(this._listeners)for(this._asyncDeliveryQueue||(this._asyncDeliveryQueue=new Vs),UUi(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)})}}},Pm=class extends E{constructor(e){super(e);this._isPaused=0;this._eventQueue=new Vs;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))}},gbe=class extends Pm{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)}},d6=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=[]}))}},xI=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(wd(()=>{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=[]}},vre=class{constructor(i,e,t,o){this._store=new P;let n=this._store.add(new xI),r=this._store.add(new jt);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()}},eN=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}},Mh=class{constructor(){this.listening=!1;this.inputEvent=H.None;this.inputEventListener=C.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()}},fbe=class{constructor(i){this._value=i;this._onDidChange=new E;this.onDidChange=this._onDidChange.event}static const(i){return new $6t(i)}get value(){return this._value}set value(i){i!==this._value&&(this._value=i,this._onDidChange.fire(void 0))}},$6t=class{constructor(i){this.value=i;this.onDidChange=H.None}};function KUi(a,i,e){let t=new jt,o=new Set(a());for(let r of o)t.set(r,e(r));let n=new P;return n.add(i(()=>{let r=a(),s=HH(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 q6t(a,i){i instanceof P?i.add(a):Array.isArray(i)&&i.push(a)}function BUi(a,i){if(i instanceof P)i.delete(a);else if(Array.isArray(i)){let e=i.indexOf(a);e!==-1&&i.splice(e,1)}a.dispose()}var ZH=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 eLo(a,i,e){typeof i=="string"&&(i=a.matchMedia(i)),i.addEventListener("change",e)}function GUi(a,i){ZH.INSTANCE.setZoomLevel(a,i)}function RT(a){return ZH.INSTANCE.getZoomLevel(a)}var tpt=ZH.INSTANCE.onDidChangeZoomLevel;function yS(a){return ZH.INSTANCE.getZoomFactor(a)}function $Ui(a,i){ZH.INSTANCE.setZoomFactor(a,i)}function s$(a,i){ZH.INSTANCE.setFullscreen(a,i)}function wS(a){return ZH.INSTANCE.isFullscreen(a)}var Bk=ZH.INSTANCE.onDidChangeFullscreen,vbe=navigator.userAgent,yc=vbe.indexOf("Firefox")>=0,H0=vbe.indexOf("AppleWebKit")>=0,eU=vbe.indexOf("Chrome")>=0,Vb=!eU&&vbe.indexOf("Safari")>=0,qUi=!eU&&!Vb&&H0,qgn=vbe.indexOf("Electron/")>=0,Q6t=vbe.indexOf("Android")>=0,ept=!1;if(typeof It.matchMedia=="function"){let a=It.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),i=It.matchMedia("(display-mode: fullscreen)");ept=a.matches,eLo(It,a,({matches:e})=>{ept&&i.matches||(ept=e)})}function bbe(){return ept}function dGe(){return!!navigator?.windowControlsOverlay?.visible}function jUi(a){return a.navigator?.windowControlsOverlay?.getTitlebarAreaRect()}function QUi(){return globalThis.MonacoEnvironment}var uGe=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}},ipt=new uGe,Y6t=new uGe,X6t=new uGe,J6t=new Array(230),opt={},tLo={},YUi=[],XUi=Object.create(null),JUi=Object.create(null),Bb={lowerCaseToEnum:a=>JUi[a]||0,toEnum:a=>XUi[a]||0,toString:a=>YUi[a]||"None"},Dy=[],Sbe=[];for(let a=0;a<=193;a++)Dy[a]=-1;for(let a=0;a<=132;a++)Sbe[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,YUi[r]=s,XUi[s]=r,JUi[s.toLowerCase()]=r,n&&(Dy[r]=l,l!==0&&l!==3&&!tN(l)&&(Sbe[l]=r))),!e[l]){if(e[l]=!0,!c)throw new Error(`String representation missing for key code ${l} around scan code ${s}`);ipt.define(l,c),Y6t.define(l,h||c),X6t.define(l,g||h||c)}u&&(J6t[u]=l),s&&(tLo[s]=u),p&&(opt[p]=l)}Sbe[3]=46})();var vp;(r=>{function a(s){return ipt.keyCodeToStr(s)}r.toString=a;function i(s){return ipt.strToKeyCode(s)}r.fromString=i;function e(s){return Y6t.keyCodeToStr(s)}r.toUserSettingsUS=e;function t(s){return X6t.keyCodeToStr(s)}r.toUserSettingsGeneral=t;function o(s){return Y6t.strToKeyCode(s)||X6t.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 ipt.keyCodeToStr(s)}r.toElectronAccelerator=n})(vp||={});function Ai(a,i){let e=(i&65535)<<16>>>0;return(a|e)>>>0}function tN(a){return a===5||a===4||a===6||a===57}var og={clipboard:{writeText:kr||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(navigator&&navigator.clipboard&&navigator.clipboard.writeText),readText:kr||!!(navigator&&navigator.clipboard&&navigator.clipboard.readText)},keyboard:kr||bbe()?0:navigator.keyboard||Vb?1:2,touch:"ontouchstart"in It||navigator.maxTouchPoints>0,pointerEvents:It.PointerEvent&&("ontouchstart"in It||navigator.maxTouchPoints>0)};function Z6t(a,i){if(typeof a=="number"){if(a===0)return null;let e=(a&65535)>>>0,t=(a&4294901760)>>>16;return t!==0?new tU([npt(e,i),npt(t,i)]):new tU([npt(e,i)])}else{let e=[];for(let t=0;t<a.length;t++)e.push(npt(a[t],i));return new tU(e)}}function npt(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 Hb(o,n,r,s,l)}var Hb=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 tU([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},KD=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)}},tU=class{constructor(i){if(i.length===0)throw Br("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}},rpt=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}},Ibe=class{};function iLo(a){if(a.charCode){let e=String.fromCharCode(a.charCode).toUpperCase();return vp.fromString(e)}let i=a.keyCode;if(i===3)return 7;if(yc)switch(i){case 59:return 85;case 60:if(Wn)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(it)return 57;break}else if(H0){if(it&&i===93)return 57;if(!it&&i===92)return 57}return J6t[i]||0}var oLo=it?256:2048,nLo=512,rLo=1024,sLo=it?2048:256;function ZUi(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 e1i(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} ('${vp.toString(a.keyCode)}')`}function spt(a){return a.ctrlKey||a.shiftKey||a.altKey||a.metaKey}var Ii=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=iLo(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;tN(this.keyCode)||(i=this.keyCode);let e=0;return this.ctrlKey&&(e|=oLo),this.altKey&&(e|=nLo),this.shiftKey&&(e|=rLo),this.metaKey&&(e|=sLo),e|=i,e}_computeKeyCodeChord(){let i=0;return tN(this.keyCode)||(i=this.keyCode),new Hb(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,i)}};var t1i=new WeakMap;function aLo(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 apt=class{static getSameOriginWindowChain(i){let e=t1i.get(i);if(!e){e=[],t1i.set(i,e);let t=i,o;do o=aLo(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 lpt(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 lLo(n)}function lLo(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 yn=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=apt.getPositionOfChildWindowRelativeToAncestorWindow(i,e.view);this.posx-=t.left,this.posy-=t.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}};var MT=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(eU){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?yc&&!it?this.deltaY=-i.deltaY/3:this.deltaY=-i.deltaY:this.deltaY=-i.deltaY/40}if(typeof n.wheelDeltaX<"u")Vb&&ri?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?yc&&!it?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 i1i=Object.freeze(function(a,i){let e=setTimeout(a.bind(i),0);return{dispose(){clearTimeout(e)}}}),ve;(t=>{function a(o){return o===t.None||o===t.Cancelled||o instanceof wbe?!0:!o||typeof o!="object"?!1:typeof o.isCancellationRequested=="boolean"&&typeof o.onCancellationRequested=="function"}t.isCancellationToken=a,t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:H.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:i1i})})(ve||={});var wbe=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?i1i:(this._emitter||(this._emitter=new E),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},$e=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 wbe),this._token}cancel(){this._token?this._token instanceof wbe&&this._token.cancel():this._token=ve.Cancelled}dispose(i=!1){i&&this.cancel(),this._parentListener?.dispose(),this._token?this._token instanceof wbe&&this._token.dispose():this._token=ve.None}};function u6(a){let i=new $e;return a.add({dispose(){i.cancel()}}),i.token}var cpt=class{constructor(){this._source=new $e;this._listeners=new P;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 cLo=65,dLo=97,uLo=90,pLo=122,bre=46,Bw=47,GD=92,a$=58,mLo=63,dpt=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 hLo(a,i){if(a===null||typeof a!="object")throw new dpt(i,"Object",a)}function Ub(a,i){if(typeof a!="string")throw new dpt(i,"string",a)}var $D=ZA==="win32";function Oc(a){return a===Bw||a===GD}function e9t(a){return a===Bw}function l$(a){return a>=cLo&&a<=uLo||a>=dLo&&a<=pLo}function upt(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=Bw}if(t(l)){if(!(r===c-1||s===1))if(s===2){if(o.length<2||n!==2||o.charCodeAt(o.length-1)!==bre||o.charCodeAt(o.length-2)!==bre){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===bre&&s!==-1?++s:s=-1}return o}function gLo(a){return a?`${a[0]==="."?"":"."}${a}`:""}function o1i(a,i){hLo(i,"pathObject");let e=i.dir||i.root,t=i.base||`${i.name||""}${gLo(i.ext)}`;return e?e===i.root?`${e}${t}`:`${e}${a}${t}`:t}var Ms={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],Ub(n,`paths[${o}]`),n.length===0)continue}else i.length===0?n=fre():(n=fp[`=${i}`]||fre(),(n===void 0||n.slice(0,2).toLowerCase()!==i.toLowerCase()&&n.charCodeAt(2)===GD)&&(n=`${i}\\`));let r=n.length,s=0,l="",c=!1,u=n.charCodeAt(0);if(r===1)Oc(u)&&(s=1,c=!0);else if(Oc(u))if(c=!0,Oc(n.charCodeAt(1))){let p=2,h=p;for(;p<r&&!Oc(n.charCodeAt(p));)p++;if(p<r&&p!==h){let g=n.slice(h,p);for(h=p;p<r&&Oc(n.charCodeAt(p));)p++;if(p<r&&p!==h){for(h=p;p<r&&!Oc(n.charCodeAt(p));)p++;(p===r||p!==h)&&(l=`\\\\${g}\\${n.slice(h,p)}`,s=p)}}}else s=1;else l$(u)&&n.charCodeAt(1)===a$&&(l=n.slice(0,2),s=2,r>2&&Oc(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=upt(e,!t,"\\",Oc),t?`${i}\\${e}`:`${i}${e}`||"."},normalize(a){Ub(a,"path");let i=a.length;if(i===0)return".";let e=0,t,o=!1,n=a.charCodeAt(0);if(i===1)return e9t(n)?"\\":a;if(Oc(n))if(o=!0,Oc(a.charCodeAt(1))){let s=2,l=s;for(;s<i&&!Oc(a.charCodeAt(s));)s++;if(s<i&&s!==l){let c=a.slice(l,s);for(l=s;s<i&&Oc(a.charCodeAt(s));)s++;if(s<i&&s!==l){for(l=s;s<i&&!Oc(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 l$(n)&&a.charCodeAt(1)===a$&&(t=a.slice(0,2),e=2,i>2&&Oc(a.charCodeAt(2))&&(o=!0,e=3));let r=e<i?upt(a.slice(e),!o,"\\",Oc):"";if(r.length===0&&!o&&(r="."),r.length>0&&Oc(a.charCodeAt(i-1))&&(r+="\\"),!o&&t===void 0&&a.includes(":")){if(r.length>=2&&l$(r.charCodeAt(0))&&r.charCodeAt(1)===a$)return`.\\${r}`;let s=a.indexOf(":");do if(s===i-1||Oc(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){Ub(a,"path");let i=a.length;if(i===0)return!1;let e=a.charCodeAt(0);return Oc(e)||i>2&&l$(e)&&a.charCodeAt(1)===a$&&Oc(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];Ub(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"&&Oc(e.charCodeAt(0))){++o;let n=e.length;n>1&&Oc(e.charCodeAt(1))&&(++o,n>2&&(Oc(e.charCodeAt(2))?++o:t=!1))}if(t){for(;o<i.length&&Oc(i.charCodeAt(o));)o++;o>=2&&(i=`\\${i.slice(o)}`)}return Ms.normalize(i)},relative(a,i){if(Ub(a,"from"),Ub(i,"to"),a===i)return"";let e=Ms.resolve(a),t=Ms.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)===GD;)o++;let n=a.length;for(;n-1>o&&a.charCodeAt(n-1)===GD;)n--;let r=n-o,s=0;for(;s<i.length&&i.charCodeAt(s)===GD;)s++;let l=i.length;for(;l-1>s&&i.charCodeAt(l-1)===GD;)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===GD&&(p=h)}if(h!==u){if(p===-1)return t}else{if(c>u){if(i.charCodeAt(s+h)===GD)return t.slice(s+h+1);if(h===2)return t.slice(s+h)}r>u&&(a.charCodeAt(o+h)===GD?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)===GD)&&(g+=g.length===0?"..":"\\..");return s+=p,g.length>0?`${g}${t.slice(s,l)}`:(t.charCodeAt(s)===GD&&++s,t.slice(s,l))},toNamespacedPath(a){if(typeof a!="string"||a.length===0)return a;let i=Ms.resolve(a);if(i.length<=2)return a;if(i.charCodeAt(0)===GD){if(i.charCodeAt(1)===GD){let e=i.charCodeAt(2);if(e!==mLo&&e!==bre)return`\\\\?\\UNC\\${i.slice(2)}`}}else if(l$(i.charCodeAt(0))&&i.charCodeAt(1)===a$&&i.charCodeAt(2)===GD)return`\\\\?\\${i}`;return i},dirname(a){Ub(a,"path");let i=a.length;if(i===0)return".";let e=-1,t=0,o=a.charCodeAt(0);if(i===1)return Oc(o)?a:".";if(Oc(o)){if(e=t=1,Oc(a.charCodeAt(1))){let s=2,l=s;for(;s<i&&!Oc(a.charCodeAt(s));)s++;if(s<i&&s!==l){for(l=s;s<i&&Oc(a.charCodeAt(s));)s++;if(s<i&&s!==l){for(l=s;s<i&&!Oc(a.charCodeAt(s));)s++;if(s===i)return a;s!==l&&(e=t=s+1)}}}}else l$(o)&&a.charCodeAt(1)===a$&&(e=i>2&&Oc(a.charCodeAt(2))?3:2,t=e);let n=-1,r=!0;for(let s=i-1;s>=t;--s)if(Oc(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&&Ub(i,"suffix"),Ub(a,"path");let e=0,t=-1,o=!0,n;if(a.length>=2&&l$(a.charCodeAt(0))&&a.charCodeAt(1)===a$&&(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(Oc(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(Oc(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){Ub(a,"path");let i=0,e=-1,t=0,o=-1,n=!0,r=0;a.length>=2&&a.charCodeAt(1)===a$&&l$(a.charCodeAt(0))&&(i=t=2);for(let s=a.length-1;s>=i;--s){let l=a.charCodeAt(s);if(Oc(l)){if(!n){t=s+1;break}continue}o===-1&&(n=!1,o=s+1),l===bre?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:o1i.bind(null,"\\"),parse(a){Ub(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 Oc(o)?(i.root=i.dir=a,i):(i.base=i.name=a,i);if(Oc(o)){if(t=1,Oc(a.charCodeAt(1))){let p=2,h=p;for(;p<e&&!Oc(a.charCodeAt(p));)p++;if(p<e&&p!==h){for(h=p;p<e&&Oc(a.charCodeAt(p));)p++;if(p<e&&p!==h){for(h=p;p<e&&!Oc(a.charCodeAt(p));)p++;p===e?t=p:p!==h&&(t=p+1)}}}}else if(l$(o)&&a.charCodeAt(1)===a$){if(e<=2)return i.root=i.dir=a,i;if(t=2,Oc(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),Oc(o)){if(!l){r=c+1;break}continue}s===-1&&(l=!1,s=c+1),o===bre?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},fLo=(()=>{if($D){let a=/\\/g;return()=>{let i=fre().replace(a,"/");return i.slice(i.indexOf("/"))}}return()=>fre()})(),Lo={resolve(...a){let i="",e=!1;for(let t=a.length-1;t>=0&&!e;t--){let o=a[t];Ub(o,`paths[${t}]`),o.length!==0&&(i=`${o}/${i}`,e=o.charCodeAt(0)===Bw)}if(!e){let t=fLo();i=`${t}/${i}`,e=t.charCodeAt(0)===Bw}return i=upt(i,!e,"/",e9t),e?`/${i}`:i.length>0?i:"."},normalize(a){if(Ub(a,"path"),a.length===0)return".";let i=a.charCodeAt(0)===Bw,e=a.charCodeAt(a.length-1)===Bw;return a=upt(a,!i,"/",e9t),a.length===0?i?"/":e?"./":".":(e&&(a+="/"),i?`/${a}`:a)},isAbsolute(a){return Ub(a,"path"),a.length>0&&a.charCodeAt(0)===Bw},join(...a){if(a.length===0)return".";let i=[];for(let e=0;e<a.length;++e){let t=a[e];Ub(t,"path"),t.length>0&&i.push(t)}return i.length===0?".":Lo.normalize(i.join("/"))},relative(a,i){if(Ub(a,"from"),Ub(i,"to"),a===i||(a=Lo.resolve(a),i=Lo.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===Bw&&(l=c)}if(c===s)if(r>s){if(i.charCodeAt(n+c)===Bw)return i.slice(n+c+1);if(c===0)return i.slice(n+c)}else o>s&&(a.charCodeAt(e+c)===Bw?l=c:c===0&&(l=0));let u="";for(c=e+l+1;c<=t;++c)(c===t||a.charCodeAt(c)===Bw)&&(u+=u.length===0?"..":"/..");return`${u}${i.slice(n+l)}`},toNamespacedPath(a){return a},dirname(a){if(Ub(a,"path"),a.length===0)return".";let i=a.charCodeAt(0)===Bw,e=-1,t=!0;for(let o=a.length-1;o>=1;--o)if(a.charCodeAt(o)===Bw){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&&Ub(i,"suffix"),Ub(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===Bw){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)===Bw){if(!o){e=n+1;break}}else t===-1&&(o=!1,t=n+1);return t===-1?"":a.slice(e,t)},extname(a){Ub(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:o1i.bind(null,"/"),parse(a){Ub(a,"path");let i={root:"",dir:"",base:"",ext:"",name:""};if(a.length===0)return i;let e=a.charCodeAt(0)===Bw,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===Bw){if(!s){n=l+1;break}continue}r===-1&&(s=!1,r=l+1),u===bre?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};Lo.win32=Ms.win32=Ms;Lo.posix=Ms.posix=Lo;var th=$D?Ms.normalize:Lo.normalize,Xl=$D?Ms.isAbsolute:Lo.isAbsolute,Ld=$D?Ms.join:Lo.join,iN=$D?Ms.resolve:Lo.resolve,SM=$D?Ms.relative:Lo.relative,wc=$D?Ms.dirname:Lo.dirname,No=$D?Ms.basename:Lo.basename,Am=$D?Ms.extname:Lo.extname,pfn=$D?Ms.format:Lo.format,c$=$D?Ms.parse:Lo.parse,mfn=$D?Ms.toNamespacedPath:Lo.toNamespacedPath,Rd=$D?Ms.sep:Lo.sep,hfn=$D?Ms.delimiter:Lo.delimiter;var z0=class{constructor(i){this.task=i;this.result=null}get(){if(this.result)return this.result;let i=new $e,e=this.task(i.token);return this.result={promise:e,dispose:()=>{this.result=null,i.cancel(),i.dispose()}},this.result}};function t9t(a){return a}var Cbe=class{constructor(i,e){this.lastCache=void 0;this.lastArgKey=void 0;typeof i=="function"?(this._fn=i,this._computeKey=t9t):(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}},kI=class{constructor(i,e){this._map=new Map;this._map2=new Map;typeof i=="function"?(this._fn=i,this._computeKey=t9t):(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}},ppt=class{constructor(i,e){this._map=new WeakMap;typeof i=="function"?(this._fn=i,this._computeKey=t9t):(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 Sre(a){return a<0?0:a>255?255:a|0}function Ire(a){return a<0?0:a>4294967295?4294967295:a|0}function Jl(a){return!a||typeof a!="string"?!0:a.trim().length===0}var vLo=/{(\d+)}/g;function id(a,...i){return i.length===0?a:a.replace(vLo,function(e,t){let o=parseInt(t,10);return isNaN(o)||o<0||o>=i.length?e:i[o]})}var bLo=/{([^}]+)}/g;function PT(a,i){return Object.keys(i).length===0?a:a.replace(bLo,(e,t)=>i[t]??e)}function hpt(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 ur(a){return a.replace(/[<>&]/g,function(i){switch(i){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";default:return i}})}function Yr(a){return a.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function IM(a,i){let e=0,t=a.indexOf(i);for(;t!==-1;)e++,t=a.indexOf(i,t+i.length);return e}function oN(a,i,e=f1i){return a.length<=i?a:`${a.substr(0,i)}${e}`}function o9t(a,i,e=f1i){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 qD(a,i=" "){let e=Hw(a,i);return ih(e,i)}function Hw(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 ih(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 r1i(a){return a.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function u$(a,i,e={}){if(!a)throw new Error("Cannot create regex from empty string");i||(a=Yr(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 xbe(a){return a.source==="^"||a.source==="^$"||a.source==="$"||a.source==="^\\s*$"?!1:!!(a.exec("")&&a.lastIndex===0)}function s1i(a,i){return a.filter(e=>e!=null&&e!==!1).join(i)}function mc(a){return a.split(/\r\n|\r|\n/)}function a1i(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 Ap(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 bl(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 tv(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 Al(a,i){return a<i?-1:a>i?1:0}function kbe(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 Uw(a,i){return wre(a,i,0,a.length,0,i.length)}function wre(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 kbe(a.toLowerCase(),i.toLowerCase(),e,t,o,n);iU(l)&&(l-=32),iU(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 pGe(a){return a>=48&&a<=57}function iU(a){return a>=97&&a<=122}function Hk(a){return a>=65&&a<=90}function mr(a,i){return a.length===i.length&&wre(a,i)===0}function l1i(a,i,e){return a===i||!!e&&a!==void 0&&i!==void 0&&mr(a,i)}function Uk(a,i){let e=i.length;return e<=a.length&&wre(a,i,0,e)===0}function gpt(a,i){let e=a.length,t=e-i.length;return t>=0&&wre(a,i,t,e)===0}function Ng(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 zw(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 Ru(a){return 55296<=a&&a<=56319}function nN(a){return 56320<=a&&a<=57343}function fpt(a,i){return(a-55296<<10)+(i-56320)+65536}function Ebe(a,i,e){let t=a.charCodeAt(e);if(Ru(t)&&e+1<i){let o=a.charCodeAt(e+1);if(nN(o))return fpt(t,o)}return t}function SLo(a,i){let e=a.charCodeAt(i-1);if(nN(e)&&i>1){let t=a.charCodeAt(i-2);if(Ru(t))return fpt(t,e)}return e}var yre=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=SLo(this._str,this._offset);return this._offset-=i>=65536?2:1,i}nextCodePoint(){let i=Ebe(this._str,this._len,this._offset);return this._offset+=i>=65536?2:1,i}eol(){return this._offset>=this._len}},d$=class{get offset(){return this._iterator.offset}constructor(i,e=0){this._iterator=new yre(i,e)}nextGraphemeLength(){let i=mpt.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(n1i(o,r)){e.setOffset(n);break}o=r}return e.offset-t}prevGraphemeLength(){let i=mpt.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(n1i(r,o)){e.setOffset(n);break}o=r}return t-e.offset}eol(){return this._iterator.eol()}};function Tbe(a,i){return new d$(a,i).nextGraphemeLength()}function n9t(a,i){return new d$(a,i).prevGraphemeLength()}function vpt(a,i){i>0&&nN(a.charCodeAt(i))&&i--;let e=i+Tbe(a,i);return[e-n9t(a,e),e]}var i9t;function ILo(){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 yM(a){return i9t||(i9t=ILo()),i9t.test(a)}var yLo=/^[\t\n\r\x20-\x7E]*$/;function oU(a){return yLo.test(a)}var r9t=/[\u2028\u2029]/;function bpt(a){return r9t.test(a)}function AT(a){return a>=11904&&a<=55215||a>=63744&&a<=64255||a>=65281&&a<=65374||a>=65504&&a<=65510}function mGe(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 c1i(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 s9t(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 wLo=/(?:\x1b\[|\x9b)[=?>!]?[\d;:]*["$#'* ]?[a-zA-Z@^`{}|~]/,CLo=/(?:\x1b\]|\x9d).*?(?:\x1b\\|\x07|\x9c)/,xLo=/\x1b(?:[ #%\(\)\*\+\-\.\/]?[a-zA-Z0-9\|}~@])/,d1i=new RegExp("(?:"+[wLo.source,CLo.source,xLo.source].join("|")+")","g");function*u1i(a){let i=0;for(let e of a.matchAll(d1i))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 CS(a){return a&&(a=a.replace(d1i,"")),a}var kLo=/\\\[.*?\\\]/g;function p1i(a){return CS(a).replace(kLo,"")}var m1i=String.fromCharCode(65279);function Spt(a){return!!(a&&a.length>0&&a.charCodeAt(0)===65279)}function hGe(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 gGe(a,i=!1){return a?(i&&(a=a.replace(/\\./g,"")),a.toLowerCase()!==a):!1}function Cre(a){return a.charAt(0).toUpperCase()+a.slice(1)}function h1i(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 _be(a){let i=26;return a=a%(2*i),a<i?String.fromCharCode(97+a):String.fromCharCode(65+a-i)}function n1i(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 mpt=class a{static{this._INSTANCE=null}static getInstance(){return a._INSTANCE||(a._INSTANCE=new a),a._INSTANCE}constructor(){this._data=ELo()}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 ELo(){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 g1i(a,i){if(a===0)return 0;let e=TLo(a,i);if(e!==void 0)return e;let t=new yre(i,a);return t.prevCodePoint(),t.offset}function TLo(a,i){let e=new yre(i,a),t=e.prevCodePoint();for(;_Lo(t)||t===65039||t===8419;){if(e.offset===0)return;t=e.prevCodePoint()}if(!mGe(t))return;let o=e.offset;return o>0&&e.prevCodePoint()===8205&&(o=e.offset),o}function _Lo(a){return 127995<=a&&a<=127999}var rN="\xA0",p6=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 Cbe(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())}},K0=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()}},f1i="\u2026";function DLo(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 m6(a){return btoa(DLo(a))}function h6(a){return a===47||a===92}function p$(a){return a.replace(/[\\/]/g,Lo.sep)}function v1i(a){return a.indexOf("/")===-1&&(a=p$(a)),/^[a-zA-Z]:(\/|$)/.test(a)&&(a="/"+a),a}function a9t(a,i=Lo.sep){if(!a)return"";let e=a.length,t=a.charCodeAt(0);if(h6(t)){if(h6(a.charCodeAt(1))&&!h6(a.charCodeAt(2))){let n=3,r=n;for(;n<e&&!h6(a.charCodeAt(n));n++);if(r!==n&&!h6(a.charCodeAt(n+1))){for(n+=1;n<e;n++)if(h6(a.charCodeAt(n)))return a.slice(0,n+1).replace(/[\\/]/g,i)}}return i}else if(S1i(t)&&a.charCodeAt(1)===58)return h6(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(h6(a.charCodeAt(o)))return a.slice(0,o+1)}return""}function g6(a){if(!ri||!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 LLo=/[\\/:\*\?"<>\|]/g,RLo=/[/]/g,MLo=/^(con|prn|aux|clock\$|nul|lpt[0-9]|com[0-9])(\.(.*?))?$/i;function nU(a,i=ri){let e=i?LLo:RLo;return!(!a||a.length===0||/^\s+$/.test(a)||(e.lastIndex=0,e.test(a))||i&&MLo.test(a)||a==="."||a===".."||i&&a[a.length-1]==="."||i&&a.length!==a.trim().length||a.length>255)}function b1i(a,i,e){let t=a===i;return!e||t?t:!a||!i?!1:mr(a,i)}function rU(a,i,e,t=Rd){if(a===i)return!0;if(!a||!i||i.length>a.length)return!1;if(e){if(!Uk(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 S1i(a){return a>=65&&a<=90||a>=97&&a<=122}function I1i(a){return ri?(a=ih(a,Rd),a.endsWith(":")&&(a+=Rd)):(a=ih(a,Rd),a||(a=Rd)),a}function f6(a,i=ri){return i?S1i(a.charCodeAt(0))&&a.charCodeAt(1)===58:!1}function y1i(a,i=ri){return f6(a,i)?a[0]:void 0}function Dbe(a,i,e){return i.length>a.length?-1:a===i?0:(e&&(a=a.toLowerCase(),i=i.toLowerCase()),a.indexOf(i))}function w1i(a){let i=a.split(":"),e,t,o;for(let n of i){let r=Number(n);Xo(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 PLo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",ALo="BDEFGHIJKMOQRSTUVWXYZbdefghijkmoqrstuvwxyz0123456789";function Lbe(a,i,e=8){let t="";for(let n=0;n<e;n++){let r;n===0&&ri&&!i&&(e===3||e===4)?r=ALo:r=PLo,t+=r.charAt(Math.floor(Math.random()*r.length))}let o;return i?o=`${i}-${t}`:o=t,a?Ld(a,o):o}var NLo=/^\w[\w\d+.-]*$/,OLo=/^\//,FLo=/^\/\//;function WLo(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&&!NLo.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(!OLo.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(FLo.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 VLo(a,i){return!a&&!i?"file":a}function BLo(a,i){switch(a){case"https":case"http":case"file":i?i[0]!==G0&&(i=G0+i):i=G0;break}return i}var ng="",G0="/",HLo=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,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||ng,this.authority=i.authority||ng,this.path=i.path||ng,this.query=i.query||ng,this.fragment=i.fragment||ng):(this.scheme=VLo(i,r),this.authority=e||ng,this.path=BLo(this.scheme,t||ng),this.query=o||ng,this.fragment=n||ng,WLo(this,r))}get fsPath(){return xre(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=ng),t===void 0?t=this.authority:t===null&&(t=ng),o===void 0?o=this.path:o===null&&(o=ng),n===void 0?n=this.query:n===null&&(n=ng),r===void 0?r=this.fragment:r===null&&(r=ng),e===this.scheme&&t===this.authority&&o===this.path&&n===this.query&&r===this.fragment?this:new v6(e,t,o,n,r)}static parse(i,e=!1){let t=HLo.exec(i);return t?new v6(t[2]||ng,Ipt(t[4]||ng),Ipt(t[5]||ng),Ipt(t[7]||ng),Ipt(t[9]||ng),e):new v6(ng,ng,ng,ng,ng)}static file(i){let e=ng;if(ri&&(i=i.replace(/\\/g,G0)),i[0]===G0&&i[1]===G0){let t=i.indexOf(G0,2);t===-1?(e=i.substring(2),i=G0):(e=i.substring(2,t),i=i.substring(t)||G0)}return new v6("file",e,i,ng,ng)}static from(i,e){return new v6(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 ri&&i.scheme==="file"?t=a.file(Ms.join(xre(i,!0),...e)).path:t=Lo.join(i.path,...e),i.with({path:t})}toString(i=!1){return l9t(this,i)}toJSON(){return this}static revive(i){if(i){if(i instanceof a)return i;{let e=new v6(i);return e._formatted=i.external??null,e._fsPath=i._sep===E1i?i.fsPath??null:null,e}}else return i}[Symbol.for("debug.description")](){return`URI(${this.toString()})`}};function oh(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 E1i=ri?1:void 0,v6=class extends A{constructor(){super(...arguments);this._formatted=null;this._fsPath=null}get fsPath(){return this._fsPath||(this._fsPath=xre(this,!1)),this._fsPath}toString(e=!1){return e?l9t(this,!0):(this._formatted||(this._formatted=l9t(this,!1)),this._formatted)}toJSON(){let e={$mid:1};return this._fsPath&&(e.fsPath=this._fsPath,e._sep=E1i),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}},T1i={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 x1i(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=T1i[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 ULo(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+=T1i[t]):i!==void 0&&(i+=a[e])}return i!==void 0?i:a}function xre(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,ri&&(e=e.replace(/\//g,"\\")),e}function l9t(a,i){let e=i?ULo:x1i,t="",{scheme:o,authority:n,path:r,query:s,fragment:l}=a;if(o&&(t+=o,t+=":"),(n||o==="file")&&(t+=G0,t+=G0),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:x1i(l,!1,!1)),t}function _1i(a){try{return decodeURIComponent(a)}catch{return a.length>3?a.substr(0,3)+_1i(a.substr(3)):a}}var k1i=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function Ipt(a){return a.match(k1i)?a.replace(k1i,i=>_1i(i)):a}var Y;(en=>(en.inMemory="inmemory",en.vscode="vscode",en.internal="private",en.walkThrough="walkThrough",en.walkThroughSnippet="walkThroughSnippet",en.http="http",en.https="https",en.file="file",en.mailto="mailto",en.untitled="untitled",en.data="data",en.command="command",en.vscodeRemote="vscode-remote",en.vscodeRemoteResource="vscode-remote-resource",en.vscodeManagedRemoteResource="vscode-managed-remote-resource",en.vscodeUserData="vscode-userdata",en.vscodeCustomEditor="vscode-custom-editor",en.vscodeNotebookCell="vscode-notebook-cell",en.vscodeNotebookCellMetadata="vscode-notebook-cell-metadata",en.vscodeNotebookCellMetadataDiff="vscode-notebook-cell-metadata-diff",en.vscodeNotebookCellOutput="vscode-notebook-cell-output",en.vscodeNotebookCellOutputDiff="vscode-notebook-cell-output-diff",en.vscodeNotebookMetadata="vscode-notebook-metadata",en.vscodeInteractiveInput="vscode-interactive-input",en.vscodeSettings="vscode-settings",en.vscodeWorkspaceTrust="vscode-workspace-trust",en.vscodeTerminal="vscode-terminal",en.vscodeChatCodeBlock="vscode-chat-code-block",en.vscodeChatCodeCompareBlock="vscode-chat-code-compare-block",en.vscodeChatEditor="vscode-chat-editor",en.vscodeChatInput="chatSessionInput",en.vscodeLocalChatSession="vscode-chat-session",en.webviewPanel="webview-panel",en.vscodeWebview="vscode-webview",en.vscodeBrowser="vscode-browser",en.extension="extension",en.vscodeFileResource="vscode-file",en.tmp="tmp",en.vsls="vsls",en.vscodeSourceControl="vscode-scm",en.commentsInput="comment",en.codeSetting="code-setting",en.outputChannel="output",en.accessibleView="accessible-view",en.chatEditingSnapshotScheme="chat-editing-snapshot-text-model",en.chatEditingModel="chat-editing-text-model",en.copilotPr="copilot-pr"))(Y||={});function jd(a,i){return A.isUri(a)?mr(a.scheme,i):Uk(a,i+":")}function $0(a,...i){return i.some(e=>jd(a,e))}var zLo="tkn",c9t=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=Lo.join(e??"/",KLo(i))}getServerRootPath(){return this._serverRootPath}get _remoteResourcesPath(){return Lo.join(this._serverRootPath,Y.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+=`&${zLo}=${encodeURIComponent(n)}`),A.from({scheme:Gt?this._preferredWebSchema:Y.vscodeRemoteResource,authority:`${t}:${o}`,path:this._remoteResourcesPath,query:r})}},jD=new c9t;function KLo(a){return`${a.quality??"oss"}-${a.commit??"dev"}`}var D1i="vs/../../extensions",sN="vs/../../node_modules",b6="vs/../../node_modules.asar",ypt="vs/../../node_modules.asar.unpacked",u9t="vscode-app",d9t=class a{static{this.FALLBACK_AUTHORITY=u9t}asBrowserUri(i){let e=this.toUri(i);return this.uriToBrowserUri(e)}uriToBrowserUri(i){return i.scheme===Y.vscodeRemote?jD.rewrite(i):i.scheme===Y.file&&(kr||PUi===`${Y.vscodeFileResource}://${a.FALLBACK_AUTHORITY}`)?i.with({scheme:Y.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===Y.vscodeFileResource?i.with({scheme:Y.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=Ld(e,i);return A.file(t)}throw new Error("Cannot determine URI for module id!")}},gn=new d9t,Ofn=Object.freeze({"Cache-Control":"no-cache, no-store"}),Ffn=Object.freeze({"Document-Policy":"include-js-call-stacks-in-crash-reports"}),kre;(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})(kre||={});function q0(a){return xre(a,!0)}var Ere=class{constructor(i){this._ignorePathCasing=i}compare(i,e,t=!1){return i===e?0:Al(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===Y.file)return rU(q0(i),q0(e),this._ignorePathCasing(i))&&i.query===e.query&&(t||i.fragment===e.fragment);if(S6(i.authority,e.authority))return rU(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 Ye(i)||i.authority}basename(i){return Lo.basename(i.path)}extname(i){return Lo.extname(i.path)}dirname(i){if(i.path.length===0)return i;let e;return i.scheme===Y.file?e=A.file(wc(q0(i))).path:(e=Lo.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===Y.file?e=A.file(th(q0(i))).path:e=Lo.normalize(i.path),i.with({path:e})}relativePath(i,e){if(i.scheme!==e.scheme||!S6(i.authority,e.authority))return;if(i.scheme===Y.file){let n=SM(q0(i),q0(e));return ri?p$(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 Lo.relative(t,o)}resolvePath(i,e){if(i.scheme===Y.file){let t=A.file(iN(q0(i),e));return i.with({authority:t.authority,path:t.path})}return e=v1i(e),i.with({path:Lo.resolve(i.path,e)})}isAbsolutePath(i){return!!i.path&&i.path[0]==="/"}isEqualAuthority(i,e){return i===e||i!==void 0&&e!==void 0&&mr(i,e)}hasTrailingPathSeparator(i,e=Rd){if(i.scheme===Y.file){let t=q0(i);return t.length>a9t(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=Rd){return Tre(i,e)?i.with({path:i.path.substr(0,i.path.length-1)}):i}addTrailingPathSeparator(i,e=Rd){let t=!1;if(i.scheme===Y.file){let o=q0(i);t=o!==void 0&&o.length===a9t(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&&!Tre(i,e)?i.with({path:i.path+"/"}):i}},ar=new Ere(()=>!1),m$=new Ere(a=>a.scheme===Y.file?!Wn:!0),dx=new Ere(a=>!0),Xe=ar.isEqual.bind(ar),La=ar.isEqualOrParent.bind(ar),zfn=ar.getComparisonKey.bind(ar),Ra=ar.basenameOrAuthority.bind(ar),Ye=ar.basename.bind(ar),ms=ar.extname.bind(ar),ci=ar.dirname.bind(ar),je=ar.joinPath.bind(ar),_re=ar.normalizePath.bind(ar),Fc=ar.relativePath.bind(ar),m9t=ar.resolvePath.bind(ar),wpt=ar.isAbsolutePath.bind(ar),S6=ar.isEqualAuthority.bind(ar),Tre=ar.hasTrailingPathSeparator.bind(ar),Rbe=ar.removeTrailingPathSeparator.bind(ar),h$=ar.addTrailingPathSeparator.bind(ar);function fGe(a,i){let e=[];for(let t=0;t<a.length;t++){let o=i(a[t]);a.some((n,r)=>r===t?!1:La(o,i(n)))||e.push(a[t])}return e}var g$;(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})(g$||={});function Og(a,i,e){if(i){let t=a.path;return t&&t[0]!==Lo.sep&&(t=Lo.sep+t),a.with({scheme:e,authority:i,path:t})}return a.with({scheme:e})}var QD=Symbol("MicrotaskDelay");function FT(a){return!!a&&typeof a.then=="function"}function xn(a){let i=new $e,e=a(i.token),t=!1,o=new Promise((n,r)=>{let s=i.token.onCancellationRequested(()=>{t=!0,s.dispose(),r(new ho)});Promise.resolve(e).then(l=>{s.dispose(),i.dispose(),t?Ac(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 wa(a,i,e){return new Promise((t,o)=>{let n=i.onCancellationRequested(()=>{n.dispose(),t(e)});a.then(t,o).finally(()=>n.dispose())})}function pm(a,i){return new Promise((e,t)=>{let o=i.onCancellationRequested(()=>{o.dispose(),t(new ho)});a.then(e,t).finally(()=>o.dispose())})}function L1i(a){return new Promise((i,e)=>{a.then(i,e)})}function Dre(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 Wp(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 TI(){let a,i;return{promise:new Promise((t,o)=>{a=t,i=o}),resolve:a,reject:i}}var um=class{constructor(){this.activePromise=null,this.queuedPromise=null,this.queuedPromiseFactory=null,this.cancellationTokenSource=new $e}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()}},Nm=class{constructor(){this.current=Promise.resolve(null)}queue(i){return this.current=this.current.then(()=>i(),()=>i())}},NT=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()}},GLo=(a,i)=>{let e=!0,t=setTimeout(()=>{e=!1,i()},a);return{isTriggered:()=>e,dispose:()=>{clearTimeout(t),e=!1}}},$Lo=a=>{let i=!0;return queueMicrotask(()=>{i&&(i=!1,a())}),{isTriggered:()=>i,dispose:()=>{i=!1}}},jo=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===QD?$Lo(t):GLo(e,t),this.completionPromise}isTriggered(){return!!this.deferred?.isTriggered()}cancel(){this.cancelTimeout(),this.completionPromise&&(this.doReject?.(new ho),this.completionPromise=null)}cancelTimeout(){this.deferred?.dispose(),this.deferred=null}dispose(){this.cancel()}},ya=class{constructor(i){this.delayer=new jo(i),this.throttler=new um}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()}},Np=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}},f$=class extends Np{constructor(i){super(),this._timeout=setTimeout(()=>this.open(),i)}open(){clearTimeout(this._timeout),super.open()}};function Pi(a,i){return i?new Promise((e,t)=>{let o=setTimeout(()=>{n.dispose(),e()},a),n=i.onCancellationRequested(()=>{clearTimeout(o),n.dispose(),t(new ho)})}):xn(e=>Pi(a,e))}function nn(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 Tpt(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 Lre(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 OT=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?H.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()}},Op=class extends OT{constructor(){super(1)}};var sU=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 Go;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 Op;let r=this.drainListenerCount++,s=H.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 jt),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()}},Pbe=class{constructor(){this._runningTask=void 0;this._pendingTasks=[]}schedule(i){let e=new Go;return this._pendingTasks.push({task:i,deferred:e,setUndefinedWhenCleared:!1}),this._runIfNotRunning(),e.p}scheduleSkipIfCleared(i){let e=new Go;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 ni;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 ho)}},Nl=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 ni("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 ni("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===void 0&&(this._token=setTimeout(()=>{this._token=void 0,i()},e))}},EI=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 ni("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 wM=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 aN,Mbe;(function(){let a=globalThis;typeof a.requestIdleCallback!="function"||typeof a.cancelIdleCallback!="function"?Mbe=(i,e,t)=>{Vw(()=>{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)}}}:Mbe=(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))}}},aN=(i,e)=>Mbe(globalThis,i,e)})();var vGe=class{constructor(i,e){this._didRun=!1;this._executor=()=>{try{this._value=e()}catch(t){this._error=t}finally{this._didRun=!0}},this._handle=Mbe(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}},v$=class extends vGe{constructor(i){super(globalThis,i)}};async function R1i(a,i,e){let t;for(let o=0;o<e;o++)try{return await a()}catch(n){t=n,await Pi(i)}throw t}var Abe=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}=TI();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}},Cpt=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 Go=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 ho)}},fn;(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})(fn||={});var h9t=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 ni("Promise is not resolved yet");if(this._error)throw this._error;return this._value}},xpt=class{constructor(i){this._compute=i;this._promise=new co(()=>new h9t(this._compute()))}requireValue(){return this._promise.value.requireValue()}getPromise(){return this._promise.value.promise}get currentValue(){return this._promise.rawValue?.value}};var g9t=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 H.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 M1i(a){let i=new $e,e=a(i.token);return new v9t(i,async t=>{let o=i.token.onCancellationRequested(()=>{o.dispose(),i.dispose(),t.reject(new ho)});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 kpt=class{constructor(i){this._deferred=new Go;this._asyncIterable=new g9t(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 f9t=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 ni("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 Go;return this._unsatisfiedConsumers.push(i),i.p}}},Fp=class a{constructor(i,e){this._onReturn=e;this._producerConsumer=new f9t;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 Go,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}},v9t=class extends Fp{constructor(e,t){super(t);this._source=e}cancel(){this._source.cancel()}},I6=Symbol("AsyncReaderEndOfStream"),Ept=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?I6:this._buffer.shift()}async readWhile(i,e){do{let t=await this.peek();if(t===I6||!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?I6:this._buffer[0]}peekBufferedOrThrow(){if(this._buffer.length===0){if(this._atEnd)return I6;throw new ni("No buffered elements")}return this._buffer[0]}async peekTimeout(i){if(this._buffer.length===0&&!this._atEnd&&await Wp(this._extendBuffer(),i),this._atEnd)return I6;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 y6(a){let i=a;return i?[i.on,i.pause,i.resume,i.destroy].every(e=>typeof e=="function"):!1}function _pt(a){let i=a;return i?y6(i.stream)&&Array.isArray(i.buffer)&&typeof i.ended=="boolean":!1}function _I(a,i){return new b9t(a,i)}var b9t=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 P1i(a,i){let e=[],t;for(;(t=a.read())!==null;)e.push(t);return i(e)}function A1i(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 w6(a,i){return new Promise((e,t)=>{let o=[];j0(a,{onData:n=>{i&&o.push(n)},onError:n=>{i?t(n):e(void 0)},onEnd:()=>{e(i?i(o):void 0)}})})}function j0(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 Dpt(a,i){return new Promise((e,t)=>{let o=new P,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 N1i(a,i){let e=_I(i);return e.end(a),e}function O1i(){let a=_I(()=>{throw new Error("not supported")});return a.end(),a}function F1i(a){let i=!1;return{read:()=>i?null:(i=!0,a)}}function S9t(a,i,e){let t=_I(e);return j0(a,{onData:o=>t.write(i.data(o)),onError:o=>t.error(i.error?i.error(o):o),onEnd:()=>t.end()}),t}function W1i(a,i,e){let t=!1;return{read:()=>{let o=i.read();return t?o:(t=!0,o!==null?e([a,o]):a)}}}function V1i(a,i,e){let t=!1,o=_I(e);return j0(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 bGe=typeof Buffer<"u",QLo=new co(()=>new Uint8Array(256)),I9t,y9t,Je=class a{static alloc(i){return bGe?new a(Buffer.allocUnsafe(i)):new a(new Uint8Array(i))}static wrap(i){return bGe&&!Buffer.isBuffer(i)&&(i=Buffer.from(i.buffer,i.byteOffset,i.byteLength)),new a(i)}static fromString(i,e){return!(e?.dontUseNodeBuffer||!1)&&bGe?new a(Buffer.from(i)):(I9t||(I9t=new TextEncoder),new a(I9t.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 bGe&&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 bGe?this.buffer.toString():(y9t||(y9t=new TextDecoder(void 0,{ignoreBOM:!0})),y9t.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 DI(this.buffer,i)}writeUInt32BE(i,e){LI(this.buffer,i,e)}readUInt32LE(i){return XLo(this.buffer,i)}writeUInt32LE(i,e){JLo(this.buffer,i,e)}readUInt8(i){return Lpt(this.buffer,i)}writeUInt8(i,e){Rpt(this.buffer,i,e)}indexOf(i,e=0){return YLo(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 YLo(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=QLo.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 U1i(a,i){return a[i+0]<<0>>>0|a[i+1]<<8>>>0}function z1i(a,i,e){a[e+0]=i&255,i=i>>>8,a[e+1]=i&255}function DI(a,i){return a[i]*2**24+a[i+1]*2**16+a[i+2]*2**8+a[i+3]}function LI(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 XLo(a,i){return a[i+0]<<0>>>0|a[i+1]<<8>>>0|a[i+2]<<16>>>0|a[i+3]<<24>>>0}function JLo(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 Lpt(a,i){return a[i]}function Rpt(a,i,e){a[e]=i}function Mpt(a){return P1i(a,i=>Je.concat(i))}function Nbe(a){return F1i(a)}function Kv(a){return w6(a,i=>Je.concat(i))}async function K1i(a){return a.ended?Je.concat(a.buffer):Je.concat([...a.buffer,await Kv(a.stream)])}function WT(a){return N1i(a,i=>Je.concat(i))}function Obe(a){return _I(i=>Je.concat(i),a)}function G1i(a,i){return W1i(a,i,e=>Je.concat(e))}function w9t(a,i){return V1i(a,i,e=>Je.concat(e))}function Sl(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 Je.wrap(o).slice(0,r)}var ZLo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",eRo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";function Qd({buffer:a},i=!0,e=!1){let t=e?eRo:ZLo,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 B1i="0123456789abcdef";function b$({buffer:a}){let i="";for(let e=0;e<a.length;e++){let t=a[e];i+=B1i[t>>>4],i+=B1i[t&15]}return i}function Fbe(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]=H1i(a,e++)<<4|H1i(a,e++);return Je.wrap(i)}function H1i(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 Ir(a){return SGe(a,0)}function SGe(a,i){switch(typeof a){case"object":return a===null?S$(349,i):Array.isArray(a)?iRo(a,i):oRo(a,i);case"string":return Vbe(a,i);case"boolean":return tRo(a,i);case"number":return S$(a,i);case"undefined":return S$(937,i);default:return S$(617,i)}}function S$(a,i){return(i<<5)-i+a|0}function tRo(a,i){return S$(a?433:863,i)}function Vbe(a,i){i=S$(149417,i);for(let e=0,t=a.length;e<t;e++)i=S$(a.charCodeAt(e),i);return i}function iRo(a,i){return i=S$(104579,i),a.reduce((e,t)=>SGe(t,e),i)}function oRo(a,i){return i=S$(181387,i),Object.keys(a).sort().reduce((e,t)=>(e=Vbe(t,e),SGe(a[t],e)),i)}var Q0=a=>{if(typeof a=="string"&&a.length<250){let e=new Ly;return e.update(a),Promise.resolve(e.digest())}let i;return typeof a=="string"?i=new TextEncoder().encode(a):a instanceof Je?i=a.buffer:i=a,crypto.subtle.digest("sha-1",i).then(Wbe)};function x9t(a,i,e=32){let t=e-i,o=~((1<<t)-1);return(a<<i|(o&a)>>>t)>>>0}function Wbe(a,i=32){return a instanceof ArrayBuffer?b$(Je.wrap(new Uint8Array(a))):(a>>>0).toString(16).padStart(i/4,"0")}var Ly=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(Ru(r))if(s+1<e){let c=i.charCodeAt(s+1);nN(c)?(s++,l=fpt(r,c)):l=65533}else{n=r;break}else nN(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()),Wbe(this._h0)+Wbe(this._h1)+Wbe(this._h2)+Wbe(this._h3)+Wbe(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,x9t(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=x9t(t,5)+l+s+c+i.getUint32(p*4,!1)&4294967295,s=r,r=n,n=x9t(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 Kn(a,i,e){return Math.min(Math.max(a,i),e)}function Y0(a,i){return(i+a%i)%i}var IGe=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}},Ppt=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 $1i(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 q1i(a){return Ey(a>=0&&a<=1,"p must be between 0 and 1"),Math.random()<a}var Pu=class{constructor(i,e,t){this.owner=i;this.debugNameSource=e;this.referenceFn=t}getDebugName(i){return E9t(i,this)}},j1i=new Map,k9t=new WeakMap;function E9t(a,i){let e=k9t.get(a);if(e)return e;let t=nRo(a,i);if(t){let o=j1i.get(t)??0;o++,j1i.set(t,o);let n=o===1?t:`${t}#${o}`;return k9t.set(a,n),n}}function nRo(a,i){let e=k9t.get(a);if(e)return e;let t=i.owner?sRo(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=yGe(r),o!==void 0))return t+o;if(i.owner!==void 0){let s=rRo(i.owner,a);if(s!==void 0)return t+s}}function rRo(a,i){for(let e in a)if(a[e]===i)return e}var Q1i=new Map,Y1i=new WeakMap;function sRo(a){let i=Y1i.get(a);if(i)return i;let e=T9t(a)??"Object",t=Q1i.get(e)??0;t++,Q1i.set(e,t);let o=t===1?e:`${e}#${t}`;return Y1i.set(a,o),o}function T9t(a){let i=a.constructor;if(i)return i.name==="Object"?void 0:i.name}function yGe(a){let i=a.toString(),t=/\/\*\*\s*@description\s*([^*]*)\*\//.exec(i);return(t?t[1]:void 0)?.trim()}function hf(a,i){return a===i}function aRo(){return(a,i)=>a===i}function D9t(a,i,e){return $i(a,i,e??hf)}function lN(a){return(i,e)=>$i(i,e,a??hf)}function VT(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(!VT(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)||!VT(e[s],t[s]))return!1;return!0}return!1}function lRo(){return(a,i)=>VT(a,i)}function J1i(a){return JSON.stringify(_9t(a))}var cRo=0,X1i=new WeakMap;function _9t(a){if(Array.isArray(a))return a.map(_9t);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]=_9t(i[t]);return e}else{let i=X1i.get(a);return i===void 0&&(i=cRo++,X1i.set(a,i)),i+"----2b76a038c20c4bcc"}return a}function dRo(a,i){return JSON.stringify(a)===JSON.stringify(i)}function uRo(){return(a,i)=>JSON.stringify(a)===JSON.stringify(i)}function C6(){return(a,i)=>a.equals(i)}function L9t(a,i,e){return a==null||i===void 0||i===null?i===a:e(a,i)}function aU(a){return(i,e)=>i==null||e===void 0||e===null?e===i:a(i,e)}var Apt;(p=>(p.strict=hf,p.strictC=aRo,p.array=D9t,p.arrayC=lN,p.structural=VT,p.structuralC=lRo,p.jsonStringify=dRo,p.jsonStringifyC=uRo,p.thisC=C6,p.ifDefined=L9t,p.ifDefinedC=aU))(Apt||={});function R9t(a){let i=new Error("BugIndicatingErrorRecovery: "+a);mt(i),console.error("recovered from an error that indicates a bug",i)}var Rre;function wGe(a){Rre?Rre instanceof Npt?Rre.loggers.push(a):Rre=new Npt([Rre,a]):Rre=a}function Ph(){return Rre}var M9t;function Z1i(a){M9t=a}function ezi(a){M9t&&M9t(a)}var Npt=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 Ui(a,i){let e=new cN(a,i);try{a(e)}finally{e.finish()}}var Opt;function x6(a){if(Opt)a(Opt);else{let i=new cN(a,void 0);Opt=i;try{a(i)}finally{i.finish(),Opt=void 0}}}async function P9t(a,i){let e=new cN(a,i);try{await a(e)}finally{e.finish()}}function dN(a,i,e){a?i(a):Ui(i,e)}var cN=class{constructor(i,e){this._fn=i;this._getDebugName=e;this._updatingObservers=[];Ph()?.handleBeginTransaction(this)}getDebugName(){return this._getDebugName?this._getDebugName():yGe(this._fn)}updateObserver(i,e){if(!this._updatingObservers){R9t("Transaction already finished!"),Ui(t=>{t.updateObserver(i,e)});return}this._updatingObservers.push({observer:i,observable:e}),i.beginUpdate(e)}finish(){let i=this._updatingObservers;if(!i){R9t("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,Ph()?.handleEndTransaction(this)}debugGetUpdatingObservers(){return this._updatingObservers}};var Il;(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,A9t.fromStack(r,2)}t.ofCaller=e})(Il||={});var A9t=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=pRo(t[e+1]);if(o)return new a(o.fileName,o.line,o.column,o.id)}};function pRo(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 N9t;function tzi(a){N9t=a}var izi;function ozi(a){izi=a}var nzi;function rzi(a){nzi=a}var O9t;function szi(a){O9t=a}var CGe=class{get TChange(){return null}reportChanges(){this.get()}read(i){return i?i.readObservable(this):this.get()}map(i,e,t=Il.ofCaller()){let o=e===void 0?void 0:i,n=e===void 0?i:e;return N9t({owner:o,debugName:()=>{let r=yGe(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 N9t({owner:void 0,debugName:()=>`${this.debugName} (flattened)`},i=>this.read(i).read(i))}recomputeInitiallyAndOnChange(i,e){return i.add(izi(this,e)),this}keepObserved(i){return i.add(nzi(this)),this}get debugValue(){return this.get()}get debug(){return new F9t(this)}},F9t=class{constructor(i){this.observable=i}getDependencyGraph(){return O9t(this.observable,{type:"dependencies"})}getObserverGraph(){return O9t(this.observable,{type:"observers"})}},YD=class extends CGe{constructor(e){super();this._observers=new Set;Ph()?.handleObservableCreated(this,e)}addObserver(e){let t=this._observers.size;this._observers.add(e),t===0&&this.onFirstObserverAdded(),t!==this._observers.size&&Ph()?.handleOnListenerCountChanged(this,this._observers.size)}removeObserver(e){let t=this._observers.delete(e);t&&this._observers.size===0&&this.onLastObserverRemoved(),t&&Ph()?.handleOnListenerCountChanged(this,this._observers.size)}onFirstObserverAdded(){}onLastObserverRemoved(){}log(){let e=!!Ph();return ezi(this),e||Ph()?.handleObservableCreated(this,Il.ofCaller()),this}debugGetObservers(){return this._observers}};function Le(a,i,e=Il.ofCaller()){let t;return typeof a=="string"?t=new Pu(void 0,a,void 0):t=new Pu(a,void 0,void 0),new CM(t,i,hf,e)}var CM=class extends YD{constructor(e,t,o,n){super(n);this._debugNameData=e;this._equalityComparator=o;this._value=t,Ph()?.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 cN(()=>{},()=>`Setting ${this.debugName}`));try{let r=this._value;this._setValue(e),Ph()?.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 X0(a,i,e=Il.ofCaller()){let t;return typeof a=="string"?t=new Pu(void 0,a,void 0):t=new Pu(a,void 0,void 0),new W9t(t,i,hf,e)}var W9t=class extends CM{_setValue(i){this._value!==i&&(this._value&&this._value.dispose(),this._value=i)}dispose(){this._value?.dispose()}};var Fpt=class extends YD{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){Ph()?.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{Ph()?.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 cN(()=>{},()=>`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 rg(a,i,e=Il.ofCaller()){return a.lazy?new Fpt(new Pu(a.owner,a.debugName,void 0),i,a.equalsFn??hf,e):new CM(new Pu(a.owner,a.debugName,void 0),i,a.equalsFn??hf,e)}function mRo(a){switch(a){case 1:return"dependenciesMightHaveChanged";case 2:return"stale";case 3:return"upToDate";default:return"<unknown>"}}var J0=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),Ph()?.handleAutorunCreated(this,o),this._run(),i$(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(),Ph()?.handleAutorunDisposed(this),o$(this)}}_run(){let i=this._dependenciesToBeRemoved;this._dependenciesToBeRemoved=this._dependencies,this._dependencies=i,this._state=3;try{if(!this._disposed){Ph()?.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){o6(o)}finally{this._isRunning=!1,t!==void 0&&t.dispose()}}}finally{this._disposed||Ph()?.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--}eh(()=>this._updateCount>=0)}handlePossibleChange(i){this._state===3&&this._isDependency(i)&&(this._checkIterations(),this._state=1)}handleChange(i,e){if(this._isDependency(i)){Ph()?.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){o6(t)}}}_isDependency(i){return this._dependencies.has(i)&&!this._dependenciesToBeRemoved.has(i)}_ensureNoRunning(){if(!this._isRunning)throw new ni("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 ni("Cannot access store after dispose");return this._store===void 0&&(this._store=new P),this._store}get delayedStore(){if(this._ensureNoRunning(),this._disposed)throw new ni("Cannot access store after dispose");return this._delayedStore===void 0&&(this._delayedStore=new P),this._delayedStore}debugGetState(){return{isRunning:this._isRunning,updateCount:this._updateCount,dependencies:this._dependencies,state:this._state,stateStr:mRo(this._state)}}debugRerun(){this._isRunning?this._state=2:this._run()}_checkIterations(){return this._iteration>100?(o6(new ni(`Autorun '${this.debugName}' is stuck in an infinite update loop.`)),!0):!1}};function he(a,i=Il.ofCaller()){return new J0(new Pu(void 0,void 0,a),a,void 0,i)}function XD(a,i,e=Il.ofCaller()){return new J0(new Pu(a.owner,a.debugName,a.debugReferenceFn??i),i,void 0,e)}function xM(a,i,e=Il.ofCaller()){return new J0(new Pu(a.owner,a.debugName,a.debugReferenceFn??i),i,a.changeTracker,e)}function V9t(a,i){let e=new P,t=xM({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 Ga(a){let i=new P,e=XD({owner:void 0,debugName:void 0,debugReferenceFn:a},t=>{i.clear(),a(t,i)});return Z(()=>{e.dispose(),i.dispose()})}function Mre(a,i){let e;return XD({debugReferenceFn:i},t=>{let o=a.read(t),n=e;e=o,i({lastValue:n,newValue:o})})}function I$(a,i,e=t=>t){let t=new Map;return XD({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 ux(a,i=Il.ofCaller()){let e,t=!1;return e=he(o=>{a({delayedStore:o.delayedStore,store:o.store,readObservable:o.readObservable.bind(o),dispose:()=>{e?.dispose(),t=!0}})},i),t&&e.dispose(),e}function hRo(a){switch(a){case 0:return"initial";case 1:return"dependenciesMightHaveChanged";case 2:return"stale";case 3:return"upToDate";default:return"<unknown>"}}var Gv=class extends YD{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,Ph()?.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),Ph()?.handleObservableUpdated(this,{oldValue:r,newValue:this._value,change:void 0,didChange:e,hadValue:n})}catch(o){o6(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 ni("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)}}eh(()=>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){Ph()?.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){o6(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 ni("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 P),this._store}get delayedStore(){return this._ensureReaderValid(),this._delayedStore===void 0&&(this._delayedStore=new P),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:hRo(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)}},Bbe=class extends Gv{constructor(e,t,o,n=void 0,r,s,l){super(e,t,o,n,r,l);this.set=s}};function Ce(a,i,e=Il.ofCaller()){return i!==void 0?new Gv(new Pu(a,void 0,i),i,void 0,void 0,hf,e):new Gv(new Pu(void 0,void 0,a),a,void 0,void 0,hf,e)}function y$(a,i,e,t=Il.ofCaller()){return new Bbe(new Pu(a,void 0,i),i,void 0,void 0,hf,e,t)}function hs(a,i,e=Il.ofCaller()){return new Gv(new Pu(a.owner,a.debugName,a.debugReferenceFn),i,void 0,a.onLastObserverRemoved,a.equalsFn??hf,e)}tzi(hs);function Hbe(a,i,e=Il.ofCaller()){return new Gv(new Pu(a.owner,a.debugName,void 0),i,a.changeTracker,void 0,a.equalityComparer??hf,e)}function RI(a,i,e=Il.ofCaller()){let t,o;i===void 0?(t=a,o=void 0):(o=a,t=i);let n;return new Gv(new Pu(o,void 0,t),r=>{n?n.clear():n=new P;let s=t(r);return s&&n.add(s),s},void 0,()=>{n&&(n.dispose(),n=void 0)},hf,e)}var Wpt=class{constructor(i){this._computeValue=i;this._value=Le(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}},Au=class a{constructor(i){this._value=Le(this,void 0);this.promiseResult=this._value;this.resolvedValue=Ce(this,i=>{let e=this.promiseResult.read(i);if(e)return e.getDataOrThrow()});this.promise=i.then(e=>(Ui(t=>{this._value.set(new xGe(e,void 0),t)}),e),e=>{throw Ui(t=>{this._value.set(new xGe(void 0,e),t)}),e})}static fromFn(i){return new a(i())}static resolved(i){return new a(Promise.resolve(i))}},xGe=class{constructor(i,e){this.data=i;this.error=e}getDataOrThrow(){if(this.error)throw this.error;return this.data}},kGe=class{constructor(i){this._computePromise=i;this._lazyValue=new Wpt(()=>new Au(this._computePromise()));this.cachedPromiseResult=Ce(this,i=>this._lazyValue.cachedValue.read(i)?.promiseResult.read(i))}getPromise(){return this._lazyValue.getValue().promise}};function gf(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=he(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 ho)});if(t.isCancellationRequested){c.dispose(),u.dispose(),n(new ho);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 JD(new Pu(i,void 0,t),e,t,()=>JD.globalTransaction,hf,o??Il.ofCaller())}function ff(a,i,e,t=Il.ofCaller()){return new JD(new Pu(a.owner,a.debugName,a.debugReferenceFn??e),i,e,()=>a.getTransaction?.()??JD.globalTransaction,a.equalsFn??hf,t)}var JD=class extends YD{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,dN(this._getTransaction(),s=>{Ph()?.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||Ph()?.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=JD;function i(t,o){let n=!1;JD.globalTransaction===void 0&&(JD.globalTransaction=t,n=!0);try{o()}finally{n&&(JD.globalTransaction=void 0)}}e.batchEventsGlobally=i})(ui||={});function Wc(a,i=Il.ofCaller()){return typeof a=="string"?new Vpt(a,void 0,i):new Vpt(void 0,a,i)}var Vpt=class extends YD{constructor(e,t,o){super(o);this._debugName=e;this._owner=t}get debugName(){return new Pu(this._owner,this._debugName,void 0).getDebugName(this)??"Observable Signal"}toString(){return this.debugName}trigger(e,t){if(!e){Ui(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 EGe(a){let i=Le("promiseValue",{});return a.then(e=>{i.set({value:e},void 0)}),i}function kM(a,i,e=Il.ofCaller()){let t=!1,o,n;return ui(void 0,r=>{let s=he(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 B9t(a,i,e=Il.ofCaller()){let t=Wc("handleTimeout"),o,n;return hs({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 H9t(a,i,e){let t=Le("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 lU(a){let i=new Bpt(!1,void 0);return a.addObserver(i),Z(()=>{a.removeObserver(i)})}rzi(lU);function EM(a,i){let e=new Bpt(!0,i);a.addObserver(e);try{e.beginUpdate(a)}finally{e.endUpdate(a)}return Z(()=>{a.removeObserver(e)})}ozi(EM);var Bpt=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 vf(a,i){let e;return hs({owner:a,debugReferenceFn:i},o=>(e=i(o,e),e))}function TGe(a,i){let e,t=Wc("derivedObservableWithWritableCache"),o=Ce(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 $v(a,i,e,t){let o=new Hpt(e,t);return hs({debugReferenceFn:e,owner:a,onLastObserverRemoved:()=>{o.dispose(),o=new Hpt(e)}},r=>{let s=i.read(r);return o.setItems(s),o.getItems()})}var Hpt=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 P;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 uN(a){return!!a&&a.read!==void 0&&a.reportChanges!==void 0}function U9t(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 ni('property name "changes" is reserved for change tracking');e[t]=a[t].read(i)}}}}function z9t(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 ni('property name "changes" is reserved for change tracking');t[o]=i[o].read(e)}}}}function Oo(a){return new K9t(a)}var K9t=class extends CGe{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 Nr(a,i,e=Il.ofCaller()){return new G9t(typeof a=="string"?a:new Pu(a,void 0,void 0),i,e)}var G9t=class extends YD{constructor(e,t,o){super(o);this.event=t;this.handleEvent=()=>{Ui(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 pN=class{constructor(i){this.observable=i}get onDidChange(){return H.fromObservableLight(this.observable)}get value(){return this.observable.get()}};function Pre(a,i){return i instanceof pN?i.observable:ui(a,i.onDidChange,()=>i.value)}function _s(a,i){let e,t=!0;return V9t({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 Upt(a,i){let e=new P,t=_s(a,(o,n,r)=>{e.clear(),i(o,n,r,e)});return{dispose(){t.dispose(),e.dispose()}}}function $9t(a,i){return Upt(a,(e,t,o,n)=>{i(e,t,o,u6(n))})}function _Ge(a,i){if(i.length===0)throw new ni;let e=!1,t,o=ui(a,n=>{let r=new P;for(let s of i)r.add(XD({debugName:()=>E9t(o,new Pu(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 q9t(a,i){return vf(a,(e,t)=>t??i(e))}var k6=class{constructor(){this._data=new Set;this._obs=rg({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 w$=class{constructor(){this._data=new Map;this._obs=rg({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 zpt;function azi(a){zpt||(zpt=new DGe,wGe(zpt)),zpt.addFilteredObj(a)}var DGe=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 gRo([Ube(bRo("|  ",this.indentation)),i])}formatInfo(i){return i.hadValue?i.didChange?[Ube(" "),mN(TM(i.oldValue,70),{color:"red",strikeThrough:!0}),Ube(" "),mN(TM(i.newValue,60),{color:"green"})]:[Ube(" (unchanged)")]:[Ube(" "),mN(TM(i.newValue,60),{color:"green"}),Ube(" (initial)")]}handleObservableCreated(i){if(i instanceof Gv){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 Gv){this._handleDerivedRecomputed(i,e);return}console.log(...this.textToConsoleArgs([zbe("observable value changed"),mN(i.debugName,{color:"BlueViolet"}),...this.formatInfo(e)]))}}formatChanges(i){if(i.size!==0)return mN(" (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([zbe("derived recomputed"),mN(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([zbe("derived cleared"),mN(i.debugName,{color:"BlueViolet"})]))}handleFromEventObservableTriggered(i,e){this._isIncluded(i)&&console.log(...this.textToConsoleArgs([zbe("observable from event triggered"),mN(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([zbe("autorun"),mN(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([zbe("transaction"),mN(e,{color:"BlueViolet"}),{data:[{fn:i._fn}]}])),this.indentation++}handleEndTransaction(){this.indentation--}};function gRo(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 Ube(a){return mN(a,{color:"black"})}function zbe(a){return mN(SRo(`${a}: `,10),{color:"black",bold:!0})}function mN(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 TM(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)?fRo(a,i):vRo(a,i);case"symbol":return a.toString();case"function":return`[[Function${a.name?" "+a.name:""}]]`;default:return""+a}}function fRo(a,i){let e="[ ",t=!0;for(let o of a){if(t||(e+=", "),e.length-5>i){e+="...";break}t=!1,e+=`${TM(o,i-e.length)}`}return e+=" ]",e}function vRo(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=T9t(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}: ${TM(r,i-t.length)}`}return t+=e?")":" }",t}function bRo(a,i){let e="";for(let t=1;t<=i;t++)e+=a;return e}function SRo(a,i){for(;a.length<i;)a+=" ";return a}var Kpt=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 lzi(a,i){let e=globalThis,t=[],o,{channel:n,handler:r}=IRo({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},Kpt.createClient(n,()=>{if(!s)throw new Error("Not supported");return s})}function IRo(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 Gpt=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 j9t(a,i){for(let e in i)a[e]&&typeof a[e]=="object"&&i[e]&&typeof i[e]=="object"?j9t(a[e],i[e]):a[e]=i[e]}function Q9t(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"?Q9t(a[e],i[e]):a[e]=i[e]}var $pt=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=lzi("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(mo)}),getDerivedInfo:i=>{let e=this._aliveInstances.get(i);return{dependencies:[...e.debugGetState().dependencies].map(t=>this._formatObservable(t)).filter(mo),observers:[...e.debugGetObservers()].map(t=>this._formatObserver(t)).filter(mo)}},getAutorunInfo:i=>({dependencies:[...this._aliveInstances.get(i).debugGetState().dependencies].map(t=>this._formatObservable(t)).filter(mo)}),getTransactionState:()=>this.getTransactionState(),setValue:(i,e)=>{let t=this._aliveInstances.get(i);if(t instanceof Gv)t.debugSetValue(e);else if(t instanceof CM)t.debugSetValue(e);else if(t instanceof JD)t.debugSetValue(e);else throw new ni("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 Gv)return TM(e.debugGetState().value,200);if(e instanceof CM)return TM(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 ni("Observable is not supported")},rerun:i=>{let e=this._aliveInstances.get(i);if(e instanceof Gv)e.debugRecompute();else if(e instanceof J0)e.debugRerun();else throw new ni("Observable is not supported")}}}));this._pendingChanges=null;this._changeThrottler=new Gpt;this._fullState={};this._flushUpdates=()=>{this._pendingChanges!==null&&(this._channel.api.notifications.handleChange(this._pendingChanges,!1),this._pendingChanges=null)};Il.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 ni("No info found"));return}return e}_getAutorunInfo(i){let e=this._instanceInfos.get(i);if(!e){mt(new ni("No info found"));return}return e}_getInfo(i,e){if(i instanceof Gv){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(mo);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 J0){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 Gv)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){Q9t(this._fullState,i),this._pendingChanges===null?this._pendingChanges=i:j9t(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 Gv?"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 Gv){this._handleDerivedRecomputed(i,e);return}let t=this._getObservableInfo(i);t&&e.didChange&&(t.lastValue=TM(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=TM(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 czi(a,i){let e=i?.debugNamePostProcessor??(n=>n),t=Are.from(a,e);if(!t)return"";let o=new Set;return i.type==="observers"?uzi(t,0,o,i).trim():dzi(t,0,o,i).trim()}function dzi(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: ${TM(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=Are.from(s,t.debugNamePostProcessor??(c=>c))??Are.unknown(s);n.push(dzi(l,i+1,e,t))}}return n.join(`
`)}function uzi(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: ${TM(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=Are.from(s,t.debugNamePostProcessor??(c=>c))??Are.unknown(s);n.push(uzi(l,i+1,e,t))}}return n.join(`
`)}var Are=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 J0){let t=i.debugGetState();return new a(i,e(i.debugName),"autorun",void 0,t.stateStr,Array.from(t.dependencies),[])}else if(i instanceof Gv){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 CM){let t=i.debugGetState();return new a(i,e(i.debugName),"observableValue",t.value,"upToDate",[],Array.from(i.debugGetObservers()))}else if(i instanceof JD){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",[],[])}};szi(czi);Z1i(azi);var yRo=!1;yRo&&wGe(new DGe);fp&&fp.VSCODE_DEV_DEBUG_OBSERVABLES&&wGe($pt.getInstance());var{registerWindow:bzi,getWindow:Me,getDocument:Ore,getWindows:Gw,getWindowsCount:Kbe,getWindowId:sg,getWindowById:qv,hasWindow:E6,onDidRegisterWindow:Fg,onWillUnregisterWindow:Szi,onDidUnregisterWindow:Izi}=(function(){let a=new Map;_ut(It,1);let i={window:It,disposables:new P};a.set(It.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 C.None;let s=new P,l={window:r,disposables:s.add(new P)};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:It},getDocument(r){return Me(r).document}}})(),qpt=new Set;function yzi(a){return qpt.add(a),Z(()=>{qpt.delete(a)})}function wRo(){for(let a of qpt)if(a().hasFocus)return!0;return!1}function CRo(){for(let a of qpt){let i=a();if(i.hasFocus&&i.window)return i.window}}function wzi(){for(let{window:a}of Gw())if(a.document.hasFocus())return!0;return!!wRo()}function Rt(a){for(;a.firstChild;)a.firstChild.remove()}var Y9t=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 Y9t(a,i,e,t)}function i7t(a,i){return function(e){return i(new yn(a,e))}}function xRo(a){return function(i){return a(new Ii(i))}}var Vo=function(i,e,t,o){let n=t;return e==="click"||e==="mousedown"||e==="contextmenu"?n=i7t(Me(i),t):(e==="keydown"||e==="keypress"||e==="keyup")&&(n=xRo(t)),j(i,e,n,o)},Gbe=function(i,e,t){let o=i7t(Me(i),e);return C$(i,o,t)},Qpt=function(i,e,t){let o=i7t(Me(i),e);return Fre(i,o,t)};function C$(a,i,e){return j(a,Nc&&og.pointerEvents?re.POINTER_DOWN:re.MOUSE_DOWN,i,e)}function $be(a,i,e){return j(a,Nc&&og.pointerEvents?re.POINTER_MOVE:re.MOUSE_MOVE,i,e)}function Fre(a,i,e){return j(a,Nc&&og.pointerEvents?re.POINTER_UP:re.MOUSE_UP,i,e)}function jv(a,i,e){return Mbe(a,i,e)}var hN=class extends vGe{constructor(i,e){super(i,e)}},Ah,$r;function MI(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 ZD=class extends EI{constructor(i){super(),this.defaultTarget=i&&Me(i)}cancelAndSet(i,e,t){return super.cancelAndSet(i,e,t??this.defaultTarget)}},LGe=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(LGe.sort),r.shift().execute();t.set(n,!1)};$r=(n,r,s=0)=>{let l=sg(n),c=new LGe(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},Ah=(n,r,s)=>{let l=sg(n);if(t.get(l)){let c=new LGe(r,s),u=i.get(l);return u||(u=[],i.set(l,u)),u.push(c),c}else return $r(n,r,s)}})();function o7t(a,i){return $r(a,i,1e4)}function T6(a,i){return $r(a,i,-1e4)}var jpt=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=Ah(Me(this.node),()=>{this.pendingRunner.clear(),this.runner()}))}isScheduled(){return this.pendingRunner.value!==void 0}};function cU(a){return Me(a).getComputedStyle(a,null)}function Fm(a,i,e){let t=Me(a),o=t.document;if(a!==o.body)return new ai(a.clientWidth,a.clientHeight);if(Nc&&t?.visualViewport)return new ai(t.visualViewport.width,t.visualViewport.height);if(t?.innerWidth&&t.innerHeight)return new ai(t.innerWidth,t.innerHeight);if(o.body&&o.body.clientWidth&&o.body.clientHeight)return new ai(o.body.clientWidth,o.body.clientHeight);if(o.documentElement&&o.documentElement.clientWidth&&o.documentElement.clientHeight)return new ai(o.documentElement.clientWidth,o.documentElement.clientHeight);if(e)return Fm(e,i);if(i)return i;throw new Error("Unable to figure out browser width and height")}var Kw=class a{static convertToPixels(i,e){return parseFloat(e)||0}static getDimension(i,e){let t=cU(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")}},ai=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 gN(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=Ezi(a)?null:cU(a);o&&(t-=o.direction!=="rtl"?a.scrollLeft:-a.scrollLeft),a===i&&(t+=Kw.getBorderLeftWidth(a),e+=Kw.getBorderTopWidth(a),e+=a.offsetTop,t+=a.offsetLeft,i=a.offsetParent)}return{left:t,top:e}}function fN(a,i,e){typeof i=="number"&&(a.style.width=`${i}px`),typeof e=="number"&&(a.style.height=`${e}px`)}function Czi(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 Yn(a){let i=a.getBoundingClientRect(),e=Me(a);return{left:i.left+e.scrollX,top:i.top+e.scrollY,width:i.width,height:i.height}}function _6(a){let i=a,e=1;do{let t=cU(i).zoom;t!=null&&t!=="1"&&(e*=t),i=i.parentElement}while(i!==null&&i!==i.ownerDocument.documentElement);return e}function yl(a){let i=Kw.getMarginLeft(a)+Kw.getMarginRight(a);return a.offsetWidth+i}function D6(a){let i=Kw.getBorderLeftWidth(a)+Kw.getBorderRightWidth(a),e=Kw.getPaddingLeft(a)+Kw.getPaddingRight(a);return a.offsetWidth-i-e}function kRo(a){let i=Kw.getMarginLeft(a)+Kw.getMarginRight(a);return a.scrollWidth+i}function qbe(a){let i=Kw.getBorderTopWidth(a)+Kw.getBorderBottomWidth(a),e=Kw.getPaddingTop(a)+Kw.getPaddingBottom(a);return a.offsetHeight-i-e}function nh(a){let i=Kw.getMarginTop(a)+Kw.getMarginBottom(a);return a.offsetHeight+i}function ERo(a,i){if(a===null)return 0;let e=gN(a),t=gN(i);return e.left-t.left}function jbe(a,i){let e=i.map(o=>Math.max(kRo(o),yl(o))+ERo(o,a)||0);return Math.max(...e)}function gs(a,i){return!!i?.contains(a)}var xzi="parentFlowToElementId";function vN(a,i){a.dataset[xzi]=i.id}function TRo(a){let i=a.dataset[xzi];return typeof i=="string"?a.ownerDocument.getElementById(i):null}function kzi(a,i){let e=a;for(;e;){if(e===i)return!0;if(Ao(e)){let t=TRo(e);if(t){e=t;continue}}e=e.parentNode}return!1}function Nh(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 Qbe(a,i,e){return!!Nh(a,i,e)}function Ezi(a){return a&&!!a.host&&!!a.mode}function x$(a){return!!_M(a)}function _M(a){for(;a.parentNode;){if(a===a.ownerDocument?.body)return null;a=a.parentNode}return Ezi(a)?a:null}function Pn(){let a=rh().activeElement;for(;a?.shadowRoot;)a=a.shadowRoot.activeElement;return a}function sa(a){return Pn()===a}function ts(a){return gs(Pn(),a)}function rh(){if(Kbe()<=1)return It.document;let i=Array.from(Gw()).map(({window:t})=>t.document).find(t=>t.hasFocus());if(i)return i;let e=CRo();return e?e.document:It.document}function Ki(){return rh().defaultView?.window??It}var MGe=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=Ir(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 Ypt(a=It.document.head){return Tzi("meta",a)}function Xpt(a=It.document.head){return Tzi("link",a)}function Tzi(a,i=It.document.head){let e=document.createElement(a);return i.appendChild(e),e}function Ao(a){return a instanceof HTMLElement||a instanceof Me(a).HTMLElement}function n7t(a){return a instanceof HTMLAnchorElement||a instanceof Me(a).HTMLAnchorElement}function L6(a){return a instanceof HTMLTextAreaElement||a instanceof Me(a).HTMLTextAreaElement}function Wre(a){return a instanceof HTMLInputElement||a instanceof Me(a).HTMLInputElement}function r7t(a){return a instanceof HTMLDivElement||a instanceof Me(a).HTMLDivElement}function s7t(a){return a instanceof SVGElement||a instanceof Me(a).SVGElement}function Vp(a){return a instanceof MouseEvent||a instanceof Me(a).MouseEvent}function ag(a){return a instanceof KeyboardEvent||a instanceof Me(a).KeyboardEvent}function Jpt(a){return a instanceof PointerEvent||a instanceof Me(a).PointerEvent}function _zi(a){return a instanceof DragEvent||a instanceof Me(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:H0?"webkitAnimationStart":"animationstart",ANIMATION_END:H0?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:H0?"webkitAnimationIteration":"animationiteration"};function Zpt(a){let i=a;return!!(i&&typeof i.preventDefault=="function"&&typeof i.stopPropagation=="function")}var $t={stop:(a,i)=>(a.preventDefault(),i&&a.stopPropagation(),a)};function Dzi(a){let i=[];for(let e=0;a&&a.nodeType===a.ELEMENT_NODE;e++)i[e]=a.scrollTop,a=a.parentNode;return i}function Lzi(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 X9t=class a extends C{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,(Ao(e)?Me(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)),Ao(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(Ao(e)){let t=_M(e),o=t?t.activeElement:e.ownerDocument.activeElement;return gs(o,e)}else{let t=e;return gs(t.document.activeElement,t.document)}}refreshState(){this._refreshStateHandler()}};function Vn(a){return new X9t(a)}function emt(a,i){return a.after(i),i}function R(a,...i){if(a.append(...i),i.length===1&&typeof i[0]!="string")return i[0]}function Sf(a,i){return a.insertBefore(i,a.firstChild),i}function Fi(a,...i){a.textContent="",R(a,...i)}var _Ro=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function Rzi(a,i,e,...t){let o=_Ro.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 Rzi("http://www.w3.org/1999/xhtml",a,i,...e)}_.SVG=function(a,i,...e){return Rzi("http://www.w3.org/2000/svg",a,i,...e)};function mm(a,...i){a?bn(...i):xo(...i)}function bn(...a){for(let i of a)i.style.display="",i.removeAttribute("aria-hidden")}function xo(...a){for(let i of a)i.style.display="none",i.setAttribute("aria-hidden","true")}function Ybe(a){return i=>{i.preventDefault(),i.stopPropagation(),a(i)}}function Mzi(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 a7t(a,i){let e=a.devicePixelRatio*i;return Math.max(1,Math.floor(e))/a.devicePixelRatio}function PGe(a){It.open(a,"_blank","noopener")}var pzi=780,mzi=640;function l7t(a){let i=Math.floor(It.screenLeft+It.innerWidth/2-pzi/2),e=Math.floor(It.screenTop+It.innerHeight/2-mzi/2);It.open(a,"_blank",`width=${pzi},height=${mzi},top=${e},left=${i}`)}function Pzi(a,i=!0){let e=It.open();return e?(i&&(e.opener=null),e.location.href=a,!0):!1}function Azi(a,i){let e=()=>{i(),t=$r(a,e)},t=$r(a,e);return Z(()=>t.dispose())}jD.setPreferredWebSchema(/^https:/.test(It.location.href)?"https":"http");function Nzi(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 Ozi(){return new Promise(a=>{let i=Ki(),e=document.createElement("input");i.document.body.appendChild(e),e.type="file",e.multiple=!0,H.once(H.fromDOMEventEmitter(e,"input"))(()=>{a(e.files??void 0)}),e.click(),setTimeout(()=>e.remove())})}var bf=class a extends E{constructor(){super();this._subscriptions=new P;this._keyStatus={altKey:!1,shiftKey:!1,ctrlKey:!1,metaKey:!1},this._subscriptions.add(H.runAndSubscribe(Fg,({window:e,disposables:t})=>this.registerListeners(e,t),{window:It,disposables:this._subscriptions}))}registerListeners(e,t){t.add(j(e,"keydown",o=>{if(o.defaultPrevented)return;let n=new Ii(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 spt(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 Om=class extends C{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)}))}},eL=class extends C{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))}},Fzi=/(?<tag>[\w\-]+)?(?:#(?<id>[\w\-]+))?(?<class>(?:\.(?:[\w\-]+))*)(?:@(?<name>(?:[\w\_])+))?/;function bt(a,...i){let e,t;Array.isArray(i[0])?(e={},t=i[0]):(e=i[0]||{},t=i[1]);let o=Fzi.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)Ao(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(Nre(p),typeof h=="number"?h+"px":""+h);else c==="tabIndex"?r.tabIndex=u:r.setAttribute(Nre(c),u.toString());return l.root=r,l}function Wzi(a,...i){let e,t;Array.isArray(i[0])?(e={},t=i[0]):(e=i[0]||{},t=i[1]);let o=Fzi.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)Ao(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(Nre(p),typeof h=="number"?h+"px":""+h);else c==="tabIndex"?r.tabIndex=u:r.setAttribute(Nre(c),u.toString());return l.root=r,l}function Nre(a){return a.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function tmt(a,i,e){for(let{name:t,value:o}of a.attributes)(!e||e.includes(t))&&i.setAttribute(t,o)}function DRo(a,i,e){let t=a.getAttribute(e);t?i.setAttribute(e,t):i.removeAttribute(e)}function imt(a,i,e){tmt(a,i,e);let t=new P;return t.add(MGe.observe(a,t,{attributes:!0,attributeFilter:e})(o=>{for(let n of o)n.type==="attributes"&&n.attributeName&&DRo(a,i,n.attributeName)})),t}function Oh(a){return a.tagName.toLowerCase()==="input"||a.tagName.toLowerCase()==="textarea"||Ao(a)&&!!a.editContext}var RGe=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($1i(i,e,o,n,t[s],t[s+1],t[l],t[l+1]))return!0}return!1}},Mo;(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 e7t(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 ni("Make sure the ref is set before accessing the element. Maybe wrong initialization order?");return l}}),c}s.ref=r})(Mo||={});var J9t=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(Ce(l=>{t(this),l.store.add({dispose:()=>{t(null)}})})),n&&(Bzi(n)?this._deriveds.push(Ce(this,l=>{hzi(this._element,gzi(n,l))})):hzi(this._element,gzi(n,void 0)));for(let[l,c]of Object.entries(r))if(l==="style")for(let[u,p]of Object.entries(c)){let h=Nre(u);uN(p)?this._deriveds.push(hs({owner:this,debugName:()=>`set.style.${h}`},g=>{this._element.style.setProperty(h,fzi(p.read(g)))})):this._element.style.setProperty(h,fzi(p))}else l==="tabIndex"?uN(c)?this._deriveds.push(Ce(this,u=>{this._element.tabIndex=c.read(u)})):this._element.tabIndex=c:l.startsWith("on")?this._element[l]=c:uN(c)?this._deriveds.push(hs({owner:this,debugName:()=>`set.${l}`},u=>{vzi(this._element,l,c.read(u))})):vzi(this._element,l,c);if(s){let l=function(u,p){return uN(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=Ce(this,u=>{this._element.replaceChildren(...l(u,s))});this._deriveds.push(c),Hzi(s)||c.get()}}readEffect(i){for(let e of this._deriveds)e.read(i)}keepUpdated(i){return Ce(e=>{this.readEffect(e)}).recomputeInitiallyAndOnChange(i),this}toDisposableLiveElement(){let i=new P;return this.keepUpdated(i),new Z9t(this._element,i)}get isHovered(){if(!this._isHovered){let i=Le("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=Le("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 hzi(a,i){s7t(a)?a.setAttribute("class",i):a.className=i}function Vzi(a,i,e){if(uN(a)){e(a.read(i));return}if(Array.isArray(a)){for(let t of a)Vzi(t,i,e);return}e(a)}function gzi(a,i){let e="";return Vzi(a,i,t=>{t&&(e.length===0?e=t:e+=" "+t)}),e}function Bzi(a){return uN(a)?!0:Array.isArray(a)?a.some(i=>Bzi(i)):!1}function fzi(a){return typeof a=="number"?a+"px":a}function Hzi(a){return uN(a)?!0:Array.isArray(a)?a.some(i=>Hzi(i)):!1}var Z9t=class{constructor(i,e){this.element=i;this._disposable=e}dispose(){this._disposable.dispose()}},e7t=class extends J9t{get element(){return this._element}};function vzi(a,i,e){e==null?a.removeAttribute(Nre(i)):a.setAttribute(Nre(i),String(e))}var t7t=class extends HTMLElement{disconnectedCallback(){this.onDidDisconnect?.()}connectedCallback(){this.onDidConnect?.()}};customElements.get("connection-observer")||customElements.define("connection-observer",t7t);var Uzi=2e4,Vre,omt,c7t,nmt,d7t;function zzi(a){Vre=document.createElement("div"),Vre.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"),Vre.appendChild(t),t};omt=i(),c7t=i();let e=()=>{let t=document.createElement("div");return t.className="monaco-status",t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),Vre.appendChild(t),t};nmt=e(),d7t=e(),a.appendChild(Vre)}function Jo(a){Vre&&(omt.textContent!==a?(Rt(c7t),rmt(omt,a)):(Rt(omt),rmt(c7t,a)))}function Or(a){Vre&&(nmt.textContent!==a?(Rt(d7t),rmt(nmt,a)):(Rt(nmt),rmt(d7t,a)))}function rmt(a,i){Rt(a),i.length>Uzi&&(i=i.substr(0,Uzi)),a.textContent=i,a.style.visibility="hidden",a.style.visibility="visible"}var Z0;(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})(Z0||={});var F=ae("instantiationService");function LRo(a,i,e){i[Z0.DI_TARGET]===i?i[Z0.DI_DEPENDENCIES].push({id:a,index:e}):(i[Z0.DI_DEPENDENCIES]=[{id:a,index:e}],i[Z0.DI_TARGET]=i)}function ae(a){if(Z0.serviceIds.has(a))return Z0.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");LRo(i,e,o)};return i.toString=()=>a,Z0.serviceIds.set(a,i),i}var Kt=ae("codeEditorService");var Ie=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 Ct=ae("modelService");var Nt=ae("textModelService");function Kzi(a){return!!a.textEditorModel}var st=class extends C{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)}},as=class extends C{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)}},li=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(){}},$l=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(){}},smt=class a extends st{static{this.ID="vs.actions.empty"}constructor(){super(a.ID,d(46,null),void 0,!1)}};function pi(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 u7t=Object.create(null);function ce(a,i){if(Ae(i)){let e=u7t[i];if(e===void 0)throw new Error(`${a} references an unknown codicon: ${i}`);i=e}return u7t[a]=i,{id:a}}function amt(){return u7t}var R6={add:ce("add",6e4),plus:ce("plus",6e4),gistNew:ce("gist-new",6e4),repoCreate:ce("repo-create",6e4),lightbulb:ce("lightbulb",60001),lightBulb:ce("light-bulb",60001),repo:ce("repo",60002),repoDelete:ce("repo-delete",60002),gistFork:ce("gist-fork",60003),repoForked:ce("repo-forked",60003),gitPullRequest:ce("git-pull-request",60004),gitPullRequestAbandoned:ce("git-pull-request-abandoned",60004),recordKeys:ce("record-keys",60005),keyboard:ce("keyboard",60005),tag:ce("tag",60006),gitPullRequestLabel:ce("git-pull-request-label",60006),tagAdd:ce("tag-add",60006),tagRemove:ce("tag-remove",60006),person:ce("person",60007),personFollow:ce("person-follow",60007),personOutline:ce("person-outline",60007),personFilled:ce("person-filled",60007),sourceControl:ce("source-control",60008),mirror:ce("mirror",60009),mirrorPublic:ce("mirror-public",60009),star:ce("star",60010),starAdd:ce("star-add",60010),starDelete:ce("star-delete",60010),starEmpty:ce("star-empty",60010),comment:ce("comment",60011),commentAdd:ce("comment-add",60011),alert:ce("alert",60012),warning:ce("warning",60012),search:ce("search",60013),searchSave:ce("search-save",60013),logOut:ce("log-out",60014),signOut:ce("sign-out",60014),logIn:ce("log-in",60015),signIn:ce("sign-in",60015),eye:ce("eye",60016),eyeUnwatch:ce("eye-unwatch",60016),eyeWatch:ce("eye-watch",60016),circleFilled:ce("circle-filled",60017),primitiveDot:ce("primitive-dot",60017),closeDirty:ce("close-dirty",60017),debugBreakpoint:ce("debug-breakpoint",60017),debugBreakpointDisabled:ce("debug-breakpoint-disabled",60017),debugHint:ce("debug-hint",60017),terminalDecorationSuccess:ce("terminal-decoration-success",60017),primitiveSquare:ce("primitive-square",60018),edit:ce("edit",60019),pencil:ce("pencil",60019),info:ce("info",60020),issueOpened:ce("issue-opened",60020),gistPrivate:ce("gist-private",60021),gitForkPrivate:ce("git-fork-private",60021),lock:ce("lock",60021),mirrorPrivate:ce("mirror-private",60021),close:ce("close",60022),removeClose:ce("remove-close",60022),x:ce("x",60022),repoSync:ce("repo-sync",60023),sync:ce("sync",60023),clone:ce("clone",60024),desktopDownload:ce("desktop-download",60024),beaker:ce("beaker",60025),microscope:ce("microscope",60025),vm:ce("vm",60026),deviceDesktop:ce("device-desktop",60026),file:ce("file",60027),more:ce("more",60028),ellipsis:ce("ellipsis",60028),kebabHorizontal:ce("kebab-horizontal",60028),mailReply:ce("mail-reply",60029),reply:ce("reply",60029),organization:ce("organization",60030),organizationFilled:ce("organization-filled",60030),organizationOutline:ce("organization-outline",60030),newFile:ce("new-file",60031),fileAdd:ce("file-add",60031),newFolder:ce("new-folder",60032),fileDirectoryCreate:ce("file-directory-create",60032),trash:ce("trash",60033),trashcan:ce("trashcan",60033),history:ce("history",60034),clock:ce("clock",60034),folder:ce("folder",60035),fileDirectory:ce("file-directory",60035),symbolFolder:ce("symbol-folder",60035),logoGithub:ce("logo-github",60036),markGithub:ce("mark-github",60036),github:ce("github",60036),terminal:ce("terminal",60037),console:ce("console",60037),repl:ce("repl",60037),zap:ce("zap",60038),symbolEvent:ce("symbol-event",60038),error:ce("error",60039),stop:ce("stop",60039),variable:ce("variable",60040),symbolVariable:ce("symbol-variable",60040),array:ce("array",60042),symbolArray:ce("symbol-array",60042),symbolModule:ce("symbol-module",60043),symbolPackage:ce("symbol-package",60043),symbolNamespace:ce("symbol-namespace",60043),symbolObject:ce("symbol-object",60043),symbolMethod:ce("symbol-method",60044),symbolFunction:ce("symbol-function",60044),symbolConstructor:ce("symbol-constructor",60044),symbolBoolean:ce("symbol-boolean",60047),symbolNull:ce("symbol-null",60047),symbolNumeric:ce("symbol-numeric",60048),symbolNumber:ce("symbol-number",60048),symbolStructure:ce("symbol-structure",60049),symbolStruct:ce("symbol-struct",60049),symbolParameter:ce("symbol-parameter",60050),symbolTypeParameter:ce("symbol-type-parameter",60050),symbolKey:ce("symbol-key",60051),symbolText:ce("symbol-text",60051),symbolReference:ce("symbol-reference",60052),goToFile:ce("go-to-file",60052),symbolEnum:ce("symbol-enum",60053),symbolValue:ce("symbol-value",60053),symbolRuler:ce("symbol-ruler",60054),symbolUnit:ce("symbol-unit",60054),activateBreakpoints:ce("activate-breakpoints",60055),archive:ce("archive",60056),arrowBoth:ce("arrow-both",60057),arrowDown:ce("arrow-down",60058),arrowLeft:ce("arrow-left",60059),arrowRight:ce("arrow-right",60060),arrowSmallDown:ce("arrow-small-down",60061),arrowSmallLeft:ce("arrow-small-left",60062),arrowSmallRight:ce("arrow-small-right",60063),arrowSmallUp:ce("arrow-small-up",60064),arrowUp:ce("arrow-up",60065),bell:ce("bell",60066),bold:ce("bold",60067),book:ce("book",60068),bookmark:ce("bookmark",60069),debugBreakpointConditionalUnverified:ce("debug-breakpoint-conditional-unverified",60070),debugBreakpointConditional:ce("debug-breakpoint-conditional",60071),debugBreakpointConditionalDisabled:ce("debug-breakpoint-conditional-disabled",60071),debugBreakpointDataUnverified:ce("debug-breakpoint-data-unverified",60072),debugBreakpointData:ce("debug-breakpoint-data",60073),debugBreakpointDataDisabled:ce("debug-breakpoint-data-disabled",60073),debugBreakpointLogUnverified:ce("debug-breakpoint-log-unverified",60074),debugBreakpointLog:ce("debug-breakpoint-log",60075),debugBreakpointLogDisabled:ce("debug-breakpoint-log-disabled",60075),briefcase:ce("briefcase",60076),broadcast:ce("broadcast",60077),browser:ce("browser",60078),bug:ce("bug",60079),calendar:ce("calendar",60080),caseSensitive:ce("case-sensitive",60081),check:ce("check",60082),checklist:ce("checklist",60083),chevronDown:ce("chevron-down",60084),chevronLeft:ce("chevron-left",60085),chevronRight:ce("chevron-right",60086),chevronUp:ce("chevron-up",60087),chromeClose:ce("chrome-close",60088),chromeMaximize:ce("chrome-maximize",60089),chromeMinimize:ce("chrome-minimize",60090),chromeRestore:ce("chrome-restore",60091),circleOutline:ce("circle-outline",60092),circle:ce("circle",60092),debugBreakpointUnverified:ce("debug-breakpoint-unverified",60092),terminalDecorationIncomplete:ce("terminal-decoration-incomplete",60092),circleSlash:ce("circle-slash",60093),circuitBoard:ce("circuit-board",60094),clearAll:ce("clear-all",60095),clippy:ce("clippy",60096),closeAll:ce("close-all",60097),cloudDownload:ce("cloud-download",60098),cloudUpload:ce("cloud-upload",60099),code:ce("code",60100),collapseAll:ce("collapse-all",60101),colorMode:ce("color-mode",60102),commentDiscussion:ce("comment-discussion",60103),creditCard:ce("credit-card",60105),dash:ce("dash",60108),dashboard:ce("dashboard",60109),database:ce("database",60110),debugContinue:ce("debug-continue",60111),debugDisconnect:ce("debug-disconnect",60112),debugPause:ce("debug-pause",60113),debugRestart:ce("debug-restart",60114),debugStart:ce("debug-start",60115),debugStepInto:ce("debug-step-into",60116),debugStepOut:ce("debug-step-out",60117),debugStepOver:ce("debug-step-over",60118),debugStop:ce("debug-stop",60119),debug:ce("debug",60120),deviceCameraVideo:ce("device-camera-video",60121),deviceCamera:ce("device-camera",60122),deviceMobile:ce("device-mobile",60123),diffAdded:ce("diff-added",60124),diffIgnored:ce("diff-ignored",60125),diffModified:ce("diff-modified",60126),diffRemoved:ce("diff-removed",60127),diffRenamed:ce("diff-renamed",60128),diff:ce("diff",60129),diffSidebyside:ce("diff-sidebyside",60129),discard:ce("discard",60130),editorLayout:ce("editor-layout",60131),emptyWindow:ce("empty-window",60132),exclude:ce("exclude",60133),extensions:ce("extensions",60134),eyeClosed:ce("eye-closed",60135),fileBinary:ce("file-binary",60136),fileCode:ce("file-code",60137),fileMedia:ce("file-media",60138),filePdf:ce("file-pdf",60139),fileSubmodule:ce("file-submodule",60140),fileSymlinkDirectory:ce("file-symlink-directory",60141),fileSymlinkFile:ce("file-symlink-file",60142),fileZip:ce("file-zip",60143),files:ce("files",60144),filter:ce("filter",60145),flame:ce("flame",60146),foldDown:ce("fold-down",60147),foldUp:ce("fold-up",60148),fold:ce("fold",60149),folderActive:ce("folder-active",60150),folderOpened:ce("folder-opened",60151),gear:ce("gear",60152),gift:ce("gift",60153),gistSecret:ce("gist-secret",60154),gist:ce("gist",60155),gitCommit:ce("git-commit",60156),gitCompare:ce("git-compare",60157),compareChanges:ce("compare-changes",60157),gitMerge:ce("git-merge",60158),githubAction:ce("github-action",60159),githubAlt:ce("github-alt",60160),globe:ce("globe",60161),grabber:ce("grabber",60162),graph:ce("graph",60163),gripper:ce("gripper",60164),heart:ce("heart",60165),home:ce("home",60166),horizontalRule:ce("horizontal-rule",60167),hubot:ce("hubot",60168),inbox:ce("inbox",60169),issueReopened:ce("issue-reopened",60171),issues:ce("issues",60172),italic:ce("italic",60173),jersey:ce("jersey",60174),json:ce("json",60175),bracket:ce("bracket",60175),kebabVertical:ce("kebab-vertical",60176),key:ce("key",60177),law:ce("law",60178),lightbulbAutofix:ce("lightbulb-autofix",60179),linkExternal:ce("link-external",60180),link:ce("link",60181),listOrdered:ce("list-ordered",60182),listUnordered:ce("list-unordered",60183),liveShare:ce("live-share",60184),loading:ce("loading",60185),location:ce("location",60186),mailRead:ce("mail-read",60187),mail:ce("mail",60188),markdown:ce("markdown",60189),megaphone:ce("megaphone",60190),mention:ce("mention",60191),milestone:ce("milestone",60192),gitPullRequestMilestone:ce("git-pull-request-milestone",60192),mortarBoard:ce("mortar-board",60193),move:ce("move",60194),multipleWindows:ce("multiple-windows",60195),mute:ce("mute",60196),noNewline:ce("no-newline",60197),note:ce("note",60198),octoface:ce("octoface",60199),openPreview:ce("open-preview",60200),package:ce("package",60201),paintcan:ce("paintcan",60202),pin:ce("pin",60203),play:ce("play",60204),run:ce("run",60204),plug:ce("plug",60205),preserveCase:ce("preserve-case",60206),preview:ce("preview",60207),project:ce("project",60208),pulse:ce("pulse",60209),question:ce("question",60210),quote:ce("quote",60211),radioTower:ce("radio-tower",60212),reactions:ce("reactions",60213),references:ce("references",60214),refresh:ce("refresh",60215),regex:ce("regex",60216),remoteExplorer:ce("remote-explorer",60217),remote:ce("remote",60218),remove:ce("remove",60219),replaceAll:ce("replace-all",60220),replace:ce("replace",60221),repoClone:ce("repo-clone",60222),repoForcePush:ce("repo-force-push",60223),repoPull:ce("repo-pull",60224),repoPush:ce("repo-push",60225),report:ce("report",60226),requestChanges:ce("request-changes",60227),rocket:ce("rocket",60228),rootFolderOpened:ce("root-folder-opened",60229),rootFolder:ce("root-folder",60230),rss:ce("rss",60231),ruby:ce("ruby",60232),saveAll:ce("save-all",60233),saveAs:ce("save-as",60234),save:ce("save",60235),screenFull:ce("screen-full",60236),screenNormal:ce("screen-normal",60237),searchStop:ce("search-stop",60238),server:ce("server",60240),settingsGear:ce("settings-gear",60241),settings:ce("settings",60242),shield:ce("shield",60243),smiley:ce("smiley",60244),sortPrecedence:ce("sort-precedence",60245),splitHorizontal:ce("split-horizontal",60246),splitVertical:ce("split-vertical",60247),squirrel:ce("squirrel",60248),starFull:ce("star-full",60249),starHalf:ce("star-half",60250),symbolClass:ce("symbol-class",60251),symbolColor:ce("symbol-color",60252),symbolConstant:ce("symbol-constant",60253),symbolEnumMember:ce("symbol-enum-member",60254),symbolField:ce("symbol-field",60255),symbolFile:ce("symbol-file",60256),symbolInterface:ce("symbol-interface",60257),symbolKeyword:ce("symbol-keyword",60258),symbolMisc:ce("symbol-misc",60259),symbolOperator:ce("symbol-operator",60260),symbolProperty:ce("symbol-property",60261),wrench:ce("wrench",60261),wrenchSubaction:ce("wrench-subaction",60261),symbolSnippet:ce("symbol-snippet",60262),tasklist:ce("tasklist",60263),telescope:ce("telescope",60264),textSize:ce("text-size",60265),threeBars:ce("three-bars",60266),thumbsdown:ce("thumbsdown",60267),thumbsup:ce("thumbsup",60268),tools:ce("tools",60269),triangleDown:ce("triangle-down",60270),triangleLeft:ce("triangle-left",60271),triangleRight:ce("triangle-right",60272),triangleUp:ce("triangle-up",60273),twitter:ce("twitter",60274),unfold:ce("unfold",60275),unlock:ce("unlock",60276),unmute:ce("unmute",60277),unverified:ce("unverified",60278),verified:ce("verified",60279),versions:ce("versions",60280),vmActive:ce("vm-active",60281),vmOutline:ce("vm-outline",60282),vmRunning:ce("vm-running",60283),watch:ce("watch",60284),whitespace:ce("whitespace",60285),wholeWord:ce("whole-word",60286),window:ce("window",60287),wordWrap:ce("word-wrap",60288),zoomIn:ce("zoom-in",60289),zoomOut:ce("zoom-out",60290),listFilter:ce("list-filter",60291),listFlat:ce("list-flat",60292),listSelection:ce("list-selection",60293),selection:ce("selection",60293),listTree:ce("list-tree",60294),debugBreakpointFunctionUnverified:ce("debug-breakpoint-function-unverified",60295),debugBreakpointFunction:ce("debug-breakpoint-function",60296),debugBreakpointFunctionDisabled:ce("debug-breakpoint-function-disabled",60296),debugStackframeActive:ce("debug-stackframe-active",60297),circleSmallFilled:ce("circle-small-filled",60298),debugStackframeDot:ce("debug-stackframe-dot",60298),terminalDecorationMark:ce("terminal-decoration-mark",60298),debugStackframe:ce("debug-stackframe",60299),debugStackframeFocused:ce("debug-stackframe-focused",60299),debugBreakpointUnsupported:ce("debug-breakpoint-unsupported",60300),symbolString:ce("symbol-string",60301),debugReverseContinue:ce("debug-reverse-continue",60302),debugStepBack:ce("debug-step-back",60303),debugRestartFrame:ce("debug-restart-frame",60304),debugAlt:ce("debug-alt",60305),callIncoming:ce("call-incoming",60306),callOutgoing:ce("call-outgoing",60307),menu:ce("menu",60308),expandAll:ce("expand-all",60309),feedback:ce("feedback",60310),gitPullRequestReviewer:ce("git-pull-request-reviewer",60310),groupByRefType:ce("group-by-ref-type",60311),ungroupByRefType:ce("ungroup-by-ref-type",60312),account:ce("account",60313),gitPullRequestAssignee:ce("git-pull-request-assignee",60313),bellDot:ce("bell-dot",60314),debugConsole:ce("debug-console",60315),library:ce("library",60316),output:ce("output",60317),runAll:ce("run-all",60318),syncIgnored:ce("sync-ignored",60319),pinned:ce("pinned",60320),githubInverted:ce("github-inverted",60321),serverProcess:ce("server-process",60322),serverEnvironment:ce("server-environment",60323),pass:ce("pass",60324),issueClosed:ce("issue-closed",60324),stopCircle:ce("stop-circle",60325),playCircle:ce("play-circle",60326),record:ce("record",60327),debugAltSmall:ce("debug-alt-small",60328),vmConnect:ce("vm-connect",60329),cloud:ce("cloud",60330),merge:ce("merge",60331),export:ce("export",60332),graphLeft:ce("graph-left",60333),magnet:ce("magnet",60334),notebook:ce("notebook",60335),redo:ce("redo",60336),checkAll:ce("check-all",60337),pinnedDirty:ce("pinned-dirty",60338),passFilled:ce("pass-filled",60339),circleLargeFilled:ce("circle-large-filled",60340),circleLarge:ce("circle-large",60341),circleLargeOutline:ce("circle-large-outline",60341),combine:ce("combine",60342),gather:ce("gather",60342),table:ce("table",60343),variableGroup:ce("variable-group",60344),typeHierarchy:ce("type-hierarchy",60345),typeHierarchySub:ce("type-hierarchy-sub",60346),typeHierarchySuper:ce("type-hierarchy-super",60347),gitPullRequestCreate:ce("git-pull-request-create",60348),runAbove:ce("run-above",60349),runBelow:ce("run-below",60350),notebookTemplate:ce("notebook-template",60351),debugRerun:ce("debug-rerun",60352),workspaceTrusted:ce("workspace-trusted",60353),workspaceUntrusted:ce("workspace-untrusted",60354),workspaceUnknown:ce("workspace-unknown",60355),terminalCmd:ce("terminal-cmd",60356),terminalDebian:ce("terminal-debian",60357),terminalLinux:ce("terminal-linux",60358),terminalPowershell:ce("terminal-powershell",60359),terminalTmux:ce("terminal-tmux",60360),terminalUbuntu:ce("terminal-ubuntu",60361),terminalBash:ce("terminal-bash",60362),arrowSwap:ce("arrow-swap",60363),copy:ce("copy",60364),personAdd:ce("person-add",60365),filterFilled:ce("filter-filled",60366),wand:ce("wand",60367),debugLineByLine:ce("debug-line-by-line",60368),inspect:ce("inspect",60369),layers:ce("layers",60370),layersDot:ce("layers-dot",60371),layersActive:ce("layers-active",60372),compass:ce("compass",60373),compassDot:ce("compass-dot",60374),compassActive:ce("compass-active",60375),azure:ce("azure",60376),issueDraft:ce("issue-draft",60377),gitPullRequestClosed:ce("git-pull-request-closed",60378),gitPullRequestDraft:ce("git-pull-request-draft",60379),debugAll:ce("debug-all",60380),debugCoverage:ce("debug-coverage",60381),runErrors:ce("run-errors",60382),folderLibrary:ce("folder-library",60383),debugContinueSmall:ce("debug-continue-small",60384),beakerStop:ce("beaker-stop",60385),graphLine:ce("graph-line",60386),graphScatter:ce("graph-scatter",60387),pieChart:ce("pie-chart",60388),bracketDot:ce("bracket-dot",60389),bracketError:ce("bracket-error",60390),lockSmall:ce("lock-small",60391),azureDevops:ce("azure-devops",60392),verifiedFilled:ce("verified-filled",60393),newline:ce("newline",60394),layout:ce("layout",60395),layoutActivitybarLeft:ce("layout-activitybar-left",60396),layoutActivitybarRight:ce("layout-activitybar-right",60397),layoutPanelLeft:ce("layout-panel-left",60398),layoutPanelCenter:ce("layout-panel-center",60399),layoutPanelJustify:ce("layout-panel-justify",60400),layoutPanelRight:ce("layout-panel-right",60401),layoutPanel:ce("layout-panel",60402),layoutSidebarLeft:ce("layout-sidebar-left",60403),layoutSidebarRight:ce("layout-sidebar-right",60404),layoutStatusbar:ce("layout-statusbar",60405),layoutMenubar:ce("layout-menubar",60406),layoutCentered:ce("layout-centered",60407),target:ce("target",60408),indent:ce("indent",60409),recordSmall:ce("record-small",60410),errorSmall:ce("error-small",60411),terminalDecorationError:ce("terminal-decoration-error",60411),arrowCircleDown:ce("arrow-circle-down",60412),arrowCircleLeft:ce("arrow-circle-left",60413),arrowCircleRight:ce("arrow-circle-right",60414),arrowCircleUp:ce("arrow-circle-up",60415),layoutSidebarRightOff:ce("layout-sidebar-right-off",60416),layoutPanelOff:ce("layout-panel-off",60417),layoutSidebarLeftOff:ce("layout-sidebar-left-off",60418),blank:ce("blank",60419),heartFilled:ce("heart-filled",60420),map:ce("map",60421),mapHorizontal:ce("map-horizontal",60421),foldHorizontal:ce("fold-horizontal",60421),mapFilled:ce("map-filled",60422),mapHorizontalFilled:ce("map-horizontal-filled",60422),foldHorizontalFilled:ce("fold-horizontal-filled",60422),circleSmall:ce("circle-small",60423),bellSlash:ce("bell-slash",60424),bellSlashDot:ce("bell-slash-dot",60425),commentUnresolved:ce("comment-unresolved",60426),gitPullRequestGoToChanges:ce("git-pull-request-go-to-changes",60427),gitPullRequestNewChanges:ce("git-pull-request-new-changes",60428),searchFuzzy:ce("search-fuzzy",60429),commentDraft:ce("comment-draft",60430),send:ce("send",60431),sparkle:ce("sparkle",60432),insert:ce("insert",60433),mic:ce("mic",60434),thumbsdownFilled:ce("thumbsdown-filled",60435),thumbsupFilled:ce("thumbsup-filled",60436),coffee:ce("coffee",60437),snake:ce("snake",60438),game:ce("game",60439),vr:ce("vr",60440),chip:ce("chip",60441),piano:ce("piano",60442),music:ce("music",60443),micFilled:ce("mic-filled",60444),repoFetch:ce("repo-fetch",60445),copilot:ce("copilot",60446),lightbulbSparkle:ce("lightbulb-sparkle",60447),robot:ce("robot",60448),sparkleFilled:ce("sparkle-filled",60449),diffSingle:ce("diff-single",60450),diffMultiple:ce("diff-multiple",60451),surroundWith:ce("surround-with",60452),share:ce("share",60453),gitStash:ce("git-stash",60454),gitStashApply:ce("git-stash-apply",60455),gitStashPop:ce("git-stash-pop",60456),vscode:ce("vscode",60457),vscodeInsiders:ce("vscode-insiders",60458),codeOss:ce("code-oss",60459),runCoverage:ce("run-coverage",60460),runAllCoverage:ce("run-all-coverage",60461),coverage:ce("coverage",60462),githubProject:ce("github-project",60463),mapVertical:ce("map-vertical",60464),foldVertical:ce("fold-vertical",60464),mapVerticalFilled:ce("map-vertical-filled",60465),foldVerticalFilled:ce("fold-vertical-filled",60465),goToSearch:ce("go-to-search",60466),percentage:ce("percentage",60467),sortPercentage:ce("sort-percentage",60467),attach:ce("attach",60468),goToEditingSession:ce("go-to-editing-session",60469),editSession:ce("edit-session",60470),codeReview:ce("code-review",60471),copilotWarning:ce("copilot-warning",60472),python:ce("python",60473),copilotLarge:ce("copilot-large",60474),copilotWarningLarge:ce("copilot-warning-large",60475),keyboardTab:ce("keyboard-tab",60476),copilotBlocked:ce("copilot-blocked",60477),copilotNotConnected:ce("copilot-not-connected",60478),flag:ce("flag",60479),lightbulbEmpty:ce("lightbulb-empty",60480),symbolMethodArrow:ce("symbol-method-arrow",60481),copilotUnavailable:ce("copilot-unavailable",60482),repoPinned:ce("repo-pinned",60483),keyboardTabAbove:ce("keyboard-tab-above",60484),keyboardTabBelow:ce("keyboard-tab-below",60485),gitPullRequestDone:ce("git-pull-request-done",60486),mcp:ce("mcp",60487),extensionsLarge:ce("extensions-large",60488),layoutPanelDock:ce("layout-panel-dock",60489),layoutSidebarLeftDock:ce("layout-sidebar-left-dock",60490),layoutSidebarRightDock:ce("layout-sidebar-right-dock",60491),copilotInProgress:ce("copilot-in-progress",60492),copilotError:ce("copilot-error",60493),copilotSuccess:ce("copilot-success",60494),chatSparkle:ce("chat-sparkle",60495),searchSparkle:ce("search-sparkle",60496),editSparkle:ce("edit-sparkle",60497),copilotSnooze:ce("copilot-snooze",60498),sendToRemoteAgent:ce("send-to-remote-agent",60499),commentDiscussionSparkle:ce("comment-discussion-sparkle",60500),chatSparkleWarning:ce("chat-sparkle-warning",60501),chatSparkleError:ce("chat-sparkle-error",60502),collection:ce("collection",60503),newCollection:ce("new-collection",60504),thinking:ce("thinking",60505),build:ce("build",60506),commentDiscussionQuote:ce("comment-discussion-quote",60507),cursor:ce("cursor",60508),eraser:ce("eraser",60509),fileText:ce("file-text",60510),quotes:ce("quotes",60512),rename:ce("rename",60513),runWithDeps:ce("run-with-deps",60514),debugConnected:ce("debug-connected",60515),strikethrough:ce("strikethrough",60516),openInProduct:ce("open-in-product",60517),indexZero:ce("index-zero",60518),agent:ce("agent",60519),editCode:ce("edit-code",60520),repoSelected:ce("repo-selected",60521),skip:ce("skip",60522),mergeInto:ce("merge-into",60523),gitBranchChanges:ce("git-branch-changes",60524),gitBranchStagedChanges:ce("git-branch-staged-changes",60525),gitBranchConflicts:ce("git-branch-conflicts",60526),gitBranch:ce("git-branch",60527),gitBranchCreate:ce("git-branch-create",60527),gitBranchDelete:ce("git-branch-delete",60527),searchLarge:ce("search-large",60528),terminalGitBash:ce("terminal-git-bash",60529),windowActive:ce("window-active",60530),forward:ce("forward",60531),download:ce("download",60532),clockface:ce("clockface",60533),unarchive:ce("unarchive",60534),sessionInProgress:ce("session-in-progress",60535),collectionSmall:ce("collection-small",60536),vmSmall:ce("vm-small",60537),cloudSmall:ce("cloud-small",60538),addSmall:ce("add-small",60539),removeSmall:ce("remove-small",60540),worktreeSmall:ce("worktree-small",60541),worktree:ce("worktree",60542),screenCut:ce("screen-cut",60543),ask:ce("ask",60544),openai:ce("openai",60545),claude:ce("claude",60546),openInWindow:ce("open-in-window",60547),newSession:ce("new-session",60548)};function k$(){return Object.values(M)}var MRo={dialogError:ce("dialog-error","error"),dialogWarning:ce("dialog-warning","warning"),dialogInfo:ce("dialog-info","info"),dialogClose:ce("dialog-close","close"),treeItemExpanded:ce("tree-item-expanded","chevron-down"),treeFilterOnTypeOn:ce("tree-filter-on-type-on","list-filter"),treeFilterOnTypeOff:ce("tree-filter-on-type-off","list-selection"),treeFilterClear:ce("tree-filter-clear","close"),treeItemLoading:ce("tree-item-loading","loading"),menuSelection:ce("menu-selection","check"),menuSubmenu:ce("menu-submenu","chevron-right"),menuBarMore:ce("menubar-more","more"),scrollbarButtonLeft:ce("scrollbar-button-left","triangle-left"),scrollbarButtonRight:ce("scrollbar-button-right","triangle-right"),scrollbarButtonUp:ce("scrollbar-button-up","triangle-up"),scrollbarButtonDown:ce("scrollbar-button-down","triangle-down"),toolBarMore:ce("toolbar-more","more"),quickInputBack:ce("quick-input-back","arrow-left"),dropDownButton:ce("drop-down-button",60084),symbolCustomColor:ce("symbol-customcolor",60252),exportIcon:ce("export",60332),workspaceUnspecified:ce("workspace-unspecified",60355),newLine:ce("newline",60394),thumbsDownFilled:ce("thumbsdown-filled",60435),thumbsUpFilled:ce("thumbsup-filled",60436),gitFetch:ce("git-fetch",60445),lightbulbSparkleAutofix:ce("lightbulb-sparkle-autofix",60447),debugBreakpointPending:ce("debug-breakpoint-pending",60377)},M={...R6,...MRo};var Gzi;(i=>{function a(e){return!!e&&typeof e=="object"&&typeof e.id=="string"}i.isThemeColor=a})(Gzi||={});function If(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(M.error);let[,k,T]=w,N=["codicon","codicon-"+k];return T&&N.push("codicon-modifier-"+T.substring(1)),N}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"||Gzi.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===M.file.id}S.isFile=v;function b(y){return y?.id===M.folder.id}S.isFolder=b})(q||={});var ge=ae("commandService"),qe=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 wUi(c,r),s(l,...c)}}let{id:e}=a,t=this._commands.get(e);t||(t=new Vs,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),Mp(n)}registerCommandAlias(a,i){return qe.registerCommand(a,(e,...t)=>e.get(ge).executeCommand(i,...t))}getCommand(a){let i=this._commands.get(a);if(!(!i||i.isEmpty()))return ht.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}};qe.registerCommand("noop",()=>{});function p7t(...a){switch(a.length){case 1:return d(1862,null,a[0]);case 2:return d(1863,null,a[0],a[1]);case 3:return d(1864,null,a[0],a[1],a[2]);default:return}}var PRo=d(1861,null),ARo=d(1860,null),M6=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 Xve(`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(p7t("==","=~"));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(p7t("&&"));break;case 124:this._match(124)?this._addToken(16):this._error(p7t("||"));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(PRo);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(ARo);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 xS=new Map;xS.set("false",!1);xS.set("true",!0);xS.set("isMac",it);xS.set("isLinux",Wn);xS.set("isWindows",ri);xS.set("isWeb",Gt);xS.set("isMacNative",it&&!Gt);xS.set("isEdge",dbe);xS.set("isFirefox",lbe);xS.set("isChrome",XH);xS.set("isSafari",cbe);function Qzi(a,i){if(xS.get(a)!==void 0)throw Br("contextkey.setConstant(k, v) invoked with already set constant `k`");xS.set(a,i)}var NRo=Object.prototype.hasOwnProperty;var ORo={regexParsingWithErrorRecovery:!0},FRo=d(1841,null),WRo=d(1842,null),VRo=d(1844,null),$zi=d(1840,null),BRo=d(1847,null),HRo=d(1848,null),URo=d(1845,null),zRo=d(1846,null),m7t=class a{constructor(i=ORo){this._config=i;this._scanner=new M6;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:FRo,offset:0,lexeme:"",additionalInfo:WRo});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?HRo:void 0;throw this._parsingErrors.push({message:BRo,offset:t.offset,lexeme:M6.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]:x.or(...i)}_and(){let i=[this._term()];for(;this._matchOne(15);){let e=this._term();i.push(e)}return i.length===1?i[0]:x.and(...i)}_term(){if(this._matchOne(2)){let i=this._peek();switch(i.type){case 11:return this._advance(),Ry.INSTANCE;case 12:return this._advance(),PI.INSTANCE;case 0:{this._advance();let e=this._expr();return this._consume(1,$zi),e?.negate()}case 17:return this._advance(),Bre.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(),x.true();case 12:return this._advance(),x.false();case 0:{this._advance();let e=this._expr();return this._consume(1,$zi),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 VGe.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(M6.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 x.regex(e,p)}case 18:{let n=o.lexeme;this._advance();let r=null;if(!Jl(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 VGe.create(e,r)}default:throw this._errExpectedButGot("REGEX",this._peek())}}if(this._matchOne(14)){this._consume(13,VRo);let o=this._value();return x.notIn(e,o)}switch(this._peek().type){case 3:{this._advance();let o=this._value();if(this._previous().type===18)return x.equals(e,o);switch(o){case"true":return x.has(e);case"false":return x.not(e);default:return x.equals(e,o)}}case 4:{this._advance();let o=this._value();if(this._previous().type===18)return x.notEquals(e,o);switch(o){case"true":return x.not(e);case"false":return x.has(e);default:return x.notEquals(e,o)}}case 5:return this._advance(),FGe.create(e,this._value());case 6:return this._advance(),WGe.create(e,this._value());case 7:return this._advance(),P6.create(e,this._value());case 8:return this._advance(),OGe.create(e,this._value());case 13:return this._advance(),x.in(e,this._value());default:return x.has(e)}}case 20:throw this._parsingErrors.push({message:URo,offset:i.offset,lexeme:"",additionalInfo:zRo}),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(1843,null,i,M6.getLexeme(e)),n=e.offset,r=M6.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}},x=class{static false(){return Ry.INSTANCE}static true(){return PI.INSTANCE}static has(i){return zk.create(i)}static equals(i,e){return eW.create(i,e)}static notEquals(i,e){return NGe.create(i,e)}static regex(i,e){return VGe.create(i,e)}static in(i,e){return lmt.create(i,e)}static notIn(i,e){return cmt.create(i,e)}static not(i){return Bre.create(i)}static and(...i){return dmt.create(i,null,!0)}static or(...i){return BGe.create(i,null,!0)}static greater(i,e){return P6.create(i,e)}static greaterEquals(i,e){return OGe.create(i,e)}static smaller(i,e){return FGe.create(i,e)}static smallerEquals(i,e){return WGe.create(i,e)}static{this._parser=new m7t({regexParsingWithErrorRecovery:!1})}static deserialize(i){return i==null?void 0:this._parser.parse(i)}};function Yzi(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 AGe(a,i){return a.cmp(i)}var Ry=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 PI.INSTANCE}},PI=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 Ry.INSTANCE}},zk=class a{constructor(i,e){this.key=i;this.negated=e;this.type=2}static create(i,e=null){let t=xS.get(i);return typeof t=="boolean"?t?PI.INSTANCE:Ry.INSTANCE:new a(i,e)}cmp(i){return i.type!==this.type?this.type-i.type:Jzi(this.key,i.key)}equals(i){return i.type===this.type?this.key===i.key:!1}substituteConstants(){let i=xS.get(this.key);return typeof i=="boolean"?i?PI.INSTANCE:Ry.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=Bre.create(this.key,this)),this.negated}},eW=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?zk.create(i,t):Bre.create(i,t);let o=xS.get(i);return typeof o=="boolean"?e===(o?"true":"false")?PI.INSTANCE:Ry.INSTANCE:new a(i,e,t)}cmp(i){return i.type!==this.type?this.type-i.type:Hre(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=xS.get(this.key);if(typeof i=="boolean"){let e=i?"true":"false";return this.value===e?PI.INSTANCE:Ry.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=NGe.create(this.key,this.value,this)),this.negated}},lmt=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:Hre(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(ri&&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(NRo.call(e,t))return!0;if(ri&&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=cmt.create(this.key,this.valueKey)),this.negated}},cmt=class a{constructor(i,e){this.key=i;this.valueKey=e;this.type=11;this._negated=lmt.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}},NGe=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?Bre.create(i,t):zk.create(i,t);let o=xS.get(i);return typeof o=="boolean"?e===(o?"true":"false")?Ry.INSTANCE:PI.INSTANCE:new a(i,e,t)}cmp(i){return i.type!==this.type?this.type-i.type:Hre(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=xS.get(this.key);if(typeof i=="boolean"){let e=i?"true":"false";return this.value===e?Ry.INSTANCE:PI.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=eW.create(this.key,this.value,this)),this.negated}},Bre=class a{constructor(i,e){this.key=i;this.negated=e;this.type=3}static create(i,e=null){let t=xS.get(i);return typeof t=="boolean"?t?Ry.INSTANCE:PI.INSTANCE:new a(i,e)}cmp(i){return i.type!==this.type?this.type-i.type:Jzi(this.key,i.key)}equals(i){return i.type===this.type?this.key===i.key:!1}substituteConstants(){let i=xS.get(this.key);return typeof i=="boolean"?i?Ry.INSTANCE:PI.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=zk.create(this.key,this)),this.negated}};function pmt(a,i){if(typeof a=="string"){let e=parseFloat(a);isNaN(e)||(a=e)}return typeof a=="string"||typeof a=="number"?i(a):Ry.INSTANCE}var P6=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 pmt(e,o=>new a(i,o,t))}cmp(i){return i.type!==this.type?this.type-i.type:Hre(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=WGe.create(this.key,this.value,this)),this.negated}},OGe=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 pmt(e,o=>new a(i,o,t))}cmp(i){return i.type!==this.type?this.type-i.type:Hre(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=FGe.create(this.key,this.value,this)),this.negated}},FGe=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 pmt(e,o=>new a(i,o,t))}cmp(i){return i.type!==this.type?this.type-i.type:Hre(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=OGe.create(this.key,this.value,this)),this.negated}},WGe=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 pmt(e,o=>new a(i,o,t))}cmp(i){return i.type!==this.type?this.type-i.type:Hre(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=P6.create(this.key,this.value,this)),this.negated}},VGe=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=h7t.create(this)),this.negated}},h7t=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 Xzi(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 dmt=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=AGe(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=Xzi(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 Ry.INSTANCE;if(r.type===6){o.push(...r.expr);continue}o.push(r)}if(o.length===0&&n)return PI.INSTANCE;if(o.length!==0){if(o.length===1)return o[0];o.sort(AGe);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=BGe.create(r.expr.map(u=>a.create([u,s],null,t)),null,l);c&&(o.push(c),o.sort(AGe))}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 Ry.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=BGe.create(i,this,!0)}return this.negated}},BGe=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=AGe(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=Xzi(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 PI.INSTANCE;if(l.type===9){o=o.concat(l.expr);continue}o.push(l)}}if(o.length===0&&n)return Ry.INSTANCE;o.sort(AGe)}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 PI.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 jzi(e))for(let r of jzi(t))o.push(dmt.create([n,r],null,!1));i.unshift(a.create(o,null,!1))}this.negated=a.create(i,this,!0)}return this.negated}},Q=class a extends zk{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 eW.create(this.key,i)}notEqualsTo(i){return NGe.create(this.key,i)}greater(i){return P6.create(this.key,i)}},X=ae("contextKeyService");function Jzi(a,i){return a<i?-1:a>i?1:0}function Hre(a,i,e,t){return a<e?-1:a>e?1:i<t?-1:i>t?1:0}function umt(a,i){if(a.type===0||i.type===1)return!0;if(a.type===9)return i.type===9?qzi(a.expr,i.expr):!1;if(i.type===9){for(let e of i.expr)if(umt(a,e))return!0;return!1}if(a.type===6){if(i.type===6)return qzi(i.expr,a.expr);for(let e of a.expr)if(umt(e,i))return!0;return!1}return a.equals(i)}function qzi(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 jzi(a){return a.type===9?a.expr:[a]}var g7t=class{constructor(){this.data=new Map}add(i,e){c6(Ae(i)),c6(yi(e)),c6(!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=>{HD(i.dispose)&&i.dispose()}),this.data.clear()}},oe=new g7t;var f7t=class a{constructor(){this._coreKeybindings=new Vs,this._extensionKeybindings=[],this._cachedMergedKeybindings=null}static bindToCurrentPlatform(i){if(zo===1){if(i&&i.win)return i.win}else if(zo===2){if(i&&i.mac)return i.mac}else if(i&&i.linux)return i.linux;return i}registerKeybindingRule(i){let e=a.bindToCurrentPlatform(i),t=new P;if(e&&e.primary){let o=Z6t(e.primary,zo);o&&t.add(this._registerDefaultKeybinding(o,i.id,i.args,i.weight,0,i.when))}if(e&&Array.isArray(e.secondary))for(let o=0,n=e.secondary.length;o<n;o++){let r=e.secondary[o],s=Z6t(r,zo);s&&t.add(this._registerDefaultKeybinding(s,i.id,i.args,i.weight,-o-1,i.when))}return 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 hn(this.registerKeybindingRule(i),qe.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(GRo)),this._cachedMergedKeybindings.slice(0)}},yt=new f7t,KRo={EditorModes:"platform.keybindingsRegistry"};oe.add(KRo.EditorModes,yt);function GRo(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 Kk(a){return a.command!==void 0}function Zzi(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.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.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.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 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}},qt=ae("menuService"),Ure=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}},fe=new class{constructor(){this._commands=new Map;this._menuItems=new Map;this._onDidChangeMenu=new d6({merge:Ure.merge});this.onDidChangeMenu=this._onDidChangeMenu.event}addCommand(a){return this._commands.set(a.id,a),this._onDidChangeMenu.fire(Ure.for(D.CommandPalette)),Mp(Z(()=>{this._commands.delete(a.id)&&this._onDidChangeMenu.fire(Ure.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 Vs,this._menuItems.set(a,e));let t=e.push(i);return this._onDidChangeMenu.fire(Ure.for(a)),Mp(Z(()=>{t(),this._onDidChangeMenu.fire(Ure.for(a))}))}appendMenuItems(a){let i=new P;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)Kk(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})})}},Cc=class extends $l{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}},Eo=class{constructor(i,e,t,o,n,r,s){this.hideActions=o;this.menuKeybinding=n;this._commandService=s;this.id=i.id,this.label=Eo.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 Eo(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)}};Eo=I([m(5,X),m(6,ge)],Eo);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(qe.getCommand(r.id))throw new Error(`Cannot register two commands with the same id: ${r.id}`);if(i.push(qe.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(fe.appendMenuItem(s.id,{command:{...r,precondition:s.precondition===null?void 0:r.precondition},...s}));else o&&i.push(fe.appendMenuItem(o.id,{command:{...r,precondition:o.precondition===null?void 0:r.precondition},...o}));if(t&&(i.push(fe.appendMenuItem(D.CommandPalette,{command:r,when:r.precondition})),i.push(fe.addCommand(r))),Array.isArray(n))for(let s of n)i.push(yt.registerKeybindingRule({...s,id:r.id,when:r.precondition?x.and(r.precondition,s.when):s.when}));else n&&i.push(yt.registerKeybindingRule({...n,id:r.id,when:r.precondition?x.and(r.precondition,n.when):n.when}));return{dispose(){Ue(i)}}}var Te=ae("telemetryService");function eKi(a,i){return a.telemetryLevel>=i}var mmt=ae("customEndpointTelemetryService");var tKi="telemetry.firstSessionDate",iKi="telemetry.lastSessionDate";var oKi="telemetry",bN="telemetry.telemetryLevel",hmt="telemetry.enableCrashReporter",zre="telemetry.enableTelemetry";function v7t(a,i){return i&&(a.stack||a.stacktrace)?d(116,null,rKi(a),nKi(a.stack)||nKi(a.stacktrace)):rKi(a)}function nKi(a){return Array.isArray(a)?a.join(`
`):a}function rKi(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 In(a=null,i=!1){if(!a)return d(113,null);if(Array.isArray(a)){let e=si(a),t=In(e[0],i);return e.length>1?d(114,null,t,e.length):t}if(Ae(a))return a;if(a.detail){let e=a.detail;if(e.error)return v7t(e.error,i);if(e.exception)return v7t(e.exception,i)}return a.stack?v7t(a,i):a.message?a.message:d(113,null)}function A6(a){let i=a;return i instanceof Error&&Array.isArray(i.actions)}function dU(a,i){let e;return typeof a=="string"?e=new Error(a):e=a,e.actions=i,e}var ne=ae("logService"),ol=ae("loggerService");function N6(a){return Xo(a)}var UGe=3;function eSe(a,i){return a!==0&&a<=i}function Kre(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 Jbe(a,i=!1){let e="";for(let t=0;t<a.length;t++){let o=a[t];if(o instanceof Error&&(o=In(o,i)),typeof o=="object")try{o=JSON.stringify(o)}catch{}e+=(t>0?" ":"")+o}return e}var uU=class extends C{constructor(){super(...arguments);this.level=UGe;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 eSe(this.level,e)}canLog(e){return this._store.isDisposed?!1:this.checkLogLevel(e)}},Zbe=class extends uU{constructor(e){super();this.logAlways=e}checkLogLevel(e){return this.logAlways||super.checkLogLevel(e)}trace(e,...t){this.canLog(1)&&this.log(1,Jbe([e,...t],!0))}debug(e,...t){this.canLog(2)&&this.log(2,Jbe([e,...t]))}info(e,...t){this.canLog(3)&&this.log(3,Jbe([e,...t]))}warn(e,...t){this.canLog(4)&&this.log(4,Jbe([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,Jbe(o))}else this.log(5,Jbe([e,...t]))}flush(){}};var gmt=class extends uU{constructor(e=UGe,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(){}},HGe=class extends uU{constructor(e,t=UGe){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:In(e,this.canLog(1))}flush(){}},fmt=class extends uU{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()}},vmt=class extends C{constructor(e,t,o){super();this.logLevel=e;this.logsHome=t;this._loggers=new vt;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 Ae(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=Ae(e)?e:t?.id??Ir(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 Ae(e)?je(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()}},b7t=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(){}},bmt=class extends b7t{};function S7t(a){if(a.verbose)return 1;if(typeof a.logLevel=="string"){let i=Gre(a.logLevel.toLowerCase());if(i!==void 0)return i}return UGe}function $w(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 zGe(a){switch(a){case 1:return{original:"Trace",value:d(2144,null)};case 2:return{original:"Debug",value:d(2140,null)};case 3:return{original:"Info",value:d(2142,null)};case 4:return{original:"Warning",value:d(2145,null)};case 5:return{original:"Error",value:d(2141,null)};case 0:return{original:"Off",value:d(2143,null)}}}function Gre(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 sKi=new Q("logLevel",$w(3));var tSe=class a{static{this.REGISTERED_COMMANDS=new Set}static getRegisteredCommands(){return[...a.REGISTERED_COMMANDS]}static registerCommand(i){a.REGISTERED_COMMANDS.add(i)}};var $re=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=x.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};yt.registerKeybindingRule(o)}}qe.registerCommand({id:this.id,handler:(i,e)=>this.runCommand(i,e),metadata:this.metadata}),this.canTriggerInlineEdits&&tSe.registerCommand(this.id)}_registerMenuItem(i){fe.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})}},SN=class extends $re{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(ne),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(Pn());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.`)}},Smt=class extends $re{constructor(e,t){super(t);this.command=e}runCommand(e,t){return this.command.runCommand(e,t)}},xc=class a extends $re{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(Kt),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))}},xi=class a extends xc{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=x.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})}},qre=class extends xi{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}}},wl=class extends K{run(i,...e){let t=i.get(Kt),o=t.getFocusedCodeEditor()||t.getActiveCodeEditor();if(o)return o.invokeWithinContext(n=>{let r=n.get(X),s=n.get(ne);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 kS(a,i){qe.registerCommand(a,function(e,...t){let o=e.get(F),[n,r]=t;So(A.isUri(n)),So(Ie.isIPosition(r));let s=e.get(Ct).getModel(n);if(s){let l=Ie.lift(r);return o.invokeFunction(i,s,l,...t.slice(2))}return e.get(Nt).createModelReference(n).then(l=>new Promise((c,u)=>{try{let p=o.invokeFunction(i,l.object.textEditorModel,Ie.lift(r),t.slice(2));c(p)}catch(p){u(p)}}).finally(()=>{l.dispose()}))})}function qi(a){return iL.INSTANCE.registerEditorCommand(a),a}function Jt(a){let i=new a;return iL.INSTANCE.registerEditorAction(i),i}function KGe(a){return iL.INSTANCE.registerEditorAction(a),a}function aKi(a){iL.INSTANCE.registerEditorAction(a)}function go(a,i,e){iL.INSTANCE.registerEditorContribution(a,i,e)}function Imt(a,i){iL.INSTANCE.registerDiffEditorContribution(a,i)}var aa;(n=>{function a(r){return iL.INSTANCE.getEditorCommand(r)}n.getEditorCommand=a;function i(){return iL.INSTANCE.getEditorActions()}n.getEditorActions=i;function e(){return iL.INSTANCE.getEditorContributions()}n.getEditorContributions=e;function t(r){return iL.INSTANCE.getEditorContributions().filter(s=>r.indexOf(s.id)>=0)}n.getSomeEditorContributions=t;function o(){return iL.INSTANCE.getDiffEditorContributions()}n.getDiffEditorContributions=o})(aa||={});var $Ro={EditorCommonContributions:"editor.contributions"},iL=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}};oe.add($Ro.EditorCommonContributions,iL.INSTANCE);function GGe(a){return a.register(),a}var BT=GGe(new SN({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}]}));GGe(new Smt(BT,{id:"default:undo",precondition:void 0}));var HT=GGe(new SN({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}]}));GGe(new Smt(HT,{id:"default:redo",precondition:void 0}));var ymt=GGe(new SN({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 Xi(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"?Xi(t):t}),i}function lKi(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(cKi.call(e,t)){let o=e[t];typeof o=="object"&&!Object.isFrozen(o)&&!yUi(o)&&i.push(o)}}return a}var cKi=Object.prototype.hasOwnProperty;function Gk(a,i){return I7t(a,i,new Set)}function I7t(a,i,e){if(Jn(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(I7t(n,i,e));return o}if(yi(a)){if(e.has(a))throw new Error("Cannot clone recursive data-structure");e.add(a);let o={};for(let n in a)cKi.call(a,n)&&(o[n]=I7t(a[n],i,e));return e.delete(a),o}return a}function Nu(a,i,e=!0){return yi(a)?(yi(i)&&Object.keys(i).forEach(t=>{t in a?e&&(yi(a[t])&&yi(i[t])?Nu(a[t],i[t],e):a[t]=i[t]):a[t]=i[t]}),a):i}function uo(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(!uo(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(),!uo(o,n))return!1;for(e=0;e<o.length;e++)if(!uo(a[o[e]],i[o[e]]))return!1}return!0}function pU(a){let i=new Set;return JSON.stringify(a,(e,t)=>{if(yi(t)||Array.isArray(t)){if(i.has(t))return"[Circular]";i.add(t)}return typeof t=="bigint"?`[BigInt ${t.toString()}]`:t})}function $Ge(a,i){let e=Object.create(null);return!a||!i||Object.keys(i).forEach(o=>{let n=a[o],r=i[o];uo(n,r)||(e[o]=r)}),e}function DM(a,i){let e=Object.create(null);for(let[t,o]of Object.entries(a))i(t,o)&&(e[t]=o);return e}function iSe(a,i){let e={};for(let[t,o]of Object.entries(a))e[t]=i(o,t);return e}var w7t=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}}},UT=class extends C{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 w7t(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 Cmt(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=Cmt.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)))}},wmt=class{constructor(i,e,t){this.scrollLeft=i,this.scrollTop=e,this.isDone=t}};function y7t(a,i){let e=i-a;return function(t){return a+e*QRo(t)}}function qRo(a,i,e){return function(t){return t<e?a(t/e):i((t-e)/(1-e))}}var Cmt=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),qRo(y7t(i,n),y7t(r,e),.33)}return y7t(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 wmt(t,o,!1)}return new wmt(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 jRo(a){return Math.pow(a,3)}function QRo(a){return 1-jRo(1-a)}var $k=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 x7t=it?1.5:1.35,C7t=8,oSe=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=x7t*t:r<C7t&&(r=r*t),r=Math.round(r),r<C7t&&(r=C7t);let u=1+(c?0:$k.getZoomLevel()*.1);return t*=u,r*=u,n===T7t&&(e==="normal"||e==="bold"?n=E7t:(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=Yd.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}},k7t=2,O6=class extends oSe{constructor(e,t){super(e);this._editorStylingBrand=void 0;this.version=k7t;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}},E7t="normal",T7t="translate",YRo="Consolas, 'Courier New', monospace",XRo="Menlo, Monaco, 'Courier New', monospace",JRo="'Droid Sans Mono', monospace",Yd={fontFamily:it?XRo:ri?YRo:JRo,fontWeight:"normal",fontSize:it?12:14,lineHeight:0,letterSpacing:0};var iv={tabSize:4,indentSize:4,insertSpaces:!0,detectIndentation:!0,trimAutoWhitespace:!0,largeFileOptimizations:!0,bracketPairColorizationOptions:{enabled:!0,independentColorPoolPerBracketType:!1}};var tW="`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?";function ZRo(a=""){let i="(-?\\d*\\.\\d\\w*)|([^";for(let e of tW)a.indexOf(e)>=0||(i+="\\"+e);return i+="\\s]+)",new RegExp(i,"g")}var F6=ZRo();function E$(a){let i=F6;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 dKi=new Vs;dKi.unshift({maxLen:1e3,windowSize:15,timeBudget:150});function My(a,i,e,t,o){if(i=E$(i),o||(o=ht.first(dKi)),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),My(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=eMo(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 eMo(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 Bi=ae("accessibilityService");var $a=new Q("accessibilityModeEnabled",!1);function uKi(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 qGe="ACCESSIBLE_VIEW_SHOWN_";var iW=8,xmt=class{constructor(i){this._values=i}hasChanged(i){return this._values[i]}},jGe=class{constructor(){this.stableMinimapLayoutInput=null,this.stableFitMaxMinimapScale=0,this.stableFitRemainingWidth=0}},Fu=class{constructor(i,e,t,o){this.id=i,this.name=e,this.defaultValue=t,this.schema=o}applyUpdate(i,e){return Emt(i,e)}compute(i,e,t){return t}},nSe=class{constructor(i,e){this.newValue=i;this.didChange=e}};function Emt(a,i){if(typeof a!="object"||typeof i!="object"||!a||!i)return new nSe(i,a!==i);if(Array.isArray(a)||Array.isArray(i)){let t=Array.isArray(a)&&Array.isArray(i)&&$i(a,i);return new nSe(i,!t)}let e=!1;for(let t in i)if(i.hasOwnProperty(t)){let o=Emt(a[t],i[t]);o.didChange&&(a[t]=o.newValue,e=!0)}return new nSe(a,e)}var mU=class{constructor(i,e){this.schema=void 0;this.id=i,this.name="_never_",this.defaultValue=e}applyUpdate(i,e){return Emt(i,e)}validate(i){return this.defaultValue}},W6=class{constructor(i,e,t,o){this.id=i,this.name=e,this.defaultValue=t,this.schema=o}applyUpdate(i,e){return Emt(i,e)}compute(i,e,t){return t}};function Sn(a,i){return typeof a>"u"?i:a==="false"?!1:!!a}var fs=class extends W6{constructor(i,e,t,o=void 0){typeof o<"u"&&(o.type="boolean",o.default=t),super(i,e,t,o)}validate(i){return Sn(i,this.defaultValue)}};function oW(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 Vc=class a extends W6{static clampedInt(i,e,t,o){return oW(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 mKi(a,i,e,t){if(typeof a>"u")return i;let o=qk.float(a,i);return qk.clamp(o,e,t)}var qk=class a extends W6{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))}},qw=class a extends W6{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 Md(a,i,e,t){return typeof a!="string"?i:t&&a in t?t[a]:e.indexOf(a)===-1?i:a}var Ou=class extends W6{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 Md(i,this.defaultValue,this._allowedValues)}},jre=class extends Fu{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 tMo(a){switch(a){case"none":return 0;case"keep":return 1;case"brackets":return 2;case"advanced":return 3;case"full":return 4}}var _7t=class extends Fu{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}},D7t=class extends Fu{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:Sn(e.insertSpace,this.defaultValue.insertSpace),ignoreEmptyLines:Sn(e.ignoreEmptyLines,this.defaultValue.ignoreEmptyLines)}}};function gYt(a){switch(a){case"blink":return 1;case"smooth":return 2;case"phase":return 3;case"expand":return 4;case"solid":return 5}}function hKi(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 kmt(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 L7t=class extends mU{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(" ")}},R7t=class extends fs{constructor(){super(45,"emptySelectionClipboard",!0,{description:d(468,null)})}compute(i,e,t){return t&&i.emptySelectionClipboard}},M7t=class extends Fu{constructor(){let i={cursorMoveOnType:!0,findOnType:!0,seedSearchStringFromSelection:"always",autoFindInSelection:"never",globalFindClipboard:!1,addExtraSpaceOnTop:!0,loop:!0,history:"workspace",replaceHistory:"workspace"};super(50,"find",i,{"editor.find.cursorMoveOnType":{type:"boolean",default:i.cursorMoveOnType,description:d(480,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(486,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(482,null),included:it},"editor.find.addExtraSpaceOnTop":{type:"boolean",default:i.addExtraSpaceOnTop,description:d(478,null)},"editor.find.loop":{type:"boolean",default:i.loop,description:d(484,null)},"editor.find.history":{type:"string",enum:["never","workspace"],default:"workspace",enumDescriptions:[d(399,null),d(400,null)],description:d(483,null)},"editor.find.replaceHistory":{type:"string",enum:["never","workspace"],default:"workspace",enumDescriptions:[d(401,null),d(402,null)],description:d(485,null)},"editor.find.findOnType":{type:"boolean",default:i.findOnType,description:d(481,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{cursorMoveOnType:Sn(e.cursorMoveOnType,this.defaultValue.cursorMoveOnType),findOnType:Sn(e.findOnType,this.defaultValue.findOnType),seedSearchStringFromSelection:typeof e.seedSearchStringFromSelection=="boolean"?e.seedSearchStringFromSelection?"always":"never":Md(e.seedSearchStringFromSelection,this.defaultValue.seedSearchStringFromSelection,["never","always","selection"]),autoFindInSelection:typeof e.autoFindInSelection=="boolean"?e.autoFindInSelection?"always":"never":Md(e.autoFindInSelection,this.defaultValue.autoFindInSelection,["never","always","multiline"]),globalFindClipboard:Sn(e.globalFindClipboard,this.defaultValue.globalFindClipboard),addExtraSpaceOnTop:Sn(e.addExtraSpaceOnTop,this.defaultValue.addExtraSpaceOnTop),loop:Sn(e.loop,this.defaultValue.loop),history:Md(e.history,this.defaultValue.history,["never","workspace"]),replaceHistory:Md(e.replaceHistory,this.defaultValue.replaceHistory,["never","workspace"])}}},mx=class a extends Fu{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(496,null)},{type:"string",description:d(495,null)}],description:d(497,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}},P7t=class a extends Fu{static{this.OFF=E7t}static{this.TRANSLATE=T7t}constructor(){super(63,"fontVariations",a.OFF,{anyOf:[{type:"boolean",description:d(499,null)},{type:"string",description:d(500,null)}],description:d(501,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}},A7t=class extends mU{constructor(){super(59,new O6({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}},N7t=class extends mU{constructor(){super(161,1)}compute(i,e,t){return i.inputMode==="overtype"?e.get(92):e.get(34)}},O7t=class extends mU{constructor(){super(170,!1)}compute(i,e){return i.editContextSupported&&e.get(44)}},F7t=class extends mU{constructor(){super(172,!1)}compute(i,e){return i.accessibilitySupport===2?e.get(7):e.get(6)}},W7t=class extends W6{constructor(){super(61,"fontSize",Yd.fontSize,{type:"number",minimum:6,maximum:100,default:Yd.fontSize,description:d(498,null)})}validate(i){let e=qk.float(i,this.defaultValue);return e===0?Yd.fontSize:qk.clamp(e,6,100)}compute(i,e,t){return i.fontInfo.fontSize}},V7t=class a extends Fu{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",Yd.fontWeight,{anyOf:[{type:"number",minimum:a.MINIMUM_VALUE,maximum:a.MAXIMUM_VALUE,errorMessage:d(503,null)},{type:"string",pattern:"^(normal|bold|1000|[1-9][0-9]{0,2})$"},{enum:a.SUGGESTION_VALUES}],default:Yd.fontWeight,description:d(502,null)})}validate(i){return i==="normal"||i==="bold"?i:String(Vc.clampedInt(i,Yd.fontWeight,a.MINIMUM_VALUE,a.MAXIMUM_VALUE))}},B7t=class extends Fu{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:Md(e.multiple,this.defaultValue.multiple,["peek","gotoAndPeek","goto"]),multipleDefinitions:Md(e.multipleDefinitions,"peek",["peek","gotoAndPeek","goto"]),multipleTypeDefinitions:Md(e.multipleTypeDefinitions,"peek",["peek","gotoAndPeek","goto"]),multipleDeclarations:Md(e.multipleDeclarations,"peek",["peek","gotoAndPeek","goto"]),multipleImplementations:Md(e.multipleImplementations,"peek",["peek","gotoAndPeek","goto"]),multipleReferences:Md(e.multipleReferences,"peek",["peek","gotoAndPeek","goto"]),multipleTests:Md(e.multipleTests,"peek",["peek","gotoAndPeek","goto"]),alternativeDefinitionCommand:qw.string(e.alternativeDefinitionCommand,this.defaultValue.alternativeDefinitionCommand),alternativeTypeDefinitionCommand:qw.string(e.alternativeTypeDefinitionCommand,this.defaultValue.alternativeTypeDefinitionCommand),alternativeDeclarationCommand:qw.string(e.alternativeDeclarationCommand,this.defaultValue.alternativeDeclarationCommand),alternativeImplementationCommand:qw.string(e.alternativeImplementationCommand,this.defaultValue.alternativeImplementationCommand),alternativeReferenceCommand:qw.string(e.alternativeReferenceCommand,this.defaultValue.alternativeReferenceCommand),alternativeTestsCommand:qw.string(e.alternativeTestsCommand,this.defaultValue.alternativeTestsCommand)}}},H7t=class extends Fu{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(512,null),d(511,null),d(513,null,it?"Command":"Control")],description:d(510,null)},"editor.hover.delay":{type:"number",default:i.delay,minimum:0,maximum:1e4,description:d(509,null)},"editor.hover.sticky":{type:"boolean",default:i.sticky,description:d(516,null)},"editor.hover.hidingDelay":{type:"integer",minimum:0,default:i.hidingDelay,markdownDescription:d(514,null)},"editor.hover.above":{type:"boolean",default:i.above,description:d(508,null)},"editor.hover.showLongLineWarning":{type:"boolean",default:i.showLongLineWarning,description:d(515,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{enabled:Md(e.enabled,this.defaultValue.enabled,["on","off","onKeyboardModifier"]),delay:Vc.clampedInt(e.delay,this.defaultValue.delay,0,1e4),sticky:Sn(e.sticky,this.defaultValue.sticky),hidingDelay:Vc.clampedInt(e.hidingDelay,this.defaultValue.hidingDelay,0,6e5),above:Sn(e.above,this.defaultValue.above),showLongLineWarning:Sn(e.showLongLineWarning,this.defaultValue.showLongLineWarning)}}};var QGe=class a extends mU{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),N=T/n,O=!1,V=!1,U=k*h,G=h/n,$=1;if(f==="fill"||f==="fit"){let{typicalViewportLineCount:Ee,extraLinesBeforeFirstLine:He,extraLinesBeyondLastLine:Ve,desiredRatio:Fe,minimapLineCount:Qt}=a.computeContainedMinimapLineCount({viewLineCount:S,scrollBeyondLastLine:u,paddingTop:i.paddingTop,paddingBottom:i.paddingBottom,height:o,lineHeight:l,pixelRatio:n});if(S/Qt>1)O=!0,V=!0,h=1,U=1,G=h/n;else{let Ti=!1,ti=h+1;if(f==="fit"){let bo=Math.ceil((He+S+Ve)*U);w&&s&&y<=e.stableFitRemainingWidth?(Ti=!0,ti=e.stableFitMaxMinimapScale):Ti=bo>T}if(f==="fill"||Ti){O=!0;let bo=h;U=Math.min(l*n,Math.max(1,Math.floor(1/Fe))),w&&s&&y<=e.stableFitRemainingWidth&&(ti=e.stableFitMaxMinimapScale),h=Math.min(ti,Math.max(1,Math.floor(U/k))),h>bo&&($=Math.min(2,h/bo)),G=h/n/$,T=Math.ceil(Math.max(Ee,He+S+Ve)*U),w?(e.stableMinimapLayoutInput=i,e.stableFitRemainingWidth=y,e.stableFitMaxMinimapScale=h):(e.stableMinimapLayoutInput=null,e.stableFitRemainingWidth=0)}}}let te=Math.floor(g*G),pe=Math.min(te,Math.max(0,Math.floor((y-b-2)*G/(c+G)))+iW),de=Math.floor(n*pe),se=de/n;de=Math.floor(de*$);let Se=p?1:2,ke=v==="left"?0:t-pe-b;return{renderMinimap:Se,minimapLeft:ke,minimapWidth:pe,minimapHeightIsEditorHeight:O,minimapIsSampling:V,minimapScale:h,minimapLineHeight:U,minimapCanvasInnerWidth:de,minimapCanvasInnerHeight:T,minimapCanvasOuterWidth:se,minimapCanvasOuterHeight:N}}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),N=i.get(117),O=N.verticalScrollbarSize,V=N.verticalHasArrows,U=N.arrowSize,G=N.horizontalScrollbarSize,$=i.get(52),te=i.get(126)!=="never",pe=i.get(74);$&&te&&(pe+=16);let de=0;if(S){let _o=Math.max(r,y);de=Math.round(_o*l)}let se=0;b&&(se=n*e.glyphMarginDecorationLaneCount);let Se=0,ke=Se+se,Ee=ke+de,He=Ee+pe,Ve=t-se-de-pe,Fe=!1,Qt=!1,Ze=-1;i.get(2)===2&&h==="inherit"&&v?(Fe=!0,Qt=!0):g==="on"||g==="bounded"?Qt=!0:g==="wordWrapColumn"&&(Ze=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:Ve,isViewportWrapping:Qt},e.memory||new jGe);Ti.renderMinimap!==0&&Ti.minimapLeft===0&&(Se+=Ti.minimapWidth,ke+=Ti.minimapWidth,Ee+=Ti.minimapWidth,He+=Ti.minimapWidth);let ti=Ve-Ti.minimapWidth,bo=Math.max(1,Math.floor((ti-O-2)/s)),Ro=V?U:0;return Qt&&(Ze=Math.max(1,bo),g==="bounded"&&(Ze=Math.min(Ze,f))),{width:t,height:o,glyphMarginLeft:Se,glyphMarginWidth:se,glyphMarginDecorationLaneCount:e.glyphMarginDecorationLaneCount,lineNumbersLeft:ke,lineNumbersWidth:de,decorationsLeft:Ee,decorationsWidth:pe,contentLeft:He,contentWidth:ti,minimap:Ti,viewportColumn:bo,isWordWrapMinified:Fe,isViewportWrapping:Qt,wrappingColumn:Ze,verticalScrollbarWidth:O,horizontalScrollbarHeight:G,overviewRuler:{top:Ro,width:O,height:o-2*Ro,right:0}}}},U7t=class extends Fu{constructor(){super(156,"wrappingStrategy","simple",{"editor.wrappingStrategy":{enumDescriptions:[d(729,null),d(728,null)],type:"string",enum:["simple","advanced"],default:"simple",description:d(727,null)}})}validate(i){return Md(i,"simple",["simple","advanced"])}compute(i,e,t){return e.get(2)===2?"advanced":t}};var z7t=class extends Fu{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:Md(i.enabled,this.defaultValue.enabled,["off","onCode","on"])}}},K7t=class extends Fu{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:Sn(e.enabled,this.defaultValue.enabled),maxLineCount:Vc.clampedInt(e.maxLineCount,this.defaultValue.maxLineCount,1,20),defaultModel:Md(e.defaultModel,this.defaultValue.defaultModel,["outlineModel","foldingProviderModel","indentationModel"]),scrollWithEditor:Sn(e.scrollWithEditor,this.defaultValue.scrollWithEditor)}}},G7t=class extends Fu{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(518,null),enum:["on","onUnlessPressed","offUnlessPressed","off"],markdownEnumDescriptions:[d(426,null),d(427,null,it?"Ctrl+Option":"Ctrl+Alt"),d(425,null,it?"Ctrl+Option":"Ctrl+Alt"),d(424,null)]},"editor.inlayHints.fontSize":{type:"number",default:i.fontSize,markdownDescription:d(520,null,"`#editor.fontSize#`","`5`")},"editor.inlayHints.fontFamily":{type:"string",default:i.fontFamily,markdownDescription:d(519,null,"`#editor.fontFamily#`")},"editor.inlayHints.padding":{type:"boolean",default:i.padding,description:d(522,null)},"editor.inlayHints.maximumLength":{type:"number",default:i.maximumLength,markdownDescription:d(521,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:Md(e.enabled,this.defaultValue.enabled,["on","off","offUnlessPressed","onUnlessPressed"]),fontSize:Vc.clampedInt(e.fontSize,this.defaultValue.fontSize,0,100),fontFamily:qw.string(e.fontFamily,this.defaultValue.fontFamily),padding:Sn(e.padding,this.defaultValue.padding),maximumLength:Vc.clampedInt(e.maximumLength,this.defaultValue.maximumLength,0,Number.MAX_SAFE_INTEGER)}}},$7t=class extends Fu{constructor(){super(74,"lineDecorationsWidth",10)}validate(i){return typeof i=="string"&&/^\d+(\.\d+)?ch$/.test(i)?-parseFloat(i.substring(0,i.length-2)):Vc.clampedInt(i,this.defaultValue,0,1e3)}compute(i,e,t){return t<0?Vc.clampedInt(-t*i.fontInfo.typicalHalfwidthCharacterWidth,this.defaultValue,0,1e3):t}},q7t=class extends qk{constructor(){super(75,"lineHeight",Yd.lineHeight,i=>qk.clamp(i,0,150),{markdownDescription:d(544,null)},0,150)}compute(i,e,t){return i.fontInfo.lineHeight}},j7t=class extends Fu{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(557,null)},"editor.minimap.autohide":{type:"string",enum:["none","mouseover","scroll"],enumDescriptions:[d(555,null),d(554,null),d(556,null)],default:i.autohide,description:d(553,null)},"editor.minimap.size":{type:"string",enum:["proportional","fill","fit"],enumDescriptions:[d(571,null),d(569,null),d(570,null)],default:i.size,description:d(568,null)},"editor.minimap.side":{type:"string",enum:["left","right"],default:i.side,description:d(567,null)},"editor.minimap.showSlider":{type:"string",enum:["always","mouseover"],default:i.showSlider,description:d(566,null)},"editor.minimap.scale":{type:"number",default:i.scale,minimum:1,maximum:3,enum:[1,2,3],description:d(561,null)},"editor.minimap.renderCharacters":{type:"boolean",default:i.renderCharacters,description:d(560,null)},"editor.minimap.maxColumn":{type:"number",default:i.maxColumn,description:d(559,null)},"editor.minimap.showRegionSectionHeaders":{type:"boolean",default:i.showRegionSectionHeaders,description:d(565,null)},"editor.minimap.showMarkSectionHeaders":{type:"boolean",default:i.showMarkSectionHeaders,description:d(564,null)},"editor.minimap.markSectionHeaderRegex":{type:"string",default:i.markSectionHeaderRegex,description:d(558,null)},"editor.minimap.sectionHeaderFontSize":{type:"number",default:i.sectionHeaderFontSize,description:d(562,null)},"editor.minimap.sectionHeaderLetterSpacing":{type:"number",default:i.sectionHeaderLetterSpacing,description:d(563,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:Sn(e.enabled,this.defaultValue.enabled),autohide:Md(e.autohide,this.defaultValue.autohide,["none","mouseover","scroll"]),size:Md(e.size,this.defaultValue.size,["proportional","fill","fit"]),side:Md(e.side,this.defaultValue.side,["right","left"]),showSlider:Md(e.showSlider,this.defaultValue.showSlider,["always","mouseover"]),renderCharacters:Sn(e.renderCharacters,this.defaultValue.renderCharacters),scale:Vc.clampedInt(e.scale,1,1,3),maxColumn:Vc.clampedInt(e.maxColumn,this.defaultValue.maxColumn,1,1e4),showRegionSectionHeaders:Sn(e.showRegionSectionHeaders,this.defaultValue.showRegionSectionHeaders),showMarkSectionHeaders:Sn(e.showMarkSectionHeaders,this.defaultValue.showMarkSectionHeaders),markSectionHeaderRegex:t,sectionHeaderFontSize:qk.clamp(qk.float(e.sectionHeaderFontSize,this.defaultValue.sectionHeaderFontSize),4,32),sectionHeaderLetterSpacing:qk.clamp(qk.float(e.sectionHeaderLetterSpacing,this.defaultValue.sectionHeaderLetterSpacing),0,5)}}};function iMo(a){return a==="ctrlCmd"?it?"metaKey":"ctrlKey":"altKey"}var Q7t=class extends Fu{constructor(){super(96,"padding",{top:0,bottom:0},{"editor.padding.top":{type:"number",default:0,minimum:0,maximum:1e3,description:d(596,null)},"editor.padding.bottom":{type:"number",default:0,minimum:0,maximum:1e3,description:d(595,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{top:Vc.clampedInt(e.top,0,0,1e3),bottom:Vc.clampedInt(e.bottom,0,0,1e3)}}},Y7t=class extends Fu{constructor(){let i={enabled:!0,cycle:!0};super(98,"parameterHints",i,{"editor.parameterHints.enabled":{type:"boolean",default:i.enabled,description:d(598,null)},"editor.parameterHints.cycle":{type:"boolean",default:i.cycle,description:d(597,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{enabled:Sn(e.enabled,this.defaultValue.enabled),cycle:Sn(e.cycle,this.defaultValue.cycle)}}},X7t=class extends mU{constructor(){super(163,1)}compute(i,e,t){return i.pixelRatio}},J7t=class extends Fu{constructor(){super(100,"placeholder",void 0)}validate(i){return typeof i>"u"?this.defaultValue:typeof i=="string"?i:this.defaultValue}},Z7t=class extends Fu{constructor(){let i={other:"on",comments:"off",strings:"off"},e=[{type:"boolean"},{type:"string",enum:["on","inline","off","offWhenInlineCompletions"],enumDescriptions:[d(591,null),d(523,null),d(589,null),d(590,null)]}];super(102,"quickSuggestions",i,{anyOf:[{type:"boolean"},{type:"string",enum:["on","inline","off","offWhenInlineCompletions"],enumDescriptions:[d(613,null),d(610,null),d(611,null),d(612,null)]},{type:"object",additionalProperties:!1,properties:{strings:{anyOf:e,default:i.strings,description:d(609,null)},comments:{anyOf:e,default:i.comments,description:d(607,null)},other:{anyOf:e,default:i.other,description:d(608,null)}}}],default:i,markdownDescription:d(606,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=Md(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=Md(e,this.defaultValue.other,n),typeof t=="boolean"?s=t?"on":"off":s=Md(t,this.defaultValue.comments,n),typeof o=="boolean"?l=o?"on":"off":l=Md(o,this.defaultValue.strings,n),{other:r,comments:s,strings:l}}};var eYt=class extends Fu{constructor(){super(76,"lineNumbers",{renderType:1,renderFn:null},{type:"string",enum:["off","on","relative","interval"],enumDescriptions:[d(547,null),d(548,null),d(549,null),d(546,null)],default:"on",description:d(545,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 Qre(a){let i=a.get(112);return i==="editable"?a.get(104):i!=="on"}function Yre(a){return!a.get(172)}var tYt=class extends Fu{constructor(){let i=[],e={type:"number",description:d(630,null)};super(116,"rulers",i,{type:"array",items:{anyOf:[e,{type:["object"],properties:{column:e,color:{type:"string",description:d(629,null),format:"color-hex"}}}]},default:i,description:d(628,null)})}validate(i){if(Array.isArray(i)){let e=[];for(let t of i)if(typeof t=="number")e.push({column:Vc.clampedInt(t,0,0,1e4),color:null});else if(t&&typeof t=="object"){let o=t;e.push({column:Vc.clampedInt(o.column,0,0,1e4),color:o.color})}return e.sort((t,o)=>t.column-o.column),e}return this.defaultValue}},iYt=class extends Fu{constructor(){super(105,"readOnlyMessage",void 0)}validate(i){return!i||typeof i!="object"?this.defaultValue:i}};function pKi(a,i){if(typeof a!="string")return i;switch(a){case"hidden":return 2;case"visible":return 3;default:return 1}}var oYt=class extends Fu{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(640,null),d(642,null),d(641,null)],default:"auto",description:d(639,null)},"editor.scrollbar.horizontal":{type:"string",enum:["auto","visible","hidden"],enumDescriptions:[d(633,null),d(635,null),d(634,null)],default:"auto",description:d(632,null)},"editor.scrollbar.verticalScrollbarSize":{type:"number",default:i.verticalScrollbarSize,description:d(643,null)},"editor.scrollbar.horizontalScrollbarSize":{type:"number",default:i.horizontalScrollbarSize,description:d(636,null)},"editor.scrollbar.scrollByPage":{type:"boolean",default:i.scrollByPage,description:d(638,null)},"editor.scrollbar.ignoreHorizontalScrollbarInContentHeight":{type:"boolean",default:i.ignoreHorizontalScrollbarInContentHeight,description:d(637,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i,t=Vc.clampedInt(e.horizontalScrollbarSize,this.defaultValue.horizontalScrollbarSize,0,1e3),o=Vc.clampedInt(e.verticalScrollbarSize,this.defaultValue.verticalScrollbarSize,0,1e3);return{arrowSize:Vc.clampedInt(e.arrowSize,this.defaultValue.arrowSize,0,1e3),vertical:pKi(e.vertical,this.defaultValue.vertical),horizontal:pKi(e.horizontal,this.defaultValue.horizontal),useShadows:Sn(e.useShadows,this.defaultValue.useShadows),verticalHasArrows:Sn(e.verticalHasArrows,this.defaultValue.verticalHasArrows),horizontalHasArrows:Sn(e.horizontalHasArrows,this.defaultValue.horizontalHasArrows),handleMouseWheel:Sn(e.handleMouseWheel,this.defaultValue.handleMouseWheel),alwaysConsumeMouseWheel:Sn(e.alwaysConsumeMouseWheel,this.defaultValue.alwaysConsumeMouseWheel),horizontalScrollbarSize:t,horizontalSliderSize:Vc.clampedInt(e.horizontalSliderSize,t,0,1e3),verticalScrollbarSize:o,verticalSliderSize:Vc.clampedInt(e.verticalSliderSize,o,0,1e3),scrollByPage:Sn(e.scrollByPage,this.defaultValue.scrollByPage),ignoreHorizontalScrollbarInContentHeight:Sn(e.ignoreHorizontalScrollbarInContentHeight,this.defaultValue.ignoreHorizontalScrollbarInContentHeight)}}},zT="inUntrustedWorkspace",px={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"},nYt=class extends Fu{constructor(){let i={nonBasicASCII:zT,invisibleCharacters:!0,ambiguousCharacters:!0,includeComments:zT,includeStrings:!0,allowedCharacters:{},allowedLocales:{_os:!0,_vscode:!0}};super(142,"unicodeHighlight",i,{[px.nonBasicASCII]:{restricted:!0,type:["boolean","string"],enum:[!0,!1,zT],default:i.nonBasicASCII,description:d(704,null)},[px.invisibleCharacters]:{restricted:!0,type:"boolean",default:i.invisibleCharacters,description:d(703,null)},[px.ambiguousCharacters]:{restricted:!0,type:"boolean",default:i.ambiguousCharacters,description:d(700,null)},[px.includeComments]:{restricted:!0,type:["boolean","string"],enum:[!0,!1,zT],default:i.includeComments,description:d(701,null)},[px.includeStrings]:{restricted:!0,type:["boolean","string"],enum:[!0,!1,zT],default:i.includeStrings,description:d(702,null)},[px.allowedCharacters]:{restricted:!0,type:"object",default:i.allowedCharacters,description:d(698,null),additionalProperties:{type:"boolean"}},[px.allowedLocales]:{restricted:!0,type:"object",additionalProperties:{type:"boolean"},default:i.allowedLocales,description:d(699,null)}})}applyUpdate(i,e){let t=!1;e.allowedCharacters&&i&&(uo(i.allowedCharacters,e.allowedCharacters)||(i={...i,allowedCharacters:e.allowedCharacters},t=!0)),e.allowedLocales&&i&&(uo(i.allowedLocales,e.allowedLocales)||(i={...i,allowedLocales:e.allowedLocales},t=!0));let o=super.applyUpdate(i,e);return t?new nSe(o.newValue,!0):o}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{nonBasicASCII:rSe(e.nonBasicASCII,zT,[!0,!1,zT]),invisibleCharacters:Sn(e.invisibleCharacters,this.defaultValue.invisibleCharacters),ambiguousCharacters:Sn(e.ambiguousCharacters,this.defaultValue.ambiguousCharacters),includeComments:rSe(e.includeComments,zT,[!0,!1,zT]),includeStrings:rSe(e.includeStrings,zT,[!0,!1,zT]),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}},rYt=class extends Fu{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(530,null)},"editor.inlineSuggest.showToolbar":{type:"string",default:i.showToolbar,enum:["always","onHover","never"],enumDescriptions:[d(535,null),d(537,null),d(536,null)],description:d(534,null)},"editor.inlineSuggest.syntaxHighlightingEnabled":{type:"boolean",default:i.syntaxHighlightingEnabled,description:d(541,null)},"editor.inlineSuggest.suppressSuggestions":{type:"boolean",default:i.suppressSuggestions,description:d(540,null)},"editor.inlineSuggest.suppressInSnippetMode":{type:"boolean",default:i.suppressInSnippetMode,description:d(539,null)},"editor.inlineSuggest.minShowDelay":{type:"number",default:0,minimum:0,maximum:1e4,description:d(532,null)},"editor.inlineSuggest.experimental.suppressInlineSuggestions":{type:"string",default:i.experimental.suppressInlineSuggestions,tags:["experimental"],description:d(538,null),experiment:{mode:"auto"}},"editor.inlineSuggest.experimental.emptyResponseInformation":{type:"boolean",default:i.experimental.emptyResponseInformation,tags:["experimental"],description:d(529,null),experiment:{mode:"auto"}},"editor.inlineSuggest.triggerCommandOnProviderChange":{type:"boolean",default:i.triggerCommandOnProviderChange,tags:["experimental"],description:d(542,null),experiment:{mode:"auto"}},"editor.inlineSuggest.experimental.showOnSuggestConflict":{type:"string",default:i.experimental.showOnSuggestConflict,tags:["experimental"],enum:["always","never","whenSuggestListIsIncomplete"],description:d(533,null),experiment:{mode:"auto"}},"editor.inlineSuggest.fontFamily":{type:"string",default:i.fontFamily,description:d(531,null)},"editor.inlineSuggest.edits.allowCodeShifting":{type:"string",default:i.edits.allowCodeShifting,description:d(525,null),enum:["always","horizontal","never"],tags:["nextEditSuggestions"]},"editor.inlineSuggest.edits.showLongDistanceHint":{type:"boolean",default:i.edits.showLongDistanceHint,description:d(528,null),tags:["nextEditSuggestions","experimental"]},"editor.inlineSuggest.edits.renderSideBySide":{type:"string",default:i.edits.renderSideBySide,description:d(526,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(527,null),tags:["nextEditSuggestions"]}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{enabled:Sn(e.enabled,this.defaultValue.enabled),mode:Md(e.mode,this.defaultValue.mode,["prefix","subword","subwordSmart"]),showToolbar:Md(e.showToolbar,this.defaultValue.showToolbar,["always","onHover","never"]),suppressSuggestions:Sn(e.suppressSuggestions,this.defaultValue.suppressSuggestions),keepOnBlur:Sn(e.keepOnBlur,this.defaultValue.keepOnBlur),fontFamily:qw.string(e.fontFamily,this.defaultValue.fontFamily),syntaxHighlightingEnabled:Sn(e.syntaxHighlightingEnabled,this.defaultValue.syntaxHighlightingEnabled),minShowDelay:Vc.clampedInt(e.minShowDelay,0,0,1e4),suppressInSnippetMode:Sn(e.suppressInSnippetMode,this.defaultValue.suppressInSnippetMode),edits:this._validateEdits(e.edits),triggerCommandOnProviderChange:Sn(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:Sn(e.enabled,this.defaultValue.edits.enabled),showCollapsed:Sn(e.showCollapsed,this.defaultValue.edits.showCollapsed),allowCodeShifting:Md(e.allowCodeShifting,this.defaultValue.edits.allowCodeShifting,["always","horizontal","never"]),showLongDistanceHint:Sn(e.showLongDistanceHint,this.defaultValue.edits.showLongDistanceHint),renderSideBySide:Md(e.renderSideBySide,this.defaultValue.edits.renderSideBySide,["never","auto"])}}_validateExperimental(i){if(!i||typeof i!="object")return this.defaultValue.experimental;let e=i;return{suppressInlineSuggestions:qw.string(e.suppressInlineSuggestions,this.defaultValue.experimental.suppressInlineSuggestions),showOnSuggestConflict:Md(e.showOnSuggestConflict,this.defaultValue.experimental.showOnSuggestConflict,["always","never","whenSuggestListIsIncomplete"]),emptyResponseInformation:Sn(e.emptyResponseInformation,this.defaultValue.experimental.emptyResponseInformation)}}},sYt=class extends Fu{constructor(){let i={enabled:iv.bracketPairColorizationOptions.enabled,independentColorPoolPerBracketType:iv.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:Sn(e.enabled,this.defaultValue.enabled),independentColorPoolPerBracketType:Sn(e.independentColorPoolPerBracketType,this.defaultValue.independentColorPoolPerBracketType)}}},aYt=class extends Fu{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:rSe(e.bracketPairs,this.defaultValue.bracketPairs,[!0,!1,"active"]),bracketPairsHorizontal:rSe(e.bracketPairsHorizontal,this.defaultValue.bracketPairsHorizontal,[!0,!1,"active"]),highlightActiveBracketPair:Sn(e.highlightActiveBracketPair,this.defaultValue.highlightActiveBracketPair),indentation:Sn(e.indentation,this.defaultValue.indentation),highlightActiveIndentation:rSe(e.highlightActiveIndentation,this.defaultValue.highlightActiveIndentation,[!0,!1,"always"])}}};function rSe(a,i,e){let t=e.indexOf(a);return t===-1?i:e[t]}var lYt=class extends Fu{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(670,null),d(672,null)],default:i.insertMode,description:d(668,null)},"editor.suggest.filterGraceful":{type:"boolean",default:i.filterGraceful,description:d(667,null)},"editor.suggest.localityBonus":{type:"boolean",default:i.localityBonus,description:d(675,null)},"editor.suggest.shareSuggestSelections":{type:"boolean",default:i.shareSuggestSelections,markdownDescription:d(679,null)},"editor.suggest.selectionMode":{type:"string",enum:["always","never","whenTriggerCharacter","whenQuickSuggestion"],enumDescriptions:[d(669,null),d(671,null),d(674,null),d(673,null)],default:i.selectionMode,markdownDescription:d(678,null,"`#editor.quickSuggestions#`","`#editor.suggestOnTriggerCharacters#`")},"editor.suggest.snippetsPreventQuickSuggestions":{type:"boolean",default:i.snippetsPreventQuickSuggestions,description:d(683,null)},"editor.suggest.showIcons":{type:"boolean",default:i.showIcons,description:d(680,null)},"editor.suggest.showStatusBar":{type:"boolean",default:i.showStatusBar,description:d(682,null)},"editor.suggest.preview":{type:"boolean",default:i.preview,description:d(677,null)},"editor.suggest.showInlineDetails":{type:"boolean",default:i.showInlineDetails,description:d(681,null)},"editor.suggest.maxVisibleSuggestions":{type:"number",deprecationMessage:d(676,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:Md(e.insertMode,this.defaultValue.insertMode,["insert","replace"]),filterGraceful:Sn(e.filterGraceful,this.defaultValue.filterGraceful),snippetsPreventQuickSuggestions:Sn(e.snippetsPreventQuickSuggestions,this.defaultValue.filterGraceful),localityBonus:Sn(e.localityBonus,this.defaultValue.localityBonus),shareSuggestSelections:Sn(e.shareSuggestSelections,this.defaultValue.shareSuggestSelections),selectionMode:Md(e.selectionMode,this.defaultValue.selectionMode,["always","never","whenQuickSuggestion","whenTriggerCharacter"]),showIcons:Sn(e.showIcons,this.defaultValue.showIcons),showStatusBar:Sn(e.showStatusBar,this.defaultValue.showStatusBar),preview:Sn(e.preview,this.defaultValue.preview),previewMode:Md(e.previewMode,this.defaultValue.previewMode,["prefix","subword","subwordSmart"]),showInlineDetails:Sn(e.showInlineDetails,this.defaultValue.showInlineDetails),showMethods:Sn(e.showMethods,this.defaultValue.showMethods),showFunctions:Sn(e.showFunctions,this.defaultValue.showFunctions),showConstructors:Sn(e.showConstructors,this.defaultValue.showConstructors),showDeprecated:Sn(e.showDeprecated,this.defaultValue.showDeprecated),matchOnWordStartOnly:Sn(e.matchOnWordStartOnly,this.defaultValue.matchOnWordStartOnly),showFields:Sn(e.showFields,this.defaultValue.showFields),showVariables:Sn(e.showVariables,this.defaultValue.showVariables),showClasses:Sn(e.showClasses,this.defaultValue.showClasses),showStructs:Sn(e.showStructs,this.defaultValue.showStructs),showInterfaces:Sn(e.showInterfaces,this.defaultValue.showInterfaces),showModules:Sn(e.showModules,this.defaultValue.showModules),showProperties:Sn(e.showProperties,this.defaultValue.showProperties),showEvents:Sn(e.showEvents,this.defaultValue.showEvents),showOperators:Sn(e.showOperators,this.defaultValue.showOperators),showUnits:Sn(e.showUnits,this.defaultValue.showUnits),showValues:Sn(e.showValues,this.defaultValue.showValues),showConstants:Sn(e.showConstants,this.defaultValue.showConstants),showEnums:Sn(e.showEnums,this.defaultValue.showEnums),showEnumMembers:Sn(e.showEnumMembers,this.defaultValue.showEnumMembers),showKeywords:Sn(e.showKeywords,this.defaultValue.showKeywords),showWords:Sn(e.showWords,this.defaultValue.showWords),showColors:Sn(e.showColors,this.defaultValue.showColors),showFiles:Sn(e.showFiles,this.defaultValue.showFiles),showReferences:Sn(e.showReferences,this.defaultValue.showReferences),showFolders:Sn(e.showFolders,this.defaultValue.showFolders),showTypeParameters:Sn(e.showTypeParameters,this.defaultValue.showTypeParameters),showSnippets:Sn(e.showSnippets,this.defaultValue.showSnippets),showUsers:Sn(e.showUsers,this.defaultValue.showUsers),showIssues:Sn(e.showIssues,this.defaultValue.showIssues)}}},cYt=class extends Fu{constructor(){super(129,"smartSelect",{selectLeadingAndTrailingWhitespace:!0,selectSubwords:!0},{"editor.smartSelect.selectLeadingAndTrailingWhitespace":{description:d(652,null),default:!0,type:"boolean"},"editor.smartSelect.selectSubwords":{description:d(653,null),default:!0,type:"boolean"}})}validate(i){return!i||typeof i!="object"?this.defaultValue:{selectLeadingAndTrailingWhitespace:Sn(i.selectLeadingAndTrailingWhitespace,this.defaultValue.selectLeadingAndTrailingWhitespace),selectSubwords:Sn(i.selectSubwords,this.defaultValue.selectSubwords)}}},dYt=class extends Fu{constructor(){let i=[];super(147,"wordSegmenterLocales",i,{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}],description:d(713,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 uYt=class extends Fu{constructor(){super(155,"wrappingIndent",1,{"editor.wrappingIndent":{type:"string",enum:["none","same","indent","deepIndent"],enumDescriptions:[d(725,null),d(726,null),d(724,null),d(723,null)],description:d(722,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}},pYt=class extends mU{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}}},mYt=class extends Fu{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:Sn(e.enabled,this.defaultValue.enabled),showDropSelector:Md(e.showDropSelector,this.defaultValue.showDropSelector,["afterDrop","never"])}}},hYt=class extends Fu{constructor(){let i={enabled:!0,showPasteSelector:"afterPaste"};super(97,"pasteAs",i,{"editor.pasteAs.enabled":{type:"boolean",default:i.enabled,markdownDescription:d(599,null)},"editor.pasteAs.showPasteSelector":{type:"string",markdownDescription:d(600,null),enum:["afterPaste","never"],enumDescriptions:[d(601,null),d(602,null)],default:"afterPaste"}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{enabled:Sn(e.enabled,this.defaultValue.enabled),showPasteSelector:Md(e.showPasteSelector,this.defaultValue.showPasteSelector,["afterPaste","never"])}}},hU=[];function Di(a){return hU[a.id]=a,a}var zb={acceptSuggestionOnCommitCharacter:Di(new fs(0,"acceptSuggestionOnCommitCharacter",!0,{markdownDescription:d(310,null)})),acceptSuggestionOnEnter:Di(new Ou(1,"acceptSuggestionOnEnter","on",["on","smart","off"],{markdownEnumDescriptions:["",d(312,null),""],markdownDescription:d(311,null)})),accessibilitySupport:Di(new _7t),accessibilityPageSize:Di(new Vc(3,"accessibilityPageSize",500,1,1073741824,{description:d(313,null),tags:["accessibility"]})),allowOverflow:Di(new fs(4,"allowOverflow",!0)),allowVariableLineHeights:Di(new fs(5,"allowVariableLineHeights",!0,{description:d(320,null)})),allowVariableFonts:Di(new fs(6,"allowVariableFonts",!0,{description:d(318,null)})),allowVariableFontsInAccessibilityMode:Di(new fs(7,"allowVariableFontsInAccessibilityMode",!1,{description:d(319,null),tags:["accessibility"]})),ariaLabel:Di(new qw(8,"ariaLabel",d(467,null))),ariaRequired:Di(new fs(9,"ariaRequired",!1,void 0)),screenReaderAnnounceInlineSuggestion:Di(new fs(12,"screenReaderAnnounceInlineSuggestion",!0,{description:d(631,null),tags:["accessibility"]})),autoClosingBrackets:Di(new Ou(10,"autoClosingBrackets","languageDefined",["always","languageDefined","beforeWhitespace","never"],{enumDescriptions:["",d(370,null),d(369,null),""],description:d(326,null)})),autoClosingComments:Di(new Ou(11,"autoClosingComments","languageDefined",["always","languageDefined","beforeWhitespace","never"],{enumDescriptions:["",d(372,null),d(371,null),""],description:d(327,null)})),autoClosingDelete:Di(new Ou(13,"autoClosingDelete","auto",["always","auto","never"],{enumDescriptions:["",d(373,null),""],description:d(328,null)})),autoClosingOvertype:Di(new Ou(14,"autoClosingOvertype","auto",["always","auto","never"],{enumDescriptions:["",d(374,null),""],description:d(329,null)})),autoClosingQuotes:Di(new Ou(15,"autoClosingQuotes","languageDefined",["always","languageDefined","beforeWhitespace","never"],{enumDescriptions:["",d(376,null),d(375,null),""],description:d(330,null)})),autoIndent:Di(new jre(16,"autoIndent",4,"full",["none","keep","brackets","advanced","full"],tMo,{enumDescriptions:[d(381,null),d(380,null),d(378,null),d(377,null),d(379,null)],description:d(331,null)})),autoIndentOnPaste:Di(new fs(17,"autoIndentOnPaste",!1,{description:d(332,null)})),autoIndentOnPasteWithinString:Di(new fs(18,"autoIndentOnPasteWithinString",!0,{description:d(333,null)})),automaticLayout:Di(new fs(19,"automaticLayout",!1)),autoSurround:Di(new Ou(20,"autoSurround","languageDefined",["languageDefined","quotes","brackets","never"],{enumDescriptions:[d(383,null),d(384,null),d(382,null),""],description:d(334,null)})),bracketPairColorization:Di(new sYt),bracketPairGuides:Di(new aYt),stickyTabStops:Di(new fs(132,"stickyTabStops",!1,{description:d(666,null)})),codeLens:Di(new fs(23,"codeLens",!0,{description:d(337,null)})),codeLensFontFamily:Di(new qw(24,"codeLensFontFamily","",{description:d(338,null)})),codeLensFontSize:Di(new Vc(25,"codeLensFontSize",0,0,100,{type:"number",default:0,minimum:0,maximum:100,markdownDescription:d(339,null)})),colorDecorators:Di(new fs(26,"colorDecorators",!0,{description:d(341,null)})),colorDecoratorActivatedOn:Di(new Ou(168,"colorDecoratorsActivatedOn","clickAndHover",["clickAndHover","hover","click"],{enumDescriptions:[d(386,null),d(387,null),d(385,null)],description:d(340,null)})),colorDecoratorsLimit:Di(new Vc(27,"colorDecoratorsLimit",500,1,1e6,{markdownDescription:d(342,null)})),columnSelection:Di(new fs(28,"columnSelection",!1,{description:d(343,null)})),comments:Di(new D7t),contextmenu:Di(new fs(30,"contextmenu",!0)),copyWithSyntaxHighlighting:Di(new fs(31,"copyWithSyntaxHighlighting",!0,{description:d(346,null)})),cursorBlinking:Di(new jre(32,"cursorBlinking",1,"blink",["blink","smooth","phase","expand","solid"],gYt,{description:d(347,null)})),cursorSmoothCaretAnimation:Di(new Ou(33,"cursorSmoothCaretAnimation","off",["off","explicit","on"],{enumDescriptions:[d(351,null),d(350,null),d(352,null)],description:d(349,null)})),cursorStyle:Di(new jre(34,"cursorStyle",1,"line",["line","block","underline","line-thin","block-outline","underline-thin"],kmt,{description:d(353,null)})),overtypeCursorStyle:Di(new jre(92,"overtypeCursorStyle",2,"block",["line","block","underline","line-thin","block-outline","underline-thin"],kmt,{description:d(592,null)})),cursorSurroundingLines:Di(new Vc(35,"cursorSurroundingLines",0,0,1073741824,{description:d(354,null)})),cursorSurroundingLinesStyle:Di(new Ou(36,"cursorSurroundingLinesStyle","default",["default","all"],{enumDescriptions:[d(357,null),d(356,null)],markdownDescription:d(355,null)})),cursorWidth:Di(new Vc(37,"cursorWidth",0,0,1073741824,{markdownDescription:d(358,null)})),cursorHeight:Di(new Vc(38,"cursorHeight",0,0,1073741824,{markdownDescription:d(348,null)})),disableLayerHinting:Di(new fs(39,"disableLayerHinting",!1)),disableMonospaceOptimizations:Di(new fs(40,"disableMonospaceOptimizations",!1)),domReadOnly:Di(new fs(41,"domReadOnly",!1)),doubleClickSelectsBlock:Di(new fs(173,"doubleClickSelectsBlock",!0,{description:d(362,null)})),dragAndDrop:Di(new fs(42,"dragAndDrop",!0,{description:d(363,null)})),emptySelectionClipboard:Di(new R7t),dropIntoEditor:Di(new mYt),editContext:Di(new fs(44,"editContext",!0,{description:d(368,null),included:XH||dbe||kr})),renderRichScreenReaderContent:Di(new fs(107,"renderRichScreenReaderContent",!1,{markdownDescription:d(622,null)})),stickyScroll:Di(new K7t),experimentalGpuAcceleration:Di(new Ou(46,"experimentalGpuAcceleration","off",["off","on"],{tags:["experimental"],enumDescriptions:[d(471,null),d(472,null)],description:d(470,null)})),experimentalWhitespaceRendering:Di(new Ou(47,"experimentalWhitespaceRendering","svg",["svg","font","off"],{enumDescriptions:[d(476,null),d(474,null),d(475,null)],description:d(473,null)})),extraEditorClassName:Di(new qw(48,"extraEditorClassName","")),fastScrollSensitivity:Di(new qk(49,"fastScrollSensitivity",5,a=>a<=0?5:a,{markdownDescription:d(477,null)})),find:Di(new M7t),fixedOverflowWidgets:Di(new fs(51,"fixedOverflowWidgets",!1)),folding:Di(new fs(52,"folding",!0,{description:d(487,null)})),foldingStrategy:Di(new Ou(53,"foldingStrategy","auto",["auto","indentation"],{enumDescriptions:[d(492,null),d(493,null)],description:d(491,null)})),foldingHighlight:Di(new fs(54,"foldingHighlight",!0,{description:d(488,null)})),foldingImportsByDefault:Di(new fs(55,"foldingImportsByDefault",!1,{description:d(489,null)})),foldingMaximumRegions:Di(new Vc(56,"foldingMaximumRegions",5e3,10,65e3,{description:d(490,null)})),unfoldOnClickAfterEndOfLine:Di(new fs(57,"unfoldOnClickAfterEndOfLine",!1,{description:d(697,null)})),fontFamily:Di(new qw(58,"fontFamily",Yd.fontFamily,{description:d(494,null)})),fontInfo:Di(new A7t),fontLigatures2:Di(new mx),fontSize:Di(new W7t),fontWeight:Di(new V7t),fontVariations:Di(new P7t),formatOnPaste:Di(new fs(64,"formatOnPaste",!1,{description:d(504,null)})),formatOnType:Di(new fs(65,"formatOnType",!1,{description:d(505,null)})),glyphMargin:Di(new fs(66,"glyphMargin",!0,{description:d(506,null)})),gotoLocation:Di(new B7t),hideCursorInOverviewRuler:Di(new fs(68,"hideCursorInOverviewRuler",!1,{description:d(507,null)})),hover:Di(new H7t),inDiffEditor:Di(new fs(70,"inDiffEditor",!1)),inertialScroll:Di(new fs(158,"inertialScroll",!1,{description:d(517,null)})),letterSpacing:Di(new qk(72,"letterSpacing",Yd.letterSpacing,a=>qk.clamp(a,-5,20),{description:d(543,null)})),lightbulb:Di(new z7t),lineDecorationsWidth:Di(new $7t),lineHeight:Di(new q7t),lineNumbers:Di(new eYt),lineNumbersMinChars:Di(new Vc(77,"lineNumbersMinChars",5,1,300)),linkedEditing:Di(new fs(78,"linkedEditing",!1,{description:d(550,null)})),links:Di(new fs(79,"links",!0,{description:d(551,null)})),matchBrackets:Di(new Ou(80,"matchBrackets","always",["always","near","never"],{description:d(552,null)})),minimap:Di(new j7t),mouseStyle:Di(new Ou(82,"mouseStyle","text",["text","default","copy"])),mouseWheelScrollSensitivity:Di(new qk(83,"mouseWheelScrollSensitivity",1,a=>a===0?1:a,{markdownDescription:d(573,null)})),mouseWheelZoom:Di(new fs(84,"mouseWheelZoom",!1,{markdownDescription:it?d(575,null):d(574,null)})),multiCursorMergeOverlapping:Di(new fs(85,"multiCursorMergeOverlapping",!0,{description:d(577,null)})),multiCursorModifier:Di(new jre(86,"multiCursorModifier","altKey","alt",["ctrlCmd","alt"],iMo,{markdownEnumDescriptions:[d(580,null),d(579,null)],markdownDescription:d(578,null)})),mouseMiddleClickAction:Di(new Ou(87,"mouseMiddleClickAction","default",["default","openLink","ctrlLeftClick"],{description:d(572,null)})),multiCursorPaste:Di(new Ou(88,"multiCursorPaste","spread",["spread","full"],{markdownEnumDescriptions:[d(583,null),d(582,null)],markdownDescription:d(581,null)})),multiCursorLimit:Di(new Vc(89,"multiCursorLimit",1e4,1,1e5,{markdownDescription:d(576,null)})),occurrencesHighlight:Di(new Ou(90,"occurrencesHighlight","singleFile",["off","singleFile","multiFile"],{markdownEnumDescriptions:[d(586,null),d(587,null),d(585,null)],markdownDescription:d(584,null)})),occurrencesHighlightDelay:Di(new Vc(91,"occurrencesHighlightDelay",0,0,2e3,{description:d(588,null),tags:["preview"]})),overtypeOnPaste:Di(new fs(93,"overtypeOnPaste",!0,{description:d(593,null)})),overviewRulerBorder:Di(new fs(94,"overviewRulerBorder",!0,{description:d(594,null)})),overviewRulerLanes:Di(new Vc(95,"overviewRulerLanes",3,0,3)),padding:Di(new Q7t),pasteAs:Di(new hYt),parameterHints:Di(new Y7t),peekWidgetDefaultFocus:Di(new Ou(99,"peekWidgetDefaultFocus","tree",["tree","editor"],{enumDescriptions:[d(605,null),d(604,null)],description:d(603,null)})),placeholder:Di(new J7t),definitionLinkOpensInPeek:Di(new fs(101,"definitionLinkOpensInPeek",!1,{description:d(360,null)})),quickSuggestions:Di(new Z7t),quickSuggestionsDelay:Di(new Vc(103,"quickSuggestionsDelay",10,0,1073741824,{description:d(614,null),experiment:{mode:"auto"}})),readOnly:Di(new fs(104,"readOnly",!1)),readOnlyMessage:Di(new iYt),renameOnType:Di(new fs(106,"renameOnType",!1,{description:d(615,null),markdownDeprecationMessage:d(616,null)})),renderControlCharacters:Di(new fs(108,"renderControlCharacters",!0,{description:d(617,null),restricted:!0})),renderFinalNewline:Di(new Ou(109,"renderFinalNewline",Wn?"dimmed":"on",["off","on","dimmed"],{description:d(618,null)})),renderLineHighlight:Di(new Ou(110,"renderLineHighlight","line",["none","gutter","line","all"],{enumDescriptions:["","","",d(620,null)],description:d(619,null)})),renderLineHighlightOnlyWhenFocus:Di(new fs(111,"renderLineHighlightOnlyWhenFocus",!1,{description:d(621,null)})),renderValidationDecorations:Di(new Ou(112,"renderValidationDecorations","editable",["editable","on","off"])),renderWhitespace:Di(new Ou(113,"renderWhitespace","selection",["none","boundary","selection","trailing","all"],{enumDescriptions:["",d(624,null),d(625,null),d(626,null),""],description:d(623,null)})),revealHorizontalRightPadding:Di(new Vc(114,"revealHorizontalRightPadding",15,0,1e3)),roundedSelection:Di(new fs(115,"roundedSelection",!0,{description:d(627,null)})),rulers:Di(new tYt),scrollbar:Di(new oYt),scrollBeyondLastColumn:Di(new Vc(118,"scrollBeyondLastColumn",4,0,1073741824,{description:d(644,null)})),scrollBeyondLastLine:Di(new fs(119,"scrollBeyondLastLine",!0,{description:d(645,null)})),scrollOnMiddleClick:Di(new fs(171,"scrollOnMiddleClick",!1,{description:d(646,null)})),scrollPredominantAxis:Di(new fs(120,"scrollPredominantAxis",!0,{description:d(647,null)})),selectionClipboard:Di(new fs(121,"selectionClipboard",!0,{description:d(648,null),included:Wn})),selectionHighlight:Di(new fs(122,"selectionHighlight",!0,{description:d(649,null)})),selectionHighlightMaxLength:Di(new Vc(123,"selectionHighlightMaxLength",200,0,1073741824,{description:d(650,null)})),selectionHighlightMultiline:Di(new fs(124,"selectionHighlightMultiline",!1,{description:d(651,null)})),selectOnLineNumbers:Di(new fs(125,"selectOnLineNumbers",!0)),showFoldingControls:Di(new Ou(126,"showFoldingControls","mouseover",["always","never","mouseover"],{enumDescriptions:[d(656,null),d(658,null),d(657,null)],description:d(655,null)})),showUnused:Di(new fs(127,"showUnused",!0,{description:d(659,null)})),showDeprecated:Di(new fs(157,"showDeprecated",!0,{description:d(654,null)})),inlayHints:Di(new G7t),snippetSuggestions:Di(new Ou(128,"snippetSuggestions","inline",["top","bottom","inline","none"],{enumDescriptions:[d(665,null),d(662,null),d(663,null),d(664,null)],description:d(661,null)})),smartSelect:Di(new cYt),smoothScrolling:Di(new fs(130,"smoothScrolling",!1,{description:d(660,null)})),stopRenderingLineAfter:Di(new Vc(133,"stopRenderingLineAfter",1e4,-1,1073741824)),suggest:Di(new lYt),inlineSuggest:Di(new rYt),inlineCompletionsAccessibilityVerbose:Di(new fs(169,"inlineCompletionsAccessibilityVerbose",!1,{description:d(524,null)})),suggestFontSize:Di(new Vc(135,"suggestFontSize",0,0,1e3,{markdownDescription:d(684,null,"`0`","`#editor.fontSize#`")})),suggestLineHeight:Di(new Vc(136,"suggestLineHeight",0,0,1e3,{markdownDescription:d(685,null,"`0`","`#editor.lineHeight#`")})),suggestOnTriggerCharacters:Di(new fs(137,"suggestOnTriggerCharacters",!0,{description:d(686,null)})),suggestSelection:Di(new Ou(138,"suggestSelection","first",["first","recentlyUsed","recentlyUsedByPrefix"],{markdownEnumDescriptions:[d(688,null),d(689,null),d(690,null)],description:d(687,null)})),tabCompletion:Di(new Ou(139,"tabCompletion","off",["on","off","onlySnippets"],{enumDescriptions:[d(693,null),d(692,null),d(694,null)],description:d(691,null)})),tabIndex:Di(new Vc(140,"tabIndex",0,-1,1073741824)),trimWhitespaceOnDelete:Di(new fs(141,"trimWhitespaceOnDelete",!1,{description:d(696,null)})),unicodeHighlight:Di(new nYt),unusualLineTerminators:Di(new Ou(143,"unusualLineTerminators","prompt",["auto","off","prompt"],{enumDescriptions:[d(706,null),d(707,null),d(708,null)],description:d(705,null)})),useShadowDOM:Di(new fs(144,"useShadowDOM",!0)),useTabStops:Di(new fs(145,"useTabStops",!0,{description:d(709,null)})),wordBreak:Di(new Ou(146,"wordBreak","normal",["normal","keepAll"],{markdownEnumDescriptions:[d(712,null),d(711,null)],description:d(710,null)})),wordSegmenterLocales:Di(new dYt),wordSeparators:Di(new qw(148,"wordSeparators",tW,{description:d(714,null)})),wordWrap:Di(new Ou(149,"wordWrap","off",["off","on","wordWrapColumn","bounded"],{markdownEnumDescriptions:[d(717,null),d(718,null),d(719,null),d(716,null)],description:d(715,null)})),wordWrapBreakAfterCharacters:Di(new qw(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:Di(new qw(151,"wordWrapBreakBeforeCharacters","([{\u2018\u201C\u3008\u300A\u300C\u300E\u3010\u3014\uFF08\uFF3B\uFF5B\uFF62\xA3\xA5\uFF04\uFFE1\uFFE5+\uFF0B")),wordWrapColumn:Di(new Vc(152,"wordWrapColumn",80,1,1073741824,{markdownDescription:d(720,null)})),wordWrapOverride1:Di(new Ou(153,"wordWrapOverride1","inherit",["off","on","inherit"])),wordWrapOverride2:Di(new Ou(154,"wordWrapOverride2","inherit",["off","on","inherit"])),wrapOnEscapedLineFeeds:Di(new fs(160,"wrapOnEscapedLineFeeds",!1,{markdownDescription:d(721,null)})),effectiveCursorStyle:Di(new N7t),editorClassName:Di(new L7t),defaultColorDecorators:Di(new Ou(167,"defaultColorDecorators","auto",["auto","always","never"],{enumDescriptions:[d(389,null),d(388,null),d(390,null)],description:d(359,null)})),pixelRatio:Di(new X7t),tabFocusMode:Di(new fs(164,"tabFocusMode",!1,{markdownDescription:d(695,null)})),layoutInfo:Di(new QGe),wrappingInfo:Di(new pYt),wrappingIndent:Di(new uYt),wrappingStrategy:Di(new U7t),effectiveEditContextEnabled:Di(new O7t),effectiveAllowVariableFonts:Di(new F7t)};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 Ie(i.endLineNumber,i.endColumn)}getStartPosition(){return a.getStartPosition(this)}static getStartPosition(i){return new Ie(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 Yt=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 Ie(this.positionLineNumber,this.positionColumn)}getSelectionStart(){return new Ie(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 Qu=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 gU(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 fYt(a,o,r,n+1,a.getStartOffset(r),a.getEndOffset(n))}var fYt=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)}},gKi=(i=>(i[i.value=3]="value",i))(gKi||{});function IN(a){return(a&gKi.value)!==0}var al=class a{static _nextVisibleColumn(i,e,t){return i===9?a.nextRenderTabStop(e,t):AT(i)||mGe(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 d$(n),s=0;for(;!r.eol();){let l=Ebe(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 yre(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 d$(i),r=0,s=1;for(;!n.eol();){let l=Ebe(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 rMo(a,i,e){let t=0;for(let n=0;n<a.length;n++)a.charAt(n)==="	"?t=al.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 sSe(a,i,e){let t=Ap(a);return t===-1&&(t=a.length),rMo(a.substring(0,t),i,e)+a.substring(t)}var vYt=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)}},nW=new vYt;var sMo=()=>!0,aMo=()=>!1,lMo=a=>a===" "||a==="	",rW=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 nW.getInputMode()}onElectricCharacter(i,e,t){let o=gU(e,t-1),n=this.languageConfigurationService.getLanguageConfiguration(o.languageId).electricCharacter;return n?n.onElectricCharacter(i,o,t-o.firstCharOffset):null}normalizeIndentation(i){return sSe(i,this.indentSize,this.insertSpaces)}_getShouldAutoClose(i,e,t){switch(e){case"beforeWhitespace":return lMo;case"languageDefined":return this._getLanguageDefinedShouldAutoClose(i,t);case"always":return sMo;case"never":return aMo}}_getLanguageDefinedShouldAutoClose(i,e){let t=this.languageConfigurationService.getLanguageConfiguration(i).getAutoCloseBeforeSet(e);return o=>t.indexOf(o)!==-1}visibleColumnFromColumn(i,e){return al.visibleColumnFromColumn(i.getLineContent(e.lineNumber),e.column,this.tabSize)}columnFromVisibleColumn(i,e,t){let o=al.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}},Ps=class a{constructor(i,e){this._cursorStateBrand=void 0;this.modelState=i,this.viewState=e}static fromModelState(i){return new bYt(i)}static fromViewState(i){return new SYt(i)}static fromModelSelection(i){let e=Yt.liftSelection(i),t=new ov(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)}},bYt=class{constructor(i){this.modelState=i,this.viewState=null}},SYt=class{constructor(i){this.modelState=null,this.viewState=i}};var ov=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 Ie(e,t),o):new a(new z(e,t,e,t),0,o,new Ie(e,t),o)}static _computeSelection(i,e){return i.isEmpty()||!e.isBeforeOrEqual(i.getStartPosition())?Yt.fromPositions(i.getStartPosition(),e):Yt.fromPositions(i.getEndPosition(),e)}},Yv=class{constructor(i,e,t){this._editOperationResultBrand=void 0;this.type=i,this.commands=e,this.shouldPushStackElementBefore=t.shouldPushStackElementBefore,this.shouldPushStackElementAfter=t.shouldPushStackElementAfter}};function sW(a){return a==="'"||a==='"'||a==="`"}var V6=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 Ie(g,f)),S=i.visibleColumnFromColumn(e,new Ie(g,v));u&&(b>r||S<o)||c&&(S>o||b<r)||p.push(new ov(new z(g,f,g,f),0,0,new Ie(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 ov(new z(g,f,g,f),0,0,new Ie(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 Ie(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 Wh=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 Yt.fromPositions(o.getEndPosition())}},aSe=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=fKi(i,o,r);s.lineNumber>n&&(s=new Ie(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 Yt.fromPositions(o.getEndPosition())}},_mt=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 Yt.fromRange(o,0)}},Xre=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 Yt.fromPositions(o.getStartPosition())}},Jre=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 Yt.fromPositions(o.getEndPosition().delta(this._lineNumberDeltaOffset,this._columnDeltaOffset))}},Dmt=class{constructor(i){this._range=i}getEditOperations(i,e){let t=i.getValueInRange(this._range),o=this._range.getEndPosition(),n=o.lineNumber,r=fKi(i,o,t.length);r.lineNumber>n&&(r=new Ie(n,i.getLineMaxColumn(n)));let s=z.fromPositions(o,r);e.addTrackedEditOperation(s,"")}computeCursorState(i,e){let o=e.getInverseEditOperations()[0].range;return Yt.fromPositions(o.getEndPosition())}},B6=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 fKi(a,i,e){if(e<0)throw new Error("Unexpected negative delta");let t=a.getLineCount(),o=new Ie(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 Ie(i.lineNumber,i.column+e);break}e=r}else{let r=e-a.getLineMaxColumn(n);if(r<=0){o=new Ie(n,e);break}e=r}return o}var Zre=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=al.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=al.nextRenderTabStop(h,t);break;default:return-1}}return h===s+t?r:-1}let u=al.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=al.nextRenderTabStop(p,t);break;default:return-1}}return p===u?n:-1}};var lSe=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&&uo(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}}},vU=class{constructor(i,e){this._findMatchBrand=void 0;this.range=i,this.matches=e}};function vKi(a){return!!a&&typeof a.read=="function"}function U6(a){return!!(a&&a.uri)}var H6=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}},Lmt=class{constructor(i,e,t){this.regex=i,this.wordSeparators=e,this.simpleSearch=t}},Rmt=class{constructor(i,e,t){this.reverseEdits=i;this.changes=e;this.trimAutoWhitespaceLineNumbers=t}};function hx(a){return!a.isTooLargeForSyncing()&&!a.isForSimpleWidget}var YGe=class{constructor(i,e,t){this._cursorPositionBrand=void 0;this.lineNumber=i,this.column=e,this.leftoverVisibleColumns=t}},pu=class a{static leftPosition(i,e){if(e.column>i.getLineMinColumn(e.lineNumber))return e.delta(void 0,-n9t(i.getLineContent(e.lineNumber),e.column-1));if(e.lineNumber>1){let t=e.lineNumber-1;return new Ie(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=Zre.atomicPosition(n,e.column-1,t,0);if(r!==-1&&r+1>=o)return new Ie(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 YGe(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 Ie(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+Tbe(i.getLineContent(e),t-1):e<i.getLineCount()&&(e=e+1,t=i.getLineMinColumn(e)),new Ie(e,t)}static rightPositionAtomicSoftTabs(i,e,t,o,n){if(t<i.getLineIndentColumn(e)){let r=i.getLineContent(e),s=Zre.atomicPosition(r,t-1,o,1);if(s!==-1)return new Ie(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 YGe(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=al.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-al.visibleColumnFromColumn(e.getLineContent(t),o,i.tabSize),l!==void 0){let f=new Ie(t,o),v=e.normalizePosition(f,l);n=n+(o-v.column),t=v.lineNumber,o=v.column}return new YGe(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 Ie(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 ov(new z(n.lineNumber,n.column,n.lineNumber,n.column),0,n.leftoverVisibleColumns,new Ie(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 ov(new z(n.lineNumber,n.column,n.lineNumber,n.column),0,n.leftoverVisibleColumns,new Ie(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 wN=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 Wh(u,"")}return[r,n]}static getDeleteRightRange(i,e,t){if(!i.isEmpty())return i;let o=i.getPosition(),n=pu.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(sW(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 Wh(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 Wh(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=Ap(n),s=r===-1?n.length+1:r+1;if(o.column<=s){let l=t.visibleColumnFromColumn(e,o),c=al.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=g1i(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 Ie(t,e.getLineMaxColumn(t))}else return i}static cut(i,e,t){let o=[],n=null;t.sort((r,s)=>Ie.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 Wh(f,"")}else o[r]=null;else o[r]=new Wh(l,"")}return new Yv(0,o,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!0})}};var cSe=60,dSe=cSe*60,ese=dSe*24,SKi=ese*7,IKi=ese*30,yKi=ese*365;function Bs(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,Bs(new Date().getTime()+o*1e3,!1));if(!t&&o<30)return d(76,null);let n;return o<cSe?(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<dSe?(n=Math.round(o/cSe),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<ese?(n=Math.round(o/dSe),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<SKi?(n=Math.round(o/ese),i?n===1?d(50,null,n):d(48,null,n):n===1?d(49,null,n):d(47,null,n)):o<IKi?(n=Math.round(o/SKi),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<yKi?(n=Math.round(o/IKi),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/yKi),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 z6(a,i){let e=Math.abs(a/1e3);return e<1?i?d(108,null,a):d(107,null,a):e<cSe?i?d(110,null,Math.round(a)/1e3):d(109,null,Math.round(a)/1e3):e<dSe?i?d(106,null,Math.round(a/(1e3*cSe))):d(105,null,Math.round(a/(1e3*cSe))):e<ese?i?d(104,null,Math.round(a/(1e3*dSe))):d(103,null,Math.round(a/(1e3*dSe))):d(102,null,Math.round(a/(1e3*ese)))}function Pmt(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 Wu={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(QH,i)}})},NumberFormat(a,i){return new co(()=>{try{return new Intl.NumberFormat(a,i)}catch{return new Intl.NumberFormat(void 0,i)}})}};var _$=class a{constructor(i){let e=Sre(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=Sre(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 D$=class{constructor(){this._actual=new _$(0)}add(i){this._actual.set(i,1)}has(i){return this._actual.get(i)===1}clear(){return this._actual.clear()}};var IYt=class extends _${constructor(e,t){super(0);this._segmenter=null;this._cachedLine=null;this._cachedSegments=[];this.intlSegmenterLocales=t,this.intlSegmenterLocales.length>0?this._segmenter=Wu.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}},wKi=new il(10);function jw(a,i){let e=`${a}/${i.join(",")}`,t=wKi.get(e);return t||(t=new IYt(a,i),wKi.set(e,t)),t}var yf=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 Ie(r,s));if(o===0)return new Ie(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 Ie(r,l.start+1))),new Ie(r,l?l.start+1:1);if(o===3){for(;l&&l.wordType===2;)l=a._findPreviousWordOnLine(i,e,new Ie(r,l.start+1));return new Ie(r,l?l.start+1:1)}return l&&s<=l.end+1&&(l=a._findPreviousWordOnLine(i,e,new Ie(r,l.start+1))),new Ie(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 Ie(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 Ie(t,r);if(s===45&&l!==45)return new Ie(t,r);if((iU(s)||pGe(s))&&Hk(l))return new Ie(t,r);if(Hk(s)&&Hk(l)&&r+1<o){let c=n.charCodeAt(r);if(iU(c)||pGe(c))return new Ie(t,r)}}return new Ie(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 Ie(n,r));if(o===2)l&&l.wordType===2&&l.end-l.start===1&&l.nextCharClass===0&&(l=a._findNextWordOnLine(i,e,new Ie(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 Ie(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 Ie(n,l.end+1))),l?r=l.start+1:r=e.getLineMaxColumn(n);return new Ie(n,r)}static _moveWordPartRight(i,e){let t=e.lineNumber,o=i.getLineMaxColumn(t);if(e.column===o)return t<i.getLineCount()?new Ie(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 Ie(t,r);if(s!==45&&l===45)return new Ie(t,r);if((iU(s)||pGe(s))&&Hk(l))return new Ie(t,r);if(Hk(s)&&Hk(l)&&r+1<o){let c=n.charCodeAt(r);if(iU(c)||pGe(c))return new Ie(t,r)}}return new Ie(t,o)}static _deleteWordLeftWhitespace(i,e){let t=i.getLineContent(e.lineNumber),o=e.column-2,n=tv(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(wN.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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(l,1)),h?c=h.start+1:c=o.getLineMaxColumn(l)):(h&&c>=h.start+1&&(h=a._findNextWordOnLine(t,o,new Ie(l,h.end+1))),h?c=h.start+1:c<p||l===u?c=p:(l++,h=a._findNextWordOnLine(t,o,new Ie(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=jw(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=jw(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 ov(new z(n.lineNumber,g,n.lineNumber,f),1,0,new Ie(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 Ie(p,h);t.selectionStart.containsPosition(g)&&(h=t.selectionStart.endColumn)}else{h=u;let g=new Ie(p,h);t.selectionStart.containsPosition(g)&&(h=t.selectionStart.startColumn)}return t.move(!0,p,h,0)}},tse=class extends yf{static deleteWordPartLeft(i){let e=Amt([yf.deleteWordLeft(i,0),yf.deleteWordLeft(i,2),yf._deleteWordPartLeft(i.model,i.selection)]);return e.sort(z.compareRangesUsingEnds),e[2]}static deleteWordPartRight(i){let e=Amt([yf.deleteWordRight(i,0),yf.deleteWordRight(i,2),yf._deleteWordPartRight(i.model,i.selection)]);return e.sort(z.compareRangesUsingStarts),e[0]}static moveWordPartLeft(i,e,t,o){let n=Amt([yf.moveWordLeft(i,e,t,0,o),yf.moveWordLeft(i,e,t,2,o),yf._moveWordPartLeft(e,t)]);return n.sort(Ie.compare),n[2]}static moveWordPartRight(i,e,t){let o=Amt([yf.moveWordRight(i,e,t,0),yf.moveWordRight(i,e,t,2),yf._moveWordPartRight(e,t)]);return o.sort(Ie.compare),o[0]}};function Amt(a){return a.filter(i=>!!i)}var Wg=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 Ps(l.modelState,l.viewState),t?o[n++]=Ps.fromModelState(pu.translateDown(i.cursorConfig,i.model,l.modelState)):o[n++]=Ps.fromViewState(pu.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 Ps(l.modelState,l.viewState),t?o[n++]=Ps.fromModelState(pu.translateUp(i.cursorConfig,i.model,l.modelState)):o[n++]=Ps.fromViewState(pu.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 Ps.fromViewState(pu.moveToBeginningOfLine(i.cursorConfig,i,e.viewState,t))}static _moveToLineStartByModel(i,e,t){return Ps.fromModelState(pu.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 Ps.fromViewState(pu.moveToEndOfLine(i.cursorConfig,i,e.viewState,t,o))}static _moveToLineEndByModel(i,e,t,o){return Ps.fromModelState(pu.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]=Ps.fromModelState(new ov(new z(s,1,s,1),0,0,new Ie(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]=Ps.fromModelState(pu.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]=Ps.fromModelState(pu.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 Ps.fromModelState(new ov(new z(1,1,1,1),0,0,new Ie(t,o),0))}static line(i,e,t,o,n){let r=i.model.validatePosition(o),s=n?i.coordinatesConverter.validateViewPosition(new Ie(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)),Ps.fromModelState(new ov(new z(r.lineNumber,1,u,p),2,0,new Ie(u,p),0))}let l=e.modelState.selectionStart.getStartPosition().lineNumber;if(r.lineNumber<l)return Ps.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)),Ps.fromViewState(e.viewState.move(!0,u,p,0))}else{let c=e.modelState.selectionStart.getEndPosition();return Ps.fromModelState(e.modelState.move(!0,c.lineNumber,c.column,0))}}static word(i,e,t,o){let n=i.model.validatePosition(o);return Ps.fromModelState(yf.word(i.cursorConfig,i.model,e.modelState,t,n))}static cancelSelection(i,e){if(!e.modelState.hasSelection())return new Ps(e.modelState,e.viewState);let t=e.viewState.position.lineNumber,o=e.viewState.position.column;return Ps.fromViewState(new ov(new z(t,o,t,o),0,0,new Ie(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 Ie(n.lineNumber,n.column),r):i.coordinatesConverter.convertModelPositionToViewPosition(r);return Ps.fromViewState(e.viewState.move(t,s.lineNumber,s.column,0))}static simpleMove(i,e,t,o,n,r){switch(t){case vs.Direction.Left:return r===vs.Unit.HalfLine?this._moveHalfLineLeft(i,e,o):this._moveLeft(i,e,o,n);case vs.Direction.Right:return r===vs.Unit.HalfLine?this._moveHalfLineRight(i,e,o):this._moveRight(i,e,o,n);case vs.Direction.Up:return r===vs.Unit.WrappedLine?this._moveUpByViewLines(i,e,o,n):r===vs.Unit.FoldedLine?this._moveUpByFoldedLines(i,e,o,n):this._moveUpByModelLines(i,e,o,n);case vs.Direction.Down:return r===vs.Unit.WrappedLine?this._moveDownByViewLines(i,e,o,n):r===vs.Unit.FoldedLine?this._moveDownByFoldedLines(i,e,o,n):this._moveDownByModelLines(i,e,o,n);case vs.Direction.PrevBlankLine:return r===vs.Unit.WrappedLine?e.map(s=>Ps.fromViewState(pu.moveToPrevBlankLine(i.cursorConfig,i,s.viewState,o))):e.map(s=>Ps.fromModelState(pu.moveToPrevBlankLine(i.cursorConfig,i.model,s.modelState,o)));case vs.Direction.NextBlankLine:return r===vs.Unit.WrappedLine?e.map(s=>Ps.fromViewState(pu.moveToNextBlankLine(i.cursorConfig,i,s.viewState,o))):e.map(s=>Ps.fromModelState(pu.moveToNextBlankLine(i.cursorConfig,i.model,s.modelState,o)));case vs.Direction.WrappedLineStart:return this._moveToViewMinColumn(i,e,o);case vs.Direction.WrappedLineFirstNonWhitespaceCharacter:return this._moveToViewFirstNonWhitespaceColumn(i,e,o);case vs.Direction.WrappedLineColumnCenter:return this._moveToViewCenterColumn(i,e,o);case vs.Direction.WrappedLineEnd:return this._moveToViewMaxColumn(i,e,o);case vs.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 vs.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 vs.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 vs.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 vs.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 Ps(e.modelState,e.viewState);{let r;n>t.endLineNumber-1?r=t.endLineNumber-1:n<t.startLineNumber?r=t.startLineNumber:r=n;let s=pu.vertical(i.cursorConfig,i,n,e.viewState.position.column,e.viewState.leftoverVisibleColumns,r,!1);return Ps.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 Ps.fromViewState(s?pu.moveRight(i.cursorConfig,i,n.viewState,t,o):pu.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]=Ps.fromViewState(pu.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 Ps.fromViewState(s?pu.moveLeft(i.cursorConfig,i,n.viewState,t,o):pu.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]=Ps.fromViewState(pu.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]=Ps.fromViewState(pu.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]=Ps.fromModelState(pu.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]=Ps.fromViewState(pu.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]=Ps.fromModelState(pu.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?Ps.fromModelState(l.modelState):Ps.fromModelState(pu.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?Ps.fromModelState(s.modelState):Ps.fromModelState(pu.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 Ps.fromViewState(e.viewState.move(t,o,n,0))}static _moveToModelPosition(i,e,t,o,n){return Ps.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}},vs;(s=>{let a=function(l){if(!yi(l))return!1;let c=l;return!(!Ae(c.to)||!cn(c.select)&&!Da(c.select)||!cn(c.by)&&!Ae(c.by)||!cn(c.value)&&!Xo(c.value)||!cn(c.noHistory)&&!Da(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||={})})(vs||={});var pSe=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}},Nmt=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)XGe(this.autoClosingPairsOpenByStart,e.open.charAt(0),e),XGe(this.autoClosingPairsOpenByEnd,e.open.charAt(e.open.length-1),e),XGe(this.autoClosingPairsCloseByStart,e.close.charAt(0),e),XGe(this.autoClosingPairsCloseByEnd,e.close.charAt(e.close.length-1),e),e.close.length===1&&e.open.length===1&&XGe(this.autoClosingPairsCloseSingleChar,e.close,e)}};function XGe(a,i,e){a.has(i)?a.get(i).push(e):a.set(i,[e])}var Omt=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 pSe(e)):i.brackets?this._autoClosingPairs=i.brackets.map(e=>new pSe({open:e[0],close:e[1]})):this._autoClosingPairs=[],i.__electricCharacterSupport&&i.__electricCharacterSupport.docComment){let e=i.__electricCharacterSupport.docComment;this._autoClosingPairs.push(new pSe({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 wYt;function CKi(){return wYt||(wYt=new TextDecoder("UTF-16LE")),wYt}var CYt;function dMo(){return CYt||(CYt=new TextDecoder("UTF-16BE")),CYt}var xYt;function kYt(){return xYt||(xYt=lGe()?CKi():dMo()),xYt}function xKi(a,i,e){let t=new Uint16Array(a.buffer,i,e);return e>0&&(t[0]===65279||t[0]===65534)?uMo(a,i,e):CKi().decode(t)}function uMo(a,i,e){let t=[],o=0;for(let n=0;n<e;n++){let r=U1i(a,i);i+=2,t[o++]=String.fromCharCode(r)}return t.join("")}var ES=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 kYt().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||Ru(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 EYt=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 mMo(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 Fmt=class{constructor(i,e){this._richEditBracketsBrand=void 0;let t=mMo(e);this.brackets=t.map((o,n)=>new EYt(i,n,o.open,o.close,hMo(o.open,o.close,t,n),gMo(o.open,o.close,t,n))),this.forwardRegex=fMo(this.brackets),this.reversedRegex=vMo(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 kKi(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 EKi(a,i){return a.length-i.length}function Wmt(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 hMo(a,i,e,t){let o=[];o=o.concat(a),o=o.concat(i);for(let n=0,r=o.length;n<r;n++)kKi(o[n],e,t,o);return o=Wmt(o),o.sort(EKi),o.reverse(),mSe(o)}function gMo(a,i,e,t){let o=[];o=o.concat(a),o=o.concat(i);for(let n=0,r=o.length;n<r;n++)kKi(o[n],e,t,o);return o=Wmt(o),o.sort(EKi),o.reverse(),mSe(o.map(TYt))}function fMo(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=Wmt(i),mSe(i)}function vMo(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=Wmt(i),mSe(i.map(TYt))}function bMo(a){let i=/^[\w ]+$/.test(a);return a=Yr(a),i?`\\b${a}\\b`:a}function mSe(a,i){let e=`(${a.map(bMo).join(")|(")})`;return u$(e,!0,i)}var TYt=(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 kYt().decode(o)}let i=null,e=null;return function(o){return i!==o&&(i=o,e=a(i)),e}})(),jk=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=TYt(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 Vmt=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 Uo(i)}onElectricCharacter(i,e,t){if(!this._richEditBrackets||this._richEditBrackets.brackets.length===0)return null;let o=e.findTokenIndexAtOffset(t-1);if(IN(e.getStandardTokenType(o)))return null;let n=this._richEditBrackets.reversedRegex,r=e.getLineContent().substring(0,t-1)+i,s=jk.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 Bmt(a){return a.global&&(a.lastIndex=0),!0}var Hmt=class{constructor(i){this._indentationRules=i}shouldIncrease(i){return!!(this._indentationRules&&this._indentationRules.increaseIndentPattern&&Bmt(this._indentationRules.increaseIndentPattern)&&this._indentationRules.increaseIndentPattern.test(i))}shouldDecrease(i){return!!(this._indentationRules&&this._indentationRules.decreaseIndentPattern&&Bmt(this._indentationRules.decreaseIndentPattern)&&this._indentationRules.decreaseIndentPattern.test(i))}shouldIndentNextLine(i){return!!(this._indentationRules&&this._indentationRules.indentNextLinePattern&&Bmt(this._indentationRules.indentNextLinePattern)&&this._indentationRules.indentNextLinePattern.test(i))}shouldIgnore(i){return!!(this._indentationRules&&this._indentationRules.unIndentedLinePattern&&Bmt(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 Umt=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=Yr(i);return/\B/.test(e.charAt(0))||(e="\\b"+e),e+="\\s*$",a._safeRegExp(e)}static _createCloseBracketRegExp(i){let e=Yr(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=ae("configurationService");function ZGe(a){let i=a;return i&&typeof i=="object"&&(!i.overrideIdentifier||typeof i.overrideIdentifier=="string")&&(!i.resource||i.resource instanceof A)}function _Yt(a){let i=a;return i&&typeof i=="object"&&(!i.overrideIdentifiers||Array.isArray(i.overrideIdentifiers))&&!i.overrideIdentifier&&(!i.resource||i.resource instanceof A)}function ise(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 ose(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:Hr(i)}}function e$e(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 hSe(a,i){let e=Object.create(null);for(let t in a)DYt(e,t,a[t],i);return e}function DYt(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 TKi(a,i){let e=i.split(".");_Ki(a,e)}function _Ki(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)&&(_Ki(o,i),Object.keys(o).length===0&&delete e[t])}}function t$e(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 gSe(a){return a.replace(/^\[/,"").replace(/]$/g,"").replace(/\]\[/g,", ")}var kt=ae("languageService");var Mt=class{constructor(i,e=[],t=!1){this.ctor=i,this.staticArguments=e,this.supportsDelayedInstantiation=t}};var DKi=[];function we(a,i,e){i instanceof Mt||(i=new Mt(i,[],!!e)),DKi.push([a,i])}function LKi(){return DKi}var Zn=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"}),SMo={".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"},LYt={".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 RKi(a){let i=Am(a),e=SMo[i.toLowerCase()];return e!==void 0?e:i$e(a)}function i$e(a){let i=Am(a),e=LYt[i.toLowerCase()];return Array.isArray(e)?e[0]:e}function K6(a){for(let i in LYt){let e=LYt[i];if(Array.isArray(e)?e.includes(a):e===a)return i}}var IMo=/^(.+)\/(.+?)(;.+)?$/;function RYt(a,i){let e=IMo.exec(a);return e?`${e[1].toLowerCase()}/${e[2].toLowerCase()}${e[3]??""}`:i?void 0:a}function oL(a){return["application/vnd.code.notebook.stdout","application/vnd.code.notebook.stderr"].includes(a)}function MKi(a){let i=!1,e=new Map,t=new Map;if(yMo(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 fSe(a){return typeof a=="object"&&a!==null}function yMo(a,i){if(!a||typeof a!="object")return;let e=(...l)=>{for(let c of l)fSe(c)&&r.push(c)},t=(...l)=>{for(let c of l)if(fSe(c))for(let u in c){let p=c[u];fSe(p)&&r.push(p)}},o=(...l)=>{for(let c of l)if(Array.isArray(c))for(let u of c)fSe(u)&&r.push(u)},n=l=>{if(Array.isArray(l))for(let c of l)fSe(c)&&r.push(c);else fSe(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 ea={JSONContribution:"base.contributions.json"};function PKi(a){return a.length>0&&a.charAt(a.length-1)==="#"?a.substring(0,a.length-1):a}var MYt=class extends C{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=PKi(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=PKi(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?MKi(t):void 0}hasSchemaContent(e){return!!this.schemasById[e]}getSchemaAssociations(){return this.schemaAssociations}},wMo=new MYt;oe.add(ea.JSONContribution,wMo);var nL,PYt=globalThis.vscode;if(typeof PYt<"u"&&typeof PYt.context<"u"){let a=PYt.context.configuration();if(a)nL=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(nL=globalThis._VSCODE_PRODUCT_JSON,fp.VSCODE_DEV&&Object.assign(nL,{nameShort:`${nL.nameShort} Dev`,nameLong:`${nL.nameLong} Dev`,dataFolderName:`${nL.dataFolderName}-dev`,serverDataFolderName:nL.serverDataFolderName?`${nL.serverDataFolderName}-dev`:void 0}),!nL.version){let a=globalThis._VSCODE_PACKAGE_JSON;Object.assign(nL,{version:a.version})}}else nL={nameShort:"Code",nameLong:"Visual Studio Code",applicationName:"code",win32x64AppId:"{{EA457B21-F73E-494C-ACAB-524FDE069978}",win32arm64AppId:"{{A5270FC5-65AD-483E-AC30-2C276B63D0AC}",win32x64UserAppId:"{{771FD6B0-FA20-440A-A002-3B3BAC16DC50}",win32arm64UserAppId:"{{D9E514E7-1A56-452D-9337-2990C0DC4310}",win32NameVersion:"Microsoft Visual Studio Code",win32DirName:"Microsoft VS Code",win32SetupExeBasename:"VSCodeSetup",win32AppUserModelId:"Microsoft.VisualStudioCode",win32ShellNameShort:"Code",win32MutexName:"vscode",win32RegValueName:"VSCode",win32VersionedUpdate:!0,darwinCredits:"resources/darwin/Credits.rtf",darwinBundleIdentifier:"com.microsoft.VSCode",darwinProfileUUID:"EBAE60D6-C8A2-4419-92FF-24F8AD5077AB",darwinProfilePayloadUUID:"C6B5723A-6539-4F31-8A4E-3CC96E51F48C",darwinExecutable:"VSCode",linuxIconName:"vscode",licenseFileName:"LICENSE.rtf",licenseName:"Multiple, see https://code.visualstudio.com/license",serverGreeting:[],serverLicense:["*","* Visual Studio Code Server","*","* By using the software, you agree to","* the Visual Studio Code Server License Terms (https://aka.ms/vscode-server-license) and","* the Microsoft Privacy Statement (https://privacy.microsoft.com/en-US/privacystatement).","*"],serverLicensePrompt:"Do you accept the terms in the License Agreement (Y/n)?",serverApplicationName:"code-server",urlProtocol:"vscode",dataFolderName:".vscode",serverDataFolderName:".vscode-server",downloadUrl:"https://code.visualstudio.com",updateUrl:"https://update.code.visualstudio.com",webUrl:"https://vscode.dev",webEndpointUrl:"https://main.vscode-cdn.net",webEndpointUrlTemplate:"https://{{uuid}}.vscode-cdn.net/{{quality}}/{{commit}}",nlsCoreBaseUrl:"https://www.vscode-unpkg.net/nls/",webviewContentExternalBaseUrlTemplate:"https://{{uuid}}.vscode-cdn.net/{{quality}}/{{commit}}/out/vs/workbench/contrib/webview/browser/pre/",quality:"stable",embedded:{nameShort:"Sessions",nameLong:"Visual Studio Code Sessions",applicationName:"sessions",win32AppUserModelId:"Microsoft.VisualStudioCodeSessions",win32MutexName:"vscodesessions",win32RegValueName:"VSCodeSessions",win32NameVersion:"Microsoft Visual Studio Code Sessions",win32VersionedUpdate:!0,darwinBundleIdentifier:"com.microsoft.VSCodeSessions",dataFolderName:".vscode-sessions",urlProtocol:"vscode-sessions",inheritAuthAccountPreference:{"github.copilot":["github.copilot-chat"],"vscode.github":["github.copilot-chat"]}},extensionsGallery:{nlsBaseUrl:"https://www.vscode-unpkg.net/_lp/",serviceUrl:"https://marketplace.visualstudio.com/_apis/public/gallery",itemUrl:"https://marketplace.visualstudio.com/items",publisherUrl:"https://marketplace.visualstudio.com/publishers",resourceUrlTemplate:"https://{publisher}.vscode-unpkg.net/{publisher}/{name}/{version}/{path}",extensionUrlTemplate:"https://www.vscode-unpkg.net/_gallery/{publisher}/{name}/latest",controlUrl:"https://main.vscode-cdn.net/extensions/marketplace.json",mcpUrl:"https://main.vscode-cdn.net/mcp/servers.json",accessSKUs:["copilot_enterprise_seat","copilot_enterprise_seat_quota","copilot_enterprise_seat_multi_quota","copilot_enterprise_seat_assignment","copilot_enterprise_seat_assignment_quota","copilot_enterprise_seat_assignment_multi_quota","copilot_enterprise_trial_seat","copilot_enterprise_trial_seat_quota","copilot_for_business_seat","copilot_for_business_seat_quota","copilot_for_business_seat_multi_quota","copilot_for_business_seat_assignment","copilot_for_business_seat_assignment_quota","copilot_for_business_seat_assignment_multi_quota","copilot_for_business_trial_seat","copilot_for_business_trial_seat_quota"]},mcpGallery:{serviceUrl:"https://api.mcp.github.com",itemWebUrl:"https://github.com/mcp/{name}",publisherUrl:"https://github.com/{name}",supportUrl:"https://support.github.com",privacyPolicyUrl:"https://docs.github.com/site-policy/privacy-policies/github-general-privacy-statement",termsOfServiceUrl:"https://docs.github.com/site-policy/github-terms/github-terms-of-service",reportUrl:"https://docs.github.com/communities/maintaining-your-safety-on-github/reporting-abuse-or-spam"},extensionProperties:{"github.copilot-chat":{hasPrereleaseVersion:!1,excludeVersionRange:"<=0.16.1"},"github.copilot":{hasPrereleaseVersion:!0}},extensionsForceVersionByQuality:["github.copilot-chat","github.copilot"],profileTemplatesUrl:"https://main.vscode-cdn.net/core/profile-templates.json",emergencyAlertUrl:"https://main.vscode-cdn.net/core/stable.json",extensionPublisherOrgs:["microsoft"],trustedExtensionPublishers:["microsoft","github","openai"],extensionRecommendations:{"ms-dotnettools.csdevkit":{onFileOpen:[{pathGlob:"{**/*.cs,**/global.json,**/*.csproj,**/*.cshtml,**/*.sln}",important:!0},{languages:["csharp"],important:!0},{pathGlob:"{**/project.json,**/appsettings.json}"}]},"ms-python.python":{onFileOpen:[{pathGlob:"{**/*.py}",important:!0},{languages:["python"],important:!0},{pathGlob:"{**/*.ipynb}"}]},"ms-toolsai.jupyter":{onFileOpen:[{pathGlob:"{**/*.py}",contentPattern:"^#\\s*%%$",important:!0,whenInstalled:["ms-python.python"]},{pathGlob:"{**/*.ipynb}"}]},"ms-toolsai.datawrangler":{onFileOpen:[{pathGlob:"{**/*.ipynb}",contentPattern:"import\\s*pandas|from\\s*pandas",whenInstalled:["ms-toolsai.jupyter"]}]},"golang.Go":{onFileOpen:[{pathGlob:"**/*.go",important:!0},{languages:["go"],important:!0}]},"vscjava.vscode-java-pack":{onFileOpen:[{pathGlob:"{**/*.java}",important:!0,whenNotInstalled:["ASF.apache-netbeans-java","Oracle.oracle-java"]},{languages:["java"],important:!0,whenNotInstalled:["ASF.apache-netbeans-java","Oracle.oracle-java"]}]},"ms-vscode.PowerShell":{onFileOpen:[{pathGlob:"{**/*.ps1,**/*.psd1,**/*.psm1}",important:!0},{languages:["powershell"],important:!0},{pathGlob:"{**/*.ps.config,**/*.ps1.config}"}]},"ms-toolsai.prompty":{onFileOpen:[{pathGlob:"{**/*.prompty}",important:!1}]},"quantum.qsharp-lang-vscode":{onFileOpen:[{pathGlob:"{**/*.qs,**/*.qsc,**/*.qasm}",important:!0}]},"typespec.typespec-vscode":{onFileOpen:[{pathGlob:"{**/*.tsp,**/tspconfig.yaml}",important:!0}]},"ms-vscode.cpptools-extension-pack":{onFileOpen:[{pathGlob:"{**/*.c,**/*.cpp,**/*.cc,**/.cxx,**/*.hh,**/*.hpp,**/*.hxx,**/*.h}",important:!0,whenNotInstalled:["llvm-vs-code-extensions.vscode-clangd"]},{languages:["c","cpp"],important:!0,whenNotInstalled:["llvm-vs-code-extensions.vscode-clangd"]}]},"ms-azuretools.vscode-containers":{onFileOpen:[{pathGlob:"{**/dockerfile,**/Dockerfile,**/docker-compose.yml,**/docker-compose.*.yml}",important:!0,whenNotInstalled:["ms-azuretools.vscode-docker"]},{languages:["dockerfile"],important:!0,whenNotInstalled:["ms-azuretools.vscode-docker"]},{pathGlob:"{**/*.cs,**/project.json,**/global.json,**/*.csproj,**/*.cshtml,**/*.sln,**/appsettings.json,**/*.py,**/*.ipynb,**/*.js,**/*.ts,**/package.json}",whenNotInstalled:["ms-azuretools.vscode-docker"]}]},"vue.volar":{onFileOpen:[{pathGlob:"{**/*.vue}",important:!0},{languages:["vue"],important:!0}]},"ms-vscode.makefile-tools":{onFileOpen:[{pathGlob:"{**/makefile,**/Makefile}",important:!0},{languages:["makefile"],important:!0}]},"ms-vscode.cmake-tools":{onFileOpen:[{pathGlob:"{**/CMakeLists.txt}",important:!0}]},"ms-azure-devops.azure-pipelines":{onFileOpen:[{pathGlob:"{**/azure-pipelines.yaml}",important:!0}]},"msazurermtools.azurerm-vscode-tools":{onFileOpen:[{pathGlob:"{**/azuredeploy.json}",important:!0}]},"ms-vscode-remote.remote-containers":{onFileOpen:[{pathGlob:"{**/devcontainer.json}",important:!0}]},"ms-azuretools.vscode-bicep":{onFileOpen:[{pathGlob:"{**/*.bicep}",important:!0,whenNotInstalled:["ms-azuretools.rad-vscode-bicep"]}]},"svelte.svelte-vscode":{onFileOpen:[{pathGlob:"{**/*.svelte}",important:!0}]},"ms-vscode.vscode-github-issue-notebooks":{onFileOpen:[{pathGlob:"{**/*.github-issues}",important:!0}]},"ms-playwright.playwright":{onFileOpen:[{pathGlob:"{**/*playwright*.config.ts,**/*playwright*.config.js,**/*playwright*.config.mjs}",important:!0}]},"vscjava.vscode-gradle":{onFileOpen:[{pathGlob:"{**/gradlew,**/gradlew.bat,**/build.gradle,**/build.gradle.kts,**/settings.gradle,**/settings.gradle.kts}",important:!0}]},"REditorSupport.r":{onFileOpen:[{pathGlob:"{**/*.r}",important:!0},{languages:["r"],important:!0}]},"firefox-devtools.vscode-firefox-debug":{onFileOpen:[{pathGlob:"{**/*.ts,**/*.tsx,**/*.js,**/*.jsx,**/*.es6,**/.babelrc}"}]},"ms-edgedevtools.vscode-edge-devtools":{onFileOpen:[{pathGlob:"{**/*.ts,**/*.tsx,**/*.js,**/*.css,**/*.html}"}]},"Ionide.Ionide-fsharp":{onFileOpen:[{pathGlob:"{**/*.fsx,**/*.fsi,**/*.fs,**/*.ml,**/*.mli}"}]},"dbaeumer.vscode-eslint":{onFileOpen:[{pathGlob:"{**/*.js,**/*.jsx,**/*.es6,**/.eslintrc.*,**/.eslintrc,**/.babelrc,**/jsconfig.json}"}]},"bmewburn.vscode-intelephense-client":{onFileOpen:[{pathGlob:"{**/*.php,**/php.ini}"}]},"xdebug.php-debug":{onFileOpen:[{pathGlob:"{**/*.php,**/php.ini}"}]},"rust-lang.rust-analyzer":{onFileOpen:[{pathGlob:"{**/*.rs,**/*.rslib}"}]},"DavidAnson.vscode-markdownlint":{onFileOpen:[{pathGlob:"{**/*.md}"}]},"EditorConfig.EditorConfig":{onFileOpen:[{pathGlob:"{**/.editorconfig}"}]},"HookyQR.beautify":{onFileOpen:[{pathGlob:"{**/.jsbeautifyrc}"}]},"donjayamanne.githistory":{onFileOpen:[{pathGlob:"{**/.gitignore,**/.git}"}]},"eamodio.gitlens":{onFileOpen:[{pathGlob:"{**/.gitignore,**/.git}"}]},"Shopify.ruby-lsp":{onFileOpen:[{pathGlob:"{**/*.rb,**/*.erb,**/*.reek,**/.fasterer.yml,**/ruby-lint.yml,**/.rubocop.yml}"}]},"swiftlang.swift-vscode":{onFileOpen:[{pathGlob:"{**/*.swift,**/*.swiftinterface}",important:!0}]},"DotJoshJohnson.xml":{onFileOpen:[{pathGlob:"{**/*.xml}"}]},"stylelint.vscode-stylelint":{onFileOpen:[{pathGlob:"{**/.stylelintrc,**/stylelint.config.js}"}]},"ms-mssql.mssql":{onFileOpen:[{pathGlob:"{**/*.sql}"}]},"mtxr.sqltools":{onFileOpen:[{pathGlob:"{**/*.sql}"}]},"usqlextpublisher.usql-vscode-ext":{onFileOpen:[{pathGlob:"{**/*.usql}"}]},"ms-vscode.sublime-keybindings":{onFileOpen:[{pathGlob:"{**/.sublime-project,**/.sublime-workspace}"}]},"k--kato.intellij-idea-keybindings":{onFileOpen:[{pathGlob:"{**/.idea}"}]},"christian-kohler.npm-intellisense":{onFileOpen:[{pathGlob:"{**/package.json}"}]},"cake-build.cake-vscode":{onFileOpen:[{pathGlob:"{**/build.cake}"}]},"Angular.ng-template":{onFileOpen:[{pathGlob:"{**/.angular-cli.json,**/angular.json,**/*.ng.html,**/*.ng,**/*.ngml}"}]},"vscjava.vscode-maven":{onFileOpen:[{pathGlob:"**/pom.xml"}]},"ms-azuretools.vscode-azureterraform":{onFileOpen:[{pathGlob:"**/*.tf"}]},"HashiCorp.terraform":{onFileOpen:[{pathGlob:"**/*.tf"}]},"vsciot-vscode.vscode-arduino":{onFileOpen:[{pathGlob:"**/*.ino"}]},"ms-kubernetes-tools.vscode-kubernetes-tools":{onFileOpen:[{pathGlob:"{**/Chart.yaml}"}]},"Oracle.oracledevtools":{onFileOpen:[{pathGlob:"{**/*.sql}"}]},"betterthantomorrow.calva":{onFileOpen:[{pathGlob:"{**/*.clj,**/*.cljs}"}]},"vmware.vscode-boot-dev-pack":{onFileOpen:[{pathGlob:"{**/application.properties}"}]},"GitHub.copilot":{onFileOpen:[{pathGlob:"{**/*.ts,**/*.tsx,**/*.js,**/*.jsx,**/*.py,**/*.go,**/*.rb,**/*.html,**/*.css,**/*.php,**/*.cpp,**/*.vue,**/*.c,**/*.sql,**/*.java,**/*.cs,**/*.rs,**/*.dart,**/*.ps,**/*.ps1,**/*.tex}"}]},"GitHub.copilot-chat":{onSettingsEditorOpen:{descriptionOverride:"GitHub Copilot is an AI-powered coding assistant that helps you write code faster and smarter."}},"GitHub.vscode-github-actions":{onFileOpen:[{pathGlob:"{**/.github/workflows/*.yml}",important:!0}]},"circleci.circleci":{onFileOpen:[{pathGlob:"{**/.circleci/config.yml}"}]},"mechatroner.rainbow-csv":{onFileOpen:[{pathGlob:"**/*.csv",important:!0}]},"tomoki1207.pdf":{onFileOpen:[{pathGlob:"**/*.pdf",important:!0}]},"Redis.redis-for-vscode":{onFileOpen:[{pathGlob:"{**/redis.*,**/redis-server.*,**/redis_*,**/redisinsight.*}",important:!0}]},"SonarSource.sonarlint-vscode":{onFileOpen:[{pathGlob:"{**/sonar-project.properties,**/sonarcloud.properties,**/sonarlint.*}",important:!0}]}},keymapExtensionTips:["vscodevim.vim","ms-vscode.sublime-keybindings","ms-vscode.atom-keybindings","ms-vscode.brackets-keybindings","ms-vscode.vs-keybindings","ms-vscode.notepadplusplus-keybindings","k--kato.intellij-idea-keybindings","lfs.vscode-emacs-friendly","alphabotsec.vscode-eclipse-keybindings","alefragnani.delphi-keybindings"],languageExtensionTips:["ms-python.python","ms-vscode.cpptools-extension-pack","ms-dotnettools.csdevkit","ms-toolsai.jupyter","vscjava.vscode-java-pack","ecmel.vscode-html-css","vue.volar","bmewburn.vscode-intelephense-client","dsznajder.es7-react-js-snippets","golang.go","ms-vscode.powershell","dart-code.dart-code","rust-lang.rust-analyzer","Shopify.ruby-lsp","GitHub.copilot"],configBasedExtensionTips:{git:{configPath:".git/config",configName:"Git",recommendations:{"github.vscode-pull-request-github":{name:"GitHub Pull Request",contentPattern:"^\\s*url\\s*=\\s*https:\\/\\/github\\.com.*$"},"eamodio.gitlens":{name:"GitLens"}}},devContainer:{configPath:".devcontainer/devcontainer.json",configName:"Dev Container",recommendations:{"ms-vscode-remote.remote-containers":{name:"Dev Containers",important:!0}}},maven:{configPath:"pom.xml",configName:"Maven",recommendations:{"vscjava.vscode-java-pack":{name:"Java",important:!0,isExtensionPack:!0,whenNotInstalled:["ASF.apache-netbeans-java","Oracle.oracle-java"]},"vmware.vscode-boot-dev-pack":{name:"Spring Boot Extension Pack",isExtensionPack:!0}}},gradle:{configPath:"build.gradle",configName:"Gradle",recommendations:{"vscjava.vscode-java-pack":{name:"Java",important:!0,isExtensionPack:!0,whenNotInstalled:["ASF.apache-netbeans-java","Oracle.oracle-java"]}}},"github-pull-request":{configPath:".vscode/.github-pull-request.rec",configName:"GitHub",configScheme:"vscode-vfs",recommendations:{"github.vscode-pull-request-github":{name:"GitHub Pull Request",important:!0}}},"pyproject-formatter":{configPath:"pyproject.toml",configName:"Python Formatter",recommendations:{"ms-python.black-formatter":{name:"Black Formatter",contentPattern:'(^\\s*\\[\\[?\\s*"?tool"?\\s*\\.\\s*"?black"?\\s*[\\].])|("black\\s*["[(<=>!~;@])'},"ms-python.autopep8":{name:"Autopep8",contentPattern:'(^\\s*\\[\\[?\\s*"?tool"?\\s*\\.\\s*"?autopep8"?\\s*[\\].])|("autopep8\\s*["[(<=>!~;@])'}}},"pep8-formatter":{configPath:".pep8",configName:"Python Formatter",recommendations:{"ms-python.autopep8":{name:"Autopep8"}}},"python-setup-cgf-formatter":{configPath:"setup.cfg",configName:"Python Formatter",recommendations:{"ms-python.autopep8":{name:"Autopep8",contentPattern:"^\\[pep8\\]"}}},"tox-ini-formatter":{configPath:"tox.ini",configName:"Python Formatter",recommendations:{"ms-python.autopep8":{name:"Autopep8",contentPattern:"^\\[pep8\\]"}}},"pyproject-linter":{configPath:"pyproject.toml",configName:"Python Linter",recommendations:{"ms-python.pylint":{name:"Pylint",contentPattern:'(^\\s*\\[\\[?\\s*"?tool"?\\s*\\.\\s*"?pylint"?\\s*[\\].])|("pylint\\s*["[(<=>!~;@])'},"charliermarsh.ruff":{name:"Ruff",contentPattern:'(^\\s*\\[\\[?\\s*"?tool"?\\s*\\.\\s*"?ruff"?\\s*[\\].])|("ruff\\s*["[(<=>!~;@])'},"ms-python.mypy-type-checker":{name:"Mypy Type Checker",contentPattern:'(^\\s*\\[\\[?\\s*"?tool"?\\s*\\.\\s*"?mypy"?\\s*[\\].])|("mypy\\s*["[(<=>!~;@])'},"ms-python.flake8":{name:"Flake8",contentPattern:'(^\\s*\\[\\[?\\s*"?tool"?\\s*\\.\\s*"?flake8"?\\s*[\\].])|("flake8\\s*["[(<=>!~;@])'}}},".pylintrc-linter":{configPath:".pylintrc",configName:"Python Linter",recommendations:{"ms-python.pylint":{name:"Pylint"}}},"pylintrc-linter":{configPath:"pylintrc",configName:"Python Linter",recommendations:{"ms-python.pylint":{name:"Pylint"}}},"mypy-ini-linter":{configPath:".mypy.ini",configName:"Python Linter",recommendations:{"ms-python.mypy-type-checker":{name:"Mypy Type Checker"}}},"tox-ini-linter":{configPath:"tox.ini",configName:"Python Linter",recommendations:{"ms-python.flake8":{name:"Flake8",contentPattern:"^\\[flake8\\]"}}},".flake8-linter":{configPath:".flake8",configName:"Python Linter",recommendations:{"ms-python.flake8":{name:"Flake8"}}},"python-setup-cgf-linter":{configPath:"setup.cfg",configName:"Python Linter",recommendations:{"ms-python.flake8":{name:"Flake8",contentPattern:"^\\[flake8\\]"}}}},exeBasedExtensionTips:{az:{friendlyName:"Azure CLI",windowsPath:"%ProgramFiles(x86)%\\Microsoft SDKs\\Azure\\CLI2\\wbin\\az.cmd",recommendations:{"ms-vscode.vscode-node-azure-pack":{name:"Azure Tools"},"ms-azuretools.vscode-azure-github-copilot":{name:"GitHub Copilot for Azure"}}},azd:{friendlyName:"Azure Dev CLI",windowsPath:"%USERPROFILE%\\AppData\\Local\\Programs\\Azure Dev CLI\\azd.exe",recommendations:{"ms-vscode.vscode-node-azure-pack":{name:"Azure Tools"},"ms-azuretools.vscode-azure-github-copilot":{name:"GitHub Copilot for Azure"}}},"azd-user":{friendlyName:"Azure Dev CLI",windowsPath:"%ProgramFiles%\\Azure Dev CLI\\azd.exe",recommendations:{"ms-vscode.vscode-node-azure-pack":{name:"Azure Tools"},"ms-azuretools.vscode-azure-github-copilot":{name:"GitHub Copilot for Azure"}}},"azure-powershell":{friendlyName:"Azure PowerShell",windowsPath:"%USERPROFILE%\\.Azure",recommendations:{"ms-vscode.vscode-node-azure-pack":{name:"Azure Tools"}}},heroku:{friendlyName:"Heroku CLI",windowsPath:"%ProgramFiles%\\Heroku\\bin\\heroku.cmd",recommendations:{"ms-azuretools.vscode-azureappservice":{name:"Azure App Service"},"pkosta2005.heroku-command":{name:"heroku-cli"}}},mongo:{friendlyName:"Mongo",windowsPath:"%ProgramFiles%\\MongoDB\\Server\\3.6\\bin\\mongod.exe",recommendations:{"ms-azuretools.vscode-cosmosdb":{name:"Azure Databases"}}},serverless:{friendlyName:"Serverless framework",windowsPath:"%APPDATA%\\npm\\serverless.cmd",recommendations:{"ms-azuretools.vscode-azurefunctions":{name:"Azure Functions"}}},func:{friendlyName:"Azure Function SDK",windowsPath:"%APPDATA%\\npm\\func.cmd",recommendations:{"ms-azuretools.vscode-azurefunctions":{name:"Azure Functions"}}},mysql:{friendlyName:"MySQL",windowsPath:"%ProgramFiles%\\MySQL\\MySQL Server 8.0\\bin\\mysqld.exe",recommendations:{"mtxr.sqltools":{name:"SQLTools"}}},postgres:{friendlyName:"PostgreSQL",windowsPath:"%ProgramFiles%\\PostgreSQL\\11\\bin\\psql.exe",recommendations:{"ms-ossdata.vscode-postgresql":{name:"PostgreSQL"},"mtxr.sqltools":{name:"SQLTools"}}},sqlcmd:{friendlyName:"SQL CLI",recommendations:{"ms-mssql.mssql":{name:"SQL Server (mssql)"}}},now:{friendlyName:"Now CLI",windowsPath:"%APPDATA%\\npm\\now.cmd",recommendations:{"ms-azuretools.vscode-azureappservice":{name:"Azure App Service"},"ms-azuretools.vscode-containers":{name:"Docker"}}},docker:{friendlyName:"Docker",windowsPath:"%ProgramFiles%\\Docker\\Docker\\Resources\\bin\\docker.exe",recommendations:{"ms-azuretools.vscode-containers":{name:"Docker",important:!0,whenNotInstalled:["ms-azuretools.vscode-docker"]},"ms-vscode-remote.remote-containers":{name:"Dev Containers",important:!0},"ms-kubernetes-tools.vscode-kubernetes-tools":{name:"Kubernetes"}}},kubectl:{friendlyName:"Kubernetes",windowsPath:"%ProgramFiles%\\Docker\\Docker\\Resources\\bin\\kubectl.exe",recommendations:{"ms-azuretools.vscode-containers":{name:"Docker"},"ms-kubernetes-tools.vscode-kubernetes-tools":{name:"Kubernetes"},"ms-vscode-remote.remote-containers":{name:"Dev Containers"}}},ng:{friendlyName:"Angular CLI",windowsPath:"%APPDATA%\\npmexit\\ng.cmd",recommendations:{"johnpapa.Angular2":{name:"Angular Snippets"}}},"create-react-app":{friendlyName:"Create React App",windowsPath:"%APPDATA%\\npm\\create-react-app.cmd",recommendations:{"msjsdiag.vscode-react-native":{name:"React Native Tools"}}},"react-native":{friendlyName:"React Native",windowsPath:"%APPDATA%\\npm\\react-native-cli",recommendations:{"msjsdiag.vscode-react-native":{name:"React Native Tools"}}},p4:{friendlyName:"Perforce",recommendations:{"slevesque.perforce":{name:"Perforce for VS Code"}}},hg:{friendlyName:"Mercurial",recommendations:{"mrcrowl.hg":{name:"Hg"}}},git:{friendlyName:"Git",windowsPath:"%ProgramFiles%\\Git\\git-bash.exe",recommendations:{"eamodio.gitlens":{name:"GitLens"}}},svn:{friendlyName:"Subversion",windowsPath:"%ProgramFiles%\\TortoiseSVN\\bin\\TortoiseProc.exe",recommendations:{"johnstoncode.svn-scm":{name:"SVN"}}},subl:{friendlyName:"Sublime",windowsPath:"%ProgramFiles%\\Sublime Text3\\sublime_text.exe",recommendations:{"ms-vscode.sublime-keybindings":{name:"Sublime Text Keymap and Settings Importer"}}},atom:{friendlyName:"Atom",windowsPath:"%USERPROFILE%\\AppData\\Local\\atom\\bin\\atom.cmd",recommendations:{"ms-vscode.atom-keybindings":{name:"Atom Keymap"}}},brackets:{friendlyName:"Brackets",windowsPath:"%ProgramFiles(x86)%\\Brackets\\Brackets.exe",recommendations:{"ms-vscode.brackets-keybindings":{name:"Brackets Keymap"}}},notepadplusplus:{friendlyName:"Notepad++",windowsPath:"%ProgramFiles%\\Notepad++\\Notepad++.exe",recommendations:{"ms-vscode.notepadplusplus-keybindings":{name:"Notepad++ keymap"}}},vi:{friendlyName:"VIM",windowsPath:"%ProgramFiles(x86)%\\Vim\\vim80\\gvim.exe",recommendations:{"vscodevim.vim":{name:"Vim"}}},mvn:{friendlyName:"Maven",recommendations:{"vscjava.vscode-java-pack":{name:"Java",important:!0,isExtensionPack:!0,whenNotInstalled:["ASF.apache-netbeans-java","Oracle.oracle-java"]}}},gradle:{friendlyName:"Gradle",recommendations:{"vscjava.vscode-java-pack":{name:"Java",important:!0,isExtensionPack:!0,whenNotInstalled:["ASF.apache-netbeans-java","Oracle.oracle-java"]}}},ollama:{friendlyName:"Ollama",windowsPath:"%USERPROFILE%\\AppData\\Local\\Programs\\Ollama\\ollama.exe",recommendations:{"ms-windows-ai-studio.windows-ai-studio":{name:"AI Toolkit for Visual Studio Code"}}},"Microsoft Edge":{friendlyName:"Microsoft Edge",windowsPath:"%USERPROFILE%\\AppData\\Local\\Microsoft\\Edge\\Application\\msedge.exe",recommendations:{"ms-edgedevtools.vscode-edge-devtools":{name:"Microsoft Edge Developer Tools"}}},"Microsoft Edge Dev":{friendlyName:"Microsoft Edge Dev",windowsPath:"%USERPROFILE%\\AppData\\Local\\Microsoft\\Edge Dev\\Application\\msedge.exe",recommendations:{"ms-edgedevtools.vscode-edge-devtools":{name:"Microsoft Edge Developer Tools"}}},"Microsoft Edge Beta":{friendlyName:"Microsoft Edge Beta",windowsPath:"%USERPROFILE%\\AppData\\Local\\Microsoft\\Edge Beta\\Application\\msedge.exe",recommendations:{"ms-edgedevtools.vscode-edge-devtools":{name:"Microsoft Edge Developer Tools"}}},"Microsoft Edge Canary":{friendlyName:"Microsoft Edge Canary",windowsPath:"%USERPROFILE%\\AppData\\Local\\Microsoft\\Edge SxS\\Application\\msedge.exe",recommendations:{"ms-edgedevtools.vscode-edge-devtools":{name:"Microsoft Edge Developer Tools"}}},"Mozilla Firefox (x86)":{friendlyName:"Mozilla Firefox",windowsPath:"%ProgramFiles(x86)%\\Mozilla Firefox\\firefox.exe",recommendations:{"firefox-devtools.vscode-firefox-debug":{name:"Debugger for Firefox"}}},"Mozilla Firefox Developer Edition (x86)":{friendlyName:"Mozilla Firefox Developer Edition",windowsPath:"%ProgramFiles(x86)%\\Firefox Developer Edition\\firefox.exe",recommendations:{"firefox-devtools.vscode-firefox-debug":{name:"Debugger for Firefox"}}},"Mozilla Firefox":{friendlyName:"Mozilla Firefox",windowsPath:"%ProgramFiles%\\Mozilla Firefox\\firefox.exe",recommendations:{"firefox-devtools.vscode-firefox-debug":{name:"Debugger for Firefox"}}},"Mozilla Firefox Developer Edition":{friendlyName:"Mozilla Firefox Developer Edition",windowsPath:"%ProgramFiles%\\Firefox Developer Edition\\firefox.exe",recommendations:{"firefox-devtools.vscode-firefox-debug":{name:"Debugger for Firefox"}}},cordova:{friendlyName:"Cordova",windowsPath:"%APPDATA%\\npm\\cordova",recommendations:{"msjsdiag.cordova-tools":{name:"Cordova Tools"}}},gcloud:{friendlyName:"Google GCloud CLI",windowsPath:"%ProgramFiles(x86)%\\Google\\Cloud SDK\\google-cloud-sdk\\bin\\gcloud.cmd",recommendations:{"GoogleCloudTools.cloudcode":{name:"Cloud Code"}}},skaffold:{friendlyName:"Skaffold Code to Cluster",recommendations:{"ms-azuretools.vscode-containers":{name:"Docker"},"ms-kubernetes-tools.vscode-kubernetes-tools":{name:"Kubernetes"}}},minikube:{friendlyName:"MiniKube Local Kubernetes Cluster",recommendations:{"ms-azuretools.vscode-containers":{name:"Docker"},"ms-kubernetes-tools.vscode-kubernetes-tools":{name:"Kubernetes"},"ms-vscode-remote.remote-containers":{name:"Dev Containers"}}},podman:{friendlyName:"Podman",recommendations:{"ms-vscode-remote.remote-containers":{name:"Dev Containers"}}},wsl:{friendlyName:"Windows Subsystem for Linux (WSL)",windowsPath:"%WINDIR%\\system32\\lxss\\LxssManager.dll",recommendations:{"ms-vscode-remote.remote-wsl":{name:"WSL"}}}},webExtensionTips:["tyriar.luna-paint","codespaces-contrib.codeswing","ms-vscode.vscode-github-issue-notebooks","esbenp.prettier-vscode","hediet.vscode-drawio"],virtualWorkspaceExtensionTips:{"vscode-vfs":{friendlyName:"Remote Repositories",extensionId:"ms-vscode.remote-repositories",startEntry:{helpLink:"https://aka.ms/vscode-remote/remote-repositories",startConnectLabel:"Remote Repository",startCommand:"remoteHub.continueOn.openRepository",priority:5}}},remoteExtensionTips:{wsl:{friendlyName:"WSL",extensionId:"ms-vscode-remote.remote-wsl",supportedPlatforms:["Windows","Web"],startEntry:{helpLink:"https://aka.ms/vscode-remote/wsl",startConnectLabel:"WSL",startCommand:"remote-wsl.connect",priority:3}},"ssh-remote":{friendlyName:"Remote - SSH",extensionId:"ms-vscode-remote.remote-ssh",supportedPlatforms:["Windows","Linux","Mac"],startEntry:{helpLink:"https://aka.ms/vscode-remote/ssh",startConnectLabel:"SSH ",startCommand:"opensshremotes.openEmptyWindowInCurrentWindow",priority:1}},"dev-container":{friendlyName:"Dev Containers",extensionId:"ms-vscode-remote.remote-containers",supportedPlatforms:["Windows","Linux","Mac"],startEntry:{helpLink:"https://aka.ms/vscode-remote/containers",startConnectLabel:"Dev Container",startCommand:"remote-containers.reopenInContainer",priority:2}},"attached-container":{friendlyName:"Dev Containers",extensionId:"ms-vscode-remote.remote-containers"},codespaces:{friendlyName:"GitHub Codespaces",extensionId:"github.codespaces",startEntry:{helpLink:"https://aka.ms/vscode-remote-codespaces",startConnectLabel:"GitHub Codespace ",startCommand:"github.codespaces.connect",priority:4}},tunnel:{friendlyName:"Remote - Tunnels",extensionId:"ms-vscode.remote-server",startEntry:{helpLink:"https://aka.ms/remote-tunnels-doc",startConnectLabel:"Tunnel",startCommand:"remote-tunnels.connectCurrentWindowToTunnel",priority:0}},amlext:{friendlyName:"Azure Machine Learning",extensionId:"ms-toolsai.vscode-ai-remote"}},commandPaletteSuggestedCommandIds:["workbench.action.files.openFile","workbench.action.files.openFileFolder","workbench.action.files.openFolder","workbench.action.remote.showMenu","editor.action.formatDocument","editor.action.commentLine","workbench.action.tasks.runTask","workbench.action.openSettings2","workbench.action.selectTheme","workbench.action.openWalkthrough","workbench.action.openIssueReporter"],extensionKeywords:{md:["Markdown"],js:["JavaScript"],jsx:["JavaScript"],es6:["JavaScript"],html:["Html"],ts:["TypeScript"],tsx:["TypeScript"],css:["CSS"],scss:["SASS"],txt:["Text"],php:["PHP"],php3:["PHP"],php4:["PHP"],ph3:["PHP"],ph4:["PHP"],xml:["XML"],py:["Python"],pyc:["Python"],pyd:["Python"],pyo:["Python"],pyw:["Python"],pyz:["Python"],java:["Java"],class:["Java"],jar:["Java"],c:["c","objective c","objective-c"],m:["objective c","objective-c"],mm:["objective c","objective-c"],cpp:["cpp","c plus plus","c","c++"],cc:["cpp","c plus plus","c","c++"],cxx:["cpp","c plus plus","c++"],hh:["cpp","c plus plus","c++"],hpp:["cpp","c++"],h:["cpp","c plus plus","c++","c","objective c","objective-c"],sql:["sql"],sh:["bash"],bash:["bash"],zsh:["bash","zshell"],cs:["c#","csharp"],csproj:["c#","csharp"],sln:["c#","csharp"],go:["go"],sty:["latex"],tex:["latex"],ps:["powershell"],ps1:["powershell"],rs:["rust"],rslib:["rust"],hs:["haskell"],lhs:["haskell"],scm:["scheme"],ss:["scheme"],clj:["clojure"],cljs:["clojure"],cljc:["clojure"],edn:["clojure"],erl:["erlang"],hrl:["erlang"],scala:["scala"],sc:["scala"],pl:["perl"],pm:["perl"],t:["perl"],pod:["perl"],groovy:["groovy"],swift:["swift"],rb:["ruby"],rbw:["ruby"],jl:["julia"],f:["fortran"],for:["fortran"],f90:["fortran"],f95:["fortran"],coffee:["CoffeeScript"],litcoffee:["CoffeeScript"],yaml:["yaml"],yml:["yaml"],dart:["dart"],json:["json"]},extensionAllowedBadgeProviders:["api.travis-ci.com","app.fossa.io","badge.buildkite.com","badge.fury.io","badgen.net","badges.frapsoft.com","badges.gitter.im","cdn.travis-ci.com","ci.appveyor.com","circleci.com","cla.opensource.microsoft.com","codacy.com","codeclimate.com","codecov.io","coveralls.io","david-dm.org","deepscan.io","dev.azure.com","docs.rs","flat.badgen.net","gitlab.com","godoc.org","goreportcard.com","img.shields.io","isitmaintained.com","marketplace.visualstudio.com","nodesecurity.io","opencollective.com","snyk.io","travis-ci.com","travis-ci.org","visualstudio.com","vsmarketplacebadge.apphb.com"],extensionAllowedBadgeProvidersRegex:["^https:\\/\\/github\\.com\\/[^/]+\\/[^/]+\\/(actions\\/)?workflows\\/.*badge\\.svg"],crashReporter:{productName:"VSCode",companyName:"Microsoft"},appCenter:{"win32-x64":"appcenter://code?aid=a4e3233c-699c-46ec-b4f4-9c2a77254662","win32-arm64":"appcenter://code?aid=3712d786-7cc8-4f11-8b08-cc12eab6d4f7","linux-x64":"appcenter://code?aid=fba07a4d-84bd-4fc8-a125-9640fc8ce171",darwin:"appcenter://code?aid=860d6632-f65b-490b-85a8-3e72944f7774","darwin-arm64":"appcenter://code?aid=be71415d-3893-4ae5-b453-e537b9668a10","darwin-universal":"appcenter://code?aid=de75e3cc-e22f-4f42-a03f-1409c21d8af8"},enableTelemetry:!0,aiConfig:{ariaKey:"5bbf946d11a54f6783919c455abaddaf-fd62977b-c92d-4714-a45d-649d06980372-7168"},msftInternalDomains:["redmond.corp.microsoft.com","northamerica.corp.microsoft.com","fareast.corp.microsoft.com","ntdev.corp.microsoft.com","wingroup.corp.microsoft.com","southpacific.corp.microsoft.com","wingroup.windeploy.ntdev.microsoft.com","ddnet.microsoft.com","europe.corp.microsoft.com"],documentationUrl:"https://go.microsoft.com/fwlink/?LinkID=533484#vscode",serverDocumentationUrl:"https://aka.ms/vscode-server-doc",releaseNotesUrl:"https://go.microsoft.com/fwlink/?LinkID=533483#vscode",keyboardShortcutsUrlMac:"https://go.microsoft.com/fwlink/?linkid=832143",keyboardShortcutsUrlLinux:"https://go.microsoft.com/fwlink/?linkid=832144",keyboardShortcutsUrlWin:"https://go.microsoft.com/fwlink/?linkid=832145",introductoryVideosUrl:"https://go.microsoft.com/fwlink/?linkid=832146",tipsAndTricksUrl:"https://go.microsoft.com/fwlink/?linkid=852118",newsletterSignupUrl:"https://www.research.net/r/vsc-newsletter",youTubeUrl:"https://aka.ms/vscode-youtube",requestFeatureUrl:"https://go.microsoft.com/fwlink/?LinkID=533482",reportIssueUrl:"https://github.com/Microsoft/vscode/issues/new",reportMarketplaceIssueUrl:"https://github.com/microsoft/vsmarketplace/issues/new",licenseUrl:"https://go.microsoft.com/fwlink/?LinkID=533485",serverLicenseUrl:"https://aka.ms/vscode-server-license",privacyStatementUrl:"https://go.microsoft.com/fwlink/?LinkId=521839",showTelemetryOptOut:!0,npsSurveyUrl:"https://aka.ms/vscode-nps",checksumFailMoreInfoUrl:"https://go.microsoft.com/fwlink/?LinkId=828886",electronRepository:"Microsoft/vscode-electron-prebuilt",nodejsRepository:"Microsoft/vscode-node",settingsSearchUrl:"https://bingsettingssearch.trafficmanager.net/api/Search",surveys:[{surveyId:"cpp.1",surveyUrl:"https://www.research.net/r/VBVV6C6",languageId:"cpp",editCount:10,userProbability:.15},{surveyId:"java.2",surveyUrl:"https://www.research.net/r/vscodejava",languageId:"java",editCount:10,userProbability:.3},{surveyId:"javascript.1",surveyUrl:"https://www.research.net/r/vscode-js",languageId:"javascript",editCount:10,userProbability:.05},{surveyId:"typescript.1",surveyUrl:"https://www.research.net/r/vscode-ts",languageId:"typescript",editCount:10,userProbability:.05},{surveyId:"csharp.1",surveyUrl:"https://www.research.net/r/8KGJ9V8",languageId:"csharp",editCount:10,userProbability:.1}],extensionsEnabledWithApiProposalVersion:["GitHub.copilot-chat","ms-vscode.vscode-commander","ms-vscode.vscode-copilot-vision","GitHub.vscode-pull-request-github"],extensionEnabledApiProposals:{"mrleemurray.theme-2026":["css"],"ms-azuretools.vscode-containers":["authenticationChallenges"],"ms-azuretools.vscode-azureresourcegroups":["authenticationChallenges"],"ms-azuretools.vscode-azure-github-copilot":["authenticationChallenges"],"ms-azuretools.vscode-dev-azurecloudshell":["contribEditSessions","authenticationChallenges"],"ms-toolsai.vscode-ai":["authenticationChallenges"],"TeamsDevApp.vscode-ai-foundry":["authenticationChallenges"],"ms-vscode.vscode-selfhost-test-provider":["testObserver","testRelatedCode"],"VisualStudioExptTeam.vscodeintellicode-completions":["inlineCompletionsAdditions"],"ms-vsliveshare.vsliveshare":["contribMenuBarHome","contribShareMenu","contribStatusBarItems","diffCommand","documentFiltersExclusive","fileSearchProvider","findTextInFiles","notebookLiveShare","terminalDimensions","terminalDataWriteEvent","textSearchProvider"],"ms-vscode.js-debug":["portsAttributes","findTextInFiles","workspaceTrust","tunnels"],"ms-toolsai.vscode-ai-remote":["resolvers","authenticationChallenges"],"ms-python.python":["codeActionAI","contribEditorContentMenu","quickPickSortByLabel","portsAttributes","testObserver","quickPickItemTooltip","terminalDataWriteEvent","terminalExecuteCommandEvent","notebookReplDocument","notebookVariableProvider","terminalShellEnv"],"ms-python.vscode-python-envs":["terminalShellEnv","terminalDataWriteEvent","taskExecutionTerminal"],"ms-dotnettools.dotnet-interactive-vscode":["notebookMessaging"],"GitHub.codespaces":["contribEditSessions","contribMenuBarHome","contribRemoteHelp","contribViewsRemote","resolvers","tunnels","terminalDataWriteEvent","treeViewReveal","notebookKernelSource"],"ms-vscode.azure-repos":["extensionRuntime","fileSearchProvider","textSearchProvider"],"ms-vscode.remote-repositories":["canonicalUriProvider","contribEditSessions","contribRemoteHelp","contribMenuBarHome","contribViewsRemote","contribViewsWelcome","contribShareMenu","documentFiltersExclusive","editSessionIdentityProvider","extensionRuntime","fileSearchProvider","quickPickSortByLabel","workspaceTrust","shareProvider","scmActionButton","scmSelectedProvider","scmValidation","textSearchProvider","timeline"],"ms-vscode-remote.remote-wsl":["resolvers","contribRemoteHelp","contribViewsRemote","telemetry"],"ms-vscode-remote.remote-ssh":["resolvers","tunnels","terminalDataWriteEvent","contribRemoteHelp","contribViewsRemote","telemetry"],"ms-vscode.remote-server":["resolvers","tunnels","contribViewsWelcome"],"ms-vscode.remote-explorer":["contribRemoteHelp","contribViewsRemote","extensionsAny"],"ms-vscode-remote.remote-containers":["contribEditSessions","resolvers","portsAttributes","tunnels","workspaceTrust","terminalDimensions","contribRemoteHelp","contribViewsRemote"],"ms-vscode.js-debug-nightly":["portsAttributes","findTextInFiles","workspaceTrust","tunnels"],"ms-vscode.lsif-browser":["documentFiltersExclusive"],"ms-vscode.vscode-speech":["speech"],"GitHub.vscode-pull-request-github":["activeComment","chatContextProvider","chatParticipantAdditions","chatParticipantPrivate","chatSessionsProvider","codiconDecoration","codeActionRanges","commentingRangeHint","commentReactor","commentReveal","commentsDraftState","commentThreadApplicability","contribAccessibilityHelpContent","contribCommentEditorActionsMenu","contribCommentPeekContext","contribCommentThreadAdditionalMenu","contribCommentsViewThreadMenus","contribEditorContentMenu","contribMultiDiffEditorMenus","contribShareMenu","diffCommand","languageModelToolResultAudience","markdownAlertSyntax","quickDiffProvider","remoteCodingAgents","shareProvider","tabInputMultiDiff","tabInputTextMerge","tokenInformation","treeItemMarkdownLabel","treeViewMarkdownMessage"],"GitHub.copilot":["inlineCompletionsAdditions","devDeviceId"],"GitHub.copilot-nightly":["inlineCompletionsAdditions","devDeviceId"],"GitHub.copilot-chat":["agentSessionsWorkspace","interactive","terminalDataWriteEvent","terminalExecuteCommandEvent","terminalSelection","terminalQuickFixProvider","chatParticipantAdditions","defaultChatParticipant","embeddings","chatProvider","mappedEditsProvider","aiRelatedInformation","aiSettingsSearch","codeActionAI","findTextInFiles","findTextInFiles2","textSearchProvider","textSearchProvider2","activeComment","commentReveal","contribSourceControlInputBoxMenu","contribCommentEditorActionsMenu","contribCommentThreadAdditionalMenu","contribCommentsViewThreadMenus","contribChatEditorInlineGutterMenu","extensionAffinity","newSymbolNamesProvider","findFiles2","chatReferenceDiagnostic","extensionsAny","authLearnMore","testObserver","aiTextSearchProvider","documentFiltersExclusive","chatParticipantPrivate","contribDebugCreateConfiguration","inlineCompletionsAdditions","chatReferenceBinaryData","languageModelSystem","languageModelCapabilities","languageModelThinkingPart","languageModelToolSupportsModel","chatStatusItem","taskProblemMatcherStatus","contribLanguageModelToolSets","textDocumentChangeReason","resolvers","taskExecutionTerminal","dataChannels","chatSessionsProvider","devDeviceId","contribEditorContentMenu","tokenInformation","chatPromptFiles","mcpServerDefinitions","tabInputMultiDiff","workspaceTrust","chatHooks","chatDebug","environmentPower","terminalTitle"],"GitHub.remotehub":["contribRemoteHelp","contribMenuBarHome","contribViewsRemote","contribViewsWelcome","documentFiltersExclusive","extensionRuntime","fileSearchProvider","quickPickSortByLabel","workspaceTrust","scmSelectedProvider","scmValidation","textSearchProvider","timeline"],"ms-python.vscode-pylance":["terminalShellEnv","portsAttributes","codeActionAI"],"ms-python.debugpy":["contribViewsWelcome","debugVisualization","portsAttributes"],"ms-toolsai.jupyter-renderers":["contribNotebookStaticPreloads"],"ms-toolsai.jupyter":["notebookDeprecated","notebookMessaging","notebookMime","portsAttributes","quickPickSortByLabel","notebookKernelSource","interactiveWindow","notebookControllerAffinityHidden","contribNotebookStaticPreloads","quickPickItemTooltip","notebookExecution","notebookCellExecution","notebookVariableProvider","notebookReplDocument"],"donjayamanne.kusto":["notebookVariableProvider"],"ms-toolsai.tensorboard":["portsAttributes"],"dbaeumer.vscode-eslint":[],"ms-vscode.azure-sphere-tools-ui":["tunnels"],"ms-azuretools.vscode-azureappservice":["terminalDataWriteEvent"],"ms-vscode.anycode":["extensionsAny"],"ms-vscode.cpptools":["terminalDataWriteEvent","chatParticipantAdditions"],"vscjava.vscode-java-pack":[],"ms-dotnettools.csdevkit":["inlineCompletionsAdditions"],"ms-dotnettools.vscodeintellicode-csharp":["inlineCompletionsAdditions"],"ms-dotnettools.vscode-dotnet-modernize":["chatParticipantAdditions","chatPromptFiles"],"microsoft-IsvExpTools.powerplatform-vscode":["fileSearchProvider","textSearchProvider"],"microsoft-IsvExpTools.powerplatform-vscode-preview":["fileSearchProvider","textSearchProvider"],"TeamsDevApp.ms-teams-vscode-extension":["chatParticipantAdditions","languageModelSystem","mcpServerDefinitions"],"ms-toolsai.datawrangler":[],"ms-vscode.vscode-commander":[],"ms-vscode.vscode-websearchforcopilot":[],"ms-vscode.vscode-copilot-vision":["chatReferenceBinaryData","codeActionAI"],"ms-autodev.vscode-autodev":["chatParticipantAdditions"],"vscjava.vscode-java-upgrade":["chatParticipantAdditions","chatParticipantPrivate"],"FoundryLocal.foundry-local-chat":["chatProvider"],"Microsoft.foundry-local-chat":["chatProvider"],"ms-wmcp.windows-mcp-server-extension":["mcpToolDefinitions"],"openai.chatgpt":["languageModelProxy","chatSessionsProvider"],"TypeScriptTeam.native-preview":["editorHoverVerbosityLevel","multiDocumentHighlightProvider"],"ms-vscode.vscode-eng-codereview":["chatContextProvider"]},tasConfig:{endpoint:"https://default.exp-tas.com/vscode/ab",telemetryEventName:"query-expfeature",assignmentContextTelemetryPropertyName:"abexp.assignmentcontext"},extensionKind:{"Shan.code-settings-sync":["ui"],"shalldie.background":["ui"],"techer.open-in-browser":["ui"],"CoenraadS.bracket-pair-colorizer-2":["ui"],"CoenraadS.bracket-pair-colorizer":["ui","workspace"],"hiro-sun.vscode-emacs":["ui","workspace"],"hnw.vscode-auto-open-markdown-preview":["ui","workspace"],"wayou.vscode-todo-highlight":["ui","workspace"],"aaron-bond.better-comments":["ui","workspace"],"vscodevim.vim":["ui"],"ollyhayes.colmak-vim":["ui"]},extensionPointExtensionKind:{typescriptServerPlugins:["workspace"]},extensionSyncedKeys:{"ritwickdey.liveserver":["liveServer.setup.version"]},extensionVirtualWorkspacesSupport:{"esbenp.prettier-vscode":{default:!1},"msjsdiag.debugger-for-chrome":{default:!1},"redhat.java":{default:!1},"HookyQR.beautify":{default:!1},"ritwickdey.LiveServer":{default:!1},"VisualStudioExptTeam.vscodeintellicode":{default:!1},"octref.vetur":{default:!1},"formulahendry.code-runner":{default:!1},"xdebug.php-debug":{default:!1},"ms-mssql.mssql":{default:!1},"christian-kohler.path-intellisense":{default:!1},"eg2.tslint":{default:!1},"eg2.vscode-npm-script":{default:!1},"donjayamanne.githistory":{default:!1},"Zignd.html-css-class-completion":{default:!1},"christian-kohler.npm-intellisense":{default:!1},"EditorConfig.EditorConfig":{default:!1},"austin.code-gnu-global":{default:!1},"johnpapa.Angular2":{default:!1},"ms-vscode.vscode-typescript-tslint-plugin":{default:!1},"DotJoshJohnson.xml":{default:!1},"techer.open-in-browser":{default:!1},"tht13.python":{default:!1},"bmewburn.vscode-intelephense-client":{default:!1},"Angular.ng-template":{default:!1},"xdebug.php-pack":{default:!1},"dbaeumer.jshint":{default:!1},"yzhang.markdown-all-in-one":{default:!1},"Dart-Code.flutter":{default:!1},"streetsidesoftware.code-spell-checker":{default:!1},"rebornix.Ruby":{default:!1},"ms-vscode.sublime-keybindings":{default:!1},"mitaki28.vscode-clang":{default:!1},"steoates.autoimport":{default:!1},"donjayamanne.python-extension-pack":{default:!1},"shd101wyy.markdown-preview-enhanced":{default:!1},"mikestead.dotenv":{default:!1},"pranaygp.vscode-css-peek":{default:!1},"ikappas.phpcs":{default:!1},"platformio.platformio-ide":{default:!1},"jchannon.csharpextensions":{default:!1},"gruntfuggly.todo-tree":{default:!1}},linkProtectionTrustedDomains:["https://*.visualstudio.com","https://*.microsoft.com","https://aka.ms","https://*.gallerycdn.vsassets.io","https://*.github.com","https://login.microsoftonline.com","https://*.vscode.dev","https://*.github.dev","https://gh.io","https://portal.azure.com","https://raw.githubusercontent.com","https://private-user-images.githubusercontent.com","https://avatars.githubusercontent.com","https://auth.openai.com"],trustedExtensionAuthAccess:{github:["vscode.github","github.remotehub","ms-vscode.remote-server","github.vscode-pull-request-github","github.codespaces","github.copilot","github.copilot-chat","ms-vsliveshare.vsliveshare","ms-azuretools.vscode-azure-github-copilot"],"github-enterprise":["vscode.github","github.remotehub","ms-vscode.remote-server","github.vscode-pull-request-github","github.codespaces","github.copilot","github.copilot-chat","ms-vsliveshare.vsliveshare","ms-azuretools.vscode-azure-github-copilot"],microsoft:["github.copilot-chat","ms-vscode.azure-repos","ms-vscode.remote-server","ms-vsliveshare.vsliveshare","ms-azuretools.vscode-azure-github-copilot","ms-azuretools.vscode-azureresourcegroups","ms-azuretools.vscode-dev-azurecloudshell","ms-edu.vscode-learning","ms-toolsai.vscode-ai","ms-toolsai.vscode-ai-remote"],"microsoft-sovereign-cloud":["ms-vscode.azure-repos","ms-vscode.remote-server","ms-vsliveshare.vsliveshare","ms-azuretools.vscode-azure-github-copilot","ms-azuretools.vscode-azureresourcegroups","ms-azuretools.vscode-dev-azurecloudshell","ms-edu.vscode-learning","ms-toolsai.vscode-ai","ms-toolsai.vscode-ai-remote"],"__GitHub.copilot-chat":["ms-azuretools.vscode-azure-github-copilot","github.vscode-pull-request-github"]},trustedExtensionProtocolHandlers:["vscode.git","vscode.github-authentication","vscode.microsoft-authentication","github.vscode-pull-request-github"],authClientIdMetadataUrl:"https://vscode.dev/oauth/client-metadata.json",inheritAuthAccountPreference:{"github.copilot":["github.copilot-chat"]},auth:{loginUrl:"https://login.microsoftonline.com/common/oauth2/authorize",tokenUrl:"https://login.microsoftonline.com/common/oauth2/token",redirectUrl:"https://vscode-redirect.azurewebsites.net/",clientId:"aebc6443-996d-45c2-90f0-388ff96faa56"},"configurationSync.store":{url:"https://vscode-sync.trafficmanager.net/",stableUrl:"https://vscode-sync.trafficmanager.net/",insidersUrl:"https://vscode-sync-insiders.trafficmanager.net/",canSwitch:!1,authenticationProviders:{github:{scopes:["user:email"]},microsoft:{scopes:["openid","profile","email","offline_access"]}}},"editSessions.store":{url:"https://vscode-sync.trafficmanager.net/",authenticationProviders:{microsoft:{scopes:["openid","profile","email","offline_access"]},github:{scopes:["user:email"]}}},tunnelServerQualities:{stable:{serverApplicationName:"code-server"},exploration:{serverApplicationName:"code-server-exploration"},insider:{serverApplicationName:"code-server-insiders"}},tunnelApplicationName:"code-tunnel",tunnelApplicationConfig:{editorWebUrl:"https://vscode.dev",extension:{friendlyName:"Remote - Tunnels",extensionId:"ms-vscode.remote-server"},authenticationProviders:{github:{scopes:["user:email","read:org"]},microsoft:{scopes:["46da2f7e-b5ef-422a-88d4-2a7f9de6a0b2/.default","profile","openid"]}}},win32TunnelServiceMutex:"vscode-tunnelservice",win32TunnelMutex:"vscode-tunnel",aiGeneratedWorkspaceTrust:{title:"This workspace was generated by GitHub Copilot",checkboxText:"Trust the contents of all files in this workspace",trustOption:"Yes, I trust the contents",dontTrustOption:"No, I don't trust the contents",startupTrustRequestLearnMore:"If you don't trust the contents of the files generated by GitHub Copilot, we recommend continuing in restricted mode. See [our docs](https://aka.ms/vscode-workspace-trust) to learn more. "},defaultChatAgent:{providerExtensionId:"vscode.github-authentication",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"}},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"},chatParticipantRegistry:"https://main.vscode-cdn.net/extensions/chat.json",remoteDefaultExtensionsIfInstalledLocally:["GitHub.copilot","GitHub.copilot-chat","GitHub.vscode-pull-request-github"],extensionConfigurationPolicy:{"github.copilot.nextEditSuggestions.enabled":{name:"CopilotNextEditSuggestions",minimumVersion:"1.99"},"github.copilot.chat.reviewSelection.enabled":{name:"CopilotReviewSelection",minimumVersion:"1.104"},"github.copilot.chat.reviewAgent.enabled":{name:"CopilotReviewAgent",minimumVersion:"1.104"}},win32ContextMenu:{x64:{clsid:"1C6DF0C0-192A-4451-BE36-6A59A86A692E"},arm64:{clsid:"F5EA5883-1DA8-4A05-864A-D5DE2D2B2854"}},chatSessionRecommendations:[{extensionId:"openai.chatgpt",extensionName:"Codex - OpenAI's coding agent",displayName:"Codex Agent",name:"codex",description:"Codex is OpenAI's coding agent that helps you write, review, and ship code faster.",postInstallCommand:"chatgpt.newCodexPanel"},{extensionId:"GitHub.copilot-chat",extensionName:"GitHub Copilot Chat",displayName:"Background Agent",name:"cli",description:"Delegate tasks to a background agent.",postInstallCommand:"workbench.action.chat.openNewSessionSidebar.copilotcli"},{extensionId:"GitHub.copilot-chat",extensionName:"GitHub Copilot Chat",displayName:"Cloud Agent",name:"cloud",description:"Delegate tasks to the GitHub Copilot Cloud Agent. The agent works asynchronously in the cloud to implement changes, iterates via chat, and can create or update pull requests as needed.",postInstallCommand:"workbench.action.chat.openNewSessionSidebar.copilot-cloud-agent"}],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.110.0",sha256:"ad3f7d935b64f4ee123853c464b47b3cba13e5018edef831770ae9c3eb218f5b",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"}}],version:"1.111.0",commit:"ce099c1ed25d9eb3076c11e4a280f3eb52b4fbeb",date:"2026-03-06T23:06:10Z"},Object.keys(nL).length===0&&Object.assign(nL,{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 to=nL;var ii={Configuration:"base.contributions.configuration"};function NYt(a,i){return a===i?!0:!a||!i?!1:typeof a=="string"||typeof i=="string"?a===i:a.id===i.id}var Qw={properties:{},patternProperties:{}},vSe={properties:{},patternProperties:{}},bSe={properties:{},patternProperties:{}},rse={properties:{},patternProperties:{}},SU={properties:{},patternProperties:{}},IU={properties:{},patternProperties:{}},CN={properties:{},patternProperties:{}},L$="vscode://schemas/settings/resourceLanguage",Gmt="vscode://schemas/settings/configurationDefaults",Kmt=oe.as(ea.JSONContribution),AYt=class extends C{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(1836,null),properties:{}},this.configurationContributors=[this.defaultLanguageConfigurationOverridesNode],this.resourceLanguageSettingsSchema={properties:{},patternProperties:{},additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0},this.configurationProperties={},this.policyConfigurations=new Map,this.excludedConfigurationProperties={},Kmt.registerSchema(L$,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),Kmt.registerSchema(L$,this.resourceLanguageSettingsSchema),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:o})}deregisterConfigurations(e){let t=new Set;this.doDeregisterConfigurations(e,t),Kmt.registerSchema(L$,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),Kmt.registerSchema(L$,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}),lg.test(s)){let u=this.mergeDefaultConfigurationsForOverrideIdentifier(s,c,r,l.configurationDefaultOverrideValue);if(!u)continue;l.configurationDefaultOverrideValue=u,this.updateDefaultOverrideProperty(s,u,r),o.push(...yU(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?NYt(c.source,n):c.value===o[r]);if(l!==-1){if(s.configurationDefaultOverrides.splice(l,1),s.configurationDefaultOverrides.length===0&&this.configurationDefaultsOverrides.delete(r),lg.test(r)){let c;for(let u of s.configurationDefaultOverrides)c=this.mergeDefaultConfigurationsForOverrideIdentifier(r,u.value,u.source,c);c&&!mf(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(1835,null,gSe(e)),$ref:L$,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(yi(c)&&(cn(r[l])||yi(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(yi(t)&&(r!==void 0&&r.type==="object"||r===void 0&&(cn(s)||yi(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={...yi(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=Jn(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&&OYt(u,p,o?.id)){delete l[u];continue}p.source=o,p.defaultDefaultValue=l[u].default,this.updatePropertyDefaultValue(u,p),lg.test(u)?p.scope=void 0:(p.scope=Jn(p.scope)?r:p.scope,p.restricted=Jn(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(Qw.properties[e]=t,t.scope){case 1:vSe.properties[e]=t;break;case 2:rse.properties[e]=t;break;case 3:bSe.properties[e]=t;break;case 7:SU.properties[e]=t;break;case 4:IU.properties[e]=t;break;case 5:CN.properties[e]=t;break;case 6:CN.properties[e]=t,this.resourceLanguageSettingsSchema.properties[e]=t;break}}removeFromSchema(e,t){switch(delete Qw.properties[e],t.scope){case 1:delete vSe.properties[e];break;case 2:delete rse.properties[e];break;case 3:delete bSe.properties[e];break;case 7:delete SU.properties[e];break;case 4:delete IU.properties[e];break;case 5:case 6:delete CN.properties[e],delete this.resourceLanguageSettingsSchema.properties[e];break}}updateOverridePropertyPatternKey(){for(let e of this.overrideIdentifiers.values()){let t=`[${e}]`,o={type:"object",description:d(1837,null),errorMessage:d(1838,null),$ref:L$};this.updatePropertyDefaultValue(t,o),Qw.properties[t]=o,vSe.properties[t]=o,bSe.properties[t]=o,rse.properties[t]=o,SU.properties[t]=o,IU.properties[t]=o,CN.properties[t]=o}}registerOverridePropertyPatternKey(){let e={type:"object",description:d(1837,null),errorMessage:d(1838,null),$ref:L$};Qw.patternProperties[bU]=e,vSe.patternProperties[bU]=e,bSe.patternProperties[bU]=e,rse.patternProperties[bU]=e,SU.patternProperties[bU]=e,IU.patternProperties[bU]=e,CN.patternProperties[bU]=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),cn(n)&&(n=t.defaultDefaultValue,r=void 0),cn(n)&&(n=r$e(t.type)),t.default=n,t.defaultValueSource=r}},NKi="\\[([^\\]]+)\\]",AKi=new RegExp(NKi,"g"),bU=`^(${NKi})+$`,lg=new RegExp(bU);function yU(a){let i=[];if(lg.test(a)){let e=AKi.exec(a);for(;e?.length;){let t=e[1].trim();t&&i.push(t),e=AKi.exec(a)}}return Uo(i)}function n$e(a){return a.reduce((i,e)=>`${i}[${e}]`,"")}function r$e(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 o$e=new AYt;oe.add(ii.Configuration,o$e);function OYt(a,i,e){return a.trim()?lg.test(a)?d(1834,null,a):o$e.getConfigurationProperties()[a]!==void 0&&(!e||!FYt.has(e.toLowerCase()))?d(1832,null,a):i.policy?.name&&o$e.getPolicyConfigurations().get(i.policy?.name)!==void 0?d(1831,null,a,i.policy?.name,o$e.getPolicyConfigurations().get(i.policy?.name)):null:d(1833,null)}function OKi(){let a=[],i=o$e.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 $mt(a){let i={};for(let e of a){let t=e.properties;if(yi(t))for(let o in t)i[o]=t[o];e.allOf&&Object.assign(i,$mt(e.allOf))}return i}function qmt(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 FYt=new Set(to.defaultChatAgent?[to.defaultChatAgent.extensionId,to.defaultChatAgent.chatExtensionId].map(a=>a.toLowerCase()):[]);var CMo={ModesRegistry:"editor.modesRegistry"},WYt=class extends C{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}},LM=new WYt;oe.add(CMo.ModesRegistry,LM);var Fr="plaintext",s$e=".txt";LM.registerLanguage({id:Fr,extensions:[s$e],aliases:[d(907,null),"text"],mimetypes:[Zn.text]});oe.as(ii.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 jmt=class{constructor(i,e){this.languageId=i;let t=e.brackets?FKi(e.brackets):[],o=new kI(s=>{let l=new Set;return{info:new VYt(this,s,l),closing:l}}),n=new kI(s=>{let l=new Set,c=new Set;return{info:new BYt(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?FKi(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 mSe(e,i)}};function FKi(a){return a.filter(([i,e])=>i!==""&&e!=="")}var Qmt=class{constructor(i,e){this.config=i;this.bracketText=e}get languageId(){return this.config.languageId}},VYt=class extends Qmt{constructor(e,t,o){super(e,t);this.openedBrackets=o;this.isOpeningBracket=!0}},BYt=class extends Qmt{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 l$e=class{constructor(i){this.languageId=i}affects(i){return this.languageId?this.languageId===i:!0}},bs=ae("languageConfigurationService"),a$e=class extends C{constructor(e,t){super();this.configurationService=e;this.languageService=t;this._registry=this._register(new zYt);this.onDidChangeEmitter=this._register(new E);this.onDidChange=this.onDidChangeEmitter.event;this.configurations=new Map;let o=new Set(Object.values(HYt));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 l$e(void 0));else for(let l of s)this.languageService.isRegisteredLanguageId(l)&&(this.configurations.delete(l),this.onDidChangeEmitter.fire(new l$e(l)))})),this._register(this._registry.onDidChange(n=>{this.configurations.delete(n.languageId),this.onDidChangeEmitter.fire(new l$e(n.languageId))}))}register(e,t,o){return this._registry.register(e,t,o)}getLanguageConfiguration(e){let t=this.configurations.get(e);return t||(t=xMo(e,this._registry,this.configurationService,this.languageService),this.configurations.set(e,t)),t}};a$e=I([m(0,B),m(1,kt)],a$e);function xMo(a,i,e,t){let o=i.getLanguageConfiguration(a);if(!o){if(!t.isRegisteredLanguageId(a))return new SSe(a,{});o=new SSe(a,{})}let n=kMo(o.languageId,e),r=VKi([o.underlyingConfig,n]);return new SSe(o.languageId,r)}var HYt={brackets:"editor.language.brackets",colorizedBracketPairs:"editor.language.colorizedBracketPairs"};function kMo(a,i){let e=i.getValue(HYt.brackets,{overrideIdentifier:a}),t=i.getValue(HYt.colorizedBracketPairs,{overrideIdentifier:a});return{brackets:WKi(e),colorizedBracketPairs:WKi(t)}}function WKi(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 Jmt(a,i,e){let t=a.getLineContent(i),o=bl(t);return o.length>e-1&&(o=o.substring(0,e-1)),o}var UYt=class{constructor(i){this.languageId=i;this._resolved=null;this._entries=[],this._order=0,this._resolved=null}register(i,e){let t=new Ymt(i,e,++this._order);return this._entries.push(t),this._resolved=null,Mp(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 SSe(this.languageId,i))}return this._resolved}_resolve(){return this._entries.length===0?null:(this._entries.sort(Ymt.cmp),VKi(this._entries.map(i=>i.configuration)))}};function VKi(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 Ymt=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}},Xmt=class{constructor(i){this.languageId=i}},zYt=class extends C{constructor(){super();this._entries=new Map;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._register(this.register(Fr,{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 UYt(e),this._entries.set(e,n));let r=n.register(t,o);return this._onDidChange.fire(new Xmt(e)),Mp(Z(()=>{r.dispose(),this._onDidChange.fire(new Xmt(e))}))}getLanguageConfiguration(e){return this._entries.get(e)?.getResolvedConfiguration()||null}},SSe=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 Umt(this.underlyingConfig):null,this.comments=a._handleComments(this.underlyingConfig),this.characterPair=new Omt(this.underlyingConfig),this.wordDefinition=this.underlyingConfig.wordPattern||F6,this.indentationRules=this.underlyingConfig.indentationRules,this.underlyingConfig.indentationRules?this.indentRulesSupport=new Hmt(this.underlyingConfig.indentationRules):this.indentRulesSupport=null,this.foldingRules=this.underlyingConfig.folding||{},this.bracketsNew=new jmt(i,this.underlyingConfig)}getWordDefinition(){return E$(this.wordDefinition)}get brackets(){return!this._brackets&&this.underlyingConfig.brackets&&(this._brackets=new Fmt(this.languageId,this.underlyingConfig.brackets)),this._brackets}get electricCharacter(){return this._electricCharacter||(this._electricCharacter=new Vmt(this.brackets)),this._electricCharacter}onEnter(i,e,t,o){return this._onEnterSupport?this._onEnterSupport.onEnter(i,e,t,o):null}getAutoClosingPairs(){return new Nmt(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}};we(bs,a$e,1);var di=class a{constructor(i,e){this.start=i;this.endExclusive=e;if(i>e)throw new ni(`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 ni(`Invalid clipping range: ${this.toString()}`);return Math.max(this.start,Math.min(this.endExclusive-1,i))}clipCyclic(i){if(this.isEmpty)throw new ni(`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 ni(`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)}},Zmt=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 di(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 Bc=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=Qu.getLanguageId(e);return this.languageIdCodec.decodeLanguageId(t)}getStandardTokenType(i){let e=this._tokens[(i<<1)+1];return Qu.getTokenType(e)}getForeground(i){let e=this._tokens[(i<<1)+1];return Qu.getForeground(e)}getClassName(i){let e=this._tokens[(i<<1)+1];return Qu.getClassNameFromMetadata(e)}getInlineStyle(i,e){let t=this._tokens[(i<<1)+1];return Qu.getInlineStyleFromMetadata(t,e)}getPresentation(i){let e=this._tokens[(i<<1)+1];return Qu.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 KYt(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 GYt,t=this.findTokenIndexAtOffset(i.start),o=this.findTokenIndexAtOffset(i.endExclusive);for(let n=t;n<=o;n++){let s=new di(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}},KYt=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 BKi(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 aW=class a{constructor(i){this._tokenInfo=i}static fromLineTokens(i){let e=[];for(let t=0;t<i.getCount();t++)e.push(new c$e(i.getEndOffset(t)-i.getStartOffset(t),i.getMetadata(t)));return a.create(e)}static create(i){return new a(i)}toLineTokens(i,e){return Bc.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 di(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 di(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 c$e(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)}},c$e=class{constructor(i,e){this.length=i;this.metadata=e}},GYt=class{constructor(){this._tokens=[]}add(i,e){this._tokens.push(new c$e(i,e))}build(){return aW.create(this._tokens)}};var lse=class{constructor(i,e,t){this._indentRulesSupport=e,this._indentationLineProcessor=new eht(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)}},cse=class{constructor(i,e){this.model=i,this.indentationLineProcessor=new eht(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=gU(e,i.startColumn-1),o;if(tht(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=gU(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 gU(f,v)};this.model.tokenization.forceTokenization(i.startLineNumber);let t=this.model.tokenization.getLineTokens(i.startLineNumber),o=gU(t,i.startColumn-1),n=Bc.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)}},eht=class{constructor(i,e){this.model=i;this.languageConfigurationService=e}getProcessedLine(i,e){let t=(r,s)=>{let l=bl(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})}),Bc.createFromTextAndMetadata(r,i.languageIdCodec)}};function tht(a,i){a.tokenization.forceTokenization(i.lineNumber);let e=a.tokenization.getLineTokens(i.lineNumber),t=gU(e,i.column-1),o=t.firstCharOffset===0,n=e.getLanguageId(0)===t.languageId;return!o&&!n}function R$(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 cse(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=Jmt(i,e.startLineNumber,e.startColumn);return f&&(v=v.substring(0,v.length-f)),{indentAction:h,appendText:g,removeText:f,indentation:v}}var $Yt=Object.create(null);function dse(a,i){if(i<=0)return"";$Yt[a]||($Yt[a]=["",a]);let e=$Yt[a];for(let t=e.length;t<=i;t++)e[t]=e[t-1]+a;return e[i]}var Xv=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=al.visibleColumnFromColumn(i,e,t);if(n){let s=dse(" ",o),c=al.prevIndentTabStop(r,o)/o;return dse(s,c)}else{let c=al.prevRenderTabStop(r,t)/t;return dse("	",c)}}static shiftIndent(i,e,t,o,n){let r=al.visibleColumnFromColumn(i,e,t);if(n){let s=dse(" ",o),c=al.nextIndentTabStop(r,o)/o;return dse(s,c)}else{let c=al.nextRenderTabStop(r,t)/t;return dse("	",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=Ap(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&&al.visibleColumnFromColumn(h,g+1,n)%r!==0&&i.tokenization.isCheapToTokenize(p-1)){let b=R$(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=Xv.unshiftIndent(h,g+1,n,r,s):f=Xv.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?dse(" ",r):"	";for(let u=t;u<=o;u++){let p=i.getLineContent(u),h=Ap(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 Yt(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 Yt(t.startLineNumber,o,t.endLineNumber,t.endColumn):new Yt(t.endLineNumber,t.endColumn,t.startLineNumber,o)}return t}};Xv=I([m(2,bs)],Xv);var iht=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 Yt(o.endLineNumber,o.endColumn,n.endLineNumber,n.endColumn-this._charAfterSelection.length)}},oht=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 Yt(o.endLineNumber,o.startColumn,o.endLineNumber,o.endColumn-this._charAfter.length)}};function EMo(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 ISe(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 lse(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=EMo(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:bl(l),action:1,line:s}}else if(r.shouldDecrease(s)){let l=i.getLineContent(s);return{indentation:bl(l),action:null,line:s}}else{if(s===1)return{indentation:bl(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:bl(i.getLineContent(u+1)),action:null,line:u+1}}if(t)return{indentation:bl(i.getLineContent(s)),action:null,line:s};for(let u=s;u>0;u--){if(r.shouldIncrease(u))return{indentation:bl(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:bl(i.getLineContent(p+1)),action:null,line:p+1}}else if(r.shouldDecrease(u))return{indentation:bl(i.getLineContent(u)),action:null,line:u}}return{indentation:bl(i.getLineContent(1)),action:null,line:1}}}function use(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 lse(i,s,n),c=ISe(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=bl(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),bl(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 UKi(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 cse(i,o).getProcessedTokenContextAroundRange(e),c=l.afterRangeProcessedTokens,u=l.beforeRangeProcessedTokens,p=bl(u.getLineContent()),h=TMo(i,e.startLineNumber,u),g=tht(i,e.getStartPosition()),f=i.getLineContent(e.startLineNumber),v=bl(f),b=ISe(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 zKi(a,i,e,t,o,n){let r=a.autoIndent;if(r<4||tht(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 cse(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=ISe(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=ISe(r,i,e.startLineNumber,!1,n)?.indentation;if(w!==void 0){let k=i.getLineContent(e.startLineNumber),T=bl(k),O=o.shiftIndent(w)===T,V=/^\s*$/.test(f),U=a.autoClosingPairs.autoClosingPairsOpenByEnd.get(t),$=U&&U.length>0&&V;if(O&&$)return w}}}return null}function nht(a,i,e){let t=e.getLanguageConfiguration(a.getLanguageId()).indentRulesSupport;return!t||i<1||i>a.getLineCount()?null:t.getIndentMetadata(a.getLineContent(i))}function TMo(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 rht=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=ySe.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=zKi(i,e,t,o,{shiftIndent:s=>u$e(i,s),unshiftIndent:s=>CSe(i,s)},i.languageConfigurationService);if(n===null)return null;let r=Jmt(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 jYt(u,l,o,n)}else{let u=this._getEditFromIndentationAndSelection(i,e,c,l,o,!0);return pse(u.range,u.text,!1)}}),s={shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1};return new Yv(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}}},sht=class{static getEdits(i,e,t,o,n,r){if($Ki(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 Wh(c,t)}return new Yv(4,o,{shouldPushStackElementBefore:ght(i,4),shouldPushStackElementAfter:!1})}},aht=class{static getEdits(i,e,t,o,n){if($Ki(i,e,t,o,n)){let r=t.map(s=>new Wh(new z(s.positionLineNumber,s.positionColumn,s.positionLineNumber,s.positionColumn+1),"",!1));return new Yv(4,r,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1})}}},ySe=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 qYt(l,e,!t,o)}return new Yv(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 Ie(f.lineNumber,f.beforeColumn)),o);if(!s)return null;let l,c;if(sW(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=jw(i.wordSeparators,[]);if(w.length>0){let U=w.charCodeAt(w.length-1);if(V.get(U)===0)return null}}if(!e.tokenization.isCheapToTokenize(v))return null;e.tokenization.forceTokenization(v);let T=e.tokenization.getLineTokens(v),N=gU(T,b-1);if(!s.shouldAutoClose(N,b-N.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}},d$e=class{static getEdits(i,e){if(!(i.inputMode==="overtype"))return null;let o=e.map(n=>new Dmt(n.insertedTextRange));return new Yv(4,o,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1})}},lht=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 iht(s,t,l)}return new Yv(0,o,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!0})}static _isSurroundSelectionType(i,e,t,o){if(!YYt(i,o)||!i.surroundingPairs.hasOwnProperty(o))return!1;let n=sW(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(sW(l))return!1}}return!0}},cht=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=bl(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 Wh(y,S);return new Yv(QYt(S,i),[w],{shouldPushStackElementBefore:!1,shouldPushStackElementAfter:!0})}}return null}},dht=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?aSe:Wh;r[l]=new u(t[l],o)}let s=QYt(o,e);return new Yv(s,r,{shouldPushStackElementBefore:ght(e,s),shouldPushStackElementAfter:!1})}},M$=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 Yv(4,r,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1})}}static _enter(i,e,t,o){if(i.autoIndent===0)return pse(o,`
`,t);if(!e.tokenization.isCheapToTokenize(o.getStartPosition().lineNumber)||i.autoIndent===1){let l=e.getLineContent(o.startLineNumber),c=bl(l).substring(0,o.startColumn-1);return pse(o,`
`+i.normalizeIndentation(c),t)}let n=R$(i.autoIndent,e,o,i.languageConfigurationService);if(n){if(n.indentAction===0)return pse(o,`
`+i.normalizeIndentation(n.indentation+n.appendText),t);if(n.indentAction===1)return pse(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 Xre(o,u,!0):new Jre(o,u,-1,c.length-l.length,!0)}else if(n.indentAction===3){let l=CSe(i,n.indentation);return pse(o,`
`+i.normalizeIndentation(l+n.appendText),t)}}let r=e.getLineContent(o.startLineNumber),s=bl(r).substring(0,o.startColumn-1);if(i.autoIndent>=4){let l=UKi(i.autoIndent,e,o,{unshiftIndent:c=>CSe(i,c),shiftIndent:c=>u$e(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=Ap(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 Xre(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 Jre(o,`
`+i.normalizeIndentation(l.afterEnter),0,g,!0)}}}return pse(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 Xre(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}},uht=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=mc(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"?aSe:Wh;n[r]=new c(t[r],o[r])}return new Yv(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 B6(p,o,c,!0)}else{let h=i.overtypeOnPaste&&i.inputMode==="overtype"?aSe:Wh;r[s]=new h(c,o)}}return new Yv(0,r,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!0})}},pht=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 Yv(4,c,{shouldPushStackElementBefore:ght(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 Jre(u,t,0,r)}},mht=class{static getEdits(i,e,t){let o=[];for(let r=0,s=e.length;r<s;r++)o[r]=new Wh(e[r],t);let n=QYt(t,i);return new Yv(n,o,{shouldPushStackElementBefore:ght(i,n),shouldPushStackElementAfter:!1})}},hht=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 Wh(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 Xv(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=ISe(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(tv(u)>=0)break}if(s<1)return null;let l=e.getLineMaxColumn(s),c=R$(i.autoIndent,e,new z(s,l,s,l),i.languageConfigurationService);c&&(n=c.indentation+c.appendText)}return o&&(o===1&&(n=u$e(i,n)),o===3&&(n=CSe(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 Wh(t,n,o)}},wSe=class extends Jre{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)}},qYt=class extends wSe{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)}},jYt=class extends wSe{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 QYt(a,i){return a===" "?i===5||i===6?6:5:4}function ght(a,i){return GKi(a)&&!GKi(i)?!0:a===5?!1:KKi(a)!==KKi(i)}function KKi(a){return a===6||a===5?"space":a}function GKi(a){return a===4||a===5||a===6}function $Ki(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=sW(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 pse(a,i,e){return e?new Xre(a,i,!0):new Wh(a,i,!0)}function u$e(a,i,e){return e=e||1,Xv.shiftIndent(i,i.length+e,a.tabSize,a.indentSize,a.insertSpaces)}function CSe(a,i,e){return e=e||1,Xv.unshiftIndent(i,i.length+e,a.tabSize,a.indentSize,a.insertSpaces)}function YYt(a,i){return sW(i)?a.autoSurround==="quotes"||a.autoSurround==="languageDefined":a.autoSurround==="brackets"||a.autoSurround==="languageDefined"}var RM=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 Xv(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 Xv(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 u$e(i,e,t)}static unshiftIndent(i,e,t){return CSe(i,e,t)}static paste(i,e,t,o,n,r){return uht.getEdits(i,e,t,o,n,r)}static tab(i,e,t){return hht.getCommands(i,e,t)}static compositionType(i,e,t,o,n,r,s,l){return pht.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 d$e.getEdits(e,o);let l=s,c=!1;for(let h of o)if(h.deletedText.length!==0){c=!0;break}if(c){if(!YYt(e,l)||!e.surroundingPairs.hasOwnProperty(l))return null;let h=sW(l);for(let v of o)if(v.deletedSelectionStart!==0||v.deletedSelectionEnd!==v.deletedText.length||/^[ \t]+$/.test(v.deletedText)||h&&sW(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 oht(g[v],o[v].deletedText,e.surroundingPairs[l]));return new Yv(4,f,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1})}let u=aht.getEdits(e,t,n,r,l);if(u!==void 0)return u;let p=ySe.getEdits(e,t,n,l,!0,!1);return p!==void 0?p:d$e.getEdits(e,o)}static typeWithInterceptors(i,e,t,o,n,r,s){let l=M$.getEdits(t,o,n,s,i);if(l!==void 0)return l;let c=rht.getEdits(t,o,n,s,i);if(c!==void 0)return c;let u=sht.getEdits(e,t,o,n,r,s);if(u!==void 0)return u;let p=ySe.getEdits(t,o,n,s,!1,i);if(p!==void 0)return p;let h=lht.getEdits(t,o,n,s,i);if(h!==void 0)return h;let g=cht.getEdits(e,t,o,n,s,i);return g!==void 0?g:dht.getEdits(t,e,n,s,i)}static typeWithoutInterceptors(i,e,t,o,n){return mht.getEdits(i,o,n)}},fht=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 xSe(a){return!!a&&typeof a.id=="string"}var P$={ICodeEditor:"vs.editor.ICodeEditor",IDiffEditor:"vs.editor.IDiffEditor"};var ue;(Cr=>(Cr.editorSimpleInput=new Q("editorSimpleInput",!1,!0),Cr.editorTextFocus=new Q("editorTextFocus",!1,d(839,null)),Cr.focus=new Q("editorFocus",!1,d(812,null)),Cr.textInputFocus=new Q("textInputFocus",!1,d(850,null)),Cr.readOnly=new Q("editorReadonly",!1,d(836,null)),Cr.inDiffEditor=new Q("inDiffEditor",!1,d(841,null)),Cr.isEmbeddedDiffEditor=new Q("isEmbeddedDiffEditor",!1,d(844,null)),Cr.inMultiDiffEditor=new Q("inMultiDiffEditor",!1,d(842,null)),Cr.multiDiffEditorAllCollapsed=new Q("multiDiffEditorAllCollapsed",void 0,d(845,null)),Cr.hasChanges=new Q("diffEditorHasChanges",!1,d(804,null)),Cr.comparingMovedCode=new Q("comparingMovedCode",!1,d(803,null)),Cr.accessibleDiffViewerVisible=new Q("accessibleDiffViewerVisible",!1,d(802,null)),Cr.diffEditorRenderSideBySideInlineBreakpointReached=new Q("diffEditorRenderSideBySideInlineBreakpointReached",!1,d(810,null)),Cr.diffEditorInlineMode=new Q("diffEditorInlineMode",!1,d(805,null)),Cr.diffEditorOriginalWritable=new Q("diffEditorOriginalWritable",!1,d(809,null)),Cr.diffEditorModifiedWritable=new Q("diffEditorModifiedWritable",!1,d(807,null)),Cr.diffEditorOriginalUri=new Q("diffEditorOriginalUri","",d(808,null)),Cr.diffEditorModifiedUri=new Q("diffEditorModifiedUri","",d(806,null)),Cr.columnSelection=new Q("editorColumnSelection",!1,d(811,null)),Cr.writable=Cr.readOnly.toNegated(),Cr.hasNonEmptySelection=new Q("editorHasSelection",!1,d(830,null)),Cr.hasOnlyEmptySelection=Cr.hasNonEmptySelection.toNegated(),Cr.hasMultipleSelections=new Q("editorHasMultipleSelections",!1,d(827,null)),Cr.hasSingleSelection=Cr.hasMultipleSelections.toNegated(),Cr.tabMovesFocus=new Q("editorTabMovesFocus",!1,d(838,null)),Cr.tabDoesNotMoveFocus=Cr.tabMovesFocus.toNegated(),Cr.isInEmbeddedEditor=new Q("isInEmbeddedEditor",!1,!0),Cr.canUndo=new Q("canUndo",!1,!0),Cr.canRedo=new Q("canRedo",!1,!0),Cr.hoverVisible=new Q("editorHoverVisible",!1,d(834,null)),Cr.hoverFocused=new Q("editorHoverFocused",!1,d(833,null)),Cr.stickyScrollFocused=new Q("stickyScrollFocused",!1,d(848,null)),Cr.stickyScrollVisible=new Q("stickyScrollVisible",!1,d(849,null)),Cr.standaloneColorPickerVisible=new Q("standaloneColorPickerVisible",!1,d(847,null)),Cr.standaloneColorPickerFocused=new Q("standaloneColorPickerFocused",!1,d(846,null)),Cr.isComposing=new Q("isComposing",!1,d(843,null)),Cr.inCompositeEditor=new Q("inCompositeEditor",void 0,d(840,null)),Cr.notInCompositeEditor=Cr.inCompositeEditor.toNegated(),Cr.languageId=new Q("editorLangId","",d(835,null)),Cr.hasCompletionItemProvider=new Q("editorHasCompletionItemProvider",!1,d(815,null)),Cr.hasCodeActionsProvider=new Q("editorHasCodeActionsProvider",!1,d(813,null)),Cr.hasCodeLensProvider=new Q("editorHasCodeLensProvider",!1,d(814,null)),Cr.hasDefinitionProvider=new Q("editorHasDefinitionProvider",!1,d(817,null)),Cr.hasDeclarationProvider=new Q("editorHasDeclarationProvider",!1,d(816,null)),Cr.hasImplementationProvider=new Q("editorHasImplementationProvider",!1,d(823,null)),Cr.hasTypeDefinitionProvider=new Q("editorHasTypeDefinitionProvider",!1,d(832,null)),Cr.hasHoverProvider=new Q("editorHasHoverProvider",!1,d(822,null)),Cr.hasDocumentHighlightProvider=new Q("editorHasDocumentHighlightProvider",!1,d(819,null)),Cr.hasDocumentSymbolProvider=new Q("editorHasDocumentSymbolProvider",!1,d(821,null)),Cr.hasReferenceProvider=new Q("editorHasReferenceProvider",!1,d(828,null)),Cr.hasRenameProvider=new Q("editorHasRenameProvider",!1,d(829,null)),Cr.hasSignatureHelpProvider=new Q("editorHasSignatureHelpProvider",!1,d(831,null)),Cr.hasInlayHintsProvider=new Q("editorHasInlayHintsProvider",!1,d(824,null)),Cr.hasDocumentFormattingProvider=new Q("editorHasDocumentFormattingProvider",!1,d(818,null)),Cr.hasDocumentSelectionFormattingProvider=new Q("editorHasDocumentSelectionFormattingProvider",!1,d(820,null)),Cr.hasMultipleDocumentFormattingProvider=new Q("editorHasMultipleDocumentFormattingProvider",!1,d(825,null)),Cr.hasMultipleDocumentSelectionFormattingProvider=new Q("editorHasMultipleDocumentSelectionFormattingProvider",!1,d(826,null)),Cr.selectionHasDiagnostics=new Q("editorSelectionHasDiagnostics",!1,d(837,null))))(ue||={});var vht=class{constructor(){this.type=0}},bht=class{constructor(){this.type=1}},Sht=class{constructor(i){this.type=2;this._source=i}hasChanged(i){return this._source.hasChanged(i)}},Iht=class{constructor(i,e,t){this.selections=i;this.modelSelections=e;this.reason=t;this.type=3}},wU=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)}},mse=class{constructor(){this.type=5}},yht=class{constructor(i){this.type=6;this.isFocused=i}},wht=class{constructor(){this.type=7}},hse=class{constructor(){this.type=8}},m$e=class{constructor(i,e){this.fromLineNumber=i;this.count=e;this.type=9}},kSe=class{constructor(i,e){this.type=10;this.fromLineNumber=i,this.toLineNumber=e}},ESe=class{constructor(i,e){this.type=11;this.fromLineNumber=i,this.toLineNumber=e}};var A$=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}},Cht=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}},xht=class{constructor(i){this.theme=i;this.type=14}},kht=class{constructor(i){this.type=15;this.ranges=i}},Eht=class{constructor(){this.type=16}},Tht=class{constructor(){this.type=17}};function XYt(a){let i=a;return typeof i?.resolve=="function"&&typeof i?.isResolved=="function"}function qKi(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 ql=0,hm=class extends xc{runEditorCommand(i,e,t){let o=e._getViewModel();o&&this.runCoreEditorCommand(o,t||{})}},Py;(s=>{let a=function(l){if(!yi(l))return!1;let c=l;return!(!Ae(c.to)||!cn(c.by)&&!Ae(c.by)||!cn(c.value)&&!Xo(c.value)||!cn(c.revealCursor)&&!Da(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||={})})(Py||={});var h$e;(t=>{let a=function(o){if(!yi(o))return!1;let n=o;return!(!Xo(n.lineNumber)&&!Ae(n.lineNumber)||!cn(n.at)&&!Ae(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"}})(h$e||={});var g$e=class{constructor(i){i.addImplementation(1e4,"code-editor",(e,t)=>{let o=e.get(Kt).getFocusedCodeEditor();return o&&o.hasTextFocus()?this._runEditorCommand(e,o,t):!1}),i.addImplementation(1e3,"generic-dom-input-textarea",(e,t)=>{let o=Pn();return o&&Oh(o)?(this.runDOMCommand(o),!0):!1}),i.addImplementation(0,"generic-dom",(e,t)=>{let o=e.get(Kt).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 Vg;(wo=>{class a extends hm{constructor(Pt){super(Pt),this._inSelectionMode=Pt.inSelectionMode}runCoreEditorCommand(Pt,Ke){if(!Ke.position)return;Pt.model.pushStackElement(),Pt.setCursorStates(Ke.source,3,[Wg.moveTo(Pt,Pt.getPrimaryCursorState(),this._inSelectionMode,Ke.position,Ke.viewPosition)])&&Ke.revealType!==2&&Pt.revealAllCursors(Ke.source,!0,!0)}}wo.MoveTo=qi(new a({id:"_moveTo",inSelectionMode:!1,precondition:void 0})),wo.MoveToSelect=qi(new a({id:"_moveToSelect",inSelectionMode:!0,precondition:void 0}));class t extends hm{runCoreEditorCommand(Pt,Ke){Pt.model.pushStackElement();let ye=this._getColumnSelectResult(Pt,Pt.getPrimaryCursorState(),Pt.getCursorColumnSelectData(),Ke);ye!==null&&(Pt.setCursorStates(Ke.source,3,ye.viewStates.map(Be=>Ps.fromViewState(Be))),Pt.setCursorColumnSelectData({isReal:!0,fromViewLineNumber:ye.fromLineNumber,fromViewVisualColumn:ye.fromVisualColumn,toViewLineNumber:ye.toLineNumber,toViewVisualColumn:ye.toVisualColumn}),ye.reversed?Pt.revealTopMostCursor(Ke.source):Pt.revealBottomMostCursor(Ke.source))}}wo.ColumnSelect=qi(new class extends t{constructor(){super({id:"columnSelect",precondition:void 0})}_getColumnSelectResult(tn,Pt,Ke,ye){if(typeof ye.position>"u"||typeof ye.viewPosition>"u"||typeof ye.mouseColumn>"u")return null;let Be=tn.model.validatePosition(ye.position),Tt=tn.coordinatesConverter.validateViewPosition(new Ie(ye.viewPosition.lineNumber,ye.viewPosition.column),Be),Ht=ye.doColumnSelect?Ke.fromViewLineNumber:Tt.lineNumber,Do=ye.doColumnSelect?Ke.fromViewVisualColumn:ye.mouseColumn-1;return V6.columnSelect(tn.cursorConfig,tn,Ht,Do,Tt.lineNumber,ye.mouseColumn-1)}}),wo.CursorColumnSelectLeft=qi(new class extends t{constructor(){super({id:"cursorColumnSelectLeft",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:3599,linux:{primary:0}}})}_getColumnSelectResult(tn,Pt,Ke,ye){return V6.columnSelectLeft(tn.cursorConfig,tn,Ke)}}),wo.CursorColumnSelectRight=qi(new class extends t{constructor(){super({id:"cursorColumnSelectRight",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:3601,linux:{primary:0}}})}_getColumnSelectResult(tn,Pt,Ke,ye){return V6.columnSelectRight(tn.cursorConfig,tn,Ke)}});class s extends t{constructor(Pt){super(Pt),this._isPaged=Pt.isPaged}_getColumnSelectResult(Pt,Ke,ye,Be){return V6.columnSelectUp(Pt.cursorConfig,Pt,ye,this._isPaged)}}wo.CursorColumnSelectUp=qi(new s({isPaged:!1,id:"cursorColumnSelectUp",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:3600,linux:{primary:0}}})),wo.CursorColumnSelectPageUp=qi(new s({isPaged:!0,id:"cursorColumnSelectPageUp",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:3595,linux:{primary:0}}}));class u extends t{constructor(Pt){super(Pt),this._isPaged=Pt.isPaged}_getColumnSelectResult(Pt,Ke,ye,Be){return V6.columnSelectDown(Pt.cursorConfig,Pt,ye,this._isPaged)}}wo.CursorColumnSelectDown=qi(new u({isPaged:!1,id:"cursorColumnSelectDown",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:3602,linux:{primary:0}}})),wo.CursorColumnSelectPageDown=qi(new u({isPaged:!0,id:"cursorColumnSelectPageDown",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:3596,linux:{primary:0}}}));class g extends hm{constructor(){super({id:"cursorMove",precondition:void 0,metadata:vs.metadata})}runCoreEditorCommand(Pt,Ke){let ye=vs.parse(Ke);ye&&this._runCursorMove(Pt,Ke.source,ye)}_runCursorMove(Pt,Ke,ye){let Be=ye.noHistory?"api":Ke;Pt.model.pushStackElement(),Pt.setCursorStates(Be,3,g._move(Pt,Pt.getCursorStates(),ye)),Pt.revealAllCursors(Be,!0)}static _move(Pt,Ke,ye){let Be=ye.select,Tt=ye.value;switch(ye.direction){case vs.Direction.Left:case vs.Direction.Right:case vs.Direction.Up:case vs.Direction.Down:case vs.Direction.PrevBlankLine:case vs.Direction.NextBlankLine:case vs.Direction.WrappedLineStart:case vs.Direction.WrappedLineFirstNonWhitespaceCharacter:case vs.Direction.WrappedLineColumnCenter:case vs.Direction.WrappedLineEnd:case vs.Direction.WrappedLineLastNonWhitespaceCharacter:return Wg.simpleMove(Pt,Ke,ye.direction,Be,Tt,ye.unit);case vs.Direction.ViewPortTop:case vs.Direction.ViewPortBottom:case vs.Direction.ViewPortCenter:case vs.Direction.ViewPortIfOutside:return Wg.viewportMove(Pt,Ke,ye.direction,Be,Tt);default:return null}}}wo.CursorMoveImpl=g,wo.CursorMove=qi(new g);let v;(Pt=>Pt[Pt.PAGE_SIZE_MARKER=-1]="PAGE_SIZE_MARKER")(v||={});class b extends hm{constructor(Pt){super(Pt),this._staticArgs=Pt.args}runCoreEditorCommand(Pt,Ke){let ye=this._staticArgs;this._staticArgs.value===-1&&(ye={direction:this._staticArgs.direction,unit:this._staticArgs.unit,select:this._staticArgs.select,value:Ke.pageSize||Pt.cursorConfig.pageSize}),Pt.model.pushStackElement(),Pt.setCursorStates(Ke.source,3,Wg.simpleMove(Pt,Pt.getCursorStates(),ye.direction,ye.select,ye.value,ye.unit)),Pt.revealAllCursors(Ke.source,!0)}}wo.CursorLeft=qi(new b({args:{direction:vs.Direction.Left,unit:vs.Unit.None,select:!1,value:1},id:"cursorLeft",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:15,mac:{primary:15,secondary:[288]}}})),wo.CursorLeftSelect=qi(new b({args:{direction:vs.Direction.Left,unit:vs.Unit.None,select:!0,value:1},id:"cursorLeftSelect",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:1039}})),wo.CursorRight=qi(new b({args:{direction:vs.Direction.Right,unit:vs.Unit.None,select:!1,value:1},id:"cursorRight",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:17,mac:{primary:17,secondary:[292]}}})),wo.CursorRightSelect=qi(new b({args:{direction:vs.Direction.Right,unit:vs.Unit.None,select:!0,value:1},id:"cursorRightSelect",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:1041}})),wo.CursorUp=qi(new b({args:{direction:vs.Direction.Up,unit:vs.Unit.WrappedLine,select:!1,value:1},id:"cursorUp",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:16,mac:{primary:16,secondary:[302]}}})),wo.CursorUpSelect=qi(new b({args:{direction:vs.Direction.Up,unit:vs.Unit.WrappedLine,select:!0,value:1},id:"cursorUpSelect",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:1040,secondary:[3088],mac:{primary:1040},linux:{primary:1040}}})),wo.CursorPageUp=qi(new b({args:{direction:vs.Direction.Up,unit:vs.Unit.WrappedLine,select:!1,value:-1},id:"cursorPageUp",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:11}})),wo.CursorPageUpSelect=qi(new b({args:{direction:vs.Direction.Up,unit:vs.Unit.WrappedLine,select:!0,value:-1},id:"cursorPageUpSelect",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:1035}})),wo.CursorDown=qi(new b({args:{direction:vs.Direction.Down,unit:vs.Unit.WrappedLine,select:!1,value:1},id:"cursorDown",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:18,mac:{primary:18,secondary:[300]}}})),wo.CursorDownSelect=qi(new b({args:{direction:vs.Direction.Down,unit:vs.Unit.WrappedLine,select:!0,value:1},id:"cursorDownSelect",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:1042,secondary:[3090],mac:{primary:1042},linux:{primary:1042}}})),wo.CursorPageDown=qi(new b({args:{direction:vs.Direction.Down,unit:vs.Unit.WrappedLine,select:!1,value:-1},id:"cursorPageDown",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:12}})),wo.CursorPageDownSelect=qi(new b({args:{direction:vs.Direction.Down,unit:vs.Unit.WrappedLine,select:!0,value:-1},id:"cursorPageDownSelect",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:1036}})),wo.CreateCursor=qi(new class extends hm{constructor(){super({id:"createCursor",precondition:void 0})}runCoreEditorCommand(tn,Pt){if(!Pt.position)return;let Ke;Pt.wholeLine?Ke=Wg.line(tn,tn.getPrimaryCursorState(),!1,Pt.position,Pt.viewPosition):Ke=Wg.moveTo(tn,tn.getPrimaryCursorState(),!1,Pt.position,Pt.viewPosition);let ye=tn.getCursorStates();if(ye.length>1){let Be=Ke.modelState?Ke.modelState.position:null,Tt=Ke.viewState?Ke.viewState.position:null;for(let Ht=0,Do=ye.length;Ht<Do;Ht++){let io=ye[Ht];if(!(Be&&!io.modelState.selection.containsPosition(Be))&&!(Tt&&!io.viewState.selection.containsPosition(Tt))){ye.splice(Ht,1),tn.model.pushStackElement(),tn.setCursorStates(Pt.source,3,ye);return}}}ye.push(Ke),tn.model.pushStackElement(),tn.setCursorStates(Pt.source,3,ye)}}),wo.LastCursorMoveToSelect=qi(new class extends hm{constructor(){super({id:"_lastCursorMoveToSelect",precondition:void 0})}runCoreEditorCommand(tn,Pt){if(!Pt.position)return;let Ke=tn.getLastAddedCursorIndex(),ye=tn.getCursorStates(),Be=ye.slice(0);Be[Ke]=Wg.moveTo(tn,ye[Ke],!0,Pt.position,Pt.viewPosition),tn.model.pushStackElement(),tn.setCursorStates(Pt.source,3,Be)}});class se extends hm{constructor(Pt){super(Pt),this._inSelectionMode=Pt.inSelectionMode}runCoreEditorCommand(Pt,Ke){Pt.model.pushStackElement(),Pt.setCursorStates(Ke.source,3,Wg.moveToBeginningOfLine(Pt,Pt.getCursorStates(),this._inSelectionMode)),Pt.revealAllCursors(Ke.source,!0)}}wo.CursorHome=qi(new se({inSelectionMode:!1,id:"cursorHome",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:14,mac:{primary:14,secondary:[2063]}}})),wo.CursorHomeSelect=qi(new se({inSelectionMode:!0,id:"cursorHomeSelect",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:1038,mac:{primary:1038,secondary:[3087]}}}));class Ee extends hm{constructor(Pt){super(Pt),this._inSelectionMode=Pt.inSelectionMode}runCoreEditorCommand(Pt,Ke){Pt.model.pushStackElement(),Pt.setCursorStates(Ke.source,3,this._exec(Pt.getCursorStates())),Pt.revealAllCursors(Ke.source,!0)}_exec(Pt){let Ke=[];for(let ye=0,Be=Pt.length;ye<Be;ye++){let Tt=Pt[ye],Ht=Tt.modelState.position.lineNumber;Ke[ye]=Ps.fromModelState(Tt.modelState.move(this._inSelectionMode,Ht,1,0))}return Ke}}wo.CursorLineStart=qi(new Ee({inSelectionMode:!1,id:"cursorLineStart",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:0,mac:{primary:287}}})),wo.CursorLineStartSelect=qi(new Ee({inSelectionMode:!0,id:"cursorLineStartSelect",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:0,mac:{primary:1311}}}));class Fe extends hm{constructor(Pt){super(Pt),this._inSelectionMode=Pt.inSelectionMode}runCoreEditorCommand(Pt,Ke){Pt.model.pushStackElement(),Pt.setCursorStates(Ke.source,3,Wg.moveToEndOfLine(Pt,Pt.getCursorStates(),this._inSelectionMode,Ke.sticky||!1)),Pt.revealAllCursors(Ke.source,!0)}}wo.CursorEnd=qi(new Fe({inSelectionMode:!1,id:"cursorEnd",precondition:void 0,kbOpts:{args:{sticky:!1},weight:ql,kbExpr:ue.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}}}}]}})),wo.CursorEndSelect=qi(new Fe({inSelectionMode:!0,id:"cursorEndSelect",precondition:void 0,kbOpts:{args:{sticky:!1},weight:ql,kbExpr:ue.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 hm{constructor(Pt){super(Pt),this._inSelectionMode=Pt.inSelectionMode}runCoreEditorCommand(Pt,Ke){Pt.model.pushStackElement(),Pt.setCursorStates(Ke.source,3,this._exec(Pt,Pt.getCursorStates())),Pt.revealAllCursors(Ke.source,!0)}_exec(Pt,Ke){let ye=[];for(let Be=0,Tt=Ke.length;Be<Tt;Be++){let Ht=Ke[Be],Do=Ht.modelState.position.lineNumber,io=Pt.model.getLineMaxColumn(Do);ye[Be]=Ps.fromModelState(Ht.modelState.move(this._inSelectionMode,Do,io,0))}return ye}}wo.CursorLineEnd=qi(new Ti({inSelectionMode:!1,id:"cursorLineEnd",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:0,mac:{primary:291}}})),wo.CursorLineEndSelect=qi(new Ti({inSelectionMode:!0,id:"cursorLineEndSelect",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:0,mac:{primary:1315}}}));class Ro extends hm{constructor(Pt){super(Pt),this._inSelectionMode=Pt.inSelectionMode}runCoreEditorCommand(Pt,Ke){Pt.model.pushStackElement(),Pt.setCursorStates(Ke.source,3,Wg.moveToBeginningOfBuffer(Pt,Pt.getCursorStates(),this._inSelectionMode)),Pt.revealAllCursors(Ke.source,!0)}}wo.CursorTop=qi(new Ro({inSelectionMode:!1,id:"cursorTop",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:2062,mac:{primary:2064}}})),wo.CursorTopSelect=qi(new Ro({inSelectionMode:!0,id:"cursorTopSelect",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:3086,mac:{primary:3088}}}));class ln extends hm{constructor(Pt){super(Pt),this._inSelectionMode=Pt.inSelectionMode}runCoreEditorCommand(Pt,Ke){Pt.model.pushStackElement(),Pt.setCursorStates(Ke.source,3,Wg.moveToEndOfBuffer(Pt,Pt.getCursorStates(),this._inSelectionMode)),Pt.revealAllCursors(Ke.source,!0)}}wo.CursorBottom=qi(new ln({inSelectionMode:!1,id:"cursorBottom",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:2061,mac:{primary:2066}}})),wo.CursorBottomSelect=qi(new ln({inSelectionMode:!0,id:"cursorBottomSelect",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:3085,mac:{primary:3090}}}));class ba extends hm{constructor(){super({id:"editorScroll",precondition:void 0,metadata:Py.metadata})}determineScrollMethod(Pt){let Ke=[6],ye=[1,2,3,4,5],Be=[4,2],Tt=[1,3];return Ke.includes(Pt.unit)&&Be.includes(Pt.direction)?this._runHorizontalEditorScroll.bind(this):ye.includes(Pt.unit)&&Tt.includes(Pt.direction)?this._runVerticalEditorScroll.bind(this):null}runCoreEditorCommand(Pt,Ke){let ye=Py.parse(Ke);if(!ye)return;let Be=this.determineScrollMethod(ye);Be&&Be(Pt,Ke.source,ye)}_runVerticalEditorScroll(Pt,Ke,ye){let Be=this._computeDesiredScrollTop(Pt,ye);if(ye.revealCursor){let Tt=Pt.getCompletelyVisibleViewRangeAtScrollTop(Be),Ht=Pt.getViewRangeWithCursorPadding(Tt);Pt.setCursorStates(Ke,3,[Wg.findPositionInViewportIfOutside(Pt,Pt.getPrimaryCursorState(),Ht,ye.select)])}Pt.viewLayout.setScrollPosition({scrollTop:Be},0)}_computeDesiredScrollTop(Pt,Ke){if(Ke.unit===1){let Tt=Pt.viewLayout.getFutureViewport(),Ht=Pt.getCompletelyVisibleViewRangeAtScrollTop(Tt.top),Do=Pt.coordinatesConverter.convertViewRangeToModelRange(Ht),io;Ke.direction===1?io=Math.max(1,Do.startLineNumber-Ke.value):io=Math.min(Pt.model.getLineCount(),Do.startLineNumber+Ke.value);let xr=Pt.coordinatesConverter.convertModelPositionToViewPosition(new Ie(io,1));return Pt.viewLayout.getVerticalOffsetForLineNumber(xr.lineNumber)}if(Ke.unit===5){let Tt=0;return Ke.direction===3&&(Tt=Pt.model.getLineCount()-Pt.cursorConfig.pageSize),Pt.viewLayout.getVerticalOffsetForLineNumber(Tt)}let ye;Ke.unit===3?ye=Pt.cursorConfig.pageSize*Ke.value:Ke.unit===4?ye=Math.round(Pt.cursorConfig.pageSize/2)*Ke.value:ye=Ke.value;let Be=(Ke.direction===1?-1:1)*ye;return Pt.viewLayout.getCurrentScrollTop()+Be*Pt.cursorConfig.lineHeight}_runHorizontalEditorScroll(Pt,Ke,ye){let Be=this._computeDesiredScrollLeft(Pt,ye);Pt.viewLayout.setScrollPosition({scrollLeft:Be},0)}_computeDesiredScrollLeft(Pt,Ke){let ye=(Ke.direction===4?-1:1)*Ke.value;return Pt.viewLayout.getCurrentScrollLeft()+ye*Pt.cursorConfig.typicalHalfwidthCharacterWidth}}wo.EditorScrollImpl=ba,wo.EditorScroll=qi(new ba),wo.ScrollLineUp=qi(new class extends hm{constructor(){super({id:"scrollLineUp",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:2064,mac:{primary:267}}})}runCoreEditorCommand(tn,Pt){wo.EditorScroll.runCoreEditorCommand(tn,{to:Py.RawDirection.Up,by:Py.RawUnit.WrappedLine,value:1,revealCursor:!1,select:!1,source:Pt.source})}}),wo.ScrollPageUp=qi(new class extends hm{constructor(){super({id:"scrollPageUp",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:2059,win:{primary:523},linux:{primary:523}}})}runCoreEditorCommand(tn,Pt){wo.EditorScroll.runCoreEditorCommand(tn,{to:Py.RawDirection.Up,by:Py.RawUnit.Page,value:1,revealCursor:!1,select:!1,source:Pt.source})}}),wo.ScrollEditorTop=qi(new class extends hm{constructor(){super({id:"scrollEditorTop",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus}})}runCoreEditorCommand(tn,Pt){wo.EditorScroll.runCoreEditorCommand(tn,{to:Py.RawDirection.Up,by:Py.RawUnit.Editor,value:1,revealCursor:!1,select:!1,source:Pt.source})}}),wo.ScrollLineDown=qi(new class extends hm{constructor(){super({id:"scrollLineDown",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:2066,mac:{primary:268}}})}runCoreEditorCommand(tn,Pt){wo.EditorScroll.runCoreEditorCommand(tn,{to:Py.RawDirection.Down,by:Py.RawUnit.WrappedLine,value:1,revealCursor:!1,select:!1,source:Pt.source})}}),wo.ScrollPageDown=qi(new class extends hm{constructor(){super({id:"scrollPageDown",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:2060,win:{primary:524},linux:{primary:524}}})}runCoreEditorCommand(tn,Pt){wo.EditorScroll.runCoreEditorCommand(tn,{to:Py.RawDirection.Down,by:Py.RawUnit.Page,value:1,revealCursor:!1,select:!1,source:Pt.source})}}),wo.ScrollEditorBottom=qi(new class extends hm{constructor(){super({id:"scrollEditorBottom",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus}})}runCoreEditorCommand(tn,Pt){wo.EditorScroll.runCoreEditorCommand(tn,{to:Py.RawDirection.Down,by:Py.RawUnit.Editor,value:1,revealCursor:!1,select:!1,source:Pt.source})}}),wo.ScrollLeft=qi(new class extends hm{constructor(){super({id:"scrollLeft",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus}})}runCoreEditorCommand(tn,Pt){wo.EditorScroll.runCoreEditorCommand(tn,{to:Py.RawDirection.Left,by:Py.RawUnit.Column,value:2,revealCursor:!1,select:!1,source:Pt.source})}}),wo.ScrollRight=qi(new class extends hm{constructor(){super({id:"scrollRight",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus}})}runCoreEditorCommand(tn,Pt){wo.EditorScroll.runCoreEditorCommand(tn,{to:Py.RawDirection.Right,by:Py.RawUnit.Column,value:2,revealCursor:!1,select:!1,source:Pt.source})}});class sx extends hm{constructor(Pt){super(Pt),this._inSelectionMode=Pt.inSelectionMode}runCoreEditorCommand(Pt,Ke){Ke.position&&(Pt.model.pushStackElement(),Pt.setCursorStates(Ke.source,3,[Wg.word(Pt,Pt.getPrimaryCursorState(),this._inSelectionMode,Ke.position)]),Ke.revealType!==2&&Pt.revealAllCursors(Ke.source,!0,!0))}}wo.WordSelect=qi(new sx({inSelectionMode:!1,id:"_wordSelect",precondition:void 0})),wo.WordSelectDrag=qi(new sx({inSelectionMode:!0,id:"_wordSelectDrag",precondition:void 0})),wo.LastCursorWordSelect=qi(new class extends hm{constructor(){super({id:"lastCursorWordSelect",precondition:void 0})}runCoreEditorCommand(tn,Pt){if(!Pt.position)return;let Ke=tn.getLastAddedCursorIndex(),ye=tn.getCursorStates(),Be=ye.slice(0),Tt=ye[Ke];Be[Ke]=Wg.word(tn,Tt,Tt.modelState.hasSelection(),Pt.position),tn.model.pushStackElement(),tn.setCursorStates(Pt.source,3,Be)}});class uf extends hm{constructor(Pt){super(Pt),this._inSelectionMode=Pt.inSelectionMode}runCoreEditorCommand(Pt,Ke){Ke.position&&(Pt.model.pushStackElement(),Pt.setCursorStates(Ke.source,3,[Wg.line(Pt,Pt.getPrimaryCursorState(),this._inSelectionMode,Ke.position,Ke.viewPosition)]),Ke.revealType!==2&&Pt.revealAllCursors(Ke.source,!1,!0))}}wo.LineSelect=qi(new uf({inSelectionMode:!1,id:"_lineSelect",precondition:void 0})),wo.LineSelectDrag=qi(new uf({inSelectionMode:!0,id:"_lineSelectDrag",precondition:void 0}));class ax extends hm{constructor(Pt){super(Pt),this._inSelectionMode=Pt.inSelectionMode}runCoreEditorCommand(Pt,Ke){if(!Ke.position)return;let ye=Pt.getLastAddedCursorIndex(),Be=Pt.getCursorStates(),Tt=Be.slice(0);Tt[ye]=Wg.line(Pt,Be[ye],this._inSelectionMode,Ke.position,Ke.viewPosition),Pt.model.pushStackElement(),Pt.setCursorStates(Ke.source,3,Tt)}}wo.LastCursorLineSelect=qi(new ax({inSelectionMode:!1,id:"lastCursorLineSelect",precondition:void 0})),wo.LastCursorLineSelectDrag=qi(new ax({inSelectionMode:!0,id:"lastCursorLineSelectDrag",precondition:void 0})),wo.CancelSelection=qi(new class extends hm{constructor(){super({id:"cancelSelection",precondition:ue.hasNonEmptySelection,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:9,secondary:[1033]}})}runCoreEditorCommand(tn,Pt){tn.model.pushStackElement(),tn.setCursorStates(Pt.source,3,[Wg.cancelSelection(tn,tn.getPrimaryCursorState())]),tn.revealAllCursors(Pt.source,!0)}}),wo.RemoveSecondaryCursors=qi(new class extends hm{constructor(){super({id:"removeSecondaryCursors",precondition:ue.hasMultipleSelections,kbOpts:{weight:ql+1,kbExpr:ue.textInputFocus,primary:9,secondary:[1033]}})}runCoreEditorCommand(tn,Pt){tn.model.pushStackElement(),tn.setCursorStates(Pt.source,3,[tn.getPrimaryCursorState()]),tn.revealAllCursors(Pt.source,!0),Or(d(181,null))}}),wo.RevealLine=qi(new class extends hm{constructor(){super({id:"revealLine",precondition:void 0,metadata:h$e.metadata})}runCoreEditorCommand(tn,Pt){let Ke=Pt,ye=Ke.lineNumber||0,Be=typeof ye=="number"?ye+1:parseInt(ye)+1;Be<1&&(Be=1);let Tt=tn.model.getLineCount();Be>Tt&&(Be=Tt);let Ht=new z(Be,1,Be,tn.model.getLineMaxColumn(Be)),Do=0;if(Ke.at)switch(Ke.at){case h$e.RawAtArgument.Top:Do=3;break;case h$e.RawAtArgument.Center:Do=1;break;case h$e.RawAtArgument.Bottom:Do=4;break;default:break}let io=tn.coordinatesConverter.convertModelRangeToViewRange(Ht);tn.revealRange(Pt.source,!1,io,Do,0)}}),wo.SelectAll=new class extends g$e{constructor(){super(ymt)}runDOMCommand(tn){yc&&(tn.focus(),tn.select()),tn.ownerDocument.execCommand("selectAll")}runEditorCommand(tn,Pt,Ke){let ye=Pt._getViewModel();ye&&this.runCoreEditorCommand(ye,Ke)}runCoreEditorCommand(tn,Pt){tn.model.pushStackElement(),tn.setCursorStates("keyboard",3,[Wg.selectAll(tn,tn.getPrimaryCursorState())])}},wo.SetSelection=qi(new class extends hm{constructor(){super({id:"setSelection",precondition:void 0})}runCoreEditorCommand(tn,Pt){Pt.selection&&(tn.model.pushStackElement(),tn.setCursorStates(Pt.source,3,[Ps.fromModelSelection(Pt.selection)]))}})})(Vg||={});var _Mo=x.and(ue.textInputFocus,ue.columnSelection);function DSe(a,i){yt.registerKeybindingRule({id:a,primary:i,when:_Mo,weight:ql+1})}DSe(Vg.CursorColumnSelectLeft.id,1039);DSe(Vg.CursorColumnSelectRight.id,1041);DSe(Vg.CursorColumnSelectUp.id,1040);DSe(Vg.CursorColumnSelectPageUp.id,1035);DSe(Vg.CursorColumnSelectDown.id,1042);DSe(Vg.CursorColumnSelectPageDown.id,1036);function jKi(a){return a.register(),a}var rL;(l=>{class a extends xc{runEditorCommand(u,p,h){let g=p._getViewModel();g&&this.runCoreEditingCommand(p,g,h||{})}}l.CoreEditingCommand=a,l.LineBreakInsert=qi(new class extends a{constructor(){super({id:"lineBreakInsert",precondition:ue.writable,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:0,mac:{primary:301}}})}runCoreEditingCommand(c,u,p){c.pushUndoStop(),c.executeCommands(this.id,M$.lineBreakInsert(u.cursorConfig,u.model,u.getCursorStates().map(h=>h.modelState.selection)))}}),l.Outdent=qi(new class extends a{constructor(){super({id:"outdent",precondition:ue.writable,kbOpts:{weight:ql,kbExpr:x.and(ue.editorTextFocus,ue.tabDoesNotMoveFocus),primary:1026}})}runCoreEditingCommand(c,u,p){c.pushUndoStop(),c.executeCommands(this.id,RM.outdent(u.cursorConfig,u.model,u.getCursorStates().map(h=>h.modelState.selection))),c.pushUndoStop()}}),l.Tab=qi(new class extends a{constructor(){super({id:"tab",precondition:ue.writable,kbOpts:{weight:ql,kbExpr:x.and(ue.editorTextFocus,ue.tabDoesNotMoveFocus),primary:2}})}runCoreEditingCommand(c,u,p){c.pushUndoStop(),c.executeCommands(this.id,RM.tab(u.cursorConfig,u.model,u.getCursorStates().map(h=>h.modelState.selection))),c.pushUndoStop()}}),l.DeleteLeft=qi(new class extends a{constructor(){super({id:"deleteLeft",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:1,secondary:[1025],mac:{primary:1,secondary:[1025,294,257]}}})}runCoreEditingCommand(c,u,p){let[h,g]=wN.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=qi(new class extends a{constructor(){super({id:"deleteRight",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:20,mac:{primary:20,secondary:[290,276]}}})}runCoreEditingCommand(c,u,p){let[h,g]=wN.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 g$e{constructor(){super(BT)}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 g$e{constructor(){super(HT)}runDOMCommand(c){c.ownerDocument.execCommand("redo")}runEditorCommand(c,u,p){if(!(!u.hasModel()||u.getOption(104)===!0))return u.getModel().redo()}}})(rL||={});var _ht=class extends $re{constructor(i,e,t){super({id:i,precondition:void 0,metadata:t}),this._handlerId=e}runCommand(i,e){let t=i.get(Kt).getFocusedCodeEditor();t&&t.trigger("keyboard",this._handlerId,e)}};function gse(a,i){jKi(new _ht("default:"+a,a)),jKi(new _ht(a,a,i))}gse("type",{description:"Type",args:[{name:"args",schema:{type:"object",required:["text"],properties:{text:{type:"string"}}}}]});gse("replacePreviousChar");gse("compositionType");gse("compositionStart");gse("compositionEnd");gse("paste");gse("cut");var $s=ae("editorWorkerService");var QKi="default",DMo="$initialize",YKi=!1;function Rht(a){Gt&&(YKi||(YKi=!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 JYt=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}},Dht=class{constructor(i,e,t,o){this.vsWorker=i;this.seq=e;this.res=t;this.err=o;this.type=1}},ZYt=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}},eXt=class{constructor(i,e,t){this.vsWorker=i;this.req=e;this.event=t;this.type=3}},tXt=class{constructor(i,e){this.vsWorker=i;this.req=e;this.type=4}},iXt=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 JYt(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 ZYt(this._workerId,o,i,e,t))},onDidRemoveLastListener:()=>{this._pendingEmitters.delete(o),this._send(new tXt(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]&&(JKi(n)?o[n]=r=>this.listen(i,n,r):XKi(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 Dht(this._workerId,e,o,void 0))},o=>{o.detail instanceof Error&&(o.detail=QG(o.detail)),this._send(new Dht(this._workerId,e,void 0,QG(o)))})}_handleSubscribeEventMessage(i){let e=i.req,t=this._handler.handleEvent(i.channel,i.eventName,i.arg)(o=>{this._send(new eXt(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)}},Lht=class extends C{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=>{Rht(t),mt(t)})),this._protocol=new iXt({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(QKi,DMo,[this._worker.getId()]).then(()=>{}),this.proxy=this._protocol.createProxyToRemoteChannel(QKi,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(JKi(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(XKi(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 XKi(a){return a[0]==="o"&&a[1]==="n"&&Hk(a.charCodeAt(2))}function JKi(a){return/^onDynamic/.test(a)&&Hk(a.charCodeAt(9))}var gx=class{constructor(i){this.esmModuleLocation=i.esmModuleLocation,this.esmModuleLocationBundler=i.esmModuleLocationBundler,this.label=i.label}};var Ay=ae("IWebWorkerService");var An=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 Mht=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 oXt(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}},oXt=class extends C{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 v$e=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 fse=class{constructor(i,e,t){this.tokens=i;this.fontInfo=e;this.endState=t;this._encodedTokenizationResultBrand=void 0}};var xU;(n=>{let a=new Map;a.set(0,M.symbolMethod),a.set(1,M.symbolFunction),a.set(2,M.symbolConstructor),a.set(3,M.symbolField),a.set(4,M.symbolVariable),a.set(5,M.symbolClass),a.set(6,M.symbolStruct),a.set(7,M.symbolInterface),a.set(8,M.symbolModule),a.set(9,M.symbolProperty),a.set(10,M.symbolEvent),a.set(11,M.symbolOperator),a.set(12,M.symbolUnit),a.set(13,M.symbolValue),a.set(15,M.symbolEnum),a.set(14,M.symbolConstant),a.set(15,M.symbolEnum),a.set(16,M.symbolEnumMember),a.set(17,M.symbolKeyword),a.set(28,M.symbolSnippet),a.set(18,M.symbolText),a.set(19,M.symbolColor),a.set(20,M.symbolFile),a.set(21,M.symbolReference),a.set(22,M.symbolCustomColor),a.set(23,M.symbolFolder),a.set(24,M.symbolTypeParameter),a.set(25,M.account),a.set(26,M.issues),a.set(27,M.tools);function i(r){let s=a.get(r);return s||(console.info("No codicon found for CompletionItemKind "+r),s=M.symbolProperty),s}n.toIcon=i;function e(r){switch(r){case 0:return d(890,null);case 1:return d(886,null);case 2:return d(878,null);case 3:return d(883,null);case 4:return d(903,null);case 5:return d(875,null);case 6:return d(896,null);case 7:return d(887,null);case 8:return d(891,null);case 9:return d(893,null);case 10:return d(882,null);case 11:return d(892,null);case 12:return d(900,null);case 13:return d(902,null);case 14:return d(877,null);case 15:return d(880,null);case 16:return d(881,null);case 17:return d(889,null);case 18:return d(897,null);case 19:return d(876,null);case 20:return d(884,null);case 21:return d(894,null);case 22:return d(879,null);case 23:return d(885,null);case 24:return d(899,null);case 25:return d(901,null);case 26:return d(888,null);case 27:return d(898,null);case 28:return d(895,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})(xU||={});var Pht=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 CU=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}},Aht=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 ZKi(a){return!!a&&A.isUri(a.uri)&&z.isIRange(a.range)&&(z.isIRange(a.originSelectionRange)||z.isIRange(a.targetSelectionRange))}function nv(a){return!!a&&A.isUri(a.uri)&&z.isIRange(a.range)}var nXt={17:d(851,null),16:d(852,null),4:d(853,null),13:d(854,null),8:d(855,null),9:d(856,null),21:d(857,null),23:d(858,null),7:d(859,null),0:d(860,null),11:d(861,null),10:d(862,null),19:d(863,null),5:d(864,null),1:d(865,null),2:d(866,null),20:d(867,null),15:d(868,null),18:d(869,null),24:d(870,null),3:d(871,null),6:d(872,null),14:d(873,null),22:d(874,null),25:d(905,null),12:d(906,null)};function Oht(a,i){return d(904,null,a,nXt[i])}var sh;(o=>{let a=new Map;a.set(0,M.symbolFile),a.set(1,M.symbolModule),a.set(2,M.symbolNamespace),a.set(3,M.symbolPackage),a.set(4,M.symbolClass),a.set(5,M.symbolMethod),a.set(6,M.symbolProperty),a.set(7,M.symbolField),a.set(8,M.symbolConstructor),a.set(9,M.symbolEnum),a.set(10,M.symbolInterface),a.set(11,M.symbolFunction),a.set(12,M.symbolVariable),a.set(13,M.symbolConstant),a.set(14,M.symbolString),a.set(15,M.symbolNumber),a.set(16,M.symbolBoolean),a.set(17,M.symbolArray),a.set(18,M.symbolObject),a.set(19,M.symbolKey),a.set(20,M.symbolNull),a.set(21,M.symbolEnumMember),a.set(22,M.symbolStruct),a.set(23,M.symbolEvent),a.set(24,M.symbolOperator),a.set(25,M.symbolTypeParameter);function i(n){let r=a.get(n);return r||(console.info("No codicon found for SymbolKind "+n),r=M.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})(sh||={});var Qk=class{static asEditOperation(i){let e=z.lift(i.range);return e.isEmpty()?An.insert(e.getStartPosition(),i.text):An.replace(e,i.text)}static isTextEdit(i){let e=i;return typeof e.text=="string"&&z.isIRange(e.range)}},Yk=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 vse;(i=>{function a(e){return!e||typeof e!="object"?!1:typeof e.id=="string"&&typeof e.title=="string"}i.is=a})(vse||={});var Nht=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}},kc=new Mht;var lW=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 bse=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 e2i(a,i,e){return new MM(new bse(a),new bse(i)).ComputeDiff(e).changes}var G6=class{static Assert(i,e){if(!i)throw new Error(e)}},$6=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 Fht=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 lW(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}},MM=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]=Vbe(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?(G6.Assert(i===e+1,"originalStart should only be one more than originalEnd"),p=[new lW(i,0,t,o-t+1)]):i<=e?(G6.Assert(t===o+1,"modifiedStart should only be one more than modifiedEnd"),p=[new lW(i,e-i+1,t,0)]):(G6.Assert(i===e+1,"originalStart should only be one more than originalEnd"),G6.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 lW(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 lW(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 Fht,N=e,O=t,V=g[0]-b[0]-o,U=-1073741824,G=this.m_forwardHistory.length-1;do{let $=V+i;$===N||$<O&&c[$-1]<c[$+1]?(p=c[$+1],f=p-V-o,p<U&&T.MarkNextChange(),U=p,T.AddModifiedElement(p+1,f),V=$+1-i):(p=c[$-1]+1,f=p-V-o,p<U&&T.MarkNextChange(),U=p-1,T.AddOriginalElement(p,f+1),V=$-1-i),G>=0&&(c=this.m_forwardHistory[G],i=c[0],N=1,O=c.length-1)}while(--G>=-1);if(w=T.getReverseChanges(),y[0]){let $=g[0]+1,te=b[0]+1;if(w!==null&&w.length>0){let pe=w[w.length-1];$=Math.max($,pe.getOriginalEnd()),te=Math.max(te,pe.getModifiedEnd())}k=[new lW($,h-$+1,te,v-te+1)]}else{T=new Fht,N=r,O=s,V=g[0]-b[0]-l,U=1073741824,G=S?this.m_reverseHistory.length-1:this.m_reverseHistory.length-2;do{let $=V+n;$===N||$<O&&u[$-1]>=u[$+1]?(p=u[$+1]-1,f=p-V-l,p>U&&T.MarkNextChange(),U=p+1,T.AddOriginalElement(p+1,f+1),V=$+1-n):(p=u[$-1],f=p-V-l,p>U&&T.MarkNextChange(),U=p,T.AddModifiedElement(p+1,f+1),V=$-1-n),G>=0&&(u=this.m_reverseHistory[G],n=u[0],N=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 U=0,G=0;u=this.ClipDiagonalBound(y-V,V,y,v),p=this.ClipDiagonalBound(y+V,V,y,v);for(let te=u;te<=p;te+=2){te===u||te<p&&b[te-1]<b[te+1]?l=b[te+1]:l=b[te-1]+1,c=l-(te-y)-k;let pe=l;for(;l<e&&c<o&&this.ElementsAreEqual(l+1,c+1);)l++,c++;if(b[te]=l,l+c>U+G&&(U=l,G=c),!O&&Math.abs(te-w)<=V-1&&l>=S[te])return n[0]=l,r[0]=c,pe<=S[te]&&V<=1448?this.WALKTRACE(y,u,p,k,w,h,g,T,b,S,l,e,n,c,o,r,O,s):null}let $=(U-i+(G-t)-V)/2;if(this.ContinueProcessingPredicate!==null&&!this.ContinueProcessingPredicate(U,$))return s[0]=!0,n[0]=U,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 lW(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 te=h;te<=g;te+=2){te===h||te<g&&S[te-1]>=S[te+1]?l=S[te+1]-1:l=S[te-1],c=l-(te-w)-T;let pe=l;for(;l>i&&c>t&&this.ElementsAreEqual(l,c);)l--,c--;if(S[te]=l,O&&Math.abs(te-y)<=V&&l<=b[te])return n[0]=l,r[0]=c,pe>=b[te]&&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 te=new Int32Array(p-u+2);te[0]=y-u+1,$6.Copy2(b,u,te,1,p-u+1),this.m_forwardHistory.push(te),te=new Int32Array(g-h+2),te[0]=w-h+1,$6.Copy2(S,h,te,1,g-h+1),this.m_reverseHistory.push(te)}}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 $6.Copy(i,0,o,0,i.length-1),o[i.length-1]=t[0],$6.Copy(e,1,o,i.length,e.length-1),o}else{let o=new Array(i.length+e.length);return $6.Copy(i,0,o,0,i.length),$6.Copy(e,0,o,i.length,e.length),o}}ChangesOverlap(i,e,t){if(G6.Assert(i.originalStart<=e.originalStart,"Left change is not less than or equal to right change"),G6.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 lW(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}}},O$=new Uint32Array(65536),LMo=(a,i)=>{let e=a.length,t=i.length,o=1<<e-1,n=-1,r=0,s=e,l=e;for(;l--;)O$[a.charCodeAt(l)]|=1<<l;for(l=0;l<t;l++){let c=O$[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--;)O$[a.charCodeAt(l)]=0;return s};function RMo(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++)O$[i.charCodeAt(y)]|=1<<y;for(let y=0;y<e;y++){let w=O$[a.charCodeAt(y)],k=o[y/32|0]>>>y&1,T=n[y/32|0]>>>y&1,N=w|f,O=((w|T)&v)+v^v|w|T,V=f|~(O|v),U=v&O;V>>>31^k&&(o[y/32|0]^=1<<y),U>>>31^T&&(n[y/32|0]^=1<<y),V=V<<1|k,U=U<<1|T,v=U|~(N|V),f=V&N}for(let y=b;y<S;y++)O$[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++)O$[i.charCodeAt(f)]|=1<<f;let g=t;for(let f=0;f<e;f++){let v=O$[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++)O$[i.charCodeAt(f)]=0;return g}function t2i(a,i){if(a.length<i.length){let e=i;i=a,a=e}return i.length===0?a.length:a.length<=32?LMo(a,i):RMo(a,i)}var sXt=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}},aXt=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 sXt(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)}},rXt=null;function MMo(){return rXt===null&&(rXt=new aXt([[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]])),rXt}var b$e=null;function PMo(){if(b$e===null){b$e=new _$(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++)b$e.set(a.charCodeAt(e),1);let i=".,;:";for(let e=0;e<i.length;e++)b$e.set(i.charCodeAt(e),2)}return b$e}var S$e=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=MMo()){let t=PMo(),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 i2i(a){return!a||typeof a.getLineCount!="function"||typeof a.getLineContent!="function"?[]:S$e.computeLinks(a)}var Wht=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 lXt=(Lt=>(Lt[Lt.DependsOnKbLayout=-1]="DependsOnKbLayout",Lt[Lt.Unknown=0]="Unknown",Lt[Lt.Backspace=1]="Backspace",Lt[Lt.Tab=2]="Tab",Lt[Lt.Enter=3]="Enter",Lt[Lt.Shift=4]="Shift",Lt[Lt.Ctrl=5]="Ctrl",Lt[Lt.Alt=6]="Alt",Lt[Lt.PauseBreak=7]="PauseBreak",Lt[Lt.CapsLock=8]="CapsLock",Lt[Lt.Escape=9]="Escape",Lt[Lt.Space=10]="Space",Lt[Lt.PageUp=11]="PageUp",Lt[Lt.PageDown=12]="PageDown",Lt[Lt.End=13]="End",Lt[Lt.Home=14]="Home",Lt[Lt.LeftArrow=15]="LeftArrow",Lt[Lt.UpArrow=16]="UpArrow",Lt[Lt.RightArrow=17]="RightArrow",Lt[Lt.DownArrow=18]="DownArrow",Lt[Lt.Insert=19]="Insert",Lt[Lt.Delete=20]="Delete",Lt[Lt.Digit0=21]="Digit0",Lt[Lt.Digit1=22]="Digit1",Lt[Lt.Digit2=23]="Digit2",Lt[Lt.Digit3=24]="Digit3",Lt[Lt.Digit4=25]="Digit4",Lt[Lt.Digit5=26]="Digit5",Lt[Lt.Digit6=27]="Digit6",Lt[Lt.Digit7=28]="Digit7",Lt[Lt.Digit8=29]="Digit8",Lt[Lt.Digit9=30]="Digit9",Lt[Lt.KeyA=31]="KeyA",Lt[Lt.KeyB=32]="KeyB",Lt[Lt.KeyC=33]="KeyC",Lt[Lt.KeyD=34]="KeyD",Lt[Lt.KeyE=35]="KeyE",Lt[Lt.KeyF=36]="KeyF",Lt[Lt.KeyG=37]="KeyG",Lt[Lt.KeyH=38]="KeyH",Lt[Lt.KeyI=39]="KeyI",Lt[Lt.KeyJ=40]="KeyJ",Lt[Lt.KeyK=41]="KeyK",Lt[Lt.KeyL=42]="KeyL",Lt[Lt.KeyM=43]="KeyM",Lt[Lt.KeyN=44]="KeyN",Lt[Lt.KeyO=45]="KeyO",Lt[Lt.KeyP=46]="KeyP",Lt[Lt.KeyQ=47]="KeyQ",Lt[Lt.KeyR=48]="KeyR",Lt[Lt.KeyS=49]="KeyS",Lt[Lt.KeyT=50]="KeyT",Lt[Lt.KeyU=51]="KeyU",Lt[Lt.KeyV=52]="KeyV",Lt[Lt.KeyW=53]="KeyW",Lt[Lt.KeyX=54]="KeyX",Lt[Lt.KeyY=55]="KeyY",Lt[Lt.KeyZ=56]="KeyZ",Lt[Lt.Meta=57]="Meta",Lt[Lt.ContextMenu=58]="ContextMenu",Lt[Lt.F1=59]="F1",Lt[Lt.F2=60]="F2",Lt[Lt.F3=61]="F3",Lt[Lt.F4=62]="F4",Lt[Lt.F5=63]="F5",Lt[Lt.F6=64]="F6",Lt[Lt.F7=65]="F7",Lt[Lt.F8=66]="F8",Lt[Lt.F9=67]="F9",Lt[Lt.F10=68]="F10",Lt[Lt.F11=69]="F11",Lt[Lt.F12=70]="F12",Lt[Lt.F13=71]="F13",Lt[Lt.F14=72]="F14",Lt[Lt.F15=73]="F15",Lt[Lt.F16=74]="F16",Lt[Lt.F17=75]="F17",Lt[Lt.F18=76]="F18",Lt[Lt.F19=77]="F19",Lt[Lt.F20=78]="F20",Lt[Lt.F21=79]="F21",Lt[Lt.F22=80]="F22",Lt[Lt.F23=81]="F23",Lt[Lt.F24=82]="F24",Lt[Lt.NumLock=83]="NumLock",Lt[Lt.ScrollLock=84]="ScrollLock",Lt[Lt.Semicolon=85]="Semicolon",Lt[Lt.Equal=86]="Equal",Lt[Lt.Comma=87]="Comma",Lt[Lt.Minus=88]="Minus",Lt[Lt.Period=89]="Period",Lt[Lt.Slash=90]="Slash",Lt[Lt.Backquote=91]="Backquote",Lt[Lt.BracketLeft=92]="BracketLeft",Lt[Lt.Backslash=93]="Backslash",Lt[Lt.BracketRight=94]="BracketRight",Lt[Lt.Quote=95]="Quote",Lt[Lt.OEM_8=96]="OEM_8",Lt[Lt.IntlBackslash=97]="IntlBackslash",Lt[Lt.Numpad0=98]="Numpad0",Lt[Lt.Numpad1=99]="Numpad1",Lt[Lt.Numpad2=100]="Numpad2",Lt[Lt.Numpad3=101]="Numpad3",Lt[Lt.Numpad4=102]="Numpad4",Lt[Lt.Numpad5=103]="Numpad5",Lt[Lt.Numpad6=104]="Numpad6",Lt[Lt.Numpad7=105]="Numpad7",Lt[Lt.Numpad8=106]="Numpad8",Lt[Lt.Numpad9=107]="Numpad9",Lt[Lt.NumpadMultiply=108]="NumpadMultiply",Lt[Lt.NumpadAdd=109]="NumpadAdd",Lt[Lt.NUMPAD_SEPARATOR=110]="NUMPAD_SEPARATOR",Lt[Lt.NumpadSubtract=111]="NumpadSubtract",Lt[Lt.NumpadDecimal=112]="NumpadDecimal",Lt[Lt.NumpadDivide=113]="NumpadDivide",Lt[Lt.KEY_IN_COMPOSITION=114]="KEY_IN_COMPOSITION",Lt[Lt.ABNT_C1=115]="ABNT_C1",Lt[Lt.ABNT_C2=116]="ABNT_C2",Lt[Lt.AudioVolumeMute=117]="AudioVolumeMute",Lt[Lt.AudioVolumeUp=118]="AudioVolumeUp",Lt[Lt.AudioVolumeDown=119]="AudioVolumeDown",Lt[Lt.BrowserSearch=120]="BrowserSearch",Lt[Lt.BrowserHome=121]="BrowserHome",Lt[Lt.BrowserBack=122]="BrowserBack",Lt[Lt.BrowserForward=123]="BrowserForward",Lt[Lt.MediaTrackNext=124]="MediaTrackNext",Lt[Lt.MediaTrackPrevious=125]="MediaTrackPrevious",Lt[Lt.MediaStop=126]="MediaStop",Lt[Lt.MediaPlayPause=127]="MediaPlayPause",Lt[Lt.LaunchMediaPlayer=128]="LaunchMediaPlayer",Lt[Lt.LaunchMail=129]="LaunchMail",Lt[Lt.LaunchApp2=130]="LaunchApp2",Lt[Lt.Clear=131]="Clear",Lt[Lt.MAX_VALUE=132]="MAX_VALUE",Lt))(lXt||{}),cXt=(o=>(o[o.Hint=1]="Hint",o[o.Info=2]="Info",o[o.Warning=4]="Warning",o[o.Error=8]="Error",o))(cXt||{}),dXt=(e=>(e[e.Unnecessary=1]="Unnecessary",e[e.Deprecated=2]="Deprecated",e))(dXt||{});var uXt=(e=>(e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e))(uXt||{});var pXt=class{static{this.CtrlCmd=2048}static{this.Shift=1024}static{this.Alt=512}static{this.WinCtrl=256}static chord(i,e){return Ai(i,e)}};function o2i(){return{editor:void 0,languages:void 0,CancellationTokenSource:$e,Emitter:E,KeyCode:lXt,KeyMod:pXt,Position:Ie,Range:z,Selection:Yt,SelectionDirection:uXt,MarkerSeverity:cXt,MarkerTag:dXt,Uri:A,Token:v$e}}var NMo=999,Oy=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=I$e(this.searchString):i=this.searchString.indexOf(`
`)>=0;let e=null;try{e=u$(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 Lmt(e,this.wordSeparators?jw(this.wordSeparators,[]):null,t?this.searchString:null)}};function I$e(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 q6(a,i,e){if(!e)return new vU(a,null);let t=[];for(let o=0,n=i.length;o<n;o++)t[o]=i[o];return new vU(a,t)}var Vht=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}},Sse=class{static findMatches(i,e,t,o,n){let r=e.parseSearchRequest();return r?r.regex.multiline?this._doFindMatchesMultiline(i,t,new kU(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 Vht(s):null,c=[],u=0,p;for(t.reset(0);p=t.next(s);)if(c[u++]=q6(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||Bht(c,e,f,v,g))&&(r[n++]=new vU(new z(t,v+1+o,t,v+1+g+o),null),n>=l))return n;return n}let u=new kU(i.wordSeparators,i.regex),p;u.reset(0);do if(p=u.next(e),p&&(r[n++]=q6(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 kU(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 Ie(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 Vht(l):null;t.reset(e.column-1);let u=t.next(l);return u?q6(this._getMultilineMatchRange(i,r,l,c,u.index,u[0]),u,o):e.lineNumber!==1||e.column!==1?this._doFindNextMatchMultiline(i,new Ie(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?q6(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 kU(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*NMo);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 Ie(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=q6(new z(t,r.index+1,t,r.index+1+r[0].length),r,o);return n}};function OMo(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 FMo(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 Bht(a,i,e,t,o){return OMo(a,i,e,t,o)&&FMo(a,i,e,t,o)}var kU=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){Ebe(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||Bht(this._wordSeparators,i,e,o,n))return t}while(t);return null}};var Ise=class{static computeUnicodeHighlights(i,e,t){let o=t?t.startLineNumber:1,n=t?t.endLineNumber:i.getLineCount(),r=new Hht(e),s=r.getCandidateCodePoints(),l;s==="allNonBasicAscii"?l=new RegExp("[^\\t\\n\\r\\x20-\\x7E]","g"):l=new RegExp(`${WMo(Array.from(s))}`,"g");let c=new kU(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 U=y.charCodeAt(k-1);Ru(U)&&k--}if(T+1<w){let U=y.charCodeAt(T-1);Ru(U)&&T++}let N=y.substring(k,T),O=My(k+1,F6,y,0);O&&O.endColumn<=k+1&&(O=null);let V=r.shouldHighlightNonBasicASCII(N,O?O.word:null);if(V!==0){if(V===3?g++:V===2?f++:V===1?v++:Hr(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 Hht(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=p6.getLocales().filter(l=>!p6.getInstance(new Set([...e.allowedLocales,l])).isAmbiguous(n));return{kind:0,confusableWith:String.fromCodePoint(r),notAmbiguousInLocales:s}}case 1:return{kind:2}}}};function WMo(a,i){return`[${Yr(a.map(t=>String.fromCodePoint(t)).join(""))}]`}var Hht=class{constructor(i){this.options=i;this.allowedCodePoints=new Set(i.allowedCodePoints),this.ambiguousCharacters=p6.getInstance(new Set(i.allowedLocales))}getCandidateCodePoints(){if(this.options.nonBasicASCII)return"allNonBasicAscii";let i=new Set;if(this.options.invisibleCharacters)for(let e of K0.codePoints)n2i(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=oU(r);o=o||l,!l&&!this.ambiguousCharacters.isAmbiguous(s)&&!K0.isInvisibleCharacter(s)&&(n=!0)}return!o&&n?0:this.options.invisibleCharacters&&!n2i(i)&&K0.isInvisibleCharacter(t)?2:this.options.ambiguousCharacters&&this.ambiguousCharacters.isAmbiguous(t)?3:0}};function n2i(a){return a===" "||a===`
`||a==="	"}var j6=class{constructor(i,e,t){this.changes=i;this.moves=e;this.hitTimeout=t}},LSe=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 ro=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=tl(i=>i.startLineNumber,qd)}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 PM(i[0].slice());for(let t=1;t<i.length;t++)e=e.getUnion(new PM(i[t].slice()));return e.ranges}static join(i){if(i.length===0)throw new ni("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 ni(`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 di(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)}},PM=class a{constructor(i=[]){this._normalizedRanges=i}get ranges(){return this._normalizedRanges}addRange(i){if(i.length===0)return;let e=xy(this._normalizedRanges,o=>o.endLineNumberExclusive>=i.startLineNumber),t=XG(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=YG(this._normalizedRanges,t=>t.startLineNumber<=i);return!!e&&e.endLineNumberExclusive>i}intersects(i){let e=YG(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 ro(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=xy(this._normalizedRanges,r=>r.endLineNumberExclusive>=i.startLineNumber),t=XG(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 ro(n,s.startLineNumber)),n=s.endLineNumberExclusive}return n<i.endLineNumberExclusive&&o.push(new ro(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 Zl=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 ro.ofLength(1,this.lineCount+1)}addToPosition(i){return this.lineCount===0?new Ie(i.lineNumber,i.column+this.columnCount):new Ie(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 RSe=class{getOffsetRange(i){return new di(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 F$.deps.StringEdit(e)}getStringReplacement(i){return new F$.deps.StringReplacement(this.getOffsetRange(i.range),i.text)}getTextReplacement(i){return new F$.deps.TextReplacement(this.getRange(i.replaceRange),i.newText)}getTextEdit(i){let e=i.replacements.map(t=>this.getTextReplacement(t));return new F$.deps.TextEdit(e)}},F$=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 r2i(a){F$._deps=a}var AM=class extends RSe{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 Ie(1,1);let t=this.textLength.lineCount+1;if(e.lineNumber>t){let n=this.getLineLength(t);return new Ie(t,n+1)}if(e.column<1)return new Ie(e.lineNumber,1);let o=this.getLineLength(e.lineNumber);return e.column-1>o?new Ie(e.lineNumber,o+1):e}getPosition(e){let t=XG(this.lineStartOffsetByLineIdx,r=>r<=e),o=t+1,n=e-this.lineStartOffsetByLineIdx[t]+1;return new Ie(o,n)}getTextLength(e){return F$.deps.TextLength.ofRange(this.getRange(e))}get textLength(){let e=this.lineStartOffsetByLineIdx.length-1;return new F$.deps.TextLength(e,this.text.length-this.lineStartOffsetByLineIdx[e])}getLineLength(e){return this.lineEndOffsetByLineIdx[e-1]-this.lineStartOffsetByLineIdx[e-1]}};var Q6=class{constructor(){this._transformer=void 0}get endPositionExclusive(){return this.length.addToPosition(new Ie(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 AM(this.getValue())),this._transformer}getLineAt(i){return this.getValueOfRange(new z(i,1,i,Number.MAX_SAFE_INTEGER))}getLines(){let i=this.getValue();return mc(i)}getLinesOfRange(i){return i.mapToLineArray(e=>this.getLineAt(e))}equals(i){return this===i?!0:this.getValue()===i.getValue()}},mXt=class extends Q6{constructor(e,t){Ey(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 Zl(this._lineCount-1,e.length)}},yse=class extends mXt{constructor(i){super(e=>i[e-1],i.length)}},_S=class extends Q6{constructor(e){super();this.value=e;this._t=new AM(this.value)}getValueOfRange(e){return this._t.getOffsetRange(e).substring(this.value)}get length(){return this._t.textLength}getTransformer(){return this._t}};var bp=class a{constructor(i){this.replacements=i;eh(()=>Ty(i,(e,t)=>e.range.getEndPosition().isBeforeOrEqual(t.range.getStartPosition())))}static fromStringEdit(i,e){let t=i.replacements.map(o=>Xr.fromStringReplacement(o,e));return new a(t)}static replace(i,e){return new a([new Xr(i,e)])}static delete(i){return new a([new Xr(i,"")])}static insert(i,e){return new a([new Xr(z.fromPositions(i,i),e)])}static fromParallelReplacementsUnsorted(i){let e=i.slice().sort(tl(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 Xr(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=Zl.ofText(n.text);if(i.isBefore(s)){let c=new Ie(r.lineNumber+e,r.column+(r.lineNumber+e===t?o:0)),u=l.addToPosition(c);return Uht(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 Ie(i.lineNumber+e,i.column+(i.lineNumber+e===t?o:0))}mapRange(i){function e(r){return r instanceof Ie?r:r.getStartPosition()}function t(r){return r instanceof Ie?r:r.getEndPosition()}let o=e(this.mapPosition(i.getStartPosition())),n=t(this.mapPosition(i.getEndPosition()));return Uht(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 Ie(1,1);for(let n of this.replacements){let r=n.range,s=r.getStartPosition(),l=r.getEndPosition(),c=Uht(t,s);c.isEmpty()||(e+=i.getValueOfRange(c)),e+=n.text,t=l}let o=Uht(t,i.endPositionExclusive);return o.isEmpty()||(e+=i.getValueOfRange(o)),e}applyToString(i){let e=new _S(i);return this.apply(e)}inverse(i){let e=this.getNewRanges();return new a(this.replacements.map((t,o)=>new Xr(e[o],i.getValueOfRange(t.range))))}getNewRanges(){let i=[],e=0,t=0,o=0;for(let n of this.replacements){let r=Zl.ofText(n.text),s=Ie.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 ni;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 Xr(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],N=T.range.getStartPosition();if(!(r===N.lineNumber&&s===N.column))l=r,c=s,u=N.lineNumber,p=N.column,h=null,r===N.lineNumber?(g=0,f=N.column-s):(g=N.lineNumber-r,f=N.column-1),v=!0,r=N.lineNumber,s=N.column;else{let V=T.range.getEndPosition();l=N.lineNumber,c=N.column,u=V.lineNumber,p=V.column,h=T.text;let U=0,G=0,$=T.text;for(let te=0;te<$.length;te++)$.charCodeAt(te)===10?(U++,G=0):G++;g=U,f=G,v=!0,r=V.lineNumber,s=V.column,n++}}else b=!0,l=r,c=s,v=!0}function k(T,N,O){if(N===0&&O===0)return["",T];let V=0,U=0;for(;V<N;){let G=T.indexOf(`
`,U);if(G===-1)throw new ni("Text length mismatch");U=G+1,V++}return U+=O,[T.substring(0,U),T.substring(U)]}for(let T of t.replacements){let N=T.range.getStartPosition(),O=T.range.getEndPosition();for(;!(S===N.lineNumber&&y===N.column);){if(w(),b){let se,Se;S===N.lineNumber?(se=0,Se=N.column-y):(se=N.lineNumber-S,Se=N.column-1),S=N.lineNumber,y=N.column,se===0?c+=Se:(l+=se,c=Se+1);break}let te,pe;g===0?(te=S,pe=y+f):(te=S+g,pe=f+1);let de=!1;if(N.lineNumber<te?de=!0:N.lineNumber===te&&(de=N.column<pe),de){let se,Se;S===N.lineNumber?(se=0,Se=N.column-y):(se=N.lineNumber-S,Se=N.column-1);let ke,Ee;if(se===g?(ke=0,Ee=f-Se):(ke=g-se,Ee=f),h!==null){let[He,Ve]=k(h,se,Se);o.push(new Xr(new z(l,c,u,p),He)),h=Ve,g=ke,f=Ee,l=u,c=p}else{let He,Ve;se===0?(He=l,Ve=c+Se):(He=l+se,Ve=Se+1),l=He,c=Ve,g=ke,f=Ee}S=N.lineNumber,y=N.column;break}h!==null&&o.push(new Xr(new z(l,c,u,p),h)),S=te,y=pe,v=!1}let V=null,U=null,G=null,$=null;for(;!(S===O.lineNumber&&y===O.column);){if(w(),b){let se,Se;S===O.lineNumber?(se=0,Se=O.column-y):(se=O.lineNumber-S,Se=O.column-1);let ke,Ee;se===0?(ke=l,Ee=c+Se):(ke=l+se,Ee=Se+1),V===null&&(V=l,U=c),G=ke,$=Ee,S=O.lineNumber,y=O.column,l=ke,c=Ee;break}let te,pe;g===0?(te=S,pe=y+f):(te=S+g,pe=f+1);let de=!1;if(O.lineNumber<te?de=!0:O.lineNumber===te&&(de=O.column<pe),de){let se,Se;S===O.lineNumber?(se=0,Se=O.column-y):(se=O.lineNumber-S,Se=O.column-1);let ke,Ee;if(se===g?(ke=0,Ee=f-Se):(ke=g-se,Ee=f),h!==null){V===null&&(V=l,U=c),G=u,$=p;let[,He]=k(h,se,Se);h=He,g=ke,f=Ee,l=u,c=p}else{let He,Ve;se===0?(He=l,Ve=c+Se):(He=l+se,Ve=Se+1),V===null&&(V=l,U=c),G=He,$=Ve,l=He,c=Ve,g=ke,f=Ee}S=O.lineNumber,y=O.column;break}V===null&&(V=l,U=c),G=u,$=p,S=te,y=pe,v=!1}if(V!==null)o.push(new Xr(new z(V,U,G,$),T.text));else{w();let te=l,pe=c;o.push(new Xr(new z(te,pe,te,pe),T.text))}}for(;w(),!b;)h!==null&&o.push(new Xr(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 _S(i)):this.replacements.length===0?"":this.replacements.map(e=>{let o=i.getValueOfRange(e.range),n=z.fromPositions(new Ie(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 Ie(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(`
`)}},Xr=class a{constructor(i,e){this.range=i;this.text=e}static joinReplacements(i,e){if(i.length===0)throw new ni;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 bp([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=Ng(e,t),n=Zl.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=zw(e,t),n=Zl.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=Ng(e,t);e=e.substring(o),t=t.substring(o);let n=zw(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 Uht(a,i){if(a.lineNumber===i.lineNumber&&a.column===Number.MAX_SAFE_INTEGER)return z.fromPositions(i,i);if(!a.isBeforeOrEqual(i))throw new ni("start must be before end");return new z(a.lineNumber,a.column,i.lineNumber,i.column)}var NI=class a{static inverse(i,e,t){let o=[],n=1,r=1;for(let l of i){let c=new a(new ro(n,l.original.startLineNumber),new ro(r,l.modified.startLineNumber));c.modified.isEmpty||o.push(c),n=l.original.endLineNumberExclusive,r=l.modified.endLineNumberExclusive}let s=new a(new ro(n,e+1),new ro(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 cg(i,e);if(this.original.startLineNumber===1||this.modified.startLineNumber===1){if(!(this.modified.startLineNumber===1&&this.original.startLineNumber===1))throw new ni("not a valid diff");return new cg(new z(this.original.startLineNumber,1,this.original.endLineNumberExclusive,1),new z(this.modified.startLineNumber,1,this.modified.endLineNumberExclusive,1))}else return new cg(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(s2i(this.original.endLineNumberExclusive,i)&&s2i(this.modified.endLineNumberExclusive,e))return new cg(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 cg(z.fromPositions(new Ie(this.original.startLineNumber,1),MSe(new Ie(this.original.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),i)),z.fromPositions(new Ie(this.modified.startLineNumber,1),MSe(new Ie(this.modified.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),e)));if(this.original.startLineNumber>1&&this.modified.startLineNumber>1)return new cg(z.fromPositions(MSe(new Ie(this.original.startLineNumber-1,Number.MAX_SAFE_INTEGER),i),MSe(new Ie(this.original.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),i)),z.fromPositions(MSe(new Ie(this.modified.startLineNumber-1,Number.MAX_SAFE_INTEGER),e),MSe(new Ie(this.modified.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),e)));throw new ni}};function MSe(a,i){if(a.lineNumber<1)return new Ie(1,1);if(a.lineNumber>i.length)return new Ie(i.length,i[i.length-1].length+1);let e=i[a.lineNumber-1];return a.column>e.length+1?new Ie(a.lineNumber,e.length+1):a}function s2i(a,i){return a>=1&&a<=i.length}var wf=class a extends NI{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 bp(t)}static fromRangeMappings(i){let e=ro.join(i.map(o=>ro.fromRangeInclusive(o.originalRange))),t=ro.join(i.map(o=>ro.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()])}},cg=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 ni("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 ni("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 Xr(this.originalRange,e)}join(i){return new a(this.originalRange.plusRange(i.originalRange),this.modifiedRange.plusRange(i.modifiedRange))}};function PSe(a,i,e,t=!1){let o=[];for(let n of s6(a.map(r=>VMo(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 wf(r.original.join(s.original),r.modified.join(s.modified),n.map(l=>l.innerChanges[0])))}return eh(()=>!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:Ty(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 VMo(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 ro(a.originalRange.startLineNumber+t,a.originalRange.endLineNumber+1+o),r=new ro(a.modifiedRange.startLineNumber+t,a.modifiedRange.endLineNumber+1+o);return new wf(n,r,[a])}var BMo=3,zht=class{computeDiff(i,e,t){let n=new w$e(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 ro(l.originalStartLineNumber+1,l.originalStartLineNumber+1):c=new ro(l.originalStartLineNumber,l.originalEndLineNumber+1);let u;l.modifiedEndLineNumber===0?u=new ro(l.modifiedStartLineNumber+1,l.modifiedStartLineNumber+1):u=new ro(l.modifiedStartLineNumber,l.modifiedEndLineNumber+1);let p=new wf(c,u,l.charChanges?.map(h=>new cg(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 wf(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 eh(()=>Ty(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 j6(r,[],n.quitEarly)}};function l2i(a,i,e,t){return new MM(a,i,e).ComputeDiff(t)}var Kht=class{constructor(i){let e=[],t=[];for(let o=0,n=i.length;o<n;o++)e[o]=gXt(i[o],1),t[o]=fXt(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 hXt(o,n,r)}},hXt=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)}},ASe=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 HMo(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)<BMo?(e.originalLength=n.originalStart+n.originalLength-e.originalStart,e.modifiedLength=n.modifiedStart+n.modifiedLength-e.modifiedStart):(i.push(n),e=n)}return i}var y$e=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=l2i(g,f,n,!0).changes;s&&(v=HMo(v)),h=[];for(let b=0,S=v.length;b<S;b++)h.push(ASe.createFromDiffChange(v[b],g,f))}}return new a(l,c,u,p,h)}},w$e=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 Kht(i),this.modified=new Kht(e),this.continueLineDiff=a2i(t.maxComputationTime),this.continueCharDiff=a2i(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=l2i(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(y$e.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=gXt(h,1),v=gXt(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=fXt(h,1),v=fXt(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(y$e.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 ASe(e,t,e,o,n,r,n,s)]),i.push(new y$e(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 ASe(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 ASe(e,t,e,o,n,r,n,s)),!0):!1}};function gXt(a,i){let e=Ap(a);return e===-1?i:e+1}function fXt(a,i){let e=tv(a);return e===-1?i:e+2}function a2i(a){if(a===0)return()=>!0;let i=Date.now();return()=>Date.now()-i<a}var TU=class a{constructor(i,e){this.diffs=i;this.hitTimeout=e}static trivial(i,e){return new a([new dg(di.ofLength(i.length),di.ofLength(e.length))],!1)}static trivialTimedOut(i,e){return new a([new dg(di.ofLength(i.length),di.ofLength(e.length))],!0)}},dg=class a{constructor(i,e){this.seq1Range=i;this.seq2Range=e}static invert(i,e){let t=[];return Nut(i,(o,n)=>{t.push(a.fromOffsetPairs(o?o.getEndExclusives():EU.zero,n?n.getStarts():new EU(e,(o?o.seq2Range.endExclusive-o.seq1Range.endExclusive:0)+e)))}),t}static fromOffsetPairs(i,e){return new a(new di(i.offset1,e.offset1),new di(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 ni("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 EU(this.seq1Range.start,this.seq2Range.start)}getEndExclusives(){return new EU(this.seq1Range.endExclusive,this.seq2Range.endExclusive)}},EU=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}},Y6=class a{static{this.instance=new a}isValid(){return!0}},Ght=class{constructor(i){this.timeout=i;this.startTime=Date.now();this.valid=!0;if(i<=0)throw new ni("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 NSe=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 x$e(a){return a===32||a===9}var C$e=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 $ht=class{compute(i,e,t=Y6.instance,o){if(i.length===0||e.length===0)return TU.trivial(i,e);let n=new NSe(i.length,e.length),r=new NSe(i.length,e.length),s=new NSe(i.length,e.length);for(let f=0;f<i.length;f++)for(let v=0;v<e.length;v++){if(!t.isValid())return TU.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 dg(new di(f+1,c),new di(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 TU(l,!1)}};var OSe=class{compute(i,e,t=Y6.instance){if(i.length===0||e.length===0)return TU.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 vXt;l.set(0,r(0,0));let c=new bXt;c.set(0,l.get(0)===0?null:new qht(null,0,0,l.get(0)));let u=0;e:for(;;){if(s++,!t.isValid())return TU.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 N=r(k,T);l.set(u,N);let O=k===y?c.get(u+1):c.get(u-1);if(c.set(u,N!==k?new qht(O,k,T,N-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 dg(new di(v,g),new di(b,f))),!p)break;g=p.x,f=p.y,p=p.prev}return h.reverse(),new TU(h,!1)}},qht=class{constructor(i,e,t,o){this.prev=i;this.x=e;this.y=t;this.length=o}},vXt=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}}},bXt=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 X6=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 di(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=u2i(i>0?this.elements[i-1]:-1),t=u2i(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+=d2i(e),o+=d2i(t),o}translateOffset(i,e="right"){let t=XG(this.firstElementOffsetByLineIdx,n=>n<=i),o=i-this.firstElementOffsetByLineIdx[t];return new Ie(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||!FSe(this.elements[i]))return;let e=i;for(;e>0&&FSe(this.elements[e-1]);)e--;let t=i;for(;t<this.elements.length&&FSe(this.elements[t]);)t++;return new di(e,t)}findSubWordContaining(i){if(i<0||i>=this.elements.length||!FSe(this.elements[i]))return;let e=i;for(;e>0&&FSe(this.elements[e-1])&&!c2i(this.elements[e]);)e--;let t=i;for(;t<this.elements.length&&FSe(this.elements[t])&&!c2i(this.elements[t]);)t++;return new di(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=YG(this.firstElementOffsetByLineIdx,o=>o<=i.start)??0,t=oUi(this.firstElementOffsetByLineIdx,o=>i.endExclusive<=o)??this.elements.length;return new di(e,t)}};function FSe(a){return a>=97&&a<=122||a>=65&&a<=90||a>=48&&a<=57}function c2i(a){return a>=65&&a<=90}var UMo={0:0,1:0,2:0,3:10,4:2,5:30,6:3,7:10,8:10};function d2i(a){return UMo[a]}function u2i(a){return a===10?8:a===13?7:x$e(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 m2i(a,i,e,t,o,n){let{moves:r,excludedChanges:s}=KMo(a,i,e,n);if(!n.isValid())return[];let l=a.filter(u=>!s.has(u)),c=GMo(l,t,o,i,e,n);return e$(r,c),r=$Mo(r),r=r.filter(u=>{let p=u.original.toOffsetRange().slice(i).map(g=>g.trim());return p.join(`
`).length>=15&&zMo(p,g=>g.length>=2)>=2}),r=qMo(a,r),r}function zMo(a,i){let e=0;for(let t of a)i(t)&&e++;return e}function KMo(a,i,e,t){let o=[],n=a.filter(l=>l.modified.isEmpty&&l.original.length>=3).map(l=>new C$e(l.original,i,l)),r=new Set(a.filter(l=>l.original.isEmpty&&l.modified.length>=3).map(l=>new C$e(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 NI(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 GMo(a,i,e,t,o,n){let r=[],s=new KH;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 ro(g,g+3)})}let l=[];a.sort(tl(h=>h.modified.startLineNumber,qd));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 ro(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 ro(k.originalLineRange.startLineNumber,y.endLineNumberExclusive),k.modifiedLineRange=new ro(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(pre(tl(h=>h.modifiedLineRange.length,qd)));let c=new PM,u=new PM;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 NI(w,y)),c.addRange(y),u.addRange(w)}}r.sort(tl(h=>h.original.startLineNumber,qd));let p=new J2e(a);for(let h=0;h<r.length;h++){let g=r[h],f=p.findLastMonotonous(N=>N.original.startLineNumber<=g.original.startLineNumber),v=YG(a,N=>N.modified.startLineNumber<=g.modified.startLineNumber),b=Math.max(g.original.startLineNumber-f.original.startLineNumber,g.modified.startLineNumber-v.modified.startLineNumber),S=p.findLastMonotonous(N=>N.original.startLineNumber<g.original.endLineNumberExclusive),y=YG(a,N=>N.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 N=g.original.startLineNumber-k-1,O=g.modified.startLineNumber-k-1;if(N>t.length||O>o.length||c.contains(O)||u.contains(N)||!p2i(t[N-1],o[O-1],n))break}k>0&&(u.addRange(new ro(g.original.startLineNumber-k,g.original.startLineNumber)),c.addRange(new ro(g.modified.startLineNumber-k,g.modified.startLineNumber)));let T;for(T=0;T<w;T++){let N=g.original.endLineNumberExclusive+T,O=g.modified.endLineNumberExclusive+T;if(N>t.length||O>o.length||c.contains(O)||u.contains(N)||!p2i(t[N-1],o[O-1],n))break}T>0&&(u.addRange(new ro(g.original.endLineNumberExclusive,g.original.endLineNumberExclusive+T)),c.addRange(new ro(g.modified.endLineNumberExclusive,g.modified.endLineNumberExclusive+T))),(k>0||T>0)&&(r[h]=new NI(new ro(g.original.startLineNumber-k,g.original.endLineNumberExclusive+T),new ro(g.modified.startLineNumber-k,g.modified.endLineNumberExclusive+T)))}return r}function p2i(a,i,e){if(a.trim()===i.trim())return!0;if(a.length>300&&i.length>300)return!1;let o=new OSe().compute(new X6([a],new z(1,1,1,a.length),!1),new X6([i],new z(1,1,1,i.length),!1),e),n=0,r=dg.invert(o.diffs,a.length);for(let u of r)u.seq1Range.forEach(p=>{x$e(a.charCodeAt(p))||n++});function s(u){let p=0;for(let h=0;h<a.length;h++)x$e(u.charCodeAt(h))||p++;return p}let l=s(a.length>i.length?a:i);return n/l>.6&&l>10}function $Mo(a){if(a.length===0)return a;a.sort(tl(e=>e.original.startLineNumber,qd));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 qMo(a,i){let e=new J2e(a);return i=i.filter(t=>{let o=e.findLastMonotonous(s=>s.original.startLineNumber<t.original.endLineNumberExclusive)||new NI(new ro(1,1),new ro(1,1)),n=YG(a,s=>s.modified.startLineNumber<t.modified.endLineNumberExclusive);return o!==n}),i}function k$e(a,i,e){let t=e;return t=h2i(a,i,t),t=h2i(a,i,t),t=jMo(a,i,t),t}function h2i(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 dg(new di(r.seq1Range.start,s.seq1Range.endExclusive-l),new di(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 dg(new di(s.seq1Range.start+l,r.seq1Range.endExclusive),new di(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 jMo(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 di(o?o.seq1Range.endExclusive+1:0,r?r.seq1Range.start-1:a.length),l=new di(o?o.seq2Range.endExclusive+1:0,r?r.seq2Range.start-1:i.length);n.seq1Range.isEmpty?e[t]=g2i(n,a,i,s,l):n.seq2Range.isEmpty&&(e[t]=g2i(n.swap(),i,a,l,s).swap())}return e}function g2i(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 f2i(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 dg(n.seq1Range.join(o.seq1Range),n.seq2Range.join(o.seq2Range)):t.push(o)}return t}function SXt(a,i,e,t,o=!1){let n=dg.invert(e,a.length),r=[],s=new EU(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 dg(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),N=new dg(k,T),O=N.intersect(y);if(b+=O.seq1Range.length,S+=O.seq2Range.length,f=f.join(N),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 QMo(e,r)}function QMo(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 v2i(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 di(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 b2i(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 di(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,N=a.countLinesIn(f.seq1Range),O=f.seq1Range.length,V=i.countLinesIn(f.seq2Range),U=f.seq2Range.length,G=130;function $(te){return Math.min(te,G)}return Math.pow(Math.pow($(y*40+w),1.5)+Math.pow($(k*40+T),1.5),1.5)+Math.pow(Math.pow($(N*40+O),1.5)+Math.pow($(V*40+U),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 sUi(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 di(h.start,l.seq1Range.start));p(g)&&(u=u.deltaStart(-g.length));let f=a.getText(new di(l.seq1Range.endExclusive,h.endExclusive));p(f)&&(u=u.deltaEnd(f.length));let v=dg.fromOffsetPairs(s?s.getEndExclusives():EU.zero,c?c.getStarts():EU.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 E$e=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:S2i(this.lines[i-1]),t=i===this.lines.length?0:S2i(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 S2i(a){let i=0;for(;i<a.length&&(a.charCodeAt(i)===32||a.charCodeAt(i)===9);)i++;return i}var WSe=class{constructor(){this.dynamicProgrammingDiffing=new $ht;this.myersDiffingAlgorithm=new OSe}computeDiff(i,e,t){if(i.length<=1&&$i(i,e,(O,V)=>O===V))return new j6([],[],!1);if(i.length===1&&i[0].length===0||e.length===1&&e[0].length===0)return new j6([new wf(new ro(1,i.length+1),new ro(1,e.length+1),[new cg(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?Y6.instance:new Ght(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 E$e(l,i),p=new E$e(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=k$e(u,p,g),g=v2i(u,p,g);let v=[],b=O=>{if(n)for(let V=0;V<O;V++){let U=S+V,G=y+V;if(i[U]!==e[G]){let $=this.refineDiff(i,e,new dg(new di(U,U+1),new di(G,G+1)),o,n,t);for(let te of $.mappings)v.push(te);$.hitTimeout&&(f=!0)}}},S=0,y=0;for(let O of g){eh(()=>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 U=this.refineDiff(i,e,O,o,n,t);U.hitTimeout&&(f=!0);for(let G of U.mappings)v.push(G)}b(i.length-S);let w=new yse(i),k=new yse(e),T=PSe(v,w,k),N=[];return t.computeMoves&&(N=this.computeMoves(T,i,e,l,c,o,n,t)),eh(()=>{function O(U,G){if(U.lineNumber<1||U.lineNumber>G.length)return!1;let $=G[U.lineNumber-1];return!(U.column<1||U.column>$.length+1)}function V(U,G){return!(U.startLineNumber<1||U.startLineNumber>G.length+1||U.endLineNumberExclusive<1||U.endLineNumberExclusive>G.length+1)}for(let U of T){if(!U.innerChanges)return!1;for(let G of U.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(U.modified,e)||!V(U.original,i))return!1}return!0}),new j6(T,N,f)}computeMoves(i,e,t,o,n,r,s,l){return m2i(i,e,t,o,n,r).map(p=>{let h=this.refineDiff(e,t,new dg(p.original.toOffsetRange(),p.modified.toOffsetRange()),r,s,l),g=PSe(h.mappings,new yse(e),new yse(t),!0);return new LSe(p,g)})}refineDiff(i,e,t,o,n,r){let l=YMo(t).toRangeMapping2(i,e),c=new X6(i,l.originalRange,n),u=new X6(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&&dg.assertSorted(g),g=k$e(c,u,g),h&&dg.assertSorted(g),g=SXt(c,u,g,(v,b)=>v.findWordContaining(b)),h&&dg.assertSorted(g),r.extendToSubwords&&(g=SXt(c,u,g,(v,b)=>v.findSubWordContaining(b),!0),h&&dg.assertSorted(g)),g=f2i(c,u,g),h&&dg.assertSorted(g),g=b2i(c,u,g),h&&dg.assertSorted(g);let f=g.map(v=>new cg(c.translateRange(v.seq1Range),u.translateRange(v.seq2Range)));return h&&cg.assertSorted(f),{mappings:f,hitTimeout:p.hitTimeout}}};function YMo(a){return new NI(new ro(a.seq1Range.start+1,a.seq1Range.endExclusive+1),new ro(a.seq2Range.start+1,a.seq2Range.endExclusive+1))}var _U={getLegacy:()=>new zht,getDefault:()=>new WSe};function J6(a,i){let e=Math.pow(10,i);return Math.round(a*e)/e}var Bt=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=J6(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}},DU=class a{constructor(i,e,t,o){this._hslaBrand=void 0;this.h=Math.max(Math.min(360,i),0)|0,this.s=J6(Math.max(Math.min(1,e),0),3),this.l=J6(Math.max(Math.min(1,t),0),3),this.a=J6(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 Bt(Math.round(r*255),Math.round(s*255),Math.round(l*255),n)}},kN=class a{constructor(i,e,t,o){this._hsvaBrand=void 0;this.h=Math.max(Math.min(360,i),0)|0,this.s=J6(Math.max(Math.min(1,e),0),3),this.v=J6(Math.max(Math.min(1,t),0),3),this.a=J6(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 Bt(c,u,p,n)}},Oe=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:DU.fromRGBA(this.rgba)}get hsva(){return this._hsva?this._hsva:kN.fromRGBA(this.rgba)}constructor(i){if(i)if(i instanceof Bt)this.rgba=i;else if(i instanceof DU)this._hsla=i,this.rgba=DU.toRGBA(i);else if(i instanceof kN)this._hsva=i,this.rgba=kN.toRGBA(i);else throw new Error("Invalid color ctor argument");else throw new Error("Color needs a value")}equals(i){return!!i&&Bt.equals(this.rgba,i.rgba)&&DU.equals(this.hsla,i.hsla)&&kN.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 J6(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 Bt(t,o,n)));return new a(new Bt(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 Bt(t,o,n)));return new a(new Bt(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 DU(this.hsla.h,this.hsla.s,this.hsla.l+this.hsla.l*i,this.hsla.a))}darken(i){return new a(new DU(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 Bt(e,t,o,n*i))}isTransparent(){return this.rgba.a===0}isOpaque(){return this.rgba.a===1}opposite(){return new a(new Bt(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 Bt(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 Bt(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 Bt(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 Bt(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 Bt(255,255,255,1))}static{this.black=new a(new Bt(0,0,0,1))}static{this.red=new a(new Bt(255,0,0,1))}static{this.blue=new a(new Bt(0,0,255,1))}static{this.green=new a(new Bt(0,255,0,1))}static{this.cyan=new a(new Bt(0,255,255,1))}static{this.lightgrey=new a(new Bt(211,211,211,1))}static{this.transparent=new a(new Bt(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"),N=parseFloat(y.groups?.a??"0");return new i(new Bt(w,k,T,N))}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 Bt(w,k,T))}return g(S)}b.parse=h;function g(S){switch(S){case"aliceblue":return new i(new Bt(240,248,255,1));case"antiquewhite":return new i(new Bt(250,235,215,1));case"aqua":return new i(new Bt(0,255,255,1));case"aquamarine":return new i(new Bt(127,255,212,1));case"azure":return new i(new Bt(240,255,255,1));case"beige":return new i(new Bt(245,245,220,1));case"bisque":return new i(new Bt(255,228,196,1));case"black":return new i(new Bt(0,0,0,1));case"blanchedalmond":return new i(new Bt(255,235,205,1));case"blue":return new i(new Bt(0,0,255,1));case"blueviolet":return new i(new Bt(138,43,226,1));case"brown":return new i(new Bt(165,42,42,1));case"burlywood":return new i(new Bt(222,184,135,1));case"cadetblue":return new i(new Bt(95,158,160,1));case"chartreuse":return new i(new Bt(127,255,0,1));case"chocolate":return new i(new Bt(210,105,30,1));case"coral":return new i(new Bt(255,127,80,1));case"cornflowerblue":return new i(new Bt(100,149,237,1));case"cornsilk":return new i(new Bt(255,248,220,1));case"crimson":return new i(new Bt(220,20,60,1));case"cyan":return new i(new Bt(0,255,255,1));case"darkblue":return new i(new Bt(0,0,139,1));case"darkcyan":return new i(new Bt(0,139,139,1));case"darkgoldenrod":return new i(new Bt(184,134,11,1));case"darkgray":return new i(new Bt(169,169,169,1));case"darkgreen":return new i(new Bt(0,100,0,1));case"darkgrey":return new i(new Bt(169,169,169,1));case"darkkhaki":return new i(new Bt(189,183,107,1));case"darkmagenta":return new i(new Bt(139,0,139,1));case"darkolivegreen":return new i(new Bt(85,107,47,1));case"darkorange":return new i(new Bt(255,140,0,1));case"darkorchid":return new i(new Bt(153,50,204,1));case"darkred":return new i(new Bt(139,0,0,1));case"darksalmon":return new i(new Bt(233,150,122,1));case"darkseagreen":return new i(new Bt(143,188,143,1));case"darkslateblue":return new i(new Bt(72,61,139,1));case"darkslategray":return new i(new Bt(47,79,79,1));case"darkslategrey":return new i(new Bt(47,79,79,1));case"darkturquoise":return new i(new Bt(0,206,209,1));case"darkviolet":return new i(new Bt(148,0,211,1));case"deeppink":return new i(new Bt(255,20,147,1));case"deepskyblue":return new i(new Bt(0,191,255,1));case"dimgray":return new i(new Bt(105,105,105,1));case"dimgrey":return new i(new Bt(105,105,105,1));case"dodgerblue":return new i(new Bt(30,144,255,1));case"firebrick":return new i(new Bt(178,34,34,1));case"floralwhite":return new i(new Bt(255,250,240,1));case"forestgreen":return new i(new Bt(34,139,34,1));case"fuchsia":return new i(new Bt(255,0,255,1));case"gainsboro":return new i(new Bt(220,220,220,1));case"ghostwhite":return new i(new Bt(248,248,255,1));case"gold":return new i(new Bt(255,215,0,1));case"goldenrod":return new i(new Bt(218,165,32,1));case"gray":return new i(new Bt(128,128,128,1));case"green":return new i(new Bt(0,128,0,1));case"greenyellow":return new i(new Bt(173,255,47,1));case"grey":return new i(new Bt(128,128,128,1));case"honeydew":return new i(new Bt(240,255,240,1));case"hotpink":return new i(new Bt(255,105,180,1));case"indianred":return new i(new Bt(205,92,92,1));case"indigo":return new i(new Bt(75,0,130,1));case"ivory":return new i(new Bt(255,255,240,1));case"khaki":return new i(new Bt(240,230,140,1));case"lavender":return new i(new Bt(230,230,250,1));case"lavenderblush":return new i(new Bt(255,240,245,1));case"lawngreen":return new i(new Bt(124,252,0,1));case"lemonchiffon":return new i(new Bt(255,250,205,1));case"lightblue":return new i(new Bt(173,216,230,1));case"lightcoral":return new i(new Bt(240,128,128,1));case"lightcyan":return new i(new Bt(224,255,255,1));case"lightgoldenrodyellow":return new i(new Bt(250,250,210,1));case"lightgray":return new i(new Bt(211,211,211,1));case"lightgreen":return new i(new Bt(144,238,144,1));case"lightgrey":return new i(new Bt(211,211,211,1));case"lightpink":return new i(new Bt(255,182,193,1));case"lightsalmon":return new i(new Bt(255,160,122,1));case"lightseagreen":return new i(new Bt(32,178,170,1));case"lightskyblue":return new i(new Bt(135,206,250,1));case"lightslategray":return new i(new Bt(119,136,153,1));case"lightslategrey":return new i(new Bt(119,136,153,1));case"lightsteelblue":return new i(new Bt(176,196,222,1));case"lightyellow":return new i(new Bt(255,255,224,1));case"lime":return new i(new Bt(0,255,0,1));case"limegreen":return new i(new Bt(50,205,50,1));case"linen":return new i(new Bt(250,240,230,1));case"magenta":return new i(new Bt(255,0,255,1));case"maroon":return new i(new Bt(128,0,0,1));case"mediumaquamarine":return new i(new Bt(102,205,170,1));case"mediumblue":return new i(new Bt(0,0,205,1));case"mediumorchid":return new i(new Bt(186,85,211,1));case"mediumpurple":return new i(new Bt(147,112,219,1));case"mediumseagreen":return new i(new Bt(60,179,113,1));case"mediumslateblue":return new i(new Bt(123,104,238,1));case"mediumspringgreen":return new i(new Bt(0,250,154,1));case"mediumturquoise":return new i(new Bt(72,209,204,1));case"mediumvioletred":return new i(new Bt(199,21,133,1));case"midnightblue":return new i(new Bt(25,25,112,1));case"mintcream":return new i(new Bt(245,255,250,1));case"mistyrose":return new i(new Bt(255,228,225,1));case"moccasin":return new i(new Bt(255,228,181,1));case"navajowhite":return new i(new Bt(255,222,173,1));case"navy":return new i(new Bt(0,0,128,1));case"oldlace":return new i(new Bt(253,245,230,1));case"olive":return new i(new Bt(128,128,0,1));case"olivedrab":return new i(new Bt(107,142,35,1));case"orange":return new i(new Bt(255,165,0,1));case"orangered":return new i(new Bt(255,69,0,1));case"orchid":return new i(new Bt(218,112,214,1));case"palegoldenrod":return new i(new Bt(238,232,170,1));case"palegreen":return new i(new Bt(152,251,152,1));case"paleturquoise":return new i(new Bt(175,238,238,1));case"palevioletred":return new i(new Bt(219,112,147,1));case"papayawhip":return new i(new Bt(255,239,213,1));case"peachpuff":return new i(new Bt(255,218,185,1));case"peru":return new i(new Bt(205,133,63,1));case"pink":return new i(new Bt(255,192,203,1));case"plum":return new i(new Bt(221,160,221,1));case"powderblue":return new i(new Bt(176,224,230,1));case"purple":return new i(new Bt(128,0,128,1));case"rebeccapurple":return new i(new Bt(102,51,153,1));case"red":return new i(new Bt(255,0,0,1));case"rosybrown":return new i(new Bt(188,143,143,1));case"royalblue":return new i(new Bt(65,105,225,1));case"saddlebrown":return new i(new Bt(139,69,19,1));case"salmon":return new i(new Bt(250,128,114,1));case"sandybrown":return new i(new Bt(244,164,96,1));case"seagreen":return new i(new Bt(46,139,87,1));case"seashell":return new i(new Bt(255,245,238,1));case"sienna":return new i(new Bt(160,82,45,1));case"silver":return new i(new Bt(192,192,192,1));case"skyblue":return new i(new Bt(135,206,235,1));case"slateblue":return new i(new Bt(106,90,205,1));case"slategray":return new i(new Bt(112,128,144,1));case"slategrey":return new i(new Bt(112,128,144,1));case"snow":return new i(new Bt(255,250,250,1));case"springgreen":return new i(new Bt(0,255,127,1));case"steelblue":return new i(new Bt(70,130,180,1));case"tan":return new i(new Bt(210,180,140,1));case"teal":return new i(new Bt(0,128,128,1));case"thistle":return new i(new Bt(216,191,216,1));case"tomato":return new i(new Bt(255,99,71,1));case"turquoise":return new i(new Bt(64,224,208,1));case"violet":return new i(new Bt(238,130,238,1));case"wheat":return new i(new Bt(245,222,179,1));case"white":return new i(new Bt(255,255,255,1));case"whitesmoke":return new i(new Bt(245,245,245,1));case"yellow":return new i(new Bt(255,255,0,1));case"yellowgreen":return new i(new Bt(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 Bt(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)),N=16*v(S.charCodeAt(7))+v(S.charCodeAt(8));return new i(new Bt(w,k,T,N/255))}if(y===4){let w=v(S.charCodeAt(1)),k=v(S.charCodeAt(2)),T=v(S.charCodeAt(3));return new i(new Bt(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)),N=v(S.charCodeAt(4));return new i(new Bt(16*w+w,16*k+k,16*T+T,(16*N+N)/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||={})})(Oe||={});function w2i(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 IXt(a,i,e,t){return{red:a/255,blue:e/255,green:i/255,alpha:t}}function T$e(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 XMo(a,i){if(!a)return;let e=Oe.Format.CSS.parseHex(i);if(e)return{range:a,color:IXt(e.rgba.r,e.rgba.g,e.rgba.b,e.rgba.a)}}function I2i(a,i,e){if(!a||i.length!==1)return;let o=i[0].values(),n=w2i(o);return{range:a,color:IXt(n[0],n[1],n[2],e?n[3]:1)}}function y2i(a,i,e){if(!a||i.length!==1)return;let o=i[0].values(),n=w2i(o),r=new Oe(new DU(n[0],n[1]/100,n[2]/100,e?n[3]:1));return{range:a,color:IXt(r.rgba.r,r.rgba.g,r.rgba.b,r.rgba.a)}}function _$e(a,i){return typeof a=="string"?[...a.matchAll(i)]:a.findMatches(i)}function JMo(a){let i=[],t=_$e(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=I2i(T$e(a,o),_$e(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=I2i(T$e(a,o),_$e(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=y2i(T$e(a,o),_$e(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=y2i(T$e(a,o),_$e(s,c),!0)}else r==="#"&&(l=XMo(T$e(a,o),r+s));l&&i.push(l)}return i}function C2i(a){return!a||typeof a.getValue!="function"||typeof a.positionAt!="function"?[]:JMo(a)}var ZMo=/^-+|-+$/g,x2i=100,ePo=5;function k2i(a,i){let e=[];if(i.findRegionSectionHeaders&&i.foldingRules?.markers){let t=tPo(a,i);e=e.concat(t)}if(i.findMarkSectionHeaders){let t=iPo(a,i);e=e.concat(t)}return e}function tPo(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,...oPo(n.substring(r[0].length)),shouldBeInComments:!1};(l.text||l.hasSeparatorLine)&&e.push(l)}}}return e}function iPo(a,i){let e=[],t=a.getLineCount();if(!i.markSectionHeaderRegex||i.markSectionHeaderRegex.trim()==="")return e;let o=I$e(i.markSectionHeaderRegex),n=new RegExp(i.markSectionHeaderRegex,`gdm${o?"s":""}`);if(xbe(n))return e;for(let r=1;r<=t;r+=x2i-ePo){let s=Math.min(r+x2i-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},N=(u.groups??{}).label??"",O=((u.groups??{}).separator??"")!=="",V={range:T,text:N,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 oPo(a){a=a.trim();let i=a.startsWith("-");return a=a.replace(ZMo,""),{text:a,hasSeparatorLine:i}}var KT=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=Ire(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=Ire(i),e=Ire(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=Ire(i),e=Ire(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=Ire(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 D$e(o,i-r)}},VSe=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 D$e(o,i-n)}let t=e>0?this._prefixSum[e-1]:0;return new D$e(e,i-t)}removeValues(i,e){this._values.splice(i,e),this._invalidate(i)}insertValues(i,e){this._values=UH(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))}},D$e=class{constructor(i,e){this.index=i;this.remainder=e;this._prefixSumIndexOfResultBrand=void 0;this.index=i,this.remainder=e}};var jht=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 Ie(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 KT(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=mc(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 E2i=60*1e3,T2i="workerTextModelSync",Z6=class a extends C{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 EI;n.cancelAndSet(()=>this._checkStopModelSync(),Math.round(E2i/2)),this._register(n)}}static create(e,t){return new a(e.getChannel(T2i),t)}dispose(){for(let e in this._syncedModels)Ue(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]>E2i&&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 P;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],Ue(t)}},Qht=class{constructor(){this._models=Object.create(null)}bindToServer(i){i.setChannel(T2i,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 yXt(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]}},yXt=class extends jht{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 Ie(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=My(i.column,E$(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(!Ie.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 wse=class{constructor(i){this.replacements=i;let e=-1;for(let t of i){if(!(t.replaceRange.start>=e))throw new ni(`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(di.emptyAt(p),new di(0,h));n.push(b)}if(!u)throw new ni("Invariant violation: lastIntersecting is undefined");let g=u.replaceRange.endExclusive+r-s.replaceRange.endExclusive;if(g>0){let b=u.slice(di.ofStartAndLength(u.replaceRange.endExclusive,0),new di(u.getNewLength()-g,u.getNewLength()));o.unshift(b),r-=b.getNewLength()-b.replaceRange.length}let f=new di(p,s.replaceRange.endExclusive-r),v=s.slice(f,new di(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 di(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(di.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 ky(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 di(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 di(e,t)}},BSe=class{constructor(i){this.replaceRange=i}delta(i){return this.slice(this.replaceRange.delta(i),new di(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 di(this.replaceRange.start,this.replaceRange.start+this.getNewLength())}},_2i=class a extends wse{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 USe=class extends wse{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(Hc.replace(di.ofStartAndLength(o.replaceRange.start+t,o.newText.length),i(o.replaceRange.start,o.replaceRange.endExclusive))),t+=o.newText.length-o.replaceRange.length;return new Qc(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)||nPo(l.replaceRange,s.replaceRange)||D2i(l.replaceRange,s.replaceRange)||D2i(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 Hc(c,l.newText)),n++}else o++,r+=s.newText.length-s.replaceRange.length;else{let c=l.replaceRange.delta(r);t.push(new Hc(c,l.newText)),n++}else break}return new Qc(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 Qc(e)}normalizeEOL(i){return new Qc(this.replacements.map(e=>e.normalizeEOL(i)))}normalizeOnSource(i){let e=this.apply(i),o=Hc.replace(di.ofLength(i.length),e).removeCommonSuffixAndPrefix(i);return o.isEmpty?Qc.empty:o.toEdit()}removeCommonSuffixAndPrefix(i){return this._createNew(this.replacements.map(e=>e.removeCommonSuffixAndPrefix(i))).normalize()}applyOnText(i){return new _S(this.apply(i.value))}mapData(i){return new OI(this.replacements.map(e=>new HSe(e.replaceRange,e.newText,i(e))))}},Yht=class extends BSe{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=Ng(t,this.newText),n=Math.min(t.length-o,this.newText.length-o,zw(t,this.newText)),r=new di(this.replaceRange.start+o,this.replaceRange.endExclusive-n),s=this.newText.substring(o,this.newText.length-n);return new Hc(r,s)}normalizeEOL(e){let t=this.newText.replace(/\r\n|\n/g,e);return new Hc(this.replaceRange,t)}removeCommonSuffixAndPrefix(e){return this.removeCommonSuffix(e).removeCommonPrefix(e)}removeCommonPrefix(e){let t=this.replaceRange.substring(e),o=Ng(t,this.newText);return o===0?this:this.slice(this.replaceRange.deltaStart(o),new di(o,this.newText.length))}removeCommonSuffix(e){let t=this.replaceRange.substring(e),o=zw(t,this.newText);return o===0?this:this.slice(this.replaceRange.deltaEnd(-o),new di(0,this.newText.length-o))}toEdit(){return new Qc([this])}toJson(){return{txt:this.newText,pos:this.replaceRange.start,len:this.replaceRange.length}}},Qc=class a extends USe{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 Hc(new di(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 Hc(i,e)])}static insert(i,e){return new a([new Hc(di.emptyAt(i),e)])}static delete(i){return new a([new Hc(i,"")])}static fromJson(i){return new a(i.map(Hc.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)}},Hc=class a extends Yht{static insert(i,e){return new a(di.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(di.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 wXt(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 OI=class a extends USe{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 HSe(i,e,t)])}static insert(i,e,t){return new a([new HSe(di.emptyAt(i),e,t)])}static delete(i,e){return new a([new HSe(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 Hc(t.replaceRange,t.newText));return new Qc(e)}},HSe=class a extends Yht{constructor(e,t,o){super(e,t);this.data=o}static insert(e,t,o){return new a(di.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 nPo(a,i){return a.isEmpty&&i.isEmpty&&a.start===i.start}function D2i(a,i){return a.isEmpty&&i.start<a.start&&a.start<i.endExclusive}r2i({StringEdit:Qc,StringReplacement:Hc,TextReplacement:Xr,TextEdit:bp,TextLength:Zl});var Xht=class a{constructor(i=null){this._foreignModule=i;this._requestHandlerBrand=void 0;this._workerTextModelSyncServer=new Qht}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?Ise.computeUnicodeHighlights(o,e,t):{ranges:[],hasMore:!1,ambiguousCharacterCount:0,invisibleCharacterCount:0,nonBasicAsciiCharacterCount:0}}async $findSectionHeaders(i,e){let t=this._getModel(i);return t?k2i(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"?_U.getDefault():_U.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 w$e(r,s,{shouldComputeCharChanges:!1,shouldPostProcessCharChanges:!1,shouldIgnoreTrimWhitespace:t,shouldMakePrettyDiff:!0,maxComputationTime:1e3}).computeDiff().changes}$computeStringDiff(i,e,t,o){return rPo(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=e2i(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 Ie(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=_U.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 ni("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?i2i(e):null}async $computeDefaultDocumentColors(i){let e=this._getModel(i);return e?C2i(e):null}static{this._suggestionsLimit=1e4}async $textualSuggest(i,e,t,o){let n=new En,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 Wht.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=o2i());function rPo(a,i,e,t){let o=t==="advanced"?_U.getDefault():_U.getLegacy();let n=new _S(a),r=n.getLines(),s=new _S(i),l=s.getLines(),c=o.computeDiff(r,l,{ignoreTrimWhitespace:!1,maxComputationTimeMs:e.maxComputationTimeMs,computeMoves:!1,extendToSubwords:!1}),u=wf.toTextEdit(c.changes,s);return n.getTransformer().getStringEdit(u)}var Nn=ae("textResourceConfigurationService"),sL=ae("textResourcePropertiesService");var zt=ae("ILanguageFeaturesService");var Jht=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 L2i(){return to.defaultChatAgent?.completionsEnablementSetting}function zSe(a,i="*"){let e=L2i();return e?Zht(a.getValue(e),i):!1}function R2i(a,i,e="*"){let t=L2i();return t?Zht(a.getValue(i,t),e):!1}function Zht(a,i="*"){return yi(a)?typeof a[i]<"u"?!!a[i]:!!a["*"]:!1}var M2i=300*1e3;function LU(a,i){let e=a.getModel(i);return!(!e||e.isTooLargeForSyncing())}var e9=class extends C{constructor(e,t,o,n,r,s){super();this._languageConfigurationService=n;this._webWorkerService=s;this._modelService=e,this._workerManager=this._register(new L$e(e9.workerDescriptor,this._modelService,this._webWorkerService)),this._logService=o,this._register(r.linkProvider.register({language:"*",hasAccessToAllModels:!0},{provideLinks:async(l,c)=>{if(!LU(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 CXt(this._workerManager,t,this._modelService,this._languageConfigurationService,this._logService,r)))}static{this.workerDescriptor=new gx({esmModuleLocation:()=>gn.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 LU(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 LSe(new NI(new ro(u[0],u[1]),new ro(u[2],u[3])),c(u[4])))};function c(u){return u.map(p=>new wf(new ro(p[0],p[1]),new ro(p[2],p[3]),p[4]?.map(h=>new cg(new z(h[0],h[1],h[2],h[3]),new z(h[4],h[5],h[6],h[7])))))}}canComputeDirtyDiff(e,t){return LU(this._modelService,e)&&LU(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(dr(t)){if(!LU(this._modelService,e))return Promise.resolve(t);let n=En.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,Pi(1e3).then(()=>t)])}else return Promise.resolve(void 0)}computeHumanReadableDiff(e,t){if(dr(t)){if(!LU(this._modelService,e))return Promise.resolve(t);let o=En.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 Qc.fromJson(s)}catch(r){return mt(r),Qc.replace(di.ofLength(e.length),t)}}canNavigateValueSet(e){return LU(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 LU(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)}};e9=I([m(0,Ct),m(1,Nn),m(2,ne),m(3,bs),m(4,zt),m(5,Ay)],e9);var CXt=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)&&R2i(this._configurationService,i.uri,i.getLanguageId()))return;let o=[];if(t.wordBasedSuggestions==="currentDocument")LU(this._modelService,i.uri)&&o.push(i.uri);else for(let p of this._modelService.getModels())LU(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}}))}}},L$e=class extends C{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 ZD).cancelAndSet(()=>this._checkStopIdleWorker(),Math.round(M2i/2),It),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>M2i&&(this._editorWorkerClient.dispose(),this._editorWorkerClient=null)}withWorker(){return this._lastWorkerUsedTime=new Date().getTime(),this._editorWorkerClient||(this._editorWorkerClient=new R$e(this._workerDescriptor,!1,this._modelService,this._webWorkerService)),Promise.resolve(this._editorWorkerClient)}};L$e=I([m(1,Ct),m(2,Ay)],L$e);var xXt=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")}},R$e=class extends C{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)),Jht.setChannel(this._worker,this._createEditorWorkerHost())}catch(e){Rht(e),this._worker=this._createFallbackLocalWorker()}return this._worker}async _getProxy(){try{let e=this._getOrCreateWorker().proxy;return await e.$ping(),e}catch(e){return Rht(e),this._worker=this._createFallbackLocalWorker(),this._worker.proxy}}_createFallbackLocalWorker(){return new xXt(new Xht(null))}_createEditorWorkerHost(){return{$fhr:(e,t)=>this.fhr(e,t)}}_getOrCreateModelManager(e){return this._modelManager||(this._modelManager=this._register(new Z6(e,this._modelService,this._keepIdleModels))),this._modelManager}async workerWithSyncedResources(e,t=!1){if(this._disposed)return Promise.reject(CI());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}};R$e=I([m(2,Ct),m(3,Ay)],R$e);var RU=ae("markerDecorationsService");var Cse=class{static{this.ID="editor.contrib.markerDecorations"}constructor(i,e){}dispose(){}};Cse=I([m(1,RU)],Cse);we($s,e9,0);go(Cse.ID,Cse,0);var Bg=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=aL(i);this._maxWidth!==e&&(this._maxWidth=e,this.domNode.style.maxWidth=this._maxWidth)}setWidth(i){let e=aL(i);this._width!==e&&(this._width=e,this.domNode.style.width=this._width)}setHeight(i){let e=aL(i);this._height!==e&&(this._height=e,this.domNode.style.height=this._height)}setTop(i){let e=aL(i);this._top!==e&&(this._top=e,this.domNode.style.top=this._top)}setLeft(i){let e=aL(i);this._left!==e&&(this._left=e,this.domNode.style.left=this._left)}setBottom(i){let e=aL(i);this._bottom!==e&&(this._bottom=e,this.domNode.style.bottom=this._bottom)}setRight(i){let e=aL(i);this._right!==e&&(this._right=e,this.domNode.style.right=this._right)}setPaddingTop(i){let e=aL(i);this._paddingTop!==e&&(this._paddingTop=e,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(i){let e=aL(i);this._paddingLeft!==e&&(this._paddingLeft=e,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(i){let e=aL(i);this._paddingBottom!==e&&(this._paddingBottom=e,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(i){let e=aL(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=aL(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=aL(i);this._lineHeight!==e&&(this._lineHeight=e,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(i){let e=aL(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 aL(a){return typeof a=="number"?`${a}px`:a}function or(a){return new Bg(a)}function Pd(a,i){a instanceof Bg?(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 t9=class extends C{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{$r(Me(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 kXt=class extends C{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()}},EXt=class extends C{constructor(e){super();this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._value=this._getPixelRatio(e);let t=this._register(new kXt(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}},TXt=class{constructor(){this.mapWindowIdToPixelRatioMonitor=new Map}_getOrCreatePixelRatioMonitor(i){let e=sg(i),t=this.mapWindowIdToPixelRatioMonitor.get(e);return t||(t=Mp(new EXt(i)),this.mapWindowIdToPixelRatioMonitor.set(e,t),Mp(H.once(Izi)(({vscodeWindowId:o})=>{o===e&&(t?.dispose(),this.mapWindowIdToPixelRatioMonitor.delete(e))}))),t}getInstance(i){return this._getOrCreatePixelRatioMonitor(i)}},Xd=new TXt;var egt=class{constructor(i,e){this.chr=i,this.type=e,this.width=0}fulfill(i){this.width=i}},_Xt=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");Pd(e,this._bareFontInfo),i.appendChild(e);let t=document.createElement("div");Pd(t,this._bareFontInfo),t.style.fontWeight="bold",i.appendChild(t);let o=document.createElement("div");Pd(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 P2i(a,i,e){new _Xt(i,e).read(a)}var DXt=class extends C{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=sg(e),o=this._cache.get(t);return o||(o=new LXt,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!==k7t)continue;let n=new O6(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 O6({pixelRatio:Xd.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 egt(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),N=this._createRequest("\u2E31",0,o,null),O="|/-_ilm%";for(let te=0,pe=O.length;te<pe;te++)this._createRequest(O.charAt(te),0,o,n),this._createRequest(O.charAt(te),1,o,n),this._createRequest(O.charAt(te),2,o,n);P2i(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),U=t.fontFeatureSettings===mx.OFF,G=n[0].width;for(let te=1,pe=n.length;U&&te<pe;te++){let de=G-n[te].width;if(de<-.001||de>.001){U=!1;break}}let $=!0;return U&&k.width!==G&&($=!1),k.width>w.width&&($=!1),new O6({pixelRatio:Xd.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:U,typicalHalfwidthCharacterWidth:r.width,typicalFullwidthCharacterWidth:s.width,canUseHalfwidthRightwardsArrow:$,spaceWidth:l.width,middotWidth:T.width,wsmiddotWidth:N.width,maxDigitWidth:V},!0)}},LXt=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])}},Fy=new DXt;var xse=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 lL(a,i){xse.items.push(new xse(a,i))}function fx(a,i){lL(a,(e,t,o)=>{if(typeof e<"u"){for(let[n,r]of i)if(e===n){o(a,r);return}}})}function A2i(a){xse.items.forEach(i=>i.apply(a))}fx("wordWrap",[[!0,"on"],[!1,"off"]]);fx("lineNumbers",[[!0,"on"],[!1,"off"]]);fx("cursorBlinking",[["visible","solid"]]);fx("renderWhitespace",[[!0,"boundary"],[!1,"none"]]);fx("renderLineHighlight",[[!0,"line"],[!1,"none"]]);fx("acceptSuggestionOnEnter",[[!0,"on"],[!1,"off"]]);fx("tabCompletion",[[!1,"off"],[!0,"onlySnippets"]]);fx("hover",[[!0,{enabled:!0}],[!1,{enabled:!1}]]);fx("parameterHints",[[!0,{enabled:!0}],[!1,{enabled:!1}]]);fx("autoIndent",[[!1,"advanced"],[!0,"full"]]);fx("matchBrackets",[[!0,"always"],[!1,"never"]]);fx("renderFinalNewline",[[!0,"on"],[!1,"off"]]);fx("cursorSmoothCaretAnimation",[[!0,"on"],[!1,"off"]]);fx("occurrencesHighlight",[[!0,"singleFile"],[!1,"off"]]);fx("wordBasedSuggestions",[[!0,"matchingDocuments"],[!1,"off"]]);fx("defaultColorDecorators",[[!0,"auto"],[!1,"never"]]);fx("minimap.autohide",[[!0,"mouseover"],[!1,"none"]]);lL("autoClosingBrackets",(a,i,e)=>{a===!1&&(e("autoClosingBrackets","never"),typeof i("autoClosingQuotes")>"u"&&e("autoClosingQuotes","never"),typeof i("autoSurround")>"u"&&e("autoSurround","never"))});lL("renderIndentGuides",(a,i,e)=>{typeof a<"u"&&(e("renderIndentGuides",void 0),typeof i("guides.indentation")>"u"&&e("guides.indentation",!!a))});lL("highlightActiveIndentGuide",(a,i,e)=>{typeof a<"u"&&(e("highlightActiveIndentGuide",void 0),typeof i("guides.highlightActiveIndentation")>"u"&&e("guides.highlightActiveIndentation",!!a))});var aPo={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"};lL("suggest.filteredTypes",(a,i,e)=>{if(a&&typeof a=="object"){for(let t of Object.entries(aPo))a[t[0]]===!1&&typeof i(`suggest.${t[1]}`)>"u"&&e(`suggest.${t[1]}`,!1);e("suggest.filteredTypes",void 0)}});lL("quickSuggestions",(a,i,e)=>{if(typeof a=="boolean"){let t=a?"on":"off";e("quickSuggestions",{comments:t,strings:t,other:t})}});lL("experimental.stickyScroll.enabled",(a,i,e)=>{typeof a=="boolean"&&(e("experimental.stickyScroll.enabled",void 0),typeof i("stickyScroll.enabled")>"u"&&e("stickyScroll.enabled",a))});lL("experimental.stickyScroll.maxLineCount",(a,i,e)=>{typeof a=="number"&&(e("experimental.stickyScroll.maxLineCount",void 0),typeof i("stickyScroll.maxLineCount")>"u"&&e("stickyScroll.maxLineCount",a))});lL("editor.experimentalEditContextEnabled",(a,i,e)=>{typeof a=="boolean"&&(e("editor.experimentalEditContextEnabled",void 0),typeof i("editor.editContext")>"u"&&e("editor.editContext",a))});lL("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)}});lL("codeActionWidget.includeNearbyQuickfixes",(a,i,e)=>{typeof a=="boolean"&&(e("codeActionWidget.includeNearbyQuickfixes",void 0),typeof i("codeActionWidget.includeNearbyQuickFixes")>"u"&&e("codeActionWidget.includeNearbyQuickFixes",a))});lL("lightbulb.enabled",(a,i,e)=>{typeof a=="boolean"&&e("lightbulb.enabled",a?void 0:"off")});lL("inlineSuggest.edits.codeShifting",(a,i,e)=>{typeof a=="boolean"&&(e("inlineSuggest.edits.codeShifting",void 0),e("inlineSuggest.edits.allowCodeShifting",a?"always":"never"))});lL("hover.enabled",(a,i,e)=>{typeof a=="boolean"&&e("hover.enabled",a?"on":"off")});var RXt=class extends C{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)}},GT=new RXt;function N2i(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 oSe._create(t,o,n,r,s,l,c,i,e)}function LS(a,i,e=!1){let t=zb.fontFamily.validate(a.fontFamily),o=zb.fontWeight.validate(a.fontWeight),n=zb.fontSize.validate(a.fontSize),r=zb.fontLigatures2.validate(a.fontLigatures),s=zb.fontVariations.validate(a.fontVariations),l=zb.lineHeight.validate(a.lineHeight),c=zb.letterSpacing.validate(a.letterSpacing);return oSe._create(t,o,n,r,s,l,c,i,e)}var i9=class extends C{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 jGe;this.isSimpleWidget=e,this.contextMenuId=t,this._containerObserver=this._register(new t9(n,o.dimension)),this._targetWindowId=Me(n).vscodeWindowId,this._rawOptions=O2i(o),this._validatedOptions=kse.validateOptions(this._rawOptions),this.options=this._computeOptions(),this.options.get(19)&&this._containerObserver.startObserving(),this._register($k.onDidChangeZoomLevel(()=>this._recomputeOptions())),this._register(GT.onDidChangeTabFocus(()=>this._recomputeOptions())),this._register(this._containerObserver.onDidChange(()=>this._recomputeOptions())),this._register(Fy.onDidChange(()=>this._recomputeOptions())),this._register(Xd.getInstance(Me(n)).onDidChange(()=>this._recomputeOptions())),this._register(this._accessibilityService.onDidChangeScreenReaderOptimized(()=>this._recomputeOptions())),this._register(nW.onDidChangeInputMode(()=>this._recomputeOptions()))}_recomputeOptions(){let e=this._computeOptions(),t=kse.checkEquals(this.options,e);t!==null&&(this.options=e,this._onDidChangeFast.fire(t),this._onDidChange.fire(t))}_computeOptions(){let e=this._readEnvConfiguration(),t=N2i(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)||GT.getTabFocusMode(),inputMode:nW.getInputMode(),accessibilitySupport:e.accessibilitySupport,glyphMarginDecorationLaneCount:this._glyphMarginDecorationLaneCount,editContextSupported:e.editContextSupported};return kse.computeOptions(this._validatedOptions,n)}_readEnvConfiguration(){return{extraEditorClassName:cPo(),outerWidth:this._containerObserver.getWidth(),outerHeight:this._containerObserver.getHeight(),emptySelectionClipboard:H0||yc,pixelRatio:Xd.getInstance(qv(this._targetWindowId,!0).window).value,editContextSupported:typeof globalThis.EditContext=="function",accessibilitySupport:this._accessibilityService.isScreenReaderOptimized()?2:this._accessibilityService.getAccessibilitySupport()}}_readFontInfo(e){return Fy.readFontInfo(qv(this._targetWindowId,!0).window,e)}getRawOptions(){return this._rawOptions}updateOptions(e){let t=O2i(e);kse.applyUpdate(this._rawOptions,t)&&(this._validatedOptions=kse.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=lPo(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())}};i9=I([m(4,Bi)],i9);function lPo(a){let i=0;for(;a;)a=Math.floor(a/10),i++;return i||1}function cPo(){let a="";return Vb||qUi?(a+="no-minimap-shadow ",a+="enable-user-select "):a+="no-user-select ",it&&(a+="mac "),a}var MXt=class{constructor(){this._values=[]}_read(i){return this._values[i]}get(i){return this._values[i]}_write(i,e){this._values[i]=e}},PXt=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}},kse=class a{static validateOptions(i){let e=new MXt;for(let t of hU){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 PXt;for(let o of hU)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 hU){let r=!a._deepEquals(i._read(n.id),e._read(n.id));t[n.id]=r,r&&(o=!0)}return o?new xmt(t):null}static applyUpdate(i,e){let t=!1;for(let o of hU)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 O2i(a){let i=Xi(a);return A2i(i),i}var vx;(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,U){let G=performance.getEntriesByName(V)[0].duration;U.total+=G,U.min=Math.min(U.min,G),U.max=Math.max(U.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 N(a),N(i),N(e),N(t),o=0,V}O.getAndClearMeasurements=k;function T(V){return{average:V.total/o,max:V.max,min:V.min}}function N(V){V.total=0,V.min=Number.MAX_VALUE,V.max=0}})(vx||={});function pn(a){return a&&typeof a.getEditorType=="function"?a.getEditorType()===P$.ICodeEditor:!1}function Ec(a){return a&&typeof a.getEditorType=="function"?a.getEditorType()===P$.IDiffEditor:!1}function MU(a){return!!a&&typeof a=="object"&&typeof a.onDidChangeActiveEditor=="function"}function ca(a){return pn(a)?a:Ec(a)?a.getModifiedEditor():MU(a)&&pn(a.activeCodeEditor)?a.activeCodeEditor:null}function F2i(a){return pn(a)||Ec(a)?a:null}var KSe=new Map;function W2i(a){return KSe.has(a)}var NXt=class extends C{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=hr(It.document.head,t=>t.textContent=e,this._store))}dispose(){super.dispose(),this._styleSheet=void 0}};function hr(a=It.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===It.document.head){let o=new Set;KSe.set(t,o),e&&e.add(Z(()=>KSe.delete(t)));for(let{window:n,disposables:r}of Gw()){if(n===It)continue;let s=r.add(B2i(t,o,n));e?.add(s)}}return t}function V2i(a){let i=new P;for(let[e,t]of KSe)i.add(B2i(e,t,a));return i}function B2i(a,i,e){let t=new P,o=a.cloneNode(!0);e.document.head.appendChild(o),t.add(Z(()=>o.remove()));for(let n of U2i(a))o.sheet?.insertRule(n.cssText,o.sheet?.cssRules.length);return t.add(MGe.observe(a,t,{childList:!0,subtree:yc,characterData:yc})(()=>{o.textContent=a.textContent})),i.add(o),t.add(Z(()=>i.delete(o))),t}var AXt=null;function H2i(){return AXt||(AXt=hr()),AXt}function U2i(a){return a?.sheet?.rules?a.sheet.rules:a?.sheet?.cssRules?a.sheet.cssRules:[]}function Vh(a,i,e=H2i()){if(!(!e||!i)){e.sheet?.insertRule(`${a} {${i}}`,0);for(let t of KSe.get(e)??[])Vh(a,i,t)}}function EN(a,i=H2i()){if(!i)return;let e=U2i(i),t=[];for(let o=0;o<e.length;o++){let n=e[o];dPo(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 KSe.get(i)??[])EN(a,o)}function dPo(a){return typeof a.selectorText=="string"}function z2i(a){let i=new P,e=i.add(new NXt);return i.add(he(t=>{e.setStyle(a.read(t))})),i}var cL=class{constructor(){this._hooks=new P;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=Me(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 TN(a){return`--vscode-${a.replace(/\./g,"-")}`}function wt(a){return`var(${TN(a)})`}function Ese(a,i){return`var(${TN(a)}, ${i})`}function uPo(a){return a!==null&&typeof a=="object"&&"light"in a&&"dark"in a}var Tse={ColorContribution:"base.contributions.colors"},M$e="default",OXt=class extends C{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:${Oe.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(2592,null)),this.colorSchema.properties[e]={description:o,oneOf:[l,{type:"string",const:M$e,description:d(2593,null)}]},this.colorReferenceSchema.enum.push(e),this.colorReferenceSchema.enumDescriptions.push(o),this._onDidChangeSchema.fire(),e}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=uPo(o.defaults)?o.defaults[t.type]:o.defaults;return $T(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(`
`)}},P$e=new OXt;oe.add(Tse.ColorContribution,P$e);function J(a,i,e,t,o){return P$e.registerColor(a,i,e,t,o)}function GSe(){return P$e}function pPo(a,i){switch(a.op){case 0:return $T(a.value,i)?.darken(a.factor);case 1:return $T(a.value,i)?.lighten(a.factor);case 2:return $T(a.value,i)?.transparent(a.factor);case 7:{let e=$T(a.color,i)||Oe.transparent,t=$T(a.with,i)||Oe.transparent;return e.mix(t,a.ratio)}case 3:{let e=$T(a.background,i);return e?$T(a.value,i)?.makeOpaque(e):$T(a.value,i)}case 4:for(let e of a.values){let t=$T(e,i);if(t)return t}return;case 6:return $T(i.defines(a.if)?a.then:a.else,i);case 5:{let e=$T(a.value,i);if(!e)return;let t=$T(a.background,i);return t?e.isDarkerThan(t)?Oe.getLighterColor(e,t,a.factor).transparent(a.transparency):Oe.getDarkerColor(e,t,a.factor).transparent(a.transparency):e.transparent(a.factor*a.transparency)}default:throw Hr(a)}}function Sp(a,i){return{op:0,value:a,factor:i}}function RS(a,i){return{op:1,value:a,factor:i}}function ei(a,i){return{op:2,value:a,factor:i}}function W$(a,i){return{op:3,value:a,background:i}}function _se(...a){return{op:4,values:a}}function Dse(a,i,e){return{op:6,if:a,then:i,else:e}}function FXt(a,i,e,t){return{op:5,value:a,background:i,factor:e,transparency:t}}function $T(a,i){if(a!==null){if(typeof a=="string")return a[0]==="#"?Oe.fromHex(a):i.getColor(a);if(a instanceof Oe)return a;if(typeof a=="object")return pPo(a,i)}}var Lse="vscode://schemas/workbench-colors",G2i=oe.as(ea.JSONContribution);G2i.registerSchema(Lse,P$e.getColorSchema());var K2i=new Dt(()=>G2i.notifySchemaChanged(Lse),200);P$e.onDidChangeSchema(()=>{K2i.isScheduled()||K2i.schedule()});var ko=J("foreground",{dark:"#CCCCCC",light:"#616161",hcDark:"#FFFFFF",hcLight:"#292929"},d(2348,null)),WXt=J("disabledForeground",{dark:"#CCCCCC80",light:"#61616180",hcDark:"#A5A5A5",hcLight:"#7F7F7F"},d(2345,null)),Rse=J("errorForeground",{dark:"#F48771",light:"#A1260D",hcDark:"#F48771",hcLight:"#B5200D"},d(2346,null)),A$e=J("descriptionForeground",{light:"#717171",dark:ei(ko,.7),hcDark:ei(ko,.7),hcLight:ei(ko,.7)},d(2344,null)),_N=J("icon.foreground",{dark:"#C5C5C5",light:"#424242",hcDark:"#FFFFFF",hcLight:"#292929"},d(2349,null)),Ad=J("focusBorder",{dark:"#007FD4",light:"#0090F1",hcDark:"#F38518",hcLight:"#006BBD"},d(2347,null)),gi=J("contrastBorder",{light:null,dark:null,hcDark:"#6FC3DF",hcLight:"#0F4A85"},d(2343,null)),qs=J("contrastActiveBorder",{light:null,dark:null,hcDark:Ad,hcLight:Ad},d(2342,null)),tgt=J("selection.background",null,d(2350,null)),WI=J("textLink.foreground",{light:"#006AB1",dark:"#3794FF",hcDark:"#21A6FF",hcLight:"#0F4A85"},d(2355,null)),igt=J("textLink.activeForeground",{light:"#006AB1",dark:"#3794FF",hcDark:"#21A6FF",hcLight:"#0F4A85"},d(2354,null)),pFn=J("textSeparator.foreground",{light:"#0000002e",dark:"#ffffff2e",hcDark:Oe.black,hcLight:"#292929"},d(2359,null)),mFn=J("textPreformat.foreground",{light:"#A31515",dark:"#D7BA7D",hcDark:"#FFFFFF",hcLight:"#FFFFFF"},d(2358,null)),hFn=J("textPreformat.background",{light:"#0000001A",dark:"#FFFFFF1A",hcDark:null,hcLight:"#09345f"},d(2356,null)),gFn=J("textPreformat.border",{light:null,dark:null,hcDark:gi,hcLight:null},d(2357,null)),fFn=J("textBlockQuote.background",{light:"#f2f2f2",dark:"#222222",hcDark:null,hcLight:"#F2F2F2"},d(2351,null)),vFn=J("textBlockQuote.border",{light:"#007acc80",dark:"#007acc80",hcDark:Oe.white,hcLight:"#292929"},d(2352,null)),bFn=J("textCodeBlock.background",{light:"#dcdcdc66",dark:"#0a0a0a66",hcDark:Oe.black,hcLight:"#F2F2F2"},d(2353,null));var CFn=J("sash.hoverBorder",Ad,d(2574,null)),rv=J("badge.background",{dark:"#4D4D4D",light:"#C4C4C4",hcDark:Oe.black,hcLight:"#0F4A85"},d(2568,null)),Yw=J("badge.foreground",{dark:Oe.white,light:"#333",hcDark:Oe.white,hcLight:Oe.white},d(2569,null)),$2i=J("activityWarningBadge.foreground",{dark:Oe.white,light:Oe.white,hcDark:Oe.white,hcLight:Oe.white},d(2567,null)),q2i=J("activityWarningBadge.background",{dark:"#B27C00",light:"#B27C00",hcDark:null,hcLight:"#B27C00"},d(2566,null)),VXt=J("activityErrorBadge.foreground",{dark:Oe.black.lighten(.2),light:Oe.white,hcDark:null,hcLight:Oe.black.lighten(.2)},d(2565,null)),BXt=J("activityErrorBadge.background",{dark:"#F14C4C",light:"#E51400",hcDark:null,hcLight:"#F14C4C"},d(2564,null)),PU=J("scrollbar.shadow",{dark:"#000000",light:"#DDDDDD",hcDark:null,hcLight:null},d(2576,null)),o9=J("scrollbarSlider.background",{dark:Oe.fromHex("#797979").transparent(.4),light:Oe.fromHex("#646464").transparent(.4),hcDark:ei(gi,.6),hcLight:ei(gi,.4)},d(2578,null)),AU=J("scrollbarSlider.hoverBackground",{dark:Oe.fromHex("#646464").transparent(.7),light:Oe.fromHex("#646464").transparent(.7),hcDark:ei(gi,.8),hcLight:ei(gi,.8)},d(2579,null)),NU=J("scrollbarSlider.activeBackground",{dark:Oe.fromHex("#BFBFBF").transparent(.4),light:Oe.fromHex("#000000").transparent(.6),hcDark:gi,hcLight:gi},d(2577,null)),xFn=J("scrollbar.background",null,d(2575,null)),j2i=J("progressBar.background",{dark:Oe.fromHex("#0E70C0"),light:Oe.fromHex("#0E70C0"),hcDark:gi,hcLight:gi},d(2573,null)),Q2i=J("chart.line",{dark:"#236B8E",light:"#236B8E",hcDark:"#236B8E",hcLight:"#236B8E"},d(2572,null)),HXt=J("chart.axis",{dark:Oe.fromHex("#BFBFBF").transparent(.4),light:Oe.fromHex("#000000").transparent(.6),hcDark:gi,hcLight:gi},d(2570,null)),Y2i=J("chart.guide",{dark:Oe.fromHex("#BFBFBF").transparent(.2),light:Oe.fromHex("#000000").transparent(.2),hcDark:gi,hcLight:gi},d(2571,null));var qo=J("editor.background",{light:"#ffffff",dark:"#1E1E1E",hcDark:Oe.black,hcLight:Oe.white},d(2388,null)),od=J("editor.foreground",{light:"#333333",dark:"#BBBBBB",hcDark:Oe.white,hcLight:ko},d(2395,null)),LFn=J("editorStickyScroll.background",qo,d(2413,null)),RFn=J("editorStickyScrollGutter.background",qo,d(2415,null)),MFn=J("editorStickyScrollHover.background",{dark:"#2A2D2E",light:"#F0F0F0",hcDark:null,hcLight:Oe.fromHex("#0F4A85").transparent(.1)},d(2416,null)),PFn=J("editorStickyScroll.border",{dark:null,light:null,hcDark:gi,hcLight:gi},d(2414,null)),AFn=J("editorStickyScroll.shadow",PU,d(2417,null)),gm=J("editorWidget.background",{dark:"#252526",light:"#F3F3F3",hcDark:"#0C141F",hcLight:Oe.white},d(2420,null)),dL=J("editorWidget.foreground",ko,d(2422,null)),DN=J("editorWidget.border",{dark:"#454545",light:"#C8C8C8",hcDark:gi,hcLight:gi},d(2421,null)),NFn=J("editorWidget.resizeBorder",null,d(2423,null)),OFn=J("editorError.background",null,d(2390,null),!0),av=J("editorError.foreground",{dark:"#F14C4C",light:"#E51400",hcDark:"#F48771",hcLight:"#B5200D"},d(2391,null)),eGi=J("editorError.border",{dark:null,light:null,hcDark:Oe.fromHex("#E47777").transparent(.8),hcLight:"#B5200D"},d(2424,null)),tGi=J("editorWarning.background",null,d(2418,null),!0),Bh=J("editorWarning.foreground",{dark:"#CCA700",light:"#BF8803",hcDark:"#FFD370",hcLight:"#895503"},d(2419,null)),n9=J("editorWarning.border",{dark:null,light:null,hcDark:Oe.fromHex("#FFCC00").transparent(.8),hcLight:Oe.fromHex("#FFCC00").transparent(.8)},d(2459,null)),FFn=J("editorInfo.background",null,d(2398,null),!0),fm=J("editorInfo.foreground",{dark:"#59a4f9",light:"#0063d3",hcDark:"#59a4f9",hcLight:"#0063d3"},d(2399,null)),r9=J("editorInfo.border",{dark:null,light:null,hcDark:Oe.fromHex("#59a4f9").transparent(.8),hcLight:"#292929"},d(2435,null)),iGi=J("editorHint.foreground",{dark:Oe.fromHex("#eeeeee").transparent(.7),light:"#6c6c6c",hcDark:null,hcLight:null},d(2396,null)),WFn=J("editorHint.border",{dark:null,light:null,hcDark:Oe.fromHex("#eeeeee").transparent(.8),hcLight:"#292929"},d(2430,null)),oGi=J("editorLink.activeForeground",{dark:"#4E94CE",light:Oe.blue,hcDark:Oe.cyan,hcLight:"#292929"},d(2368,null)),sv=J("editor.selectionBackground",{light:"#ADD6FF",dark:"#264F78",hcDark:"#f3f518",hcLight:"#0F4A85"},d(2409,null)),nGi=J("editor.selectionForeground",{light:null,dark:null,hcDark:"#000000",hcLight:Oe.white},d(2410,null)),rGi=J("editor.inactiveSelectionBackground",{light:ei(sv,.5),dark:ei(sv,.5),hcDark:ei(sv,.7),hcLight:ei(sv,.5)},d(2397,null),!0),YSe=J("editor.selectionHighlightBackground",{light:FXt(sv,qo,.3,.6),dark:FXt(sv,qo,.3,.6),hcDark:null,hcLight:null},d(2411,null),!0),VFn=J("editor.selectionHighlightBorder",{light:null,dark:null,hcDark:qs,hcLight:qs},d(2412,null)),BFn=J("editor.compositionBorder",{light:"#000000",dark:"#ffffff",hcLight:"#000000",hcDark:"#ffffff"},d(2389,null)),Pse=J("editor.findMatchBackground",{light:"#A8AC94",dark:"#515C6A",hcDark:null,hcLight:null},d(2392,null)),sGi=J("editor.findMatchForeground",null,d(2394,null)),Kb=J("editor.findMatchHighlightBackground",{light:"#EA5C0055",dark:"#EA5C0055",hcDark:null,hcLight:null},d(2425,null),!0),aGi=J("editor.findMatchHighlightForeground",null,d(2427,null),!0),lGi=J("editor.findRangeHighlightBackground",{dark:"#3a3d4166",light:"#b4b4b44d",hcDark:null,hcLight:null},d(2428,null),!0),HFn=J("editor.findMatchBorder",{light:null,dark:null,hcDark:qs,hcLight:qs},d(2393,null)),LN=J("editor.findMatchHighlightBorder",{light:null,dark:null,hcDark:qs,hcLight:qs},d(2426,null)),cGi=J("editor.findRangeHighlightBorder",{dark:null,light:null,hcDark:ei(qs,.4),hcLight:ei(qs,.4)},d(2429,null),!0),ogt=J("editor.hoverHighlightBackground",{light:"#ADD6FF26",dark:"#264f7840",hcDark:"#ADD6FF26",hcLight:null},d(2434,null),!0),qT=J("editorHoverWidget.background",gm,d(2431,null)),s9=J("editorHoverWidget.foreground",dL,d(2433,null)),OU=J("editorHoverWidget.border",DN,d(2432,null)),UFn=J("editorHoverWidget.statusBarBackground",{dark:RS(qT,.2),light:Sp(qT,.05),hcDark:gm,hcLight:gm},d(2455,null)),ngt=J("editorInlayHint.foreground",{dark:"#969696",light:"#969696",hcDark:Oe.white,hcLight:Oe.black},d(2403,null)),rgt=J("editorInlayHint.background",{dark:ei(rv,.1),light:ei(rv,.1),hcDark:ei(Oe.white,.1),hcLight:ei(rv,.1)},d(2400,null)),dGi=J("editorInlayHint.typeForeground",ngt,d(2405,null)),uGi=J("editorInlayHint.typeBackground",rgt,d(2402,null)),pGi=J("editorInlayHint.parameterForeground",ngt,d(2404,null)),mGi=J("editorInlayHint.parameterBackground",rgt,d(2401,null)),mPo=J("editorLightBulb.foreground",{dark:"#FFCC00",light:"#DDB100",hcDark:"#FFCC00",hcLight:"#007ACC"},d(2408,null)),zFn=J("editorLightBulbAutoFix.foreground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(2407,null)),KFn=J("editorLightBulbAi.foreground",mPo,d(2406,null)),GFn=J("editor.snippetTabstopHighlightBackground",{dark:new Oe(new Bt(124,124,124,.3)),light:new Oe(new Bt(10,50,100,.2)),hcDark:new Oe(new Bt(124,124,124,.3)),hcLight:new Oe(new Bt(10,50,100,.2))},d(2453,null)),$Fn=J("editor.snippetTabstopHighlightBorder",null,d(2454,null)),qFn=J("editor.snippetFinalTabstopHighlightBackground",null,d(2451,null)),jFn=J("editor.snippetFinalTabstopHighlightBorder",{dark:"#525252",light:new Oe(new Bt(10,50,100,.5)),hcDark:"#525252",hcLight:"#292929"},d(2452,null)),$Se=new Oe(new Bt(155,185,85,.2)),qSe=new Oe(new Bt(255,0,0,.2)),Hg=J("diffEditor.insertedTextBackground",{dark:"#9ccc2c33",light:"#9ccc2c40",hcDark:null,hcLight:null},d(2378,null),!0),Cf=J("diffEditor.removedTextBackground",{dark:"#ff000033",light:"#ff000033",hcDark:null,hcLight:null},d(2384,null),!0),F$e=J("diffEditor.insertedLineBackground",{dark:$Se,light:$Se,hcDark:null,hcLight:null},d(2380,null),!0),QFn=J("diffEditor.removedLineBackground",{dark:qSe,light:qSe,hcDark:null,hcLight:null},d(2386,null),!0),YFn=J("diffEditorGutter.insertedLineBackground",null,d(2379,null)),XFn=J("diffEditorGutter.removedLineBackground",null,d(2385,null)),sgt=J("diffEditorOverview.insertedForeground",null,d(2382,null)),agt=J("diffEditorOverview.removedForeground",null,d(2383,null)),JFn=J("diffEditor.insertedTextBorder",{dark:null,light:null,hcDark:"#33ff2eff",hcLight:"#374E06"},d(2381,null)),ZFn=J("diffEditor.removedTextBorder",{dark:null,light:null,hcDark:"#FF008F",hcLight:"#AD0707"},d(2387,null)),e0n=J("diffEditor.border",{dark:null,light:null,hcDark:gi,hcLight:gi},d(2377,null)),hGi=J("diffEditor.diagonalFill",{dark:"#cccccc33",light:"#22222233",hcDark:null,hcLight:null},d(2373,null)),t0n=J("diffEditor.unchangedRegionBackground","sideBar.background",d(2375,null)),i0n=J("diffEditor.unchangedRegionForeground","foreground",d(2376,null)),o0n=J("diffEditor.unchangedCodeBackground",{dark:"#74747429",light:"#b8b8b829",hcDark:null,hcLight:null},d(2374,null)),RN=J("widget.shadow",{dark:ei(Oe.black,.36),light:ei(Oe.black,.16),hcDark:null,hcLight:null},d(2461,null)),jT=J("widget.border",{dark:null,light:null,hcDark:gi,hcLight:gi},d(2460,null)),Mse=J("toolbar.hoverBackground",{dark:"#5a5d5e50",light:"#b8b8b850",hcDark:null,hcLight:null},d(2457,null)),n0n=J("toolbar.hoverOutline",{dark:null,light:null,hcDark:qs,hcLight:qs},d(2458,null)),r0n=J("toolbar.activeBackground",{dark:RS(Mse,.1),light:Sp(Mse,.1),hcDark:null,hcLight:null},d(2456,null)),gGi=J("breadcrumb.foreground",ei(ko,.8),d(2370,null)),fGi=J("breadcrumb.background",qo,d(2369,null)),zXt=J("breadcrumb.focusForeground",{light:Sp(ko,.2),dark:RS(ko,.1),hcDark:RS(ko,.1),hcLight:RS(ko,.1)},d(2370,null)),vGi=J("breadcrumb.activeSelectionForeground",{light:Sp(ko,.2),dark:RS(ko,.1),hcDark:RS(ko,.1),hcLight:RS(ko,.1)},d(2372,null)),KXt=J("breadcrumbPicker.background",gm,d(2371,null)),bGi=.5,X2i=Oe.fromHex("#40C8AE").transparent(bGi),J2i=Oe.fromHex("#40A6FF").transparent(bGi),Z2i=Oe.fromHex("#606060").transparent(.4),GXt=.4,jSe=1,N$e=J("merge.currentHeaderBackground",{dark:X2i,light:X2i,hcDark:null,hcLight:null},d(2440,null),!0),s0n=J("merge.currentContentBackground",ei(N$e,GXt),d(2439,null),!0),O$e=J("merge.incomingHeaderBackground",{dark:J2i,light:J2i,hcDark:null,hcLight:null},d(2442,null),!0),a0n=J("merge.incomingContentBackground",ei(O$e,GXt),d(2441,null),!0),UXt=J("merge.commonHeaderBackground",{dark:Z2i,light:Z2i,hcDark:null,hcLight:null},d(2438,null),!0),l0n=J("merge.commonContentBackground",ei(UXt,GXt),d(2437,null),!0),QSe=J("merge.border",{dark:null,light:null,hcDark:"#C3DF6F",hcLight:"#007ACC"},d(2436,null)),c0n=J("editorOverviewRuler.currentContentForeground",{dark:ei(N$e,jSe),light:ei(N$e,jSe),hcDark:QSe,hcLight:QSe},d(2444,null)),d0n=J("editorOverviewRuler.incomingContentForeground",{dark:ei(O$e,jSe),light:ei(O$e,jSe),hcDark:QSe,hcLight:QSe},d(2446,null)),u0n=J("editorOverviewRuler.commonContentForeground",{dark:ei(UXt,jSe),light:ei(UXt,jSe),hcDark:QSe,hcLight:QSe},d(2443,null)),MN=J("editorOverviewRuler.findMatchForeground",{dark:"#d186167e",light:"#d186167e",hcDark:"#AB5A00",hcLight:"#AB5A00"},d(2445,null),!0),XSe=J("editorOverviewRuler.selectionHighlightForeground","#A0A0A0CC",d(2447,null),!0),SGi=J("problemsErrorIcon.foreground",av,d(2448,null)),IGi=J("problemsWarningIcon.foreground",Bh,d(2450,null)),yGi=J("problemsInfoIcon.foreground",fm,d(2449,null));var a9=J("minimap.findMatchHighlight",Kb,d(2555,null),!0),W$e=J("minimap.selectionOccurrenceHighlight",YSe,d(2559,null),!0),$Xt=J("minimap.selectionHighlight",sv,d(2558,null),!0),wGi=J("minimap.infoHighlight",{dark:fm,light:fm,hcDark:r9,hcLight:r9},d(2557,null)),CGi=J("minimap.warningHighlight",{dark:Bh,light:Bh,hcDark:n9,hcLight:n9},d(2563,null)),xGi=J("minimap.errorHighlight",{dark:new Oe(new Bt(255,18,18,.7)),light:new Oe(new Bt(255,18,18,.7)),hcDark:new Oe(new Bt(255,50,50,1)),hcLight:"#B5200D"},d(2554,null)),kGi=J("minimap.background",null,d(2553,null)),EGi=J("minimap.foregroundOpacity",Oe.fromHex("#000f"),d(2556,null)),v0n=J("minimapSlider.background",ei(o9,.5),d(2561,null)),b0n=J("minimapSlider.hoverBackground",ei(AU,.5),d(2562,null)),S0n=J("minimapSlider.activeBackground",ei(NU,.5),d(2560,null));var JSe=J("charts.foreground",ko,d(2361,null)),lgt=J("charts.lines",ei(ko,.5),d(2363,null)),V$e=J("charts.red",av,d(2366,null)),B$e=J("charts.blue",fm,d(2360,null)),TGi=J("charts.yellow",Bh,d(2367,null)),k0n=J("charts.orange",a9,d(2364,null)),Ase=J("charts.green",{dark:"#89D185",light:"#388A34",hcDark:"#89D185",hcLight:"#374e06"},d(2362,null)),cgt=J("charts.purple",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},d(2365,null));var c9=J("list.focusBackground",null,d(2530,null)),ZSe=J("list.focusForeground",null,d(2531,null)),H$e=J("list.focusOutline",{dark:Ad,light:Ad,hcDark:qs,hcLight:qs},d(2533,null)),_Gi=J("list.focusAndSelectionOutline",null,d(2529,null)),Wy=J("list.activeSelectionBackground",{dark:"#04395E",light:"#0060C0",hcDark:null,hcLight:Oe.fromHex("#0F4A85").transparent(.1)},d(2516,null)),QT=J("list.activeSelectionForeground",{dark:Oe.white,light:Oe.white,hcDark:null,hcLight:null},d(2517,null)),dgt=J("list.activeSelectionIconForeground",null,d(2518,null)),xf=J("list.inactiveSelectionBackground",{dark:"#37373D",light:"#E4E6F1",hcDark:null,hcLight:Oe.fromHex("#0F4A85").transparent(.1)},d(2538,null)),ugt=J("list.inactiveSelectionForeground",null,d(2539,null)),DGi=J("list.inactiveSelectionIconForeground",null,d(2540,null)),pgt=J("list.inactiveFocusBackground",null,d(2536,null)),LGi=J("list.inactiveFocusOutline",null,d(2537,null)),Xk=J("list.hoverBackground",{dark:"#2A2D2E",light:"#F0F0F0",hcDark:Oe.white.transparent(.1),hcLight:Oe.fromHex("#0F4A85").transparent(.1)},d(2534,null)),eIe=J("list.hoverForeground",null,d(2535,null)),mgt=J("list.dropBackground",{dark:"#062F4A",light:"#D6EBFF",hcDark:null,hcLight:null},d(2520,null)),RGi=J("list.dropBetweenBackground",{dark:_N,light:_N,hcDark:null,hcLight:null},d(2521,null)),l9=J("list.highlightForeground",{dark:"#2AAAFF",light:"#0066BF",hcDark:Ad,hcLight:Ad},d(2514,null)),MGi=J("list.focusHighlightForeground",{dark:l9,light:Dse(Wy,l9,"#BBE7FF"),hcDark:l9,hcLight:l9},d(2532,null)),PGi=J("list.invalidItemForeground",{dark:"#B89500",light:"#B89500",hcDark:"#B89500",hcLight:"#B5200D"},d(2515,null)),uL=J("list.errorForeground",{dark:"#F88070",light:"#B01011",hcDark:null,hcLight:null},d(2522,null)),d9=J("list.warningForeground",{dark:"#CCA700",light:"#855F00",hcDark:null,hcLight:null},d(2541,null)),AGi=J("listFilterWidget.background",{light:Sp(gm,0),dark:RS(gm,0),hcDark:gm,hcLight:gm},d(2525,null)),NGi=J("listFilterWidget.outline",{dark:Oe.transparent,light:Oe.transparent,hcDark:"#f38518",hcLight:"#007ACC"},d(2527,null)),OGi=J("listFilterWidget.noMatchesOutline",{dark:"#BE1100",light:"#BE1100",hcDark:gi,hcLight:gi},d(2526,null)),FGi=J("listFilterWidget.shadow",RN,d(2528,null)),WGi=J("list.filterMatchBackground",{dark:Kb,light:Kb,hcDark:null,hcLight:null},d(2523,null)),VGi=J("list.filterMatchBorder",{dark:LN,light:LN,hcDark:gi,hcLight:qs},d(2524,null)),hgt=J("list.deemphasizedForeground",{dark:"#8C8C8C",light:"#8E8E90",hcDark:"#A7A8A9",hcLight:"#666666"},d(2519,null)),tIe=J("tree.indentGuidesStroke",{dark:"#585858",light:"#a9a9a9",hcDark:"#a9a9a9",hcLight:"#a5a5a5"},d(2545,null)),BGi=J("tree.inactiveIndentGuidesStroke",ei(tIe,.4),d(2544,null)),HGi=J("tree.tableColumnsBorder",{dark:"#CCCCCC20",light:"#61616120",hcDark:null,hcLight:null},d(2542,null)),U$e=J("tree.tableOddRowsBackground",{dark:ei(ko,.04),light:ei(ko,.04),hcDark:null,hcLight:null},d(2543,null)),R0n=J("editorActionList.background",gm,d(2510,null)),UGi=J("editorActionList.foreground",dL,d(2513,null)),M0n=J("editorActionList.focusForeground",QT,d(2512,null)),P0n=J("editorActionList.focusBackground",Wy,d(2511,null));var Gb=J("input.background",{dark:"#3C3C3C",light:Oe.white,hcDark:Oe.black,hcLight:Oe.white},d(2483,null)),pL=J("input.foreground",ko,d(2485,null)),Vy=J("input.border",{dark:null,light:null,hcDark:gi,hcLight:gi},d(2484,null)),cW=J("inputOption.activeBorder",{dark:"#007ACC",light:"#007ACC",hcDark:gi,hcLight:gi},d(2482,null)),hPo=J("inputOption.hoverBackground",{dark:"#5a5d5e80",light:"#b8b8b850",hcDark:null,hcLight:null},d(2488,null)),dW=J("inputOption.activeBackground",{dark:ei(Ad,.4),light:ei(Ad,.2),hcDark:Oe.transparent,hcLight:Oe.transparent},d(2486,null)),V$=J("inputOption.activeForeground",{dark:Oe.white,light:Oe.black,hcDark:ko,hcLight:ko},d(2487,null)),u9=J("input.placeholderForeground",{light:ei(ko,.5),dark:ei(ko,.5),hcDark:ei(ko,.7),hcLight:ei(ko,.7)},d(2489,null)),zGi=J("inputValidation.infoBackground",{dark:"#063B49",light:"#D6ECF2",hcDark:Oe.black,hcLight:Oe.white},d(2493,null)),KGi=J("inputValidation.infoForeground",{dark:null,light:null,hcDark:null,hcLight:ko},d(2495,null)),z$e=J("inputValidation.infoBorder",{dark:"#007acc",light:"#007acc",hcDark:gi,hcLight:gi},d(2494,null)),GGi=J("inputValidation.warningBackground",{dark:"#352A05",light:"#F6F5D2",hcDark:Oe.black,hcLight:Oe.white},d(2496,null)),$Gi=J("inputValidation.warningForeground",{dark:null,light:null,hcDark:null,hcLight:ko},d(2498,null)),K$e=J("inputValidation.warningBorder",{dark:"#B89500",light:"#B89500",hcDark:gi,hcLight:gi},d(2497,null)),ggt=J("inputValidation.errorBackground",{dark:"#5A1D1D",light:"#F2DEDE",hcDark:Oe.black,hcLight:Oe.white},d(2490,null)),fgt=J("inputValidation.errorForeground",{dark:null,light:null,hcDark:null,hcLight:ko},d(2492,null)),Nse=J("inputValidation.errorBorder",{dark:"#BE1100",light:"#BE1100",hcDark:gi,hcLight:gi},d(2491,null)),FU=J("dropdown.background",{dark:"#3C3C3C",light:Oe.white,hcDark:Oe.black,hcLight:Oe.white},d(2478,null)),qGi=J("dropdown.listBackground",{dark:null,light:null,hcDark:Oe.black,hcLight:Oe.white},d(2481,null)),Ose=J("dropdown.foreground",{dark:"#F0F0F0",light:ko,hcDark:Oe.white,hcLight:ko},d(2480,null)),PN=J("dropdown.border",{dark:FU,light:"#CECECE",hcDark:gi,hcLight:gi},d(2479,null)),YT=J("button.foreground",Oe.white,d(2464,null)),vgt=J("button.separator",ei(YT,.4),d(2470,null)),MS=J("button.background",{dark:"#0E639C",light:"#007ACC",hcDark:Oe.black,hcLight:"#0F4A85"},d(2462,null)),B$=J("button.hoverBackground",{dark:RS(MS,.2),light:Sp(MS,.2),hcDark:MS,hcLight:MS},d(2465,null)),oIe=J("button.border",gi,d(2463,null)),Fse=J("button.secondaryForeground",{dark:ko,light:ko,hcDark:Oe.white,hcLight:ko},d(2468,null)),H$=J("button.secondaryBackground",{dark:Xk,light:Xk,hcDark:null,hcLight:Oe.white},d(2466,null)),H0n=J("button.secondaryBorder",gi,d(2467,null)),Wse=J("button.secondaryHoverBackground",{dark:RS(Xk,.2),light:RS(Xk,.2),hcDark:null,hcLight:null},d(2469,null)),iIe=J("radio.activeForeground",V$,d(2504,null)),jGi=J("radio.activeBackground",dW,d(2505,null)),QGi=J("radio.activeBorder",cW,d(2503,null)),YGi=J("radio.inactiveForeground",null,d(2509,null)),XGi=J("radio.inactiveBackground",null,d(2507,null)),JGi=J("radio.inactiveBorder",{light:ei(iIe,.2),dark:ei(iIe,.2),hcDark:ei(iIe,.4),hcLight:ei(iIe,.2)},d(2508,null)),ZGi=J("radio.inactiveHoverBackground",hPo,d(2506,null)),nIe=J("checkbox.background",FU,d(2471,null)),U0n=J("checkbox.selectBackground",gm,d(2476,null)),rIe=J("checkbox.foreground",Ose,d(2475,null)),bgt=J("checkbox.border",PN,d(2472,null)),z0n=J("checkbox.selectBorder",_N,d(2477,null)),e$i=J("checkbox.disabled.background",{op:7,color:nIe,with:rIe,ratio:.33},d(2473,null)),t$i=J("checkbox.disabled.foreground",{op:7,color:rIe,with:nIe,ratio:.33},d(2474,null)),i$i=J("keybindingLabel.background",{dark:new Oe(new Bt(128,128,128,.17)),light:new Oe(new Bt(221,221,221,.4)),hcDark:Oe.transparent,hcLight:Oe.transparent},d(2499,null)),o$i=J("keybindingLabel.foreground",{dark:Oe.fromHex("#CCCCCC"),light:Oe.fromHex("#555555"),hcDark:Oe.white,hcLight:ko},d(2502,null)),n$i=J("keybindingLabel.border",{dark:new Oe(new Bt(51,51,51,.6)),light:new Oe(new Bt(204,204,204,.4)),hcDark:new Oe(new Bt(111,195,223)),hcLight:gi},d(2500,null)),r$i=J("keybindingLabel.bottomBorder",{dark:new Oe(new Bt(68,68,68,.6)),light:new Oe(new Bt(187,187,187,.4)),hcDark:new Oe(new Bt(111,195,223)),hcLight:ko},d(2501,null));var s$i=J("menu.border",{dark:null,light:null,hcDark:gi,hcLight:gi},d(2547,null)),a$i=J("menu.foreground",Ose,d(2548,null)),l$i=J("menu.background",FU,d(2546,null)),Q0n=J("menu.selectionForeground",QT,d(2551,null)),Y0n=J("menu.selectionBackground",Wy,d(2549,null)),c$i=J("menu.selectionBorder",{dark:null,light:null,hcDark:qs,hcLight:qs},d(2550,null)),d$i=J("menu.separatorBackground",{dark:"#606060",light:"#D4D4D4",hcDark:gi,hcLight:gi},d(2552,null));var sIe=J("quickInput.background",gm,d(2580,null)),Sgt=J("quickInput.foreground",dL,d(2581,null)),p$i=J("quickInputTitle.background",{dark:new Oe(new Bt(255,255,255,.105)),light:new Oe(new Bt(0,0,0,.06)),hcDark:"#000000",hcLight:Oe.white},d(2584,null)),Igt=J("pickerGroup.foreground",{dark:"#3794FF",light:"#0066BF",hcDark:Oe.white,hcLight:"#0F4A85"},d(2583,null)),m$i=J("pickerGroup.border",{dark:"#3F3F46",light:"#CCCEDB",hcDark:Oe.white,hcLight:"#0F4A85"},d(2582,null)),u$i=J("quickInput.list.focusBackground",null,"",void 0,d(2585,null)),WU=J("quickInputList.focusForeground",QT,d(2587,null)),aIe=J("quickInputList.focusIconForeground",dgt,d(2588,null)),VU=J("quickInputList.focusBackground",{dark:_se(u$i,Wy),light:_se(u$i,Wy),hcDark:null,hcLight:null},d(2586,null));var sWn=J("search.resultsInfoForeground",{light:ko,dark:ei(ko,.65),hcDark:ko,hcLight:ko},d(2589,null)),aWn=J("searchEditor.findMatchBackground",{light:ei(Kb,.66),dark:ei(Kb,.66),hcDark:Kb,hcLight:Kb},d(2591,null)),lWn=J("searchEditor.findMatchBorder",{light:ei(LN,.66),dark:ei(LN,.66),hcDark:LN,hcLight:LN},d(2590,null));var U$=class{constructor(i,e){this.x=i;this.y=e;this._pageCoordinatesBrand=void 0}toClientCoordinates(i){return new G$e(this.x-i.scrollX,this.y-i.scrollY)}},G$e=class{constructor(i,e){this.clientX=i;this.clientY=e;this._clientCoordinatesBrand=void 0}toPageCoordinates(i){return new U$(this.clientX+i.scrollX,this.clientY+i.scrollY)}},jXt=class{constructor(i,e,t,o){this.x=i;this.y=e;this.width=t;this.height=o;this._editorPagePositionBrand=void 0}},QXt=class{constructor(i,e){this.x=i;this.y=e;this._positionRelativeToEditorBrand=void 0}};function lIe(a){let i=Yn(a);return new jXt(i.left,i.top,i.width,i.height)}function cIe(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 QXt(n,r)}var mL=class extends yn{constructor(e,t,o){super(Me(o),e);this._editorMouseEventBrand=void 0;this.isFromPointerCapture=t,this.pos=new U$(this.posx,this.posy),this.editorPos=lIe(o),this.relativePos=cIe(o,this.editorPos,this.pos)}},ygt=class{constructor(i){this._editorViewDomNode=i}_create(i){return new mL(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)))}},wgt=class{constructor(i){this._editorViewDomNode=i}_create(i){return new mL(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)))}},Cgt=class extends C{constructor(i){super(),this._editorViewDomNode=i,this._globalPointerMoveMonitor=this._register(new cL),this._keydownListener=null}startMonitoring(i,e,t,o,n){this._keydownListener=Vo(i.ownerDocument,"keydown",r=>{r.toKeyCodeChord().isModifierKey()||this._globalPointerMoveMonitor.stopMonitoring(!0,r.browserEvent)},!0),this._globalPointerMoveMonitor.startMonitoring(i,e,t,r=>{o(new mL(r,!0,this._editorViewDomNode))},r=>{this._keydownListener.dispose(),n(r)})}stopMonitoring(){this._globalPointerMoveMonitor.stopMonitoring(!0)}},p9=class a{constructor(i){this._editor=i;this._instanceId=++a._idPool;this._counter=0;this._rules=new jt;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 YXt(e,`dyn-rule-${this._instanceId}-${o}`,x$(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)}},YXt=class{constructor(i,e,t,o){this.key=i;this.className=e;this.properties=o;this._referenceCount=0;this._styleElementDisposables=new P,this._styleElement=hr(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=wt(n.id):r=n;let s=gPo(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 gPo(a){return a.replace(/(^[A-Z])/,([i])=>i.toLowerCase()).replace(/([A-Z])/g,([i])=>`-${i.toLowerCase()}`)}var Jk=class extends C{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 mu=class extends Jk{constructor(i){super(),this._context=i,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),super.dispose()}onBeforeRender(i){}};var PS=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 XXt=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()}},xgt=class extends XXt{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}},dIe=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}},m9=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}]`}},NM=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}},uIe=class{constructor(i,e){this.outsideRenderedLine=i,this.originalLeft=e,this.left=Math.round(this.originalLeft)}},Vse=class{constructor(i,e){this.outsideRenderedLine=i;this.ranges=e}};var Bse=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(NM.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 NM(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 pIe=class{constructor(i,e){this._viewModelDecorationBrand=void 0;this.range=i,this.options=e}};function $$e(a,i){return!(i.options.hideInCommentTokens&&kgt(a,i)||i.options.hideInStringTokens&&Egt(a,i))}function kgt(a,i){return h$i(a,i.range,e=>e===1)}function Egt(a,i){return h$i(a,i.range,e=>e===2)}function h$i(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 Zk=class{constructor(i,e,t){this.range=i;this.inlineClassName=e;this.type=t}},Tgt=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(!$$e(this.model,g))continue;let v=this._getOrCreateViewModelDecoration(g),b=v.range;if(s[l++]=v,f.inlineClassName){let S=new Zk(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 Zk(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 Zk(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 Ie(o.startLineNumber,1),0,!1,!0),l=this.coordinatesConverter.convertModelPositionToViewPosition(new Ie(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 pIe(r,n),this._decorationsCache[e]=t}return t}},_gt=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),N=v.inlineClassNameAffectsLetterSpacing?3:0;c.push(new Zk(T,v.inlineClassName,N))}}}if(f<=p)o+=h,n++;else break}}return t}};var ug=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 Jv=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}},Dgt=class{constructor(i,e,t,o){this.startOffset=i,this.endOffset=e,this.className=t,this.metadata=o}},JXt=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 Dgt(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 Dgt(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++}},Lgt=class{static normalize(i,e){if(e.length===0)return[];let t=[],o=new JXt,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);Ru(v)&&c--}if(u>1){let v=i.charCodeAt(u-2);Ru(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 hL=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,N=!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(Jv.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((U,G)=>U.start<G.start?-1:1),this.renderNewLineWhenEmpty=N,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&&Jv.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 q$e=class{constructor(i,e){this.partIndex=i;this.charIndex=e}},j$e=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 q$e(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 Hse=class{constructor(i,e){this._renderLineOutputBrand=void 0;this.characterMapping=i,this.containsForeignElements=e}};function uW(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 j$e(1,e+t);return n.setColumnInfo(1,e,0,0),new Hse(n,o)}return a.renderNewLineWhenEmpty?i.appendString(`<span><span>
</span></span>`):i.appendString("<span><span></span></span>"),new Hse(new j$e(0,0),0)}return kPo(bPo(a),i)}var ZXt=class{constructor(i,e,t){this.characterMapping=i;this.html=e;this.containsForeignElements=t}};function g$i(a){let i=new ES(1e4),e=uW(a,i);return new ZXt(e.characterMapping,i.build(),e.containsForeignElements)}var eJt=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 bPo(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=SPo(i,a.containsRTL,a.lineTokens,a.fauxIndentLength,o);a.renderControlCharacters&&!a.isBasicASCII&&(n=wPo(i,n)),(a.renderWhitespace===4||a.renderWhitespace===1||a.renderWhitespace===2&&a.selectionsOnLine||a.renderWhitespace===3&&!a.continuesWithWrappedLine)&&(n=CPo(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=xPo(i,o,n,a.lineDecorations)}return a.containsRTL?n=yPo(i,n):n=IPo(i,n,!a.isBasicASCII||a.fontLigatures),new eJt(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 SPo(a,i,e,t,o){let n=[],r=0;t>0&&(n[r++]=new ug(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?yM(a.substring(s,o)):!1;n[r++]=new ug(o,p,0,g);break}let h=i?yM(a.substring(s,u)):!1;n[r++]=new ug(u,p,0,h),s=u}return n}function IPo(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 ug(g+1,u,p,h),f=g+1,g=-1);f!==c&&(o[n++]=new ug(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 ug(b,p,h,g)}o[n++]=new ug(c,p,h,g)}else o[n++]=l;t=c}return o}function yPo(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 ug(o,e.type,e.metadata,!1)),n.push(new ug(t,e.type,e.metadata,e.containsRTL));for(let r=1;r<i.length;r++)n.push(i[r]);return n}function f$i(a){return a<32?a!==9:a===127||a>=8234&&a<=8238||a>=8294&&a<=8297||a>=8206&&a<=8207||a===1564}function wPo(a,i){let e=[],t=new ug(0,"",0,!1),o=0;for(let n of i){let r=n.endIndex;for(;o<r;o++){let s=a.charCodeAt(o);f$i(s)&&(o>t.endIndex&&(t=new ug(o,n.type,n.metadata,n.containsRTL),e.push(t)),t=new ug(o+1,"mtkcontrol",n.metadata,!1),e.push(t))}o>t.endIndex&&(t=new ug(r,n.type,n.metadata,n.containsRTL),e.push(t))}return e}function CPo(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=Ap(i),N;T===-1?(k=!0,T=e,N=e):N=tv(i);let O=!1,V=0,U=c&&c[V],G=s%r;for(let te=n;te<e;te++){let pe=i.charCodeAt(te);U&&U.endExclusive<=te&&(V++,U=c&&c[V]);let de;if(te<T||te>N)de=!0;else if(pe===9)de=!0;else if(pe===32)if(u)if(O)de=!0;else{let se=te+1<e?i.charCodeAt(te+1):0;de=se===32||se===9}else de=!0;else de=!1;if(de&&c&&(de=!!U&&U.start<=te&&te<U.endExclusive),de&&p&&(de=k||te>N),de&&S&&te>=T&&te<=N&&(de=!1),O){if(!de||!l&&G>=r){if(h){let se=f>0?g[f-1].endIndex:n;for(let Se=se+1;Se<=te;Se++)g[f++]=new ug(Se,"mtkw",1,!1)}else g[f++]=new ug(te,"mtkw",1,!1);G=G%r}}else(te===y||de&&te>n)&&(g[f++]=new ug(te,b,0,S),G=G%r);for(pe===9?G=r:AT(pe)?G+=2:G++,O=de;te===y&&(v++,v<w);)b=t[v].type,S=t[v].containsRTL,y=t[v].endIndex}let $=!1;if(O)if(o&&u){let te=e>0?i.charCodeAt(e-1):0,pe=e>1?i.charCodeAt(e-2):0;te===32&&pe!==32&&pe!==9||($=!0)}else $=!0;if($)if(h){let te=f>0?g[f-1].endIndex:n;for(let pe=te+1;pe<=e;pe++)g[f++]=new ug(pe,"mtkw",1,!1)}else g[f++]=new ug(e,"mtkw",1,!1);else g[f++]=new ug(e,b,0,S);return g}function xPo(a,i,e,t){t.sort(Jv.compare);let o=Lgt.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 ug(c,v,b,S)),y.endOffset+1<=f)c=y.endOffset+1,s[l++]=new ug(c,v+" "+y.className,b|y.metadata,S),r++;else{c=f,s[l++]=new ug(c,v+" "+y.className,b|y.metadata,S);break}}f>c&&(c=f,s[l++]=new ug(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 ug(c,p.className,p.metadata,!1),r++}return s}function kPo(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 j$e(r+1,c.length),y=!1,w=0,k=h,T=0,N=0,O=0;i.appendString("<span>");for(let V=0,U=c.length;V<U;V++){let G=c[V],$=G.endIndex,te=G.type,pe=G.containsRTL,de=v!==0&&G.isWhitespace(),se=de&&!e&&(te==="mtkw"||!o),Se=w===$&&G.isPseudoAfter();if(T=0,i.appendString("<span "),pe&&i.appendString('style="unicode-bidi:isolate" '),i.appendString('class="'),i.appendString(se?"mtkz":te),i.appendASCIICharCode(34),de){let ke=0;{let Ee=w,He=k;for(;Ee<$;Ee++){let Fe=(n.charCodeAt(Ee)===9?p-He%p:1)|0;ke+=Fe,Ee>=u&&(He+=Fe)}}for(se&&(i.appendString(' style="width:'),i.appendString(String(g*ke)),i.appendString('px"')),i.appendASCIICharCode(62);w<$;w++){S.setColumnInfo(w+1,V-O,T,N),O=0;let Ee=n.charCodeAt(w),He,Ve;if(Ee===9){He=p-k%p|0,Ve=He,!t||Ve>1?i.appendCharCode(8594):i.appendCharCode(65515);for(let Fe=2;Fe<=Ve;Fe++)i.appendCharCode(160)}else He=2,Ve=1,i.appendCharCode(f),i.appendCharCode(8204);T+=He,N+=Ve,w>=u&&(k+=Ve)}}else for(i.appendASCIICharCode(62);w<$;w++){S.setColumnInfo(w+1,V-O,T,N),O=0;let ke=n.charCodeAt(w),Ee=1,He=1;switch(ke){case 9:Ee=p-k%p,He=Ee;for(let Ve=1;Ve<=Ee;Ve++)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:AT(ke)&&He++,b&&ke<32?i.appendCharCode(9216+ke):b&&ke===127?i.appendCharCode(9249):b&&f$i(ke)?(i.appendString("[U+"),i.appendString(EPo(ke)),i.appendString("]"),Ee=8,He=Ee):i.appendCharCode(ke)}T+=Ee,N+=He,w>=u&&(k+=He)}Se?O++:O=0,w>=r&&!y&&G.isPseudoAfter()&&(y=!0,S.setColumnInfo(w+1,V,T,N)),i.appendString("</span>")}return y||S.setColumnInfo(r+1,c.length-1,T,N),s&&(i.appendString('<span class="mtkoverflow">'),i.appendString(d(960,null,TPo(l))),i.appendString("</span>")),i.appendString("</span>"),new Hse(S,o)}function EPo(a){return a.toString(16).toUpperCase().padStart(4,"0")}function TPo(a){return a<1024?d(959,null,a):a<1024*1024?`${(a/1024).toFixed(1)} KB`:`${(a/1024/1024).toFixed(1)} MB`}function Ug(a){return a==="hcDark"||a==="hcLight"}function Ip(a){return a==="dark"||a==="hcDark"}var _Po=(function(){return kr?!0:!(Wn||yc||Vb)})(),hIe=!0,pW=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=or(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 Ug(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=Jv.filter(r.inlineDecorations,i,r.minColumn,r.maxColumn),c=s.experimentalWhitespaceRendering==="off"?s.renderWhitespace:"none",u=!r.hasVariableFonts,p=null;if(Ug(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&&(Ug(s.themeType)&&l.push(new Jv(S,y,"inline-selected-text",0)),c==="selection"&&(p||(p=[]),p.push(new di(S-1,y-1))))}}let h=new hL(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!==mx.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=uW(h,n);n.appendString("</div>");let f=null;return u&&hIe&&_Po&&r.isBasicASCII&&h.isLTR&&s.useMonospaceOptimizations&&g.containsForeignElements===0&&(f=new mIe(this._renderedViewLine?this._renderedViewLine.domNode:null,h,g.characterMapping)),f||(f=v$i(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 mIe:!1}monospaceAssumptionsAreValid(){return this._renderedViewLine&&this._renderedViewLine instanceof mIe?this._renderedViewLine.monospaceAssumptionsAreValid():hIe}onMonospaceAssumptionsInvalidated(){this._renderedViewLine&&this._renderedViewLine instanceof mIe&&(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 Vse(!0,[new NM(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 Vse(!1,r):null}getColumnOfNodeOffset(i,e){return this._renderedViewLine?this._renderedViewLine.getColumnOfNodeOffset(i,e):1}resetCachedWidth(){this._renderedViewLine?.resetCachedWidth()}};var mIe=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 hIe;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!"),hIe=!1)}return hIe}toSlowRenderedLine(){return v$i(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 NM(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=Bse.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 K$(this._characterMapping,i,e)}},Rgt=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 NM(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 NM(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=Bse.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=Bse.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 NM(0,this.getWidth(o))];let n=this._characterMapping.getDomPosition(e),r=this._characterMapping.getDomPosition(t);return Bse.readHorizontalRanges(this._getReadingTarget(i),n.partIndex,n.charIndex,r.partIndex,r.charIndex,o)}getColumnOfNodeOffset(i,e){return K$(this._characterMapping,i,e)}},tJt=class extends Rgt{_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}},v$i=(function(){return H0?DPo:LPo})();function DPo(a,i,e,t){return new tJt(a,i,e,t)}function LPo(a,i,e,t){return new Rgt(a,i,e,t)}function K$(a,i,e){let t=i.textContent.length,o=-1;for(;i;)i=i.previousSibling,o++;return a.getColumn(new q$e(o,e),t)}var BU=class{constructor(i=null){this.hitTarget=i;this.type=0}},Mgt=class{constructor(i,e,t){this.position=i;this.spanNode=e;this.injectedText=t;this.type=1}get hitTarget(){return this.spanNode}},gIe;(i=>{function a(e,t,o){let n=e.getPositionFromDOMInfo(t,o);return n?new Mgt(n,t,null):new BU(t)}i.createFromDOMInfo=a})(gIe||={});var Pgt=class{constructor(i,e){this.lastViewCursorsRenderData=i;this.lastTextareaPosition=e}},lv=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)}},By=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}},fIe=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 Ie(t.afterLineNumber+1,1)),t.afterLineNumber>0&&(r=new Ie(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()}},iJt=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,vIe._getMouseColumn(this.mouseContentHorizontalOffset,i.typicalHalfwidthCharacterWidth))}},oJt=class extends iJt{constructor(e,t,o,n,r){super(e,t,o,n);this.hitTestResult=new co(()=>vIe.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=PS.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)?al.visibleColumnFromColumn(this._ctx.viewModel.getLineContent(e.lineNumber),e.column,this._ctx.viewModel.model.getOptions().tabSize)+1:this.mouseColumn}fulfillUnknown(e=null){return lv.createUnknown(this.target,this._getMouseColumn(e),e)}fulfillTextarea(){return lv.createTextarea(this.target,this._getMouseColumn())}fulfillMargin(e,t,o,n){return lv.createMargin(e,this.target,this._getMouseColumn(t),t,o,n)}fulfillViewZone(e,t,o){return lv.createViewZone(e,this.target,this._getMouseColumn(),t,o)}fulfillContentText(e,t,o){return lv.createContentText(this.target,this._getMouseColumn(e),e,t,o)}fulfillContentEmpty(e,t){return lv.createContentEmpty(this.target,this._getMouseColumn(e),e,t)}fulfillContentWidget(e){return lv.createContentWidget(this.target,this._getMouseColumn(),e)}fulfillScrollbar(e){return lv.createScrollbar(this.target,this._getMouseColumn(e),e)}fulfillOverlayWidget(e){return lv.createOverlayWidget(this.target,this._getMouseColumn(),e)}},b$i={isAfterLines:!0};function Use(a){return{isAfterLines:!1,horizontalDistanceToText:a}}var vIe=class a{constructor(i,e){this._context=i,this._viewHelper=e}mouseTargetIsWidget(i){let e=i.target,t=PS.collect(e,this._viewHelper.viewDomNode);return!!(By.isChildOfContentWidgets(t)||By.isChildOfOverflowingContentWidgets(t)||By.isChildOfOverlayWidgets(t)||By.isChildOfOverflowingOverlayWidgets(t))}createMouseTarget(i,e,t,o,n){let r=new fIe(this._context,this._viewHelper,i),s=new oJt(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!By.isChildOfOverflowGuard(e.targetPath)&&!By.isChildOfOverflowingContentWidgets(e.targetPath)&&!By.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(By.isChildOfContentWidgets(e.targetPath)||By.isChildOfOverflowingContentWidgets(e.targetPath)){let t=i.findAttribute(e.target,"widgetId");return t?e.fulfillContentWidget(t):e.fulfillUnknown()}return null}static _hitTestOverlayWidget(i,e){if(By.isChildOfOverlayWidgets(e.targetPath)||By.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 By.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(!By.isChildOfViewLines(e.targetPath))return null;if(i.isInTopPadding(e.mouseVerticalOffset))return e.fulfillContentEmpty(new Ie(1,1),b$i);if(i.isAfterLines(e.mouseVerticalOffset)||i.isInBottomPadding(e.mouseVerticalOffset)){let o=i.viewModel.getLineCount(),n=i.viewModel.getLineMaxColumn(o);return e.fulfillContentEmpty(new Ie(o,n),b$i)}if(By.isStrictChildOfViewLines(e.targetPath)){let o=i.getLineNumberAtVerticalOffset(e.mouseVerticalOffset),n=i.viewModel.getLineLength(o),r=i.getLineWidth(o);if(n===0){let l=Use(e.mouseContentHorizontalOffset-r);return e.fulfillContentEmpty(new Ie(o,1),l)}if(i.isRtl(o)){if(e.mouseContentHorizontalOffset+r<=i.layoutInfo.contentWidth-i.layoutInfo.verticalScrollbarWidth){let l=Use(e.mouseContentHorizontalOffset-r),c=new Ie(o,i.viewModel.getLineMaxColumn(o));return e.fulfillContentEmpty(c,l)}}else if(e.mouseContentHorizontalOffset>=r){let l=Use(e.mouseContentHorizontalOffset-r),c=new Ie(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=Use(e.mouseContentHorizontalOffset-l);return e.fulfillContentEmpty(new Ie(o,1),c)}let n=i.getLineWidth(o);if(i.isRtl(o)){if(e.mouseContentHorizontalOffset+n<=i.layoutInfo.contentWidth-i.layoutInfo.verticalScrollbarWidth){let l=Use(e.mouseContentHorizontalOffset-n),c=new Ie(o,i.viewModel.getLineMaxColumn(o));return e.fulfillContentEmpty(c,l)}}else if(e.mouseContentHorizontalOffset>=n){let l=Use(e.mouseContentHorizontalOffset-n),c=new Ie(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(By.isChildOfMinimap(e.targetPath)){let t=i.getLineNumberAtVerticalOffset(e.mouseVerticalOffset),o=i.viewModel.getLineMaxColumn(t);return e.fulfillScrollbar(new Ie(t,o))}return null}static _hitTestScrollbarSlider(i,e){if(By.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 Ie(o,n))}}return null}static _hitTestScrollbar(i,e){if(By.isChildOfScrollableElement(e.targetPath)){let t=i.getLineNumberAtVerticalOffset(e.mouseVerticalOffset),o=i.viewModel.getLineMaxColumn(t);return e.fulfillScrollbar(new Ie(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=Use(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(Me(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 Ie(r,y.column):new Ie(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 U$(e.pos.x,l),u=this._actualDoHitTestWithCaretRangeFromPoint(i,c.toClientCoordinates(Me(i.viewDomNode)));if(u.type===1)return u}return this._actualDoHitTestWithCaretRangeFromPoint(i,e.pos.toClientCoordinates(Me(i.viewDomNode)))}static _actualDoHitTestWithCaretRangeFromPoint(i,e){let t=_M(i.viewDomNode),o;if(t?typeof t.caretRangeFromPoint>"u"?o=RPo(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 BU;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)===pW.CLASS_NAME?gIe.createFromDOMInfo(i,r,o.startOffset):new BU(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)===pW.CLASS_NAME?gIe.createFromDOMInfo(i,n,n.textContent.length):new BU(n)}return new BU}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)===pW.CLASS_NAME?gIe.createFromDOMInfo(i,t.offsetNode.parentNode,t.offset):new BU(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===pW.CLASS_NAME){let l=t.offsetNode.childNodes[Math.min(t.offset,t.offsetNode.childNodes.length-1)];if(l)return gIe.createFromDOMInfo(i,l,0)}else if(s===pW.CLASS_NAME)return gIe.createFromDOMInfo(i,t.offsetNode,0)}return new BU(t.offsetNode)}static _snapToSoftTabBoundary(i,e){let t=e.getLineContent(i.lineNumber),{tabSize:o}=e.model.getOptions(),n=Zre.atomicPosition(t,i.column-1,o,2);return n!==-1?new Ie(i.lineNumber,n+1):i}static doHitTest(i,e){let t=new BU;if(typeof i.viewDomNode.ownerDocument.caretRangeFromPoint=="function"?t=this._doHitTestWithCaretRangeFromPoint(i,e):i.viewDomNode.ownerDocument.caretPositionFromPoint&&(t=this._doHitTestWithCaretPositionFromPoint(i,e.pos.toClientCoordinates(Me(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 Mgt(n,t.spanNode,o))}return t}};function RPo(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=Me(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=nJt.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 nJt=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 S$i(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 mi(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 Nd(a,i,e){return S$i((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 OM(a,i,e){return S$i((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 Gn;(n=>(n.Tap="-monaco-gesturetap",n.Change="-monaco-gesturechange",n.Start="-monaco-gesturestart",n.End="-monaco-gesturesend",n.Contextmenu="-monaco-gesturecontextmenu"))(Gn||={});var Hy=class Hy extends C{constructor(){super();this.dispatched=!1;this.targets=new Vs;this.ignoreTargets=new Vs;this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(H.runAndSubscribe(Fg,({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:It,disposables:this._store}))}static{this.SCROLL_FRICTION=-.005}static{this.HOLD_DELAY=700}static{this.CLEAR_TAP_COUNT_TIME=400}static addTarget(e){if(!Hy.isTouchDevice())return C.None;Hy.INSTANCE||(Hy.INSTANCE=Mp(new Hy));let t=Hy.INSTANCE.targets.push(e);return Z(t)}static ignoreTarget(e){if(!Hy.isTouchDevice())return C.None;Hy.INSTANCE||(Hy.INSTANCE=Mp(new Hy));let t=Hy.INSTANCE.ignoreTargets.push(e);return Z(t)}static isTouchDevice(){return"ontouchstart"in It||navigator.maxTouchPoints>0}static isHoverDevice(){return It.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(Gn.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<Hy.HOLD_DELAY&&Math.abs(c.initialPageX-c.rollingPageX.at(-1))<30&&Math.abs(c.initialPageY-c.rollingPageY.at(-1))<30){let p=this.newGestureEvent(Gn.Tap,c.initialTarget);p.pageX=c.rollingPageX.at(-1),p.pageY=c.rollingPageY.at(-1),this.dispatchEvent(p)}else if(u>=Hy.HOLD_DELAY&&Math.abs(c.initialPageX-c.rollingPageX.at(-1))<30&&Math.abs(c.initialPageY-c.rollingPageY.at(-1))<30){let p=this.newGestureEvent(Gn.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(Gn.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===Gn.Tap){let t=new Date().getTime(),o=0;t-this._lastSetTapCountTime>Hy.CLEAR_TAP_COUNT_TIME?o=1:o=2,this._lastSetTapCountTime=t,e.tapCount=o}else(e.type===Gn.Change||e.type===Gn.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=$r(e,()=>{let p=Date.now(),h=p-o,g=0,f=0,v=!0;n+=Hy.SCROLL_FRICTION*h,l+=Hy.SCROLL_FRICTION*h,n>0&&(v=!1,g=r*n*h),l>0&&(v=!1,f=c*l*h);let b=this.newGestureEvent(Gn.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(Gn.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([mi],Hy,"isTouchDevice",1),I([mi],Hy,"isHoverDevice",1);var ws=Hy;var Ma=class extends C{onclick(i,e){this._register(j(i,re.CLICK,t=>e(new yn(Me(i),t))))}onmousedown(i,e){this._register(j(i,re.MOUSE_DOWN,t=>e(new yn(Me(i),t))))}onmouseover(i,e){this._register(j(i,re.MOUSE_OVER,t=>e(new yn(Me(i),t))))}onmouseleave(i,e){this._register(j(i,re.MOUSE_LEAVE,t=>e(new yn(Me(i),t))))}onkeydown(i,e){this._register(j(i,re.KEY_DOWN,t=>e(new Ii(t))))}onkeyup(i,e){this._register(j(i,re.KEY_UP,t=>e(new Ii(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 ws.ignoreTarget(i)}};var h9=11,Agt=class extends Ma{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=h9+"px",this.domNode.style.height=h9+"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 cL),this._register(Vo(this.bgDomNode,re.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(Vo(this.domNode,re.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new ZD),this._pointerdownScheduleRepeatTimer=this._register(new Nl)}_arrowPointerDown(i){if(!i.target||!(i.target instanceof Element))return;let e=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Me(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 Ngt=class extends C{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 Nl)}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 MPo=140,bIe=class extends Ma{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 Ngt(i.visibility,"visible scrollbar "+i.extraScrollbarClassName,"invisible scrollbar "+i.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new cL),this._shouldRender=!0,this.domNode=or(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 Agt(i));this.domNode.domNode.appendChild(e.bgDomNode),this.domNode.domNode.appendChild(e.domNode)}_createSlider(i,e,t,o){this.slider=or(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=Yn(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(ri&&s>MPo){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 g9=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 Ogt=class extends bIe{constructor(i,e,t){let o=i.getScrollDimensions(),n=i.getCurrentScrollPosition();if(super({lazyRender:e.lazyRender,host:t,scrollbarState:new g9(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-h9)/2,s=(e.horizontalScrollbarSize-h9)/2;this._createArrow({className:"scra",icon:M.scrollbarButtonLeft,top:s,left:r,bottom:void 0,right:void 0,bgWidth:e.arrowSize,bgHeight:e.horizontalScrollbarSize,onActivate:()=>this._host.onMouseWheel(new MT(null,1,0))}),this._createArrow({className:"scra",icon:M.scrollbarButtonRight,top:s,left:void 0,bottom:void 0,right:r,bgWidth:e.arrowSize,bgHeight:e.horizontalScrollbarSize,onActivate:()=>this._host.onMouseWheel(new MT(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 Fgt=class extends bIe{constructor(i,e,t){let o=i.getScrollDimensions(),n=i.getCurrentScrollPosition();if(super({lazyRender:e.lazyRender,host:t,scrollbarState:new g9(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-h9)/2,s=(e.verticalScrollbarSize-h9)/2;this._createArrow({className:"scra",icon:M.scrollbarButtonUp,top:r,left:s,bottom:void 0,right:void 0,bgWidth:e.verticalScrollbarSize,bgHeight:e.arrowSize,onActivate:()=>this._host.onMouseWheel(new MT(null,0,1))}),this._createArrow({className:"scra",icon:M.scrollbarButtonDown,top:void 0,left:s,bottom:r,right:void 0,bgWidth:e.verticalScrollbarSize,bgHeight:e.arrowSize,onActivate:()=>this._host.onMouseWheel(new MT(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 PPo=500,I$i=50,y$i=!0,rJt=class{constructor(i,e,t){this.timestamp=i,this.deltaX=e,this.deltaY=t,this.score=0}},HU=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(eU){let e=Me(i.browserEvent),t=yS(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 rJt(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}},Q$e=class extends Ma{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=APo(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 Fgt(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new Ogt(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=or(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=or(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=or(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 Nl),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=Ue(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,it&&(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 MT(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 Nl),this._inertialTimeout.cancelAndSet(()=>this._periodicSync(),1e3/60)):(this._inertialTimeout?.dispose(),this._inertialTimeout=null)}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Ue(this._mouseWheelToDispose),e)){let o=n=>{this._onMouseWheel(new MT(n))};this._mouseWheelToDispose.push(j(this._listenOnDomNode,re.MOUSE_WHEEL,o,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=HU.INSTANCE;y$i&&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=!it&&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=I$i*r,h=c.scrollTop-(p<0?Math.floor(p):Math.ceil(p));this._verticalScrollbar.writeScrollPosition(u,h)}if(s){let p=I$i*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)&&(y$i&&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(),PPo)}},f9=class extends Q$e{constructor(i,e){e=e||{},e.mouseWheelSmoothScroll=!1;let t=new UT({forceIntegerValues:!0,smoothScrollDuration:0,scheduleAtNextAnimationFrame:o=>$r(Me(i),o)});super(i,e,t),this._register(t)}setScrollPosition(i){this._scrollable.setScrollPositionNow(i)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}},AN=class extends Q$e{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()}},Pa=class extends Q$e{constructor(i,e){e=e||{},e.mouseWheelSmoothScroll=!1;let t=new UT({forceIntegerValues:!1,smoothScrollDuration:0,scheduleAtNextAnimationFrame:o=>$r(Me(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 APo(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,it&&(i.className+=" mac"),i}var Wgt=class extends C{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)}},Vgt=class extends C{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=$r(Me(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}},Bgt=class extends Wgt{_createDragScrollingOperation(i,e){return new sJt(this._context,this._viewHelper,this._mouseTargetFactory,this._dispatchMouse,i,e)}},sJt=class extends Vgt{_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=lIe(this._viewHelper.viewDomNode),p=this._context.configuration.options.get(165).horizontalScrollbarHeight,h=new U$(this._mouseEvent.pos.x,u.y+u.height-p-.1),g=cIe(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=lv.createOutsideEditor(this._position.mouseColumn,new Ie(s,1),"above",this._position.outsideDistance):c=lv.createOutsideEditor(this._position.mouseColumn,new Ie(s,this._context.viewModel.getLineMaxColumn(s)),"below",this._position.outsideDistance)),this._dispatchMouse(c,!0,2),this._animationFrameDisposable=$r(Me(c.element),()=>this._execute())}},Hgt=class extends Wgt{_createDragScrollingOperation(i,e){return new aJt(this._context,this._viewHelper,this._mouseTargetFactory,this._dispatchMouse,i,e)}},aJt=class extends Vgt{_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=lIe(this._viewHelper.viewDomNode),c=this._context.configuration.options.get(165).horizontalScrollbarHeight,u=new U$(this._mouseEvent.pos.x,l.y+l.height-c-.1),p=cIe(this._viewHelper.viewDomNode,l,u);s=this._mouseTargetFactory.createMouseTarget(this._viewHelper.getLastRenderData(),l,u,p,null)}this._position.outsidePosition==="left"?s=lv.createOutsideEditor(s.mouseColumn,new Ie(r,s.mouseColumn),"left",this._position.outsideDistance):s=lv.createOutsideEditor(s.mouseColumn,new Ie(r,s.mouseColumn),"right",this._position.outsideDistance),this._dispatchMouse(s,!0,2),this._animationFrameDisposable=$r(Me(s.element),()=>this._execute())}};var SIe=class extends Jk{constructor(e,t,o){super();this._mouseLeaveMonitor=null;this._context=e,this.viewController=t,this.viewHelper=o,this.mouseTargetFactory=new vIe(this._context,o),this._mouseDownOperation=this._register(new lJt(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 ygt(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 mL(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=HU.INSTANCE,t=0,o=$k.getZoomLevel(),n=!1,r=0,s=c=>{if(this.viewController.emitMouseWheel(c),!this._context.configuration.options.get(84))return;let u=new MT(c);if(e.acceptStandardWheelEvent(u),e.isPhysicalMouseWheel()){if(l(c)){let p=$k.getZoomLevel(),h=u.deltaY>0?1:-1;$k.setZoomLevel(p+h),u.preventDefault(),u.stopPropagation()}}else Date.now()-t>50&&(o=$k.getZoomLevel(),n=l(c),r=0),t=Date.now(),r+=u.deltaY,n&&($k.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 it?(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 G$e(e,t).toPageCoordinates(Me(this.viewHelper.viewDomNode)),r=lIe(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=cIe(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=_M(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;it&&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)}},lJt=class extends C{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 Cgt(this._viewHelper.viewDomNode)),this._topBottomDragScrolling=this._register(new Bgt(this._context,this._viewHelper,this._mouseTargetFactory,(l,c,u)=>this._dispatchMouse(l,c,u))),this._leftRightDragScrolling=this._register(new Hgt(this._context,this._viewHelper,this._mouseTargetFactory,(l,c,u)=>this._dispatchMouse(l,c,u))),this._mouseState=new cJt,this._currentSelection=new Yt(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);ag(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=fIe.getZoneAtCoord(this._context,g);if(f){let b=this._helpPositionJumpOverViewZone(f);if(b)return lv.createOutsideEditor(r,b,"above",h)}let v=n.getLineNumberAtVerticalOffset(g);return lv.createOutsideEditor(r,new Ie(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=fIe.getZoneAtCoord(this._context,g);if(f){let b=this._helpPositionJumpOverViewZone(f);if(b)return lv.createOutsideEditor(r,b,"below",h)}let v=n.getLineNumberAtVerticalOffset(g);return lv.createOutsideEditor(r,new Ie(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 lv.createOutsideEditor(r,new Ie(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 lv.createOutsideEditor(r,new Ie(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 lv.createViewZone(n.type,n.element,n.mouseColumn,s,n.detail)}return n}_helpPositionJumpOverViewZone(e){let t=new Ie(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})}},cJt=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 On=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 NPo=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Ugt(a){return NPo.test(a)}var _t=(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 zgt(a){return`${a}-${_t()}`}var IIe=class extends C{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()}},Aa={RESOURCES:"ResourceURLs",DOWNLOAD_URL:"DownloadURL",FILES:"Files",TEXT:Zn.text,INTERNAL_URI_LIST:"application/vnd.code.uri-list"};function NN(a,i){return{id:i,asString:async()=>a,asFile:()=>{},value:typeof a=="string"?a:void 0}}function C$i(a,i,e,t){let o={id:_t(),name:a,uri:i,data:e};return{id:t,asString:async()=>"",asFile:()=>o,value:void 0}}var bx=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 ht.some(this,([t,o])=>o.asFile())&&e.push("files"),x$i(Kgt(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 Kgt(i)}};function Kgt(a){return a.toLowerCase()}function Y$e(a,i){return x$i(Kgt(a),i.map(Kgt))}function x$i(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 Uy=Object.freeze({create:a=>Uo(a.map(i=>i.toString())).join(`\r
`),split:a=>a.split(`\r
`),parse:a=>Uy.split(a).filter(i=>!i.startsWith("#"))});function yIe(a){return JSON.stringify(a,OPo)}function zg(a){let i=JSON.parse(a);return i=Xn(i),i}function OPo(a,i){return i instanceof RegExp?{$mid:2,source:i.source,flags:i.flags}:i}function Xn(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 Je||a instanceof Uint8Array)return a;if(Array.isArray(a))for(let e=0;e<a.length;++e)a[e]=Xn(a[e],i+1);else for(let e in a)Object.hasOwnProperty.call(a,e)&&(a[e]=Xn(a[e],i+1))}return a}var Ggt=(o=>(o[o.Ignore=0]="Ignore",o[o.Info=1]="Info",o[o.Warning=2]="Warning",o[o.Error=3]="Error",o))(Ggt||{});(s=>{let a="error",i="warning",e="warn",t="info",o="ignore";function n(l){return l?mr(a,l)?3:mr(i,l)||mr(e,l)?2:mr(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})(Ggt||={});var gt=Ggt;function T$i(a,i){let{os:e,tildify:t,relative:o}=i;if(o){let s=FPo(a,o,e);if(typeof s=="string")return s}let n=a.fsPath;if(e===1&&!ri?n=n.replace(/\//g,"\\"):e!==1&&ri&&(n=n.replace(/\\/g,"/")),e!==1&&t?.userHome){let s=t.userHome.fsPath,l;a.scheme!==t.userHome.scheme&&a.path[0]===Lo.sep&&a.path[1]!==Lo.sep?l=t.userHome.with({path:a.path}).fsPath:l=n,n=Z$e(l,s,e)}return(e===1?Ms:Lo).normalize(Hp(n,e===1))}function FPo(a,i,e){let t=e===1?Ms:Lo,o=e===3?ar:dx,n=i.getWorkspace(),r=n.folders.at(0);if(!r)return;a.scheme!==r.uri.scheme&&a.path[0]===Lo.sep&&a.path[1]!==Lo.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=ri){return f6(a,i)?a.charAt(0).toUpperCase()+a.slice(1):a}var dJt=Object.create(null);function Z$e(a,i,e=zo){if(e===1||!a||!i)return a;let t=dJt.original===i?dJt.normalized:void 0;t||(t=i,ri&&(t=p$(t)),t=`${ih(t,Lo.sep)}${Lo.sep}`,dJt={original:i,normalized:t});let o=a;return ri&&(o=p$(o)),(e===3?o.startsWith(t):Uk(o,t))?`~/${o.substr(t.length)}`:a}function v9(a,i){return a.replace(/^~($|\/|\\)/,`${i}$1`)}var k$i="\u2026",X$e="\\\\",J$e="~";function wIe(a,i=Rd){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(X$e)===0?(r=s.substr(0,s.indexOf(X$e)+X$e.length),s=s.substr(s.indexOf(X$e)+X$e.length)):s.indexOf(i)===0?(r=s.substr(0,s.indexOf(i)+i.length),s=s.substr(s.indexOf(i)+i.length)):s.indexOf(J$e)===0&&(r=s.substr(0,s.indexOf(J$e)+J$e.length),s=s.substr(s.indexOf(J$e)+J$e.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+k$i+i),h=h+p,u+c<l.length&&(h=h+i+k$i),e[o]=h}}t&&(e[o]=n)}return e}function $gt(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 G$(a,i){return it||i?a.replace(/\(&&\w\)|&&/g,"").replace(/&/g,it?"&":"&&"):a.replace(/&&|&/g,e=>e==="&"?"&&":"&")}function $$(a,i){let e=a.replace(/\(&&\w\)|&&/g,"");if(i)return e;if(it)return{withMnemonic:e,withoutMnemonic:e};let t;return ri?t=a.replace(/&&|&/g,o=>o==="&"?"&&":"&"):t=a.replace(/&&/g,"_"),{withMnemonic:t,withoutMnemonic:e}}function eqe(a){return a.replace(/&/g,"&&")}function _$i(a){if(a.endsWith("]")){let i=a.lastIndexOf(" [",a.length-2);if(i!==-1){let e=E$i(a.substring(0,i)),t=a.substring(i);return{name:e.name+t,parentPath:e.parentPath}}}return E$i(a)}function E$i(a){let i=a.indexOf("/")!==-1?Lo:Ms,e=i.basename(a),t=i.dirname(a);return e.length?{name:e,parentPath:t}:{name:t,parentPath:""}}var ct=ae("dialogService");var CIe=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(1869,null)),o.cancelButton?t.push(o.cancelButton):t.push(d(1865,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(1865,null)):typeof o.cancelButton=="string"?t.push(o.cancelButton):o.cancelButton.label?t.push(o.cancelButton.label):t.push(d(1865,null))),t.length===0&&t.push(d(1868,null));break}case 3:{let o=i;o.primaryButton?t.push(o.primaryButton):t.push(d(1868,null)),o.cancelButton?t.push(o.cancelButton):t.push(d(1865,null));break}}return t}getDialogType(i){if(typeof i=="string")return i;if(typeof i=="number")return i===gt.Info?"info":i===gt.Error?"error":i===gt.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}}},dn=ae("fileDialogService");var qgt=10;function Xw(a){let i=[];return i.push(...a.slice(0,qgt).map(e=>typeof e=="string"?e:Ye(e))),a.length>qgt&&(a.length-qgt===1?i.push(d(1866,null)):i.push(d(1867,null,a.length-qgt))),i.push(""),i.join(`
`)}var uJt=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]}},pJt=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?kbe(i,this._value,0,i.length,this._from,this._to):wre(i,this._value,0,i.length,this._from,this._to)}value(){return this._value.substring(this._from,this._to)}},b9=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?kbe(i,this._value,0,i.length,this._from,this._to):wre(i,this._value,0,i.length,this._from,this._to)}value(){return this._value.substring(this._from,this._to)}};var mJt=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 b9(!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 Uw(i,this._value.scheme);if(this._states[this._stateIdx]===2)return Uw(i,this._value.authority);if(this._states[this._stateIdx]===3)return this._pathIterator.cmp(i);if(this._states[this._stateIdx]===4)return Al(i,this._value.query);if(this._states[this._stateIdx]===5)return Al(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}},q$=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}},xIe=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 Yu=class a{static forUris(i=()=>!1,e=()=>!1){return new a(new mJt(i,e))}static forPaths(i=!1){return new a(new b9(void 0,!i))}static forStrings(){return new a(new uJt)}static forConfigKeys(){return new a(new pJt)}constructor(i){this._iter=i}clear(){this._root=void 0}fill(i,e){if(e){let t=e.slice(0);l6(t);for(let o of t)this.set(o,i)}else{let t=i.slice(0);l6(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 xIe,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 xIe,o.left.segment=t.value()),n.push([-1,o]),o=o.left;else if(s<0)o.right||(o.right=new xIe,o.right.segment=t.value()),n.push([1,o]),o=o.right;else if(t.hasNext())t.next(),o.mid||(o.mid=new xIe,o.mid.segment=t.value()),n.push([0,o]),o=o.mid;else break}let r=q$.unwrap(o.value);o.value=q$.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 q$.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:Ey(!1);case 1:Ey(!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=q$.unwrap(t.value)||o,t=t.mid;else break}return t&&q$.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?q$.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,q$.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 be=ae("fileService");function D$i(a){return a.create===!0}function XT(a){return!!(a.capabilities&2)}function L$i(a){return!!(a.capabilities&524288)}function tqe(a){return!!(a.capabilities&8)}function jgt(a){return!!(a.capabilities&131072)}function R$i(a){return!!(a.capabilities&262144)}function j$(a){return!!(a.capabilities&4)}function Qgt(a){return!!(a.capabilities&16)}function Ygt(a){return XT(a)?!!(a.capabilities&16384):!1}function hJt(a){return XT(a)?!!(a.capabilities&32768):!1}function M$i(a){return!!(a.capabilities&65536)}function P$i(a){return!!(a.capabilities&2048)}var kIe=class a extends Error{constructor(e,t){super(e);this.code=t}static create(e,t){let o=new a(e.toString(),t);return gJt(o,t),o}};function Jr(a,i){return kIe.create(a,i)}function Q$(a){return a||Jr(d(2061,null),"Unknown")}function gJt(a,i){return a.name=i?`${i} (FileSystemError)`:"FileSystemError",a}function Gse(a){if(!a)return"Unknown";if(a instanceof kIe)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 hu(a){if(a instanceof As)return a.fileOperationResult;switch(Gse(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 ON=class{constructor(i,e,t){this.resource=i;this.operation=e;this.target=t}isOperation(i){return this.operation===i}};var FN=class a{constructor(i,e){this.ignorePathCasing=e;this.correlationId=void 0;this.added=new co(()=>{let i=Yu.forUris(()=>this.ignorePathCasing);return i.fill(this.rawAdded.map(e=>[e,!0])),i});this.updated=new co(()=>{let i=Yu.forUris(()=>this.ignorePathCasing);return i.fill(this.rawUpdated.map(e=>[e,!0])),i});this.deleted=new co(()=>{let i=Yu.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 As=class extends Error{constructor(e,t,o){super(e);this.fileOperationResult=t;this.options=o}},WN=class extends As{constructor(e,t,o,n){super(e,t,n);this.fileOperationResult=t;this.size=o}},UU=class extends As{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"},AS={OFF:"off",ON_EXIT:"onExit",ON_EXIT_AND_WINDOW_CLOSE:"onExitAndWindowClose"},Y$="files.associations",Xgt="files.exclude",Jgt="files.readonlyInclude",Zgt="files.readonlyExclude",A$i="files.readonlyFromPermissions",Cd=(t=>(t[t.FILE=0]="FILE",t[t.FOLDER=1]="FOLDER",t[t.ROOT_FOLDER=2]="ROOT_FOLDER",t))(Cd||{}),gL="";function fJt(a){if(!(typeof a.size!="number"||typeof a.mtime!="number"))return a.mtime.toString(29)+a.size.toString(31)}async function N$i(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 ll=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 Xo(i)||(i=0),i<a.KB?d(2056,null,i.toFixed(0)):i<a.MB?d(2058,null,(i/a.KB).toFixed(2)):i<a.GB?d(2059,null,(i/a.MB).toFixed(2)):i<a.TB?d(2057,null,(i/a.GB).toFixed(2)):d(2060,null,(i/a.TB).toFixed(2))}};function eft(a){let i=typeof a=="string"||a?.scheme===Y.vscodeRemote;return typeof a!="string"&&a?.scheme===Y.file?1024*ll.MB:i?10*ll.MB:Gt?50*ll.MB:1024*ll.MB}var Sx;(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})(Sx||={});var vJt;(i=>{function a(e){return typeof e?.FileSystemObserver=="function"}i.supported=a})(vJt||={});var tft=class extends C{constructor(e,t,o){super();this.indexedDB=e;this.store=t;this.logService=o;this.onDidChangeCapabilities=H.None;this.extUri=Wn?ar:dx;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,Wn&&(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(Sx.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,Sx.isFileSystemFileHandle(r)?1:2]);return o}catch(t){throw this.toFileSystemProviderError(t)}}readFileStream(e,t,o){let n=_I(r=>Je.concat(r.map(s=>Je.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(2055,null),"Unavailable")}catch(n){throw this.toFileSystemProviderError(n)}}watch(e,t){let o=new P;return this.doWatch(e,t,o).catch(n=>this.logService.error(`[File Watcher ('FileSystemObserver')] Error: ${n} (${e})`)),o}async doWatch(e,t,o){if(!vJt.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}] ${je(e,...c.relativePathComponents)}`),c.type){case"appeared":l.push({resource:je(e,...c.relativePathComponents),type:1});break;case"disappeared":l.push({resource:je(e,...c.relativePathComponents),type:2});break;case"modified":l.push({resource:je(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=Am(e.name),r=No(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:Y.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(Sx.isFileSystemHandle(n)){let r=await n.queryPermission()==="granted";try{r||(r=await n.requestPermission()==="granted")}catch(s){this.logService.error(s)}if(r)return Sx.isFileSystemFileHandle(n)?this._files.set(t,n):Sx.isFileSystemDirectoryHandle(n)&&this._directories.set(t,n),n}throw this.createFileSystemProviderError(e,"No file system handle registered","Unavailable")}toFileSystemProviderError(e){if(e instanceof kIe)return e;let t="Unknown";return e.name==="NotAllowedError"&&(e=new Error(d(2054,null)),t="Unavailable"),Jr(e,t)}createFileSystemProviderError(e,t,o){return Jr(new Error(`${t} (${th(e.path)})`),o)}};var Qe=ae("openerService");function fL(a,i){return a.with({fragment:`${i.startLineNumber},${i.startColumn}${i.endLineNumber?`-${i.endLineNumber}${i.endColumn?`,${i.endColumn}`:""}`:""}`})}function EIe(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 Ll={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 iqe(a){let i=[];if(a.dataTransfer&&a.dataTransfer.types.length>0){let o=a.dataTransfer.getData(Ll.EDITORS);if(o)try{i.push(...zg(o))}catch{}else try{let s=a.dataTransfer.getData(Aa.RESOURCES);i.push(...SJt(s))}catch{}if(a.dataTransfer?.files)for(let s=0;s<a.dataTransfer.files.length;s++){let l=a.dataTransfer.files[s];if(l&&Ix(l))try{i.push({resource:A.file(Ix(l)),isExternal:!0,allowWorkspaceOpen:!0})}catch{}}let n=a.dataTransfer.getData(Ll.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=oe.as(mW.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 vt;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 TIe(a,i){let e=iqe(i);if(i.dataTransfer&&Gt&&gu(i,Aa.FILES)&&i.dataTransfer.items){let n=await a.get(F).invokeFunction(r=>WPo(r,i));for(let r of n)e.push({resource:r.resource,contents:r.contents?.toString(),isExternal:!0,allowWorkspaceOpen:r.isDirectory})}return e}function SJt(a){let i=[];if(a){let e=JSON.parse(a);for(let t of e)if(t.indexOf(":")>0){let{selection:o,uri:n}=EIe(A.parse(t));i.push({resource:n,options:{selection:o}})}}return i}async function WPo(a,i){if(Sx.supported(It)){let t=i.dataTransfer?.items;if(t)return VPo(a,t)}let e=i.dataTransfer?.files;return e?BPo(a,e):[]}async function VPo(a,i){let e=a.get(be).getProvider(Y.file);if(!(e instanceof tft))return[];let t=[];for(let o=0;o<i.length;o++){let n=i[o];if(n){let r=new Go;t.push(r),(async()=>{try{let s=await n.getAsFileSystemHandle();if(!s){r.complete(void 0);return}Sx.isFileSystemFileHandle(s)?r.complete({resource:await e.registerFileHandle(s),isDirectory:!1}):Sx.isFileSystemDirectoryHandle(s)?r.complete({resource:await e.registerDirectoryHandle(s),isDirectory:!0}):r.complete(void 0)}catch{r.complete(void 0)}})()}}return si(await Promise.all(t.map(o=>o.p)))}async function BPo(a,i){let e=a.get(ct),t=[];for(let o=0;o<i.length;o++){let n=i.item(o);if(n){if(n.size>100*ll.MB){e.warn(d(1877,null));continue}let r=new Go;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:Y.untitled,path:c}),contents:typeof u=="string"?Je.fromString(u):Je.wrap(new Uint8Array(u))})},s.readAsArrayBuffer(n)}}return si(await Promise.all(t.map(o=>o.p)))}function gu(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 bJt=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}},mW={DragAndDropContribution:"workbench.contributions.dragAndDrop"};oe.add(mW.DragAndDropContribution,new bJt);var VI=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 O$i(a,i,e){a.dataTransfer?.setData(i,JSON.stringify(e))}function IJt(a,i,e){let t=a.dataTransfer?.getData(i);if(t)try{return JSON.parse(t)}catch{}return e}function F$i(a){return IJt(a,Ll.SYMBOLS,[])}function _Ie(a,i){O$i(i,Ll.SYMBOLS,a)}function W$i(a){return IJt(a,Ll.MARKERS,void 0)}function V$i(a,i){O$i(i,Ll.MARKERS,a)}function B$i(a){return IJt(a,Ll.NOTEBOOK_CELL_OUTPUT,void 0)}function Ix(a){if(kr&&typeof globalThis.vscode?.webUtils?.getPathForFile=="function")return globalThis.vscode?.webUtils?.getPathForFile(a)}function HPo(a){let i=new bx;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,NN(o))}else if(e.kind==="file"){let o=e.getAsFile();o&&i.append(t,UPo(o))}}return i}function UPo(a){let i=Ix(a),e=i?A.parse(i):void 0;return C$i(a.name,e,async()=>new Uint8Array(await a.arrayBuffer()))}var zPo=Object.freeze([Ll.EDITORS,Ll.FILES,Aa.RESOURCES,Aa.INTERNAL_URI_LIST]);function $se(a,i=!1){let e=HPo(a),t=e.get(Aa.INTERNAL_URI_LIST);if(t)e.replace(Zn.uriList,t);else if(i||!e.has(Zn.uriList)){let o=[];for(let n of a.items){let r=n.getAsFile();if(r){let s=Ix(r);try{s?o.push(A.file(s).toString()):o.push(A.parse(r.name,!0).toString())}catch{}}}o.length&&e.replace(Zn.uriList,NN(Uy.create(o)))}for(let o of zPo)e.delete(o);return e}function H$i(a,i,e){let{dataToCopy:t,metadata:o}=z$i(a);return U$i(t.text,o,e),{dataToCopy:t,metadata:o}}function U$i(a,i,e){S9.INSTANCE.set(e?a.replace(/\r\n/g,`
`):a,i)}function z$i(a){let i=a.getEditorOption(45),e=a.getEditorOption(31),t=a.getCursorStates().map(r=>r.modelState.selection),o=KPo(a,t,i,e),n={version:1,id:_t(),isFromEmptySelection:o.isFromEmptySelection,multicursorText:o.multicursorText,mode:o.mode};return{dataToCopy:o,metadata:n}}function KPo(a,i,e,t){let{sourceRanges:o,sourceText:n}=a.getPlainTextToCopy(i,e,ri),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(zU.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 S9=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)}},zU={forceCopyWithSyntaxHighlighting:!1,electronBugWorkaroundCopyEventHasFired:!1},K$i={getTextData(a){let i=a.getData(Zn.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(Zn.text,i),typeof e=="string"&&a.setData("text/html",e),a.setData("vscode-editor-data",JSON.stringify(t))}};function DIe(a,i,e,t,o){let{dataToCopy:n,metadata:r}=z$i(e.viewModel),s=!1;return{isCut:i,clipboardData:{setData:(l,c)=>{a.clipboardData?.setData(l,c)}},dataToCopy:n,ensureClipboardGetsEditorData:()=>{a.preventDefault(),a.clipboardData&&K$i.setTextData(a.clipboardData,n.text,n.html,r),U$i(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 ift(a){let i=!1,[e,t]=a.clipboardData?K$i.getTextData(a.clipboardData):["",null];return t=t||S9.INSTANCE.get(e),{clipboardData:GPo(a.clipboardData),metadata:t,text:e,toExternalVSDataTransfer:()=>a.clipboardData?$se(a.clipboardData):void 0,browserEvent:a,setHandled:()=>{i=!0,a.preventDefault(),a.stopImmediatePropagation()},get isHandled(){return i}}}function GPo(a){return{types:Array.from(a?.types??[]),files:Array.prototype.slice.call(a?.files??[],0),getData:i=>a?.getData(i)??""}}var JT=!1,NS=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){JT&&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};JT&&(console.log("------------------------deduceInput"),console.log(`PREVIOUS STATE: ${i.toString()}`),console.log(`CURRENT STATE: ${e.toString()}`));let o=Math.min(Ng(i.value,e.value),i.selectionStart,e.selectionStart),n=Math.min(zw(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(JT&&(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 JT&&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(JT&&(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(Ng(i.value,e.value),i.selectionEnd),o=Math.min(zw(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 JT&&(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 nft;(i=>i.Tap="-monaco-textarea-synthetic-tap")(nft||={});var yJt=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}},LIe=class extends C{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=NS.EMPTY,this._selectionChangeListener=null,this._accessibilityService.isScreenReaderOptimized()&&this.writeNativeTextAreaContent("ctor"),this._register(H.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 Ii(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 Ii(c);this._onKeyUp.fire(u)})),this._register(this._textArea.onCompositionStart(c=>{JT&&console.log("[compositionstart]",c);let u=new yJt;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")){JT&&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=>{JT&&console.log("[compositionupdate]",c);let u=this._currentComposition;if(!u)return;if(this._browser.isAndroid){let h=NS.readFromTextArea(this._textArea,this._textAreaState),g=NS.deduceAndroidCompositionInput(this._textAreaState,h);this._textAreaState=h,this._onType.fire(g),this._onCompositionUpdate.fire(c);return}let p=u.handleCompositionUpdate(c.data);this._textAreaState=NS.readFromTextArea(this._textArea,this._textAreaState),this._onType.fire(p),this._onCompositionUpdate.fire(c)})),this._register(this._textArea.onCompositionEnd(c=>{JT&&console.log("[compositionend]",c);let u=this._currentComposition;if(!u)return;if(this._currentComposition=null,this._browser.isAndroid){let h=NS.readFromTextArea(this._textArea,this._textAreaState),g=NS.deduceAndroidCompositionInput(this._textAreaState,h);this._textAreaState=h,this._onType.fire(g),this._onCompositionEnd.fire();return}let p=u.handleCompositionUpdate(c.data);this._textAreaState=NS.readFromTextArea(this._textArea,this._textAreaState),this._onType.fire(p),this._onCompositionEnd.fire()})),this._register(this._textArea.onInput(c=>{if(JT&&console.log("[input]",c),this._textArea.setIgnoreSelectionChangeTime("received input event"),this._currentComposition)return;let u=NS.readFromTextArea(this._textArea,this._textAreaState),p=NS.deduceInput(this._textAreaState,u,this._OS===2);p.replacePrevCharCnt===0&&p.text.length===1&&(Ru(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:S9.INSTANCE.get(p.text)}):this._onType.fire(p)))})),this._register(this._textArea.onCut(c=>{this._logService.trace("TextAreaInput#onCut",c);let u=DIe(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),zU.electronBugWorkaroundCopyEventHasFired=!0;let u=DIe(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=ift(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=NS.readFromTextArea(this._textArea,null)}_installSelectionChangeListener(){let e=0;return j(this._textArea.ownerDocument,"selectionchange",t=>{if(vx.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 Yt(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())}};LIe=I([m(4,Bi),m(5,ne)],LIe);var oft=class extends C{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 On(this._actual,"keydown")).event,this.onKeyPress=this._register(new On(this._actual,"keypress")).event,this.onKeyUp=this._register(new On(this._actual,"keyup")).event,this.onCompositionStart=this._register(new On(this._actual,"compositionstart")).event,this.onCompositionUpdate=this._register(new On(this._actual,"compositionupdate")).event,this.onCompositionEnd=this._register(new On(this._actual,"compositionend")).event,this.onBeforeInput=this._register(new On(this._actual,"beforeinput")).event,this.onInput=this._register(new On(this._actual,"input")).event,this.onCut=this._register(new On(this._actual,"cut")).event,this.onCopy=this._register(new On(this._actual,"copy")).event,this.onPaste=this._register(new On(this._actual,"paste")).event,this.onFocus=this._register(new On(this._actual,"focus")).event,this.onBlur=this._register(new On(this._actual,"blur")).event,this._register(this.onKeyDown(()=>vx.onKeyDown())),this._register(this.onBeforeInput(()=>vx.onBeforeInput())),this._register(this.onInput(()=>vx.onInput())),this._register(this.onKeyUp(()=>vx.onKeyUp())),this._register(j(this._actual,nft.Tap,()=>this._onSyntheticTap.fire()))}get ownerDocument(){return this._actual.ownerDocument}hasFocus(){let e=_M(this._actual);return e?e.activeElement===this._actual:this._actual.isConnected?Pn()===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=_M(n);s?r=s.activeElement:r=Pn();let l=Me(r),c=r===n,u=n.selectionStart,p=n.selectionEnd;if(c&&u===t&&p===o){yc&&l.parent!==l&&n.focus();return}if(c){this.setIgnoreSelectionChangeTime("setSelectionRange"),n.setSelectionRange(t,o),yc&&l.parent!==l&&n.focus();return}try{let h=Dzi(n);this.setIgnoreSelectionChangeTime("setSelectionRange"),n.focus(),n.setSelectionRange(t,o),Lzi(n,h)}catch{}}};var wJt=class extends SIe{constructor(i,e,t){super(i,e,t),this._register(ws.addTarget(this.viewHelper.linesContentDomNode)),this._register(j(this.viewHelper.linesContentDomNode,Gn.Tap,n=>this.onTap(n))),this._register(j(this.viewHelper.linesContentDomNode,Gn.Change,n=>this.onChange(n))),this._register(j(this.viewHelper.linesContentDomNode,Gn.Contextmenu,n=>this._onContextMenu(new mL(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 wgt(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 mL(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)}},CJt=class extends SIe{constructor(i,e,t){super(i,e,t),this._register(ws.addTarget(this.viewHelper.linesContentDomNode)),this._register(j(this.viewHelper.linesContentDomNode,Gn.Tap,o=>this.onTap(o))),this._register(j(this.viewHelper.linesContentDomNode,Gn.Change,o=>this.onChange(o))),this._register(j(this.viewHelper.linesContentDomNode,Gn.Contextmenu,o=>this._onContextMenu(new mL(o,!1,this.viewHelper.viewDomNode),!1)))}onTap(i){i.preventDefault(),this.viewHelper.focusTextArea();let e=this._createMouseTarget(new mL(i,!1,this.viewHelper.viewDomNode),!1);if(e.position){let t=document.createEvent("CustomEvent");t.initEvent(nft.Tap,!1,!0),this.viewHelper.dispatchTextAreaEvent(t),this.viewController.moveTo(e.position,1)}}onChange(i){this._context.viewModel.viewLayout.deltaScrollNow(-i.translationX,-i.translationY)}},rft=class extends C{constructor(i,e,t){super(),(Nc||Jut&&sbe)&&og.pointerEvents?this.handler=this._register(new wJt(i,e,t)):It.TouchEvent?this.handler=this._register(new CJt(i,e,t)):this.handler=this._register(new SIe(i,e,t))}getTargetAtClientPoint(i,e){return this.handler.getTargetAtClientPoint(i,e)}};var sft=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){Vg.SetSelection.runCoreEditorCommand(this.viewModel,{source:"keyboard",selection:i})}_validateViewColumn(i){let e=this.viewModel.getLineMinColumn(i.lineNumber);return i.column<e?new Ie(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 Yt.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 Yt.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(!yM(g))return new Yt(t,c+2,t,u)}dispatchMouse(i){let e=this.configuration.options,t=Wn&&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){Vg.MoveTo.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_moveToSelect(i,e){Vg.MoveToSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_columnSelect(i,e,t){i=this._validateViewColumn(i),Vg.ColumnSelect.runCoreEditorCommand(this.viewModel,{source:"mouse",position:this._convertViewToModelPosition(i),viewPosition:i,mouseColumn:e,doColumnSelect:t})}_createCursor(i,e){i=this._validateViewColumn(i),Vg.CreateCursor.runCoreEditorCommand(this.viewModel,{source:"mouse",position:this._convertViewToModelPosition(i),viewPosition:i,wholeLine:e})}_lastCursorMoveToSelect(i,e){Vg.LastCursorMoveToSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_wordSelect(i,e){Vg.WordSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_wordSelectDrag(i,e){Vg.WordSelectDrag.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_lastCursorWordSelect(i,e){Vg.LastCursorWordSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_lineSelect(i,e){Vg.LineSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_lineSelectDrag(i,e){Vg.LineSelectDrag.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_lastCursorLineSelect(i,e){Vg.LastCursorLineSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_lastCursorLineSelectDrag(i,e){Vg.LastCursorLineSelectDrag.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_select(i){Vg.SetSelection.runCoreEditorCommand(this.viewModel,{source:"mouse",selection:i})}_selectAll(){Vg.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 Kg(a,i){let e=QUi();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 oqe=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 ni("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}},RIe=class{constructor(i,e){this._viewContext=i;this._lineFactory=e;this.domNode=this._createDomNode(),this._linesCollection=new oqe(this._lineFactory)}_createDomNode(){let i=or(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 xJt(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)}},xJt=class a{constructor(i,e,t,o){this._domNode=i;this._lineFactory=e;this._viewportData=t;this._viewContext=o}static{this._ttPolicy=Kg("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 ES(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 aft=class extends mu{constructor(e){super(e);this._dynamicOverlays=[];this._isFocused=!1;this._visibleLines=new RIe(this._context,{createLine:()=>new kJt(this._dynamicOverlays)}),this.domNode=this._visibleLines.domNode;let o=this._context.configuration.options.get(59);Pd(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 Pd(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)}},kJt=class{constructor(i){this._dynamicOverlays=i,this._domNode=null,this._renderedContent=null}getDomNode(){return this._domNode?this._domNode.domNode:null}setDomNode(i){this._domNode=or(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))}},lft=class extends aft{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))}},cft=class extends aft{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),Pd(this.domNode,e.get(59))}onConfigurationChanged(i){let e=this._context.configuration.options;Pd(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 MIe=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 Ie(i.afterLineNumber,1)).lineNumber}}};var dft=class extends mu{constructor(e){super(e);this.blocks=[];this.contentWidth=-1;this.contentLeft=0;this.domNode=or(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]=or(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 uft=class extends mu{constructor(i,e){super(i),this._viewDomNode=e,this._widgets={},this.domNode=or(document.createElement("div")),PS.write(this.domNode,1),this.domNode.setClassName("contentWidgets"),this.domNode.setPosition("absolute"),this.domNode.setTop(0),this.overflowingContentWidgetsDomNode=or(document.createElement("div")),PS.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 TJt(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)}},TJt=class{constructor(i,e,t){this._primaryAnchor=new qse(null,null);this._secondaryAnchor=new qse(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=or(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 qse(null,null);let l=r.model.validatePosition(n);if(r.coordinatesConverter.modelPositionIsVisible(l)){let c=r.coordinatesConverter.convertModelPositionToViewPosition(l,s??void 0);return new qse(n,c)}return new qse(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=Yn(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=Fm(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 jse(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 pft(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 pft(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=EJt(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 jse(n.aboveTop,n.left),position:1}}else if(s===2){if(!n)return null;if(r===2||n.fitsBelow)return{kind:"inViewport",coordinate:new jse(n.belowTop,n.left),position:2}}else return this.allowEditorOverflow?{kind:"inViewport",coordinate:this._prepareRenderWidgetAtExactPositionOverflowing(new jse(o.top,o.left)),position:0}:{kind:"inViewport",coordinate:new jse(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"&&EJt(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"&&EJt(this._actual.afterRender,this._actual,this._renderData.position,this._renderData.coordinate)}},qse=class{constructor(i,e){this.modelPosition=i;this.viewPosition=e}},jse=class{constructor(i,e){this.top=i;this.left=e;this._coordinateBrand=void 0}},pft=class{constructor(i,e,t){this.top=i;this.left=e;this.height=t;this._anchorCoordinateBrand=void 0}};function EJt(a,i,...e){try{return a.call(i,...e)}catch{return null}}var Jw=class extends Jk{};var De=ae("themeService");function Ss(a){return{id:a}}var G$i=M.file,X$=M.folder;function J$(a){switch(a){case"dark":return"vs-dark";case"hcDark":return"hc-black";case"hcLight":return"hc-light";default:return"vs"}}var LJt={ThemingContribution:"base.contributions.theming"},_Jt=class extends C{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}},$$i=new _Jt;oe.add(LJt.ThemingContribution,$$i);function is(a){return $$i.onColorThemeChange(a)}var Jd=class extends C{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 PIe=J("editor.lineHighlightBackground",null,d(790,null)),q$i=J("editor.inactiveLineHighlightBackground",PIe,d(789,null)),RJt=J("editor.lineHighlightBorder",{dark:"#282828",light:"#eeeeee",hcDark:"#f38518",hcLight:gi},d(791,null)),j$i=J("editor.rangeHighlightBackground",{dark:"#ffffff0b",light:"#fdff0033",hcDark:null,hcLight:null},d(796,null),!0),u2n=J("editor.rangeHighlightBorder",{dark:null,light:null,hcDark:qs,hcLight:qs},d(797,null)),p2n=J("editor.symbolHighlightBackground",{dark:Kb,light:Kb,hcDark:null,hcLight:null},d(798,null),!0),m2n=J("editor.symbolHighlightBorder",{dark:null,light:null,hcDark:qs,hcLight:qs},d(799,null)),I9=J("editorCursor.foreground",{dark:"#AEAFAD",light:Oe.black,hcDark:Oe.white,hcLight:"#0F4A85"},d(730,null)),mft=J("editorCursor.background",null,d(765,null)),hft=J("editorMultiCursor.primary.foreground",I9,d(780,null)),Q$i=J("editorMultiCursor.primary.background",mft,d(779,null)),gft=J("editorMultiCursor.secondary.foreground",I9,d(782,null)),Y$i=J("editorMultiCursor.secondary.background",mft,d(781,null)),AIe=J("editorWhitespace.foreground",{dark:"#e3e4e229",light:"#33333333",hcDark:"#e3e4e229",hcLight:"#CCCCCC"},d(788,null)),X$i=J("editorLineNumber.foreground",{dark:"#858585",light:"#237893",hcDark:Oe.white,hcLight:"#292929"},d(778,null)),$Po=J("editorIndentGuide.background",AIe,d(771,null),!1,d(733,null)),qPo=J("editorIndentGuide.activeBackground",AIe,d(734,null),!1,d(731,null)),fft=J("editorIndentGuide.background1",$Po,d(772,null)),J$i=J("editorIndentGuide.background2","#00000000",d(773,null)),Z$i=J("editorIndentGuide.background3","#00000000",d(774,null)),eqi=J("editorIndentGuide.background4","#00000000",d(775,null)),tqi=J("editorIndentGuide.background5","#00000000",d(776,null)),iqi=J("editorIndentGuide.background6","#00000000",d(777,null)),vft=J("editorIndentGuide.activeBackground1",qPo,d(735,null)),oqi=J("editorIndentGuide.activeBackground2","#00000000",d(736,null)),nqi=J("editorIndentGuide.activeBackground3","#00000000",d(737,null)),rqi=J("editorIndentGuide.activeBackground4","#00000000",d(738,null)),sqi=J("editorIndentGuide.activeBackground5","#00000000",d(739,null)),aqi=J("editorIndentGuide.activeBackground6","#00000000",d(740,null)),jPo=J("editorActiveLineNumber.foreground",{dark:"#c6c6c6",light:"#0B216F",hcDark:qs,hcLight:qs},d(741,null),!1,d(732,null)),h2n=J("editorLineNumber.activeForeground",jPo,d(741,null)),lqi=J("editorLineNumber.dimmedForeground",null,d(766,null)),cqi=J("editorRuler.foreground",{dark:"#5A5A5A",light:Oe.lightgrey,hcDark:Oe.white,hcLight:"#292929"},d(785,null)),g2n=J("editorCodeLens.foreground",{dark:"#999999",light:"#919191",hcDark:"#999999",hcLight:"#292929"},d(764,null)),f2n=J("editorBracketMatch.background",{dark:"#0064001a",light:"#0064001a",hcDark:"#0064001a",hcLight:"#0000"},d(749,null)),v2n=J("editorBracketMatch.border",{dark:"#888",light:"#B9B9B9",hcDark:gi,hcLight:gi},d(750,null)),dqi=J("editorBracketMatch.foreground",null,d(751,null)),bft=J("editorOverviewRuler.border",{dark:"#7f7f7f4d",light:"#7f7f7f4d",hcDark:"#7f7f7f4d",hcLight:"#666666"},d(784,null)),uqi=J("editorOverviewRuler.background",null,d(783,null)),b2n=J("editorGutter.background",qo,d(770,null)),S2n=J("editorUnnecessaryCode.border",{dark:null,light:null,hcDark:Oe.fromHex("#fff").transparent(.8),hcLight:gi},d(800,null)),pqi=J("editorUnnecessaryCode.opacity",{dark:Oe.fromHex("#000a"),light:Oe.fromHex("#0007"),hcDark:null,hcLight:null},d(801,null)),I2n=J("editorGhostText.border",{dark:null,light:null,hcDark:Oe.fromHex("#fff").transparent(.8),hcLight:Oe.fromHex("#292929").transparent(.8)},d(768,null)),mqi=J("editorGhostText.foreground",{dark:Oe.fromHex("#ffffff56"),light:Oe.fromHex("#0007"),hcDark:null,hcLight:null},d(769,null)),y2n=J("editorGhostText.background",null,d(767,null)),QPo=new Oe(new Bt(0,122,204,.6)),y9=J("editorOverviewRuler.rangeHighlightForeground",QPo,d(794,null),!0),NIe=J("editorOverviewRuler.errorForeground",{dark:new Oe(new Bt(255,18,18,.7)),light:new Oe(new Bt(255,18,18,.7)),hcDark:new Oe(new Bt(255,50,50,1)),hcLight:"#B5200D"},d(792,null)),hqi=J("editorOverviewRuler.warningForeground",{dark:Bh,light:Bh,hcDark:n9,hcLight:n9},d(795,null)),w9=J("editorOverviewRuler.infoForeground",{dark:fm,light:fm,hcDark:r9,hcLight:r9},d(793,null)),Sft=J("editorBracketHighlight.foreground1",{dark:"#FFD700",light:"#0431FAFF",hcDark:"#FFD700",hcLight:"#0431FAFF"},d(742,null)),Ift=J("editorBracketHighlight.foreground2",{dark:"#DA70D6",light:"#319331FF",hcDark:"#DA70D6",hcLight:"#319331FF"},d(743,null)),yft=J("editorBracketHighlight.foreground3",{dark:"#179FFF",light:"#7B3814FF",hcDark:"#87CEFA",hcLight:"#7B3814FF"},d(744,null)),wft=J("editorBracketHighlight.foreground4","#00000000",d(745,null)),Cft=J("editorBracketHighlight.foreground5","#00000000",d(746,null)),xft=J("editorBracketHighlight.foreground6","#00000000",d(747,null)),gqi=J("editorBracketHighlight.unexpectedBracket.foreground",{dark:new Oe(new Bt(255,18,18,.8)),light:new Oe(new Bt(255,18,18,.8)),hcDark:new Oe(new Bt(255,50,50,1)),hcLight:"#B5200D"},d(748,null)),fqi=J("editorBracketPairGuide.background1","#00000000",d(758,null)),vqi=J("editorBracketPairGuide.background2","#00000000",d(759,null)),bqi=J("editorBracketPairGuide.background3","#00000000",d(760,null)),Sqi=J("editorBracketPairGuide.background4","#00000000",d(761,null)),Iqi=J("editorBracketPairGuide.background5","#00000000",d(762,null)),yqi=J("editorBracketPairGuide.background6","#00000000",d(763,null)),wqi=J("editorBracketPairGuide.activeBackground1","#00000000",d(752,null)),Cqi=J("editorBracketPairGuide.activeBackground2","#00000000",d(753,null)),xqi=J("editorBracketPairGuide.activeBackground3","#00000000",d(754,null)),kqi=J("editorBracketPairGuide.activeBackground4","#00000000",d(755,null)),Eqi=J("editorBracketPairGuide.activeBackground5","#00000000",d(756,null)),Tqi=J("editorBracketPairGuide.activeBackground6","#00000000",d(757,null)),w2n=J("editorUnicodeHighlight.border",Bh,d(787,null)),C2n=J("editorUnicodeHighlight.background",tGi,d(786,null));is((a,i)=>{let e=a.getColor(qo),t=a.getColor(PIe),o=t&&!t.isTransparent()?t:e;o&&i.addRule(`.monaco-editor .inputarea.ime-input { background-color: ${o}; }`)});var kft=class extends Jw{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 Yt(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 Ie(s,1)).lineNumber,u=l.convertModelPositionToViewPosition(new Ie(c,1)).lineNumber,p=l.convertModelPositionToViewPosition(new Ie(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)}},Eft=class extends kft{_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()}},Tft=class extends kft{_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(PIe),t=a.getColor(q$i);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(RJt)){let o=a.getColor(RJt);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}; }`),Ug(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 _ft=class extends Jw{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 m9(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 Dft=class extends mu{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 "+J$(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 AN(e.domNode,p,this._context.viewLayout.getScrollable())),PS.write(this.scrollbar.getDomNode(),6),this.scrollbarDomNode=or(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 "+J$(this._context.theme.type)),!0}prepareRender(i){}render(i){this.scrollbar.renderNow()}};var Yse=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}},MJt=class{constructor(i,e,t){this.className=i;this.zIndex=e;this.tooltip=t}},PJt=class{constructor(){this.decorations=[]}add(i){this.decorations.push(i)}getDecorations(){return this.decorations}},OIe=class extends Jw{_render(i,e,t){let o=[];for(let s=i;s<=e;s++){let l=s-i;o[l]=new PJt}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 MJt(l,c,s.tooltip))}return o}},Lft=class extends mu{constructor(e){super(e);this._widgets={};this._context=e;let t=this._context.configuration.options,o=t.get(165);this.domNode=or(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=or(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 Ie(g,0)),v=this._context.viewModel.glyphLanes.getLanesAtLine(f.lineNumber).indexOf(p);t.push(new AJt(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 Ie(u,0)),h=this._context.viewModel.glyphLanes.getLanesAtLine(p.lineNumber).indexOf(r.preference.lane);t.push(new NJt(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 bS(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=or(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 AJt=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 OJt(this.lineNumber,this.laneIndex,i)}},NJt=class{constructor(i,e,t,o){this.lineNumber=i;this.laneIndex=e;this.zIndex=t;this.widget=o;this.type=1}},OJt=class{constructor(i,e,t){this.lineNumber=i;this.laneIndex=e;this.combinedClassName=t}};var FIe=class extends C{constructor(){super(...arguments);this._isDisposed=!1}dispose(){super.dispose(),this._isDisposed=!0}assertNotDisposed(){if(this._isDisposed)throw new Error("TextModelPart is disposed!")}};function eq(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 VN=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}},tq=class{constructor(i,e){this.top=i;this.endColumn=e}};var Rft=class extends FIe{constructor(e,t){super();this.textModel=e;this.languageConfigurationService=t}getLanguageConfiguration(e){return this.languageConfigurationService.getLanguageConfiguration(e)}_computeIndentLevel(e){return eq(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 ni("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 U=V-2;U>=0;U--){let G=this._computeIndentLevel(U);if(G>=0){l=U,c=G;break}}}if(u===-2){u=-1,p=-1;for(let U=V;U<n;U++){let G=this._computeIndentLevel(U);if(G>=0){u=U,p=G;break}}}},g=-2,f=-1,v=-2,b=-1,S=V=>{if(g===-2){g=-1,f=-1;for(let U=V-2;U>=0;U--){let G=this._computeIndentLevel(U);if(G>=0){g=U,f=G;break}}}if(v!==-1&&(v===-2||v<V-1)){v=-1,b=-1;for(let U=V;U<n;U++){let G=this._computeIndentLevel(U);if(G>=0){v=U,b=G;break}}}},y=0,w=!0,k=0,T=!0,N=0,O=0;for(let V=0;w||T;V++){let U=e-V,G=e+V;V>1&&(U<1||U<t)&&(w=!1),V>1&&(G>n||G>o)&&(T=!1),V>5e4&&(w=!1,T=!1);let $=-1;if(w&&U>=1){let pe=this._computeIndentLevel(U-1);pe>=0?(u=U-1,p=pe,$=Math.ceil(pe/this.textModel.getOptions().indentSize)):(h(U),$=this._getIndentLevelForWhitespaceLine(s,c,p))}let te=-1;if(T&&G<=n){let pe=this._computeIndentLevel(G-1);pe>=0?(g=G-1,f=pe,te=Math.ceil(pe/this.textModel.getOptions().indentSize)):(S(G),te=this._getIndentLevelForWhitespaceLine(s,f,b))}if(V===0){O=$;continue}if(V===1){if(G<=n&&te>=0&&O+1===te){w=!1,y=G,k=G,N=te;continue}if(U>=1&&$>=0&&$-1===O){T=!1,y=U,k=U,N=$;continue}if(y=e,k=e,N=O,N===0)return{startLineNumber:y,endLineNumber:k,indent:N}}w&&($>=N?y=U:w=!1),T&&(te>=N?k=G:T=!1)}return{startLineNumber:y,endLineNumber:k,indent:N}}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=ju(h,g=>s||g.range.startLineNumber!==g.range.endLineNumber)?.range}let u=this.textModel.getOptions().bracketPairColorizationOptions.independentColorPoolPerBracketType,p=new nqe;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 VN(-1,h.openingBracketRange.getEndPosition().column,f,new tq(!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;Ap(this.textModel.getLineContent(h.closingBracketRange.startLineNumber))<h.closingBracketRange.startColumn-1&&(T=!0);let V=Math.max(v.lineNumber,e),U=Math.min(b.lineNumber,t),G=T?1:0;for(let $=V;$<U+G;$++)r[$-e].push(new VN(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 VN(k,-1,f,new tq(!1,v.column),-1,-1)),b.lineNumber<=t&&y>k&&r[b.lineNumber-e].push(new VN(k,-1,f,new tq(!T,b.column),-1,-1)))}for(let h of r)h.sort((g,f)=>g.visibleColumn-f.visibleColumn);return r}getVisibleColumnFromPosition(e){return al.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)}},nqe=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 Mft=class extends Jw{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 Ie(l,1))?.left??0;for(let g of u){let f=g.column===-1?h+(g.visibleColumn-1)*this._spaceWidth:i.visibleRangeForPosition(new Ie(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 Ie(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 bS(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 VN(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 WIe(a){if(!(a&&a.isTransparent()))return a}is((a,i)=>{let e=[{bracketColor:Sft,guideColor:fqi,guideColorActive:wqi},{bracketColor:Ift,guideColor:vqi,guideColorActive:Cqi},{bracketColor:yft,guideColor:bqi,guideColorActive:xqi},{bracketColor:wft,guideColor:Sqi,guideColorActive:kqi},{bracketColor:Cft,guideColor:Iqi,guideColorActive:Eqi},{bracketColor:xft,guideColor:yqi,guideColorActive:Tqi}],t=new nqe,o=[{indentColor:fft,indentColorActive:vft},{indentColor:J$i,indentColorActive:oqi},{indentColor:Z$i,indentColorActive:nqi},{indentColor:eqi,indentColorActive:rqi},{indentColor:tqi,indentColorActive:sqi},{indentColor:iqi,indentColorActive:aqi}],n=e.map(s=>{let l=a.getColor(s.bracketColor),c=a.getColor(s.guideColor),u=a.getColor(s.guideColorActive),p=WIe(WIe(c)??l?.transparent(.3)),h=WIe(WIe(u)??l);if(!(!p||!h))return{guideColor:p,guideColorActive:h}}).filter(mo),r=o.map(s=>{let l=a.getColor(s.indentColor),c=a.getColor(s.indentColorActive),u=WIe(l),p=WIe(c);if(!(!u||!p))return{indentColor:u,indentColorActive:p}}).filter(mo);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 VIe=class a extends Jw{static{this.CLASS_NAME="line-numbers"}constructor(i){super(),this._context=i,this._readConfig(),this._lastCursorModelPosition=new Ie(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 Ie(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=Wn?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 Ie(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(X$i),t=a.getColor(lqi);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 tE="monaco-mouse-cursor-text";var BIe=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 iq=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 FJt=class{constructor(){this._currentVisibleRange=new z(1,1,1,1)}getCurrentVisibleRange(){return this._currentVisibleRange}setCurrentVisibleRange(i){this._currentVisibleRange=i}},WJt=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}},VJt=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}},Pft=class a extends mu{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 iq(o,this._context.theme.type),this._linesContent=t,this._textRangeRestingSpot=document.createElement("div"),this._visibleLines=new RIe(this._context,{createLine:()=>new pW(e,this._viewLineOptions)}),this.domNode=this._visibleLines.domNode,PS.write(this.domNode,8),this.domNode.setClassName(`view-lines ${tE}`),Pd(this.domNode,r),this._maxLineWidth=0,this._asyncUpdateLineWidths=new Dt(()=>{this._updateLineWidthsSlow()},200),this._asyncCheckMonospaceFontAssumptions=new Dt(()=>{this._checkMonospaceFontAssumptions()},2e3),this._lastRenderedData=new FJt,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,Pd(this.domNode,t),this._onOptionsMaybeChanged(),i.hasChanged(165)&&(this._maxLineWidth=0),!0}_onOptionsMaybeChanged(){let i=this._context.configuration,e=new iq(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 WJt(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 VJt(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 Ie(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 Ie(o,s)}_getViewLineDomNode(i){for(;i&&i.nodeType===1;){if(i.className===pW.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 BIe(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 BIe(this.domNode.domNode,this._textRangeRestingSpot),l=0;e&&(l=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new Ie(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 Ie(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 dIe(b.outsideRenderedLine,p,m9.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 BIe(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 uIe(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(),Wn&&!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 Aft=class extends OIe{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 Yse(s.range.startLineNumber,s.range.endLineNumber,l,s.options.linesDecorationsTooltip??null,c));let u=s.options.firstLineDecorationClassName;u&&(t[o++]=new Yse(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 HIe=class a extends mu{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=or(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=or(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 Nft=class extends OIe{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 Yse(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 BN=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 _qi=(()=>{let a=[];for(let i=32;i<=126;i++)a.push(i);return a.push(65533),a})(),Dqi=(a,i)=>(a-=32,a<0||a>96?i<=2?(a+96)%96:95:a);var UIe=class a extends C{constructor(){super();this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._updateColorMap(),this._register(kc.onDidChange(e=>{e.changedColorMap&&this._updateColorMap()}))}static{this._INSTANCE=null}static getInstance(){return this._INSTANCE||(this._INSTANCE=Mp(new a)),this._INSTANCE}_updateColorMap(){let e=kc.getColorMap();if(!e){this._colors=[BN.Empty],this._backgroundIsLight=!0;return}this._colors=[BN.Empty];for(let o=1;o<e.length;o++){let n=e[o].rgba;this._colors[o]=new BN(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 ni(`Missing color for colorId ${e}`)),t=BN.Empty),t}backgroundIsLight(){return this._backgroundIsLight}};var rqe=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]=Sre(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=Dqi(o,c),S=i.width*4,y=s.r,w=s.g,k=s.b,T=n.r-y,N=n.g-w,O=n.b-k,V=Math.max(r,l),U=i.data,G=b*h*g,$=t*S+e*4;for(let te=0;te<f;te++){let pe=$;for(let de=0;de<h;de++){let se=v[G++]/255*(r/255);U[pe++]=y+T*se,U[pe++]=w+N*se,U[pe++]=k+O*se,U[pe++]=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,N=b+w*g,O=Math.max(n,s),V=i.data,U=t*h+e*4;for(let G=0;G<p;G++){let $=U;for(let te=0;te<c;te++)V[$++]=k,V[$++]=T,V[$++]=N,V[$++]=O;U+=h}}};var Rqi={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},Mqi=a=>{let i=new Uint8ClampedArray(a.length/2);for(let e=0;e<a.length;e+=2)i[e>>1]=Rqi[a[e]]<<4|Rqi[a[e+1]]&15;return i},BJt={1:wd(()=>Mqi("0000511D6300CF609C709645A78432005642574171487021003C451900274D35D762755E8B629C5BA856AF57BA649530C167D1512A272A3F6038604460398526BCA2A968DB6F8957C768BE5FBE2FB467CF5D8D5B795DC7625B5DFF50DE64C466DB2FC47CD860A65E9A2EB96CB54CE06DA763AB2EA26860524D3763536601005116008177A8705E53AB738E6A982F88BAA35B5F5B626D9C636B449B737E5B7B678598869A662F6B5B8542706C704C80736A607578685B70594A49715A4522E792")),2:wd(()=>Mqi("000000000000000055394F383D2800008B8B1F210002000081B1CBCBCC820000847AAF6B9AAF2119BE08B8881AD60000A44FD07DCCF107015338130C00000000385972265F390B406E2437634B4B48031B12B8A0847000001E15B29A402F0000000000004B33460B00007A752C2A0000000000004D3900000084394B82013400ABA5CFC7AD9C0302A45A3E5A98AB000089A43382D97900008BA54AA087A70A0248A6A7AE6DBE0000BF6F94987EA40A01A06DCFA7A7A9030496C32F77891D0000A99FB1A0AFA80603B29AB9CA75930D010C0948354D3900000C0948354F37460D0028BE673D8400000000AF9D7B6E00002B007AA8933400007AA642675C2700007984CFB9C3985B768772A8A6B7B20000CAAECAAFC4B700009F94A6009F840009D09F9BA4CA9C0000CC8FC76DC87F0000C991C472A2000000A894A48CA7B501079BA2C9C69BA20000B19A5D3FA89000005CA6009DA2960901B0A7F0669FB200009D009E00B7890000DAD0F5D092820000D294D4C48BD10000B5A7A4A3B1A50402CAB6CBA6A2000000B5A7A4A3B1A8044FCDADD19D9CB00000B7778F7B8AAE0803C9AB5D3F5D3F00009EA09EA0BAB006039EA0989A8C7900009B9EF4D6B7C00000A9A7816CACA80000ABAC84705D3F000096DA635CDC8C00006F486F266F263D4784006124097B00374F6D2D6D2D6D4A3A95872322000000030000000000008D8939130000000000002E22A5C9CBC70600AB25C0B5C9B400061A2DB04CA67001082AA6BEBEBFC606002321DACBC19E03087AA08B6768380000282FBAC0B8CA7A88AD25BBA5A29900004C396C5894A6000040485A6E356E9442A32CD17EADA70000B4237923628600003E2DE9C1D7B500002F25BBA5A2990000231DB6AFB4A804023025C0B5CAB588062B2CBDBEC0C706882435A75CA20000002326BD6A82A908048B4B9A5A668000002423A09CB4BB060025259C9D8A7900001C1FCAB2C7C700002A2A9387ABA200002626A4A47D6E9D14333163A0C87500004B6F9C2D643A257049364936493647358A34438355497F1A0000A24C1D590000D38DFFBDD4CD3126"))};var Oft=class a{static create(i,e){if(this.lastCreated&&i===this.lastCreated.scale&&e===this.lastFontFamily)return this.lastCreated;let t;return BJt[i]?t=new rqe(BJt[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 _qi)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 rqe(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 N=f;N<v;N++){let O=1-(N-Math.floor(N)),V=k+Math.floor(N)*4,U=O*T;S+=U,b+=i[V]*i[V+3]/255*U}}let y=b/S;c=Math.max(c,y),t[l++]=Sre(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 HN=ri?'"Segoe WPC", "Segoe UI", sans-serif':it?"-apple-system, BlinkMacSystemFont, sans-serif":'system-ui, "Ubuntu", "Droid Sans", sans-serif',JPo=async()=>{try{return[...await It.queryLocalFonts()].map(t=>t.family)}catch(a){return console.error(`Failed to query fonts: ${a}`),[]}},Fft=async()=>Xut?(await JPo()).map(e=>({body:`${e}`})):[];var tAo=140,iAo=2,Wft=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=HN,this.sectionHeaderFontSize=c.sectionHeaderFontSize*n,this.sectionHeaderLetterSpacing=c.sectionHeaderLetterSpacing,this.sectionHeaderFontColor=a._getSectionHeaderColor(e,t.getColor(1)),this.charRenderer=wd(()=>Oft.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(kGi);return t?new BN(t.rgba.r,t.rgba.g,t.rgba.b,Math.round(255*t.rgba.a)):e}static _getMinimapForegroundOpacity(i){let e=i.getColor(EGi);return e?BN._clamp(Math.round(255*e.rgba.a)):255}static _getSectionHeaderColor(i,e){let t=i.getColor(od);return t?new BN(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}},HJt=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 N=l*i.lineHeight+i.paddingTop+i.paddingBottom;i.scrollBeyondLastLine&&(N+=Math.max(0,n-i.lineHeight-i.paddingBottom));let O=Math.max(1,Math.floor(n*n/N)),V=Math.max(0,i.minimapHeight-O),U=V/(u-n),G=c*U,$=V>0,te=Math.floor(i.canvasInnerHeight/i.minimapLineHeight),pe=Math.floor(i.paddingTop/i.lineHeight);return new a(c,u,$,U,G,O,pe,1,Math.min(s,te))}let b;if(r&&t!==s){let N=t-e+1;b=Math.floor(N*g/h)}else{let N=n/v;b=Math.floor(N*g/h)}let S=Math.floor(i.paddingTop/v),y=Math.floor(i.paddingBottom/v);if(i.scrollBeyondLastLine){let N=n/v;y=Math.max(y,N-1)}let w;if(y>0){let N=n/v;w=(S+s+y-N-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 N=w>0;return new a(c,u,N,k,T,b,S,1,s)}else{let N;e>1?N=e+S:N=Math.max(1,c/v);let O,V=Math.max(1,Math.floor(N-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 U=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,U)}}},Vft=class a{static{this.INVALID=new a(-1)}constructor(i){this.dy=i}onContentChanged(){this.dy=-1}onTokensChanged(){this.dy=-1}},Bft=class{constructor(i,e,t){this.renderedLayout=i,this._imageData=e,this._renderedLines=new oqe({createLine:()=>Vft.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)}},UJt=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}},Hft=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}=QGe.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}},Uft=class extends mu{constructor(e){super(e);this._sectionHeaderCache=new il(10,1.5);this.tokensColorTracker=UIe.getInstance(),this._selections=[],this._minimapSelections=null,this.options=new Wft(this._context.configuration,this._context.theme,this.tokensColorTracker);let[t]=Hft.compute(this.options,this._context.viewModel.getLineCount(),null);this._samplingState=t,this._shouldCheckSampling=!1,this._actual=new zJt(e.theme,this)}dispose(){this._actual.dispose(),super.dispose()}getDomNode(){return this._actual.getDomNode()}_onOptionsMaybeChanged(){let e=new Wft(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]=Hft.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 Yt(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 pIe(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)}},zJt=class a extends C{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($Xt),this._domNode=or(document.createElement("div")),PS.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=or(document.createElement("div")),this._shadow.setClassName("minimap-shadow-hidden"),this._domNode.appendChild(this._shadow),this._canvas=or(document.createElement("canvas")),this._canvas.setPosition("absolute"),this._canvas.setLeft(0),this._domNode.appendChild(this._canvas),this._decorationsCanvas=or(document.createElement("canvas")),this._decorationsCanvas.setPosition("absolute"),this._decorationsCanvas.setClassName("minimap-decorations-layer"),this._decorationsCanvas.setLeft(0),this._domNode.appendChild(this._decorationsCanvas),this._slider=or(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=or(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(Vo(this._domNode.domNode,re.MOUSE_OVER,()=>{this._isMouseOverMinimap=!0})),this._register(Vo(this._domNode.domNode,re.MOUSE_LEAVE,()=>{this._isMouseOverMinimap=!1})),this._pointerDownListener=Vo(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=Yn(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 cL,this._sliderPointerDownListener=Vo(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=ws.addTarget(this._domNode.domNode),this._sliderTouchStartListener=j(this._domNode.domNode,Gn.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,Gn.Change,o=>{o.preventDefault(),o.stopPropagation(),this._lastRenderData&&this._gestureInProgress&&this.scrollDueToTouchEvent(o)},{passive:!1}),this._sliderTouchEndListener=Vo(this._domNode.domNode,Gn.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=Yn(this._domNode.domNode),u=Math.min(Math.abs(l-n),Math.abs(l-c.left),Math.abs(l-c.left-c.width));if(ri&&u>tAo){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 UJt(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($Xt),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=HJt.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 zft(e.startLineNumber,e.endLineNumber,!1);this._renderSelectionLineHighlights(u,t,p,e,s),this._renderDecorationsLineHighlights(u,o,p,e,s);let h=new zft(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(iW,s,e.canvas.width,l-s),s=g),l=f}l>s&&e.fillRect(iW,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(iW,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,iAo,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 iW;if((o-1)*r>=s)return s;let c=e.get(t);if(!c){let u=this._model.getLineContent(t);c=[iW];let p=iW;for(let h=1;h<u.length+1;h++){let g=u.charCodeAt(h-1),f=g===9?n*r:AT(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-iW);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,iW,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 Se=this._lastRenderData._get();return new Bft(e,Se.imageData,Se.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,N=(S===1?2:3)*w,O=n>N?Math.floor((n-N)/2):0,V=g.a/255,U=new BN(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 Se=0,ke=o-t+1;Se<ke;Se++)c[Se]&&a._renderLine(r,U,g.a,b,S,k,v,f,y,G,O,p,u[Se],w,n),$[Se]=new Vft(G),G+=n;let te=s===-1?0:s,de=(l===-1?r.height:l)-te;return this._canvas.domNode.getContext("2d").putImageData(r,0,0,0,te,r.width,de),new Bft(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,N=-1,O=t*r;for(let G=o;G<=n;G++){let $=G-o,te=G-p,pe=te>=0&&te<g?h[te].dy:-1;if(pe===-1){l[$]=!0,O+=r;continue}let de=pe*f*4,se=(pe+r)*f*4,Se=O*f*4,ke=(O+r)*f*4;k===de&&N===Se?(k=se,N=ke):(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=de,k=se,T=Se,N=ke),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),U=y===-1?-1:y/(f*4);return[V,U,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=iW,N=0,O=0;for(let V=0,U=y.getCount();V<U;V++){let G=y.getEndOffset(V),$=y.getForeground(V),te=l.getColor($);for(;N<G;N++){if(T>w)return;let pe=S.charCodeAt(N);if(pe===9){let de=g-(N+O)%g;O+=de-1,T+=de*s}else if(pe===32)T+=s;else{let de=AT(pe)?2:1;for(let se=0;se<de;se++)if(r===2?u.blockRenderChar(e,T,p+h,te,c,t,o,k):u.renderChar(e,T,p+h,pe,te,c,t,o,v,n,k),T+=s,T>w)return}}}}},zft=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 Kft=class extends mu{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=or(document.createElement("div")),PS.write(this._domNode,4),this._domNode.setClassName("overlayWidgets"),this.overflowingOverlayWidgetsDomNode=or(document.createElement("div")),PS.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=or(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=Yn(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 sqe=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}},Gft=class{constructor(i,e){this.tabSize=i,this.data=e}},Zse=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}},KU=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?oU(i):!0}static containsRTL(i,e,t){return!e&&t?yM(i):!1}};var eae=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 KJt=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(bft);this.borderColor=o?o.toString():null,this.hideCursor=t.get(68);let n=e.getColor(I9);this.cursorColorSingle=n?n.transparent(.7).toString():null;let r=e.getColor(hft);this.cursorColorPrimary=r?r.transparent(.7).toString():null;let s=e.getColor(gft);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(uqi),h=kc.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&&Oe.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 $ft=class extends mu{constructor(e){super(e);this._actualShouldRender=0;this._renderedDecorations=[];this._renderedCursorPositions=[];this._domNode=or(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=kc.onDidChange(t=>{t.changedColorMap&&this._updateSettings(!0)}),this._cursorPositions=[{position:new Ie(1,1),color:this._settings.cursorColorSingle}]}dispose(){super.dispose(),this._tokensColorTrackerListener.dispose()}_updateSettings(e){let t=new KJt(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)=>Ie.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?Oe.Format.CSS.formatHexA(e):""),this._domNode.setDisplay("none");return}let t=this._context.viewModel.getAllOverviewRulerDecorations(this._context.theme);if(t.sort(eae.compareByRenderingProps),this._actualShouldRender===1&&!eae.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=Oe.Format.CSS.formatHexA(e),h.fillRect(0,0,o,n)):(h.clearRect(0,0,o,n),h.fillStyle=Oe.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,N=S.length/3;T<N;T++){let O=S[3*T],V=S[3*T+1],U=S[3*T+2],G=s.getVerticalOffsetForLineNumber(V)*c|0,$=(s.getVerticalOffsetForLineNumber(U)+r)*c|0;if($-G<u){let pe=(G+$)/2|0;pe<p?pe=p:pe+p>n&&(pe=n-p),G=pe-p,$=pe+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 N=0,O=this._cursorPositions.length;N<O;N++){let V=this._cursorPositions[N].color;if(!V)continue;let U=this._cursorPositions[N].position,G=s.getVerticalOffsetForLineNumber(U.lineNumber)*c|0;G<b?G=b:G+b>n&&(G=n-b);let $=G-b,te=$+v;$>k+1||V!==T?(N!==0&&T&&h.fillRect(S,w,y,k-w),w=$,k=te):te>k&&(k=te),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 qft=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}},aqe=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}},jft=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(aqe.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 qft(v-b,v+b,y);u.setColorZone(w),s.push(w)}return this._colorZonesInvalid=!1,s.sort(qft.compare),s}};var Qft=class extends Jk{constructor(i,e){super(),this._context=i;let t=this._context.configuration.options;this._domNode=or(document.createElement("canvas")),this._domNode.setClassName(e),this._domNode.setPosition("absolute"),this._domNode.setLayerHinting(!0),this._domNode.setContain("strict"),this._zoneManager=new jft(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 Yft=class extends mu{constructor(i){super(i),this.domNode=or(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=or(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 Xft=class extends mu{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=or(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 GJt=class{constructor(i){this.left=i.left,this.width=i.width,this.startStyle=null,this.endStyle=null}},$Jt=class{constructor(i,e){this.lineNumber=i,this.ranges=e}};function oAo(a){return new GJt(a)}function nAo(a){return new $Jt(a.lineNumber,a.ranges.map(oAo))}var Zft=class a extends Jw{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;Jft(p-v)<n?g.top=2:p>v&&(g.top=1),Jft(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;Jft(p-v)<n?g.bottom=2:v<p&&p<b&&(g.bottom=1),Jft(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(nAo);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 N=k.startStyle,O=k.endStyle;if(N.top===1||N.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;N.top===1&&(V+=" "+a.SELECTION_TOP_RIGHT),N.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 N=k.startStyle,O=k.endStyle;N.top===0&&(T+=" "+a.SELECTION_TOP_LEFT),N.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(nGi);e&&!e.isTransparent()&&i.addRule(`.monaco-editor .view-line span.inline-selected-text { color: ${e}; }`)});function Jft(a){return a<0?-a:a}var evt=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 lqe=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=or(document.createElement("div")),this._domNode.setClassName(`cursor ${tE}`),this._domNode.setHeight(this._context.viewLayout.getLineHeightForLineNumber(1)),this._domNode.setTop(0),this._domNode.setLeft(0),Pd(this._domNode,o),this._domNode.setDisplay("none"),this._position=new Ie(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),Pd(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]=vpt(t,e-1);return[new Ie(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=Me(this._domNode.domNode),S;this._cursorStyle===1?(S=a7t(b,this._lineCursorWidth>0?this._lineCursorWidth:2),S>2&&(e=n,t=this._getTokenClassName(o))):S=a7t(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 evt(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 evt(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} ${tE} ${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 tvt=class a extends mu{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 lqe(this._context,0),this._secondaryCursors=[],this._renderData=[],this._domNode=or(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 Nl,this._cursorFlatBlinkInterval=new ZD,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 lqe(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,Me(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:I9,background:mft},{class:".cursor-primary",foreground:hft,background:Q$i},{class:".cursor-secondary",foreground:gft,background:Y$i}];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}; }`),Ug(a.type)&&i.addRule(`.monaco-editor .cursors-layer.has-selection ${t.class} { border-left: 1px solid ${n}; border-right: 1px solid ${n}; }`)}}});var jJt=()=>{throw new Error("Invalid change accessor")},ivt=class extends mu{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=or(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=or(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 Ie(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)}};sAo(i,o),o.addZone=jJt,o.removeZone=jJt,o.layoutZone=jJt}),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:or(e.domNode),marginDomNode:e.marginDomNode?or(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 sAo(a,i){try{return a(i)}catch(e){mt(e);return}}var ovt=class extends Jw{constructor(i){super(),this._context=i,this._options=new nvt(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 nvt(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 di(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(AIe),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="",N=!1,O=Ap(s),V;O===-1?(N=!0,O=l,V=l):V=tv(s);let U=0,G=t&&t[U],$=0;for(let te=u;te<l;te++){let pe=s.charCodeAt(te);if(G&&G.endExclusive<=te&&(U++,G=t&&t[U]),pe!==9&&pe!==32||h&&!N&&te<=V)continue;if(p&&te>=O&&te<=V&&pe===32){let se=te-1>=0?s.charCodeAt(te-1):0,Se=te+1<l?s.charCodeAt(te+1):0;if(se!==32&&Se!==32)continue}if(p&&c&&te===l-1){let se=te-1>=0?s.charCodeAt(te-1):0;if(pe===32&&se!==32&&se!==9)continue}if(t&&!(G&&G.start<=te&&te<G.endExclusive))continue;let de=i.visibleRangeForPosition(new Ie(e,te+1));de&&(r?($=Math.max($,de.left),pe===9?T+=this._renderArrow(g,b,de.left):T+=`<circle cx="${(de.left+b/2).toFixed(2)}" cy="${(g/2).toFixed(2)}" r="${(b/7).toFixed(2)}" />`):pe===9?T+=`<div class="mwh" style="left:${de.left}px;height:${g}px;">${k?"\uFFEB":"\u2192"}</div>`:T+=`<div class="mwh" style="left:${de.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]}},nvt=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 rvt=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 svt=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 avt=class{constructor(i,e,t){this.configuration=i,this.theme=new svt(e),this.viewModel=t,this.viewLayout=t.viewLayout}addEventHandler(i){this.viewModel.addViewEventHandler(i)}removeEventHandler(i){this.viewModel.removeViewEventHandler(i)}};var hW=new Float32Array([1,0,1,1,0,1,0,0,0,1,1,0]);function UN(a){if(!a)throw new Error(`Value "${a}" cannot be null`);return a}function lvt(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 ni("Could not observe device pixel dimensions")}return Z(()=>t?.disconnect())}var aAo=0,GU=class extends C{constructor(e,t,o,n){super();this.fontSize=e;this.fontFamily=t;this.devicePixelRatio=o;this._decorationStyleCache=n;this.id=aAo++;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=it?"greyscale":"subpixel";let r=Math.ceil(this.fontSize*o);this._canvas=new OffscreenCanvas(r*3,r*3),this._ctx=UN(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=Qu.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 ES(200),g=Qu.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[Qu.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([mi],GU.prototype,"cacheKey",1);var zIe=class extends C{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()}};zIe=I([m(0,ne)],zIe);var QJt=class extends zIe{_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())}}},YJt=class extends zIe{_requestCallback(i){return Ki().requestIdleCallback(i)}_cancelCallback(i){Ki().cancelIdleCallback(i)}},XJt="requestIdleCallback"in Ki()?YJt:QJt,cvt=class{constructor(i){this._queue=i.createInstance(XJt)}set(i){this._queue.clear(),this._queue.enqueue(i)}flush(){this._queue.flush()}};cvt=I([m(0,F)],cvt);var dvt=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=UN(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 ni("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=UN(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 uvt=class{constructor(i,e,t){this._canvas=i;this._textureIndex=e;this._slabs=[];this._activeSlabsByDims=new GH;this._unusedRects=[];this._openRegionsByHeight=new Map;this._openRegionsByWidth=new Map;this._allocatedGlyphs=new Set;this._nextIndex=0;this._ctx=UN(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 ni("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&&Pqi(this._openRegionsByWidth,u,{x:n.x+this._slabW-u,w:u,y:n.y,h:this._slabH-(p??0)}),p&&Pqi(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=UN(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 Pqi(a,i,e){let t=a.get(i);t||(t=[],a.set(i,t)),t.push(e)}var Zw=class extends C{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 GH;this._glyphInOrderSet=new Set;switch(this._canvas=new OffscreenCanvas(t,t),this._colorMap=r.getColorTheme().tokenColorMap,o){case"shelf":this._allocator=new dvt(this._canvas,e);break;case"slab":this._allocator=new uvt(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>=Zw.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()}};Zw=I([m(3,ne),m(4,De)],Zw);var iE=class extends C{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 GH;this._onDidDeleteGlyphs=this._register(new E);this.onDidDeleteGlyphs=this._onDidDeleteGlyphs.event;this._allocatorType=t?.allocatorType??"slab",this._register(H.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(()=>Ue(this._pages)))}static{this.maximumPageCount=16}get pages(){return this._pages}_initFirstPage(){let e=this._instantiationService.createInstance(Zw,0,this.pageSize,this._allocatorType);this._pages.push(e);let t=new GU(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>=iE.maximumPageCount)throw new Error(`Attempt to create a texture atlas page past the limit ${iE.maximumPageCount}`);return this._pages.push(this._instantiationService.createInstance(Zw,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 ni("Cannot warm atlas without color map");this._warmUpTask.value?.clear();let o=this._warmUpTask.value=this._instantiationService.createInstance(XJt);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)})}};iE=I([m(3,De),m(4,F)],iE);var St=gt,Ne=ae("notificationService");function C9(a){if(a){let i=a;return typeof i.id=="string"&&typeof i.label=="string"}return!1}var tae=class{constructor(){this.progress=new JJt;this.onDidClose=H.None;this.onDidChangeVisibility=H.None}updateSeverity(i){}updateMessage(i){}updateActions(i){}close(){}},JJt=class{infinite(){}done(){}total(i){}worked(i){}};function x9(a,i){return i===St.Error?d(2214,null,a):i===St.Warning?d(2216,null,a):d(2215,null,a)}var BI;(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 ZJt(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,HD(r)?r():r),ZJt(s)}t.createBuffer=i;function e(o,n){return ZJt(o.createTexture(n))}t.createTexture=e})(BI||={});function ZJt(a){return{object:a,dispose:()=>a.destroy()}}var pvt=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 Aqi(a,i){return new eZt(a,i)}var eZt=class extends C{constructor(e,t){super();this.propertySpecs=e;this.capacity=t;this._dirtyTracker=new pvt;this._propertySpecsMap=new Map;this._entries=new Vs;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(()=>Ue(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 tZt(this.view,this._propertySpecsMap,this._dirtyTracker,this._entries.size,e),o=this._entries.push(t),n=[];return n.push(H.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),Ue(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}},tZt=class extends C{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 Nqi=`

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 mvt=class extends Jk{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(Aqi([{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(BI.createBuffer(this._device,{label:"Monaco rectangle renderer uniform buffer",size:24,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST},()=>u())).object,this._register(lvt(this._canvas,Ki(),(p,h)=>{this._device.queue.writeBuffer(o,0,u(p,h))}))}let n=2;this._scrollOffsetBindBuffer=this._register(BI.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=()=>BI.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(H.runAndSubscribe(this._shapeCollection.onDidChangeBuffer,()=>{this._shapeBindBuffer.value=r(),this._pipeline&&this._updateBindGroup(this._pipeline,o)})),this._vertexBuffer=this._register(BI.createBuffer(this._device,{label:"Monaco rectangle renderer vertex buffer",size:hW.byteLength,usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST},hW)).object;let s=this._device.createShaderModule({label:"Monaco rectangle renderer shader module",code:Nqi});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(hW.length/2,this._shapeCollection.entryCount),o.end();let r=t.finish();this._device.queue.submit([r])}};var hvt=class extends C{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=[...rh().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 gvt=class{constructor(){this._nextId=1;this._cacheById=new Map;this._cacheByStyle=new GH}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 ec=class extends C{constructor(e,t,o,n,r){super();this._instantiationService=t;this._notificationService=o;this.configurationService=n;this._themeService=r;this.maxGpuCols=2e3;this.canvas=or(document.createElement("canvas")),this.canvas.setClassName("editorCanvas"),this._register(H.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=UN(this.canvas.domNode.getContext("webgpu")),ec.device||(ec.device=BI.requestDevice(u=>{let p=[{label:d(189,null),run:()=>this.configurationService.updateValue("editor.experimentalGpuAcceleration","off")}];this._notificationService.prompt(St.Warning,u,p)}).then(u=>(ec.deviceSync=u.object,ec._atlas||(ec._atlas=this._instantiationService.createInstance(iE,u.object.limits.maxTextureDimension2D,void 0,ec.decorationStyleCache)),u.object)));let s=Le(this,Ki().devicePixelRatio);this._register(j(Ki(),"resize",()=>{s.set(Ki().devicePixelRatio,void 0)})),this.devicePixelRatio=s,this._register(_s(this.devicePixelRatio,()=>ec.atlas?.clear())),this._register(this._themeService.onDidColorThemeChange(()=>{ec.decorationCssRuleExtractor.clear(),ec.atlas?.clear()}));let l=Le(this,{width:this.canvas.domNode.width,height:this.canvas.domNode.height});this._register(lvt(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=Le(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(mvt,e,this.contentLeft,this.devicePixelRatio,this.canvas.domNode,this.ctx,ec.device))}static{this._decorationCssRuleExtractor=new hvt}static get decorationCssRuleExtractor(){return ec._decorationCssRuleExtractor}static{this._decorationStyleCache=new gvt}static get decorationStyleCache(){return ec._decorationStyleCache}static get atlas(){if(!ec._atlas)throw new ni("Cannot call ViewGpuContext.textureAtlas before device is resolved");return ec._atlas}get atlas(){return ec.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=ec._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(!Oqi(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=ec._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(!Oqi(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}};ec=I([m(1,F),m(2,Ne),m(3,B),m(4,De)],ec);var cAo=["color","font-weight","opacity","text-decoration","text-decoration-color","text-decoration-line","text-decoration-style","text-decoration-thickness"];function Oqi(a,i){if(!cAo.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:Oe.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 k9(a,i){return a.isBasicASCII&&i.useMonospaceOptimizations?new iZt(a):new oZt(a)}var iZt=class{constructor(i){this._content=i.content}getSegmentAtIndex(i){return this._content[i]}getSegmentData(i){}},oZt=class{constructor(i){this._segments=[];let e=i.content,t=Wu.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 KIe=class extends Jk{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 fvt=`
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, ${Zw.maximumGlyphCount}>, ${iE.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 vvt=class a extends KIe{constructor(e,t,o,n){super(e,t,o,n);this.type="viewport";this.wgsl=fvt;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(BI.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(BI.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,N,O,V,U=0,G=0,$,te=Ki().devicePixelRatio,pe;this._scrollInitialized||(this.onScrollChanged(),this._scrollInitialized=!0),this._cellBindBufferLineCapacity<e.endLineNumber-e.startLineNumber+1&&this._rebuildCellBuffer(e.endLineNumber-e.startLineNumber+1);let de=new Float32Array(this._cellValueBuffers[this._activeDoubleBufferIndex]);de.fill(0);let se=a.maxSupportedColumns*6;for(s=e.startLineNumber;s<=e.endLineNumber;s++)if(this._viewGpuContext.canRender(t,e,s)){O=e.getViewLineRenderingData(s),p=0,pe=k9(O,t),r=t.spaceWidth*te,c=(O.minColumn-1)*r,$=O.tokens,f=O.minColumn-1,v=0;for(let Ee=0,He=$.getCount();Ee<He;Ee++)if(v=$.getEndOffset(Ee),!(v<=f)){for(b=$.getMetadata(Ee),l=f;l<v&&!(l>a.maxSupportedColumns);l++){if(n=pe.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,N=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 Fe=ec.decorationCssRuleExtractor.getStyleRules(this._viewGpuContext.canvas.domNode,V.inlineClassName);for(let Qt of Fe)for(let Ze of Qt.style){let Ti=Qt.styleMap.get(Ze)?.toString()??"";switch(Ze){case"color":{let ti=Oe.Format.CSS.parse(Ti);if(!ti)throw new ni("Invalid color format "+Ti);y=ti.toNumber32Bit();break}case"font-weight":{dAo(Ti)>=400?S=!0:S=!1;break}case"opacity":{w=uAo(Ti);break}case"text-decoration":case"text-decoration-line":{Ti==="line-through"&&(k=!0);break}case"text-decoration-thickness":{let ti=Ti.match(/^(\d+(?:\.\d+)?)px$/);ti&&(T=parseFloat(ti[1]));break}case"text-decoration-color":{let ti=Ti,bo=Ti.match(/^var\((--[^,]+),\s*(?:initial|inherit)\)$/);bo&&(ti=ec.decorationCssRuleExtractor.resolveCssVariable(this._viewGpuContext.canvas.domNode,bo[1]));let Ro=Oe.Format.CSS.parse(ti);Ro&&(N=Ro.toNumber32Bit());break}case"text-decoration-style":break;default:throw new ni("Unexpected inline decoration style")}}}if(o===" "||o==="	"){if(g=((s-1)*a.maxSupportedColumns+l)*6,de.fill(0,g,g+6),o==="	"){let Fe=l+p;p=al.nextRenderTabStop(l+p,O.tabSize),c+=r*(p-Fe),p-=l+1}else c+=r;continue}let Ve=ec.decorationStyleCache.getOrCreateEntry(y,S,w,k,T,N);h=this._viewGpuContext.atlas.getGlyph(this.glyphRasterizer,o,b,Ve,c),u=Math.round(e.relativeVerticalOffset[s-e.startLineNumber]*te+Math.floor((e.lineHeight*te-(h.fontBoundingBoxAscent+h.fontBoundingBoxDescent))/2)+h.fontBoundingBoxAscent),g=((s-e.startLineNumber)*a.maxSupportedColumns+l)*6,de[g+0]=Math.floor(c),de[g+1]=u,de[g+4]=h.glyphIndex,de[g+5]=h.pageIndex,c+=r}f=v}U=((s-e.startLineNumber)*a.maxSupportedColumns+v)*6,G=(s-e.startLineNumber)*a.maxSupportedColumns*6,de.fill(0,U,G)}let Se=(e.endLineNumber-e.startLineNumber+1)*se,ke=e.endLineNumber-e.startLineNumber+1;if(this._device.queue.writeBuffer(this._cellBindBuffer,0,de.buffer,0,Se*Float32Array.BYTES_PER_ELEMENT),ke<this._lastViewportLineCount){let Ee=this._lastViewportLineCount-ke,He=Se*Float32Array.BYTES_PER_ELEMENT,Ve=Ee*se*Float32Array.BYTES_PER_ELEMENT;this._device.queue.writeBuffer(this._cellBindBuffer,He,de.buffer,Se*Float32Array.BYTES_PER_ELEMENT,Ve)}return this._lastViewportLineCount=ke,this._activeDoubleBufferIndex=this._activeDoubleBufferIndex?0:1,this._visibleObjectCount=Se,Se}draw(e,t){if(this._visibleObjectCount<=0)throw new ni("Attempt to draw 0 objects");e.draw(hW.length/2,this._visibleObjectCount)}};function dAo(a){switch(a){case"lighter":case"normal":return 400;case"bolder":case"bold":return 700}return parseInt(a)}function uAo(a){return a.endsWith("%")?parseFloat(a.substring(0,a.length-1))/100:a.match(/^\d+(?:\.\d*)/)?parseFloat(a):1}var E9=class a extends KIe{constructor(e,t,o,n){super(e,t,o,n);this.type="fullfile";this.wgsl=fvt;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(BI.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(BI.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,N,O,V,U=0,G=0,$,te=Ki().devicePixelRatio,pe;this._scrollInitialized||(this.onScrollChanged(),this._scrollInitialized=!0);let de=new Float32Array(this._cellValueBuffers[this._activeDoubleBufferIndex]),se=a.maxSupportedColumns*6,Se=this._upToDateLines[this._activeDoubleBufferIndex],ke=3e3,Ee=0,He=this._queuedBufferUpdates[this._activeDoubleBufferIndex];for(;He.length;){let Fe=He.shift();switch(Fe.type){case 2:case 8:case 17:{de.fill(0),ke=1,Ee=Math.max(Ee,this._finalRenderedLine),this._finalRenderedLine=0;break}case 10:{let Qt=(Fe.fromLineNumber-1)*a.maxSupportedColumns*6,Ze=Fe.toLineNumber*a.maxSupportedColumns*6,Ti=(this._finalRenderedLine-(Fe.toLineNumber-Fe.fromLineNumber+1))*a.maxSupportedColumns*6;de.set(de.subarray(Ze),Qt),de.fill(0,Ti),ke=Math.min(ke,Fe.fromLineNumber),Ee=Math.max(Ee,this._finalRenderedLine),this._finalRenderedLine-=Fe.toLineNumber-Fe.fromLineNumber+1;break}}}for(s=e.startLineNumber;s<=e.endLineNumber;s++){if(!this._viewGpuContext.canRender(t,e,s)){U=(s-1)*a.maxSupportedColumns*6,G=s*a.maxSupportedColumns*6,de.fill(0,U,G),ke=Math.min(ke,s),Ee=Math.max(Ee,s);continue}if(!Se.has(s)){ke=Math.min(ke,s),Ee=Math.max(Ee,s),O=e.getViewLineRenderingData(s),p=0,pe=k9(O,t),r=t.spaceWidth*te,c=(O.minColumn-1)*r,$=O.tokens,f=O.minColumn-1,v=0;for(let Fe=0,Qt=$.getCount();Fe<Qt;Fe++)if(v=$.getEndOffset(Fe),!(v<=f)){for(b=$.getMetadata(Fe),l=f;l<v&&!(l>a.maxSupportedColumns);l++){if(n=pe.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,N=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=ec.decorationCssRuleExtractor.getStyleRules(this._viewGpuContext.canvas.domNode,V.inlineClassName);for(let ti of Ti)for(let bo of ti.style){let Ro=ti.styleMap.get(bo)?.toString()??"";switch(bo){case"color":{let _o=Oe.Format.CSS.parse(Ro);if(!_o)throw new ni("Invalid color format "+Ro);y=_o.toNumber32Bit();break}case"font-weight":{pAo(Ro)>=400?S=!0:S=!1;break}case"opacity":{w=mAo(Ro);break}case"text-decoration":case"text-decoration-line":{Ro==="line-through"&&(k=!0);break}case"text-decoration-thickness":{let _o=Ro.match(/^(\d+(?:\.\d+)?)px$/);_o&&(T=parseFloat(_o[1]));break}case"text-decoration-color":{let _o=Ro,sr=Ro.match(/^var\((--[^,]+),\s*(?:initial|inherit)\)$/);sr&&(_o=ec.decorationCssRuleExtractor.resolveCssVariable(this._viewGpuContext.canvas.domNode,sr[1]));let ln=Oe.Format.CSS.parse(_o);ln&&(N=ln.toNumber32Bit());break}case"text-decoration-style":break;default:throw new ni("Unexpected inline decoration style")}}}if(o===" "||o==="	"){if(g=((s-1)*a.maxSupportedColumns+l)*6,de.fill(0,g,g+6),o==="	"){let Ti=l+p;p=al.nextRenderTabStop(l+p,O.tabSize),c+=r*(p-Ti),p-=l+1}else c+=r;continue}let Ze=ec.decorationStyleCache.getOrCreateEntry(y,S,w,k,T,N);h=this._viewGpuContext.atlas.getGlyph(this.glyphRasterizer,o,b,Ze,c),u=Math.round(e.relativeVerticalOffset[s-e.startLineNumber]*te+Math.floor((e.lineHeight*te-(h.fontBoundingBoxAscent+h.fontBoundingBoxDescent))/2)+h.fontBoundingBoxAscent),g=((s-1)*a.maxSupportedColumns+l)*6,de[g+0]=Math.floor(c),de[g+1]=u,de[g+4]=h.glyphIndex,de[g+5]=h.pageIndex,c+=r}f=v}U=((s-1)*a.maxSupportedColumns+v)*6,G=s*a.maxSupportedColumns*6,de.fill(0,U,G),Se.add(s)}}let Ve=(e.endLineNumber-e.startLineNumber+1)*se;return ke=Math.min(ke,a.maxSupportedLines),Ee=Math.min(Ee,a.maxSupportedLines),ke<=Ee&&this._device.queue.writeBuffer(this._cellBindBuffer,(ke-1)*se*Float32Array.BYTES_PER_ELEMENT,de.buffer,(ke-1)*se*Float32Array.BYTES_PER_ELEMENT,(Ee-ke+1)*se*Float32Array.BYTES_PER_ELEMENT),this._finalRenderedLine=Math.max(this._finalRenderedLine,Ee),this._activeDoubleBufferIndex=this._activeDoubleBufferIndex?0:1,this._visibleObjectCount=Ve,Ve}draw(e,t){if(this._visibleObjectCount<=0)throw new ni("Attempt to draw 0 objects");e.draw(hW.length/2,this._visibleObjectCount,void 0,(t.startLineNumber-1)*a.maxSupportedColumns)}_queueBufferUpdate(e){this._queuedBufferUpdates[0].push(e),this._queuedBufferUpdates[1].push(e)}};function pAo(a){switch(a){case"lighter":case"normal":return 400;case"bolder":case"bold":return 700}return parseInt(a)}function mAo(a){return a.endsWith("%")?parseFloat(a.substring(0,a.length-1))/100:a.match(/^\d+(?:\.\d*)/)?parseFloat(a):1}var GIe=class extends mu{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(he(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=ec.deviceSync||await ec.device,this._store.isDisposed)return;let e=ec.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(BI.createBuffer(this._device,{label:"Monaco uniform buffer",size:24,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST},()=>p())).object,this._register(_s(this._viewGpuContext.canvasDevicePixelDimensions,({width:h,height:g})=>{this._device.queue.writeBuffer(o,0,p(h,g))})),this._register(_s(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(BI.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 GU(s,r,this._viewGpuContext.devicePixelRatio.get(),ec.decorationStyleCache)),this._register(_s(this._viewGpuContext.devicePixelRatio,()=>{this._refreshGlyphRasterizer()})),this._renderStrategy.value=this._instantiationService.createInstance(E9,this._context,this._viewGpuContext,this._device,this._glyphRasterizer),this._glyphStorageBuffer=this._register(BI.createBuffer(this._device,{label:"Monaco glyph storage buffer",size:iE.maximumPageCount*(Zw.maximumGlyphCount*24),usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST})).object,this._atlasGpuTextureVersions[0]=0,this._atlasGpuTextureVersions[1]=0,this._atlasGpuTexture=this._register(BI.createTexture(this._device,{label:"Monaco atlas texture",format:"rgba8unorm",size:{width:e.pageSize,height:e.pageSize,depthOrArrayLayers:iE.maximumPageCount},dimension:"2d",usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT})).object,this._updateAtlasStorageBufferAndTexture(),this._vertexBuffer=this._register(BI.createBuffer(this._device,{label:"Monaco vertex buffer",size:hW.byteLength,usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST},hW)).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<E9.maxSupportedLines&&this._viewportMaxColumn(e)<E9.maxSupportedColumns)return;this._logService.trace(`File is larger than ${E9.maxSupportedLines} lines or ${E9.maxSupportedColumns} columns, switching to viewport render strategy`);let t=this._instantiationService.createInstance(vvt,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 ec.atlas.pages.entries()){if(e>=iE.maximumPageCount){console.log(`Attempt to upload atlas page [${e}], only ${iE.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*Zw.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>Zw.maximumGlyphCount)throw new Error(`Attempting to write more glyphs (${r/6}) than the GPUBuffer can hold (${Zw.maximumGlyphCount})`);this._device.queue.writeBuffer(this._glyphStorageBuffer,e*6*Zw.maximumGlyphCount*Float32Array.BYTES_PER_ELEMENT,n,0,6*Zw.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 ni("Should not be called")}render(e){throw new ni("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 GU(o,t,n,ec.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 iq(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=k9(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=al.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 Ie(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 Ie(h+1,1)).lineNumber,S!==p&&(b.ranges[b.ranges.length-1].width+=c.spaceWidth)}u.push(new dIe(b.outsideRenderedLine,h,m9.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=k9(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=al.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=al.nextRenderTabStop(g,s.tabSize):g++}return new Vse(!1,[new NM(p*r.spaceWidth+h,(g-p)*r.spaceWidth+f)])}visibleRangeForPosition(e){let t=this._visibleRangesForLineRange(e.lineNumber,e.column,e.column);return t?new uIe(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=k9(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=al.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 Ie(e,g+1)}};GIe=I([m(2,F),m(3,ne)],GIe);var rZt=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()}},ZT=new rZt;var _e=ae("keybindingService");var $Ie=class extends mu{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 qIe=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 cqe(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 sZt(a){let i=0,e=-1;do{if(e=a.indexOf(`
`,e+1),e===-1)break;i++}while(!0);return i}var aZt=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)}},bvt=new aZt;var cZt=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 Ie(this.modelLineNumber,this.distanceToModelLineStart+1),t=new Ie(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}},lZt=yc,jIe=class extends $Ie{constructor(e,t,o,n,r,s,l){super(t);this._keybindingService=s;this._instantiationService=l;this._primaryCursorPosition=new Ie(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 Yt(1,1,1,1)],this._modelSelections=[new Yt(1,1,1,1)],this._lastRenderPosition=null,this.textArea=or(document.createElement("textarea")),PS.write(this.textArea,7),this.textArea.setClassName(`inputarea ${tE}`),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",cqe(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=or(document.createElement("div")),this.textAreaCover.setPosition("absolute"),o.appendChild(this.textArea),o.appendChild(this.textAreaCover);let h=new qIe,g={context:this._context,getScreenReaderContent:()=>{if(this._accessibilitySupport===1){let b=this._selections[0];if(it&&b.isEmpty()){let y=b.getStartPosition(),w=this._getWordBeforePosition(y);if(w.length===0&&(w=this._getCharacterBeforePosition(y)),w.length>0)return new NS(w,w.length,w.length,z.fromPositions(y),0)}if(it&&!b.isEmpty()&&this._context.viewModel.getValueLengthInRange(b,0)<500){let y=this._context.viewModel.getValueInRange(b,0);return new NS(y,0,y.length,b,0)}if(Vb&&!b.isEmpty()){let y="vscode-placeholder";return new NS(y,0,y.length,null,void 0)}return NS.EMPTY}if(Q6t){let b=this._selections[0];if(b.isEmpty()){let S=b.getStartPosition(),[y,w]=this._getAndroidWordAtPosition(S);if(y.length>0)return new NS(y,w,w,z.fromPositions(S),0)}return NS.EMPTY}let v=h.fromEditorSelection(this._context.viewModel,this._selections[0],this._accessibilityPageSize,this._accessibilitySupport===0);return NS.fromScreenReaderContentState(v)},deduceModelPosition:(v,b,S)=>this._context.viewModel.deduceModelPositionRelativeToViewPosition(v,b,S)},f=this._register(new oft(this.textArea.domNode));this._textAreaInput=this._register(this._instantiationService.createInstance(LIe,g,f,zo,{isAndroid:Q6t,isChrome:eU,isFirefox:yc,isSafari:Vb})),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?(JT&&console.log(` => compositionType: <<${v.text}>>, ${v.replacePrevCharCnt}, ${v.replaceNextCharCnt}, ${v.positionDelta}`),this._viewController.compositionType(v.text,v.replacePrevCharCnt,v.replaceNextCharCnt,v.positionDelta)):(JT&&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)),N=T.lastIndexOf(`
`),O=T.substring(N+1),V=O.lastIndexOf("	"),U=O.length-V-1,G=S.getStartPosition(),$=Math.min(G.column-1,U),te=G.column-1-$,pe=O.substring(0,O.length-$),{tabSize:de}=this._context.viewModel.model.getOptions(),se=hAo(this.textArea.domNode.ownerDocument,pe,this._fontInfo,de);return{distanceToModelLineStart:te,widthOfHiddenTextBefore:se}})(),{distanceToModelLineEnd:k}=(()=>{let T=b.value.substring(Math.max(b.selectionStart,b.selectionEnd)),N=T.indexOf(`
`),O=N===-1?T:T.substring(0,N),V=O.indexOf("	"),U=V===-1?O.length:O.length-V-1,G=S.getEndPosition(),$=Math.min(this._context.viewModel.model.getLineMaxColumn(G.lineNumber)-G.column,U);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 cZt(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 ${tE} 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 ${tE}`),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(ZT.onDidChange(()=>{this._ensureReadOnlyAttribute()})),this._register(bvt.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=jw(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=jw(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(!Ru(o.charCodeAt(0)))return o}return""}_setAccessibilityOptions(e){this._accessibilitySupport=e.get(2);let t=e.get(3);this._accessibilitySupport===2&&t===zb.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=lZt?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",cqe(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;!ZT.enabled||e.get(41)&&e.get(104)?this.textArea.setAttribute("readonly","true"):this.textArea.removeAttribute("readonly")}prepareRender(e){this._primaryCursorPosition=new Ie(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=sZt(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:(kc.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(it||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??sZt(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:lZt?0:1,useCover:!1})}_renderAtTopLeft(){this._doRender({lastRenderPosition:null,top:0,left:0,width:this._textAreaWidth,height:lZt?0:1,useCover:!0})}_doRender(e){this._lastRenderPosition=e.lastRenderPosition;let t=this.textArea,o=this.textAreaCover;Pd(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?Oe.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 "+HIe.OUTER_CLASS_NAME):n.get(76).renderType!==0?o.setClassName("monaco-editor-background textAreaCover "+VIe.CLASS_NAME):o.setClassName("monaco-editor-background textAreaCover")}};jIe=I([m(5,_e),m(6,F)],jIe);function hAo(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");Pd(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 QIe=class extends C{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=_M(this._domNode),t=e?e.activeElement:Pn(),o=this._domNode===t;this._handleFocusedChanged(o)}get isFocused(){return this._isFocused}};QIe=I([m(0,ne)],QIe);function YIe(a,i,e,t){return a.addEventListener(i,e,t),{dispose(){a.removeEventListener(i,e)}}}var gAo=Kg("richScreenReaderContent",{createHTML:a=>a}),dZt="data-line-number",XIe=class extends C{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=dqe.NULL;this._strategy=new mZt;this._renderedLines=new Map;this._renderedSelection=new Yt(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=dqe.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()||!ZT.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=Jv.filter(o.inlineDecorations,e,o.minColumn,o.maxColumn),h=r.isMonospace&&!u,g=c!==mx.OFF,f;n.get(47)==="off"?f=n.get(113):f="none";let b=new hL(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 ES(1e4),y=uW(b,S),w=S.build(),k=gAo?.createHTML(w)??w,T=t.viewLayout.getLineHeightForLineNumber(e)+"px",N=document.createElement("div");return N.innerHTML=k,N.style.lineHeight=T,N.style.height=T,N.setAttribute(dZt,e.toString()),new uZt(N,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),N=c.domNode.firstChild,O=u.domNode.firstChild,V=N.childNodes,U=O.childNodes,G=V.item(k.partIndex),$=U.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||!Ao(s)||!l||!Ao(l))return;let c=s.parentElement?.parentElement,u=l.parentElement?.parentElement;if(!c||!u)return;let p=c.getAttribute(dZt),h=u.getAttribute(dZt);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=K$(v,s,o.startOffset),y=K$(b,l,o.endOffset);return e.direction==="forward"?new Yt(g,S,f,y):new Yt(f,y,g,S)}};XIe=I([m(3,Bi)],XIe);var uZt=class{constructor(i,e){this.domNode=i;this.characterMapping=e}},pZt=class{constructor(i,e){this.startLine=i;this.endLine=e}},dqe=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,[])}},mZt=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 pZt(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 dqe(i,l)}};var JIe=class extends C{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 qIe;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||!ZT.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 AM(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 Yt.fromPositions(b,S)}};JIe=I([m(3,Bi)],JIe);var eye=class extends C{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 Yt(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 XIe(this._domNode,this._context,this._viewController,this._accessibilityService):new JIe(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",cqe(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 Yt(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){Pd(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)}};eye=I([m(3,_e),m(4,Bi)],eye);var hZt;(i=>{function a(e,t){return new e.EditContext(t)}i.create=a})(hZt||={});var gZt=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)}},iae=new gZt;var oae=class extends $Ie{constructor(e,t,o,n,r,s,l){super(t);this._viewController=n;this._visibleRangeProvider=r;this.logService=l;this._previousEditContextSelection=new di(0,0);this._previousEditContextText="";this._editContextPrimarySelection=new Yt(1,1,1,1);this._parentBounds=null;this._decorations=[];this._primarySelection=new Yt(1,1,1,1);this._targetWindowId=-1;this._scrollTop=0;this._scrollLeft=0;this._linesVisibleRanges=null;this.domNode=new Bg(document.createElement("div")),this.domNode.setClassName("native-edit-context"),this._imeTextArea=new Bg(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 QIe(l,this.domNode.domNode,h=>{l.trace("NativeEditContext#handleFocusChange : ",h),this._screenReaderSupport.handleFocusChange(h),this._context.viewModel.setHasFocus(h)}));let c=Me(this.domNode.domNode);this._editContext=hZt.create(c),this.setEditContextOnDomNode(),this._screenReaderSupport=this._register(s.createInstance(eye,this.domNode,t,this._viewController)),this._register(j(this.domNode.domNode,"copy",h=>{this.logService.trace("NativeEditContext#copy"),zU.electronBugWorkaroundCopyEventHasFired=!0;let g=DIe(h,!1,this._context,this.logService,yc);this._onWillCopy.fire(g),!g.isHandled&&g.ensureClipboardGetsEditorData()})),this._register(j(this.domNode.domNode,"cut",h=>{this.logService.trace("NativeEditContext#cut");let g=DIe(h,!0,this._context,this.logService,yc);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",()=>{vx.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=>{vx.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=ift(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(YIe(this._editContext,"textformatupdate",h=>this._handleTextFormatUpdate(h))),this._register(YIe(this._editContext,"characterboundsupdate",h=>this._updateCharacterBounds(h)));let u;this._register(YIe(this._editContext,"textupdate",h=>{vx.onInput();let g=h.text;if(g.length===1){let f=g.charCodeAt(0);if(Ru(f)){u=g;return}if(nN(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(YIe(this._editContext,"compositionstart",h=>{this._updateEditContext(),this._viewController.compositionStart(),this._context.viewModel.onCompositionStart()})),this._register(YIe(this._editContext,"compositionend",h=>{this._updateEditContext(),this._viewController.compositionEnd(),this._context.viewModel.onCompositionEnd()}));let p=!1;this._register(ZT.onDidChange(()=>{ZT.enabled&&p&&(this._focusTracker.resume(),this.domNode.focus(),p=!1),!ZT.enabled&&this.isFocused()&&(this._focusTracker.pause(),this._imeTextArea.focus(),p=!0)})),this._register(iae.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 Yt(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===Pn())}writeScreenReaderContent(){this._screenReaderSupport.writeScreenReaderContent()}isFocused(){return this._focusTracker.isFocused}focus(){this._focusTracker.focus(),this.refreshFocusState()}refreshFocusState(){this._focusTracker.refreshFocusState()}setEditContextOnDomNode(){let e=Me(this.domNode.domNode),t=sg(e);this._targetWindowId!==t&&(this.domNode.domNode.editContext=this._editContext,this._targetWindowId=t)}_onKeyUp(e){vx.onKeyUp(),this._viewController.emitKeyUp(new Ii(e))}_onKeyDown(e){vx.onKeyDown();let t=new Ii(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 di(e.selectionStartOffset,e.selectionEndOffset)}_emitTypeEvent(e,t){if(!this._editContext)return;let o=this._previousEditContextSelection.endExclusive,n=this._previousEditContextSelection.start;this._previousEditContextSelection=new di(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 Ie(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 AM(this._editContext.text);for(let c=e.rangeStart;c<e.rangeEnd;c++){let u=l.getPosition(c),p=this._editContextPrimarySelection.startLineNumber-1,h=new Ie(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 N=this._context.viewLayout.getLineHeightForLineNumber(S);s.push(new DOMRect(r.left+n+k-this._scrollLeft,w,T,N))}this._editContext.updateCharacterBounds(e.rangeStart,s)}};oae=I([m(5,F),m(6,ne)],oae);var Svt=class extends mu{constructor(e,t){super(e);this._viewGpuContext=t;this._gpuShapes=[];this._register(he(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?Oe.fromHex(c.color):this._context.theme.getColor(cqi)??Oe.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 Ivt=class a extends Jw{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 iq(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 eC=ae("userInteractionService");var tye=class extends Jk{constructor(e,t,o,n,r,s,l,c,u,p){super();this._instantiationService=u;this._userInteractionService=p;this._editContextClipboardListeners=new P;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 vZt(e,c,this._userInteractionService)),this._register(this._widgetFocusTracker.onChange(()=>{this._context.viewModel.setHasWidgetFocus(this._widgetFocusTracker.hasFocus())})),this._selections=[new Yt(1,1,1,1)],this._renderAnimationFrame=null,this._overflowGuardContainer=or(document.createElement("div")),PS.write(this._overflowGuardContainer,3),this._overflowGuardContainer.setClassName("overflow-guard"),this._viewController=new sft(n,s,l,o),this._context=new avt(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=or(document.createElement("div")),this._linesContent.setClassName("lines-content monaco-editor-background"),this._linesContent.setPosition("absolute"),this.domNode=or(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(ec,this._context)),this._scrollbar=new Dft(this._context,this._linesContent,this.domNode,this._overflowGuardContainer),this._viewParts.push(this._scrollbar),this._viewLines=new Pft(this._context,this._viewGpuContext,this._linesContent),this._viewGpuContext&&(this._viewLinesGpu=this._instantiationService.createInstance(GIe,this._context,this._viewGpuContext)),this._viewZones=new ivt(this._context),this._viewParts.push(this._viewZones);let h=new $ft(this._context);this._viewParts.push(h);let g=new Xft(this._context);this._viewParts.push(g);let f=new lft(this._context);this._viewParts.push(f),f.addDynamicOverlay(new Eft(this._context)),f.addDynamicOverlay(new Zft(this._context)),f.addDynamicOverlay(new Mft(this._context)),f.addDynamicOverlay(new _ft(this._context)),f.addDynamicOverlay(new ovt(this._context));let v=new cft(this._context);this._viewParts.push(v),v.addDynamicOverlay(new Tft(this._context)),v.addDynamicOverlay(new Nft(this._context)),v.addDynamicOverlay(new Aft(this._context)),v.addDynamicOverlay(new VIe(this._context)),this._viewGpuContext&&v.addDynamicOverlay(new Ivt(this._context,this._viewGpuContext)),this._glyphMarginWidgets=new Lft(this._context),this._viewParts.push(this._glyphMarginWidgets);let b=new HIe(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 uft(this._context,this.domNode),this._viewParts.push(this._contentWidgets),this._viewCursors=new tvt(this._context),this._viewParts.push(this._viewCursors),this._overlayWidgets=new Kft(this._context,this.domNode),this._viewParts.push(this._overlayWidgets);let S=this._viewGpuContext?new Svt(this._context,this._viewGpuContext):new Yft(this._context);this._viewParts.push(S);let y=new dft(this._context);this._viewParts.push(y);let w=new Uft(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 rft(this._context,this._viewController,this._createPointerHandlerHelper()))}_instantiateEditContext(){return this._context.configuration.options.get(170)?this._instantiationService.createInstance(oae,this._ownerID,this._context,this._overflowGuardContainer,this._viewController,this._createTextAreaHandlerHelper()):this._instantiationService.createInstance(jIe,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 Pgt(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 Ie(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)+" "+J$(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 ni;if(this._renderAnimationFrame===null){this._editContext instanceof oae&&this._editContext.setEditContextOnDomNode();let e=this._createCoordinatedRendering();this._renderAnimationFrame=fZt.INSTANCE.scheduleCoordinatedRendering({window:Me(this.domNode?.domNode),prepareRenderText:()=>{if(this._store.isDisposed)throw new ni;try{return e.prepareRenderText()}finally{this._renderAnimationFrame=null}},renderText:t=>{if(this._store.isDisposed)throw new ni;return e.renderText(t)},prepareRender:(t,o)=>{if(this._store.isDisposed)throw new ni;return e.prepareRender(t,o)},render:(t,o)=>{if(this._store.isDisposed)throw new ni;return e.render(t,o)}})}}_flushAccumulatedAndRenderNow(){let e=this._createCoordinatedRendering(),t=T9(()=>e.prepareRenderText());if(!t)return;let o=T9(()=>e.renderText(t));if(!o)return;let[n,r]=o;T9(()=>e.prepareRender(n,r)),T9(()=>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(vx.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 rvt(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 xgt(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 Ie(n.lineNumber,n.column));return r?r.left:-1}getLineWidth(e){let t=this._context.viewModel.model,o=this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(new Ie(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?MIe.convertViewToModelMouseTarget(o,this._context.viewModel.coordinatesConverter):null}createOverviewRuler(e){return new Qft(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()}};tye=I([m(8,F),m(9,eC)],tye);function T9(a){try{return a()}catch(i){return mt(i),null}}var fZt=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,Ah(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]=T9(()=>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]=T9(()=>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;T9(()=>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;T9(()=>r.render(l,c))}}},vZt=class extends C{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 oq=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 iye(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 iye(i-1,this.getMaxOutputOffset(i-1))}else if(t===1){let o=this.getOutputLineCount()-1;if(i<o&&e===this.getMaxOutputOffset(i))return new iye(i+1,this.getMinOutputOffset(i+1))}return new iye(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&&Fqi(this.injectionOptions[t.injectedTextIndex].cursorStops))return t.offsetInInputWithInjections+t.length;{let o=t.offsetInInputWithInjections;if(Wqi(this.injectionOptions[t.injectedTextIndex].cursorStops))return o;let n=t.injectedTextIndex-1;for(;n>=0&&this.injectionOffsets[n]===this.injectionOffsets[t.injectedTextIndex]&&!(Fqi(this.injectionOptions[n].cursorStops)||(o-=this.injectionOptions[n].content.length,Wqi(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}Hr(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 Fqi(a){return a==null?!0:a===1||a===0}function Wqi(a){return a==null?!0:a===2||a===0}var iye=class{constructor(i,e){this.outputLineIndex=i,this.outputOffset=e}toString(){return`${this.outputLineIndex}:${this.outputOffset}`}toPosition(i){return new Ie(i+this.outputLineIndex,this.outputOffset+1)}};function Vqi(){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 yvt=class{constructor(){this.changeType=1}},e_=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)}},pqe=class{constructor(i,e,t,o){this.changeType=2;this.lineNumber=i,this.lineNumberPostEdit=e,this.detail=t,this.injectedText=o}},wvt=class{constructor(i,e,t,o){this.ownerId=i,this.decorationId=e,this.lineNumber=t,this.lineHeightMultiplier=o}},Cvt=class{constructor(i,e){this.ownerId=i,this.lineNumber=e}},xvt=class{constructor(i,e,t){this.changeType=3;this.fromLineNumber=i,this.toLineNumber=e,this.lastUntouchedLinePostEdit=t}},kvt=class{constructor(i,e,t,o,n){this.changeType=4;this.injectedTexts=n,this.fromLineNumber=i,this.fromLineNumberPostEdit=e,this.count=t,this.detail=o}get toLineNumber(){return this.fromLineNumber+this.count-1}get toLineNumberPostEdit(){return this.fromLineNumberPostEdit+this.count-1}},Evt=class{constructor(){this.changeType=5}},nae=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)}},oye=class{constructor(i){this.changes=i}},nye=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}}},rye=class{constructor(i){this.changes=i}},_9=class a{constructor(i,e){this.rawContentChangedEvent=i;this.contentChangedEvent=e}merge(i){let e=nae.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 bAo=Kg("domLineBreaksComputer",{createHTML:a=>a}),Tvt=class a{constructor(i){this.targetWindow=i}static create(i){return new a(new WeakRef(i))}createLineBreaksComputer(i,e,t,o,n,r){let s=[],l=[];return{addRequest:(c,u,p)=>{s.push(c),l.push(u)},finalize:()=>SAo(Oi(this.targetWindow.deref()),s,i,e,t,o,n,l)}}};function SAo(a,i,e,t,o,n,r,s){function l(U){let G=s[U];if(G){let $=e_.applyInjectedText(i[U],G),te=G.map(de=>de.options),pe=G.map(de=>de.column-1);return new oq(pe,te,[$.length],[],0)}else return null}if(o===-1){let U=[];for(let G=0,$=i.length;G<$;G++)U[G]=l(G);return U}let c=Math.round(o*e.typicalHalfwidthCharacterWidth),u=n===3?2:n===2?1:0,p=Math.round(t*u),h=Math.ceil(e.spaceWidth*p),g=document.createElement("div");Pd(g,e);let f=new ES(1e4),v=[],b=[],S=[],y=[],w=[];for(let U=0;U<i.length;U++){let G=e_.applyInjectedText(i[U],s[U]),$=0,te=0,pe=c;if(n!==0)if($=Ap(G),$===-1)$=0;else{for(let ke=0;ke<$;ke++){let Ee=G.charCodeAt(ke)===9?t-te%t:1;te+=Ee}let Se=Math.ceil(e.spaceWidth*te);Se+e.typicalFullwidthCharacterWidth>c?($=0,te=0):pe=c-Se}let de=G.substr($),se=IAo(de,te,t,pe,f,h);v[U]=$,b[U]=te,S[U]=de,y[U]=se[0],w[U]=se[1]}let k=f.build(),T=bAo?.createHTML(k)??k;g.innerHTML=T,g.style.position="absolute",g.style.top="10000px",r==="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 N=document.createRange(),O=Array.prototype.slice.call(g.children,0),V=[];for(let U=0;U<i.length;U++){let G=O[U],$=yAo(N,G,S[U],y[U]);if($===null){V[U]=l(U);continue}let te=v[U],pe=b[U]+p,de=w[U],se=[];for(let He=0,Ve=$.length;He<Ve;He++)se[He]=de[$[He]];if(te!==0)for(let He=0,Ve=$.length;He<Ve;He++)$[He]+=te;let Se,ke,Ee=s[U];Ee?(Se=Ee.map(He=>He.options),ke=Ee.map(He=>He.column-1)):(Se=null,ke=null),V[U]=new oq(ke,Se,$,se,pe)}return g.remove(),V}function IAo(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:AT(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 yAo(a,i,e,t){if(e.length<=1)return null;let o=Array.prototype.slice.call(i.children,0),n=[];try{SZt(a,o,t,0,null,e.length-1,null,n)}catch(r){return console.log(r),null}return n.length===0?null:(n.push(e.length),n)}function SZt(a,i,e,t,o,n,r,s){if(t===n||(o=o||bZt(a,i,e[t],e[t+1]),r=r||bZt(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=bZt(a,i,e[l],e[l+1]);SZt(a,i,e,t,o,l,c,s),SZt(a,i,e,l,c,n,r,s)}function bZt(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 _vt=class extends C{constructor(){super();this._editor=null;this._instantiationService=null;this._instances=this._register(new jt);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(jv(Me(this._editor.getDomNode()),()=>{this._instantiateSome(1)})),this._register(jv(Me(this._editor.getDomNode()),()=>{this._instantiateSome(2)})),this._register(jv(Me(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 jv(Me(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 Dvt=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 oE(a){return(a.metadata&1)>>>0}function Xu(a,i){a.metadata=a.metadata&254|i<<0}function HI(a){return(a.metadata&2)>>>1===1}function Vu(a,i){a.metadata=a.metadata&253|(i?1:0)<<1}function jqi(a){return(a.metadata&4)>>>2===1}function Bqi(a,i){a.metadata=a.metadata&251|(i?1:0)<<2}function Qqi(a){return(a.metadata&64)>>>6===1}function Hqi(a,i){a.metadata=a.metadata&191|(i?1:0)<<6}function Yqi(a){return(a.metadata&128)>>>7===1}function Uqi(a,i){a.metadata=a.metadata&127|(i?1:0)<<7}function wAo(a){return(a.metadata&24)>>>3}function zqi(a,i){a.metadata=a.metadata&231|i<<3}function CAo(a){return(a.metadata&32)>>>5===1}function Kqi(a,i){a.metadata=a.metadata&223|(i?1:0)<<5}var rae=class{constructor(i,e,t){this.metadata=0,this.parent=this,this.left=this,this.right=this,Xu(this,1),this.start=e,this.end=t,this.delta=0,this.maxEnd=t,this.id=i,this.ownerId=0,this.options=null,Bqi(this,!1),Hqi(this,!1),zqi(this,1),Kqi(this,!1),Uqi(this,!1),this.cachedVersionId=0,this.cachedAbsoluteStart=e,this.cachedAbsoluteEnd=t,this.range=null,Vu(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;Bqi(this,e==="squiggly-error"||e==="squiggly-warning"||e==="squiggly-info"),Hqi(this,this.options.glyphMarginClassName!==null),zqi(this,this.options.stickiness),Kqi(this,this.options.collapseOnReplaceEdit),Uqi(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}},da=new rae(null,0,0);da.parent=da;da.left=da;da.right=da;Xu(da,0);var L9=class{constructor(){this.root=da,this.requestNormalizeDelta=!1}intervalSearch(i,e,t,o,n,r,s){return this.root===da?[]:LAo(this,i,e,t,o,n,r,s)}search(i,e,t,o,n){return this.root===da?[]:Gqi(this,i,e,t,o,n)}collectNodesFromOwner(i){return _Ao(this,i)}collectNodesPostOrder(){return DAo(this)}insert(i){$qi(this,i),this._normalizeDeltaIfNecessary()}delete(i){qqi(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=EAo(this,i,i+e);for(let r=0,s=n.length;r<s;r++){let l=n[r];qqi(this,l)}this._normalizeDeltaIfNecessary(),TAo(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,kAo(l,i,i+e,t,o),l.maxEnd=l.end,$qi(this,l)}this._normalizeDeltaIfNecessary()}getAllInOrder(){return Gqi(this,0,!1,!1,0,!1)}_normalizeDeltaIfNecessary(){this.requestNormalizeDelta&&(this.requestNormalizeDelta=!1,xAo(this))}};function xAo(a){let i=a.root,e=0;for(;i!==da;){if(i.left!==da&&!HI(i.left)){i=i.left;continue}if(i.right!==da&&!HI(i.right)){e+=i.delta,i=i.right;continue}i.start=e+i.start,i.end=e+i.end,i.delta=0,nq(i),Vu(i,!0),Vu(i.left,!1),Vu(i.right,!1),i===i.parent.right&&(e-=i.parent.delta),i=i.parent}Vu(a.root,!1)}function sye(a,i,e,t){return a<e?!0:a>e||t===1?!1:t===2?!0:i}function kAo(a,i,e,t,o){let n=wAo(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&&CAo(a)&&(a.start=i,h=!0,a.end=i,f=!0);{let b=o?1:l>0?2:0;!h&&sye(p,r,i,b)&&(h=!0),!f&&sye(g,s,i,b)&&(f=!0)}if(u>0&&!o){let b=l>c?2:0;!h&&sye(p,r,i+u,b)&&(h=!0),!f&&sye(g,s,i+u,b)&&(f=!0)}{let b=o?1:0;!h&&sye(p,r,e,b)&&(a.start=i+c,h=!0),!f&&sye(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 EAo(a,i,e){let t=a.root,o=0,n=0,r=0,s=0,l=[],c=0;for(;t!==da;){if(HI(t)){Vu(t.left,!1),Vu(t.right,!1),t===t.parent.right&&(o-=t.parent.delta),t=t.parent;continue}if(!HI(t.left)){if(n=o+t.maxEnd,n<i){Vu(t,!0);continue}if(t.left!==da){t=t.left;continue}}if(r=o+t.start,r>e){Vu(t,!0);continue}if(s=o+t.end,s>=i&&(t.setCachedOffsets(r,s,0),l[c++]=t),Vu(t,!0),t.right!==da&&!HI(t.right)){o+=t.delta,t=t.right;continue}}return Vu(a.root,!1),l}function TAo(a,i,e,t){let o=a.root,n=0,r=0,s=0,l=t-(e-i);for(;o!==da;){if(HI(o)){Vu(o.left,!1),Vu(o.right,!1),o===o.parent.right&&(n-=o.parent.delta),nq(o),o=o.parent;continue}if(!HI(o.left)){if(r=n+o.maxEnd,r<i){Vu(o,!0);continue}if(o.left!==da){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),Vu(o,!0);continue}if(Vu(o,!0),o.right!==da&&!HI(o.right)){n+=o.delta,o=o.right;continue}}Vu(a.root,!1)}function _Ao(a,i){let e=a.root,t=[],o=0;for(;e!==da;){if(HI(e)){Vu(e.left,!1),Vu(e.right,!1),e=e.parent;continue}if(e.left!==da&&!HI(e.left)){e=e.left;continue}if(e.ownerId===i&&(t[o++]=e),Vu(e,!0),e.right!==da&&!HI(e.right)){e=e.right;continue}}return Vu(a.root,!1),t}function DAo(a){let i=a.root,e=[],t=0;for(;i!==da;){if(HI(i)){Vu(i.left,!1),Vu(i.right,!1),i=i.parent;continue}if(i.left!==da&&!HI(i.left)){i=i.left;continue}if(i.right!==da&&!HI(i.right)){i=i.right;continue}e[t++]=i,Vu(i,!0)}return Vu(a.root,!1),e}function Gqi(a,i,e,t,o,n){let r=a.root,s=0,l=0,c=0,u=[],p=0;for(;r!==da;){if(HI(r)){Vu(r.left,!1),Vu(r.right,!1),r===r.parent.right&&(s-=r.parent.delta),r=r.parent;continue}if(r.left!==da&&!HI(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&&jqi(r)&&(h=!1),t&&Yqi(r)&&(h=!1),n&&!Qqi(r)&&(h=!1),h&&(u[p++]=r),Vu(r,!0),r.right!==da&&!HI(r.right)){s+=r.delta,r=r.right;continue}}return Vu(a.root,!1),u}function LAo(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!==da;){if(HI(l)){Vu(l.left,!1),Vu(l.right,!1),l===l.parent.right&&(c-=l.parent.delta),l=l.parent;continue}if(!HI(l.left)){if(u=c+l.maxEnd,u<i){Vu(l,!0);continue}if(l.left!==da){l=l.left;continue}}if(p=c+l.start,p>e){Vu(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&&jqi(l)&&(v=!1),n&&Yqi(l)&&(v=!1),s&&!Qqi(l)&&(v=!1),v&&(g[f++]=l)}if(Vu(l,!0),l.right!==da&&!HI(l.right)){c+=l.delta,l=l.right;continue}}return Vu(a.root,!1),g}function $qi(a,i){if(a.root===da)return i.parent=da,i.left=da,i.right=da,Xu(i,0),a.root=i,a.root;RAo(a,i),D9(i.parent);let e=i;for(;e!==a.root&&oE(e.parent)===1;)if(e.parent===e.parent.parent.left){let t=e.parent.parent.right;oE(t)===1?(Xu(e.parent,0),Xu(t,0),Xu(e.parent.parent,1),e=e.parent.parent):(e===e.parent.right&&(e=e.parent,mqe(a,e)),Xu(e.parent,0),Xu(e.parent.parent,1),hqe(a,e.parent.parent))}else{let t=e.parent.parent.left;oE(t)===1?(Xu(e.parent,0),Xu(t,0),Xu(e.parent.parent,1),e=e.parent.parent):(e===e.parent.left&&(e=e.parent,hqe(a,e)),Xu(e.parent,0),Xu(e.parent.parent,1),mqe(a,e.parent.parent))}return Xu(a.root,0),i}function RAo(a,i){let e=0,t=a.root,o=i.start,n=i.end;for(;;)if(PAo(o,n,t.start+e,t.end+e)<0)if(t.left===da){i.start-=e,i.end-=e,i.maxEnd-=e,t.left=i;break}else t=t.left;else if(t.right===da){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=da,i.right=da,Xu(i,1)}function qqi(a,i){let e,t;if(i.left===da?(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===da?(e=i.left,t=i):(t=MAo(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,Xu(e,0),i.detach(),IZt(),nq(e),a.root.parent=da;return}let o=oE(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,Xu(t,oE(i)),i===a.root?a.root=t:i===i.parent.left?i.parent.left=t:i.parent.right=t,t.left!==da&&(t.left.parent=t),t.right!==da&&(t.right.parent=t)),i.detach(),o){D9(e.parent),t!==i&&(D9(t),D9(t.parent)),IZt();return}D9(e),D9(e.parent),t!==i&&(D9(t),D9(t.parent));let n;for(;e!==a.root&&oE(e)===0;)e===e.parent.left?(n=e.parent.right,oE(n)===1&&(Xu(n,0),Xu(e.parent,1),mqe(a,e.parent),n=e.parent.right),oE(n.left)===0&&oE(n.right)===0?(Xu(n,1),e=e.parent):(oE(n.right)===0&&(Xu(n.left,0),Xu(n,1),hqe(a,n),n=e.parent.right),Xu(n,oE(e.parent)),Xu(e.parent,0),Xu(n.right,0),mqe(a,e.parent),e=a.root)):(n=e.parent.left,oE(n)===1&&(Xu(n,0),Xu(e.parent,1),hqe(a,e.parent),n=e.parent.left),oE(n.left)===0&&oE(n.right)===0?(Xu(n,1),e=e.parent):(oE(n.left)===0&&(Xu(n.right,0),Xu(n,1),mqe(a,n),n=e.parent.left),Xu(n,oE(e.parent)),Xu(e.parent,0),Xu(n.left,0),hqe(a,e.parent),e=a.root));Xu(e,0),IZt()}function MAo(a){for(;a.left!==da;)a=a.left;return a}function IZt(){da.parent=da,da.delta=0,da.start=0,da.end=0}function mqe(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!==da&&(e.left.parent=i),e.parent=i.parent,i.parent===da?a.root=e:i===i.parent.left?i.parent.left=e:i.parent.right=e,e.left=i,i.parent=e,nq(i),nq(e)}function hqe(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!==da&&(e.right.parent=i),e.parent=i.parent,i.parent===da?a.root=e:i===i.parent.right?i.parent.right=e:i.parent.left=e,e.right=i,i.parent=e,nq(i),nq(e)}function Xqi(a){let i=a.end;if(a.left!==da){let e=a.left.maxEnd;e>i&&(i=e)}if(a.right!==da){let e=a.right.maxEnd+a.delta;e>i&&(i=e)}return i}function nq(a){a.maxEnd=Xqi(a)}function D9(a){for(;a!==da;){let i=Xqi(a);if(a.maxEnd===i)return;a.maxEnd=i,a=a.parent}}function PAo(a,i,e,t){return a===e?i-t:a-e}var Cl=ae("undoRedoService");var gqe=class{constructor(i,e){this.resource=i;this.elements=e}},R9=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}},$U=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 OS(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 rq=class a{constructor(i){this.replacements=i;Ey(Ty(i,(e,t)=>e.lineRange.endLineNumberExclusive<=t.lineRange.startLineNumber))}static{this.empty=new a([])}static deserialize(i){return new a(i.map(e=>qU.deserialize(e)))}static fromStringEdit(i,e){let t=bp.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=Xr.joinReplacements(n,e);n.length=0;let u=qU.fromSingleTextEdit(c,e);o.push(u)}return new a(o)}static createFromUnsorted(i){let e=i.slice();return e.sort(tl(t=>t.lineRange.startLineNumber,qd)),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 Qc(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(ro.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 ro(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 qU(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 s6(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 qU(e[o],i.slice(t.lineRange.startLineNumber-1,t.lineRange.endLineNumberExclusive-1))))}},qU=class a{constructor(i,e){this.lineRange=i;this.newLines=e}static deserialize(i){return new a(ro.ofLength(i[0],i[1]-i[0]),i[2])}static fromSingleTextEdit(i,e){let t=mc(i.text),o=i.range.startLineNumber,n=e.getValueOfRange(z.fromPositions(new Ie(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 Ie(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 ro(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 Ie(n,r)}else t=new Ie(1,1);let o=e.addToPosition(new Ie(1,1));return new Xr(z.fromPositions(t,o),"")}else return new Xr(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 Xr(z.fromPositions(new Ie(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 Xr(o,n)}}toSingleEdit(i){let e=this.toSingleTextEdit(i),t=i.getTransformer().getOffsetRange(e.range);return new Hc(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 ro(e,t),this.newLines.slice(o,this.newLines.length-n))}toLineEdit(){return new rq([this])}},AAo;(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})(AAo||={});var NAo=Symbol("TextModelEditSource"),fqe=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 nE(a){return new fqe(a,NAo)}function Zqi(a){switch(a.metadata.source){case"inlineCompletionAccept":case"inlineCompletionPartialAccept":case"inlineChat.applyEdits":case"Chat.applyEdits":return!0}return!1}function eji(a){return a.metadata.source==="cursor"?a.metadata.kind==="type":!1}var _c={unknown(a){return nE({source:"unknown",name:a.name})},rename:(a,i)=>nE({source:"rename",$$$oldName:a,$$$newName:i}),chatApplyEdits(a){return nE({source:"Chat.applyEdits",$modelId:Jqi(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:()=>nE({source:"Chat.undoEdits"}),chatReset:()=>nE({source:"Chat.reset"}),inlineCompletionAccept(a){return nE({source:"inlineCompletionAccept",$nes:a.nes,...Lvt(a.providerId),$$correlationId:a.correlationId,$$requestUuid:a.requestUuid,$$languageId:a.languageId})},inlineCompletionPartialAccept(a){return nE({source:"inlineCompletionPartialAccept",type:a.type,$nes:a.nes,...Lvt(a.providerId),$$correlationId:a.correlationId,$$requestUuid:a.requestUuid,$$languageId:a.languageId})},inlineChatApplyEdit(a){return nE({source:"inlineChat.applyEdits",$modelId:Jqi(a.modelId),$extensionId:a.extensionId?.extensionId,$extensionVersion:a.extensionId?.version,$$sessionId:a.sessionId,$$requestId:a.requestId,$$languageId:a.languageId})},reloadFromDisk:()=>nE({source:"reloadFromDisk"}),cursor(a){return nE({source:"cursor",kind:a.kind,detailedSource:a.detailedSource})},setValue:()=>nE({source:"setValue"}),eolChange:()=>nE({source:"eolChange"}),applyEdits:()=>nE({source:"applyEdits"}),snippet:()=>nE({source:"snippet"}),suggest:a=>nE({source:"suggest",...Lvt(a.providerId)}),codeAction:a=>nE({source:"codeAction",$kind:a.kind,...Lvt(a.providerId)})};function Lvt(a){return a?{$extensionId:a.extensionId,$extensionVersion:a.extensionVersion,$providerId:a.providerId}:{}}function Jqi(a){if(a!==void 0)return a.replaceAll("/","|")}var zy=class a{constructor(i,e,t,o){this.linesAdded=i;this.linesRemoved=e;this.charsAdded=t;this.charsRemoved=o}static fromText(i){let e=Zl.ofText(i).lineCount,t=i.length;return new a(e,0,t,0)}static fromEdit(i,e){let t=rq.fromStringEdit(i,e),o=ky(t.replacements,l=>l.newLines.length),n=ky(t.replacements,l=>l.lineRange.length),r=ky(i.replacements,l=>l.getNewLength()),s=ky(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)}},yZt;(i=>{function a(e){let t=e?e("sgt"):zgt("sgt");return t}i.newId=a})(yZt||={});var vqe=class{constructor(i,e,t,o){this.range=i;this.nestingLevel=e;this.nestingLevelOfEqualBracketType=t;this.isInvalid=o}},wZt=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}},Rvt=class extends wZt{constructor(e,t,o,n,r,s,l){super(e,t,o,n,r,s);this.minVisibleColumnIndentation=l}};function tji(a,i,e,t){return a!==e?vm(e-a,t):vm(0,t-i)}var ib=0;function aye(a){return a===0}var vL=2**26;function vm(a,i){return a*vL+i}function yx(a){let i=a,e=Math.floor(i/vL),t=i-e*vL;return new Zl(e,t)}function iji(a){return Math.floor(a/vL)}function Od(a,i){let e=a+i;return i>=vL&&(e=e-a%vL),e}function oji(a,i){return a.reduce((e,t)=>Od(e,i(t)),ib)}function CZt(a,i){return a===i}function sae(a,i){let e=a,t=i;if(t-e<=0)return ib;let n=Math.floor(e/vL),r=Math.floor(t/vL),s=t-r*vL;if(n===r){let l=e-n*vL;return vm(0,s-l)}else return vm(r-n,s)}function sq(a,i){return a<i}function M9(a,i){return a<=i}function lye(a,i){return a>=i}function P9(a){return vm(a.lineNumber-1,a.column-1)}function A9(a,i){let e=a,t=Math.floor(e/vL),o=e-t*vL,n=i,r=Math.floor(n/vL),s=n-r*vL;return new z(t+1,o+1,r+1,s+1)}function nji(a){let i=mc(a);return vm(i.length-1,i[i.length-1].length)}var Mvt=[],Ky=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,Mvt)}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===Mvt&&i.additionalItems===Mvt)return e===this.items?this:e===i.items?i:a.create(e,Mvt);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}},xZt={getKey(a){return a}},cye=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 bqe=class{get length(){return this._length}constructor(i){this._length=i}},Sqe=class a extends bqe{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=Od(n,t.length)),o&&(n=Od(n,o.length)),new a(n,e,t,o,t?t.missingOpeningBracketIds:Ky.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(Od(e,this.openingBracket.length),t):Number.MAX_SAFE_INTEGER}},bL=class a extends bqe{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=Od(r,t.length),s=s.merge(t.missingOpeningBracketIds),o){if(e.listHeight!==o.listHeight)throw new Error("Invalid list heights");r=Od(r,o.length),s=s.merge(o.missingOpeningBracketIds)}return n?new kZt(r,e.listHeight+1,e,t,o,s):new Iqe(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=Od(o,e[r].length),n=n.merge(e[r].missingOpeningBracketIds);return t?new Pvt(o,e[0].listHeight+1,e,n):new yqe(o,e[0].listHeight+1,e,n)}}static getEmpty(){return new Pvt(ib,0,[],Ky.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 ni;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=Od(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=Od(n,s.length))}return this.cachedMinIndentation=o,o}},Iqe=class a extends bL{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}},kZt=class extends Iqe{toMutable(){return new Iqe(this.length,this.listHeight,this.item1,this.item2,this.item3,this.missingOpeningBracketIds)}throwIfImmutable(){throw new Error("this instance is immutable")}},yqe=class a extends bL{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}},Pvt=class extends yqe{toMutable(){return new yqe(this.length,this.listHeight,[...this.children],this.missingOpeningBracketIds)}throwIfImmutable(){throw new Error("this instance is immutable")}},OAo=[],wqe=class extends bqe{get listHeight(){return 0}get childrenLength(){return 0}getChild(i){return null}get children(){return OAo}flattenLists(){return this}deepClone(){return this}},gW=class extends wqe{get kind(){return 0}get missingOpeningBracketIds(){return Ky.getEmpty()}canBeReused(i){return!0}computeMinIndentation(i,e){let t=yx(i),o=(t.columnCount===0?t.lineCount:t.lineCount+1)+1,n=iji(Od(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=al.visibleColumnFromColumn(c,l,e.getOptions().tabSize);r=Math.min(r,u)}return r}},Cqe=class a extends wqe{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 Ky.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}},Avt=class extends wqe{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 zN=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(P9(o.getStartPosition()),P9(o.getEndPosition()),nji(t.text))}).reverse()}toString(){return`[${yx(this.startOffset)}...${yx(this.endOffset)}) -> ${yx(this.newLength)}`}},Nvt=class{constructor(i){this.nextEditIdx=0;this.deltaOldToNewLineCount=0;this.deltaOldToNewColumnCount=0;this.deltaLineIdxInOld=-1;this.edits=i.map(e=>EZt.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:sae(i,t)}translateOldToCur(i){return i.lineCount===this.deltaLineIdxInOld?vm(i.lineCount+this.deltaOldToNewLineCount,i.columnCount+this.deltaOldToNewColumnCount):vm(i.lineCount+this.deltaOldToNewLineCount,i.columnCount)}translateCurToOld(i){let e=yx(i);return e.lineCount-this.deltaOldToNewLineCount===this.deltaLineIdxInOld?vm(e.lineCount-this.deltaOldToNewLineCount,e.columnCount-this.deltaOldToNewColumnCount):vm(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(M9(t,i)){this.nextEditIdx++;let o=yx(t),n=yx(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}}},EZt=class a{static from(i){return new a(i.startOffset,i.endOffset,i.newLength)}constructor(i,e,t){this.endOffsetBeforeObj=yx(e),this.endOffsetAfterObj=yx(Od(i,t)),this.offsetObj=yx(i)}};var fW=class{constructor(i,e,t,o,n){this.length=i;this.kind=e;this.bracketId=t;this.bracketIds=o;this.astNode=n}},dye=class{constructor(i,e){this.textModel=i;this.bracketTokens=e;this.reader=new TZt(this.textModel,this.bracketTokens),this._offset=ib,this.didPeek=!1,this.peeked=null,this.textBufferLineCount=i.getLineCount(),this.textBufferLastLineLength=i.getLineLength(this.textBufferLineCount)}get offset(){return this._offset}get length(){return vm(this.textBufferLineCount-1,this.textBufferLastLineLength)}getText(){return this.textModel.getValue()}skip(i){this.didPeek=!1,this._offset=Od(this._offset,i);let e=yx(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=Od(this._offset,i.length)),i}peek(){return this.didPeek||(this.peeked=this.reader.read(),this.didPeek=!0),this.peeked}},TZt=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=Qu.getTokenType(l)===0,u=Qu.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=tji(i,e,this.lineIdx,this.lineCharOffset);return new fW(o,0,-1,Ky.getEmpty(),new gW(o))}},Ovt=class{constructor(i,e){this.text=i;this._offset=ib;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 fW(vm(0,f),0,-1,Ky.getEmpty(),new gW(vm(0,f))));let h=[];for(let f=0;f<60;f++)h.push(new fW(vm(1,f),0,-1,Ky.getEmpty(),new gW(vm(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=vm(0,S);b=new fW(y,0,-1,Ky.getEmpty(),new gW(y))}}else{let S=s-u,y=f-l;if(S===1&&y<h.length)b=h[y];else{let w=vm(S,y);b=new fW(w,0,-1,Ky.getEmpty(),new gW(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?vm(0,g-c):vm(s-u,g-l);n.push(new fW(f,0,-1,Ky.getEmpty(),new gW(f)))}this.length=vm(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 jG}getText(){return this.text}};var _Zt=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=vm(0,n.bracketText.length),s=t(n),l=Ky.getEmpty().add(s,xZt);o.set(n.bracketText,new fW(r,1,s,l,Cqe.create(r,n,l)))}for(let n of i.bracketsNew.closingBrackets){let r=vm(0,n.bracketText.length),s=Ky.getEmpty(),l=n.getOpeningBrackets();for(let c of l)s=s.add(t(c),xZt);o.set(n.bracketText,new fW(r,2,t(l[0]),s,Cqe.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=>VAo(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 VAo(a){let i=Yr(a);return/^[\w ]+/.test(a)&&(i=`\\b${i}`),/[\w ]+$/.test(a)&&(i=`${i}\\b`),i}var uye=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=_Zt.createFromLanguage(this.getLanguageConfiguration(i),this.denseKeyProvider),this.languageIdToBracketTokens.set(i,e)),e}getToken(i,e){return this.getSingleLanguageBracketTokens(e).getToken(i)}};function sji(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?RZt(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())rji(t,o)<=rji(o,r)?(t=DZt(t,o),o=r):o=DZt(o,r);return DZt(t,o)}function RZt(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]=bL.create23(a[n],a[n+1],n+3===e?a[n+2]:null,i)}e=t}return bL.create23(a[0],a[1],e>=3?a[2]:null,i)}function rji(a,i){return Math.abs(a.listHeight-i.listHeight)}function DZt(a,i){return a.listHeight===i.listHeight?bL.create23(a,i,null,!1):a.listHeight>i.listHeight?BAo(a,i):HAo(i,a)}function BAo(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=bL.create23(r.unappendChild(),o,null,!1):(r.appendChildOfSameHeight(o),o=void 0):r.handleChildrenChanged()}return o?bL.create23(a,o,null,!1):a}function HAo(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=bL.create23(o,r.unprependChild(),null,!1):(r.prependChildOfSameHeight(o),o=void 0):r.handleChildrenChanged()}return o?bL.create23(o,a,null,!1):a}var Fvt=class{constructor(i){this.lastOffset=ib;this.nextNodes=[i],this.offsets=[ib],this.idxs=[]}readLongestNodeAt(i,e){if(sq(i,this.lastOffset))throw new Error("Invalid offset");for(this.lastOffset=i;;){let t=xqe(this.nextNodes);if(!t)return;let o=xqe(this.offsets);if(sq(i,o))return;if(sq(o,i))if(Od(o,t.length)<=i)this.nextNodeAfterCurrent();else{let n=MZt(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=MZt(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=xqe(this.offsets),e=xqe(this.nextNodes);if(this.nextNodes.pop(),this.offsets.pop(),this.idxs.length===0)break;let t=xqe(this.nextNodes),o=MZt(t,this.idxs[this.idxs.length-1]);if(o!==-1){this.nextNodes.push(t.getChild(o)),this.offsets.push(Od(i,e.length)),this.idxs[this.idxs.length-1]=o;break}else this.idxs.pop()}}};function MZt(a,i=-1){for(;;){if(i++,i>=a.childrenLength)return-1;if(a.getChild(i))return i}}function xqe(a){return a.length>0?a[a.length-1]:void 0}function kqe(a,i,e,t){return new PZt(a,i,e,t).parseDocument()}var PZt=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 Fvt(t):void 0,this.positionMapper=new Nvt(e)}get nodesConstructed(){return this._itemsConstructed}get nodesReused(){return this._itemsFromCache}parseDocument(){this._itemsConstructed=0,this._itemsFromCache=0;let i=this.parseList(Ky.getEmpty(),0);return i||(i=bL.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?sji(t):RZt(t,this.createImmutableLists)}tryReadChildFromCache(i){if(this.oldNodeReader){let e=this.positionMapper.getDistanceToNextChange(this.tokenizer.offset);if(e===null||!aye(e)){let t=this.oldNodeReader.readLongestNodeAt(this.positionMapper.getOffsetBeforeChange(this.tokenizer.offset),o=>e!==null&&!sq(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 Avt(t.bracketIds,t.length);case 0:return t.astNode;case 1:{if(e>300)return new gW(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(),Sqe.create(t.astNode,n,r.astNode)):Sqe.create(t.astNode,n,null)}default:throw new Error("unexpected")}}};function pye(a,i){if(a.length===0)return i;if(i.length===0)return a;let e=new bS(aji(a)),t=aji(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&&!aye(c);){let[p,h]=o.splitAt(c);u.push(p),c=sae(p.lengthAfter,c),o=h??e.dequeue()}return aye(c)||u.push(new Eqe(!1,c,c)),u}let r=[];function s(c,u,p){if(r.length>0&&CZt(r[r.length-1].endOffset,c)){let h=r[r.length-1];r[r.length-1]=new zN(h.startOffset,u,Od(h.newLength,p))}else r.push({startOffset:c,endOffset:u,newLength:p})}let l=ib;for(let c of t){let u=n(c.lengthBefore);if(c.modified){let p=oji(u,g=>g.lengthBefore),h=Od(l,p);s(l,h,c.lengthAfter),l=h}else for(let p of u){let h=l;l=Od(l,p.lengthBefore),p.modified&&s(h,l,p.lengthAfter)}}return r}var Eqe=class a{constructor(i,e,t){this.modified=i;this.lengthBefore=e;this.lengthAfter=t}splitAt(i){let e=sae(i,this.lengthAfter);return CZt(e,ib)?[this,void 0]:this.modified?[new a(this.modified,this.lengthBefore,i),new a(this.modified,ib,e)]:[new a(this.modified,i,i),new a(this.modified,e,e)]}toString(){return`${this.modified?"M":"U"}:${yx(this.lengthBefore)} -> ${yx(this.lengthAfter)}`}};function aji(a){let i=[],e=ib;for(let t of a){let o=sae(e,t.startOffset);aye(o)||i.push(new Eqe(!1,o,o));let n=sae(t.startOffset,t.endOffset);i.push(new Eqe(!0,n,t.newLength)),e=t.endOffset}return i}var Wvt=class extends C{constructor(e,t){super();this.textModel=e;this.getLanguageConfiguration=t;if(this.didChangeEmitter=this._register(new E),this.denseKeyProvider=new cye,this.brackets=new uye(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 Ovt(this.textModel.getValue(),o);this.initialAstWithoutTokens=kqe(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 zN(vm(o.fromLineNumber-1,0),vm(o.toLineNumber,0),vm(o.toLineNumber-o.fromLineNumber+1,0)));this.handleEdits(t,!0),this.initialAstWithoutTokens||this.didChangeEmitter.fire()}handleContentChanged(e){let t=zN.fromModelContentChanges(e.changes);this.handleEdits(t,!1)}handleEdits(e,t){let o=pye(this.queuedTextEdits,e);this.queuedTextEdits=o,this.initialAstWithoutTokens&&!t&&(this.queuedTextEditsForInitialAstWithoutTokens=pye(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 dye(this.textModel,this.brackets);return kqe(s,e,r,o)}getBracketsInRange(e,t){this.flushQueue();let o=vm(e.startLineNumber-1,e.startColumn-1),n=vm(e.endLineNumber-1,e.endColumn-1);return new JG(r=>{let s=this.initialAstWithoutTokens||this.astWithTokens;AZt(s,ib,s.length,o,n,r,0,0,new Map,t)})}getBracketPairsInRange(e,t){this.flushQueue();let o=P9(e.getStartPosition()),n=P9(e.getEndPosition());return new JG(r=>{let s=this.initialAstWithoutTokens||this.astWithTokens,l=new NZt(r,t,this.textModel);OZt(s,ib,s.length,o,n,l,0,new Map)})}getFirstBracketAfter(e){this.flushQueue();let t=this.initialAstWithoutTokens||this.astWithTokens;return cji(t,ib,t.length,P9(e))}getFirstBracketBefore(e){this.flushQueue();let t=this.initialAstWithoutTokens||this.astWithTokens;return lji(t,ib,t.length,P9(e))}};function lji(a,i,e,t){if(a.kind===4||a.kind===2){let o=[];for(let n of a.children)e=Od(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(sq(r,t)){let l=lji(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=A9(i,e);return{bracketInfo:a.bracketInfo,range:o}}}return null}function cji(a,i,e,t){if(a.kind===4||a.kind===2){for(let o of a.children){if(e=Od(i,o.length),sq(t,e)){let n=cji(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=A9(i,e);return{bracketInfo:a.bracketInfo,range:o}}}return null}function AZt(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=Od(i,g.length),M9(i,o)&&lye(e,t)){if(lye(e,o)){a=g;continue e}if(!AZt(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=Od(i,v.length),M9(i,o)&&lye(e,t)){if(lye(e,o)&&v.kind!==1){a=v,p?(r++,s=h+1):s=h;continue e}if((p||v.kind!==1||!a.closingBracket)&&!AZt(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=A9(i,e);return n(new vqe(p,r-1,0,!0))}case 1:{let p=A9(i,e);return n(new vqe(p,r-1,s-1,u))}case 0:return!0}}var NZt=class{constructor(i,e,t){this.push=i;this.includeMinIndentation=e;this.textModel=t}};function OZt(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=Od(i,a.openingBracket.length),p=-1;if(n.includeMinIndentation&&(p=a.computeMinIndentation(i,n.textModel)),l=n.push(new Rvt(A9(i,e),A9(i,u),a.closingBracket?A9(Od(u,a.child?.length||ib),e):void 0,r,c,a,p)),i=u,l&&a.child){let h=a.child;if(e=Od(i,h.length),M9(i,o)&&lye(e,t)&&(l=OZt(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=Od(c,u.length),M9(p,o)&&M9(t,c)&&(l=OZt(u,p,c,t,o,n,r,s),!l))return!1}}return l}var Bvt=class extends C{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 P;this.bracketPairsTree.value=UAo(e.add(new Wvt(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)||JG.empty}getBracketPairsInRangeWithMinIndentation(e){return this.bracketsRequested=!0,this.updateBracketPairsTree(),this.bracketPairsTree.value?.object.getBracketPairsInRange(e,!0)||JG.empty}getBracketsInRange(e,t=!1){return this.bracketsRequested=!0,this.updateBracketPairsTree(),this.bracketPairsTree.value?.object.getBracketsInRange(e,t)||JG.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?Vvt(this._findMatchingBracketUp(c,n,WZt(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(tl(n=>n.openingBracketRange.containsPosition(e)?n.openingBracketRange:n.closingBracketRange,z.compareRangesUsingStarts));return o?[o.openingBracketRange,o.closingBracketRange]:null}else{let o=WZt(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(IN(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(IN(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&&!IN(n.getStandardTokenType(s))){let{searchStartOffset:c,searchEndOffset:u}=this._establishBracketSearchOffsets(e,n,l,s),p=null;for(;;){let h=jk.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 aq)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&&!IN(n.getStandardTokenType(c))){let{searchStartOffset:p,searchEndOffset:h}=this._establishBracketSearchOffsets(e,n,u,c),g=jk.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 aq?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 aq?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 aq.INSTANCE;let f=jk.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&&!IN(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 aq.INSTANCE;let v=jk.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&&!IN(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=jk.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&&!IN(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=jk.findPrevBracketInRange(n.reversedRegex,s,u,h,g);if(S)return this._toFoundBracket(r,S)}f=b}if(r&&n&&f&&h!==g){let v=jk.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=jk.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&&!IN(c.getStandardTokenType(h));if(S)v||(g=c.getStartOffset(h)),f=c.getEndOffset(h);else if(s&&r&&v&&g!==f){let y=jk.findNextBracketInRange(r.forwardRegex,l,p,g,f);if(y)return this._toFoundBracket(s,y)}v=S}if(s&&r&&v&&g!==f){let b=jk.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=WZt(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 aq.INSTANCE;let w=jk.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 N=v.getLanguageId(y);h!==N&&(h=N,g=this.languageConfigurationService.getLanguageConfiguration(h).brackets,c(h,g))}let T=!0;for(;y<b;y++){let N=v.getLanguageId(y);if(h!==N){if(g&&T&&w!==k){let V=p(g,f,S,w,k);if(V)return Vvt(V);T=!1}h=N,g=this.languageConfigurationService.getLanguageConfiguration(h).brackets,c(h,g)}let O=!!g&&!IN(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 Vvt(V)}T=O}if(g&&T&&w!==k){let N=p(g,f,S,w,k);if(N)return Vvt(N)}}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 UAo(a,i){return{object:a,dispose:()=>i?.dispose()}}function WZt(a){if(typeof a>"u")return()=>!0;{let i=Date.now();return()=>Date.now()-i<=a}}var aq=class a{constructor(){this._searchCanceledBrand=void 0}static{this.INSTANCE=new a}};function Vvt(a){return a instanceof aq?null:a}var Hvt=class extends C{constructor(e){super();this.textModel=e;this.colorProvider=new Uvt;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):[]}},Uvt=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=[Sft,Ift,yft,wft,Cft,xft],t=new Uvt;i.addRule(`.monaco-editor .${t.unexpectedClosingBracketClassName} { color: ${a.getColor(gqi)}; }`);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 zvt(a){return a.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}var SL=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} "${zvt(this.newText)}")`:this.newText.length===0?`(delete@${this.oldPosition} "${zvt(this.oldText)}")`:`(replace@${this.oldPosition} "${zvt(this.oldText)}" with "${zvt(this.newText)}")`}static _writeStringSize(i){return 4+2*i.length}static _writeString(i,e,t){let o=e.length;LI(i,o,t),t+=4;for(let n=0;n<o;n++)z1i(i,e.charCodeAt(n),t),t+=2;return t}static _readString(i,e){let t=DI(i,e);return e+=4,xKi(i,e,t)}writeSize(){return 8+a._writeStringSize(this.oldText)+a._writeStringSize(this.newText)}write(i,e){return LI(i,this.oldPosition,e),e+=4,LI(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=DI(i,e);e+=4;let n=DI(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 dji(a,i){return a===null||a.length===0?i:new VZt(a,i).compress()}var VZt=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 SL(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 SL(e.oldPosition-i,e.oldText,e.newPosition,e.newText)}static _rebasePrev(i,e){return new SL(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 SL(i.oldPosition,i.oldText,i.newPosition,t),new SL(i.oldEnd,"",i.newPosition+e,o)]}static _splitCurr(i,e){let t=i.oldText.substr(0,e),o=i.oldText.substr(e);return[new SL(i.oldPosition,t,i.newPosition,i.newText),new SL(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 SL(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 mye(a){return a.toString()}var t_=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=BZt(i);return new a(t,t,o,o,e,e,[])}append(i,e,t,o,n){e.length>0&&(this.changes=dji(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(LI(i,e?e.length:0,t),t+=4,e)for(let o of e)LI(i,o.selectionStartLineNumber,t),t+=4,LI(i,o.selectionStartColumn,t),t+=4,LI(i,o.positionLineNumber,t),t+=4,LI(i,o.positionColumn,t),t+=4;return t}static _readSelections(i,e,t){let o=DI(i,e);e+=4;for(let n=0;n<o;n++){let r=DI(i,e);e+=4;let s=DI(i,e);e+=4;let l=DI(i,e);e+=4;let c=DI(i,e);e+=4,t.push(new Yt(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;LI(e,this.beforeVersionId,t),t+=4,LI(e,this.afterVersionId,t),t+=4,Rpt(e,this.beforeEOL,t),t+=1,Rpt(e,this.afterEOL,t),t+=1,t=a._writeSelections(e,this.beforeCursorState,t),t=a._writeSelections(e,this.afterCursorState,t),LI(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=DI(e,t);t+=4;let n=DI(e,t);t+=4;let r=Lpt(e,t);t+=1;let s=Lpt(e,t);t+=1;let l=[];t=a._readSelections(e,t,l);let c=[];t=a._readSelections(e,t,c);let u=DI(e,t);t+=4;let p=[];for(let h=0;h<u;h++)t=SL.read(e,t,p);return new a(o,n,r,s,l,c,p)}},IL=class{constructor(i,e,t,o){this.label=i;this.code=e;this.model=t,this._data=t_.create(t,o)}get type(){return 0}get resource(){return A.isUri(this.model)?this.model:this.model.uri}toString(){return(this._data instanceof t_?this._data:t_.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 t_}append(i,e,t,o,n){this._data instanceof t_&&this._data.append(i,e,t,o,n)}close(){this._data instanceof t_&&(this._data=this._data.serialize())}open(){this._data instanceof t_||(this._data=t_.deserialize(this._data))}undo(){if(A.isUri(this.model))throw new Error("Invalid SingleModelEditStackElement");this._data instanceof t_&&(this._data=this._data.serialize());let i=t_.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 t_&&(this._data=this._data.serialize());let i=t_.deserialize(this._data);this.model._applyRedo(i.changes,i.afterEOL,i.afterVersionId,i.afterCursorState)}heapSize(){return this._data instanceof t_&&(this._data=this._data.serialize()),this._data.byteLength+168}},vW=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=mye(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=mye(i);return this._editStackElementsMap.has(e)}setModel(i){let e=mye(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=mye(i.uri);return this._editStackElementsMap.has(e)?this._editStackElementsMap.get(e).canAppend(i):!1}append(i,e,t,o,n){let r=mye(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=mye(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(`${Ye(e.resource)}: ${e}`);return`{${i.join(", ")}}`}};function BZt(a){return a.getEOL()===`
`?0:1}function jU(a){return a?a instanceof IL||a instanceof vW:!1}var Kvt=class a{constructor(i,e){this._model=i,this._undoRedoService=e}pushStackElement(){let i=this._undoRedoService.getLastElement(this._model.uri);jU(i)&&i.close()}popStackElement(){let i=this._undoRedoService.getLastElement(this._model.uri);jU(i)&&i.open()}clear(){this._undoRedoService.removeElements(this._model.uri)}_getOrCreateEditStackElement(i,e){let t=this._undoRedoService.getLastElement(this._model.uri);if(jU(t)&&t.canAppend(this._model))return t;let o=new IL(d(908,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,[],BZt(this._model),this._model.getAlternativeVersionId(),null)}pushEditOperation(i,e,t,o,n=_c.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),BZt(this._model),this._model.getAlternativeVersionId(),l),l}static _computeCursorState(i,e){try{return i?i(e):null}catch(t){return mt(t),null}}};var HZt=class{constructor(){this.spacesDiff=0;this.looksLikeAlignment=!1}};function zAo(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 UZt(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 HZt;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 U=S?b.charCodeAt(O):a.getLineCharCode(f,O);if(U===9)T++;else if(U===32)k++;else{y=!0,w=O;break}}if(!y||(T>0?o++:k>1&&n++,zAo(r,s,b,w,p),p.looksLikeAlignment&&!(e&&i===p.spacesDiff)))continue;let N=p.spacesDiff;N<=c&&u[N]++,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 hye=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!==Zr)return Gvt(this.right);let i=this;for(;i.parent!==Zr&&i.parent.left!==i;)i=i.parent;return i.parent===Zr?Zr:i.parent}prev(){if(this.left!==Zr)return KZt(this.left);let i=this;for(;i.parent!==Zr&&i.parent.right!==i;)i=i.parent;return i.parent===Zr?Zr:i.parent}detach(){this.parent=null,this.left=null,this.right=null}};var Zr=new hye(null,0);Zr.parent=Zr;Zr.left=Zr;Zr.right=Zr;Zr.color=0;function Gvt(a){for(;a.left!==Zr;)a=a.left;return a}function KZt(a){for(;a.right!==Zr;)a=a.right;return a}function GZt(a){return a===Zr?0:a.size_left+a.piece.length+GZt(a.right)}function $Zt(a){return a===Zr?0:a.lf_left+a.piece.lineFeedCnt+$Zt(a.right)}function zZt(){Zr.parent=Zr}function _qe(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!==Zr&&(e.left.parent=i),e.parent=i.parent,i.parent===Zr?a.root=e:i.parent.left===i?i.parent.left=e:i.parent.right=e,e.left=i,i.parent=e}function Dqe(a,i){let e=i.left;i.left=e.right,e.right!==Zr&&(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===Zr?a.root=e:i===i.parent.right?i.parent.right=e:i.parent.left=e,e.right=i,i.parent=e}function Lqe(a,i){let e,t;if(i.left===Zr?(t=i,e=t.right):i.right===Zr?(t=i,e=t.left):(t=Gvt(i.right),e=t.right),t===a.root){a.root=e,e.color=0,i.detach(),zZt(),a.root.parent=Zr;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,Tqe(a,e)):(t.parent===i?e.parent=t:e.parent=t.parent,Tqe(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!==Zr&&(t.left.parent=t),t.right!==Zr&&(t.right.parent=t),t.size_left=i.size_left,t.lf_left=i.lf_left,Tqe(a,t)),i.detach(),e.parent.left===e){let r=GZt(e),s=$Zt(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,YU(a,e.parent,l,c)}}if(Tqe(a,e.parent),o){zZt();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,_qe(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,Dqe(a,n),n=e.parent.right),n.color=e.parent.color,e.parent.color=0,n.right.color=0,_qe(a,e.parent),e=a.root)):(n=e.parent.left,n.color===1&&(n.color=0,e.parent.color=1,Dqe(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,_qe(a,n),n=e.parent.left),n.color=e.parent.color,e.parent.color=0,n.left.color=0,Dqe(a,e.parent),e=a.root));e.color=0,zZt()}function qZt(a,i){for(Tqe(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,_qe(a,i)),i.parent.color=0,i.parent.parent.color=1,Dqe(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,Dqe(a,i)),i.parent.color=0,i.parent.parent.color=1,_qe(a,i.parent.parent))}a.root.color=0}function YU(a,i,e,t){for(;i!==a.root&&i!==Zr;)i.parent.left===i&&(i.parent.size_left+=e,i.parent.lf_left+=t),i=i.parent}function Tqe(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=GZt(i.left)-i.size_left,t=$Zt(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 lq=65535;function uji(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 jZt=class{constructor(i,e,t,o,n){this.lineStarts=i;this.cr=e;this.lf=t;this.crlf=o;this.isBasicASCII=n}};function XU(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?uji(e):e}function pji(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 jZt(uji(a),t,o,n,r);return a.length=0,s}var wx=class{constructor(i,e,t,o,n){this.bufferIndex=i,this.start=e,this.end=t,this.lineFeedCnt=o,this.length=n}},JU=class{constructor(i,e){this.buffer=i,this.lineStarts=e}},QZt=class{constructor(i,e){this._pieces=[],this._tree=i,this._BOM=e,this._index=0,i.root!==Zr&&i.iterate(i.root,t=>(t!==Zr&&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++])}},YZt=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}}},$vt=class{constructor(i,e,t){this.create(i,e,t)}create(i,e,t){this._buffers=[new JU("",[0])],this._lastChangeBufferPos={line:0,column:0},this.root=Zr,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=XU(i[n].buffer));let s=new wx(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 YZt(1),this._lastVisitedLine={lineNumber:0,value:""},this.computeBufferMetadata()}normalizeEOL(i){let e=lq,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 JU(p,XU(p))),n=c,r=u,!0}),r>0){let l=n.replace(/\r\n|\r|\n/g,i);s.push(new JU(l,XU(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 QZt(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===Zr)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!==Zr;)if(o.left!==Zr&&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!==Zr;)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 Ie(t+1,s+1)}return new Ie(t+1,n.remainder+1)}else if(i-=e.size_left+e.piece.length,t+=e.lf_left+e.piece.lineFeedCnt,e.right===Zr){let n=this.getOffsetAt(t+1,1),r=o-i-n;return new Ie(t+1,r+1)}else e=e.right;return new Ie(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!==Zr;){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===Zr)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===Zr)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,N=T+b[0].length;if(p[u++]=q6(new z(t+k,T,t+k,N),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 kU(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||Bht(u,t,f,v,g))&&(s[r++]=new vU(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++]=q6(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!==Zr){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<lq){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 wx(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 wx(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===Zr)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();Lqe(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!==Zr&&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 wx(r.bufferIndex,s,r.end,this.getLineFeedCnt(r.bufferIndex,s,r.end),r.length-1);e.piece=l,i+=`
`,YU(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++)Lqe(this,i[e])}createNewPieces(i){if(i.length>lq){let u=[];for(;i.length>lq;){let h=i.charCodeAt(lq-1),g;h===13||h>=55296&&h<=56319?(g=i.substring(0,lq-1),i=i.substring(lq-1)):(g=i.substring(0,lq),i=i.substring(lq));let f=XU(g);u.push(new wx(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 JU(g,f))}let p=XU(i);return u.push(new wx(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 JU(i,p)),u}let e=this._buffers[0].buffer.length,t=XU(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 wx(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!==Zr;)if(t.left!==Zr&&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!==Zr;){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!==Zr;)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 wx(t.bufferIndex,t.start,r,l,p),YU(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 wx(t.bufferIndex,r,t.end,s,p),YU(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 wx(o.bufferIndex,o.start,c,u,p),YU(this,i,p-s,u-l);let h=new wx(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=XU(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 wx(i.piece.bufferIndex,i.piece.start,l,p,c),this._lastChangeBufferPos=l,YU(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!==Zr;)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!==Zr;)if(t.left!==Zr&&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!==Zr;){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===Zr||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===Zr||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 wx(i.piece.bufferIndex,i.piece.start,n,s,r),YU(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 wx(e.piece.bufferIndex,l,e.piece.end,u,c),YU(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++)Lqe(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)Lqe(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 wx(o.bufferIndex,n,o.end,s,r),YU(this,t,-1,-1)}return!0}}return!1}iterate(i,e){if(i===Zr)return e(Zr);let t=this.iterate(i.left,e);return t&&e(i)&&this.iterate(i.right,e)}getNodeContent(i){if(i===Zr)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 hye(e,1);if(t.left=Zr,t.right=Zr,t.parent=Zr,t.size_left=0,t.lf_left=0,this.root===Zr)this.root=t,t.color=0;else if(i.right===Zr)i.right=t,t.parent=i;else{let n=Gvt(i.right);n.left=t,t.parent=n}return qZt(this,t),t}rbInsertLeft(i,e){let t=new hye(e,1);if(t.left=Zr,t.right=Zr,t.parent=Zr,t.size_left=0,t.lf_left=0,this.root===Zr)this.root=t,t.color=0;else if(i.left===Zr)i.left=t,t.parent=i;else{let o=KZt(i.left);o.right=t,t.parent=o}return qZt(this,t),t}getContentOfSubTree(i){let e="";return this.iterate(i,t=>(e+=this.getNodeContent(t),!0)),e}};var N9=class a extends C{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 $vt(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++)Ru(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=Ap(this.getLineContent(e));return t===-1?0:t+1}getLineLastNonWhitespaceColumn(e){let t=tv(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=!oU(S.text),s=O),!n&&O&&(n=yM(S.text)),!r&&O&&(r=bpt(S.text))}let w="",k=0,T=0,N=0;if(S.text){let O;[k,T,N,O]=OS(S.text);let V=this.getEOL(),U=V===`\r
`?2:1;O===0||O===U?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:N,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),Ap(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 SL(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||Ap(k)!==-1||v.push(y)}}return this._onDidChangeContent.fire(),new Rmt(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]=OS(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]=OS(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 XZt=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=XU(s);t[n]=new JU(s,l)}let o=new N9(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]}},cq=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&&Spt(i)&&(this.BOM=m1i,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=pji(this._tmpLineStarts,i);this.chunks.push(new JU(i,e.lineStarts)),this.cr+=e.cr,this.lf+=e.lf,this.crlf+=e.crlf,e.isBasicASCII||(this.isBasicASCII=!1,this.containsRTL||(this.containsRTL=yM(i)),this.containsUnusualLineTerminators||(this.containsUnusualLineTerminators=bpt(i)))}finish(i=!0){return this._finish(),new XZt(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=XU(i.buffer);i.lineStarts=e,this._previousChar===13&&this.cr++}}};var qvt=class{constructor(){this._onDidChangeVisibleRanges=new E;this.onDidChangeVisibleRanges=this._onDidChangeVisibleRanges.event;this._views=new Set;this._viewsChanged=Wc(this);this.visibleLineRanges=hs({owner:this,equalsFn:lN(C6())},i=>(this._viewsChanged.read(i),ro.joinMany([...this._views].map(t=>t.state.read(i)?.visibleLineRanges??[]))))}attachView(){let i=new ZZt(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()}},JZt=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)}},ZZt=class{constructor(i){this.handleStateChange=i;this._state=rg({owner:this,equalsFn:aU((e,t)=>e.equals(t))},void 0)}get state(){return this._state}setVisibleLines(i,e){let t=i.map(n=>new ro(n.startLineNumber,n.endLineNumber+1)),o=new JZt(t,e);this._state.set(o,void 0,void 0),this.handleStateChange(o)}},jvt=class extends C{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()}},gye=class extends C{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 dq=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}`}},uq=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 KAo=/\b(comment|string|regex|regexp)\b/;function mji(a){let i=a.match(KAo);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 KN(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 hji(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=eei(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 eei(a,i){let e=GAo(a);return gji(`font-decoration-${e}-${i}`)}function GAo(a){let i=a.toLowerCase().trim();return i?gji(i):"default"}function gji(a){return a.replace(/[^a-z0-9_-]/gi,"-")}var Mqe=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=bM(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=bM(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())}},fye=class a{static create(i){return new a(i)}constructor(i){this._annotations=i}get annotations(){return this._annotations}rebase(i){let e=new Mqe(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 di(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 Pqe=class a extends wse{static{this.empty=new a([])}static fromEdit(i){return new a(i.replacements.map(e=>new aae(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 aae(i,e)])}static insert(i,e){return new a([new aae(di.emptyAt(i),e)])}static delete(i){return new a([new aae(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 aae(di.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}},aae=class a extends BSe{constructor(e,t){super(e);this.newLength=t}static create(e,t,o){return new a(new di(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 fji(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(An.replace(o,t.newText))}return e}function O9(a){let i=a.map(t=>new Hc(di.ofStartAndLength(t.rangeOffset,t.rangeLength),t.text));return i.reverse(),new Qc(i)}function vji(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 di(s,l);t.push(new Hc(c,r))}return new Qc(t)}function tei(a){let e=a.slice().reverse().map(o=>Pqe.replace(new di(o.range.startLineNumber-1,o.range.endLineNumber),OS(o.text)[0]+1));return Pqe.compose(e)}var Qvt=class a extends C{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 Mqe;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 dq(0,g,p,c.annotation.lineHeightMultiplier)),l.add(new uq(0,g,p))}if(r.push(h),!n.has(p)){let g=this.textModel.getOffsetAt(new Ie(p,1)),f=this.textModel.getOffsetAt(new Ie(p,this.textModel.getLineMaxColumn(p))),v=new di(g,f),b=this._fontAnnotatedString.getAnnotationsIntersecting(v);for(let S of b){let y=S.annotation.decorationId;s.add(new dq(0,y,p,null)),l.add(new uq(0,y,p))}n.add(p)}}this._fontAnnotatedString.setAnnotations(fye.create(r)),this._onDidChangeLineHeight.fire(s),this._onDidChangeFont.fire(l)}))}static{this.DECORATION_COUNT=0}handleDidChangeContent(e){let t=O9(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 dq(0,u,c,null)),r.add(new uq(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 di(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=eei(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 $Ao(a,i){let e=a.gotoNextSibling(),t=i.gotoNextSibling();if(e!==t)throw new Error("Trees are out of sync");return e&&t}function iei(a,i){let e=a.gotoParent(),t=i.gotoParent();if(e!==t)throw new Error("Trees are out of sync");return e&&t}function bji(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 oei(a,i){do{if(a.currentNode.nextSibling)return $Ao(a,i);a.currentNode.parent&&iei(a,i)}while(a.currentNode.nextSibling||a.currentNode.parent);return!1}function Sji(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 vye=class extends C{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=Le(this,void 0);this.tree=this._tree;this._treeLastParsedVersion=Le(this,-1);this.treeLastParsedVersion=this._treeLastParsedVersion;this._onDidChangeContentQueue=new Pbe;this._tree=Le(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();Ui(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=Zl.ofRange(z.lift(t.range)),n=Zl.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=iei(o,n);let p=o.currentNode,h=Sji(o,e)??p;r.push({startIndex:h.startIndex,endIndex:p.endIndex,startPosition:h.startPosition,endPosition:p.endPosition}),s=oei(o,n)}else u.length>=1&&(s=bji(o,n,c[0]))}else s=oei(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&&Iji(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=qAo();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=>Vw(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(jAo(s,o)||Iji(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}};vye=I([m(5,ne),m(6,Te)],vye);function qAo(){let a=performance.now();return function(e){let t=performance.now();return t-a>50?(a=t,!0):!1}}function jAo(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 Iji(a,i){return a.startIndex<=i.startIndex&&a.endIndex>=i.startIndex||i.startIndex<=a.startIndex&&i.endIndex>=a.startIndex}var nei=new class{clone(){return this}equals(a){return this===a}};function bye(a,i){let e=new Uint32Array(2);return e[0]=0,e[1]=(a<<0|0|0|32768|2<<24)>>>0,new fse(e,[],i===null?nei:i)}var Yvt=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=QAo(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=UH(this._store,i,t)}};function QAo(a,i){let e=[];for(let t=0;t<a;t++)e[t]=i;return e}var ZU=new Uint32Array(0).buffer,UI=class a{static deleteBeginning(i,e){return i===null||i===ZU?i:a.delete(i,0,e)}static deleteEnding(i,e){if(i===null||i===ZU)return i;let t=e1(i),o=t[t.length-2];return a.delete(i,e,o)}static delete(i,e,t){if(i===null||i===ZU||e===t)return i;let o=e1(i),n=o.length>>>1;if(e===0&&o[o.length-2]===t)return ZU;let r=Bc.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===ZU)return i;if(i===ZU)return e;if(i===null)return i;if(e===null)return null;let t=e1(i),o=e1(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===ZU)return i;let o=e1(i),n=o.length>>>1,r=Bc.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 e1(a){return a instanceof Uint32Array?a:new Uint32Array(a)}var Aqe=class a{static deserialize(i,e,t){let o=new Uint32Array(i.buffer),n=DI(i,e);e+=4;let r=DI(i,e);e+=4;let s=[];for(let l=0;l<r;l++){let c=DI(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 ro(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){LI(i,this._startLineNumber,e),e+=4,LI(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!");LI(i,o.byteLength,e),e+=4,i.set(new Uint8Array(o.buffer),e),e+=o.byteLength}return e}applyEdit(i,e){let[t,o]=OS(e);this._acceptDeleteRange(i),this._acceptInsertText(new Ie(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]=UI.delete(this._tokens[e],i.startColumn-1,i.endColumn-1);return}if(e>=0)if(this._tokens[e]=UI.deleteEnding(this._tokens[e],i.startColumn-1),t<this._tokens.length){let o=UI.deleteBeginning(this._tokens[t],i.endColumn-1);this._tokens[e]=UI.append(this._tokens[e],o),this._tokens.splice(e+1,t-e)}else this._tokens[e]=UI.append(this._tokens[e],null),this._tokens=this._tokens.slice(0,e+1);else{let o=-e;this._startLineNumber-=o,this._tokens[t]=UI.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]=UI.insert(this._tokens[o],i.column-1,t);return}this._tokens[o]=UI.deleteEnding(this._tokens[o],i.column-1),this._tokens[o]=UI.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=UH(this._tokens,i,t)}};var t1=class{static deserialize(i){let e=0,t=DI(i,e);e+=4;let o=[];for(let n=0;n<t;n++)e=Aqe.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 Aqe(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;LI(i,this._tokens.length,e),e+=4;for(let t=0;t<this._tokens.length;t++)e=this._tokens[t].serialize(i,e)}};var rei=class{constructor(i,e){this.tokenizationSupport=e;this.initialState=this.tokenizationSupport.getInitialState(),this.store=new Sye(i)}getStartState(i){return this.store.getStartState(i,this.initialState)}getFirstInvalidLine(){return this.store.getFirstInvalidLine(this.initialState)}},Xvt=class extends rei{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=Nqe(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=Nqe(this._languageIdCodec,n,this.tokenizationSupport,s,!0,o),c=new Bc(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=Nqe(this._languageIdCodec,n,this.tokenizationSupport,l,!0,s);r.push(new Bc(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=Nqe(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}=aei(this._textModel,e,this);o||(o=this.tokenizationSupport.getInitialState());let n=this._textModel.getLanguageId(),r=o;for(let s of t)r=Nqe(this._languageIdCodec,n,this.tokenizationSupport,s,!1,r).endState;return r}};function aei(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 Sye=class{constructor(i){this.lineCount=i;this._tokenizationStateStore=new Oqe;this._invalidEndStatesLineNumbers=new sei;this._invalidEndStatesLineNumbers.addRange(new di(1,i+1))}getEndState(i){return this._tokenizationStateStore.getEndState(i)}setEndState(i,e){if(!e)throw new ni("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 di(i+1,i+2)),t}acceptChange(i,e){this.lineCount+=e-i.length,this._tokenizationStateStore.acceptChange(i,e),this._invalidEndStatesLineNumbers.addRangeAndResize(new di(i.startLineNumber,i.endLineNumberExclusive),e)}acceptChanges(i){for(let e of i){let[t]=OS(e.text);this.acceptChange(new ro(e.range.startLineNumber,e.range.endLineNumber+1),t+1)}}invalidateEndStateRange(i){this._invalidEndStatesLineNumbers.addRange(new di(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 ni("Start state must be defined");return{lineNumber:e,startState:t}}},Oqe=class{constructor(){this._lineEndStates=new Yvt(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]=OS(e.text);this.acceptChange(new ro(e.range.startLineNumber,e.range.endLineNumber+1),t+1)}}},sei=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 di(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 di(i+1,t.endExclusive):t.endExclusive===i+1?this._ranges[e]=new di(t.start,i):this._ranges.splice(e,1,new di(t.start,i),new di(i+1,t.endExclusive))}}addRange(i){di.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 di(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 di(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 Nqe(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=bye(a.encodeLanguageId(i),n)),Bc.convertToEndOffset(r.tokens,t.length),r}var Jvt=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,aN(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?Vw(t):this._beginBackgroundTokenization())};t()}_backgroundTokenizeForAtLeast1ms(){let i=this._tokenizerWithStateStore._textModel.getLineCount(),e=new t1,t=En.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 ro(i,e))}};var pq=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),FS(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),FS(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 FS(a){return a.token!==void 0}function yji(a,i){let e=a,t=[],o;for(;;){if(i.height===e.height){o=i;break}if(FS(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=pq.create(r.unappendChild(),o):(r.appendChild(o),o=void 0))}if(o){let n=new pq(o.height+1);return n.appendChild(a),n.appendChild(o),n}else return a}function YAo(a,i){let e=a,t=[];for(;i.height!==e.height;){if(FS(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=pq.create(o,r.unprependChild()):(r.prependChild(o),o=void 0))}return o?pq.create(o,a):a}function XAo(a,i){return a.height===i.height?pq.create(a,i):a.height>i.height?yji(a,i):YAo(i,a)}var Zvt=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=yji(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){FS(p.node)||(p.node.parent=void 0),r.push(p.node);continue}else FS(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){FS(p.node)||(p.node.parent=void 0),s.push(p.node);continue}else if(FS(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(!FS(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=XAo(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(!FS(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)=>FS(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(FS(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=>(FS(t)&&(t.tokenQuality=0),!1))}rangeHasTokens(i,e,t){let o=!0;return this.traverseInOrderInRange(i,e,n=>(FS(n)&&n.tokenQuality<t&&(o=!1),!1)),o}rangeNeedsRefresh(i,e){let t=!1;return this.traverseInOrderInRange(i,e,o=>(FS(o)&&o.tokenQuality!==3&&(t=!0),!1)),t}getNeedsRefresh(){let i=[];return this.traverseInOrderInRange(0,this._textModel.getValueLength(),(e,t)=>(FS(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=FS(i)?{length:i.length,token:i.token,tokenQuality:i.tokenQuality,height:i.height}:new pq(i.height),t=[[i,e]];for(;t.length>0;){let[o,n]=t.pop();if(!FS(o))for(let r of o.children){let s=FS(r)?{length:r.length,token:r.token,tokenQuality:r.tokenQuality,height:r.height}:new pq(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(FS(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(!FS(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 ebt=ae("treeSitterThemeService");var Iye=class extends C{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(_s(this._treeSitterThemeService.onChange,()=>{this._updateTheme()})),this._tokenStore=this._register(new Zvt(this._textModel)),this._accurateVersion=this._textModel.getVersionId(),this._guessVersion=this._textModel.getVersionId(),this._tokenStore.buildStore(this._createEmptyTokens(),0),this._register(he(s=>{let l=this._visibleLineRanges.read(s);this._parseAndTokenizeViewPort(l)})),this._register(xM({owner:this,changeTracker:U9t({tree:this._tree.tree})},(s,l)=>{let c=l.changes.at(0)?.change;if(l.changes.length>1)throw new ni("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 Bc(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 Bc(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(mo);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=aei(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(mo);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 Ie(u,p),f=h===e[s].newRange.endLineNumber?e[s].newRange.endColumn:this._textModel.getLineMaxColumn(h),v=new Ie(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=>Vw(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=En.create(),s=o-t,l=this._languageIdCodec.encodeLanguageId(this._tree.languageId),c=JAo[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(ZAo)).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 U=0;U<T.length;U++){let G=T[U];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,N=y-w;b>0?T=u[p-1].endOffset:T=w-t-1;let O=k-N;if(T>=0&&T<O&&(u[p]={endOffset:O,scopes:[c],encodedLanguageId:this._encodedLanguageId},p++,h()),!(N<0))if(T>=k){let V=p-1,U=u[V].endOffset,G=V>=2?u[V-1].endOffset:0;do{if(G+N===U){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,U=V>=0?u[V].endOffset:0}while(U>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=En.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}};Iye=I([m(4,ebt)],Iye);var JAo={css:"source.css",typescript:"source.ts",ini:"source.ini",regex:"source.regex"},ZAo=/[\{\}\[\]\<\>\(\)]/g;var F9=ae("treeSitterLibraryService");var i1=class extends gye{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 Au(this._treeSitterLibraryService.getParserClass()),c=Ce(this,u=>l.promiseResult?.read(u)?.getDataOrThrow());this._tree=Ce(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(vye,h,void 0,f,p,this._textModel))}),this._tokenizationImpl=Ce(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(Iye,p,h,this._languageIdCodec,n))}),this._register(he(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 Bc.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}};i1=I([m(4,F9),m(5,F)],i1);var tbt=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=UH(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 Bc(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 Fqe=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!==ZU)return new Bc(e1(o),t,this._languageIdCodec);let n=new Uint32Array(2);return n[0]=t.length,n[1]=wji(this._languageIdCodec.encodeLanguageId(i)),new Bc(n,t,this._languageIdCodec)}static _massageTokens(i,e,t){let o=t?e1(t):null;if(e===0){let n=!1;if(o&&o.length>1&&(n=Qu.getLanguageId(o[1])!==i),!n)return ZU}if(!o||o.length===0){let n=new Uint32Array(2);return n[0]=e,n[1]=wji(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=UH(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=e1(i),o=e1(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 Ie(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]=UI.delete(this._lineTokens[e],i.startColumn-1,i.endColumn-1);return}this._lineTokens[e]=UI.deleteEnding(this._lineTokens[e],i.startColumn-1);let t=i.endLineNumber-1,o=null;t<this._len&&(o=UI.deleteBeginning(this._lineTokens[t],i.endColumn-1)),this._lineTokens[e]=UI.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]=UI.insert(this._lineTokens[o],i.column-1,t);return}this._lineTokens[o]=UI.deleteEnding(this._lineTokens[o],i.column-1),this._lineTokens[o]=UI.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 wji(a){return(a<<0|0|0|32768|2<<24|1024)>>>0}var ibt=class extends gye{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 Fqe(this._languageIdCodec);this._debugBackgroundTokenizer=this._register(new me);this._attachedViewStates=this._register(new jt);this._register(kc.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 jvt(()=>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 Sye(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=kc.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 Xvt(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 Jvt(this._tokenizer,r),this._defaultBackgroundTokenizer.handleChanges()),o?.backgroundTokenizerShouldOnlyVerifyTokens&&o.createBackgroundTokenizer?(this._debugBackgroundTokens=new Fqe(this._languageIdCodec),this._debugBackgroundStates=new Sye(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]=OS(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=ro.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 t1,{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 t1;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 Ie(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 mq=class extends FIe{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=Le(this,this._languageId),this._useTreeSitter=Ce(this,p=>{let h=this._languageIdObs.read(p);return this._treeSitterLibraryService.supportsLanguage(h,p)}),this.tokens=Ce(this,p=>{let h;return this._useTreeSitter.read(p)?h=p.store.add(this._instantiationService.createInstance(i1,this._languageIdObs,this._languageService.languageIdCodec,this._textModel,this._attachedViews.visibleLineRanges)):h=p.store.add(new ibt(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 tbt(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]=OS(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 ni("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]=mq._findLanguageBoundaries(n,r),c=My(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]=mq._findLanguageBoundaries(n,r-1),h=My(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 Ie(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({})}};mq=I([m(4,kt),m(5,bs),m(6,F),m(7,F9)],mq);function lae(a){let i=new cq;return i.acceptChunk(a),i.finish()}function W9(a){return new Promise((i,e)=>{let t=new cq,o=!1;j0(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 i_(a){let i=new cq,e;for(;typeof(e=a.read())=="string";)i.acceptChunk(e);return i.finish()}function n1(a,i){let e;return typeof a=="string"?e=lae(a):vKi(a)?e=i_(a):e=a,e.create(i)}var obt=0,eNo=999,tNo=1e4,iNo=300,cei=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)}},Wqe=()=>{throw new Error("Invalid change accessor")};var Bu=class extends C{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 mei((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 hei);this._languageSelectionListener=this._register(new me);this._deltaDecorationCallCnt=0;this._attachedViews=this._register(new qvt);this._viewModels=new Set;obt++,this.id="$model"+obt,this.isForSimpleWidget=o.isForSimpleWidget,typeof n>"u"||n===null?this._associatedResource=A.parse("inmemory://model/"+obt):this._associatedResource=n,this._attachedEditorCount=0;let{textBuffer:u,disposable:p}=n1(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>Bu.LARGE_FILE_SIZE_THRESHOLD||h>Bu.LARGE_FILE_LINE_COUNT_THRESHOLD,this._isTooLargeForHeapOperation=g>Bu.LARGE_FILE_HEAP_OPERATION_THRESHOLD):(this._isTooLargeForTokenization=!1,this._isTooLargeForHeapOperation=!1),this._options=Bu.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 Bvt(this,this._languageConfigurationService)),this._guidesTextModelPart=this._register(new Rft(this,this._languageConfigurationService)),this._decorationProvider=this._register(new Hvt(this)),this._tokenizationTextModelPart=this.instantiationService.createInstance(mq,this,this._bracketPairs,f,this._attachedViews),this._fontTokenDecorationsProvider=this._register(new Qvt(this,this._tokenizationTextModelPart)),this._isTooLargeForSyncing=g>Bu._MODEL_SYNC_LIMIT,this._versionId=1,this._alternativeVersionId=1,this._initialUndoRedoSnapshot=null,this._isDisposed=!1,this.__isDisposing=!1,this._instanceId=_be(obt),this._lastDecorationId=0,this._decorations=Object.create(null),this._decorationsTree=new rbt,this._commandManager=new Kvt(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:iv.tabSize,indentSize:iv.indentSize,insertSpaces:iv.insertSpaces,detectIndentation:!1,defaultEOL:1,trimAutoWhitespace:iv.trimAutoWhitespace,largeFileOptimizations:iv.largeFileOptimizations,bracketPairColorizationOptions:iv.bracketPairColorizationOptions}}static resolveOptions(e,t){if(t.detectIndentation){let o=UZt(e,t.tabSize,t.insertSpaces);return new lSe({tabSize:o.tabSize,indentSize:"tabSize",insertSpaces:o.insertSpaces,trimAutoWhitespace:t.trimAutoWhitespace,defaultEOL:t.defaultEOL,bracketPairColorizationOptions:t.bracketPairColorizationOptions})}return new lSe(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 N9([],"",`
`,!1,!1,!0,!0);e.dispose(),this._buffer=e,this._bufferDisposable=C.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 ni("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 _9(e,t);o&&(n.rawContentChangedEvent.resultingSelection=o),this._onDidChangeContentOrInjectedText(n),this._eventEmitter.fire(n)}setValue(e,t=_c.setValue()){if(this._assertNotDisposed(),e==null)throw Br();let{textBuffer:o,disposable:n}=n1(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 rbt,this._commandManager.clear(),this._trimAutoWhitespaceLines=null,this._emitContentChangedEvent(new nae([new yvt],this._versionId,!1,!1),this._createContentChanged2(new z(1,1,s,l),0,r,new Ie(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 nae([new Evt],this._versionId,!1,!1),this._createContentChanged2(new z(1,1,r,s),0,n,new Ie(r,s),this.getValue(),!1,!1,!1,!0,_c.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,nq(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>=tNo?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 lSe({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=UZt(this._buffer,t,e);this.updateOptions({insertSpaces:o.insertSpaces,tabSize:o.tabSize,indentSize:o.tabSize})}normalizeIndentation(e){return this._assertNotDisposed(),sSe(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(r9t.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 ni("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 cei(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 ni("Illegal value for lineNumber");return this._buffer.getLineContent(e)}getLineLength(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new ni("Illegal value for lineNumber");return this._buffer.getLineLength(e)}getLinesContent(){if(this._assertNotDisposed(),this.isTooLargeForHeapOperation())throw new ni("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 ni("Illegal value for lineNumber");return this._buffer.getLineLength(e)+1}getLineFirstNonWhitespaceColumn(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new ni("Illegal value for lineNumber");return this._buffer.getLineFirstNonWhitespaceColumn(e)}getLineLastNonWhitespaceColumn(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new ni("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 Yt)?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(Ru(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 Ie(1,1);if(n>s)return new Ie(s,this.getLineMaxColumn(s));if(r<=1)return new Ie(n,1);let l=this.getLineMaxColumn(n);if(r>=l)return new Ie(n,l);if(o===1){let c=this._buffer.getLineCharCode(n,r-2);if(Ru(c))return new Ie(n,r-1)}return new Ie(n,r)}validatePosition(e){let t=1;return this._assertNotDisposed(),e instanceof Ie&&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=Ru(l),p=Ru(c);return!u&&!p}return!0}validateRange(e){let t=1;if(this._assertNotDisposed(),e instanceof z&&!(e instanceof Yt)&&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=Ru(u),g=Ru(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=eNo){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 Oy(e,o,n,r).parseSearchRequest();if(!g)return[];p=f=>this.findMatchesLineByLine(f,g,s,l)}else p=h=>Sse.findMatches(this,new Oy(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 Oy(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 Sse.findNextMatch(this,new Oy(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 Sse.findNextMatch(this,new Oy(e,o,n,r),l,s)}findPreviousMatch(e,t,o,n,r,s){this._assertNotDisposed();let l=this.validatePosition(t);return Sse.findPreviousMatch(this,new Oy(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 H6)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 H6(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 H6(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,_c.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??_c.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]=OS(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,N=l-p-T+b,O=N,V=N+w,U=this._decorationsTree.getInjectedTextInInterval(this,this.getOffsetAt(new Ie(O,1)),this.getOffsetAt(new Ie(V,this.getLineMaxColumn(V))),0),G=e_.fromDecorations(U),$=new bS(G);for(let te=k;te>=0;te--){let pe=b+te,de=N+te;$.takeFromEndWhile(Se=>Se.lineNumber>de);let se=$.takeFromEndWhile(Se=>Se.lineNumber===de);u.push(new pqe(pe,de,this.getLineContent(de),se))}if(k<y){let te=b+k,pe=w-y,de=l-p-pe+te;u.push(new xvt(te+1,S,de))}if(k<w){let te=new bS(G),pe=b+k,de=w-k,se=l-p-de+pe+1,Se=[],ke=[];for(let Ee=0;Ee<de;Ee++){let He=se+Ee;ke[Ee]=this.getLineContent(He),te.takeWhile(Ve=>Ve.lineNumber<He),Se[Ee]=te.takeWhile(Ve=>Ve.lineNumber===He)}u.push(new kvt(pe+1,se,de,ke,Se))}p+=T}this._emitContentChangedEvent(new nae(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 pqe(s,s,this.getLineContent(s),this._getInjectedTextInLine(s)));this._onDidChangeContentOrInjectedText(new oye(r))}this._fireOnDidChangeLineHeight(t),this._fireOnDidChangeFont(o)}_fireOnDidChangeLineHeight(e){if(e&&e.size>0){let o=Array.from(e).map(n=>new wvt(n.ownerId,n.decorationId,n.lineNumber,n.lineHeight));this._onDidChangeLineHeight.fire(new nye(o))}}_fireOnDidChangeFont(e){if(e&&e.size>0){let o=Array.from(e).map(n=>new Cvt(n.ownerId,n.lineNumber));this._onDidChangeFont.fire(new rye(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,xji(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=Wqe,o.changeDecoration=Wqe,o.changeDecorationOptions=Wqe,o.removeDecoration=Wqe,o.deltaDecorations=Wqe,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:Cji[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(Cji[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 e$(g,this._decorationProvider.getDecorationsInRange(h,o,n,r)),e$(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 e$(c,this._decorationProvider.getDecorationsInRange(l,t,o,n,r)),e$(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 e$(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 e$(o,this._fontTokenDecorationsProvider.getDecorationsInRange(e,t)),o}_getInjectedTextInLine(e){let t=this._buffer.getOffsetAt(e,1),o=t+this._buffer.getLineLength(e),n=this._decorationsTree.getInjectedTextInInterval(this,t,o,0);return e_.fromDecorations(n).filter(r=>r.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=oNo(o)!==nbt(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 rae(w,0,0),this._decorations[w]=h}let g=o[u],f=this._validateRangeRelaxedNoAllocations(g.range),v=xji(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 yye(this.getLineContent(e))+1}toString(){return`TextModel(${this.uri.toString()})`}};Bu=I([m(4,Cl),m(5,kt),m(6,bs),m(7,F)],Bu);function kji(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:Bc.defaultTokenMetadata})}t=a.withInserted(o)}else t=a;return t}function yye(a){let i=0;for(let e of a)if(e===" "||e==="	")i++;else break;return i}function lei(a){return!!(a.options.overviewRuler&&a.options.overviewRuler.color)}function oNo(a){return!!a.after||!!a.before}function nbt(a){return!!a.options.after||!!a.options.before}var rbt=class{constructor(){this._decorationsTree0=new L9,this._decorationsTree1=new L9,this._injectedTextDecorationsTree=new L9}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){nbt(i)?this._injectedTextDecorationsTree.insert(i):lei(i)?this._decorationsTree1.insert(i):this._decorationsTree0.insert(i)}delete(i){nbt(i)?this._injectedTextDecorationsTree.delete(i):lei(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){nbt(i)?this._injectedTextDecorationsTree.resolveNode(i,e):lei(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 o1(a){return a.replace(/[^a-z0-9\-_]/gi," ")}var sbt=class{constructor(i){this.color=i.color||"",this.darkColor=i.darkColor||""}},dei=class extends sbt{constructor(i){super(i),this._resolvedColor=null,this.position=typeof i.position=="number"?i.position:2}getColor(i){return this._resolvedColor||(Ip(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():""}},uei=class{constructor(i){this.position=i?.position??2,this.persistLane=i?.persistLane}},pei=class extends sbt{constructor(i){super(i),this.position=i.position,this.sectionHeaderStyle=i.sectionHeaderStyle??null,this.sectionHeaderText=i.sectionHeaderText??null}getColor(i){return this._resolvedColor||(Ip(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"?Oe.fromHex(i):e.getColor(i.id)}},r1=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}},po=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?o1(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?o1(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,iNo):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 dei(i.overviewRuler):null,this.minimap=i.minimap?new pei(i.minimap):null,this.glyphMargin=i.glyphMarginClassName?new uei(i.glyphMargin):null,this.glyphMarginClassName=i.glyphMarginClassName?o1(i.glyphMarginClassName):null,this.linesDecorationsClassName=i.linesDecorationsClassName?o1(i.linesDecorationsClassName):null,this.lineNumberClassName=i.lineNumberClassName?o1(i.lineNumberClassName):null,this.linesDecorationsTooltip=i.linesDecorationsTooltip?hpt(i.linesDecorationsTooltip):null,this.firstLineDecorationClassName=i.firstLineDecorationClassName?o1(i.firstLineDecorationClassName):null,this.marginClassName=i.marginClassName?o1(i.marginClassName):null,this.inlineClassName=i.inlineClassName?o1(i.inlineClassName):null,this.inlineClassNameAffectsLetterSpacing=i.inlineClassNameAffectsLetterSpacing||!1,this.beforeContentClassName=i.beforeContentClassName?o1(i.beforeContentClassName):null,this.afterContentClassName=i.afterContentClassName?o1(i.afterContentClassName):null,this.after=i.after?r1.from(i.after):null,this.before=i.before?r1.from(i.before):null,this.hideInCommentTokens=i.hideInCommentTokens??!1,this.hideInStringTokens=i.hideInStringTokens??!1,this.textDirection=i.textDirection??null}};po.EMPTY=po.register({description:"empty"});var Cji=[po.register({description:"tracked-range-always-grows-when-typing-at-edges",stickiness:0}),po.register({description:"tracked-range-never-grows-when-typing-at-edges",stickiness:1}),po.register({description:"tracked-range-grows-only-when-typing-before",stickiness:2}),po.register({description:"tracked-range-grows-only-when-typing-after",stickiness:3})];function xji(a){return a instanceof po?a:po.createDynamic(a)}var mei=class extends C{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 lre([],dq.toKey)),this._affectedLineHeights.add(new dq(e,t,o,n))}recordLineAffectedByFontChange(e,t,o){this._affectedFontLines||(this._affectedFontLines=new lre([],uq.toKey)),this._affectedFontLines.add(new uq(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)}},hei=class extends C{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 abt=class a{static create(i){return new a(i.get(151),i.get(150))}constructor(i,e){this.classifier=new gei(i,e)}createLineBreaksComputer(i,e,t,o,n,r){let s=[],l=[],c=[];return{addRequest:(u,p,h)=>{s.push(u),l.push(p),c.push(h)},finalize:()=>{let u=i.typicalFullwidthCharacterWidth/i.typicalHalfwidthCharacterWidth,p=[];for(let h=0,g=s.length;h<g;h++){let f=l[h],v=c[h],b=s[h],S=r&&b.includes('"')&&b.includes("\\n");v&&!v.injectionOptions&&!f&&!S?p[h]=nNo(this.classifier,v,b,e,t,u,o,n):p[h]=rNo(this.classifier,b,f,e,t,u,o,n,S)}return fei.length=0,vei.length=0,p}}}};var gei=class extends _${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}},fei=[],vei=[];function nNo(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=Tji(e,t,o,n,r),g=o-h,f=fei,v=vei,b=0,S=0,y=0,w=o,k=u.length,T=0;if(T>=0){let N=Math.abs(p[T]-w);for(;T+1<k;){let O=Math.abs(p[T+1]-w);if(O>=N)break;N=O,T++}}for(;T<k;){let N=T<0?0:u[T],O=T<0?0:p[T];S>N&&(N=S,O=y);let V=0,U=0,G=0,$=0;if(O<=w){let pe=O,de=N===0?0:e.charCodeAt(N-1),se=N===0?0:a.get(de),Se=!0;for(let ke=N;ke<l;ke++){let Ee=ke,He=e.charCodeAt(ke),Ve,Fe;if(Ru(He)?(ke++,Ve=0,Fe=2):(Ve=a.get(He),Fe=Vqe(He,pe,t,n)),Ee>S&&bei(de,se,He,Ve,c)&&(V=Ee,U=pe),pe+=Fe,pe>w){Ee>S?(G=Ee,$=pe-Fe):(G=ke+1,$=pe),pe-U>g&&(V=0),Se=!1;break}de=He,se=Ve}if(Se){b>0&&(f[b]=u[u.length-1],v[b]=p[u.length-1],b++);break}}if(V===0){let pe=O,de=e.charCodeAt(N),se=a.get(de),Se=!1;for(let ke=N-1;ke>=S;ke--){let Ee=ke+1,He=e.charCodeAt(ke);if(He===9){Se=!0;break}let Ve,Fe;if(nN(He)?(ke--,Ve=0,Fe=2):(Ve=a.get(He),Fe=AT(He)?n:1),pe<=w){if(G===0&&(G=Ee,$=pe),pe<=w-g)break;if(bei(He,Ve,de,se,c)){V=Ee,U=pe;break}}pe-=Fe,de=He,se=Ve}if(V!==0){let ke=g-($-U);if(ke<=t){let Ee=e.charCodeAt(G),He;Ru(Ee)?He=2:He=Vqe(Ee,$,t,n),ke-He<0&&(V=0)}}if(Se){T--;continue}}if(V===0&&(V=G,U=$),V<=S){let pe=e.charCodeAt(S);Ru(pe)?(V=S+2,U=y+2):(V=S+1,U=y+Vqe(pe,y,t,n))}for(S=V,f[b]=V,y=U,v[b]=U,b++,w=U+g;T<0||T<k&&p[T]<U;)T++;let te=Math.abs(p[T]-w);for(;T+1<k;){let pe=Math.abs(p[T+1]-w);if(pe>=te)break;te=pe,T++}}return b===0?null:(f.length=b,v.length=b,fei=i.breakOffsets,vei=i.breakOffsetsVisibleColumn,i.breakOffsets=f,i.breakOffsetsVisibleColumn=v,i.wrappedTextIndentLength=h,i)}function rNo(a,i,e,t,o,n,r,s,l){let c=e_.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 oq(p,u,[c.length],[],0):null;let h=c.length;if(h<=1)return u?new oq(p,u,[c.length],[],0):null;let g=s==="keepAll",f=Tji(c,t,o,n,r),v=o-f,b=[],S=[],y=0,w=0,k=0,T=o,N=c.charCodeAt(0),O=a.get(N),V=Vqe(N,0,t,n),U=1;Ru(N)&&(V+=1,N=c.charCodeAt(1),O=a.get(N),U++);for(let G=U;G<h;G++){let $=G,te=c.charCodeAt(G),pe,de,se=!1;Ru(te)?(G++,pe=0,de=2):(pe=a.get(te),de=Vqe(te,V,t,n)),l&&sNo(c,G)?(w=$,k=V,se=!0):bei(N,O,te,pe,g)&&(w=$,k=V),V+=de,(V>T||se)&&((w===0||V-k>v)&&(w=$,k=V-de),b[y]=w,S[y]=k,y++,T=k+v,w=0),N=te,O=pe}return y===0&&(!e||e.length===0)?null:(b[y]=h,S[y]=V,new oq(p,u,b,S,f))}function Vqe(a,i,e,t){return a===9?e-i%e:AT(a)||a<32?t:1}function Eji(a,i){return i-a%i}function sNo(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 bei(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 Tji(a,i,e,t,o){let n=0;if(o!==0){let r=Ap(a);if(r!==-1){for(let l=0;l<r;l++){let c=a.charCodeAt(l)===9?Eji(n,i):1;n+=c}let s=o===3?2:o===2?1:0;for(let l=0;l<s;l++){let c=Eji(n,i);n+=c}n+t>e&&(n=0)}}return n}var Bqe=class a{constructor(i){this._selTrackedRange=null,this._trackSelection=!0,this._setState(i,new ov(new z(1,1,1,1),0,0,new Ie(1,1),0),new ov(new z(1,1,1,1),0,0,new Ie(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 Ps(this.modelState,this.viewState)}readSelectionFromMarkers(i){let e=i.model._getTrackedRange(this._selTrackedRange);return this.modelState.selection.isEmpty()&&!e.isEmpty()?Yt.fromRange(e.collapseToEnd(),this.modelState.selection.getDirection()):Yt.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 ov(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 ov(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 ov(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 ov(o,e.selectionStartKind,e.selectionStartLeftoverVisibleColumns,n,e.leftoverVisibleColumns)}else{let o=i.coordinatesConverter.convertModelPositionToViewPosition(new Ie(e.selectionStart.startLineNumber,e.selectionStart.startColumn)),n=i.coordinatesConverter.convertModelPositionToViewPosition(new Ie(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 ov(r,e.selectionStartKind,e.selectionStartLeftoverVisibleColumns,s,e.leftoverVisibleColumns)}this.modelState=e,this.viewState=t,this._updateTrackedRange(i)}};var Hqe=class{constructor(i){this.context=i,this.cursors=[new Bqe(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 Put(this.cursors,tl(i=>i.viewState.position,Ie.compare)).viewState.position}getBottomMostViewPosition(){return Mut(this.cursors,tl(i=>i.viewState.position,Ie.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(Ps.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 Bqe(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(tl(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 Yt(v.startLineNumber,v.startColumn,v.endLineNumber,v.endColumn):w=new Yt(v.endLineNumber,v.endColumn,v.startLineNumber,v.startColumn),e[c].selection=w;let k=Ps.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 Uqe=class{constructor(i,e,t,o){this._cursorContextBrand=void 0;this.model=i,this.viewModel=e,this.coordinatesConverter=t,this.cursorConfig=o}};var lbt=class extends C{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 VM),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)}}},VM=class{constructor(){this.viewEvents=[],this.outgoingEvents=[]}emitViewEvent(i){this.viewEvents.push(i)}emitOutgoingEvent(i){this.outgoingEvents.push(i)}};var cbt=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)}},zqe=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)}},dbt=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 zqe(this.oldHasFocus,i.hasFocus)}},ubt=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)}},pbt=class{constructor(){this.kind=4}isNoOp(){return!1}attemptToMerge(i){return i.kind!==this.kind?null:this}},mbt=class{constructor(){this.kind=5}isNoOp(){return!1}attemptToMerge(i){return i.kind!==this.kind?null:this}},hbt=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)}},gbt=class{constructor(){this.kind=6}isNoOp(){return!1}attemptToMerge(i){return i.kind!==this.kind?null:this}},fbt=class{constructor(i){this.event=i;this.kind=8}isNoOp(){return!1}attemptToMerge(i){return null}},vbt=class{constructor(i){this.event=i;this.kind=9}isNoOp(){return!1}attemptToMerge(i){return null}},bbt=class{constructor(i){this.event=i;this.kind=10}isNoOp(){return!1}attemptToMerge(i){return null}},Sbt=class{constructor(i){this.event=i;this.kind=11}isNoOp(){return!1}attemptToMerge(i){return null}},Ibt=class{constructor(i){this.event=i;this.kind=12}isNoOp(){return!1}attemptToMerge(i){return null}},ybt=class{constructor(i){this.event=i;this.kind=13}isNoOp(){return!1}attemptToMerge(i){return null}},wbt=class{constructor(i){this.event=i;this.kind=14}isNoOp(){return!1}attemptToMerge(i){return null}},Cbt=class{constructor(i){this.event=i;this.kind=15}isNoOp(){return!1}attemptToMerge(i){return null}};var wye=class extends C{constructor(i,e,t,o){super(),this._model=i,this._knownModelVersionId=this._model.getVersionId(),this._viewModel=e,this._coordinatesConverter=t,this.context=new Uqe(this._model,this._viewModel,this._coordinatesConverter,o),this._cursors=new Hqe(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=Ue(this._autoClosedActions),super.dispose()}updateConfiguration(i){this.context=new Uqe(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=Kqe.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 A$(e,t,l,c,o,n,r))}revealPrimary(i,e,t,o,n,r){let l=[this._cursors.getPrimaryCursor().viewState.selection];i.emitViewEvent(new A$(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,Ps.fromModelSelections(t)),this.revealAll(i,"restoreState",!1,0,!0,1)}onModelContentChanged(i,e){if(e instanceof oye){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 Hqe(this.context),this._validateAutoClosedActions(),this._emitStateChangedIfNecessary(i,"model",1,null,!1);else if(this._hasFocus&&t.resultingSelection&&t.resultingSelection.length>0){let n=Ps.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,Ps.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,Ps.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 xbt(this._model,n,r))}_executeEditOperation(i,e){if(!i)return;i.shouldPushStackElementBefore&&this._model.pushStackElement();let t=V9.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 wSe&&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=Kqe.from(this._model,this);if(r.equals(o))return!1;let s=this._cursors.getSelections(),l=this._cursors.getViewSelections();if(i.emitViewEvent(new Iht(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 hbt(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=Kqe.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 xbt.getAllAutoClosedCharacters(this._autoClosedActions)}startComposition(i){this._compositionState=new Iei(this._model,this.getSelections())}endComposition(i,e){let t=_c.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(RM.compositionEndWithInterceptors(this._prevEditOperationType,this.context.cursorConfig,this._model,o,this.getSelections(),this.getAutoClosedCharacters()),t)},i,e)}type(i,e,t){let o=_c.cursor({kind:"type",detailedSource:t});this._executeEdit(()=>{if(t==="keyboard"){let n=e.length,r=0;for(;r<n;){let s=Tbe(e,r),l=e.substr(r,s);this._executeEditOperation(RM.typeWithInterceptors(!!this._compositionState,this._prevEditOperationType,this.context.cursorConfig,this._model,this.getSelections(),this.getAutoClosedCharacters(),l),o),r+=s}}else this._executeEditOperation(RM.typeWithoutInterceptors(this._prevEditOperationType,this.context.cursorConfig,this._model,this.getSelections(),e),o)},i,t)}compositionType(i,e,t,o,n,r){let s=_c.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 Yt(u.lineNumber,u.column+n,u.lineNumber,u.column+n)});this.setSelections(i,r,l,0)}return}this._executeEdit(()=>{this._executeEditOperation(RM.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=_c.cursor({kind:"paste",detailedSource:n});this._executeEdit(()=>{this._executeEditOperation(RM.paste(this.context.cursorConfig,this._model,this.getSelections(),e,t,o||[]),r)},i,n,4)}cut(i,e){let t=_c.cursor({kind:"cut",detailedSource:e});this._executeEdit(()=>{this._executeEditOperation(wN.cut(this.context.cursorConfig,this._model,this.getSelections()),t)},i,e)}executeCommand(i,e,t){let o=_c.cursor({kind:"executeCommand",detailedSource:t});this._executeEdit(()=>{this._cursors.killSecondaryCursors(),this._executeEditOperation(new Yv(0,[e],{shouldPushStackElementBefore:!1,shouldPushStackElementAfter:!1}),o)},i,t)}executeCommands(i,e,t){let o=_c.cursor({kind:"executeCommands",detailedSource:t});this._executeEdit(()=>{this._executeEditOperation(new Yv(0,e,{shouldPushStackElementBefore:!1,shouldPushStackElementAfter:!1}),o)},i,t)}},Kqe=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}},xbt=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}},V9=class{static executeCommands(i,e,t,o=_c.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 Yt(S.startLineNumber,S.startColumn,S.endLineNumber,S.endColumn):new Yt(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=Yt.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}},Sei=class{constructor(i,e,t,o){this.text=i;this.lineNumber=e;this.startSelectionOffset=t;this.endSelectionOffset=o}},Iei=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 Sei(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,Ng(i.text,e.text)),o=Math.min(i.text.length-i.endSelectionOffset,e.text.length-e.endSelectionOffset,zw(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 fht(n,i.startSelectionOffset-t,i.endSelectionOffset-t,l,e.startSelectionOffset-t,e.endSelectionOffset-t,c)}};var yei={getInitialState:()=>nei,tokenizeEncoded:(a,i,e)=>bye(0,e)};function kbt(a,i,e){return wei(i,a.languageIdCodec,kc.get(e)||yei)}async function bW(a,i,e){if(!e)return wei(i,a.languageIdCodec,yei);let t=await kc.getOrCreate(e);return wei(i,a.languageIdCodec,t||yei)}function Ebt(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+=AT(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 wei(a,i,e){let t='<div class="monaco-tokenized-source">',o=mc(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);Bc.convertToEndOffset(c.tokens,l.length);let p=new Bc(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}">${ur(l.substring(h,b))}</span>`,h=b}n=c.endState}return t+="</div>",t}var Cei=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}},$qe=class{constructor(i,e){this._decorationIDToCustomLine=new Gqe;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=[];for(let t of i)switch(t.kind){case 1:this._doRemoveCustomLineHeight(t.decorationId,e);break;case 0:this._doInsertOrChangeCustomLineHeight(t.decorationId,t.startLineNumber,t.endLineNumber,t.lineHeight,e);break;case 2:this._flushStagedDecorationChanges(e),this._doLinesDeleted(t.fromLineNumber,t.toLineNumber);break;case 3:this._flushStagedDecorationChanges(e),this._doLinesInserted(t.fromLineNumber,t.toLineNumber,e);break}this._flushStagedDecorationChanges(e)}_doRemoveCustomLineHeight(i,e){let t=this._decorationIDToCustomLine.get(i);if(t){this._decorationIDToCustomLine.delete(i);for(let o of t)o.deleted=!0,this._invalidIndex=Math.min(this._invalidIndex,o.index)}for(let o=e.length-1;o>=0;o--)e[o].decorationId===i&&e.splice(o,1)}_doInsertOrChangeCustomLineHeight(i,e,t,o,n){this._doRemoveCustomLineHeight(i,n);for(let r=e;r<=t;r++){let s=new Cei(i,-1,r,o,0);n.push(s)}}_flushStagedDecorationChanges(i){if(i.length===0&&this._invalidIndex===1/0)return;for(let r of i){let s=this._binarySearchOverOrderedCustomLinesArray(r.lineNumber),l=s>=0?s:-(s+1);this._orderedCustomLines.splice(l,0,r),this._invalidIndex=Math.min(this._invalidIndex,l)}i.length=0;let e=new Gqe,t=[];for(let r=0;r<this._invalidIndex;r++){let s=this._orderedCustomLines[r];t.push(s),e.add(s.decorationId,s)}let o=0,n=this._invalidIndex>0?t[this._invalidIndex-1]:void 0;for(let r=this._invalidIndex;r<this._orderedCustomLines.length;r++){let s=this._orderedCustomLines[r];if(s.deleted){o++;continue}if(s.index=r-o,n&&n.lineNumber===s.lineNumber)s.maximumSpecialHeight=n.maximumSpecialHeight,s.prefixSum=n.prefixSum;else{let l=s.specialHeight;for(let u=r;u<this._orderedCustomLines.length;u++){let p=this._orderedCustomLines[u];if(!p.deleted){if(p.lineNumber!==s.lineNumber)break;l=Math.max(l,p.specialHeight)}}s.maximumSpecialHeight=l;let c;n?c=n.prefixSum+n.maximumSpecialHeight+this._defaultLineHeight*(s.lineNumber-n.lineNumber-1):c=this._defaultLineHeight*(s.lineNumber-1),s.prefixSum=c}n=s,t.push(s),e.add(s.decorationId,s)}this._orderedCustomLines=t,this._decorationIDToCustomLine=e,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 N=r;N<=l;N++)p=Math.max(p,this._orderedCustomLines[N].maximumSpecialHeight);let h=0;if(r>0){let N=this._orderedCustomLines[r-1];h=N.prefixSum+N.maximumSpecialHeight+this._defaultLineHeight*(i-N.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 Gqe,T=0;for(let N=0;N<this._orderedCustomLines.length;N++){let O=this._orderedCustomLines[N];if(N<r)w.push(O),k.add(O.decorationId,O);else if(N>=r&&N<=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 N>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){let o=e-i+1,n=this._binarySearchOverOrderedCustomLinesArray(i),r;if(n>=0){r=n;for(let h=n-1;h>=0&&this._orderedCustomLines[h].lineNumber===i;h--)r--}else r=-(n+1);let s=[],l=new Set;for(let h=r;h<this._orderedCustomLines.length;h++)this._orderedCustomLines[h].lineNumber===i&&l.add(this._orderedCustomLines[h].decorationId);let c=new Set;for(let h=r-1;h>=0;h--)this._orderedCustomLines[h].lineNumber===i-1&&c.add(this._orderedCustomLines[h].decorationId);let u=Dut(c,l),p=o*this._defaultLineHeight;for(let h=r;h<this._orderedCustomLines.length;h++)this._orderedCustomLines[h].lineNumber+=o,this._orderedCustomLines[h].prefixSum+=p;if(u.size>0){for(let h of u){let g=this._decorationIDToCustomLine.get(h);if(g){let f=g.reduce((S,y)=>Math.min(S,y.lineNumber),i),v=g.reduce((S,y)=>Math.max(S,y.lineNumber),i),b=g.reduce((S,y)=>Math.max(S,y.specialHeight),0);s.push({decorationId:h,startLineNumber:f,endLineNumber:v,lineHeight:b})}}for(let h of s)this._doInsertOrChangeCustomLineHeight(h.decorationId,h.startLineNumber,h.endLineNumber,h.lineHeight,t)}}_binarySearchOverOrderedCustomLinesArray(i){return bM(this._orderedCustomLines.length,e=>{let t=this._orderedCustomLines[e];return t.lineNumber===i?0:t.lineNumber<i?-1:1})}},qqe=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)})}},Gqe=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)}};var xei=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)}},kei=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}},Tbt=class a{static{this.INSTANCE_COUNT=0}constructor(i,e,t,o,n){this._instanceId=_be(++a.INSTANCE_COUNT),this._pendingChanges=new xei,this._lastWhitespaceId=0,this._arr=[],this._prefixSumValidIndex=-1,this._minWidth=-1,this._lineCount=i,this._paddingTop=t,this._paddingBottom=o,this._lineHeightsManager=new $qe(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 $qe(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 kei(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 N=u,O=u+T;(N<=v&&v<O||N>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 cNo=125,cae=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}},Eei=class extends C{constructor(e,t){super();this._onDidContentSizeChange=this._register(new E);this.onDidContentSizeChange=this._onDidContentSizeChange.event;this._dimensions=new cae(0,0,0,0),this._scrollable=this._register(new UT({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 cbt(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()}},_bt=class extends C{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 Tbt(e,n.get(75),s.top,s.bottom,t),this._maxLineWidth=0,this._overlayWidgetsMinWidth=0,this._scrollable=this._register(new Eei(0,o)),this._configureSmoothScrollDuration(),this._scrollable.setScrollDimensions(new cae(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)?cNo: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 cae(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 cae(e,i.contentWidth,t,this._getContentHeight(e,t,o)))}getCurrentViewport(){let i=this._scrollable.getScrollDimensions(),e=this._scrollable.getCurrentScrollPosition();return new sqe(e.scrollTop,e.scrollLeft,i.width,i.height)}getFutureViewport(){let i=this._scrollable.getScrollDimensions(),e=this._scrollable.getFutureScrollPosition();return new sqe(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 cae(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 Dbt=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,Qre(this.configuration.options),Yre(this.configuration.options),l,c)};this._inlineDecorationsComputer=new Tgt(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 Mbt(a,i){return a===null?i?Lbt.INSTANCE:Rbt.INSTANCE:new _ei(a,i)}var _ei=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 e_(0,0,c+1,this._projectionData.injectionOptions[u],0));r=e_.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=_ji(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 _gt(h).getInlineDecorations(e),v=i.tokenization.getLineTokens(e),b=kji(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=_ji(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 Zse(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")}},Lbt=class a{static{this.INSTANCE=new a}constructor(){}isVisible(){return!0}setVisible(i){return i?this:Rbt.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 Zse(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 Ie(i,e)}getViewLineNumberOfModelPosition(i,e){return i}normalizePosition(i,e,t){return e}getInjectedTextAt(i,e){return null}},Rbt=class a{static{this.INSTANCE=new a}constructor(){}isVisible(){return!1}setVisible(i){return i?Lbt.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")}},Tei=[""];function _ji(a){if(a>=Tei.length)for(let i=1;i<=a;i++)Tei[i]=dNo(i);return Tei[a]}function dNo(a){return new Array(a+1).join(" ")}var Pbt=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 Abt=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 Dei(this)}_constructLines(i,e){this.modelLineProjections=[],i&&(this.hiddenAreasDecorationIds=this.model.deltaDecorations(this.hiddenAreasDecorationIds,[]));let t=this.model.getLinesContent(),o=this.model.getInjectedTextDecorations(this._editorId),n=t.length,r=this.createLineBreaksComputer(),s=new bS(e_.fromDecorations(o));for(let v=0;v<n;v++){let b=s.takeWhile(S=>S.lineNumber===v+1);r.addRequest(t[v],b,e?e[v]:null)}let l=r.finalize(),c=[],u=this.hiddenAreasDecorationIds.map(v=>this.model.getDecorationRange(v)).sort(z.compareRangesUsingStarts),p=1,h=0,g=-1,f=g+1<u.length?h+1:n+2;for(let v=0;v<n;v++){let b=v+1;b===f&&(g++,p=u[g].startLineNumber,h=u[g].endLineNumber,f=g+1<u.length?h+1:n+2);let S=b>=p&&b<=h,y=Mbt(l[v],!S);c[v]=y.getViewLineCount(),this.modelLineProjections[v]=y}this._validModelVersionId=this.model.getVersionId(),this.projectedModelLineLineCounts=new VSe(c),this._ensureAtLeastOneVisibleLine()}getHiddenAreas(){return this.hiddenAreasDecorationIds.map(i=>this.model.getDecorationRange(i))}setHiddenAreas(i){let e=i.map(h=>this.model.validateRange(h)),t=uNo(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:po.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(){return(this.wrappingStrategy==="advanced"?this._domLineBreaksComputerFactory:this._monospaceLineBreaksComputerFactory).createLineBreaksComputer(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 kSe(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=Mbt(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 ESe(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=Mbt(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 m$e(u,p-u+1):null,S=h<=g?new ESe(h,g):null,y=f<=v?new kSe(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 Nbt(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 Ie(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 Ie(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 Nbt(l,h))}if(!c.isVisible()&&r){let u=new Ie(l-1,this.model.getLineMaxColumn(l-1)+1),p=z.fromPositions(r,u);n.push(new Obt(p,s)),s=[],r=null}else c.isVisible()&&!r&&(r=new Ie(l,1))}if(r){let l=z.fromPositions(r,this.getModelEndPositionOfViewLine(o));n.push(new Obt(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 VN(g.visibleColumn,f,g.className,new tq(g.horizontalLine.top,v.column),-1,-1):b.lineNumber<u.modelLineWrappedLineIdx||g.visibleColumn!==-1?void 0:new VN(g.visibleColumn,f,g.className,new tq(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 Ie(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 Ie(n+1,u)).equals(t)?new Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 uNo(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 Nbt=class{constructor(i,e){this.modelLineNumber=i;this.modelLineWrappedLineIdx=e}get isWrappedLineContinuation(){return this.modelLineWrappedLineIdx>0}},Obt=class{constructor(i,e){this.modelRange=i;this.viewLines=e}},Dei=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 Fbt=class{constructor(i){this.model=i}dispose(){}createCoordinatesConverter(){return new Pbt(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,o)=>{i.push(null)},finalize:()=>i}}onModelFlushed(){}onModelLinesDeleted(i,e,t){return new kSe(e,t)}onModelLinesInserted(i,e,t,o){return new ESe(e,t)}onModelLineChanged(i,e,t){return[!1,new m$e(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 Zse(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 dae=3,Wbt=class{constructor(i){this.persist=0;this._requiredLanes=1;this.lanes=new Uint8Array(Math.ceil((i+1)*dae/8))}reset(i){let e=Math.ceil((i+1)*dae/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=dae*o+(i-1);this.lanes[n>>>3]|=1<<n%8,this._requiredLanes=Math.max(this._requiredLanes,this.countAtLine(o))}}getLanesAtLine(i){let e=[],t=dae*i;for(let o=0;o<dae;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=dae*i,t=0;for(let o=0;o<dae;o++)(this.persist&1<<o||this.lanes[e>>>3]&1<<e%8)&&t++,e++;return t}};var pNo=!0,Vbt=class extends C{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 Mei;this.previousHiddenAreas=[];if(this._editorId=e,this._configuration=t,this.model=o,this._eventDispatcher=new lbt,this.onEvent=this._eventDispatcher.onEvent,this.cursorConfig=new rW(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._updateConfigurationViewLineCount=this._register(new Dt(()=>this._updateConfigurationViewLineCountNow(),0)),this._hasFocus=!1,this._viewportStart=Lei.create(this.model),this.glyphLanes=new Wbt(0),pNo&&this.model.isTooLargeForTokenization())this._lines=new Fbt(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 Abt(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 wye(o,this,this.coordinatesConverter,this.cursorConfig)),this.viewLayout=this._register(new _bt(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 Cht(h)),this._eventDispatcher.emitOutgoingEvent(new ubt(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 Dbt(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(UIe.getInstance().onDidChange(()=>{this._eventDispatcher.emitSingleViewEvent(new Eht)})),this._register(this._themeService.onDidColorThemeChange(h=>{this._invalidateDecorationsColorCache(),this._eventDispatcher.emitSingleViewEvent(new xht(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(){return this._lines.createLineBreaksComputer()}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 qqe.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 qqe.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 yht(e)),this._eventDispatcher.emitOutgoingEvent(new zqe(!e,e))}setHasWidgetFocus(e){this._eventDispatcher.emitOutgoingEvent(new dbt(!e,e))}onCompositionStart(){this._eventDispatcher.emitSingleViewEvent(new vht)}onCompositionEnd(){this._eventDispatcher.emitSingleViewEvent(new bht)}_captureStableViewport(){if(this._viewportStart.isValid&&this.viewLayout.getCurrentScrollTop()>0){let e=new Ie(this._viewportStart.viewLineNumber,this.getLineMinColumn(this._viewportStart.viewLineNumber)),t=this.coordinatesConverter.convertViewPositionToModelPosition(e);return new Bbt(t,this._viewportStart.startLineDelta)}return new Bbt(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 mse),e.emitViewEvent(new hse),e.emitViewEvent(new wU(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 wU(null))),t.hasChanged(112)&&(this._decorations.reset(),e.emitViewEvent(new wU(null))),e.emitViewEvent(new Sht(t)),this.viewLayout.onConfigurationChanged(t),o.recoverViewportStart(this.coordinatesConverter,this.viewLayout),rW.shouldRecreate(t)&&(this.cursorConfig=new rW(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 _9?e.rawContentChangedEvent.changes:e.changes,l=e instanceof _9?e.rawContentChangedEvent.versionId:null,c=this._lines.createLineBreaksComputer();for(let g of s)switch(g.changeType){case 4:{for(let f=0;f<g.detail.length;f++){let v=g.detail[f],b=g.injectedTexts[f];b&&(b=b.filter(S=>!S.ownerId||S.ownerId===this._editorId)),c.addRequest(v,b,null)}break}case 2:{let f=null;g.injectedText&&(f=g.injectedText.filter(v=>!v.ownerId||v.ownerId===this._editorId)),c.addRequest(g.detail,f,null);break}}let u=c.finalize(),p=new bS(u),h=[];for(let g of s)switch(g.changeType){case 1:{this._lines.onModelFlushed(),o.emitViewEvent(new mse),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.detail.length),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 hse),o.emitViewEvent(new wU(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 _9&&t.emitOutgoingEvent(new Sbt(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 nye(n);this._eventDispatcher.emitOutgoingEvent(new wbt(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 rye(n);this._eventDispatcher.emitOutgoingEvent(new Cbt(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 Ie(l.fromLineNumber,1)).lineNumber,u=this.coordinatesConverter.convertModelPositionToViewPosition(new Ie(l.toLineNumber,this.model.getLineMaxColumn(l.toLineNumber))).lineNumber;n[r]={fromLineNumber:c,toLineNumber:u}}this._eventDispatcher.emitSingleViewEvent(new kht(n)),this._eventDispatcher.emitOutgoingEvent(new ybt(o))})),this._register(this.model.onDidChangeLanguageConfiguration(o=>{this._eventDispatcher.emitSingleViewEvent(new wht),this.cursorConfig=new rW(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._cursor.updateConfiguration(this.cursorConfig),this._eventDispatcher.emitOutgoingEvent(new bbt(o))})),this._register(this.model.onDidChangeLanguage(o=>{this.cursorConfig=new rW(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._cursor.updateConfiguration(this.cursorConfig),this._eventDispatcher.emitOutgoingEvent(new vbt(o))})),this._register(this.model.onDidChangeOptions(o=>{if(this._lines.setTabSize(this.model.getOptions().tabSize)){try{let n=this._eventDispatcher.beginEmitViewEvents();n.emitViewEvent(new mse),n.emitViewEvent(new hse),n.emitViewEvent(new wU(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 rW(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._cursor.updateConfiguration(this.cursorConfig),this._eventDispatcher.emitOutgoingEvent(new Ibt(o))})),this._register(this.model.onDidChangeDecorations(o=>{this._decorations.onModelDecorationsChanged(),this._eventDispatcher.emitSingleViewEvent(new wU(o)),this._eventDispatcher.emitOutgoingEvent(new fbt(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 mse),l.emitViewEvent(new hse),l.emitViewEvent(new wU(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 mbt)}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 Ie(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=Ap(this.getLineContent(e));return t===-1?0:t+1}getLineLastNonWhitespaceColumn(e){let t=tv(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 KU(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 Gft(this.getTabSize(),n)}getAllOverviewRulerDecorations(e){let t=this.model.getOverviewRulerDecorations(this._editorId,Qre(this._configuration.options),Yre(this._configuration.options)),o=new Rei;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===Fr||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===Yd.fontFamily,u;return c?u=Yd.fontFamily:(u=r.fontFamily,u=u.replace(/"/g,"'"),/[,']/.test(u)||/[+ ]/.test(u)&&(u=`'${u}'`),u=`${u}, ${Yd.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+=Ebt(h,p.inflate(),t,g,f,l,ri)}return c}_getColorMap(){let e=kc.getColorMap(),t=["#000000"];if(e)for(let o=1,n=e.length;o<n;o++)t[o]=Oe.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 gbt);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 A$(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 A$(e,!1,o,null,0,!0,0)))}revealRange(e,t,o,n,r){this._withViewEventsCollector(s=>s.emitViewEvent(new A$(e,!1,o,null,n,t,r)))}changeWhitespace(e){this.viewLayout.changeWhitespace(e)&&(this._eventDispatcher.emitSingleViewEvent(new Tht),this._eventDispatcher.emitOutgoingEvent(new pbt))}_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)}},Lei=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 Ie(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}},Rei=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 eae(i,e,[n,t,o]);this._asMap[i]=s,this.asArray.push(s)}}},Mei=class{constructor(){this.hiddenAreas=new Map;this.shouldRecompute=!1;this.ranges=[]}setHiddenAreas(i,e){let t=this.hiddenAreas.get(i);t&&Dji(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)=>mNo(e,t),[]);return Dji(this.ranges,i)?this.ranges:(this.ranges=i,this.ranges)}};function mNo(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 Dji(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 Bbt=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 Io=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 jr=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.languageConfigurationService=h;this._deliveryQueue=zUi();this._contributions=this._register(new _vt);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 ob(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 Hbt({deliveryQueue:this._deliveryQueue}));this.onDidFocusEditorText=this._editorTextFocus.onDidChangeToTrue;this.onDidBlurEditorText=this._editorTextFocus.onDidChangeToFalse;this._editorWidgetFocus=this._register(new Hbt({deliveryQueue:this._deliveryQueue}));this.onDidFocusEditorWidget=this._editorWidgetFocus.onDidChangeToTrue;this.onDidBlurEditorWidget=this._editorWidgetFocus.onDidChangeToFalse;this._onWillType=this._register(new ob(this._contributions,this._deliveryQueue));this.onWillType=this._onWillType.event;this._onDidType=this._register(new ob(this._contributions,this._deliveryQueue));this.onDidType=this._onDidType.event;this._onDidCompositionStart=this._register(new ob(this._contributions,this._deliveryQueue));this.onDidCompositionStart=this._onDidCompositionStart.event;this._onDidCompositionEnd=this._register(new ob(this._contributions,this._deliveryQueue));this.onDidCompositionEnd=this._onDidCompositionEnd.event;this._onDidPaste=this._register(new ob(this._contributions,this._deliveryQueue));this.onDidPaste=this._onDidPaste.event;this._onWillCopy=this._register(new ob(this._contributions,this._deliveryQueue));this.onWillCopy=this._onWillCopy.event;this._onWillCut=this._register(new ob(this._contributions,this._deliveryQueue));this.onWillCut=this._onWillCut.event;this._onWillPaste=this._register(new ob(this._contributions,this._deliveryQueue));this.onWillPaste=this._onWillPaste.event;this._onMouseUp=this._register(new ob(this._contributions,this._deliveryQueue));this.onMouseUp=this._onMouseUp.event;this._onMouseDown=this._register(new ob(this._contributions,this._deliveryQueue));this.onMouseDown=this._onMouseDown.event;this._onMouseDrag=this._register(new ob(this._contributions,this._deliveryQueue));this.onMouseDrag=this._onMouseDrag.event;this._onMouseDrop=this._register(new ob(this._contributions,this._deliveryQueue));this.onMouseDrop=this._onMouseDrop.event;this._onMouseDropCanceled=this._register(new ob(this._contributions,this._deliveryQueue));this.onMouseDropCanceled=this._onMouseDropCanceled.event;this._onDropIntoEditor=this._register(new ob(this._contributions,this._deliveryQueue));this.onDropIntoEditor=this._onDropIntoEditor.event;this._onContextMenu=this._register(new ob(this._contributions,this._deliveryQueue));this.onContextMenu=this._onContextMenu.event;this._onMouseMove=this._register(new ob(this._contributions,this._deliveryQueue));this.onMouseMove=this._onMouseMove.event;this._onMouseLeave=this._register(new ob(this._contributions,this._deliveryQueue));this.onMouseLeave=this._onMouseLeave.event;this._onMouseWheel=this._register(new ob(this._contributions,this._deliveryQueue));this.onMouseWheel=this._onMouseWheel.event;this._onKeyUp=this._register(new ob(this._contributions,this._deliveryQueue));this.onKeyUp=this._onKeyUp.event;this._onKeyDown=this._register(new ob(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=++gNo,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 Aei(this,this._contextKeyService)),this._register(new Nei(this,this._contextKeyService,g)),this._instantiationService=this._register(n.createChild(new Io([X,this._contextKeyService]))),this._modelData=null,this._contentWidgets={},this._overlayWidgets={},this._glyphMarginWidgets={};let b;Array.isArray(o.contributions)?b=o.contributions:b=aa.getEditorContributions(),this._contributions.initialize(this,b,this._instantiationService);for(let y of aa.getEditorActions()){if(this._actions.has(y.id)){mt(new Error(`Cannot have two actions with the same id ${y.id}`));continue}let w=new Dvt(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 Om(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=po.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 i9(e,t,o,this._domElement,n)}getId(){return this.getEditorType()+":"+this._id}getEditorType(){return P$.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?yf.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?jr._getVerticalOffsetForPosition(this._modelData,e,1,t):-1}getTopForPosition(e,t){return this._modelData?jr._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?jr._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=Ie.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 al.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 al.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(!Ie.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(!Ie.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=Yt.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 Yt(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(!Yt.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=aa.getEditorCommand(t);return n?(o=o||{},yi(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 fqe?(s=e,r=e.metadata.source):(s=_c.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 Oei(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,Qre(t),Yre(t))}getDecorationsInRange(e){if(!this._modelData)return null;let t=this._configuration.options;return this._modelData.model.getDecorationsInRange(e,this._id,Qre(t),Yre(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=Ir(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=po.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=jr._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){Pd(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 Vbt(this._id,this._configuration,e,Tvt.create(Me(this._domElement)),abt.create(this._configuration.options),l=>$r(Me(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(St.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 Pei(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 MIe(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 tye(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:jr.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()}};jr=I([m(3,F),m(4,Kt),m(5,ge),m(6,X),m(7,De),m(8,Ne),m(9,Bi),m(10,bs),m(11,zt),m(12,eC)],jr);var gNo=0,Pei=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(){Ue(this.listenersToRemove),this.model.onBeforeDetached(this.attachedView),this.hasRealView&&this.view.dispose(),this.viewModel.dispose()}};var Hbt=class extends C{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())}},ob=class extends E{constructor(e,t){super({deliveryQueue:t});this._contributions=e}fire(e){this._contributions.onBeforeInteractionEvent(),super.fire(e)}},Aei=class extends C{constructor(i,e){super(),this._editor=i,e.createKey("editorId",i.getId()),this._editorSimpleInput=ue.editorSimpleInput.bindTo(e),this._editorFocus=ue.focus.bindTo(e),this._textInputFocus=ue.textInputFocus.bindTo(e),this._editorTextFocus=ue.editorTextFocus.bindTo(e),this._tabMovesFocus=ue.tabMovesFocus.bindTo(e),this._editorReadonly=ue.readOnly.bindTo(e),this._inDiffEditor=ue.inDiffEditor.bindTo(e),this._editorColumnSelection=ue.columnSelection.bindTo(e),this._hasMultipleSelections=ue.hasMultipleSelections.bindTo(e),this._hasNonEmptySelection=ue.hasNonEmptySelection.bindTo(e),this._canUndo=ue.canUndo.bindTo(e),this._canRedo=ue.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(GT.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)||GT.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()))}},Nei=class extends C{constructor(e,t,o){super();this._editor=e;this._contextKeyService=t;this._languageFeaturesService=o;this._langId=ue.languageId.bindTo(t),this._hasCompletionItemProvider=ue.hasCompletionItemProvider.bindTo(t),this._hasCodeActionsProvider=ue.hasCodeActionsProvider.bindTo(t),this._hasCodeLensProvider=ue.hasCodeLensProvider.bindTo(t),this._hasDefinitionProvider=ue.hasDefinitionProvider.bindTo(t),this._hasDeclarationProvider=ue.hasDeclarationProvider.bindTo(t),this._hasImplementationProvider=ue.hasImplementationProvider.bindTo(t),this._hasTypeDefinitionProvider=ue.hasTypeDefinitionProvider.bindTo(t),this._hasHoverProvider=ue.hasHoverProvider.bindTo(t),this._hasDocumentHighlightProvider=ue.hasDocumentHighlightProvider.bindTo(t),this._hasDocumentSymbolProvider=ue.hasDocumentSymbolProvider.bindTo(t),this._hasReferenceProvider=ue.hasReferenceProvider.bindTo(t),this._hasRenameProvider=ue.hasRenameProvider.bindTo(t),this._hasSignatureHelpProvider=ue.hasSignatureHelpProvider.bindTo(t),this._hasInlayHintsProvider=ue.hasInlayHintsProvider.bindTo(t),this._hasDocumentFormattingProvider=ue.hasDocumentFormattingProvider.bindTo(t),this._hasDocumentSelectionFormattingProvider=ue.hasDocumentSelectionFormattingProvider.bindTo(t),this._hasMultipleDocumentFormattingProvider=ue.hasMultipleDocumentFormattingProvider.bindTo(t),this._hasMultipleDocumentSelectionFormattingProvider=ue.hasMultipleDocumentSelectionFormattingProvider.bindTo(t),this._isInEmbeddedEditor=ue.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===Y.walkThroughSnippet||e.uri.scheme===Y.vscodeChatCodeBlock)})}},Oei=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}},fNo=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='"),vNo=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 Cye(a){return fNo+encodeURIComponent(a.toString())+vNo}var bNo=encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" height="3" width="12"><g fill="'),SNo=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 Lji(a){return bNo+encodeURIComponent(a.toString())+SNo}is((a,i)=>{let e=a.getColor(av);e&&(i.addRule(`.monaco-editor .squiggly-error { background: url("data:image/svg+xml,${Cye(e)}") repeat-x bottom left; }`),i.addRule(`:root { --monaco-editor-error-decoration: url("data:image/svg+xml,${Cye(e)}"); }`));let t=a.getColor(Bh);t&&(i.addRule(`.monaco-editor .squiggly-warning { background: url("data:image/svg+xml,${Cye(t)}") repeat-x bottom left; }`),i.addRule(`:root { --monaco-editor-warning-decoration: url("data:image/svg+xml,${Cye(t)}"); }`));let o=a.getColor(fm);o&&(i.addRule(`.monaco-editor .squiggly-info { background: url("data:image/svg+xml,${Cye(o)}") repeat-x bottom left; }`),i.addRule(`:root { --monaco-editor-info-decoration: url("data:image/svg+xml,${Cye(o)}"); }`));let n=a.getColor(iGi);n&&(i.addRule(`.monaco-editor .squiggly-hint { background: url("data:image/svg+xml,${Lji(n)}") no-repeat bottom left; }`),i.addRule(`:root { --monaco-editor-hint-decoration: url("data:image/svg+xml,${Lji(n)}"); }`));let r=a.getColor(pqi);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 INo=!1;function rE(){return INo}function Fei(a){if(rE()){let i=yNo();return i.add(a),{dispose(){i.delete(a)}}}else return{dispose(){}}}function yNo(){Ubt||(Ubt=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 Ubt){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}}),Ubt}var Ubt;rE()&&Fei(({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 Cx(a,i){return wNo([a],i),a}function wNo(a,i){rE()&&Nr("reload",t=>Fei(({oldExports:o})=>{if([...Object.values(o)].some(n=>a.includes(n)))return n=>(t(void 0),!0)})).read(i)}var Rji=new Map;function s1(a){if(!rE())return Oo(a);let i=a.name,e=Rji.get(i);return e?setTimeout(()=>{e.set(a,void 0)},0):(e=Le(i,a),Rji.set(i,e)),e}function pr(a,i,e,t=Il.ofCaller()){return ff({debugName:()=>`Configuration Key "${a}"`},o=>e.onDidChangeConfiguration(n=>{n.affectsConfiguration(a)&&o(n)}),()=>e.getValue(a)??i,t)}function tc(a,i,e,t=Il.ofCaller()){let o=a.bindTo(i),n=new P;return hs({debugName:()=>`Set Context Key "${a.key}"`},r=>{let s=e(r);return o.set(s),s},t).recomputeInitiallyAndOnChange(n),n}function Mji(a,i,e=Il.ofCaller()){return ui(void 0,i.onDidChangeContext,()=>i.getContextKeyValue(a),e)}var tr=ae("accessibilitySignalService"),Aji=Symbol("AcknowledgeDocCommentsToken"),xye=class extends C{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 kI(n=>pr(n.settingsKey,{sound:"off",announcement:"off"},this.configurationService)),this._signalEnabledState=new kI({getCacheKey:J1i},n=>Ce(r=>{let s=this._signalConfigValue.get(n.signal).read(r);return!!((n.modality==="sound"||n.modality===void 0)&&(n.signal.managesOwnEnablement||Pji(s.sound,()=>this.screenReaderAttached.read(r),n.userGesture))||(n.modality==="announcement"||n.modality===void 0)&&Pji(s.announcement,()=>this.screenReaderAttached.read(r),n.userGesture))}).recomputeInitiallyAndOnChange(this._store))}getEnabledState(e,t,o){return new pN(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=gn.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 CNo(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}};xye=I([m(0,B),m(1,Bi),m(2,Te)],xye);function Pji(a,i,e){return a==="on"||a==="always"||a==="auto"&&i()||a==="userGesture"&&e}async function CNo(a,i){let e=new P;try{return await xNo(a,i,e)}finally{e.dispose()}}function xNo(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 nd=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"})}},Wei=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 Wei("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(1785,null),sound:nd.error,announcementMessage:d(1752,null),settingsKey:"accessibility.signals.positionHasError",delaySettingsKey:"accessibility.signalOptions.delays.errorAtPosition"})}static{this.warningAtPosition=a.register({name:d(1786,null),sound:nd.warning,announcementMessage:d(1753,null),settingsKey:"accessibility.signals.positionHasWarning",delaySettingsKey:"accessibility.signalOptions.delays.warningAtPosition"})}static{this.errorOnLine=a.register({name:d(1776,null),sound:nd.error,legacySoundSettingsKey:"audioCues.lineHasError",legacyAnnouncementSettingsKey:"accessibility.alert.error",announcementMessage:d(1744,null),settingsKey:"accessibility.signals.lineHasError"})}static{this.warningOnLine=a.register({name:d(1779,null),sound:nd.warning,legacySoundSettingsKey:"audioCues.lineHasWarning",legacyAnnouncementSettingsKey:"accessibility.alert.warning",announcementMessage:d(1746,null),settingsKey:"accessibility.signals.lineHasWarning"})}static{this.foldedArea=a.register({name:d(1777,null),sound:nd.foldedArea,legacySoundSettingsKey:"audioCues.lineHasFoldedArea",legacyAnnouncementSettingsKey:"accessibility.alert.foldedArea",announcementMessage:d(1745,null),settingsKey:"accessibility.signals.lineHasFoldedArea"})}static{this.break=a.register({name:d(1775,null),sound:nd.break,legacySoundSettingsKey:"audioCues.lineHasBreakpoint",legacyAnnouncementSettingsKey:"accessibility.alert.breakpoint",announcementMessage:d(1743,null),settingsKey:"accessibility.signals.lineHasBreakpoint"})}static{this.inlineSuggestion=a.register({name:d(1778,null),sound:nd.quickFixes,legacySoundSettingsKey:"audioCues.lineHasInlineSuggestion",settingsKey:"accessibility.signals.lineHasInlineSuggestion"})}static{this.nextEditSuggestion=a.register({name:d(1780,null),sound:nd.nextEditSuggestion,legacySoundSettingsKey:"audioCues.nextEditSuggestion",settingsKey:"accessibility.signals.nextEditSuggestion",announcementMessage:d(1747,null)})}static{this.terminalQuickFix=a.register({name:d(1794,null),sound:nd.quickFixes,legacySoundSettingsKey:"audioCues.terminalQuickFix",legacyAnnouncementSettingsKey:"accessibility.alert.terminalQuickFix",announcementMessage:d(1761,null),settingsKey:"accessibility.signals.terminalQuickFix"})}static{this.onDebugBreak=a.register({name:d(1784,null),sound:nd.break,legacySoundSettingsKey:"audioCues.onDebugBreak",legacyAnnouncementSettingsKey:"accessibility.alert.onDebugBreak",announcementMessage:d(1751,null),settingsKey:"accessibility.signals.onDebugBreak"})}static{this.noInlayHints=a.register({name:d(1781,null),sound:nd.error,legacySoundSettingsKey:"audioCues.noInlayHints",legacyAnnouncementSettingsKey:"accessibility.alert.noInlayHints",announcementMessage:d(1748,null),settingsKey:"accessibility.signals.noInlayHints"})}static{this.taskCompleted=a.register({name:d(1789,null),sound:nd.taskCompleted,legacySoundSettingsKey:"audioCues.taskCompleted",legacyAnnouncementSettingsKey:"accessibility.alert.taskCompleted",announcementMessage:d(1756,null),settingsKey:"accessibility.signals.taskCompleted"})}static{this.taskFailed=a.register({name:d(1790,null),sound:nd.taskFailed,legacySoundSettingsKey:"audioCues.taskFailed",legacyAnnouncementSettingsKey:"accessibility.alert.taskFailed",announcementMessage:d(1757,null),settingsKey:"accessibility.signals.taskFailed"})}static{this.terminalCommandFailed=a.register({name:d(1792,null),sound:nd.error,legacySoundSettingsKey:"audioCues.terminalCommandFailed",legacyAnnouncementSettingsKey:"accessibility.alert.terminalCommandFailed",announcementMessage:d(1759,null),settingsKey:"accessibility.signals.terminalCommandFailed"})}static{this.terminalCommandSucceeded=a.register({name:d(1793,null),sound:nd.terminalCommandSucceeded,announcementMessage:d(1760,null),settingsKey:"accessibility.signals.terminalCommandSucceeded"})}static{this.terminalBell=a.register({name:d(1791,null),sound:nd.terminalBell,legacySoundSettingsKey:"audioCues.terminalBell",legacyAnnouncementSettingsKey:"accessibility.alert.terminalBell",announcementMessage:d(1758,null),settingsKey:"accessibility.signals.terminalBell"})}static{this.notebookCellCompleted=a.register({name:d(1782,null),sound:nd.taskCompleted,legacySoundSettingsKey:"audioCues.notebookCellCompleted",legacyAnnouncementSettingsKey:"accessibility.alert.notebookCellCompleted",announcementMessage:d(1749,null),settingsKey:"accessibility.signals.notebookCellCompleted"})}static{this.notebookCellFailed=a.register({name:d(1783,null),sound:nd.taskFailed,legacySoundSettingsKey:"audioCues.notebookCellFailed",legacyAnnouncementSettingsKey:"accessibility.alert.notebookCellFailed",announcementMessage:d(1750,null),settingsKey:"accessibility.signals.notebookCellFailed"})}static{this.diffLineInserted=a.register({name:d(1770,null),sound:nd.diffLineInserted,legacySoundSettingsKey:"audioCues.diffLineInserted",settingsKey:"accessibility.signals.diffLineInserted"})}static{this.diffLineDeleted=a.register({name:d(1769,null),sound:nd.diffLineDeleted,legacySoundSettingsKey:"audioCues.diffLineDeleted",settingsKey:"accessibility.signals.diffLineDeleted"})}static{this.diffLineModified=a.register({name:d(1771,null),sound:nd.diffLineModified,legacySoundSettingsKey:"audioCues.diffLineModified",settingsKey:"accessibility.signals.diffLineModified"})}static{this.chatEditModifiedFile=a.register({name:d(1762,null),sound:nd.chatEditModifiedFile,announcementMessage:d(1735,null),settingsKey:"accessibility.signals.chatEditModifiedFile"})}static{this.chatRequestSent=a.register({name:d(1763,null),sound:nd.requestSent,legacySoundSettingsKey:"audioCues.chatRequestSent",legacyAnnouncementSettingsKey:"accessibility.alert.chatRequestSent",announcementMessage:d(1736,null),settingsKey:"accessibility.signals.chatRequestSent"})}static{this.chatResponseReceived=a.register({name:d(1764,null),legacySoundSettingsKey:"audioCues.chatResponseReceived",sound:{randomOneOf:[nd.responseReceived1,nd.responseReceived2,nd.responseReceived3,nd.responseReceived4]},settingsKey:"accessibility.signals.chatResponseReceived"})}static{this.codeActionTriggered=a.register({name:d(1768,null),sound:nd.codeActionTriggered,legacySoundSettingsKey:"audioCues.codeActionRequestTriggered",legacyAnnouncementSettingsKey:"accessibility.alert.codeActionRequestTriggered",announcementMessage:d(1739,null),settingsKey:"accessibility.signals.codeActionTriggered"})}static{this.codeActionApplied=a.register({name:d(1767,null),legacySoundSettingsKey:"audioCues.codeActionApplied",sound:nd.codeActionApplied,settingsKey:"accessibility.signals.codeActionApplied"})}static{this.progress=a.register({name:d(1787,null),sound:nd.progress,legacySoundSettingsKey:"audioCues.chatResponsePending",legacyAnnouncementSettingsKey:"accessibility.alert.progress",announcementMessage:d(1754,null),settingsKey:"accessibility.signals.progress"})}static{this.clear=a.register({name:d(1766,null),sound:nd.clear,legacySoundSettingsKey:"audioCues.clear",legacyAnnouncementSettingsKey:"accessibility.alert.clear",announcementMessage:d(1738,null),settingsKey:"accessibility.signals.clear"})}static{this.save=a.register({name:d(1788,null),sound:nd.save,legacySoundSettingsKey:"audioCues.save",legacyAnnouncementSettingsKey:"accessibility.alert.save",announcementMessage:d(1755,null),settingsKey:"accessibility.signals.save"})}static{this.format=a.register({name:d(1774,null),sound:nd.format,legacySoundSettingsKey:"audioCues.format",legacyAnnouncementSettingsKey:"accessibility.alert.format",announcementMessage:d(1742,null),settingsKey:"accessibility.signals.format"})}static{this.voiceRecordingStarted=a.register({name:d(1795,null),sound:nd.voiceRecordingStarted,legacySoundSettingsKey:"audioCues.voiceRecordingStarted",settingsKey:"accessibility.signals.voiceRecordingStarted"})}static{this.voiceRecordingStopped=a.register({name:d(1796,null),sound:nd.voiceRecordingStopped,legacySoundSettingsKey:"audioCues.voiceRecordingStopped",settingsKey:"accessibility.signals.voiceRecordingStopped"})}static{this.editsKept=a.register({name:d(1772,null),sound:nd.editsKept,announcementMessage:d(1740,null),settingsKey:"accessibility.signals.editsKept"})}static{this.editsUndone=a.register({name:d(1773,null),sound:nd.editsUndone,announcementMessage:d(1741,null),settingsKey:"accessibility.signals.editsUndone"})}static{this.chatUserActionRequired=a.register({name:d(1765,null),sound:nd.chatUserActionRequired,announcementMessage:d(1737,null),settingsKey:"accessibility.signals.chatUserActionRequired"})}};var Bo=ae("progressService");var zbt=Object.freeze({total(){},worked(){},done(){}}),bm=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)}},kye=class extends C{constructor(e,t){super();this.deferred=new Go;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}};kye=I([m(1,Bo)],kye);var Eye=class extends C{constructor(e){super();this.progressIndicator=e;this.currentOperationId=0;this.currentOperationDisposables=this._register(new P);this.currentProgressTimeout=void 0}start(e){this.stop();let t=++this.currentOperationId,o=new $e;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()}},rd=ae("editorProgressService");var tC=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)}},jqe=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 kNo=()=>({get delay(){return-1},dispose:()=>{},showHover:()=>{}}),Kbt=kNo,ENo=new co(()=>Kbt("mouse",!1)),TNo=new co(()=>Kbt("element",!1));function Nji(a){Kbt=a}function Ni(a){return a==="element"?TNo.value:ENo.value}function Gg(){return Kbt("element",!0)}function n_(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=n_(t[1].trim(),i)),`var(${t[0]}, ${i})`}return a}return i}function Vei(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 Oji(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 Tye(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 WS(a){return`'${a.replaceAll(/'/g,"\\000027")}'`}function Na(a){return a?Hs`url('${CSS.escape(gn.uriToBrowserUri(a).toString(!0))}')`:"url('')"}function a1(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 Hs(a,...i){return a.reduce((e,t,o)=>{let n=i[o]||"";return e+t+n},"")}var o_=class{constructor(){this._parts=[]}push(...i){this._parts.push(...i)}join(i=`
`){return this._parts.join(i)}};var Gbt=class{constructor(i){this.spliceables=i}splice(i,e,t){this.spliceables.forEach(o=>o.splice(i,e,t))}};function Fji(a){let i=_No(a);if(i&&i.length>0)return new Uint32Array(i)}var yL=0,B9=new Uint32Array(10);function _No(a){if(yL=0,l1(a,Bei,4352),yL>0||(l1(a,Hei,4449),yL>0)||(l1(a,Uei,4520),yL>0)||(l1(a,uae,12593),yL))return B9.subarray(0,yL);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<Bei.length?l1(t,Bei,0):4352+t-12593<uae.length&&l1(4352+t,uae,12593),o<Hei.length?l1(o,Hei,0):4449+o-12593<uae.length&&l1(4449+o-12593,uae,12593),n>=0&&(n<Uei.length?l1(n,Uei,0):4520+n-12593<uae.length&&l1(4520+n-12593,uae,12593)),yL>0)return B9.subarray(0,yL)}}function l1(a,i,e){a>=e&&a<e+i.length&&DNo(i[a-e])}function DNo(a){a!==0&&(B9[yL++]=a&255,a>>8&&(B9[yL++]=a>>8&255),a>>16&&(B9[yL++]=a>>16&255))}var Bei=new Uint8Array([114,82,115,101,69,102,97,113,81,116,84,100,119,87,99,122,120,118,103]),Hei=new Uint16Array([107,111,105,79,106,112,117,80,104,27496,28520,27752,121,110,27246,28782,27758,98,109,27757,108]),Uei=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]),uae=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 edr=new il(1e4);var LNo=new il(1e4);function RNo(a){return PNo(a,"NFD",LNo)}var MNo=/[^\u0000-\u0080]/;function PNo(a,i,e){if(!a)return a;let t=e.get(a);if(t)return t;let o;return MNo.test(a)?o=a.normalize(i):o=a,e.set(a,o),o}var Qqe=(function(){let a=new il(1e4),i=/[\u0300-\u036f]/g;return function(e){let t=a.get(e);if(t)return t;let o=RNo(e).replace(i,""),n=(o.length===e.length?o:e).toLowerCase();return a.set(e,n),n}})();function GN(...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 sdr=Uji.bind(void 0,!1),pae=Uji.bind(void 0,!0);function Uji(a,i,e){if(!e||e.length<i.length)return null;let t;return a?t=Uk(e,i):t=e.indexOf(i)===0,t?i.length>0?[{start:0,end:i.length}]:[]:null}function SW(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 z9(a,i){if(a.length>i.length)return null;a=Qqe(a),i=Qqe(i);let e=i.indexOf(a);return e===-1?null:[{start:e,end:e+a.length}]}function Xqe(a,i){return a.length>i.length?null:Gei(a.toLowerCase(),i.toLowerCase(),0,0)}function Gei(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=Gei(a,i,e+1,t+1))?Xei({start:t,end:t+1},o):null}return Gei(a,i,e,t+1)}function Qei(a){return 97<=a&&a<=122}function _ye(a){return 65<=a&&a<=90}function Yei(a){return 48<=a&&a<=57}function zji(a){return a===32||a===9||a===10||a===13}var Kji=new Set;"()[]{}<>`'\"-/;:,.?!".split("").forEach(a=>Kji.add(a.charCodeAt(0)));function jbt(a){return zji(a)||Kji.has(a)}function Wji(a,i){return a===i||jbt(a)&&jbt(i)}var zei=new Map;function Vji(a){if(zei.has(a))return zei.get(a);let i,e=Fji(a);return e&&(i=e),zei.set(a,i),i}function Gji(a){return Qei(a)||_ye(a)||Yei(a)}function Xei(a,i){return i.length===0?i=[a]:a.end===i[0].start?i[0].start=a.start:i.unshift(a),i}function $ji(a,i){for(let e=i;e<a.length;e++){let t=a.charCodeAt(e);if(_ye(t)||Yei(t)||e>0&&!Gji(a.charCodeAt(e-1)))return e}return a.length}function $ei(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=$ei(a,i,e+1,t+1);!o&&(n=$ji(i,n))<i.length;)o=$ei(a,i,e+1,n),n++;return o===null?null:Xei({start:t,end:t+1},o)}}function ANo(a){let i=0,e=0,t=0,o=0,n=0;for(let u=0;u<a.length;u++)n=a.charCodeAt(u),_ye(n)&&i++,Qei(n)&&e++,Gji(n)&&t++,Yei(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 NNo(a){let{upperPercent:i,lowerPercent:e}=a;return e===0&&i>.6}function ONo(a){let{upperPercent:i,lowerPercent:e,alphaPercent:t,numericPercent:o}=a;return e>.2&&i<.8&&t>.6&&o<.2}function FNo(a){let i=0,e=0,t=0,o=0;for(let n=0;n<a.length;n++)t=a.charCodeAt(n),_ye(t)&&i++,Qei(t)&&e++,zji(t)&&o++;return(i===0||e===0)&&o===0?a.length<=30:i<=5}function K9(a,i){if(!i||(i=i.trim(),i.length===0)||!FNo(a))return null;i.length>60&&(i=i.substring(0,60));let e=ANo(i);if(!ONo(e)){if(!NNo(e))return null;i=i.toLowerCase()}let t=null,o=0;for(a=a.toLowerCase();o<i.length&&(t=$ei(a,i,0,o))===null;)o=$ji(i,o+1);return t}function Gy(a,i,e=!1){if(!i||i.length===0)return null;let t=null,o=0;for(a=Qqe(a),i=Qqe(i);o<i.length&&(t=qei(a,i,0,o,e),t===null);)o=qji(i,o+1);return t}function qei(a,i,e,t,o){let n=0;if(e===a.length)return[];if(t===i.length)return null;if(!Wji(a.charCodeAt(e),i.charCodeAt(t))){let l=Vji(a.charCodeAt(e));if(!l)return null;for(let c=0;c<l.length;c++)if(!Wji(l[c],i.charCodeAt(t+c)))return null;n+=l.length-1}let r=null,s=t+n+1;if(r=qei(a,i,e+1,s,o),!o)for(;!r&&(s=qji(i,s))<i.length;)r=qei(a,i,e+1,s,o),s++;if(!r)return null;if(a.charCodeAt(e)!==i.charCodeAt(t)){let l=Vji(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 Xei({start:t,end:t+n+1},r)}function qji(a,i){for(let e=i;e<a.length;e++)if(jbt(a.charCodeAt(e))||e>0&&jbt(a.charCodeAt(e-1)))return e;return a.length}var WNo=GN(pae,K9,SW),VNo=GN(pae,K9,Xqe),Bji=new il(1e4);function Up(a,i,e=!1){if(typeof a!="string"||typeof i!="string")return null;let t=Bji.get(a);t||(t=new RegExp(r1i(a),"i"),Bji.set(a,t));let o=t.exec(i);return o?[{start:o.index,end:o.index+o[0].length}]:e?VNo(a,i):WNo(a,i)}function Dye(a,i){let e=wL(a,a.toLowerCase(),0,i,i.toLowerCase(),0,{firstMatchCanBeWeak:!0,boostFullMatch:!0});return e?ua(e):null}function jji(a,i,e,t,o,n){let r=Math.min(13,a.length);for(;e<r;e++){let s=wL(a,i,e,t,o,n,{firstMatchCanBeWeak:!0,boostFullMatch:!0});if(s)return s}return[0,n]}function ua(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 U9=128;function Jei(){let a=[],i=[];for(let e=0;e<=U9;e++)i[e]=0;for(let e=0;e<=U9;e++)a.push(i.slice(0));return a}function Qji(a){let i=[];for(let e=0;e<=a;e++)i[e]=0;return i}var Yji=Qji(2*U9),jei=Qji(2*U9),c1=Jei(),H9=Jei(),Yqe=Jei(),BNo=!1;function Kei(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 HNo(a,i,e,t){a=a.substr(i),e=e.substr(t),console.log(Kei(H9,a,a.length,e,e.length)),console.log(Kei(Yqe,a,a.length,e,e.length)),console.log(Kei(c1,a,a.length,e,e.length))}function $bt(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!!mGe(e)}}function Hji(a,i){if(i<0||i>=a.length)return!1;switch(a.charCodeAt(i)){case 32:case 9:return!0;default:return!1}}function qbt(a,i,e){return i[a]!==e[a]}function Jqe(a,i,e,t,o,n,r=!1){for(;i<e&&o<n;)a[i]===t[o]&&(r&&(Yji[i]=o),i+=1),o+=1;return i===e}var uv;(e=>{e.Default=[-100,0];function i(t){return!t||t.length===2&&t[0]===-100&&t[1]===0}e.isDefault=i})(uv||={});var hq=class{constructor(i,e){this.firstMatchCanBeWeak=i;this.boostFullMatch=e}static{this.default={boostFullMatch:!0,firstMatchCanBeWeak:!1}}};function wL(a,i,e,t,o,n,r=hq.default){let s=a.length>U9?U9:a.length,l=t.length>U9?U9:t.length;if(e>=s||n>=l||s-e>l-n||!Jqe(i,e,s,o,n,l,!0))return;UNo(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=Yji[p],w=jei[p],k=p+1<s?jei[p+1]:l;for(u=y-n+1,h=y;h<k;u++,h++){let T=Number.MIN_SAFE_INTEGER,N=!1;h<=w&&(T=zNo(a,i,p,e,t,o,h,l,n,c1[c-1][u-1]===0,g));let O=0;T!==Number.MIN_SAFE_INTEGER&&(N=!0,O=T+H9[c-1][u-1]);let V=h>y,U=V?H9[c][u-1]+(c1[c][u-1]>0?-5:0):0,G=h>y+1&&c1[c][u-1]>0,$=G?H9[c][u-2]+(c1[c][u-2]>0?-5:0):0;if(G&&(!V||$>=U)&&(!N||$>=O))H9[c][u]=$,Yqe[c][u]=3,c1[c][u]=0;else if(V&&(!N||U>=O))H9[c][u]=U,Yqe[c][u]=2,c1[c][u]=0;else if(N)H9[c][u]=O,Yqe[c][u]=1,c1[c][u]=c1[c-1][u-1]+1;else throw new Error("not possible")}}if(BNo&&HNo(a,e,t,n),!g[0]&&!r.firstMatchCanBeWeak)return;c--,u--;let f=[H9[c][u],n],v=0,b=0;for(;c>=1;){let y=u;do{let w=Yqe[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]&&!qbt(y+n-1,t,o)&&v+1>c1[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 UNo(a,i,e,t,o,n){let r=a-1,s=i-1;for(;r>=e&&s>=t;)o[r]===n[s]&&(jei[r]=s,r--),s--}function zNo(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:qbt(r,o,n)&&(r===0||!qbt(r-1,o,n))?(p=a[e]===o[r]?7:5,h=!0):$bt(n,r)&&(r===0||!$bt(n,r-1))?p=5:($bt(n,r-1)||Hji(n,r-1))&&(p=5,h=!0),p>1&&e===t&&(u[0]=!0),h||(h=qbt(r,o,n)||$bt(n,r-1)||Hji(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 Qbt(a,i,e,t,o,n,r){return KNo(a,i,e,t,o,n,!0,r)}function KNo(a,i,e,t,o,n,r,s){let l=wL(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=GNo(a,u);if(p){let h=wL(p,p.toLowerCase(),e,t,o,n,s);h&&(h[0]-=3,(!l||h[0]>l[0])&&(l=h))}}}return l}function GNo(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 mae="notSelectable";var CL=class extends Error{constructor(i,e){super(`ListError [${i}] ${e}`)}},d1=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 qb;(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})(qb||={});function Xji(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=qb.intersect(a,t.range);qb.isEmpty(o)||e.push({range:o,size:t.size})}return e}function Xbt({start:a,end:i},e){return{start:a+e,end:i+e}}function $No(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 qNo(...a){return $No(a.reduce((i,e)=>i.concat(e),[]))}var Ybt=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=Xji({start:0,end:i},this.groups),r=Xji({start:i+e,end:Number.POSITIVE_INFINITY},this.groups).map(l=>({range:Xbt(l.range,o),size:l.size})),s=t.map((l,c)=>({range:{start:i+c,end:i+c+1},size:l.size}));this.groups=qNo(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 Jbt=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 $N(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 hae={CurrentDragAndDropData:void 0};var u1={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},$y=class{get context(){return this._context}set context(i){this._context=i}constructor(i){this.elements=i}update(){}getData(){return this.elements}},Zqe=class{constructor(i){this.elements=i}update(){}getData(){return this.elements}},p1=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 jNo(a,i){return Array.isArray(a)&&Array.isArray(i)?$i(a,i):a===i}var Zei=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=>{}}},xL=class xL{constructor(i,e,t,o=u1){this.virtualDelegate=e;this.domId=`list_id_${++xL.InstanceCount}`;this.renderers=new Map;this.renderWidth=0;this._scrollHeight=0;this.scrollableElementUpdateDisposable=null;this.scrollableElementWidthDelayer=new jo(50);this.splicing=!1;this.dragOverAnimationStopDisposable=C.None;this.dragOverMouseY=0;this.canDrop=!1;this.currentDragFeedbackDisposable=C.None;this.onDragLeaveTimeout=C.None;this.currentSelectionDisposable=C.None;this.disposables=new P;this._onDidChangeContentHeight=this.disposables.add(new E);this._onDidChangeContentWidth=this.disposables.add(new E);this.onDidChangeContentHeight=H.latch(this._onDidChangeContentHeight.event,void 0,this.disposables);this.onDidChangeContentWidth=H.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 Jbt(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??u1.horizontalScrolling,this.domNode.classList.toggle("horizontal-scrolling",this._horizontalScrolling),this.paddingBottom=typeof o.paddingBottom>"u"?0:o.paddingBottom,this.accessibilityProvider=new Zei(o.accessibilityProvider),this.rowsContainer=document.createElement("div"),this.rowsContainer.className="monaco-list-rows",(o.transformOptimization??u1.transformOptimization)&&(this.rowsContainer.style.transform="translate3d(0px, 0px, 0px)",this.rowsContainer.style.overflow="hidden",this.rowsContainer.style.contain="strict"),this.disposables.add(ws.addTarget(this.rowsContainer)),this.scrollable=this.disposables.add(new UT({forceIntegerValues:!0,smoothScrollDuration:o.smoothScrolling??!1?125:0,scheduleAtNextAnimationFrame:r=>$r(Me(this.domNode),r)})),this.scrollableElement=this.disposables.add(new AN(this.rowsContainer,{alwaysConsumeMouseWheel:o.alwaysConsumeMouseWheel??u1.alwaysConsumeMouseWheel,horizontal:1,vertical:o.verticalScrollMode??u1.verticalScrollMode,useShadows:o.useShadows??u1.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,Gn.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??u1.setRowLineHeight,this.setRowHeight=o.setRowHeight??u1.setRowHeight,this.supportDynamicHeights=o.supportDynamicHeights??u1.supportDynamicHeights,this.dnd=o.dnd??this.disposables.add(u1.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:D6(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=Pn();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 Ybt(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=qb.intersect(o,n),s=new Map;for(let T=r.end-1;T>=r.start;T--){let N=this.items[T];if(N.dragStartDisposable.dispose(),N.checkedDisposable.dispose(),N.row){let O=s.get(N.templateId);O||(O=[],s.set(N.templateId,O));let V=this.renderers.get(N.templateId);V&&V.disposeElement&&V.disposeElement(N.element,T,N.row.templateData,{height:N.size}),O.unshift(N.row)}N.row=null,N.stale=!0}let l={start:i+e,end:this.items.length},c=qb.intersect(l,o),u=qb.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:C.None,checkedDisposable:C.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=ure(this.items,i,e,p));let g=t.length-e,f=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),v=Xbt(c,g),b=qb.intersect(f,v);for(let T=b.start;T<b.end;T++)this.updateItemInDOM(this.items[T],T);let S=qb.relativeComplement(v,f);for(let T of S)for(let N=T.start;N<T.end;N++)this.removeItemFromDOM(N);let y=u.map(T=>Xbt(T,g)),k=[{start:i,end:i+t.length},...y].map(T=>qb.intersect(f,T)).reverse();for(let T of k)for(let N=T.end-1;N>=T.start;N--){let O=this.items[N],U=s.get(O.templateId)?.pop();this.insertItemInDOM(N,U)}for(let T of s.values())for(let N of T)this.cache.release(N);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=$r(Me(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:qbe(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:D6(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=qb.relativeComplement(l,i).reverse(),u=qb.relativeComplement(i,l);if(r){let p=qb.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=D6(i.row.domNode);let e=Me(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 H.map(this.disposables.add(new On(this.domNode,"click")).event,i=>this.toMouseEvent(i),this.disposables)}get onMouseDblClick(){return H.map(this.disposables.add(new On(this.domNode,"dblclick")).event,i=>this.toMouseEvent(i),this.disposables)}get onMouseMiddleClick(){return H.filter(H.map(this.disposables.add(new On(this.domNode,"auxclick")).event,i=>this.toMouseEvent(i),this.disposables),i=>i.browserEvent.button===1,this.disposables)}get onMouseUp(){return H.map(this.disposables.add(new On(this.domNode,"mouseup")).event,i=>this.toMouseEvent(i),this.disposables)}get onMouseDown(){return H.map(this.disposables.add(new On(this.domNode,"mousedown")).event,i=>this.toMouseEvent(i),this.disposables)}get onMouseOver(){return H.map(this.disposables.add(new On(this.domNode,"mouseover")).event,i=>this.toMouseEvent(i),this.disposables)}get onMouseMove(){return H.map(this.disposables.add(new On(this.domNode,"mousemove")).event,i=>this.toMouseEvent(i),this.disposables)}get onMouseOut(){return H.map(this.disposables.add(new On(this.domNode,"mouseout")).event,i=>this.toMouseEvent(i),this.disposables)}get onContextMenu(){return H.any(H.map(this.disposables.add(new On(this.domNode,"contextmenu")).event,i=>this.toMouseEvent(i),this.disposables),H.map(this.disposables.add(new On(this.domNode,Gn.Contextmenu)).event,i=>this.toGestureEvent(i),this.disposables))}get onTouchStart(){return H.map(this.disposables.add(new On(this.domNode,"touchstart")).event,i=>this.toTouchEvent(i),this.disposables)}get onTap(){return H.map(this.disposables.add(new On(this.rowsContainer,Gn.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(Aa.TEXT,e);let n;this.dnd.getDragLabel&&(n=this.dnd.getDragLabel(o,t)),typeof n>"u"&&(n=String(o.length)),$N(t,this.domNode,n,[this.domId]),this.domNode.classList.add("dragging"),this.currentDragData=new $y(o),hae.CurrentDragAndDropData=new Zqe(o),this.dnd.onDragStart?.(this.currentDragData,t)}onPotentialSelectionStart(i){this.currentSelectionDisposable.dispose();let e=Ore(this.domNode),t=this.currentSelectionDisposable=new P,o=t.add(new P);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(),hae.CurrentDragAndDropData&&hae.CurrentDragAndDropData.getData()==="vscode-ui"||(this.setupDragAndDropScrollTopAnimation(i.browserEvent),!i.browserEvent.dataTransfer))return!1;if(!this.currentDragData)if(hae.CurrentDragAndDropData)this.currentDragData=hae.CurrentDragAndDropData;else{if(!i.browserEvent.dataTransfer.types)return!1;this.currentDragData=new p1}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=Uo(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(jNo(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=nn(()=>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,hae.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,hae.CurrentDragAndDropData=void 0,this.dnd.onDragEnd?.(i)}clearDragOverFeedback(){this.currentDragFeedback=void 0,this.currentDragFeedbackPosition=void 0,this.currentDragFeedbackDisposable.dispose(),this.currentDragFeedbackDisposable=C.None}setupDragAndDropScrollTopAnimation(i){if(!this.dragOverAnimationDisposable){let e=gN(this.domNode).top;this.dragOverAnimationDisposable=Azi(Me(this.domNode),this.animateDragAndDropScrollTop.bind(this,e))}this.dragOverAnimationStopDisposable.dispose(),this.dragOverAnimationStopDisposable=nn(()=>{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 Kn(o,0,3)}getItemIndexFromEventTarget(i){let e=this.scrollableElement.getDomNode(),t=i;for(;(Ao(t)||s7t(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=qb.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=qb.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&&(gs(i.row.domNode,Me(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 ni("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([mi],xL.prototype,"onMouseClick",1),I([mi],xL.prototype,"onMouseDblClick",1),I([mi],xL.prototype,"onMouseMiddleClick",1),I([mi],xL.prototype,"onMouseUp",1),I([mi],xL.prototype,"onMouseDown",1),I([mi],xL.prototype,"onMouseOver",1),I([mi],xL.prototype,"onMouseMove",1),I([mi],xL.prototype,"onMouseOut",1),I([mi],xL.prototype,"onContextMenu",1),I([mi],xL.prototype,"onTouchStart",1),I([mi],xL.prototype,"onTap",1);var Lye=xL;var eti=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)}},Rye=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 eti(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(Zji),e)}_set(i,e,t){let o=this.indexes,n=this.sortedIndexes;this.indexes=i,this.sortedIndexes=e;let r=nti(n,i);return this.renderer.renderIndexes(r),this._onChange.fire({indexes:i,browserEvent:t}),o}get(){return this.indexes}contains(i){return cx(this.sortedIndexes,i,Zji)>=0}dispose(){Ue(this._onChange)}};I([mi],Rye.prototype,"renderer",1);var tti=class extends Rye{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"))}},ije=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 oje(a,i){return a.classList.contains(i)?!0:a.classList.contains("monaco-list")||!a.parentElement?!1:oje(a.parentElement,i)}function G9(a){return oje(a,"monaco-editor")}function e5i(a){return oje(a,"monaco-custom-toggle")}function t5i(a){return oje(a,"action-item")}function Mye(a){return oje(a,"monaco-tree-sticky-row")}function Pye(a){return a.classList.contains("monaco-tree-sticky-container")}function lti(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:lti(a.parentElement)}var Zbt=class{constructor(i,e,t){this.list=i;this.view=e;this.disposables=new P;this.multipleSelectionDisposables=new P;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&&(it?o.metaKey:o.ctrlKey)&&this.onCtrlA(o)}}))}get onKeyDown(){return H.chain(this.disposables.add(new On(this.view.domNode,"keydown")).event,i=>i.filter(e=>!Oh(e.target)).map(e=>new Ii(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([mi],Zbt.prototype,"onKeyDown",1);var cti=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}},iti=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 P;this.disposables=new P;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=H.chain(this.enabledDisposables.add(new On(this.view.domNode,"keydown")).event,n=>n.filter(r=>!Oh(r.target)).filter(()=>this.mode===0||this.triggered).map(r=>new Ii(r)).filter(r=>i||this.keyboardNavigationEventFilter(r)).filter(r=>this.delegate.mightProducePrintableCharacter(r)).forEach(r=>$t.stop(r,!0)).map(r=>r.browserEvent.key)),t=H.debounce(e,()=>null,800,void 0,void 0,void 0,this.enabledDisposables);H.reduce(H.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"?Jo(e):e&&Jo(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(pae(i,l)){this.previouslyFocused=t,this.list.setFocus([r]),this.list.reveal(r);return}let c=Dye(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"||pae(i,l)){this.previouslyFocused=t,this.list.setFocus([r]),this.list.reveal(r);return}}}dispose(){this.disable(),this.enabledDisposables.dispose(),this.disposables.dispose()}},oti=class{constructor(i,e){this.list=i;this.view=e;this.disposables=new P;let t=H.chain(this.disposables.add(new On(e.domNode,"keydown")).event,n=>n.filter(r=>!Oh(r.target)).map(r=>new Ii(r)));H.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||!Ao(o)||o.tabIndex===-1)return;let n=Me(o).getComputedStyle(o);n.visibility==="hidden"||n.display==="none"||(i.preventDefault(),i.stopPropagation(),o.focus())}dispose(){this.disposables.dispose()}};function dti(a){return it?a.browserEvent.metaKey:a.browserEvent.ctrlKey}function uti(a){return a.browserEvent.shiftKey}function QNo(a){return Vp(a)&&a.button===2}var Jji={isSelectionSingleChangeEvent:dti,isSelectionRangeChangeEvent:uti},gae=class{constructor(i){this.list=i;this.disposables=new P;this._onPointer=this.disposables.add(new E);i.options.multipleSelectionSupport!==!1&&(this.multipleSelectionController=this.list.options.multipleSelectionController||Jji),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(ws.addTarget(i.getHTMLElement()))),H.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||Jji))}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){G9(i.browserEvent.target)||Pn()!==i.browserEvent.target&&this.list.domFocus()}onContextMenu(i){if(Oh(i.browserEvent.target)||G9(i.browserEvent.target))return;let e=typeof i.index>"u"?[]:[i.index];this.list.setFocus(e,i.browserEvent)}onViewPointer(i){if(!this.mouseSupport||Oh(i.browserEvent.target)||G9(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),QNo(i.browserEvent)||this.list.getElementGroupId(e)!==mae&&this.list.setSelection([e],i.browserEvent),this._onPointer.fire(i)}onDoubleClick(i){if(Oh(i.browserEvent.target)||G9(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=XNo(nti(l,[t]),t);if(c.length===0)return;let u=nti(r,JNo(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===mae)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()}},fae=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=n_(i.listFocusAndSelectionOutline,n_(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=n_(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(`
`)}},eSt={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:Oe.fromHex("#a9a9a9").transparent(.4).toString(),tableColumnsBorder:Oe.fromHex("#cccccc").transparent(.2).toString(),tableOddRowsBackgroundColor:Oe.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},YNo={keyboardSupport:!0,mouseSupport:!0,multipleSelectionSupport:!0,dnd:{getDragURI(){return null},onDragStart(){},onDragOver(){return!1},drop(){},dispose(){}}};function XNo(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 nti(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 JNo(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 Zji=(a,i)=>a-i,rti=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++])}},sti=class{constructor(i){this.accessibilityProvider=i;this.templateId="a18n"}renderTemplate(i){return{container:i,disposables:new P}}renderElement(i,e,t){let o=this.accessibilityProvider.getAriaLabel(i),n=o&&typeof o!="string"?o:Oo(o);t.disposables.add(he(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()}},ati=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()}},hc=class{constructor(i,e,t,o,n=YNo){this.user=i;this._options=n;this.focus=new Rye("focused");this.anchor=new Rye("anchor");this.eventBufferer=new eN;this._ariaLabel="";this.disposables=new P;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 tti(r!=="listbox");let s=[this.focus.renderer,this.selection.renderer];this.accessibilityProvider=n.accessibilityProvider,this.accessibilityProvider&&(s.push(new sti(this.accessibilityProvider)),this.accessibilityProvider.onDidChangeActiveDescendant?.(this.onDidChangeActiveDescendant,this,this.disposables)),o=o.map(c=>new rti(c.templateId,[...s,c]));let l={...n,dnd:n.dnd&&new ati(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=hr(this.view.domNode);this.styleController=new fae(c,this.view.domId)}if(this.spliceable=new Gbt([new ije(this.focus,this.view,n.identityProvider),new ije(this.selection,this.view,n.identityProvider),new ije(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 oti(this,this.view)),(typeof n.keyboardSupport!="boolean"||n.keyboardSupport)&&(this.keyboardController=new Zbt(this,this.view,n),this.disposables.add(this.keyboardController)),n.keyboardNavigationLabelProvider){let c=n.keyboardNavigationDelegate||cti;this.typeNavigationController=new iti(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:Oo(c);this.disposables.add(he(p=>{this.ariaLabel=p.readObservable(u)}))}this._options.multipleSelectionSupport!==!1&&this.view.domNode.setAttribute("aria-multiselectable","true")}get onDidChangeFocus(){return H.map(this.eventBufferer.wrapEvent(this.focus.onChange),i=>this.toListEvent(i),this.disposables)}get onDidChangeSelection(){return H.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=H.chain(this.disposables.add(new On(this.view.domNode,"keydown")).event,n=>n.map(r=>new Ii(r)).filter(r=>i=r.keyCode===58||r.shiftKey&&r.keyCode===68).map(r=>$t.stop(r,!0)).filter(()=>!1)),t=H.chain(this.disposables.add(new On(this.view.domNode,"keyup")).event,n=>n.forEach(()=>i=!1).map(r=>new Ii(r)).filter(r=>r.keyCode===58||r.shiftKey&&r.keyCode===68).map(r=>$t.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=H.chain(this.view.onContextMenu,n=>n.filter(r=>!i).map(({element:r,index:s,browserEvent:l})=>({element:r,index:s,anchor:new yn(Me(this.view.domNode),l),browserEvent:l})));return H.any(e,t,o)}get onKeyDown(){return this.disposables.add(new On(this.view.domNode,"keydown")).event}get onKeyUp(){return this.disposables.add(new On(this.view.domNode,"keyup")).event}get onKeyPress(){return this.disposables.add(new On(this.view.domNode,"keypress")).event}get onDidFocus(){return H.signal(this.disposables.add(new On(this.view.domNode,"focus",!0)).event)}get onDidBlur(){return H.signal(this.disposables.add(new On(this.view.domNode,"blur",!0)).event)}createListView(i,e,t,o){return new Lye(i,e,t,o)}createMouseController(i){return new gae(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 CL(this.user,`Invalid start index: ${i}`);if(e<0)throw new CL(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 CL(this.user,`Invalid index ${t}`);i=i.filter(t=>this.getElementGroupId(t)!==mae),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 CL(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===mae?[]: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 CL(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 Pi(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 Pi(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 CL(this.user,`Invalid index ${i}`);let o=this.view.getScrollTop(),n=this.view.elementTop(i),r=this.view.elementHeight(i);if(Xo(e)){let s=r-this.view.renderHeight+t;this.view.setScrollTop(s*Kn(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 CL(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 sa(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([mi],hc.prototype,"onDidChangeFocus",1),I([mi],hc.prototype,"onDidChangeSelection",1),I([mi],hc.prototype,"onContextMenu",1),I([mi],hc.prototype,"onKeyDown",1),I([mi],hc.prototype,"onKeyUp",1),I([mi],hc.prototype,"onKeyPress",1),I([mi],hc.prototype,"onDidFocus",1),I([mi],hc.prototype,"onDidBlur",1);var ZNo="$(",mti=new RegExp(`\\$\\(${q.iconNameExpression}(?:${q.iconModifierExpression})?\\)`,"g"),eOo=new RegExp(`(\\\\)?${mti.source}`,"g");function i5i(a){return a.replace(eOo,(i,e)=>e?i:`\\${i}`)}var tOo=new RegExp(`\\\\${mti.source}`,"g");function o5i(a){return a.replace(tOo,i=>`\\${i}`)}var iOo=new RegExp(`(\\s)?(\\\\)?${mti.source}(\\s)?`,"g");function fu(a){return a.indexOf(ZNo)===-1?a:a.replace(iOo,(i,e,t,o)=>t?i:e||o||"")}function m1(a){return a?a.replace(/\$\((.*?)\)/g,(i,e)=>` ${e} `).trim():""}var pti=new RegExp(`\\$\\(${q.iconNameCharacter}+\\)`,"g");function IW(a){pti.lastIndex=0;let i="",e=[],t=0;for(;;){let o=pti.lastIndex,n=pti.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 gq(a,i,e=!1){let{text:t,iconOffsets:o}=i;if(!o||o.length===0)return Up(a,t,e);let n=Hw(t," "),r=t.length-n.length,s=Up(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 xe=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 Br("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+=BM(this.supportThemeIcons?i5i(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+=`
${oOo(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(Yr(e),"g");return i.replace(t,(o,n)=>i.charAt(n-1)!=="\\"?`\\${o}`:o)}};function yW(a){return Mr(a)?!a.value:Array.isArray(a)?a.every(yW):!0}function Mr(a){return a instanceof xe?!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 nje(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&&Xe(A.from(a.baseUri),A.from(i.baseUri)))}function BM(a){return a.replace(/[\\`*_{}[\]()#+\-!~]/g,"\\$&")}function oOo(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 rje(a){return a.replace(/"/g,"&quot;")}function tSt(a){return a&&a.replace(/\\([\\`*_{}[\]()#+\-.!~])/g,"$1")}function iSt(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 oSt(a,i,e,t=!0){return`[${t?BM(a):a}](${i}${e?` "${BM(e)}"`:""})`}function qy(a,i=!0){let e=ic(a.id,...a.arguments||[]).toString();return oSt(a.title,e,a.tooltip,i)}function ic(a,...i){return A.from({scheme:Y.command,path:a,query:i.length?encodeURIComponent(JSON.stringify(i)):void 0})}var vae=class{constructor(i){this._prefix=i,this._lastId=0}nextId(){return this._prefix+ ++this._lastId}},fq=new vae("id#");function gti(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Iae=gti();function c5i(a){Iae=a}var d5i=/[&<>"']/,rOo=new RegExp(d5i.source,"g"),u5i=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,sOo=new RegExp(u5i.source,"g"),aOo={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},n5i=a=>aOo[a];function HM(a,i){if(i){if(d5i.test(a))return a.replace(rOo,n5i)}else if(u5i.test(a))return a.replace(sOo,n5i);return a}var lOo=/(^|[^\[])\^/g;function Hh(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(lOo,"$1"),e=e.replace(o,r),t},getRegex:()=>new RegExp(e,i)};return t}function r5i(a){try{a=encodeURI(a).replace(/%25/g,"%")}catch{return null}return a}var lje={exec:()=>null};function s5i(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 sje(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 cOo(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 a5i(a,i,e,t){let o=i.href,n=i.title?HM(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:HM(r)}}function dOo(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 Nye=class{options;rules;lexer;constructor(i){this.options=i||Iae}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:sje(t,`
`)}}}fences(i){let e=this.rules.block.fences.exec(i);if(e){let t=e[0],o=dOo(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=sje(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:sje(e[0],`
`)}}blockquote(i){let e=this.rules.block.blockquote.exec(i);if(e){let t=sje(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=s5i(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(s5i(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:HM(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=sje(t.slice(0,-1),"\\");if((t.length-r.length)%2===0)return}else{let r=cOo(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)),a5i(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 a5i(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=HM(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=HM(e[1]),o="mailto:"+t):(t=HM(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=HM(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=HM(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=HM(e[0]),{type:"text",raw:e[0],text:t}}}},uOo=/^(?: *(?:\n|$))+/,pOo=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,mOo=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,dje=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,hOo=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,p5i=/(?:[*+-]|\d{1,9}[.)])/,m5i=Hh(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,p5i).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(),fti=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,gOo=/^[^\n]+/,vti=/(?!\s*\])(?:\\.|[^\[\]\\])+/,fOo=Hh(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",vti).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),vOo=Hh(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,p5i).getRegex(),sSt="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",bti=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,bOo=Hh("^ {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",bti).replace("tag",sSt).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),h5i=Hh(fti).replace("hr",dje).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",sSt).getRegex(),SOo=Hh(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",h5i).getRegex(),Sti={blockquote:SOo,code:pOo,def:fOo,fences:mOo,heading:hOo,hr:dje,html:bOo,lheading:m5i,list:vOo,newline:uOo,paragraph:h5i,table:lje,text:gOo},l5i=Hh("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",dje).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",sSt).getRegex(),IOo={...Sti,table:l5i,paragraph:Hh(fti).replace("hr",dje).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",l5i).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",sSt).getRegex()},yOo={...Sti,html:Hh(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",bti).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:lje,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Hh(fti).replace("hr",dje).replace("heading",` *#{1,6} *[^
]`).replace("lheading",m5i).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},g5i=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,wOo=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,f5i=/^( {2,}|\\)\n(?!\s*$)/,COo=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,uje="\\p{P}\\p{S}",xOo=Hh(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,uje).getRegex(),kOo=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,EOo=Hh(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,uje).getRegex(),TOo=Hh("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,uje).getRegex(),_Oo=Hh("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,uje).getRegex(),DOo=Hh(/\\([punct])/,"gu").replace(/punct/g,uje).getRegex(),LOo=Hh(/^<(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(),ROo=Hh(bti).replace("(?:-->|$)","-->").getRegex(),MOo=Hh("^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",ROo).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),rSt=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,POo=Hh(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",rSt).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),v5i=Hh(/^!?\[(label)\]\[(ref)\]/).replace("label",rSt).replace("ref",vti).getRegex(),b5i=Hh(/^!?\[(ref)\](?:\[\])?/).replace("ref",vti).getRegex(),AOo=Hh("reflink|nolink(?!\\()","g").replace("reflink",v5i).replace("nolink",b5i).getRegex(),Iti={_backpedal:lje,anyPunctuation:DOo,autolink:LOo,blockSkip:kOo,br:f5i,code:wOo,del:lje,emStrongLDelim:EOo,emStrongRDelimAst:TOo,emStrongRDelimUnd:_Oo,escape:g5i,link:POo,nolink:b5i,punctuation:xOo,reflink:v5i,reflinkSearch:AOo,tag:MOo,text:COo,url:lje},NOo={...Iti,link:Hh(/^!?\[(label)\]\((.*?)\)/).replace("label",rSt).getRegex(),reflink:Hh(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",rSt).getRegex()},hti={...Iti,escape:Hh(g5i).replace("])","~|])").getRegex(),url:Hh(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},OOo={...hti,br:Hh(f5i).replace("{2,}","*").getRegex(),text:Hh(hti.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},nSt={normal:Sti,gfm:IOo,pedantic:yOo},aje={normal:Iti,gfm:hti,breaks:OOo,pedantic:NOo},vq=class a{tokens;options;state;tokenizer;inlineQueue;constructor(i){this.tokens=[],this.tokens.links=Object.create(null),this.options=i||Iae,this.options.tokenizer=this.options.tokenizer||new Nye,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:nSt.normal,inline:aje.normal};this.options.pedantic?(e.block=nSt.pedantic,e.inline=aje.pedantic):this.options.gfm&&(e.block=nSt.gfm,this.options.breaks?e.inline=aje.breaks:e.inline=aje.gfm),this.tokenizer.rules=e}static get rules(){return{block:nSt,inline:aje}}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}},$9=class{options;parser;constructor(i){this.options=i||Iae}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-'+HM(o)+'">'+(t?n:HM(n,!0))+`</code></pre>
`:"<pre><code>"+(t?n:HM(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=r5i(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=r5i(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}},cje=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""}},bq=class a{options;renderer;textRenderer;constructor(i){this.options=i||Iae,this.options.renderer=this.options.renderer||new $9,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new cje}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}},Aye=class{options;constructor(i){this.options=i||Iae}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(i){return i}postprocess(i){return i}processAllTokens(i){return i}},bae=class{defaults=gti();options=this.setOptions;parse=this.parseMarkdown(vq.lex,bq.parse);parseInline=this.parseMarkdown(vq.lexInline,bq.parseInline);Parser=bq;Renderer=$9;TextRenderer=cje;Lexer=vq;Tokenizer=Nye;Hooks=Aye;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 $9(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 Nye(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 Aye;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];Aye.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 vq.lex(i,e??this.defaults)}parser(i,e){return bq.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>"+HM(t.message+"",!0)+"</pre>";return e?Promise.resolve(o):o}if(e)return Promise.reject(t);throw t}}},Sae=new bae;function Yc(a,i){return Sae.parse(a,i)}Yc.options=Yc.setOptions=function(a){return Sae.setOptions(a),Yc.defaults=Sae.defaults,c5i(Yc.defaults),Yc};Yc.getDefaults=gti;Yc.defaults=Iae;Yc.use=function(...a){return Sae.use(...a),Yc.defaults=Sae.defaults,c5i(Yc.defaults),Yc};Yc.walkTokens=function(a,i){return Sae.walkTokens(a,i)};Yc.parseInline=Sae.parseInline;Yc.Parser=bq;Yc.parser=bq.parse;Yc.Renderer=$9;Yc.TextRenderer=cje;Yc.Lexer=vq;Yc.lexer=vq.lex;Yc.Tokenizer=Nye;Yc.Hooks=Aye;Yc.parse=Yc;var bpr=Yc.options,Spr=Yc.setOptions,Ipr=Yc.use,S5i=Yc.walkTokens,ypr=Yc.parseInline,I5i=Yc,wpr=bq.parse,q9=vq.lex;var{entries:D5i,setPrototypeOf:y5i,isFrozen:FOo,getPrototypeOf:WOo,getOwnPropertyDescriptor:VOo}=Object,{freeze:s_,seal:qN,create:L5i}=Object,{apply:Tti,construct:_ti}=typeof Reflect<"u"&&Reflect;s_||(s_=function(i){return i});qN||(qN=function(i){return i});Tti||(Tti=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)});_ti||(_ti=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 aSt=a_(Array.prototype.forEach),BOo=a_(Array.prototype.lastIndexOf),w5i=a_(Array.prototype.pop),mje=a_(Array.prototype.push),HOo=a_(Array.prototype.splice),cSt=a_(String.prototype.toLowerCase),yti=a_(String.prototype.toString),wti=a_(String.prototype.match),hje=a_(String.prototype.replace),UOo=a_(String.prototype.indexOf),zOo=a_(String.prototype.trim),wW=a_(Object.prototype.hasOwnProperty),r_=a_(RegExp.prototype.test),gje=KOo(TypeError);function a_(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 Tti(a,i,t)}}function KOo(a){return function(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return _ti(a,e)}}function Zd(a,i){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:cSt;y5i&&y5i(a,null);let t=i.length;for(;t--;){let o=i[t];if(typeof o=="string"){let n=e(o);n!==o&&(FOo(i)||(i[t]=n),o=n)}a[o]=!0}return a}function GOo(a){for(let i=0;i<a.length;i++)wW(a,i)||(a[i]=null);return a}function Sq(a){let i=L5i(null);for(let[e,t]of D5i(a))wW(a,e)&&(Array.isArray(t)?i[e]=GOo(t):t&&typeof t=="object"&&t.constructor===Object?i[e]=Sq(t):i[e]=t);return i}function fje(a,i){for(;a!==null;){let t=VOo(a,i);if(t){if(t.get)return a_(t.get);if(typeof t.value=="function")return a_(t.value)}a=WOo(a)}function e(){return null}return e}var C5i=s_(["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"]),Cti=s_(["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"]),xti=s_(["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"]),$Oo=s_(["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"]),kti=s_(["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"]),qOo=s_(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),x5i=s_(["#text"]),k5i=s_(["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"]),Eti=s_(["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"]),E5i=s_(["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"]),lSt=s_(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),jOo=qN(/\{\{[\w\W]*|[\w\W]*\}\}/gm),QOo=qN(/<%[\w\W]*|[\w\W]*%>/gm),YOo=qN(/\$\{[\w\W]*/gm),XOo=qN(/^data-[\-\w.\u00B7-\uFFFF]+$/),JOo=qN(/^aria-[\-\w]+$/),R5i=qN(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ZOo=qN(/^(?:\w+script|data):/i),eFo=qN(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),M5i=qN(/^html$/i),tFo=qN(/^[a-z][.\w]*(-[.\w]+)+$/i),T5i=Object.freeze({__proto__:null,ARIA_ATTR:JOo,ATTR_WHITESPACE:eFo,CUSTOM_ELEMENT:tFo,DATA_ATTR:XOo,DOCTYPE_NAME:M5i,ERB_EXPR:QOo,IS_ALLOWED_URI:R5i,IS_SCRIPT_OR_DATA:ZOo,MUSTACHE_EXPR:jOo,TMPLIT_EXPR:YOo}),vje={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},iFo=function(){return typeof window>"u"?null:window},oFo=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}},_5i=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function P5i(){let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:iFo(),i=Ia=>P5i(Ia);if(i.version="3.2.7",i.removed=[],!a||!a.document||a.document.nodeType!==vje.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=fje(f,"cloneNode"),b=fje(f,"remove"),S=fje(f,"nextSibling"),y=fje(f,"childNodes"),w=fje(f,"parentNode");if(typeof r=="function"){let Ia=e.createElement("template");Ia.content&&Ia.content.ownerDocument&&(e=Ia.content.ownerDocument)}let k,T="",{implementation:N,createNodeIterator:O,createDocumentFragment:V,getElementsByTagName:U}=e,{importNode:G}=t,$=_5i();i.isSupported=typeof D5i=="function"&&typeof w=="function"&&N&&N.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:te,ERB_EXPR:pe,TMPLIT_EXPR:de,DATA_ATTR:se,ARIA_ATTR:Se,IS_SCRIPT_OR_DATA:ke,ATTR_WHITESPACE:Ee,CUSTOM_ELEMENT:He}=T5i,{IS_ALLOWED_URI:Ve}=T5i,Fe=null,Qt=Zd({},[...C5i,...Cti,...xti,...kti,...x5i]),Ze=null,Ti=Zd({},[...k5i,...Eti,...E5i,...lSt]),ti=Object.seal(L5i(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}})),bo=null,Ro=null,_o=!0,sr=!0,ln=!1,en=!0,Ws=!1,ba=!0,Id=!1,Dg=!1,yd=!1,uu=!1,Jm=!1,Dh=!1,Rp=!0,Uv=!1,Cr="user-content-",sx=!0,Lg=!1,Nw={},gp=null,uf=Zd({},["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"]),KG=null,e6=Zd({},["audio","video","img","source","image","track"]),ax=null,II=Zd({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ut="http://www.w3.org/1998/Math/MathML",_i="http://www.w3.org/2000/svg",eo="http://www.w3.org/1999/xhtml",Ar=eo,na=!1,Rg=null,wo=Zd({},[Ut,_i,eo],yti),tn=Zd({},["mi","mo","mn","ms","mtext"]),Pt=Zd({},["annotation-xml"]),Ke=Zd({},["title","style","font","a","script"]),ye=null,Be=["application/xhtml+xml","text/html"],Tt="text/html",Ht=null,Do=null,io=e.createElement("form"),xr=function(hi){return hi instanceof RegExp||hi instanceof Function},oo=function(){let hi=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Do&&Do===hi)){if((!hi||typeof hi!="object")&&(hi={}),hi=Sq(hi),ye=Be.indexOf(hi.PARSER_MEDIA_TYPE)===-1?Tt:hi.PARSER_MEDIA_TYPE,Ht=ye==="application/xhtml+xml"?yti:cSt,Fe=wW(hi,"ALLOWED_TAGS")?Zd({},hi.ALLOWED_TAGS,Ht):Qt,Ze=wW(hi,"ALLOWED_ATTR")?Zd({},hi.ALLOWED_ATTR,Ht):Ti,Rg=wW(hi,"ALLOWED_NAMESPACES")?Zd({},hi.ALLOWED_NAMESPACES,yti):wo,ax=wW(hi,"ADD_URI_SAFE_ATTR")?Zd(Sq(II),hi.ADD_URI_SAFE_ATTR,Ht):II,KG=wW(hi,"ADD_DATA_URI_TAGS")?Zd(Sq(e6),hi.ADD_DATA_URI_TAGS,Ht):e6,gp=wW(hi,"FORBID_CONTENTS")?Zd({},hi.FORBID_CONTENTS,Ht):uf,bo=wW(hi,"FORBID_TAGS")?Zd({},hi.FORBID_TAGS,Ht):Sq({}),Ro=wW(hi,"FORBID_ATTR")?Zd({},hi.FORBID_ATTR,Ht):Sq({}),Nw=wW(hi,"USE_PROFILES")?hi.USE_PROFILES:!1,_o=hi.ALLOW_ARIA_ATTR!==!1,sr=hi.ALLOW_DATA_ATTR!==!1,ln=hi.ALLOW_UNKNOWN_PROTOCOLS||!1,en=hi.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ws=hi.SAFE_FOR_TEMPLATES||!1,ba=hi.SAFE_FOR_XML!==!1,Id=hi.WHOLE_DOCUMENT||!1,uu=hi.RETURN_DOM||!1,Jm=hi.RETURN_DOM_FRAGMENT||!1,Dh=hi.RETURN_TRUSTED_TYPE||!1,yd=hi.FORCE_BODY||!1,Rp=hi.SANITIZE_DOM!==!1,Uv=hi.SANITIZE_NAMED_PROPS||!1,sx=hi.KEEP_CONTENT!==!1,Lg=hi.IN_PLACE||!1,Ve=hi.ALLOWED_URI_REGEXP||R5i,Ar=hi.NAMESPACE||eo,tn=hi.MATHML_TEXT_INTEGRATION_POINTS||tn,Pt=hi.HTML_INTEGRATION_POINTS||Pt,ti=hi.CUSTOM_ELEMENT_HANDLING||{},hi.CUSTOM_ELEMENT_HANDLING&&xr(hi.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ti.tagNameCheck=hi.CUSTOM_ELEMENT_HANDLING.tagNameCheck),hi.CUSTOM_ELEMENT_HANDLING&&xr(hi.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ti.attributeNameCheck=hi.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),hi.CUSTOM_ELEMENT_HANDLING&&typeof hi.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ti.allowCustomizedBuiltInElements=hi.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ws&&(sr=!1),Jm&&(uu=!0),Nw&&(Fe=Zd({},x5i),Ze=[],Nw.html===!0&&(Zd(Fe,C5i),Zd(Ze,k5i)),Nw.svg===!0&&(Zd(Fe,Cti),Zd(Ze,Eti),Zd(Ze,lSt)),Nw.svgFilters===!0&&(Zd(Fe,xti),Zd(Ze,Eti),Zd(Ze,lSt)),Nw.mathMl===!0&&(Zd(Fe,kti),Zd(Ze,E5i),Zd(Ze,lSt))),hi.ADD_TAGS&&(Fe===Qt&&(Fe=Sq(Fe)),Zd(Fe,hi.ADD_TAGS,Ht)),hi.ADD_ATTR&&(Ze===Ti&&(Ze=Sq(Ze)),Zd(Ze,hi.ADD_ATTR,Ht)),hi.ADD_URI_SAFE_ATTR&&Zd(ax,hi.ADD_URI_SAFE_ATTR,Ht),hi.FORBID_CONTENTS&&(gp===uf&&(gp=Sq(gp)),Zd(gp,hi.FORBID_CONTENTS,Ht)),sx&&(Fe["#text"]=!0),Id&&Zd(Fe,["html","head","body"]),Fe.table&&(Zd(Fe,["tbody"]),delete bo.tbody),hi.TRUSTED_TYPES_POLICY){if(typeof hi.TRUSTED_TYPES_POLICY.createHTML!="function")throw gje('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof hi.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw gje('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');k=hi.TRUSTED_TYPES_POLICY,T=k.createHTML("")}else k===void 0&&(k=oFo(g,o)),k!==null&&typeof T=="string"&&(T=k.createHTML(""));s_&&s_(hi),Do=hi}},Gr=Zd({},[...Cti,...xti,...$Oo]),Sa=Zd({},[...kti,...qOo]),_r=function(hi){let zn=w(hi);(!zn||!zn.tagName)&&(zn={namespaceURI:Ar,tagName:"template"});let Ks=cSt(hi.tagName),Jf=cSt(zn.tagName);return Rg[hi.namespaceURI]?hi.namespaceURI===_i?zn.namespaceURI===eo?Ks==="svg":zn.namespaceURI===Ut?Ks==="svg"&&(Jf==="annotation-xml"||tn[Jf]):!!Gr[Ks]:hi.namespaceURI===Ut?zn.namespaceURI===eo?Ks==="math":zn.namespaceURI===_i?Ks==="math"&&Pt[Jf]:!!Sa[Ks]:hi.namespaceURI===eo?zn.namespaceURI===_i&&!Pt[Jf]||zn.namespaceURI===Ut&&!tn[Jf]?!1:!Sa[Ks]&&(Ke[Ks]||!Gr[Ks]):!!(ye==="application/xhtml+xml"&&Rg[hi.namespaceURI]):!1},sl=function(hi){mje(i.removed,{element:hi});try{w(hi).removeChild(hi)}catch{b(hi)}},Dd=function(hi,zn){try{mje(i.removed,{attribute:zn.getAttributeNode(hi),from:zn})}catch{mje(i.removed,{attribute:null,from:zn})}if(zn.removeAttribute(hi),hi==="is")if(uu||Jm)try{sl(zn)}catch{}else try{zn.setAttribute(hi,"")}catch{}},Ow=function(hi){let zn=null,Ks=null;if(yd)hi="<remove></remove>"+hi;else{let yI=wti(hi,/^[\r\n\t ]+/);Ks=yI&&yI[0]}ye==="application/xhtml+xml"&&Ar===eo&&(hi='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+hi+"</body></html>");let Jf=k?k.createHTML(hi):hi;if(Ar===eo)try{zn=new h().parseFromString(Jf,ye)}catch{}if(!zn||!zn.documentElement){zn=N.createDocument(Ar,"template",null);try{zn.documentElement.innerHTML=na?T:Jf}catch{}}let Vk=zn.body||zn.documentElement;return hi&&Ks&&Vk.insertBefore(e.createTextNode(Ks),Vk.childNodes[0]||null),Ar===eo?U.call(zn,Id?"html":"body")[0]:Id?zn.documentElement:Vk},sre=function(hi){return O.call(hi.ownerDocument||hi,hi,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},GG=function(hi){return hi instanceof p&&(typeof hi.nodeName!="string"||typeof hi.textContent!="string"||typeof hi.removeChild!="function"||!(hi.attributes instanceof u)||typeof hi.removeAttribute!="function"||typeof hi.setAttribute!="function"||typeof hi.namespaceURI!="string"||typeof hi.insertBefore!="function"||typeof hi.hasChildNodes!="function")},KHi=function(hi){return typeof s=="function"&&hi instanceof s};function $G(Ia,hi,zn){aSt(Ia,Ks=>{Ks.call(i,hi,zn,Do)})}let GHi=function(hi){let zn=null;if($G($.beforeSanitizeElements,hi,null),GG(hi))return sl(hi),!0;let Ks=Ht(hi.nodeName);if($G($.uponSanitizeElement,hi,{tagName:Ks,allowedTags:Fe}),ba&&hi.hasChildNodes()&&!KHi(hi.firstElementChild)&&r_(/<[/\w!]/g,hi.innerHTML)&&r_(/<[/\w!]/g,hi.textContent)||hi.nodeType===vje.progressingInstruction||ba&&hi.nodeType===vje.comment&&r_(/<[/\w]/g,hi.data))return sl(hi),!0;if(!Fe[Ks]||bo[Ks]){if(!bo[Ks]&&qHi(Ks)&&(ti.tagNameCheck instanceof RegExp&&r_(ti.tagNameCheck,Ks)||ti.tagNameCheck instanceof Function&&ti.tagNameCheck(Ks)))return!1;if(sx&&!gp[Ks]){let Jf=w(hi)||hi.parentNode,Vk=y(hi)||hi.childNodes;if(Vk&&Jf){let yI=Vk.length;for(let BD=yI-1;BD>=0;--BD){let qG=v(Vk[BD],!0);qG.__removalCount=(hi.__removalCount||0)+1,Jf.insertBefore(qG,S(hi))}}}return sl(hi),!0}return hi instanceof l&&!_r(hi)||(Ks==="noscript"||Ks==="noembed"||Ks==="noframes")&&r_(/<\/no(script|embed|frames)/i,hi.innerHTML)?(sl(hi),!0):(Ws&&hi.nodeType===vje.text&&(zn=hi.textContent,aSt([te,pe,de],Jf=>{zn=hje(zn,Jf," ")}),hi.textContent!==zn&&(mje(i.removed,{element:hi.cloneNode()}),hi.textContent=zn)),$G($.afterSanitizeElements,hi,null),!1)},$Hi=function(hi,zn,Ks){if(Rp&&(zn==="id"||zn==="name")&&(Ks in e||Ks in io))return!1;if(!(sr&&!Ro[zn]&&r_(se,zn))){if(!(_o&&r_(Se,zn))){if(!Ze[zn]||Ro[zn]){if(!(qHi(hi)&&(ti.tagNameCheck instanceof RegExp&&r_(ti.tagNameCheck,hi)||ti.tagNameCheck instanceof Function&&ti.tagNameCheck(hi))&&(ti.attributeNameCheck instanceof RegExp&&r_(ti.attributeNameCheck,zn)||ti.attributeNameCheck instanceof Function&&ti.attributeNameCheck(zn,hi))||zn==="is"&&ti.allowCustomizedBuiltInElements&&(ti.tagNameCheck instanceof RegExp&&r_(ti.tagNameCheck,Ks)||ti.tagNameCheck instanceof Function&&ti.tagNameCheck(Ks))))return!1}else if(!ax[zn]){if(!r_(Ve,hje(Ks,Ee,""))){if(!((zn==="src"||zn==="xlink:href"||zn==="href")&&hi!=="script"&&UOo(Ks,"data:")===0&&KG[hi])){if(!(ln&&!r_(ke,hje(Ks,Ee,"")))){if(Ks)return!1}}}}}}return!0},qHi=function(hi){return hi!=="annotation-xml"&&wti(hi,He)},jHi=function(hi){$G($.beforeSanitizeAttributes,hi,null);let{attributes:zn}=hi;if(!zn||GG(hi))return;let Ks={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ze,forceKeepAttr:void 0},Jf=zn.length;for(;Jf--;){let Vk=zn[Jf],{name:yI,namespaceURI:BD,value:qG}=Vk,Qve=Ht(yI),L6t=qG,lx=yI==="value"?L6t:zOo(L6t);if(Ks.attrName=Qve,Ks.attrValue=lx,Ks.keepAttr=!0,Ks.forceKeepAttr=void 0,$G($.uponSanitizeAttribute,hi,Ks),lx=Ks.attrValue,Uv&&(Qve==="id"||Qve==="name")&&(Dd(yI,hi),lx=Cr+lx),ba&&r_(/((--!?|])>)|<\/(style|title|textarea)/i,lx)){Dd(yI,hi);continue}if(Qve==="attributename"&&wti(lx,"href")){Dd(yI,hi);continue}if(Ks.forceKeepAttr)continue;if(!Ks.keepAttr){Dd(yI,hi);continue}if(!en&&r_(/\/>/i,lx)){Dd(yI,hi);continue}Ws&&aSt([te,pe,de],YHi=>{lx=hje(lx,YHi," ")});let QHi=Ht(hi.nodeName);if(!$Hi(QHi,Qve,lx)){Dd(yI,hi);continue}if(k&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!BD)switch(g.getAttributeType(QHi,Qve)){case"TrustedHTML":{lx=k.createHTML(lx);break}case"TrustedScriptURL":{lx=k.createScriptURL(lx);break}}if(lx!==L6t)try{BD?hi.setAttributeNS(BD,yI,lx):hi.setAttribute(yI,lx),GG(hi)?sl(hi):w5i(i.removed)}catch{Dd(yI,hi)}}$G($.afterSanitizeAttributes,hi,null)},ADo=function Ia(hi){let zn=null,Ks=sre(hi);for($G($.beforeSanitizeShadowDOM,hi,null);zn=Ks.nextNode();)$G($.uponSanitizeShadowNode,zn,null),GHi(zn),jHi(zn),zn.content instanceof n&&Ia(zn.content);$G($.afterSanitizeShadowDOM,hi,null)};return i.sanitize=function(Ia){let hi=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},zn=null,Ks=null,Jf=null,Vk=null;if(na=!Ia,na&&(Ia="<!-->"),typeof Ia!="string"&&!KHi(Ia))if(typeof Ia.toString=="function"){if(Ia=Ia.toString(),typeof Ia!="string")throw gje("dirty is not a string, aborting")}else throw gje("toString is not a function");if(!i.isSupported)return Ia;if(Dg||oo(hi),i.removed=[],typeof Ia=="string"&&(Lg=!1),Lg){if(Ia.nodeName){let qG=Ht(Ia.nodeName);if(!Fe[qG]||bo[qG])throw gje("root node is forbidden and cannot be sanitized in-place")}}else if(Ia instanceof s)zn=Ow("<!---->"),Ks=zn.ownerDocument.importNode(Ia,!0),Ks.nodeType===vje.element&&Ks.nodeName==="BODY"||Ks.nodeName==="HTML"?zn=Ks:zn.appendChild(Ks);else{if(!uu&&!Ws&&!Id&&Ia.indexOf("<")===-1)return k&&Dh?k.createHTML(Ia):Ia;if(zn=Ow(Ia),!zn)return uu?null:Dh?T:""}zn&&yd&&sl(zn.firstChild);let yI=sre(Lg?Ia:zn);for(;Jf=yI.nextNode();)GHi(Jf),jHi(Jf),Jf.content instanceof n&&ADo(Jf.content);if(Lg)return Ia;if(uu){if(Jm)for(Vk=V.call(zn.ownerDocument);zn.firstChild;)Vk.appendChild(zn.firstChild);else Vk=zn;return(Ze.shadowroot||Ze.shadowrootmode)&&(Vk=G.call(t,Vk,!0)),Vk}let BD=Id?zn.outerHTML:zn.innerHTML;return Id&&Fe["!doctype"]&&zn.ownerDocument&&zn.ownerDocument.doctype&&zn.ownerDocument.doctype.name&&r_(M5i,zn.ownerDocument.doctype.name)&&(BD="<!DOCTYPE "+zn.ownerDocument.doctype.name+`>
`+BD),Ws&&aSt([te,pe,de],qG=>{BD=hje(BD,qG," ")}),k&&Dh?k.createHTML(BD):BD},i.setConfig=function(){let Ia=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};oo(Ia),Dg=!0},i.clearConfig=function(){Do=null,Dg=!1},i.isValidAttribute=function(Ia,hi,zn){Do||oo({});let Ks=Ht(Ia),Jf=Ht(hi);return $Hi(Ks,Jf,zn)},i.addHook=function(Ia,hi){typeof hi=="function"&&mje($[Ia],hi)},i.removeHook=function(Ia,hi){if(hi!==void 0){let zn=BOo($[Ia],hi);return zn===-1?void 0:HOo($[Ia],zn,1)[0]}return w5i($[Ia])},i.removeHooks=function(Ia){$[Ia]=[]},i.removeAllHooks=function(){$=_5i()},i}var yae=P5i();var Lti=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"]),N5i=Object.freeze(["href","target","src","alt","title","for","name","role","tabindex","x-dispatch","required","checked","placeholder","type","start","width","height","align"]),Dti="vscode-relative-path";function A5i(a,i){if(i.override==="*")return!0;try{let e=new URL(a,Dti+"://");return!!(i.override.includes(e.protocol.replace(/:$/,""))||i.allowRelativePaths&&e.protocol===Dti+":"&&!a.trim().toLowerCase().startsWith(Dti))}catch{return!1}}function nFo(a,i){yae.addHook("afterSanitizeAttributes",e=>{for(let t of["href","src"])if(e.hasAttribute(t)){let o=e.getAttribute(t);t==="href"?!o.startsWith("#")&&!A5i(o,a)&&e.removeAttribute(t):A5i(o,i)||e.removeAttribute(t)}})}var rFo=Object.freeze({ALLOWED_TAGS:[...Lti],ALLOWED_ATTR:[...N5i],ALLOW_UNKNOWN_PROTOCOLS:!0});function dSt(a,i){return O5i(a,i,"trusted")}function O5i(a,i,e){try{let t={...rFo};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=[...N5i];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),nFo({override:i?.allowedLinkProtocols?.override??[Y.http,Y.https],allowRelativePaths:i?.allowRelativeLinkPaths??!1},{override:i?.allowedMediaProtocols?.override??[Y.http,Y.https],allowRelativePaths:i?.allowRelativeMediaPaths??!1}),i?.replaceWithPlaintext&&yae.addHook("uponSanitizeElement",aFo),r.size&&yae.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"?yae.sanitize(a,{...t,RETURN_DOM_FRAGMENT:!0}):yae.sanitize(a,{...t,RETURN_TRUSTED_TYPE:!0})}finally{yae.removeAllHooks()}}var sFo=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],aFo=(a,i,e)=>{if(!i.allowedTags[i.tagName]&&i.tagName!=="body"){let t=Rti(a);t&&(a.nodeType===Node.COMMENT_NODE?a.parentElement?.insertBefore(t,a):a.parentElement?.replaceChild(t,a))}};function Rti(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=sFo.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 Iq(a,i,e){let t=O5i(i,e,"dom");Fi(a,t)}var lFo=new RegExp(`(\\\\)?\\$\\((${q.iconNameExpression}(?:${q.iconModifierExpression})?)\\)`,"g");function Bn(a){let i=new Array,e,t=0,o=0;for(;(e=lFo.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})`:Qo({id:r}))}return t<a.length&&i.push(a.substring(t)),i}function Qo(a){let i=_("span");return i.classList.add(...q.asClassNameArray(a)),i}var Mti=Object.freeze({image:({href:a,title:i,text:e})=>{let t=[],o=[];return a&&({href:a,dimensions:t}=iSt(a),o.push(`src="${rje(a)}"`)),e&&o.push(`alt="${rje(e)}"`),i&&o.push(`title="${rje(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=tSt(t)),i=typeof i=="string"?rje(tSt(i)):"",a=tSt(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 cFo(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=Qo({id:l[p]}).outerHTML,g=this.parser.parse(e);return`<blockquote data-severity="${p}"><p><span>${h}${u}</span>${g.substring(3)}</blockquote>
`}}function nb(a,i={},e){let t=new P,o=!1,n=new bae(...i.markedExtensions??[]),{renderer:r,codeBlocks:s,syncCodeBlocks:l}=uFo(n,i,a),c=pFo(a),u;if(i.fillInIncompleteTokens){let f={...n.defaults,...i.markedOptions,renderer:r},v=n.lexer(c,f),b=xFo(v);u=n.parser(b,f)}else u=n.parse(c,{...i?.markedOptions,renderer:r,async:!1});a.supportThemeIcons&&(u=Bn(u).map(v=>typeof v=="string"?v:v.outerHTML).join(""));let p=document.createElement("div"),h=H5i(a,i.sanitizerConfig??{});Iq(p,u,h),dFo(a,i,p);let g;if(e?(g=e,Fi(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&&Fi(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&&Fi(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 yn(Me(g),v);!b.leftButton&&!b.middleButton||W5i(a,i,b)};t.add(j(g,"click",f)),t.add(j(g,"auxclick",f)),t.add(j(g,"keydown",v=>{let b=new Ii(v);!b.equals(10)&&!b.equals(3)||W5i(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=Rti(f);v?f.parentElement?.replaceChild(v,f):f.remove()}else f.remove();return{element:g,dispose:()=>{o=!0,t.dispose()}}}function dFo(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=Pti(A.from(a.baseUri),n))}catch{}if(t.setAttribute("src",V5i(a,n,!0)),i.sanitizerConfig?.remoteImageIsAllowed){let r=A.parse(n);r.scheme!==Y.file&&r.scheme!==Y.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=V5i(a,o,!1);a.baseUri&&(n=Pti(A.from(a.baseUri),o)),t.dataset.href=n}}}function uFo(a,i,e){let t=new a.Renderer(i.markedOptions);t.image=Mti.image,t.link=Mti.link,t.paragraph=Mti.paragraph,e.supportAlertSyntax&&(t.blockquote=cFo(t.blockquote));let o=[],n=[];return i.codeBlockRendererSync?t.code=({text:r,lang:s,raw:l})=>{let c=fq.nextId(),u=i.codeBlockRendererSync(B5i(s),r,l);return n.push([c,u]),`<div class="code" data-code="${c}">${ur(r)}</div>`}:i.codeBlockRenderer&&(t.code=({text:r,lang:s})=>{let l=fq.nextId(),c=i.codeBlockRenderer(B5i(s),r);return o.push(c.then(u=>[l,u])),`<div class="code" data-code="${l}">${ur(r)}</div>`}),e.supportHtml||(t.html=({text:r})=>i.sanitizerConfig?.replaceWithPlaintext?ur(r):(e.isTrusted?r.match(/^(<span[^>]+>)|(<\/\s*span>)$/):void 0)?r:""),{renderer:t,codeBlocks:o,syncCodeBlocks:n}}function pFo(a){let i=a.value;return i.length>1e5&&(i=`${i.substr(0,1e5)}\u2026`),a.supportThemeIcons&&(i=o5i(i)),i}function W5i(a,i,e){let t=e.target.closest("a[data-href]");if(Ao(t))try{let o=t.dataset.href;o&&(a.baseUri&&(o=Pti(A.from(a.baseUri),o)),i.actionHandler?.(o,a))}catch(o){mt(o)}finally{e.preventDefault(),e.stopPropagation()}}function mFo(a,i){let e;try{e=zg(decodeURIComponent(i))}catch{}return e?(e=Gk(e,t=>{if(a.uris&&a.uris[t])return A.revive(a.uris[t])}),encodeURIComponent(JSON.stringify(e))):i}function V5i(a,i,e){let t=a.uris&&a.uris[i],o=A.revive(t);return e?i.startsWith(Y.data+":")?i:(o||(o=A.parse(i)),gn.uriToBrowserUri(o).toString(!0)):!o||A.parse(i).toString()===o.toString()?i:(o.query&&(o=o.with({query:mFo(a,o.query)})),o.toString())}function B5i(a){if(!a)return"";let i=a.split(/[\s+|:|,|\{|\?]/,1);return i.length?i[0]:a}function Pti(a,i){return/^\w[\w\d+.-]*:/.test(i)?i:a.path.endsWith("/")?m9t(a,i).toString():m9t(ci(a),i).toString()}function hFo(a,i,e={}){let t=H5i(i,e);return dSt(a,t)}var Ati=Object.freeze([...Lti,"input"]),Sje=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 H5i(a,i){let e=a.isTrusted??!1,t=[Y.http,Y.https,Y.mailto,Y.file,Y.vscodeFileResource,Y.vscodeRemote,Y.vscodeRemoteResource,Y.vscodeNotebookCell,Y.internal];return e&&t.push(Y.command),i.allowedLinkSchemes?.augment&&t.push(...i.allowedLinkSchemes.augment),{allowedTags:{override:i.allowedTags?.override??Ati},allowedAttributes:{override:i.allowedAttributes?.override??Sje},allowedLinkProtocols:{override:t},allowRelativeLinkPaths:!!a.baseUri,allowedMediaProtocols:{override:[Y.http,Y.https,Y.data,Y.file,Y.vscodeFileResource,Y.vscodeRemote,Y.vscodeRemoteResource]},allowRelativeMediaPaths:!!a.baseUri,replaceWithPlaintext:i.replaceWithPlaintext}}function qa(a,i){if(typeof a=="string")return a;let e=a.value??"";e.length>1e5&&(e=`${e.substr(0,1e5)}\u2026`);let t=fFo();i?.includeCodeBlocksFences&&(t.code=vFo),i?.useLinkFormatter&&(t.link=bFo);let o=I5i(e,{async:!1,renderer:t});return hFo(o,{isTrusted:!1},{}).toString().replace(/&(#\d+|[a-zA-Z]+);/g,n=>gFo.get(n)??n).trim()}var gFo=new Map([["&quot;",'"'],["&nbsp;"," "],["&amp;","&"],["&#39;","'"],["&lt;","<"],["&gt;",">"]]);function fFo(){let a=new $9;return a.code=({text:i})=>ur(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})=>ur(i),a.br=i=>`
`,a.del=({text:i})=>i,a.image=i=>"",a.text=({text:i})=>i,a.link=({text:i})=>i,a}var vFo=({text:a})=>`
\`\`\`
${ur(a)}
\`\`\`
`,bFo=({text:a,href:i})=>{try{if(i){let e=A.parse(i);return a.trim()||Ye(e)}}catch{return a.trim()||No(i)}return a};function bje(a){let i="";return a.forEach(e=>{i+=e.raw}),i}function U5i(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 EFo(a);if(o.includes("**"))return MFo(a);if(o.match(/\*\w/))return TFo(a);if(o.match(/(^|\s)__\w/))return PFo(a);if(o.match(/(^|\s)_\w/))return _Fo(a);if(SFo(o)||IFo(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(/^[^"]* +"[^"]*$/)?LFo(a):DFo(a)}else if(o.match(/(^|\s)\[\w*[^\]]*$/))return RFo(a)}}}function SFo(a){return!!a.match(/(^|\s)\[.*\]\(\w*/)}function IFo(a){return!!a.match(/^[^\[]*\]\([^\)]*$/)}function yFo(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=U5i(e);else if(t(a)){let c=q9(a.raw.trim()+" &nbsp;")[0];return c.type!=="list"?void 0:c}if(!o||o.type!=="paragraph")return;let n=bje(a.items.slice(0,-1)),r=i.raw.match(/^(\s*(-|\d+\.|\*) +)/)?.[0];if(!r)return;let s=r+bje(i.tokens.slice(0,-1))+o.raw,l=q9(n+s)[0];if(l.type==="list")return l}function wFo(a,i){if(a.raw.match(/-\s*$/))return q9(i+" &nbsp;")}var CFo=3;function xFo(a){for(let i=0;i<CFo;i++){let e=kFo(a);if(e)a=e;else break}return a}function kFo(a){let i,e;for(i=0;i<a.length;i++){let o=a[i];if(o.type==="paragraph"&&o.raw.match(/(\n|^)\|/)){e=AFo(a.slice(i));break}}let t=a.at(-1);if(!e&&t?.type==="list"){let o=yFo(t);o&&(e=[o],i=a.length-1)}if(!e&&t?.type==="paragraph"){let o=U5i(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=wFo(t,bje(a));if(o)return o}return null}function EFo(a){return j9(a,"`")}function TFo(a){return j9(a,"*")}function _Fo(a){return j9(a,"_")}function DFo(a){return j9(a,")",!1)}function LFo(a){return j9(a,'")',!1)}function RFo(a){return j9(a,"](https://microsoft.com)",!1)}function MFo(a){return j9(a,"**")}function PFo(a){return j9(a,"__")}function j9(a,i,e=!0){let t=bje(Array.isArray(a)?a:[a]),o=e?t.trimEnd():t;return q9(o+i)[0]}function AFo(a){let i=bje(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 q9(s)}}function wae(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 uSt(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=wae(a.height,i.height,p);s=g.position+a.top,g.result==="flipped"&&(n=n===0?1:0),qb.intersects({start:s,end:s+i.height},{start:p.offset,end:p.offset+p.size})&&(h.mode=0);let f=wae(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=wae(a.width,i.width,p);l=g.position,g.result==="flipped"&&(o=o===0?1:0),qb.intersects({start:l,end:l+i.width},{start:p.offset,end:p.offset+p.size})&&(h.mode=0);let f=wae(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 Nti(a){let i=a;return!!i&&typeof i.x=="number"&&typeof i.y=="number"}function yje(a){if(Ao(a)){let i=Yn(a),e=_6(a);return{top:i.top*e,left:i.left*e,width:i.width*e,height:i.height*e}}else return Nti(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 Oye=class a extends C{constructor(e,t){super();this.container=null;this.useFixedPosition=!1;this.useShadowDOM=!1;this.delegate=null;this.toDisposeOnClean=C.None;this.toDisposeOnSetContainer=C.None;this.shadowRoot=null;this.shadowRootHostElement=null;this.view=_(".context-view"),xo(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=OFo,this.shadowRoot.appendChild(r),this.shadowRoot.appendChild(this.view),this.shadowRoot.appendChild(_("slot"))}else this.container.appendChild(this.view);let n=new P;a.BUBBLE_UP_EVENTS.forEach(r=>{n.add(Vo(this.container,r,s=>{this.onDOMEvent(s,!1)}))}),a.BUBBLE_DOWN_EVENTS.forEach(r=>{n.add(Vo(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",bn(this.view),this.toDisposeOnClean=e.render(this.view)||C.None,this.delegate=e,this.doLayout(),this.delegate.focus?.()}getViewElement(){return this.view}layout(){if(this.isVisible()){if(this.delegate.canRelayout===!1&&!(Nc&&og.pointerEvents)){this.hide();return}this.delegate?.layout?.(),this.doLayout()}}doLayout(){if(!this.isVisible())return;let e=yje(this.delegate.getAnchor()),t=Ki(),o={top:t.pageYOffset,left:t.pageXOffset,width:t.innerWidth,height:t.innerHeight},n={width:yl(this.view),height:nh(this.view)},r=this.delegate.anchorPosition,s=this.delegate.anchorAlignment,l=this.delegate.anchorAxisAlignment,{top:c,left:u}=uSt(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=Yn(this.container),h=this.container.scrollTop||0,g=this.container.scrollLeft||0;this.view.style.top=`${c-(this.useFixedPosition?Yn(this.view).top:p.top)+h}px`,this.view.style.left=`${u-(this.useFixedPosition?Yn(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(),xo(this.view)}isVisible(){return!!this.delegate}onDOMEvent(e,t){this.delegate&&(this.delegate.onDOMEvent?this.delegate.onDOMEvent(e,Me(e).document.activeElement):t&&!gs(e.target,this.container)&&this.hide())}dispose(){this.hide(),super.dispose()}},OFo=`
	: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 z5i={showInstantHover:()=>{},showDelayedHover:()=>{},setupDelayedHover:()=>C.None,setupDelayedHoverAtMouse:()=>C.None,hideHover:()=>{},showAndFocusLastHover:()=>{},setupManagedHover:()=>({dispose:()=>{},show:()=>{},hide:()=>{},update:()=>{}}),showManagedHover:()=>{}};function K5i(a){z5i=a}function yp(){return z5i}var Cae=_,G5i="selectOption.entry.template",Oti=class{get templateId(){return G5i}renderTemplate(i){let e=Object.create(null);return e.root=i,e.text=R(i,Cae(".option-text")),e.detail=R(i,Cae(".option-detail")),e.decoratorRight=R(i,Cae(".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){}},pSt=class a extends C{constructor(e,t,o,n,r){super();this.options=[];this._currentSelection=0;this._hasDetails=!1;this._selectionDetailsDisposables=this._register(new P);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(yp().setupManagedHover(Ni("mouse"),this.selectElement,e)):this._hover&&this._hover.update(e)}getHeight(){return 22}getTemplateId(){return G5i}constructSelectDropDown(e){this.contextViewProvider=e,this.selectDropDownContainer=_(".monaco-select-box-dropdown-container"),this.selectionDetailsPane=R(this.selectDropDownContainer,Cae(".select-box-details-pane"));let t=R(this.selectDropDownContainer,Cae(".select-box-dropdown-container-width-control")),o=R(t,Cae(".width-control-div"));this.widthControlElement=document.createElement("span"),this.widthControlElement.className="option-text-width-control",R(o,this.widthControlElement),this._dropDownPosition=0,this.styleElement=hr(this.selectDropDownContainer),this.selectDropDownContainer.setAttribute("draggable","true"),this._register(j(this.selectDropDownContainer,re.DRAG_START,n=>{$t.stop(n,!0)}))}registerListeners(){this._register(Vo(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=>{$t.stop(t),this._isVisible?this.hideSelectDropDown(!0):this.showSelectDropDown()})),this._register(j(this.selectElement,re.MOUSE_DOWN,t=>{$t.stop(t)}));let e;this._register(j(this.selectElement,"touchstart",t=>{e=this._isVisible})),this._register(j(this.selectElement,"touchend",t=>{$t.stop(t),e?this.hideSelectDropDown(!0):this.showSelectDropDown()})),this._register(j(this.selectElement,re.KEY_DOWN,t=>{let o=new Ii(t),n=!1;it?(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(),$t.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=n_(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=Me(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=Me(this.selectElement),o=Yn(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=yl(e)}return t}createSelectList(e){if(this.selectList)return;this.selectDropDownListContainer=R(e,Cae(".select-box-dropdown-list-container")),this.listRenderer=new Oti,this.selectList=this._register(new hc("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:()=>it?"":"option",getWidgetRole:()=>"listbox"}})),this.selectBoxOptions.ariaLabel&&(this.selectList.ariaLabel=this.selectBoxOptions.ariaLabel);let t=this._register(new On(this.selectDropDownListContainer,"keydown")),o=H.chain(t.event,n=>n.filter(()=>this.selectList.length>0).map(r=>new Ii(r)));this._register(H.chain(o,n=>n.filter(r=>r.keyCode===3))(this.onEnter,this)),this._register(H.chain(o,n=>n.filter(r=>r.keyCode===2))(this.onEnter,this)),this._register(H.chain(o,n=>n.filter(r=>r.keyCode===9))(this.onEscape,this)),this._register(H.chain(o,n=>n.filter(r=>r.keyCode===16))(this.onUpArrow,this)),this._register(H.chain(o,n=>n.filter(r=>r.keyCode===18))(this.onDownArrow,this)),this._register(H.chain(o,n=>n.filter(r=>r.keyCode===12))(this.onPageDown,this)),this._register(H.chain(o,n=>n.filter(r=>r.keyCode===11))(this.onPageUp,this)),this._register(H.chain(o,n=>n.filter(r=>r.keyCode===14))(this.onHome,this)),this._register(H.chain(o,n=>n.filter(r=>r.keyCode===13))(this.onEnd,this)),this._register(H.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||gs(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;$t.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=nb({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){$t.stop(e),this.select(this._currentSelection),this.hideSelectDropDown(!0)}onEnter(e){if($t.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){$t.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){$t.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){$t.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){$t.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($t.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($t.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=vp.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]),$t.stop(e);break}}dispose(){this.hideSelectDropDown(!1),super.dispose()}};var mSt=class extends C{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(ws.addTarget(this.selectElement)),[Gn.Tap].forEach(e=>{this._register(j(this.selectElement,e,t=>{this.selectElement.focus()}))}),this._register(Vo(this.selectElement,"click",e=>{$t.stop(e,!0)})),this._register(Vo(this.selectElement,"change",e=>{this.selectElement.title=e.target.value,this._onDidSelect.fire({index:e.target.selectedIndex,selected:e.target.value})})),this._register(Vo(this.selectElement,"keydown",e=>{let t=!1;it?(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 jN=Object.freeze({text:"\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500",isDisabled:!0,isSeparator:!0}),qmr={...eSt,selectBackground:"#3C3C3C",selectForeground:"#F0F0F0",selectBorder:"#3C3C3C",decoratorRightForeground:void 0,selectListBackground:void 0,selectListBorder:void 0,focusBorder:void 0},aE=class extends Ma{constructor(i,e,t,o,n){super(),it&&!n?.useCustomDrawn?this.selectBoxDelegate=new mSt(i,e,o,n):this.selectBoxDelegate=new pSt(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 oc=class extends C{constructor(e,t,o={}){super();this.options=o;this._context=e||this,this._action=t,t instanceof st&&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 as)),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(ws.addTarget(e));let o=this.options&&this.options.draggable;o&&(e.draggable=!0,yc&&this._register(j(e,re.DRAG_START,n=>n.dataTransfer?.setData(Aa.TEXT,this._action.label)))),this._register(j(t,Gn.Tap,n=>this.onClick(n,!0))),this._register(j(t,re.MOUSE_DOWN,n=>{o||$t.stop(n,!0),this._action.enabled&&n.button===0&&t.classList.add("active")})),it&&this._register(j(t,re.CONTEXT_MENU,n=>{n.button===0&&n.ctrlKey===!0&&this.onClick(n)})),this._register(j(t,re.CLICK,n=>{$t.stop(n,!0),this.options&&this.options.isMenu||this.onClick(n)})),this._register(j(t,re.DBLCLICK,n=>{$t.stop(n,!0)})),[re.MOUSE_UP,re.MOUSE_OUT].forEach(n=>{this._register(j(t,n,r=>{$t.stop(r),t.classList.remove("active")}))})}onClick(e,t=!1){$t.stop(e,!0);let o=Jn(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??Ni("element");this.customHover=this._store.add(yp().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()}},Lr=class extends oc{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),So(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===li.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===li.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())))}},h1=class extends oc{constructor(i,e,t,o,n,r,s){super(i,e),this.selectBox=new aE(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 ji=class extends C{constructor(e,t={}){super();this._actionRunnerDisposables=this._register(new P);this.viewItemDisposables=this._register(new jt);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(Gg()),this.options.actionRunner?this._actionRunner=this.options.actionRunner:(this._actionRunner=new as,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 Ii(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 oc&&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 Ii(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(Vn(this.domNode)),this._register(this.focusTracker.onDidBlur(()=>{(Pn()===this.domNode||!gs(Pn(),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 oc&&o.isEnabled());t instanceof oc&&t.setFocusable(!0)}else this.viewItems.forEach(t=>{t instanceof oc&&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(gs(Pn(),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(Ao(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=Xo(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 Lr(this.context,r,c)),this.options.allowContextMenu||this.viewItemDisposables.set(l,j(s,re.CONTEXT_MENU,u=>{$t.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 oc))continue;let l;r||s.action.id===li.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]),Ue(this.viewItems.splice(e,1)),this.refreshRole())}clear(){this.isEmpty()||(this.viewItems=Ue(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?gs(Pn(),this.domNode):gs(Pn(),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===li.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===li.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;HD(n.focus)||(r=!1),this.options.focusOnlyEnabledItems&&HD(n.isEnabled)&&!n.isEnabled()&&(r=!1),n.action.id===li.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 oc){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=Ue(this.viewItems),this.getContainer().remove(),super.dispose()}};function yq(a){if(!a.length)return a;let i=-1;for(let t=0;t<a.length;t++)if(a[t].id!==li.ID){i=t;break}if(i===-1)return[];a=a.slice(i);for(let t=a.length-1;t>=0&&a[t].id===li.ID;t--)a.splice(t,1);let e=!1;for(let t=a.length-1;t>=0;t--){let o=a[t].id===li.ID;o&&!e?a.splice(t,1):o?o&&(e=!1):e=!0}return a}function $5i(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 Wye(a,i){let e=new P,t=a.createDecorationsCollection();return e.add(XD({debugName:()=>`Apply decorations from ${i.debugName}`},o=>{let n=i.read(o);t.set(n)})),e.add({dispose:()=>{t.clear()}}),e}function wq(a,i){return a.appendChild(i),Z(()=>{i.remove()})}function q5i(a,i){return a.prepend(i),Z(()=>{i.remove()})}var Fye=class extends C{constructor(e,t){super();this._automaticLayout=!1;this.elementSizeObserver=this._register(new t9(e,t)),this._width=Le(this,this.elementSizeObserver.getWidth()),this._height=Le(this,this.elementSizeObserver.getHeight()),this._register(this.elementSizeObserver.onDidChange(o=>Ui(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 Vti(a,i,e){let t=i.get(),o=t,n=t,r=Le("animatedValue",t),s=-1,l=300,c;e.add(xM({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(FFo(p,o,t-o,l)),p<l?c=a.requestAnimationFrame(u):n=t,r.set(n,void 0)}return r}function FFo(a,i,e,t){return a===t?i+e:e*(-Math.pow(2,-10*a/t)+1)+i}var xae=class extends C{constructor(i,e,t){super(),this._register(new Fti(i,t)),this._register(UM(t,{height:e.actualHeight,top:e.actualTop}))}},g1=class{constructor(i,e){this._afterLineNumber=i;this.heightInPx=e;this.domNode=document.createElement("div"),this._actualTop=Le(this,void 0),this._actualHeight=Le(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()}},Fti=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 UM(a,i){return he(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 Vye(a,i,e,t){let o=new P,n=[];return o.add(Ga((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(xM({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 hSt=class extends $e{dispose(){super.dispose(!0)}};function Bti(a,i){let e=ju(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 Ie(o,a.column))}if(!e.innerChanges)return z.fromPositions(new Ie(e.modified.startLineNumber,1));let t=ju(e.innerChanges,o=>o.originalRange.getStartPosition().isBeforeOrEqual(a));if(!t){let o=a.lineNumber-e.original.startLineNumber+e.modified.startLineNumber;return z.fromPositions(new Ie(o,a.column))}if(t.originalRange.containsPosition(a))return t.modifiedRange;{let o=WFo(t.originalRange.getEndPosition(),a);return z.fromPositions(o.addToPosition(t.modifiedRange.getEndPosition()))}}function WFo(a,i){return a.lineNumber===i.lineNumber?new Zl(0,i.column-a.column):new Zl(i.lineNumber-a.lineNumber,i.column-1)}function j5i(a,i){let e;return a.filter(t=>{let o=i(t,e);return e=t,o})}var CW=class{static create(i,e=void 0){return new wje(i,i,e)}static createWithDisposable(i,e,t=void 0){let o=new P;return o.add(e),o.add(i),new wje(i,o,t)}static createOfNonDisposable(i,e,t=void 0){return new wje(i,e,t)}},wje=class extends CW{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 Wti(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)}}},Wti=class extends CW{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 Uti={IconContribution:"base.contributions.icons"},VFo;(i=>{function a(e,t){let o=e.defaults;for(;q.isThemeIcon(o);){let n=kae.getIcon(o.id);if(!n)return;o=n.defaults}return o}i.getDefinition=a})(VFo||={});var gSt;(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=>Ae(n)?n:void 0;if(t&&Array.isArray(t.src)&&t.src.every(n=>Ae(n.format)&&Ae(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})(gSt||={});var Q9=/^([\w_-]+)$/,Bye=/^(normal|italic|(oblique[ \w\s-]+))$/,Hye=/^(normal|bold|lighter|bolder|(\d{0-1000}))$/,Cje=/^([\w_.%+-]+)$/,Y5i=/^woff|woff2|truetype|opentype|embedded-opentype|svg$/,fSt=/^#[0-9a-fA-F]{0,6}$/,Uye=d(2598,null),Hti=class extends C{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(2595,null),pattern:Q9.source,patternErrorMessage:Uye},fontCharacter:{type:"string",description:d(2594,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(`
`)}},kae=new Hti;oe.add(Uti.IconContribution,kae);function Re(a,i,e,t){return kae.registerIcon(a,i,e,t)}function jy(){return kae}function BFo(){let a=amt();for(let i in a){let e="\\"+a[i].toString(16);kae.registerIcon(i,{fontCharacter:e})}}BFo();var vSt="vscode://schemas/icons",X5i=oe.as(ea.JSONContribution);X5i.registerSchema(vSt,kae.getIconSchema());var Q5i=new Dt(()=>X5i.notifySchemaChanged(vSt),200);kae.onDidChange(()=>{Q5i.isScheduled()||Q5i.schedule()});var lE=Re("widget-close",M.close,d(2599,null)),J5i=Re("goto-previous-location",M.arrowUp,d(2597,null)),Z5i=Re("goto-next-location",M.arrowDown,d(2596,null)),xje=q.modify(M.sync,"spin"),cE=q.modify(M.loading,"spin");var HFo=Re("diff-review-insert",M.add,d(209,null)),UFo=Re("diff-review-remove",M.remove,d(210,null)),zFo=Re("diff-review-close",M.close,d(208,null)),QN=class extends C{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=Ce(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(Eje,this._diffs,this._models,this._setVisible,this._canClose)),n=e.store.add(this._instantiationService.createInstance(Tje,this._parentNode,o,this._width,this._height,this._models));return{model:o,view:n}}).recomputeInitiallyAndOnChange(this._store)}static{this._ttPolicy=Kg("diffReview",{createHTML:e=>e})}next(){Ui(e=>{let t=this._visible.get();this._setVisible(!0,e),t&&this._state.get().model.nextGroup(e)})}prev(){Ui(e=>{this._setVisible(!0,e),this._state.get().model.previousGroup(e)})}close(){Ui(e=>{this._setVisible(!1,e)})}};QN=I([m(8,F)],QN);var Eje=class extends C{constructor(e,t,o,n,r){super();this._diffs=e;this._models=t;this._setVisible=o;this.canClose=n;this._accessibilitySignalService=r;this._groups=Le(this,[]);this._currentGroupIdx=Le(this,0);this._currentElementIdx=Le(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(he(s=>{let l=this._diffs.read(s);if(!l){this._groups.set([],void 0);return}let c=KFo(l,this._models.getOriginalModel().getLineCount(),this._models.getModifiedModel().getLineCount());Ui(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(he(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(he(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 Ie(c,1)))}}))}_goToGroupDelta(e,t){let o=this.groups.get();!o||o.length<=1||dN(t,n=>{this._currentGroupIdx.set(di.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||Ui(o=>{this._currentElementIdx.set(di.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&&Ui(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 Ie(e.originalLineNumber,1))):this._models.modifiedReveal(e.type!==0?z.fromPositions(new Ie(e.modifiedLineNumber,1)):void 0))}close(){this.canClose.get()&&(this._setVisible(!1,void 0),this._models.modifiedFocus())}};Eje=I([m(4,tr)],Eje);var kje=3;function KFo(a,i,e){let t=[];for(let o of s6(a,(n,r)=>r.modified.startLineNumber-n.modified.endLineNumberExclusive<2*kje)){let n=[];n.push(new Kti);let r=new ro(Math.max(1,o[0].original.startLineNumber-kje),Math.min(o[o.length-1].original.endLineNumberExclusive+kje,i+1)),s=new ro(Math.max(1,o[0].modified.startLineNumber-kje),Math.min(o[o.length-1].modified.endLineNumberExclusive+kje,e+1));Nut(o,(u,p)=>{let h=new ro(u?u.original.endLineNumberExclusive:r.startLineNumber,p?p.original.startLineNumber:r.endLineNumberExclusive),g=new ro(u?u.modified.endLineNumberExclusive:s.startLineNumber,p?p.modified.startLineNumber:s.endLineNumberExclusive);h.forEach(f=>{n.push(new qti(f,g.startLineNumber+(f-h.startLineNumber)))}),p&&(p.original.forEach(f=>{n.push(new Gti(p,f))}),p.modified.forEach(f=>{n.push(new $ti(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 zti(new NI(l,c),n))}return t}var zti=class{constructor(i,e){this.range=i;this.lines=e}},Kti=class{constructor(){this.type=0}},Gti=class{constructor(i,e){this.diff=i;this.originalLineNumber=e;this.type=2;this.modifiedLineNumber=void 0}},$ti=class{constructor(i,e){this.diff=i;this.modifiedLineNumber=e;this.type=3;this.originalLineNumber=void 0}},qti=class{constructor(i,e){this.originalLineNumber=i;this.modifiedLineNumber=e;this.type=1}},Tje=class extends C{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 ji(l)),this._register(he(c=>{this._actionBar.clear(),this._model.canClose.read(c)&&this._actionBar.push(pi({id:"diffreview.close",label:d(217,null),class:"close-diff-review "+q.asClassName(zFo),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 Pa(this._content,{})),Fi(this.domNode,this._scrollbar.getDomNode(),l),this._register(he(c=>{this._height.read(c),this._width.read(c),this._scrollbar.scanDomNode()})),this._register(Z(()=>{Fi(this.domNode)})),this._register(UM(this.domNode,{width:this._width,height:this._height})),this._register(UM(this._content,{width:this._width,height:this._height})),this._register(Ga((c,u)=>{this._model.currentGroup.read(c),this._render(u)})),this._register(Vo(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)),Pd(n,o.get(59)),Fi(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 N=document.createElement("div");N.className="diff-review-cell diff-review-summary",N.appendChild(document.createTextNode(`${S+1}/${y}: @@ -${b.original.startLineNumber},${b.original.length} +${b.modified.startLineNumber},${b.modified.length} @@`)),v.appendChild(N),g=v}else g=this._createRow(h,u,this._width.get(),t,r,l,o,s,c);n.appendChild(g);let f=Ce(v=>this._model.currentElement.read(v)===h);e.add(he(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=HFo;break;case 2:v="diff-review-row line-delete",b=" char-delete",y=UFo;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 N=document.createElement("span");N.style.width=f+"px",N.style.minWidth=f+"px",N.style.paddingRight="10px",N.className="diff-review-line-number"+b,e.modifiedLineNumber!==void 0?N.appendChild(document.createTextNode(String(e.modifiedLineNumber))):N.innerText="\xA0",k.appendChild(N);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);QN._ttPolicy&&(G=QN._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);QN._ttPolicy&&(G=QN._ttPolicy.createHTML(G)),k.insertAdjacentHTML("beforeend",G),V=r.getLineContent(e.originalLineNumber)}V.length===0&&(V=d(212,null));let U="";switch(e.type){case 1:e.originalLineNumber===e.modifiedLineNumber?U=d(221,null,V,e.originalLineNumber):U=d(214,null,V,e.originalLineNumber,e.modifiedLineNumber);break;case 3:U=d(216,null,V,e.modifiedLineNumber);break;case 2:U=d(213,null,V,e.originalLineNumber);break}return w.setAttribute("aria-label",U),w}_getLineHtml(e,t,o,n,r){let s=e.getLineContent(n),l=t.get(59),c=t.get(117).verticalScrollbarSize,u=Bc.createEmpty(s,r),p=KU.isBasicASCII(s,e.mightContainNonBasicASCII()),h=KU.containsRTL(s,p,e.mightContainRTL());return g$i(new hL(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)!==mx.OFF,null,null,c)).html}};Tje=I([m(5,kt)],Tje);var bSt=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 $gr=J("diffEditor.move.border","#8b8b8b9c",d(247,null)),qgr=J("diffEditor.moveActive.border","#FFA500",d(248,null)),jgr=J("diffEditor.unchangedRegionShadow",{dark:"#000000",light:"#737373BF",hcDark:"#000000",hcLight:"#737373BF"},d(249,null)),GFo=Re("diff-insert",M.add,d(250,null)),jti=Re("diff-remove",M.remove,d(251,null)),Qti=po.register({className:"line-insert",description:"line-insert",isWholeLine:!0,linesDecorationsClassName:"insert-sign "+q.asClassName(GFo),marginClassName:"gutter-insert"}),Yti=po.register({className:"line-delete",description:"line-delete",isWholeLine:!0,linesDecorationsClassName:"delete-sign "+q.asClassName(jti),marginClassName:"gutter-delete"}),Xti=po.register({className:"line-insert",description:"line-insert",isWholeLine:!0,marginClassName:"gutter-insert"}),Jti=po.register({className:"line-delete",description:"line-delete",isWholeLine:!0,marginClassName:"gutter-delete"}),Eae=po.register({className:"char-insert",description:"char-insert",shouldFillLineOnLineBreak:!0}),zye=po.register({className:"char-insert",description:"char-insert",isWholeLine:!0}),e4i=po.register({className:"char-insert diff-range-empty",description:"char-insert diff-range-empty"}),Cq=po.register({className:"char-delete",description:"char-delete",shouldFillLineOnLineBreak:!0}),t4i=po.register({className:"char-delete",description:"char-delete",isWholeLine:!0}),i4i=po.register({className:"char-delete diff-range-empty",description:"char-delete diff-range-empty"});var Zti=ae("diffProviderFactoryService"),_je=class{constructor(i){this.instantiationService=i}createDiffProvider(i){return this.instantiationService.createInstance(xW,i)}};_je=I([m(0,F)],_je);we(Zti,_je,1);var xW=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 wf(new ro(1,2),new ro(1,e.getLineCount()+1),[new cg(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=xW.diffCache.get(n);if(s&&s.context===r)return s.result;let l=En.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 xW.diffCache.size>10&&xW.diffCache.delete(xW.diffCache.keys().next().value),xW.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()}};xW=I([m(1,$s),m(2,Te)],xW);var Y9=class extends C{constructor(e,t,o){super();this.model=e;this._options=t;this._diffProviderFactoryService=o;this._isDiffUpToDate=Le(this,!1);this.isDiffUpToDate=this._isDiffUpToDate;this._diff=Le(this,void 0);this.diff=this._diff;this._unchangedRegions=Le(this,void 0);this.unchangedRegions=Ce(this,e=>this._options.hideUnchangedRegions.read(e)?this._unchangedRegions.read(e)?.regions??[]:(Ui(t=>{for(let o of this._unchangedRegions.read(void 0)?.regions||[])o.collapseAll(t)}),[]));this.movedTextToCompare=Le(this,void 0);this._activeMovedText=Le(this,void 0);this._hoveredMovedText=Le(this,void 0);this.activeMovedText=Ce(this,e=>this.movedTextToCompare.read(e)??this._hoveredMovedText.read(e)??this._activeMovedText.read(e));this._cancellationTokenSource=new $e;this._diffProvider=Ce(this,e=>{let t=this._diffProviderFactoryService.createDiffProvider({diffAlgorithm:this._options.diffAlgorithm.read(e)}),o=Nr("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(he(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?ro.fromRangeInclusive(v):void 0),p=c.modifiedDecorationIds.map(v=>e.modified.getDecorationRange(v)).map(v=>v?ro.fromRangeInclusive(v):void 0),h=c.regions.map((v,b)=>!u[b]||!p[b]?void 0:new X9(u[b].startLineNumber,p[b].startLineNumber,u[b].length,v.visibleLineCountTop.read(l),v.visibleLineCountBottom.read(l))).filter(mo),g=[],f=!1;for(let v of s6(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 X9(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"}})));Ui(S=>{this._unchangedRegions.set({regions:g,originalDecorationIds:v,modifiedDecorationIds:b},S)})}}));let s=(l,c,u)=>{let p=X9.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?ro.fromRangeInclusive(T):void 0),y=g.modifiedDecorationIds.map(T=>e.modified.getDecorationRange(T)).map(T=>T?ro.fromRangeInclusive(T):void 0),k=j5i(g.regions.map((T,N)=>{if(!S[N]||!y[N])return;let O=S[N].length;return new X9(S[N].startLineNumber,y[N].startLineNumber,O,Math.min(T.visibleLineCountTop.get(),O),Math.min(T.visibleLineCountBottom.get(),O-T.visibleLineCountTop.get()))}).filter(mo),(T,N)=>!N||T.modifiedLineNumber>=N.modifiedLineNumber+N.lineCount&&T.originalLineNumber>=N.originalLineNumber+N.lineCount).map(T=>new NI(T.getHiddenOriginalRange(u),T.getHiddenModifiedRange(u)));k=NI.clip(k,ro.ofLength(1,e.original.getLineCount()),ro.ofLength(1,e.modified.getLineCount())),h=NI.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=zN.fromModelContentChanges(l.changes),p=(this._lastDiff,e.original,e.modified,void 0);p&&(this._lastDiff=p,Ui(h=>{this._diff.set(Tae.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=zN.fromModelContentChanges(l.changes),p=(this._lastDiff,e.original,e.modified,void 0);p&&(this._lastDiff=p,Ui(h=>{this._diff.set(Tae.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(Ga(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),Cx(WSe,l),Cx(k$e,l),this._isDiffUpToDate.set(!1,void 0);let p=[];c.add(e.original.onDidChangeContent(f=>{let v=zN.fromModelContentChanges(f.changes);p=pye(p,v)}));let h=[];c.add(e.modified.onDidChangeContent(f=>{let v=zN.fromModelContentChanges(f.changes);h=pye(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=$Fo(g,e.original,e.modified),g=(e.original,e.modified,void 0)??g,g=(e.original,e.modified,void 0)??g,Ui(f=>{s(g,f),this._lastDiff=g;let v=Tae.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 gf(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=>ro.deserialize(n.range)),o=this._unchangedRegions.get();!o||!t||Ui(n=>{for(let r of o.regions)for(let s of t)if(r.modifiedUnchangedRange.intersect(s)){r.setHiddenModifiedRange(s,n);break}})}};Y9=I([m(2,Zti)],Y9);function $Fo(a,i,e){return{changes:a.changes.map(t=>new wf(t.original,t.modified,t.innerChanges?t.innerChanges.map(o=>qFo(o,i,e)):void 0)),moves:a.moves,identical:a.identical,quitEarly:a.quitEarly}}function qFo(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 cg(t,o)}var Tae=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 Dje(e)),i.moves||[],i.identical,i.quitEarly)}},Dje=class{constructor(i){this.lineRangeMapping=i}},X9=class a{constructor(i,e,t,o,n){this.originalLineNumber=i;this.modifiedLineNumber=e;this.lineCount=t;this._visibleLineCountTop=Le(this,0);this.visibleLineCountTop=this._visibleLineCountTop;this._visibleLineCountBottom=Le(this,0);this.visibleLineCountBottom=this._visibleLineCountBottom;this._shouldHideControls=Ce(this,i=>this.visibleLineCountTop.read(i)+this.visibleLineCountBottom.read(i)===this.lineCount&&!this.isDragged.read(i));this.isDragged=Le(this,void 0);let r=Math.max(Math.min(o,this.lineCount),0),s=Math.max(Math.min(n,this.lineCount-o),0);A6t(o===r),A6t(n===s),this._visibleLineCountTop.set(r,void 0),this._visibleLineCountBottom.set(s,void 0)}static fromDiffs(i,e,t,o,n){let r=wf.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 ro.ofLength(this.originalLineNumber,this.lineCount)}get modifiedUnchangedRange(){return ro.ofLength(this.modifiedLineNumber,this.lineCount)}setVisibleRanges(i,e){let t=[],o=new PM(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 ro.ofLength(this.originalLineNumber+this._visibleLineCountTop.read(i),this.lineCount-this._visibleLineCountTop.read(i)-this._visibleLineCountBottom.read(i))}getHiddenModifiedRange(i){return ro.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 o4i(a){let{domNode:i,renderLinesResult:e,diffEntry:t,originalModel:o,clipboardService:n}=a,r=new P;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 SSt=class extends C{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(M.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)&&!Nc,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 st("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 N=this._originalTextModel.getValueInRange(r.original.toExclusiveRange());await this._clipboardService.writeText(N)})),r.original.length>1&&w.push(new st("diff.clipboard.copyDeletedLineContent",k?d(226,null,r.original.startLineNumber+g):d(223,null,r.original.startLineNumber+g),void 0,!0,async()=>{let N=this._originalTextModel.getLineContent(r.original.startLineNumber+g);N===""&&(N=this._originalTextModel.getEndOfLineSequence()===0?`
`:`\r
`),await this._clipboardService.writeText(N)})),n.getOption(104)||w.push(new st("diff.inline.revertChange",d(229,null),void 0,!0,async()=>{this._editor.revert(this._diff)})),w},autoSelectFirstItem:!0})};this._register(Vo(this._diffActions,"mousedown",b=>{if(!b.leftButton)return;let{top:S,height:y}=Yn(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(o4i({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}=Yn(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 n4i=Kg("diffEditorWidget",{createHTML:a=>a});function EL(a,i,e,t,o=!1){Pd(t,i.fontInfo);let n=e.length>0,r=new ES(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=Jv.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),N=r4i(l,T,Jv.extractWrapped(y,w,k),n,a.mightContainNonBasicASCII,a.mightContainRTL,i,r,o);s=Math.max(s,N.maxCharWidth),u.push(new ISt(N.output.characterMapping,N.output.containsForeignElements,w)),l++,w=k}c.push(S.breakOffsets.length)}else{c.push(1);let w=r4i(l,b,y,n,a.mightContainNonBasicASCII,a.mightContainRTL,i,r,o);s=Math.max(s,w.maxCharWidth),u.push(new ISt(w.output.characterMapping,w.output.containsForeignElements,0)),l++}}s+=i.scrollBeyondLastColumn;let p=r.build(),h=n4i?n4i.createHTML(p):p;t.innerHTML=h;let g=s*i.typicalHalfwidthCharacterWidth;return new eii(l,g,c,u,a)}var dE=class{constructor(i,e=i.map(n=>null),t=!0,o=!0){this.lineTokens=i;this.lineBreakData=e;this.mightContainNonBasicASCII=t;this.mightContainRTL=o}},uE=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)}},eii=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=K$(c.characterMapping,i,e)+c.offset;return new Ie(s,u)}},ISt=class extends Hse{constructor(e,t,o){super(e,t);this.offset=o}};function r4i(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=KU.isBasicASCII(c,o),p=KU.containsRTL(c,u,n),h=uW(new hL(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!==mx.OFF,null,null,r.verticalScrollbarSize),s);s.appendString("</div>");let g=h.characterMapping.getHorizontalOffset(h.characterMapping.length);return{output:h,maxCharWidth:g}}var Wi=ae("clipboardService");var _n=ae("contextViewService"),ze=ae("contextMenuService");var Kye=class extends C{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=Le(this,0),this._originalScrollOffset=Le(this,0),this._originalScrollOffsetAnimated=Vti(this._targetWindow,this._originalScrollOffset,this._store),this._modifiedTopPadding=Le(this,0),this._modifiedScrollOffset=Le(this,0),this._modifiedScrollOffsetAnimated=Vti(this._targetWindow,this._modifiedScrollOffset,this._store);let h=Le("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=Ce(k=>{let T=this._diffModel.read(k),N=T?.diff.read(k);if(!T||!N)return null;h.read(k);let V=this._options.renderSideBySide.read(k);return s4i(this._editors.original,this._editors.modified,N.mappings,this._origViewZonesToIgnore,this._modViewZonesToIgnore,V)}),b=Ce(k=>{let T=this._diffModel.read(k)?.movedTextToCompare.read(k);if(!T)return null;h.read(k);let N=T.changes.map(O=>new Dje(O));return s4i(this._editors.original,this._editors.modified,N,this._origViewZonesToIgnore,this._modViewZonesToIgnore,!0)});function S(){let k=document.createElement("div");return k.className="diagonal-fill",k}let y=this._register(new P);this.viewZones=Ce(this,k=>{y.clear();let T=v.read(k)||[],N=[],O=[],V=this._modifiedTopPadding.read(k);V>0&&O.push({afterLineNumber:0,domNode:document.createElement("div"),heightInPx:V,showInHiddenAreas:!0,suppressMouseDown:!0});let U=this._originalTopPadding.read(k);U>0&&N.push({afterLineNumber:0,domNode:document.createElement("div"),heightInPx:U,showInHiddenAreas:!0,suppressMouseDown:!0});let G=this._options.renderSideBySide.read(k),$=G?void 0:this._editors.modified._getViewModel()?.createLineBreaksComputer();if($){let He=this._editors.original.getModel();for(let Ve of T)if(Ve.diff)for(let Fe=Ve.originalRange.startLineNumber;Fe<Ve.originalRange.endLineNumberExclusive;Fe++){if(Fe>He.getLineCount())return{orig:N,mod:O};$?.addRequest(He.getLineContent(Fe),null,null)}}let te=$?.finalize()??[],pe=0,de=this._editors.modified.getOption(75),se=this._diffModel.read(k)?.movedTextToCompare.read(k),Se=this._editors.original.getModel()?.mightContainNonBasicASCII()??!1,ke=this._editors.original.getModel()?.mightContainRTL()??!1,Ee=uE.fromEditor(this._editors.modified);for(let He of T)if(He.diff&&!G&&(!this._options.useTrueInlineDiffRendering.read(k)||!Rje(He.diff))){if(!He.originalRange.isEmpty){f.read(k);let Fe=document.createElement("div");Fe.classList.add("view-lines","line-delete","line-delete-selectable","monaco-mouse-cursor-text");let Qt=this._editors.original.getModel();if(He.originalRange.endLineNumberExclusive-1>Qt.getLineCount())return{orig:N,mod:O};let Ze=new dE(He.originalRange.mapToLineArray(_o=>Qt.tokenization.getLineTokens(_o)),He.originalRange.mapToLineArray(_o=>te[pe++]),Se,ke),Ti=[];for(let _o of He.diff.innerChanges||[])Ti.push(new Zk(_o.originalRange.delta(-(He.diff.original.startLineNumber-1)),Cq.className,0));let ti=EL(Ze,Ee,Ti,Fe),bo=document.createElement("div");if(bo.className="inline-deleted-margin-view-zone",Pd(bo,Ee.fontInfo),this._options.renderIndicators.read(k))for(let _o=0;_o<ti.heightInLines;_o++){let sr=document.createElement("div");sr.className=`delete-sign ${q.asClassName(jti)}`,sr.setAttribute("style",`position:absolute;top:${_o*de}px;width:${Ee.lineDecorationsWidth}px;height:${de}px;right:0;`),bo.appendChild(sr)}let Ro;y.add(new SSt(()=>Oi(Ro),bo,Fe,this._editors.modified,He.diff,this._diffEditorWidget,ti,this._editors.original.getModel(),this._contextMenuService,this._clipboardService));for(let _o=0;_o<ti.viewLineCounts.length;_o++){let sr=ti.viewLineCounts[_o];sr>1&&N.push({afterLineNumber:He.originalRange.startLineNumber+_o,domNode:S(),heightInPx:(sr-1)*de,showInHiddenAreas:!0,suppressMouseDown:!0})}O.push({afterLineNumber:He.modifiedRange.startLineNumber-1,domNode:Fe,heightInPx:ti.heightInLines*de,minWidthInPx:ti.minWidthInPx,marginDomNode:bo,setZoneId(_o){Ro=_o},showInHiddenAreas:!0,suppressMouseDown:!1})}let Ve=document.createElement("div");Ve.className="gutter-delete",N.push({afterLineNumber:He.originalRange.endLineNumberExclusive-1,domNode:S(),heightInPx:He.modifiedHeightInPx,marginDomNode:Ve,showInHiddenAreas:!0,suppressMouseDown:!0})}else{let Ve=He.modifiedHeightInPx-He.originalHeightInPx;if(Ve>0){if(se?.lineRangeMapping.original.delta(-1).deltaLength(2).contains(He.originalRange.endLineNumberExclusive-1))continue;N.push({afterLineNumber:He.originalRange.endLineNumberExclusive-1,domNode:S(),heightInPx:Ve,showInHiddenAreas:!0,suppressMouseDown:!0})}else{let Fe=function(){let Ze=document.createElement("div");return Ze.className="arrow-revert-change "+q.asClassName(M.arrowRight),k.store.add(j(Ze,"mousedown",Ti=>Ti.stopPropagation())),k.store.add(j(Ze,"click",Ti=>{Ti.stopPropagation(),r.revert(He.diff)})),_("div",{},Ze)};if(se?.lineRangeMapping.modified.delta(-1).deltaLength(2).contains(He.modifiedRange.endLineNumberExclusive-1))continue;let Qt;He.diff&&He.diff.modified.isEmpty&&this._options.shouldRenderOldRevertArrows.read(k)&&(Qt=Fe()),O.push({afterLineNumber:He.modifiedRange.endLineNumberExclusive-1,domNode:S(),heightInPx:-Ve,marginDomNode:Qt,showInHiddenAreas:!0,suppressMouseDown:!0})}}for(let He of b.read(k)??[]){if(!se?.lineRangeMapping.original.intersect(He.originalRange)||!se?.lineRangeMapping.modified.intersect(He.modifiedRange))continue;let Ve=He.modifiedHeightInPx-He.originalHeightInPx;Ve>0?N.push({afterLineNumber:He.originalRange.endLineNumberExclusive-1,domNode:S(),heightInPx:Ve,showInHiddenAreas:!0,suppressMouseDown:!0}):O.push({afterLineNumber:He.modifiedRange.endLineNumberExclusive-1,domNode:S(),heightInPx:-Ve,showInHiddenAreas:!0,suppressMouseDown:!0})}return{orig:N,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(he(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(he(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(he(k=>{let T=this._diffModel.read(k)?.movedTextToCompare.read(k),N=0;if(T){let O=this._editors.original.getTopForLineNumber(T.lineRangeMapping.original.startLineNumber,!0)-this._originalTopPadding.read(void 0);N=this._editors.modified.getTopForLineNumber(T.lineRangeMapping.modified.startLineNumber,!0)-this._modifiedTopPadding.read(void 0)-O}N>0?(this._modifiedTopPadding.set(0,void 0),this._originalTopPadding.set(N,void 0)):N<0?(this._modifiedTopPadding.set(-N,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)-N,void 0,!0):this._modifiedScrollOffset.set(this._originalScrollOffset.read(void 0)+N,void 0,!0)}))}};Kye=I([m(8,Wi),m(9,ze)],Kye);function s4i(a,i,e,t,o,n){let r=new bS(a4i(a,t)),s=new bS(a4i(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:ro.ofLength(b.lineNumber,1),modifiedRange:ro.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,N=!1){if(k<y||T<S)return;if(b)b=!1;else if(!N&&(k===y||T===S))return;let O=new ro(y,k),V=new ro(S,T);if(O.isEmpty&&V.isEmpty)return;let U=r.takeWhile($=>$.lineNumber<k)?.reduce(($,te)=>$+te.heightInPx,0)??0,G=s.takeWhile($=>$.lineNumber<T)?.reduce(($,te)=>$+te.heightInPx,0)??0;u.push({originalRange:O,modifiedRange:V,originalHeightInPx:O.length*l+U,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(),N=k.originalRange.endLineNumber<=T.getLineCount()?T.getLineMaxColumn(k.originalRange.endLineNumber):Number.MAX_SAFE_INTEGER;k.originalRange.endColumn<N&&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 a4i(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 Ie(l.afterLineNumber,1)).lineNumber;e.push({lineNumber:c,heightInPx:l.height})}return $5i(e,t,l=>l.lineNumber,(l,c)=>({lineNumber:l.lineNumber,heightInPx:l.heightInPx+c.heightInPx}))}function Rje(a){return a.innerChanges?a.innerChanges.every(i=>Lje(i.modifiedRange)&&Lje(i.originalRange)||i.originalRange.equalsRange(new z(1,1,1,1))):!1}function Lje(a){return a.startLineNumber===a.endLineNumber}var J9=class a extends C{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=Nr("onDidChangeViewZones",this._editors.modified.onDidChangeViewZones),this.width=Le(this,0),this._modifiedViewZonesChangedSignal=Nr("modified.onDidChangeViewZones",this._editors.modified.onDidChangeViewZones),this._originalViewZonesChangedSignal=Nr("original.onDidChangeViewZones",this._editors.original.onDidChangeViewZones),this._state=Ce(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(ke,Ee){let He=Ee.getTopForLineNumber(ke.startLineNumber,!0),Ve=Ee.getTopForLineNumber(ke.endLineNumberExclusive,!0);return(He+Ve)/2}let U=V(O.lineRangeMapping.original,this._editors.original),G=this._originalScrollTop.read(p),$=V(O.lineRangeMapping.modified,this._editors.modified),te=this._modifiedScrollTop.read(p),pe=U-G,de=$-te,se=Math.min(U,$),Se=Math.max(U,$);return{range:new di(se,Se),from:pe,to:de,fromWithoutScroll:U,toWithoutScroll:$,move:O}});b.sort(Wut(tl(O=>O.fromWithoutScroll>O.toWithoutScroll,Vut),tl(O=>O.fromWithoutScroll>O.toWithoutScroll?O.fromWithoutScroll:-O.toWithoutScroll,qd)));let S=tii.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),N=0;for(let O of b){let V=S.getTrack(N),U=w+y+V*10,G=15,$=15,te=T,pe=v.glyphMarginWidth+v.lineNumbersWidth,de=18,se=document.createElementNS("http://www.w3.org/2000/svg","rect");se.classList.add("arrow-rectangle"),se.setAttribute("x",`${te-pe}`),se.setAttribute("y",`${O.to-de/2}`),se.setAttribute("width",`${pe}`),se.setAttribute("height",`${de}`),this._element.appendChild(se);let Se=document.createElementNS("http://www.w3.org/2000/svg","g"),ke=document.createElementNS("http://www.w3.org/2000/svg","path");ke.setAttribute("d",`M 0 ${O.from} L ${U} ${O.from} L ${U} ${O.to} L ${te-$} ${O.to}`),ke.setAttribute("fill","none"),Se.appendChild(ke);let Ee=document.createElementNS("http://www.w3.org/2000/svg","polygon");Ee.classList.add("arrow"),p.store.add(he(He=>{ke.classList.toggle("currentMove",O.move===h.activeMovedText.read(He)),Ee.classList.toggle("currentMove",O.move===h.activeMovedText.read(He))})),Ee.setAttribute("points",`${te-$},${O.to-G/2} ${te},${O.to} ${te-$},${O.to+G/2}`),Se.appendChild(Ee),this._element.appendChild(Se),N++}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(he(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(EM(this._state));let s=Ce(p=>{let g=this._diffModel.read(p)?.diff.read(p);return g?g.movedTexts.map(f=>({move:f,original:new g1(Oo(f.lineRangeMapping.original.startLineNumber-1),18),modified:new g1(Oo(f.lineRangeMapping.modified.startLineNumber-1),18)})):[]});this._register(Vye(this._editors.original,s.map(p=>p.map(h=>h.original)))),this._register(Vye(this._editors.modified,s.map(p=>p.map(h=>h.modified)))),this._register(Ga((p,h)=>{let g=s.read(p);for(let f of g)h.add(new ySt(this._editors.original,f.original,f.move,"original",this._diffModel.get())),h.add(new ySt(this._editors.modified,f.modified,f.move,"modified",this._diffModel.get()))}));let l=Nr("original.onDidFocusEditorWidget",p=>this._editors.original.onDidFocusEditorWidget(()=>setTimeout(()=>p(void 0),0))),c=Nr("modified.onDidFocusEditorWidget",p=>this._editors.modified.onDidFocusEditorWidget(()=>setTimeout(()=>p(void 0),0))),u="modified";this._register(xM({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}},tii=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=nUi(e,tl(s=>s.intersectWithRangeLength(o),qd)):(n=e.length,e.push(new Zmt))),e[n].addRange(o),t.push(n)}return new a(e.length,t)}getTrack(i){return this.trackPerLineIdx[i]}getTrackCount(){return this._trackCount}},ySt=class extends xae{constructor(e,t,o,n,r){let s=bt("div.diff-hidden-lines-widget");super(e,t,s.root);this._editor=e;this._move=o;this._kind=n;this._diffModel=r;this._nodes=bt("div.diff-moved-code-block",{style:{marginRight:"4px"}},[bt("div.text-content@textContent"),bt("div.action-bar@actionBar")]);s.root.appendChild(this._nodes.root);let l=ui(this._editor.onDidLayoutChange,()=>this._editor.getLayoutInfo());this._register(UM(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 ji(this._nodes.actionBar,{highlightToggledItems:!0})),p=new st("",c,"",!1);u.push(p,{icon:!1,label:!0});let h=new st("","Compare",q.asClassName(M.compareChanges),!0,()=>{this._editor.focus(),this._diffModel.movedTextToCompare.set(this._diffModel.movedTextToCompare.get()===o?void 0:this._move,void 0)});this._register(he(g=>{let f=this._diffModel.movedTextToCompare.read(g)===o;h.checked=f})),u.push(h,{icon:!1,label:!0})}};var wSt=class extends C{constructor(e,t,o,n){super();this._editors=e;this._diffModel=t;this._options=o;this._decorations=Ce(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?Yti:Jti}),p.lineRangeMapping.modified.isEmpty||c.push({range:p.lineRangeMapping.modified.toInclusiveRange(),options:r?Qti:Xti}),p.lineRangeMapping.modified.isEmpty||p.lineRangeMapping.original.isEmpty)p.lineRangeMapping.original.isEmpty||l.push({range:p.lineRangeMapping.original.toInclusiveRange(),options:t4i}),p.lineRangeMapping.modified.isEmpty||c.push({range:p.lineRangeMapping.modified.toInclusiveRange(),options:zye});else{let h=this._options.useTrueInlineDiffRendering.read(e)&&Rje(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?i4i:Cq}),p.lineRangeMapping.modified.contains(g.modifiedRange.startLineNumber)&&c.push({range:g.modifiedRange,options:g.modifiedRange.isEmpty()&&s&&!h?e4i:Eae}),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?Yti:Jti});let g=p.modified.toInclusiveRange();g&&c.push({range:g,options:r?Qti:Xti});for(let f of p.innerChanges||[])l.push({range:f.originalRange,options:Cq}),c.push({range:f.modifiedRange,options:Eae})}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:[J9.movedCodeBlockPadding,0,J9.movedCodeBlockPadding,J9.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(Wye(this._editors.original,this._decorations.map(r=>r?.originalDecorations||[]))),this._register(Wye(this._editors.modified,this._decorations.map(r=>r?.modifiedDecorations||[])))}};var Uh=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 os(a){return iii.get(a)}var iii=class a extends C{constructor(e){super();this.editor=e;this._sawZeroLineWidth=!1;this._onDidContainerResize=ff({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=Le(this,this.editor.getModel()),this.model=this._model,this.isReadonly=ff({owner:this,getTransaction:()=>this._currentTransaction},this.editor.onDidChangeConfiguration,()=>this.editor.getOption(104)),this._versionId=rg({owner:this,lazy:!0},this.editor.getModel()?.getVersionId()??null),this.versionId=this._versionId,this._selections=rg({owner:this,equalsFn:aU(lN(Yt.selectionsEqual)),lazy:!0},this.editor.getSelections()??null),this.selections=this._selections,this.positions=hs({owner:this,equalsFn:aU(lN(Ie.equals))},t=>this.selections.read(t)?.map(o=>o.getStartPosition())??null),this.isFocused=ff({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=ff({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=ff({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=y$(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=Ce(this,t=>(this.versionId.read(t),this.editor.getModel()?.getValueLength()===0)),this.cursorSelection=hs({owner:this,equalsFn:aU(Yt.selectionsEqual)},t=>this.selections.read(t)?.[0]??null),this.cursorPosition=hs({owner:this,equalsFn:Ie.equals},t=>this.selections.read(t)?.[0]?.getPosition()??null),this.cursorLineNumber=Ce(this,t=>this.cursorPosition.read(t)?.lineNumber??null),this.onDidType=Wc(this),this.onDidPaste=Wc(this),this.scrollTop=ff({owner:this,getTransaction:()=>this._currentTransaction},this.editor.onDidScrollChange,()=>this.editor.getScrollTop()),this.scrollLeft=ff({owner:this,getTransaction:()=>this._currentTransaction},this.editor.onDidScrollChange,()=>this.editor.getScrollLeft()),this.layoutInfo=ff({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=ff({owner:this,getTransaction:()=>this._currentTransaction},this.editor.onDidContentSizeChange,()=>this.editor.getContentWidth()),this.contentHeight=ff({owner:this,getTransaction:()=>this._currentTransaction},this.editor.onDidContentSizeChange,()=>this.editor.getContentHeight()),this._onDidChangeViewZones=Nr(this,this.editor.onDidChangeViewZones),this._onDidHiddenAreasChanged=Nr(this,this.editor.onDidChangeHiddenAreas),this._onDidLineHeightChanged=Nr(this,this.editor.onDidChangeLineHeight),this._widgetCounter=0,this.openedPeekWidgets=Le(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=Ce(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 cN(()=>{}))}_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=Il.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 P,o=this.editor.createDecorationsCollection();return t.add(XD({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=he(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=he(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 Ie(r.startLineNumber,1)),t),n=this.observePosition(e.map(r=>new Ie(r.endLineNumberExclusive+1,1)),t);return Ce(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 di(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=rg({owner:this,debugName:()=>`topLeftOfPosition${o?.toString()}`,equalsFn:aU(Uh.equals)},new Uh(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 Uh(0,this.editor.getBottomForLineNumber(p.getLineCount())-this.scrollTop.get()),void 0):n.set(u?new Uh(u.left,u.top):null,void 0)}};return this.editor.addContentWidget(l),t.add(he(c=>{o=e.read(c),this.editor.layoutContentWidget(l)})),t.add(Z(()=>{this.editor.removeContentWidget(l)})),n}isTargetHovered(e,t){let o=Le("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 Ce(t=>{let o=e instanceof Ie?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 Ie(e,1)):Ce(t=>{let o=e.read(t);return o===null?null:this.observeLineHeightForPosition(new Ie(o,1)).read(t)})}observeLineHeightsForLineRange(e){return Ce(t=>{let o=e instanceof ro?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 Ce(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 Ce(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 zI=class extends C{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=zI.ENTIRE_DIFF_OVERVIEW_WIDTH;let c=ui(this._themeService.onDidColorThemeChange,()=>this._themeService.getColorTheme()),u=Ce(g=>{let f=c.read(g),v=f.getColor(sgt)||(f.getColor(Hg)||$Se).transparent(2),b=f.getColor(agt)||(f.getColor(Cf)||qSe).transparent(2);return{insertColor:v,removeColor:b}}),p=or(document.createElement("div"));p.setClassName("diffViewport"),p.setPosition("absolute");let h=bt("div.diffOverview",{style:{position:"absolute",top:"0px",width:zI.ENTIRE_DIFF_OVERVIEW_WIDTH+"px"}}).root;this._register(wq(h,p.domNode)),this._register(Vo(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(wq(this._rootElement,h)),this._register(Ga((g,f)=>{let v=this._diffModel.read(g),b=this._editors.original.createOverviewRuler("original diffOverviewRuler");b&&(f.add(b),f.add(wq(h,b.getDomNode())));let S=this._editors.modified.createOverviewRuler("modified diffOverviewRuler");if(S&&(f.add(S),f.add(wq(h,S.getDomNode()))),!b||!S)return;let y=Nr("viewZoneChanged",this._editors.original.onDidChangeViewZones),w=Nr("viewZoneChanged",this._editors.modified.onDidChangeViewZones),k=Nr("hiddenRangesChanged",this._editors.original.onDidChangeHiddenAreas),T=Nr("hiddenRangesChanged",this._editors.modified.onDidChangeHiddenAreas);f.add(he(N=>{y.read(N),w.read(N),k.read(N),T.read(N);let O=u.read(N),V=v?.diff.read(N)?.mappings;function U(te,pe,de){let se=de._getViewModel();return se?te.filter(Se=>Se.length>0).map(Se=>{let ke=se.coordinatesConverter.convertModelPositionToViewPosition(new Ie(Se.startLineNumber,1)),Ee=se.coordinatesConverter.convertModelPositionToViewPosition(new Ie(Se.endLineNumberExclusive,1)),He=Ee.lineNumber-ke.lineNumber;return new aqe(ke.lineNumber,Ee.lineNumber,He,pe.toString())}):[]}let G=U((V||[]).map(te=>te.lineRangeMapping.original),O.removeColor,this._editors.original),$=U((V||[]).map(te=>te.lineRangeMapping.modified),O.insertColor,this._editors.modified);b?.setZones(G),S?.setZones($)})),f.add(he(N=>{let O=this._rootHeight.read(N),V=this._rootWidth.read(N),U=this._modifiedEditorLayoutInfo.read(N);if(U){let G=zI.ENTIRE_DIFF_OVERVIEW_WIDTH-2*zI.ONE_OVERVIEW_WIDTH;b.setLayout({top:0,height:O,right:G+zI.ONE_OVERVIEW_WIDTH,width:zI.ONE_OVERVIEW_WIDTH}),S.setLayout({top:0,height:O,right:0,width:zI.ONE_OVERVIEW_WIDTH});let $=this._editors.modifiedScrollTop.read(N),te=this._editors.modifiedScrollHeight.read(N),pe=this._editors.modified.getOption(117),de=new g9(pe.verticalHasArrows?pe.arrowSize:0,pe.verticalScrollbarSize,0,U.height,te,$);p.setTop(de.getSliderPosition()),p.setHeight(de.getSliderSize())}else p.setTop(0),p.setHeight(0);h.style.height=O+"px",h.style.left=V-zI.ENTIRE_DIFF_OVERVIEW_WIDTH+"px",p.setWidth(zI.ENTIRE_DIFF_OVERVIEW_WIDTH)}))}))}static{this.ONE_OVERVIEW_WIDTH=15}static{this.ENTIRE_DIFF_OVERVIEW_WIDTH=this.ONE_OVERVIEW_WIDTH*2}};zI=I([m(6,De)],zI);var Gye=class extends C{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=os(this.modified),this.originalObs=os(this.original),this.modifiedModel=this.modifiedObs.model,this.modifiedSelections=ui(this,this.modified.onDidChangeCursorSelection,()=>this.modified.getSelections()??[]),this.modifiedCursor=hs({owner:this,equalsFn:Ie.equals},u=>this.modifiedSelections.read(u)[0]?.getPosition()??new Ie(1,1)),this.originalCursor=ui(this,this.original.onDidChangeCursorPosition,()=>this.original.getPosition()??new Ie(1,1)),this.isOriginalFocused=os(this.original).isFocused,this.isModifiedFocused=os(this.modified).isFocused,this.isFocused=Ce(this,u=>this.isOriginalFocused.read(u)||this.isModifiedFocused.read(u)),this._argCodeEditorWidgetOptions=null,this._register(xM({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()+zI.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=zb.revealHorizontalRightPadding.defaultValue+zI.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,""):""}};Gye=I([m(5,X),m(6,F),m(7,_e)],Gye);var jFo=!1;var c4i=4,d4i=new E;function u4i(a){c4i=a,d4i.fire(a)}var p4i=300,m4i=new E;function h4i(a){p4i=a,m4i.fire(a)}var Mje=class{constructor(i){this.el=i;this.disposables=new P}get onPointerMove(){return this.disposables.add(new On(Me(this.el),"mousemove")).event}get onPointerUp(){return this.disposables.add(new On(Me(this.el),"mouseup")).event}dispose(){this.disposables.dispose()}};I([mi],Mje.prototype,"onPointerMove",1),I([mi],Mje.prototype,"onPointerUp",1);var Pje=class{constructor(i){this.el=i;this.disposables=new P}get onPointerMove(){return this.disposables.add(new On(this.el,Gn.Change)).event}get onPointerUp(){return this.disposables.add(new On(this.el,Gn.End)).event}dispose(){this.disposables.dispose()}};I([mi],Pje.prototype,"onPointerMove",1),I([mi],Pje.prototype,"onPointerUp",1);var $ye=class{constructor(i){this.factory=i}get onPointerMove(){return this.factory.onPointerMove}get onPointerUp(){return this.factory.onPointerUp}dispose(){}};I([mi],$ye.prototype,"onPointerMove",1),I([mi],$ye.prototype,"onPointerUp",1);var l4i="pointer-events-disabled",pv=class a extends C{constructor(e,t,o){super();this.hoverDelay=p4i;this.hoverDelayer=this._register(new jo(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 P);this.orthogonalStartDragHandleDisposables=this._register(new P);this.orthogonalEndSashDisposables=this._register(new P);this.orthogonalEndDragHandleDisposables=this._register(new P);this.linkedSash=void 0;this.el=R(e,_(".monaco-sash")),o.orthogonalEdge&&this.el.classList.add(`orthogonal-edge-${o.orthogonalEdge}`),it&&this.el.classList.add("mac"),this._register(j(this.el,"mousedown",r=>this.onPointerStart(r,new Mje(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(ws.addTarget(this.el)),this._register(j(this.el,Gn.Start,r=>this.onPointerStart(r,new Pje(this.el))));let n;this._register(j(this.el,Gn.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=c4i,this._register(d4i.event(r=>{this.size=r,this.layout()}))),this._register(m4i.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",jFo),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=R(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=R(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){$t.stop(e);let o=!1;if(!e.__orthogonalSashEvent){let v=this.getOrthogonalSash(e);v&&(o=!0,e.__orthogonalSashEvent=!0,v.onPointerStart(e,new $ye(t)))}if(this.linkedSash&&!e.__linkedSashEvent&&(e.__linkedSashEvent=!0,this.linkedSash.onPointerStart(e,new $ye(t))),!this.state)return;let n=this.el.ownerDocument.getElementsByTagName("iframe");for(let v of n)v.classList.add(l4i);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=hr(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=it?"row-resize":"ns-resize":this.state===1?v="e-resize":this.state===2?v="w-resize":v=it?"col-resize":"ew-resize",u.textContent=`* { cursor: ${v} !important; }`},h=new P;p(),o||this.onDidEnablementChange.event(p,null,h);let g=v=>{$t.stop(v,!1);let b={startX:r,currentX:v.pageX,startY:s,currentY:v.pageY,altKey:l};this._onDidChange.fire(b)},f=v=>{$t.stop(v,!1),u.remove(),this.el.classList.remove("active"),this._onDidEnd.fire(),h.dispose();for(let b of n)b.classList.remove(l4i)};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||!Ao(t))&&t.classList.contains("orthogonal-drag-handle"))return t.classList.contains("start")?this.orthogonalStartSash:this.orthogonalEndSash}dispose(){super.dispose(),this.el.remove()}};var CSt=class{constructor(i,e){this._options=i;this.dimensions=e;this.sashLeft=y$(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=Le(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}},qye=class extends C{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 pv(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(he(l=>{let c=this._boundarySashes.read(l);c&&(this._sash.orthogonalEndSash=c.bottom)})),this._register(he(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 xSt=class a extends C{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 jb={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 Z9=class{constructor(i,e){this._accessibilityService=e;this._diffEditorWidth=Le(this,0),this._screenReaderMode=ui(this,this._accessibilityService.onDidChangeScreenReaderOptimized,()=>this._accessibilityService.isScreenReaderOptimized()),this.couldShowInlineViewBecauseOfSize=Ce(this,o=>this._options.read(o).renderSideBySide&&this._diffEditorWidth.read(o)<=this._options.read(o).renderSideBySideInlineBreakpoint),this.renderOverviewRuler=Ce(this,o=>this._options.read(o).renderOverviewRuler),this.renderSideBySide=Ce(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=Ce(this,o=>this._options.read(o).readOnly),this.shouldRenderOldRevertArrows=Ce(this,o=>!(!this._options.read(o).renderMarginRevertIcon||!this.renderSideBySide.read(o)||this.readOnly.read(o)||this.shouldRenderGutterMenu.read(o))),this.shouldRenderGutterMenu=Ce(this,o=>this._options.read(o).renderGutterMenu),this.renderIndicators=Ce(this,o=>this._options.read(o).renderIndicators),this.enableSplitViewResizing=Ce(this,o=>this._options.read(o).enableSplitViewResizing),this.splitViewDefaultRatio=Ce(this,o=>this._options.read(o).splitViewDefaultRatio),this.ignoreTrimWhitespace=Ce(this,o=>this._options.read(o).ignoreTrimWhitespace),this.maxComputationTimeMs=Ce(this,o=>this._options.read(o).maxComputationTime),this.showMoves=Ce(this,o=>this._options.read(o).experimental.showMoves&&this.renderSideBySide.read(o)),this.isInEmbeddedEditor=Ce(this,o=>this._options.read(o).isInEmbeddedEditor),this.diffWordWrap=Ce(this,o=>this._options.read(o).diffWordWrap),this.originalEditable=Ce(this,o=>this._options.read(o).originalEditable),this.diffCodeLens=Ce(this,o=>this._options.read(o).diffCodeLens),this.accessibilityVerbose=Ce(this,o=>this._options.read(o).accessibilityVerbose),this.diffAlgorithm=Ce(this,o=>this._options.read(o).diffAlgorithm),this.showEmptyDecorations=Ce(this,o=>this._options.read(o).experimental.showEmptyDecorations),this.onlyShowAccessibleDiffViewer=Ce(this,o=>this._options.read(o).onlyShowAccessibleDiffViewer),this.compactMode=Ce(this,o=>this._options.read(o).compactMode),this.trueInlineDiffRenderingEnabled=Ce(this,o=>this._options.read(o).experimental.useTrueInlineView),this.useTrueInlineDiffRendering=Ce(this,o=>!this.renderSideBySide.read(o)&&this.trueInlineDiffRenderingEnabled.read(o)),this.hideUnchangedRegions=Ce(this,o=>this._options.read(o).hideUnchangedRegions.enabled),this.hideUnchangedRegionsRevealLineCount=Ce(this,o=>this._options.read(o).hideUnchangedRegions.revealLineCount),this.hideUnchangedRegionsContextLineCount=Ce(this,o=>this._options.read(o).hideUnchangedRegions.contextLineCount),this.hideUnchangedRegionsMinimumLineCount=Ce(this,o=>this._options.read(o).hideUnchangedRegions.minimumLineCount),this._model=Le(this,void 0),this.shouldRenderInlineViewInSmartMode=this._model.map(this,o=>q9t(this,n=>{let r=o?.diff.read(n);return r?QFo(r,this.trueInlineDiffRenderingEnabled.read(n)):void 0})).flatten().map(this,o=>!!o),this.inlineViewHideOriginalLineNumbers=this.compactMode;let t={...i,...g4i(i,jb)};this._options=Le(this,t)}get editorOptions(){return this._options}updateOptions(i){let e=g4i(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)}};Z9=I([m(1,Bi)],Z9);function QFo(a,i){return a.mappings.every(e=>YFo(e.lineRangeMapping)||XFo(e.lineRangeMapping)||i&&Rje(e.lineRangeMapping))}function YFo(a){return a.original.length===0}function XFo(a){return a.modified.length===0}function g4i(a,i){return{enableSplitViewResizing:Sn(a.enableSplitViewResizing,i.enableSplitViewResizing),splitViewDefaultRatio:mKi(a.splitViewDefaultRatio,.5,.1,.9),renderSideBySide:Sn(a.renderSideBySide,i.renderSideBySide),renderMarginRevertIcon:Sn(a.renderMarginRevertIcon,i.renderMarginRevertIcon),maxComputationTime:oW(a.maxComputationTime,i.maxComputationTime,0,1073741824),maxFileSize:oW(a.maxFileSize,i.maxFileSize,0,1073741824),ignoreTrimWhitespace:Sn(a.ignoreTrimWhitespace,i.ignoreTrimWhitespace),renderIndicators:Sn(a.renderIndicators,i.renderIndicators),originalEditable:Sn(a.originalEditable,i.originalEditable),diffCodeLens:Sn(a.diffCodeLens,i.diffCodeLens),renderOverviewRuler:Sn(a.renderOverviewRuler,i.renderOverviewRuler),diffWordWrap:Md(a.diffWordWrap,i.diffWordWrap,["off","on","inherit"]),diffAlgorithm:Md(a.diffAlgorithm,i.diffAlgorithm,["legacy","advanced"],{smart:"legacy",experimental:"advanced"}),accessibilityVerbose:Sn(a.accessibilityVerbose,i.accessibilityVerbose),experimental:{showMoves:Sn(a.experimental?.showMoves,i.experimental.showMoves),showEmptyDecorations:Sn(a.experimental?.showEmptyDecorations,i.experimental.showEmptyDecorations),useTrueInlineView:Sn(a.experimental?.useTrueInlineView,i.experimental.useTrueInlineView)},hideUnchangedRegions:{enabled:Sn(a.hideUnchangedRegions?.enabled??a.experimental?.collapseUnchangedRegions,i.hideUnchangedRegions.enabled),contextLineCount:oW(a.hideUnchangedRegions?.contextLineCount,i.hideUnchangedRegions.contextLineCount,0,1073741824),minimumLineCount:oW(a.hideUnchangedRegions?.minimumLineCount,i.hideUnchangedRegions.minimumLineCount,0,1073741824),revealLineCount:oW(a.hideUnchangedRegions?.revealLineCount,i.hideUnchangedRegions.revealLineCount,0,1073741824)},isInEmbeddedEditor:Sn(a.isInEmbeddedEditor,i.isInEmbeddedEditor),onlyShowAccessibleDiffViewer:Sn(a.onlyShowAccessibleDiffViewer,i.onlyShowAccessibleDiffViewer),renderSideBySideInlineBreakpoint:oW(a.renderSideBySideInlineBreakpoint,i.renderSideBySideInlineBreakpoint,0,1073741824),useInlineViewWhenSpaceIsLimited:Sn(a.useInlineViewWhenSpaceIsLimited,i.useInlineViewWhenSpaceIsLimited),renderGutterMenu:Sn(a.renderGutterMenu,i.renderGutterMenu),compactMode:Sn(a.compactMode,i.compactMode)}}var kSt=_;var e7=class extends C{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 Pa(this.contentsDomNode,{consumeMouseWheelIfScrollbarIsNeeded:!0})),this.containerDomNode.appendChild(this.scrollbar.getDomNode())}onContentsChanged(){this.scrollbar.scanDomNode()}},t7=class a extends C{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=R(i,kSt("div.action-container")),this.actionContainer.setAttribute("tabindex","0"),this.action=R(this.actionContainer,kSt("a.action")),this.action.setAttribute("role","button"),e.iconClass&&R(this.action,kSt("span.icon")).classList.add(...e.iconClass.split(" ")),this.actionRenderedLabel=t?`${e.label} (${t})`:e.label;let o=R(this.action,kSt("span"));o.textContent=this.actionRenderedLabel,this._store.add(new Aje(this.actionContainer,e.run)),this._store.add(new Nje(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 ESt(a,i){return a&&i?d(15,null,i):a?d(16,null):""}var Aje=class extends C{constructor(i,e){super(),this._register(j(i,re.CLICK,t=>{t.stopPropagation(),t.preventDefault(),e(i)}))}},Nje=class extends C{constructor(i,e,t){super(),this._register(j(i,re.KEY_DOWN,o=>{let n=new Ii(o);t.some(r=>n.equals(r))&&(o.stopPropagation(),o.preventDefault(),e(i))}))}};var Oje=class extends as{constructor(e,t){super();this._onDidChangeVisibility=this._register(new E);this.onDidChangeVisibility=this._onDidChangeVisibility.event;this._element=R(e,_(".monaco-dropdown")),this._label=R(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,Gn.Tap])this._register(j(this.element,r,s=>$t.stop(s,!0)));for(let r of[re.MOUSE_DOWN,Gn.Tap])this._register(j(this._label,r,s=>{Vp(s)&&s.button!==0||(this.visible?this.hide():this.show())}));this._register(j(this._label,re.KEY_DOWN,r=>{let s=new Ii(r);(s.equals(3)||s.equals(10))&&($t.stop(r,!0),this.visible?this.hide():this.show())}));let n=o(this._label);n&&this._register(n),this._register(ws.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(yp().setupManagedHover(Ni("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 f4i(a){return typeof a?.getActions=="function"}var TSt=class extends Oje{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 wp=class extends oc{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=R(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 TSt(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(yp().setupManagedHover(this.options.hoverDelegate??Ni("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)}},jye=class extends Lr{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=bt("div.action-dropdown-item-separator",[bt("div",{})]).root;n.classList.toggle("prominent",o.includes("prominent")),R(this.element,n),this.dropdownMenuActionViewItem=this._register(new wp(this._register(new st("dropdownAction",d(8,null))),t,this.contextMenuProvider,{classNames:["dropdown",...q.asClassNameArray(M.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 Ii(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 Fje=20,_ae=4,JFo="--vscode-toolbar-action-min-width",Ju=class extends C{constructor(e,t,o={orientation:0}){super();this.container=e;this.submenuActionViewItems=[];this.hasSecondaryActions=!1;this._onDidChangeDropdownVisibility=this._register(new xI);this.originalPrimaryActions=[];this.originalSecondaryActions=[];this.hiddenActions=[];this.disposables=this._register(new P);if(o.hoverDelegate=o.hoverDelegate??this._register(Gg()),this.options=o,this.toggleMenuAction=this._register(new Qye(()=>this.toggleMenuActionViewItem?.show(),o.toggleMenuTitle)),this.element=document.createElement("div"),this.element.className="monaco-toolbar",e.appendChild(this.element),this.actionBar=this._register(new ji(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===Qye.ID)return this.toggleMenuActionViewItem=new wp(n,{getActions:()=>this.toggleMenuAction.menuActions},t,{actionViewItemProvider:this.options.actionViewItemProvider,actionRunner:this.actionRunner,keybindingProvider:this.options.getKeyBinding,classNames:q.asClassNameArray(o.moreIcon??M.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 $l){let s=new wp(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.actionMinWidth=(o.responsiveBehavior?.actionMinWidth??Fje)+_ae,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(JFo,`${this.actionMinWidth-_ae}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)}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 li),o.forEach(n=>{this.actionBar.push(n,{icon:this.options.icon??!0,label:this.options.label??!1,keybinding:this.getKeybindingLabel(n)})}),this.actionBar.domNode.classList.toggle("has-overflow",this.actionBar.hasAction(this.toggleMenuAction)),this.options.responsiveBehavior?.enabled){if(this.hiddenActions.length=0,this.options.responsiveBehavior?.minItems!==void 0){let n=this.options.responsiveBehavior.minItems,r=0;(this.originalSecondaryActions.length>0||n<this.originalPrimaryActions.length)&&(r=Fje+_ae),this.container.style.minWidth=`${n*this.actionMinWidth+r}px`,this.element.style.minWidth=`${n*this.actionMinWidth+r}px`}else this.container.style.minWidth=`${Fje+_ae}px`,this.element.style.minWidth=`${Fje+_ae}px`;this.updateActions(this.element.getBoundingClientRect().width)}}isEmpty(){return this.actionBar.isEmpty()}getKeybindingLabel(e){return this.options.getKeyBinding?.(e)?.getLabel()??void 0}updateActions(e){if(this.actionBar.isEmpty())return;e=Math.max(e,parseInt(this.element.style.minWidth));let t=n=>{if(this.options.responsiveBehavior?.kind==="last"){let r=this.actionBar.hasAction(this.toggleMenuAction),s=r?this.actionBar.length()-1:this.actionBar.length(),l=0;for(let c=0;c<s-1;c++)l+=this.actionBar.getWidth(c)+_ae;return l+=n?this.actionBar.getWidth(s-1):this.actionMinWidth,l+=r?Fje+_ae:0,l}else return this.actionBar.length()*this.actionMinWidth};if(t(!1)<=e&&this.hiddenActions.length===0)return;if(t(!1)>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(;t(!0)>e&&this.actionBar.length()>0;){let n=this.originalPrimaryActions.length-this.hiddenActions.length-1;if(n<0)break;let r=Math.min(this.actionMinWidth,this.getItemWidth(n)),s=this.originalPrimaryActions[n];this.hiddenActions.unshift({action:s,size:r}),this.actionBar.pull(n),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)})}}else for(;this.hiddenActions.length>0;){let n=this.hiddenActions.shift();if(t(!0)+n.size>e){this.hiddenActions.unshift(n);break}this.actionBar.push(n.action,{icon:this.options.icon??!0,label:this.options.label??!1,keybinding:this.getKeybindingLabel(n.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))}let o=this.hiddenActions.map(n=>n.action);if(this.originalSecondaryActions.length>0||o.length>0){let n=this.originalSecondaryActions.slice(0);this.toggleMenuAction.menuActions=li.join(o,n)}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()}},Qye=class a extends st{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 Yye=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]=ZFo(s,l,this.modifierLabels[i])}return o.join(" ")}},YN=new Yye({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:"+"}),_St=new Yye({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:"+"}),v4i=new Yye({ctrlKey:"Ctrl",shiftKey:"Shift",altKey:"Alt",metaKey:"Cmd",separator:"+"},{ctrlKey:"Ctrl",shiftKey:"Shift",altKey:"Alt",metaKey:"Super",separator:"+"}),Xye=new Yye({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 ZFo(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 xq(a){return!!a&&typeof a=="object"&&typeof a.original=="string"&&typeof a.value=="string"}function Jye(a){return a?a.condition!==void 0:!1}function nii(a){let i=[];typeof a=="number"&&i.push("code/timeOrigin",a);function e(o,n){i.push(o,n?.startTime??Date.now())}function t(){let o=[];for(let n=0;n<i.length;n+=2)o.push({name:i[n],startTime:i[n+1]});return o}return{mark:e,getMarks:t}}function e0o(){if(typeof performance=="object"&&typeof performance.mark=="function"&&!performance.nodeTiming)return typeof performance.timeOrigin!="number"&&!performance.timing?nii():{mark(a,i){performance.mark(a,i)},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 nii(a)}else return console.trace("perf-util loaded in UNKNOWN environment"),nii()}function t0o(a){return a.MonacoPerformanceMarks||(a.MonacoPerformanceMarks=e0o()),a.MonacoPerformanceMarks}var b4i=t0o(globalThis),sn=b4i.mark,S4i=b4i.getMarks;var XN=class a extends C{constructor(e,t=Object.create(null)){super();this.database=e;this.options=t;this._onDidChangeStorage=this._register(new Pm);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;Jn(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 Jn(o)?t:o}getBoolean(e,t){let o=this.get(e);return Jn(o)?t:o==="true"}getNumber(e,t){let o=this.get(e);return Jn(o)?t:parseInt(o,10)}getObject(e,t){let o=this.get(e);return Jn(o)?t:zg(o)}async set(e,t,o=!1){if(this.state===2)return;if(Jn(t))return this.delete(e,o);let n=yi(t)||Array.isArray(t)?yIe(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}},ewe=class{constructor(){this.onDidChangeItemsExternal=H.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 Co=ae("environmentService"),iC=Co;var Pe=ae("contextService");function $g(a){let i=a;return typeof i?.id=="string"&&A.isUri(i.uri)}function Eq(a){return typeof a?.id=="string"&&!$g(a)&&!TL(a)}var i0o={id:"ext-dev"},o0o={id:"empty-window"};function VS(a,i){if(typeof a=="string"||typeof a>"u")return typeof a=="string"?{id:No(a)}:i?i0o:o0o;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 TL(a){let i=a;return typeof i?.id=="string"&&A.isUri(i.configPath)}function I4i(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 Tq(a){let i=a;return!!(i&&typeof i=="object"&&typeof i.id=="string"&&Array.isArray(i.folders))}function oC(a){let i=a;return!!(i&&typeof i=="object"&&A.isUri(i.uri)&&typeof i.name=="string"&&typeof i.toResource=="function")}var twe=class{constructor(i,e,t,o,n){this._id=i;this._transient=t;this._configuration=o;this.ignorePathCasing=n;this.foldersMap=Yu.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=Yu.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}}},kq=class{constructor(i,e){this.raw=e;this.uri=i.uri,this.index=i.index,this.name=i.name}toResource(i){return je(this.uri,i)}toJSON(){return{uri:this.uri,name:this.name,index:this.index}}};function Dae(a){return new kq({uri:a,index:0,name:Ra(a)},{uri:a.toString()})}var JN="code-workspace",Wje=`.${JN}`,Lyr=[{name:d(2726,null),extensions:[JN]}],y4i="workspace.json";function _q(a,i){return m$.isEqualOrParent(a,i.untitledWorkspacesHome)}function xx(a){let i;return A.isUri(a)?i=a:i=a.configuration,i?.scheme===Y.tmp}var n0o="4064f6ec-cb38-4ad0-af64-ee6467e63c82";function w4i(a){return a.id===n0o}function Vje(a,i){return!_q(a,i)&&!xx(a)}function o7(a){return(typeof a=="string"?Am(a):ms(a))===Wje}var dt=ae("IUriIdentityService");function ZN(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=ae("IUserDataProfilesService");function Qy(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 Lae(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:je(e,"globalStorage"),settingsResource:n&&o?.useDefaultFlags?.settings?n.settingsResource:je(e,"settings.json"),keybindingsResource:n&&o?.useDefaultFlags?.keybindings?n.keybindingsResource:je(e,"keybindings.json"),tasksResource:n&&o?.useDefaultFlags?.tasks?n.tasksResource:je(e,"tasks.json"),snippetsHome:n&&o?.useDefaultFlags?.snippets?n.snippetsHome:je(e,"snippets"),promptsHome:n&&o?.useDefaultFlags?.prompts?n.promptsHome:je(e,"prompts"),extensionsResource:n&&o?.useDefaultFlags?.extensions?n.extensionsResource:je(e,"extensions.json"),mcpResource:n&&o?.useDefaultFlags?.mcp?n.mcpResource:je(e,"mcp.json"),cacheHome:je(t,a),useDefaultFlags:o?.useDefaultFlags,isTransient:o?.transient,workspaces:o?.workspaces}}var DSt=class extends C{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=je(this.environmentService.userRoamingDataHome,"profiles"),this.profilesCacheHome=je(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=Ye(n.location);t.push(Lae(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||!Ae(e.name)||!e.location||e.isSystem||this.uriIdentityService.extUri.basename(this.uriIdentityService.extUri.dirname(e.location))==="builtin")}createDefaultProfile(){let e=Lae("__default__profile__",d(2685,null),this.environmentService.userRoamingDataHome,this.profilesCacheHome);return{...e,extensionsResource:this.getDefaultProfileExtensionsLocation()??e.extensionsResource,isDefault:!0}}async createTransientProfile(e){let t="Temp",o=new RegExp(`${Yr(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(Ir(_t()).toString(16),r,{transient:!0},e)}async createNamedProfile(e,t,o){return this.createProfile(Ir(_t()).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(!Ae(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=Lae(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 fn.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=Lae(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){hu(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 $g(e)?e.uri:TL(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(){}};DSt=I([m(0,Co),m(1,be),m(2,dt),m(3,ne)],DSt);var rii="__$__isNewStorageMarker",LSt="__$__targetStorageMarker",le=ae("storageService");function r0o(a){let i=a.get(LSt);if(i)try{return JSON.parse(i)}catch{}return Object.create(null)}var Rae=class a extends C{constructor(e={flushInterval:a.DEFAULT_FLUSH_INTERVAL}){super();this._onDidChangeValue=this._register(new Pm);this._onDidChangeTarget=this._register(new Pm);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 H.filter(this._onDidChangeValue.event,n=>n.scope===e&&(t===void 0||n.key===t),o)}doFlushWhenIdle(){this.runFlushWhenIdle.value=aN(()=>{this.shouldFlushWhenIdle()&&this.flush(),this.flushWhenIdleScheduler.schedule()})}shouldFlushWhenIdle(){return!0}stopFlushWhenIdle(){Ue([this.runFlushWhenIdle,this.flushWhenIdleScheduler])}initialize(){return this.initializationPromise||(this.initializationPromise=(async()=>{sn("code/willInitStorage");try{await this.doInitialize()}finally{sn("code/didInitStorage")}this.flushWhenIdleScheduler.schedule()})()),this.initializationPromise}emitDidChangeValue(e,t){let{key:o,external:n}=t;if(o===LSt){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(Jn(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(LSt,JSON.stringify(r),n)):typeof r[e]=="number"&&(delete r[e],this.getStorage(t)?.set(LSt,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?r0o(t):Object.create(null)}isNew(e){return this.getBoolean(rii,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 fn.settled([t?.whenFlushed()??Promise.resolve(),o?.whenFlushed()??Promise.resolve(),n?.whenFlushed()??Promise.resolve()]);break;case 1:await fn.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 s0o(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),ZN(e)?this.switchToProfile(e,t):this.switchToWorkspace(e,t)}canSwitchProfile(e,t){return!(e.id===t.id||iwe(t)&&iwe(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 iwe(a){return a.isDefault||!!a.useDefaultFlags?.globalState}var RSt=class extends Rae{constructor(){super();this.applicationStorage=this._register(new XN(new ewe,{hint:1}));this.profileStorage=this._register(new XN(new ewe,{hint:1}));this.workspaceStorage=this._register(new XN(new ewe,{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 s0o(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 sii(a,i){let e={...i};for(let t in a){let o=a[t];e[t]=o!==void 0?wt(o):void 0}return e}var l_={keybindingLabelBackground:wt(i$i),keybindingLabelForeground:wt(o$i),keybindingLabelBorder:wt(n$i),keybindingLabelBottomBorder:wt(r$i),keybindingLabelShadow:wt(RN)};var Ko={buttonForeground:wt(YT),buttonSeparator:wt(vgt),buttonBackground:wt(MS),buttonHoverBackground:wt(B$),buttonSecondaryForeground:wt(Fse),buttonSecondaryBackground:wt(H$),buttonSecondaryHoverBackground:wt(Wse),buttonSecondaryBorder:wt(oIe),buttonBorder:wt(oIe)};var kx={progressBarBackground:wt(j2i)};var qg={inputActiveOptionBorder:wt(cW),inputActiveOptionForeground:wt(V$),inputActiveOptionBackground:wt(dW)},Iwr={activeForeground:wt(iIe),activeBackground:wt(jGi),activeBorder:wt(QGi),inactiveForeground:wt(YGi),inactiveBackground:wt(XGi),inactiveBorder:wt(JGi),inactiveHoverBackground:wt(ZGi)};var kf={checkboxBackground:wt(nIe),checkboxBorder:wt(bgt),checkboxForeground:wt(rIe),checkboxDisabledBackground:wt(e$i),checkboxDisabledForeground:wt(t$i)},C4i={dialogBackground:wt(gm),dialogForeground:wt(dL),dialogShadow:wt(RN),dialogBorder:wt(jT),errorIconForeground:wt(SGi),warningIconForeground:wt(IGi),infoIconForeground:wt(yGi),textLinkForeground:wt(WI)};var pl={inputBackground:wt(Gb),inputForeground:wt(pL),inputBorder:wt(Vy),inputValidationInfoBorder:wt(z$e),inputValidationInfoBackground:wt(zGi),inputValidationInfoForeground:wt(KGi),inputValidationWarningBorder:wt(K$e),inputValidationWarningBackground:wt(GGi),inputValidationWarningForeground:wt($Gi),inputValidationErrorBorder:wt(Nse),inputValidationErrorBackground:wt(ggt),inputValidationErrorForeground:wt(fgt)};function c_(a){return sii(a,pl)}var x4i={listFilterWidgetBackground:wt(AGi),listFilterWidgetOutline:wt(NGi),listFilterWidgetNoMatchesOutline:wt(OGi),listFilterWidgetShadow:wt(FGi),inputBoxStyles:pl,toggleStyles:qg},BS={badgeBackground:wt(rv),badgeForeground:wt(Yw),badgeBorder:wt(gi)};var f1={breadcrumbsBackground:wt(fGi),breadcrumbsForeground:wt(gGi),breadcrumbsHoverForeground:wt(zXt),breadcrumbsFocusForeground:wt(zXt),breadcrumbsFocusAndSelectionForeground:wt(vGi)};var n7={listBackground:void 0,listInactiveFocusForeground:void 0,listFocusBackground:wt(c9),listFocusForeground:wt(ZSe),listFocusOutline:wt(H$e),listActiveSelectionBackground:wt(Wy),listActiveSelectionForeground:wt(QT),listActiveSelectionIconForeground:wt(dgt),listFocusAndSelectionOutline:wt(_Gi),listFocusAndSelectionBackground:wt(Wy),listFocusAndSelectionForeground:wt(QT),listInactiveSelectionBackground:wt(xf),listInactiveSelectionIconForeground:wt(DGi),listInactiveSelectionForeground:wt(ugt),listInactiveFocusBackground:wt(pgt),listInactiveFocusOutline:wt(LGi),listHoverBackground:wt(Xk),listHoverForeground:wt(eIe),listDropOverBackground:wt(mgt),listDropBetweenBackground:wt(RGi),listSelectionOutline:wt(qs),listHoverOutline:wt(qs),treeIndentGuidesStroke:wt(tIe),treeInactiveIndentGuidesStroke:wt(BGi),treeStickyScrollBackground:void 0,treeStickyScrollBorder:void 0,treeStickyScrollShadow:wt(PU),tableColumnsBorder:wt(HGi),tableOddRowsBackgroundColor:wt(U$e)};function GI(a){return sii(a,n7)}var pE={selectBackground:wt(FU),selectListBackground:wt(qGi),selectForeground:wt(Ose),decoratorRightForeground:wt(Igt),selectBorder:wt(PN),focusBorder:wt(Ad),listFocusBackground:wt(VU),listInactiveSelectionIconForeground:wt(aIe),listFocusForeground:wt(WU),listFocusOutline:Ese(qs,Oe.transparent.toString()),listHoverBackground:wt(Xk),listHoverForeground:wt(eIe),listHoverOutline:wt(qs),selectListBorder:wt(DN),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 MSt(a){return sii(a,pE)}var PSt={shadowColor:wt(RN),borderColor:wt(s$i),foregroundColor:wt(a$i),backgroundColor:wt(l$i),selectionForegroundColor:wt(eIe),selectionBackgroundColor:wt(Xk),selectionBorderColor:wt(c$i),separatorColor:wt(d$i),scrollbarShadow:wt(PU),scrollbarSliderBackground:wt(o9),scrollbarSliderHoverBackground:wt(AU),scrollbarSliderActiveBackground:wt(NU)};var k4i=["#007acc","#005a9e","#0098ff","#4fc3f7","#64b5f6","#42a5f5"],Bje;function ASt(a){if(Bje)return;let i=a.getBoundingClientRect(),e=Me(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),Bje=t,{overlay:t,cx:i.width/2,cy:i.height/2}}function NSt(a){setTimeout(()=>{Bje&&(Bje.remove(),Bje=void 0)},a)}function OSt(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 a0o(a){let i=ASt(a);if(!i)return;let{overlay:e,cx:t,cy:o}=i,n=a.getBoundingClientRect();OSt(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=k4i[l%k4i.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"}),NSt(2e3)}function l0o(a,i){let e=ASt(a);if(!e)return;let{overlay:t,cx:o,cy:n}=e,r=a.getBoundingClientRect();OSt(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"}),NSt(2e3)}function c0o(a){let i=ASt(a);if(!i)return;let{overlay:e,cx:t,cy:o}=i,n=a.getBoundingClientRect();OSt(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"}),NSt(2e3)}function d0o(a){let i=ASt(a);if(!i)return;let{overlay:e,cx:t,cy:o}=i;OSt(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"})}NSt(2e3)}function E4i(a,i,e){switch(i){case 1:a0o(a);break;case 2:e&&l0o(a,e);break;case 3:c0o(a);break;case 4:d0o(a);break}}var owe={WIDTH:400,WIDTH_WITH_VERTICAL_PANEL:600,HEIGHT:270};function T4i(a){return typeof a.parentId=="number"}function nwe(a){return!!a.workspaceUri}function _4i(a){return!!a.folderUri}function D4i(a){return!!a.fileUri}function HS(a,i){if(Gt)return!1;let e=eO(a,i),t=a.getValue("window");return t?.menuStyle==="native"?!(!it&&!e):t?.menuStyle==="custom"?!1:e}function Mae(a,i){return Gt?!1:it?!0:HS(a,i)}function Hje(a){let i=a.getValue("window.menuBarVisibility");return i==="default"||i==="compact"&&Mae(a)||it&&kr?"classic":i}function rwe(a,i){return!0}function eO(a,i){return i||(i=v1(a)),i==="native"}function v1(a){if(Gt)return"custom";let i=a.getValue("window");if(i){if(it&&i.nativeTabs===!0||it&&i.nativeFullScreen===!1)return"native";let o=i.titleBarStyle;if(o==="native"||o==="custom")return o}return"custom"}function Uje(a){if(Gt||it||v1(a)==="native")return"native";let e=a.getValue("window")?.controlsStyle;return e==="custom"||e==="hidden"?e:"native"}var swe=35;function aii(a){if(Gt||eO(a))return!1;if(!it){let i=Uje(a);if(i==="custom"||i==="hidden")return!1}return!0}function L4i(a=0){return 1.2**a}var FSt={width:1024,height:768};function Ef(a,i){let e={primary:[],secondary:[]};return R4i(a,e,i),e}function Uc(a,i){let e=[];return R4i(a,e,i),e}function R4i(a,i,e){let t=bf.getInstance(),o=t.keyStatus.altKey||(ri||Wn)&&t.keyStatus.shiftKey;M4i(a,i,o,e?n=>n===e:n=>n==="navigation")}function hl(a,i,e,t){let o={primary:[],secondary:[]};return Dq(a,o,i,e,t),o}function Vm(a,i,e,t){let o=[];return Dq(a,o,i,e,t),o}function Dq(a,i,e,t,o){M4i(a,i,!1,typeof e=="string"?r=>r===e:e,t,o)}function M4i(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 li)):(p=s,p.length>0&&p.push(new li));for(let h of u){e&&(h=h instanceof Eo&&h.alt?h.alt:h);let g=p.push(h);h instanceof $l&&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 ml=class extends Lr{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=bf.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;E4i(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(1806,null,t,YN.modifierLabels[zo].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&&Jye(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=Ip(this._themeService.getColorTheme().type)?Na(n.dark):Na(n.light),o.classList.add("icon"),this._itemClassDispose.value=hn(Z(()=>{o.style.backgroundImage="",o.classList.remove("icon")}),this._themeService.onDidColorThemeChange(()=>{this.updateClass()}))}};ml=I([m(2,_e),m(3,Ne),m(4,X),m(5,De),m(6,ze),m(7,Bi)],ml);var WSt=class a extends ml{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(1805,null,this._action.label,e):this.label.textContent=d(1804,null,this._action.label,e)}}static _symbolPrintEnter(i){return i.getLabel()?.replace(/\benter\b/gi,"\u23CE").replace(/\bEscape\b/gi,"Esc")}},mE=class extends wp{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),So(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=Ip(this._themeService.getColorTheme().type)?Na(o.dark):Na(o.light))};n(),this._register(this._themeService.onDidColorThemeChange(()=>{n()}))}}};mE=I([m(2,_e),m(3,ze),m(4,De)],mE);var zje=class extends oc{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 P);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(ml,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 as)};this._dropdown=this._register(new wp(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 Eo&&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(ml,e,{keybinding:this._getDefaultActionKeybindingLabel(e)})),this._defaultAction.actionRunner=this._defaultActionDisposables.add(new class extends as{async runAction(t,o){await t.run(void 0)}}),this._container&&this._defaultAction.render(Sf(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(R(this._container,t)),this._register(j(t,re.KEY_DOWN,n=>{let r=new Ii(n);r.equals(17)&&(this._defaultAction.element.tabIndex=-1,this._dropdown.focus(),r.stopPropagation())}));let o=_(".dropdown-action-container");this._dropdown.render(R(this._container,o)),this._register(j(o,re.KEY_DOWN,n=>{let r=new Ii(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))}};zje=I([m(2,_e),m(3,Ne),m(4,ze),m(5,qt),m(6,F),m(7,le)],zje);var Kje=class extends h1{constructor(i,e,t){super(null,i,i.actions.map(o=>o.id===li.ID?jN:{text:o.label,isDisabled:!o.enabled}),0,e,pE,{ariaLabel:i.tooltip||i.label,optionsAsChildren:!0,useCustomDrawn:!HS(t)}),this.select(Math.max(0,i.actions.findIndex(o=>o.checked)))}render(i){super.render(i),i.style.borderColor=wt(PN)}runAction(i,e){let t=this.action.actions[e];t&&this.actionRunner.run(t)}};Kje=I([m(1,_n),m(2,B)],Kje);function Ca(a,i,e){return i instanceof Eo?a.createInstance(ml,i,e):i instanceof Cc?i.item.isSelection?a.createInstance(Kje,i):i.item.isSplitButton?a.createInstance(zje,i,{...e,togglePrimaryAction:typeof i.item.isSplitButton!="boolean"?i.item.isSplitButton.togglePrimaryAction:!1}):a.createInstance(mE,i,e):void 0}var awe=class{constructor(i,e,t){this._commandService=i;this._keybindingService=e;this._hiddenStates=new b1(t)}createMenu(i,e,t){return new lwe(i,this._hiddenStates,{emitEventsForSubmenuChanges:!1,eventDebounceDelay:50,...t},this._commandService,this._keybindingService,e)}getMenuActions(i,e,t){let o=new lwe(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 VSt(i,!1);return new Set([...e.structureContextKeys,...e.preconditionContextKeys,...e.toggledContextKeys])}resetHiddenStates(i){this._hiddenStates.reset(i)}};awe=I([m(0,ge),m(1,_e),m(2,le)],awe);var b1=class{constructor(i){this._storageService=i;this._disposables=new P;this._onDidChange=new E;this.onDidChange=this._onDidChange.event;this._ignoreChangeEvent=!1;this._hiddenByDefaultCache=new Map;try{let e=i.get(b1._key,0,"{}");this._data=JSON.parse(e)}catch{this._data=Object.create(null)}this._disposables.add(i.onDidChangeValue(0,b1._key,this._disposables)(()=>{if(!this._ignoreChangeEvent)try{let e=i.get(b1._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&&rUi(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(b1._key,i,0,0)}finally{this._ignoreChangeEvent=!1}}};b1=I([m(0,le)],b1);var VSt=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(fe.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),Kk(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&&(fe.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)}},Lq=class extends VSt{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=Kk(l);c&&this._hiddenStates.setDefaultState(this._id,l.command.id,!!l.isHiddenByDefault);let u=u0o(this._id,c?l.command:l,this._hiddenStates);if(c){let p=Gje(this._commandService,this._keybindingService,l.command.id,l.when);(s??=[]).push(new Eo(l.command,l.alt,e,u,p,this._contextKeyService,this._commandService))}else{let p=new Lq(l.submenu,this._hiddenStates,this._collectContextKeysForSubmenus,this._commandService,this._keybindingService,this._contextKeyService).createActionGroups(e),h=li.join(...p.map(g=>g[1]));h.length>0&&(s??=[]).push(new Cc(l,u,h))}}s&&s.length>0&&t.push([n,s])}return t}_sort(e){return e.sort(Lq._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:Lq._compareTitles(Kk(e)?e.command.title:e.title,Kk(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)}};Lq=I([m(3,ge),m(4,_e),m(5,X)],Lq);var lwe=class{constructor(i,e,t,o,n,r){this._disposables=new P;this._menuInfo=new Lq(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(fe.onDidChangeMenu(p=>{for(let h of this._menuInfo.allMenuIds)if(p.has(h)){s.schedule();break}}));let l=this._disposables.add(new P),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 gbe({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()}};lwe=I([m(3,ge),m(4,_e),m(5,X)],lwe);function u0o(a,i,e){let t=Zzi(i)?i.submenu.id:i.id,o=typeof i.title=="string"?i.title:i.title.value,n=pi({id:`hide/${a.id}/${t}`,label:d(1811,null,o),run(){e.updateHidden(a,t,!0)}}),r=pi({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 Gje(a,i,e,t=void 0,o=!0){return pi({id:`configureKeybinding/${e}`,label:d(1810,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 Yy=ae("IActionViewItemService");var lii=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}`}};we(Yy,lii,1);var Ol=class extends Ju{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 P);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 Eo)&&!(h instanceof Cc)||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=Dut(new Set(this._options.overflowBehavior.exempted),ht.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))}}ZG(n),ZG(c),super.setActions(li.clean(n),li.join(c,r)),(s.length>0||n.length>0)&&this._sessionDisposables.add(j(this.getElement(),"contextmenu",p=>{let h=new yn(Me(this.getElement()),p),g=this.getItemAction(h.target);if(!g)return;h.preventDefault(),h.stopPropagation();let f=[];if(g instanceof Eo&&g.menuKeybinding)f.push(g.menuKeybinding);else if(!(g instanceof Cc||g instanceof Qye)){let b=!!this._keybindingService.lookupKeybinding(g.id);f.push(Gje(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]=pi({id:g.id,label:g.label,checked:!0,enabled:!1,run(){}});break}}if(!b&&(g instanceof Eo||g instanceof Cc)){if(!g.hideActions)return;f.push(g.hideActions.hide)}else f.push(pi({id:"label",label:d(1807,null),enabled:!1,run(){}}))}let v=li.join(f,s);this._options?.resetMenu&&!o&&(o=[this._options.resetMenu]),u&&o&&(v.push(new li),v.push(pi({id:"resetThisMenu",label:d(1808,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,qt),m(3,X),m(4,ze),m(5,_e),m(6,ge),m(7,Te)],Ol);var Ln=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 Cc?g.item.submenu.id:g.id);v||(v=o?.actionViewItemProvider);let b=v?.(g,f,h,Me(e).vscodeWindowId);return b||Ca(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}=hl(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 ni("This toolbar is populated from a menu.")}};Ln=I([m(3,qt),m(4,X),m(5,ze),m(6,_e),m(7,ge),m(8,Te),m(9,Yy),m(10,F)],Ln);var tt=ae("hoverService"),mv=class extends C{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 P);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=Ao(e.target)?[e.target]:e.target.targetElements;for(let s of n)this.hoverDisposables.add(Vo(s,"keydown",l=>{l.equals(9)&&this.hoverService.hideHover()}));let r=Ao(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())}};mv=I([m(3,B),m(4,tt)],mv);var US={showHover:function(){throw new Error("Native hover function not implemented.")},delay:0,showNativeHover:!0};var _L=class extends Q6{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 Zl(e-1,t)}};var cwe=class extends as{constructor(e){super();this._getContext=e}runAction(e,t){let o=this._getContext();return super.runAction(e,o)}};var BSt=class extends C{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=Nr("onDidChangeViewZones",this._editor.onDidChangeViewZones),this.editorOnDidContentSizeChange=Nr("onDidContentSizeChange",this._editor.onDidContentSizeChange),this.domNodeSizeChanged=Wc("domNodeSizeChanged"),this.views=this._register(new jt),this._domNode.className="gutter monaco-editor";let n=this._domNode.appendChild(bt("div.scroll-decoration",{role:"presentation",ariaHidden:"true",style:{width:"100%"}}).root),r=new ResizeObserver(()=>{Ui(s=>{this.domNodeSizeChanged.trigger(s)})});r.observe(this._domNode),this._register(Z(()=>r.disconnect())),this._register(he(s=>{n.className=this.isScrollTopZero.read(s)?"":"scroll-decoration"})),this._register(he(s=>this.render(s)))}dispose(){super.dispose(),Fi(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=di.ofStartAndLength(0,this._domNode.clientHeight);if(!r.isEmpty)for(let s of o){let l=new ro(s.startLineNumber,s.endLineNumber+1),c=this.itemProvider.getIntersectingGutterItems(l,e);Ui(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=Le("item",p),y=this.itemProvider.createView(S,b);h=new cii(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(di.ofStartAndLength(g,v),r)}})}for(let s of n)this.views.deleteAndDispose(s)}},cii=class{constructor(i,e,t){this.item=i;this.gutterItemView=e;this.domNode=t}dispose(){this.gutterItemView.dispose(),this.domNode.remove()}};var dii=[],HSt=35,dwe=class extends C{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=Ce(this,h=>this._options.renderSideBySide.read(h)&&this._hasActions.read(h)),this.width=Ce(this,h=>this._hasActions.read(h)?HSt:0),this.elements=bt("div.gutter@gutter",{style:{position:"absolute",height:"100%",width:HSt+"px"}},[]),this._currentDiff=Ce(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=Ce(this,h=>{let f=this._diffModel.read(h)?.diff.read(h);if(!f)return dii;let v=this._editors.modifiedSelections.read(h);if(v.every(w=>w.isEmpty()))return dii;let b=new PM(v.map(w=>ro.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)?dii:y}),this._register(q5i(e,this.elements.root)),this._register(j(this.elements.root,"click",()=>{this._editors.modified.focus()})),this._register(UM(this.elements.root,{display:this._hasActions.map(h=>h?"block":"none")})),RI(this,h=>this._showSash.read(h)?new qye(e,this._sashLayout.dimensions,this._options.enableSplitViewResizing,this._boundarySashes,y$(this,f=>this._sashLayout.sashLeft.read(f)-HSt,(f,v)=>this._sashLayout.sashLeft.set(f+HSt,v)),()=>this._sashLayout.resetSash()):void 0).recomputeInitiallyAndOnChange(this._store);let p=Ce(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=wf.fromRangeMappings(v.flatMap(y=>y.rangeMappings));return[new USt(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 USt(S.lineRangeMapping.withInnerChangesFromLineRanges(),S.lineRangeMapping===b?.lineRangeMapping,D.DiffEditorHunkToolbar,void 0,g.model.original.uri,g.model.modified.uri))});this._register(new BSt(this._editors.modified,this.elements.root,{getIntersectingGutterItems:(h,g)=>p.read(g),createView:(h,g)=>this._instantiationService.createInstance($je,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 _L(this._editors.modifiedModel.get()),n=new _L(this._editors.original.getModel());return new bp(t.map(l=>l.toTextEdit(o))).apply(n)}layout(e){this.elements.gutter.style.left=e+"px"}};dwe=I([m(6,F),m(7,X),m(8,qt)],dwe);var USt=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}},$je=class extends C{constructor(e,t,o,n){super();this._item=e;this._elements=bt("div.gutterItem",{style:{height:"20px",width:"34px"}},[bt("div.background@background",{},[]),bt("div.buttons@buttons",{},[])]),this._showAlways=this._item.map(this,s=>s.showAlways),this._menuId=this._item.map(this,s=>s.menuId),this._isSmall=Le(this,!1),this._lastItemRange=void 0,this._lastViewRange=void 0;let r=this._register(n.createInstance(mv,"element",{instantHover:!0},{position:{hoverPosition:1}}));this._register(wq(t,this._elements.root)),this._register(he(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(Ga((s,l)=>{this._elements.buttons.replaceChildren();let c=l.add(n.createInstance(Ln,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 cwe(()=>{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=di.tryCreate(r,t.endExclusive-r-o),c=di.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`}};$je=I([m(3,F)],$je);var tO=class extends C{constructor(e,t,o,n){super();this._editors=e;this._diffModel=t;this._options=o;this._instantiationService=n;this._modifiedOutlineSource=RI(this,e=>{let t=this._editors.modifiedModel.read(e),o=tO._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();Ui(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();Ui(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=Ce(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=Ce(this,k=>S.getHiddenOriginalRange(k).startLineNumber-1),w=new g1(y,12);p.push(w),c.store.add(new zSt(this._editors.original,w,S,!g))}{let y=Ce(this,k=>S.getHiddenModifiedRange(k).startLineNumber-1),w=new g1(y,12);h.push(w),c.store.add(new zSt(this._editors.modified,w,S))}}else{{let y=Ce(this,k=>S.getHiddenOriginalRange(k).startLineNumber-1),w=new g1(y,24);p.push(w),c.store.add(new KSt(this._editors.original,w,S,S.originalUnchangedRange,!g,u,k=>this._diffModel.get().ensureModifiedLineIsVisible(k,2,void 0),this._options))}{let y=Ce(this,k=>S.getHiddenModifiedRange(k).startLineNumber-1),w=new g1(y,24);h.push(w),c.store.add(new KSt(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 xe(void 0,{isTrusted:!0,supportThemeIcons:!0}).appendMarkdown(d(238,null)),glyphMarginClassName:"fold-unchanged "+q.asClassName(M.fold),zIndex:10001};this._register(Wye(this._editors.original,Ce(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 Ie(h.originalLineNumber,1)),options:l});return p}))),this._register(Wye(this._editors.modified,Ce(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:ro.ofLength(h.modifiedLineNumber,1).toInclusiveRange(),options:l});return p}))),this._register(he(c=>{let u=r.read(c);this._isUpdatingHiddenAreas=!0;try{this._editors.original.setHiddenAreas(u.map(p=>p.getHiddenOriginalRange(c).toInclusiveRange()).filter(mo)),this._editors.modified.setHiddenAreas(u.map(p=>p.getHiddenModifiedRange(c).toInclusiveRange()).filter(mo))}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=Le(this,()=>({dispose(){},getBreadcrumbItems(e,t){return[]},getAt:()=>[]}))}static setBreadcrumbsSourceFactory(e){this._breadcrumbsSourceFactory.set(e,void 0)}get isUpdatingHiddenAreas(){return this._isUpdatingHiddenAreas}};tO=I([m(3,F)],tO);var zSt=class extends xae{constructor(e,t,o,n=!1){let r=bt("div.diff-hidden-lines-widget");super(e,t,r.root);this._unchangedRegion=o;this._hide=n;this._nodes=bt("div.diff-hidden-lines-compact",[bt("div.line-left",[]),bt("div.text@text",[]),bt("div.line-right",[])]);r.root.appendChild(this._nodes.root),this._hide&&this._nodes.root.replaceChildren(),this._register(he(s=>{if(!this._hide){let l=this._unchangedRegion.getHiddenModifiedRange(s).length,c=d(239,null,l);this._nodes.text.innerText=c}}))}},KSt=class extends xae{constructor(e,t,o,n,r,s,l,c){let u=bt("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=bt("div.diff-hidden-lines",[bt("div.top@top",{title:d(237,null)}),bt("div.center@content",{style:{display:"flex"}},[bt("div@first",{style:{display:"flex",justifyContent:"center",alignItems:"center",flexShrink:"0"}},[_("a",{title:d(240,null),role:"button",onclick:()=>{this._unchangedRegion.showAll(void 0)}},...Bn("$(unfold)"))]),bt("div@others",{style:{display:"flex",justifyContent:"center",alignItems:"center"}})]),bt("div.bottom@bottom",{title:d(235,null),role:"button"})]);u.root.appendChild(this._nodes.root),this._hide?Fi(this._nodes.first):this._register(UM(this._nodes.first,{width:os(this._editor).layoutInfoContentLeft})),this._register(he(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=Me(this._nodes.top),S=j(b,"mousemove",w=>{let T=w.clientY-g;f=f||Math.abs(T)>2;let N=Math.round(T/p.getOption(75)),O=Math.max(0,Math.min(v+N,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=Me(this._nodes.bottom),S=j(b,"mousemove",w=>{let T=w.clientY-g;f=f||Math.abs(T)>2;let N=Math.round(T/p.getOption(75)),O=Math.max(0,Math.min(v-N,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 U=this._unchangedRegionRange.endLineNumberExclusive>p.getModel().getLineCount()?p.getContentHeight():p.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);p.setScrollTop(p.getScrollTop()+(U-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(he(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=sh.toIcon(k.kind),N=bt("div.breadcrumb-item",{style:{display:"flex",alignItems:"center"}},[Qo(T),"\xA0",k.name,...w===y.length-1?[]:[Qo(M.chevronRight)]]).root;g.push(N),N.onclick=()=>{this._revealModifiedHiddenLine(k.startLineNumber)}}}}Fi(this._nodes.others,...g)}))}};var uii=[],GSt=class extends C{constructor(e,t,o,n){super();this._editors=e;this._diffModel=t;this._options=o;this._widget=n;this._selectedDiffs=Ce(this,e=>{let o=this._diffModel.read(e)?.diff.read(e);if(!o)return uii;let n=this._editors.modifiedSelections.read(e);if(n.every(c=>c.isEmpty()))return uii;let r=new PM(n.map(c=>ro.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)?uii:l});this._register(Ga((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 $St(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 $St(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)}))}))}},$St=class a extends C{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=bt("div.revertButton",{title:this._revertSelection?d(246,null):d(245,null)},[Qo(M.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 NI?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 Hu=class extends xSt{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=bt("div.monaco-diff-editor.side-by-side",{style:{position:"relative",height:"100%"}},[bt("div.editor.original@original",{style:{position:"absolute",height:"100%"}}),bt("div.editor.modified@modified",{style:{position:"absolute",height:"100%"}}),bt("div.accessibleDiffViewer@accessibleDiffViewer",{style:{position:"absolute",height:"100%"}})]),this._diffModelSrc=this._register(X0(this,void 0)),this._diffModel=Ce(this,T=>this._diffModelSrc.read(T)?.object),this.onDidChangeModel=H.fromObservableLight(this._diffModel),this._contextKeyService=this._register(this._parentContextKeyService.createScoped(this._domElement)),this._instantiationService=this._register(this._parentInstantiationService.createChild(new Io([X,this._contextKeyService]))),this._boundarySashes=Le(this,void 0),this._accessibleDiffViewerShouldBeVisible=Le(this,!1),this._accessibleDiffViewerVisible=Ce(this,T=>this._options.onlyShowAccessibleDiffViewer.read(T)?!0:this._accessibleDiffViewerShouldBeVisible.read(T)),this._movedBlocksLinesPart=Le(this,void 0),this._layoutInfo=Ce(this,T=>{let N=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),U=this._gutter.read(T),G=U?.width.read(T)??0,$=this._overviewRulerPart.read(T)?.width??0,te,pe,de,se,Se;if(!!V){let Ee=V.sashLeft.read(T),He=this._movedBlocksLinesPart.read(T)?.width.read(T)??0;te=0,pe=Ee-G-He,Se=Ee-G,de=Ee,se=N-de-$}else{Se=0;let Ee=this._options.inlineViewHideOriginalLineNumbers.read(T);te=G,Ee?pe=0:pe=Math.max(5,this._editors.originalObs.layoutInfoDecorationsLeft.read(T)),de=G+pe,se=N-de-$}return this.elements.original.style.left=te+"px",this.elements.original.style.width=pe+"px",this._editors.original.layout({width:pe,height:O},!0),U?.layout(Se),this.elements.modified.style.left=de+"px",this.elements.modified.style.width=se+"px",this._editors.modified.layout({width:se,height:O},!0),{modifiedEditor:this._editors.modified.getLayoutInfo(),originalEditor:this._editors.original.getLayoutInfo()}}),this._diffValue=this._diffModel.map((T,N)=>T?.diff.read(N)),this.onDidUpdateDiff=H.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 Fye(this.elements.root,t.dimension)),this._rootSizeObserver.setAutomaticLayout(t.automaticLayout??!1),this._options=this._instantiationService.createInstance(Z9,t),this._register(he(T=>{this._options.setWidth(this._rootSizeObserver.width.read(T))})),this._contextKeyService.createKey(ue.isEmbeddedDiffEditor.key,!1),this._register(tc(ue.isEmbeddedDiffEditor,this._contextKeyService,T=>this._options.isInEmbeddedEditor.read(T))),this._register(tc(ue.comparingMovedCode,this._contextKeyService,T=>!!this._diffModel.read(T)?.movedTextToCompare.read(T))),this._register(tc(ue.diffEditorRenderSideBySideInlineBreakpointReached,this._contextKeyService,T=>this._options.couldShowInlineViewBecauseOfSize.read(T))),this._register(tc(ue.diffEditorInlineMode,this._contextKeyService,T=>!this._options.renderSideBySide.read(T))),this._register(tc(ue.hasChanges,this._contextKeyService,T=>(this._diffModel.read(T)?.diff.read(T)?.mappings.length??0)>0)),this._editors=this._register(this._instantiationService.createInstance(Gye,this.elements.original,this.elements.modified,this._options,o,(T,N,O,V)=>this._createInnerEditor(T,N,O,V))),this._register(tc(ue.diffEditorOriginalWritable,this._contextKeyService,T=>this._options.originalEditable.read(T))),this._register(tc(ue.diffEditorModifiedWritable,this._contextKeyService,T=>!this._options.readOnly.read(T))),this._register(tc(ue.diffEditorOriginalUri,this._contextKeyService,T=>this._diffModel.read(T)?.model.original.uri.toString()??"")),this._register(tc(ue.diffEditorModifiedUri,this._contextKeyService,T=>this._diffModel.read(T)?.model.modified.uri.toString()??"")),this._overviewRulerPart=RI(this,T=>this._options.renderOverviewRuler.read(T)?this._instantiationService.createInstance(Cx(zI,T),this._editors,this.elements.root,this._diffModel,this._rootSizeObserver.width,this._rootSizeObserver.height,this._layoutInfo.map(N=>N.modifiedEditor)):void 0).recomputeInitiallyAndOnChange(this._store);let u={height:this._rootSizeObserver.height,width:this._rootSizeObserver.width.map((T,N)=>T-(this._overviewRulerPart.read(N)?.width??0))};this._sashLayout=new CSt(this._options,u),this._sash=RI(this,T=>{let N=this._options.renderSideBySide.read(T);return this.elements.root.classList.toggle("side-by-side",N),N?new qye(this.elements.root,u,this._options.enableSplitViewResizing,this._boundarySashes,this._sashLayout.sashLeft,()=>this._sashLayout.resetSash()):void 0}).recomputeInitiallyAndOnChange(this._store);let p=RI(this,T=>this._instantiationService.createInstance(Cx(tO,T),this._editors,this._diffModel,this._options)).recomputeInitiallyAndOnChange(this._store);RI(this,T=>this._instantiationService.createInstance(Cx(wSt,T),this._editors,this._diffModel,this._options,this)).recomputeInitiallyAndOnChange(this._store);let h=new Set,g=new Set,f=!1,v=RI(this,T=>this._instantiationService.createInstance(Cx(Kye,T),Me(this._domElement),this._editors,this._diffModel,this._options,this,()=>f||p.read(void 0).isUpdatingHiddenAreas,h,g)).recomputeInitiallyAndOnChange(this._store),b=Ce(this,T=>{let N=v.read(T).viewZones.read(T).orig,O=p.read(T).viewZones.read(T).origViewZones;return N.concat(O)}),S=Ce(this,T=>{let N=v.read(T).viewZones.read(T).mod,O=p.read(T).viewZones.read(T).modViewZones;return N.concat(O)});this._register(Vye(this._editors.original,b,T=>{f=T},h));let y;this._register(Vye(this._editors.modified,S,T=>{f=T,f?y=tC.capture(this._editors.modified):(y?.restore(this._editors.modified),y=void 0)},g)),this._accessibleDiffViewer=RI(this,T=>this._instantiationService.createInstance(Cx(QN,T),this.elements.accessibleDiffViewer,this._accessibleDiffViewerVisible,(N,O)=>this._accessibleDiffViewerShouldBeVisible.set(N,O),this._options.onlyShowAccessibleDiffViewer.map(N=>!N),this._rootSizeObserver.width,this._rootSizeObserver.height,this._diffModel.map((N,O)=>N?.diff.read(O)?.mappings.map(V=>V.lineRangeMapping)),new bSt(this._editors))).recomputeInitiallyAndOnChange(this._store);let w=this._accessibleDiffViewerVisible.map(T=>T?"hidden":"visible");this._register(UM(this.elements.modified,{visibility:w})),this._register(UM(this.elements.original,{visibility:w})),this._createDiffEditorContributions(),this._codeEditorService.addDiffEditor(this),this._register(Z(()=>{this._codeEditorService.removeDiffEditor(this)})),this._gutter=RI(this,T=>this._options.shouldRenderGutterMenu.read(T)?this._instantiationService.createInstance(Cx(dwe,T),this.elements.root,this._diffModel,this._editors,this._options,this._sashLayout,this._boundarySashes):void 0),this._register(EM(this._layoutInfo)),RI(this,T=>new(Cx(J9,T))(this.elements.root,this._diffModel,this._layoutInfo.map(N=>N.originalEditor),this._layoutInfo.map(N=>N.modifiedEditor),this._editors)).recomputeInitiallyAndOnChange(this._store,T=>{this._movedBlocksLinesPart.set(T,void 0)}),this._register(H.runAndSubscribe(this._editors.modified.onDidChangeCursorPosition,T=>this._handleCursorPositionChange(T,!0))),this._register(H.runAndSubscribe(this._editors.original.onDidChangeCursorPosition,T=>this._handleCursorPositionChange(T,!1)));let k=this._diffModel.map(this,(T,N)=>{if(T)return T.diff.read(N)===void 0&&!T.isDiffUpToDate.read(N)});this._register(Ga((T,N)=>{if(k.read(T)===!0){let O=this._editorProgressService.show(!0,1e3);N.add(Z(()=>O.done()))}})),this._register(Ga((T,N)=>{N.add(new(Cx(GSt,T))(this._editors,this._diffModel,this._options,this))})),this._register(Ga((T,N)=>{let O=this._diffModel.read(T);if(O)for(let V of[O.model.original,O.model.modified])N.add(V.onWillDispose(U=>{mt(new ni("TextModel got disposed before DiffEditorWidget model got reset")),this.setModel(null)}))})),this._register(he(T=>{this._options.setModel(this._diffModel.read(T))}))}static{this.ENTIRE_DIFF_OVERVIEW_WIDTH=zI.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(jr,t,o,n)}_createDiffEditorContributions(){let e=aa.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 P$.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(Y9,e,this._options)}getModel(){return this._diffModel.get()?.model??null}setModel(e){let t=e?"model"in e?CW.create(e).createNewRef(this):CW.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&&dN(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?pii(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=ro.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 Ie(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=ju(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=Bti(r.getStartPosition(),s),c=Bti(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&&Ui(t=>{for(let o of e)o.collapseAll(t)})}showAllUnchangedRegions(){let e=this._diffModel.get()?.unchangedRegions.get();e&&Ui(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"})}}};Hu=I([m(3,X),m(4,F),m(5,Kt),m(6,tr),m(7,rd)],Hu);function pii(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 qSt=class extends K{constructor(){super({id:"diffEditor.toggleCollapseUnchangedRegions",title:L(205,"Toggle Collapse Unchanged Regions"),icon:M.map,toggled:x.has("config.diffEditor.hideUnchangedRegions.enabled"),precondition:x.has("isInDiffEditor"),menu:{when:x.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)}},qje=class extends K{constructor(){super({id:"diffEditor.toggleShowMovedCodeBlocks",title:L(206,"Toggle Show Moved Code Blocks"),precondition:x.has("isInDiffEditor")})}run(i,...e){let t=i.get(B),o=!t.getValue("diffEditor.experimental.showMoves");t.updateValue("diffEditor.experimental.showMoves",o)}},jje=class extends K{constructor(){super({id:"diffEditor.toggleUseInlineViewWhenSpaceIsLimited",title:L(207,"Toggle Use Inline View When Space Is Limited"),precondition:x.has("isInDiffEditor")})}run(i,...e){let t=i.get(B),o=!t.getValue("diffEditor.useInlineViewWhenSpaceIsLimited");t.updateValue("diffEditor.useInlineViewWhenSpaceIsLimited",o)}},Qje=L(198,"Diff Editor"),jSt=class extends wl{constructor(){super({id:"diffEditor.switchSide",title:L(204,"Switch Side"),icon:M.arrowSwap,precondition:x.has("isInDiffEditor"),f1:!0,category:Qje})}runEditorCommand(i,e,t){let o=Aae(i);if(o instanceof Hu){if(t&&t.dryRun)return{destinationSelection:o.mapToOtherSide().destinationSelection};o.switchSide()}}},QSt=class extends wl{constructor(){super({id:"diffEditor.exitCompareMove",title:L(201,"Exit Compare Move"),icon:M.close,precondition:ue.comparingMovedCode,f1:!1,category:Qje,keybinding:{weight:1e4,primary:9}})}runEditorCommand(i,e,...t){let o=Aae(i);o instanceof Hu&&o.exitCompareMove()}},YSt=class extends wl{constructor(){super({id:"diffEditor.collapseAllUnchangedRegions",title:L(197,"Collapse All Unchanged Regions"),icon:M.fold,precondition:x.has("isInDiffEditor"),f1:!0,category:Qje})}runEditorCommand(i,e,...t){let o=Aae(i);o instanceof Hu&&o.collapseAllUnchangedRegions()}},XSt=class extends wl{constructor(){super({id:"diffEditor.showAllUnchangedRegions",title:L(203,"Show All Unchanged Regions"),icon:M.unfold,precondition:x.has("isInDiffEditor"),f1:!0,category:Qje})}runEditorCommand(i,e,...t){let o=Aae(i);o instanceof Hu&&o.showAllUnchangedRegions()}},uwe=class extends K{constructor(){super({id:"diffEditor.revert",title:L(202,"Revert"),f1:!0,category:Qje,precondition:x.has("isInDiffEditor")})}run(i,e){return e?this.runViaToolbarContext(i,e):this.runViaCursorOrSelection(i)}runViaCursorOrSelection(i){let e=Aae(i);e instanceof Hu&&e.revertFocusedRangeMappings()}runViaToolbarContext(i,e){let t=p0o(i,e.originalUri,e.modifiedUri);t instanceof Hu&&t.revertRangeMappings(e.mapping.innerChanges??[])}},P4i=L(196,"Accessible Diff Viewer"),S1=class a extends K{static{this.id="editor.action.accessibleDiffViewer.next"}constructor(){super({id:a.id,title:L(199,"Go to Next Difference"),category:P4i,precondition:x.has("isInDiffEditor"),keybinding:{primary:65,weight:100},f1:!0})}run(i){Aae(i)?.accessibleDiffViewerNext()}},Pae=class a extends K{static{this.id="editor.action.accessibleDiffViewer.prev"}constructor(){super({id:a.id,title:L(200,"Go to Previous Difference"),category:P4i,precondition:x.has("isInDiffEditor"),keybinding:{primary:1089,weight:100},f1:!0})}run(i){Aae(i)?.accessibleDiffViewerPrev()}};function p0o(a,i,e){return a.get(Kt).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 Aae(a){let e=a.get(Kt).listDiffEditors(),t=Pn();if(t){for(let o of e)if(o.getContainerDomNode().contains(t))return o}return null}function JSt(a,i){if(!i.getOption(70))return null;let e=a.get(Kt);for(let t of e.listDiffEditors()){let o=t.getOriginalEditor(),n=t.getModifiedEditor();if(o===i||n===i)return t}return null}W(qSt);W(qje);W(jje);fe.appendMenuItem(D.EditorTitle,{command:{id:new jje().desc.id,title:d(234,null),toggled:x.has("config.diffEditor.useInlineViewWhenSpaceIsLimited"),precondition:x.has("isInDiffEditor")},order:11,group:"1_diff",when:x.and(ue.diffEditorRenderSideBySideInlineBreakpointReached,x.has("isInDiffEditor"))});fe.appendMenuItem(D.EditorTitle,{command:{id:new qje().desc.id,title:d(233,null),icon:M.move,toggled:eW.create("config.diffEditor.experimental.showMoves",!0),precondition:x.has("isInDiffEditor")},order:10,group:"1_diff",when:x.has("isInDiffEditor")});W(uwe);for(let a of[{icon:M.arrowRight,key:ue.diffEditorInlineMode.toNegated()},{icon:M.discard,key:ue.diffEditorInlineMode}])fe.appendMenuItem(D.DiffEditorHunkToolbar,{command:{id:new uwe().desc.id,title:d(231,null),icon:a.icon},when:x.and(ue.diffEditorModifiedWritable,a.key),order:5,group:"primary"}),fe.appendMenuItem(D.DiffEditorSelectionToolbar,{command:{id:new uwe().desc.id,title:d(232,null),icon:a.icon},when:x.and(ue.diffEditorModifiedWritable,a.key),order:5,group:"primary"});W(jSt);W(QSt);W(YSt);W(XSt);fe.appendMenuItem(D.EditorTitle,{command:{id:S1.id,title:d(230,null),precondition:x.has("isInDiffEditor")},order:10,group:"2_diff",when:x.and(ue.accessibleDiffViewerVisible.negate(),x.has("isInDiffEditor"))});qe.registerCommandAlias("editor.action.diffReview.next",S1.id);W(S1);qe.registerCommandAlias("editor.action.diffReview.prev",Pae.id);W(Pae);var ZSt=new Q("selectionAnchorSet",!1),iO=class{constructor(i,e){this.editor=i;this.selectionAnchorSetContextKey=ZSt.bindTo(e),this.modelChangeListener=i.onDidChangeModel(()=>this.selectionAnchorSetContextKey.reset())}static{this.ID="editor.contrib.selectionAnchorController"}static get(i){return i.getContribution(iO.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(Yt.fromPositions(i,i),{description:"selection-anchor",stickiness:1,hoverMessage:new xe().appendText(d(965,null)),className:"selection-anchor"})}),this.selectionAnchorSetContextKey.set(!!this.decorationId),Jo(d(961,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(Yt.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()}};iO=I([m(1,X)],iO);var mii=class extends xi{constructor(){super({id:"editor.action.setSelectionAnchor",label:L(966,"Set Selection Anchor"),precondition:void 0,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,2080),weight:100}})}async run(i,e){iO.get(e)?.setSelectionAnchor()}},hii=class extends xi{constructor(){super({id:"editor.action.goToSelectionAnchor",label:L(963,"Go to Selection Anchor"),precondition:ZSt})}async run(i,e){iO.get(e)?.goToSelectionAnchor()}},gii=class extends xi{constructor(){super({id:"editor.action.selectFromAnchorToCursor",label:L(964,"Select from Anchor to Cursor"),precondition:ZSt,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,2089),weight:100}})}async run(i,e){iO.get(e)?.selectFromAnchorToCursor()}},fii=class extends xi{constructor(){super({id:"editor.action.cancelSelectionAnchor",label:L(962,"Cancel Selection Anchor"),precondition:ZSt,kbOpts:{kbExpr:ue.editorTextFocus,primary:9,weight:100}})}async run(i,e){iO.get(e)?.cancelSelectionAnchor()}};go(iO.ID,iO,4);Jt(mii);Jt(hii);Jt(gii);Jt(fii);var m0o=J("editorOverviewRuler.bracketMatchForeground","#A0A0A0",d(968,null)),vii=class extends xi{constructor(){super({id:"editor.action.jumpToBracket",label:L(969,"Go to Bracket"),precondition:void 0,kbOpts:{kbExpr:ue.editorTextFocus,primary:3165,weight:100}})}run(i,e){I1.get(e)?.jumpToBracket()}},bii=class extends xi{constructor(){super({id:"editor.action.selectToBracket",label:L(971,"Select to Bracket"),precondition:void 0,metadata:{description:L(972,"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),I1.get(e)?.selectToBracket(o)}},Sii=class extends xi{constructor(){super({id:"editor.action.removeBrackets",label:L(970,"Remove Brackets"),precondition:void 0,kbOpts:{kbExpr:ue.editorTextFocus,primary:2561,weight:100},canTriggerInlineEdits:!0})}run(i,e){I1.get(e)?.removeBrackets(this.id)}},Iii=class{constructor(i,e,t){this.position=i,this.brackets=e,this.options=t}},I1=class a extends C{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 Yt(r.lineNumber,r.column,r.lineNumber,r.column):new Yt(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 Yt(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=po.register({description:"bracket-match-overview",stickiness:1,className:"bracket-match",inlineClassName:"bracket-match-inline",overviewRuler:{color:Ss(m0o),position:2}})}static{this._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER=po.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(Ie.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 Iii(g,f,v)}}this._lastBracketsData=s,this._lastVersionId=t}};go(I1.ID,I1,1);Jt(bii);Jt(vii);Jt(Sii);fe.appendMenuItem(D.MenubarGoMenu,{group:"5_infile_nav",command:{id:"editor.action.jumpToBracket",title:d(967,null)},order:2});is((a,i)=>{let e=a.getColor(dqi);e&&i.addRule(`.monaco-editor .bracket-match-inline { color: ${e} !important; }`)});var eIt=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 Yt(this._selection.startLineNumber,this._selection.startColumn-1,this._selection.endLineNumber,this._selection.endColumn-1):new Yt(this._selection.startLineNumber,this._selection.startColumn+1,this._selection.endLineNumber,this._selection.endColumn+1)}};var tIt=class extends xi{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 eIt(n,this.left));e.pushUndoStop(),e.executeCommands(this.id,t),e.pushUndoStop()}},yii=class extends tIt{constructor(){super(!0,{id:"editor.action.moveCarretLeftAction",label:L(973,"Move Selected Text Left"),precondition:ue.writable})}},wii=class extends tIt{constructor(){super(!1,{id:"editor.action.moveCarretRightAction",label:L(974,"Move Selected Text Right"),precondition:ue.writable})}};Jt(yii);Jt(wii);var Cii=class extends xi{constructor(){super({id:"editor.action.transposeLetters",label:L(975,"Transpose Letters"),precondition:ue.writable,kbOpts:{kbExpr:ue.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():pu.rightPosition(t,r.getPosition().lineNumber,r.getPosition().column),p=pu.leftPosition(t,u),h=pu.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 Wh(v,f+g))}o.length>0&&(e.pushUndoStop(),e.executeCommands(this.id,o),e.pushUndoStop())}};Jt(Cii);var Is=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))}};var A4i={ctrlCmd:!1,alt:!1};var Yje=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===Y.file?i.resource.fsPath:i.resource?.path}},r7=new Yje,Ge=ae("quickInputService");var ma=ae("IWorkspaceEditService"),s7=class{constructor(i){this.metadata=i}static convert(i){return i.edits.map(e=>{if(ja.is(e))return ja.lift(e);if(tu.is(e))return tu.lift(e);throw new Error("Unsupported edit")})}},ja=class a extends s7{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:yi(e)&&A.isUri(e.resource)&&yi(e.textEdit)}static lift(e){return e instanceof a?e:new a(e.resource,e.textEdit,e.versionId,e.metadata)}},tu=class a extends s7{constructor(e,t,o={},n){super(n);this.oldResource=e;this.newResource=t;this.options=o}static is(e){return e instanceof a?!0:yi(e)&&(!!e.newResource||!!e.oldResource)}static lift(e){return e instanceof a?e:new a(e.oldResource,e.newResource,e.options,e.metadata)}};var xii=ae("IEditorCancelService"),N4i=new Q("cancellableOperation",!1,d(1094,null));we(xii,class{constructor(){this._tokens=new WeakMap}add(a,i){let e=this._tokens.get(a);e||(e=a.invokeWithinContext(o=>{let n=N4i.bindTo(o.get(X)),r=new Vs;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 iIt=class extends $e{constructor(e,t){super(t);this.editor=e;this._unregister=e.invokeWithinContext(o=>o.get(xii).add(e,this))}dispose(){this._unregister(),super.dispose()}};qi(new class extends xc{constructor(){super({id:"editor.cancelOperation",kbOpts:{weight:100,primary:9},precondition:N4i})}runEditorCommand(a,i){a.get(xii).cancel(i)}});var y1=class a{constructor(i,e){if(this.flags=e,(this.flags&1)!==0){let t=i.getModel();this.modelVersionId=t?id("{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))}},Ex=class extends iIt{constructor(e,t,o,n){super(e,n);this._listener=new P;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()}},Nae=class extends $e{constructor(i,e){super(e),this._listener=i.onDidChangeContent(()=>this.cancel())}dispose(){this._listener.dispose(),super.dispose()}};var h0o=po.register({description:"inline-progress-widget",stickiness:1,showIfCollapsed:!0,after:{content:rN,inlineClassName:"inline-editor-progress-decoration",inlineClassNameAffectsLetterSpacing:!0}}),kii=class a extends C{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(M.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)}},a7=class extends C{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=nn(()=>{let l=z.fromPositions(e);this._currentDecorations.set([{range:l,options:h0o}]).length>0&&(this._currentWidget.value=this._instantiationService.createInstance(kii,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()}};a7=I([m(2,F)],a7);var Qn=ae("markdownRendererService"),Xje=class{constructor(i){this._openerService=i}render(i,e,t){let o={...e};o.actionHandler||(o.actionHandler=(r,s)=>zM(this._openerService,r,s.isTrusted)),o.codeBlockRenderer||(o.codeBlockRenderer=(r,s)=>this._defaultCodeBlockRenderer?.renderCodeBlock(r,s,o??{})??Promise.resolve(document.createElement("span")));let n=nb(i,o,t);return n.element.classList.add("rendered-markdown"),n}setDefaultCodeBlockRenderer(i){this._defaultCodeBlockRenderer=i}};Xje=I([m(0,Qe)],Xje);async function zM(a,i,e,t){try{return await a.open(i,{fromUserGesture:!0,allowContributedOpeners:!0,allowCommands:g0o(e),skipValidation:t})}catch(o){return mt(o),!1}}function g0o(a){return a===!0?!0:a&&Array.isArray(a.enabledCommands)?a.enabledCommands:!1}we(Qn,Xje,1);var iu=class{constructor(i,e,t){this._openerService=t;this._messageWidget=new me;this._messageListeners=new P;this._mouseOverMessage=!1;this._editor=i,this._visible=iu.MESSAGE_VISIBLE.bindTo(e)}static{this.ID="editor.contrib.messageController"}static{this.MESSAGE_VISIBLE=new Q("messageVisible",!1,d(1445,null))}static get(i){return i.getContribution(iu.ID)}dispose(){this._messageListeners.dispose(),this._messageWidget.dispose(),this._visible.reset()}isVisible(){return this._visible.get()}showMessage(i,e){if(Jo(Mr(i)?i.value:i),this._visible.set(!0),this._messageWidget.clear(),this._messageListeners.clear(),Mr(i)){let o=this._messageListeners.add(nb(i,{actionHandler:(n,r)=>{this.closeMessage(),zM(this._openerService,n,r.isTrusted)}}));this._messageWidget.value=new Jje(this._editor,e,o.element)}else this._messageWidget.value=new Jje(this._editor,e,i);this._messageListeners.add(H.debounce(this._editor.onDidBlurEditorText,(o,n)=>n,0)(()=>{this._mouseOverMessage||this._messageWidget.value&&gs(Pn(),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(Jje.fadeOut(this._messageWidget.value))}};iu=I([m(1,X),m(2,Qe)],iu);var f0o=xc.bindToContribution(iu.get);qi(new f0o({id:"leaveEditorMessage",precondition:iu.MESSAGE_VISIBLE,handler:a=>a.closeMessage(),kbOpts:{weight:130,primary:9}}));var Jje=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)}};go(iu.ID,iu,4);var Zje=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(){}}}},Rq=class a extends Zje{constructor(){super(Is.Empty.append("text","plain"));this.id=a.id;this.dropMimeTypes=[Zn.text];this.pasteMimeTypes=[Zn.text]}static{this.id="text"}async getEdit(e,t){let o=e.get(Zn.text);if(!o||e.has(Zn.uriList))return;let n=await o.asString();return{handledMimeType:Zn.text,title:d(1088,null),insertText:n,kind:this.kind}}},oIt=class extends Zje{constructor(){super(Is.Empty.append("uri","path","absolute"));this.dropMimeTypes=[Zn.uriList];this.pasteMimeTypes=[Zn.uriList]}async getEdit(e,t){let o=await O4i(e);if(!o.length||t.isCancellationRequested)return;let n=0,r=o.map(({uri:l,originalText:c})=>l.scheme===Y.file?l.fsPath:(n++,c)).join(" "),s;return n>0?s=o.length>1?d(1086,null):d(1085,null):s=o.length>1?d(1082,null):d(1081,null),{handledMimeType:Zn.uriList,insertText:r,title:s,kind:this.kind}}},pwe=class extends Zje{constructor(e){super(Is.Empty.append("uri","path","relative"));this._workspaceContextService=e;this.dropMimeTypes=[Zn.uriList];this.pasteMimeTypes=[Zn.uriList]}async getEdit(e,t){let o=await O4i(e);if(!o.length||t.isCancellationRequested)return;let n=si(o.map(({uri:r})=>{let s=this._workspaceContextService.getWorkspaceFolder(r);return s?Fc(s.uri,r):void 0}));if(n.length)return{handledMimeType:Zn.uriList,insertText:n.join(" "),title:o.length>1?d(1084,null):d(1083,null),kind:this.kind}}};pwe=I([m(0,Pe)],pwe);var Eii=class{constructor(){this.kind=new Is("html");this.providedPasteEditKinds=[this.kind];this.copyMimeTypes=[];this.pasteMimeTypes=["text/html"];this._yieldTo=[{mimeType:Zn.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(1087,null),kind:this.kind}]}}};async function O4i(a){let i=a.get(Zn.uriList);if(!i)return[];let e=await i.asString(),t=[];for(let o of Uy.parse(e))try{t.push({uri:A.parse(o),originalText:o})}catch{}return t}var Oae={scheme:"*",hasAccessToAllModels:!0},mwe=class extends C{constructor(i,e){super(),this._register(i.documentDropEditProvider.register(Oae,new Rq)),this._register(i.documentDropEditProvider.register(Oae,new oIt)),this._register(i.documentDropEditProvider.register(Oae,new pwe(e)))}};mwe=I([m(0,zt),m(1,Pe)],mwe);var hwe=class extends C{constructor(i,e){super(),this._register(i.documentPasteEditProvider.register(Oae,new Rq)),this._register(i.documentPasteEditProvider.register(Oae,new oIt)),this._register(i.documentPasteEditProvider.register(Oae,new pwe(e))),this._register(i.documentPasteEditProvider.register(Oae,new Eii))}};hwe=I([m(0,zt),m(1,Pe)],hwe);var Tii=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}}},l7=class{constructor(){this._children=[]}appendChild(i){return i instanceof Qb&&this._children[this._children.length-1]instanceof Qb?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 gwe)return i;i=i.parent}}toString(){return this.children.reduce((i,e)=>i+e.toString(),"")}len(){return 0}},Qb=class a extends l7{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)}},nIt=class extends l7{},Tx=class a extends nIt{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 Fae?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}},Fae=class a extends l7{constructor(){super(...arguments);this.options=[]}appendChild(e){return e instanceof Qb&&(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}},_ii=class a extends l7{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 kW&&!!r.elseValue)&&(n=this._replace([])),n}_replace(e){let t="";for(let o of this._children)if(o instanceof kW){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}},kW=class a extends l7{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)}},Wae=class a extends nIt{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 Qb(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 F4i(a,i){let e=[...a];for(;e.length>0;){let t=e.shift();if(!i(t))break;e.unshift(...t.children)}}var gwe=class a extends l7{get placeholderInfo(){if(!this._placeholders){let i=[],e;this.walk(function(t){return t instanceof Tx&&(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 F4i([i],t=>(e+=t.len(),!0)),e}enclosingPlaceholders(i){let e=[],{parent:t}=i;for(;t;)t instanceof Tx&&e.push(t),t=t.parent;return e}resolveVariables(i){return this.walk(e=>(e instanceof Wae&&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){F4i(this.children,i)}},zh=class a{constructor(){this._scanner=new Tii;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 gwe;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 Tx&&(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 Tx(l.index);p.transform=l.transform;for(let h of u){let g=h.clone();p.appendChild(g),g instanceof Tx&&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 Tx(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 Qb(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 Tx(Number(e)):new Wae(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 Tx(Number(e));if(this._accept(1))for(;;){if(this._accept(4))return i.appendChild(n),!0;if(!this._parse(n))return i.appendChild(new Qb("${"+e+":")),n.children.forEach(i.appendChild,i),!0}else if(n.index>0&&this._accept(7)){let r=new Fae;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 Qb(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 Wae(e);if(this._accept(1))for(;;){if(this._accept(4))return i.appendChild(n),!0;if(!this._parse(n))return i.appendChild(new Qb("${"+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 _ii,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 Qb(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 kW(Number(o))),!0;if(!this._accept(1))return this._backTo(e),!1}else return i.appendChild(new kW(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 kW(Number(o),n)),!0)}else if(this._accept(11)){let n=this._until(4);if(n)return i.appendChild(new kW(Number(o),void 0,n,void 0)),!0}else if(this._accept(12)){let n=this._until(4);if(n)return i.appendChild(new kW(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 kW(Number(o),void 0,n,r)),!0}}else{let n=this._until(4);if(n)return i.appendChild(new kW(Number(o),void 0,void 0,n)),!0}return this._backTo(e),!1}_parseAnything(i){return this._token.type!==14?(i.appendChild(new Qb(this._scanner.tokenText(this._token))),this._accept(void 0),!0):!1}};function rIt(a,i,e){return(typeof e.insertText=="string"?e.insertText==="":e.insertText.snippet==="")?{edits:e.additionalEdit?.edits??[]}:{edits:[...i.map(t=>new ja(a,{range:t,text:typeof e.insertText=="string"?zh.escape(e.insertText)+"$0":e.insertText.snippet,insertAsSnippet:!0})),...e.additionalEdit?.edits??[]]}}function sIt(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 fwe={buttonBackground:"#0E639C",buttonHoverBackground:"#006BB3",buttonSeparator:Oe.white.toString(),buttonForeground:Oe.white.toString(),buttonBorder:void 0,buttonSecondaryBackground:void 0,buttonSecondaryForeground:void 0,buttonSecondaryHoverBackground:void 0,buttonSecondaryBorder:void 0},W4i=Object.freeze({allowedTags:{override:["b","i","u","code","span"]},allowedAttributes:{override:["class"]}}),V4i=Object.freeze({sanitizerConfig:{allowedAttributes:{override:["class"]}}}),Mi=class extends C{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(ws.addTarget(this._element)),[re.CLICK,Gn.Tap].forEach(s=>{this._register(j(this._element,s,l=>{if(!this.enabled){$t.stop(l);return}this._onDidClick.fire(l)}))}),this._register(j(this._element,re.KEY_DOWN,s=>{let l=new Ii(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&&$t.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(Vn(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 Bn(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||Mr(this._label)&&Mr(e)&&nje(this._label,e))return;this._element.classList.add("monaco-text-button");let t=this.options.supportShortLabel?this._labelElement:this._element;if(Mr(e)){let n=nb(e,V4i,document.createElement("span"));n.dispose();let r=n.element.querySelector("p")?.innerHTML;r?Iq(t,r,W4i):Fi(t)}else this.options.supportIcons?Fi(t,...this.getContentElements(e)):t.textContent=e;let o="";typeof this.options.title=="string"?o=this.options.title:this.options.title&&(o=qa(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?Fi(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(yp().setupManagedHover(this.options.hoverDelegate??Ni("element"),this._element,e)):this._hover&&this._hover.update(e)}focus(){this._element.focus()}hasFocus(){return sa(this._element)}},$I=class extends C{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(Gg())}),this.primaryButton=this._register(new Mi(this.element,t)),this._register(this.primaryButton.onDidClick(r=>this._onDidClick.fire(r))),this.action=pi({id:"primaryAction",label:qa(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 Mi(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=M.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()}},e5e=class{constructor(i,e){this.options=e;this._element=document.createElement("div"),this._element.classList.add("monaco-description-button"),this._button=new Mi(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?Fi(this._descriptionElement,...Bn(i)):this._descriptionElement.textContent=i}};var _x=class{constructor(i,e){this.container=i;this.options=e;this._buttons=[];this._buttonStore=new P}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 Mi(this.container,i));return this.pushButton(e),e}addButtonWithDescription(i){let e=this._buttonStore.add(new e5e(this.container,i));return this.pushButton(e),e}addButtonWithDropdown(i){let e=this._buttonStore.add(new $I(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 Ii(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(),$t.stop(t,!0))}))}},oO=class extends Mi{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||Mr(this._label)&&Mr(i)&&nje(this._label,i))return;if(this._element.classList.add("monaco-text-button"),Mr(i)){let t=nb(i,V4i,document.createElement("span"));t.dispose();let o=t.element.querySelector("p")?.innerHTML;o?Iq(this._mdlabelElement,o,W4i):Fi(this._mdlabelElement)}else this.options.supportIcons?Fi(this._mdlabelElement,...this.getContentElements(i)):this._mdlabelElement.textContent=i;let e="";typeof this.options.title=="string"?e=this.options.title:this.options.title&&(e=qa(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 aIt=_,t5e={keybindingLabelBackground:void 0,keybindingLabelForeground:void 0,keybindingLabelBorder:void 0,keybindingLabelBottomBorder:void 0,keybindingLabelShadow:void 0},ah=class a extends C{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=R(e,aIt(".monaco-keybinding")),n&&(this.domNode.style.color=n),this.hover=this._register(yp().setupManagedHover(Ni("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++)R(this.domNode,aIt("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=YN.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){R(e,this.createKeyElement(t,o?".highlight":"")),n&&R(e,aIt("span.monaco-keybinding-key-separator",void 0,n))}renderUnbound(e){R(e,this.createKeyElement(d(25,null)))}createKeyElement(e,t=""){let o=aIt("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&&uo(e.firstPart,t.firstPart)&&uo(e.chordPart,t.chordPart)}};var nc=ae("layoutService");var Mii="acceptSelectedCodeAction",Pii="previewSelectedCodeAction";var Dii=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){}},Lii=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){}},i5e=class{constructor(i,e,t,o){this._supportsPreview=i;this._onRemoveItem=e;this._keybindingService=t;this._openerService=o}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 ah(i,zo),s=document.createElement("div");s.className="action-list-item-toolbar",i.append(s);let l=new P;return{container:i,icon:e,text:t,badge:o,description:n,keybinding:r,toolbar:s,elementDisposables:l}}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=wt(i.group.icon.color.id))):(t.icon.className=q.asClassName(M.lightBulb),t.icon.style.color="var(--vscode-editorLightBulb-foreground)"),!i.item||!i.label)return;if(mm(!i.hideIcon,t.icon),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=cIt(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=cIt(i.description);else{let s=nb(i.description,{actionHandler:l=>{this._openerService.open(A.parse(l),{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(Mii)?.getLabel(),n=this._keybindingService.lookupKeybinding(Pii)?.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(1818,null,o,n):t.container.title=d(1817,null,o):t.container.title="",Rt(t.toolbar);let r=[...i.toolbarActions??[]];if(i.onRemove&&r.push(pi({id:"actionList.remove",label:d(1814,null),class:q.asClassName(M.close),run:()=>{i.onRemove(),this._onRemoveItem?.(i)}})),t.container.classList.toggle("has-toolbar",r.length>0),r.length>0){let s=new ji(t.toolbar);t.elementDisposables.add(s),s.push(r,{icon:!0,label:!1})}}disposeTemplate(i){i.keybinding.dispose(),i.elementDisposables.dispose()}};i5e=I([m(2,_e),m(3,Qe)],i5e);var Rii=class extends UIEvent{constructor(){super("acceptSelectedAction")}},lIt=class extends UIEvent{constructor(){super("previewSelectedAction")}};function b0o(a){if(a.kind==="action")return a.label}var vwe=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this._delegate=n;this._options=s;this._anchor=l;this._contextViewService=c;this._keybindingService=u;this._layoutService=p;this._hoverService=h;this._openerService=g;this._headerLineHeight=24;this._separatorLineHeight=8;this.cts=this._register(new $e);this._hover=this._register(new me);this._collapsedSections=new Set;this._filterText="";this._suppressHover=!1;this._lastMinWidth=0;this._hasLaidOut=!1;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._options?.collapsedByDefault)for(let v of this._options.collapsedByDefault)this._collapsedSections.add(v);let f={getHeight:v=>{switch(v.kind){case"header":return this._headerLineHeight;case"separator":return this._separatorLineHeight;default:return this._actionLineHeight}},getTemplateId:v=>v.kind};this._list=this._register(new hc(e,this.domNode,f,[new i5e(t,v=>this._removeItem(v),this._keybindingService,this._openerService),new Dii,new Lii],{keyboardSupport:!1,typeNavigationEnabled:!this._options?.showFilter,keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:b0o},accessibilityProvider:{getAriaLabel:v=>{if(v.kind==="action"){let b=v.label?cIt(v?.label):"";if(v.description){let S=typeof v.description=="string"?v.description:v.description.value;b=b+", "+cIt(S)}return v.disabled&&(b=d(1816,null,b,v.disabled)),b}return null},getWidgetAriaLabel:()=>d(1815,null),getRole:v=>{switch(v.kind){case"action":return"option";case"separator":return"separator";default:return"separator"}},getWidgetRole:()=>"listbox",...r}})),this._list.style(n7),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",this._filterInput=document.createElement("input"),this._filterInput.type="text",this._filterInput.className="action-list-filter-input",this._filterInput.placeholder=this._options?.filterPlaceholder??d(1813,null),this._filterInput.setAttribute("aria-label",d(1812,null)),this._filterContainer.appendChild(this._filterInput),this._register(j(this._filterInput,"input",()=>{this._filterText=this._filterInput.value,this._applyFilter()}))),this._applyFilter(),this._list.length&&this._focusCheckedOrFirst(),this._filterInput&&this._register(j(this.domNode,"keydown",v=>{this._filterInput&&!sa(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())}))}get anchorPosition(){if(this._showAbove!==void 0)return this._showAbove?1:0}_toggleSection(e){this._collapsedSections.has(e)?this._collapsedSections.delete(e):this._collapsedSections.add(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?M.chevronRight:M.chevronDown}});continue}if(l.section&&this._collapsedSections.has(l.section))continue;o.push(l)}}let s=this._filterInput&&sa(this._filterInput);if(this._list.splice(0,this._list.length,o),this._hasLaidOut){if(this.layout(this._lastMinWidth),s)this._filterInput?.focus(),this._focusCheckedOrFirst();else if(this._list.domFocus(),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}}}this._contextViewService.layout()}}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()}_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._contextViewService.hideContextView()}clearFilter(){return this._filterInput&&this._filterText?(this._filterInput.value="",this._filterText="",this._applyFilter(),!0):!1}hasDynamicHeight(){return this._options?.showFilter?!0:this._allMenuItems.some(e=>e.isSectionToggle)}computeHeight(){let e=this._list.length,t=0;for(let p=0;p<e;p++)switch(this._list.element(p).kind){case"header":t+=this._headerLineHeight;break;case"separator":t+=this._separatorLineHeight;break;default:t+=this._actionLineHeight;break}let o=this._filterContainer?36:0,n=10,r=Me(this.domNode),s;if(this.hasDynamicHeight()){let p=r.innerHeight,h=yje(this._anchor),g=h.top-r.pageYOffset,f=p-g-h.height-n,v=g-n;if(this._showAbove===void 0){let b=o;for(let S of this._allMenuItems)switch(S.kind){case"header":b+=this._headerLineHeight;break;case"separator":b+=this._separatorLineHeight;break;default:b+=this._actionLineHeight;break}this._showAbove=b>f&&v>f}s=this._showAbove?v:f}else{let p=this._layoutService.getContainer(r).clientHeight,h=this.domNode.getBoundingClientRect().top;s=h>0?p-h-n:p*.7}let l=Math.floor(r.innerHeight*.4),c=Math.min(Math.max(s,this._actionLineHeight*3+o),l);return Math.min(t+o,c)-o}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(this._cachedMaxWidth!==void 0)return this._cachedMaxWidth;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)switch(h.kind){case"header":u+=this._headerLineHeight;break;case"separator":u+=this._separatorLineHeight;break;default:u+=this._actionLineHeight;break}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)}layout(e){this._hasLaidOut=!0,this._lastMinWidth=e;let t=this.computeHeight();return this._list.layout(t),this._cachedMaxWidth=this.computeMaxWidth(e),this._list.layout(t,this._cachedMaxWidth),this.domNode.style.height=`${t}px`,this._filterContainer&&this._filterContainer.parentElement&&this._filterContainer.parentElement.insertBefore(this._filterContainer,this.domNode),this._cachedMaxWidth}focusPrevious(){if(this._filterInput&&sa(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&&sa(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 lIt:new Rii;this._list.setSelection([o],r)}onListSelection(e){if(!e.elements.length)return;let t=e.elements[0];if(t.isSectionToggle){this._list.setSelection([]);return}t.item&&this.focusCondition(t)?this._delegate.onSelect(t.item,e.browserEvent instanceof lIt):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){let o;if(e.hover?.content){let n=this._getRowElement(t);if(n){let r=typeof e.hover.content=="string"?new xe(e.hover.content):e.hover.content;o=this._hoverService.showDelayedHover({content:r??"",target:n,additionalClasses:["action-widget-hover"],position:{hoverPosition:0,forcePosition:!1,...e.hover.position},appearance:{showPointer:!0}},{groupId:"actionListHover"})}}this._hover.value=o}async onListHover(e){let t=e.element;if(t&&t.item&&this.focusCondition(t)){if(Ao(e.browserEvent.target)&&e.browserEvent.target.closest(".action-list-item-toolbar")!==null){this._list.setFocus([]);return}if(this._list.setFocus(typeof e.index=="number"?[e.index]:[]),this._delegate.onHover&&!t.disabled&&t.kind==="action"){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){if(e.element&&e.element.isSectionToggle&&e.element.section){let t=e.element.section;queueMicrotask(()=>this._toggleSection(t));return}e.element&&this.focusCondition(e.element)&&this._list.setFocus([])}};vwe=I([m(7,_n),m(8,_e),m(9,nc),m(10,tt),m(11,Qe)],vwe);function cIt(a){return a.replace(/\r\n|\r|\n/g," ")}J("actionBar.toggledBackground",dW,d(1820,null));var hE={Visible:new Q("codeActionMenuVisible",!1,d(1823,null)),FilterFocused:new Q("codeActionMenuFilterFocused",!1,d(1822,null))},nl=ae("actionWidgetService"),KM=class extends C{constructor(e,t,o){super();this._contextViewService=e;this._contextKeyService=t;this._instantiationService=o;this._list=this._register(new me)}get isVisible(){return hE.Visible.getValue(this._contextKeyService)||!1}show(e,t,o,n,r,s,l,c,u){let p=hE.Visible.bindTo(this._contextKeyService),h=this._instantiationService.createInstance(vwe,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 P,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=hE.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(Vn(e));return r.add(f.onDidBlur(()=>{Pn()?.closest(".action-widget-hover")||this.hide(!0)})),r}_createActionBar(e,t){if(!t.length)return;let o=_(e),n=new ji(o);return n.push(t,{icon:!1,label:!0}),n}_onWidgetClosed(e){this._list.value?.hide(e)}};KM=I([m(0,_n),m(1,X),m(2,F)],KM);we(nl,KM,1);var Mq=1100;W(class extends K{constructor(){super({id:"hideCodeActionWidget",title:L(1826,"Hide action widget"),precondition:hE.Visible,keybinding:{weight:Mq,primary:9,secondary:[1033]}})}run(a){a.get(nl).hide(!0)}});W(class extends K{constructor(){super({id:"clearFilterCodeActionWidget",title:L(1821,"Clear action widget filter"),precondition:x.and(hE.Visible,hE.FilterFocused),keybinding:{weight:Mq+1,primary:9}})}run(a){let i=a.get(nl);i instanceof KM&&(i.clearFilter()||i.hide(!0))}});W(class extends K{constructor(){super({id:"selectPrevCodeAction",title:L(1829,"Select previous action"),precondition:hE.Visible,keybinding:{weight:Mq,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})}run(a){let i=a.get(nl);i instanceof KM&&i.focusPrevious()}});W(class extends K{constructor(){super({id:"selectNextCodeAction",title:L(1828,"Select next action"),precondition:hE.Visible,keybinding:{weight:Mq,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}})}run(a){let i=a.get(nl);i instanceof KM&&i.focusNext()}});W(class extends K{constructor(){super({id:"collapseSectionCodeAction",title:L(1824,"Collapse section"),precondition:x.and(hE.Visible,hE.FilterFocused.negate()),keybinding:{weight:Mq,primary:15}})}run(a){let i=a.get(nl);i instanceof KM&&i.collapseSection()}});W(class extends K{constructor(){super({id:"expandSectionCodeAction",title:L(1825,"Expand section"),precondition:x.and(hE.Visible,hE.FilterFocused.negate()),keybinding:{weight:Mq,primary:17}})}run(a){let i=a.get(nl);i instanceof KM&&i.expandSection()}});W(class extends K{constructor(){super({id:"toggleSectionCodeAction",title:L(1830,"Toggle section"),precondition:x.and(hE.Visible,hE.FilterFocused.negate()),keybinding:{weight:Mq,primary:10}})}run(a){let i=a.get(nl);i instanceof KM&&(i.toggleSection()||i.acceptSelected())}});W(class extends K{constructor(){super({id:Mii,title:L(1819,"Accept selected action"),precondition:hE.Visible,keybinding:{weight:Mq,primary:3,secondary:[2137]}})}run(a){let i=a.get(nl);i instanceof KM&&i.acceptSelected()}});W(class extends K{constructor(){super({id:Pii,title:L(1827,"Preview selected action"),precondition:hE.Visible,keybinding:{weight:Mq,primary:2051}})}run(a){let i=a.get(nl);i instanceof KM&&i.acceptSelected(!0)}});var Vae=class extends C{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(H.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 Mi(this.domNode,{supportIcons:!0})),this.button.label="$(insert)",this._register(j(this.domNode,re.CLICK,()=>this.showSelector()))}getId(){return Vae.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:this.range.getEndPosition(),preference:[2]}}showSelector(){let e=Yn(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?M.check.id:M.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)}};Vae=I([m(8,X),m(9,_e),m(10,nl)],Vae);var c7=class extends C{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(H.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)=>{so(y)||(this._notificationService.error(w),o&&this.show(e[0],t,c))},p=new Ex(this._editor,3,void 0,r),h;try{h=await pm(n(l,p.token),p.token)}catch(y){return u(y,d(1093,null,l.title,In(y)))}finally{p.dispose()}if(r.isCancellationRequested)return;let g=rIt(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(1092,null,l.title,In(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(Vae,this._id,this._editor,this._visibleContext,this._showCommand,e,t,o,this._getAdditionalActions()))}clear(){this._currentWidget.clear()}tryShowSelector(){this._currentWidget.value?.showSelector()}};c7=I([m(5,F),m(6,ma),m(7,Ne)],c7);var Nii="editor.changePasteType",o5e="editor.pasteAs.preferences",dIt=new Q("pasteWidgetVisible",!1,d(1078,null)),Aii="application/vnd.code.copymetadata",ou=class extends C{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 a7("pasteIntoEditor",e,t)),this._postPasteWidgetManager=this._register(t.createInstance(c7,"pasteIntoEditor",e,dIt,{id:Nii,label:d(1079,null)},()=>ou._configureDefaultAction?[ou._configureDefaultAction]:[]))}static{this.ID="editor.contrib.copyPasteActionController"}static get(e){return e.getContribution(ou.ID)}static setConfigureDefaultAction(e){ou._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 bx,c=s.flatMap(h=>h.copyMimeTypes??[]),u=_t();this.setCopyMetadata(e.clipboardData,{id:u,providerCopyMimeTypes:c,defaultPastePayload:r});let p=s.map(h=>({providerMimeTypes:h.copyMimeTypes,operation:xn(g=>h.prepareDocumentPaste(t,e.dataToCopy.sourceRanges,l,g).catch(f=>{console.error(f)}))}));ou._currentCopyOperation?.operations.forEach(h=>h.operation.cancel()),ou._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(Aii),iu.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??[],Zn.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=>Y$e(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(1072,null):t.providerId;iu.get(this._editor)?.showMessage(d(1074,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 Ex(s,3,void 0),c=xn(async u=>{let p=this._editor;if(!p.hasModel())return;let h=p.getModel(),g=new P,f=g.add(new $e(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 Rq)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 Rq)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 N=k.provider.resolveDocumentPasteEdit(k,T),O=new Go,V=await this._pasteProgressManager.showWhile(t[0].getEndPosition(),d(1080,null,k.title),wa(Promise.race([O.p,N]),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(1077,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=xn(async l=>{let c=this._editor;if(!c.hasModel())return;let u=c.getModel(),p=new P,h=p.add(new Ex(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(1073,null),edit:void 0},w=await this._quickInputService.pick([...v.edits.map(k=>({label:k.title,description:k.kind?.value,edit:k})),...ou._configureDefaultAction?[{type:"separator"},{label:ou._configureDefaultAction.label,edit:void 0}]:[]],{placeHolder:d(1075,null)});if(w===y){ou._configureDefaultAction?.run();return}b=w?.edit}if(!b)return;let S=rIt(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(1076,null)},()=>s)}setCopyMetadata(e,t){this._logService.trace("CopyPasteController#setCopyMetadata new id : ",t.id),e.setData(Aii,JSON.stringify(t))}fetchCopyMetadata(e){this._logService.trace("CopyPasteController#fetchCopyMetadata");let t=e.clipboardData.getData(Aii);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&&ou._currentCopyOperation?.handle===o.id){let r=ou._currentCopyOperation.operations.filter(l=>e.some(c=>c.pasteMimeTypes.some(u=>Y$e(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(Zn.uriList)){let r=await this._clipboardService.readResources();if(n.isCancellationRequested)return;r.length&&t.append(Zn.uriList,NN(Uy.create(r)))}}async getPasteEdits(e,t,o,n,r,s){let l=new P,c=await wa(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){so(h)||console.error(h);return}})),s),u=si(c??[]).flat().filter(p=>!r.only||r.only.contains(p.kind));return{edits:sIt(u),dispose:()=>l.dispose()}}async applyDefaultPasteHandler(e,t,o,n){let s=await(e.get(Zn.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?t.preferences.some(o=>t.preferences.some(n=>n.contains(o))):e.id===t.providerId}getInitialActiveEditIndex(e,t){let o=this._configService.getValue(o5e,{resource:e.uri});for(let n of Array.isArray(o)?o:[]){let r=new Is(n),s=t.findIndex(l=>r.contains(l.kind));if(s>=0)return s}return 0}};ou=I([m(1,F),m(2,ne),m(3,ma),m(4,Wi),m(5,ge),m(6,B),m(7,zt),m(8,Ge),m(9,Bo)],ou);var Bae="9_cutcopypaste",I0o=kr||document.queryCommandSupported("cut"),H4i=kr||document.queryCommandSupported("copy"),y0o=typeof navigator.clipboard>"u"||yc?document.queryCommandSupported("paste"):!0;function Wii(a){return a.register(),a}var EW=I0o?Wii(new SN({id:"editor.action.clipboardCutAction",precondition:void 0,kbOpts:kr?{primary:2102,win:{primary:2102,secondary:[1044]},weight:100}:void 0,menuOpts:[{menuId:D.MenubarEditMenu,group:"2_ccp",title:d(982,null),order:1},{menuId:D.EditorContext,group:Bae,title:d(978,null),when:ue.writable,order:1},{menuId:D.CommandPalette,group:"",title:d(978,null),order:1},{menuId:D.SimpleEditorContext,group:Bae,title:d(978,null),when:ue.writable,order:1}]})):void 0,$M=H4i?Wii(new SN({id:"editor.action.clipboardCopyAction",precondition:void 0,kbOpts:kr?{primary:2081,win:{primary:2081,secondary:[2067]},weight:100}:void 0,menuOpts:[{menuId:D.MenubarEditMenu,group:"2_ccp",title:d(981,null),order:2},{menuId:D.EditorContext,group:Bae,title:d(976,null),order:2},{menuId:D.CommandPalette,group:"",title:d(976,null),order:1},{menuId:D.SimpleEditorContext,group:Bae,title:d(976,null),order:2}]})):void 0;fe.appendMenuItem(D.MenubarEditMenu,{submenu:D.MenubarCopy,title:L(980,"Copy As"),group:"2_ccp",order:3});fe.appendMenuItem(D.EditorContext,{submenu:D.EditorContextCopy,title:L(980,"Copy As"),group:Bae,order:3});fe.appendMenuItem(D.EditorContext,{submenu:D.EditorContextShare,title:L(984,"Share"),group:"11_share",order:-1,when:x.and(x.notEquals("resourceScheme","output"),ue.editorTextFocus)});fe.appendMenuItem(D.ExplorerContext,{submenu:D.ExplorerContextShare,title:L(984,"Share"),group:"11_share",order:-1});var GM=y0o?Wii(new SN({id:"editor.action.clipboardPasteAction",precondition:void 0,kbOpts:kr?{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(983,null),order:4},{menuId:D.EditorContext,group:Bae,title:d(979,null),when:ue.writable,order:4},{menuId:D.CommandPalette,group:"",title:d(979,null),order:1},{menuId:D.SimpleEditorContext,group:Bae,title:d(979,null),when:ue.writable,order:4}]})):void 0,Oii=class extends xi{constructor(){super({id:"editor.action.clipboardCopyWithSyntaxHighlightingAction",label:L(977,"Copy with Syntax Highlighting"),precondition:void 0,kbOpts:{kbExpr:ue.textInputFocus,primary:0,weight:100}})}run(i,e){let t=i.get(ne),o=i.get(Wi);t.trace("ExecCommandCopyWithSyntaxHighlightingAction#run"),!(!e.hasModel()||!e.getOption(45)&&e.getSelection().isEmpty())&&(zU.forceCopyWithSyntaxHighlighting=!0,e.focus(),t.trace("ExecCommandCopyWithSyntaxHighlightingAction (before execCommand copy)"),Fii(e,o),t.trace("ExecCommandCopyWithSyntaxHighlightingAction (after execCommand copy)"),zU.forceCopyWithSyntaxHighlighting=!1)}};function Fii(a,i){if(zU.electronBugWorkaroundCopyEventHasFired=!1,a.getContainerDomNode().ownerDocument.execCommand("copy"),kr&&zU.electronBugWorkaroundCopyEventHasFired===!1){let{dataToCopy:e}=H$i(a._getViewModel(),void 0,yc);i.writeText(e.text)}}function U4i(a,i){a&&(a.addImplementation(1e4,"code-editor",(e,t)=>{let o=e.get(ne),n=e.get(Wi);o.trace("registerExecCommandImpl (addImplementation code-editor for : ",i,")");let r=e.get(Kt).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"?(B4i(r),o.trace("registerExecCommandImpl (before execCommand copy)"),Fii(r,n),r.trigger(void 0,"cut",void 0),o.trace("registerExecCommandImpl (after execCommand copy)")):(B4i(r),o.trace("registerExecCommandImpl (before execCommand "+i+")"),i==="copy"?Fii(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(ne);return o.trace("registerExecCommandImpl (addImplementation generic-dom for : ",i,")"),o.trace("registerExecCommandImpl (before execCommand "+i+")"),rh().execCommand(i),o.trace("registerExecCommandImpl (after execCommand "+i+")"),!0}))}function B4i(a){if(a.getOption(170)){let e=iae.get(a.getId());e&&e.handleWillCopy()}}U4i(EW,"cut");U4i($M,"copy");GM&&(GM.addImplementation(1e4,"code-editor",(a,i)=>{let e=a.get(ne);e.trace("registerExecCommandImpl (addImplementation code-editor for : paste)");let t=a.get(Kt),o=a.get(Wi),n=t.getFocusedCodeEditor();if(n&&n.hasModel()&&n.hasTextFocus()){if(n.getOption(170)){let l=iae.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)"),ou.get(n)?.finishedPaste()??Promise.resolve()))):(e.trace("registerExecCommandImpl (triggerPaste undefined)"),Gt?(e.trace("registerExecCommandImpl (Paste handling on web)"),(async()=>{let l=await o.readText();if(l!==""){let c=S9.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}),GM.addImplementation(0,"generic-dom",(a,i)=>(a.get(ne).trace("registerExecCommandImpl (addImplementation generic-dom for : paste)"),a.get(Wi).triggerPaste(Ki().vscodeWindowId)??!1)));H4i&&Jt(Oii);var nC=Object.freeze({id:"editor",order:5,type:"object",title:d(269,null),scope:6}),bwe={...nC,properties:{"editor.tabSize":{type:"number",default:iv.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:iv.insertSpaces,markdownDescription:d(276,null,"`#editor.detectIndentation#`")},"editor.detectIndentation":{type:"boolean",default:iv.detectIndentation,markdownDescription:d(258,null,"`#editor.tabSize#`","`#editor.insertSpaces#`")},"editor.trimAutoWhitespace":{type:"boolean",default:iv.trimAutoWhitespace,description:d(298,null)},"editor.largeFileOptimizations":{type:"boolean",default:iv.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:jb.maxComputationTime,description:d(278,null)},"diffEditor.maxFileSize":{type:"number",default:jb.maxFileSize,description:d(279,null)},"diffEditor.renderSideBySide":{type:"boolean",default:jb.renderSideBySide,description:d(295,null)},"diffEditor.renderSideBySideInlineBreakpoint":{type:"number",default:jb.renderSideBySideInlineBreakpoint,description:d(284,null)},"diffEditor.useInlineViewWhenSpaceIsLimited":{type:"boolean",default:jb.useInlineViewWhenSpaceIsLimited,description:d(299,null)},"diffEditor.renderMarginRevertIcon":{type:"boolean",default:jb.renderMarginRevertIcon,description:d(283,null)},"diffEditor.renderGutterMenu":{type:"boolean",default:jb.renderGutterMenu,description:d(281,null)},"diffEditor.ignoreTrimWhitespace":{type:"boolean",default:jb.ignoreTrimWhitespace,description:d(274,null)},"diffEditor.renderIndicators":{type:"boolean",default:jb.renderIndicators,description:d(282,null)},"diffEditor.codeLens":{type:"boolean",default:jb.diffCodeLens,description:d(257,null)},"diffEditor.wordWrap":{type:"string",enum:["off","on","inherit"],default:jb.diffWordWrap,markdownEnumDescriptions:[d(308,null),d(309,null),d(307,null,"`#editor.wordWrap#`")]},"diffEditor.diffAlgorithm":{type:"string",enum:["legacy","advanced"],default:jb.diffAlgorithm,markdownEnumDescriptions:[d(260,null),d(259,null)]},"diffEditor.hideUnchangedRegions.enabled":{type:"boolean",default:jb.hideUnchangedRegions.enabled,markdownDescription:d(271,null)},"diffEditor.hideUnchangedRegions.revealLineCount":{type:"integer",default:jb.hideUnchangedRegions.revealLineCount,markdownDescription:d(273,null),minimum:1},"diffEditor.hideUnchangedRegions.minimumLineCount":{type:"integer",default:jb.hideUnchangedRegions.minimumLineCount,markdownDescription:d(272,null),minimum:1},"diffEditor.hideUnchangedRegions.contextLineCount":{type:"integer",default:jb.hideUnchangedRegions.contextLineCount,markdownDescription:d(270,null),minimum:1},"diffEditor.experimental.showMoves":{type:"boolean",default:jb.experimental.showMoves,markdownDescription:d(294,null)},"diffEditor.experimental.showEmptyDecorations":{type:"boolean",default:jb.experimental.showEmptyDecorations,description:d(293,null)},"diffEditor.experimental.useTrueInlineView":{type:"boolean",default:jb.experimental.useTrueInlineView,description:d(300,null)}}};function w0o(a){return typeof a.type<"u"||typeof a.anyOf<"u"}for(let a of hU){let i=a.schema;if(typeof i<"u")if(w0o(i))bwe.properties[`editor.${a.name}`]=i;else for(let e in i)Object.hasOwnProperty.call(i,e)&&(bwe.properties[e]=i[e])}var C0o=oe.as(ii.Configuration);C0o.registerConfiguration(bwe);async function z4i(a){let i=["editor.fontFamily"],e=await a();for(let t of i)bwe.properties&&bwe.properties[t]&&(bwe.properties[t].defaultSnippets=e)}var gr=new class{constructor(){this.QuickFix=new Is("quickfix");this.Refactor=new Is("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 Is("notebook");this.Source=new Is("source");this.SourceOrganizeImports=this.Source.append("organizeImports");this.SourceFixAll=this.Source.append("fixAll");this.SurroundWith=this.Refactor.append("surround")}};function K4i(a,i){return!(a.include&&!a.include.intersects(i)||a.excludes&&a.excludes.some(e=>$4i(i,e,a.include))||!a.includeSourceActions&&gr.Source.contains(i))}function G4i(a,i){let e=i.kind?new Is(i.kind):void 0;return!(a.include&&(!e||!a.include.contains(e))||a.excludes&&e&&a.excludes.some(t=>$4i(e,t,a.include))||!a.includeSourceActions&&e&&gr.Source.contains(e)||a.onlyIncludePreferredActions&&!i.isPreferred)}function $4i(a,i,e){return!(!i.contains(a)||e&&i.contains(e))}var d7=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 Is(i.kind):e}static getPreferredUser(i){return typeof i.preferred=="boolean"?i.preferred:!1}},uIt=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){ss(t)}e&&(this.action.edit=e.edit)}return this}};var Swe="editor.action.codeAction",w1="editor.action.quickFix",Iwe="editor.action.autoFix",ywe="editor.action.refactor";var wwe="editor.action.sourceAction",n5e="editor.action.organizeImports",r5e="editor.action.fixAll",x0o=1e3,Vii=class a extends C{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:dr(e.diagnostics)?dr(t.diagnostics)?a.codeActionsPreferredComparator(e,t):-1:dr(t.diagnostics)?1:a.codeActionsPreferredComparator(e,t)}get hasAutoFix(){return this.validActions.some(({action:e})=>!!e.kind&&gr.QuickFix.contains(new Is(e.kind))&&!!e.isPreferred)}get hasAIFix(){return this.validActions.some(({action:e})=>!!e.isAI)}get allAIFixes(){return this.validActions.every(({action:e})=>!!e.isAI)}},q4i={actions:[],documentation:void 0};async function DL(a,i,e,t,o,n){let r=t.filter||{},s={...r,excludes:[...r.excludes||[],gr.Notebook]},l={only:r.include?.value,trigger:t.type},c=new Nae(i,n),u=t.type===2,p=k0o(a,i,u?s:r),h=new P,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(),q4i;S&&h.add(S);let y=(S?.actions||[]).filter(k=>k&&G4i(r,k)),w=T0o(v,y,r.include);return{actions:y.map(k=>new uIt(k,v)),documentation:w}}catch(S){if(so(S))throw S;return ss(S),q4i}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=[...si(v.map(w=>w.documentation)),...E0o(a,i,t,b)],y=new Vii(b,S,h);return h.add(y),y}catch(v){throw h.dispose(),v}finally{f.dispose(),c.dispose()}}function k0o(a,i,e){return a.all(i).filter(t=>t.providedCodeActionKinds?t.providedCodeActionKinds.some(o=>K4i(e,new Is(o))):!0)}function*E0o(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 T0o(a,i,e){if(!a.documentation)return;let t=a.documentation.map(o=>({kind:new Is(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 Is(o.kind)))return n.command}}async function Nq(a,i,e,t,o=ve.None){let n=a.get(ma),r=a.get(ge),s=a.get(Te),l=a.get(Ne),c=a.get(tr);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:_c.codeAction({kind:i.action.kind,providerId:CU.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=_0o(u);l.error(typeof p=="string"?p:d(985,null))}setTimeout(()=>c.playSignal($o.codeActionApplied),x0o)}}function _0o(a){return typeof a=="string"?a:a instanceof Error&&typeof a.message=="string"?a.message:void 0}qe.registerCommand("_executeCodeActionProvider",async function(a,i,e,t,o){if(!(i instanceof A))throw Br();let{codeActionProvider:n}=a.get(zt),r=a.get(Ct).getModel(i);if(!r)throw Br();let s=Yt.isISelection(e)?Yt.liftSelection(e):z.isIRange(e)?r.validateRange(e):void 0;if(!s)throw Br();let l=typeof t=="string"?new Is(t):void 0,c=await DL(n,r,s,{type:1,triggerAction:"other (default)",filter:{includeSourceActions:!0,include:l}},bm.None,ve.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(ve.None));try{return await Promise.all(u),c.validActions.map(h=>h.action)}finally{setTimeout(()=>c.dispose(),100)}});var cl=(o=>(o[o.Hint=1]="Hint",o[o.Info=2]="Info",o[o.Warning=4]="Warning",o[o.Error=8]="Error",o))(cl||{});(s=>{function a(l,c){return c-l}s.compare=a;let i=Object.create(null);i[8]=d(2146,null),i[4]=d(2150,null),i[2]=d(2148,null);function e(l){return i[l]||""}s.toString=e;let t=Object.create(null);t[8]=d(2147,null),t[4]=d(2151,null),t[2]=d(2149,null);function o(l){return t[l]||""}s.toStringPlural=o;function n(l){switch(l){case gt.Error:return 8;case gt.Warning:return 4;case gt.Info:return 2;case gt.Ignore:return 1}}s.fromSeverity=n;function r(l){switch(l){case 8:return gt.Error;case 4:return gt.Warning;case 2:return gt.Info;case 1:return gt.Ignore}}s.toSeverity=r})(cl||={});var TW;(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(cl.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})(TW||={});var Ns=ae("markerService");var p7=class{constructor(i){this.keybindingService=i}static{this.codeActionCommands=[ywe,Swe,wwe,n5e,r5e]}getResolver(){let i=new co(()=>this.keybindingService.getKeybindings().filter(e=>p7.codeActionCommands.indexOf(e.command)>=0).filter(e=>e.resolvedKeybinding).map(e=>{let t=e.commandArgs;return e.command===n5e?t={kind:gr.SourceOrganizeImports.value}:e.command===r5e&&(t={kind:gr.SourceFixAll.value}),{resolvedKeybinding:e.resolvedKeybinding,...d7.fromUser(t,{kind:Is.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 Is(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)}};p7=I([m(0,_e)],p7);var vNr=J("symbolIcon.arrayForeground",ko,d(1652,null)),bNr=J("symbolIcon.booleanForeground",ko,d(1653,null)),SNr=J("symbolIcon.classForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},d(1654,null)),INr=J("symbolIcon.colorForeground",ko,d(1655,null)),yNr=J("symbolIcon.constantForeground",ko,d(1656,null)),wNr=J("symbolIcon.constructorForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},d(1657,null)),Bii=J("symbolIcon.enumeratorForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},d(1658,null)),Q4i=J("symbolIcon.enumeratorMemberForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(1659,null)),CNr=J("symbolIcon.eventForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},d(1660,null)),xNr=J("symbolIcon.fieldForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(1661,null)),_W=J("symbolIcon.fileForeground",ko,d(1662,null)),Hii=J("symbolIcon.folderForeground",ko,d(1663,null)),kNr=J("symbolIcon.functionForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},d(1664,null)),ENr=J("symbolIcon.interfaceForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(1665,null)),TNr=J("symbolIcon.keyForeground",ko,d(1666,null)),_Nr=J("symbolIcon.keywordForeground",ko,d(1667,null)),Uii=J("symbolIcon.methodForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},d(1668,null)),DNr=J("symbolIcon.moduleForeground",ko,d(1669,null)),LNr=J("symbolIcon.namespaceForeground",ko,d(1670,null)),RNr=J("symbolIcon.nullForeground",ko,d(1671,null)),MNr=J("symbolIcon.numberForeground",ko,d(1672,null)),PNr=J("symbolIcon.objectForeground",ko,d(1673,null)),ANr=J("symbolIcon.operatorForeground",ko,d(1674,null)),NNr=J("symbolIcon.packageForeground",ko,d(1675,null)),ONr=J("symbolIcon.propertyForeground",ko,d(1676,null)),FNr=J("symbolIcon.referenceForeground",ko,d(1677,null)),WNr=J("symbolIcon.snippetForeground",ko,d(1678,null)),VNr=J("symbolIcon.stringForeground",ko,d(1679,null)),BNr=J("symbolIcon.structForeground",ko,d(1680,null)),HNr=J("symbolIcon.textForeground",ko,d(1681,null)),UNr=J("symbolIcon.typeParameterForeground",ko,d(1682,null)),zNr=J("symbolIcon.unitForeground",ko,d(1683,null)),Y4i=J("symbolIcon.variableForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(1684,null));var X4i=Object.freeze({kind:Is.Empty,title:d(1024,null)}),D0o=Object.freeze([{kind:gr.QuickFix,title:d(1026,null)},{kind:gr.RefactorExtract,title:d(1022,null),icon:M.wrench},{kind:gr.RefactorInline,title:d(1023,null),icon:M.wrench},{kind:gr.RefactorRewrite,title:d(1021,null),icon:M.wrench},{kind:gr.RefactorMove,title:d(1025,null),icon:M.wrench},{kind:gr.SurroundWith,title:d(1028,null),icon:M.surroundWith},{kind:gr.Source,title:d(1027,null),icon:M.symbolFile},X4i]);function J4i(a,i,e){if(!i)return a.map(n=>({kind:"action",item:n,group:X4i,disabled:!!n.action.disabled,label:n.action.disabled||n.action.title,canPreview:!!n.action.edit?.edits.length}));let t=D0o.map(n=>({group:n,actions:[]}));for(let n of a){let r=n.action.kind?new Is(n.action.kind):Is.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:M.sparkle}:s,label:r.action.title,disabled:!!r.action.disabled,keybinding:e(r.action)})}}return o}var Gii=new Q("supportedCodeAction",""),Z4i="_typescript.applyFixAllCodeAction",zii=class extends C{constructor(e,t,o,n=250){super();this._editor=e;this._markerService=t;this._signalChange=o;this._delay=n;this._autoTriggerTimer=this._register(new Nl);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=>Xe(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}}},m7;(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(so(l))return Kii;throw l})}cancel(){this._cancellablePromise.cancel()}}t.Triggered=e})(m7||={});var Kii=Object.freeze({allActions:[],validActions:[],dispose:()=>{},documentation:[],hasAutoFix:!1,hasAIFix:!1,allAIFixes:!1}),pIt=class extends C{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=m7.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=Gii.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(m7.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(m7.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 zii(this._editor,this._markerService,n=>{if(!n){this.setState(m7.Empty);return}let r=n.selection.getStartPosition(),s=xn(async u=>{if(this._settingEnabledNearbyQuickfixes()&&n.trigger.type===1&&(n.trigger.triggerAction==="quick fix action"||n.trigger.filter?.include?.contains(gr.QuickFix))){let h=await DL(this._registry,e,n.selection,n.trigger,bm.None,u);this.codeActionsDisposable.value=h;let g=[...h.allActions];if(u.isCancellationRequested)return h.dispose(),Kii;let f=h.validActions?.some(b=>b.action.kind&&gr.QuickFix.contains(new Is(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(Z4i))&&(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 N=T.endColumn,O=T.endLineNumber,V=T.startLineNumber;if(O===b.lineNumber||V===b.lineNumber){S=new Ie(O,N);let U={type:n.trigger.type,triggerAction:n.trigger.triggerAction,filter:{include:n.trigger.filter?.include?n.trigger.filter?.include:gr.QuickFix},autoApply:n.trigger.autoApply,context:{notAvailableMessage:n.trigger.context?.notAvailableMessage||"",position:S}},G=new Yt(S.lineNumber,S.column,S.lineNumber,S.column),$=await DL(this._registry,e,G,U,bm.None,u);if(u.isCancellationRequested)return $.dispose(),Kii;if($.validActions.length!==0){for(let te of $.validActions)te.action.command?.arguments?.some(pe=>typeof pe=="string"&&pe.includes(Z4i))&&(te.action.diagnostics=[...v.filter(pe=>pe.relatedInformation)]);h.allActions.length===0&&g.push(...$.allActions),Math.abs(b.column-N)<y?w.unshift(...$.validActions):w.push(...$.validActions)}y=Math.abs(b.column-N)}}let k=w.filter((T,N,O)=>O.findIndex(V=>V.action.title===T.action.title)===N);return k.sort((T,N)=>T.action.isPreferred&&!N.action.isPreferred?-1:!T.action.isPreferred&&N.action.isPreferred||T.action.isAI&&!N.action.isAI?1:!T.action.isAI&&N.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 DL(this._registry,e,n.selection,n.trigger,bm.None,u);return this.codeActionsDisposable.value=h,h}let p=await DL(this._registry,e,n.selection,n.trigger,bm.None,u);return this.codeActionsDisposable.value=p,p});n.trigger.type===1&&this._progressService?.showWhile(s,250);let l=new m7.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 e3i=Re("gutter-lightbulb",M.lightBulb,d(1036,null)),t3i=Re("gutter-lightbulb-auto-fix",M.lightbulbAutofix,d(1034,null)),i3i=Re("gutter-lightbulb-sparkle",M.lightbulbSparkle,d(1033,null)),o3i=Re("gutter-lightbulb-aifix-auto-fix",M.lightbulbSparkleAutofix,d(1032,null)),n3i=Re("gutter-lightbulb-sparkle-filled",M.sparkleFilled,d(1035,null)),C1;(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})(C1||={});function $ii(a,i,e,t,o=!1){if(a.validActions.length<=0)return;let n,r=!1;a.allAIFixes?(n=o?n3i:M.sparkleFilled,a.validActions.length===1&&(r=!0)):a.hasAutoFix?a.hasAIFix?n=o?o3i:M.lightbulbSparkleAutofix:n=o?t3i:M.lightbulbAutofix:a.hasAIFix?n=o?i3i:M.lightbulbSparkle:n=o?e3i:M.lightBulb;let s;return r?s=d(1030,null,a.validActions[0].action.title):a.hasAutoFix&&e?s=d(1037,null,e):!a.hasAutoFix&&t?s=d(1031,null,t):s=d(1029,null),{actions:a,trigger:i,icon:n,autoRun:r,title:s,isGutter:o}}var gE=class extends C{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=Le(this,C1.Hidden);this._gutterState=Le(this,C1.Hidden);this._combinedInfo=Ce(this,e=>{let t=this._gutterState.read(e);if(t.type===1)return gE._computeLightBulbInfo(t,!0,this._preferredKbLabel.read(e),this._quickFixKbLabel.read(e));let o=this._state.read(e);if(o.type===1)return gE._computeLightBulbInfo(o,!1,this._preferredKbLabel.read(e),this._quickFixKbLabel.read(e))});this.lightBulbInfo=this._combinedInfo;this._iconClasses=[];this.lightbulbClasses=["codicon-"+e3i.id,"codicon-"+o3i.id,"codicon-"+t3i.id,"codicon-"+i3i.id,"codicon-"+n3i.id];this._preferredKbLabel=Le(this,void 0);this._quickFixKbLabel=Le(this,void 0);this.gutterDecoration=gE.GUTTER_DECORATION;this._domNode=_("div.lightBulbWidget"),this._domNode.role="listbox",this._register(ws.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(Gbe(this._domNode,o=>{let n=this._state.get();if(n.type!==1)return;this._editor.focus(),o.preventDefault();let{top:r,height:s}=Yn(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(H.runAndSubscribe(this._keybindingService.onDidUpdateKeybindings,()=>{this._preferredKbLabel.set(this._keybindingService.lookupKeybinding(Iwe)?.getLabel()??void 0,void 0),this._quickFixKbLabel.set(this._keybindingService.lookupKeybinding(w1)?.getLabel()??void 0,void 0)})),this._register(he(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}=Yn(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=po.register({description:"codicon-gutter-lightbulb-decoration",glyphMarginClassName:q.asClassName(M.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 $ii(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=eq(h,u),f=p.spaceWidth*g>22,v=N=>N>2&&this._editor.getTopForLineNumber(N)===this._editor.getTopForLineNumber(N-1),b=this._editor.getLineDecorations(l),S=!1;if(b)for(let N of b){let O=N.options.glyphMarginClassName;if(O&&!this.lightbulbClasses.some(V=>O.includes(V))){S=!0;break}}let y=l,w=1;if(!f){let N=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,U=l>1&&N(l-1),G=!V&&N(l+1),$=N(l),te=!G&&!U;if(!G&&!U&&!S)return this._gutterState.set(new C1.Showing(e,t,o,{position:{lineNumber:y,column:w},preference:gE._posPref}),void 0),this.renderGutterLightbub(),this.hide();U||V||U&&!$?y-=1:(G||te&&$)&&(y+=1)}else if(l===1&&(l===s.getLineCount()||!N(l+1)&&!N(l)))if(this._gutterState.set(new C1.Showing(e,t,o,{position:{lineNumber:y,column:w},preference:gE._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 C1.Showing(e,t,o,{position:{lineNumber:y,column:w},preference:gE._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()!==C1.Hidden&&(this._state.set(C1.Hidden,void 0),this._editor.layoutContentWidget(this))}gutterHide(){this._gutterState.get()!==C1.Hidden&&(this._gutterDecorationID&&this._removeGutterDecoration(this._gutterDecorationID),this._gutterState.set(C1.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=po.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)})}};gE=I([m(1,_e)],gE);var R0o="quickfix-edit-highlight",Zu=class extends C{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=Le(this,void 0);this._preferredKbLabel=Le(this,void 0);this._quickFixKbLabel=Le(this,void 0);this._hasLightBulbStateObservers=!1;this.lightBulbState=hs({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 pIt(this._editor,r.codeActionProvider,t,o,s,c)),this._register(this._model.onDidChangeState(f=>this.update(f))),this._register(H.runAndSubscribe(this._keybindingService.onDidUpdateKeybindings,()=>{this._preferredKbLabel.set(this._keybindingService.lookupKeybinding(Iwe)?.getLabel()??void 0,void 0),this._quickFixKbLabel.set(this._keybindingService.lookupKeybinding(w1)?.getLabel()??void 0,void 0)})),this._lightBulbWidget=new co(()=>{let f=this._editor.getContribution(gE.ID);return f&&(this._register(f.onClick(v=>this.showCodeActionsFromLightbulb(v.actions,v))),f.onlyWithEmptySelection=this._onlyLightBulbWithEmptySelection),f}),this._resolver=n.createInstance(p7),this._register(this._editor.onDidLayoutChange(()=>this._actionWidgetService.hide()))}static{this.ID="editor.contrib.codeActionController"}static get(e){return e.getContribution(Zu.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;iu.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(Nq,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!==m7.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($ii(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){iu.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)){iu.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=po.register({description:"quickfix-highlight",className:R0o})}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=Ie.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 Is(g);h=[gr.RefactorExtract,gr.RefactorInline,gr.RefactorRewrite,gr.RefactorMove,gr.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:Zu.DECORATION})):p.map(f=>({range:f,options:Zu.DECORATION}));n.set(g)}else if(h&&h.length>0){let g=h.map(v=>({range:v,options:Zu.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;Or(d(1018,null,v,f.startLineNumber,f.startColumn))}}}else n.clear()}};this._actionWidgetService.show("codeActionWidget",!0,J4i(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=Yn(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(1019,null),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!1,this.showCodeActionList(e,t,o))}:{id:"showMoreActions",label:d(1020,null),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!0,this.showCodeActionList(e,t,o))}),n}};Zu=I([m(1,Ns),m(2,X),m(3,F),m(4,zt),m(5,rd),m(6,ge),m(7,B),m(8,nl),m(9,F),m(10,rd),m(11,_e)],Zu);is((a,i)=>{((o,n)=>{n&&i.addRule(`.monaco-editor ${o} { background-color: ${n}; }`)})(".quickfix-edit-highlight",a.getColor(Kb));let t=a.getColor(LN);t&&i.addRule(`.monaco-editor .quickfix-edit-highlight { border: 1px ${Ug(a.type)?"dotted":"solid"} ${t}; box-sizing: border-box; }`)});function s5e(a){return x.regex(Gii.keys()[0],new RegExp("(\\s|^)"+Yr(a.value)+"\\b"))}var qii={type:"object",defaultSnippets:[{body:{kind:""}}],properties:{kind:{type:"string",description:d(990,null)},apply:{type:"string",description:d(986,null),default:"ifSingle",enum:["first","ifSingle","never"],enumDescriptions:[d(987,null),d(988,null),d(989,null)]},preferred:{type:"boolean",default:!1,description:d(991,null)}}};function Uae(a,i,e,t,o="other (default)"){a.hasModel()&&Zu.get(a)?.manualTriggerAtCurrentPosition(i,o,e,t)}var hIt=class extends wl{constructor(){super({id:w1,title:L(1012,"Quick Fix..."),precondition:x.and(ue.writable,ue.hasCodeActionsProvider),icon:M.lightBulb,f1:!0,keybinding:{when:ue.textInputFocus,primary:2137,weight:100},menu:{id:D.InlineChatEditorAffordance,group:"1_quickfix",order:0,when:x.and(ue.writable,ue.hasCodeActionsProvider)}})}runEditorCommand(i,e){return Uae(e,d(999,null),void 0,void 0,"quick fix action")}},gIt=class extends xc{constructor(){super({id:Swe,precondition:x.and(ue.writable,ue.hasCodeActionsProvider),metadata:{description:"Trigger a code action",args:[{name:"args",schema:qii}]}})}runEditorCommand(i,e,t){let o=d7.fromUser(t,{kind:Is.Empty,apply:"ifSingle"});return Uae(e,typeof t?.kind=="string"?o.preferred?d(997,null,t.kind):d(995,null,t.kind):o.preferred?d(996,null):d(994,null),{include:o.kind,includeSourceActions:!0,onlyIncludePreferredActions:o.preferred},o.apply)}},fIt=class extends xi{constructor(){super({id:ywe,label:L(1013,"Refactor..."),precondition:x.and(ue.writable,ue.hasCodeActionsProvider),kbOpts:{kbExpr:ue.textInputFocus,primary:3120,mac:{primary:1328},weight:100},contextMenuOpts:{group:"1_modification",order:2,when:x.and(ue.writable,s5e(gr.Refactor))},metadata:{description:"Refactor...",args:[{name:"args",schema:qii}]}})}run(i,e,t){let o=d7.fromUser(t,{kind:gr.Refactor,apply:"never"});return Uae(e,typeof t?.kind=="string"?o.preferred?d(1003,null,t.kind):d(1001,null,t.kind):o.preferred?d(1002,null):d(1000,null),{include:gr.Refactor.contains(o.kind)?o.kind:Is.None,onlyIncludePreferredActions:o.preferred},o.apply,"refactor")}},vIt=class extends xi{constructor(){super({id:wwe,label:L(1014,"Source Action..."),precondition:x.and(ue.writable,ue.hasCodeActionsProvider),contextMenuOpts:{group:"1_modification",order:2.1,when:x.and(ue.writable,s5e(gr.Source))},metadata:{description:"Source Action...",args:[{name:"args",schema:qii}]}})}run(i,e,t){let o=d7.fromUser(t,{kind:gr.Source,apply:"never"});return Uae(e,typeof t?.kind=="string"?o.preferred?d(1007,null,t.kind):d(1005,null,t.kind):o.preferred?d(1006,null):d(1004,null),{include:gr.Source.contains(o.kind)?o.kind:Is.None,includeSourceActions:!0,onlyIncludePreferredActions:o.preferred},o.apply,"source action")}},bIt=class extends xi{constructor(){super({id:n5e,label:L(1011,"Organize Imports"),precondition:x.and(ue.writable,s5e(gr.SourceOrganizeImports)),kbOpts:{kbExpr:ue.textInputFocus,primary:1581,weight:100},metadata:{description:L(1010,"Organize imports in the current file. Also called 'Optimize Imports' by some tools")}})}run(i,e){return Uae(e,d(998,null),{include:gr.SourceOrganizeImports,includeSourceActions:!0},"ifSingle","organize imports")}},SIt=class extends xi{constructor(){super({id:r5e,label:L(1008,"Fix All"),precondition:x.and(ue.writable,s5e(gr.SourceFixAll))})}run(i,e){return Uae(e,d(1009,null),{include:gr.SourceFixAll,includeSourceActions:!0},"ifSingle","fix all")}},IIt=class extends xi{constructor(){super({id:Iwe,label:L(992,"Auto Fix..."),precondition:x.and(ue.writable,s5e(gr.QuickFix)),kbOpts:{kbExpr:ue.textInputFocus,primary:1625,mac:{primary:2649},weight:100}})}run(i,e){return Uae(e,d(993,null),{include:gr.QuickFix,onlyIncludePreferredActions:!0},"ifSingle","auto fix")}};go(Zu.ID,Zu,3);go(gE.ID,gE,4);W(hIt);Jt(fIt);Jt(vIt);Jt(bIt);Jt(IIt);Jt(SIt);qi(new gIt);oe.as(ii.Configuration).registerConfiguration({...nC,properties:{"editor.codeActionWidget.showHeaders":{type:"boolean",scope:6,description:d(1016,null),default:!0}}});oe.as(ii.Configuration).registerConfiguration({...nC,properties:{"editor.codeActionWidget.includeNearbyQuickFixes":{type:"boolean",scope:6,description:d(1015,null),default:!0}}});oe.as(ii.Configuration).registerConfiguration({...nC,properties:{"editor.codeActions.triggerOnFocusChange":{type:"boolean",scope:6,markdownDescription:d(1017,null,"`#editor.codeActionsOnSave#`","`#files.autoSave#`","`afterDelay`","`always`"),default:!1}}});var zae=class a{constructor(){this.lenses=[]}static{this.Empty=new a}dispose(){this._store?.dispose()}get isDisposed(){return this._store?.isDisposed??!1}add(i,e){Ac(i)&&(this._store??=new P,this._store.add(i));for(let t of i.lenses)this.lenses.push({symbol:t,provider:e})}};async function jii(a,i,e){let t=a.ordered(i),o=new Map,n=new zae,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){ss(c)}});return await Promise.all(r),e.isCancellationRequested?(n.dispose(),zae.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)}qe.registerCommand("_executeCodeLensProvider",function(a,...i){let[e,t]=i;So(A.isUri(e)),So(typeof t=="number"||!t);let{codeLensProvider:o}=a.get(zt),n=a.get(Ct).getModel(e);if(!n)throw Br();let r=[],s=new P;return jii(o,n,ve.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,ve.None)).then(p=>r.push(p||u.symbol)));return Promise.all(c)}).then(()=>r).finally(()=>{setTimeout(()=>s.dispose(),100)})});var Qii=ae("ICodeLensCache"),yIt=class{constructor(i,e){this.lineCount=i;this.data=e}},a5e=class{constructor(i){this._fakeProvider=new class{provideCodeLenses(){throw new Error("not supported")}};this._cache=new il(20,.75);let e="codelens/cache";jv(It,()=>i.remove(e,1));let t="codelens/cache2",o=i.get(t,1,"{}");this._deserialize(o);let n=H.filter(i.onWillSaveState,r=>r.reason===1);H.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 zae;o.add({lenses:t},this._fakeProvider);let n=new yIt(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 zae;r.add({lenses:n},this._fakeProvider),this._cache.set(t,new yIt(o.lineCount,r))}}catch{}}};a5e=I([m(0,le)],a5e);we(Qii,a5e,1);var Yii=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")}},Xii=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=Bn(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?(Fi(this._domNode,...t),this._isEmpty&&e&&this._domNode.classList.add("fadein"),this._isEmpty=!1):Fi(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}},Cwe=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])}},r3i=po.register({collapseOnReplaceEdit:!0,description:"codelens"}),l5e=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:r3i},p=>this._decorationIds[u]=p),s?s=z.plusRange(s,c.symbol.range):s=z.lift(c.symbol.range)}),this._viewZone=new Yii(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 Xii(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:r3i},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 jg=ae("ILanguageFeatureDebounceService"),eoi;(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})(eoi||={});var Jii=class{constructor(i){this._default=i}get(i){return this._default}update(i,e){return this._default}default(){return this._default}},Zii=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 il(50,.7)}_key(i){return i.id+this._registry.all(i).reduce((e,t)=>SGe(eoi.of(t),e),0)}get(i){let e=this._key(i),t=this._cache.get(e);return t?Kn(t.value,this._min,this._max):this.default()}update(i,e){let t=this._key(i),o=this._cache.get(t);o||(o=new Ppt(6),this._cache.set(t,o));let n=Kn(o.update(e),this._min,this._max);return jd(i.uri,"output")||this._logService.trace(`[DEBOUNCE: ${this._name}] for ${i.uri.toString()} is ${n}ms`),n}_overall(){let i=new IGe;for(let[,e]of this._cache)i.update(e.value);return i.value}default(){let i=this._overall()|0||this._default;return Kn(i,this._min,this._max)}},c5e=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=`${eoi.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 Jii(o*1.5)):l=new Zii(this._logService,e,i,this._overallAverage()|0||o*1.5,o,n),this._data.set(s,l)),l}_overallAverage(){let i=new IGe;for(let e of this._data.values())i.update(e.default());return i.value}};c5e=I([m(0,ne),m(1,Co)],c5e);we(jg,c5e,1);var Oq=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 P;this._localToDispose=new P;this._lenses=[];this._oldCodeLensModels=new P;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",Yd.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&&nn(()=>{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=xn(n=>jii(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 Cwe;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=tC.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 Cwe;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=tC.capture(this._editor),r=this._getLayoutInfo();this._editor.changeDecorations(s=>{this._editor.changeViewZones(l=>{let c=new Cwe,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 l5e(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 l5e(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=xn(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},ss):(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}};Oq=I([m(1,zt),m(2,jg),m(3,ge),m(4,Ne),m(5,Qii)],Oq);go(Oq.ID,Oq,1);Jt(class extends xi{constructor(){super({id:"codelens.showLensesInCurrentLine",precondition:ue.hasCodeLensProvider,label:L(1039,"Show CodeLens Commands for Current Line")})}async run(i,e){if(!e.hasModel())return;let t=i.get(Ge),o=i.get(ge),n=i.get(Ne),r=e.getSelection().positionLineNumber,s=e.getContribution(Oq.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(1038,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 s3i=[];function Dx(a){s3i.push(a)}function a3i(){return s3i.slice(0)}var xwe=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}},Fq=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}},Lx=class{constructor(i,e){this.renderedHoverParts=i;this.disposables=e}dispose(){for(let i of this.renderedHoverParts)i.dispose();this.disposables?.dispose()}},d_=new class{constructor(){this._participants=[]}register(i){this._participants.push(i)}getAll(){return this._participants}};var Wq=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 Oe(new Bt(Math.round(255*n.red),Math.round(255*n.green),Math.round(255*n.blue),n.alpha)),s=Oe.Format.CSS.formatRGB(r),l=Oe.Format.CSS.formatHSL(r),c=Oe.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}};Wq=I([m(0,$s)],Wq);var kwe=class extends C{constructor(i,e){super(),this._register(i.colorProvider.register("*",new Wq(e)))}};kwe=I([m(0,zt),m(1,$s)],kwe);async function xIt(a,i,e,t="auto"){return kIt(new toi,a,i,e,t)}function ioi(a,i,e,t){return Promise.resolve(e.provideColorPresentations(a,i,t))}var toi=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)}},wIt=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)}},CIt=class{constructor(i){this.colorInfo=i}async compute(i,e,t,o){let n=await i.provideColorPresentations(e,this.colorInfo,ve.None);return Array.isArray(n)&&o.push(...n),Array.isArray(n)}};async function kIt(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 Wq)r=u;else try{await a.compute(u,e,t,s)&&(n=!0)}catch(p){ss(p)}}return n?s:r&&o!=="never"?(await a.compute(r,e,t,s),s):[]}function ooi(a,i){let{colorProvider:e}=a.get(zt),t=a.get(Ct).getModel(i);if(!t)throw Br();let o=a.get(B).getValue("editor.defaultColorDecorators",{resource:i});return{model:t,colorProviderRegistry:e,defaultColorDecoratorsEnablement:o}}var roi=Object.create({}),Xy=class extends C{constructor(e,t,o,n){super();this._editor=e;this._configurationService=t;this._languageFeaturesService=o;this._localToDispose=this._register(new P);this._decorationsIds=[];this._colorDatas=new Map;this._decoratorLimitReporter=this._register(new noi);this._colorDecorationClassRefs=this._register(new P);this._colorDecoratorIds=this._editor.createDecorationsCollection(),this._ruleFactory=this._register(new p9(this._editor)),this._debounceInformation=n.for(o.colorProvider,"Document Colors",{min:Xy.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 Nl,this._timeoutTimer.cancelAndSet(()=>{this._timeoutTimer=null,this.beginCompute()},this._debounceInformation.get(e)))})),this.beginCompute())}async beginCompute(){this._computePromise=xn(async e=>{let t=this._editor.getModel();if(!t)return[];let o=new En(!1),n=await xIt(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:po.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 Bt(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:rN,inlineClassName:`${g.className} colorpicker-color-decoration`,inlineClassNameAffectsLetterSpacing:!0,attachedData:roi}}})}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)}};Xy=I([m(1,B),m(2,zt),m(3,jg)],Xy);var noi=class extends C{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 EIt="editor.action.showHover",l3i="editor.action.showDefinitionPreviewHover",c3i="editor.action.hideHover",d3i="editor.action.scrollUpHover",u3i="editor.action.scrollDownHover",p3i="editor.action.scrollLeftHover",m3i="editor.action.scrollRightHover",h3i="editor.action.pageUpHover",g3i="editor.action.pageDownHover",f3i="editor.action.goToTopHover",v3i="editor.action.goToBottomHover",x1="editor.action.increaseHoverVerbosityLevel",b3i="editor.action.increaseHoverVerbosityLevelFromAccessibleView",S3i=d(1261,null),k1="editor.action.decreaseHoverVerbosityLevel",I3i="editor.action.decreaseHoverVerbosityLevelFromAccessibleView",y3i=d(1260,null),d5e="editor.action.hideLongLineWarningHover";var E1="editor.action.inlineSuggest.commit",Kae="editor.action.inlineSuggest.commitAlternativeAction",TIt="editor.action.inlineSuggest.showPrevious",_It="editor.action.inlineSuggest.showNext",DIt="editor.action.inlineSuggest.jump",LIt="editor.action.inlineSuggest.hide",u5e="editor.action.inlineSuggest.toggleShowCollapsed",soi="editor.action.inlineSuggest.renameSymbol";var Ewe=class extends C{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=Ce(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 Ie(r.lineNumber,Math.min(s,this.sessionPosition?.column??Number.MAX_SAFE_INTEGER));return this.sessionPosition=l,l}),this._register(Ga((n,r)=>{let s=this.model.read(n);if(!s||!this.alwaysShowToolbar.read(n))return;let l=Ce(u=>{let p=u.store.add(this.instantiationService.createInstance(LL.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(he(h=>{this.position.read(h)&&s.lastTriggerKind.read(h)!==1&&s.triggerExplicitly()})),p}),c=vf(this,(u,p)=>!!this.position.read(u)||!!p);r.add(he(u=>{c.read(u)&&l.read(u)}))}))}};Ewe=I([m(2,F)],Ewe);var M0o=Re("inline-suggestion-hints-next",M.chevronRight,d(1364,null)),P0o=Re("inline-suggestion-hints-previous",M.chevronLeft,d(1365,null)),LL=class extends C{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${LL.id++}`,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._warningMessageContentNode=Ce(v=>{let b=this._warning.read(v);return b?typeof b.message=="string"?b.message:v.store.add(nb(b.message)).element:void 0}),this._warningMessageNode=Mo.div({class:"warningMessage",style:{maxWidth:400,margin:4,marginBottom:4,display:Ce(v=>this._warning.read(v)?"block":"none")}},[this._warningMessageContentNode]).keepUpdated(this._store),this.nodes=bt("div.inlineSuggestionsHints",{className:this.withBorder?"monaco-hover monaco-hover-content":""},[this._warningMessageNode.element,bt("div@toolBar")]),this.previousAction=this._register(this.createCommandAction(TIt,d(1366,null),q.asClassName(P0o))),this.availableSuggestionCountAction=this._register(new st("inlineSuggestionHints.availableSuggestionCount","",void 0,!1)),this.nextAction=this._register(this.createCommandAction(_It,d(1363,null),q.asClassName(M0o))),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(he(v=>{this._warningMessageContentNode.read(v),this._warningMessageNode.readEffect(v),this._relayout()})),this.toolBar=this._register(p.createInstance(p5e,this.nodes.toolBar,D.InlineSuggestionToolbar,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:v=>v.startsWith("primary")},actionViewItemProvider:(v,b)=>{if(v instanceof Eo)return p.createInstance(loi,v,void 0);if(v===this.availableSuggestionCountAction){let S=new aoi(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=>{LL._dropDownVisible=v})),this._register(he(v=>{this._position.read(v),this.editor.layoutContentWidget(this)})),this._register(he(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(he(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 Eo&&S.push(k);S.length>0&&S.unshift(new li),this.toolBar.setAdditionalSecondaryActions(S)}))}static{this.hot=s1(this)}static{this._dropDownVisible=!1}static get dropDownVisible(){return this._dropDownVisible}static{this.id=0}createCommandAction(e,t,o){let n=new st(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}}};LL=I([m(8,ge),m(9,F),m(10,_e),m(11,X),m(12,qt)],LL);var aoi=class extends Lr{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(){}},loi=class extends ml{updateLabel(){let i=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService,!0);if(!i)return super.updateLabel();if(this.label){let e=bt("div.keybinding").root;this._register(new ah(e,zo,{disableTitle:!0,...t5e})).set(i),this.label.textContent=this._action.label,this.label.appendChild(e),this.label.classList.add("inlineSuggestionStatusBarItemLabel")}}updateTooltip(){}},p5e=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}=hl(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())}};p5e=I([m(3,qt),m(4,X),m(5,ze),m(6,_e),m(7,ge),m(8,Te)],p5e);var m5e={kind:0},A0o={kind:1};function N0o(a,i,e){return{kind:2,commandId:a,commandArgs:i,isBubble:e}}var MIt=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||!Yzi(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:umt(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."),m5e;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: ${w3i(s.when)}, source: ${C3i(s)}.`),A0o):(this._log(`\\ From ${r.length} keybinding entries, matched ${s.command}, when: ${w3i(s.when)}, source: ${C3i(s)}.`),N0o(s.command,s.commandArgs,s.bubble)):(this._log(`\\ From ${r.length} keybinding entries, no when clauses matched the context.`),m5e)}_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 w3i(a){return a?`${a.serialize()}`:"no when condition"}function C3i(a){return a.extensionId?a.isBuiltinExtension?`built-in extension ${a.extensionId}`:`user extension ${a.extensionId}`:a.isDefault?"built-in":"user"}function g7(a,i,e){let t=Yn(a);return!(i<t.left+3||i>t.left+t.width-3||e<t.top+3||e>t.top+t.height-3)}function PIt(a,i,e){return a==="on"?!0:a==="off"?!1:h5e(i,e.event)}function h5e(a,i){return a==="altKey"?i.ctrlKey||i.metaKey:i.altKey}var coi=class{constructor(i,e,t,o){this.value=i;this.isComplete=e;this.hasLoadingMessage=t;this.options=o}},Twe=class extends C{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 g5e(e=>this._triggerAsyncComputation(e),0));this._syncComputationScheduler=this._register(new g5e(e=>this._triggerSyncComputation(e),0));this._loadingMessageScheduler=this._register(new g5e(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=M1i(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 coi(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}},g5e=class extends C{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 nO=class{constructor(){this._onDidWillResize=new E;this._onDidResize=new E;this._sashListener=new P;this._size=new ai(0,0);this._minSize=new ai(0,0);this._maxSize=new ai(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER);this.domNode=document.createElement("div"),this._eastSash=new pv(this.domNode,{getVerticalSashLeft:()=>this._size.width},{orientation:0}),this._westSash=new pv(this.domNode,{getVerticalSashLeft:()=>0},{orientation:0}),this._northSash=new pv(this.domNode,{getHorizontalSashTop:()=>0},{orientation:1,orthogonalEdge:"north"}),this._southSash=new pv(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(H.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(H.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(H.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(H.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 ai(e,i);ai.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 O0o=30,F0o=24,AIt=class extends C{constructor(e,t=new ai(10,10)){super();this._editor=e;this.allowEditorOverflow=!0;this.suppressMouseDown=!1;this._resizableNode=this._register(new nO);this._contentPosition=null;this._isResizing=!1;this._resizableNode.domNode.style.position="absolute",this._resizableNode.minSize=ai.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 ai(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?Ie.lift(this._contentPosition.position):void 0}_availableVerticalSpaceAbove(e){let t=this._editor.getDomNode(),o=this._editor.getScrolledVisiblePosition(e);return!t||!o?void 0:Yn(t).top+o.top-O0o}_availableVerticalSpaceBelow(e){let t=this._editor.getDomNode(),o=this._editor.getScrolledVisiblePosition(e);if(!t||!o)return;let n=Yn(t),r=Fm(t.ownerDocument.body),s=n.top+o.top+o.height;return r.height-s-F0o}_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 x3i=30,Rx=class extends AIt{constructor(e,t,o,n,r){let s=e.getOption(75)+8,l=150,c=new ai(l,s);super(e,c);this._configurationService=o;this._accessibilityService=n;this._keybindingService=r;this._hover=this._register(new e7(!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=ue.hoverVisible.bindTo(t),this._hoverFocusedKey=ue.hoverFocused.bindTo(t),R(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(Vn(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 ai(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 Rx.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 Rx._applyDimensions(o,e,t)}_setContainerDomNodeDimensions(e,t){let o=this._hover.containerDomNode;return Rx._applyDimensions(o,e,t)}_setScrollableElementDimensions(e,t){let o=this._hover.scrollbar.getDomNode();return Rx._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){Rx._applyMaxDimensions(this._hover.contentsDomNode,e,t),Rx._applyMaxDimensions(this._hover.scrollbar.getDomNode(),e,t),Rx._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 ai(e,t),this._setHoverWidgetMaxDimensions(e,t)}_resize(e){Rx._lastDimensions=new ai(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?Fm(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=Yn(this.getDomNode());this._renderedHover.closestMouseDistance===void 0&&(this._renderedHover.closestMouseDistance=k3i(this._renderedHover.initialMousePosX,this._renderedHover.initialMousePosY,o.left,o.top,o.width,o.height));let n=k3i(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,Rx._lastDimensions.height),t=Math.max(this._editor.getLayoutInfo().width*.66,750,Rx._lastDimensions.width);this._resizableNode.maxSize=new ai(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=nh(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&&ESt(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 ai(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 ai(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 ai(e,this._minimumSize.height)}handleContentsChanged(){this._removeConstraintsRenderNormally();let e=this._hover.contentsDomNode,t=nh(e),o=yl(e)+2;if(this._resizableNode.layout(t,o),this._setHoverWidgetDimensions(o,t),t=nh(e),o=yl(e),this._contentWidth=o,this._updateMinimumWidth(),this._resizableNode.layout(t,o),this._renderedHover?.showAtPosition){let n=nh(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-x3i})}scrollRight(){let e=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:e+x3i})}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})}};Rx=I([m(1,X),m(2,B),m(3,Bi),m(4,_e)],Rx);function k3i(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 NIt=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 si(o)}};var v5e=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 doi(this,e,this.isComplete,this.options)}},doi=class extends v5e{constructor(e,t,o,n){super(t,o,n);this.original=e}filter(e){return this.original.filter(e)}};var E3i=_,f7=class extends C{constructor(e,t){super();this._keybindingService=e;this._hoverService=t;this.actions=[];this._hasContent=!1;this.hoverElement=E3i("div.hover-row.status-bar"),this.hoverElement.tabIndex=0,this.actionsElement=R(this.hoverElement,E3i("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(t7.render(this.actionsElement,e,o));return this._register(this._hoverService.setupManagedHover(Ni("element"),n.actionContainer,n.actionRenderedLabel)),this.actions.push(n),n}append(e){let t=R(this.actionsElement,e);return this._hasContent=!0,t}};f7=I([m(0,_e),m(1,tt)],f7);function Dwe(a){let i=a;return typeof i=="object"&&"markdown"in i&&"markdownNotSupportedFallback"in i}function T3i(a){let i=a;return typeof i=="object"&&"element"in i}var b7={inputActiveOptionBorder:"#007ACC00",inputActiveOptionForeground:"#FFFFFF",inputActiveOptionBackground:"#0E639C50"},Gae=class extends oc{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 Kh({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}},Kh=class extends Ma{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(yp().setupDelayedHover(this.domNode,()=>({content:!Mr(this._title)&&!Ao(this._title)?fu(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:Mr(e)?e.value:e.textContent;this.domNode.setAttribute("aria-label",m1(t))}set visible(e){this.domNode.style.display=e?"":"none"}get visible(){return this.domNode.style.display!=="none"}},b5e=class extends Ma{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 sa(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`}},hv=class extends b5e{constructor(i,e,t){let o=new Kh({title:i,isChecked:e,icon:M.check,actionClassName:b5e.CLASS_NAME,hoverLifecycleOptions:t.hoverLifecycleOptions,...b7});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(M.check):this.checkbox.setIcon(void 0),super.applyStyles(i)}},v7=class extends b5e{constructor(e,t,o){let n;switch(t){case!0:n=M.check;break;case"mixed":n=M.dash;break;case!1:n=void 0;break}let r=new Kh({title:e,isChecked:t===!0,icon:n,actionClassName:hv.CLASS_NAME,hoverLifecycleOptions:o.hoverLifecycleOptions,...b7});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(M.check);break;case"mixed":this.checkbox.setIcon(M.dash);break;case!1:this.checkbox.setIcon(void 0);break}super.applyStyles(e)}},OIt=class extends oc{constructor(i,e,t){super(i,e,t),this.toggle=this._register(new hv(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 T1(a){return(i,e)=>{if(i.checked!==void 0)return new Gae(null,i,{...e,toggleStyles:a})}}var Vq=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=po.register({description:"current-find-match",stickiness:1,zIndex:13,className:"currentFindMatch",inlineClassName:"currentFindMatchInline",showIfCollapsed:!0,overviewRuler:{color:Ss(MN),position:2},minimap:{color:Ss(a9),position:1}})}static{this._FIND_MATCH_DECORATION=po.register({description:"find-match",stickiness:1,zIndex:10,className:"findMatch",inlineClassName:"findMatchInline",showIfCollapsed:!0,overviewRuler:{color:Ss(MN),position:2},minimap:{color:Ss(a9),position:1}})}static{this._FIND_MATCH_NO_OVERVIEW_DECORATION=po.register({description:"find-match-no-overview",stickiness:1,className:"findMatch",showIfCollapsed:!0})}static{this._FIND_MATCH_ONLY_OVERVIEW_DECORATION=po.register({description:"find-match-only-overview",stickiness:1,overviewRuler:{color:Ss(MN),position:2}})}static{this._RANGE_HIGHLIGHT_DECORATION=po.register({description:"find-range-highlight",stickiness:1,className:"rangeHighlight",isWholeLine:!0})}static{this._FIND_SCOPE_DECORATION=po.register({description:"find-scope",className:"findScope",isWholeLine:!0})}};var FIt=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 S5e(a,i){if(a&&a[0]!==""){let e=_3i(a,i,"-"),t=_3i(a,i,"_");return e&&!t?D3i(a,i,"-"):!e&&t?D3i(a,i,"_"):a[0].toUpperCase()===a[0]?i.toUpperCase():a[0].toLowerCase()===a[0]?i.toLowerCase():gGe(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 _3i(a,i,e){return a[0].indexOf(e)!==-1&&i.indexOf(e)!==-1&&a[0].split(e).length===i.split(e).length}function D3i(a,i,e){let t=i.split(e),o=a[0].split(e),n="";return t.forEach((r,s)=>{n+=S5e([o[s]],r)+e}),n.slice(0,-1)}var WIt=class{constructor(i){this.staticValue=i;this.kind=0}},uoi=class{constructor(i){this.pieces=i;this.kind=1}},S7=class a{static fromStaticValue(i){return new a([Lwe.staticValue(i)])}get hasReplacementPatterns(){return this._state.kind===1}constructor(i){!i||i.length===0?this._state=new WIt(""):i.length===1&&i[0].staticValue!==null?this._state=new WIt(i[0].staticValue):this._state=new uoi(i)}buildReplaceString(i,e){if(this._state.kind===0)return e?S5e(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}},Lwe=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)}},poi=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++]=Lwe.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),this._result[this._resultLen++]=Lwe.caseOps(i,t),this._lastCharIndex=e}finalize(){return this.emitUnchanged(this._source.length),this._currentStaticPiece.length!==0&&(this._result[this._resultLen++]=Lwe.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),new S7(this._result)}};function VIt(a){if(!a||a.length===0)return new S7(null);let i=[],e=new poi(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 fE=new Q("findWidgetVisible",!1),L3i=fE.toNegated(),Rwe=new Q("findInputFocussed",!1),I5e=new Q("replaceInputFocussed",!1),HIt=new Q("findWidgetFocused",!1),Bq={primary:545,mac:{primary:2593}},Hq={primary:565,mac:{primary:2613}},Uq={primary:560,mac:{primary:2608}},y5e={primary:554,mac:{primary:2602}},$ae={primary:558,mac:{primary:2606}},ad={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"},rO=19999,W0o=240,BIt=class a{constructor(i,e){this._toDispose=new P;this._editor=i,this._state=e,this._isDisposed=!1,this._startSearchingTimer=new Nl,this._decorations=new Vq(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,Ue(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)},W0o)):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,rO);this._decorations.set(o,t);let n=this._editor.getSelection(),r=this._decorations.getCurrentMatchesPosition(n);if(r===0&&o.length>0){let s=xy(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 Ie(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()<rO){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 Ie(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 Ie(t,o)}_moveToNextMatch(i){if(!this._state.canNavigateForward()){let t=this._decorations.matchBeforePosition(i);t&&this._setCurrentFindMatch(t);return}if(this._decorations.getCount()<rO){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 Ie(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?VIt(this._state.replaceString):S7.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 Wh(e,o);this._executeEditorCommand("replace",n),this._decorations.setStartPosition(new Ie(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>=rO?this._largeReplaceAll():this._regularReplaceAll(i),this.research(!1)}_largeReplaceAll(){let e=new Oy(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 B6(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 FIt(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 Yt(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 V0o=d(10,null),B0o=d(12,null),H0o=d(11,null),Mwe=class extends Kh{constructor(i){super({icon:M.caseSensitive,title:V0o+i.appendTitle,isChecked:i.isChecked,hoverLifecycleOptions:i.hoverLifecycleOptions,inputActiveOptionBorder:i.inputActiveOptionBorder,inputActiveOptionForeground:i.inputActiveOptionForeground,inputActiveOptionBackground:i.inputActiveOptionBackground})}},Pwe=class extends Kh{constructor(i){super({icon:M.wholeWord,title:B0o+i.appendTitle,isChecked:i.isChecked,hoverLifecycleOptions:i.hoverLifecycleOptions,inputActiveOptionBorder:i.inputActiveOptionBorder,inputActiveOptionForeground:i.inputActiveOptionForeground,inputActiveOptionBackground:i.inputActiveOptionBackground})}},Awe=class extends Kh{constructor(i){super({icon:M.regex,title:H0o+i.appendTitle,isChecked:i.isChecked,hoverLifecycleOptions:i.hoverLifecycleOptions,inputActiveOptionBorder:i.inputActiveOptionBorder,inputActiveOptionForeground:i.inputActiveOptionForeground,inputActiveOptionBackground:i.inputActiveOptionBackground})}};function R3i(a,i,e){let t=e??document.createElement("div");return t.textContent=a,t}function RL(a,i,e){let t=e??document.createElement("div");return t.textContent="",M3i(t,U0o(a,!!i?.renderCodeSegments),i?.actionHandler,i?.renderCodeSegments),t}var moi=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 M3i(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(Vo(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=>{M3i(o,n,e,t)})}function U0o(a,i){let e={type:1,children:[]},t=0,o=e,n=[],r=new moi(a);for(;!r.eos();){let s=r.next(),l=s==="\\"&&hoi(r.peek(),i)!==0;if(l&&(s=r.next()),!l&&z0o(s,i)&&s===r.peek()){r.advance(),o.type===2&&(o=n.pop());let c=hoi(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 z0o(a,i){return hoi(a,i)!==0}function hoi(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 UIt=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 I7=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 UIt(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)}},zq=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 lre([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 Nwe=_;var P3i={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},Dc=class extends Ma{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=R(e,Nwe(".monaco-inputbox.idle"));let n=this.options.flexibleHeight?"textarea":"input",r=R(this.element,Nwe(".ibwrapper"));if(this.input=R(r,Nwe(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=R(r,Nwe("div.mirror")),this.mirror.innerText="\xA0",this.scrollableElement=new f9(this.element,{vertical:1}),this.options.flexibleWidth&&(this.input.setAttribute("wrap","off"),this.mirror.style.whiteSpace="pre",this.mirror.style.wordWrap="initial"),R(e,this.scrollableElement.getDomNode()),this._register(this.scrollableElement),this._register(this.scrollableElement.onScroll(c=>this.input.scrollTop=c.scrollTop));let s=this._register(new On(e.ownerDocument,"selectionchange")),l=H.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 ji(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 ji(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(yp().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:nh(this.element)}focus(){this.input.focus()}blur(){this.input.blur()}hasFocus(){return sa(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 yl(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"&&uo(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 ${n_(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=yl(this.element)+"px";this.contextViewProvider.showContextView({getAnchor:()=>this.element,anchorAlignment:1,render:n=>{if(!this.message)return null;e=R(n,Nwe(".monaco-inputbox-container")),t();let r=Nwe("span.monaco-inputbox-message");this.message.formatContent?RL(this.message.content,void 0,r):R3i(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}`:"",R(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),Jo(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&&yp().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 ${n_(n,"transparent")}`}layout(){if(!this.mirror){this.layoutMessage();return}let e=this.cachedContentHeight;this.cachedContentHeight=nh(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()}},y7=class extends Dc{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 I7(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&&!sa(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??"",Or(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,Or(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 K0o=d(9,null),_1=class extends Ma{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||K0o,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 y7(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 Awe({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 Pwe({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 Mwe({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(),$t.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 P;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 G0o=d(13,null),$0o=d(14,null),goi=class extends Kh{constructor(i){super({icon:M.preserveCase,title:$0o+i.appendTitle,isChecked:i.isChecked,hoverLifecycleOptions:i.hoverLifecycleOptions,inputActiveOptionBorder:i.inputActiveOptionBorder,inputActiveOptionForeground:i.inputActiveOptionForeground,inputActiveOptionBackground:i.inputActiveOptionBackground})}},zIt=class extends Ma{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||G0o;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 y7(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 goi({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(),$t.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 GIt=new Q("suggestWidgetVisible",!1,d(2099,null)),foi="historyNavigationWidgetFocus",A3i="historyNavigationForwardsEnabled",N3i="historyNavigationBackwardsEnabled",w5e,KIt=[];function qM(a,i){if(KIt.includes(i))throw new Error("Cannot register the same widget multiple times");KIt.push(i);let e=new P,t=new Q(foi,!1).bindTo(a),o=new Q(A3i,!0).bindTo(a),n=new Q(N3i,!0).bindTo(a),r=()=>{t.set(!0),w5e=i},s=()=>{t.set(!1),w5e===i&&(w5e=void 0)};return sa(i.element)&&r(),e.add(i.onDidFocus(()=>r())),e.add(i.onDidBlur(()=>s())),e.add(Z(()=>{KIt.splice(KIt.indexOf(i),1),s()})),{historyNavigationForwardsEnablement:o,historyNavigationBackwardsEnablement:n,dispose(){e.dispose()}}}var D1=class extends y7{constructor(i,e,t,o){super(i,e,t);let n=this._register(o.createScoped(this.element));this._register(qM(n,this))}};D1=I([m(3,X)],D1);var L1=class extends _1{constructor(i,e,t,o){super(i,e,t);let n=this._register(o.createScoped(this.inputBox.element));this._register(qM(n,this.inputBox))}};L1=I([m(3,X)],L1);var R1=class extends zIt{constructor(i,e,t,o,n=!1){super(i,e,n,t);let r=this._register(o.createScoped(this.inputBox.element));this._register(qM(r,this.inputBox))}};R1=I([m(3,X)],R1);yt.registerCommandAndKeybindingRule({id:"history.showPrevious",weight:200,when:x.and(x.has(foi),x.equals(N3i,!0),x.not("isComposing"),GIt.isEqualTo(!1)),primary:16,secondary:[528],handler:a=>{w5e?.showPreviousValue()}});yt.registerCommandAndKeybindingRule({id:"history.showNext",weight:200,when:x.and(x.has(foi),x.equals(A3i,!0),x.not("isComposing"),GIt.isEqualTo(!1)),primary:18,secondary:[530],handler:a=>{w5e?.showNextValue()}});function ML(a){return a.lookupKeybinding("history.showPrevious")?.getElectronAccelerator()==="Up"&&a.lookupKeybinding("history.showNext")?.getElectronAccelerator()==="Down"}var O3i=Re("find-collapsed",M.chevronRight,d(1115,null)),F3i=Re("find-expanded",M.chevronDown,d(1116,null)),Soi=Re("find-selection",M.selection,d(1122,null)),Ioi=Re("find-replace",M.replace,d(1121,null)),yoi=Re("find-replace-all",M.replaceAll,d(1120,null)),k5e=Re("find-previous-match",M.arrowUp,d(1119,null)),E5e=Re("find-next-match",M.arrowDown,d(1118,null)),q0o=d(1125,null),voi=d(1124,null),j0o=d(1135,null),Q0o=d(1129,null),Y0o=d(1127,null),X0o=d(1134,null),J0o=d(1123,null),boi=d(1130,null),Z0o=d(1136,null),eWo=d(1132,null),tWo=d(1131,null),iWo=d(1133,null),oWo=d(1138,null,rO),T5e=d(1126,null),w7=d(1128,null),M1=419,nWo=275,rWo=nWo-54,C5e=69,sWo=33,W3i=it?256:2048,x5e=class{constructor(i){this.afterLineNumber=i,this.heightInPx=sWo,this.suppressMouseDown=!1,this.domNode=document.createElement("div"),this.domNode.className="dock-find-viewzone"}};function V3i(a,i,e){let t=!!i.match(/\n/);if(e&&t&&e.selectionStart>0){a.stopPropagation();return}}function B3i(a,i,e){let t=!!i.match(/\n/);if(e&&t&&e.selectionEnd<e.value.length){a.stopPropagation();return}}var $It=class a extends Ma{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 jo(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 x5e(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=Rwe.bindTo(s),this._findFocusTracker=this._register(Vn(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=I5e.bindTo(s),this._replaceFocusTracker=this._register(Vn(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=HIt.bindTo(s),this._widgetFocusTracker=this._register(Vn(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=>{Ao(g.target)&&(this._lastFocusedElement=g.target)})),this._codeEditor.addOverlayWidget(this),this._codeEditor.getOption(50).addExtraSpaceOnTop&&(this._viewZone=new x5e(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)&&Me(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=yl(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=C5e+"px",this._state.matchesCount>=rO?this._matchesCount.title=oWo:this._matchesCount.title="",this._matchesCount.firstChild?.remove();let e;if(this._state.matchesCount>0){let t=String(this._state.matchesCount);this._state.matchesCount>=rO&&(t+="+");let o=String(this._state.matchesPosition);o==="0"&&(o="?"),e=id(T5e,o,t)}else e=w7;this._matchesCount.appendChild(document.createTextNode(e)),Jo(this._getAriaLabel(e,this._state.currentMatch,this._state.searchString)),C5e=Math.max(C5e,this._matchesCount.clientWidth)}_getAriaLabel(e,t,o){let n;if(e===w7)n=o===""?d(1112,null,e):d(1111,null,e,o);else if(t){let r=d(1113,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(1114,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=Yn(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=gN(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 x5e(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&&yl(this._domNode)>M1){this._domNode.style.maxWidth=`${o-28-n-15}px`,this._replaceInput.width=yl(this._findInput.domNode);return}if(M1+28+n>=o&&(s=!0),M1+28+n-C5e>=o&&(l=!0),M1+28+n-C5e>=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=yl(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(W3i|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 V3i(e,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea"));if(e.equals(18))return B3i(e,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea"))}_onReplaceInputKeyDown(e){if(e.equals(W3i|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 V3i(e,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea"));if(e.equals(18))return B3i(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 L1(null,this._contextViewProvider,{width:rWo,label:voi,placeholder:j0o,appendCaseSensitiveLabel:this._keybindingLabelFor(ad.ToggleCaseSensitiveCommand),appendWholeWordsLabel:this._keybindingLabelFor(ad.ToggleWholeWordCommand),appendRegexLabel:this._keybindingLabelFor(ad.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:()=>ML(this._keybindingService),inputBoxStyles:pl,toggleStyles:qg,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()})),Wn&&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 KS({label:Q0o+this._keybindingLabelFor(ad.PreviousMatchFindAction),icon:k5e,hoverLifecycleOptions:r,onTrigger:()=>{Oi(this._codeEditor.getAction(ad.PreviousMatchFindAction)).run().then(void 0,mt)}},this._hoverService)),this._nextBtn=this._register(new KS({label:Y0o+this._keybindingLabelFor(ad.NextMatchFindAction),icon:E5e,hoverLifecycleOptions:r,onTrigger:()=>{Oi(this._codeEditor.getAction(ad.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 Kh({icon:Soi,title:X0o+this._keybindingLabelFor(ad.ToggleSearchScopeCommand),isChecked:!1,hoverLifecycleOptions:r,inputActiveOptionBackground:wt(dW),inputActiveOptionBorder:wt(cW),inputActiveOptionForeground:wt(V$)})),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 KS({label:J0o+this._keybindingLabelFor(ad.CloseFindWidgetCommand),icon:lE,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 R1(null,void 0,{label:boi,placeholder:Z0o,appendPreserveCaseLabel:this._keybindingLabelFor(ad.TogglePreserveCaseCommand),history:n==="workspace"?this._replaceWidgetHistory:new Set([]),flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showHistoryHint:()=>ML(this._keybindingService),inputBoxStyles:pl,toggleStyles:qg,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 KS({label:eWo+this._keybindingLabelFor(ad.ReplaceOneAction),icon:Ioi,hoverLifecycleOptions:r,onTrigger:()=>{this._controller.replace()},onKeyDown:h=>{h.equals(1026)&&(this._closeBtn.focus(),h.preventDefault())}},this._hoverService)),this._replaceAllBtn=this._register(new KS({label:tWo+this._keybindingLabelFor(ad.ReplaceAllAction),icon:yoi,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 KS({label:iWo,className:"codicon toggle left",onTrigger:()=>{this._state.change({isReplaceRevealed:!this._isReplaceVisible},!1),this._isReplaceVisible&&(this._replaceInput.width=yl(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=q0o,this._domNode.role="dialog",this._domNode.style.width=`${M1}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 pv(this._domNode,this,{orientation:0,size:2})),this._resized=!1;let p=M1;this._register(this._resizeSash.onDidStart(()=>{p=yl(this._domNode)})),this._register(this._resizeSash.onDidChange(h=>{this._resized=!0;let g=p+h.startX-h.currentX;if(g<M1)return;let f=parseFloat(cU(this._domNode).maxWidth)||0;g>f||(this._domNode.style.width=`${g}px`,this._isReplaceVisible&&(this._replaceInput.width=yl(this._findInput.domNode)),this._findInput.inputBox.layout(),this._tryUpdateHeight())})),this._register(this._resizeSash.onDidReset(()=>{let h=yl(this._domNode);if(h<M1)return;let g=M1;if(!this._resized||h===M1){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=yl(this._findInput.domNode)),this._findInput.inputBox.layout()}))}updateAccessibilitySupport(){let e=this._codeEditor.getOption(2);this._findInput.setFocusInputOnOptionClick(e!==2),this._updateFindInputAriaLabel()}_updateFindInputAriaLabel(){let e=voi,t=boi;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(1110,null,o);e=d(1117,null,e,n),t=d(1137,null,t,n)}this._accessibilityHelpHintAnnounced=!0,this._labelResetTimeout?.dispose(),this._labelResetTimeout=nn(()=>{this._isVisible&&(this._findInput.inputBox.setAriaLabel(voi),this._replaceInput.inputBox.setAriaLabel(boi))},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)}},KS=class extends Ma{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(O3i)),this._domNode.classList.add(...q.asClassNameArray(F3i))):(this._domNode.classList.remove(...q.asClassNameArray(F3i)),this._domNode.classList.add(...q.asClassNameArray(O3i)))}};is((a,i)=>{let e=a.getColor(LN);e&&i.addRule(`.monaco-editor .findMatch { border: 1px ${Ug(a.type)?"dotted":"solid"} ${e}; box-sizing: border-box; }`);let t=a.getColor(cGi);t&&i.addRule(`.monaco-editor .findScope { border: 1px ${Ug(a.type)?"dashed":"solid"} ${t}; }`);let o=a.getColor(gi);o&&i.addRule(`.monaco-editor .find-widget { border: 1px solid ${o}; }`);let n=a.getColor(sGi);n&&i.addRule(`.monaco-editor .findMatchInline { color: ${n}; }`);let r=a.getColor(aGi);r&&i.addRule(`.monaco-editor .currentFindMatchInline { color: ${r}; }`)});var Owe=class extends C{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 KS({label:d(1287,null),icon:M.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),Or(d(1286,null)))}};Owe=I([m(2,Wi),m(3,tt)],Owe);var woi=class{constructor(i,e,t){this.provider=i;this.hover=e;this.ordinal=t}};async function aWo(a,i,e,t,o){let n=await Promise.resolve(a.provideHover(e,t,o)).catch(ss);if(!(!n||!lWo(n)))return new woi(a,n,i)}function _5e(a,i,e,t,o=!1){let r=a.ordered(i,o).map((s,l)=>aWo(s,l,i,e,t));return Fp.fromPromisesResolveOrder(r).coalesce()}async function H3i(a,i,e,t,o=!1){let n=[];for await(let r of _5e(a,i,e,t,o))n.push(r.hover);return n}kS("_executeHoverProvider",(a,i,e)=>{let t=a.get(zt);return H3i(t.hoverProvider,i,e,ve.None)});kS("_executeHoverProvider_recursive",(a,i,e)=>{let t=a.get(zt);return H3i(t.hoverProvider,i,e,ve.None,!0)});function lWo(a){let i=typeof a.range<"u",e=typeof a.contents<"u"&&a.contents&&a.contents.length>0;return i&&e}var qae=_,cWo=Re("hover-increase-verbosity",M.addSmall,d(1290,null)),dWo=Re("hover-decrease-verbosity",M.removeSmall,d(1288,null)),vE=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}},qIt=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}}},P1=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 vE(this,i.range,[new xe().appendText(d(1292,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 vE(this,i.range,[{value:d(1293,null,d5e),isTrusted:!0}],!1,s++))),!g&&typeof p=="number"&&l>=p&&h&&r.push(new vE(this,i.range,[{value:d(1294,null,d5e),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||yW(y))continue;v.options.beforeContentClassName&&(f=!0);let w=new z(i.range.startLineNumber,b,i.range.startLineNumber,S);r.push(new vE(this,w,Yl(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=_5e(i,e,n,o);for await(let s of r)if(!yW(s.hover.contents)){let l=s.hover.range?z.lift(s.hover.range):t.range,c=new qIt(s.hover,s.provider,n);yield new vE(this,l,s.hover.contents,!1,s.ordinal,c)}}renderHoverParts(i,e){return this._renderedHoverParts=new Coi(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))}};P1=I([m(1,Qn),m(2,B),m(3,zt),m(4,_e),m(5,tt),m(6,ge)],P1);var Fwe=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()}},Coi=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 P;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(tl(o=>o.ordinal,qd)),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 P;if(r.add(t),!n)return new Fwe(i,o,r);let s=n.supportsVerbosityAction(0),l=n.supportsVerbosityAction(1);if(!s&&!l)return new Fwe(i,o,r);let c=qae("div.verbosity-actions");o.prepend(c);let u=qae("div.verbosity-actions-inner");return c.append(u),r.add(this._renderHoverExpansionAction(u,0,s)),r.add(this._renderHoverExpansionAction(u,1,l)),new Fwe(i,o,r,u)}_renderMarkdownHover(i,e){return K3i(this._editor,i,this._markdownRendererService,e)}_renderHoverExpansionAction(i,e,t){let o=new P,n=e===0,r=R(i,qae(q.asCSSSelector(n?cWo:dWo)));r.tabIndex=0;let s=o.add(new mv("mouse",void 0,{target:i,position:{hoverPosition:0}},this._configurationService,this._hoverService));if(o.add(this._hoverService.setupManagedHover(s,r,xoi(this._keybindingService,e))),!t)return r.classList.add("disabled"),o;r.classList.add("enabled");let l=()=>this._commandService.executeCommand(e===0?x1:k1,{focus:!0});return o.add(new Aje(r,l)),o.add(new Nje(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 qIt(r,n.hoverProvider,n.hoverPosition),l=o.hoverPart,c=new vE(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 $e;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){ss(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 Fwe(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 z3i(a,i,e,t){i.sort(tl(n=>n.ordinal,qd));let o=[];for(let n of i){let r=K3i(e,n,t,a.onContentsChanged);a.fragment.appendChild(r.hoverElement),o.push(r)}return new Lx(o)}function K3i(a,i,e,t){let o=new P,n=qae("div.hover-row"),r=qae("div.hover-row-contents");n.appendChild(r);let s=i.contents;for(let c of s){if(yW(c))continue;let u=qae("div.markdown-hover"),p=R(u,qae("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 xoi(a,i){switch(i){case 0:return a.appendKeybinding(d(1291,null),x1);case 1:return a.appendKeybinding(d(1289,null),k1)}}var G3i=_,jIt=class extends C{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=G3i(".saturation-wrap"),R(e,this._domNode),this._canvas=document.createElement("canvas"),this._canvas.className="saturation-box",R(this._domNode,this._canvas),this.selection=G3i(".saturation-selection"),R(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 cL);let t=Yn(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 Oe(new kN(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=Oe.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 QIt=class extends C{constructor(e){super();this._onClicked=this._register(new E);this.onClicked=this._onClicked.event;this._button=R(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 YIt=class extends C{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 XIt(a,i,e){let t=a.getValueInRange(i.range),{red:o,green:n,blue:r,alpha:s}=i.color,l=new Bt(Math.round(o*255),Math.round(n*255),Math.round(r*255),s),c=new Oe(l),u=await ioi(a,i,e,ve.None),p=new YIt(c,[],0);return p.colorPresentations=u||[],p.guessColorPresentation(c,t),{range:z.lift(i.range),model:p,provider:e}}function JIt(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 jae(a,i,e,t,o){let n=await ioi(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,ve.None);i.colorPresentations=n||[]}var D5e=_,ZIt=class extends C{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=R(e,D5e(".standalone-strip")),this.overlay=R(this.domNode,D5e(".standalone-overlay"))):(this.domNode=R(e,D5e(".strip")),this.overlay=R(this.domNode,D5e(".overlay"))),this.slider=R(this.domNode,D5e(".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 cL),o=Yn(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`}},eyt=class extends ZIt{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 Oe(new Bt(e,t,o,1)),r=new Oe(new Bt(e,t,o,0));this.overlay.style.background=`linear-gradient(to bottom, ${n} 0%, ${r} 100%)`}getValue(i){return i.hsva.a}},tyt=class extends ZIt{constructor(i,e,t){super(i,e,t),this.domNode.classList.add("hue-strip")}getValue(i){return 1-i.hsva.h/360}};var uWo=_,oyt=class extends C{constructor(e,t,o,n){super();this.model=t;this.pixelRatio=o;this._insertButton=null;this._domNode=uWo(".colorpicker-body"),R(e,this._domNode),this._saturationBox=new jIt(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 eyt(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 tyt(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 QIt(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 Oe(new kN(o.h,e,t,o.a))}onDidOpacityChange(e){let t=this.model.color.hsva;this.model.color=new Oe(new kN(t.h,t.s,t.v,e))}onDidHueChange(e){let t=this.model.color.hsva,o=(1-e)*360;this.model.color=new Oe(new kN(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 pWo=_,nyt=class extends C{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"),R(e,this._button);let t=document.createElement("div");t.classList.add("close-button-inner-div"),R(this._button,t),R(t,pWo(".button"+q.asCSSSelector(Re("color-picker-close",M.close,d(1040,null))))).classList.add("close-icon"),this._register(j(this._button,re.CLICK,()=>{this._onClicked.fire()}))}};var ryt=_,syt=class extends C{constructor(e,t,o,n){super();this.model=t;this.type=n;this._closeButton=null;this._domNode=ryt(".colorpicker-header"),R(e,this._domNode),this._pickedColorNode=R(this._domNode,ryt(".picked-color")),R(this._pickedColorNode,ryt("span.codicon.codicon-color-mode")),this._pickedColorPresentation=R(this._pickedColorNode,document.createElement("span")),this._pickedColorPresentation.classList.add("picked-color-presentation");let r=d(1041,null);this._pickedColorNode.setAttribute("title",r),this._originalColorNode=R(this._domNode,ryt(".original-color")),this._originalColorNode.style.backgroundColor=Oe.Format.CSS.format(this.model.originalColor)||"",this.backgroundColor=o.getColorTheme().getColor(qT)||Oe.white,this._register(o.onDidColorThemeChange(s=>{this.backgroundColor=s.getColor(qT)||Oe.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=Oe.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 nyt(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=Oe.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 mWo=_,Wwe=class a extends Ma{constructor(e,t,o,n,r){super();this.model=t;this.pixelRatio=o;this._register(Xd.getInstance(Me(e)).onDidChange(()=>this.layout())),this._domNode=mWo(".colorpicker-widget"),e.appendChild(this._domNode),this.header=this._register(new syt(this._domNode,this.model,n,r)),this.body=this._register(new oyt(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 ayt=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)}},C7=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=Xy.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[ayt.fromBaseColor(this,await XIt(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 Lx([]);let o=t.getOption(75)+8;i.setMinimumDimensions(new ai(302,o));let n=new P,r=e[0],s=t.getModel(),l=r.model;this._colorPicker=n.add(new Wwe(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 jae(s,l,h,u,r),c=!0,u=JIt(t,u,l)})),n.add(l.onDidChangeColor(h=>{jae(s,l,h,u,r)})),n.add(t.onDidChangeModelContent(h=>{c?c=!1:(i.hide(),t.focus())}));let p={hoverPart:ayt.fromBaseColor(this,r),hoverElement:this._colorPicker.domNode,dispose(){n.dispose()}};return new Lx([p])}getAccessibleContent(i){return d(1042,null)}handleResize(){this._colorPicker?.layout()}handleContentsChanged(){this._colorPicker?.layout()}handleHide(){this._colorPicker?.dispose(),this._colorPicker=void 0}isColorPickerVisible(){return!!this._colorPicker}};C7=I([m(1,De)],C7);function koi(a,i){return!!a[i]}var L5e=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=koi(i.event,e.triggerModifier),this.isMiddleClick&&e.mouseMiddleClickAction==="ctrlLeftClick"&&(this.isMiddleClick=!1,this.isLeftClick=!0,this.hasTriggerModifier=!0),this.hasSideBySideModifier=koi(i.event,e.triggerSideBySideModifier),this.isNoneOrSingleMouseDown=i.event.detail<=1}},lyt=class{constructor(i,e){this.keyCodeIsTriggerKey=i.keyCode===e.triggerKey,this.keyCodeIsSideBySideKey=i.keyCode===e.triggerSideBySideKey,this.hasTriggerModifier=koi(i,e.triggerModifier)}},Vwe=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 $3i(a,i){return a==="altKey"?it?new Vwe(57,"metaKey",6,"altKey",i):new Vwe(5,"ctrlKey",6,"altKey",i):it?new Vwe(6,"altKey",57,"metaKey",i):new Vwe(6,"altKey",5,"ctrlKey",i)}var sO=class extends C{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=$3i(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=$3i(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 L5e(o,this._opts)))),this._register(this._editor.onMouseDown(o=>this._onEditorMouseDown(new L5e(o,this._opts)))),this._register(this._editor.onMouseUp(o=>this._onEditorMouseUp(new L5e(o,this._opts)))),this._register(this._editor.onKeyDown(o=>this._onEditorKeyDown(new lyt(o,this._opts)))),this._register(this._editor.onKeyUp(o=>this._onEditorKeyUp(new lyt(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 R5e=class{constructor(i,e){this.range=i;this.direction=e}},Eoi=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){ss(e),this._isResolved=!1}}},M5e=class a{constructor(i,e,t){this._disposables=new P;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 Eoi(s,new R5e(p,c),r))}}this.items=o.sort((n,r)=>Ie.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){ss(c)}}));if(await Promise.all(r.flat()),o.isCancellationRequested||e.isDisposed())throw new ho;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 cyt(a){return ic(a.id,...a.arguments??[]).toString()}var zc=class extends jr{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){Nu(this._overwriteOptions,i,!0),super.updateOptions(this._overwriteOptions)}};zc=I([m(4,F),m(5,Kt),m(6,ge),m(7,X),m(8,De),m(9,Ne),m(10,Bi),m(11,bs),m(12,zt),m(13,eC)],zc);function Bwe(a){let i=a.get(Kt).getFocusedCodeEditor();return i instanceof zc?i.getParentEditor():i}var q3i=new Oe(new Bt(0,122,204)),hWo={showArrow:!0,showFrame:!0,className:"",frameColor:q3i,arrowColor:q3i,keepEditorSelection:!1},gWo="vs.editor.contrib.zoneWidget",Toi=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)}},_oi=class{constructor(i,e){this._id=i,this._domNode=e}getId(){return this._id}getDomNode(){return this._domNode}getPosition(){return null}},Doi=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 vae(".arrow-decoration-")}dispose(){this.hide(),EN(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(){EN(this._ruleName),Vh(`.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()}},aO=class{constructor(i,e={}){this._arrow=null;this._overlayWidget=null;this._resizeSash=null;this._isSashResizeHeight=!1;this._viewZone=null;this._disposables=new P;this.container=null;this._isShowing=!1;this.editor=i,this._positionMarkerId=this.editor.createDecorationsCollection(),this.options=Xi(e),Nu(this.options,hWo,!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 Doi(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(Pn())}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:po.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:po.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 Toi(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 _oi(gWo+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 pv(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 Kq=ae("IPeekViewService");we(Kq,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 Gh;(e=>(e.inPeekEditor=new Q("inReferenceSearchEditor",!0,d(1474,null)),e.notInPeekEditor=e.inPeekEditor.toNegated()))(Gh||={});var Hwe=class{static{this.ID="editor.contrib.referenceController"}constructor(i,e){i instanceof zc&&Gh.inPeekEditor.bindTo(e)}dispose(){}};Hwe=I([m(1,X)],Hwe);go(Hwe.ID,Hwe,0);var fWo={headerBackgroundColor:Oe.white,primaryHeadingColor:Oe.fromHex("#333333"),secondaryHeadingColor:Oe.fromHex("#6c6c6cb3")},bE=class extends aO{constructor(e,t,o){super(e,t);this.instantiationService=o;this._onDidClose=new E;this.onDidClose=this._onDidClose.event;Nu(this.options,fWo,!1);let n=os(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=os(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"),Vo(this._titleElement,"click",r=>this._onTitleClick(r))),R(this._headElement,this._titleElement),this._fillTitleIcon(this._titleElement),this._primaryHeading=_("span.filename"),this._secondaryHeading=_("span.dirname"),this._metaHeading=_("span.meta"),R(this._titleElement,this._primaryHeading,this._secondaryHeading,this._metaHeading);let o=_(".peekview-actions");R(this._headElement,o);let n=this._getActionBarOptions();this._actionbarWidget=new ji(o,n),this._disposables.add(this._actionbarWidget),t||this._actionbarWidget.push(this._disposables.add(new st("peekview.close",d(1475,null),q.asClassName(M.close),!0,()=>(this.dispose(),Promise.resolve()))),{label:!1,icon:!0})}_fillTitleIcon(e){}_getActionBarOptions(){return{actionViewItemProvider:Ca.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,bn(this._metaHeading)):xo(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`)}};bE=I([m(2,F)],bE);var DW=J("peekViewTitle.background",{dark:"#252526",light:"#F3F3F3",hcDark:Oe.black,hcLight:Oe.white},d(1489,null)),lO=J("peekViewTitleLabel.foreground",{dark:Oe.white,light:Oe.black,hcDark:Oe.white,hcLight:od},d(1490,null)),cO=J("peekViewTitleDescription.foreground",{dark:"#ccccccb3",light:"#616161",hcDark:"#FFFFFF99",hcLight:"#292929"},d(1491,null)),p_=J("peekView.border",{dark:fm,light:fm,hcDark:gi,hcLight:gi},d(1476,null)),x7=J("peekViewResult.background",{dark:"#252526",light:"#F3F3F3",hcDark:Oe.black,hcLight:Oe.white},d(1483,null)),s$r=J("peekViewResult.lineForeground",{dark:"#bbbbbb",light:"#646465",hcDark:Oe.white,hcLight:od},d(1485,null)),a$r=J("peekViewResult.fileForeground",{dark:Oe.white,light:"#1E1E1E",hcDark:Oe.white,hcLight:od},d(1484,null)),l$r=J("peekViewResult.selectionBackground",{dark:"#3399ff33",light:"#3399ff33",hcDark:null,hcLight:null},d(1487,null)),c$r=J("peekViewResult.selectionForeground",{dark:Oe.white,light:"#6C6C6C",hcDark:Oe.white,hcLight:od},d(1488,null)),Loi=J("peekViewEditor.background",{dark:"#001F33",light:"#F2F8FC",hcDark:Oe.black,hcLight:Oe.white},d(1477,null)),d$r=J("peekViewEditorGutter.background",Loi,d(1478,null)),u$r=J("peekViewEditorStickyScroll.background",Loi,d(1481,null)),p$r=J("peekViewEditorStickyScrollGutter.background",Loi,d(1482,null)),m$r=J("peekViewResult.matchHighlightBackground",{dark:"#ea5c004d",light:"#ea5c004d",hcDark:null,hcLight:null},d(1486,null)),dyt=J("peekViewEditor.matchHighlightBackground",{dark:"#ff8f0099",light:"#f5d802de",hcDark:null,hcLight:null},d(1479,null)),h$r=J("peekViewEditor.matchHighlightBorder",{dark:null,light:null,hcDark:qs,hcLight:qs},d(1480,null));var Moi=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:C.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 $e,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)}},Poi=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 vWo(a,i){return{...i,accessibilityProvider:i.accessibilityProvider&&new Poi(a,i.accessibilityProvider)}}var A1=class{constructor(i,e,t,o,n={}){this.modelDisposables=new P;let r=()=>this.model,s=o.map(l=>new Moi(l,r));this.list=new hc(i,e,t,s,vWo(r,n))}updateOptions(i){this.list.updateOptions(i)}getHTMLElement(){return this.list.getHTMLElement()}isDOMFocused(){return sa(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 H.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 H.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 H.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 H.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 H.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 H.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 H.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 bWo={separatorBorder:Oe.transparent};var uyt=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=Kn(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()}},Aoi=class extends uyt{layoutContainer(i){this.container.style.top=`${i}px`,this.container.style.height=`${this.size}px`}},Noi=class extends uyt{layoutContainer(i){this.container.style.left=`${i}px`,this.container.style.width=`${this.size}px`}};var Wl;(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})(Wl||={});var vu=class extends C{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=R(this.el,_(".sash-container")),this.viewContainer=_(".split-view-container"),this.scrollable=this._register(new UT({forceIntegerValues:!0,smoothScrollDuration:125,scheduleAtNextAnimationFrame:n=>$r(Me(this.el),n)})),this.scrollableElement=this._register(new AN(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 On(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)})),R(this.el,this.scrollableElement.getDomNode()),this.style(t.styles||bWo),t.descriptor&&(this.size=t.descriptor.size,t.descriptor.views.forEach((n,r)=>{let s=cn(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):Wl.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=Kn(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=hn(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((U,G)=>U+(this.viewItems[G].minimumSize-u[G]),0),y=v.reduce((U,G)=>U+(this.viewItems[G].viewMaximumSize-u[G]),0),w=b.length===0?Number.POSITIVE_INFINITY:b.reduce((U,G)=>U+(u[G]-this.viewItems[G].minimumSize),0),k=b.length===0?Number.NEGATIVE_INFINITY:b.reduce((U,G)=>U+(u[G]-this.viewItems[G].viewMaximumSize),0),T=Math.max(S,k),N=Math.min(w,y),O=this.findFirstSnapIndex(v),V=this.findFirstSnapIndex(b);if(typeof O=="number"){let U=this.viewItems[O],G=Math.floor(U.viewMinimumSize/2);g={index:O,limitDelta:U.visible?T-G:T+G,size:U.size}}if(typeof V=="number"){let U=this.viewItems[V],G=Math.floor(U.viewMinimumSize/2);f={index:V,limitDelta:U.visible?N+G:N-G,size:U.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=Kn(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=Kn(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=Kn(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=hn(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 Aoi(r,e,u,c):new Noi(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 pv(this.sashContainer,{getHorizontalSashTop:U=>this.getSashPosition(U),getHorizontalSashWidth:this.getSashOrthogonalSize},{...g,orientation:1}):new pv(this.sashContainer,{getVerticalSashLeft:U=>this.getSashPosition(U),getVerticalSashHeight:this.getSashOrthogonalSize},{...g,orientation:0}),v=this.orientation===0?U=>({sash:f,start:U.startY,current:U.currentY,alt:U.altKey}):U=>({sash:f,start:U.startX,current:U.currentX,alt:U.altKey}),S=H.map(f.onDidStart,v)(this.onSashStart,this),w=H.map(f.onDidChange,v)(this.onSashChange,this),T=H.map(f.onDidEnd,()=>this.sashItems.findIndex(U=>U.sash===f))(this.onSashEnd,this),N=f.onDidReset(()=>{let U=this.sashItems.findIndex(de=>de.sash===f),G=ig(U,-1),$=ig(U+1,this.viewItems.length),te=this.findFirstSnapIndex(G),pe=this.findFirstSnapIndex($);typeof te=="number"&&!this.viewItems[te].visible||typeof pe=="number"&&!this.viewItems[pe].visible||this._onDidSashReset.fire(U)}),O=hn(S,w,T,N,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)Fut(p,V),Fut(h,V);if(n)for(let V of n)iGe(p,V),iGe(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,U)=>V+(this.viewItems[U].minimumSize-o[U]),0),y=p.reduce((V,U)=>V+(this.viewItems[U].maximumSize-o[U]),0),w=h.length===0?Number.POSITIVE_INFINITY:h.reduce((V,U)=>V+(o[U]-this.viewItems[U].minimumSize),0),k=h.length===0?Number.NEGATIVE_INFINITY:h.reduce((V,U)=>V+(o[U]-this.viewItems[U].maximumSize),0),T=Math.max(S,k,s),N=Math.min(w,y,l),O=!1;if(c){let V=this.viewItems[c.index],U=t>=c.limitDelta;O=U!==V.visible,V.setVisible(U,c.size)}if(!O&&u){let V=this.viewItems[u.index],U=t<u.limitDelta;O=U!==V.visible,V.setVisible(U,u.size)}if(O)return this.resize(e,t,o,n,r,s,l);t=Kn(t,T,N);for(let V=0,U=t;V<g.length;V++){let G=g[V],$=Kn(f[V]+U,G.minimumSize,G.maximumSize),te=$-f[V];U-=te,G.size=$}for(let V=0,U=t;V<v.length;V++){let G=v[V],$=Kn(b[V]-U,G.minimumSize,G.maximumSize),te=$-b[V];U+=te,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)Fut(n,l);for(let l of r)iGe(n,l);typeof e=="number"&&iGe(n,e);for(let l=0;o!==0&&l<n.length;l++){let c=this.viewItems[n[l]],u=Kn(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(),Ue(this.viewItems),this.viewItems=[],this.sashItems.forEach(e=>e.disposable.dispose()),this.sashItems=[],super.dispose()}};var pyt=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=R(i,_(".monaco-table-tr")),t=[],o=[];for(let r=0;r<this.columns.length;r++){let s=this.renderers[r],l=R(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 SWo(a){return{getHeight(i){return a.getHeight(i)},getTemplateId(){return pyt.TemplateId}}}var Ooi=class extends C{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(yp().setupManagedHover(Ni("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??H.None}layout(e){this._onDidLayout.fire([this.index,e])}},dO=class a{constructor(i,e,t,o,n,r){this.virtualDelegate=t;this.columns=o;this.domId=`table_id_${++a.InstanceCount}`;this.disposables=new P;this.cachedWidth=0;this.cachedHeight=0;this.domNode=R(e,_(`.monaco-table.${this.domId}`));let s=o.map((u,p)=>this.disposables.add(new Ooi(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 vu(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 pyt(o,n,u=>this.splitview.getViewSize(u));this.list=this.disposables.add(new hc(i,this.domNode,SWo(t),[c],r)),H.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=hr(this.domNode),this.style(eSt)}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??qbe(this.domNode),e=e??D6(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 pg=class extends Error{constructor(i,e){super(`TreeError [${i}] ${e}`)}},Qae=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 k7(a){return!!a&&a.visibility!==void 0}function N1(a){switch(a){case!0:return 1;case!1:return 0;default:return a}}function Foi(a){return"collapsible"in a}var myt=class{constructor(i,e,t={}){this.user=i;this.rootRef=[];this.eventBufferer=new eN;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 jo(QD);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=ht.empty(),o={}){if(i.length===0)throw new pg(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=ht.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 MM({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,ht.slice(l,f,f+v.modifiedLength),n);h(g,f,g)}spliceSimple(i,e,t=ht.empty(),{onDidCreateNode:o,onDidDeleteNode:n,diffIdentityProvider:r}){let{parentNode:s,listIndex:l,revealed:c,visible:u}=this.getParentNodeWithListIndex(i),p=[],h=ht.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 N=s.children[T];if(N.visible){f=N.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=ure(s.children,g,e,v);r?s.lastDiffIds?ure(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 N=s.children[T];N.visible&&(N.visibleChildIndex-=w)}if(s.visibleChildrenCount+=b-w,y.length>0&&n){let T=N=>{n(N),N.children.forEach(T)};y.forEach(T)}if(c&&u){let T=y.reduce((N,O)=>N+(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 pg(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&&!Foi(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:(Foi(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})),!Foi(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||ht.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):k7(t)?(i.filterData=t.data,N1(t.visibility)):(i.filterData=void 0,N1(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 pg(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 pg(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 pg(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?[]:Mg(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 Voi=class extends $y{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 Woi(a){return a instanceof $y?new Voi(a):a}var Boi=class{constructor(i,e){this.modelProvider=i;this.dnd=e;this.autoExpandDisposable=C.None;this.disposables=new P}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?.(Woi(i),e)}onDragOver(i,e,t,o,n,r=!0){let s=this.dnd.onDragOver(Woi(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=nn(()=>{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(Woi(i),e&&e.element,t,o,n)}onDragEnd(i){this.dnd.onDragEnd?.(i)}dispose(){this.disposables.dispose(),this.dnd.dispose()}};function IWo(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 Boi(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 Uwe=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)}},A5e=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 Hoi=class{constructor(i,e=[]){this._elements=e;this.disposables=new P;this.onDidChange=H.forEach(i,t=>this._elements=t,this.disposables)}get elements(){return this._elements}dispose(){this.disposables.dispose()}},Uoi=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=C.None;this.disposables=new P;this.templateId=i.templateId,this.updateOptions(r),H.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"?Kn(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 P;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=R(i,_(".monaco-tl-row")),t=R(e,_(".monaco-tl-indent")),o=R(e,_(".monaco-tl-twistie")),n=R(e,_(".monaco-tl-contents")),r=this.renderer.renderTemplate(n);return{container:i,indent:t,twistie:o,indentGuidesDisposable:C.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(M.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(M.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 P;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(),Ue(this.disposables)}};function yWo(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 N5e=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 P}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:k7(r)?t=N1(r.visibility):t=r,t===0)return!1}if(this._totalCount++,!this._pattern)return this._matchCount++,{data:uv.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:uv.Default,visibility:t};let l;if(this._findMatchType===1?l=yWo(this._lowercasePattern,s.toLowerCase()):l=wL(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:uv.Default,visibility:t}}reset(){this._totalCount=0,this._matchCount=0}dispose(){Ue(this.disposables)}},zoi=class extends Kh{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}},Koi=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)}},wWo={inputBoxStyles:P3i,toggleStyles:b7,listFilterWidgetBackground:void 0,listFilterWidgetNoMatchesOutline:void 0,listFilterWidgetOutline:void 0,listFilterWidgetShadow:void 0};var Goi=class extends C{constructor(e,t,o,n,r=[],s){super();this.tree=t;this.elements=bt(".monaco-tree-type-filter",[bt(".monaco-tree-type-filter-input@findInput"),bt(".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??wWo;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 zoi(f,l.toggleStyles,c))),this.onDidToggleChange=H.any(...this.toggles.map(f=>H.map(f.onChange,()=>({id:f.id,isChecked:f.checked}))));let u=s?.history||[];this.findInput=this._register(new _1(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 ji(this.elements.actionbar));let p=this._register(new On(this.findInput.inputBox.inputElement,"keydown")),h=H.chain(p.event,f=>f.map(v=>new Ii(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 st("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 Pi(300),super.dispose()}};var $oi=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 P;this.disposables=new P;this.toggles=new Koi(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 Goi(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?Jo(d(35,null,i)):Jo(d(38,null))}dispose(){this._history=void 0,this._onDidChangePattern.dispose(),this.enabledDisposables.dispose(),this.disposables.dispose()}},O5e=class extends $oi{constructor(e,t,o,n={}){let r=n.defaultFindMode??0,s=n.defaultFindMatchType??0,l=[{id:"mode",icon:M.listFilter,title:d(34,null),isChecked:r===1},{id:"matchType",icon:M.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=>!uv.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:!uv.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 CWo(a,i){return a.position===i.position&&Y3i(a,i)}function Y3i(a,i){return a.node.element===i.node.element&&a.startIndex===i.startIndex&&a.height===i.height&&a.endIndex===i.endIndex}var qoi=class{constructor(i=[]){this.stickyNodes=i}get count(){return this.stickyNodes.length}equal(i){return $i(this.stickyNodes,i.stickyNodes,CWo)}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,Y3i)||this.count===0)return!1;let e=this.stickyNodes[this.count-1],t=i.stickyNodes[i.count-1];return e.position!==t.position}},joi=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}},gyt=class extends C{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 joi,this.paddingTop=s.paddingTop??0,this._widget=this._register(new Qoi(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 qoi(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}}},Qoi=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 P;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 Yoi(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 C.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:Oo(n),s=he(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()}},Yoi=class extends C{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(!Pye(t)&&!Mye(t)){this.focusedLast()&&this.view.domFocus();return}if(!ag(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;!Pye(t)&&!Mye(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=Kn(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 Yae(a){let i=0;return Qbe(a.browserEvent.target,"monaco-tl-twistie","monaco-tl-row")?i=1:Qbe(a.browserEvent.target,"monaco-tl-contents","monaco-tl-row")?i=2:Qbe(a.browserEvent.target,"monaco-tree-type-filter","monaco-list")&&(i=3),{browserEvent:a.browserEvent,element:a.element?a.element.element:null,target:i}}function xWo(a){let i=Pye(a.browserEvent.target);return{element:a.element?a.element.element:null,browserEvent:a.browserEvent,anchor:a.anchor,isStickyScroll:i}}function hyt(a,i){i(a),a.children.forEach(e=>hyt(e,i))}var P5e=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=>hyt(u,c)),this.set([...l.values()]);return}let t=new Set,o=l=>t.add(this.identityProvider.getId(l.element).toString());e.forEach(l=>hyt(l,o));let n=new Map,r=l=>n.set(this.identityProvider.getId(l.element).toString(),l);i.forEach(l=>hyt(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}},Xoi=class extends gae{constructor(e,t,o){super(e);this.tree=t;this.stickyScrollProvider=o}onViewPointer(e){if(lti(e.browserEvent.target)||Oh(e.browserEvent.target)||G9(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=Mye(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(e5i(e.browserEvent.target)||t5i(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(!Pye(t)&&!Mye(t)){super.onMouseDown(e);return}}onContextMenu(e){let t=e.browserEvent.target;if(!Pye(t)&&!Mye(t)){super.onContextMenu(e);return}}},Joi=class extends hc{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 Xoi(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(Uo([...super.getFocus(),...n])),r.length>0&&super.setSelection(Uo([...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 LW=class{constructor(i,e,t,o,n={}){this._user=i;this._options=n;this.eventBufferer=new eN;this.onDidChangeFindOpenState=H.None;this.onDidChangeStickyScrollFocused=H.None;this.disposables=new P;this.onDidSwapModel=this.disposables.add(new E);this.onDidChangeModelRelay=this.disposables.add(new Mh);this.onDidSpliceModelRelay=this.disposables.add(new Mh);this.onDidChangeCollapseStateRelay=this.disposables.add(new Mh);this.onDidChangeRenderNodeCountRelay=this.disposables.add(new Mh);this.onDidChangeActiveNodesRelay=this.disposables.add(new Mh);this._onWillRefilter=new E;this.onWillRefilter=this._onWillRefilter.event;this._onDidUpdateOptions=new E;this.onDidUpdateOptions=this._onDidUpdateOptions.event;this.modelDisposables=new P;n.keyboardNavigationLabelProvider&&(n.findWidgetEnabled??!0)&&(this.findFilter=new N5e(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 Uwe(t);let r=this.disposables.add(new Hoi(this.onDidChangeActiveNodesRelay.event)),s=new KH;this.renderers=o.map(l=>new Uoi(l,this.model,this.onDidChangeCollapseStateRelay.event,r,s,n));for(let l of this.renderers)this.disposables.add(l);if(this.focus=new P5e(()=>this.view.getFocusedElements()[0],n.identityProvider),this.selection=new P5e(()=>this.view.getSelectedElements()[0],n.identityProvider),this.anchor=new P5e(()=>this.view.getAnchorElement(),n.identityProvider),this.view=new Joi(i,e,this.treeDelegate,this.renderers,this.focus,this.selection,this.anchor,{...IWo(()=>this.model,this.disposables,n),tree:this,stickyScrollProvider:()=>this.stickyScrollController}),this.setupModel(this.model),n.keyboardSupport!==!1){let l=H.chain(this.view.onKeyDown,c=>c.filter(u=>!Oh(u.target)).map(u=>new Ii(u)));H.chain(l,c=>c.filter(u=>u.keyCode===15))(this.onLeftArrow,this,this.disposables),H.chain(l,c=>c.filter(u=>u.keyCode===17))(this.onRightArrow,this,this.disposables),H.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 O5e(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=H.None,this.onDidChangeFindMatchType=H.None;n.enableStickyScroll&&(this.stickyScrollController=new gyt(this,this.model,this.view,this.renderers,this.treeDelegate,n),this.onDidChangeStickyScrollFocused=this.stickyScrollController.onDidChangeHasFocus),this.styleElement=hr(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 H.map(this.view.onMouseClick,Yae)}get onMouseDblClick(){return H.filter(H.map(this.view.onMouseDblClick,Yae),i=>i.target!==3)}get onMouseMiddleClick(){return H.filter(H.map(this.view.onMouseMiddleClick,Yae),i=>i.target!==3)}get onMouseOver(){return H.map(this.view.onMouseOver,Yae)}get onMouseOut(){return H.map(this.view.onMouseOut,Yae)}get onContextMenu(){return H.any(H.filter(H.map(this.view.onContextMenu,xWo),i=>!i.isStickyScroll),this.stickyScrollController?.onContextMenu??H.None)}get onTap(){return H.map(this.view.onTap,Yae)}get onPointer(){return H.map(this.view.onPointer,Yae)}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 H.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:H.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(this._options),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 gyt(this,this.model,this.view,this.renderers,this.treeDelegate,this._options),this.onDidChangeStickyScrollFocused=this.stickyScrollController.onDidChangeHasFocus):this.stickyScrollController&&!this._options.enableStickyScroll&&(this.onDidChangeStickyScrollFocused=H.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 sa(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=n_(i.listFocusAndSelectionOutline,n_(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=ag(t)&&t.altKey?void 0:this.focusNavigationFilter){this.view.focusNext(i,e,t,o)}focusPrevious(i=1,e=!1,t,o=ag(t)&&t.altKey?void 0:this.focusNavigationFilter){this.view.focusPrevious(i,e,t,o)}focusNextPage(i,e=ag(i)&&i.altKey?void 0:this.focusNavigationFilter){return this.view.focusNextPage(i,e)}focusPreviousPage(i,e=ag(i)&&i.altKey?void 0:this.focusNavigationFilter){return this.view.focusPreviousPage(i,e,()=>this.stickyScrollController?.height??0)}focusLast(i,e=ag(i)&&i.altKey?void 0:this.focusNavigationFilter){this.view.focusLast(i,e)}focusFirst(i,e=ag(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 pg(this._user,"Can't get tree view state without an identity provider");let e=r=>i.getId(r).toString(),t=A5e.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),dre(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=H.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 jo(0));this.modelDisposables.add(H.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=H.signal(i.onDidSpliceModel),this.onDidChangeCollapseStateRelay.input=i.onDidChangeCollapseState,this.onDidChangeRenderNodeCountRelay.input=i.onDidChangeRenderNodeCount,this.onDidSpliceModelRelay.input=i.onDidSpliceModel,it&&this.modelDisposables.add(i.onDidChangeCollapseState(n=>{let{node:r,deep:s}=n;r.collapsible&&!s&&this.isDOMFocused()&&Jo(r.collapsed?d(39,null):d(40,null))}))}navigate(i){return new Zoi(this.view,this.model,i)}delegateScrollFromMouseWheelEvent(i){this.view.delegateScrollFromMouseWheelEvent(i)}dispose(){Ue(this.disposables),this.stickyScrollController?.dispose(),this.view.dispose(),this.modelDisposables.dispose()}},Zoi=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 O1=class{constructor(i,e={}){this.user=i;this.rootRef=null;this.nodes=new Map;this.nodesByIdentity=new Map;this.model=new myt(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=ht.empty(),t={}){let o=this.getElementLocation(i);this._setChildren(o,this.preserveCollapseState(e),t)}_setChildren(i,e=ht.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=ht.empty()){return this.sorter&&(i=[...i].sort(this.sorter.compare.bind(this.sorter))),ht.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))),ht.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 pg(this.user,`Tree element not found: ${i}`);return e}getNodeLocation(i){return i.element}getParentNodeLocation(i){if(i===null)throw new pg(this.user,"Invalid getParentNodeLocation call");let e=this.nodes.get(i);if(!e)throw new pg(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 pg(this.user,`Tree element not found: ${i}`);return this.model.getNodeLocation(e)}};function vyt(a){let i=[a.element],e=a.incompressible||!1;return{element:{elements:i,incompressible:e},children:ht.map(ht.from(a.children),vyt),collapsible:a.collapsible,collapsed:a.collapsed}}function byt(a){let i=[a.element],e=a.incompressible||!1,t,o;for(;[o,t]=ht.consume(ht.from(a.children),2),!(o.length!==1||o[0].incompressible);)a=o[0],i.push(a.element);return{element:{elements:i,incompressible:e},children:ht.map(ht.concat(o,t),byt),collapsible:a.collapsible,collapsed:a.collapsed}}function eni(a,i=0){let e;return i<a.element.elements.length-1?e=[eni(a,i+1)]:e=ht.map(ht.from(a.children),t=>eni(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 X3i(a){return eni(a,0)}function J3i(a,i,e){return a.element===i?{...a,children:e}:{...a,children:ht.map(ht.from(a.children),t=>J3i(t,i,e))}}var kWo=a=>({getId(i){return i.elements.map(e=>a.getId(e).toString()).join("\0")}}),tni=class{constructor(i,e={}){this.user=i;this.rootRef=null;this.nodes=new Map;this.model=new O1(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=ht.empty(),t){let o=t.diffIdentityProvider&&kWo(t.diffIdentityProvider);if(i===null){let f=ht.map(e,this.enabled?byt:vyt);this._setChildren(null,f,{diffIdentityProvider:o,diffDepth:1/0});return}let n=this.nodes.get(i);if(!n)throw new pg(this.user,"Unknown compressed tree node");let r=this.model.getNode(n),s=this.model.getParentNodeLocation(n),l=this.model.getNode(s),c=X3i(r),u=J3i(c,i,e),p=(this.enabled?byt:vyt)(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||ht.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=ht.map(t,X3i),n=ht.map(o,i?byt:vyt);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 pg(this.user,`Tree element not found: ${i}`);return e}},EWo=a=>a[a.length-1],ini=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 TWo(a,i){return{...i,identityProvider:i.identityProvider&&{getId(e){return i.identityProvider.getId(a(e))}},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=N1(k7(r)?r.visibility:r)}return i.filter.filter(o[o.length-1],t)}}}}var Syt=class{constructor(i,e={}){this.rootRef=null;this.elementMapper=e.elementMapper||EWo;let t=o=>this.elementMapper(o.elements);this.nodeMapper=new Qae(o=>new ini(t,o)),this.model=new tni(i,TWo(t,e))}get onDidSpliceModel(){return H.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 H.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 H.map(this.model.onDidChangeCollapseState,({node:i,deep:e})=>({node:this.nodeMapper.map(i),deep:e}))}get onDidChangeRenderNodeCount(){return H.map(this.model.onDidChangeRenderNodeCount,i=>this.nodeMapper.map(i))}setChildren(i,e=ht.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 Jy=class extends LW{constructor(e,t,o,n,r={}){super(e,t,o,n,r);this.user=e}get onDidChangeCollapseState(){return this.model.onDidChangeCollapseState}setChildren(e,t=ht.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 O1(e,t)}},Iyt=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([mi],Iyt.prototype,"compressedTreeNodeProvider",1);var oni=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 _Wo(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 zwe=class extends Jy{constructor(i,e,t,o,n={}){let r=()=>this,s=new oni(()=>this.model),l=o.map(c=>new Iyt(r,s,c));super(i,e,t,l,{..._Wo(r,n),stickyScrollDelegate:s})}setChildren(i,e=ht.empty(),t){this.model.setChildren(i,e,t)}createModel(i,e){return new Syt(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 nni(a){return{...a,children:[],refreshPromise:void 0,stale:!0,slow:!1,forceExpanded:!1}}function sni(a,i){return i.parent?i.parent===a?!0:sni(a,i.parent):!1}function DWo(a,i){return a===i||sni(a,i)||sni(i,a)}var ani=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}},lni=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(M.treeItemLoading)),!0):(e.classList.remove(...q.asClassNameArray(M.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 Z3i(a){return{browserEvent:a.browserEvent,elements:a.elements.map(i=>i.element)}}function yyt(a){return{browserEvent:a.browserEvent,element:a.element&&a.element.element,target:a.target}}function LWo(a){return{browserEvent:a.browserEvent,element:a.element&&a.element.element,anchor:a.anchor,isStickyScroll:a.isStickyScroll}}var cni=class extends $y{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 rni(a){return a instanceof $y?new cni(a):a}var dni=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?.(rni(i),e)}onDragOver(i,e,t,o,n,r=!0){return this.dnd.onDragOver(rni(i),e&&e.element,t,o,n)}drop(i,e,t,o,n){this.dnd.drop(rni(i),e&&e.element,t,o,n)}onDragEnd(i){this.dnd.onDragEnd?.(i)}dispose(){this.dnd.dispose()}},uni=class extends N5e{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=k7(o)?o.visibility:o;return N1(n)===0?0:this.findProvider.isVisible(e)?o:0}},pni=class extends O5e{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 $e,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:!uv.isDefault(e.filterData)}};function e8i(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 dni(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 mni(a,i){i(a),a.children.forEach(e=>mni(e,i))}var gv=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 Qae(i=>new ani(i));this.disposables=new P;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 uni(r.findProvider,r.keyboardNavigationLabelProvider,r.filter)),this.tree=this.createTree(i,e,t,o,{...r,findWidgetEnabled:!s,filter:l??r.filter}),this.root=nni({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 pni(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 H.map(this.tree.onDidChangeFocus,Z3i)}get onDidChangeSelection(){return H.map(this.tree.onDidChangeSelection,Z3i)}get onKeyDown(){return this.tree.onKeyDown}get onMouseClick(){return H.map(this.tree.onMouseClick,yyt)}get onMouseDblClick(){return H.map(this.tree.onMouseDblClick,yyt)}get onContextMenu(){return H.map(this.tree.onContextMenu,LWo)}get onTap(){return H.map(this.tree.onTap,yyt)}get onPointer(){return H.map(this.tree.onPointer,yyt)}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 Uwe(t),s=o.map(c=>new lni(c,this.nodeMapper,this._onDidChangeNodeSlowState.event)),l=e8i(n)||{};return new Jy(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 fni(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 pg(this.user,"Tree input not set");this.root.refreshPromise&&(await this.root.refreshPromise,await H.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 pg(this.user,"Tree input not set");this.root.refreshPromise&&(await this.root.refreshPromise,await H.toPromise(this._onDidRender.event));let t=this.getDataNode(i);if(this.tree.hasElement(t)&&!this.tree.isCollapsible(t)||(t.refreshPromise&&(await t.refreshPromise,await H.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 H.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 ht.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 pg(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&&DWo(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=xn(async()=>{let n=await this.doRefreshNode(i,e,t);i.stale=!1,await fn.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(ht.empty());else{let n=this.doGetChildren(i);if(oGe(n))o=Promise.resolve(n);else{let r=Pi(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),so(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 oGe(t)?this.processChildren(t):(e=xn(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=nni({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=>mni(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=nni({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())mni(u,p=>this.nodes.delete(p.element));for(let u of c)this.nodes.set(u.element,u);return ure(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)}}};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?ht.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 pg(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)),dre(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()}},hni=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}},gni=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(M.treeItemLoading)),!0):(e.classList.remove(...q.asClassNameArray(M.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=Ue(this.disposables)}};function RWo(a){let i=a&&e8i(a);return i&&{...i,keyboardNavigationLabelProvider:i.keyboardNavigationLabelProvider&&{...i.keyboardNavigationLabelProvider,getCompressedNodeKeyboardNavigationLabel(e){return a.keyboardNavigationLabelProvider.getCompressedNodeKeyboardNavigationLabel(e.map(t=>t.element))}},stickyScrollDelegate:i.stickyScrollDelegate}}var wyt=class extends gv{constructor(e,t,o,n,r,s,l={}){super(e,t,o,r,s,l);this.compressionDelegate=n;this.compressibleNodeMapper=new Qae(e=>new hni(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 Uwe(o),l=n.map(u=>new gni(u,this.nodeMapper,()=>this.compressibleNodeMapper,this._onDidChangeNodeSlowState.event)),c=RWo(r)||{};return new zwe(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 pg(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=ht.filter(e,t=>{let o=this.filter.filter(t,1),n=MWo(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 MWo(a){return typeof a=="boolean"?a?1:0:k7(a)?N1(a.visibility):N1(a)}var fni=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 SE=class extends LW{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 pg(this.user,"Can't restore tree view state without an identity provider");if(this.input=e,!e){this.nodesByIdentity.clear(),this.model.setChildren(null,ht.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 pg(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:ht.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 O1(e,t)}};var Cyt=new Q("isMac",it,d(1854,null)),Jae=new Q("isLinux",Wn,d(1853,null)),Zy=new Q("isWindows",ri,d(1858,null)),ep=new Q("isWeb",Gt,d(1857,null)),Mx=new Q("isMacNative",it&&!Gt,d(1855,null)),xyt=new Q("isIOS",Nc,d(1852,null)),t8i=new Q("isMobile",sbe,d(1856,null)),Gq=new Q("isDevelopment",!1,!0),RW=new Q("productQualityType","",d(1859,null)),Uu="inputFocus",$h=new Q(Uu,!1,d(1851,null));var fo=ae("listService"),Eyt=class{constructor(){this.disposables=new P;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),sa(i.getHTMLElement())&&this.setLastFocusedList(i),hn(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()}},F5e=new Q("listScrollAtBoundary","none"),Pyt=x.or(F5e.isEqualTo("top"),F5e.isEqualTo("both")),Ayt=x.or(F5e.isEqualTo("bottom"),F5e.isEqualTo("both")),B5e=new Q("listFocus",!0),Gwe=new Q("treestickyScrollFocused",!1),E7=new Q("listSupportsMultiselect",!0),rc=x.and(B5e,x.not(Uu),Gwe.negate()),H5e=new Q("listHasSelectionOrFocus",!1),AW=new Q("listDoubleSelection",!1),Ini=new Q("listMultiSelection",!1),Zae=new Q("listSelectionNavigation",!1),yni=new Q("listSupportsFind",!0),$we=new Q("treeElementCanCollapse",!1),wni=new Q("treeElementHasParent",!1),qwe=new Q("treeElementCanExpand",!1),Cni=new Q("treeElementHasChild",!1),xni=new Q("treeFindOpen",!1),o8i="listTypeNavigationMode",n8i="listAutomaticKeyboardNavigation";function Nyt(a,i){let e=a.createScoped(i.getHTMLElement());return B5e.bindTo(e),e}function Oyt(a,i){let e=F5e.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 ele="workbench.list.multiSelectModifier",kyt="workbench.list.openMode",jM="workbench.list.horizontalScrolling",kni="workbench.list.defaultFindMode",Eni="workbench.list.typeNavigationMode",Tyt="workbench.list.keyboardNavigation",MW="workbench.list.scrollByPage",Tni="workbench.list.defaultFindMatchType",W5e="workbench.tree.indent",_yt="workbench.tree.renderIndentGuides",PW="workbench.list.smoothScrolling",W1="workbench.list.mouseWheelScrollSensitivity",V1="workbench.list.fastScrollSensitivity",Dyt="workbench.tree.expandMode",Lyt="workbench.tree.enableStickyScroll",Ryt="workbench.tree.stickyScrollMaxItemCount";function B1(a){return a.getValue(ele)==="alt"}var vni=class extends C{constructor(e){super();this.configurationService=e;this.useAltAsMultipleSelectionModifier=B1(e),this.registerListeners()}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration(ele)&&(this.useAltAsMultipleSelectionModifier=B1(this.configurationService))}))}isSelectionSingleChangeEvent(e){return this.useAltAsMultipleSelectionModifier?e.browserEvent.altKey:dti(e)}isSelectionRangeChangeEvent(e){return uti(e)}};function Fyt(a,i){let e=a.get(B),t=a.get(_e),o=new P;return[{...i,keyboardNavigationDelegate:{mightProducePrintableCharacter(r){return t.mightProducePrintableCharacter(r)}},smoothScrolling:!!e.getValue(PW),mouseWheelScrollSensitivity:e.getValue(W1),fastScrollSensitivity:e.getValue(V1),multipleSelectionController:i.multipleSelectionController??o.add(new vni(e)),keyboardNavigationEventFilter:PWo(t),scrollByPage:!!e.getValue(MW)},o]}var Rl=class extends hc{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(jM),[p,h]=c.invokeFunction(Fyt,n);super(i,e,t,o,{keyboardSupport:!1,...p,horizontalScrolling:u}),this.disposables.add(h),this.contextKeyService=Nyt(r,this),this.disposables.add(Oyt(this.contextKeyService,this)),this.listSupportsMultiSelect=E7.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(n.multipleSelectionSupport!==!1),Zae.bindTo(this.contextKeyService).set(!!n.selectionNavigation),this.listHasSelectionOrFocus=H5e.bindTo(this.contextKeyService),this.listDoubleSelection=AW.bindTo(this.contextKeyService),this.listMultiSelection=Ini.bindTo(this.contextKeyService),this.horizontalScrolling=n.horizontalScrolling,this._useAltAsMultipleSelectionModifier=B1(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(ele)&&(this._useAltAsMultipleSelectionModifier=B1(l));let v={};if(f.affectsConfiguration(jM)&&this.horizontalScrolling===void 0){let b=!!l.getValue(jM);v={...v,horizontalScrolling:b}}if(f.affectsConfiguration(MW)){let b=!!l.getValue(MW);v={...v,scrollByPage:b}}if(f.affectsConfiguration(PW)){let b=!!l.getValue(PW);v={...v,smoothScrolling:b}}if(f.affectsConfiguration(W1)){let b=l.getValue(W1);v={...v,mouseWheelScrollSensitivity:b}}if(f.affectsConfiguration(V1)){let b=l.getValue(V1);v={...v,fastScrollSensitivity:b}}Object.keys(v).length>0&&this.updateOptions(v)})),this.navigator=new Myt(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?GI(i):n7)}get useAltAsMultipleSelectionModifier(){return this._useAltAsMultipleSelectionModifier}};Rl=I([m(5,X),m(6,fo),m(7,B),m(8,F)],Rl);var F1=class extends A1{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(jM),[p,h]=c.invokeFunction(Fyt,n);super(i,e,t,o,{keyboardSupport:!1,...p,horizontalScrolling:u}),this.disposables=new P,this.disposables.add(h),this.contextKeyService=Nyt(r,this),this.disposables.add(Oyt(this.contextKeyService,this.widget)),this.horizontalScrolling=n.horizontalScrolling,this.listSupportsMultiSelect=E7.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(n.multipleSelectionSupport!==!1),Zae.bindTo(this.contextKeyService).set(!!n.selectionNavigation),this._useAltAsMultipleSelectionModifier=B1(l),this.disposables.add(this.contextKeyService),this.disposables.add(s.register(this)),this.updateStyles(n.overrideStyles),this.disposables.add(l.onDidChangeConfiguration(f=>{f.affectsConfiguration(ele)&&(this._useAltAsMultipleSelectionModifier=B1(l));let v={};if(f.affectsConfiguration(jM)&&this.horizontalScrolling===void 0){let b=!!l.getValue(jM);v={...v,horizontalScrolling:b}}if(f.affectsConfiguration(MW)){let b=!!l.getValue(MW);v={...v,scrollByPage:b}}if(f.affectsConfiguration(PW)){let b=!!l.getValue(PW);v={...v,smoothScrolling:b}}if(f.affectsConfiguration(W1)){let b=l.getValue(W1);v={...v,mouseWheelScrollSensitivity:b}}if(f.affectsConfiguration(V1)){let b=l.getValue(V1);v={...v,fastScrollSensitivity:b}}Object.keys(v).length>0&&this.updateOptions(v)})),this.navigator=new Myt(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?GI(i):n7)}get useAltAsMultipleSelectionModifier(){return this._useAltAsMultipleSelectionModifier}dispose(){this.disposables.dispose(),super.dispose()}};F1=I([m(5,X),m(6,fo),m(7,B),m(8,F)],F1);var rC=class extends dO{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(jM),[h,g]=u.invokeFunction(Fyt,r);super(i,e,t,o,n,{keyboardSupport:!1,...h,horizontalScrolling:p}),this.disposables.add(g),this.contextKeyService=Nyt(s,this),this.disposables.add(Oyt(this.contextKeyService,this)),this.listSupportsMultiSelect=E7.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(r.multipleSelectionSupport!==!1),Zae.bindTo(this.contextKeyService).set(!!r.selectionNavigation),this.listHasSelectionOrFocus=H5e.bindTo(this.contextKeyService),this.listDoubleSelection=AW.bindTo(this.contextKeyService),this.listMultiSelection=Ini.bindTo(this.contextKeyService),this.horizontalScrolling=r.horizontalScrolling,this._useAltAsMultipleSelectionModifier=B1(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(ele)&&(this._useAltAsMultipleSelectionModifier=B1(c));let b={};if(v.affectsConfiguration(jM)&&this.horizontalScrolling===void 0){let S=!!c.getValue(jM);b={...b,horizontalScrolling:S}}if(v.affectsConfiguration(MW)){let S=!!c.getValue(MW);b={...b,scrollByPage:S}}if(v.affectsConfiguration(PW)){let S=!!c.getValue(PW);b={...b,smoothScrolling:S}}if(v.affectsConfiguration(W1)){let S=c.getValue(W1);b={...b,mouseWheelScrollSensitivity:S}}if(v.affectsConfiguration(V1)){let S=c.getValue(V1);b={...b,fastScrollSensitivity:S}}Object.keys(b).length>0&&this.updateOptions(b)})),this.navigator=new bni(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?GI(i):n7)}get useAltAsMultipleSelectionModifier(){return this._useAltAsMultipleSelectionModifier}dispose(){this.disposables.dispose(),super.dispose()}};rC=I([m(6,X),m(7,fo),m(8,B),m(9,F)],rC);function IE(a="keydown",i,e){let t=new KeyboardEvent(a);return t.preserveFocus=i,t.pinned=e,t.__forceEvent=!0,t}var V5e=class extends C{constructor(e,t){super();this.widget=e;this._onDidOpen=this._register(new E);this.onDidOpen=this._onDidOpen.event;this._register(H.filter(this.widget.onDidChangeSelection,o=>ag(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(kyt)!=="doubleClick",this._register(t?.configurationService.onDidChangeConfiguration(o=>{o.affectsConfiguration(kyt)&&(this.openOnSingleClick=t?.configurationService.getValue(kyt)!=="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})}},Myt=class extends V5e{constructor(i,e){super(i,e),this.widget=i}getSelectedElement(){return this.widget.getSelectedElements()[0]}},bni=class extends V5e{constructor(i,e){super(i,e)}getSelectedElement(){return this.widget.getSelectedElements()[0]}},Sni=class extends V5e{constructor(i,e){super(i,e)}getSelectedElement(){return this.widget.getSelection()[0]??void 0}};function PWo(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 mg=class extends Jy{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(U5e,n);super(i,e,t,o,u),this.disposables.add(h),this.internals=new $q(this,n,p,n.overrideStyles,s,l,c),this.disposables.add(this.internals)}updateOptions(i){super.updateOptions(i),this.internals.updateOptions(i)}};mg=I([m(5,F),m(6,X),m(7,fo),m(8,B)],mg);var PL=class extends zwe{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(U5e,n);super(i,e,t,o,u),this.disposables.add(h),this.internals=new $q(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)}};PL=I([m(5,F),m(6,X),m(7,fo),m(8,B)],PL);var pO=class extends SE{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(U5e,r);super(i,e,t,o,n,p),this.disposables.add(g),this.internals=new $q(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)}};pO=I([m(6,F),m(7,X),m(8,fo),m(9,B)],pO);var nu=class extends gv{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(U5e,r);super(i,e,t,o,n,p),this.disposables.add(g),this.internals=new $q(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)}};nu=I([m(6,F),m(7,X),m(8,fo),m(9,B)],nu);var qI=class extends wyt{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(U5e,s);super(i,e,t,o,n,r,h),this.disposables.add(f),this.internals=new $q(this,s,g,s.overrideStyles,c,u,p),this.disposables.add(this.internals)}updateOptions(i){super.updateOptions(i),this.internals.updateOptions(i)}};qI=I([m(7,F),m(8,X),m(9,fo),m(10,B)],qI);function r8i(a){let i=a.getValue(kni);if(i==="highlight")return 0;if(i==="filter")return 1;let e=a.getValue(Tyt);if(e==="simple"||e==="highlight")return 0;if(e==="filter")return 1}function s8i(a){let i=a.getValue(Tni);if(i==="fuzzy")return 0;if(i==="contiguous")return 1}function U5e(a,i){let e=a.get(B),t=a.get(_n),o=a.get(X),n=a.get(F),r=()=>{let h=o.getContextKeyValue(o8i);if(h==="automatic")return 0;if(h==="trigger")return 1;if(o.getContextKeyValue(n8i)===!1)return 1;let f=e.getValue(Eni);if(f==="automatic")return 0;if(f==="trigger")return 1},s=i.horizontalScrolling!==void 0?i.horizontalScrolling:!!e.getValue(jM),[l,c]=n.invokeFunction(Fyt,i),u=i.paddingBottom,p=i.renderIndentGuides!==void 0?i.renderIndentGuides:e.getValue(_yt);return{getTypeNavigationMode:r,disposable:c,options:{keyboardSupport:!1,...l,indent:typeof e.getValue(W5e)=="number"?e.getValue(W5e):void 0,renderIndentGuides:p,smoothScrolling:!!e.getValue(PW),defaultFindMode:i.defaultFindMode??r8i(e),defaultFindMatchType:i.defaultFindMatchType??s8i(e),horizontalScrolling:s,scrollByPage:!!e.getValue(MW),paddingBottom:u,hideTwistiesOfChildlessElements:i.hideTwistiesOfChildlessElements,expandOnlyOnTwistieClick:i.expandOnlyOnTwistieClick??e.getValue(Dyt)==="doubleClick",contextViewProvider:t,findWidgetStyles:x4i,enableStickyScroll:!!e.getValue(Lyt),stickyScrollMaxItemCount:Number(e.getValue(Ryt))}}}var $q=class{constructor(i,e,t,o,n,r,s){this.tree=i;this.disposables=[];this.contextKeyService=Nyt(n,i),this.disposables.push(Oyt(this.contextKeyService,i)),this.listSupportsMultiSelect=E7.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(e.multipleSelectionSupport!==!1),Zae.bindTo(this.contextKeyService).set(!!e.selectionNavigation),this.listSupportFindWidget=yni.bindTo(this.contextKeyService),this.listSupportFindWidget.set(e.findWidgetEnabled??!0),this.hasSelectionOrFocus=H5e.bindTo(this.contextKeyService),this.hasDoubleSelection=AW.bindTo(this.contextKeyService),this.hasMultiSelection=Ini.bindTo(this.contextKeyService),this.treeElementCanCollapse=$we.bindTo(this.contextKeyService),this.treeElementHasParent=wni.bindTo(this.contextKeyService),this.treeElementCanExpand=qwe.bindTo(this.contextKeyService),this.treeElementHasChild=Cni.bindTo(this.contextKeyService),this.treeFindOpen=xni.bindTo(this.contextKeyService),this.treeStickyScrollFocused=Gwe.bindTo(this.contextKeyService),this._useAltAsMultipleSelectionModifier=B1(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(o8i),u.add(n8i),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(ele)&&(this._useAltAsMultipleSelectionModifier=B1(s)),p.affectsConfiguration(W5e)){let g=s.getValue(W5e);h={...h,indent:g}}if(p.affectsConfiguration(_yt)&&e.renderIndentGuides===void 0){let g=s.getValue(_yt);h={...h,renderIndentGuides:g}}if(p.affectsConfiguration(PW)){let g=!!s.getValue(PW);h={...h,smoothScrolling:g}}if(p.affectsConfiguration(kni)||p.affectsConfiguration(Tyt)){let g=r8i(s);h={...h,defaultFindMode:g}}if(p.affectsConfiguration(Eni)||p.affectsConfiguration(Tyt)){let g=t();h={...h,typeNavigationMode:g}}if(p.affectsConfiguration(Tni)){let g=s8i(s);h={...h,defaultFindMatchType:g}}if(p.affectsConfiguration(jM)&&e.horizontalScrolling===void 0){let g=!!s.getValue(jM);h={...h,horizontalScrolling:g}}if(p.affectsConfiguration(MW)){let g=!!s.getValue(MW);h={...h,scrollByPage:g}}if(p.affectsConfiguration(Dyt)&&e.expandOnlyOnTwistieClick===void 0&&(h={...h,expandOnlyOnTwistieClick:s.getValue(Dyt)==="doubleClick"}),p.affectsConfiguration(Lyt)){let g=s.getValue(Lyt);h={...h,enableStickyScroll:g}}if(p.affectsConfiguration(Ryt)){let g=Math.max(1,s.getValue(Ryt));h={...h,stickyScrollMaxItemCount:g}}if(p.affectsConfiguration(W1)){let g=s.getValue(W1);h={...h,mouseWheelScrollSensitivity:g}}if(p.affectsConfiguration(V1)){let g=s.getValue(V1);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 Sni(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?GI(i):n7)}dispose(){this.disposables=Ue(this.disposables)}};$q=I([m(4,X),m(5,fo),m(6,B)],$q);var AWo=oe.as(ii.Configuration);AWo.registerConfiguration({id:"workbench",order:7,title:d(2139,null),type:"object",properties:{[ele]:{type:"string",enum:["ctrlCmd","alt"],markdownEnumDescriptions:[d(2132,null),d(2131,null)],default:"ctrlCmd",description:d(2130,null)},[kyt]:{type:"string",enum:["singleClick","doubleClick"],default:"singleClick",description:d(2133,null)},[jM]:{type:"boolean",default:!1,description:d(2121,null)},[MW]:{type:"boolean",default:!1,description:d(2128,null)},[W5e]:{type:"number",default:8,minimum:4,maximum:40,description:d(2137,null)},[_yt]:{type:"string",enum:["none","onHover","always"],default:"onHover",description:d(2134,null)},[PW]:{type:"boolean",default:!1,description:d(2127,null)},[W1]:{type:"number",default:1,markdownDescription:d(2129,null)},[V1]:{type:"number",default:5,markdownDescription:d(2120,null)},[kni]:{type:"string",enum:["highlight","filter"],enumDescriptions:[d(2118,null),d(2117,null)],default:"highlight",description:d(2116,null)},[Tyt]:{type:"string",enum:["simple","highlight","filter"],enumDescriptions:[d(2125,null),d(2124,null),d(2123,null)],default:"highlight",description:d(2122,null),deprecated:!0,deprecationMessage:d(2126,null)},[Tni]:{type:"string",enum:["fuzzy","contiguous"],enumDescriptions:[d(2115,null),d(2114,null)],default:"fuzzy",description:d(2113,null)},[Dyt]:{type:"string",enum:["singleClick","doubleClick"],default:"singleClick",description:d(2119,null)},[Lyt]:{type:"boolean",default:!0,description:d(2135,null)},[Ryt]:{type:"number",minimum:1,default:7,markdownDescription:d(2136,null,"`#workbench.tree.enableStickyScroll#`")},[Eni]:{type:"string",enum:["automatic","trigger"],default:"automatic",markdownDescription:d(2138,null)}}});var AL=class{constructor(i,e,t,o){this.isProviderFirst=i;this.parent=e;this.link=t;this._rangeCallback=o;this.id=fq.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(1243,null,i.value,Ye(this.uri),this.range.startLineNumber,this.range.startColumn):d(1242,null,Ye(this.uri),this.range.startLineNumber,this.range.startColumn)}},_ni=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}}}},H1=class{constructor(i,e){this.parent=i;this.uri=e;this.children=[];this._previews=new vt}dispose(){Ue(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(1240,null,Ye(this.uri),this.uri.fsPath):d(1241,null,i,Ye(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 _ni(t))}catch(t){mt(t)}return this}},ew=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 H1(this,n.uri),this.groups.push(o)),o.children.length===0||a._compareReferences(n,o.children[o.children.length-1])!==0){let r=new AL(t===n,o,n,s=>this._onDidChangeReferenceRange.fire(s));this.references.push(r),o.children.push(r)}}dispose(){Ue(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(1244,null):this.references.length===1?d(1245,null,this.references[0].uri.fsPath):this.groups.length===1?d(1246,null,this.references.length,this.groups[0].uri.fsPath):d(1247,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:Ng(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 fv=class extends C{constructor(e,t,o){super();this.options=t;this.styles=o;this.count=0;this.hover=this._register(new me);this.element=R(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=yp().setupDelayedHoverAtMouse(this.element,()=>({content:id(this.titleFormat,this.count),appearance:{compact:!0}})):this.titleFormat===""&&this.hover.value&&(this.hover.value=void 0)}render(){this.element.textContent=id(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 Oa=class a extends C{constructor(e,t){super();this.options=t;this.text="";this.title="";this.highlights=[];this.didEverRender=!1;this.domNode=R(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&&uo(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(...Bn(l)):t.push(l),o=n.start}let r=this.text.substring(o,n.end),s=_("span.highlight",void 0,...e?Bn(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(...Bn(n)):t.push(n)}if(Fi(this.domNode,...t),!this.customHover&&this.title!==""){let n=this.options?.hoverDelegate??Ni("mouse");this.customHover=this._register(yp().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 tle=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||uo(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}},Lc=class extends C{constructor(e,t){super();this.customHovers=new Map;this.creationOptions=t,this.domNode=this._register(new tle(R(e,_(".monaco-icon-label")))),this.labelContainer=R(this.domNode.element,_(".monaco-icon-label-container")),this.nameContainer=R(this.labelContainer,_("span.monaco-icon-name-container")),t?.supportHighlights||t?.supportIcons?this.nameNode=this._register(new Lni(this.nameContainer,!!t.supportIcons)):this.nameNode=new Dni(this.nameContainer),this.hoverDelegate=t?.hoverDelegate??Ni("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||!Ao(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=Na(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 Oa){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?Oa.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(!gs(e,this.creationOptions.hoverTargetOverride))throw new Error("hoverTargetOverrride must be an ancestor of the htmlElement");n=this.creationOptions.hoverTargetOverride}let r=yp().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 tle(emt(this.nameContainer,_("span.monaco-icon-suffix-container"))));this.suffixNode=this._register(new tle(R(e.element,_("span.label-suffix"))))}return this.suffixNode}getOrCreateDescriptionNode(){if(!this.descriptionNode){let e=this._register(new tle(R(this.labelContainer,_("span.monaco-icon-description-container"))));this.creationOptions?.supportDescriptionHighlights?this.descriptionNode=this._register(new Oa(R(e.element,_("span.label-description")))):this.descriptionNode=this._register(new tle(R(e.element,_("span.label-description"))))}return this.descriptionNode}},Dni=class{constructor(i){this.container=i;this.label=void 0;this.singleLabel=void 0}setLabel(i,e){if(!(this.label===i&&uo(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=R(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}`;R(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&&R(this.container,_("span.label-separator",void 0,e?.separator||"/"))}}}};function NWo(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=>qb.intersect(n,s)).filter(s=>!qb.isEmpty(s)).map(({start:s,end:l})=>({start:s-t,end:l-t}));return t=n.end+i.length,r})}var Lni=class extends C{constructor(e,t){super();this.container=e;this.supportIcons=t;this.label=void 0;this.singleLabel=void 0}setLabel(e,t){if(this.label===e&&uo(this.options,t))return;this.label=e,this.options=t;let o=t?.supportIcons??this.supportIcons;if(typeof e=="string")this.singleLabel||(this.container.textContent="",this.container.classList.remove("multiple"),this.singleLabel=this._register(new Oa(R(this.container,_("a.label-name",{id:t?.domId}))))),this.singleLabel.set(e,t?.matches,void 0,t?.labelEscapeNewLines,o);else{this.container.textContent="",this.container.classList.add("multiple"),this.singleLabel=void 0;let n=t?.separator||"/",r=NWo(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._register(new Oa(R(this.container,p))).set(l,c,void 0,t?.labelEscapeNewLines,o),s<e.length-1&&R(p,_("span.label-separator",void 0,n))}}}};var ot=ae("labelService");var jwe=class{constructor(i){this._resolverService=i}hasChildren(i){return i instanceof ew||i instanceof H1}getChildren(i){if(i instanceof ew)return i.groups;if(i instanceof H1)return i.resolve(this._resolverService).then(e=>e.children);throw new Error("bad tree")}};jwe=I([m(0,Nt)],jwe);var Wyt=class{getHeight(){return 23}getTemplateId(i){return i instanceof H1?jq.id:K5e.id}},Qwe=class{constructor(i){this._keybindingService=i}getKeyboardNavigationLabel(i){if(i instanceof AL){let e=i.parent.getPreview(i)?.preview(i.range);if(e)return e.value}return Ye(i.uri)}mightProducePrintableCharacter(i){return this._keybindingService.mightProducePrintableCharacter(i)}};Qwe=I([m(0,_e)],Qwe);var Vyt=class{getId(i){return i instanceof AL?i.id:i.uri}},z5e=class extends C{constructor(e,t){super();this._labelService=t;let o=document.createElement("div");o.classList.add("reference-file"),this.file=this._register(new Lc(o,{supportHighlights:!0})),this.badge=this._register(new fv(R(o,_(".count")),{},BS)),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(1235,null,n)):this.badge.setTitleFormat(d(1234,null,n))}};z5e=I([m(1,ot)],z5e);var jq=class{constructor(i){this._instantiationService=i;this.templateId=jq.id}static{this.id="FileReferencesRenderer"}renderTemplate(i){return this._instantiationService.createInstance(z5e,i)}renderElement(i,e,t){t.set(i.element,ua(i.filterData))}disposeTemplate(i){i.dispose()}};jq=I([m(0,F)],jq);var Rni=class extends C{constructor(i){super(),this.label=this._register(new Oa(i))}set(i,e){let t=i.parent.getPreview(i)?.preview(i.range);if(!t||!t.value)this.label.set(`${Ye(i.uri)}:${i.range.startLineNumber+1}:${i.range.startColumn+1}`);else{let{value:o,highlight:n}=t;e&&!uv.isDefault(e)?(this.label.element.classList.toggle("referenceMatch",!1),this.label.set(o,ua(e))):(this.label.element.classList.toggle("referenceMatch",!0),this.label.set(o,[n]))}}},K5e=class a{constructor(){this.templateId=a.id}static{this.id="OneReferenceRenderer"}renderTemplate(i){return new Rni(i)}renderElement(i,e,t){t.set(i.element,i.filterData)}disposeTemplate(i){i.dispose()}},Byt=class{getWidgetAriaLabel(){return d(1236,null)}getAriaLabel(i){return i.ariaMessage}};var Mni=class a{constructor(i,e){this._editor=i;this._model=e;this._decorations=new Map;this._decorationIgnoreSet=new Set;this._callOnDispose=new P;this._callOnModelChange=new P;this._callOnDispose.add(this._editor.onDidChangeModel(()=>this._onModelChanged())),this._onModelChanged()}static{this.DecorationOptions=po.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()}},Hyt=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}}},Pni=class extends nu{},G5e=class{constructor(i){this.labelService=i;this.disposables=new P}getDragURI(i){return i instanceof H1?i.uri.toString():i instanceof AL?fL(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(Aa.RESOURCES,JSON.stringify(o)),e.dataTransfer.setData(Aa.TEXT,o.join(`
`)))}onDragOver(){return!1}drop(){}dispose(){this.disposables.dispose()}};G5e=I([m(0,ot)],G5e);var Ywe=class extends bE{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 P;this._callOnDispose=new P;this._onDidSelectReference=this._callOnDispose.add(new E);this.onDidSelectReference=this._onDidSelectReference.event;this._dim=new ai(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(),Ue(this._preview),Ue(this._previewNotAvailableMessage),Ue(this._tree),Ue(this._previewModelReference),this._splitView.dispose(),super.dispose()}_applyTheme(e){let t=e.getColor(p_)||Oe.transparent;this.style({arrowColor:t,frameColor:t,headerBackgroundColor:e.getColor(DW)||Oe.transparent,primaryHeadingColor:e.getColor(lO),secondaryHeadingColor:e.getColor(cO)})}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=R(e,_("div.messages")),xo(this._messageContainer),this._splitView=new vu(e,{orientation:1}),this._previewContainer=R(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(zc,this._previewContainer,t,{},this.editor),xo(this._previewContainer),this._previewNotAvailableMessage=this._instantiationService.createInstance(Bu,d(1237,null),Fr,Bu.DEFAULT_CREATION_OPTIONS,null),this._treeContainer=R(e,_("div.ref-tree.inline"));let o={keyboardSupport:this._defaultTreeKeyboardSupport,accessibilityProvider:new Byt,keyboardNavigationLabelProvider:this._instantiationService.createInstance(Qwe),identityProvider:new Vyt,openOnSingleClick:!0,selectionNavigation:!0,overrideStyles:{listBackground:x7},dnd:this._instantiationService.createInstance(G5e)};this._defaultTreeKeyboardSupport&&this._callOnDispose.add(Vo(this._treeContainer,"keydown",r=>{r.equals(9)&&(this._keybindingService.dispatchEvent(r,r.target),r.stopPropagation())},!0)),this._tree=this._instantiationService.createInstance(Pni,"ReferencesWidget",this._treeContainer,new Wyt,[this._instantiationService.createInstance(jq),this._instantiationService.createInstance(K5e)],this._instantiationService.createInstance(jwe),o),this._splitView.addView({onDidChange:H.None,element:this._previewContainer,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:r=>{this._preview.layout({height:this._dim.height,width:r})}},Wl.Distribute),this._splitView.addView({onDidChange:H.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)}},Wl.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 AL&&(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")})),xo(this._treeContainer)}_onWidth(e){this._dim&&this._doLayoutBody(this._dim.height,e)}_doLayoutBody(e,t){super._doLayoutBody(e,t),this._dim=new ai(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(1238,null),bn(this._messageContainer),Promise.resolve(void 0)):(xo(this._messageContainer),this._decorationsManager=new Mni(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"),bn(this._treeContainer),bn(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 AL)return e;if(e instanceof H1&&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!==Y.inMemory?this.setTitle(Ra(e.uri),this._uriLabel.getUriLabel(ci(e.uri))):this.setTitle(d(1239,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}Ue(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()}};Ywe=I([m(3,De),m(4,Nt),m(5,F),m(6,Kq),m(7,ot),m(8,_e)],Ywe);var ile=new Q("referenceSearchVisible",!1,d(1233,null)),yE=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 P;this._requestIdPool=0;this._ignoreModelChangeEvent=!1;this._referenceSearchVisible=ile.bindTo(t)}static{this.ID="editor.contrib.referencesController"}static get(i){return i.getContribution(yE.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=Hyt.fromJSON(this._storageService.get(n,0,"{}"));this._widget=this._instantiationService.createInstance(Ywe,this._editor,this._defaultTreeKeyboardSupport,r),this._widget.setTitle(d(1231,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(1232,null,this._model.title,this._model.references.length));let c=this._editor.getModel().uri,u=new Ie(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=yE.get(o),r=this._model.clone();this.closeWidget(),o.focus(),n?.toggleWidget(t,xn(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)}};yE=I([m(2,X),m(3,Kt),m(4,Ne),m(5,F),m(6,le),m(7,B)],yE);function ole(a,i){let e=Bwe(a);if(!e)return;let t=yE.get(e);t&&i(t)}yt.registerCommandAndKeybindingRule({id:"togglePeekWidgetFocus",weight:100,primary:Ai(2089,60),when:x.or(ile,Gh.inPeekEditor),handler(a){ole(a,i=>{i.changeFocusBetweenPreviewAndReferences()})}});yt.registerCommandAndKeybindingRule({id:"goToNextReference",weight:90,primary:62,secondary:[70],when:x.or(ile,Gh.inPeekEditor),handler(a){ole(a,i=>{i.goToNextOrPreviousReference(!0)})}});yt.registerCommandAndKeybindingRule({id:"goToPreviousReference",weight:90,primary:1086,secondary:[1094],when:x.or(ile,Gh.inPeekEditor),handler(a){ole(a,i=>{i.goToNextOrPreviousReference(!1)})}});qe.registerCommandAlias("goToNextReferenceFromEmbeddedEditor","goToNextReference");qe.registerCommandAlias("goToPreviousReferenceFromEmbeddedEditor","goToPreviousReference");qe.registerCommandAlias("closeReferenceSearchEditor","closeReferenceSearch");qe.registerCommand("closeReferenceSearch",a=>ole(a,i=>i.closeWidget()));yt.registerKeybindingRule({id:"closeReferenceSearch",weight:-1,primary:9,secondary:[1033],when:x.and(Gh.inPeekEditor,x.not("config.editor.stablePeek"))});yt.registerKeybindingRule({id:"closeReferenceSearch",weight:250,primary:9,secondary:[1033],when:x.and(ile,x.not("config.editor.stablePeek"),x.or(ue.editorTextFocus,$h.negate()))});yt.registerCommandAndKeybindingRule({id:"revealReference",weight:200,primary:3,mac:{primary:3,secondary:[2066]},when:x.and(ile,rc,$we.negate(),qwe.negate()),handler(a){let e=a.get(fo).lastFocusedList?.getFocus();Array.isArray(e)&&e[0]instanceof AL&&ole(a,t=>t.revealReference(e[0]))}});yt.registerCommandAndKeybindingRule({id:"openReferenceToSide",weight:100,primary:2051,mac:{primary:259},when:x.and(ile,rc,$we.negate(),qwe.negate()),handler(a){let e=a.get(fo).lastFocusedList?.getFocus();Array.isArray(e)&&e[0]instanceof AL&&ole(a,t=>t.openReference(e[0],!0,!0))}});qe.registerCommand("openReference",a=>{let e=a.get(fo).lastFocusedList?.getFocus();Array.isArray(e)&&e[0]instanceof AL&&ole(a,t=>t.openReference(e[0],!1,!0))});var Ani=new Q("hasSymbols",!1,d(1248,null)),j5e=ae("ISymbolNavigationService"),$5e=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=Ani.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 q5e(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(Xe(p.uri,s.uri))c=!0,u=u||z.containsPosition(p.range,l);else if(c)break;(!c||!u)&&this.reset()});this._currentState=hn(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(1250,null,this._currentIdx+1,this._currentModel.references.length,i.getLabel()):d(1249,null,this._currentIdx+1,this._currentModel.references.length);this._currentMessage=this._notificationService.status(e)}};$5e=I([m(0,X),m(1,Kt),m(2,Ne),m(3,_e)],$5e);we(j5e,$5e,1);qi(new class extends xc{constructor(){super({id:"editor.gotoNextSymbolFromResult",precondition:Ani,kbOpts:{weight:100,primary:70}})}runEditorCommand(a,i){return a.get(j5e).revealNext(i)}});yt.registerCommandAndKeybindingRule({id:"editor.gotoNextSymbolFromResult.cancel",weight:100,when:Ani,primary:9,handler(a){a.get(j5e).reset()}});var q5e=class{constructor(i){this._listener=new Map;this._disposables=new P;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(),Ue(this._listener.values())}_onDidAddEditor(i){this._listener.set(i,hn(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)}};q5e=I([m(0,Kt)],q5e);function Nni(a,i){return i.uri.scheme===a.uri.scheme?!0:!$0(i.uri,Y.walkThroughSnippet,Y.vscodeChatCodeBlock,Y.vscodeChatCodeCompareBlock)}async function Q5e(a,i,e,t,o){let r=e.ordered(a,t).map(l=>Promise.resolve(o(l,a,i)).then(void 0,c=>{ss(c)})),s=await Promise.all(r);return si(s.flat()).filter(l=>Nni(a,l))}function U1(a,i,e,t,o){return Q5e(i,e,a,t,(n,r,s)=>n.provideDefinition(r,s,o))}function Uyt(a,i,e,t,o){return Q5e(i,e,a,t,(n,r,s)=>n.provideDeclaration(r,s,o))}function Xwe(a,i,e,t,o){return Q5e(i,e,a,t,(n,r,s)=>n.provideImplementation(r,s,o))}function zyt(a,i,e,t,o){return Q5e(i,e,a,t,(n,r,s)=>n.provideTypeDefinition(r,s,o))}function T7(a,i,e,t,o,n){return Q5e(i,e,a,o,async(r,s,l)=>{let c=(await r.provideReferences(s,l,{includeDeclaration:!0},n))?.filter(p=>Nni(s,p));if(!t||!c||c.length!==2)return c;let u=(await r.provideReferences(s,l,{includeDeclaration:!1},n))?.filter(p=>Nni(s,p));return u&&u.length===1?u:c})}async function z1(a){let i=await a(),e=new ew(i,""),t=e.references.map(o=>o.link);return e.dispose(),t}kS("_executeDefinitionProvider",(a,i,e)=>{let t=a.get(zt),o=U1(t.definitionProvider,i,e,!1,ve.None);return z1(()=>o)});kS("_executeDefinitionProvider_recursive",(a,i,e)=>{let t=a.get(zt),o=U1(t.definitionProvider,i,e,!0,ve.None);return z1(()=>o)});kS("_executeTypeDefinitionProvider",(a,i,e)=>{let t=a.get(zt),o=zyt(t.typeDefinitionProvider,i,e,!1,ve.None);return z1(()=>o)});kS("_executeTypeDefinitionProvider_recursive",(a,i,e)=>{let t=a.get(zt),o=zyt(t.typeDefinitionProvider,i,e,!0,ve.None);return z1(()=>o)});kS("_executeDeclarationProvider",(a,i,e)=>{let t=a.get(zt),o=Uyt(t.declarationProvider,i,e,!1,ve.None);return z1(()=>o)});kS("_executeDeclarationProvider_recursive",(a,i,e)=>{let t=a.get(zt),o=Uyt(t.declarationProvider,i,e,!0,ve.None);return z1(()=>o)});kS("_executeReferenceProvider",(a,i,e)=>{let t=a.get(zt),o=T7(t.referenceProvider,i,e,!1,!1,ve.None);return z1(()=>o)});kS("_executeReferenceProvider_recursive",(a,i,e)=>{let t=a.get(zt),o=T7(t.referenceProvider,i,e,!1,!0,ve.None);return z1(()=>o)});kS("_executeImplementationProvider",(a,i,e)=>{let t=a.get(zt),o=Xwe(t.implementationProvider,i,e,!1,ve.None);return z1(()=>o)});kS("_executeImplementationProvider_recursive",(a,i,e)=>{let t=a.get(zt),o=Xwe(t.implementationProvider,i,e,!0,ve.None);return z1(()=>o)});fe.appendMenuItem(D.EditorContext,{submenu:D.EditorContextPeek,title:d(1224,null),group:"navigation",order:100});var nle=class a{constructor(i,e){this.model=i;this.position=e}static is(i){return!i||typeof i!="object"?!1:!!(i instanceof a||Ie.isIPosition(i.position)&&i.model)}},mO=class a extends wl{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 ht.wrap(e.menu))(t.id===D.EditorContext||t.id===D.EditorContextPeek)&&(t.when=x.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(Kt),s=i.get(rd),l=i.get(j5e),c=i.get(zt),u=i.get(F),p=e.getModel(),h=e.getPosition(),g=nle.is(t)?t:new nle(p,h),f=new Ex(e,5),v=wa(this._getLocationModel(c,g.model,g.position,f.token),f.token).then(async b=>{if(!b||f.token.isCancellationRequested)return;Jo(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);iu.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 zc)&&(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(ZKi(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=yE.get(i);o&&i.hasModel()?o.toggleWidget(t??i.getSelection(),xn(n=>Promise.resolve(e)),this.configuration.openInPeek):e.dispose()}},NW=class extends mO{async _getLocationModel(i,e,t,o){return new ew(await U1(i.definitionProvider,e,t,!1,o),d(1207,null))}_getNoResultFoundMessage(i){return i&&i.word?d(1223,null,i.word):d(1209,null)}_getAlternativeCommand(i){return i.getOption(67).alternativeDefinitionCommand}_getGoToPreference(i){return i.getOption(67).multipleDefinitions}};W(class Oni extends NW{static{this.id="editor.action.revealDefinition"}constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:Oni.id,title:{...L(1195,"Go to Definition"),mnemonicTitle:d(1219,null)},precondition:ue.hasDefinitionProvider,keybinding:[{when:ue.editorTextFocus,primary:70,weight:100},{when:x.and(ue.editorTextFocus,ep),primary:2118,weight:100}],menu:[{id:D.EditorContext,group:"navigation",order:1.1},{id:D.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:2}]}),qe.registerCommandAlias("editor.action.goToDeclaration",Oni.id)}});W(class Fni extends NW{static{this.id="editor.action.revealDefinitionAside"}constructor(){super({openToSide:!0,openInPeek:!1,muteMessage:!1},{id:Fni.id,title:L(1197,"Open Definition to the Side"),precondition:x.and(ue.hasDefinitionProvider,ue.isInEmbeddedEditor.toNegated()),keybinding:[{when:ue.editorTextFocus,primary:Ai(2089,70),weight:100},{when:x.and(ue.editorTextFocus,ep),primary:Ai(2089,2118),weight:100}]}),qe.registerCommandAlias("editor.action.openDeclarationToTheSide",Fni.id)}});W(class Wni extends NW{static{this.id="editor.action.peekDefinition"}constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:Wni.id,title:L(1203,"Peek Definition"),precondition:x.and(ue.hasDefinitionProvider,Gh.notInPeekEditor,ue.isInEmbeddedEditor.toNegated()),keybinding:{when:ue.editorTextFocus,primary:582,linux:{primary:3140},weight:100},menu:{id:D.EditorContextPeek,group:"peek",order:2}}),qe.registerCommandAlias("editor.action.previewDeclaration",Wni.id)}});var Kyt=class extends mO{async _getLocationModel(i,e,t,o){return new ew(await Uyt(i.declarationProvider,e,t,!1,o),d(1206,null))}_getNoResultFoundMessage(i){return i&&i.word?d(1205,null,i.word):d(1204,null)}_getAlternativeCommand(i){return i.getOption(67).alternativeDeclarationCommand}_getGoToPreference(i){return i.getOption(67).multipleDeclarations}};W(class a8i extends Kyt{static{this.id="editor.action.revealDeclaration"}constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:a8i.id,title:{...L(1196,"Go to Declaration"),mnemonicTitle:d(1218,null)},precondition:x.and(ue.hasDeclarationProvider,ue.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(1205,null,i.word):d(1204,null)}});W(class extends Kyt{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.peekDeclaration",title:L(1200,"Peek Declaration"),precondition:x.and(ue.hasDeclarationProvider,Gh.notInPeekEditor,ue.isInEmbeddedEditor.toNegated()),menu:{id:D.EditorContextPeek,group:"peek",order:3}})}});var Gyt=class extends mO{async _getLocationModel(i,e,t,o){return new ew(await zyt(i.typeDefinitionProvider,e,t,!1,o),d(1229,null))}_getNoResultFoundMessage(i){return i&&i.word?d(1215,null,i.word):d(1214,null)}_getAlternativeCommand(i){return i.getOption(67).alternativeTypeDefinitionCommand}_getGoToPreference(i){return i.getOption(67).multipleTypeDefinitions}};W(class l8i extends Gyt{static{this.ID="editor.action.goToTypeDefinition"}constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:l8i.ID,title:{...L(1199,"Go to Type Definition"),mnemonicTitle:d(1222,null)},precondition:ue.hasTypeDefinitionProvider,keybinding:{when:ue.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 c8i extends Gyt{static{this.ID="editor.action.peekTypeDefinition"}constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:c8i.ID,title:L(1202,"Peek Type Definition"),precondition:x.and(ue.hasTypeDefinitionProvider,Gh.notInPeekEditor,ue.isInEmbeddedEditor.toNegated()),menu:{id:D.EditorContextPeek,group:"peek",order:4}})}});var $yt=class extends mO{async _getLocationModel(i,e,t,o){return new ew(await Xwe(i.implementationProvider,e,t,!1,o),d(1216,null))}_getNoResultFoundMessage(i){return i&&i.word?d(1212,null,i.word):d(1211,null)}_getAlternativeCommand(i){return i.getOption(67).alternativeImplementationCommand}_getGoToPreference(i){return i.getOption(67).multipleImplementations}};W(class d8i extends $yt{static{this.ID="editor.action.goToImplementation"}constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:d8i.ID,title:{...L(1198,"Go to Implementations"),mnemonicTitle:d(1220,null)},precondition:ue.hasImplementationProvider,keybinding:{when:ue.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 u8i extends $yt{static{this.ID="editor.action.peekImplementation"}constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:u8i.ID,title:L(1201,"Peek Implementations"),precondition:x.and(ue.hasImplementationProvider,Gh.notInPeekEditor,ue.isInEmbeddedEditor.toNegated()),keybinding:{when:ue.editorTextFocus,primary:3142,weight:100},menu:{id:D.EditorContextPeek,group:"peek",order:5}})}});var qyt=class extends mO{_getNoResultFoundMessage(i){return i?d(1227,null,i.word):d(1228,null)}_getAlternativeCommand(i){return i.getOption(67).alternativeReferenceCommand}_getGoToPreference(i){return i.getOption(67).multipleReferences}};W(class extends qyt{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:"editor.action.goToReferences",title:{...L(1213,"Go to References"),mnemonicTitle:d(1221,null)},precondition:x.and(ue.hasReferenceProvider,Gh.notInPeekEditor,ue.isInEmbeddedEditor.toNegated()),keybinding:{when:ue.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 ew(await T7(i.referenceProvider,e,t,!0,!1,o),d(1225,null))}});W(class extends qyt{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.referenceSearch.trigger",title:L(1226,"Peek References"),precondition:x.and(ue.hasReferenceProvider,Gh.notInPeekEditor,ue.isInEmbeddedEditor.toNegated()),menu:{id:D.EditorContextPeek,group:"peek",order:6}})}async _getLocationModel(i,e,t,o){return new ew(await T7(i.referenceProvider,e,t,!1,!1,o),d(1225,null))}});var Vni=class extends mO{constructor(e,t,o){super(e,{id:"editor.action.goToLocation",title:L(1217,"Go to Any Symbol"),precondition:x.and(Gh.notInPeekEditor,ue.isInEmbeddedEditor.toNegated())});this._references=t;this._gotoMultipleBehaviour=o}async _getLocationModel(e,t,o,n){return new ew(this._references,d(1210,null))}_getNoResultFoundMessage(e){return e&&d(1208,null,e.word)||""}_getGoToPreference(e){return this._gotoMultipleBehaviour??e.getOption(67).multipleReferences}_getAlternativeCommand(){}};qe.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:Ie.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)=>{So(A.isUri(i)),So(Ie.isIPosition(e)),So(Array.isArray(t)),So(typeof o>"u"||typeof o=="string"),So(typeof r>"u"||typeof r=="boolean");let s=a.get(Kt),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 Vni{_getNoResultFoundMessage(p){return n||super._getNoResultFoundMessage(p)}}({muteMessage:!n,openInPeek:!!r,openToSide:!1},t,o);c.get(F).invokeFunction(u.run.bind(u),l)})}});qe.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:Ie.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)}});qe.registerCommand({id:"editor.action.findReferences",handler:(a,i,e)=>{So(A.isUri(i)),So(Ie.isIPosition(e));let t=a.get(zt),o=a.get(Kt);return o.openCodeEditor({resource:i},o.getFocusedCodeEditor()).then(n=>{if(!pn(n)||!n.hasModel())return;let r=yE.get(n);if(!r)return;let s=xn(c=>T7(t.referenceProvider,n.getModel(),Ie.lift(e),!1,!1,c).then(u=>new ew(u,d(1225,null)))),l=new z(e.lineNumber,e.column,e.lineNumber,e.column);return Promise.resolve(r.toggleWidget(l,s,!1))})}});qe.registerCommandAlias("editor.action.showReferences","editor.action.peekLocations");async function p8i(a,i,e,t){let o=a.get(Nt),n=a.get(ze),r=a.get(ge),s=a.get(F),l=a.get(Ne);if(await t.item.resolve(ve.None),!t.part.location)return;let c=t.part.location,u=[],p=new Set(fe.getMenuItems(D.EditorContext).map(g=>Kk(g)?g.command.id:_t()));for(let g of mO.all())p.has(g.desc.id)&&u.push(new st(g.desc.id,Eo.label(g.desc,{renderShortTitle:!0}),void 0,!0,async()=>{let f=await o.createModelReference(c.uri);try{let v=new nle(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 li),u.push(new st(g.id,g.title,void 0,!0,async()=>{try{await r.executeCommand(g.id,...g.arguments??[])}catch(f){l.notify({severity:St.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=Yn(e);return{x:g.left,y:g.top+g.height+8}},getActions:()=>u,onHide:()=>{i.focus()},autoSelectFirstItem:!0})}async function jyt(a,i,e,t){let n=await a.get(Nt).createModelReference(t.uri);await e.invokeWithinContext(async r=>{let s=i.hasSideBySideModifier,l=r.get(X),c=Gh.inPeekEditor.getValue(l),u=!s&&e.getOption(101)&&!c;return new NW({openToSide:s,openInPeek:u,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(r,new nle(n.object.textEditorModel,z.getStartPosition(t.range)),z.lift(t.range))}),n.dispose()}var Bni=class a{constructor(){this._entries=new il(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()}`}},m8i=ae("IInlayHintsCache");we(m8i,Bni,1);var Jwe=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]}},Hni=class{constructor(i,e){this.part=i;this.hasTriggerModifier=e}};var Uni=class{constructor(){this._store=new me;this._tokenSource=new $e}dispose(){this._store.dispose(),this._tokenSource.dispose(!0)}reset(){return this._tokenSource.dispose(!0),this._tokenSource=new $e,this._store.value=new P,{store:this._store.value,token:this._tokenSource.token}}},wE=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 P;this._sessionDisposables=new P;this._decorationsMetadata=new Map;this._activeRenderMode=0;this._ruleFactory=this._disposables.add(new p9(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(wE.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(bf.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 Uni),s=new Dt(async()=>{let c=Date.now(),{store:u,token:p}=r.reset();try{let h=await M5e.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=nn(()=>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 P,e=i.add(new sO(this._editor)),t=new P;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 $e;t.add(Z(()=>l.dispose(!0))),r.item.resolve(l.token),this._activeInlayHintPart=r.part.command||r.part.location?new Hni(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(jyt,o,this._editor,r.location):vse.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(ve.None),dr(t.item.hint.textEdits))){let o=t.item.hint.textEdits.map(n=>An.replace(z.lift(n.range),n.text));this._editor.executeEdits("inlayHint.default",o),i()}})}_installContextMenu(){return this._editor.onContextMenu(async i=>{if(!Ao(i.event.target))return;let e=this._getInlayHintLabelPart(i);e&&await this._instaService.invokeFunction(p8i,this._editor,i.event.target,e)})}_getInlayHintLabelPart(i){if(i.target.type!==6)return;let e=i.target.detail.injectedText?.options;if(e instanceof r1&&e?.attachedData instanceof Jwe)return e.attachedData}async _invokeCommand(i,e){try{await this._commandService.executeCommand(i.id,...i.arguments??[])}catch(t){this._notificationService.notify({severity:St.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 R5e(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 N=this._decorationsMetadata.get(T.id);if(T.range.startColumn>b.column)continue;let O=N?.decoration.options[N.item.anchor.direction];if(O&&O.attachedData!==wE._whitespaceData){let V=S.get(N.item)??0;S.set(N.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(),N=w.shift();if(!N&&!T)break;if(T)t.set(T,N??0),k=T;else if(k&&N){let O=t.get(k);O+=N,O+=w.reduce((V,U)=>V+U,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,wE._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 N=y[T],O=T===0,V=T===y.length-1,U={fontSize:`${s}px`,fontFamily:`var(${h}), ${Yd.fontFamily}`,verticalAlign:u?"baseline":"middle",unicodeBidi:"isolate"};dr(S.hint.textEdits)&&(U.cursor="default"),this._fillInColors(U,S.hint),(N.command||N.location)&&this._activeInlayHintPart?.part.item===S&&this._activeInlayHintPart.part.index===T&&(U.textDecoration="underline",this._activeInlayHintPart.hasTriggerModifier&&(U.color=Ss(oGi),U.cursor="pointer"));let G=N.label;g.totalLen+=G.length;let $=!1,te=p!==0?g.totalLen-p:0;if(te>0&&(G=G.slice(0,-te)+"\u2026",$=!0),k+=G.length,w!==void 0){let pe=k-w;pe>=0&&(k-=pe,G=G.slice(0,-(1+pe))+"\u2026",$=!0)}if(c&&(O&&(V||$)?(U.padding=`1px ${Math.max(1,s/4)|0}px`,U.borderRadius=`${s/4|0}px`):O?(U.padding=`1px 0 1px ${Math.max(1,s/4)|0}px`,U.borderRadius=`${s/4|0}px 0 0 ${s/4|0}px`):V||$?(U.padding=`1px ${Math.max(1,s/4)|0}px 1px 0`,U.borderRadius=`0 ${s/4|0}px ${s/4|0}px 0`):U.padding="1px 0 1px 0"),n(S,this._ruleFactory.createClassNameRef(U),OWo(G),V&&!S.hint.paddingRight?1:3,new Jwe(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>wE._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=tC.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=Ss(mGi),i.color=Ss(pGi)):e.kind===1?(i.backgroundColor=Ss(uGi),i.color=Ss(dGi)):(i.backgroundColor=Ss(rgt),i.color=Ss(ngt))}_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}};wE=I([m(1,zt),m(2,jg),m(3,m8i),m(4,ge),m(5,Ne),m(6,F)],wE);function OWo(a){return a.replace(/[ \t]/g,"\xA0")}qe.registerCommand("_executeInlayHintProvider",async(a,...i)=>{let[e,t]=i;So(A.isUri(e)),So(z.isIRange(t));let{inlayHintsProvider:o}=a.get(zt),n=await a.get(Nt).createModelReference(e);try{let r=await M5e.create(o,n.object.textEditorModel,[z.lift(t)],ve.None),s=r.items.map(l=>l.hint);return setTimeout(()=>r.dispose(),0),s}finally{n.dispose()}});var Qyt=class extends Fq{constructor(e,t,o,n){super(10,t,e.item.anchor.range,o,n,!0);this.part=e}},_7=class extends P1{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(!wE.get(this._editor)||e.target.type!==6)return null;let o=e.target.detail.injectedText?.options;return o instanceof r1&&o.attachedData instanceof Jwe?new Qyt(o.attachedData,this,e.event.posx,e.event.posy):null}computeSync(){return[]}computeAsync(e,t,o,n){return e instanceof Qyt?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 xe().appendText(s.item.hint.tooltip):s.item.hint.tooltip&&(l=s.item.hint.tooltip),l&&r.emitOne(new vE(this,e.range,[l],!1,0)),dr(s.item.hint.textEdits)&&r.emitOne(new vE(this,e.range,[new xe().appendText(d(1320,null))],!1,10001));let c;if(typeof s.part.tooltip=="string"?c=new xe().appendText(s.part.tooltip):s.part.tooltip&&(c=s.part.tooltip),c&&r.emitOne(new vE(this,e.range,[c],!1,1)),s.part.location||s.part.command){let p,g=this._editor.getOption(86)==="altKey"?it?d(1326,null):d(1325,null):it?d(1324,null):d(1323,null);s.part.location&&s.part.command?p=new xe().appendText(d(1322,null,g)):s.part.location?p=new xe().appendText(d(1321,null,g)):s.part.command&&(p=new xe(`[${d(1319,null)}](${cyt(s.part.command)} "${s.part.command.title}") (${g})`,{isTrusted:!0})),p&&r.emitOne(new vE(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 _5e(this._languageFeaturesService.hoverProvider,s,new Ie(n.startLineNumber,n.startColumn),t))yW(l.hover.contents)||(yield new vE(this,e.item.anchor.range,l.hover.contents,!1,2+l.ordinal))}finally{r.dispose()}}};_7=I([m(1,Qn),m(2,_e),m(3,tt),m(4,B),m(5,Nt),m(6,zt),m(7,ge)],_7);var Yyt=class{constructor(i,e,t){this.marker=i;this.index=e;this.total=t}},rle=class{constructor(i,e,t){this._markerService=e;this._configService=t;this._onDidChange=new E;this.onDidChange=this._onDidChange.event;this._dispoables=new P;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=Al(s.resource.toString(),l.resource.toString());return c===0&&(o==="position"?c=z.compareRangesUsingStarts(s,l)||cl.compare(s.severity,l.severity):c=cl.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 Yyt(i,this._nextIdx+1,this._markers.length)}_initIdx(i,e,t){let o=this._markers.findIndex(n=>Xe(n.resource,i.uri));if(o<0)o=bM(this._markers.length,n=>Al(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 Yyt(this._markers[t],t+1,this._markers.length)}}};rle=I([m(1,Ns),m(2,B)],rle);var X5e=ae("IMarkerNavigationService"),Y5e=class{constructor(i,e){this._markerService=i;this._configService=e;this._provider=new Vs}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 rle(i,this._markerService,this._configService)}};Y5e=I([m(0,Ns),m(1,B)],Y5e);we(X5e,Y5e,1);var Px;(i=>{function a(e){switch(e){case gt.Ignore:return"severity-ignore "+q.asClassName(M.info);case gt.Info:return q.asClassName(M.info);case gt.Warning:return q.asClassName(M.warning);case gt.Error:return q.asClassName(M.error);default:return""}}i.className=a})(Px||={});var zni=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 P;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(Vo(this._relatedBlock,"click",s=>{s.preventDefault();let l=this._relatedDiagnostics.get(s.target);l&&t(l)})),this._scrollable=new f9(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(){Ue(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=mc(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=R(this._codeLink,_("span"));g.innerText=n.value,h.appendChild(this._codeLink)}}if(Rt(this._relatedBlock),this._editor.applyFontInfo(this._relatedBlock),dr(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(1189,null);break;case 4:e=d(1194,null);break;case 2:e=d(1191,null);break;case 1:e=d(1190,null);break}let t=d(1192,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}},K1=class extends bE{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 P;this._onDidSelectRelatedInformation=new E;this.onDidSelectRelatedInformation=this._onDidSelectRelatedInformation.event;this._severity=4,this._backgroundColor=Oe.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(BWo);let t=Kni,o=FWo;this._severity===4?(t=Xyt,o=WWo):this._severity===2&&(t=Gni,o=VWo);let n=e.getColor(t),r=e.getColor(o);this.style({arrowColor:n,frameColor:n,headerBackgroundColor:r,primaryHeadingColor:e.getColor(lO),secondaryHeadingColor:e.getColor(cO)})}_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(K1.TitleMenu,this._contextKeyService),o=Vm(t);this._actionbarWidget.push(o,{label:!1,icon:!0,index:0})}_fillTitleIcon(e){this._icon=R(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 zni(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(1193,null,t,o):d(1181,null,t,o);this.setTitle(Ye(l.uri),c)}this._icon.className=`codicon ${Px.className(cl.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()}};K1=I([m(1,De),m(2,Qe),m(3,qt),m(4,F),m(5,X),m(6,ot)],K1);var h8i=_se(av,eGi),g8i=_se(Bh,n9),f8i=_se(fm,r9),Kni=J("editorMarkerNavigationError.background",{dark:h8i,light:h8i,hcDark:gi,hcLight:gi},d(1183,null)),FWo=J("editorMarkerNavigationError.headerBackground",{dark:ei(Kni,.1),light:ei(Kni,.1),hcDark:null,hcLight:null},d(1184,null)),Xyt=J("editorMarkerNavigationWarning.background",{dark:g8i,light:g8i,hcDark:gi,hcLight:gi},d(1187,null)),WWo=J("editorMarkerNavigationWarning.headerBackground",{dark:ei(Xyt,.1),light:ei(Xyt,.1),hcDark:"#0C141F",hcLight:ei(Xyt,.2)},d(1188,null)),Gni=J("editorMarkerNavigationInfo.background",{dark:f8i,light:f8i,hcDark:gi,hcLight:gi},d(1185,null)),VWo=J("editorMarkerNavigationInfo.headerBackground",{dark:ei(Gni,.1),light:ei(Gni,.1),hcDark:null,hcLight:null},d(1186,null)),BWo=J("editorMarkerNavigation.background",qo,d(1182,null));var tw=class{constructor(i,e,t,o,n){this._markerNavigationService=e;this._contextKeyService=t;this._editorService=o;this._instantiationService=n;this._sessionDispoables=new P;this._editor=i,this._widgetVisible=v8i.bindTo(this._contextKeyService)}static{this.ID="editor.contrib.markerController"}static get(i){return i.getContribution(tw.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(K1,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 Ie(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&&(tw.get(n)?.close(),tw.get(n)?.navigate(i,e))}else this._widget.showAtMarker(o.selected.marker,o.selected.index,o.selected.total)}};tw=I([m(1,X5e),m(2,X),m(3,Kt),m(4,F)],tw);var Zwe=class extends xi{constructor(e,t,o){super(o);this._next=e;this._multiFile=t}async run(e,t){t.hasModel()&&await tw.get(t)?.navigate(this._next,this._multiFile)}},sle=class a extends Zwe{static{this.ID="editor.action.marker.next"}static{this.LABEL=L(1173,"Go to Next Problem (Error, Warning, Info)")}constructor(){super(!0,!1,{id:a.ID,label:a.LABEL,precondition:void 0,kbOpts:{kbExpr:ue.focus,primary:578,weight:100},menuOpts:{menuId:K1.TitleMenu,title:a.LABEL.value,icon:Re("marker-navigation-next",M.arrowDown,d(1179,null)),group:"navigation",order:1}})}},J5e=class a extends Zwe{static{this.ID="editor.action.marker.prev"}static{this.LABEL=L(1175,"Go to Previous Problem (Error, Warning, Info)")}constructor(){super(!1,!1,{id:a.ID,label:a.LABEL,precondition:void 0,kbOpts:{kbExpr:ue.focus,primary:1602,weight:100},menuOpts:{menuId:K1.TitleMenu,title:a.LABEL.value,icon:Re("marker-navigation-previous",M.arrowUp,d(1180,null)),group:"navigation",order:2}})}},Z5e=class a extends Zwe{static{this.ID="editor.action.marker.nextInFiles"}constructor(){super(!0,!0,{id:a.ID,label:L(1174,"Go to Next Problem in Files (Error, Warning, Info)"),precondition:void 0,kbOpts:{kbExpr:ue.focus,primary:66,weight:100},menuOpts:{menuId:D.MenubarGoMenu,title:d(1177,null),group:"6_problem_nav",order:1}})}},e4e=class a extends Zwe{static{this.ID="editor.action.marker.prevInFiles"}constructor(){super(!1,!0,{id:a.ID,label:L(1176,"Go to Previous Problem in Files (Error, Warning, Info)"),precondition:void 0,kbOpts:{kbExpr:ue.focus,primary:1090,weight:100},menuOpts:{menuId:D.MenubarGoMenu,title:d(1178,null),group:"6_problem_nav",order:2}})}};go(tw.ID,tw,4);Jt(sle);Jt(J5e);Jt(Z5e);Jt(e4e);var v8i=new Q("markersNavigationVisible",!1),HWo=xc.bindToContribution(tw.get);qi(new HWo({id:"closeMarkersNavigation",precondition:v8i,handler:a=>a.close(),kbOpts:{weight:150,kbExpr:ue.focus,primary:9,secondary:[1033]}}));var hO=_,t4e=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}},b8i={type:1,filter:{include:gr.QuickFix},triggerAction:"quick fix hover window"},eCe=class{constructor(i,e,t,o){this._editor=i;this._markerDecorationsService=e;this._openerService=t;this._languageFeaturesService=o;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 t4e(this,h,p))}return s}renderHoverParts(i,e){if(!e.length)return new Lx([]);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)=>cl.compare(r.marker.severity,s.marker.severity))[0],n=this._renderMarkerStatusbar(i,o);return new Lx(t,n)}getAccessibleContent(i){return i.marker.message}_renderMarkerHover(i){let e=new P,t=hO("div.hover-row"),o=R(t,hO("div.marker.hover-contents")),{source:n,message:r,code:s,relatedInformation:l}=i.marker;this._editor.applyFontInfo(o);let c=R(o,hO("span"));if(c.style.whiteSpace="pre-wrap",c.innerText=r,n||s)if(s&&typeof s!="string"){let p=hO("span");if(n){let v=R(p,hO("span"));v.innerText=n}let h=R(p,hO("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=R(h,hO("span"));g.innerText=s.value;let f=R(o,p);f.style.opacity="0.6",f.style.paddingLeft="6px"}else{let p=R(o,hO("span"));p.style.opacity="0.6",p.style.paddingLeft="6px",p.innerText=n&&s?`${n}(${s})`:n||`(${s})`}if(dr(l))for(let{message:p,resource:h,startLineNumber:g,startColumn:f}of l){let v=R(o,hO("div"));v.style.marginTop="8px";let b=R(v,hO("a"));b.innerText=`${Ye(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=R(v,hO("span"));S.innerText=p,this._editor.applyFontInfo(S)}return{hoverPart:i,hoverElement:t,dispose:()=>e.dispose()}}_renderMarkerStatusbar(i,e){let t=new P;if(e.marker.severity===8||e.marker.severity===4||e.marker.severity===2){let o=tw.get(this._editor);o&&i.statusBar.addAction({label:d(1298,null),commandId:sle.ID,run:()=>{i.hide(),o.showAtMarker(e.marker),this._editor.focus()}})}if(!this._editor.getOption(104)){let o=i.statusBar.append(hO("div"));this.recentMarkerCodeActionsInfo&&(TW.makeKey(this.recentMarkerCodeActionsInfo.marker)===TW.makeKey(e.marker)?this.recentMarkerCodeActionsInfo.hasCodeActions||(o.textContent=d(1296,null)):this.recentMarkerCodeActionsInfo=void 0);let n=this.recentMarkerCodeActionsInfo&&!this.recentMarkerCodeActionsInfo.hasCodeActions?C.None:nn(()=>o.textContent=d(1295,null),200,t);o.textContent||(o.textContent="\xA0");let r=this.getCodeActions(e.marker);t.add(Z(()=>r.cancel())),r.then(s=>{if(n.dispose(),this.recentMarkerCodeActionsInfo={marker:e.marker,hasCodeActions:s.validActions.length>0},!this.recentMarkerCodeActionsInfo.hasCodeActions){s.dispose(),o.textContent=d(1296,null);return}o.style.display="none";let l=!1;t.add(Z(()=>{l||s.dispose()})),i.statusBar.addAction({label:d(1297,null),commandId:w1,run:u=>{l=!0;let p=Zu.get(this._editor),h=Yn(u);i.hide(),p?.showCodeActions(b8i,s,{x:h.left,y:h.top,width:h.width,height:h.height})}});let c=s.validActions.find(u=>u.action.isAI);c&&i.statusBar.addAction({label:c.action.title,commandId:c.action.command?.id??"",iconClass:q.asClassName(M.sparkle),run:()=>{Zu.get(this._editor)?.applyCodeAction(c,!1,!1,"fromProblemsHover")}}),i.onContentsChanged()},mt)}return t}getCodeActions(i){return xn(e=>DL(this._languageFeaturesService.codeActionProvider,this._editor.getModel(),new z(i.startLineNumber,i.startColumn,i.endLineNumber,i.endColumn),b8i,bm.None,e))}};eCe=I([m(1,RU),m(2,Qe),m(3,zt)],eCe);var D7=class extends C{constructor(i,e,t,o,n,r,s){super();let l=e.hoverParts;this._renderedHoverParts=this._register(new ale(i,t,l,o,n,r,s));let c=e.options,u=c.anchor,{showAtPosition:p,showAtSecondaryPosition:h}=D7.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 Ie(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 Ie(n,r);return{showAtPosition:l,showAtSecondaryPosition:c}}};D7=I([m(4,_e),m(5,tt),m(6,Wi)],D7);var $ni=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()}},ale=class extends C{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=po.register({description:"content-hover-highlight",className:"hoverHighlight"})}_createEditorDecorations(e,t){if(t.length===0)return C.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:ale._DECORATION_OPTIONS}]),Z(()=>{n.clear()})}_renderParts(e,t,o,n,r){let s=new f7(n,r),l={fragment:this._fragment,statusBar:s,...o},c=new P;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 Lx([])}_renderStatusBar(e,t){if(t.hasContent)return new $ni(e,t)}_registerListenersOnRenderedParts(){let e=new P;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 t4e&&e.add(new Owe(n,()=>t.participant.getAccessibleContent(t.hoverPart),this._clipboardService,this._hoverService))}),e}_updateMarkdownAndColorParticipantInfo(e){let t=e.find(o=>o instanceof P1&&!(o instanceof _7));t&&(this._markdownHoverParticipant=t),this._colorHoverParticipant=e.find(o=>o instanceof C7)}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(1255,null)];for(let n of t.actions){let r=n.actionKeybindingLabel;r?o.push(d(1256,null,n.actionLabel,r)):o.push(d(1257,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 ni;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}};ale=I([m(4,_e),m(5,tt),m(6,Wi)],ale);var tCe=class extends C{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(Rx,this._editor)),this._participants=this._initializeHoverParticipants(),this._hoverOperation=this._register(new Twe(this._editor,new NIt(this._editor,this._participants))),this._registerListeners()}_initializeHoverParticipants(){let e=[];for(let t of d_.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 v5e(o,t.isComplete,t.options))}));let e=this._contentHoverWidget.getDomNode();this._register(Vo(e,"keydown",t=>{t.equals(9)&&this.hide()})),this._register(Vo(e,"mouseleave",t=>{this._onMouseLeave(t)})),this._register(kc.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 D7(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 xwe(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 xwe(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||!g7(t,e.x,e.y))&&this.hide()}startShowingAtRange(e,t,o,n){this._startShowingOrUpdateHover(new xwe(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}};tCe=I([m(1,F),m(2,_e),m(3,tt),m(4,Wi)],tCe);function Zyt(a){let i=a.target;return!!i&&i.type===6&&i.detail.injectedText?.options.attachedData===roi}var qni=!1,kl=class extends C{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 P;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(kl.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()||Zyt(e)}_isMouseOnContentHoverWidget(e){return this._contentWidget?g7(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))||qni||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){PIt(this._hoverSettings.enabled,this._editor.getOption(86),e)&&this._getOrCreateContentWidget().showsOrWillShow(e)||qni||this.hideContentHover()}_onKeyDown(e){if(this._ignoreMouseEvents||!this._contentWidget)return;if(this._hoverSettings.enabled==="onKeyboardModifier"&&h5e(this._editor.getOption(86),e)&&this._mouseMoveEvent){this._contentWidget.isVisible||this._contentWidget.showsOrWillShow(this._mouseMoveEvent);return}let t=this._isPotentialKeyboardShortcut(e),o=tN(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===EIt||t.commandId===x1||t.commandId===k1)&&this._contentWidget.isVisible;return o||n}hideContentHover(){qni||LL.dropDownVisible||this._contentWidget?.hide()}_getOrCreateContentWidget(){return this._contentWidget||(this._contentWidget=this._instantiationService.createInstance(tCe,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()}};kl=I([m(1,ze),m(2,F),m(3,_e)],kl);var i4e=class extends C{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"||!Zyt(e))return;let o=this._editor.getContribution(kl.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 jni=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)}},Qni=class extends C{constructor(i,e,t,o){super();let n=i.getModel(),r=t.model;this.color=t.model.color,this.colorPicker=this._register(new Wwe(e.fragment,r,i.getOption(163),o,"standalone")),this._register(r.onColorFlushed(l=>{this.color=l})),this._register(r.onDidChangeColor(l=>{jae(n,r,l,t.range,t)}));let s=!1;this._register(i.onDidChangeModelContent(l=>{s?s=!1:(e.hide(),i.focus())})),jae(n,r,this.color,t.range,t)}},iCe=class{constructor(i,e){this._editor=i;this._themeService=e;this.hoverOrdinal=2}async createColorHover(i,e,t){if(!this._editor.hasModel()||!Xy.get(this._editor))return null;let n=await xIt(t,this._editor.getModel(),ve.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:jni.fromBaseColor(this,await XIt(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 jae(this._editor.getModel(),e,this._color,t,i),t=JIt(this._editor,t,e))}renderHoverParts(i,e){if(!(e.length===0||!this._editor.hasModel()))return this._setMinimumDimensions(i),this._renderedParts=new Qni(this._editor,i,e[0],this._themeService),this._renderedParts}_setMinimumDimensions(i){let e=this._editor.getOption(75)+8;i.setMinimumDimensions(new ai(302,e))}get _color(){return this._renderedParts?.color}};iCe=I([m(1,De)],iCe);var Yni=class{constructor(i,e){this.value=i;this.foundInEditor=e}},S8i=8,UWo=22,L7=class extends C{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(iCe,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(Vn(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 L7.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 Yni(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 Wq(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 f7(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-UWo-S8i,u=r.body.enterButton;u?.onClicked(()=>{this.updateEditor(),this.hide()});let p=r.header,h=p.pickedColorNode;h.style.width=l+S8i+"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)}};L7=I([m(3,F),m(4,_e),m(5,zt),m(6,$s),m(7,tt)],L7);var QM=class extends C{constructor(e,t,o){super();this._editor=e;this._instantiationService=o;this._standaloneColorPickerWidget=null;this._standaloneColorPickerVisible=ue.standaloneColorPickerVisible.bindTo(t),this._standaloneColorPickerFocused=ue.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(L7,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(QM.ID)}};QM=I([m(1,X),m(2,F)],QM);var ewt=class extends wl{constructor(){super({id:"editor.action.showOrFocusStandaloneColorPicker",title:{...L(1048,"Show or Focus Standalone Color Picker"),mnemonicTitle:d(1047,null)},precondition:void 0,menu:[{id:D.CommandPalette}],metadata:{description:L(1049,"Show or focus a standalone color picker which uses the default color provider. It displays hex/rgb/hsl colors.")}})}runEditorCommand(i,e){QM.get(e)?.showOrFocus()}},twt=class extends xi{constructor(){super({id:"editor.action.hideColorPicker",label:L(1043,"Hide the Color Picker"),precondition:ue.standaloneColorPickerVisible.isEqualTo(!0),kbOpts:{primary:9,weight:100},metadata:{description:L(1044,"Hide the standalone color picker.")}})}run(i,e){QM.get(e)?.hide()}},iwt=class extends xi{constructor(){super({id:"editor.action.insertColorWithStandaloneColorPicker",label:L(1045,"Insert Color with Standalone Color Picker"),precondition:ue.standaloneColorPickerFocused.isEqualTo(!0),kbOpts:{primary:3,weight:100},metadata:{description:L(1046,"Insert hex/rgb/hsl colors with the focused standalone color picker.")}})}run(i,e){QM.get(e)?.insertColor()}};Jt(twt);Jt(iwt);W(ewt);go(i4e.ID,i4e,2);go(QM.ID,QM,1);go(Xy.ID,Xy,1);Dx(kwe);d_.register(C7);qe.registerCommand("_executeDocumentColorProvider",function(a,...i){let[e]=i;if(!(e instanceof A))throw Br();let{model:t,colorProviderRegistry:o,defaultColorDecoratorsEnablement:n}=ooi(a,e);return kIt(new wIt,o,t,ve.None,n)});qe.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 Br();let{model:r,colorProviderRegistry:s,defaultColorDecoratorsEnablement:l}=ooi(a,o),[c,u,p,h]=e;return kIt(new CIt({range:n,color:{red:c,green:u,blue:p,alpha:h}}),s,r,ve.None,l)});var Qq=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(An.delete(new z(i.startLineNumber,i.startColumn-e.length,i.endLineNumber,i.endColumn+t.length))):(o.push(An.delete(new z(i.startLineNumber,i.startColumn-e.length,i.startLineNumber,i.startColumn))),o.push(An.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(An.replace(new z(i.startLineNumber,i.startColumn,i.endLineNumber,i.endColumn),e+"  "+t)):(n.push(An.insert(new Ie(i.startLineNumber,i.startColumn),e+(o?" ":""))),n.push(An.insert(new Ie(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 Yt(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 Yt(o.endLineNumber,o.endColumn+n,o.endLineNumber,o.endColumn+n)}}};var oCe=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=Ap(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&&!Qq._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 Ie(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?Qq._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=Ap(c);u===-1&&(u=c.length),l=Qq._createAddBlockCommentOperations(new z(t.startLineNumber,u+1,t.startLineNumber,c.length+1),r,s,this._insertSpace)}else l=Qq._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 Yt(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(An.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(An.insert(new Ie(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 o4e=class extends xi{constructor(i,e){super(e),this._type=i}run(i,e){let t=i.get(bs);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 oCe(t,u.selection,r.indentSize,this._type,s.insertSpace,s.ignoreEmptyLines,u.ignoreFirstLine));e.pushUndoStop(),e.executeCommands(this.id,n),e.pushUndoStop()}},Xni=class extends o4e{constructor(){super(0,{id:"editor.action.commentLine",label:L(1051,"Toggle Line Comment"),precondition:ue.writable,kbOpts:{kbExpr:ue.editorTextFocus,primary:2138,weight:100},menuOpts:{menuId:D.MenubarEditMenu,group:"5_insert",title:d(1055,null),order:1},canTriggerInlineEdits:!0})}},Jni=class extends o4e{constructor(){super(1,{id:"editor.action.addCommentLine",label:L(1052,"Add Line Comment"),precondition:ue.writable,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,2081),weight:100},canTriggerInlineEdits:!0})}},Zni=class extends o4e{constructor(){super(2,{id:"editor.action.removeCommentLine",label:L(1053,"Remove Line Comment"),precondition:ue.writable,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,2099),weight:100},canTriggerInlineEdits:!0})}},eri=class extends xi{constructor(){super({id:"editor.action.blockComment",label:L(1050,"Toggle Block Comment"),precondition:ue.writable,kbOpts:{kbExpr:ue.editorTextFocus,primary:1567,linux:{primary:3103},weight:100},menuOpts:{menuId:D.MenubarEditMenu,group:"5_insert",title:d(1054,null),order:2},canTriggerInlineEdits:!0})}run(i,e){let t=i.get(bs);if(!e.hasModel())return;let o=e.getOption(29),n=[],r=e.getSelections();for(let s of r)n.push(new Qq(s,o.insertSpace,t));e.pushUndoStop(),e.executeCommands(this.id,n),e.pushUndoStop()}};Jt(Xni);Jt(Jni);Jt(Zni);Jt(eri);var Hm=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 P;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&&_M(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(Hm.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 Cc){let c=this._getMenuActions(i,l.item.submenu);c.length>0&&(t.push(new $l(l.id,l.label,c)),s++)}else t.push(l),s++;s&&t.push(new li)}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=Yn(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)&&!Nc;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 Lr(n,n,{label:!0,keybinding:r.getLabel(),isMenu:!0});let s=n;return typeof s.getActionViewItem=="function"?s.getActionViewItem():new Lr(n,n,{icon:!0,label:!0,isMenu:!0})},getKeyBinding:n=>this._keybindingFor(n),onHide:n=>{this._contextMenuIsBeingShownCount--}})}_showScrollbarContextMenu(i){if(!this._editor.hasModel()||w4i(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 $l(`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(1057,null),checked:e.enabled,run:()=>{this._configurationService.updateValue("editor.minimap.enabled",!e.enabled)}})),s.push(new li),s.push(o({label:d(1058,null),enabled:e.enabled,checked:e.renderCharacters,run:()=>{this._configurationService.updateValue("editor.minimap.renderCharacters",!e.renderCharacters)}})),s.push(r(d(1059,null),e.enabled,"editor.minimap.size",e.size,[{label:d(1062,null),value:"proportional"},{label:d(1060,null),value:"fill"},{label:d(1061,null),value:"fit"}])),s.push(r(d(1063,null),e.enabled,"editor.minimap.showSlider",e.showSlider,[{label:d(1065,null),value:"mouseover"},{label:d(1064,null),value:"always"}]));let l=this._editor.getOption(144)&&!Nc;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()}};Hm=I([m(1,ze),m(2,_n),m(3,X),m(4,_e),m(5,qt),m(6,B),m(7,Pe)],Hm);var tri=class extends xi{constructor(){super({id:"editor.action.showContextMenu",label:L(1056,"Show Editor Context Menu"),precondition:void 0,kbOpts:{kbExpr:ue.textInputFocus,primary:1092,weight:100}})}run(i,e){Hm.get(e)?.showContextMenu()}};go(Hm.ID,Hm,2);Jt(tri);var n4e=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}},r4e=class{constructor(i,e,t){this.cursorState=i;this.scrollTop=e;this.scrollLeft=t}},nCe=class a extends C{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 n4e(e.oldSelections);this._undoStack.length>0&&this._undoStack[this._undoStack.length-1].cursorState.equals(t)||(this._undoStack.push(new r4e(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 r4e(new n4e(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 r4e(new n4e(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}},iri=class extends xi{constructor(){super({id:"cursorUndo",label:L(1067,"Cursor Undo"),precondition:void 0,kbOpts:{kbExpr:ue.textInputFocus,primary:2099,weight:100}})}run(i,e,t){nCe.get(e)?.cursorUndo()}},ori=class extends xi{constructor(){super({id:"cursorRedo",label:L(1066,"Cursor Redo"),precondition:void 0})}run(i,e,t){nCe.get(e)?.cursorRedo()}};go(nCe.ID,nCe,0);Jt(iri);Jt(ori);var owt=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 Yt(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 Yt(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 Yt(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 Yt(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 Yt(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 rCe(a){return it?a.altKey:a.ctrlKey}var sCe=class a extends C{static{this.ID="editor.contrib.dragAndDrop"}static{this.TRIGGER_KEY_VALUE=it?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)||(rCe(i)&&(this._modifierPressed=!0),this._mouseDown&&rCe(i)&&this._editor.updateOptions({mouseStyle:"copy"}))}onEditorKeyUp(i){!this._editor.getOption(42)||this._editor.getOption(28)||(rCe(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}rCe(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 Ie(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 Yt(n,r,e.lineNumber,e.column)]}}else t=(this._editor.getSelections()||[]).map(o=>o.containsPosition(e)?new Yt(e.lineNumber,e.column,e.lineNumber,e.column):o);this._editor.setSelections(t||[],"mouse",3)}else(!this._dragSelection.containsPosition(e)||(rCe(i.event)||this._modifierPressed)&&(this._dragSelection.getEndPosition().equals(e)||this._dragSelection.getStartPosition().equals(e)))&&(this._editor.pushUndoStop(),this._editor.executeCommand(a.ID,new owt(this._dragSelection,e,rCe(i.event)||this._modifierPressed)),this._editor.pushUndoStop())}this._editor.updateOptions({mouseStyle:"text"}),this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1}static{this._DECORATION_OPTIONS=po.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()}};go(sCe.ID,sCe,2);var nri="editor.action.pasteAs";go(ou.ID,ou,0);Dx(hwe);qi(new class extends xc{constructor(){super({id:Nii,precondition:dIt,kbOpts:{weight:100,primary:2137}})}runEditorCommand(a,i){return ou.get(i)?.changePasteType()}});qi(new class extends xc{constructor(){super({id:"editor.hidePasteWidget",precondition:dIt,kbOpts:{weight:100,primary:9}})}runEditorCommand(a,i){ou.get(i)?.clearWidgets()}});Jt(class I8i extends xi{static{this.argsSchema={oneOf:[{type:"object",required:["kind"],properties:{kind:{type:"string",description:d(1069,null)}}},{type:"object",required:["preferences"],properties:{preferences:{type:"array",description:d(1070,null),items:{type:"string"}}}}]}}constructor(){super({id:nri,label:L(1068,"Paste As..."),precondition:ue.writable,metadata:{description:"Paste as",args:[{name:"args",schema:I8i.argsSchema}]},canTriggerInlineEdits:!0})}run(i,e,t){let o;return t&&("kind"in t?o={only:new Is(t.kind)}:"preferences"in t&&(o={preferences:t.preferences.map(n=>new Is(n))})),ou.get(e)?.pasteAs(o)}});Jt(class extends xi{constructor(){super({id:"editor.action.pasteAsText",label:L(1071,"Paste as Text"),precondition:ue.writable,canTriggerInlineEdits:!0})}run(a,i){return ou.get(i)?.pasteAs({providerId:Rq.id})}});var nwt=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)}},sC=class{constructor(i){this.identifier=i}};var Yq=ae("treeViewsDndService");we(Yq,nwt,1);var s4e="editor.dropIntoEditor.preferences",rri="editor.changeDropType",rwt=new Q("dropWidgetVisible",!1,d(1090,null)),lh=class extends C{constructor(e,t,o,n,r){super();this._configService=o;this._languageFeaturesService=n;this._treeViewsDragAndDropService=r;this.treeItemsTransfer=VI.getInstance();this._dropProgressManager=this._register(t.createInstance(a7,"dropIntoEditor",e)),this._postDropWidgetManager=this._register(t.createInstance(c7,"dropIntoEditor",e,rwt,{id:rri,label:d(1091,null)},()=>lh._configureDefaultAction?[lh._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(lh.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;lh._currentDropOperation?.cancel(),e.focus(),e.setPosition(t);let n=xn(async r=>{let s=new P,l=s.add(new Ex(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(),lh._currentDropOperation===n&&(lh._currentDropOperation=void 0)}});this._dropProgressManager.showWhile(t,d(1089,null),n,{cancel:()=>n.cancel()}),lh._currentDropOperation=n}async getDropEdits(e,t,o,n,r){let s=new P,l=await wa(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){so(p)||console.error(p),console.error(p)}})),r),c=si(l??[]).flat();return{edits:sIt(c),dispose:()=>s.dispose()}}getInitialActiveEditIndex(e,t){let o=this._configService.getValue(s4e,{resource:e.uri});for(let n of Array.isArray(o)?o:[]){let r=new Is(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 bx;let t=$se(e.dataTransfer);if(this.treeItemsTransfer.hasData(sC.prototype)){let o=this.treeItemsTransfer.getData(sC.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}};lh=I([m(1,F),m(2,B),m(3,zt),m(4,Yq)],lh);go(lh.ID,lh,2);Dx(mwe);qi(new class extends xc{constructor(){super({id:rri,precondition:rwt,kbOpts:{weight:100,primary:2137}})}runEditorCommand(a,i,e){lh.get(i)?.changeDropType()}});qi(new class extends xc{constructor(){super({id:"editor.hideDropWidget",precondition:rwt,kbOpts:{weight:100,primary:9}})}runEditorCommand(a,i,e){lh.get(i)?.clearWidgets()}});var swt=class a extends Ma{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:wt(cW),inputActiveOptionForeground:wt(V$),inputActiveOptionBackground:wt(dW)},r={groupId:"find-options-widget"};this.caseSensitive=this._register(new Mwe({appendTitle:this._keybindingLabelFor(ad.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 Pwe({appendTitle:this._keybindingLabelFor(ad.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 Awe({appendTitle:this._keybindingLabelFor(ad.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 awt(a,i){return a===1?!0:a===2?!1:i}var G1=class extends C{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 awt(this._isRegexOverride,this._isRegex)}get wholeWord(){return awt(this._wholeWordOverride,this._wholeWord)}get matchCase(){return awt(this._matchCaseOverride,this._matchCase)}get preserveCase(){return awt(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>=rO}};var h_=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 h_._instance||(h_._instance=new h_(i)),h_._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(h_.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(h_.FIND_HISTORY_KEY,JSON.stringify(i),1,0),this._onDidChangeEmitter.fire(i),e()})}};h_=I([m(0,le)],h_);var g_=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 g_._instance||(g_._instance=new g_(i)),g_._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(g_.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(g_.FIND_HISTORY_KEY,JSON.stringify(i),1,0),this._onDidChangeEmitter.fire(i),e()})}};g_=I([m(0,le)],g_);var KWo=524288;function R7(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)<KWo)return a.getModel().getValueInRange(t)}return null}var Tf=class extends C{static{this.ID="editor.contrib.findController"}get editor(){return this._editor}static get(i){return i.getContribution(Tf.ID)}constructor(i,e,t,o,n,r){super(),this._editor=i,this._findWidgetVisible=fE.bindTo(e),this._contextKeyService=e,this._storageService=t,this._clipboardService=o,this._notificationService=n,this._hoverService=r,this._updateHistoryDelayer=this._register(new jo(500)),this._state=this._register(new G1),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!!Rwe.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=Yr(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=R7(this._editor,i.seedSearchStringFromSelection,i.seedSearchStringFromNonEmptySelection);o&&(this._state.isRegex?t.searchString=Yr(o):t.searchString=o)}else if(i.seedSearchStringFromSelection==="multiple"&&!i.updateSearchScope){let o=R7(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 BIt(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(1109,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)}};Tf=I([m(1,X),m(2,le),m(3,Wi),m(4,Ne),m(5,tt)],Tf);var a4e=class extends Tf{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=h_.getOrCreate(s),this._replaceWidgetHistory=g_.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 $It(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 swt(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)}};a4e=I([m(1,_n),m(2,X),m(3,_e),m(4,Ne),m(5,le),m(6,Wi),m(7,tt),m(8,B),m(9,Bi)],a4e);var uri=KGe(new qre({id:ad.StartFindAction,label:L(1105,"Find"),precondition:x.or(ue.focus,x.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2084,weight:100},menuOpts:{menuId:D.MenubarEditMenu,group:"3_find",title:d(1101,null),order:1}}));uri.addImplementation(0,(a,i,e)=>{let t=Tf.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 GWo={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"}}}}]},sri=class extends xi{constructor(){super({id:ad.StartFindWithArgs,label:L(1106,"Find with Arguments"),precondition:void 0,kbOpts:{kbExpr:null,primary:0,weight:100},metadata:GWo})}async run(i,e,t){let o=Tf.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)}}},ari=class extends xi{constructor(){super({id:ad.StartFindWithSelection,label:L(1107,"Find with Selection"),precondition:void 0,kbOpts:{kbExpr:null,primary:0,mac:{primary:2083},weight:100}})}async run(i,e){let t=Tf.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 y8i(a,i){let e=Tf.get(a);if(!e)return;let t=()=>(i?e.moveToNextMatch():e.moveToPrevMatch())?(e.editor.pushUndoStop(),!0):!1;t()||(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}),t())}var pri=KGe(new qre({id:ad.NextMatchFindAction,label:L(1099,"Find Next"),precondition:void 0,kbOpts:[{kbExpr:ue.focus,primary:61,mac:{primary:2085,secondary:[61]},weight:100},{kbExpr:x.and(ue.focus,Rwe),primary:3,weight:100}]}));pri.addImplementation(0,async(a,i,e)=>y8i(i,!0));var mri=KGe(new qre({id:ad.PreviousMatchFindAction,label:L(1100,"Find Previous"),precondition:void 0,kbOpts:[{kbExpr:ue.focus,primary:1085,mac:{primary:3109,secondary:[1085]},weight:100},{kbExpr:x.and(ue.focus,Rwe),primary:1027,weight:100}]}));mri.addImplementation(0,async(a,i,e)=>y8i(i,!1));var lri=class extends xi{constructor(){super({id:ad.GoToMatchFindAction,label:L(1095,"Go to Match..."),precondition:fE});this._highlightDecorations=[]}run(e,t){let o=Tf.get(t);if(!o)return;let n=o.getState().matchesCount;if(n<1){e.get(Ne).notify({severity:St.Warning,message:d(1098,null)});return}let r=e.get(Ge),s=new P,l=s.add(r.createInputBox());l.placeholder=d(1096,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(1097,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(1097,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:Ss(y9),position:7}}}])})}},lwt=class extends xi{async run(i,e){let t=Tf.get(e);if(!t)return;let o=R7(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))}},cri=class extends lwt{constructor(){super({id:ad.NextSelectionMatchFindAction,label:L(1103,"Find Next Selection"),precondition:void 0,kbOpts:{kbExpr:ue.focus,primary:2109,weight:100}})}_run(i){return i.moveToNextMatch()}},dri=class extends lwt{constructor(){super({id:ad.PreviousSelectionMatchFindAction,label:L(1104,"Find Previous Selection"),precondition:void 0,kbOpts:{kbExpr:ue.focus,primary:3133,weight:100}})}_run(i){return i.moveToPrevMatch()}},hri=KGe(new qre({id:ad.StartFindReplaceAction,label:L(1108,"Replace"),precondition:x.or(ue.focus,x.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2086,mac:{primary:2596},weight:100},menuOpts:{menuId:D.MenubarEditMenu,group:"3_find",title:d(1102,null),order:2}}));hri.addImplementation(0,(a,i,e)=>{if(!i.hasModel()||i.getOption(104))return!1;let t=Tf.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})});go(Tf.ID,a4e,0);Jt(sri);Jt(ari);Jt(lri);Jt(cri);Jt(dri);var OW=xc.bindToContribution(Tf.get);qi(new OW({id:ad.CloseFindWidgetCommand,precondition:fE,handler:a=>a.closeFindWidget(),kbOpts:{weight:105,kbExpr:x.and(ue.focus,x.not("isComposing")),primary:9,secondary:[1033]}}));qi(new OW({id:ad.ToggleCaseSensitiveCommand,precondition:void 0,handler:a=>a.toggleCaseSensitive(),kbOpts:{weight:105,kbExpr:ue.focus,primary:Bq.primary,mac:Bq.mac,win:Bq.win,linux:Bq.linux}}));qi(new OW({id:ad.ToggleWholeWordCommand,precondition:void 0,handler:a=>a.toggleWholeWords(),kbOpts:{weight:105,kbExpr:ue.focus,primary:Hq.primary,mac:Hq.mac,win:Hq.win,linux:Hq.linux}}));qi(new OW({id:ad.ToggleRegexCommand,precondition:void 0,handler:a=>a.toggleRegex(),kbOpts:{weight:105,kbExpr:ue.focus,primary:Uq.primary,mac:Uq.mac,win:Uq.win,linux:Uq.linux}}));qi(new OW({id:ad.ToggleSearchScopeCommand,precondition:void 0,handler:a=>a.toggleSearchScope(),kbOpts:{weight:105,kbExpr:ue.focus,primary:y5e.primary,mac:y5e.mac,win:y5e.win,linux:y5e.linux}}));qi(new OW({id:ad.TogglePreserveCaseCommand,precondition:void 0,handler:a=>a.togglePreserveCase(),kbOpts:{weight:105,kbExpr:ue.focus,primary:$ae.primary,mac:$ae.mac,win:$ae.win,linux:$ae.linux}}));qi(new OW({id:ad.ReplaceOneAction,precondition:fE,handler:a=>a.replace(),kbOpts:{weight:105,kbExpr:ue.focus,primary:3094}}));qi(new OW({id:ad.ReplaceOneAction,precondition:fE,handler:a=>a.replace(),kbOpts:{weight:105,kbExpr:x.and(ue.focus,I5e,ue.isComposing.negate()),primary:3}}));qi(new OW({id:ad.ReplaceAllAction,precondition:fE,handler:a=>a.replaceAll(),kbOpts:{weight:105,kbExpr:ue.focus,primary:2563}}));qi(new OW({id:ad.ReplaceAllAction,precondition:fE,handler:a=>a.replaceAll(),kbOpts:{weight:105,kbExpr:x.and(ue.focus,I5e),primary:void 0,mac:{primary:2051}}}));qi(new OW({id:ad.SelectAllMatchesAction,precondition:fE,handler:a=>a.selectAllMatches(),kbOpts:{weight:105,kbExpr:ue.focus,primary:515}}));var $Wo={0:" ",1:"u",2:"r"},w8i=65535,YM=16777215,C8i=4278190080,l4e=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)}},jI=class a{constructor(i,e,t){if(i.length!==e.length||i.length>w8i)throw new Error("invalid startIndexes or endIndexes size");this._startIndexes=i,this._endIndexes=e,this._collapseStates=new l4e(i.length),this._userDefinedStates=new l4e(i.length),this._recoveredStates=new l4e(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>YM||r>YM)throw new Error("startLineNumber or endLineNumber must not exceed "+YM);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]&YM}getEndLineNumber(i){return this._endIndexes[i]&YM}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 gri(this,i)}getParentIndex(i){this.ensureParentIndices();let e=((this._startIndexes[i]&C8i)>>>24)+((this._endIndexes[i]&C8i)>>>16);return e===w8i?-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]=`[${$Wo[this.getSource(e)]}${this.isCollapsed(e)?"+":"-"}] ${this.getStartLineNumber(e)}/${this.getEndLineNumber(e)}`;return i.join(", ")}toFoldRange(i){return{startLineNumber:this._startIndexes[i]&YM,endLineNumber:this._endIndexes[i]&YM,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}},gri=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 cwt=class{constructor(i,e){this._updateEventEmitter=new E;this.onDidChange=this._updateEventEmitter.event;this._textModel=i,this._decorationProvider=e,this._regions=new jI(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(jI.fromFoldRanges(e))}update(i,e){let t=this._currentFoldedOrManualRanges(e),o=jI.sanitizeAndMerge(i,t,this._textModel.getLineCount(),e);this.updatePost(jI.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=jI.sanitizeAndMerge(this._regions,e,t);this.updatePost(jI.fromFoldRanges(o))}_getLinesChecksum(i,e){return Ir(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 c4e(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 lle(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 fri(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 x8i(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 k8i(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 vri(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 dwt(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 uwt(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 E8i(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 T8i(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 _8i(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 pwt=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||OS(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 D8i(this._hiddenRanges,i)!==null}adjustSelections(i){let e=!1,t=this._foldingModel.textModel,o=null,n=r=>((!o||!jWo(r,o))&&(o=D8i(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 jWo(a,i){return a>=i.startLineNumber&&a<=i.endLineNumber}function D8i(a,i){let e=xy(a,t=>i<t.startLineNumber)-1;return e>=0&&a[e].endLineNumber>=i?a[e]:null}var QWo=5e3,YWo="indent",cle=class{constructor(i,e,t){this.editorModel=i;this.languageConfigurationService=e;this.foldingRangesLimit=t;this.id=YWo}dispose(){}compute(i){let e=this.languageConfigurationService.getLanguageConfiguration(this.editorModel.getLanguageId()).foldingRules,t=e&&!!e.offSide,o=e&&e.markers;return Promise.resolve(JWo(this.editorModel,t,o,this.foldingRangesLimit))}},bri=class{constructor(i){this._startIndexes=[],this._endIndexes=[],this._indentOccurrences=[],this._length=0,this._foldingRangesLimit=i}insertFirst(i,e,t){if(i>YM||e>YM)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 jI(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=eq(p,n);(h<o||h===o&&t++<e)&&(r[c]=u,s[c]=this._endIndexes[l],c++)}return new jI(r,s)}}},XWo={limit:QWo,update:()=>{}};function JWo(a,i,e,t=XWo){let o=a.getOptions().tabSize,n=new bri(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=eq(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 ZWo=J("editor.foldBackground",{light:ei(sv,.3),dark:ei(sv,.3),hcDark:null,hcLight:null},d(1161,null),!0);J("editor.foldPlaceholderForeground",{light:"#808080",dark:"#808080",hcDark:null,hcLight:null},d(1159,null));J("editorGutter.foldingControlForeground",_N,d(1160,null));var dle=Re("folding-expanded",M.chevronDown,d(1163,null)),ule=Re("folding-collapsed",M.chevronRight,d(1162,null)),L8i=Re("folding-manual-collapsed",ule,d(1164,null)),R8i=Re("folding-manual-expanded",dle,d(1165,null)),Sri={color:Ss(ZWo),position:1},aCe=d(1166,null),mwt=d(1167,null),hwt=class a{constructor(i){this.editor=i;this.showFoldingControls="mouseover";this.showFoldingHighlights=!0}static{this.COLLAPSED_VISUAL_DECORATION=po.register({description:"folding-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:aCe,firstLineDecorationClassName:q.asClassName(ule)})}static{this.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=po.register({description:"folding-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:Sri,isWholeLine:!0,linesDecorationsTooltip:aCe,firstLineDecorationClassName:q.asClassName(ule)})}static{this.MANUALLY_COLLAPSED_VISUAL_DECORATION=po.register({description:"folding-manually-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:aCe,firstLineDecorationClassName:q.asClassName(L8i)})}static{this.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=po.register({description:"folding-manually-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:Sri,isWholeLine:!0,linesDecorationsTooltip:aCe,firstLineDecorationClassName:q.asClassName(L8i)})}static{this.NO_CONTROLS_COLLAPSED_RANGE_DECORATION=po.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:aCe})}static{this.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION=po.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:Sri,isWholeLine:!0,linesDecorationsTooltip:aCe})}static{this.EXPANDED_VISUAL_DECORATION=po.register({description:"folding-expanded-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+q.asClassName(dle),linesDecorationsTooltip:mwt})}static{this.EXPANDED_AUTO_HIDE_VISUAL_DECORATION=po.register({description:"folding-expanded-auto-hide-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:q.asClassName(dle),linesDecorationsTooltip:mwt})}static{this.MANUALLY_EXPANDED_VISUAL_DECORATION=po.register({description:"folding-manually-expanded-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+q.asClassName(R8i),linesDecorationsTooltip:mwt})}static{this.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION=po.register({description:"folding-manually-expanded-auto-hide-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:q.asClassName(R8i),linesDecorationsTooltip:mwt})}static{this.NO_CONTROLS_EXPANDED_RANGE_DECORATION=po.register({description:"folding-no-controls-range-decoration",stickiness:0,isWholeLine:!0})}static{this.HIDDEN_RANGE_DECORATION=po.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 eVo={},tVo="syntax",ple=class{constructor(i,e,t,o,n){this.editorModel=i;this.providers=e;this.handleFoldingRangesChange=t;this.foldingRangesLimit=o;this.fallbackRangeProvider=n;this.id=tVo;this.disposables=new P,n&&this.disposables.add(n);for(let r of e)typeof r.onDidChange=="function"&&this.disposables.add(r.onDidChange(t))}compute(i){return iVo(this.providers,this.editorModel,i).then(e=>this.editorModel.isDisposed()?null:e?yri(e,this.foldingRangesLimit):this.fallbackRangeProvider?.compute(i)??null)}dispose(){this.disposables.dispose()}};function iVo(a,i,e){let t=null,o=a.map((n,r)=>Promise.resolve(n.provideFoldingRanges(i,eVo,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})}},ss));return Promise.all(o).then(n=>t)}var Iri=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>YM||e>YM)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 jI(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 jI(o,n,r)}}};function yri(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 Iri(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 GS=new Q("foldingEnabled",!1),Qg=class extends C{constructor(e,t,o,n,r,s){super();this.contextKeyService=t;this.languageConfigurationService=o;this.languageFeaturesService=s;this.localToDispose=this._register(new P);this.editor=e,this._foldingLimitReporter=this._register(new d4e(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 hwt(e),this.foldingDecorationProvider.showFoldingControls=l.get(126),this.foldingDecorationProvider.showFoldingHighlights=l.get(54),this.foldingEnabled=GS.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(Qg.ID)}static getFoldingRangeProviders(e,t){let o=e.foldingRangeProvider.ordered(t);return Qg._foldingRangeSelector?.(o,t)??o}static setFoldingRangeProviderSelector(e){return Qg._foldingRangeSelector=e,{dispose:()=>{Qg._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 cwt(e,this.foldingDecorationProvider),this.localToDispose.add(this.foldingModel),this.hiddenRangeModel=new pwt(this.foldingModel),this.localToDispose.add(this.hiddenRangeModel),this.localToDispose.add(this.hiddenRangeModel.onDidChange(t=>this.onHiddenRangesChanges(t))),this.updateScheduler=new jo(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 cle(e,this.languageConfigurationService,this._foldingLimitReporter);if(this.rangeProvider=t,this._useFoldingProviders&&this.foldingModel){let o=Qg.getFoldingRangeProviders(this.languageFeaturesService,e);o.length>0&&(this.rangeProvider=new ple(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 En,o=this.getRangeProvider(e.textModel),n=this.foldingRegionPromise=xn(r=>o.compute(r));return n.then(r=>{if(r&&n===this.foldingRegionPromise){let s;if(this._foldingImportsByDefault&&!this._currentModelHasFoldedImports){let u=r.setCollapsedAllOfType(Yk.Imports.value,!0);u&&(s=tC.capture(this.editor),this._currentModelHasFoldedImports=u)}let l=this.editor.getSelections();e.update(r,oVo(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)}};Qg=I([m(1,X),m(2,bs),m(3,Ne),m(4,jg),m(5,zt)],Qg);var d4e=class extends C{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())}},Yb=class extends xi{runEditorCommand(i,e,t){let o=i.get(bs),n=Qg.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 oVo(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 M8i(a){if(!cn(a)){if(!yi(a))return!1;let i=a;if(!cn(i.levels)&&!Xo(i.levels)||!cn(i.direction)&&!Ae(i.direction)||!cn(i.selectionLines)&&(!Array.isArray(i.selectionLines)||!i.selectionLines.every(Xo)))return!1}return!0}var wri=class extends Yb{constructor(){super({id:"editor.unfold",label:L(1154,"Unfold"),precondition:GS,kbOpts:{kbExpr:ue.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:M8i,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"?fri(e,!1,n,r):lle(e,!1,n,r)}},Cri=class extends Yb{constructor(){super({id:"editor.unfoldRecursively",label:L(1158,"Unfold Recursively"),precondition:GS,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,2142),weight:100}})}invoke(i,e,t,o){lle(e,!1,Number.MAX_VALUE,this.getSelectedLines(t))}},xri=class extends Yb{constructor(){super({id:"editor.fold",label:L(1140,"Fold"),precondition:GS,kbOpts:{kbExpr:ue.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:M8i,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"?x8i(e,!0,n):s==="up"?fri(e,!0,r||1,n):lle(e,!0,r||1,n)}},kri=class extends Yb{constructor(){super({id:"editor.toggleFold",label:L(1151,"Toggle Fold"),precondition:GS,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,2090),weight:100}})}invoke(i,e,t){let o=this.getSelectedLines(t);c4e(e,1,o)}},Eri=class extends Yb{constructor(){super({id:"editor.foldRecursively",label:L(1146,"Fold Recursively"),precondition:GS,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,2140),weight:100}})}invoke(i,e,t){let o=this.getSelectedLines(t);lle(e,!0,Number.MAX_VALUE,o)}},Tri=class extends Yb{constructor(){super({id:"editor.toggleFoldRecursively",label:L(1152,"Toggle Fold Recursively"),precondition:GS,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,3114),weight:100}})}invoke(i,e,t){let o=this.getSelectedLines(t);c4e(e,Number.MAX_VALUE,o)}},_ri=class extends Yb{constructor(){super({id:"editor.foldAllBlockComments",label:L(1142,"Fold All Block Comments"),precondition:GS,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,2138),weight:100}})}invoke(i,e,t,o,n){if(e.regions.hasTypes())uwt(e,Yk.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*"+Yr(s.blockCommentStartToken));dwt(e,l,!0)}}}},Dri=class extends Yb{constructor(){super({id:"editor.foldAllMarkerRegions",label:L(1144,"Fold All Regions"),precondition:GS,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,2077),weight:100}})}invoke(i,e,t,o,n){if(e.regions.hasTypes())uwt(e,Yk.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);dwt(e,l,!0)}}}},Lri=class extends Yb{constructor(){super({id:"editor.unfoldAllMarkerRegions",label:L(1157,"Unfold All Regions"),precondition:GS,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,2078),weight:100}})}invoke(i,e,t,o,n){if(e.regions.hasTypes())uwt(e,Yk.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);dwt(e,l,!1)}}}},Rri=class extends Yb{constructor(){super({id:"editor.foldAllExcept",label:L(1143,"Fold All Except Selected"),precondition:GS,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,2136),weight:100}})}invoke(i,e,t){let o=this.getSelectedLines(t);vri(e,!0,o)}},Mri=class extends Yb{constructor(){super({id:"editor.unfoldAllExcept",label:L(1156,"Unfold All Except Selected"),precondition:GS,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,2134),weight:100}})}invoke(i,e,t){let o=this.getSelectedLines(t);vri(e,!1,o)}},Pri=class extends Yb{constructor(){super({id:"editor.foldAll",label:L(1141,"Fold All"),precondition:GS,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,2069),weight:100}})}invoke(i,e,t){lle(e,!0)}},Ari=class extends Yb{constructor(){super({id:"editor.unfoldAll",label:L(1155,"Unfold All"),precondition:GS,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,2088),weight:100}})}invoke(i,e,t){lle(e,!1)}},gwt=class a extends Yb{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){k8i(e,this.getFoldingLevel(),!0,this.getSelectedLines(t))}},Nri=class extends Yb{constructor(){super({id:"editor.gotoParentFold",label:L(1148,"Go to Parent Fold"),precondition:GS,kbOpts:{kbExpr:ue.editorTextFocus,weight:100}})}invoke(i,e,t){let o=this.getSelectedLines(t);if(o.length>0){let n=E8i(o[0],e);n!==null&&t.setSelection({startLineNumber:n,startColumn:1,endLineNumber:n,endColumn:1})}}},Ori=class extends Yb{constructor(){super({id:"editor.gotoPreviousFold",label:L(1149,"Go to Previous Folding Range"),precondition:GS,kbOpts:{kbExpr:ue.editorTextFocus,weight:100}})}invoke(i,e,t){let o=this.getSelectedLines(t);if(o.length>0){let n=T8i(o[0],e);n!==null&&t.setSelection({startLineNumber:n,startColumn:1,endLineNumber:n,endColumn:1})}}},Fri=class extends Yb{constructor(){super({id:"editor.gotoNextFold",label:L(1147,"Go to Next Folding Range"),precondition:GS,kbOpts:{kbExpr:ue.editorTextFocus,weight:100}})}invoke(i,e,t){let o=this.getSelectedLines(t);if(o.length>0){let n=_8i(o[0],e);n!==null&&t.setSelection({startLineNumber:n,startColumn:1,endLineNumber:n,endColumn:1})}}},Wri=class extends Yb{constructor(){super({id:"editor.createFoldingRangeFromSelection",label:L(1139,"Create Folding Range from Selection"),precondition:GS,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(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=jI.sanitizeAndMerge(e.regions,o,t.getModel()?.getLineCount());e.updatePost(jI.fromFoldRanges(r))}}}},Vri=class extends Yb{constructor(){super({id:"editor.removeManualFoldingRanges",label:L(1150,"Remove Manual Folding Ranges"),precondition:GS,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(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()}}},Bri=class extends Yb{constructor(){super({id:"editor.toggleImportFold",label:L(1153,"Toggle Import Fold"),precondition:GS,kbOpts:{kbExpr:ue.editorTextFocus,weight:100}})}async invoke(i,e){let t=[],o=e.regions;for(let n=o.length-1;n>=0;n--)o.getType(n)===Yk.Imports.value&&t.push(o.toRegion(n));e.toggleCollapseState(t),i.triggerFoldingModelChanged()}};go(Qg.ID,Qg,0);Jt(wri);Jt(Cri);Jt(xri);Jt(Eri);Jt(Tri);Jt(Pri);Jt(Ari);Jt(_ri);Jt(Dri);Jt(Lri);Jt(Rri);Jt(Mri);Jt(kri);Jt(Nri);Jt(Ori);Jt(Fri);Jt(Wri);Jt(Vri);Jt(Bri);for(let a=1;a<=7;a++)aKi(new gwt({id:gwt.ID(a),label:L(1145,"Fold Level {0}",a),precondition:GS,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,2048|21+a),weight:100}}));qe.registerCommand("_executeFoldingRangeProvider",async function(a,...i){let[e]=i;if(!(e instanceof A))throw Br();let t=a.get(zt),o=a.get(Ct).getModel(e);if(!o)throw Br();let n=a.get(B);if(!n.getValue("editor.folding",{resource:e}))return[];let r=a.get(bs),s=n.getValue("editor.foldingStrategy",{resource:e}),l={get limit(){return n.getValue("editor.foldingMaximumRegions",{resource:e})},update:(g,f)=>{}},c=new cle(o,r,l),u=c;if(s!=="indentation"){let g=Qg.getFoldingRangeProviders(t,o);g.length&&(u=new ple(o,g,()=>{},l,c))}let p=await u.compute(ve.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?Yk.fromValue(f):void 0})}return h}finally{u.dispose()}});var Hri=class extends xi{constructor(){super({id:"editor.action.fontZoomIn",label:L(1168,"Increase Editor Font Size"),precondition:void 0})}run(i,e){$k.setZoomLevel($k.getZoomLevel()+1)}},Uri=class extends xi{constructor(){super({id:"editor.action.fontZoomOut",label:L(1169,"Decrease Editor Font Size"),precondition:void 0})}run(i,e){$k.setZoomLevel($k.getZoomLevel()-1)}},zri=class extends xi{constructor(){super({id:"editor.action.fontZoomReset",label:L(1170,"Reset Editor Font Size"),precondition:void 0})}run(i,e){$k.setZoomLevel(0)}};Jt(Hri);Jt(Uri);Jt(zri);var mle=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=tC.capture(i),n=a._handleEolEdits(i,e);n.length===1&&a._isFullModelReplaceEdit(i,n[0])?i.executeEdits("formatEditsCommand",n.map(r=>An.replace(z.lift(r.range),r.text))):i.executeEdits("formatEditsCommand",n.map(r=>An.replaceMove(z.lift(r.range),r.text))),t&&i.pushUndoStop(),o.restoreRelativeVerticalPositionOfCursor(i)}};function M7(a){return a.scheme===Y.vscodeRemote?a.authority:void 0}function $S(a){if(!a)return;let i=a.indexOf("+");return i<0?a:a.substr(0,i)}function P8i(a){if(!a)return;let i=a.indexOf("+");if(!(i<0))return a.substring(i+1)}function A8i(a){let{host:i,port:e}=nVo(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 nVo(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 N8i="extensions.user.cache",O8i="extensions.builtin.cache",fwt="undefined_publisher",F8i=["ui","workspace","web"];function hle(a){if(typeof a=="object"&&a!==null&&a.supported!==!0)return a.description}var gO=["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 Ei=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 mr(t,o)}return i._lower===e._lower}static toKey(i){return typeof i=="string"?i.toLowerCase():i._lower}},QI=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(Ei.toKey(i))}delete(i){return this._set.delete(Ei.toKey(i))}has(i){return this._set.has(Ei.toKey(i))}},Fd=class{constructor(){this._map=new Map}clear(){this._map.clear()}delete(i){this._map.delete(Ei.toKey(i))}get(i){return this._map.get(Ei.toKey(i))}has(i){return this._map.has(Ei.toKey(i))}set(i,e){this._map.set(Ei.toKey(i),e)}values(){return this._map.values()}forEach(i){this._map.forEach(i)}[Symbol.iterator](){return this._map[Symbol.iterator]()}};function Xq(a){return NL(a)}function NL(a){return a.contributes&&a.contributes.localizations?a.contributes.localizations.length>0:!1}function Kri(a){return a.contributes&&a.contributes.authentication?a.contributes.authentication.length>0:!1}function lCe(a,i){if(i){let e=`onResolveRemoteAuthority:${$S(i)}`;return!!a.activationEvents?.includes(e)}return!1}function W8i(a){return a.map(i=>{let[e,t]=i.split("@");return{proposalName:e,version:t?parseInt(t):void 0}})}function V8i(a){return a.map(i=>i.split("@")[0])}var B8i=ae("IBuiltinExtensionsScannerService");function cCe(a,i,e){let t=[],o=new QI,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 gle=class a{static{this._selectors=new Vs}static setFormatterSelector(i){return{dispose:a._selectors.unshift(i)}}static async select(i,e,t,o){if(i.length===0)return;let n=ht.first(a._selectors);if(n)return await n(i,e,t,o)}};async function fle(a,i,e,t,o,n,r){let s=a.get(F),{documentRangeFormattingEditProvider:l}=a.get(zt),c=pn(i)?i.getModel():i,u=l.ordered(c),p=await gle.select(u,c,t,2);p&&(o.report(p),await s.invokeFunction(Gri,p,i,e,n,r))}async function Gri(a,i,e,t,o,n){let r=a.get($s),s=a.get(ne),l=a.get(tr),c,u;pn(e)?(c=e.getModel(),u=new Ex(e,5,void 0,o)):(c=e,u=new Nae(e,o));let p=[],h=0;for(let S of Yl(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))mle.execute(e,v,!0),e.revealPositionInCenterIfOutsideViewport(e.getPosition(),1);else{let[{range:S}]=v,y=new Yt(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 Yt(k.startLineNumber,k.startColumn,k.endLineNumber,k.endColumn)];return null})}return l.playSignal($o.format,{userGesture:n}),!0}async function vle(a,i,e,t,o,n){let r=a.get(F),s=a.get(zt),l=pn(i)?i.getModel():i,c=cCe(s.documentFormattingEditProvider,s.documentRangeFormattingEditProvider,l),u=await gle.select(c,l,e,1);u&&(t.report(u),await r.invokeFunction($ri,u,i,e,o,n))}async function $ri(a,i,e,t,o,n){let r=a.get($s),s=a.get(tr),l,c;pn(e)?(l=e.getModel(),c=new Ex(e,5,void 0,o)):(l=e,c=new Nae(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))mle.execute(e,u,t!==2),t!==2&&e.revealPositionInCenterIfOutsideViewport(e.getPosition(),1);else{let[{range:p}]=u,h=new Yt(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 Yt(f.startLineNumber,f.startColumn,f.endLineNumber,f.endColumn)];return null})}return s.playSignal($o.format,{userGesture:n}),!0}async function rVo(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(ss);if(dr(l))return await a.computeMoreMinimalEdits(e.uri,l)}}async function sVo(a,i,e,t,o){let n=cCe(i.documentFormattingEditProvider,i.documentRangeFormattingEditProvider,e);for(let r of n){let s=await Promise.resolve(r.provideDocumentFormattingEdits(e,t,o)).catch(ss);if(dr(s))return await a.computeMoreMinimalEdits(e.uri,s)}}async function u4e(a,i,e,t,o){let n=pn(e)?e.getModel():e,r=cCe(i.documentFormattingEditProvider,i.documentRangeFormattingEditProvider,n),s=await gle.select(r,n,t,1);if(s){let l=await Promise.resolve(s.provideDocumentFormattingEdits(n,n.getOptions(),o)).catch(ss);return await a.computeMoreMinimalEdits(n.uri,l)}}function qri(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(ss).then(l=>a.computeMoreMinimalEdits(e.uri,l))}function aVo(a){let i=a;return!!i&&typeof i=="object"&&typeof i.tabSize=="number"&&typeof i.insertSpaces=="boolean"}qe.registerCommand("_executeFormatRangeProvider",async function(a,...i){let[e,t,o]=i;So(A.isUri(e)),So(z.isIRange(t));let n=a.get(Nt),r=a.get($s),s=a.get(zt),l=await n.createModelReference(e);try{return rVo(r,s,l.object.textEditorModel,z.lift(t),jri(o,l),ve.None)}finally{l.dispose()}});qe.registerCommand("_executeFormatDocumentProvider",async function(a,...i){let[e,t]=i;So(A.isUri(e));let o=a.get(Nt),n=a.get($s),r=a.get(zt),s=await o.createModelReference(e);try{return sVo(n,r,s.object.textEditorModel,jri(t,s),ve.None)}finally{s.dispose()}});qe.registerCommand("_executeFormatOnTypeProvider",async function(a,...i){let[e,t,o,n]=i;So(A.isUri(e)),So(Ie.isIPosition(t)),So(typeof o=="string");let r=a.get(Nt),s=a.get($s),l=a.get(zt),c=await r.createModelReference(e);try{return qri(s,l,c.object.textEditorModel,Ie.lift(t),o,jri(n,c),ve.None)}finally{c.dispose()}});function jri(a,i){let e;if(aVo(a))e=a;else{let t=i.object.textEditorModel.getOptions();e={tabSize:t.tabSize,insertSpaces:t.insertSpaces}}return e}var P7=class{constructor(i,e,t,o){this._editor=i;this._languageFeaturesService=e;this._workerService=t;this._accessibilitySignalService=o;this._disposables=new P;this._sessionDisposables=new P;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 D$;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 $e,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}});qri(this._workerService,this._languageFeaturesService,e,t,i,e.getFormattingOptions(),o.token).then(r=>{o.token.isCancellationRequested||dr(r)&&(this._accessibilitySignalService.playSignal($o.format,{userGesture:!1}),mle.execute(this._editor,r,!0))}).finally(()=>{n.dispose()})}};P7=I([m(1,zt),m(2,$s),m(3,tr)],P7);var dCe=class{constructor(i,e,t){this.editor=i;this._languageFeaturesService=e;this._instantiationService=t;this._callOnDispose=new P;this._callOnModel=new P;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(fle,this.editor,i,2,bm.None,ve.None,!1).catch(mt))}};dCe=I([m(1,zt),m(2,F)],dCe);var Qri=class extends xi{constructor(){super({id:"editor.action.formatDocument",label:L(1171,"Format Document"),precondition:x.and(ue.notInCompositeEditor,ue.writable,ue.hasDocumentFormattingProvider),kbOpts:{kbExpr:ue.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(rd).showWhile(t.invokeFunction(vle,e,1,bm.None,ve.None,!0),250)}}},Yri=class extends xi{constructor(){super({id:"editor.action.formatSelection",label:L(1172,"Format Selection"),precondition:x.and(ue.writable,ue.hasDocumentSelectionFormattingProvider),kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,2084),weight:100},contextMenuOpts:{when:ue.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(rd).showWhile(t.invokeFunction(fle,e,n,1,bm.None,ve.None,!0),250)}};go(P7.ID,P7,2);go(dCe.ID,dCe,2);Jt(Qri);Jt(Yri);qe.registerCommand("editor.action.format",async a=>{let i=a.get(Kt).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 OL=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=Ng(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}},_f=class extends OL{constructor(e,t,o){super();this.id=e;this.parent=t;this.symbol=o;this.children=new Map}},iw=class extends OL{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=cx(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}),ZG(e)}},fO=class a extends OL{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 $e(o),r=new a(t.uri),s=e.ordered(t),l=s.map((u,p)=>{let h=OL.findId(`provider_${p}`,r),g=new iw(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=>(ss(f),g)).then(f=>{OL.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=OL.findId(e,t),n=new _f(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=ht.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 iw&&(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 OL.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 _f?e.push(t.symbol):e.push(...ht.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)=>Ie.compare(z.getStartPosition(o.range),z.getStartPosition(n.range))||Ie.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)}},f_=ae("IOutlineModelService"),m4e=class{constructor(i,e,t){this._languageFeaturesService=i;this._disposables=new P;this._cache=new il(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 $e;n={versionId:i.getVersionId(),provider:o,promiseCnt:0,source:s,promise:fO.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 ht.filter(ht.map(this._cache.values(),i=>i.model),i=>i!==void 0)}};m4e=I([m(0,zt),m(1,jg),m(2,Ct)],m4e);we(f_,m4e,1);qe.registerCommand("_executeDocumentSymbolProvider",async function(a,...i){let[e]=i;So(A.isUri(e));let t=a.get(f_),n=await a.get(Nt).createModelReference(e);try{return(await t.getOrCreate(n.object.textEditorModel,ve.None)).getTopLevelSymbols()}finally{n.dispose()}});var xa=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 H8i(a){return a instanceof g4e?a._instance:a}var g4e=class{constructor(i){this.instantiationService=i}init(...i){}};function lVo(a,i){return class extends i{constructor(){super(...arguments);this._autorun=void 0}init(...o){this._autorun=Ga((n,r)=>{let s=a.read(n);this._instance=r.add(this.instantiationService.createInstance(s,...o))})}dispose(){this._autorun?.dispose()}}}var vwt=class extends g4e{constructor(i){super(i),this.init()}};vwt=I([m(0,F)],vwt);function bwt(a){return rE()?lVo(a,h4e):a.get()}var h4e=class extends g4e{constructor(i,e){super(e),this.init(i)}};h4e=I([m(1,F)],h4e);var A7=class{validateOrThrow(i){let e=this.validate(i);if(e.error)throw new Error(e.error.message);return e.content}},uCe=class extends A7{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}}},cVo=new uCe("string");function U8i(){return cVo}var hls=new uCe("number");var dVo=new uCe("boolean");function tsi(){return dVo}var gls=new uCe("object");var Xri=class extends A7{validate(i){return{content:i,error:void 0}}getJSONSchema(){return{}}};function z8i(){return new Xri}var Swt=class extends A7{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 K8i(){return new Swt}var f4e=class{constructor(i){this.validator=i}};function v4e(a){return new f4e(a)}var Jri=class extends A7{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 f4e,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 f4e,l=s?r.validator:r;t[n]=l.getJSONSchema(),s||e.push(n)}return{type:"object",properties:t,...e.length>0?{required:e}:{}}}};function G8i(a){return new Jri(a)}var Zri=class extends A7{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:pUi(this.validators,e=>{if(!(e instanceof Swt))return e.getJSONSchema()})}}};function $8i(...a){return new Zri(a)}var esi=class extends A7{constructor(e,t){super();this._ref=e;this._validator=t}validate(e){return this._validator.validate(e)}getJSONSchema(){return{$ref:this._ref}}};function q8i(a,i){return new esi(a,i)}var $n={Visible:GIt,HasFocusedSuggestion:new Q("suggestWidgetHasFocusedSuggestion",!1,d(1620,null)),DetailsVisible:new Q("suggestWidgetDetailsVisible",!1,d(1619,null)),DetailsFocused:new Q("suggestWidgetDetailsFocused",!1,d(1618,null)),MultipleSuggestions:new Q("suggestWidgetMultipleSuggestions",!1,d(1621,null)),MakesTextEdit:new Q("suggestionMakesTextEdit",!0,d(1617,null)),AcceptSuggestionsOnEnter:new Q("acceptSuggestionOnEnter",!0,d(1613,null)),HasInsertAndReplaceRange:new Q("suggestionHasInsertAndReplaceRange",!1,d(1615,null)),InsertMode:new Q("suggestionInsertMode",void 0,{type:"string",description:d(1616,null)}),CanResolve:new Q("suggestionCanResolve",!1,d(1614,null))},WW=new D("suggestWidgetStatusBar"),isi=class{constructor(i,e,t,o){this.position=i;this.completion=e;this.container=t;this.provider=o;this.isInvalid=!1;this.score=uv.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 Ie(e.range.startLineNumber,e.range.startColumn),this.editInsertEnd=new Ie(e.range.endLineNumber,e.range.endColumn),this.editReplaceEnd=new Ie(e.range.endLineNumber,e.range.endColumn),this.isInvalid=this.isInvalid||z.spansMultipleLines(e.range)||e.range.startLineNumber!==i.lineNumber):(this.editStart=new Ie(e.range.insert.startLineNumber,e.range.insert.startColumn),this.editInsertEnd=new Ie(e.range.insert.endLineNumber,e.range.insert.endColumn),this.editReplaceEnd=new Ie(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 En(!0);this._resolveCache=Promise.resolve(this.provider.resolveCompletionItem(this.completion,i)).then(o=>{Object.assign(this.completion,o),this._resolveDuration=t.elapsed()},o=>{so(o)&&(this._resolveCache=void 0,this._resolveDuration=void 0)}).finally(()=>{e.dispose()})}return this._resolveCache}};var Jq=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}},N7;function Q8i(){return N7}function Y8i(a){let i=N7;return N7=a,i}var osi=class{constructor(i,e,t,o){this.items=i;this.needsClipboard=e;this.durations=t;this.disposable=o}};async function Sle(a,i,e,t=Jq.default,o={triggerKind:0},n=ve.None){let r=new En;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 P,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=zh.guessNeedsClipboard(k.insertText)),u.push(new isi(e,k,S,b)),w=!0}return Ac(S)&&p.add(S),h.push({providerName:b._debugDisplayName??"unknown_provider",elapsedProvider:S.duration??-1,elapsedOverall:y.elapsed()}),w},v=(async()=>{if(!N7||t.kindFilter.has(28))return;let b=t.providerItemsToReuse.get(N7);if(b){b.forEach(w=>u.push(w));return}if(t.providerFilter.size>0&&!t.providerFilter.has(N7))return;let S=new En,y=await N7.provideCompletionItems(i,e,o,n);f(N7,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 En,k=await y.provideCompletionItems(i,e,o,n);S=f(y,k,w)||S}catch(w){ss(w)}})),S||n.isCancellationRequested)break}return await v,n.isCancellationRequested?(p.dispose(),Promise.reject(new ho)):new osi(u.sort(mVo(t.snippetSortOrder)),g,{entries:h,elapsed:r.elapsed()},p)}function nsi(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 uVo(a,i){if(a.completion.kind!==i.completion.kind){if(a.completion.kind===28)return-1;if(i.completion.kind===28)return 1}return nsi(a,i)}function pVo(a,i){if(a.completion.kind!==i.completion.kind){if(a.completion.kind===28)return 1;if(i.completion.kind===28)return-1}return nsi(a,i)}var Iwt=new Map;Iwt.set(0,uVo);Iwt.set(2,pVo);Iwt.set(1,nsi);function mVo(a){return Iwt.get(a)}qe.registerCommand("_executeCompletionItemProvider",async(a,...i)=>{let[e,t,o,n]=i;So(A.isUri(e)),So(Ie.isIPosition(t)),So(typeof o=="string"||!o),So(typeof n=="number"||!n);let{completionProvider:r}=a.get(zt),s=await a.get(Nt).createModelReference(e);try{let l={incomplete:!1,suggestions:[]},c=[],u=s.object.textEditorModel.validatePosition(t),p=await Sle(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(ve.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 ywt(a,i){a.getContribution("editor.contrib.suggestController")?.triggerSuggest(new Set().add(i),void 0,!0)}var FW=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 ka=class{static{this.inlineSuggestionVisible=new Q("inlineSuggestionVisible",!1,d(1356,null))}static{this.inlineSuggestionAlternativeActionVisible=new Q("inlineSuggestionAlternativeActionVisible",!1,d(1353,null))}static{this.inlineSuggestionHasIndentation=new Q("inlineSuggestionHasIndentation",!1,d(1354,null))}static{this.inlineSuggestionHasIndentationLessThanTabSize=new Q("inlineSuggestionHasIndentationLessThanTabSize",!0,d(1355,null))}static{this.suppressSuggestions=new Q("inlineSuggestionSuppressSuggestions",void 0,d(1357,null))}static{this.cursorBeforeGhostText=new Q("cursorBeforeGhostText",!1,d(1348,null))}static{this.cursorInIndentation=new Q("cursorInIndentation",!1,d(1349,null))}static{this.hasSelection=new Q("editor.hasSelection",!1,d(1350,null))}static{this.cursorAtInlineEdit=new Q("cursorAtInlineEdit",!1,d(1347,null))}static{this.inlineEditVisible=new Q("inlineEditIsVisible",!1,d(1352,null))}static{this.tabShouldJumpToInlineEdit=new Q("tabShouldJumpToInlineEdit",!1,d(1359,null))}static{this.tabShouldAcceptInlineEdit=new Q("tabShouldAcceptInlineEdit",!1,d(1358,null))}static{this.inInlineEditsPreviewEditor=new Q("inInlineEditsPreviewEditor",!0,d(1351,null))}};var wwt=class{constructor(i,e,t){this._selection=i,this._cursors=e,this._selectionId=null,this._trimInRegexesAndStrings=t}getEditOperations(i,e){let t=b4e(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 b4e(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=tv(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++]=An.delete(new z(s,g,s,u))}return t}var S4e=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=Yt.createWithDirection(o,n,r,s,this._selectionDirection)}return t}};function Ax(a,i){let e=0;for(let t=0;t<a.length;t++)a.charAt(t)==="	"?e+=i:e++;return e}function Ile(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 mCe=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 Yt(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=bl(i.getLineContent(c)),v=h+Ax(f,n);p=Ile(v,n,s)+this.trimStart(u)}else{let f=this.createVirtualModel(i,b=>b===o.startLineNumber?c:b),v=use(this._autoIndent,f,i.getLanguageIdAtPosition(c,1),o.startLineNumber,l,this._languageConfigurationService);if(v!==null){let b=bl(i.getLineContent(c)),S=Ax(v,n),y=Ax(b,n);S!==y&&(p=Ile(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=use(this._autoIndent,f,i.getLanguageIdAtPosition(c,1),o.startLineNumber+1,l,this._languageConfigurationService);if(v!==null){let b=bl(i.getLineContent(o.startLineNumber)),S=Ax(v,n),y=Ax(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=use(this._autoIndent,p,i.getLanguageIdAtPosition(o.startLineNumber,1),c,l,this._languageConfigurationService);if(g!==null){let f=bl(i.getLineContent(o.startLineNumber)),v=Ax(g,n),b=Ax(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=>Xv.shiftIndent(o,o.length+1,i,e,t),unshiftIndent:o=>Xv.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=bl(i.getLineContent(o)),c=bl(r),u=nht(i,o,this._languageConfigurationService);u!==null&&u&2&&(c=e.unshiftIndent(c));let p=Ax(c,t),h=Ax(l,t);return p-h}}return null}matchEnterRuleMovingDown(i,e,t,o,n,r){if(tv(r)>=0){let s=i.getLineMaxColumn(n),l=R$(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(tv(u)>=0)break;s--}if(s<1||o>i.getLineCount())return null;let l=i.getLineMaxColumn(s),c=R$(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),tv(u)>=0)break;s--}if(s<1||o>i.getLineCount())return null;let l=i.getLineMaxColumn(s),c=R$(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=bl(l),p=Ax(c,o)+r,h=Ile(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}};mCe=I([m(3,bs)],mCe);var hCe=class{static{this._COLLATOR=Wu.Collator()}constructor(i,e){this.selection=i,this.descending=e,this.selectionId=null}getEditOperations(i,e){let t=hVo(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=J8i(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 J8i(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(hCe._COLLATOR.value.compare),e===!0&&(r=r.reverse()),{startLineNumber:t,endLineNumber:o,before:n,after:r}}function hVo(a,i,e){let t=J8i(a,i,e);return t?An.replace(new z(t.startLineNumber,1,t.endLineNumber,a.getLineMaxColumn(t.endLineNumber)),t.after.join(`
`)):null}var Cwt=class extends xi{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 S4e(r.selection,this.down,r.ignore));e.pushUndoStop(),e.executeCommands(this.id,n),e.pushUndoStop()}},rsi=class extends Cwt{constructor(){super(!1,{id:"editor.action.copyLinesUpAction",label:L(1412,"Copy Line Up"),precondition:ue.writable,kbOpts:{kbExpr:ue.editorTextFocus,primary:1552,linux:{primary:3600},weight:100},menuOpts:{menuId:D.MenubarSelectionMenu,group:"2_line",title:d(1429,null),order:1},canTriggerInlineEdits:!0})}},ssi=class extends Cwt{constructor(){super(!0,{id:"editor.action.copyLinesDownAction",label:L(1411,"Copy Line Down"),precondition:ue.writable,kbOpts:{kbExpr:ue.editorTextFocus,primary:1554,linux:{primary:3602},weight:100},menuOpts:{menuId:D.MenubarSelectionMenu,group:"2_line",title:d(1428,null),order:2},canTriggerInlineEdits:!0})}},asi=class extends xi{constructor(){super({id:"editor.action.duplicateSelection",label:L(1402,"Duplicate Selection"),precondition:ue.writable,menuOpts:{menuId:D.MenubarSelectionMenu,group:"2_line",title:d(1430,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 S4e(s,!0));else{let l=new Yt(s.endLineNumber,s.endColumn,s.endLineNumber,s.endColumn);o.push(new _mt(l,r.getValueInRange(s)))}e.pushUndoStop(),e.executeCommands(this.id,o),e.pushUndoStop()}},xwt=class extends xi{constructor(i,e){super(e),this.down=i}run(i,e){let t=i.get(bs),o=[],n=e.getSelections()||[],r=e.getOption(16);for(let s of n)o.push(new mCe(s,this.down,r,t));e.pushUndoStop(),e.executeCommands(this.id,o),e.pushUndoStop()}},lsi=class extends xwt{constructor(){super(!1,{id:"editor.action.moveLinesUpAction",label:L(1422,"Move Line Up"),precondition:ue.writable,kbOpts:{kbExpr:ue.editorTextFocus,primary:528,linux:{primary:528},weight:100},menuOpts:{menuId:D.MenubarSelectionMenu,group:"2_line",title:d(1432,null),order:3},canTriggerInlineEdits:!0})}},csi=class extends xwt{constructor(){super(!0,{id:"editor.action.moveLinesDownAction",label:L(1421,"Move Line Down"),precondition:ue.writable,kbOpts:{kbExpr:ue.editorTextFocus,primary:530,linux:{primary:530},weight:100},menuOpts:{menuId:D.MenubarSelectionMenu,group:"2_line",title:d(1431,null),order:4},canTriggerInlineEdits:!0})}},kwt=class extends xi{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 Yt(1,1,t.getLineCount(),t.getLineMaxColumn(t.getLineCount()))]);for(let r of o)if(!hCe.canRun(e.getModel(),r,this.descending))return;let n=[];for(let r=0,s=o.length;r<s;r++)n[r]=new hCe(o[r],this.descending);e.pushUndoStop(),e.executeCommands(this.id,n),e.pushUndoStop()}},dsi=class extends kwt{constructor(){super(!1,{id:"editor.action.sortLinesAscending",label:L(1425,"Sort Lines Ascending"),precondition:ue.writable,canTriggerInlineEdits:!0})}},usi=class extends kwt{constructor(){super(!0,{id:"editor.action.sortLinesDescending",label:L(1426,"Sort Lines Descending"),precondition:ue.writable,canTriggerInlineEdits:!0})}},psi=class extends xi{constructor(){super({id:"editor.action.removeDuplicateLines",label:L(1416,"Delete Duplicate Lines"),precondition:ue.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 Yt(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 Yt(c.startLineNumber,1,c.endLineNumber,t.getLineMaxColumn(c.endLineNumber)),g=c.startLineNumber-r,f=new Yt(g,1,g+p.length-1,p[p.length-1].length+1);o.push(An.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()}},msi=class extends xi{constructor(){super({id:"editor.action.reverseLines",label:L(1424,"Reverse lines"),precondition:ue.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 Yt(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=An.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 Yt(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 Yt(y,k,w,T)}};s.push(b(u))}e.pushUndoStop(),e.executeEdits(this.id,r,s),e.pushUndoStop()}},w4e=class a extends xi{static{this.ID="editor.action.trimTrailingWhitespace"}constructor(){super({id:a.ID,label:L(1427,"Trim Trailing Whitespace"),precondition:ue.writable,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,2102),weight:100}})}run(i,e,t){let o=[];t.reason==="auto-save"&&(o=(e.getSelections()||[]).map(u=>new Ie(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 wwt(n,o,l);e.pushUndoStop(),e.executeCommands(this.id,[c]),e.pushUndoStop()}},hsi=class extends xi{constructor(){super({id:"editor.action.deleteLines",label:L(1413,"Delete Line"),precondition:ue.writable,kbOpts:{kbExpr:ue.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(An.replace(new Yt(p,g,h,f),"")),s.push(new Yt(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}},gsi=class extends xi{constructor(){super({id:"editor.action.indentLines",label:L(1417,"Indent Line"),precondition:ue.writable,kbOpts:{kbExpr:ue.editorTextFocus,primary:2142,weight:100},canTriggerInlineEdits:!0})}run(i,e){let t=e._getViewModel();t&&(e.pushUndoStop(),e.executeCommands(this.id,RM.indent(t.cursorConfig,e.getModel(),e.getSelections())),e.pushUndoStop())}},fsi=class extends xi{constructor(){super({id:"editor.action.outdentLines",label:L(1423,"Outdent Line"),precondition:ue.writable,kbOpts:{kbExpr:ue.editorTextFocus,primary:2140,weight:100},canTriggerInlineEdits:!0})}run(i,e){rL.Outdent.runEditorCommand(i,e,null)}},C4e=class a extends xi{static{this.ID="editor.action.insertLineBefore"}constructor(){super({id:a.ID,label:L(1419,"Insert Line Above"),precondition:ue.writable,kbOpts:{kbExpr:ue.editorTextFocus,primary:3075,weight:100},canTriggerInlineEdits:!0})}run(i,e){let t=e._getViewModel();t&&(e.pushUndoStop(),e.executeCommands(this.id,M$.lineInsertBefore(t.cursorConfig,e.getModel(),e.getSelections())))}},yle=class a extends xi{static{this.ID="editor.action.insertLineAfter"}constructor(){super({id:a.ID,label:L(1418,"Insert Line Below"),precondition:ue.writable,kbOpts:{kbExpr:ue.editorTextFocus,primary:2051,weight:100},canTriggerInlineEdits:!0})}run(i,e){let t=e._getViewModel();t&&(e.pushUndoStop(),e.executeCommands(this.id,M$.lineInsertAfter(t.cursorConfig,e.getModel(),e.getSelections())))}},Ewt=class extends xi{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=>An.replace(l,""));e.pushUndoStop(),e.executeEdits(this.id,s,r),e.pushUndoStop()}},vsi=class extends Ewt{constructor(){super({id:"deleteAllLeft",label:L(1414,"Delete All Left"),precondition:ue.writable,kbOpts:{kbExpr:ue.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 Yt(l,r.startColumn,l,r.startColumn)}else s=new Yt(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)}},bsi=class extends Ewt{constructor(){super({id:"deleteAllRight",label:L(1415,"Delete All Right"),precondition:ue.writable,kbOpts:{kbExpr:ue.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 Yt(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}},Ssi=class extends xi{constructor(){super({id:"editor.action.joinLines",label:L(1420,"Join Lines"),precondition:ue.writable,kbOpts:{kbExpr:ue.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 Yt(h.startLineNumber,h.startColumn,g.endLineNumber,g.endColumn):g.startLineNumber>h.endLineNumber?(n.push(h),g):new Yt(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),U=s.getLineFirstNonWhitespaceColumn(O);if(U>=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(U-1);T+=(G?" ":"")+$,G?S=$.length+1:S=$.length}else S=0}let N=new z(v,b,y,w);if(!N.isEmpty()){let O;f.isEmpty()?(l.push(An.replace(N,T)),O=new Yt(N.startLineNumber-p,T.length-S+1,v-p,T.length-S+1)):f.startLineNumber===f.endLineNumber?(l.push(An.replace(N,T)),O=new Yt(f.startLineNumber-p,f.startColumn,f.endLineNumber-p,f.endColumn)):(l.push(An.replace(N,T)),O=new Yt(f.startLineNumber-p,f.startColumn,f.startLineNumber-p,T.length-k)),z.intersectRanges(N,o)!==null?u=O:c.push(O)}p+=N.endLineNumber-N.startLineNumber}c.unshift(u),e.pushUndoStop(),e.executeEdits(this.id,l,c),e.pushUndoStop()}},Isi=class extends xi{constructor(){super({id:"editor.action.transpose",label:L(1410,"Transpose Characters around the Cursor"),precondition:ue.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 Wh(new Yt(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 B6(p,h,new Yt(c.lineNumber,c.column+1,c.lineNumber,c.column+1)))}}e.pushUndoStop(),e.executeCommands(this.id,n),e.pushUndoStop()}},Zq=class extends xi{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(An.replace(u,this._modifyText(p,n)))}else{let l=o.getValueInRange(s);r.push(An.replace(s,this._modifyText(l,n)))}e.pushUndoStop(),e.executeEdits(this.id,r),e.pushUndoStop()}},ysi=class extends Zq{constructor(){super({id:"editor.action.transformToUppercase",label:L(1409,"Transform to Uppercase"),precondition:ue.writable,canTriggerInlineEdits:!0})}_modifyText(i,e){return i.toLocaleUpperCase()}},wsi=class extends Zq{constructor(){super({id:"editor.action.transformToLowercase",label:L(1405,"Transform to Lowercase"),precondition:ue.writable,canTriggerInlineEdits:!0})}_modifyText(i,e){return i.toLocaleLowerCase()}},FL=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}},Twt=class a extends Zq{static{this.titleBoundary=new FL("(^|[^\\p{L}\\p{N}']|((^|\\P{L})'))\\p{L}","gmu")}constructor(){super({id:"editor.action.transformToTitlecase",label:L(1408,"Transform to Title Case"),precondition:ue.writable,canTriggerInlineEdits:!0})}_modifyText(i,e){let t=a.titleBoundary.get();return t?i.toLocaleLowerCase().replace(t,o=>o.toLocaleUpperCase()):i}},I4e=class a extends Zq{static{this.caseBoundary=new FL("(\\p{Ll})(\\p{Lu})","gmu")}static{this.singleLetters=new FL("(\\p{Lu}|\\p{N})(\\p{Lu})(\\p{Ll})","gmu")}constructor(){super({id:"editor.action.transformToSnakecase",label:L(1407,"Transform to Snake Case"),precondition:ue.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()}},y4e=class a extends Zq{static{this.singleLineWordBoundary=new FL("[_\\s-]+","gm")}static{this.multiLineWordBoundary=new FL("[_-]+","gm")}static{this.validWordStart=new FL("^(\\p{Lu}[^\\p{Lu}])","gmu")}constructor(){super({id:"editor.action.transformToCamelcase",label:L(1403,"Transform to Camel Case"),precondition:ue.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("")}},_wt=class a extends Zq{static{this.wordBoundary=new FL("[_ \\t-]","gm")}static{this.wordBoundaryToMaintain=new FL("(?<=\\.)","gm")}static{this.upperCaseWordMatcher=new FL("^\\p{Lu}+$","mu")}constructor(){super({id:"editor.action.transformToPascalcase",label:L(1406,"Transform to Pascal Case"),precondition:ue.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("")}},Dwt=class a extends Zq{static isSupported(){return[this.caseBoundary,this.singleLetters,this.underscoreBoundary].every(e=>e.isSupported())}static{this.caseBoundary=new FL("(\\p{Ll})(\\p{Lu})","gmu")}static{this.singleLetters=new FL("(\\p{Lu}|\\p{N})(\\p{Lu}\\p{Ll})","gmu")}static{this.underscoreBoundary=new FL("(\\S)(_)(\\S)","gm")}constructor(){super({id:"editor.action.transformToKebabcase",label:L(1404,"Transform to Kebab Case"),precondition:ue.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()}};Jt(rsi);Jt(ssi);Jt(asi);Jt(lsi);Jt(csi);Jt(dsi);Jt(usi);Jt(psi);Jt(w4e);Jt(hsi);Jt(gsi);Jt(fsi);Jt(C4e);Jt(yle);Jt(vsi);Jt(bsi);Jt(Ssi);Jt(Isi);Jt(ysi);Jt(wsi);Jt(msi);I4e.caseBoundary.isSupported()&&I4e.singleLetters.isSupported()&&Jt(I4e);y4e.singleLineWordBoundary.isSupported()&&y4e.multiLineWordBoundary.isSupported()&&Jt(y4e);_wt.wordBoundary.isSupported()&&Jt(_wt);Twt.titleBoundary.isSupported()&&Jt(Twt);Dwt.isSupported()&&Jt(Dwt);var O7=ae("dataChannelService");function Z8i(a){return a.sourceId+" @@ "+JSON.stringify({...a,modelUri:a.modelUri?.toString(),sourceId:void 0})}var F7=class extends C{constructor(e,t,o){super();this._key=e;this._contextKeyService=t;this._dataChannelService=o;this._isEnabledContextKeyValue=gVo("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}};F7=I([m(1,X),m(2,O7)],F7);function gVo(a,i){return ui(i.onDidChangeContext,()=>i.getContextKeyValue(a))}var gCe=class extends C{constructor(e,t,o){super();this._editor=e;this._instantiationService=t;this._loggerService=o;this._structuredLogger=this._register(this._instantiationService.createInstance(F7.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(he(s=>{eSe(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(he(s=>{this._editor instanceof jr&&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)}))}))}};gCe=I([m(1,F),m(2,ol)],gCe);var eQi=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}),x4e=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}}},k4e=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=bl(n,0,this._selection.startColumn-1),s=r;i.snippet.walk(c=>c===i?!1:(c instanceof Qb&&(s=bl(mc(c.value).pop())),!0));let l=Ng(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)}}}},E4e=class{constructor(i,e){this._labelService=i;this._model=e}resolve(i){let{name:e}=i;if(e==="TM_FILENAME")return No(this._model.uri.fsPath);if(e==="TM_FILENAME_BASE"){let t=No(this._model.uri.fsPath),o=t.lastIndexOf(".");return o<=0?t:t.slice(0,o)}else{if(e==="TM_DIRECTORY")return wc(this._model.uri.fsPath)==="."?"":this._labelService.getUriLabel(ci(this._model.uri));if(e==="TM_DIRECTORY_BASE")return wc(this._model.uri.fsPath)==="."?"":No(wc(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})}}},T4e=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=>!Jl(o));if(t.length===this._selectionCount)return t[this._selectionIdx]}return e}}},wle=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}}};wle=I([m(2,bs)],wle);var _4e=class a{constructor(){this._date=new Date}static{this.dayNames=[d(1594,null),d(1584,null),d(1598,null),d(1600,null),d(1596,null),d(1572,null),d(1590,null)]}static{this.dayNamesShort=[d(1595,null),d(1585,null),d(1599,null),d(1601,null),d(1597,null),d(1573,null),d(1591,null)]}static{this.monthNames=[d(1574,null),d(1570,null),d(1580,null),d(1564,null),d(1582,null),d(1578,null),d(1576,null),d(1566,null),d(1592,null),d(1588,null),d(1586,null),d(1568,null)]}static{this.monthNamesShort=[d(1575,null),d(1571,null),d(1581,null),d(1565,null),d(1583,null),d(1579,null),d(1577,null),d(1567,null),d(1593,null),d(1589,null),d(1587,null),d(1569,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}}},D4e=class{constructor(i){this._workspaceService=i}resolve(i){if(!this._workspaceService)return;let e=VS(this._workspaceService.getWorkspace());if(!Eq(e)){if(i.name==="WORKSPACE_NAME")return this._resolveWorkspaceName(e);if(i.name==="WORKSPACE_FOLDER")return this._resoveWorkspacePath(e)}}_resolveWorkspaceName(i){if($g(i))return No(i.uri.path);let e=No(i.configPath.path);return e.endsWith(JN)&&(e=e.substr(0,e.length-JN.length-1)),e}_resoveWorkspacePath(i){if($g(i))return Hp(i.uri.fsPath);let e=No(i.configPath.path),t=i.configPath.fsPath;return t.endsWith(e)&&(t=t.substr(0,t.length-e.length-1)),t?Hp(t):"/"}},L4e=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 _t()}};var Lwt=class a{constructor(i,e,t){this._editor=i;this._snippet=e;this._snippetLineLeadingWhitespace=t;this._offset=-1;this._nestingLevel=1;this._placeholderGroups=Pg(e.placeholders,Tx.compareByIndex),this._placeholderGroupsIdx=-1}static{this._decor={active:po.register({description:"snippet-placeholder-1",stickiness:0,className:"snippet-placeholder"}),inactive:po.register({description:"snippet-placeholder-2",stickiness:1,className:"snippet-placeholder"}),activeFinal:po.register({description:"snippet-placeholder-3",stickiness:1,className:"finish-snippet-placeholder"}),inactiveFinal:po.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(An.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 Yt(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 Tx){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 Fae,!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=Pg(this._snippet.placeholders,Tx.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}},tQi={overwriteBefore:0,overwriteAfter:0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0},aC=class{constructor(i,e,t=tQi,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=bl(r,0,e.column-1),l;return o.walk(c=>{if(!(c instanceof Qb)||c.parent instanceof Fae||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 Qb(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=Yt.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 E4e(k.get(ot),h)),v=()=>s,b=h.getValueInRange(aC.adjustSelection(h,i.getSelection(),t,0)),S=h.getValueInRange(aC.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 N=aC.adjustSelection(h,k,t,0),O=aC.adjustSelection(h,k,0,o);b!==h.getValueInRange(N)&&(N=k),S!==h.getValueInRange(O)&&(O=k);let V=k.setStartPosition(N.startLineNumber,N.startColumn).setEndPosition(O.endLineNumber,O.endColumn),U=new zh().parse(e,!0,n),G=V.getStartPosition(),$=aC.adjustWhitespace(h,G,r||T>0&&y!==h.getLineFirstNonWhitespaceColumn(k.positionLineNumber),U);U.resolveVariables(new x4e([f,new T4e(v,T,w.length,i.getOption(88)==="spread"),new k4e(h,k,T,l),new wle(h,k,c),new _4e,new D4e(g),new L4e])),u[T]=An.replace(V,U.toString()),u[T].identifier={major:T,minor:0},u[T]._isTracked=!0,p[T]=new Lwt(i,U,$)}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 zh,p=new gwe,h=new x4e([i.invokeWithinContext(f=>new E4e(f.get(ot),c)),new T4e(()=>n,0,i.getSelections().length,i.getOption(88)==="spread"),new k4e(c,i.getSelection(),0,r),new wle(c,i.getSelection(),s),new _4e,new D4e(i.invokeWithinContext(f=>f.get(Pe))),new L4e]);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 N=e[f-1].range,O=z.fromPositions(N.getEndPosition(),v.getStartPosition()),V=new Qb(c.getValueInRange(O));p.appendChild(V),g+=V.value.length}let y=u.parseFragment(b,p);aC.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=An.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 Lwt(i,p,"")]}}dispose(){Ue(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"?aC.createEditsAndSnippetsFromSelections(this._editor,this._template,this._options.overwriteBefore,this._options.overwriteAfter,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService):aC.createEditsAndSnippetsFromEdits(this._editor,this._template,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService);this._snippets=t,this._editor.executeEdits(i??_c.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=>Yt.fromPositions(r.range.getEndPosition()))}),this._editor.revealRange(this._editor.getSelections()[0])}merge(i,e=tQi){if(!this._editor.hasModel())return;this._templateMerges.push([this._snippets[0]._nestingLevel,this._snippets[0]._placeholderGroupsIdx,i]);let{edits:t,snippets:o}=aC.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=>Yt.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}};aC=I([m(3,bs)],aC);var Rwt={overwriteBefore:0,overwriteAfter:0,undoStopBefore:!0,undoStopAfter:!0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0},Qr=class{constructor(i,e,t,o,n){this._editor=i;this._logService=e;this._languageFeaturesService=t;this._languageConfigurationService=n;this._inSnippetObservable=Le(this,!1);this._snippetListener=new P;this._modelVersionId=-1;this._inSnippet=Qr.InSnippetMode.bindTo(o),this._hasNextTabstop=Qr.HasNextTabstop.bindTo(o),this._hasPrevTabstop=Qr.HasPrevTabstop.bindTo(o)}static{this.ID="snippetController2"}static get(i){return i.getContribution(Qr.ID)}static{this.InSnippetMode=new Q("inSnippetMode",!1,d(1562,null))}static{this.HasNextTabstop=new Q("hasNextTabstop",!1,d(1560,null))}static{this.HasPrevTabstop=new Q("hasPrevTabstop",!1,d(1561,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"?Rwt:{...Rwt,...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"?Rwt:{...Rwt,...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?(So(typeof i=="string"),this._session.merge(i,e)):(this._modelVersionId=this._editor.getModel().getAlternativeVersionId(),this._session=new aC(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()||!Ie.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(1563,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(()=>{ywt(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()}};Qr=I([m(1,ne),m(2,zt),m(3,X),m(4,bs)],Qr);go(Qr.ID,Qr,4);var Mwt=xc.bindToContribution(Qr.get);qi(new Mwt({id:"jumpToNextSnippetPlaceholder",precondition:x.and(Qr.InSnippetMode,Qr.HasNextTabstop),handler:a=>a.next(),kbOpts:{weight:130,kbExpr:ue.textInputFocus,primary:2}}));qi(new Mwt({id:"jumpToPrevSnippetPlaceholder",precondition:x.and(Qr.InSnippetMode,Qr.HasPrevTabstop),handler:a=>a.prev(),kbOpts:{weight:130,kbExpr:ue.textInputFocus,primary:1026}}));qi(new Mwt({id:"leaveSnippet",precondition:Qr.InSnippetMode,handler:a=>a.cancel(!0),kbOpts:{weight:130,kbExpr:ue.textInputFocus,primary:9,secondary:[1033]}}));qi(new Mwt({id:"acceptSnippet",precondition:Qr.InSnippetMode,handler:a=>a.finish()}));function Cle(a){return new Csi(a)}var Csi=class extends RSe{constructor(e){super();this._textModel=e}getOffset(e){return this._textModel.getOffsetAt(e)}getPosition(e){return this._textModel.getPositionAt(e)}};var fVo=[];function iQi(){return fVo}function xsi(a){return vVo(a).map(e=>e.getEndPosition())}function vVo(a){let i=Aut.createSortPermutation(a,tl(o=>o.range,z.compareRangesUsingStarts)),t=new bp(i.apply(a)).getNewRanges();return i.inverse().apply(t)}function oQi(a,i){let e=Cle(i),t=i.getValue();return a.map(r=>e.getStringReplacement(r)).map(r=>r.removeCommonSuffixPrefix(t)).map(r=>e.getTextReplacement(r))}function nQi(a,i){let e=Le("result",[]),t=[];return i.add(he(o=>{let n=a.read(o);Ui(r=>{if(n.length!==t.length){t.length=n.length;for(let s=0;s<t.length;s++)t[s]||(t[s]=Le("item",n[s]));e.set([...t],r)}t.forEach((s,l)=>s.set(n[l],r))})})),e}var Pwt=class{constructor(i){this._contextKeyService=i}bind(i,e){return tc(i,this._contextKeyService,e instanceof Function?e:t=>e.read(t))}};function ksi(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 R4e=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 M4e=class a{constructor(i,e,t,o=bVo){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 bVo(a,i,e,t){return a===t?i+e:e*(-Math.pow(2,-10*a/t)+1)+i}function rQi(a,i,e,t){return e*((a=a/t-1)*a*a+1)+i}var Awt=class a{static const(i){return new a(M4e.const(i))}constructor(i){this._value=Le(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()||P4e.instance.invalidateOnNextAnimationFrame(i),e.getValue()}},P4e=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 $1=class{constructor(i,e){this.lineNumber=i;this.parts=e;eh(()=>Ty(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 bp([...this.parts.map(t=>new Xr(z.fromPositions(new Ie(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 bp([...this.parts.map(n=>new Xr(z.fromPositions(new Ie(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)}},W7=class{constructor(i,e,t,o=[]){this.column=i;this.text=e;this.preview=t;this._inlineDecorations=o;this.lines=mc(this.text).map((n,r)=>({line:n,lineDecorations:Jv.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&&Jv.equalsArr(e.lineDecorations,i.lines[t].lineDecorations))}},fCe=class{constructor(i,e,t,o=0){this.lineNumber=i;this.columnRange=e;this.text=t;this.additionalReservedLineCount=o;this.parts=[new W7(this.columnRange.endColumnExclusive,this.text,!1)],this.newLines=mc(this.text)}renderForScreenReader(i){return this.newLines.join(`
`)}render(i,e=!1){let t=this.columnRange.toRange(this.lineNumber);return e?new bp([new Xr(z.fromPositions(t.getStartPosition()),"("),new Xr(z.fromPositions(t.getEndPosition()),`)[${this.newLines.join(`
`)}]`)]).applyToString(i):new bp([new Xr(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 Esi(a,i){return $i(a,i,Tsi)}function Tsi(a,i){return a===i?!0:!a||!i?!1:a instanceof $1&&i instanceof $1||a instanceof fCe&&i instanceof fCe?a.equals(i):!1}function XM(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=Ng(n,o),s=Zl.ofText(n.substring(0,r)).addToPosition(a.range.getStartPosition()),l=o.substring(r),c=z.fromPositions(s,a.range.getEndPosition());return new Xr(c,l)}function Nwt(a,i){return a.text.startsWith(i.text)&&SVo(a.range,i.range)}function SVo(a,i){return i.getStartPosition().equals(a.getStartPosition())&&i.getEndPosition().isBeforeOrEqual(a.getEndPosition())}function _si(a,i,e,t,o=0){let n=XM(a,i);if(n.range.endLineNumber!==n.range.startLineNumber)return;let r=i.getLineContent(n.range.startLineNumber),s=bl(r).length;if(n.range.startColumn-1<=s){let f=bl(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 Xr(w,k)}let c=i.getValueInRange(n.range),u=IVo(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 W7(v,y,!1)),w.length>0&&h.push(new W7(v,w,!0))}return new $1(p,h)}var Owt;function IVo(a,i){if(Owt?.originalValue===a&&Owt?.newValue===i)return Owt?.changes;{let e=aQi(a,i,!0);if(e){let t=sQi(e);if(t>0){let o=aQi(a,i,!1);o&&sQi(o)<t&&(e=o)}}return Owt={originalValue:a,newValue:i,changes:e},e}}function sQi(a){let i=0;for(let e of a)i+=e.originalLength;return i}function aQi(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 MM({getElements:()=>s},{getElements:()=>l}).ComputeDiff(!1).changes}function lQi(a,i){let e,t=!1,o=new Bbe(new Pu(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??hf,(n,r,s)=>{if(!t)throw new ni("Can only set when there is a listener! This is to prevent leaks.");dN(r,l=>{e=n,o.setValue(n,l,s)})},Il.ofCaller());return o}var Dsi=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)}},vO=class extends Dsi{constructor(i,e){super(i,(t,o)=>{let n=!0;o&&Lsi in o&&(n=!!o[Lsi]),n&&e.getDataChannel("editTelemetry").sendData({eventName:t,data:o??{}})})}};vO=I([m(0,Te),m(1,O7)],vO);var Lsi=Symbol("shouldForwardToChannel");function q1(a){return{[Lsi]:a}}function VW(a){if(!a)return!1;let i=a.toLowerCase();return i==="github.copilot"||i==="github.copilot-chat"}function Fwt(a,i){a.publicLog2("inlineCompletion.endOfLife",i)}var yVo=new Set([";",",","=","+","-","*","/","{","}","(",")","[","]","<",">",":",".","!","?","&","|","^","%","@","#","~","`","\\","'",'"',"$"]);function wVo(a){return yVo.has(a)}function CVo(a){return/[a-zA-Z0-9_]/.test(a)}function xVo(a){return a===" "||a==="	"}function Wwt(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&&(wVo(a)?t="syntactical":CVo(a)?t="identifier":xVo(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 Msi=class{constructor(i){this.edits=i}toString(){return JSON.stringify({edits:this.edits})}};function Psi(a,i,e){if(a.replacements.length!==0)return new Msi(a.replacements.map(t=>kVo(t,i,e)))}function Rsi(a){return a.length===0?0:a.split(/\r\n|\r|\n/).length-1}function kVo(a,i,e){let t=a.replaceRange,o=a.newText,n=t.length,r=o.length,s=Rsi(o);switch(t.isEmpty?"insert":o.length===0?"delete":"replace"){case"insert":return{operation:"insert",properties:EVo(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:TVo(t.start,t.endExclusive,i),charactersInserted:0,charactersDeleted:n,linesInserted:0,linesDeleted:Rsi(c)}}case"replace":{let c=i.getValue().substring(t.start,t.endExclusive);return{operation:"replace",properties:_Vo(c,o),charactersInserted:r,charactersDeleted:n,linesInserted:s,linesDeleted:Rsi(c)}}}}function EVo(a,i,e,t){let o=Wwt(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 TVo(a,i,e){let t=e.getValue().substring(a,i),o=Wwt(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 _Vo(a,i){let e=Wwt(a),t=Wwt(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 Vwt(a,i,e,t){let o=XM(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)&&!!Xqe(h,u)}function cQi(a,i){let e=new cye,t=new uye(e,c=>i.getLanguageConfiguration(c)),o=new dye(new Asi([a]),t),n=kqe(o,[],void 0,!0),r="",s=a.getLineContent();function l(c,u){if(c.kind===2)if(l(c.openingBracket,u),u=Od(u,c.openingBracket.length),c.child&&(l(c.child,u),u=Od(u,c.child.length)),c.closingBracket)l(c.closingBracket,u),u=Od(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,Od(u,c.length));else if(c.kind===4)for(let p of c.children)l(p,u),u=Od(u,p.length)}}return l(n,ib),r}var Asi=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 Bwt=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 WL=class a{constructor(i,e=!1){this.event=i;this.alternativeAction=e}static create(i,e=!1){return new a(new yn(Me(i),i),e)}};var xle=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 pQi(a,i,e,t,o,n){let r=zgt("icr"),s=new $e,l,c={...t,requestUuid:r},u=LVo(i,e),p=tUi(a,S=>S.groupId),h=Bwt.from(a,S=>S.yieldsToGroupIds?.flatMap(y=>p.get(y)??[])??[]),{foundCycles:g}=h.removeCycles();g.length>0&&ss(new Error(`Inline completions: cyclic yield-to dependency detected. Path: ${g.map(S=>S.toString?S.toString():""+S).join(" -> ")}`));let f=0,v=new kI(async S=>{try{if(f++,s.token.isCancellationRequested)return;let y=h.getOutgoing(S);for(let V of y){let U=await v.get(V);if(U)for(let G of U.inlineSuggestions.items){if(G.isInlineEdit||typeof G.insertText!="string"&&G.insertText!==void 0)return;if(G.insertText!==void 0){let $=new Xr(z.lift(G.range)??u,G.insertText);if(Vwt($,void 0,e,i))return}}}let w,k=Date.now();try{w=await S.provideInlineCompletions(e,i,c,s.token)}catch(V){ss(V);return}let T=Date.now();if(!w)return;let N=[],O=new Hwt(w,N,S);if(O.addRef(),Osi(s.token,()=>O.removeRef(l)),s.token.isCancellationRequested)return;for(let V of w.items){let U=DVo(V,O,u,e,n,c,o,{startTime:k,endTime:T});if(R4e.is(U)){U.logError();continue}N.push(U)}return O}finally{f--}}),b=Fp.fromPromisesResolveOrder(a.map(S=>v.get(S))).filter(mo);return{contextWithUuid:c,get didAllProvidersReturn(){return f===0},lists:b,cancelAndDispose:S=>{l===void 0&&(l=S,s.dispose(!0))}}}function Osi(a,i){if(a.isCancellationRequested)return i(),C.None;{let e=a.onCancellationRequested(()=>{e.dispose(),i()});return{dispose:()=>e.dispose()}}}function DVo(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:Ie.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=dQi(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=dQi(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 zh().parse(a.insertText.snippet);f.children.length===1&&f.children[0]instanceof Qb?(u=f.children[0].value,p=void 0):(u=f.toString(),p={snippet:a.insertText.snippet,range:h})}else Hr(a.insertText);l={kind:"edit",range:h,insertText:u,snippetInfo:p,uri:c,alternativeAction:void 0}}else if(l=void 0,!a.hint)return R4e.message("Inline completion has no insertText, jumpToPosition nor hint.");return new A4e(l,a.hint,a.additionalTextEdits||iQi(),a,i,n,a.isInlineEdit??!1,a.supportsRename??!1,r,s,a.correlationId)}var A4e=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 Nsi;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 Hwt({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 zy(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 ni("Rename info has already been set.");this._renameInfo=i}withAction(i){return this._action=i,this}addPerformanceMarker(i){this.performance.mark(i)}},Nsi=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 Hwt=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 LVo(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 dQi(a,i,e,t){let o=e.getLineContent(i.lineNumber),n=Hc.replace(new di(i.column-1,o.length),a),s=e.tokenization.tokenizeLinesAt(i.lineNumber,[n.replace(o)])?.[0].sliceZeroCopy(n.getRangeAfterReplace());return s?cQi(s,t):a}var Fsi;(i=>{function a(e){return e?.command.id??void 0}i.toString=a})(Fsi||={});var j1=class a extends Q6{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 Zl(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 N4e;(i=>{function a(e,t,o=!0){return!e.isInlineEdit&&!e.action?.uri&&e.action?.kind==="edit"?Wsi.create(e,t,e.action):Vsi.create(e,t,o)}i.create=a})(N4e||={});function RVo(a){let i=a?.kind==="edit"?{...a,alternativeAction:Fsi.toString(a.alternativeAction),target:a?.target.uri.toString()}:{...a,target:a?.target.uri.toString()};return JSON.stringify(i)}var zwt=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 ni("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 RVo(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)}},Kwt=class a{constructor(){this._onDispose=Wc(this);this.onDispose=this._onDispose;this._jumpedTo=Le(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)}},Gwt=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 di(e.getOffset(this.range.getStartPosition()),e.getOffset(this.range.getEndPosition())),o=wXt([t],i)[0];if(!o)return;let n=e.getRange(o);return new a(n,this.content,this.style)}},Wsi=class a extends zwt{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 Kwt,r=t.getTransformer(),s=o.insertText.replace(/\r\n|\r|\n/g,t.getEOL()),l=AVo(new Hc(r.getOffsetRange(o.range),s),t),c=l.removeCommonSuffixAndPrefix(t.getValue()),u=r.getTextReplacement(l),p=e.hint?Gwt.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 Qc([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=wXt([this._edit.replaceRange],e);if(o.length===0)return;let n=new Hc(o[0],this._textEdit.text),r=Cle(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)&&Zl.ofRange(o).isGreaterThanOrEqualTo(Zl.ofRange(this._originalRange))}isVisible(e,t){let o=this.getSingleTextEdit();return Vwt(o,this._originalRange,e,t)}computeEditKind(e){return Psi(new Qc([this._edit]),e)}get editRange(){return this.getSingleTextEdit().range}get insertText(){return this.getSingleTextEdit().text}},Vsi=class a extends zwt{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(A4e.createForTest(n,e.uri),e)}static create(e,t,o=!0){let n,r=[];if(e.action?.kind==="edit"){let c=o?MVo(t,e.action.range,e.action.insertText):PVo(t,e.action.range,e.action.insertText),u=bp.fromStringEdit(c,t),p=c.isEmpty()?new Xr(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 Bsi.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 ni("InlineEditItem: action is undefined and no hint is provided");let s=new Kwt,l=e.hint?Gwt.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=Cle(o),r=!1,s=this._inlineEditModelVersion,l,c=j1.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 Qc(t.map(f=>f.edit));l={kind:"edit",textReplacement:n.getTextEdit(h).toReplacement(new _L(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 Psi(t,e)}};function MVo(a,i,e){let t=a.getEOL(),o=a.getValueOfRange(i),n=e.replace(/\r\n|\r|\n/g,t),l=_U.getDefault().computeDiff(mc(o),mc(n),{ignoreTrimWhitespace:!1,computeMoves:!1,extendToSubwords:!0,maxComputationTimeMs:50}).changes.flatMap(h=>h.innerChanges??[]);function c(h,g){let f=Zl.fromPosition(g.getStartPosition());return Zl.ofRange(g).createRange(f.addToPosition(h))}let u=new _S(n);return new Qc(l.map(h=>{let g=c(i.getStartPosition(),h.originalRange),f=a.getTransformer().getOffsetRange(g),v=u.getValueOfRange(h.modifiedRange),b=new Hc(f,v),S=a.getValueOfRange(g);return NVo(b,S,l.length,a)}))}function PVo(a,i,e){return new Qc([new Hc(a.getTransformer().getOffsetRange(i),e)])}var Bsi=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=Ng(i.newText,e),o=zw(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 ni("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 Hc(new di(t+this._prefixLength,t+this._prefixLength),""),editHasChanged:!0}:{edit:new Hc(new di(t,o),n),editHasChanged:r}}};function AVo(a,i){let e=i.getEOL();return a.replaceRange.isEmpty&&a.newText.includes(e)&&(a=mQi(a,i)),a}function NVo(a,i,e,t){let o=t.getEOL();if(a.newText.endsWith(o)&&i.endsWith(o)&&(a=new Hc(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=mQi(a,t))}if(e===1){let n=Ng(i,a.newText),r=zw(i.slice(n),a.newText.slice(n));if(n+r===i.length)return new Hc(a.replaceRange.deltaStart(n).deltaEnd(-r),a.newText.substring(n,a.newText.length-r));if(n+r===a.newText.length)return new Hc(a.replaceRange.deltaStart(n).deltaEnd(-r),"")}return a}function mQi(a,i){if(!a.replaceRange.isEmpty)throw new ni("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 Hc(a.replaceRange.delta(-1),e+a.newText.slice(0,-e.length)):a}var FVo=!1,kle=new Q("renameInputVisible",!1,d(1554,null)),Qhs=new Q("renameInputFocused",!1,d(1553,null)),vCe=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 P;this._visibleContextKey=kle.bindTo(n),this._isEditingRenameCandidate=!1,this._nRenameSuggestionsInvocations=0,this._hadAutomaticRenameSuggestionsInvocation=!1,this._candidates=new Set,this._beforeFirstInputFieldEditSW=new En,this._inputWithButton=new Usi,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 Hsi(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(RN),t=i.getColor(jT);this._domNode.style.backgroundColor=String(i.getColor(gm)??""),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(pL)??"");let o=i.getColor(Vy);this._inputWithButton.domNode.style.backgroundColor=String(i.getColor(Gb)??""),this._inputWithButton.input.style.backgroundColor=String(i.getColor(Gb)??""),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;So(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=Fm(this.getDomNode().ownerDocument.body),e=Yn(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}=O4e.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(1551,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;So(this._renameCandidateListView),So(this._nPxAvailableAbove!==void 0),So(this._nPxAvailableBelow!==void 0);let e=nh(this._inputWithButton.domNode),t=nh(this._label),o;i===2?o=this._nPxAvailableBelow:o=this._nPxAvailableAbove,this._renameCandidateListView.layout({height:o-t-e,width:yl(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 P;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 Ii(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 Ie(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 Go;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"),So(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"))),FVo||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),So(this._renameCts),this._inputWithButton.buttonState!=="stop")){this._renameCandidateProvidersCts=new $e;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){So(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 wa(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"&&mo(c.value)?c.value:[]);o(`received updateRenameCandidates results - total (unfiltered) ${r.length} candidates.`);let s=Uo(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)}};vCe=I([m(2,De),m(3,_e),m(4,X),m(5,ne)],vCe);var Hsi=class a{constructor(i,e){this._disposables=new P,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(GI({listInactiveFocusForeground:WU,listInactiveFocusBackground:VU}))}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`,Or(d(1555,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}=O4e.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 O4e(r,t)}renderElement(r,s,l){l.populate(r)}disposeTemplate(r){r.dispose()}};return new hc("NewSymbolNameCandidates",i,o,[n],{keyboardSupport:!1,mouseSupport:!0,multipleSelectionSupport:!1})}},Usi=class{constructor(){this._buttonHoverContent="";this._disposables=new P;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(1552,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(1550,null),this._buttonCancelHoverText=d(1549,null),this._buttonHoverContent=this._buttonGenHoverText,this._disposables.add(yp().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 Ii(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 So(this._inputNode),this._inputNode}get button(){return So(this._buttonNode),this._buttonNode}get buttonState(){return this._buttonState}setSparkleButton(){this._buttonState="sparkle",this._sparkleIcon??=Qo(M.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??=Qo(M.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()}},O4e=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=Qo(M.sparkle),this._icon.style.display="none",t.appendChild(this._icon),this._label=document.createElement("div"),Pd(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 bCe=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(1543,null)),o);return r}};function hQi(a,i){return a.ordered(i).length>0}async function gQi(a,i,e,t,o){return new bCe(i,e,a).provideRenameEdits(t,o??ve.None)}async function Ksi(a,i,e,t){let o=new bCe(i,e,a),n=await o.resolveRenameLocation(ve.None);return n?.rejectReason?{edits:[],rejectReason:n.rejectReason}:o.provideRenameEdits(t,ve.None)}var bO=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 P;this._cts=new $e;this._renameWidget=this._disposableStore.add(this._instaService.createInstance(vCe,this.editor,["acceptRenameInput","acceptRenameInputWithPreview"]))}static{this.ID="editor.contrib.renameController"}static get(i){return i.getContribution(bO.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 $e,!this.editor.hasModel()){i("editor has no model");return}let e=this.editor.getPosition(),t=new bCe(this.editor.getModel(),e,this._languageFeaturesService.renameProvider);if(!t.hasProvider()){i("skeleton has no provider");return}let o=new Ex(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 ho?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"||Mr(f))&&iu.get(this.editor)?.showMessage(f||d(1548,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),iu.get(this.editor)?.showMessage(n.rejectReason,e);return}if(o.token.isCancellationRequested){i("returning early - cts1 cancelled");return}let r=new Ex(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=wa(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(1542,null,n?.text,h.newName),code:"undoredo.rename",quotableLabel:d(1544,null,n?.text,h.newName),respectAutoSaveConfig:!0,reason:_c.rename(n?.text,h.newName)}).then(v=>{i("edits applied"),v.ariaSummary&&Jo(d(1538,null,n.text,h.newName,v.ariaSummary))}).catch(v=>{i(`error when applying edits ${JSON.stringify(v,null,"	")}`),this._notificationService.error(d(1546,null)),this._logService.error(v)})},f=>{i("error when providing rename edits",JSON.stringify(f,null,"	")),this._notificationService.error(d(1545,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()}};bO=I([m(1,F),m(2,Ne),m(3,ma),m(4,rd),m(5,ne),m(6,Nn),m(7,zt)],bO);var zsi=class extends xi{constructor(){super({id:"editor.action.rename",label:L(1547,"Rename Symbol"),precondition:x.and(ue.writable,ue.hasRenameProvider),kbOpts:{kbExpr:ue.editorTextFocus,primary:60,weight:100},contextMenuOpts:{group:"1_modification",order:1.1},canTriggerInlineEdits:!0})}runCommand(i,e){let t=i.get(Kt),[o,n]=Array.isArray(e)&&e||[void 0,void 0];return A.isUri(o)&&Ie.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(ne),o=bO.get(e);return o?(t.trace("[RenameAction] got controller, running..."),o.run()):(t.trace("[RenameAction] returning early - controller missing"),Promise.resolve())}};go(bO.ID,bO,4);Jt(zsi);var Gsi=xc.bindToContribution(bO.get);qi(new Gsi({id:"acceptRenameInput",precondition:kle,handler:a=>a.acceptRenameInput(!1),kbOpts:{weight:199,kbExpr:x.and(ue.focus,x.not("isComposing")),primary:3}}));qi(new Gsi({id:"acceptRenameInputWithPreview",precondition:x.and(kle,x.has("config.editor.rename.enablePreview")),handler:a=>a.acceptRenameInput(!0),kbOpts:{weight:199,kbExpr:x.and(ue.focus,x.not("isComposing")),primary:2051}}));qi(new Gsi({id:"cancelRenameInput",precondition:kle,handler:a=>a.cancelRenameInput(),kbOpts:{weight:199,kbExpr:ue.focus,primary:9,secondary:[1033]}}));W(class extends K{constructor(){super({id:"focusNextRenameSuggestion",title:{...L(1540,"Focus Next Rename Suggestion")},precondition:kle,keybinding:[{primary:18,weight:199}]})}run(i){let e=i.get(Kt).getFocusedCodeEditor();if(!e)return;let t=bO.get(e);t&&t.focusNextRenameSuggestion()}});W(class extends K{constructor(){super({id:"focusPreviousRenameSuggestion",title:{...L(1541,"Focus Previous Rename Suggestion")},precondition:kle,keybinding:[{primary:16,weight:199}]})}run(i){let e=i.get(Kt).getFocusedCodeEditor();if(!e)return;let t=bO.get(e);t&&t.focusPreviousRenameSuggestion()}});kS("_executeDocumentRenameProvider",function(a,i,e,...t){let[o]=t;So(typeof o=="string");let{renameProvider:n}=a.get(zt);return Ksi(n,i,e,o)});kS("_executePrepareRename",async function(a,i,e){let{renameProvider:t}=a.get(zt),n=await new bCe(i,e,t).resolveRenameLocation(ve.None);if(n?.rejectReason)throw new Error(n.rejectReason);return n});oe.as(ii.Configuration).registerConfiguration({id:"editor",properties:{"editor.rename.enablePreview":{scope:6,description:d(1539,null),default:!0,type:"boolean"}}});var $wt=ae("renameSymbolTrackerService");var qwt=(t=>(t.no="no",t.yes="yes",t.maybe="maybe",t))(qwt||{});(i=>{function a(e){switch(e){case"no":return"no";case"yes":return"yes";case"maybe":return"maybe";default:return"no"}}i.fromString=a})(qwt||={});var $si=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 MM(new bse(l),new bse(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],N=k.originalStart-(T.originalStart+T.originalLength);if(N>0){let O=v+T.originalStart+T.originalLength,V=i.getPositionAt(O),U=i.getWordAtPosition(V);if(U){let G=i.getOffsetAt(new Ie(V.lineNumber,U.startColumn)),$=i.getOffsetAt(new Ie(V.lineNumber,U.endColumn)),te=O+N;if(G<=O&&te<=$&&G<=te&&te<=$){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),N=c.substring(k.modifiedStart,k.modifiedStart+k.modifiedLength),O=v+k.originalStart,V=i.getPositionAt(O),U=O+k.originalLength,G=i.getPositionAt(U),$=z.fromPositions(V,G),te=N.length-k.originalLength;if(/\s/.test(T)){u.push(new Xr($,N)),y+=te;continue}if(T.length>0){o.lastIndex=0;let ke=o.exec(T);if(ke===null||ke.index!==0||ke[0].length!==T.length){u.push(new Xr($,N)),y+=te;continue}}if(/\s/.test(N)){u.push(new Xr($,N)),y+=te;continue}if(N.length>0){o.lastIndex=0;let ke=o.exec(N);if(ke===null||ke.index!==0||ke[0].length!==N.length){u.push(new Xr($,N)),y+=te;continue}}let pe=i.getWordAtPosition(V);if(pe===null){u.push(new Xr($,N)),y+=te;continue}let de=k.originalStart+1,se=k.originalLength===0&&k.modifiedLength>0,Se;if(se&&de===pe.endColumn&&pe.endColumn>pe.startColumn?Se=this.getTokenAtPosition(i,new Ie(V.lineNumber,pe.startColumn)):Se=this.getTokenAtPosition(i,V),pe.startColumn!==Se.range.startColumn||pe.endColumn!==Se.range.endColumn){u.push(new Xr($,N)),y+=te;continue}if(Se.type===0){let ke=i.getValueInRange(Se.range);if(ke.length===0){u.push(new Xr($,N)),y+=te;continue}if(h===void 0)h=ke;else if(h!==ke){u.push(new Xr($,N)),y+=te;continue}let Ee=i.getOffsetAt(Se.range.getStartPosition())-v+y,He=i.getOffsetAt(Se.range.getEndPosition())-v+y;if(ke=c.substring(Ee,He+te),ke.length===0){u.push(new Xr($,N)),y+=te;continue}if(g===void 0)g=ke;else if(g!==ke){u.push(new Xr($,N)),y+=te;continue}f===void 0&&(f=Se.range.getStartPosition()),h!==void 0&&g!==void 0&&h.length>0&&g.length>0&&h!==g?p.push(new Xr(Se.range,g)):p.push(new Xr($,N)),y+=te}else u.push(new Xr($,N)),y+=N.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))}}},F4e=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}},qsi=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 $e,l===void 0||c===void 0){this._promise=gQi(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(F4e.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 ja(l.file,new Xr(u,c.newText??o));s.push(p)}return{edits:s}}catch{return{rejectReason:"Rename failed",edits:[]}}}},SCe=class extends C{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 $si;this._renameRunnable=void 0;this._register(qe.registerCommand(soi,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||!hQi(this._languageFeaturesService.renameProvider,e))return t;let n=F4e.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 Wp(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 qsi(this._languageFeaturesService,this._commandService,t.requestUuid,e,n,h,p,v,v!==void 0?u:void 0));let w=_c.inlineCompletionAccept({nes:t.isInlineEdit,requestUuid:t.requestUuid,providerId:t.source.provider.providerId,languageId:e.getLanguageId(),correlationId:t.getSourceCompletion().correlationId}),k={id:soi,title:d(1367,null),arguments:[w,this._renameRunnable]},T={label:d(1367,null),icon:M.replaceAll,command:k,count:this._renameRunnable.getCount()},N={kind:"edit",range:g[0].range,insertText:g[0].text,snippetInfo:t.snippetInfo,alternativeAction:T,uri:e.uri},O=j1.snapshot(e);return N4e.create(t.withAction(N),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=qwt.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(F4e.create(this._codeEditorService,n))?!1:this._renameRunnable===void 0?!0:this._renameRunnable.requestUuid===e.requestUuid?!1:(this._renameRunnable.cancel(),this._renameRunnable=void 0,!0)}};SCe=I([m(0,ge),m(1,zt),m(2,bs),m(3,ma),m(4,$wt),m(5,Kt)],SCe);var V7=class extends C{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=lQi(this,{initial:()=>({inlineCompletions:BW.createEmpty(),suggestWidgetInlineCompletions:BW.createEmpty()}),disposeFinal:e=>{e.inlineCompletions.dispose(),e.suggestWidgetInlineCompletions.dispose()},changeTracker:z9t(()=>({versionId:this._versionId})),update:(e,t,o)=>{let n=Qc.compose(o.changes.map(r=>r.change?O9(r.change.changes):Qc.empty).filter(mo));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=Ce(this,e=>{this._versionId.read(e),this._updateOperation.clear()});this._loadingCount=Le(this,0);this.loading=this._loadingCount.map(this,e=>e>0);this._loggingEnabled=pr("editor.inlineSuggest.logFetch",!1,this._configurationService).recomputeInitiallyAndOnChange(this._store),this._sendRequestData=pr("editor.inlineSuggest.emptyResponseInformation",!0,this._configurationService).recomputeInitiallyAndOnChange(this._store),this._structuredFetchLogger=this._register(this._instantiationService.createInstance(F7.cast(),"editor.inlineSuggest.logFetch.commandId")),this._renameProcessor=this._store.add(this._instantiationService.createInstance(SCe)),this.clearOperationOnTextModelChange.recomputeInitiallyAndOnChange(this._store);let h=to.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);yi(t)?this._completionsEnabled=t:this._completionsEnabled=void 0}_log(e){this._loggingEnabled.get()&&this._logService.info(Z8i(e)),this._structuredFetchLogger.log(e)}fetch(e,t,o,n,r,s,l){let c=this._cursorPosition.get(),u=new jsi(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 $e,f=(async()=>{let b=new P;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(N=>N.providerId),T=new Qsi(o,l,k);try{let N=this._debounceValue.get(this._textModel),O=Mut(e.map(He=>He.debounceDelayMs),gUi(qd))??N;if((h||r&&o.triggerKind===0)&&await ksi(O,g.token),g.token.isCancellationRequested||this._store.isDisposed||this._textModel.getVersionId()!==u.versionId)return T.setNoSuggestionReasonIfNotSet("canceled:beforeFetch"),!1;let U=V7._requestId++;(this._loggingEnabled.get()||this._structuredFetchLogger.isEnabled.get())&&this._log({sourceId:"InlineCompletions.fetch",kind:"start",requestId:U,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,$=pQi(e,this._cursorPosition.get(),this._textModel,o,l,this._languageConfigurationService);Osi(g.token,()=>$.cancelAndDispose({kind:"tokenCancellation"}));let te=!1,pe=!1,de=[];for await(let He of $.lists)if(He){He.addRef(),b.add(Z(()=>He.removeRef(He.inlineSuggestionsData.length===0?{kind:"empty"}:{kind:"notTaken"})));for(let Ve of He.inlineSuggestionsData){if(pe=!0,!o.includeInlineEdits&&(Ve.isInlineEdit||Ve.showInlineEditMenu)){Ve.setNotShownReason("notInlineEditRequested");continue}if(!o.includeInlineCompletions&&!(Ve.isInlineEdit||Ve.showInlineEditMenu)){Ve.setNotShownReason("notInlineCompletionRequested");continue}Ve.addPerformanceMarker("providerReturned");let Fe=Ve.action?.uri,Qt,Ze;if(Fe&&Fe.toString()!==this._textModel.uri.toString()){let bo=await this._textModelService.createModelReference(Fe);Qt=bo.object.textEditorModel,Ze=bo}else Qt=this._textModel,Ze=void 0;let Ti=j1.snapshot(Qt),ti=N4e.create(Ve,Ti);if(Ze){let bo=_s(ti.identity.onDispose,()=>{Ze?.dispose(),bo.dispose()})}Ve.addPerformanceMarker("itemCreated"),de.push(ti),!ti.isInlineEdit&&!ti.showInlineEditMenu&&o.triggerKind===0&&ti.isVisible(this._textModel,this._cursorPosition.get())&&(te=!0)}if(te)break}de.forEach(He=>He.addPerformanceMarker("providersResolved"));let se=await Promise.all(de.map(async He=>this._renameProcessor.proposeRenameRefactoring(this._textModel,He,o)));if(se.forEach(He=>He.addPerformanceMarker("renameProcessed")),$.cancelAndDispose({kind:"lostRace"}),this._loggingEnabled.get()||this._structuredFetchLogger.isEnabled.get()){let He=$.didAllProvidersReturn,Ve;(g.token.isCancellationRequested||this._store.isDisposed||this._textModel.getVersionId()!==u.versionId)&&(Ve="canceled");let Fe=se.map(Qt=>{let Ze=Qt.getSourceCompletion();if(Ze.doNotLog)return;let Ti={insertText:Ze.insertText,range:Ze.range,additionalTextEdits:Ze.additionalTextEdits,uri:Ze.uri,command:Ze.command,gutterMenuLinkAction:Ze.gutterMenuLinkAction,shownCommand:Ze.shownCommand,completeBracketPairs:Ze.completeBracketPairs,isInlineEdit:Ze.isInlineEdit,showInlineEditMenu:Ze.showInlineEditMenu,showRange:Ze.showRange,warning:Ze.warning,hint:Ze.hint,supportsRename:Ze.supportsRename,correlationId:Ze.correlationId,jumpToPosition:Ze.jumpToPosition};return{...Gk(Ti,ti=>z.isIRange(ti)?z.lift(ti).toString():Ie.isIPosition(ti)?Ie.lift(ti).toString():vse.is(ti)?{$commandId:ti.id}:ti),$providerId:Qt.source.provider.providerId?.toString()}}).filter(Qt=>Qt!==void 0);this._log({sourceId:"InlineCompletions.fetch",kind:"end",requestId:U,durationMs:Date.now()-G.getTime(),error:Ve,result:Fe,time:Date.now(),didAllProvidersReturn:He})}if(T.setRequestUuid($.contextWithUuid.requestUuid),pe)T.setHasProducedSuggestion(),se.length>0&&g.token.isCancellationRequested&&se.forEach(He=>He.setNotShownReasonIfNotSet("canceled:whileAwaitingOtherProviders"));else if(g.token.isCancellationRequested)T.setNoSuggestionReasonIfNotSet("canceled:whileFetching");else{let He=this._contextKeyService.getContextKeyValue("completionsQuotaExceeded");T.setNoSuggestionReasonIfNotSet(He?"completionsQuotaExceeded":"noSuggestion")}let Se=o.earliestShownDateTime-Date.now();if(Se>0&&await ksi(Se,g.token),se.forEach(He=>He.addPerformanceMarker("minShowDelayPassed")),g.token.isCancellationRequested||this._store.isDisposed||this._textModel.getVersionId()!==u.versionId||s.get()){let He=g.token.isCancellationRequested?"canceled:afterMinShowDelay":this._store.isDisposed?"canceled:disposed":this._textModel.getVersionId()!==u.versionId?"canceled:documentChanged":s.get()?"canceled:userJumped":"unknown";return se.forEach(Ve=>Ve.setNotShownReasonIfNotSet(He)),!1}let ke=new Date;this._debounceValue.update(this._textModel,ke.getTime()-G.getTime());let Ee=this._cursorPosition.get();this._updateOperation.clear(),Ui(He=>{let Ve=this._state.get();o.selectedSuggestionInfo?this._state.set({inlineCompletions:BW.createEmpty(),suggestWidgetInlineCompletions:Ve.suggestWidgetInlineCompletions.createStateWithAppliedResults(se,u,this._textModel,Ee,n)},He):this._state.set({inlineCompletions:Ve.inlineCompletions.createStateWithAppliedResults(se,u,this._textModel,Ee,n),suggestWidgetInlineCompletions:BW.createEmpty()},He),Ve.inlineCompletions.dispose(),Ve.suggestWidgetInlineCompletions.dispose()})}finally{b.dispose(),y(),this._sendInlineCompletionsRequestTelemetry(T)}return!0})(),v=new Ysi(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:BW.createEmpty(),suggestWidgetInlineCompletions:BW.createEmpty()},e),t.inlineCompletions.dispose(),t.suggestWidgetInlineCompletions.dispose()}seedInlineCompletionsWithSuggestWidget(){let e=this.inlineCompletions.get(),t=this.suggestWidgetInlineCompletions.get();t&&Ui(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:BW.createEmpty()},o),n.inlineCompletions.dispose(),n.suggestWidgetInlineCompletions.dispose()}this.clearSuggestWidgetInlineCompletions(o)})}seedWithCompletion(e,t){let o=this._state.get();this._state.set({inlineCompletions:new BW([e],void 0),suggestWidgetInlineCompletions:BW.createEmpty()},t),o.inlineCompletions.dispose(),o.suggestWidgetInlineCompletions.dispose()}_sendInlineCompletionsRequestTelemetry(e){if(!this._sendRequestData.get()&&!this._contextKeyService.getContextKeyValue("isRunningUnificationExperiment")||e.requestUuid===void 0||e.hasProducedSuggestion||!Zht(this._completionsEnabled,this._textModel.getLanguageId())||!e.providers.some(n=>VW(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(mo).join(","),...q1(e.providers.some(n=>VW(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(vO);Fwt(o,t)}clearSuggestWidgetInlineCompletions(e){this._updateOperation.value?.request.context.selectedSuggestionInfo&&this._updateOperation.clear()}cancelUpdate(){this._updateOperation.clear()}};V7=I([m(4,bs),m(5,ne),m(6,B),m(7,F),m(8,X),m(9,Nt)],V7);var jsi=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)&&L9t(this.context.selectedSuggestionInfo,i.context.selectedSuggestionInfo,C6())&&(i.context.triggerKind===0||this.context.triggerKind===1)&&this.versionId===i.versionId&&WVo(i.providers,this.providers)}get isExplicitRequest(){return this.context.triggerKind===1}},Qsi=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 WVo(a,i){return[...a].every(e=>i.has(e))}var Ysi=class{constructor(i,e,t){this.request=i;this.cancellationTokenSource=e;this.promise=t}dispose(){this.cancellationTokenSource.cancel()}},BW=class a extends C{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(mo);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=BVo(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(tl(u=>u.showInlineEditMenu,Vut)),c=VVo(c,u=>u.semanticId),new a(c,t)}clone(){return new a(this.inlineCompletions,this.request)}};function VVo(a,i){let e=new Set;return a.filter(t=>{let o=i(t);return e.has(o)?!1:(e.add(o),!0)})}function BVo(a,i){let e=i.indexOf(a);return e>-1?[a,...i.slice(0,e),...i.slice(e+1)]:i}var ej=ae("IInlineCompletionsService"),vQi=new Q("inlineCompletions.snoozed",!1,d(192,null)),Ele=class extends C{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 Nl);let o=vQi.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=Ele.SNOOZE_DURATION){this.setSnoozeDuration(e+this.snoozeTimeLeft)}setSnoozeDuration(e){if(e<0)throw new ni(`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 ni("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})}};Ele=I([m(0,X),m(1,Te)],Ele);we(ej,Ele,1);var HVo="editor.action.inlineSuggest.snooze",UVo="editor.action.inlineSuggest.cancelSnooze",fQi="inlineCompletions.lastSnoozeDuration",jwt=class a extends K{static{this.ID=HVo}constructor(){super({id:a.ID,title:L(191,"Snooze Inline Suggestions"),precondition:x.true(),f1:!0})}async run(i,...e){let t=i.get(Ge),o=i.get(ej),n=i.get(le),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(fQi,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(fQi,n.value,0,0),n.value}},Qwt=class a extends K{static{this.ID=UVo}constructor(){super({id:a.ID,title:L(190,"Cancel Snooze Inline Suggestions"),precondition:vQi,f1:!0})}async run(i){i.get(ej).cancelSnooze()}};var Ywt=class a extends C{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=Zve(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=Zve(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 Um=ae("defaultAccountService");var bQi;function SQi(a){return bQi?.(a)??null}function IQi(a){bQi=a}var ICe=class extends C{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=Le(this,!1);this._onlyRequestInlineEditsSignal=Wc(this);this._forceUpdateExplicitlySignal=Wc(this);this._noDelaySignal=Wc(this);this._fetchSpecificProviderSignal=Wc(this);this._selectedInlineCompletionId=Le(this,void 0);this.primaryPosition=Ce(this,e=>this._positions.read(e)[0]??new Ie(1,1));this.allPositions=Ce(this,e=>this._positions.read(e));this.sku=Le(this,void 0);this._isAcceptingPartially=!1;this._appearedInsideViewport=Ce(this,e=>{let t=this.state.read(e);return!t||!t.inlineSuggestion?!1:eai(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=Hbe({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=Hbe({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){Ui(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(mo),this._source.fetch(v,f.label,u,h?.identity,t.shouldDebounce,g,c)});this._inlineSuggestionItems=hs({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=hs({owner:this,equalsFn:lN()},e=>this._inlineSuggestionItems.read(e)?.inlineCompletions??[]);this.selectedInlineCompletionIndex=Ce(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=Ce(this,e=>{let t=this._inlineCompletionItems.read(e),o=this.selectedInlineCompletionIndex.read(e);return t[o]});this.activeCommands=hs({owner:this,equalsFn:lN()},e=>this.selectedInlineCompletion.read(e)?.source.inlineSuggestions.commands??[]);this.inlineCompletionsCount=Ce(this,e=>{if(this.lastTriggerKind.read(e)===1)return this._inlineCompletionItems.read(e).length});this._hasVisiblePeekWidgets=Ce(this,e=>this._editorObs.openedPeekWidgets.read(e)>0);this._shouldShowOnSuggestConflict=Ce(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=hs({owner:this,equalsFn:(e,t)=>!e||!t?e===t:e.kind==="ghostText"&&t.kind==="ghostText"?Esi(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=>ro.fromRangeInclusive(n.targetRange).addMargin(1,1).contains(p.lineNumber)),l=n.action?.kind==="edit"?n.action.stringEdit:void 0,c=l?bp.fromStringEdit(l,new _L(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=XM(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,...Xsi(this.textModel,g,u)].map((w,k)=>({edit:w,ghostText:w?_si(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 $1(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,...Xsi(this.textModel,u,l)].map((v,b)=>({edit:v,ghostText:v?_si(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=Ce(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=Ce(this,e=>{let t=this.state.read(e);if(!(!t||t.kind!=="ghostText")&&!this._editorObs.inComposition.read(e))return t});this.inlineEditState=Ce(this,e=>{let t=this.state.read(e);if(!(!t||t.kind!=="inlineEdit"))return t});this.inlineEditAvailable=Ce(this,e=>!!this.inlineEditState.read(e));this.warning=Ce(this,e=>this.inlineCompletionState.read(e)?.inlineSuggestion?.warning);this.ghostTexts=hs({owner:this,equalsFn:Esi},e=>{let t=this.inlineCompletionState.read(e);if(t)return t.ghostTexts});this.primaryGhostText=hs({owner:this,equalsFn:Tsi},e=>{let t=this.inlineCompletionState.read(e);if(t)return t?.primaryGhostText});this.showCollapsed=Ce(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=Ce(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=Ce(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=Ce(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=Le(this,void 0);this._inAcceptFlow=Le(this,!1);this.inAcceptFlow=this._inAcceptFlow;this._source=this._register(this._instantiationService.createInstance(V7,this.textModel,this._textModelVersionId,this._debounceValue,this.primaryPosition)),this.lastTriggerKind=this._source.inlineCompletions.map(this,N=>N?.request?.context.triggerKind),this._editorObs=os(this._editor);let S=this._editorObs.getOption(134);this._suggestPreviewEnabled=S.map(N=>N.preview),this._suggestPreviewMode=S.map(N=>N.previewMode);let y=this._editorObs.getOption(71);this._inlineSuggestMode=y.map(N=>N.mode),this._suppressedInlineCompletionGroupIds=y.map(N=>new Set(N.experimental.suppressInlineSuggestions.split(","))),this._inlineEditsEnabled=y.map(N=>!!N.edits.enabled),this._inlineEditsShowCollapsedEnabled=y.map(N=>N.edits.showCollapsed),this._triggerCommandOnProviderChange=y.map(N=>N.triggerCommandOnProviderChange),this._minShowDelay=y.map(N=>N.minShowDelay),this._showOnSuggestConflict=y.map(N=>N.experimental.showOnSuggestConflict),this._suppressInSnippetMode=y.map(N=>N.suppressInSnippetMode);let w=Qr.get(this._editor);this._isInSnippetMode=w?.isInSnippetObservable??Oo(!1),b.getDefaultAccount().then(KVo(N=>this.sku.set(yQi(N),void 0),this._store)),this._register(b.onDidChangeDefaultAccount(N=>this.sku.set(yQi(N),void 0))),this._typing=this._register(new Ywt(this.textModel)),this._register(this._inlineCompletionsService.onDidChangeIsSnoozing(N=>{N&&this.stop()}));{let N=this.textModel.uri.scheme===Y.vscodeNotebookCell,[O]=this._codeEditorService.listDiffEditors().filter(V=>V.getOriginalEditor().getId()===this._editor.getId()||V.getModifiedEditor().getId()===this._editor.getId());this.isInDiffEditor=!!O,this.editorType=N?"notebook":this.isInDiffEditor?"diffEditor":"textEditor"}this._register(EM(this.state,N=>{N&&N.inlineSuggestion&&this._inlineCompletionsService.reportNewCompletion(N.inlineSuggestion.requestUuid)})),this._register(EM(this._fetchInlineCompletionsPromise)),this._register(he(N=>{this._editorObs.versionId.read(N),this._inAcceptFlow.set(!1,void 0)})),this._register(he(N=>{this.state.map((V,U)=>!V||V.kind==="inlineEdit"&&!V.cursorAtInlineEdit.read(U)).read(N)&&this._jumpedToId.set(void 0,void 0)})),this._register(he(N=>{let O=this.state.map(V=>V?.inlineSuggestion).read(N);O&&O.addPerformanceMarker("activeSuggestion")}));let k=this.inlineEditState.map(N=>N?.inlineSuggestion.semanticId);this._register(he(N=>{k.read(N)&&(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));$v(this,T,(N,O)=>{N.onDidChangeInlineCompletions&&O.add(N.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!==N||Ui($=>{this._fetchSpecificProviderSignal.trigger($,{provider:N,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=Ap(l);p===-1&&(p=l.length-1),t=p>0;let h=this.textModel.getOptions().tabSize;o=al.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={}){dN(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){dN(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(mo);return DT(r,l=>{let c=l.getSingleTextEdit();return c=XM(c,o,z.fromPositions(c.range.getStartPosition(),e.range.getEndPosition())),Nwt(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?_c.inlineCompletionPartialAccept({nes:e.isInlineEdit,requestUuid:e.requestUuid,providerId:e.source.provider.providerId,languageId:t,type:o,correlationId:e.getSourceCompletion().correlationId}):_c.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 ni;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,ss)}else if(l.snippetInfo){let c=Xr.delete(l.textReplacement.range),u=o.additionalTextEdits.map(h=>new Xr(z.lift(h.range),h.text??"")),p=bp.fromParallelReplacementsUnsorted([c,...u]);e.edit(p,this._getMetadata(o,this.textModel.getLanguageId())),e.setPosition(l.snippetInfo.range.getStartPosition(),"inlineCompletionAccept"),Qr.get(e)?.insert(l.snippetInfo.snippet,{undoStopBefore:!1})}else{let c=r.edits,u=c;r.kind==="ghostText"&&(u=oQi(c,this.textModel));let p=xsi(u).map(f=>Yt.fromPositions(f)),h=o.additionalTextEdits.map(f=>new Xr(z.lift(f.range),f.text??"")),g=bp.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 Jsi(e,f,()=>{this._store.delete(v)}))}}}}}else{let l=await this._codeEditorService.openCodeEditor({resource:o.originalTextRef.uri},this._editor);if(l){let u=SQi(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,ss),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 ni;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 Ie(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 Xr(w,k),N=[T,...Xsi(this.textModel,f,T)].filter(mo),O=xsi(N).map(V=>Yt.fromPositions(V));e.edit(bp.fromParallelReplacementsUnsorted(N),this._getMetadata(l,t)),e.setSelections(O,"inlineCompletionPartialAccept"),e.revealPositionInCenterIfOutsideViewport(e.getPosition(),0)}finally{this._isAcceptingPartially=!1}let b=z.fromPositions(l.editRange.getStartPosition(),Zl.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=XM(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{Ui(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(),Ui(t=>{this._source.seedWithCompletion(e,t),this._isActive.set(!0,t),this._inAcceptFlow.set(!0,t),this.dontRefetchSignal.trigger(t)})}};ICe=I([m(7,F),m(8,ge),m(9,bs),m(10,Bi),m(11,zt),m(12,Kt),m(13,ej),m(14,Um)],ICe);function Xsi(a,i,e){if(i.length===1)return[];let t=new _L(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(di.emptyAt(n)),u=t.getValueOfOffsetRange(c);return r.map(h=>{let g=h+l,f=g+s.replaceRange.length,v=new di(g,f),b=v.join(di.emptyAt(h));if(t.getValueOfOffsetRange(b)!==u)return;let y=new Hc(v,s.newText);return o.getTextReplacement(y)}).filter(mo)}var Jsi=class extends C{constructor(i,e,t){super(),t&&this._register({dispose:()=>t()}),this._register(os(i).setDecorations(Oo(e.map(r=>({range:r,options:{description:"animation",className:"edits-fadeout-decoration",zIndex:1}})))));let o=new M4e(1,0,1e3,rQi),n=new Awt(o);this._register(he(r=>{let s=n.getValue(r);i.getContainerDomNode().style.setProperty("--animation-opacity",s.toString()),o.isFinished()&&this.dispose()}))}};function eai(a,i,e=void 0){let t=i.targetRange;os(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 yQi(a){if(a?.entitlementsData?.access_type_sku&&a?.entitlementsData?.copilot_plan)return{type:a.entitlementsData.access_type_sku,plan:a.entitlementsData.copilot_plan}}var Zsi=class{constructor(i){this.handler=i=>this._cb?.(i);this._cb=i}dispose(){this._cb=void 0}};function KVo(a,i){let e=new Zsi(a);return i.add(e),e.handler}var W4e=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}},Xwt=class extends W4e{constructor(){super("first")}memorize(i,e,t){}toJSON(){}fromJSON(){}},tai=class extends W4e{constructor(){super("recentlyUsed");this._cache=new il(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:xU.fromString(n.type),this._cache.set(o,n);this._seq=this._cache.size}},iai=class extends W4e{constructor(){super("recentlyUsedByPrefix");this._trie=Yu.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:xU.fromString(o.type),this._trie.set(t,o)}}},tj=class{constructor(i,e){this._storageService=i;this._configService=e;this._disposables=new P;this._persistSoon=new Dt(()=>this._saveState(),500),this._disposables.add(i.onWillSaveState(t=>{t.reason===1&&this._saveState()}))}static{this._strategyCtors=new Map([["recentlyUsedByPrefix",iai],["recentlyUsed",tai],["first",Xwt]])}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=tj._strategyCtors.get(t)||Xwt;this._strategy=new o;try{let r=this._configService.getValue("editor.suggest.shareSuggestSelections")?0:1,s=this._storageService.get(`${tj._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(`${tj._storagePrefix}/${this._strategy.name}`,t,e,1)}}};tj=I([m(0,le),m(1,B)],tj);var yCe=ae("ISuggestMemories");we(yCe,tj,1);var ij=class{constructor(i,e){this._editor=i;this._enabled=!1;this._ckAtEnd=ij.AtEnd.bindTo(e),this._configListener=this._editor.onDidChangeConfiguration(t=>t.hasChanged(139)&&this._update()),this._update()}static{this.AtEnd=new Q("atEndOfWord",!1,{type:"boolean",description:d(1651,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)}};ij=I([m(1,X)],ij);var JM=class{constructor(i,e){this._editor=i;this._index=0;this._ckOtherSuggestions=JM.OtherSuggestions.bindTo(e)}static{this.OtherSuggestions=new Q("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(JM._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=JM._moveIndex(i,this._model,this._index),this._acceptNext({index:this._index,item:this._model.items[this._index],model:this._model})}finally{this._ignore=!1}}};JM=I([m(1,X)],JM);var wCe=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 Vs,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 Ie(o,n),e.getEndPosition())}),t.push({range:z.fromPositions(new Ie(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 Ie(r,s),e.getEndPosition())}),t.push({range:z.fromPositions(new Ie(r,1),e.getEndPosition())}))}}};var CCe=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 wCe().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(JA(p))return 2<<20;let h=cx(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 V4e=class{constructor(i,e){this.leadingLineContent=i;this.characterCountDelta=e}};var xCe=class a{constructor(i,e,t,o,n,r,s=hq.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?wL:Qbt;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=uv.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=uv.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;Uw(u.completion.filterText,u.textLabel)===0?u.score=v:(u.score=jji(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?r6(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 oj=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 GVo(a,i,e){if(!i.getContextKeyValue(ka.inlineSuggestionVisible.key))return!0;let t=i.getContextKeyValue(ka.suppressSuggestions.key);return t!==void 0?!t:!a.getOption(71).suppressSuggestions}function $Vo(a,i,e){if(!i.getContextKeyValue("inlineSuggestionVisible"))return!0;let t=i.getContextKeyValue(ka.suppressSuggestions.key);return t!==void 0?!t:!a.getOption(71).suppressSuggestions}var Q1=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 P;this._triggerCharacterListener=new P;this._triggerQuickSuggest=new Nl;this._triggerState=void 0;this._completionDisposables=new P;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 Yt(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(){Ue(this._triggerCharacterListener),Ue([this._onDidCancel,this._onDidSuggest,this._onDidTrigger,this._triggerQuickSuggest]),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=Q8i();r&&n.add(r),i.set(o,n)}n.add(t)}let e=t=>{if(!$Vo(this._editor,this._contextKeyService,this._configurationService)||oj.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="";nN(t.charCodeAt(t.length-1))?Ru(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._triggerState!==void 0&&(this._triggerQuickSuggest.cancel(),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(){FW.isAllOff(this._editor.getOption(102))||this._editor.getOption(134).snippetsPreventQuickSuggestions&&Qr.get(this._editor)?.isInSnippet()||(this.cancel(),this._triggerQuickSuggest.cancelAndSet(()=>{if(this._triggerState!==void 0||!oj.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(!FW.isAllOff(t)){if(!FW.isAllOn(t)){i.tokenization.tokenizeIfCheap(e.lineNumber);let o=i.tokenization.getLineTokens(e.lineNumber),n=o.getStandardTokenType(o.findTokenIndexAtOffset(Math.max(e.column-1-1,0)));if(FW.valueFor(t,n)!=="on"&&(FW.valueFor(t,n)!=="offWhenInlineCompletions"||this._languageFeaturesService.inlineCompletionsProvider.has(i)&&this._editor.getOption(71).enabled))return}GVo(this._editor,this._contextKeyService,this._configurationService)&&this._languageFeaturesService.completionProvider.has(i)&&this.trigger({auto:!0})}},this._editor.getOption(103)))}_refilterCompletionItems(){So(this._editor.hasModel()),So(this._triggerState!==void 0);let i=this._editor.getModel(),e=this._editor.getPosition(),t=new oj(i,e,{...this._triggerState,refilter:!0});this._onNewContext(t)}trigger(i){if(!this._editor.hasModel())return;let e=this._editor.getModel(),t=new oj(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 $e;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}=Q1.createSuggestFilter(this._editor),c=new Jq(r,i.completionOptions?.kindFilter??s,i.completionOptions?.providerFilter,i.completionOptions?.providerItemsToReuse,l),u=CCe.create(this._editorWorkerService,this._editor),p=Sle(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 oj(v,this._editor.getPosition(),i),S={...hq.default,firstMatchCanBeWeak:!this._editor.getOption(134).matchOnWordStartOnly};if(this._completionModel=new xCe(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(bl(i.leadingLineContent)!==bl(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(oj.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=oj.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})}}}}};Q1=I([m(1,$s),m(2,Wi),m(3,Te),m(4,ne),m(5,X),m(6,B),m(7,zt),m(8,Co)],Q1);var Jwt=class{constructor(i,e,t,o){this._disposables=new P;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||!dr(i.item.completion.commitCharacters)){this.reset();return}if(this._active&&this._active.item.item===i.item)return;let e=new D$;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 Zwt=class a{constructor(i,e){this._disposables=new P;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 nj=class{constructor(i,e,t,o,n,r){this._menuId=e;this._menuService=n;this._contextKeyService=r;this._menuDisposables=new P;this.element=R(i,_(".suggest-status-bar"));let s=(l=>t?.showIconsNoKeybindings?l instanceof Eo?o.createInstance(ml,l,void 0):void 0:l instanceof Eo?o.createInstance(WSt,l,{useComma:!1}):void 0);this._leftActions=new ji(this.element,{actionViewItemProvider:s}),this._rightActions=new ji(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()}};nj=I([m(3,F),m(4,qt),m(5,X)],nj);function B4e(a){return!!a&&!!(a.completion.documentation||a.completion.detail&&a.completion.detail!==a.completion.label)}var kCe=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 P;this._renderDisposeable=new P;this._size=new ai(330,0);this.domNode=_(".suggest-details"),this.domNode.classList.add("no-docs"),this._body=_(".body"),this._scrollbar=new Pa(this._body,{alwaysConsumeMouseWheel:!0}),R(this.domNode,this._scrollbar.getDomNode()),this._disposables.add(this._scrollbar),this._header=R(this._body,_(".header")),this._close=R(this._header,_("span"+q.asCSSSelector(M.close))),this._close.title=d(1647,null),this._close.role="button",this._close.tabIndex=-1,this._type=R(this._header,_("p.type")),this._docs=R(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=Ug(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(1648,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 xe().appendCodeblock("empty",n),t=`Provider: ${i.provider._debugDisplayName}`}if(!e&&!B4e(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,bn(this._type),this._type.classList.toggle("auto-wrap",!/\r?\n^\s+/gmi.test(n))}else Rt(this._type),this._type.title="",xo(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 ai(i,e);ai.equals(t,this._size)||(this._size=t,fN(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()}};kCe=I([m(1,De),m(2,Qn)],kCe);var eCt=class{constructor(i,e){this.widget=i;this._editor=e;this.allowEditorOverflow=!0;this._disposables=new P;this._added=!1;this._preferAlignAtTop=!0;this._resizable=new nO,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=Fm(this.getDomNode().ownerDocument.body),n=this.widget.getLayoutInfo(),r=new ai(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,U=new ai(O,o.height-i.top-n.borderHeight-n.verticalPadding),G=U.with(void 0,i.top+i.height-n.borderHeight-n.verticalPadding);return{top:s,left:V,fit:O-e.width,maxSizeTop:U,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),U=new ai(O,o.height-i.top-n.borderHeight-n.verticalPadding),G=U.with(void 0,i.top+i.height-n.borderHeight-n.verticalPadding);return{top:s,left:V,fit:O-e.width,maxSizeTop:U,maxSizeBottom:G,minSize:r.with(Math.min(O,r.width))}})(),u=(function(){let O=i.left,V=-n.borderWidth+i.top+i.height,U=new ai(i.width-n.borderHeight,o.height-i.top-i.height-n.verticalPadding);return{top:V,left:O,fit:U.height-e.height,maxSizeBottom:U,maxSizeTop:U,minSize:r.with(U.width)}})(),p=(function(){let O=i.left,V=new ai(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 N=this._editor.getDomNode();if(N){let O=N.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 jVo=/(?:\/|^)(?:([^\/]+)\/)?([^\/]+)$/;function js(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===Y.data)r=g$.parseMetaData(e).get(g$.META_DATA_LABEL);else{let s=e.path.match(jVo);s?(r=Tle(s[2].toLowerCase()),s[1]&&n.push(`${Tle(s[1].toLowerCase())}-name-dir-icon`)):r=Tle(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=QVo(a,i,e);s&&n.push(`${Tle(s)}-lang-file-icon`)}}return n}function Y1(a){return["file-icon",`${Tle(a)}-lang-file-icon`]}function QVo(a,i,e){if(!e)return null;let t=null;if(e.scheme===Y.data){let n=g$.parseMetaData(e).get(g$.META_DATA_MIME);n&&(t=i.getLanguageIdByMimeType(n))}else{let o=a.getModel(e);o&&(t=o.getLanguageId())}return t&&t!==Fr?t:i.guessLanguageIdByFilepathOrFirstLine(e)}function Tle(a){return a.replace(/[\s]/g,"/")}var YVo=Re("suggest-more-info",M.chevronRight,d(1650,null)),XVo=new class H4e{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(`^${H4e._regexRelaxed.source}$`,"i")}extract(i,e){if(i.textLabel.match(H4e._regexStrict))return e[0]=i.textLabel,!0;if(i.completion.detail&&i.completion.detail.match(H4e._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=H4e._regexRelaxed.exec(t);if(o&&(o.index===0||o.index+o[0].length===t.length))return e[0]=o[0],!0}return!1}},ECe=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 P,t=i;t.classList.add("show-file-icons");let o=R(i,_(".icon")),n=R(o,_("span.colorspan")),r=R(i,_(".contents")),s=R(r,_(".main")),l=R(s,_(".icon-label.codicon")),c=R(s,_("span.left")),u=R(s,_("span.right")),p=new Lc(c,{supportHighlights:!0,supportIcons:!0});e.add(p);let h=R(c,_("span.signature-label")),g=R(c,_("span.qualifier-label")),f=R(u,_("span.details-label")),v=R(u,_("span.readMore"+q.asCSSSelector(YVo)));return v.title=d(1649,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,N=S.get(135)||y.fontSize,O=S.get(136)||y.lineHeight,V=y.fontWeight,U=y.letterSpacing,G=`${N}px`,$=`${O}px`,te=`${U}px`;t.style.fontSize=G,t.style.fontWeight=V,t.style.letterSpacing=te,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:ua(i.score)},r=[];if(o.kind===19&&XVo.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=js(this._modelService,this._languageService,A.from({scheme:"fake",path:i.textLabel}),0),l=js(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=[js(this._modelService,this._languageService,A.from({scheme:"fake",path:i.textLabel}),1),js(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(xU.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=oai(o.detail||""),t.root.classList.add("string-label")):(t.parametersLabel.textContent=oai(o.label.detail||""),t.detailsLabel.textContent=oai(o.label.description||""),t.root.classList.remove("string-label")),this._editor.getOption(134).showInlineDetails?bn(t.detailsLabel):xo(t.detailsLabel),B4e(i)?(t.right.classList.add("can-expand-details"),bn(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"),xo(t.readMore),t.readMore.onmousedown=null,t.readMore.onclick=null)}disposeTemplate(i){i.disposables.dispose()}};ECe=I([m(1,Ct),m(2,kt),m(3,De)],ECe);function oai(a){return a.replace(/\r\n|\r|\n/g,"")}J("editorSuggestWidget.background",gm,d(1631,null));J("editorSuggestWidget.border",DN,d(1632,null));var sai=J("editorSuggestWidget.foreground",od,d(1634,null));J("editorSuggestWidget.selectedForeground",WU,d(1637,null));J("editorSuggestWidget.selectedIconForeground",aIe,d(1638,null));var aai=J("editorSuggestWidget.selectedBackground",VU,d(1636,null));J("editorSuggestWidget.highlightForeground",l9,d(1635,null));J("editorSuggestWidget.focusHighlightForeground",MGi,d(1633,null));J("editorSuggestWidgetStatus.foreground",ei(sai,.5),d(1639,null));var nai=class{constructor(i,e){this._service=i;this._key=`suggestWidget.size/${e.getEditorType()}/${e instanceof zc}`}restore(){let i=this._service.get(this._key,0)??"";try{let e=JSON.parse(i);if(ai.is(e))return ai.lift(e)}catch{}}store(i){this._service.store(this._key,JSON.stringify(i),0,1)}reset(){this._service.remove(this._key,0)}},HW=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 Nl;this._disposables=new P;this._onDidSelect=new Pm;this._onDidFocus=new Pm;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 nO,this.element.domNode.classList.add("editor-widget","suggest-widget"),this._contentWidget=new rai(this,i),this._persistedSize=new nai(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 ai(S,y))}this._contentWidget.unlockPreference(),s=void 0}})),this._messageElement=R(this.element.domNode,_(".message")),this._listElement=R(this.element.domNode,_(".tree"));let l=this._disposables.add(n.createInstance(kCe,this.editor));l.onDidClose(()=>this.toggleDetails(),this,this._disposables),this._details=new eCt(l,this.editor);let c=()=>this.element.domNode.classList.toggle("no-icons",!this.editor.getOption(134).showIcons);c();let u=n.createInstance(ECe,this.editor);this._disposables.add(u),this._disposables.add(u.onDidToggleDetails(()=>this.toggleDetails())),this._list=new hc("SuggestWidget",this._listElement,{getHeight:g=>this.getLayoutInfo().itemHeight,getTemplateId:g=>"suggestion"},[u],{alwaysConsumeMouseWheel:!0,useShadows:!1,mouseSupport:!1,multipleSelectionSupport:!1,accessibilityProvider:{getRole:()=>ri?"listitem":"option",getWidgetAriaLabel:()=>d(1644,null),getWidgetRole:()=>"listbox",getAriaLabel:g=>{let f=g.textLabel,v=xU.toLabel(g.completion.kind);if(typeof g.completion.label!="string"){let{detail:w,description:k}=g.completion.label;w&&k?f=d(1643,null,f,w,k,v):w?f=d(1642,null,f,w,v):k&&(f=d(1641,null,f,k,v))}else f=d(1640,null,f,v);if(!g.isResolved||!this._isDetailsVisible())return f;let{documentation:b,detail:S}=g.completion,y=id("{0}{1}",S||"",b?typeof b=="string"?b:b.value:"");return d(1630,null,f,y)}}}),this._list.style(GI({listInactiveFocusBackground:aai,listInactiveFocusOutline:qs})),this._status=n.createInstance(nj,this.element.domNode,WW,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=$n.Visible.bindTo(t),this._ctxSuggestWidgetDetailsVisible=$n.DetailsVisible.bindTo(t),this._ctxSuggestWidgetMultipleSuggestions=$n.MultipleSuggestions.bindTo(t),this._ctxSuggestWidgetHasFocusedSuggestion=$n.HasFocusedSuggestion.bindTo(t),this._ctxSuggestWidgetDetailsFocused=$n.DetailsFocused.bindTo(t);let h=Vn(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(Vo(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(1645,null)}static{this.NO_SUGGESTIONS_MESSAGE=d(1646,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=xn(async o=>{let n=nn(()=>{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:xo(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=HW.LOADING_MESSAGE,xo(this._listElement,this._status.element),bn(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,Or(HW.LOADING_MESSAGE);break;case 2:this.element.domNode.classList.add("message"),this._messageElement.textContent=HW.NO_SUGGESTIONS_MESSAGE,xo(this._listElement,this._status.element),bn(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,Or(HW.NO_SUGGESTIONS_MESSAGE);break;case 3:xo(this._messageElement),bn(this._listElement,this._status.element),this._show();break;case 4:xo(this._messageElement),bn(this._listElement,this._status.element),this._show();break;case 5:xo(this._messageElement),bn(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=nn(()=>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=Ah(Me(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")):(B4e(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=Ah(Me(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=Fm(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 ai(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=Yn(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 ai(s,t.defaultSize.height),this.element.maxSize=new ai(r,b),this.element.minSize=new ai(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=Kn(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 ai(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}};HW=I([m(1,le),m(2,X),m(3,De),m(4,F)],HW);var rai=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 ai(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 JVo=!1,lai=class{constructor(i,e){this._model=i;this._position=e;this._decorationOptions=po.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 El=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 P;this._selectors=new cai(i=>i.priority);this._onWillInsertSuggestItem=new E;this._wantsForceRenderingAbove=!1;this.editor=i,this.model=n.createInstance(Q1,this.editor),this._selectors.register({priority:0,select:(p,h,g)=>this._memoryService.select(p,h,g)});let l=$n.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 hN(Me(i.getDomNode()),()=>{let p=this._instantiationService.createInstance(HW,this.editor);this._toDispose.add(p),this._toDispose.add(p.onDidSelect(b=>this._insertSuggestion(b,0),this));let h=new Jwt(this.editor,p,this.model,b=>this._insertSuggestion(b,2));this._toDispose.add(h);let g=$n.MakesTextEdit.bindTo(this._contextKeyService),f=$n.HasInsertAndReplaceRange.bindTo(this._contextKeyService),v=$n.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(!Ie.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 hN(Me(i.getDomNode()),()=>this._toDispose.add(new Zwt(this.editor,this.model)))),this._alternatives=this._toDispose.add(new hN(Me(i.getDomNode()),()=>this._toDispose.add(new JM(this.editor,this._contextKeyService)))),this._toDispose.add(n.createInstance(ij,i)),this._toDispose.add(this.model.onDidTrigger(p=>{this.widget.value.showTriggered(p.auto,p.shy?250:50),this._lineSuffix.value=new lai(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(()=>{JVo||(this.model.cancel(),this.model.clear())}));let c=$n.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(El.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=Qr.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 $e;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=tC.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 An.replaceMove(b,v.text)})),f.restoreRelativeVerticalPositionOfCursor(this.editor)}else if(!u){let f=new En,v,b=o.onDidChangeContent(k=>{if(k.isFlush){l.cancel(),b.dispose();return}for(let T of k.changes){let N=z.getEndPosition(T.range);(!v||Ie.isBefore(N,v))&&(v=N)}}),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=>Ie.isBefore(v,z.getStartPosition(T.range))))return!1;y&&this.editor.pushUndoStop();let k=tC.capture(this.editor);return this.editor.executeEdits("suggestController.additionalTextEdits.async",r.completion.additionalTextEdits.map(T=>An.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=zh.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:_c.suggest({providerId:CU.fromExtensionId(r.extensionId?.value)})}),e&2||this.editor.pushUndoStop(),r.completion.command)if(r.completion.command.id===tCt.id)this.model.trigger({auto:!0,retrigger:!0});else{let f=new En;s.push(this._commandService.executeCommand(r.completion.command.id,...r.completion.command.arguments?[...r.completion.command.arguments]:[]).catch(v=>{r.completion.extensionId?ss(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:Ir(Ye(e.uri)).toString(16),languageId:e.getLanguageId(),fileExtension:ms(e.uri),resolveInfo:i.provider.resolveCompletionItem?t?1:0:-1,resolveDuration:i.resolveDuration,commandDuration:o,additionalEditsAsync:n,index:r,firstIndex:p})}getOverwriteInfo(i,e){So(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(dr(i.completion.additionalTextEdits)){let e=d(1624,null,i.textLabel,i.completion.additionalTextEdits.length);Jo(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};H.once(this.model.onDidTrigger)(n=>{let r=[];H.any(this.model.onDidTrigger,this.model.onDidCancel)(()=>{Ue(r),t()},void 0,r),this.model.onDidSuggest(({completionModel:s})=>{if(Ue(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)}};El=I([m(1,yCe),m(2,ge),m(3,X),m(4,F),m(5,ne),m(6,Te)],El);var cai=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}},tCt=class a extends xi{static{this.id="editor.action.triggerSuggest"}constructor(){super({id:a.id,label:L(1629,"Trigger Suggest"),precondition:x.and(ue.writable,ue.hasCompletionItemProvider,$n.Visible.toNegated()),kbOpts:{kbExpr:ue.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[521,2087]},weight:100}})}run(i,e,t){let o=El.get(e);if(!o)return;let n;t&&typeof t=="object"&&t.auto===!0&&(n=!0),o.triggerSuggest(void 0,n,void 0)}};go(El.ID,El,2);Jt(tCt);var v_=190,Nx=xc.bindToContribution(El.get);qi(new Nx({id:"acceptSelectedSuggestion",precondition:x.and($n.Visible,$n.HasFocusedSuggestion),handler(a){a.acceptSelectedSuggestion(!0,!1)},kbOpts:[{primary:2,kbExpr:x.and($n.Visible,ue.textInputFocus),weight:v_},{primary:3,kbExpr:x.and($n.Visible,ue.textInputFocus,$n.AcceptSuggestionsOnEnter,$n.MakesTextEdit),weight:v_}],menuOpts:[{menuId:WW,title:d(1622,null),group:"left",order:1,when:x.and($n.HasFocusedSuggestion,$n.HasInsertAndReplaceRange.toNegated())},{menuId:WW,title:d(1622,null),group:"left",order:1,when:x.and($n.HasFocusedSuggestion,$n.HasInsertAndReplaceRange,$n.InsertMode.isEqualTo("insert"))},{menuId:WW,title:d(1623,null),group:"left",order:1,when:x.and($n.HasFocusedSuggestion,$n.HasInsertAndReplaceRange,$n.InsertMode.isEqualTo("replace"))}]}));qi(new Nx({id:"acceptAlternativeSelectedSuggestion",precondition:x.and($n.Visible,ue.textInputFocus,$n.HasFocusedSuggestion),kbOpts:{weight:v_,kbExpr:ue.textInputFocus,primary:1027,secondary:[1026]},handler(a){a.acceptSelectedSuggestion(!1,!0)},menuOpts:[{menuId:WW,group:"left",order:2,when:x.and($n.HasFocusedSuggestion,$n.HasInsertAndReplaceRange,$n.InsertMode.isEqualTo("insert")),title:d(1623,null)},{menuId:WW,group:"left",order:2,when:x.and($n.HasFocusedSuggestion,$n.HasInsertAndReplaceRange,$n.InsertMode.isEqualTo("replace")),title:d(1622,null)}]}));qe.registerCommandAlias("acceptSelectedSuggestionOnEnter","acceptSelectedSuggestion");qi(new Nx({id:"hideSuggestWidget",precondition:$n.Visible,handler:a=>a.cancelSuggestWidget(),kbOpts:{weight:v_,kbExpr:ue.textInputFocus,primary:9,secondary:[1033]}}));qi(new Nx({id:"selectNextSuggestion",precondition:x.and($n.Visible,x.or($n.MultipleSuggestions,$n.HasFocusedSuggestion.negate())),handler:a=>a.selectNextSuggestion(),kbOpts:{weight:v_,kbExpr:ue.textInputFocus,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}},menuOpts:{menuId:WW,group:"left",order:0,when:$n.HasFocusedSuggestion.toNegated(),title:d(1627,null)}}));qi(new Nx({id:"selectNextPageSuggestion",precondition:x.and($n.Visible,x.or($n.MultipleSuggestions,$n.HasFocusedSuggestion.negate())),handler:a=>a.selectNextPageSuggestion(),kbOpts:{weight:v_,kbExpr:ue.textInputFocus,primary:12,secondary:[2060]}}));qi(new Nx({id:"selectLastSuggestion",precondition:x.and($n.Visible,x.or($n.MultipleSuggestions,$n.HasFocusedSuggestion.negate())),handler:a=>a.selectLastSuggestion()}));qi(new Nx({id:"selectPrevSuggestion",precondition:x.and($n.Visible,x.or($n.MultipleSuggestions,$n.HasFocusedSuggestion.negate())),handler:a=>a.selectPrevSuggestion(),kbOpts:{weight:v_,kbExpr:ue.textInputFocus,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}}));qi(new Nx({id:"selectPrevPageSuggestion",precondition:x.and($n.Visible,x.or($n.MultipleSuggestions,$n.HasFocusedSuggestion.negate())),handler:a=>a.selectPrevPageSuggestion(),kbOpts:{weight:v_,kbExpr:ue.textInputFocus,primary:11,secondary:[2059]}}));qi(new Nx({id:"selectFirstSuggestion",precondition:x.and($n.Visible,x.or($n.MultipleSuggestions,$n.HasFocusedSuggestion.negate())),handler:a=>a.selectFirstSuggestion()}));qi(new Nx({id:"focusSuggestion",precondition:x.and($n.Visible,$n.HasFocusedSuggestion.negate()),handler:a=>a.focusSuggestion(),kbOpts:{weight:v_,kbExpr:ue.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}}}));qi(new Nx({id:"focusAndAcceptSuggestion",precondition:x.and($n.Visible,$n.HasFocusedSuggestion.negate()),handler:a=>{a.focusSuggestion(),a.acceptSelectedSuggestion(!0,!1)}}));qi(new Nx({id:"toggleSuggestionDetails",precondition:x.and($n.Visible,$n.HasFocusedSuggestion),handler:a=>a.toggleSuggestionDetails(),kbOpts:{weight:v_,kbExpr:ue.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}},menuOpts:[{menuId:WW,group:"right",order:1,when:x.and($n.DetailsVisible,$n.CanResolve),title:d(1626,null)},{menuId:WW,group:"right",order:1,when:x.and($n.DetailsVisible.toNegated(),$n.CanResolve),title:d(1625,null)}]}));qi(new Nx({id:"toggleExplainMode",precondition:$n.Visible,handler:a=>a.toggleExplainMode(),kbOpts:{weight:100,primary:2138}}));qi(new Nx({id:"toggleSuggestionFocus",precondition:$n.Visible,handler:a=>a.toggleSuggestionFocus(),kbOpts:{weight:v_,kbExpr:ue.textInputFocus,primary:2570,mac:{primary:778}}}));qi(new Nx({id:"insertBestCompletion",precondition:x.and(ue.textInputFocus,x.equals("config.editor.tabCompletion","on"),ij.AtEnd,$n.Visible.toNegated(),JM.OtherSuggestions.toNegated(),Qr.InSnippetMode.toNegated()),handler:(a,i)=>{a.triggerSuggestAndAcceptBest(yi(i)?{fallback:"tab",...i}:{fallback:"tab"})},kbOpts:{weight:v_,primary:2}}));qi(new Nx({id:"insertNextSuggestion",precondition:x.and(ue.textInputFocus,x.equals("config.editor.tabCompletion","on"),JM.OtherSuggestions,$n.Visible.toNegated(),Qr.InSnippetMode.toNegated()),handler:a=>a.acceptNextSuggestion(),kbOpts:{weight:v_,kbExpr:ue.textInputFocus,primary:2}}));qi(new Nx({id:"insertPrevSuggestion",precondition:x.and(ue.textInputFocus,x.equals("config.editor.tabCompletion","on"),JM.OtherSuggestions,$n.Visible.toNegated(),Qr.InSnippetMode.toNegated()),handler:a=>a.acceptPrevSuggestion(),kbOpts:{weight:v_,kbExpr:ue.textInputFocus,primary:1026}}));qi(new class extends xc{constructor(){super({id:"suggestWidgetCopy",precondition:$n.DetailsFocused,kbOpts:{weight:v_+10,kbExpr:$n.DetailsFocused,primary:2081,win:{primary:2081,secondary:[2067]}}})}runEditorCommand(a,i){Me(i.getDomNode()).document.execCommand("copy")}});Jt(class extends xi{constructor(){super({id:"editor.action.resetSuggestSize",label:L(1628,"Reset Suggest Widget Size"),precondition:void 0})}run(a,i){El.get(i)?.resetWidgetSize()}});var dai=class extends C{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=El.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?XM(h,p):void 0;if(!g)return-1;let f=Ie.lift(c),v=u.map((S,y)=>{let w=U4e.fromSuggestion(n,p,f,S,this.isShiftKeyPressed),k=XM(w.getSingleTextEdit(),p),T=Nwt(g,k);return{index:y,valid:T,prefixLength:k.text.length,suggestItem:S}}).filter(S=>S&&S.valid&&S.prefixLength>0),b=Z2e(v,tl(S=>S.prefixLength,qd));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(H.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=U4e.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||!ZVo(this._currentSuggestItemInfo,t))&&(this._isActive=e,this._currentSuggestItemInfo=t,this._onDidSelectedItemChange.fire())}getSuggestItemInfo(){let e=El.get(this.editor);if(!e||!this.isSuggestWidgetVisible)return;let t=e.widget.value.getFocusedItem(),o=this.editor.getPosition(),n=this.editor.getModel();if(!(!t||!o||!n))return U4e.fromSuggestion(e,n,o,t.item,this.isShiftKeyPressed)}stopForceRenderingAbove(){El.get(this.editor)?.stopForceRenderingAbove()}forceRenderingAbove(){El.get(this.editor)?.forceRenderingAbove()}},U4e=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 zh().parse(r);c.children.length<100&&aC.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 Pht(this.range,this.insertText,this.completionItemKind,this.isSnippetText)}getSingleTextEdit(){return new Xr(this.range,this.insertText)}};function ZVo(a,i){return a===i?!0:!a||!i?!1:a.equals(i)}var iCt=class extends C{constructor(e,t,o){super();this._editorObs=e;this._handleSuggestAccepted=t;this._suggestControllerPreselector=o;this._suggestWidgetAdaptor=this._register(new dai(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 _le=class a{constructor(i,e){this.startColumn=i;this.endColumnExclusive=e;if(i>e)throw new ni(`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 di(this.startColumn-1,this.endColumnExclusive-1)}};var oCt=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 _le(i.startColumn,i.endColumn))}toRange(){return new z(this.lineNumber,this.columnRange.startColumn,this.lineNumber,this.columnRange.endColumnExclusive)}};var z4e=class a{constructor(i){this._tokenInfo=i}static fromLineTokens(i){let e=[];for(let t=0;t<i.getCount();t++)e.push(new nCt(i.getTokenText(t),i.getMetadata(t)));return a.create(e)}static create(i){return new a(i)}toLineTokens(i){return Bc.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 di(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 di(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 nCt(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)}},nCt=class{constructor(i,e){this.text=i;this.metadata=e}};var rCt=class a{constructor(i=M.warning){this.icon=i}static from(i){if(i)return new a(i.icon)}},wQi=!0,kQi="ghost-text",X1=class extends C{constructor(e,t,o,n){super();this._editor=e;this._data=t;this._languageService=n;this._isDisposed=Le(this,!1);this._warningState=Ce(e=>{let t=this._data.read(e),o=t?.warning;if(!t||!o)return;let n=t.ghostText;return{lineNumber:n.lineNumber,position:new Ie(n.lineNumber,n.parts[0].column),icon:o.icon}});this._onDidClick=this._register(new E);this.onDidClick=this._onDidClick.event;this._nonWhitespaceCount=Ce(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=Ce(this,e=>{let t=this._extraClasses.slice();wQi&&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=Ce(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 fCe?n.columnRange:void 0,s=this._useSyntaxHighlighting.read(e),l=this._extraClassNames.read(e),{inlineTexts:c,additionalLines:u,hiddenRange:p,additionalLinesOriginalSuffix:h}=eBo(n,o,kQi+l),g=o.getLineContent(n.lineNumber),f=new Qc(c.map(O=>Hc.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 U=v?.[V+1]??Bc.createEmpty(O.content,this._languageService.languageIdCodec);if(V===u.length-1&&h){let $=z4e.fromLineTokens(o.tokenization.getLineTokens(h.lineNumber)).slice(h.columnRange.toZeroBasedOffsetRange());U=z4e.fromLineTokens(U).append($).toLineTokens(U.languageIdCodec)}return new mai(U,O.decorations)}),w=this._editor.getSelection()?.getStartPosition().column,k=S.filter(O=>O.text!==""),T=k.length!==0,N=new xle((T?k[0].column:1)-w,T?0:u.findIndex(O=>O.content!=="")+1,T?1:0,u.length+(T?1:0),0,Zve(k.map(O=>O.text.length))+Zve(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:N,handleInlineCompletionShown:t.handleInlineCompletionShown}});this._decorations=Ce(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 Ie(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 K4e(this)},showIfCollapsed:!0}})}return o});this.isHovered=Ce(this,e=>this._isDisposed.read(e)?!1:this._isInlineTextHovered.read(e)||this._additionalLinesWidget.isHovered.read(e));this.height=Ce(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??Oo(0),this._useSyntaxHighlighting=o.useSyntaxHighlighting??Oo(!0),this._highlightShortText=o.highlightShortSuggestions??!1,this._editorObs=os(this._editor),this._additionalLinesWidget=this._register(new pai(this._editor,hs({owner:this,equalsFn:aU(C6())},r=>{let s=this._state.read(r);return s?new uai(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 K4e&&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 K4e&&s.owner===this&&this._onDidClick.fire(r.event)}))),this._register(he(r=>{let s=this._state.read(r);s?.handleInlineCompletionShown(s.telemetryViewData)})),this._register(Ga((r,s)=>{if(wQi)return;let l=this._warningState.read(r);if(!l)return;let c=this._editorObs.getOption(75);s.add(this._editorObs.createContentWidget({position:Oo({position:new Ie(l.lineNumber,Number.MAX_SAFE_INTEGER),preference:[0],positionAffinity:1}),allowEditorOverflow:!1,domNode:Mo.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)}}},[Mo.div({class:"ghost-text-view-warning-widget-icon",style:{width:"100%",height:"100%",display:"flex",alignContent:"center",alignItems:"center"}},[Qo(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}};X1=I([m(3,kt)],X1);var K4e=class{constructor(i){this.owner=i}};function eBo(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 Jv(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 Jv(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 oCt(a.lineNumber,new _le(l+1,r.length+1)));let u=s!==void 0?new _le(s,r.length+1):void 0;return{inlineTexts:t,additionalLines:o,hiddenRange:u,additionalLinesOriginalSuffix:c}}var uai=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,C6())}},pai=class extends C{constructor(e,t,o,n){super();this._editor=e;this._lines=t;this._shouldKeepCursorStable=o;this._isClickable=n;this._viewZoneHeight=Le("viewZoneHeight",void 0),this.editorOptionsChanged=Nr("editorOptionChanged",H.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=os(this._editor).isTargetHovered(r=>CQi(r.target.element),this._store),this.hasBeenAccepted=!1,this._editor instanceof jr&&this._shouldKeepCursorStable&&this._register(this._editor.onBeforeExecuteEdit(r=>this.hasBeenAccepted=r.source==="inlineSuggestion.accept")),this._register(he(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();os(this._editor).transaction(s=>{this._editor.changeViewZones(l=>{let c=new P;this.removeActiveViewZone(l);let u=Math.max(t.length,o);if(u>0){let p=document.createElement("div");tBo(p,r,t,this._editor.getOptions(),this._isClickable),this._isClickable&&(c.add(j(p,"mousedown",h=>{h.preventDefault()})),c.add(j(p,"click",h=>{CQi(h.target)&&this._onDidClick.fire(new yn(Me(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 CQi(a){return Ao(a)&&a.classList.contains(kQi)}var mai=class{constructor(i,e){this.content=i;this.decorations=e}equals(i){return this.content.equals(i.content)?Jv.equalsArr(this.decorations,i.decorations):!1}};function tBo(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 ES(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=oU(k),N=yM(k);uW(new hL(u.isMonospace&&!n,u.canUseHalfwidthRightwardsArrow,k,!1,T,N,0,w,y.decorations.slice(),i,0,u.spaceWidth,u.middotWidth,u.wsmiddotWidth,r,s,l,c!==mx.OFF,null,null,0),g),g.appendString("</div>")}g.appendString("</div>"),Pd(a,u);let f=g.build(),v=xQi?xQi.createHTML(f):f;a.innerHTML=v}var xQi=Kg("editorGhostText",{createHTML:a=>a});var H7=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 bu=class a{constructor(i,e,t,o){this.left=i;this.top=e;this.right=t;this.bottom=o;if(i>t)throw new ni("Invalid arguments: Horizontally offset by "+(i-t));if(e>o)throw new ni("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 Uh(this.left,this.bottom)}getRightBottom(){return new Uh(this.right,this.bottom)}getLeftTop(){return new Uh(this.left,this.top)}getRightTop(){return new Uh(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 di(this.left,this.right)}getVerticalRange(){return new di(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 H7(this.width,this.height)}};var TCe=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)}},EQi=Kg("stickyScrollViewLayer",{createHTML:a=>a}),hai="data-sticky-line-index",TQi="data-sticky-is-line",iBo="data-sticky-is-line-number",_Qi="data-sticky-is-folding-icon",sCt=class extends C{constructor(e){super();this._foldingIconStore=this._register(new P);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 zc),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 Ie(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 gai(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=K$(t.characterMapping,e,0);return new Ie(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,hai);return t?parseInt(t,10):null}isInStickyLine(e){return this._getAttributeValue(e,TQi)!==void 0}isInFoldingIconDomNode(e){return this._getAttributeValue(e,_Qi)!==void 0}_getAttributeValue(e,t){for(;e&&e!==this._rootDomNode;){let o=e.getAttribute(t);if(o!==null)return o;e=e.parentElement}}},gai=class{constructor(i,e,t,o,n,r,s){this.index=r;this.lineNumber=s;let l=e.coordinatesConverter.convertModelPositionToViewPosition(new Ie(s,1)).lineNumber,c=e.getViewLineRenderingData(l),u=i.getOption(76),p=i.getOption(117).verticalScrollbarSize,h;try{h=Jv.filter(c.inlineDecorations,l,c.minColumn,c.maxColumn)}catch{h=[]}let g=i.getLineHeightForPosition(new Ie(s,1)),f=e.getTextDirection(s),v=new hL(!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 ES(2e3),S=uW(v,b);this.characterMapping=S.characterMapping;let y;EQi?y=EQi.createHTML(b.build()):y=b.build();let w=document.createElement("span");w.setAttribute(hai,String(r)),w.setAttribute(TQi,""),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(hai,String(r)),k.setAttribute(iBo,""),k.className="sticky-line-number",k.style.lineHeight=`${g}px`;let T=t.contentLeft;k.style.width=`${T}px`;let N=document.createElement("span");u.renderType===1||u.renderType===3&&s%10===0?N.innerText=s.toString():u.renderType===2&&(N.innerText=Math.abs(s-i.getPosition().lineNumber).toString()),N.className="sticky-line-number-inner",N.style.width=`${t.lineNumbersWidth}px`,N.style.paddingLeft=`${t.lineNumbersLeft}px`,k.appendChild(N),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 fai(p,c,s.getEndLineNumber(l),o);return h.setVisible(n?!0:p||r==="always"),h.domNode.setAttribute(_Qi,""),h}},fai=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?ule:dle)}setVisible(i){this.domNode.style.cursor=i?"pointer":"default",this.domNode.style.opacity=i?"1":"0"}};var rj=class{constructor(i,e){this.startLineNumber=i;this.endLineNumber=e}},Dle=class{constructor(i,e,t){this.range=i;this.children=e;this.parent=t}},G4e=class{constructor(i,e,t,o){this.uri=i;this.version=e;this.element=t;this.outlineProviderId=o}};var _Ce=class extends C{constructor(e,t,o,n){super();this._editor=e;this._modelProviders=[];this._modelPromise=null;this._updateScheduler=this._register(new jo(300));this._updateOperation=this._register(new P);switch(this._editor.getOption(131).defaultModel){case"outlineModel":this._modelProviders.push(new $4e(this._editor,n));case"foldingProviderModel":this._modelProviders.push(new j4e(this._editor,t,n));case"indentationModel":this._modelProviders.push(new q4e(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))}};_Ce=I([m(2,F),m(3,zt)],_Ce);var aCt=class extends C{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=xn(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}},$4e=class extends aCt{constructor(e,t){super(e);this._languageFeaturesService=t}createModelFromProvider(e){return fO.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 G4e(r.uri,r.getVersionId(),o,n)}isModelValid(e){return e&&e.children.size>0}_stickyModelFromOutlineModel(e,t){let o;if(ht.first(e.children.values())instanceof iw){let l=ht.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 rj(l.symbol.range.startLineNumber,l.symbol.range.endLineNumber),p=new rj(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 Dle(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 rj(e.symbol.selectionRange.startLineNumber,e.symbol.range.endLineNumber);return new Dle(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 _f?t+e.symbol.range.endLineNumber-e.symbol.selectionRange.startLineNumber:t}};$4e=I([m(1,zt)],$4e);var lCt=class extends aCt{constructor(i){super(i),this._foldingLimitReporter=this._register(new d4e(i))}createStickyModel(i,e){let t=this._fromFoldingRegions(e),o=this._editor.getModel();return new G4e(o.uri,o.getVersionId(),t,void 0)}isModelValid(i){return i!==null}_fromFoldingRegions(i){let e=i.length,t=[],o=new Dle(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 Dle(new rj(i.getStartLineNumber(n),i.getEndLineNumber(n)+1),[],s);s.children.push(l),t.push(l)}return o}},q4e=class extends lCt{constructor(e,t){super(e);this._languageConfigurationService=t;this.provider=this._register(new cle(e.getModel(),this._languageConfigurationService,this._foldingLimitReporter))}async createModelFromProvider(e){return this.provider.compute(e)}};q4e=I([m(1,bs)],q4e);var j4e=class extends lCt{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=Qg.getFoldingRangeProviders(this._languageFeaturesService,e.getModel());o.length!==0&&(this.provider.value=new ple(e.getModel(),o,t,this._foldingLimitReporter,void 0))}isProviderValid(){return this.provider!==void 0}async createModelFromProvider(e){return this.provider.value?.compute(e)??null}};j4e=I([m(2,zt)],j4e);var vai=class{constructor(i,e,t,o){this.startLineNumber=i;this.endLineNumber=e;this.top=t;this.height=o}},DCe=class extends C{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 P),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 _Ce(this._editor,()=>this._updateSoon.schedule(),this._languageConfigurationService,this._languageFeaturesService))}async update(){this._cts?.dispose(!0),this._cts=new $e,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(cx(u,e.startLineNumber,(g,f)=>g-f)),h=this.updateIndex(cx(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 Ie(v,1));o.push(new vai(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}};DCe=I([m(1,zt),m(2,bs)],DCe);var rb=class extends C{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 P;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 sCt(this._editor),this._stickyLineCandidateProvider=new DCe(this._editor,o,r),this._register(this._stickyScrollWidget),this._register(this._stickyLineCandidateProvider),this._widgetState=TCe.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(Me(c),p)})),this._stickyScrollFocusedContextKey=ue.stickyScrollFocused.bindTo(this._contextKeyService),this._stickyScrollVisibleContextKey=ue.stickyScrollVisible.bindTo(this._contextKeyService);let u=this._register(Vn(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(rb.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 P,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 P),t=this._register(new sO(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(Vo(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 Ie(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 Ie(u,1)}this._revealPosition(c)})),this._register(j(It,re.MOUSE_MOVE,r=>{this._mouseTarget=r.target,this._onMouseMoveOrKeyDown(r)})),this._register(j(It,re.KEY_DOWN,r=>{this._onMouseMoveOrKeyDown(r)})),this._register(j(It,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 $e;e.add(Z(()=>p.dispose(!0)));let h;U1(this._languageFeaturesService.definitionProvider,this._editor.getModel(),new Ie(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(jyt,r,this._editor,{uri:this._editor.getModel().uri,range:this._stickyRangeProjectedOnEditor})))}))}_onContextMenu(e,t){let o=new yn(e,t);this._contextMenuService.showContextMenu({menuId:D.StickyScrollContext,getAnchor:()=>o,menuActionOptions:{renderShortTitle:!0}})}_onMouseMoveOrKeyDown(e){if(!e.shiftKey||!this._mouseTarget||!Ao(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;c4e(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 Qg.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=TCe.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 rj(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 TCe(n,r,o,this._showEndForLine)}dispose(){super.dispose(),this._sessionStore.dispose()}};rb=I([m(1,ze),m(2,zt),m(3,F),m(4,bs),m(5,jg),m(6,X)],rb);var z7=J("inlineEdit.originalBackground",ei(Cf,.2),d(1392,null),!0),cCt=J("inlineEdit.modifiedBackground",ei(Hg,.3),d(1388,null),!0),CEs=J("inlineEdit.originalChangedLineBackground",ei(Cf,.8),d(1394,null),!0),DQi=J("inlineEdit.originalChangedTextBackground",ei(Cf,.8),d(1395,null),!0),LQi=J("inlineEdit.modifiedChangedLineBackground",{light:ei(F$e,.7),dark:ei(F$e,.7),hcDark:F$e,hcLight:F$e},d(1390,null),!0),RQi=J("inlineEdit.modifiedChangedTextBackground",ei(Hg,.7),d(1391,null),!0),K7=J("inlineEdit.gutterIndicator.primaryForeground",YT,d(1381,null)),SO=J("inlineEdit.gutterIndicator.primaryBorder",MS,d(1380,null)),J1=J("inlineEdit.gutterIndicator.primaryBackground",{light:ei(SO,.5),dark:ei(SO,.4),hcDark:ei(SO,.4),hcLight:ei(SO,.5)},d(1379,null)),MQi=J("inlineEdit.gutterIndicator.secondaryForeground",s9,d(1384,null)),PQi=J("inlineEdit.gutterIndicator.secondaryBorder",OU,d(1383,null)),LCe=J("inlineEdit.gutterIndicator.secondaryBackground",qT,d(1382,null)),AQi=J("inlineEdit.gutterIndicator.successfulForeground",YT,d(1387,null)),bai=J("inlineEdit.gutterIndicator.successfulBorder",MS,d(1386,null)),RCe=J("inlineEdit.gutterIndicator.successfulBackground",bai,d(1385,null)),NQi=J("inlineEdit.gutterIndicator.background",{hcDark:ei("tab.inactiveBackground",.5),hcLight:ei("tab.inactiveBackground",.5),dark:ei("tab.inactiveBackground",.5),light:"#5f5f5f18"},d(1378,null)),Q4e=J("inlineEdit.originalBorder",{light:Cf,dark:Cf,hcDark:Cf,hcLight:Cf},d(1393,null)),Y4e=J("inlineEdit.modifiedBorder",{light:Sp(Hg,.6),dark:Hg,hcDark:Hg,hcLight:Hg},d(1389,null)),oBo=J("inlineEdit.tabWillAcceptModifiedBorder",{light:Sp(Y4e,0),dark:Sp(Y4e,0),hcDark:Sp(Y4e,0),hcLight:Sp(Y4e,0)},d(1396,null)),nBo=J("inlineEdit.tabWillAcceptOriginalBorder",{light:Sp(Q4e,0),dark:Sp(Q4e,0),hcDark:Sp(Q4e,0),hcLight:Sp(Q4e,0)},d(1397,null));function sj(a){return a.map(i=>i==="accept"?oBo:Y4e)}function G7(a){return a.map(i=>i==="accept"?nBo:Q4e)}function sb(a,i){let e;typeof a=="string"?e=U7(a,i):e=a.map((o,n)=>U7(o,i).read(n));let t=U7(qo,i);return e.map((o,n)=>o.makeOpaque(t.read(n)))}function b_(a){let i;switch(a){case"textEditor":i=qo;break;case"diffEditor":i=qo;break;case"notebook":i="notebook.cellEditorBackground";break;default:Hr(a,"Not supported editor type yet")}return wt(i)}function U7(a,i){return ff({owner:{observeColor:a},equalsFn:(e,t)=>e.equals(t),debugName:()=>`observeColor(${a})`},i.onDidColorThemeChange,()=>{let e=i.getColorTheme().getColor(a);if(!e)throw new ni(`Missing color: ${a}`);return e})}var ab=3;function ZM(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 FQi(a,i,e){Nr(a,a.editor.onDidChangeLineHeight).read(e);let t=a.model.read(e);if(!t)throw new ni("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 Ie(n,1));o.push(new H7(r,s))}return o}function WQi(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 MCe(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=>yye(n.getLineContent(h))),l=e.filter(h=>h!=="").map(h=>yye(h)),c=Math.min(...r,...s,...l),u;if(n.getLineIndentColumn(i.startLineNumber)>=c+1)os(t).scrollTop.read(o),u=t.getOffsetForColumn(i.startLineNumber,c+1);else if(e.length>0)u=X4e(e[0].slice(0,c),t,n);else return{prefixTrim:0,prefixLeftOffset:0};return{prefixTrim:c,prefixLeftOffset:u}}function X4e(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 PCe(a){let i=a.layoutInfoContentLeft,e=Ce({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=Ce({name:"editor.validOverlay.height"},o=>a.layoutInfoHeight.read(o)+a.contentHeight.read(o));return Ce({name:"editor.validOverlay"},o=>bu.fromLeftTopWidthHeight(i.read(o),0,e.read(o),t.read(o)))}var OQi=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 VQi(a,i){let e=[];for(let t of a){let o=i.mapRange(t.modifiedRange);e.push(new cg(t.originalRange,o))}return e}function ACe(...a){return a.filter(i=>typeof i=="string").join(" ")}function rBo(a,i){return new z(i.lineNumber,i.column+a.start,i.lineNumber,i.column+a.endExclusive)}function sBo(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 aBo(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 ni("Unexpected character found while calculating indent length")}return o}function BQi(a,i,e){let t=mc(a),o=[],n=Put(i.mapToLineArray(r=>sBo(t[r-1],e)),qd);return i.forEach(r=>{let s=aBo(t[r-1],n,e);o.push(new Xr(rBo(new di(0,s),new Ie(r,1)),""))}),new bp(o)}var Rle=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 CE(a){let i=vf(void 0,(e,t)=>a.read(e)||t);return hs({debugName:()=>`${a.debugName}.mapOutFalsy`},e=>{if(i.read(e),!!a.read(e))return i})}function lb(a,i=Il.ofCaller()){return{left:Ce({name:"editor.validOverlay.left"},e=>a(e)?.left,i),top:Ce({name:"editor.validOverlay.top"},e=>a(e)?.top,i),width:Ce({name:"editor.validOverlay.width"},e=>{let t=a(e);if(t)return t.width},i),height:Ce({name:"editor.validOverlay.height"},e=>{let t=a(e);if(t)return t.height},i)}}function HQi(a,i){let e=a.getContainerDomNode(),t=Le("domRect",e.getBoundingClientRect());return i.add(a.onDidLayoutChange(o=>{t.set(e.getBoundingClientRect(),void 0)})),t}var NCe=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=Le("active",void 0),e=b=>({title:b.title,icon:b.icon,keybinding:typeof b.commandId=="string"?this._getKeybinding(b.commandArgs?void 0:b.commandId):Ce(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)=>aj(e({id:S.command.id+"_"+y,title:S.command.title,icon:S.icon??M.symbolEvent,commandId:S.command.id,commandArgs:S.command.arguments})))),o=[];for(let b of t)b.length>0&&(o.push(Sai()),o.push(...b));if(this._data.extensionCommandsOnly)return UQi(o.slice(1));let n=lBo(this._data.displayName),r=aj(e({id:"gotoAndAccept",title:d(1368,null),icon:M.check,commandId:E1})),s=aj(e({id:"reject",title:d(1369,null),icon:M.close,commandId:LIt})),l=this._data.alternativeAction?aj(e({id:"alternativeCommand",title:this._data.alternativeAction.command.title,icon:this._data.alternativeAction.icon,commandId:Kae})):void 0,u=!1?this._data.modelInfo?.models.map(b=>aj({title:b.name,icon:b.id===this._data.modelInfo?.currentModelId?M.check:M.circle,keybinding:Oo(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=>aj(e(b?{id:"showExpanded",title:d(1372,null),icon:M.expandAll,commandId:u5e}:{id:"showCollapsed",title:d(1371,null),icon:M.collapseAll,commandId:u5e}))),h=aj(e({id:"snooze",title:d(1373,null),icon:M.bellSlash,commandId:"editor.action.inlineSuggest.snooze"})),g=aj(e({id:"settings",title:d(1370,null),icon:M.gear,commandId:"workbench.action.openSettings",commandArgs:["@tag:nextEditSuggestions"]})),f=this._data.action?[this._data.action]:[],v=f.length>0?cBo(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:US}):void 0;return UQi([n,r,l,s,p,u.length?Sai():void 0,...u,h,g,...o,v?Sai():void 0,v])}_getKeybinding(i){return i?ui(this._contextKeyService.onDidChangeContext,()=>this._keybindingService.lookupKeybinding(i)):Oo(void 0)}};NCe=I([m(3,X),m(4,_e),m(5,ge)],NCe);function UQi(a){return Mo.div({class:"content",style:{margin:4,minWidth:180}},a)}function lBo(a){return Mo.div({class:"header",style:{color:wt(A$e),fontSize:"13px",fontWeight:"600",padding:"0 4px",lineHeight:28}},[a])}function aj(a){return Ce({name:"inlineEdits.option"},i=>Mo.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}},[Mo.elem("span",{style:{fontSize:16,display:"flex"}},[q.isThemeIcon(a.icon)?Qo(a.icon):a.icon.map(e=>Qo(e))]),Mo.elem("span",{},[a.title]),Mo.div({style:{marginLeft:"auto"},ref:e=>{let t=i.store.add(new ah(e,zo,{disableTitle:!0,...l_,keybindingLabelShadow:void 0,keybindingLabelForeground:wt(A$e),keybindingLabelBackground:"transparent",keybindingLabelBorder:"transparent",keybindingLabelBottomBorder:void 0}));i.store.add(he(o=>{t.set(a.keybinding.read(o))}))}})]))}function cBo(a,i){return Ce({name:"inlineEdits.actionBar"},e=>Mo.div({class:["action-widget-action-bar"],style:{padding:"3px 24px"}},[Mo.div({ref:t=>{e.store.add(new ji(t,i)).push(a,{icon:!1,label:!0})}})]))}function Sai(){return Mo.div({id:"inline-edit-gutter-indicator-menu-separator",class:"menu-separator",style:{color:wt(UGi),padding:"2px 0"}},Mo.div({style:{borderBottom:`1px solid ${wt(OU)}`}}))}var $7=class{constructor(i,e,t,o,n){this.gutterMenuData=i;this.originalRange=e;this.model=t;this.altAction=o;this.customization=n}},q7=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(1374,null),t.length>0?[t]:[],e,i.source.provider.modelInfo,i.source.provider.setModelId?.bind(i.source.provider))}},j7=class a{constructor(i,e){this.accept=i;this.jump=e}static fromInlineCompletionModel(i){return new a(()=>i.accept(),()=>i.jump())}},Iai=16,zQi=2,Z1=class extends C{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=Ce(this,e=>this._userInteractionService.readModifierKeyStatus(this._editorObs.editor.getDomNode(),e).shiftKey);this._gutterIndicatorStyles=Ce(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:sb(LCe,this._themeService).read(e).toString(),foreground:sb(MQi,this._themeService).read(e).toString(),border:sb(PQi,this._themeService).read(e).toString()};case"jump":return{background:sb(J1,this._themeService).read(e).toString(),foreground:sb(K7,this._themeService).read(e).toString(),border:sb(SO,this._themeService).read(e).toString()};case"accept":return{background:sb(RCe,this._themeService).read(e).toString(),foreground:sb(AQi,this._themeService).read(e).toString(),border:sb(bai,this._themeService).read(e).toString()};default:Hr(t)}});this._state=Ce(this,e=>{let t=this._originalRangeObs.read(e);if(t)return{range:t,lineOffsetRange:this._editorObs.observeLineOffsetRange(t,e.store)}});this._lineNumberToRender=Ce(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=Ce(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 ni("Could not find avilable width for icon")}});this._layout=Ce(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(de=>de.startLineNumber)).read(e),r=1,s=2,l=o.decorationsLeft+o.decorationsWidth-o.glyphMarginLeft-2*r,c=o.height-2*s,u=bu.fromLeftTopWidthHeight(r,s,l,c),p=u.withTop(this._stickyScrollHeight.read(e)),h=u.withTop(p.top+s),g=t.lineOffsetRange.read(e),f=bu.fromRanges(di.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?Oo(w):this._tabAction.map(de=>de==="accept"?M.keyboardTab:M.arrowRight),T=w?Oo(w):Ce(this,de=>{if(this._isHoveredOverIconDebounced.read(de)||this._isHoveredOverInlineEditDebounced.read(de))return M.check;if(this._tabAction.read(de)==="accept")return M.keyboardTab;let se=this._editorObs.cursorLineNumber.read(de)??0,Se=t.range.read(de).startLineNumber;return se<=Se?M.keyboardTabAbove:M.keyboardTabBelow}),N=22,O=de=>{let se=this._availableWidthForIcon.read(void 0)(de.bottom+this._editorObs.editor.getScrollTop())-r;return Math.max(Math.min(se,N),Iai)};if(y){let de=S,se;o.lineNumbersWidth===0?se=Math.min(Math.max(o.lineNumbersLeft-u.left,0),de.width-N):se=Math.max(o.lineNumbersLeft+o.lineNumbersWidth-u.left,0);let Se=de.withWidth(se),ke=Iai+zQi,Ee=Math.min(de.width-se,N),He=de.withWidth(Math.max(Ee,ke)).translateX(se),Ve=Ee>=ke;return{gutterEditArea:f,icon:T,iconDirection:"right",iconRect:He,iconVisible:Ve,pillRect:de,lineNumberRect:Se}}let V=u.intersect(f);if(V&&V.height>=v){let de=S.moveToBeContainedIn(h).moveToBeContainedIn(V),se=de.withWidth(O(de));return{gutterEditArea:f,icon:T,iconDirection:"right",iconRect:se,pillRect:se,iconVisible:!0}}let G=S.moveToBeContainedIn(u),$=G.withWidth(O(G)),te=$,pe=$.top<S.top?"top":"bottom";return{gutterEditArea:f,icon:k,iconDirection:pe,iconRect:te,pillRect:$,iconVisible:!0}});this._iconRef=Mo.ref();this.isVisible=this._layout.map(e=>!!e);this._hoverVisible=Le(this,!1);this.isHoverVisible=this._hoverVisible;this._isHoveredOverIcon=Le(this,!1);this._isHoveredOverIconDebounced=kM(this._isHoveredOverIcon,100);this.isHoveredOverIcon=this._isHoveredOverIconDebounced;this._indicator=Mo.div({class:"inline-edits-view-gutter-indicator",style:{position:"absolute",overflow:"visible"}},CE(this._layout).map(e=>e?[Mo.div({style:{position:"absolute",background:wt(NQi),borderRadius:`${ab}px`,...lb(t=>e.read(t).gutterEditArea)}}),Mo.div({class:"icon",ref:this._iconRef,tabIndex:0,onclick:()=>{let o=this._layout.get()?.icon.get()===M.check,n=this._data.get();if(!n)throw new ni("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:`${ab}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"),...lb(t=>e.read(t).pillRect)}},[Mo.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),Mo.div({style:{transform:e.map(t=>`rotate(${dBo(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?wt(t.customization.icon.color.id):void 0)}},[e.map((t,o)=>uBo(Qo(t.icon.read(o)),{fontSize:pBo(Math.min(t.iconRect.width-zQi,Iai))}))])])]:[]));this._originalRangeObs=CE(this._data.map(f=>f?.originalRange)),this._stickyScrollController=rb.get(this._editorObs.editor),this._stickyScrollHeight=this._stickyScrollController?ui(this._stickyScrollController.onDidChangeStickyScrollHeight,()=>this._stickyScrollController.stickyScrollWidgetHeight):Oo(0);let g=this._indicator.keepUpdated(this._store);this._register(this._editorObs.createOverlayWidget({domNode:g.element,position:Oo(null),allowEditorOverflow:!1,minContentWidthInPx:Oo(0)})),this._register(this._editorObs.editor.onMouseMove(f=>{if(this._state.get()===void 0)return;let S=this._iconRef.element.getBoundingClientRect(),y=bu.fromLeftTopWidthHeight(S.left,S.top,S.width,S.height),w=new Uh(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=kM(this._isHoveringOverInlineEdit,100),this._register(_s(this._isHoveredOverInlineEditDebounced,f=>{f&&this.triggerAnimation()})),this._register(he(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 ni("Gutter indicator data not available");let t=new P,o=t.add(this._instantiationService.createInstance(NCe,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(he(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()}};Z1=I([m(6,tt),m(7,F),m(8,Bi),m(9,De),m(10,eC)],Z1);function dBo(a){switch(a){case"top":return 90;case"bottom":return-90;case"right":return 0}}function uBo(a,i){for(let e in i)a.style[e]=i[e];return a}function pBo(a){return`${a}px`}var OCe=class extends C{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=Le({name:"setupDone"},!1);this._activeCompletionId=Ce(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 P,t=!1,o=!1,n=0,r=0;return e.add($9t(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 Pi(500);break}case"secondTime":{this._indicator.get()?.triggerAnimation();break}}})),e.add(he(s=>{this._collapsedView.isVisible.read(s)&&this.getNewUserType()!=="active"&&this._collapsedView.triggerAnimation()})),e.add(he(s=>{let l=this._indicator.read(s);l&&s.store.add(_s(l.isHoveredOverIcon,async c=>{c&&(t=!0)}))})),e.add(he(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 ni("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())})}};OCe=I([m(3,le),m(4,B)],OCe);var dCt=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 qU(ro.ofLength(this.action.position.lineNumber,0),[]):this.action?.kind==="edit"?qU.fromSingleTextEdit(this.edit.toReplacement(this.originalText),this.originalText):new qU(new ro(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(ro.ofLength(this.originalLineRange.startLineNumber,this.lineEdit.newLines.length)))}};var uCt=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=Ce(this,o=>eai(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(),Vw(()=>{this._model.handleInlineSuggestionShown(t,i,e,o),t.removeRef()})}};var FCe=class extends C{constructor(e,t,o){super();this._editor=e;this._edit=t;this._accessibilityService=o;this.onDidClick=H.None;this._iconRef=Mo.ref();this.isHovered=Oo(!1);this._editorObs=os(this._editor);let r=this._edit.map(u=>u?.edit?.replacements[0]??null).map(u=>u?XM(u,this._editor.getModel()).range.getStartPosition():null),s=this._editorObs.observePosition(r,this._store),l=Ce(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 Uh(h+p.x-g,p.y)}),c=Mo.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:Oo(null),allowEditorOverflow:!1,minContentWidthInPx:Oo(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 Mo.svg({class:"collapsedView",ref:this._iconRef,style:{position:"absolute",...lb(r=>PCe(this._editorObs).read(r)),overflow:"hidden",pointerEvents:"none"}},[Mo.svgElem("path",{class:"collapsedViewPath",d:n,fill:wt(SO)})])}createIconPath(e){return e.map(r=>{if(!r)return new Rle().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 Rle().moveTo(s).lineTo(l).lineTo(u).lineTo(p).lineTo(c).lineTo(s).build()})}};FCe=I([m(2,Bi)],FCe);var pCt=14,yai=0,lj=4,mCt=4,KQi=2,WCe=class extends C{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=Le(this,!1);this.isHovered=this._isHovered;this._viewRef=Mo.ref();this._editorObs=os(this._editor);let l=o.map((h,g)=>{let f;switch(h){case"inactive":f=LCe;break;case"jump":f=J1;break;case"accept":f=RCe;break}return{border:sb(f,r).read(g).toString(),background:b_(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=Ce(this,h=>{let g=c.read(h);return g?g.rect.read(h).bottom+this._editor.getScrollTop():0});let p=Mo.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:Oo(null),allowEditorOverflow:!1,minContentWidthInPx:vf(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)+lj-this._editorObs.layoutInfoContentLeft.read(h);return Math.max(g??0,v)}).recomputeInitiallyAndOnChange(this._store)})),this._register(he(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=ZM(this._editorObs,e,void 0),u=X4e(t,this._editor,this._editor.getModel()),p=lj+pCt;return c+u+p<n-r-s-l}getState(e){let t=Ce(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=ZM(this._editorObs,new ro(c,c+1),l),v=c+1<=g?ZM(this._editorObs,new ro(c+1,c+2),l):void 0,b=c-1>=1?ZM(this._editorObs,new ro(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 ro(o,n+1),e.content,void 0);return{rect:Ce(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+pCt-mCt-lj<g?w="below":h!==void 0&&h+pCt-mCt-lj<g?w="above":w="end";let k,T,N=0,O=0;switch(w){case"end":{k=this._editorObs.editor.getTopForLineNumber(o),T=u,N=lj+pCt;break}case"below":{k=this._editorObs.editor.getTopForLineNumber(o+1),T=g,N=lj+mCt,O=yai+KQi;break}case"above":{k=this._editorObs.editor.getTopForLineNumber(o-1),T=g,N=lj+mCt,O=-yai+KQi;break}}return bu.fromLeftTopWidthHeight(v+T-y,k-S,c*e.content.length,b).withMargin(yai,lj).translateX(N).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=aW.fromLineTokens(n).toLineTokens(e.label,this._languageService.languageIdCodec):r=Bc.createEmpty(e.label,this._languageService.languageIdCodec);let s=EL(new dE([r]),uE.fromEditor(this._editor).withSetWidth(!1).withScrollBeyondLastColumn(0),[],o,!0);o.style.width=`${s.minWidthInPx}px`;let l=e.rect.map(c=>c.withMargin(0,lj));return Mo.div({class:"collapsedView",ref:this._viewRef,style:{position:"absolute",...lb(c=>l.read(c)),overflow:"hidden",boxSizing:"border-box",cursor:"pointer",border:t.map(c=>`1px solid ${c.border}`),borderRadius:`${ab}px`,backgroundColor:t.map(c=>c.background),display:"flex",alignItems:"center",justifyContent:"center",whiteSpace:"nowrap"},onmousedown:c=>{c.preventDefault()},onclick:c=>{this._onDidClick.fire(WL.create(c))}},[o])}};WCe=I([m(4,De),m(5,kt)],WCe);var hBo=0,gBo=0,wai=1,fBo=1,vBo=3,Cai=ab,hCt=class extends C{constructor(e,t,o,n){super();this._editor=e;this._edit=t;this._uiState=o;this._tabAction=n;this.onDidClick=H.None;this._display=Ce(this,e=>this._uiState.read(e)?"block":"none");this._editorMaxContentWidthInRange=Ce(this,e=>{let t=this._originalDisplayRange.read(e);return t?(this._editorObs.versionId.read(e),vf(this,(o,n)=>{let r=ZM(this._editorObs,t,o);return Math.max(r,n??0)})):Oo(0)}).map((e,t)=>e.read(t));this._maxPrefixTrim=Ce(this,e=>{let t=this._uiState.read(e);return t?MCe(t.deletions,t.originalRange,[],this._editor):{prefixTrim:0,prefixLeftOffset:0}});this._editorLayoutInfo=Ce(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:bu.fromLeftTopRightBottom(h,u,l,p).withMargin(gBo,hBo),contentLeft:n.contentLeft}}).recomputeInitiallyAndOnChange(this._store);this._originalOverlay=Mo.div({style:{pointerEvents:"none"}},Ce(this,e=>{let t=CE(this._editorLayoutInfo).read(e);if(!t)return;let o=t.map(c=>bu.fromLeftTopRightBottom(c.contentLeft-Cai-wai,c.codeRect.top,c.contentLeft,c.codeRect.bottom)),n=Ce(this,c=>{let u=t.read(c).codeRect,p=o.read(c);return u.intersectHorizontal(new di(p.left,Number.MAX_SAFE_INTEGER))}),r=this._uiState.map(c=>c?.editorType==="diffEditor"?vBo:fBo).read(e),s=n.map(c=>c.withMargin(r,r)),l=b_(this._uiState.map(c=>c?.editorType??"textEditor").read(e));return[Mo.div({class:"originalSeparatorDeletion",style:{...s.read(e).toStyles(),borderRadius:`${Cai}px`,border:`${wai+r}px solid ${l}`,boxSizing:"border-box"}}),Mo.div({class:"originalOverlayDeletion",style:{...n.read(e).toStyles(),borderRadius:`${Cai}px`,border:G7(this._tabAction).map(c=>`${wai}px solid ${wt(c)}`),boxSizing:"border-box",backgroundColor:wt(z7)}}),Mo.div({class:"originalOverlayHiderDeletion",style:{...o.read(e).toStyles(),backgroundColor:l}})]})).keepUpdated(this._store);this._nonOverflowView=Mo.div({class:"inline-edits-view",style:{position:"absolute",overflow:"visible",top:"0px",left:"0px",display:this._display}},[[this._originalOverlay]]).keepUpdated(this._store);this.isHovered=Oo(!1);this._editorObs=os(this._editor);let r=Ce(this,l=>{let c=this._edit.read(l);return c?new Ie(c.originalLineRange.startLineNumber,1):null}),s=Ce(this,l=>{let c=this._edit.read(l);return c?new Ie(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:Oo(null),allowEditorOverflow:!1,minContentWidthInPx:Ce(this,l=>{let c=this._editorLayoutInfo.read(l);return c===null?0:c.codeRect.width})}))}};var J4e=1,bBo=1,SBo=3,xai=ab,VCe=class extends C{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=Ce(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=Ce(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 Ie(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=Ce(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 ro(t.lineNumber,t.lineNumber+(r.linesTop>0?0:1));return MCe([],c,l,this._editor)});this._ghostText=Ce(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 Zk(new z(u+1,u===0?1:o.prefixTrim+1,u+1,c.length+1),"modified-background",0));return new $1(t.lineNumber,[new W7(t.column,t.text,!1,l)])});this._display=Ce(this,e=>this._state.read(e)?"block":"none");this._editorMaxContentWidthInRange=Ce(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=uE.fromEditor(this._editor).withSetWidth(!1).withScrollBeyondLastColumn(0),p=c.map(h=>{let g=o.tokenization.tokenizeLinesAt(t.lineNumber,[h])?.[0],f;return g?f=aW.fromLineTokens(g).toLineTokens(h,this._languageService.languageIdCodec):f=Bc.createEmpty(h,this._languageService.languageIdCodec),EL(new dE([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 ro(e.lineNumber,Math.min(e.lineNumber+2,this._editor.getModel().getLineCount()+1)):void 0);this._overlayLayout=Ce(this,e=>{this._ghostText.read(e);let t=this._state.read(e);if(!t)return null;this._editorObs.observePosition(Le(this,new Ie(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 bu(c,f,s,v);return{overlay:b,startsAtContentLeft:l===0,contentLeft:o.contentLeft,minContentWidthRequired:l+b.width+r}}).recomputeInitiallyAndOnChange(this._store);this._modifiedOverlay=Mo.div({style:{pointerEvents:"none"}},Ce(this,e=>{let t=CE(this._overlayLayout).read(e);if(!t)return;let o=t.map(c=>bu.fromLeftTopRightBottom(c.contentLeft-xai-J4e,c.overlay.top,c.contentLeft,c.overlay.bottom)).read(e),n=this._input.map(c=>c?.editorType==="diffEditor"?SBo:bBo).read(e),r=t.map(c=>c.overlay.withMargin(0,J4e,0,c.startsAtContentLeft?0:J4e).intersectHorizontal(new di(o.left,Number.MAX_SAFE_INTEGER))),s=r.map(c=>c.withMargin(n,n)),l=b_(this._input.read(void 0)?.editorType??"textEditor");return[Mo.div({class:"originalUnderlayInsertion",style:{...s.read(e).toStyles(),borderRadius:xai,border:`${J4e+n}px solid ${l}`,boxSizing:"border-box"}}),Mo.div({class:"originalOverlayInsertion",style:{...r.read(e).toStyles(),borderRadius:xai,border:sj(this._tabAction).map(c=>`${J4e}px solid ${wt(c)}`),boxSizing:"border-box",backgroundColor:wt(cCt)}}),Mo.div({class:"originalOverlayHiderInsertion",style:{...o.toStyles(),backgroundColor:l}})]})).keepUpdated(this._store);this._view=Mo.div({class:"inline-edits-view",style:{position:"absolute",overflow:"visible",top:"0px",left:"0px",display:this._display}},[[this._modifiedOverlay]]).keepUpdated(this._store);this._editorObs=os(this._editor),this._ghostTextView=this._register(n.createInstance(X1,this._editor,Ce(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 WL(s))})),this._register(this._editorObs.createOverlayWidget({domNode:this._view.element,position:Oo(null),allowEditorOverflow:!1,minContentWidthInPx:Ce(this,s=>{let l=this._overlayLayout.read(s);return l===null?0:l.minContentWidthRequired})}))}};VCe=I([m(3,F),m(4,kt)],VCe);var BCe=class extends C{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?MCe(l.replacements.flatMap(u=>[u.originalRange,u.modifiedRange]),l.originalRange,l.modifiedLines,this._editor.editor,c):void 0),this._modifiedLineElements=Ce(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=IBo(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],N;T?N=aW.fromLineTokens(T).toLineTokens(k,this._languageService.languageIdCodec):N=Bc.createEmpty(k,this._languageService.languageIdCodec);let O=[];for(let U of f.filter(G=>G.startLineNumber===w)){let G=Math.min(U.endColumn,k.length+1);O.push(new Zk(new z(1,U.startColumn,1,G),"inlineCompletions-modified-bubble",0))}let V=EL(new dE([N]),uE.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=Ce(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 ke=f.slice(0,p.modifiedRange.length);for(;ke.length<p.modifiedRange.length;)ke.push(f[f.length-1]);return ke})(),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(),N=p.originalRange.mapToLineArray(ke=>this._editor.editor.getOffsetForColumn(ke,T.getLineMaxColumn(ke))-h),O=Math.max(...N,g),V=p.originalRange.startLineNumber,U=p.originalRange.endLineNumberExclusive-1,G=this._editor.editor.getTopForLineNumber(V)-w,$=this._editor.editor.getBottomForLineNumber(U)-w,te=bu.fromLeftTopWidthHeight(k+h,G,O,$-G),pe=bu.fromLeftTopWidthHeight(te.left,te.bottom,te.width,v.reduce((ke,Ee)=>ke+Ee,0)),de=bu.hull([te,pe]),se=de.intersectVertical(new di(te.bottom,Number.MAX_SAFE_INTEGER)),Se=new bu(se.left,se.top,se.right,se.bottom);return{originalLinesOverlay:te,modifiedLinesOverlay:pe,background:de,lowerBackground:se,lowerText:Se,modifiedLineHeights:v,minContentWidthRequired:h+O+S}}),this._viewZoneInfo=Ce(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=Ce(this,l=>{let c=CE(this._layout).read(l);return!c||this._viewZoneInfo.read(l)!==void 0?0:c.read(l).lowerText.bottom+this._editor.editor.getScrollTop()}),this._div=Mo.div({class:"line-replacement"},[Ce(this,l=>{let c=CE(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=sj(this._tabAction).read(l),v=G7(this._tabAction).read(l),b=b_(this._editorType.read(l));return[Mo.div({style:{position:"absolute",...lb(S=>PCe(this._editor).read(S)),overflow:"hidden",pointerEvents:"none"}},[Mo.div({class:"borderAroundLineReplacement",style:{position:"absolute",...lb(S=>c.read(S).background.translateX(-h).withMargin(g)),borderRadius:`${ab}px`,border:`${g+1}px solid ${b}`,boxSizing:"border-box",pointerEvents:"none"}}),Mo.div({class:"originalOverlayLineReplacement",style:{position:"absolute",...lb(S=>c.read(S).background.translateX(-h)),borderRadius:`${ab}px`,border:sb(v,this._themeService).map(S=>`1px solid ${S.toString()}`),pointerEvents:"none",boxSizing:"border-box",background:wt(z7)}}),Mo.div({class:"modifiedOverlayLineReplacement",style:{position:"absolute",...lb(S=>c.read(S).lowerBackground.translateX(-h)),borderRadius:`0 0 ${ab}px ${ab}px`,background:b,boxShadow:`${wt(PU)} 0 6px 6px -6px`,border:`1px solid ${wt(f)}`,boxSizing:"border-box",overflow:"hidden",cursor:"pointer",pointerEvents:"auto"},onmousedown:S=>{S.preventDefault()},onclick:S=>this._onDidClick.fire(WL.create(S))},[Mo.div({style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",background:wt(LQi)}})]),Mo.div({class:"modifiedLinesLineReplacement",style:{position:"absolute",boxSizing:"border-box",...lb(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 ${ab}px ${ab}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(Mre(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:Ce(this,l=>this._layout.read(l)?.minContentWidthRequired??0),position:Oo({preference:{top:0,left:0}}),allowEditorOverflow:!1}))}_isMouseOverWidget(e){let t=this._layout.get();return!t||!(e.event instanceof mL)?!1:t.lowerBackground.containsPoint(new Uh(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)}};BCe=I([m(4,kt),m(5,De)],BCe);function IBo(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 yBo(a,i){a.$$visualization=i}function Z4e(a,i){if(Array.isArray(a)){let e={};a.forEach((t,o)=>{e[o.toString()]=t}),a=e}return yBo(a,new kai(a,i)),a}var kai=class{constructor(i,e){this._rects=i;this._elem=e}visualize(){let i=[];for(let e in this._rects){let t=new Eai(this._rects[e],this._elem,e);i.push(t.visualize())}return{dispose:()=>{i.forEach(e=>e.dispose())}}}};var Eai=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 e3e(a,i){if(typeof a=="object"&&a&&"$$visualization"in a){let e=a.$$visualization;wBo(e.visualize(),i)}}function wBo(a,i){Ce({name:"debugReadDisposable"},e=>{e.store.add(a)}).read(i)}function GQi(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 Q7=class extends C{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=Ce(this,e=>({background:sb(J1,this._themeService).read(e).toString(),foreground:sb(K7,this._themeService).read(e).toString(),border:sb(SO,this._themeService).read(e).toString()}));this._pos=Ce(this,e=>this._editor.observePosition(Ce(t=>this._data.read(t)?.jumpToPosition||null),e.store)).flatten();this._layout=Ce(this,e=>{let t=this._data.read(e);if(!t)return;let o=t.jumpToPosition,n=this._editor.observeLineHeightForLine(Oo(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:bu.fromLeftTopWidthHeight(s.x+l.contentLeft+2-r,s.y,100,n)}});this._blink=CBo([{value:!0,durationMs:600},{value:!1,durationMs:600}]);this._widget=Mo.div({class:"inline-edit-jump-to-widget",style:{position:"absolute",display:this._layout.map(e=>e?"flex":"none"),alignItems:"center",cursor:"pointer",userSelect:"none",...lb(e=>this._layout.read(e)?.widgetRect)}},Ce(e=>this._data.read(e)===void 0?[]:Mo.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"?Mo.elem("div",{style:{borderLeft:"2px solid",height:14,opacity:this._blink.map(t=>t?"0":"1")}}):[Ce(()=>Mo.elem("div",{},xBo(this._keybinding))),Mo.elem("div",{style:{lineHeight:this._layout.map(t=>t?.widgetRect.height),marginTop:"-2px"}},["to jump"])]])));this._style=t.style,this._keybinding=this._getKeybinding(E1);let l=this._widget.keepUpdated(this._store);this._register(this._editor.createOverlayWidget({domNode:l.element,position:Oo(null),allowEditorOverflow:!1,minContentWidthInPx:Oo(0)})),this._register(this._editor.setDecorations(Ce(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=Il.ofCaller()){return e?ui(this,this._contextKeyService.onDidChangeContext,()=>this._keybindingService.lookupKeybinding(e),t):Oo(void 0)}};Q7=I([m(3,De),m(4,_e),m(5,X)],Q7);function CBo(a,i=Il.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 xBo(a){return Ce(i=>Mo.div({style:{},ref:e=>{let t=i.store.add(new ah(e,zo,{disableTitle:!0,...l_,keybindingLabelShadow:void 0,keybindingLabelForeground:wt(K7),keybindingLabelBackground:"transparent",keybindingLabelBorder:wt(K7),keybindingLabelBottomBorder:void 0}));i.store.add(he(o=>{t.set(a.read(o))}))}}))}var HCe=class extends C{constructor(e,t,o,n,r){super();this._previewTextModel=e;this._properties=t;this._parentEditor=o;this._tabAction=n;this._instantiationService=r;this._previewRef=Mo.ref();this.element=Mo.div({class:"preview",style:{},ref:this._previewRef});this._state=Ce(this,e=>{let t=this._properties.read(e);if(!t)return;let o,n;t.nextCursorPosition!==null?(o="original",n=ro.ofLength(t.nextCursorPosition.lineNumber,1)):t.diff[0].innerChanges?.every(s=>s.modifiedRange.isEmpty())?(o="original",n=ro.ofLength(t.diff[0].original.startLineNumber,1)):(o="modified",n=ro.ofLength(t.diff[0].modified.startLineNumber,1));let r=o==="modified"?j1.snapshot(this._previewTextModel):t.target;return{mode:o,visibleLineRange:n,textModel:r,diff:t.diff}});this.updatePreviewEditorEffect=Ce(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=Ce(this,e=>this._getHorizontalContentRangeInPreviewEditorToShow(this.previewEditor,e));this.contentHeight=Ce(this,e=>{let t=this._state.read(e);return t?this._previewEditorObs.observeLineHeightForLine(t.visibleLineRange.startLineNumber):Oo(null)}).flatten();this._editorDecorations=Ce(this,e=>{let t=this._state.read(e);if(!t)return;let o={mode:"insertionInline",diff:t.diff},n=[],r=[],s=po.register({className:"inlineCompletions-char-delete",description:"char-delete",isWholeLine:!1,zIndex:1}),l=po.register({className:"inlineCompletions-char-insert",description:"char-insert",isWholeLine:!0}),c=po.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:ACe("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=os(this._parentEditor),this._register(he(l=>{let c=this._state.read(l)?.textModel||null;c&&this.previewEditor.setModel(c.dangerouslyGetUnderlyingModel())})),this._previewEditorObs=os(this.previewEditor),this._register(this._previewEditorObs.setDecorations(Ce(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(Q7,this._previewEditorObs,{style:"cursor"},Ce(l=>{let c=this._properties.read(l);if(!(!c||!c.nextCursorPosition))return{jumpToPosition:c.nextCursorPosition}}))),this._register(he(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(he(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(Z1,this._previewEditorObs,Ce(l=>{let c=this._state.read(l);if(!c)return;let u=this._properties.read(l);if(u)return new $7(u.inlineSuggestInfo,ro.ofLength(c.visibleLineRange.startLineNumber,1),u.model,void 0)}),this._tabAction,Oo(0),Oo(!1),Le(this,!1))),this.updatePreviewEditorEffect.recomputeInitiallyAndOnChange(this._store)}_createPreviewEditor(){return this._instantiationService.createInstance(zc,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:{[ka.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=ZM(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=kBo(e.getModel(),u,5),h=this._previewEditorObs.getLeftOfPosition(p.getStartPosition(),t),g=this._previewEditorObs.getLeftOfPosition(p.getEndPosition(),t),f=Kn(h,0,c),v=Kn(g,f,c),b=e.getModel().getLineFirstNonWhitespaceColumn(p.startLineNumber),S=this._previewEditorObs.getLeftOfPosition(new Ie(p.startLineNumber,b),t),y=new di(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)}};HCe=I([m(4,F)],HCe);function kBo(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 $Qi(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 t3e=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 H7(Math.max(0,e-o.width-s),o.height)}),this.availableSpaceHeightPrefixSums=TBo(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=di.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 EBo(this._lineRangeInfo.lineRange.addMargin(-1,-1),i,n=>{let r=this.getWidgetVerticalOutline(n,e,o),s=$Qi(r.delta(-this._lineRangeInfo.top),this.availableSpaceSizesTransposed);return s<o.minWidgetWidth?void 0:{horizontalWidgetRange:di.ofStartAndLength(t-s,s),verticalWidgetRange:r}})}};function qQi(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:ro.ofLength(r,u-r),top:s,sizes:l}),r=u,s=h,l=[]),l.push(i[c])}return n.push({lineRange:ro.ofLength(r,a.endLineNumberExclusive-r),top:s,sizes:l}),Ce({owner:"splitIntoContinuousLineRanges"},c=>t.observeTopForLineNumber(a.endLineNumberExclusive-1).read(c)).read(o),n}function EBo(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 TBo(a,i){let e=[0],t=0;for(let o of a)t+=i(o),e.push(t);return e}var _Bo=6,Tai={EMPTY_SPACE:425,OVERLAY:375},DBo=250,LBo={previewEditorMargin:2,widgetPadding:2,widgetBorder:1,lowerBarHeight:20,minWidgetWidth:DBo},UCe=class extends C{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=H.None;this._viewWithElement=void 0;this._hintTextPosition=Ce(this,e=>{let t=this._viewState.read(e);return t?new Ie(t.hint.lineNumber,Number.MAX_SAFE_INTEGER):null});this._lineSizesAroundHintPosition=Ce(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=ro.ofLength(o.lineNumber,1).addMargin(5,5).intersect(ro.ofLength(1,n.getLineCount()));if(!r)return[];let s=FQi(this._editorObs,r,e),l=this._editorObs.observeTopForLineNumber(r.startLineNumber).read(e);return qQi(r,s,l,this._editorObs,e)});this._isVisibleDelayed=B9t(Ce(this,e=>this._viewState.read(e)?.hint.isVisible),(e,t)=>e===!0&&t===!1?200:0);this._previewEditorLayoutInfo=Ce(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=LBo,v=l+2,b,S,y=Ze=>Ze===t.hint.lineNumber?40:20;for(let Ze of o){let Ti=new t3e(Ze,u,y);if(S=Ti,!1){let bo=MBo(new Uh(p,Ze.top-n),Ti.availableSpaceSizes,"right");e3e(Z4e({...bo},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 Ze=Math.min(s.width-s.contentLeft,Tai.OVERLAY),Ti=S??new t3e(o[0],u,y);b={horizontalWidgetRange:di.ofStartAndLength(p-Ze,Ze),verticalWidgetRange:Ti.getWidgetVerticalOutline(t.hint.lineNumber+2,v,g).delta(10)}}if(!b)return;let k=bu.fromRanges(b.horizontalWidgetRange,b.verticalWidgetRange).translateX(-r).translateY(-n);!1&&e3e(Z4e({rectAvailableSpace:k},this._editor.getDomNode()),e);let{previewEditorMargin:N,widgetPadding:O,widgetBorder:V,lowerBarHeight:U}=g,G=Math.min(w==="overlay"?Tai.OVERLAY:Tai.EMPTY_SPACE,c.maxEditorWidth+N+O),$=GQi(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 te=RBo([$.spaceBefore,$.content,$.spaceAfter],k.left),pe=k.withHorizontalRange(te[0]),de=k.withHorizontalRange(te[1]),se=k.withHorizontalRange(te[2]);!1&&e3e(Z4e({spaceBeforeRect:pe,widgetRect:de,spaceAfterRect:se},this._editor.getDomNode()),e);let ke=de.withMargin(-O-V-N).withMargin(0,0,-U,0);!1&&e3e(Z4e({previewEditorRect:ke},this._editor.getDomNode()),e);let He=ke.width-c.nonContentWidth,Ve=He*.8,Fe=c.preferredRangeToReveal.intersect(di.ofStartAndLength(c.preferredRangeToReveal.start,Ve))??c.preferredRangeToReveal,Qt=PBo(c.indentationEnd,He,Fe);return{codeEditorSize:ke.getSize(),codeScrollLeft:r,contentLeft:s.contentLeft,widgetRect:de,previewEditorMargin:N,widgetPadding:O,widgetBorder:V,lowerBarHeight:U,desiredPreviewEditorScrollLeft:Qt.newScrollPosition}});this._view=Mo.div({class:"inline-edits-view",style:{position:"absolute",overflow:"visible",top:"0px",left:"0px",display:Ce(this,e=>this._previewEditorLayoutInfo.read(e)?"block":"none")}},[Ce(this,e=>[this._widgetContent])]);this._widgetContent=Ce(this,e=>Mo.div({class:["inline-edits-long-distance-hint-widget","show-file-icons"],style:{position:"absolute",overflow:"hidden",cursor:"pointer",background:wt(gm),padding:this._previewEditorLayoutInfo.map(t=>t?.widgetPadding),boxSizing:"border-box",borderRadius:_Bo,border:Ce(t=>`${this._previewEditorLayoutInfo.read(t)?.widgetBorder}px solid ${this._styles.read(t).border}`),display:"flex",flexDirection:"column",opacity:Ce(t=>this._viewState.read(t)?.hint.isVisible?"1":"0"),transition:"opacity 200ms ease-in-out",...lb(t=>this._previewEditorLayoutInfo.read(t)?.widgetRect)},onmousedown:t=>{t.preventDefault()},onclick:()=>{this._viewState.read(void 0)?.model.jump()}},[Mo.div({class:["editorContainer"],style:{overflow:"hidden",padding:this._previewEditorLayoutInfo.map(t=>t?.previewEditorMargin),background:this._styles.map(t=>t.background),pointerEvents:"none"}},[Ce(this,t=>this._previewEditor.element)]),Mo.div({class:"bar",style:{color:wt(A$e),pointerEvents:"none",margin:"0 4px",height:this._previewEditorLayoutInfo.map(t=>t?.lowerBarHeight),display:"flex",justifyContent:"space-between",alignItems:"center"}},[Ce(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=Ye(s),f=js(this._modelService,this._languageService,s,0);o.push(Mo.div({class:"target-file",style:{display:"flex",alignItems:"center",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},[Mo.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=sh.toIcon(y.kind);b.push(Mo.div({class:"breadcrumb-item",style:{display:"flex",alignItems:"center",flex:"1 1 auto",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}},[Qo(w),"\xA0",y.name,...S===v.length-1?[]:[Qo(M.chevronRight)]]))}o.push(Mo.div({class:"outline-elements",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},b))}let c=this._originalTargetLineNumber.read(t),u=l?M.arrowRight:n.hint.lineNumber<c?M.arrowDown:M.arrowUp,p=this._keybindingService.lookupKeybinding(DIt),h=l?"Go to file":"Go to suggestion";return p&&p.getLabel()==="Tab"&&(h=l?"Tab to open":"Tab to jump"),o.push(Mo.div({class:"go-to-label",style:{position:"relative",display:"flex",alignItems:"center",flex:"0 0 auto",paddingLeft:"6px"}},[h,"\xA0",Qo(u)])),o})])]));this._originalTargetLineNumber=Ce(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=RI(this,e=>{let t=this._editorObs.model.read(e),o=tO._breadcrumbsSourceFactory.read(e);return!t||!o?void 0:o(t,this._instantiationService)});this._styles=Ce(p=>{let h=this._tabAction.read(p),g=U7(DN,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=LCe;break;case"jump":b=J1;break;case"accept":b=RCe;break}v=sb(b,this._themeService).read(p)}return{border:v.toString(),background:b_(this._viewState.map(b=>b?.editorType??"textEditor").read(p))}}),this._editorObs=os(this._editor),this._previewEditor=this._register(this._instantiationService.createInstance(HCe,this._previewTextModel,Ce(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:Oo(null),allowEditorOverflow:!1,minContentWidthInPx:Oo(0)})),this._widgetContent.get().keepUpdated(this._store),this._register(he(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}};UCe=I([m(4,F),m(5,De),m(6,_e),m(7,Ct),m(8,kt)],UCe);function RBo(a,i=0){let e=[],t=i;for(let o of a)e.push(new di(t,t+o)),t+=o;return e}function MBo(a,i,e="left"){let t=[],o=0;for(let n of i)t.push(bu.fromLeftTopWidthHeight(a.x+(e==="left"?0:-n.width),a.y+o,n.width,n.height)),o+=n.height;return t}function PBo(a,i,e){let t=new di(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 zCe=0,i3e=0,ABo=!1,UW=1,NBo=1,OBo=3,cj=ab,_ai=20,jQi=12,Mle=class extends C{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=os(this._editor),this._display=Ce(this,h=>this._uiState.read(h)?"block":"none"),this.previewRef=Mo.ref();let u=this._uiState.map(h=>h?.editorType==="diffEditor"?OBo:NBo);this._editorContainer=Mo.div({class:["editorContainer"],style:{position:"absolute",overflow:"hidden",cursor:"pointer"},onmousedown:h=>{h.preventDefault()},onclick:h=>{this._onDidClick.fire(WL.create(h))}},[Mo.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(zc,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:{[ka.inInlineEditsPreviewEditor.key]:!0},contributions:[]},this._editor)),this._previewEditorObs=os(this.previewEditor),this._activeViewZones=[],this._updatePreviewEditor=Ce(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=Ce(this,h=>{let g=this._edit.read(h);return g?(this._updatePreviewEditor.read(h),ZM(this._previewEditorObs,g.modifiedLineRange,h)):0}),this._cursorPosIfTouchesEdit=Ce(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=Ce(this,h=>{let g=this._edit.read(h);return g?new Ie(g.originalLineRange.startLineNumber,1):null}),this._originalEndPosition=Ce(this,h=>{let g=this._edit.read(h);return g?new Ie(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=Ce(this,h=>{let g=this._originalDisplayRange.read(h);return g?(this._editorObs.versionId.read(h),vf(this,(f,v)=>{let b=ZM(this._editorObs,g,f);return Math.max(b,v??0)})):Oo(0)}).map((h,g)=>h.read(g));let p=HQi(this._editor,this._store);this._previewEditorLayoutInfo=Ce(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),N=y.contentLeft+y.contentWidth+T.left,O=Me(this._editor.getContainerDomNode()).innerWidth-N,V=Me(this._editor.getContainerDomNode()).innerWidth-T.right,U=Math.min(y.contentWidth*.3,w,100),G=0,$=G+O,te=this._cursorPosIfTouchesEdit.read(h),pe=Math.max(k+b-G-Math.max(0,U-$),Math.min(te?WQi(this._editorObs,te,h)+50:0,k+b)),de=Math.min(S+_ai,pe),se=S+_ai+w+70,Se=pe-de,ke,Ee;de>b?(ke=0,Ee=y.contentLeft+de-b):(ke=b-de,Ee=y.contentLeft);let He=this._originalVerticalStartPosition.read(h)??this._editor.getTopForLineNumber(v.startLineNumber)-this._editorObs.scrollTop.read(h),Ve=this._originalVerticalEndPosition.read(h)??this._editor.getBottomForLineNumber(v.endLineNumberExclusive-1)-this._editorObs.scrollTop.read(h),Fe=y.contentLeft-b,Qt=bu.fromLeftTopRightBottom(Fe,He,Ee,Ve),Ze=Qt.height===0;Ze||(Qt=Qt.withMargin(i3e,zCe));let ti=this._previewEditorObs.observeLineHeightsForLineRange(g.modifiedLineRange).read(h).reduce((Ws,ba)=>Ws+ba,0),bo=Ve-He,Ro=Math.max(bo,ti),_o=Se===0,sr=0,ln=Math.min(w+jQi,V+y.width-y.contentLeft-sr),en=bu.fromLeftTopWidthHeight(Qt.right+sr,He,ln,Ro);return Ze?en=en.withMargin(i3e,zCe).translateY(i3e):en=en.withMargin(i3e,zCe).translateX(zCe+UW),{codeRect:Qt,editRect:en,codeScrollLeft:b,contentLeft:y.contentLeft,isInsertion:Ze,maxContentWidth:se,shouldShowShadow:_o,desiredPreviewEditorScrollLeft:ke,previewEditorWidth:ln}}),this._stickyScrollController=rb.get(this._editorObs.editor),this._stickyScrollHeight=this._stickyScrollController?ui(this._stickyScrollController.onDidChangeStickyScrollHeight,()=>this._stickyScrollController.stickyScrollWidgetHeight):Oo(0),this._shouldOverflow=Ce(this,h=>{if(!ABo)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(z7)??Oe.transparent),this._editorBackgroundColor=this._uiState.map(h=>b_(h?.editorType??"textEditor")),this._backgroundSvg=Mo.svg({transform:"translate(-0.5 -0.5)",style:{overflow:"visible",pointerEvents:"none",position:"absolute"}},[Mo.svgElem("path",{class:"rightOfModifiedBackgroundCoverUp",d:Ce(this,h=>{let g=this._previewEditorLayoutInfo.read(h);if(!(!g||this._originalBackgroundColor.read(h).isTransparent()))return new Rle().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=Mo.div({style:{pointerEvents:"none",display:this._previewEditorLayoutInfo.map(h=>h?.isInsertion?"none":"block")}},Ce(this,h=>{let g=CE(this._previewEditorLayoutInfo).read(h);if(!g)return;let f=this._editorBackgroundColor.read(h),v=u.read(h),b=G7(this._tabAction).map(G=>`${UW}px solid ${wt(G)}`),S=`${UW+v}px solid ${f}`,y=g.read(h).codeScrollLeft!==0,w=g.map(G=>G.codeRect.bottom<G.editRect.bottom),k=cj*2+UW*2,T=g.map(G=>bu.fromLeftTopRightBottom(G.contentLeft-cj-UW,G.codeRect.top,G.contentLeft,G.codeRect.bottom+k)).read(h),N=new di(T.left,Number.MAX_SAFE_INTEGER),O=g.map(G=>G.codeRect.intersectHorizontal(N)),V=O.map(G=>G.withMargin(v,0,v,v).intersectHorizontal(N)),U=O.map(G=>bu.fromLeftTopWidthHeight(G.right-k+UW,G.bottom-UW,k,k).intersectHorizontal(N));return[Mo.div({class:"originalSeparatorSideBySide",style:{...V.read(h).toStyles(),boxSizing:"border-box",borderRadius:`${cj}px 0 0 ${cj}px`,borderTop:S,borderBottom:S,borderLeft:y?"none":S}}),Mo.div({class:"originalOverlaySideBySide",style:{...O.read(h).toStyles(),boxSizing:"border-box",borderRadius:`${cj}px 0 0 ${cj}px`,borderTop:b,borderBottom:b,borderLeft:y?"none":b,backgroundColor:wt(z7)}}),Mo.div({class:"originalCornerCutoutSideBySide",style:{pointerEvents:"none",display:w.map(G=>G?"block":"none"),...U.read(h).toStyles()}},[Mo.div({class:"originalCornerCutoutBackground",style:{position:"absolute",top:"0px",left:"0px",width:"100%",height:"100%",backgroundColor:sb(z7,this._themeService).map(G=>G.toString())}}),Mo.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}})]),Mo.div({class:"originalOverlaySideBySideHider",style:{...T.toStyles(),backgroundColor:f}})]})).keepUpdated(this._store),this._modifiedOverlay=Mo.div({style:{pointerEvents:"none"}},Ce(this,h=>{let g=CE(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 ${cj}px ${cj}px ${O?cj:0}px`),y=sb(sj(this._tabAction),this._themeService).map(O=>`1px solid ${O.toString()}`),w=`${UW+b}px solid ${v}`,k=g.map(O=>O.editRect.withMargin(0,UW)),T=k.map(O=>O.withMargin(b,b,b,0)),N=Ce(this,O=>{let V=k.read(O),U=g.read(O);return!U.isInsertion||U.contentLeft>=V.left?bu.fromLeftTopWidthHeight(V.left,V.top,0,0):new bu(U.contentLeft,V.top,V.left,V.top+UW*2)});return[Mo.div({class:"modifiedInsertionSideBySide",style:{...N.read(h).toStyles(),backgroundColor:sj(this._tabAction).map(O=>wt(O))}}),Mo.div({class:"modifiedSeparatorSideBySide",style:{...T.read(h).toStyles(),borderRadius:S,borderTop:w,borderBottom:w,borderRight:w,boxSizing:"border-box"}}),Mo.div({class:"modifiedOverlaySideBySide",style:{...k.read(h).toStyles(),borderRadius:S,border:y,boxSizing:"border-box",backgroundColor:wt(cCt)}})]})).keepUpdated(this._store),this._nonOverflowView=Mo.div({class:"inline-edits-view",style:{position:"absolute",overflow:"visible",top:"0px",left:"0px",display:this._display}},[this._backgroundSvg,Ce(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:Oo(null),allowEditorOverflow:!1,minContentWidthInPx:Ce(this,h=>{let g=this._previewEditorLayoutInfo.read(h)?.maxContentWidth;return g===void 0?0:g})})),this.previewEditor.setModel(this._previewTextModel),this._register(he(h=>{let g=this._previewEditorLayoutInfo.read(h);if(!g)return;let f=g.editRect.withMargin(-i3e,-zCe);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+zCe}px`})),this._register(he(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=os(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=ZM(r,o.displayRange,void 0),h=o.lineEdit.newLines.reduce((v,b)=>Math.max(v,X4e(b,e,t)),0),g=_ai,f=jQi+2*UW;return p+h+g+f<s-l-c-u}};Mle=I([m(5,F),m(6,De),m(7,eC)],Mle);var gCt=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}},Ox=1,QQi="word-replacement-view-overlay",YQi="word-replacement-view-widget",XQi="word-replacement-view-replacement",Dai="word-replacement-view-rename",dj=class extends C{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(Oo(this._viewData.edit.range.getStartPosition()),this._store),this._end=this._editor.observePosition(Oo(this._viewData.edit.range.getEndPosition()),this._store),this._line=document.createElement("div"),this._primaryElement=Le(this,null),this._secondaryElement=Le(this,null),this.isHovered=Ce(this,g=>{let f=this._primaryElement.read(g);return f?this._userInteractionService.createHoverTracker(f.element,g.store).read(g):!1}),this._renderTextEffect=Ce(this,g=>{let f=this._editor.model.get(),v=f.getLineContent(this._viewData.edit.range.startLineNumber),b=Hc.replace(new di(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=aW.fromLineTokens(y).slice(b.getRangeAfterReplace()).toLineTokens(this._viewData.edit.text,this._languageService.languageIdCodec):w=Bc.createEmpty(this._viewData.edit.text,this._languageService.languageIdCodec);let k=EL(new dE([w]),uE.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=EGe(this._viewData.alternativeAction?.count??new Promise(g=>g(void 0))).map(g=>g.value),h=Ce(this,g=>this._userInteractionService.readModifierKeyStatus(this._editor.editor.getDomNode(),g).shiftKey);this._layout=Ce(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 Uh(w,k),N;if(this._viewData.alternativeAction){let $=this._viewData.alternativeAction.label,te=p.read(g),pe=h.read(g),de=te!==void 0?te===1?d(1375,null,$):d(1376,null,$,te):$,se=d(1377,null,"[shift]");N={label:te!==void 0&&pe?de:$,tooltip:de?`${de}
${se}`:void 0,icon:void 0,count:te,keybinding:this._keybindingService.lookupKeybinding(Kae),active:h}}let O=bu.fromPoints(f,v).withHeight(b).translateX(-S),V=bu.fromPointSize(O.getLeftBottom().add(T),new Uh(this._viewData.edit.text.length*y,O.height)),U=V.withWidth(V.width+(N?N.label.length*y+8+4+12:0)),G=U.withLeft(O.left);return{alternativeAction:N,originalLine:O,codeLine:V,modifiedLine:U,lowerBackground:G,lineHeight:b}}),this.minEditorScrollHeight=Ce(this,g=>{let f=CE(this._layout).read(g);return f?f.read(g).modifiedLine.bottom+Ox+this._editor.editor.getScrollTop():0}),this._root=Mo.div({class:"word-replacement"},[Ce(this,g=>{let f=CE(this._layout).read(g);if(!f)return[];let v=G7(this._tabAction).map(te=>wt(te)).read(g),b=sj(this._tabAction).map(te=>wt(te)).read(g);this._line.style.lineHeight=`${f.read(g).modifiedLine.height+2*Ox}px`;let S=Oo(!1),y=f.map(te=>te.alternativeAction),w=Ce(te=>(y.read(te)?.active.read(te)??!1)||S.read(te)),T=ui(this._themeService.onDidColorThemeChange,()=>{let te=this._themeService.getColorTheme();return te.type==="hcDark"||te.type==="hcLight"}).read(g)?U7(gi,this._themeService).read(g):null,N={borderColor:T?T.toString():b,backgroundColor:wt(RQi),color:"",opacity:"1"},O={borderColor:T?T.toString():wt(SO),backgroundColor:wt(J1),color:wt(K7),opacity:"1"},V={borderColor:T?T.toString():U7(s9,this._themeService).map(te=>te.transparent(.2).toString()).read(g),backgroundColor:b_(this._viewData.editorType),color:"",opacity:"0.7"},U=b_(this._viewData.editorType),G=Ce(this,te=>(w.read(te),N)),$=Ce(this,te=>w.read(te)?O:V);return[Mo.div({id:QQi,style:{position:"absolute",...lb(te=>PCe(this._editor).read(te)),overflow:"hidden",pointerEvents:"none"}},[Mo.div({style:{position:"absolute",...lb(te=>f.read(te).lowerBackground.withMargin(Ox,2*Ox,Ox,0)),background:U,cursor:"pointer",pointerEvents:"auto"},onmousedown:te=>this._mouseDown(te)}),Mo.div({id:YQi,style:{position:"absolute",...lb(te=>f.read(te).modifiedLine.withMargin(Ox,2*Ox)),width:void 0,pointerEvents:"auto",boxSizing:"border-box",borderRadius:`${ab}px`,background:U,display:"flex",justifyContent:"left",outline:`2px solid ${U}`},onmousedown:te=>this._mouseDown(te)},[Mo.div({id:XQi,style:{fontFamily:this._editor.getOption(58),fontSize:this._editor.getOption(61),fontWeight:this._editor.getOption(62),width:lb(te=>f.read(te).codeLine.withMargin(Ox,2*Ox)).width,borderRadius:`${ab}px`,border:G.map(te=>`${Ox}px solid ${te.borderColor}`),boxSizing:"border-box",padding:`${Ox}px`,opacity:G.map(te=>te.opacity),background:G.map(te=>te.backgroundColor),display:"flex",justifyContent:"left",alignItems:"center",pointerEvents:"auto",cursor:"pointer"},obsRef:te=>{this._primaryElement.set(te,void 0)}},[this._line]),Ce(this,te=>{let pe=y.read(te);if(!pe)return;let de=document.createElement("div");return te.store.add(new ah(de,zo,{...t5e,disableTitle:!0})).set(pe.keybinding),Mo.div({id:Dai,style:{position:"relative",borderRadius:`${ab}px`,borderTop:`${Ox}px solid`,borderRight:`${Ox}px solid`,borderBottom:`${Ox}px solid`,borderLeft:`${Ox}px solid`,borderColor:$.map(Se=>Se.borderColor),opacity:$.map(Se=>Se.opacity),color:$.map(Se=>Se.color),display:"flex",justifyContent:"center",alignItems:"center",padding:"0 4px 0 1px",marginLeft:"4px",background:$.map(Se=>Se.backgroundColor),cursor:"pointer",textWrap:"nowrap"},class:"inline-edit-alternative-action-label",obsRef:Se=>{this._secondaryElement.set(Se,void 0)},ref:Se=>{pe.tooltip&&te.store.add(this._hoverService.setupDelayedHoverAtMouse(Se,{content:pe.tooltip,appearance:{compact:!0}}))}},[de,_("div.inline-edit-alternative-action-label-separator"),pe.icon?Qo(pe.icon):void 0,pe.label])})]),Mo.div({style:{position:"absolute",...lb(te=>f.read(te).originalLine.withMargin(Ox)),boxSizing:"border-box",borderRadius:`${ab}px`,border:`${Ox}px solid ${v}`,background:wt(DQi),pointerEvents:"none"}},[]),Mo.svg({width:11,height:14,viewBox:"0 0 11 14",fill:"none",style:{position:"absolute",left:f.map(te=>te.modifiedLine.left-16),top:f.map(te=>te.modifiedLine.top+Math.round((te.lineHeight-14-5)/2)),pointerEvents:"none"},onmousedown:te=>this._mouseDown(te)},[Mo.svgElem("path",{d:"M1 0C1 2.98966 1 5.92087 1 8.49952C1 9.60409 1.89543 10.5 3 10.5H10.5",stroke:wt(s9)}),Mo.svgElem("path",{d:"M6 7.5L9.99999 10.49998L6 13.5",stroke:wt(s9)})])])]})]).keepUpdated(this._store),this._register(this._editor.createOverlayWidget({domNode:this._root.element,minContentWidthInPx:Oo(0),position:Oo({preference:{top:0,left:0}}),allowEditorOverflow:!1}))}static{this.MAX_LENGTH=100}_mouseDown(e){let t=FBo(e.target,new Set([YQi,XQi,Dai,QQi]));t&&(e.preventDefault(),this._onDidClick.fire(WL.create(e,t===Dai)))}};dj=I([m(3,kt),m(4,De),m(5,_e),m(6,tt),m(7,eC)],dj);function FBo(a,i){let e=a;for(;e;){if(i.has(e.id))return e.id;e=e.parentElement}return null}var fCt=class extends C{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=os(this._originalEditor).isTargetHovered(r=>r.target.type===6&&r.target.detail.injectedText?.options.attachedData instanceof o3e&&r.target.detail.injectedText.options.attachedData.owner===this,this._store),this._tokenizationFinished=VBo(this._modifiedTextModel),this._decorations=Ce(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=po.register({className:"inlineCompletions-line-insert",description:"line-insert",isWholeLine:!0,marginClassName:"gutter-insert"}),v=po.register({className:"inlineCompletions-line-delete",description:"line-delete",isWholeLine:!0,marginClassName:"gutter-delete"}),b=po.register({className:"inlineCompletions-char-delete",description:"char-delete",isWholeLine:!1,zIndex:1}),S=po.register({className:"inlineCompletions-char-insert",description:"char-insert",isWholeLine:!0}),y=po.register({className:"inlineCompletions-char-insert",description:"char-insert",shouldFillLineOnLineBreak:!0}),w=po.register({className:"inlineCompletions-char-insert diff-range-empty",description:"char-insert diff-range-empty"}),k=po.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",N=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&&JQi(O);for(let U of O.innerChanges||[]){if(O.original.contains(U.originalRange.startLineNumber)&&!(N&&U.originalRange.isEmpty())){let G=this._originalEditor.getModel()?.getValueInRange(U.originalRange,1);h.push({range:U.originalRange,options:{description:"char-delete",shouldFillLineOnLineBreak:!1,className:ACe("inlineCompletions-char-delete",U.originalRange.isSingleLine()&&s.mode==="insertionInline"&&"single-line-inline",U.originalRange.isEmpty()&&"empty",(U.originalRange.isEmpty()&&u||s.mode==="deletion"&&G===`
`)&&p&&!V&&"diff-range-empty"),inlineClassName:V?ACe("strike-through","inlineCompletions"):null,zIndex:1}})}if(O.modified.contains(U.modifiedRange.startLineNumber)&&g.push({range:U.modifiedRange,options:U.modifiedRange.isEmpty()&&p&&!V&&u?w:y}),V){let G=l.getValueOfRange(U.modifiedRange),$=G.length>3?[{text:G.slice(0,1),extraClasses:["start"],offsetRange:new di(U.modifiedRange.startColumn-1,U.modifiedRange.startColumn)},{text:G.slice(1,-1),extraClasses:[],offsetRange:new di(U.modifiedRange.startColumn,U.modifiedRange.endColumn-2)},{text:G.slice(-1),extraClasses:["end"],offsetRange:new di(U.modifiedRange.endColumn-2,U.modifiedRange.endColumn-1)}]:[{text:G,extraClasses:["start","end"],offsetRange:new di(U.modifiedRange.startColumn-1,U.modifiedRange.endColumn)}];this._tokenizationFinished.read(r);let te=this._modifiedTextModel.tokenization.getLineTokens(U.modifiedRange.startLineNumber);for(let{text:pe,extraClasses:de,offsetRange:se}of $)h.push({range:z.fromPositions(U.originalRange.getEndPosition()),options:{description:"inserted-text",before:{tokens:te.getTokensInRange(se),content:pe,inlineClassName:ACe("inlineCompletions-char-insert",U.modifiedRange.isSingleLine()&&s.mode==="insertionInline"&&"single-line-inline",...de),cursorStops:3,attachedData:new o3e(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(os(this._originalEditor).setDecorations(this._decorations.map(r=>r?.originalDecorations??[])));let n=this._state.map(r=>r?.modifiedCodeEditor);this._register(Ga((r,s)=>{let l=n.read(r);l&&s.add(os(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 o3e&&s.owner===this&&this._onDidClick.fire(new WL(r.event))}))}static supportsInlineDiffRendering(e){return JQi(e)}},o3e=class{constructor(i){this.owner=i}};function JQi(a){return a.innerChanges?a.innerChanges.every(i=>Lje(i.modifiedRange)&&Lje(i.originalRange)):!1}var WBo=0;function VBo(a){return ui(a.onDidChangeTokens,()=>WBo++)}var KCe=class extends C{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=Ce(e=>this._model.read(e)?.tabAction.read(e)??"inactive");this.displayRange=Ce(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 ni("custom view should have a range");return new ro(o.startLineNumber,o.endLineNumber)}return t.state?.kind==="insertionMultiLine"?this._insertion.originalLines.read(e):t.edit.displayRange}});this._currentInlineEditCache=void 0;this._uiState=Ce(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=cg.fromEdit(n.edit),l=new _S(n.edit.apply(n.originalText)),r=PSe(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=BQi(l.getValue(),n.modifiedLineRange,o.getOptions().tabSize);l=new _S(g.applyToString(l.getValue())),s=VQi(s,g),r=PSe(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=Qc.replace(new di(0,p.length),l.getValue()).removeCommonSuffixPrefix(p),v=Cle(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=Ce(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=Ce(this,e=>this._uiState.read(e)?.state?.kind==="insertionMultiLine"?this._insertion.startLineOffset.read(e):0);this._editorObs=os(this._editor),this._constructorDone=Le(this,!1),this._previewTextModel=this._register(this._instantiationService.createInstance(Bu,"",this._editor.getModel().getLanguageId(),{...Bu.DEFAULT_CREATION_OPTIONS,bracketPairColorizationOptions:{enabled:!0,independentColorPoolPerBracketType:!1}},null)),this._sideBySide=this._register(this._instantiationService.createInstance(Mle,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(hCt,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(VCe,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(FCe,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(WCe,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=Ce(this,p=>{if(this._showLongDistanceHint.read(p))return p.store.add(this._instantiationService.createInstance(UCe,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=Ce(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 _S(h.newText),diff:h.diff,mode:h.state.kind,modifiedCodeEditor:this._sideBySide.previewEditor,editorType:h.editorType}}),this._inlineDiffView=this._register(new fCt(this._editor,this._inlineDiffViewState,this._previewTextModel)),this._jumpToView=this._register(this._instantiationService.createInstance(Q7,this._editorObs,{style:"label"},Ce(p=>{let h=this._uiState.read(p);if(h?.state?.kind==="jumpTo")return{jumpToPosition:h.state.position}})));let l=hs({equalsFn:Apt.arrayC(Apt.thisC())},p=>{let h=this._uiState.read(p);return h?.state?.kind==="wordReplacements"?h.state.replacements.map(g=>new gCt(g,h.editorType,h.state?.alternativeAction)):[]});this._wordReplacementViews=$v(this,l,(p,h)=>h.add(this._instantiationService.createInstance(dj,this._editorObs,p,this._tabAction))),this._lineReplacementView=this._register(this._instantiationService.createInstance(BCe,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(he(p=>{let h=this._model.read(p);h&&p.store.add(H.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=Ce(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(he(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"&&o6i(o))return HBo(o,r.cursorPosition)?"insertionInline":"lineReplacement";if(e6i(f,r,n))return"deletion";if(ZQi(o)&&this._useCodeShifting.read(t)==="always")return"insertionMultiLine";if(f.every(S=>Zl.ofRange(S.originalRange).columnCount<dj.MAX_LENGTH&&Zl.ofRange(S.modifiedRange).columnCount<dj.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())||!t6i(f.map(w=>new Xr(w.originalRange,"")),r.originalText).some(w=>w.range.isEmpty()&&Zl.ofRange(w.range).columnCount<dj.MAX_LENGTH)))return"wordReplacements"}}if(h>0&&g>0)return h===1&&g===1&&e.editorType!=="diffEditor"?"lineReplacement":this._renderSideBySide.read(t)!=="never"&&Mle.fitsInsideViewport(this._editor,this._previewTextModel,r,t)?"sideBySide":"lineReplacement";if(e.editorType==="diffEditor"){if(e6i(f,r,n))return"deletion";if(ZQi(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:i6i};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=BBo(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 Xr(g.originalRange,g.modified));if(h.length!==0){if(s==="wordReplacements"){let g=UBo(h,r.originalText);return g.some(f=>f.range.isEmpty())&&(g=t6i(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 ni("viewHasBeenShownLongThan called before a view has been shown");return Date.now()-t>=e}};KCe=I([m(5,F)],KCe);var i6i=new xle(-1,-1,-1,-1,-1,-1,-1,!0);function BBo(a,i,e){if(!a.edit)return i6i;let t=a.cursorPosition,o=i.length===0?!1:i[0].modified.startsWith(e.getEOL());return new xle(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 o6i(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 HBo(a,i){if(!i||!o6i(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 ZQi(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 e6i(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 UBo(a,i){return n6i(a,i,e=>/^[a-zA-Z]$/.test(e))}function t6i(a,i){return n6i(a,i,e=>!/^\s$/.test(e))}function n6i(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 Xr(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=Xr.joinReplacements([t.pop(),h],i)),t.push(h)}function o(n){return n===void 0?!1:e(n)}return t}var GCe=class extends C{constructor(e,t,o,n){super();this._editor=e;this._model=t;this._showCollapsed=o;this._inlineEdit=Ce(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 Xr(h,p.newText)});s=new bp(u)}else s=void 0;return new dCt(n.inlineSuggestion.originalTextRef,r,s,t.primaryPosition.read(void 0),t.allPositions.read(void 0),n.inlineSuggestion.source.inlineSuggestions.commands??[],n.inlineSuggestion)});this._inlineEditModel=Ce(this,e=>{let t=this._model.read(e);if(!t)return;let o=this._inlineEdit.read(e);if(!o)return;let n=Ce(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 uCt(t,o,n)});this._editorObs=os(this._editor),this.view=this._register(n.createInstance(KCe,this._editor,this._inlineEditModel,this._model.map(r=>r?j7.fromInlineCompletionModel(r):void 0),this._inlineEdit.map(r=>r?q7.fromInlineSuggestion(r.inlineCompletion):void 0),this._showCollapsed))}};GCe=I([m(3,F)],GCe);var $Ce=class extends C{constructor(e,t,o,n){super();this._editor=e;this._model=t;this._focusIsInMenu=o;this._instantiationService=n;this._ghostTexts=Ce(this,e=>this._model.read(e)?.ghostTexts.read(e)??[]);this._inlineEdit=Ce(this,e=>this._model.read(e)?.inlineEditState.read(e)?.inlineSuggestion);this._everHadInlineEdit=vf(this,(e,t)=>t||!!this._inlineEdit.read(e)||!!this._model.read(e)?.inlineCompletionState.read(e)?.inlineSuggestion?.showInlineEditMenu);this._indicatorIsHoverVisible=Le(this,void 0);this._showInlineEditCollapsed=Ce(this,e=>(this._model.read(e)?.showCollapsed.read(e)??!1)&&!this._indicatorIsHoverVisible.read(e)?.read(e));this._inlineEditWidget=RI(e=>{if(this._everHadInlineEdit.read(e))return this._instantiationService.createInstance(GCe,this._editor,this._model,this._showInlineEditCollapsed)});this._gutterIndicatorState=Ce(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:ro.ofLength(o.primaryGhostText.lineNumber,1),tabAction:Ce(this,n=>this._editorObs.isFocused.read(n)?"accept":"inactive"),gutterIndicatorOffset:Oo(zBo(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:Ce(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=nQi(this._ghostTexts,this._store),this._editorObs=os(this._editor),this._ghostTextWidgets=$v(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(z2i(Ce(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 Ewe(this._editor,this._model,this._instantiationService)),this._indicator=this._register(this._instantiationService.createInstance(Z1,this._editorObs,Ce(r=>{let s=this._gutterIndicatorState.read(r);if(s)return new $7(q7.fromInlineSuggestion(s.inlineSuggestion),s.displayRange,j7.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),Ce(r=>{let s=this._inlineEditWidget.read(r);if(s)return r.store.add(this._instantiationService.createInstance(OCe,s._inlineEditModel,Oo(this._indicator),s.view._inlineCollapsedView))}).recomputeInitiallyAndOnChange(this._store)}static{this.hot=s1(this)}_createGhostText(e){return this._instantiationService.createInstance(X1,this._editor,Ce(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:rCt.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}};$Ce=I([m(3,F)],$Ce);function zBo(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 KBo(e.text,o)*n}return 0}function KBo(a,i){if(!i.length)return 0;let e=0,t=0;for(;a.startsWith(i,t);)e++,t+=i.length;return e}IQi(a=>Rc.get(a));var Rc=class extends C{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=Ce(this,e=>this._enabledInConfig.read(e)&&(!this._isScreenReaderEnabled.read(e)||!this._editorDictationInProgress.read(e)));this._focusIsInMenu=Le(this,!1);this._focusIsInEditorOrMenu=Ce(this,e=>{let t=this._editorObs.isFocused.read(e),o=this._focusIsInMenu.read(e);return t||o});this._cursorIsInIndentation=Ce(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=RI(this,e=>{if(this._editorObs.isReadonly.read(e))return;let t=this._editorObs.model.read(e);return t?this._instantiationService.createInstance(ICe,t,this._suggestWidgetAdapter.selectedItem,this._editorObs.versionId,this._positions,this._debounceValue,this._enabled,this.editor):void 0});this._playAccessibilitySignal=Wc(this);this._view=Ce(e=>e.store.add(this._instantiationService.createInstance($Ce.hot.read(e),this.editor,this.model,this._focusIsInMenu)));this._editorObs=os(this.editor),this._positions=Ce(this,b=>this._editorObs.selections.read(b)?.map(S=>S.getEndPosition())??[new Ie(1,1)]),this._suggestWidgetAdapter=this._register(new iCt(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),Rc._instances.add(this),this._register(Z(()=>Rc._instances.delete(this))),this._register(he(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 Rc._instances)k!==this&&(w&&Xe(w,k.editor.getModel()?.uri)?k.model.read(void 0)?.trigger():k.reject())})),this._register(he(b=>{let S=this.model.read(b),y=this.editor.getModel()?.uri;!S||!y||b.store.add(S.onDidAccept(()=>{for(let w of Rc._instances){if(w===this)continue;let k=w.model.read(void 0)?.state.read(void 0);k?.kind==="inlineEdit"&&Xe(k.nextEditUri,y)&&w.model.read(void 0)?.stop("automatic")}}))})),this._register(_s(this._editorObs.onDidType,(b,S)=>{this._enabled.get()&&this.model.get()?.trigger()})),this._register(_s(this._editorObs.onDidPaste,(b,S)=>{this._enabled.get()&&this.model.get()?.trigger()}));let h=new Set([rL.Tab.id,rL.DeleteLeft.id,rL.DeleteRight.id,E1,"acceptSelectedSuggestion",yle.ID,C4e.ID,ad.NextMatchFindAction,sle.ID,J5e.ID,Z5e.ID,e4e.ID,...tSe.getRegisteredCommands()]);this._register(this._commandService.onDidExecuteCommand(b=>{if(h.has(b.commandId)&&e.hasTextFocus()&&this._enabled.get()){let S=!1;b.commandId===E1&&(S=!0),this._editorObs.forceUpdate(y=>{this.model.get()?.trigger(y,{noDelay:S})})}})),this._register(_s(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(he(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)&&Ui(k=>{for(let T of Rc._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||LL.dropDownVisible||y&&(y.state.read(void 0)?.inlineSuggestion?.isFromExplicitRequest&&y.inlineEditAvailable.read(void 0)||Ui(w=>{y.stop("automatic",w)}))})),this._register(he(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=vf(this,(b,S)=>{let w=this.model.read(b)?.state.read(b);return this._suggestWidgetAdapter.selectedItem.get()?S:w?.inlineSuggestion?.semanticId});this._register(Upt(Ce(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 Pi(50,u6(w)),await gf(this._suggestWidgetAdapter.selectedItem,cn,()=>!1,u6(w)),k=this.model.get(),T=k?.state.get(),!T||!k))return;let N=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(N)):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 Pwt(this._contextKeyService);this._register(f.bind(ka.cursorInIndentation,this._cursorIsInIndentation)),this._register(f.bind(ka.hasSelection,b=>!this._editorObs.cursorSelection.read(b)?.isEmpty())),this._register(f.bind(ka.cursorAtInlineEdit,this.model.map((b,S)=>b?.inlineEditState?.read(S)?.cursorAtInlineEdit.read(S)))),this._register(f.bind(ka.tabShouldAcceptInlineEdit,this.model.map((b,S)=>!!b?.tabShouldAcceptInlineEdit.read(S)))),this._register(f.bind(ka.tabShouldJumpToInlineEdit,this.model.map((b,S)=>!!b?.tabShouldJumpToInlineEdit.read(S)))),this._register(f.bind(ka.inlineEditVisible,b=>this.model.read(b)?.inlineEditState.read(b)!==void 0)),this._register(f.bind(ka.inlineSuggestionHasIndentation,b=>this.model.read(b)?.getIndentationInfo(b)?.startsWithIndentation)),this._register(f.bind(ka.inlineSuggestionHasIndentationLessThanTabSize,b=>this.model.read(b)?.getIndentationInfo(b)?.startsWithIndentationLessThanTabSize)),this._register(f.bind(ka.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(ka.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(ka.inlineSuggestionVisible,b=>{let y=this.model.read(b)?.inlineCompletionState.read(b);return!!y?.inlineSuggestion&&y?.primaryGhostText!==void 0&&!y?.primaryGhostText.isEmpty()}));let v=Ce(this,b=>{let w=this.model.read(b)?.inlineCompletionState.read(b)?.primaryGhostText;return!w||w.isEmpty()?void 0:new Ie(w.lineNumber,w.parts[0].column)});this._register(f.bind(ka.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(gCe,this.editor))}static{this._instances=new Set}static{this.hot=s1(this)}static{this.ID="editor.contrib.inlineCompletionsController"}static getInFocusedEditorOrParent(e){let t=Bwe(e);return t?Rc.get(t):null}static get(e){return H8i(e.getContribution(Rc.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(1360,null,o.getAriaLabel())),Jo(n?e+", "+n:e)}shouldShowHoverAt(e){let t=this.model.get()?.primaryGhostText.get();return t?t.parts.some(o=>e.containsPosition(new Ie(t.lineNumber,o.column))):!1}shouldShowHoverAtViewZone(e){return this._view.get().shouldShowHoverAtViewZone(e)}reject(){Ui(e=>{let t=this.model.get();if(t&&(t.stop("explicitCancel",e),this._focusIsInEditorOrMenu.get()))for(let o of Rc._instances)o!==this&&!o._focusIsInEditorOrMenu.get()&&o.model.get()?.stop("automatic",e)})}jump(){let e=this.model.get();e&&e.jump()}};Rc=I([m(1,F),m(2,X),m(3,B),m(4,ge),m(5,jg),m(6,zt),m(7,tr),m(8,_e),m(9,Bi)],Rc);var vCt=class a extends xi{static{this.ID=_It}constructor(){super({id:a.ID,label:L(1338,"Show Next Inline Suggestion"),precondition:x.and(ue.writable,ka.inlineSuggestionVisible),kbOpts:{weight:100,primary:606}})}async run(i,e){Rc.get(e)?.model.get()?.next()}},bCt=class a extends xi{static{this.ID=TIt}constructor(){super({id:a.ID,label:L(1339,"Show Previous Inline Suggestion"),precondition:x.and(ue.writable,ka.inlineSuggestionVisible),kbOpts:{weight:100,primary:604}})}async run(i,e){Rc.get(e)?.model.get()?.previous()}},Lai="vscode://schemas/inlineCompletionProviderIdArgs";function Rai(a){let i=[];return a.providerId&&(i.push(a.providerId.toStringWithoutVersion()),i.push(a.providerId.extensionId+":*")),i}var r6i=$8i(G8i({showNoResultNotification:v4e(tsi()),providerId:v4e(q8i(Lai,U8i())),explicit:v4e(tsi()),changeHintData:v4e(z8i())}),K8i()),SCt=class extends xi{constructor(){super({id:"editor.action.inlineSuggest.trigger",label:L(1341,"Trigger Inline Suggestion"),precondition:ue.writable,metadata:{description:d(1343,null),args:[{name:"args",description:d(1342,null),isOptional:!0,schema:r6i.getJSONSchema()}]}})}async run(i,e,t){let o=i.get(Ne),n=i.get(zt),r=Rc.get(e),s=r6i.validateOrThrow(t),l=s?.providerId?n.inlineCompletionsProvider.all(e.getModel()).find(c=>Rai(c).some(u=>u===s.providerId)):void 0;await P9t(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:St.Info,message:d(1345,null)}))}},ICt=class extends xi{constructor(){super({id:"editor.action.inlineSuggest.acceptNextWord",label:L(1333,"Accept Next Word Of Inline Suggestion"),precondition:x.and(ue.writable,ka.inlineSuggestionVisible),kbOpts:{weight:101,primary:2065,kbExpr:x.and(ue.writable,ka.inlineSuggestionVisible,ka.cursorBeforeGhostText,$a.negate())},menuOpts:[{menuId:D.InlineSuggestionToolbar,title:d(1329,null),group:"primary",order:2}]})}async run(i,e){await Rc.get(e)?.model.get()?.acceptNextWord()}},yCt=class extends xi{constructor(){super({id:"editor.action.inlineSuggest.acceptNextLine",label:L(1332,"Accept Next Line Of Inline Suggestion"),precondition:x.and(ue.writable,ka.inlineSuggestionVisible),kbOpts:{weight:101},menuOpts:[{menuId:D.InlineSuggestionToolbar,title:d(1328,null),group:"secondary",order:2}]})}async run(i,e){await Rc.get(e)?.model.get()?.acceptNextLine()}},wCt=class extends xi{constructor(){super({id:E1,label:L(1330,"Accept Inline Suggestion"),precondition:x.or(ka.inlineSuggestionVisible,ka.inlineEditVisible),menuOpts:[{menuId:D.InlineSuggestionToolbar,title:d(1327,null),group:"primary",order:2},{menuId:D.InlineEditsActions,title:d(1327,null),group:"primary",order:2}],kbOpts:[{primary:2,weight:200,kbExpr:x.or(x.and(ka.inlineSuggestionVisible,ue.tabMovesFocus.toNegated(),$n.Visible.toNegated(),ue.hoverFocused.toNegated(),ka.hasSelection.toNegated(),ka.inlineSuggestionHasIndentationLessThanTabSize),x.and(ka.inlineEditVisible,ue.tabMovesFocus.toNegated(),$n.Visible.toNegated(),ue.hoverFocused.toNegated(),ka.tabShouldAcceptInlineEdit))}]})}async run(i,e){let t=Rc.getInFocusedEditorOrParent(i);t&&(t.model.get()?.accept(t.editor),t.editor.focus())}};yt.registerKeybindingRule({id:E1,weight:202,primary:2,when:x.and(ka.inInlineEditsPreviewEditor)});var CCt=class extends xi{constructor(){super({id:Kae,label:L(1331,"Accept Inline Suggestion Alternative Action"),precondition:x.and(ka.inlineSuggestionAlternativeActionVisible,ka.inlineEditVisible),menuOpts:[],kbOpts:[{primary:1026,weight:203}]})}async run(i,e){let t=Rc.getInFocusedEditorOrParent(i);t&&(t.model.get()?.accept(t.editor,!0),t.editor.focus())}};yt.registerKeybindingRule({id:Kae,weight:203,primary:1026,when:x.and(ka.inInlineEditsPreviewEditor)});var xCt=class extends xi{constructor(){super({id:DIt,label:L(1337,"Jump to next inline edit"),precondition:ka.inlineEditVisible,menuOpts:[{menuId:D.InlineEditsActions,title:d(1344,null),group:"primary",order:1,when:ka.cursorAtInlineEdit.toNegated()}],kbOpts:{primary:2,weight:201,kbExpr:x.and(ka.inlineEditVisible,ue.tabMovesFocus.toNegated(),$n.Visible.toNegated(),ue.hoverFocused.toNegated(),ka.tabShouldJumpToInlineEdit)}})}async run(i,e){let t=Rc.get(e);t&&t.jump()}},n3e=class a extends xi{static{this.ID=LIt}constructor(){super({id:a.ID,label:L(1336,"Hide Inline Suggestion"),precondition:x.or(ka.inlineSuggestionVisible,ka.inlineEditVisible),kbOpts:{weight:190,primary:9},menuOpts:[{menuId:D.InlineEditsActions,title:d(1346,null),group:"primary",order:3}]})}async run(i,e){let t=Rc.getInFocusedEditorOrParent(i);Ui(o=>{t?.model.get()?.stop("explicitCancel",o)}),t?.editor.focus()}},kCt=class a extends xi{static{this.ID=u5e}constructor(){super({id:a.ID,label:L(1340,"Toggle Inline Suggestions Show Collapsed"),precondition:x.true()})}async run(i,e){let t=i.get(B),o=t.getValue("editor.inlineSuggest.edits.showCollapsed");t.updateValue("editor.inlineSuggest.edits.showCollapsed",!o)}};yt.registerKeybindingRule({id:n3e.ID,weight:-1,primary:9,secondary:[1033],when:x.and(ka.inInlineEditsPreviewEditor)});var ECt=class a extends K{static{this.ID="editor.action.inlineSuggest.toggleAlwaysShowToolbar"}constructor(){super({id:a.ID,title:d(1334,null),f1:!1,precondition:void 0,menu:[{id:D.InlineSuggestionToolbar,group:"secondary",order:10}],toggled:x.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)}},TCt=class extends xi{constructor(){super({id:"editor.action.inlineSuggest.dev.extractRepro",label:d(1335,null),alias:"Developer: Inline Suggest Extract Repro",precondition:x.or(ka.inlineEditVisible,ka.inlineSuggestionVisible)})}async run(i,e){let t=i.get(Wi),n=Rc.get(e)?.model.get();if(!n)return;let r=n.extractReproSample(),l=mc(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 Mai=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}},qCe=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=Rc.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 Fq(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 Fq(1e3,this,t.range,i.event.posx,i.event.posy,!1);if(t.type===6&&t.detail.mightBeForeignElement&&e.shouldShowHoverAt(t.range))return new Fq(1e3,this,t.range,i.event.posx,i.event.posy,!1);if(t.type===9&&t.element){let o=X1.getWarningWidgetContext(t.element);if(o&&e.shouldShowHoverAt(o.range))return new Fq(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=Rc.get(this._editor);return t&&t.shouldShowHoverAt(i.range)?[new Mai(this,i.range,t)]:[]}renderHoverParts(i,e){let t=new P,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(Ga((l,c)=>{let u=c.add(this._instantiationService.createInstance(LL.hot.read(l),this._editor,!1,Oo(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 Lx([s])}getAccessibleContent(i){return d(1361,null)}renderScreenReaderText(i,e){let t=new P,o=_,n=o("div.hover-row.markdown-hover"),r=R(n,o("div.hover-contents",{"aria-live":"assertive"})),s=l=>{let c=d(1362,null),u=t.add(this._markdownRendererService.render(new xe().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(he(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 Fi(r)})),i.fragment.appendChild(n),t}};qCe=I([m(1,Bi),m(2,F),m(3,Te),m(4,Qn)],qCe);var Wd=ae("accessibleViewService");var tp=class extends C{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 _Ct(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 Y7=class extends C{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 DCt=class{constructor(){this.type="view";this.priority=95;this.name="inline-completions";this.when=x.or(ka.inlineSuggestionVisible,ka.inlineEditVisible)}getProvider(i){let e=i.get(Kt),t=e.getActiveCodeEditor()||e.getFocusedCodeEditor();if(!t)return;let o=Rc.get(t)?.model.get();if(o?.state.get())return new Pai(t,o)}},Pai=class extends C{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 _L(this._model.textModel);return rq.fromTextEdit(new bp(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()}};go(Rc.ID,bwt(Rc.hot),3);Jt(SCt);Jt(vCt);Jt(bCt);Jt(ICt);Jt(yCt);Jt(wCt);Jt(CCt);Jt(kCt);Jt(n3e);Jt(xCt);W(ECt);Jt(TCt);W(jwt);W(Qwt);d_.register(qCe);xa.register(new DCt);var S_=class{constructor(i,e,t,o){this.textModelResolverService=e;this.languageService=t;this.languageFeaturesService=o;this.toUnhook=new P;this.toUnhookForKeyboard=new P;this.currentWordAtPosition=null;this.previousPromise=null;this.editor=i,this.linkDecorations=this.editor.createDecorationsCollection();let n=new sO(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(S_.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 y1(this.editor,15);this.previousPromise&&(this.previousPromise.cancel(),this.previousPromise=null),this.previousPromise=xn(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 xe().appendText(d(1230,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 xe().appendCodeblock(p||"",u):void 0),s.dispose()}):void 0}}getPreviewValue(i,e,t){let o=t.range;return o.endLineNumber-o.startLineNumber>=S_.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+S_.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 r1)&&(i.hasTriggerModifier||(e?e.keyCodeIsTriggerKey:!1))&&this.languageFeaturesService.definitionProvider.has(this.editor.getModel())}findDefinition(i,e){let t=this.editor.getModel();return t?U1(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 NW({openToSide:e,openInPeek:o,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(t)})}isInPeekEditor(i){let e=i.get(X);return Gh.inPeekEditor.getValue(e)}dispose(){this.toUnhook.dispose(),this.toUnhookForKeyboard.dispose()}};S_=I([m(1,Nt),m(2,kt),m(3,zt)],S_);go(S_.ID,S_,2);var jCe=class extends C{constructor(e,t,o){super();this._editor=e;this._markerService=o;this._ctxHasDiagnostics=ue.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=>Xe(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)}};jCe=I([m(1,X),m(2,Ns)],jCe);go(jCe.ID,jCe,1);var Aai=class extends xi{constructor(){super({id:"editor.action.debugEditorGpuRenderer",label:L(1252,"Developer: Debug Editor GPU Renderer"),precondition:x.true()})}async run(i,e){let t=i.get(F),n=await i.get(Ge).pick([{label:d(1253,null),id:"logTextureAtlasStats"},{label:d(1254,null),id:"saveTextureAtlas"},{label:d(1251,null),id:"drawGlyph"}],{canPickMany:!1});if(n)switch(n.id){case"logTextureAtlasStats":t.invokeFunction(r=>{let s=r.get(ne),l=ec.atlas;if(!ec.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(be),c=s.getWorkspace().folders;if(c.length>0){let u=ec.atlas,p=[];for(let[h,g]of u.pages.entries())p.push(l.writeFile(A.joinPath(c[0].uri,`textureAtlasPage${h}_actual.png`),Je.wrap(new Uint8Array(await(await g.source.convertToBlob()).arrayBuffer()))),l.writeFile(A.joinPath(c[0].uri,`textureAtlasPage${h}_usage.png`),Je.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(be),c=r.get(Ge),p=r.get(Pe).getWorkspace().folders;if(p.length===0)return;let h=ec.atlas,g=s.getValue("editor.fontFamily"),f=s.getValue("editor.fontSize"),v=new GU(f,g,Ki().devicePixelRatio,ec.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 N=new OffscreenCanvas(T.width,T.height);UN(N.getContext("2d")).putImageData(T,0,0);let V=await N.convertToBlob({type:"image/png"}),U=A.joinPath(p[0].uri,`glyph_${b}_${y}_${f}px_${g.replaceAll(/[,\\\/\.'\s]/g,"_")}.png`);await l.writeFile(U,Je.wrap(new Uint8Array(await V.arrayBuffer())))});break}}};Jt(Aai);var s6i=(t=>(t.NoAutoFocus="noAutoFocus",t.FocusIfVisible="focusIfVisible",t.AutoFocusImmediately="autoFocusImmediately",t))(s6i||{}),LCt=class extends xi{constructor(){super({id:EIt,label:L(1281,"Show or Focus Hover"),metadata:{description:L(1285,"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(1284,null),d(1283,null),d(1282,null)],default:"focusIfVisible"}}}}]},precondition:void 0,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,2087),weight:100}})}run(i,e,t){if(!e.hasModel())return;let o=kl.get(e);if(!o)return;let n=t?.focus,r="focusIfVisible";Object.values(s6i).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")}},RCt=class extends xi{constructor(){super({id:l3i,label:L(1279,"Show Definition Preview Hover"),precondition:void 0,metadata:{description:L(1280,"Show the definition preview hover in the editor.")}})}run(i,e){let t=kl.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=S_.get(e);if(!r)return;r.startFindDefinitionFromCursor(o).then(()=>{t.showContentHover(n,1,2,!0)})}},MCt=class extends xi{constructor(){super({id:c3i,label:L(1266,"Hide Hover"),alias:"Hide Content Hover",precondition:void 0})}run(i,e){kl.get(e)?.hideContentHover()}},PCt=class extends xi{constructor(){super({id:d3i,label:L(1277,"Scroll Up Hover"),precondition:ue.hoverFocused,kbOpts:{kbExpr:ue.hoverFocused,primary:16,weight:100},metadata:{description:L(1278,"Scroll up the editor hover.")}})}run(i,e){let t=kl.get(e);t&&t.scrollUp()}},ACt=class extends xi{constructor(){super({id:u3i,label:L(1271,"Scroll Down Hover"),precondition:ue.hoverFocused,kbOpts:{kbExpr:ue.hoverFocused,primary:18,weight:100},metadata:{description:L(1272,"Scroll down the editor hover.")}})}run(i,e){let t=kl.get(e);t&&t.scrollDown()}},NCt=class extends xi{constructor(){super({id:p3i,label:L(1273,"Scroll Left Hover"),precondition:ue.hoverFocused,kbOpts:{kbExpr:ue.hoverFocused,primary:15,weight:100},metadata:{description:L(1274,"Scroll left the editor hover.")}})}run(i,e){let t=kl.get(e);t&&t.scrollLeft()}},OCt=class extends xi{constructor(){super({id:m3i,label:L(1275,"Scroll Right Hover"),precondition:ue.hoverFocused,kbOpts:{kbExpr:ue.hoverFocused,primary:17,weight:100},metadata:{description:L(1276,"Scroll right the editor hover.")}})}run(i,e){let t=kl.get(e);t&&t.scrollRight()}},FCt=class extends xi{constructor(){super({id:h3i,label:L(1269,"Page Up Hover"),precondition:ue.hoverFocused,kbOpts:{kbExpr:ue.hoverFocused,primary:11,secondary:[528],weight:100},metadata:{description:L(1270,"Page up the editor hover.")}})}run(i,e){let t=kl.get(e);t&&t.pageUp()}},WCt=class extends xi{constructor(){super({id:g3i,label:L(1267,"Page Down Hover"),precondition:ue.hoverFocused,kbOpts:{kbExpr:ue.hoverFocused,primary:12,secondary:[530],weight:100},metadata:{description:L(1268,"Page down the editor hover.")}})}run(i,e){let t=kl.get(e);t&&t.pageDown()}},VCt=class extends xi{constructor(){super({id:f3i,label:L(1264,"Go To Top Hover"),precondition:ue.hoverFocused,kbOpts:{kbExpr:ue.hoverFocused,primary:14,secondary:[2064],weight:100},metadata:{description:L(1265,"Go to the top of the editor hover.")}})}run(i,e){let t=kl.get(e);t&&t.goToTop()}},BCt=class extends xi{constructor(){super({id:v3i,label:L(1262,"Go To Bottom Hover"),precondition:ue.hoverFocused,kbOpts:{kbExpr:ue.hoverFocused,primary:13,secondary:[2066],weight:100},metadata:{description:L(1263,"Go to the bottom of the editor hover.")}})}run(i,e){let t=kl.get(e);t&&t.goToBottom()}},HCt=class extends xi{constructor(){super({id:x1,label:S3i,alias:"Increase Hover Verbosity Level",precondition:ue.hoverVisible})}run(i,e,t){let o=kl.get(e);if(!o)return;let n=t?.index!==void 0?t.index:o.focusedHoverPartIndex();o.updateHoverVerbosityLevel(0,n,t?.focus)}},UCt=class extends xi{constructor(){super({id:k1,label:y3i,alias:"Decrease Hover Verbosity Level",precondition:ue.hoverVisible})}run(i,e,t){let o=kl.get(e);if(!o)return;let n=t?.index!==void 0?t.index:o.focusedHoverPartIndex();kl.get(e)?.updateHoverVerbosityLevel(1,n,t?.focus)}};var zCt=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||yW(l)||o.push(...Yl(l).map(e))}return o}};var a6i=_,X7=class extends C{constructor(e,t){super();this._markdownRendererService=t;this.allowEditorOverflow=!0;this._renderDisposeables=this._register(new P);this._editor=e,this._isVisible=!1,this._messages=[],this._hover=this._register(new e7(!0)),this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible),this._hoverOperation=this._register(new Twe(this._editor,new zCt(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(Vo(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 X7.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=a6i("div.hover-row.markdown-hover"),l=R(s,a6i("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=Yn(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||!g7(t,e.x,e.y))&&this.hide()}};X7=I([m(1,Qn)],X7);var KCt=!1,Yg=class extends C{constructor(e,t){super();this._editor=e;this._instantiationService=t;this.shouldKeepOpenOnEditorMouseMoveOrLeave=!1;this._listenersStore=new P;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(Yg.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?g7(t,e.event.posx,e.event.posy):!1}_onEditorMouseUp(){this._hoverState.mouseDown=!1}_onEditorMouseLeave(e){this.shouldKeepOpenOnEditorMouseMoveOrLeave||(this._cancelScheduler(),this._isMouseOnGlyphHoverWidget(e))||KCt||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(!PIt(this._hoverSettings.enabled,this._editor.getOption(86),e)){if(KCt)return;this.hideGlyphHover();return}this._tryShowHoverWidget(e)||KCt||this.hideGlyphHover()}_tryShowHoverWidget(e){return this._getOrCreateGlyphWidget().showsOrWillShow(e)}_onKeyDown(e){if(this._editor.hasModel()){if(this._hoverSettings.enabled==="onKeyboardModifier"&&h5e(this._editor.getOption(86),e)&&this._mouseMoveEvent){this._tryShowHoverWidget(this._mouseMoveEvent);return}tN(e.keyCode)||this.hideGlyphHover()}}hideGlyphHover(){KCt||this._glyphWidget?.hide()}_getOrCreateGlyphWidget(){return this._glyphWidget||(this._glyphWidget=this._instantiationService.createInstance(X7,this._editor)),this._glyphWidget}dispose(){super.dispose(),this._unhookListeners(),this._listenersStore.dispose(),this._glyphWidget?.dispose()}};Yg=I([m(1,F)],Yg);var Nai;(e=>(e.increaseVerbosity=d(1259,null,`<keybinding:${x1}>`),e.decreaseVerbosity=d(1258,null,`<keybinding:${k1}>`)))(Nai||={});var GCt=class{constructor(){this.type="view";this.priority=95;this.name="hover";this.when=ue.hoverFocused}getProvider(i){let e=i.get(Kt),t=e.getActiveCodeEditor()||e.getFocusedCodeEditor();if(!t)throw new Error("No active or focused code editor");let o=kl.get(t);if(!o)return;let n=i.get(_e);return i.get(F).createInstance(Oai,n,t,o)}},$Ct=class{constructor(){this.priority=100;this.name="hover";this.type="help";this.when=ue.hoverVisible}getProvider(i){let e=i.get(Kt),t=e.getActiveCodeEditor()||e.getFocusedCodeEditor();if(!t)throw new Error("No active or focused code editor");let o=kl.get(t);if(o)return i.get(F).createInstance(jCt,o)}},qCt=class extends C{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 Nai.increaseVerbosity;case 1:return Nai.decreaseVerbosity}}},jCt=class extends qCt{constructor(e){super(e);this.options={type:"help"}}provideContent(){return this.provideContentAtIndex(this._focusedHoverPartIndex,!0)}},Oai=class extends qCt{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=x1,n=b3i,r=M.add;break;case 1:o=k1,n=I3i,r=M.remove;break}let s=xoi(this._keybindingService,t),l=this._hoverController.doesHoverAtIndexSupportVerbosityAction(this._focusedHoverPartIndex,t);return new st(n,s,q.asClassName(r),l,()=>{e.getAction(o)?.run({index:this._focusedHoverPartIndex,focus:!1})})}_initializeOptions(e,t){let o=this._register(new jCt(t));this.options.language=e.getModel()?.getLanguageId(),this.options.customHelp=()=>o.provideContentAtIndex(this._focusedHoverPartIndex,!0)}},QCt=class{constructor(){this.type="view";this.priority=90;this.name="extension-hover"}getProvider(i){let t=i.get(_n).getContextViewElement(),o=t?.textContent??void 0,n=i.get(tt);if(!(t.classList.contains("accessible-view-container")||!o))return new tp("hover",{language:"typescript",type:"view"},()=>o,()=>{n.showAndFocusLastHover()},"accessibility.verbosity.hover")}};go(kl.ID,kl,2);go(Yg.ID,Yg,2);Jt(LCt);Jt(RCt);Jt(MCt);Jt(PCt);Jt(ACt);Jt(NCt);Jt(OCt);Jt(FCt);Jt(WCt);Jt(VCt);Jt(BCt);Jt(HCt);Jt(UCt);d_.register(P1);d_.register(eCe);qe.registerCommand(d5e,a=>{a.get(B).updateValue("editor.hover.showLongLineWarning",!1)});is((a,i)=>{let e=a.getColor(OU);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)}; }`))});xa.register(new GCt);xa.register(new $Ct);xa.register(new QCt);function Fai(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 lse(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,Xv.shiftIndent(v,v.length+b,r,s,l)),u=(v,b)=>(b=b||1,Xv.unshiftIndent(v,v.length+b,r,s,l)),p=[],h=a.getLineContent(e),g=bl(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(GBo(a,v))continue;let b=a.getLineContent(v),S=bl(b),y=f;n.shouldDecrease(v,y)&&(f=u(f),g=u(g)),S!==f&&p.push(An.replaceMove(new Yt(v,1,v,S.length+1),sSe(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 GBo(a,i){return a.tokenization.isCheapToTokenize(i)?a.tokenization.getLineTokens(i).getStandardTokenType(0)===2:!1}var r3e=class a extends xi{static{this.ID="editor.action.indentationToSpaces"}constructor(){super({id:a.ID,label:L(1310,"Convert Indentation to Spaces"),precondition:ue.writable,metadata:{description:L(1311,"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 Hai(n,o.tabSize);e.pushUndoStop(),e.executeCommands(this.id,[r]),e.pushUndoStop(),t.updateOptions({insertSpaces:!0})}},s3e=class a extends xi{static{this.ID="editor.action.indentationToTabs"}constructor(){super({id:a.ID,label:L(1312,"Convert Indentation to Tabs"),precondition:ue.writable,metadata:{description:L(1313,"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 Uai(n,o.tabSize);e.pushUndoStop(),e.executeCommands(this.id,[r]),e.pushUndoStop(),t.updateOptions({insertSpaces:!1})}},a3e=class extends xi{constructor(e,t,o){super(o);this.insertSpaces=e;this.displaySizeOnly=t}run(e,t){let o=e.get(Ge),n=e.get(Ct),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(1301,null):p===s.tabSize?d(1303,null):p===l.tabSize?d(1302,null):void 0})),u=Math.min(r.getOptions().tabSize-1,7);setTimeout(()=>{o.pick(c,{placeHolder:d(1318,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)}},l3e=class a extends a3e{static{this.ID="editor.action.indentUsingTabs"}constructor(){super(!1,!1,{id:a.ID,label:L(1316,"Indent Using Tabs"),precondition:void 0,metadata:{description:L(1317,"Use indentation with tabs.")}})}},c3e=class a extends a3e{static{this.ID="editor.action.indentUsingSpaces"}constructor(){super(!0,!1,{id:a.ID,label:L(1314,"Indent Using Spaces"),precondition:void 0,metadata:{description:L(1315,"Use indentation with spaces.")}})}},d3e=class a extends a3e{static{this.ID="editor.action.changeTabDisplaySize"}constructor(){super(!0,!0,{id:a.ID,label:L(1299,"Change Tab Display Size"),precondition:void 0,metadata:{description:L(1300,"Change the space size equivalent of the tab.")}})}},u3e=class a extends xi{static{this.ID="editor.action.detectIndentation"}constructor(){super({id:a.ID,label:L(1304,"Detect Indentation from Content"),precondition:void 0,metadata:{description:L(1305,"Detect the indentation from content.")}})}run(i,e){let t=i.get(Ct),o=e.getModel();if(!o)return;let n=t.getCreationOptions(o.getLanguageId(),o.uri,o.isForSimpleWidget);o.detectIndentation(n.insertSpaces,n.tabSize)}},Wai=class extends xi{constructor(){super({id:"editor.action.reindentlines",label:L(1306,"Reindent Lines"),precondition:ue.writable,metadata:{description:L(1307,"Reindent the lines of the editor.")},canTriggerInlineEdits:!0})}run(i,e){let t=i.get(bs),o=e.getModel();if(!o)return;let n=Fai(o,t,1,o.getLineCount());n.length>0&&(e.pushUndoStop(),e.executeEdits(this.id,n),e.pushUndoStop())}},Vai=class extends xi{constructor(){super({id:"editor.action.reindentselectedlines",label:L(1308,"Reindent Selected Lines"),precondition:ue.writable,metadata:{description:L(1309,"Reindent the selected lines of the editor.")},canTriggerInlineEdits:!0})}run(i,e){let t=i.get(bs),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=Fai(o,t,l,c);r.push(...u)}r.length>0&&(e.pushUndoStop(),e.executeEdits(this.id,r),e.pushUndoStop())}},Bai=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)}},QCe=class{constructor(i,e){this.editor=i;this._languageConfigurationService=e;this.callOnDispose=new P;this.callOnModel=new P;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)&&$Bo(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=>Xv.shiftIndent(f,f.length+1,r,s,l),unshiftIndent:f=>Xv.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=use(n,t,t.getLanguageId(),p,u,this._languageConfigurationService);if(f!==null){let v=bl(h),b=Ax(f,r),S=Ax(v,r);if(b!==S){let y=Ile(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=nht(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=use(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=Ax(v,r),S=Ax(bl(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=bl(k),O=Ax(T,r)+y,V=Ile(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 Bai(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()}};QCe=I([m(1,bs)],QCe);function $Bo(a,i){let e=t=>BKi(a,t)===2;return e(i.getStartPosition())||e(i.getEndPosition())}function l6i(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 Hai=class{constructor(i,e){this.selection=i;this.tabSize=e;this.selectionId=null}getEditOperations(i,e){this.selectionId=e.trackSelection(this.selection),l6i(i,e,this.tabSize,!0)}computeCursorState(i,e){return e.getTrackedSelection(this.selectionId)}},Uai=class{constructor(i,e){this.selection=i;this.tabSize=e;this.selectionId=null}getEditOperations(i,e){this.selectionId=e.trackSelection(this.selection),l6i(i,e,this.tabSize,!1)}computeCursorState(i,e){return e.getTrackedSelection(this.selectionId)}};go(QCe.ID,QCe,2);Jt(r3e);Jt(s3e);Jt(l3e);Jt(c3e);Jt(d3e);Jt(u3e);Jt(Wai);Jt(Vai);go(wE.ID,wE,1);d_.register(_7);var YCt=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 Yt(o.endLineNumber,Math.min(this._originalSelection.positionColumn,o.endColumn),o.endLineNumber,Math.min(this._originalSelection.positionColumn,o.endColumn)):new Yt(o.endLineNumber,o.endColumn-this._text.length,o.endLineNumber,o.endColumn)}};var zW=class{static{this.ID="editor.contrib.inPlaceReplaceController"}static get(i){return i.getContribution(zW.ID)}static{this.DECORATION=po.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 y1(this.editor,5),s=o.uri;return this.editorWorkerService.canNavigateValueSet(s)?(this.currentRequest=xn(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 Yt(n.startLineNumber,n.startColumn,n.endLineNumber,n.endColumn+p-1));let h=new YCt(c,n,l.value);this.editor.pushUndoStop(),this.editor.executeCommand(i,h),this.editor.pushUndoStop(),this.decorations.set([{range:u,options:zW.DECORATION}]),this.decorationRemover?.cancel(),this.decorationRemover=Pi(350),this.decorationRemover.then(()=>this.decorations.clear()).catch(mt)}).catch(mt)):Promise.resolve(void 0)}};zW=I([m(1,$s)],zW);var zai=class extends xi{constructor(){super({id:"editor.action.inPlaceReplace.up",label:L(1399,"Replace with Previous Value"),precondition:ue.writable,kbOpts:{kbExpr:ue.editorTextFocus,primary:3159,weight:100}})}run(i,e){let t=zW.get(e);return t?t.run(this.id,!1):Promise.resolve(void 0)}},Kai=class extends xi{constructor(){super({id:"editor.action.inPlaceReplace.down",label:L(1398,"Replace with Next Value"),precondition:ue.writable,kbOpts:{kbExpr:ue.editorTextFocus,primary:3161,weight:100}})}run(i,e){let t=zW.get(e);return t?t.run(this.id,!0):Promise.resolve(void 0)}};go(zW.ID,zW,4);Jt(zai);Jt(Kai);var XCt=class{constructor(i){this._selection=i,this._selectionId=null}getEditOperations(i,e){let t=qBo(i);t&&e.addEditOperation(t.range,t.text),this._selectionId=e.trackSelection(this._selection)}computeCursorState(i,e){return e.getTrackedSelection(this._selectionId)}};function qBo(a){let i=a.getLineCount(),e=a.getLineContent(i),t=tv(e)===-1;if(!(!i||t))return An.insert(new Ie(i,a.getLineMaxColumn(i)),a.getEOL())}var Gai=class a extends xi{static{this.ID="editor.action.insertFinalNewLine"}constructor(){super({id:a.ID,label:L(1400,"Insert Final New Line"),precondition:ue.writable})}run(i,e,t){let o=e.getSelection();if(o===null)return;let n=new XCt(o);e.pushUndoStop(),e.executeCommands(this.id,[n]),e.pushUndoStop()}};Jt(Gai);var $ai=class extends xi{constructor(){super({id:"expandLineSelection",label:L(1401,"Expand Line Selection"),precondition:void 0,kbOpts:{weight:0,kbExpr:ue.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,Wg.expandLineSelection(o,o.getCursorStates())),o.revealAllCursors(t.source,!0)}};Jt($ai);var c6i=new Q("LinkedEditingInputVisible",!1),jBo="linked-editing-decoration",KW=class extends C{constructor(e,t,o,n,r){super();this.languageConfigurationService=n;this._syncRangesToken=0;this._localToDispose=this._register(new P);this._editor=e,this._providers=o.linkedEditingRangeProvider,this._enabled=!1,this._visibleContextKey=c6i.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 P),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=po.register({description:"linked-editing",stickiness:0,className:jBo})}static get(e){return e.getContribution(KW.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(H.runAndSubscribe(t.onDidChangeLanguageConfiguration,()=>{this._languageWordPattern=this.languageConfigurationService.getLanguageConfiguration(t.getLanguageId()).getWordDefinition()}));let n=new jo(this._debounceInformation.get(t)),r=()=>{this._rangeUpdateTriggerPromise=n.trigger(()=>this.updateRanges(),this._debounceDuration??this._debounceInformation.get(t))},s=new jo(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=Ng(u,p);h+=f,u=u.substr(f),p=p.substr(f);let v=zw(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 $e;try{let s=new En(!1),l=await d6i(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:KW.DECORATION}));this._visibleContextKey.set(!0),this._currentDecorations.set(p),this._syncRangesToken++}catch(s){so(s)||mt(s),(this._currentRequestCts===r||!this._currentRequestCts)&&this.clearRanges()}}setDebounceDuration(e){this._debounceDuration=e}};KW=I([m(1,X),m(2,zt),m(3,bs),m(4,jg)],KW);var qai=class extends xi{constructor(){super({id:"editor.action.linkedEditing",label:L(1434,"Start Linked Editing"),precondition:x.and(ue.writable,ue.hasRenameProvider),kbOpts:{kbExpr:ue.editorTextFocus,primary:3132,weight:100}})}runCommand(i,e){let t=i.get(Kt),[o,n]=Array.isArray(e)&&e||[void 0,void 0];return A.isUri(o)&&Ie.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=KW.get(e);return t?Promise.resolve(t.updateRanges(!0)):Promise.resolve()}},QBo=xc.bindToContribution(KW.get);qi(new QBo({id:"cancelLinkedEditingInput",precondition:c6i,handler:a=>a.clearRanges(),kbOpts:{kbExpr:ue.editorTextFocus,weight:199,primary:9,secondary:[1033]}}));function d6i(a,i,e,t){let o=a.ordered(i);return Lre(o.map(n=>async()=>{try{return await n.provideLinkedEditingRanges(i,e,t)}catch(r){ss(r);return}}),n=>!!n&&dr(n?.ranges))}var NBs=J("editor.linkedEditingBackground",{dark:Oe.fromHex("#f00").transparent(.3),light:Oe.fromHex("#f00").transparent(.3),hcDark:Oe.fromHex("#f00").transparent(.3),hcLight:Oe.white},d(1433,null));kS("_executeLinkedEditingProvider",(a,i,e)=>{let{linkedEditingRangeProvider:t}=a.get(zt);return d6i(t,i,e,ve.None)});go(KW.ID,KW,1);Jt(qai);var jai=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"))}},JCt=class a{constructor(i){this._disposables=new P;let e=[];for(let[t,o]of i){let n=t.links.map(r=>new jai(r,o));e=a._union(e,n),Ac(t)&&(this._disposables??=new P,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 Qai(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){ss(l)}});await Promise.all(o);let n=new JCt(si(t));return e.isCancellationRequested&&(n.dispose(),n=JCt.Empty),n}qe.registerCommand("_executeLinkProvider",async(a,...i)=>{let[e,t]=i;So(e instanceof A),typeof t!="number"&&(t=0);let{linkProvider:o}=a.get(zt),n=a.get(Ct).getModel(e);if(!n)return[];let r=await Qai(o,n,ve.None);if(!r)return[];for(let l=0;l<Math.min(t,r.links.length);l++)await r.links[l].resolve(ve.None);let s=r.links.slice(0);return r.dispose(),s});var Fx=class extends C{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 sO(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(Fx.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=xn(t=>Qai(this.providers,e,t));try{let t=new En(!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(ZCt.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 ZCt(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(ve.None).then(r=>{if(typeof r=="string"&&this.editor.hasModel()){let s=this.editor.getModel().uri;if(s.scheme===Y.file&&r.startsWith(`${Y.file}:`)){let l=A.parse(r);if(l.scheme===Y.file){let c=q0(l),u=null;c.startsWith("/./")||c.startsWith("\\.\\")?u=`.${c.substr(1)}`:(c.startsWith("//./")||c.startsWith("\\\\.\\"))&&(u=`.${c.substr(2)}`),u&&(r=je(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(1435,null,n.url.toString())):s==="missing"?this.notificationService.warn(d(1443,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()}};Fx=I([m(1,Qe),m(2,Ne),m(3,zt),m(4,jg)],Fx);var u6i={general:po.register({description:"detected-link",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link"}),active:po.register({description:"detected-link-active",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link-active"})},ZCt=class a{static decoration(i,e){return{range:i.range,options:a._getOptions(i,e,!1)}}static _getOptions(i,e,t){let o={...t?u6i.active:u6i.general};return o.hoverMessage=YBo(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 YBo(a,i){let e=a.url&&/^command:/i.test(a.url.toString()),t=a.tooltip?a.tooltip:e?d(1437,null):d(1438,null),o=i?it?d(1442,null):d(1441,null):it?d(1440,null):d(1439,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(1444,null,l)}}return new xe("",!0).appendLink(a.url.toString(!0).replace(/ /g,"%20"),t,n).appendMarkdown(` (${o})`)}else return new xe().appendText(`${t} (${o})`)}var Yai=class extends xi{constructor(){super({id:"editor.action.openLink",label:L(1436,"Open Link"),precondition:void 0})}run(i,e){let t=Fx.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)}}};go(Fx.ID,Fx,1);Jt(Yai);var ext=class a extends C{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)}};go(ext.ID,ext,2);var p3e=class a extends C{constructor(e){super();this._editor=e;let t=os(this._editor),o=t.getOption(171);this._register(he(n=>{if(!o.read(n))return;let r=t.domNode.read(n);if(!r)return;let s=n.store.add(X0("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 P,h=new Uh(c.event.posx,c.event.posy),f=XBo(Me(r),h,p).map(S=>S.subtract(h).withThreshold(5)),v=r.getBoundingClientRect(),b=new Uh(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(he(c=>{let u=s.read(c);if(!u)return;let p=Date.now();c.store.add(he(g=>{P4e.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 Uh(this._editor.getScrollLeft(),this._editor.getScrollTop());this._editor.setScrollPosition(JBo(w.add(y))),y.isZero()||(u.didScroll=!0)}));let h=Ce(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(he(g=>{r.setAttribute("data-scroll-direction",h.read(g))}))}));let l=n.store.add(Mo.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(wq(r,l.element)),n.store.add(he(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 XBo(a,i,e){let t=Le("pos",i);return e.add(j(a,"mousemove",o=>{t.set(new Uh(o.pageX,o.pageY),void 0)})),t}function JBo(a){return{scrollLeft:a.x,scrollTop:a.y}}go(p3e.ID,p3e,2);var eHo=J("editor.wordHighlightBackground",{dark:"#575757B8",light:"#57575740",hcDark:null,hcLight:null},d(1723,null),!0);J("editor.wordHighlightStrongBackground",{dark:"#004972B8",light:"#0e639c40",hcDark:null,hcLight:null},d(1725,null),!0);J("editor.wordHighlightTextBackground",eHo,d(1727,null),!0);var tHo=J("editor.wordHighlightBorder",{light:null,dark:null,hcDark:qs,hcLight:qs},d(1724,null));J("editor.wordHighlightStrongBorder",{light:null,dark:null,hcDark:qs,hcLight:qs},d(1726,null));J("editor.wordHighlightTextBorder",tHo,d(1728,null));var iHo=J("editorOverviewRuler.wordHighlightForeground","#A0A0A0CC",d(1720,null),!0),oHo=J("editorOverviewRuler.wordHighlightStrongForeground","#C0A0C0CC",d(1721,null),!0),nHo=J("editorOverviewRuler.wordHighlightTextForeground",XSe,d(1722,null),!0),rHo=po.register({description:"word-highlight-strong",stickiness:1,className:"wordHighlightStrong",overviewRuler:{color:Ss(oHo),position:2},minimap:{color:Ss(W$e),position:1}}),sHo=po.register({description:"word-highlight-text",stickiness:1,className:"wordHighlightText",overviewRuler:{color:Ss(nHo),position:2},minimap:{color:Ss(W$e),position:1}}),aHo=po.register({description:"selection-highlight-overview",stickiness:1,className:"selectionHighlight",overviewRuler:{color:Ss(XSe),position:2},minimap:{color:Ss(W$e),position:1}}),lHo=po.register({description:"selection-highlight",stickiness:1,className:"selectionHighlight"}),cHo=po.register({description:"word-highlight",stickiness:1,className:"wordHighlight",overviewRuler:{color:Ss(iHo),position:2},minimap:{color:Ss(W$e),position:1}});function p6i(a){return a===2?rHo:a===0?sHo:cHo}function m6i(a){return a?lHo:aHo}is((a,i)=>{let e=a.getColor(YSe);e&&i.addRule(`.monaco-editor .selectionHighlight { background-color: ${e.transparent(.5)}; }`)});function tY(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(1449,null,t):d(1450,null,t);Or(o)}}var Xai=class extends xi{constructor(){super({id:"editor.action.insertCursorAbove",label:L(1465,"Add Cursor Above"),precondition:void 0,kbOpts:{kbExpr:ue.editorTextFocus,primary:2576,linux:{primary:1552,secondary:[3088]},weight:100},menuOpts:{menuId:D.MenubarSelectionMenu,group:"3_multi",title:d(1453,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,Wg.addCursorUp(n,r,o)),n.revealTopMostCursor(t.source),tY(r,n.getCursorStates())}},Jai=class extends xi{constructor(){super({id:"editor.action.insertCursorBelow",label:L(1467,"Add Cursor Below"),precondition:void 0,kbOpts:{kbExpr:ue.editorTextFocus,primary:2578,linux:{primary:1554,secondary:[3090]},weight:100},menuOpts:{menuId:D.MenubarSelectionMenu,group:"3_multi",title:d(1455,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,Wg.addCursorDown(n,r,o)),n.revealBottomMostCursor(t.source),tY(r,n.getCursorStates())}},Zai=class extends xi{constructor(){super({id:"editor.action.insertCursorAtEndOfEachLineSelected",label:L(1466,"Add Cursors to Line Ends"),precondition:void 0,kbOpts:{kbExpr:ue.editorTextFocus,primary:1575,weight:100},menuOpts:{menuId:D.MenubarSelectionMenu,group:"3_multi",title:d(1454,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 Yt(o,n,o,n))}i.endColumn>1&&t.push(new Yt(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),tY(r,n.getCursorStates())}},eli=class extends xi{constructor(){super({id:"editor.action.addCursorsToBottom",label:L(1459,"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 Yt(l,t[0].startColumn,l,t[0].endColumn));let r=e._getViewModel(),s=r.getCursorStates();n.length>0&&e.setSelections(n),tY(s,r.getCursorStates())}},tli=class extends xi{constructor(){super({id:"editor.action.addCursorsToTop",label:L(1460,"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 Yt(s,t[0].startColumn,s,t[0].endColumn));let n=e._getViewModel(),r=n.getCursorStates();o.length>0&&e.setSelections(o),tY(r,n.getCursorStates())}},YCe=class{constructor(i,e,t){this.selections=i;this.revealRange=e;this.revealScrollType=t}},txt=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 Yt(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 YCe(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 YCe(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 Yt(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 YCe(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 YCe(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 Yt(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)}},Z7=class a extends C{constructor(e){super();this._sessionDispose=this._register(new P);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=txt.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 Yt(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(!g6i(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 Yt(r.range.startLineNumber,r.range.startColumn,r.range.endLineNumber,r.range.endColumn)))}}selectAllUsingSelections(e){e.length>0&&this._setSelections(e)}},eY=class extends xi{run(i,e){let t=Z7.get(e);if(!t)return;let o=e._getViewModel();if(o){let n=o.getCursorStates(),r=Tf.get(e);if(r)this._run(t,r);else{let s=i.get(F).createInstance(Tf,e);this._run(t,s),s.dispose()}tY(n,o.getCursorStates())}}},ili=class extends eY{constructor(){super({id:"editor.action.addSelectionToNextFindMatch",label:L(1446,"Add Selection to Next Find Match"),precondition:void 0,kbOpts:{kbExpr:ue.focus,primary:2082,weight:100},menuOpts:{menuId:D.MenubarSelectionMenu,group:"3_multi",title:d(1451,null),order:5}})}_run(i,e){i.addSelectionToNextFindMatch(e)}},oli=class extends eY{constructor(){super({id:"editor.action.addSelectionToPreviousFindMatch",label:L(1447,"Add Selection to Previous Find Match"),precondition:void 0,menuOpts:{menuId:D.MenubarSelectionMenu,group:"3_multi",title:d(1452,null),order:6}})}_run(i,e){i.addSelectionToPreviousFindMatch(e)}},nli=class extends eY{constructor(){super({id:"editor.action.moveSelectionToNextFindMatch",label:L(1457,"Move Last Selection to Next Find Match"),precondition:void 0,kbOpts:{kbExpr:ue.focus,primary:Ai(2089,2082),weight:100}})}_run(i,e){i.moveSelectionToNextFindMatch(e)}},rli=class extends eY{constructor(){super({id:"editor.action.moveSelectionToPreviousFindMatch",label:L(1458,"Move Last Selection to Previous Find Match"),precondition:void 0})}_run(i,e){i.moveSelectionToPreviousFindMatch(e)}},sli=class extends eY{constructor(){super({id:"editor.action.selectHighlights",label:L(1468,"Select All Occurrences of Find Match"),precondition:void 0,kbOpts:{kbExpr:ue.focus,primary:3114,weight:100},menuOpts:{menuId:D.MenubarSelectionMenu,group:"3_multi",title:d(1456,null),order:7}})}_run(i,e){i.selectAll(e)}},ali=class extends eY{constructor(){super({id:"editor.action.changeAll",label:L(1448,"Change All Occurrences"),precondition:x.and(ue.writable,ue.editorTextFocus),kbOpts:{kbExpr:ue.editorTextFocus,primary:2108,weight:100},contextMenuOpts:{group:"1_modification",order:1.2}})}_run(i,e){i.selectAll(e)}},lli=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}},J7=class extends C{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=Tf.get(e);o&&this._register(o.getState().onFindReplaceStateChange(n=>{this._update()})),this.updateSoon.schedule()}static{this.ID="editor.contrib.selectionHighlighter"}_update(){this._setState(J7._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=Z7.get(r);if(!s)return null;let l=Tf.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(!g6i(r.getModel(),h,f))return null}c=txt.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 lli(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:m6i(l)}));this._decorations.set(c)}dispose(){this._setState(null),super.dispose()}};J7=I([m(1,zt)],J7);function g6i(a,i,e){let t=h6i(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=h6i(a,r,!e);if(t!==s)return!1}return!0}function h6i(a,i,e){let t=a.getValueInRange(i);return e?t.toLowerCase():t}var cli=class extends xi{constructor(){super({id:"editor.action.focusNextCursor",label:L(1461,"Focus Next Cursor"),metadata:{description:d(1462,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),tY(n,o.getCursorStates()))}},dli=class extends xi{constructor(){super({id:"editor.action.focusPreviousCursor",label:L(1463,"Focus Previous Cursor"),metadata:{description:d(1464,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),tY(n,o.getCursorStates()))}};go(Z7.ID,Z7,4);go(J7.ID,J7,1);Jt(Xai);Jt(Jai);Jt(Zai);Jt(ili);Jt(oli);Jt(nli);Jt(rli);Jt(sli);Jt(ali);Jt(eli);Jt(tli);Jt(cli);Jt(dli);var uj={Visible:new Q("parameterHintsVisible",!1),MultipleSignatures:new Q("parameterHintsMultipleSignatures",!1)};async function uli(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){ss(s)}}qe.registerCommand("_executeSignatureHelpProvider",async(a,...i)=>{let[e,t,o]=i;So(A.isUri(e)),So(Ie.isIPosition(t)),So(typeof o=="string"||!o);let n=a.get(zt),r=await a.get(Nt).createModelReference(e);try{let s=await uli(n.signatureHelpProvider,r.object.textEditorModel,Ie.lift(t),{triggerKind:1,isRetrigger:!1,triggerCharacter:o},ve.None);return s?(setTimeout(()=>s.dispose(),0),s.value):void 0}finally{r.dispose()}});var Ple;(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})(Ple||={});var ixt=class a extends C{constructor(e,t,o=a.DEFAULT_DELAY){super();this._onChangedHints=this._register(new E);this.onChangedHints=this._onChangedHints.event;this.triggerOnType=!1;this._state=Ple.Default;this._pendingTriggers=[];this._lastSignatureHelpResult=this._register(new me);this.triggerChars=new D$;this.retriggerChars=new D$;this.triggerId=0;this.editor=e,this.providers=t,this.throttledDelayer=this._register(new jo(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=Ple.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 Ple.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(dHo);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 Ple.Pending(xn(c=>uli(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 Ple.Active(c.value),this._lastSignatureHelpResult.value=c,this._onChangedHints.fire(this.state.hints),!0)}catch(c){return e===this.triggerId&&(this.state=Ple.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 dHo(a,i){switch(i.triggerKind){case 1:return i;case 3:return a;case 2:default:return i}}var VL=_,uHo=Re("parameter-hints-next",M.chevronDown,d(1472,null)),pHo=Re("parameter-hints-previous",M.chevronUp,d(1473,null)),iY=class extends C{constructor(e,t,o,n){super();this.editor=e;this.model=t;this.markdownRendererService=n;this.renderDisposeables=this._register(new P);this.visible=!1;this.announcedLabel=null;this.allowEditorOverflow=!0;this.keyVisible=uj.Visible.bindTo(o),this.keyMultipleSignatures=uj.MultipleSignatures.bindTo(o)}static{this.ID="editor.widget.parameterHintsWidget"}createParameterHintDOMNodes(){let e=VL(".editor-widget.parameter-hints-widget"),t=R(e,VL(".phwrapper"));t.tabIndex=-1;let o=R(t,VL(".controls")),n=R(o,VL(".button"+q.asCSSSelector(pHo))),r=R(o,VL(".overloads")),s=R(o,VL(".button"+q.asCSSSelector(uHo)));this._register(j(n,"click",g=>{$t.stop(g),this.previous()})),this._register(j(s,"click",g=>{$t.stop(g),this.next()}));let l=VL(".body"),c=new Pa(l,{alwaysConsumeMouseWheel:!0});this._register(c),t.appendChild(c.getDomNode());let u=R(l,VL(".signature")),p=R(l,VL(".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",Yd.fontFamily)};h(),this._register(H.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=R(this.domNodes.signature,VL(".code")),r=o.parameters.length>0,s=o.activeParameter??e.activeParameter;if(r)this.renderParameters(n,o,s);else{let u=R(n,VL("span"));u.textContent=o.label}let l=o.parameters[s];if(l?.documentation){let u=VL("span.documentation");if(typeof l.documentation=="string")u.textContent=l.documentation;else{let p=this.renderMarkdownDocs(l.documentation);u.appendChild(p.element)}R(this.domNodes.docs,VL("p",{},u))}if(o.documentation!==void 0)if(typeof o.documentation=="string")R(this.domNodes.docs,VL("p",{},o.documentation));else{let u=this.renderMarkdownDocs(o.documentation);R(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&&(Jo(d(1471,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"&&Oi(t.documentation).length>0||t&&typeof t.documentation=="object"&&Oi(t.documentation).value.length>0||e.documentation&&typeof e.documentation=="string"&&Oi(e.documentation).length>0||e.documentation&&typeof e.documentation=="object"&&Oi(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),R(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|^)${Yr(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 iY.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)}};iY=I([m(2,X),m(3,Qn)],iY);J("editorHoverWidget.highlightForeground",l9,d(1470,null));var IO=class extends C{static{this.ID="editor.controller.parameterHints"}static get(i){return i.getContribution(IO.ID)}constructor(i,e,t){super(),this.editor=i,this.model=this._register(new ixt(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(iY,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)}};IO=I([m(1,F),m(2,zt)],IO);var pli=class extends xi{constructor(){super({id:"editor.action.triggerParameterHints",label:L(1469,"Trigger Parameter Hints"),precondition:ue.hasSignatureHelpProvider,kbOpts:{kbExpr:ue.editorTextFocus,primary:3082,weight:100}})}run(i,e){IO.get(e)?.trigger({triggerKind:1})}};go(IO.ID,IO,2);Jt(pli);var mli=175,hli=xc.bindToContribution(IO.get);qi(new hli({id:"closeParameterHints",precondition:uj.Visible,handler:a=>a.cancel(),kbOpts:{weight:mli,kbExpr:ue.focus,primary:9,secondary:[1033]}}));qi(new hli({id:"showPrevParameterHint",precondition:x.and(uj.Visible,uj.MultipleSignatures),handler:a=>a.previous(),kbOpts:{weight:mli,kbExpr:ue.focus,primary:16,secondary:[528],mac:{primary:16,secondary:[528,302]}}}));qi(new hli({id:"showNextParameterHint",precondition:x.and(uj.Visible,uj.MultipleSignatures),handler:a=>a.next(),kbOpts:{weight:mli,kbExpr:ue.focus,primary:18,secondary:[530],mac:{primary:18,secondary:[530,300]}}}));var GW=class a extends C{constructor(e){super();this._editor=e;this._editorObs=os(this._editor),this._placeholderText=this._editorObs.getOption(100),this._state=hs({owner:this,equalsFn:VT},t=>{let o=this._placeholderText.read(t);if(o&&this._editorObs.valueIsEmpty.read(t))return{placeholder:o}}),this._shouldViewBeAlive=mHo(this,t=>this._state.read(t)?.placeholder!==void 0),this._view=Ce(t=>{if(!this._shouldViewBeAlive.read(t))return;let o=bt("div.editorPlaceholder");t.store.add(he(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(he(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(he(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:Oo(0),position:Oo(null),domNode:o.root}))}),this._view.recomputeInitiallyAndOnChange(this._store)}static get(e){return e.getContribution(a.ID)}static{this.ID="editor.contrib.placeholderText"}};function mHo(a,i){return vf(a,(e,t)=>t===!0?!0:i(e))}function v6i(a){return rE()?b6i(a,m3e):a()}var oxt=class{constructor(i){this.instantiationService=i}init(...i){}};function b6i(a,i){return class extends i{constructor(){super(...arguments);this._autorun=void 0}init(...o){this._autorun=Ga((n,r)=>{let s=Cx(a(),n);r.add(this.instantiationService.createInstance(s,...o))})}dispose(){this._autorun?.dispose()}}}var m3e=class extends oxt{constructor(i){super(i),this.init()}};m3e=I([m(0,F)],m3e);function S6i(a){return rE()?b6i(a,h3e):a()}var h3e=class extends oxt{constructor(i,e){super(e),this.init(i)}};h3e=I([m(1,F)],h3e);go(GW.ID,S6i(()=>GW),0);J("editor.placeholder.foreground",mqi,d(1492,null));var XCe=class extends C{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=>hHo(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()}};XCe=I([m(1,bs),m(2,$s)],XCe);function hHo(a){return{range:a.range,options:po.createDynamic({description:"section-header",stickiness:3,collapseOnReplaceEdit:!0,minimap:{color:void 0,position:1,sectionHeaderStyle:a.hasSeparatorLine?2:1,sectionHeaderText:a.text}})}}go(XCe.ID,XCe,1);var nxt=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 rxt=class a{static create(i,e){return new a(i,new gli(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]=OS(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 Ie(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)}},gli=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 sxt(this._tokens.subarray(4*r,4*s+4))}}return this._getDeltaLine(e)===i?new sxt(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 nxt(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)")})}}},sxt=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 axt=!1,JCe=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 vli}getMetadata(i,e,t){let o=this._languageService.languageIdCodec.encodeLanguageId(t),n=this._hashTable.get(i,e,o),r;if(n)r=n.metadata,axt&&this._logService.getLevel()===1&&this._logService.trace(`SemanticTokensProviderStyling [CACHED] ${i} / ${e}: foreground ${Qu.getForeground(r)}, fontStyle ${Qu.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;axt&&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 axt&&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),axt&&this._logService.getLevel()===1&&this._logService.trace(`SemanticTokensProviderStyling ${i} (${s}) / ${e} (${l.join(" ")}): foreground ${Qu.getForeground(r)}, fontStyle ${Qu.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}).`))}};JCe=I([m(1,De),m(2,kt),m(3,ne)],JCe);function lxt(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,N=w===0?c+k|0:k,O=t[y+2],V=N+O|0,U=t[y+3],G=t[y+4];if(V<=N)i.warnInvalidLengthSemanticTokens(T,N+1);else if(v===T&&b>N)i.warnOverlappingSemanticTokens(T,N+1);else{let $=i.getMetadata(U,G,e);$!==2147483647&&(f===0&&(f=T),h[g]=T-f,h[g+1]=N,h[g+2]=V,h[g+3]=$,g+=4,v=T,b=V)}l=T,c=N,s++}g!==h.length&&(h=h.subarray(0,g));let S=rxt.create(f,h);r.push(S)}return r}var fli=class{constructor(i,e,t,o){this.tokenTypeIndex=i,this.tokenModifierSet=e,this.languageId=t,this.metadata=o,this.next=null}},vli=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 fli(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 Ale=ae("semanticTokensStylingService");function I6i(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 gHo(a){let i=new Uint8Array(a.buffer,a.byteOffset,a.length*4);return lGe()||I6i(i),Je.wrap(i)}function fHo(a){let i=a.buffer;if(lGe()||I6i(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 bli(a){let i=new Uint32Array(vHo(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 gHo(i)}function vHo(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 Sli(a){let i=fHo(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 g3e(a){return a&&!!a.data}function wli(a){return a&&Array.isArray(a.edits)}var Ili=class{constructor(i,e,t){this.provider=i;this.tokens=e;this.error=t}};function Cli(a,i){return a.has(i)}function bHo(a,i){let e=a.orderedGroups(i);return e.length>0?e[0]:[]}async function xli(a,i,e,t,o){let n=bHo(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||!g3e(l)&&!wli(l))&&(l=null),new Ili(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 SHo(a,i){let e=a.orderedGroups(i);return e.length>0?e[0]:null}var yli=class{constructor(i,e){this.provider=i;this.tokens=e}};function y6i(a,i){return a.has(i)}function w6i(a,i){let e=a.orderedGroups(i);return e.length>0?e[0]:[]}async function cxt(a,i,e,t){let o=w6i(a,i),n=await Promise.all(o.map(async r=>{let s;try{s=await r.provideDocumentRangeSemanticTokens(i,e,t)}catch(l){ss(l),s=null}return(!s||!g3e(s))&&(s=null),new yli(r,s)}));for(let r of n)if(r.tokens)return r;return n.length>0?n[0]:null}qe.registerCommand("_provideDocumentSemanticTokensLegend",async(a,...i)=>{let[e]=i;So(e instanceof A);let t=a.get(Ct).getModel(e);if(!t)return;let{documentSemanticTokensProvider:o}=a.get(zt),n=SHo(o,t);return n?n[0].getLegend():a.get(ge).executeCommand("_provideDocumentRangeSemanticTokensLegend",e)});qe.registerCommand("_provideDocumentSemanticTokens",async(a,...i)=>{let[e]=i;So(e instanceof A);let t=a.get(Ct).getModel(e);if(!t)return;let{documentSemanticTokensProvider:o}=a.get(zt);if(!Cli(o,t))return a.get(ge).executeCommand("_provideDocumentRangeSemanticTokens",e,t.getFullModelRange());let n=await xli(o,t,null,null,ve.None);if(!n)return;let{provider:r,tokens:s}=n;if(!s||!g3e(s))return;let l=bli({id:0,type:"full",data:s.data});return s.resultId&&r.releaseDocumentSemanticTokens(s.resultId),l});qe.registerCommand("_provideDocumentRangeSemanticTokensLegend",async(a,...i)=>{let[e,t]=i;So(e instanceof A);let o=a.get(Ct).getModel(e);if(!o)return;let{documentRangeSemanticTokensProvider:n}=a.get(zt),r=w6i(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 cxt(n,o,z.lift(t),ve.None);if(s)return s.provider.getLegend()});qe.registerCommand("_provideDocumentRangeSemanticTokens",async(a,...i)=>{let[e,t]=i;So(e instanceof A),So(z.isIRange(t));let o=a.get(Ct).getModel(e);if(!o)return;let{documentRangeSemanticTokensProvider:n}=a.get(zt),r=await cxt(n,o,z.lift(t),ve.None);if(!(!r||!r.tokens))return bli({id:0,type:"full",data:r.tokens.data})});var Nle="editor.semanticHighlighting";function ZCe(a,i,e){let t=e.getValue(Nle,{overrideIdentifier:a.getLanguageId(),resource:a.uri})?.enabled;return typeof t=="boolean"?t:i.getColorTheme().semanticHighlighting}var f3e=class extends C{constructor(e,t,o,n,r,s){super();this._watchers=new vt;this._providerChangeListeners=this._register(new P);let l=s.documentSemanticTokensProvider,c=g=>{this._watchers.get(g.uri)?.dispose(),this._watchers.set(g.uri,new yO(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);ZCe(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=>{ZCe(g,o,n)&&c(g)}),this._register(t.onModelAdded(g=>{ZCe(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(Nle)&&p()})),this._register(o.onDidColorThemeChange(p)),h(),this._register(l.onDidChange(()=>{h();for(let g of this._watchers.values())g.handleRegistryChange()}))}dispose(){Ue(this._watchers.values()),this._watchers.clear(),super.dispose()}};f3e=I([m(0,Ale),m(1,Ct),m(2,De),m(3,B),m(4,jg),m(5,zt)],f3e);var yO=class extends C{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:yO.REQUEST_MIN_DELAY,max:yO.REQUEST_MAX_DELAY}),this._fetchDocumentSemanticTokens=this._register(new Dt(()=>this._fetchDocumentSemanticTokensNow(),yO.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(!Cli(this._provider,this._model)){this._currentDocumentResponse&&this._model.tokenization.setSemanticTokens(null,!1);return}if(!this._model.isAttachedToEditor())return;let e=new $e,t=this._currentDocumentResponse?this._currentDocumentResponse.provider:null,o=this._currentDocumentResponse&&this._currentDocumentResponse.resultId||null,n=xli(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 En(!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&&(so(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(wli(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&&(yO._copy(c,p-v,u,h-v,v),h-=v),f.data&&(yO._copy(f.data,0,u,h-f.data.length,f.data.length),h-=f.data.length),p=f.start}p>0&&yO._copy(c,0,u,0,p),t={resultId:t.resultId,data:u}}}if(g3e(t)){this._currentDocumentResponse=new kli(e,t.resultId,t.data);let l=lxt(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()}};yO=I([m(1,Ale),m(2,De),m(3,jg),m(4,zt)],yO);var kli=class{constructor(i,e,t){this.provider=i;this.resultId=e;this.data=t}dispose(){this.provider.releaseDocumentSemanticTokens(this.resultId)}};Dx(f3e);var $W=class extends C{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(Nle)&&(this._cancelAll(),l())})),this._register(this._themeService.onDidColorThemeChange(()=>{this._cancelAll(),l()})),l()}static{this.ID="editor.contrib.viewportSemanticTokens"}static get(e){return e.getContribution($W.ID)}dispose(){this._cleanupProviderListeners(),super.dispose()}_cleanupProviderListeners(){Ue(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(!ZCe(e,this._themeService,this._configurationService)){e.tokenization.hasSomeSemanticTokens()&&e.tokenization.setSemanticTokens(null,!1);return}if(!y6i(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=xn(s=>Promise.resolve(cxt(this._provider,e,t,s))),r=new En(!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,lxt(c,u,e.getLanguageId()))}).then(()=>this._removeOutstandingRequest(n),()=>this._removeOutstandingRequest(n)),n}};$W=I([m(1,Ale),m(2,De),m(3,B),m(4,jg),m(5,zt)],$W);go($W.ID,$W,1);var dxt=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(iU(p)&&Hk(u))break;u=p}for(l+=1;c<n.length;c++){let p=n.charCodeAt(c);if(Hk(p)&&iU(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 Eli=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}},wO=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(wO.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 C6i(this._languageFeaturesService.selectionRangeProvider,t,e.map(n=>n.getPosition()),this._editor.getOption(129),ve.None).then(n=>{if(!(!dr(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 Eli(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=>Yt.fromPositions(n.ranges[n.index].getStartPosition(),n.ranges[n.index].getEndPosition()));this._ignoreSelection=!0;try{this._editor.setSelections(o)}finally{this._ignoreSelection=!1}}};wO=I([m(1,zt)],wO);var uxt=class extends xi{constructor(i,e){super(e),this._forward=i}async run(i,e){let t=wO.get(e);t&&await t.run(this._forward)}},Tli=class extends uxt{constructor(){super(!0,{id:"editor.action.smartSelect.expand",label:L(1558,"Expand Selection"),precondition:void 0,kbOpts:{kbExpr:ue.editorTextFocus,primary:1553,mac:{primary:3345,secondary:[1297]},weight:100},menuOpts:{menuId:D.MenubarSelectionMenu,group:"1_basic",title:d(1556,null),order:2}})}};qe.registerCommandAlias("editor.action.smartSelect.grow","editor.action.smartSelect.expand");var _li=class extends uxt{constructor(){super(!1,{id:"editor.action.smartSelect.shrink",label:L(1559,"Shrink Selection"),precondition:void 0,kbOpts:{kbExpr:ue.editorTextFocus,primary:1551,mac:{primary:3343,secondary:[1295]},weight:100},menuOpts:{menuId:D.MenubarSelectionMenu,group:"1_basic",title:d(1557,null),order:3}})}};go(wO.ID,wO,4);Jt(Tli);Jt(_li);async function C6i(a,i,e,t,o){let n=a.all(i).concat(new dxt(t.selectSubwords));n.length===1&&n.unshift(new wCe);let r=[],s=[];for(let l of n)r.push(Promise.resolve(l.provideSelectionRanges(i,e,o)).then(c=>{if(dr(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))}},ss));return await Promise.all(r),s.map(l=>{if(l.length===0)return[];l.sort((h,g)=>Ie.isBefore(h.getStartPosition(),g.getStartPosition())?1:Ie.isBefore(g.getStartPosition(),h.getStartPosition())||Ie.isBefore(h.getEndPosition(),g.getEndPosition())?-1:Ie.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})}qe.registerCommand("_executeSelectionRangeProvider",async function(a,...i){let[e,t]=i;So(A.isUri(e)),So(N6t(t,r=>Ie.isIPosition(r)));let o=a.get(zt).selectionRangeProvider,n=await a.get(Nt).createModelReference(e);try{return C6i(o,n.object.textEditorModel,t.map(Ie.lift),{selectLeadingAndTrailingWhitespace:!0,selectSubwords:!0},ve.None)}finally{n.dispose()}});var We=Object.freeze({View:L(1802,"View"),Help:L(1799,"Help"),Test:L(1801,"Test"),File:L(1798,"File"),Preferences:L(1800,"Preferences"),Developer:L(1797,"Developer")});var pxt=class extends wl{constructor(){super({id:"editor.action.toggleStickyScroll",title:{...L(1611,"Toggle Editor Sticky Scroll"),mnemonicTitle:d(1606,null)},metadata:{description:L(1612,"Toggle/enable the editor sticky scroll which shows the nested scopes at the top of the viewport")},category:We.View,toggled:{condition:x.equals("config.editor.stickyScroll.enabled",!0),title:d(1610,null),mnemonicTitle:d(1605,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=rb.get(e)?.isFocused();t.updateValue("editor.stickyScroll.enabled",o),n&&e.focus()}},bxt=100,mxt=class extends wl{constructor(){super({id:"editor.action.focusStickyScroll",title:{...L(1602,"Focus Editor Sticky Scroll"),mnemonicTitle:d(1604,null)},precondition:x.and(x.has("config.editor.stickyScroll.enabled"),ue.stickyScrollVisible),menu:[{id:D.CommandPalette}]})}runEditorCommand(i,e){rb.get(e)?.focus()}},hxt=class extends wl{constructor(){super({id:"editor.action.selectNextStickyScrollLine",title:L(1608,"Select the next editor sticky scroll line"),precondition:ue.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:bxt,primary:18}})}runEditorCommand(i,e){rb.get(e)?.focusNext()}},gxt=class extends wl{constructor(){super({id:"editor.action.selectPreviousStickyScrollLine",title:L(1609,"Select the previous sticky scroll line"),precondition:ue.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:bxt,primary:16}})}runEditorCommand(i,e){rb.get(e)?.focusPrevious()}},fxt=class extends wl{constructor(){super({id:"editor.action.goToFocusedStickyScrollLine",title:L(1603,"Go to the focused sticky scroll line"),precondition:ue.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:bxt,primary:3}})}runEditorCommand(i,e){rb.get(e)?.goToFocused()}},vxt=class extends wl{constructor(){super({id:"editor.action.selectEditor",title:L(1607,"Select Editor"),precondition:ue.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:bxt,primary:9}})}runEditorCommand(i,e){rb.get(e)?.selectEditor()}};go(rb.ID,rb,1);W(pxt);W(mxt);W(gxt);W(hxt);W(fxt);W(vxt);var Dli=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}},v3e=class extends qH{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=ht.slice(t,o),r=ht.slice(t,0,o),s=5;for(let l of ht.concat(n,r)){if(l.score===uv.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 Dli(c,u,l.filterTextLow??l.labelLow,l.completion.additionalTextEdits,l.completion.command,l.completion.action,l)),s-->=0&&l.resolve(ve.None)}return e}};v3e=I([m(5,yCe)],v3e);var b3e=class extends C{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(FW.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(FW.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 V4e(g,t.column-this._lastResult.word.endColumn);this._lastResult.completionModel.lineContext=f,this._lastResult.acquire(),h=this._lastResult}else{let f=await Sle(this._languageFeatureService.completionProvider,e,t,new Jq(void 0,Q1.createSuggestFilter(r).itemKind,p?.providers),p&&{triggerKind:1,triggerCharacter:p.ch},n),v;f.needsClipboard&&(v=await this._clipboardService.readText());let b=new xCe(f.items,t.column,new V4e(g,0),CCe.None,r.getOption(134),r.getOption(128),{boostFullMatch:!1,firstMatchCanBeWeak:!1},v);h=new v3e(e,t.lineNumber,u,b,f,this._suggestMemoryService)}return this._lastResult=h,h}handleItemDidShow(e,t){t.completion.resolve(ve.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}}};b3e=I([m(0,zt),m(1,Wi),m(2,yCe),m(3,Kt)],b3e);Dx(b3e);var Lli=class extends xi{constructor(){super({id:"editor.action.forceRetokenize",label:L(1689,"Developer: Force Retokenize"),precondition:void 0})}run(i,e){if(!e.hasModel())return;let t=e.getModel();t.tokenization.resetTokenization();let o=new En;t.tokenization.forceTokenization(t.getLineCount()),o.stop(),console.log(`tokenization took ${o.elapsed()}`)}};Jt(Lli);var S3e=class a extends K{static{this.ID="editor.action.toggleTabFocusMode"}constructor(){super({id:a.ID,title:L(1686,"Toggle Tab Key Moves Focus"),precondition:void 0,keybinding:{primary:2091,mac:{primary:1323},weight:100},metadata:{description:L(1685,"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=!GT.getTabFocusMode();GT.setTabFocusMode(e),e?Jo(d(1688,null)):Jo(d(1687,null))}};W(S3e);var Xg=class extends C{constructor(e,t,o={},n,r){super();this._link=t;this._hoverService=n;this._enabled=!0;this.el=R(e,_("a.monaco-link",{tabIndex:t.tabIndex??0,href:t.href},t.label)),this.hoverDelegate=o.hoverDelegate??Ni("mouse"),this.setTooltip(t.title),this.el.setAttribute("role","button");let s=this._register(new On(this.el,"click")),l=this._register(new On(this.el,"keydown")),c=H.chain(l.event,h=>h.map(g=>new Ii(g)).filter(g=>g.keyCode===3||g.keyCode===10)),u=this._register(new On(this.el,Gn.Tap)).event;this._register(ws.addTarget(this.el));let p=H.any(s.event,c,u);this._register(p(h=>{this.enabled&&($t.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)}};Xg=I([m(3,tt),m(4,Qe)],Xg);var IHo=26,exe=class extends C{constructor(e,t){super();this._editor=e;this.instantiationService=t;this.banner=this._register(this.instantiationService.createInstance(I3e))}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,IHo)}};exe=I([m(1,F)],exe);var I3e=class extends C{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=R(this.element,_("div.icon-container"));o.setAttribute("aria-hidden","true"),e.icon&&o.appendChild(_(`div${q.asCSSSelector(e.icon)}`));let n=R(this.element,_("div.message-container"));if(n.setAttribute("aria-hidden","true"),n.appendChild(this.getBannerMessage(e.message)),this.messageActionsContainer=R(this.element,_("div.message-actions-container")),e.actions)for(let s of e.actions)this._register(this.instantiationService.createInstance(Xg,this.messageActionsContainer,{...s,tabIndex:-1},{}));let r=R(this.element,_("div.action-container"));this.actionBar=this._register(new ji(r)),this.actionBar.push(this._register(new st("banner.close",d(1690,null),q.asClassName(lE),!0,()=>{typeof e.onClose=="function"&&e.onClose()})),{icon:!0,label:!1}),this.actionBar.setFocusable(!1)}};I3e=I([m(0,F),m(1,Qn)],I3e);var BL=ae("workspaceTrustEnablementService"),ns=ae("workspaceTrustManagementService");var Vd=ae("workspaceTrustRequestService");var yHo=Re("extensions-warning-message",M.warning,d(1714,null)),Ole=class extends C{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(1713,null),command:new x3e};else if(e.ambiguousCharacterCount>=t)o={message:d(1711,null),command:new Fle};else if(e.invisibleCharacterCount>=t)o={message:d(1712,null),command:new C3e};else throw new Error("Unreachable");this._bannerController.show({id:"unicodeHighlightBanner",message:o.message,icon:yHo,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(exe,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=wHo(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"?Wu.NumberFormat().value.resolvedOptions().locale:o==="_vscode"?Dr:o)};this._editorWorkerService.canComputeUnicodeHighlights(this._editor.getModel().uri)?this._highlighter=new y3e(this._editor,t,this._updateState,this._editorWorkerService):this._highlighter=new Mli(this._editor,t,this._updateState)}getDecorationInfo(e){return this._highlighter?this._highlighter.getDecorationInfo(e):null}};Ole=I([m(1,$s),m(2,ns),m(3,F)],Ole);function wHo(a,i){return{nonBasicASCII:i.nonBasicASCII===zT?!a:i.nonBasicASCII,ambiguousCharacters:i.ambiguousCharacters,invisibleCharacters:i.invisibleCharacters,includeComments:i.includeComments===zT?!a:i.includeComments,includeStrings:i.includeStrings===zT?!a:i.includeStrings,allowedCharacters:i.allowedCharacters,allowedLocales:i.allowedLocales}}var y3e=class extends C{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:Sxt.instance.getDecorationFromOptions(this._options)});this._decorations.set(o)})}getDecorationInfo(e){if(!this._decorations.has(e))return null;let t=this._editor.getModel();if(!$$e(t,e))return null;let o=t.getValueInRange(e.range);return{reason:k6i(o,this._options),inComment:kgt(t,e),inString:Egt(t,e)}}};y3e=I([m(3,$s)],y3e);var Mli=class extends C{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=Ise.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:Sxt.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 $$e(t,e)?{reason:k6i(o,this._options),inComment:kgt(t,e),inString:Egt(t,e)}:null}};var x6i=d(1703,null),w3e=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(Ole.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=Rli(p),g;switch(c.reason.kind){case 0:{oU(c.reason.confusableWith)?g=d(1700,null,h,Rli(c.reason.confusableWith.codePointAt(0))):g=d(1699,null,h,Rli(c.reason.confusableWith.codePointAt(0)));break}case 1:g=d(1701,null,h);break;case 2:g=d(1702,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(1697,null),b=ic(Ixt.ID,f),S=new xe("",!0).appendMarkdown(g).appendText(" ").appendLink(b,v,x6i);n.push(new vE(this,l.range,[S],!1,s++))}return n}renderHoverParts(i,e){return z3i(i,e,this._editor,this._markdownRendererService)}getAccessibleContent(i){return i.contents.map(e=>e.value).join(`
`)}};w3e=I([m(1,Qn)],w3e);function Pli(a){return`U+${a.toString(16).padStart(4,"0")}`}function Rli(a){let i=`\`${Pli(a)}\``;return K0.isInvisibleCharacter(a)||(i+=` "${`${CHo(a)}`}"`),i}function CHo(a){return a===96?"`` ` ``":"`"+String.fromCodePoint(a)+"`"}function k6i(a,i){return Ise.computeUnicodeHighlightReason(a,i)}var Sxt=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=po.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}},Ali=class extends xi{constructor(){super({id:Fle.ID,label:L(1691,"Disable highlighting of characters in comments"),precondition:void 0});this.shortLabel=d(1704,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(px.includeComments,!1,2)}},Nli=class extends xi{constructor(){super({id:Fle.ID,label:L(1692,"Disable highlighting of characters in strings"),precondition:void 0});this.shortLabel=d(1705,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(px.includeStrings,!1,2)}},Fle=class a extends K{constructor(){super({id:a.ID,title:L(1693,"Disable highlighting of ambiguous characters"),precondition:void 0,f1:!1});this.shortLabel=d(1706,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(px.ambiguousCharacters,!1,2)}},C3e=class a extends K{constructor(){super({id:a.ID,title:L(1694,"Disable highlighting of invisible characters"),precondition:void 0,f1:!1});this.shortLabel=d(1707,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(px.invisibleCharacters,!1,2)}},x3e=class a extends K{constructor(){super({id:a.ID,title:L(1695,"Disable highlighting of non basic ASCII characters"),precondition:void 0,f1:!1});this.shortLabel=d(1708,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(px.nonBasicASCII,!1,2)}},Ixt=class a extends K{static{this.ID="editor.action.unicodeHighlight.showExcludeOptions"}constructor(){super({id:a.ID,title:L(1696,"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(Ge),c=i.get(B);function u(f){return K0.isInvisibleCharacter(f)?d(1710,null,Pli(f)):d(1709,null,`${Pli(f)} "${s}"`)}let p=[];if(o.kind===0)for(let f of o.notAmbiguousInLocales)p.push({label:d(1698,null,f),run:async()=>{kHo(c,[f])}});if(p.push({label:u(t),run:()=>xHo(c,[t])}),r){let f=new Ali;p.push({label:f.label,run:async()=>f.runAction(c)})}else if(n){let f=new Nli;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 Fle;p.push({label:h(f),run:async()=>f.runAction(c)})}else if(o.kind===1){let f=new C3e;p.push({label:h(f),run:async()=>f.runAction(c)})}else if(o.kind===2){let f=new x3e;p.push({label:h(f),run:async()=>f.runAction(c)})}else EHo(o);let g=await l.pick(p,{title:x6i});g&&await g.run()}};async function xHo(a,i){let e=a.getValue(px.allowedCharacters),t;typeof e=="object"&&e?t=e:t={};for(let o of i)t[String.fromCodePoint(o)]=!0;await a.updateValue(px.allowedCharacters,t,2)}async function kHo(a,i){let e=a.inspect(px.allowedLocales).user?.value,t;typeof e=="object"&&e?t=Object.assign({},e):t={};for(let o of i)t[o]=!0;await a.updateValue(px.allowedLocales,t,2)}function EHo(a){throw new Error(`Unexpected value: ${a}`)}W(Fle);W(C3e);W(x3e);W(Ixt);go(Ole.ID,Ole,1);d_.register(w3e);var E6i="ignoreUnusualLineTerminators";function THo(a,i,e){a.setModelProperty(i.uri,E6i,e)}function _Ho(a,i){return a.getModelProperty(i.uri,E6i)}var oY=class extends C{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()||_Ho(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(1719,null),message:d(1718,null),detail:d(1715,null,Ye(e.uri)),primaryButton:d(1716,null),cancelButton:d(1717,null)})}finally{this._isPresentingDialog=!1}if(!o.confirmed){THo(this._codeEditorService,e,!0);return}e.removeUnusualLineTerminators(this._editor.getSelections())}};oY=I([m(1,ct),m(2,Kt)],oY);go(oY.ID,oY,1);function Wli(){return Object.create(null)}var k3e="**",T6i="/",yxt="[/\\\\]",wxt="[^/\\\\]",DHo=/\//g;function _6i(a,i){switch(a){case 0:return"";case 1:return`${wxt}*?`;default:return`(?:${yxt}|${wxt}+${yxt}${i?`|${yxt}${wxt}+`:""})*?`}}function HL(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 M6i(a){if(!a)return"";let i="",e=HL(a,T6i);if(e.every(t=>t===k3e))i=".*";else{let t=!1;e.forEach((o,n)=>{if(o===k3e){if(t)return;i+=_6i(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===T6i?p="":p=Yr(u),c+=p;continue}switch(u){case"{":r=!0;continue;case"[":l=!0;continue;case"}":{let h=`(?:${HL(s,",").map(g=>M6i(g)).join("|")})`;i+=h,r=!1,s="";break}case"]":{i+="["+c+"]",l=!1,c="";break}case"?":i+=wxt;continue;case"*":i+=_6i(1);continue;default:i+=Yr(u)}}n<e.length-1&&(e[n+1]!==k3e||n+2<e.length)&&(i+=yxt)}t=o===k3e})}return i}var LHo=/^\*\*\/\*\.[\w\.-]+$/,RHo=/^\*\*\/([\w\.-]+)\/?$/,MHo=/^{\*\*\/\*?[\w\.-]+\/?(,\*\*\/\*?[\w\.-]+\/?)*}$/,PHo=/^{\*\*\/\*?[\w\.-]+(\/(\*\*)?)?(,\*\*\/\*?[\w\.-]+(\/(\*\*)?)?)*}$/,AHo=/^\*\*((\/[\w\.-]+)+)\/?$/,NHo=/^([\w\.-]+(\/[\w\.-]+)*)\/?$/,D6i=new il(1e4),Fli=function(){return!1},qW=function(){return null};function Vli(a){return a===Fli||a===qW}function Bli(a,i){if(!a)return qW;let e;typeof a!="string"?e=a.pattern:e=a,e=e.trim();let t=i.ignoreCase??!1,o={...i,equals:t?mr:(l,c)=>l===c,endsWith:t?gpt:(l,c)=>l.endsWith(c),isEqualOrParent:(l,c)=>rU(l,c,!Wn||t)},n=`${t?e.toLowerCase():e}_${!!i.trimForExclusions}_${t}`,r=D6i.get(n);if(r)return L6i(r,a,o);let s;return LHo.test(e)?r=OHo(e.substring(4),e,o):(s=RHo.exec(Oli(e,o)))?r=FHo(s[1],e,o):(i.trimForExclusions?PHo:MHo).test(e)?r=WHo(e,o):(s=AHo.exec(Oli(e,o)))?r=R6i(s[1].substring(1),e,!0,o):(s=NHo.exec(Oli(e,o)))?r=R6i(s[1],e,!1,o):r=VHo(e,o),D6i.set(n,r),L6i(r,a,o)}function L6i(a,i,e){if(typeof i=="string")return a;let t=function(o,n){return e.isEqualOrParent(o,i.base)?a(Hw(o.substring(i.base.length),Rd),n):null};return t.allBasenames=a.allBasenames,t.allPaths=a.allPaths,t.basenames=a.basenames,t.patterns=a.patterns,t}function Oli(a,i){return i.trimForExclusions&&a.endsWith("/**")?a.substring(0,a.length-2):a}function OHo(a,i,e){return function(t,o){return typeof t=="string"&&e.endsWith(t,a)?i:null}}function FHo(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 WHo(a,i){let e=P6i(a.slice(1,-1).split(",").map(s=>Bli(s,i)).filter(s=>s!==qW),a),t=e.length;if(!t)return qW;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 R6i(a,i,e,t){let o=Rd===Lo.sep,n=o?a:a.replace(DHo,Rd),r=Rd+n,s=Lo.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 VHo(a,i){try{let e=new RegExp(`^${M6i(a)}$`,i.ignoreCase?"i":void 0);return function(t){return e.lastIndex=0,typeof t=="string"&&e.test(t)?a:null}}catch{return qW}}function Cp(a,i,e){return!a||typeof i!="string"?!1:zm(a,e)(i)}function zm(a,i={}){if(!a)return Fli;if(typeof a=="string"||eP(a)){let e=Bli(a,i);if(e===qW)return Fli;let t=function(o,n){return!!e(o,n)};return e.allBasenames&&(t.allBasenames=e.allBasenames),e.allPaths&&(t.allPaths=e.allPaths),t}return BHo(a,i)}function eP(a){let i=a;return i?typeof i.base=="string"&&typeof i.pattern=="string":!1}function BHo(a,i){let e=P6i(Object.getOwnPropertyNames(a).map(s=>HHo(s,a[s],i)).filter(s=>s!==qW)),t=e.length;if(!t)return qW;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;FT(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=No(s)),u||(u=l.substring(0,l.length-Am(s).length)));let v=f(s,l,u,c);if(typeof v=="string")return v;FT(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 HHo(a,i,e){if(i===!1)return qW;let t=Bli(a,e);if(t===qW)return qW;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 FT(p)?p.then(h=>h?a:null):p?a:null};return n.requiresSiblings=!0,n}}return t}function P6i(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 jW(a,i,e,t,o,n){if(Array.isArray(a)){let r=0;for(let s of a){let l=jW(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:th(s.base)},h===i.fsPath||Cp(h,i.fsPath))p=10;else return 0}return p}else return 0}}function Hli(a,i){if(typeof a=="string")i.add(a);else if(Array.isArray(a))for(let e of a)Hli(e,i);else{let e=a.language;e&&i.add(e)}}var Cxt=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,tW,!1).map(s=>({range:s.range,kind:0})):Promise.resolve(o)}provideMultiDocumentHighlights(i,e,t,o){let n=new vt,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,tW,!1).map(u=>({range:u.range,kind:0}));c&&n.set(s.uri,c)}return n}},txe=class extends C{constructor(i){super(),this._register(i.documentHighlightProvider.register("*",new Cxt)),this._register(i.multiDocumentHighlightProvider.register("*",new Cxt))}};txe=I([m(0,zt)],txe);var qli=new Q("hasWordHighlights",!1);function A6i(a,i,e,t){let o=a.ordered(i);return Lre(o.map(n=>()=>Promise.resolve(n.provideDocumentHighlights(i,e,t)).then(void 0,ss)),n=>n!=null).then(n=>{if(n){let r=new vt;return r.set(i.uri,n),r}return new vt})}function UHo(a,i,e,t,o){let n=a.ordered(i);return Lre(n.map(r=>()=>{let s=o.filter(l=>hx(l)).filter(l=>jW(r.selector,l.uri,l.getLanguageId(),!0,void 0,void 0)>0);return Promise.resolve(r.provideMultiDocumentHighlights(i,e,s,t)).then(void 0,ss)}),r=>r!=null)}var xxt=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=xn(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()}},Uli=class extends xxt{constructor(i,e,t,o){super(i,e,t),this._providers=o}_compute(i,e,t,o){return A6i(this._providers,i,e.getPosition(),o).then(n=>n||new vt)}},zli=class extends xxt{constructor(i,e,t,o,n){super(i,e,t),this._providers=o,this._otherModels=n}_compute(i,e,t,o){return UHo(this._providers,i,e.getPosition(),o,this._otherModels).then(n=>n||new vt)}};function zHo(a,i,e,t){return new Uli(i,e,t,a)}function KHo(a,i,e,t,o){return new zli(i,e,t,a,o)}kS("_executeDocumentHighlights",async(a,i,e)=>{let t=a.get(zt);return(await A6i(t.documentHighlightProvider,i,e,ve.None))?.get(i.uri)});var ip=class{constructor(i,e,t,o,n,r,s,l){this.toUnhook=new P;this.workerRequestTokenId=0;this.workerRequestCompleted=!1;this.workerRequestValue=new vt;this.lastCursorPositionChangeTime=0;this.renderDecorationsTimer=void 0;this.runDelayer=this.toUnhook.add(new jo(50));this.editor=i,this.providers=e,this.multiDocumentProviders=t,this.codeEditorService=r,this.textModelService=n,this.configurationService=s,this.logService=l,this._hasWordHighlights=qli.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=>{jd(this.model.uri,"output")||this._stopAll()})),this.toUnhook.add(i.onDidChangeModel(c=>{!c.newModelUrl&&c.oldModelUrl?this._stopSingular():ip.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(ip.query?.modelInfo?.modelURI);break;case"multiFile":ip.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===Y.vscodeNotebookCell&&this.editor.getModel()?.uri.scheme!==Y.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,ip.query&&this._run()}static{this.storedDecorationIDs=new vt}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);Jo(`${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);Jo(`${r}, ${t+1} of ${i.length} for '${n.word}'`)}}finally{this._ignorePositionChangeEvent=!1}}_removeSingleDecorations(){if(!this.editor.hasModel())return;let i=ip.storedDecorationIDs.get(this.editor.getModel().uri);i&&(this.editor.removeDecorations(i),ip.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()||Xe(o.getModel().uri,i))continue;let n=ip.storedDecorationIDs.get(o.getModel().uri);if(!n)continue;o.removeDecorations(n),t.push(o.getModel().uri);let r=Xb.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)ip.storedDecorationIDs.delete(o)}_stopSingular(){this._removeSingleDecorations(),this.editor.hasTextFocus()&&(this.editor.getModel()?.uri.scheme!==Y.vscodeNotebookCell&&ip.query?.modelInfo?.modelURI.scheme!==Y.vscodeNotebookCell?(ip.query=null,this._run()):ip.query?.modelInfo&&(ip.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===Y.vscodeNotebookCell){let n=[],r=this.codeEditorService.listCodeEditors();for(let s of r){let l=s.getModel();l&&l!==i&&l.uri.scheme===Y.vscodeNotebookCell&&n.push(l)}return n}let t=[],o=this.codeEditorService.listCodeEditors();for(let n of o){if(!Ec(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){ip.query=null,this._stopAll();return}let n=o.startColumn,r=o.endColumn,s=this._getWord();if(!s||s.startColumn>n||s.endColumn<r){ip.query=null,this._stopAll();return}ip.query={modelInfo:{modelURI:this.model.uri,selection:o}}}else if(!ip.query){this._stopAll();return}if(this.lastCursorPositionChangeTime=new Date().getTime(),Xe(this.editor.getModel().uri,ip.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(!ip.query||!ip.query.modelInfo)return;let r=await this.textModelService.createModelReference(ip.query.modelInfo.modelURI);try{this.workerRequest=this.computeWithModel(r.object.textEditorModel,ip.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===Y.vscodeNotebookCell){let o=++this.workerRequestTokenId;if(this.workerRequestCompleted=!1,!ip.query||!ip.query.modelInfo)return;let n=await this.textModelService.createModelReference(ip.query.modelInfo.modelURI);try{this.workerRequest=this.computeWithModel(n.object.textEditorModel,ip.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?KHo(this.multiDocumentProviders,i,e,this.editor.getOption(148),t):zHo(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=Xb.get(e);if(!t)continue;let o=[],n=e.getModel()?.uri;if(n&&this.workerRequestValue.has(n)){let r=ip.storedDecorationIDs.get(n),s=this.workerRequestValue.get(n);if(s)for(let c of s)c.range&&o.push({range:c.range,options:p6i(c.kind)});let l=[];e.changeDecorations(c=>{l=c.deltaDecorations(r??[],o)}),ip.storedDecorationIDs=ip.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()}};ip=I([m(4,Nt),m(5,Kt),m(6,B),m(7,ne)],ip);var Xb=class extends C{static{this.ID="editor.contrib.wordHighlighter"}static get(i){return i.getContribution(Xb.ID)}constructor(i,e,t,o,n,r,s){super(),this._wordHighlighter=null;let l=()=>{i.hasModel()&&!i.getModel().isTooLargeForTokenization()&&i.getModel().uri.scheme!==Y.accessibleView&&(this._wordHighlighter=new ip(i,t.documentHighlightProvider,t.multiDocumentHighlightProvider,e,n,o,r,s))};this._register(i.onDidChangeModel(c=>{this._wordHighlighter&&(!c.newModelUrl&&c.oldModelUrl?.scheme!==Y.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()}};Xb=I([m(1,X),m(2,zt),m(3,Kt),m(4,Nt),m(5,B),m(6,ne)],Xb);var kxt=class extends xi{constructor(i,e){super(e),this._isNext=i}run(i,e){let t=Xb.get(e);t&&(this._isNext?t.moveNext():t.moveBack())}},Kli=class extends kxt{constructor(){super(!0,{id:"editor.action.wordHighlight.next",label:L(1729,"Go to Next Symbol Highlight"),precondition:qli,kbOpts:{kbExpr:ue.editorTextFocus,primary:65,weight:100}})}},Gli=class extends kxt{constructor(){super(!1,{id:"editor.action.wordHighlight.prev",label:L(1730,"Go to Previous Symbol Highlight"),precondition:qli,kbOpts:{kbExpr:ue.editorTextFocus,primary:1089,weight:100}})}},$li=class extends xi{constructor(){super({id:"editor.action.wordHighlight.trigger",label:L(1731,"Trigger Symbol Highlight"),precondition:void 0,kbOpts:{kbExpr:ue.editorTextFocus,primary:0,weight:100}})}run(i,e){let t=Xb.get(e);t&&t.restoreViewState(!0)}};go(Xb.ID,Xb,0);Jt(Kli);Jt(Gli);Jt($li);Dx(txe);var Wle=class extends xc{constructor(i){super(i),this._inSelectionMode=i.inSelectionMode,this._wordNavigationType=i.wordNavigationType}runEditorCommand(i,e,t){if(!e.hasModel())return;let o=jw(e.getOption(148),e.getOption(147)),n=e.getModel(),r=e.getSelections(),s=r.length>1,l=r.map(c=>{let u=new Ie(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=>Ps.fromModelSelection(c))),l.length===1){let c=new Ie(l[0].positionLineNumber,l[0].positionColumn);e.revealPosition(c,0)}}_moveTo(i,e,t){return t?new Yt(i.selectionStartLineNumber,i.selectionStartColumn,e.lineNumber,e.column):new Yt(e.lineNumber,e.column,e.lineNumber,e.column)}},ez=class extends Wle{_move(i,e,t,o,n){return yf.moveWordLeft(i,e,t,o,n)}},tz=class extends Wle{_move(i,e,t,o,n){return yf.moveWordRight(i,e,t,o)}},jli=class extends ez{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartLeft",precondition:void 0})}},Qli=class extends ez{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndLeft",precondition:void 0})}},Yli=class extends ez{constructor(){super({inSelectionMode:!1,wordNavigationType:1,id:"cursorWordLeft",precondition:void 0,kbOpts:{kbExpr:x.and(ue.textInputFocus,x.and($a,Zy)?.negate()),primary:2063,mac:{primary:527},weight:100}})}},Xli=class extends ez{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartLeftSelect",precondition:void 0})}},Jli=class extends ez{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndLeftSelect",precondition:void 0})}},Zli=class extends ez{constructor(){super({inSelectionMode:!0,wordNavigationType:1,id:"cursorWordLeftSelect",precondition:void 0,kbOpts:{kbExpr:x.and(ue.textInputFocus,x.and($a,Zy)?.negate()),primary:3087,mac:{primary:1551},weight:100}})}},eci=class extends ez{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityLeft",precondition:void 0})}_move(i,e,t,o,n){return super._move(jw(zb.wordSeparators.defaultValue,i.intlSegmenterLocales),e,t,o,n)}},tci=class extends ez{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityLeftSelect",precondition:void 0})}_move(i,e,t,o,n){return super._move(jw(zb.wordSeparators.defaultValue,i.intlSegmenterLocales),e,t,o,n)}},ici=class extends tz{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartRight",precondition:void 0})}},oci=class extends tz{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndRight",precondition:void 0,kbOpts:{kbExpr:x.and(ue.textInputFocus,x.and($a,Zy)?.negate()),primary:2065,mac:{primary:529},weight:100}})}},nci=class extends tz{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordRight",precondition:void 0})}},rci=class extends tz{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartRightSelect",precondition:void 0})}},sci=class extends tz{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndRightSelect",precondition:void 0,kbOpts:{kbExpr:x.and(ue.textInputFocus,x.and($a,Zy)?.negate()),primary:3089,mac:{primary:1553},weight:100}})}},aci=class extends tz{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordRightSelect",precondition:void 0})}},lci=class extends tz{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityRight",precondition:void 0})}_move(i,e,t,o,n){return super._move(jw(zb.wordSeparators.defaultValue,i.intlSegmenterLocales),e,t,o,n)}},cci=class extends tz{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityRightSelect",precondition:void 0})}_move(i,e,t,o,n){return super._move(jw(zb.wordSeparators.defaultValue,i.intlSegmenterLocales),e,t,o,n)}},Vle=class extends xc{constructor(i){super({canTriggerInlineEdits:!0,...i}),this._whitespaceHeuristics=i.whitespaceHeuristics,this._wordNavigationType=i.wordNavigationType}runEditorCommand(i,e,t){let o=i?.get(bs);if(!e.hasModel()||!o)return;let n=jw(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 Wh(f,"")});e.pushUndoStop(),e.executeCommands(this.id,h),e.pushUndoStop()}},E3e=class extends Vle{_delete(i,e){let t=yf.deleteWordLeft(i,e);return t||new z(1,1,1,1)}},T3e=class extends Vle{_delete(i,e){let t=yf.deleteWordRight(i,e);if(t)return t;let o=i.model.getLineCount(),n=i.model.getLineMaxColumn(o);return new z(o,n,o,n)}},dci=class extends E3e{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartLeft",precondition:ue.writable})}},uci=class extends E3e{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndLeft",precondition:ue.writable})}},pci=class extends E3e{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordLeft",precondition:ue.writable,kbOpts:{kbExpr:ue.textInputFocus,primary:2049,mac:{primary:513},weight:100}})}},mci=class extends T3e{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartRight",precondition:ue.writable})}},hci=class extends T3e{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndRight",precondition:ue.writable})}},gci=class extends T3e{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordRight",precondition:ue.writable,kbOpts:{kbExpr:ue.textInputFocus,primary:2068,mac:{primary:532},weight:100}})}},fci=class extends xi{constructor(){super({id:"deleteInsideWord",precondition:ue.writable,label:L(1732,"Delete Word"),metadata:{description:L(1734,"Delete the word at the cursor"),args:[{name:"args",schema:{type:"object",properties:{onlyWord:{type:"boolean",default:!1,description:d(1733,null)}}}}]}})}run(i,e,t){if(!e.hasModel())return;let o=!!(t&&typeof t=="object"&&t.onlyWord),n=jw(e.getOption(148),e.getOption(147)),r=e.getModel(),l=e.getSelections().map(c=>{let u=yf.deleteInsideWord(n,r,c,o);return new Wh(u,"")});e.pushUndoStop(),e.executeCommands(this.id,l),e.pushUndoStop()}};qi(new jli);qi(new Qli);qi(new Yli);qi(new Xli);qi(new Jli);qi(new Zli);qi(new ici);qi(new oci);qi(new nci);qi(new rci);qi(new sci);qi(new aci);qi(new eci);qi(new tci);qi(new lci);qi(new cci);qi(new dci);qi(new uci);qi(new pci);qi(new mci);qi(new hci);qi(new gci);Jt(fci);var vci=class extends Vle{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordPartLeft",precondition:ue.writable,kbOpts:{kbExpr:ue.textInputFocus,primary:0,mac:{primary:769},weight:100}})}_delete(i,e){let t=tse.deleteWordPartLeft(i);return t||new z(1,1,1,1)}},bci=class extends Vle{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordPartRight",precondition:ue.writable,kbOpts:{kbExpr:ue.textInputFocus,primary:0,mac:{primary:788},weight:100}})}_delete(i,e){let t=tse.deleteWordPartRight(i);if(t)return t;let o=i.model.getLineCount(),n=i.model.getLineMaxColumn(o);return new z(o,n,o,n)}},Ext=class extends Wle{_move(i,e,t,o,n){return tse.moveWordPartLeft(i,e,t,n)}},Sci=class extends Ext{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordPartLeft",precondition:void 0,kbOpts:{kbExpr:ue.textInputFocus,primary:0,mac:{primary:783},weight:100}})}};qe.registerCommandAlias("cursorWordPartStartLeft","cursorWordPartLeft");var Ici=class extends Ext{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordPartLeftSelect",precondition:void 0,kbOpts:{kbExpr:ue.textInputFocus,primary:0,mac:{primary:1807},weight:100}})}};qe.registerCommandAlias("cursorWordPartStartLeftSelect","cursorWordPartLeftSelect");var Txt=class extends Wle{_move(i,e,t,o,n){return tse.moveWordPartRight(i,e,t)}},yci=class extends Txt{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordPartRight",precondition:void 0,kbOpts:{kbExpr:ue.textInputFocus,primary:0,mac:{primary:785},weight:100}})}},wci=class extends Txt{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordPartRightSelect",precondition:void 0,kbOpts:{kbExpr:ue.textInputFocus,primary:0,mac:{primary:1809},weight:100}})}};qi(new vci);qi(new bci);qi(new Sci);qi(new Ici);qi(new yci);qi(new wci);var _xt=class extends C{constructor(e){super();this.editor=e;this._register(this.editor.onDidAttemptReadOnlyEdit(()=>this._onDidAttemptReadOnlyEdit()))}static{this.ID="editor.contrib.readOnlyMessageController"}_onDidAttemptReadOnlyEdit(){let e=iu.get(this.editor);if(e&&this.editor.hasModel()){let t=this.editor.getOptions().get(105);t||(this.editor.isSimpleWidget?t=new xe(d(1537,null)):t=new xe(d(1536,null))),e.showMessage(t,this.editor.getPosition())}}};go(_xt.ID,_xt,2);var _3e=class extends C{constructor(e,t,o){super();this._textModel=e;this._languageFeaturesService=t;this._outlineModelService=o;this._currentModel=Le(this,void 0);let n=Nr("documentSymbolProvider.onDidChange",this._languageFeaturesService.documentSymbolProvider.onDidChange),r=Nr("_textModel.onDidChangeContent",H.debounce(s=>this._textModel.onDidChangeContent(s),()=>{},100));this._register(Ga(async(s,l)=>{n.read(s),r.read(s);let c=l.add(new hSt),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(pre(tl(r=>r.range.endLineNumber-r.range.startLineNumber,qd))),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 ro(r.range.startLineNumber,r.range.endLineNumber).contains(e));return n.length===0?[]:(n.sort(pre(tl(r=>r.range.endLineNumber-r.range.startLineNumber,qd))),n.map(r=>({name:r.name,kind:r.kind,startLineNumber:r.range.startLineNumber})))}};_3e=I([m(1,zt),m(2,f_)],_3e);tO.setBreadcrumbsSourceFactory((a,i)=>i.createInstance(_3e,a));var QW=class extends C{static{this.ID="editor.contrib.floatingToolbar"}constructor(i,e,t,o){super();let n=this._register(os(i)),r=Ce(l=>n.model.read(l)?.uri),s=this._register(e.createInstance(Ble,D.EditorContent,i.contextKeyService,r));this._register(he(l=>{s.hasActions.read(l)&&l.store.add(n.createOverlayWidget({allowEditorOverflow:!1,domNode:s.element,minContentWidthInPx:Oo(0),position:Oo({preference:1})}))}))}};QW=I([m(1,F),m(2,_e),m(3,qt)],QW);var Ble=class extends C{constructor(i,e,t,o,n,r){super();let s=this._register(r.createMenu(i,e)),l=ui(this,s.onDidChange,()=>s.getActions()),c=Ce(u=>{let p=l.read(u),{primary:h}=hl(p,()=>!0);return h.filter(g=>g.id!==li.ID)});this.hasActions=Ce(u=>c.read(u).length>0),this.element=bt("div.floating-menu-overlay-widget").root,this._register(Z(()=>this.element.remove())),this._register(he(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(Ln,this.element,i,{actionViewItemProvider:(b,S)=>{if(b instanceof Eo)return o.createInstance(class extends ml{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(he(b=>{let S=t.read(b);v.context=S}))}))}};Ble=I([m(3,F),m(4,_e),m(5,qt)],Ble);go(QW.ID,QW,1);var gc;(Ze=>(Ze.accessibilityHelpTitle=d(910,null),Ze.openingDocs=d(939,null),Ze.readonlyDiffEditor=d(945,null),Ze.editableDiffEditor=d(927,null),Ze.readonlyEditor=d(946,null),Ze.editableEditor=d(928,null),Ze.defaultWindowTitleIncludesEditorState=d(926,null),Ze.defaultWindowTitleExcludingEditorState=d(925,null),Ze.toolbar=d(958,null),Ze.changeConfigToOnMac=d(915,null),Ze.changeConfigToOnWinLinux=d(916,null),Ze.auto_on=d(913,null),Ze.auto_off=d(912,null),Ze.screenReaderModeEnabled=d(948,null),Ze.screenReaderModeDisabled=d(947,null),Ze.tabFocusModeOnMsg=d(955,null,"<keybinding:editor.action.toggleTabFocusMode>"),Ze.tabFocusModeOffMsg=d(954,null,"<keybinding:editor.action.toggleTabFocusMode>"),Ze.stickScroll=d(952,null,"<keybinding:editor.action.focusStickyDebugConsole>"),Ze.suggestActions=d(953,null,"<keybinding:editor.action.triggerSuggest>"),Ze.acceptSuggestAction=d(909,null,"<keybinding:acceptSelectedSuggestion>"),Ze.toggleSuggestionFocus=d(957,null,"<keybinding:focusSuggestion>","<keybinding:toggleSuggestionFocus>"),Ze.codeFolding=d(920,null,"<keybinding:editor.toggleFold>"),Ze.intellisense=d(936,null,"<keybinding:editor.action.triggerSuggest>"),Ze.showOrFocusHover=d(950,null,"<keybinding:editor.action.showHover>"),Ze.goToSymbol=d(933,null,"<keybinding:workbench.action.gotoSymbol>"),Ze.showAccessibilityHelpAction=d(949,null),Ze.listSignalSounds=d(938,null),Ze.listAlerts=d(937,null),Ze.announceCursorPosition=d(911,null,"<keybinding:editor.action.announceCursorPosition>"),Ze.focusNotifications=d(930,null,"<keybinding:notifications.focusToasts>","<keybinding:notification.acceptPrimaryAction>"),Ze.quickChat=d(940,null,"<keybinding:workbench.action.quickchat.toggle>"),Ze.startInlineChat=d(951,null,"<keybinding:inlineChat.start>"),Ze.startDebugging=d(921,null,"<keybinding:workbench.action.debug.start>"),Ze.setBreakpoint=d(924,null,"<keybinding:editor.debug.action.toggleInlineBreakpoint>"),Ze.addToWatch=d(922,null,"<keybinding:editor.debug.action.selectionToWatch>"),Ze.debugExecuteSelection=d(923,null,"<keybinding:editor.debug.action.selectionToRepl>"),Ze.chatEditorModification=d(918,null),Ze.chatEditorRequestInProgress=d(919,null),Ze.chatEditActions=d(917,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>")))(gc||={});var $Ho;(i=>i.inspectTokensAction=d(935,null))($Ho||={});var qHo;(e=>(e.gotoLineActionLabel=d(931,null),e.gotoOffsetActionLabel=d(932,null)))(qHo||={});var jHo;(i=>i.helpQuickAccessActionLabel=d(934,null))(jHo||={});var QHo;(e=>(e.quickCommandActionLabel=d(942,null),e.quickCommandHelp=d(941,null)))(QHo||={});var YHo;(e=>(e.quickOutlineActionLabel=d(943,null),e.quickOutlineByCategoryActionLabel=d(944,null)))(YHo||={});var XHo;(i=>i.editorViewAccessibleLabel=d(929,null))(XHo||={});var JHo;(i=>i.toggleHighContrast=d(956,null))(JHo||={});var ZHo;(i=>i.bulkEditServiceSummary=d(914,null))(ZHo||={});var ao=ae("lifecycleService");function Dxt(a){switch(a){case 1:return"NewWindow";case 3:return"ReloadedWindow";case 4:return"ReopenedWindow"}}function N6i(a){switch(a){case 1:return"Starting";case 2:return"Ready";case 3:return"Restored";case 4:return"Eventually"}}var Lxt=ae("editorPaneService");var Qi;(i=>i.Workbench="workbench.contributions.kind")(Qi||={});var ut=(o=>(o[o.BlockStartup=1]="BlockStartup",o[o.BlockRestore=2]="BlockRestore",o[o.AfterRestored=3]="AfterRestored",o[o.Eventually=4]="Eventually",o))(ut||{});function O6i(a){let i=a;return!!i&&typeof i.editorTypeId=="string"}function eUo(a){switch(a){case 3:return ut.AfterRestored;case 4:return ut.Eventually}}function F6i(a){switch(a){case ut.BlockStartup:return 1;case ut.BlockRestore:return 2;case ut.AfterRestored:return 3;case ut.Eventually:return 4}}var Hle=class a extends C{constructor(){super(...arguments);this.contributionsByPhase=new Map;this.contributionsByEditor=new Map;this.contributionsById=new Map;this.instancesById=new Map;this.instanceDisposables=this._register(new P);this.timingsByPhase=new Map;this.pendingRestoredContributions=new Go;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"&&O6i(o)&&this.editorPaneService.didInstantiateEditorPane(o.editorTypeId))?this.safeCreateContribution(this.instantiationService,this.logService,this.environmentService,n,typeof o=="number"?F6i(o):this.lifecycleService.phase):(typeof o=="number"&&$H(this.contributionsByPhase,F6i(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),O6i(o)&&$H(this.contributionsByEditor,o.editorTypeId,[]).push(n)))}registerWorkbenchContribution(e,t){this.registerWorkbenchContribution2(void 0,e,eUo(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(ao),n=this.logService=e.get(ne),r=this.environmentService=e.get(Co),s=this.editorPaneService=e.get(Lxt);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:{sn(`code/willCreateWorkbenchContributions/${n}`);for(let s of r)this.safeCreateContribution(e,t,o,s,n);sn(`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){sn(`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){aN(c,l);break}}s===e.length&&(sn(`code/didCreateWorkbenchContributions/${r}`),r===3&&this.pendingRestoredContributions.complete())};aN(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"&&sn(`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)),Ac(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"&&sn(`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])}}}},pt=Hle.INSTANCE.registerWorkbenchContribution2.bind(Hle.INSTANCE),Ule=Hle.INSTANCE.getWorkbenchContribution.bind(Hle.INSTANCE);oe.add(Qi.Workbench,Hle.INSTANCE);var iz=(n=>(n.Extensions="Extensions",n.IntegratedTerminal="IntegratedTerminal",n.InteractiveSession="InteractiveSession",n.Telemetry="Telemetry",n.Update="Update",n))(iz||{}),W6i={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 CO="^([a-z0-9A-Z][a-z0-9-A-Z]*)\\.([a-z0-9A-Z][a-z0-9-A-Z]*)$",mj=new RegExp(CO),Rxt="__web_extension",hj="skipWalkthrough",UL="skipPublisherTrust",YW="extensionInstallSource",Mxt="dependecyOrPackExtensionInstall",V6i="clientTargetPlatform";function D3e(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 B6i(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 Pxt(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 ixe(a,i){return i==="web"&&!a.includes("web")}function zle(a,i,e){return ixe(i,e)?!1:a==="undefined"||a==="universal"?!0:a==="unknown"?!1:a===e}function H6i(a){let i=a;return!!i&&typeof i=="object"&&typeof i.id=="string"&&(!i.uuid||typeof i.uuid=="string")}var ta=ae("extensionGalleryService");var xE=class extends Error{constructor(e,t){super(e);this.code=t;this.name=t}};var ch=class extends Error{constructor(e,t){super(e);this.code=t;this.name=t}},ls=ae("extensionManagementService"),nY="extensionsIdentifiers/disabled",Cci="extensionsIdentifiers/enabled",nz=ae("IGlobalExtensionEnablementService"),oxe=ae("IExtensionTipsService"),zp=ae("IAllowedExtensionsService");async function xci(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=>xci(o.resource,i)))).reduce((o,n)=>o+n,0):e.size??0}var dh=L(1964,"Extensions"),kci=L(1981,"Preferences"),Kle="extensions.allowed",nxe="extensions.verifySignature",Axt="extensions.requestTimeout";oe.as(ii.Configuration).registerConfiguration({id:"extensions",order:30,title:d(1980,null),type:"object",properties:{[Kle]:{type:"object",markdownDescription:d(1970,null),default:"*",defaultSnippets:[{body:{},description:d(1975,null)},{body:{"*":!0},description:d(1971,null)}],scope:1,policy:{name:"AllowedExtensions",category:"Extensions",minimumVersion:"1.96",localization:{description:{key:"extensions.allowed.policy",value:d(1976,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(1968,null),enumDescriptions:[d(1974,null),d(1972,null),d(1973,null)]},{type:"array",items:{type:"string"},description:d(1969,null)}]},"([a-z0-9A-Z][a-z0-9-A-Z]*)$":{type:["boolean","string"],enum:[!0,!1,"stable"],description:d(1963,null),enumDescriptions:[d(1979,null),d(1977,null),d(1978,null)]},"\\*":{type:"boolean",enum:[!0,!1],description:d(1965,null),enumDescriptions:[d(1967,null),d(1966,null)]}}}}});function L3e(a,i){return a?i?.capabilities.signing?.allPrivateRepositorySigned===!0:i?.capabilities.signing?.allPublicRepositorySigned===!0}var nt=ae("productService"),U6i="vscode://schemas/vscode-product";var Eci=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[Ei.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:${Ei.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}},gj=new Eci;var tUo={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"},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:2},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"},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"},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"},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"},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"}},rz=Object.freeze(tUo);var Rci=oe.as(ea.JSONContribution),Nxt=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(gt.Error,i)}warn(i){this._msg(gt.Warning,i)}info(i){this._msg(gt.Info,i)}},Tci=class a{constructor(i,e){this.added=i;this.removed=e}static _toSet(i){let e=new QI;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)}},_ci=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=Tci.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)}}},iUo={type:"string",enum:["ui","workspace"],enumDescriptions:[d(16930,null),d(17010,null)]},z6i="vscode://schemas/vscode-extensions",Dci={properties:{engines:{type:"object",description:d(16994,null),properties:{vscode:{type:"string",description:d(16995,null),default:"^1.22.0"}}},publisher:{description:d(17006,null),type:"string"},displayName:{description:d(16991,null),type:"string"},categories:{description:d(16985,null),type:"array",uniqueItems:!0,items:{oneOf:[{type:"string",enum:gO},{type:"string",const:"Languages",deprecationMessage:d(16986,null)}]}},galleryBanner:{type:"object",description:d(16998,null),properties:{color:{description:d(16999,null),type:"string"},theme:{description:d(17000,null),type:"string",enum:["dark","light"]}}},contributes:{description:d(16987,null),type:"object",properties:{},default:{}},preview:{type:"boolean",description:d(17004,null)},enableProposedApi:{type:"boolean",deprecationMessage:d(16993,null)},enabledApiProposals:{markdownDescription:d(16992,null),type:"array",uniqueItems:!0,items:{type:"string",enum:Object.keys(rz).map(a=>a),markdownEnumDescriptions:Object.values(rz).map(a=>a.proposal)}},api:{markdownDescription:d(16965,null),type:"string",enum:["none"],enumDescriptions:[d(16966,null)]},activationEvents:{description:d(16931,null),type:"array",items:{type:"string",defaultSnippets:[{label:"onWebviewPanel",description:d(16962,null),body:"onWebviewPanel:viewType"},{label:"onLanguage",description:d(16945,null),body:"onLanguage:${1:languageId}"},{label:"onCommand",description:d(16935,null),body:"onCommand:${2:commandId}"},{label:"onDebug",description:d(16937,null),body:"onDebug"},{label:"onDebugInitialConfigurations",description:d(16940,null),body:"onDebugInitialConfigurations"},{label:"onDebugDynamicConfigurations",description:d(16939,null),body:"onDebugDynamicConfigurations"},{label:"onDebugResolve",description:d(16941,null),body:"onDebugResolve:${6:type}"},{label:"onDebugAdapterProtocolTracker",description:d(16938,null),body:"onDebugAdapterProtocolTracker:${6:type}"},{label:"workspaceContains",description:d(16964,null),body:"workspaceContains:${4:filePattern}"},{label:"onStartupFinished",description:d(16953,null),body:"onStartupFinished"},{label:"onTaskType",description:d(16954,null),body:"onTaskType:${1:taskType}"},{label:"onFileSystem",description:d(16943,null),body:"onFileSystem:${1:scheme}"},{label:"onEditSession",description:d(16942,null),body:"onEditSession:${1:scheme}"},{label:"onSearch",description:d(16952,null),body:"onSearch:${7:scheme}"},{label:"onView",body:"onView:${5:viewId}",description:d(16960,null)},{label:"onUri",body:"onUri",description:d(16959,null)},{label:"onOpenExternalUri",body:"onOpenExternalUri",description:d(16950,null)},{label:"onCustomEditor",body:"onCustomEditor:${9:viewType}",description:d(16936,null)},{label:"onNotebook",body:"onNotebook:${1:type}",description:d(16949,null)},{label:"onAuthenticationRequest",body:"onAuthenticationRequest:${11:authenticationProviderId}",description:d(16932,null)},{label:"onRenderer",description:d(16951,null),body:"onRenderer:${11:rendererId}"},{label:"onTerminalProfile",body:"onTerminalProfile:${1:terminalId}",description:d(16956,null)},{label:"onTerminalQuickFixRequest",body:"onTerminalQuickFixRequest:${1:quickFixId}",description:d(16957,null)},{label:"onWalkthrough",body:"onWalkthrough:${1:walkthroughID}",description:d(16961,null)},{label:"onIssueReporterOpened",body:"onIssueReporterOpened",description:d(16944,null)},{label:"onChatParticipant",body:"onChatParticipant:${1:participantId}",description:d(16934,null)},{label:"onChatContextProvider",body:"onChatContextProvider:${1:contextProviderId}",description:d(16933,null)},{label:"onLanguageModelChatProvider",body:"onLanguageModelChatProvider:${1:vendor}",description:d(16946,null)},{label:"onLanguageModelTool",body:"onLanguageModelTool:${1:toolId}",description:d(16947,null)},{label:"onTerminal",body:"onTerminal:{1:shellType}",description:d(16955,null)},{label:"onTerminalShellIntegration",body:"onTerminalShellIntegration:${1:shellType}",description:d(16958,null)},{label:"onMcpCollection",description:d(16948,null),body:"onMcpCollection:${2:collectionId}"},{label:"*",description:d(16963,null),body:"*"}]}},badges:{type:"array",description:d(16967,null),items:{type:"object",required:["url","href","description"],properties:{url:{type:"string",description:d(16970,null)},href:{type:"string",description:d(16969,null)},description:{type:"string",description:d(16968,null)}}}},markdown:{type:"string",description:d(17003,null),enum:["github","standard"],default:"github"},qna:{default:"marketplace",description:d(17007,null),anyOf:[{type:["string","boolean"],enum:["marketplace",!1]},{type:"string"}]},extensionDependencies:{description:d(16997,null),type:"array",uniqueItems:!0,items:{type:"string",pattern:CO}},extensionAffinity:{description:d(16996,null),type:"array",uniqueItems:!0,items:{type:"string",pattern:CO}},extensionPack:{description:d(16988,null),type:"array",uniqueItems:!0,items:{type:"string",pattern:CO}},extensionKind:{description:d(16923,null),type:"array",items:iUo,default:["workspace"],defaultSnippets:[{body:["ui"],description:d(16925,null)},{body:["workspace"],description:d(16927,null)},{body:["ui","workspace"],description:d(16926,null)},{body:["workspace","ui"],description:d(16928,null)},{body:[],description:d(16924,null)}]},capabilities:{description:d(16971,null),type:"object",properties:{virtualWorkspaces:{description:d(16979,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(16981,null),type:["string","boolean"],enum:["limited",!0,!1],enumDescriptions:[d(16983,null),d(16984,null),d(16982,null)]},description:{type:"string",markdownDescription:d(16980,null)}}},untrustedWorkspaces:{description:d(16972,null),type:"object",required:["supported"],defaultSnippets:[{body:{supported:"${1:limited}",description:"${2}"}}],properties:{supported:{markdownDescription:d(16975,null),type:["string","boolean"],enum:["limited",!0,!1],enumDescriptions:[d(16977,null),d(16978,null),d(16976,null)]},restrictedConfigurations:{description:d(16974,null),type:"array",items:{type:"string"}},description:{type:"string",markdownDescription:d(16973,null)}}}}},sponsor:{description:d(16989,null),type:"object",defaultSnippets:[{body:{url:"${1:https:}"}}],properties:{url:{description:d(16990,null),type:"string"}}},scripts:{type:"object",properties:{"vscode:prepublish":{description:d(17008,null),type:"string"},"vscode:uninstall":{description:d(17009,null),type:"string"}}},icon:{type:"string",description:d(17001,null)},l10n:{type:"string",description:d(17002,null)},pricing:{type:"string",markdownDescription:d(17005,null),enum:["Free","Trial"],default:"Free"}}},Lci=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 _ci(i.extensionPoint,i.defaultExtensionKind,i.canHandleResolver);return this._extensionPoints.set(i.extensionPoint,e),i.activationEventsGenerator&&gj.register(i.extensionPoint,i.activationEventsGenerator),Dci.properties.contributes.properties[i.extensionPoint]=i.jsonSchema,Rci.registerSchema(z6i,Dci),e}getExtensionPoints(){return Array.from(this._extensionPoints.values())}},K6i={ExtensionsRegistry:"ExtensionsRegistry"};oe.add(K6i.ExtensionsRegistry,new Lci);var Tn=oe.as(K6i.ExtensionsRegistry);Rci.registerSchema(z6i,Dci);Rci.registerSchema(U6i,{properties:{extensionEnabledApiProposals:{description:d(16929,null),type:"object",properties:{},additionalProperties:{anyOf:[{type:"array",uniqueItems:!0,items:{type:"string",enum:Object.keys(rz),markdownEnumDescriptions:Object.values(rz).map(a=>a.proposal)}}]}}}});var Ds;(i=>i.ExtensionFeaturesRegistry="workbench.registry.extensionFeatures")(Ds||={});var YI=ae("IExtensionFeaturesManagementService"),Mci=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())}};oe.add(Ds.ExtensionFeaturesRegistry,new Mci);var G6i=Tn.registerExtensionPoint({extensionPoint:"jsonValidation",defaultExtensionKind:["workspace","web"],jsonSchema:{description:d(3214,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(3215,null),items:{type:["string"]}},url:{description:d(3216,null),type:"string"}}}}}),Oxt=class{constructor(){G6i.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(3219,null));return}t.forEach(r=>{if(!Ae(r.fileMatch)&&!(Array.isArray(r.fileMatch)&&r.fileMatch.every(Ae))){o.error(d(3218,null));return}let s=r.url;if(!Ae(s)){o.error(d(3221,null));return}if(s.startsWith("./"))try{let l=je(n,s);La(l,n)||o.warn(d(3220,null,G6i.name,l.toString(),n.path))}catch(l){o.error(d(3222,null,l.message))}else if(!/^[^:/?#]+:\/\//.test(s)){o.error(d(3223,null));return}})}})}},Pci=class extends C{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(3217,null),d(3225,null)],n=t.map(r=>[new xe().appendMarkdown(`\`${Array.isArray(r.fileMatch)?r.fileMatch.join(", "):r.fileMatch}\``),r.url]);return{data:{headers:o,rows:n},dispose:()=>{}}}};oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:"jsonValidation",label:d(3224,null),access:{canToggle:!1},renderer:new Mt(Pci)});var Aci=oe.as(Tse.ColorContribution),Fxt=Aci.getColorReferenceSchema(),$6i="^\\w+[.\\w+]*$",oUo=Tn.registerExtensionPoint({extensionPoint:"colors",jsonSchema:{description:d(17285,null),type:"array",items:{type:"object",properties:{id:{type:"string",description:d(17287,null),pattern:$6i,patternErrorMessage:d(17288,null)},description:{type:"string",description:d(17286,null)},defaults:{type:"object",properties:{light:{description:d(17292,null),type:"string",anyOf:[Fxt,{type:"string",format:"color-hex"}]},dark:{description:d(17289,null),type:"string",anyOf:[Fxt,{type:"string",format:"color-hex"}]},highContrast:{description:d(17290,null),type:"string",anyOf:[Fxt,{type:"string",format:"color-hex"}]},highContrastLight:{description:d(17291,null),type:"string",anyOf:[Fxt,{type:"string",format:"color-hex"}]}},required:["light","dark"]}}}}}),Wxt=class{constructor(){oUo.setHandler((i,e)=>{for(let t of e.added){let o=t.value,n=t.collector;if(!o||!Array.isArray(o)){n.error(d(17298,null));return}let r=(s,l)=>s.length>0?s[0]==="#"?Oe.Format.CSS.parseHex(s):s:(n.error(d(17299,null,l)),Oe.red);for(let s of o){if(typeof s.id!="string"||s.id.length===0){n.error(d(17304,null));return}if(!s.id.match($6i)){n.error(d(17305,null));return}if(typeof s.description!="string"||s.id.length===0){n.error(d(17303,null));return}let l=s.defaults;if(!l||typeof l!="object"||typeof l.light!="string"||typeof l.dark!="string"){n.error(d(17300,null));return}if(l.highContrast&&typeof l.highContrast!="string"){n.error(d(17301,null));return}if(l.highContrastLight&&typeof l.highContrastLight!="string"){n.error(d(17302,null));return}Aci.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)Aci.deregisterColor(n.id)}})}},Nci=class extends C{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(17297,null),d(17296,null),d(17293,null),d(17295,null),d(17294,null)],n=s=>s[0]==="#"?Oe.fromHex(s):void 0,r=t.sort((s,l)=>s.id.localeCompare(l.id)).map(s=>[new xe().appendMarkdown(`\`${s.id}\``),s.description,n(s.defaults.dark)??new xe().appendMarkdown(`\`${s.defaults.dark}\``),n(s.defaults.light)??new xe().appendMarkdown(`\`${s.defaults.light}\``),n(s.defaults.highContrast)??new xe().appendMarkdown(`\`${s.defaults.highContrast}\``)]);return{data:{headers:o,rows:r},dispose:()=>{}}}};oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:"colors",label:d(17284,null),access:{canToggle:!1},renderer:new Mt(Nci)});var R3e=oe.as(Uti.IconContribution),nUo=R3e.getIconReferenceSchema(),q6i=`^${q.iconNameSegment}(-${q.iconNameSegment})+$`,rUo=Tn.registerExtensionPoint({extensionPoint:"icons",jsonSchema:{description:d(17373,null),type:"object",propertyNames:{pattern:q6i,description:d(17371,null),patternErrorMessage:d(17372,null)},additionalProperties:{type:"object",properties:{description:{type:"string",description:d(17370,null)},default:{anyOf:[nUo,{type:"object",properties:{fontPath:{description:d(17369,null),type:"string"},fontCharacter:{description:d(17368,null),type:"string"}},required:["fontPath","fontCharacter"],defaultSnippets:[{body:{fontPath:"${1:myiconfont.woff}",fontCharacter:"${2:\\\\E001}"}}]}],description:d(17367,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}"}}}}]}}),Vxt=class{constructor(){rUo.setHandler((i,e)=>{for(let t of e.added){let o=t.value,n=t.collector;if(!o||typeof o!="object"){n.error(d(17374,null));return}for(let r in o){if(!r.match(q6i)){n.error(d(17379,null));return}let s=o[r];if(typeof s.description!="string"||s.description.length===0){n.error(d(17378,null));return}let l=s.default;if(typeof l=="string")R3e.registerIcon(r,{id:l},s.description);else if(typeof l=="object"&&typeof l.fontPath=="string"&&typeof l.fontCharacter=="string"){let c=Am(l.fontPath).substring(1),u=sUo[c];if(!u){n.warn(d(17376,null,c));return}let p=t.description.extensionLocation,h=je(p,l.fontPath),g=aUo(t.description,l.fontPath),f=R3e.registerIconFont(g,{src:[{location:h,format:u}]});if(!La(h,p)){n.warn(d(17377,null,h.path,p.path));return}R3e.registerIcon(r,{fontCharacter:l.fontCharacter,font:{id:g,definition:f}},s.description)}else n.error(d(17375,null))}}for(let t of e.removed){let o=t.value;for(let n in o)R3e.deregisterIcon(n)}})}},sUo={ttf:"truetype",woff:"woff",woff2:"woff2"};function aUo(a,i){return Lo.join(a.identifier.value,i)}var lUo="*",Y6i=":",X6i=".",Bxt="\\w+[-_\\w+]*",fj=`^${Bxt}$`,cUo=`^(${Bxt}|\\*)(\\${X6i}${Bxt})*(${Y6i}${Bxt})?$`,dUo="^(\\s*(italic|bold|underline|strikethrough))*\\s*$",tP=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:Oe.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"?Oe.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 Oe?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=Oe.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})(tP||={});var rxe;(o=>{function a(n,r){if(r&&typeof r._selector=="string"&&r._style){let s=tP.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:tP.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&&tP.equals(n.style,r.style)}o.equals=e;function t(n){return n&&n.selector&&typeof n.selector.id=="string"&&tP.is(n.style)}o.is=t})(rxe||={});var uUo={TokenClassificationContribution:"base.contributions.tokenClassification"},Fci=class extends C{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:{[cUo]:Oci()},additionalProperties:!1,definitions:{style:{type:"object",description:d(2644,null),properties:{foreground:{type:"string",description:d(2642,null),format:"color-hex",default:"#ff0000"},background:{type:"string",deprecationMessage:d(2638,null)},fontStyle:{type:"string",description:d(2640,null),pattern:dUo,patternErrorMessage:d(2637,null),defaultSnippets:[{label:d(2641,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(2639,null)},italic:{type:"boolean",description:d(2643,null)},underline:{type:"boolean",description:d(2646,null)},strikethrough:{type:"boolean",description:d(2645,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(fj))throw new Error("Invalid token type id.");if(o&&!o.match(fj))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=Oci(t,n);this.tokenStylingSchema.properties[e]=l,this.typeHierarchy=Object.create(null)}registerTokenModifier(e,t,o){if(!e.match(fj))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}`]=Oci(t,o)}parseTokenSelector(e,t){let o=Hxt(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!==lUo){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(`
`)}},j6i=Y6i.charCodeAt(0),pUo=X6i.charCodeAt(0);function Hxt(a,i){let e=a.length,t=i,o=[];for(let r=e-1;r>=0;r--){let s=a.charCodeAt(r);if(s===j6i||s===pUo){let l=a.substring(r+1,e);e=r,s===j6i?t=l:o.push(l)}}return{type:a.substring(0,e),modifiers:o,language:t}}var Uxt=mUo();oe.add(uUo.TokenClassificationContribution,Uxt);function mUo(){let a=new Fci;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(2614,null),[["comment"]]),i("string",d(2648,null),[["string"]]),i("keyword",d(2624,null),[["keyword.control"]]),i("number",d(2631,null),[["constant.numeric"]]),i("regexp",d(2636,null),[["constant.regexp"]]),i("operator",d(2632,null),[["keyword.operator"]]),i("namespace",d(2630,null),[["entity.name.namespace"]]),i("type",d(2650,null),[["entity.name.type"],["support.type"]]),i("struct",d(2649,null),[["entity.name.type.struct"]]),i("class",d(2613,null),[["entity.name.type.class"],["support.class"]]),i("interface",d(2623,null),[["entity.name.type.interface"]]),i("enum",d(2619,null),[["entity.name.type.enum"]]),i("typeParameter",d(2651,null),[["entity.name.type.parameter"]]),i("function",d(2622,null),[["entity.name.function"],["support.function"]]),i("member",d(2627,null),[],"method","Deprecated use `method` instead"),i("method",d(2628,null),[["entity.name.function.member"],["support.function"]]),i("macro",d(2626,null),[["entity.name.function.preprocessor"]]),i("variable",d(2652,null),[["variable.other.readwrite"],["entity.name.variable"]]),i("parameter",d(2633,null),[["variable.parameter"]]),i("property",d(2634,null),[["variable.other.property"]]),i("enumMember",d(2620,null),[["variable.other.enummember"]]),i("event",d(2621,null),[["variable.other.event"]]),i("decorator",d(2616,null),[["entity.name.decorator"],["entity.name.function"]]),i("label",d(2625,null),void 0),a.registerTokenModifier("declaration",d(2615,null),void 0),a.registerTokenModifier("documentation",d(2618,null),void 0),a.registerTokenModifier("static",d(2647,null),void 0),a.registerTokenModifier("abstract",d(2611,null),void 0),a.registerTokenModifier("deprecated",d(2617,null),void 0),a.registerTokenModifier("modification",d(2629,null),void 0),a.registerTokenModifier("async",d(2612,null),void 0),a.registerTokenModifier("readonly",d(2635,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 zxt(){return Uxt}function Oci(a,i){return{description:a,deprecationMessage:i,defaultSnippets:[{body:"${1:#ff0000}"}],anyOf:[{type:"string",format:"color-hex"},{$ref:"#/definitions/style"}]}}var sxe="vscode://schemas/token-styling",J6i=oe.as(ea.JSONContribution);J6i.registerSchema(sxe,Uxt.getTokenStylingSchema());var Q6i=new Dt(()=>J6i.notifySchemaChanged(sxe),200);Uxt.onDidChangeSchema(()=>{Q6i.isScheduled()||Q6i.schedule()});var rY=zxt(),hUo=Tn.registerExtensionPoint({extensionPoint:"semanticTokenTypes",jsonSchema:{description:d(17448,null),type:"array",items:{type:"object",properties:{id:{type:"string",description:d(17449,null),pattern:fj,patternErrorMessage:d(17450,null)},superType:{type:"string",description:d(17451,null),pattern:fj,patternErrorMessage:d(17452,null)},description:{type:"string",description:d(17440,null)}}}}}),gUo=Tn.registerExtensionPoint({extensionPoint:"semanticTokenModifiers",jsonSchema:{description:d(17441,null),type:"array",items:{type:"object",properties:{id:{type:"string",description:d(17443,null),pattern:fj,patternErrorMessage:d(17444,null)},description:{description:d(17442,null)}}}}}),fUo=Tn.registerExtensionPoint({extensionPoint:"semanticTokenScopes",jsonSchema:{description:d(17445,null),type:"array",items:{type:"object",properties:{language:{description:d(17446,null),type:"string"},scopes:{description:d(17447,null),type:"object",additionalProperties:{type:"array",items:{type:"string"}}}}}}}),Kxt=class{constructor(){function i(e,t,o){if(typeof e.id!="string"||e.id.length===0)return o.error(d(17454,null,t)),!1;if(!e.id.match(fj))return o.error(d(17455,null,t)),!1;let n=e.superType;return n&&!n.match(fj)?(o.error(d(17463,null,t)),!1):typeof e.description!="string"||e.id.length===0?(o.error(d(17453,null,t)),!1):!0}hUo.setHandler((e,t)=>{for(let o of t.added){let n=o.value,r=o.collector;if(!n||!Array.isArray(n)){r.error(d(17462,null));return}for(let s of n)i(s,"semanticTokenType",r)&&rY.registerTokenType(s.id,s.description,s.superType)}for(let o of t.removed){let n=o.value;for(let r of n)rY.deregisterTokenType(r.id)}}),gUo.setHandler((e,t)=>{for(let o of t.added){let n=o.value,r=o.collector;if(!n||!Array.isArray(n)){r.error(d(17456,null));return}for(let s of n)i(s,"semanticTokenModifier",r)&&rY.registerTokenModifier(s.id,s.description)}for(let o of t.removed){let n=o.value;for(let r of n)rY.deregisterTokenModifier(r.id)}}),fUo.setHandler((e,t)=>{for(let o of t.added){let n=o.value,r=o.collector;if(!n||!Array.isArray(n)){r.error(d(17457,null));return}for(let s of n){if(s.language&&typeof s.language!="string"){r.error(d(17458,null));continue}if(!s.scopes||typeof s.scopes!="object"){r.error(d(17459,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(17461,null));continue}try{let u=rY.parseTokenSelector(l,s.language);rY.registerTokenStyleDefault(u,{scopesToProbe:c.map(p=>p.split(" "))})}catch{r.error(d(17460,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=rY.parseTokenSelector(s,r.language);rY.registerTokenStyleDefault(c,{scopesToProbe:l.map(u=>u.split(" "))})}catch{}}}})}};var $xt;(i=>i.DEFAULT={allowTrailingComma:!0})($xt||={});function $le(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&&axe(a.charCodeAt(e));)e++;if(e<a.length&&a.charCodeAt(e)===46)if(e++,e<a.length&&axe(a.charCodeAt(e)))for(e++;e<a.length&&axe(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&&axe(a.charCodeAt(e))){for(e++;e<a.length&&axe(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(Gxt(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(Wci(v)){do e++,o+=String.fromCharCode(v),v=a.charCodeAt(e);while(Wci(v));return r=15}if(Gxt(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&&!Gxt(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||!axe(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(Wci(v)||Gxt(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 Wci(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 Gxt(a){return a===10||a===13||a===8232||a===8233}function axe(a){return a>=48&&a<=57}function Z6i(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{Wx(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,Vx(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 Ur(a,i=[],e=$xt.DEFAULT){let t=null,o=[],n=[];function r(l){Array.isArray(o)?o.push(l):t!==null&&(o[t]=l)}return Wx(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 zL(a,i=[],e=$xt.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}Wx(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:Vx(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 lC(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 Vci(a){if(!a.parent||!a.parent.children)return[];let i=Vci(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 vUo(a,i,e=!1){return i>=a.offset&&i<a.offset+a.length||e&&i===a.offset+a.length}function Bci(a,i,e=!1){if(vUo(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=Bci(t[o],i,e);if(n)return n}return a}}function Wx(a,i,e=$xt.DEFAULT){let t=$le(a,!1);function o(U){return U?()=>U(t.getTokenOffset(),t.getTokenLength()):()=>!0}function n(U){return U?G=>U(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 U=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(U){case 12:case 13:v?y(10):g();break;case 16:y(1);break;case 15:case 14:break;default:return U}}}function y(U,G=[],$=[]){if(f(U),G.length+$.length>0){let te=t.getToken();for(;te!==17;){if(G.indexOf(te)!==-1){S();break}else if($.indexOf(te)!==-1)break;te=S()}}}function w(U){let G=t.getTokenValue();return U?p(G):s(G),S(),!0}function k(){switch(t.getToken()){case 11:{let U=0;try{U=JSON.parse(t.getTokenValue()),typeof U!="number"&&(y(2),U=0)}catch{y(2)}p(U);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 N(){r(),S();let U=!1;for(;t.getToken()!==2&&t.getToken()!==17;){if(t.getToken()===5){if(U||y(4,[],[]),h(","),S(),t.getToken()===2&&b)break}else U&&y(6,[],[]);T()||y(4,[],[2,5]),U=!0}return l(),t.getToken()!==2?y(7,[2],[]):S(),!0}function O(){c(),S();let U=!1;for(;t.getToken()!==4&&t.getToken()!==17;){if(t.getToken()===5){if(U||y(4,[],[]),h(","),S(),t.getToken()===4&&b)break}else U&&y(6,[],[]);V()||y(4,[],[4,5]),U=!0}return u(),t.getToken()!==4?y(8,[4],[]):S(),!0}function V(){switch(t.getToken()){case 3:return O();case 1:return N();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 Vx(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 bUo(a){if(Pp===2&&/^penguin(\.|$)/i.test(a))return"chromebook"}function e9i(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=_t()+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"]=LT(Pp),p["common.nodePlatform"]=ZA,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}}),rbe&&(p["common.snap"]="true");let f=bUo(i);return f&&(p["common.platformDetail"]=f),p}function t9i(a){let i=fp.USERDNSDOMAIN;if(!i)return!1;let e=i.toLowerCase();return a.some(t=>e===t)}var Im=class{constructor(i){this.value=i;this.isTrustedTelemetryValue=!0}},Hci=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(){}},i9i=new Hci;var qle="telemetry",qxt={id:qle,name:d(2302,null)};function KL(a,i){return!i.isBuilt&&!i.disableTelemetry?!0:!(i.disableTelemetry||!a.enableTelemetry)}function lxe(a,i){return i.extensionTestsLocationURI?!0:!(i.isBuilt||i.disableTelemetry||a.enableTelemetry&&a.aiConfig?.ariaKey)}function xO(a){let i=a.getValue(bN),e=a.getValue(hmt);if(a.getValue(zre)===!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 jxt(a,i){if(!a)return"none";let e=$S(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 o9i(a,i){let e=a.msftInternalDomains||[],t=i.getValue("telemetry.internalTesting");return t9i(e)||t}function n9i(a){return[a.appRoot,a.extensionsPath,a.userHome.fsPath,a.tmpDir.fsPath,a.userDataPath]}function IUo(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;let c=t.some(([u,p])=>l.index<p&&u<r.lastIndex);if(!o.test(l[0])&&!c){let u=n.exec(l[0]);u?e+=a.substring(s,l.index)+"<REDACTED: user-file-path>/"+u[2]:e+=a.substring(s,l.index)+"<REDACTED: user-file-path>",s=r.lastIndex}}return s<a.length&&(e+=a.substr(s)),e}function yUo(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 r9i(a,i){return a?Gk(a,e=>{if(e instanceof Im||Object.hasOwnProperty.call(e,"isTrustedTelemetryValue"))return e.value;if(typeof e=="string"){let t=e.replaceAll("%20"," ");t=IUo(t,i);for(let o of i)t=t.replace(o,"");return t=yUo(t),t}}):{}}function Ot(a,i){return a.uuid&&i.uuid?a.uuid===i.uuid:a.id===i.id?!0:Uw(a.id,i.id)===0}var wUo=/^([^.]+\..+)-(\d+\.\d+\.\d+)(-(.+))?$/,Qxt=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=wUo.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?Ot(this,i)&&this.version===i.version&&this.targetPlatform===i.targetPlatform:!1}},CUo=/^([^.]+\..+)@((prerelease)|(\d+\.\d+\.\d+(-.*)?))$/;function M3e(a){let i=CUo.exec(a);return i&&i[1]?[jle(i[1]),i[2]]:[jle(a),void 0]}function Jb(a,i){return`${a}.${i}`}function jle(a){return a.toLowerCase()}function Df(a,i){return jle(Jb(a??fwt,i))}function Uci(a,i){let e=[],t=o=>{for(let n of e)if(n.some(r=>Ot(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 Yxt(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 Qle(a){return{id:new Im(a.identifier.id),name:new Im(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 s9i=new Ei("pprice.better-merge");function Yle(a,i){let e=[],t=i.manifest.extensionDependencies?.slice(0)??[];for(;t.length;){let o=t.shift();if(o&&e.every(n=>!Ot(n.identifier,{id:o}))){let n=a.filter(r=>Ot(r.identifier,{id:o}));n.length===1&&(e.push(n[0]),t.push(...n[0].manifest.extensionDependencies?.slice(0)??[]))}}return e}async function xUo(a,i){if(!Wn)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.",Cn(o))}}return!!e&&(e.match(/^ID=([^\u001b\r\n]*)/m)||[])[1]==="alpine"}async function Xxt(a,i){let e=await xUo(a,i),t=Pxt(e?"alpine":Pp,ube);return i.debug("ComputeTargetPlatform:",t),t}function Jxt(a,i){return zci(a,i)!==void 0}function zci(a,i){return i.find(({extensionOrPublisher:e})=>Ae(e)?Uw(a.id.split(".")[0],e)===0:Ot(a,e))}var tkt=Object.freeze({identifier:new Ei("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}),ikt="extensions.webWorker",lt=ae("extensionService");var Xle=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:gj.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=a9i(this._allExtensions),c=a9i(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 QI(this._myExtensions),h=new QI(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=gj.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 QI(e),s=new QI(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(Ei.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=gj.readActivationEvents(e);for(let o of t)i.add(o)}return i}};function a9i(a){let i=new Fd;for(let e of a)i.set(e.identifier,e);return i}function Ea(a,i){return a.enabledApiProposals?a.enabledApiProposals.includes(i):!1}function P3e(a,i){if(!Ea(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 Zxt=class{constructor(i,e,t,o){this.codeLoadingTime=i;this.activateCallTime=e;this.activateResolvedTime=t;this.activationReason=o}},ekt=class{constructor(i,e){this.description=i,this.value=e}};function kE(a){return{type:a.isBuiltin?0:1,isBuiltin:a.isBuiltin||a.isUserBuiltin,identifier:{id:Df(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 kO(a,i){let e=Jb(a.manifest.publisher,a.manifest.name);return{id:e,identifier:new Ei(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 EO(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 TO(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=Ugt(n)?n:null}catch{t=null}if(!t){t=_t();try{await i.writeFile(a.serviceMachineIdResource,Je.fromString(t))}catch{}}return e?.store("storage.serviceMachineId",t,-1,1),t}var vv=ae("IExtensionGalleryManifestService");function oP(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 A3e="extensions.gallery.serviceUrl";var kUo="/web-extension-resource/",Bx=ae("extensionResourceLoaderService");var okt=class extends C{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?oP(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(PT(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:jD.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}${Gt?"-web":""}`,"X-Client-Version":this._productService.version};return KL(this._productService,this._environmentService)&&xO(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=TO(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=jD.getServerRootPath();return t.startsWith(o)&&t.startsWith(kUo,o.length)}};function l9i(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 N3e(a){return l9i(a)&&a.length===2}var sY=class extends C{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=Ir(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=Ur(t,o);return o.length&&console.error(d(8355,null,e.toString(),o.map(r=>`[${r.offset}, ${r.length}] ${EO(r.error)}`).join(`
`))),Vx(n)!=="object"&&(console.error(d(8354,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(!yi(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(yi(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"&&(N3e(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(!N3e(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(!N3e(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(!yi(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"&&!l9i(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(!N3e(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(!yi(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(!N3e(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(!yi(l)){console.warn(`[${e}]: language configuration: expected \`onEnterRules[${r}]\` to be an object.`);continue}if(!yi(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=sY.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(yi(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}};sY=I([m(0,kt),m(1,Bx),m(2,lt),m(3,bs)],sY);var EUo="vscode://schemas/language-configuration",TUo={allowComments:!0,allowTrailingCommas:!0,default:{comments:{blockComment:["/*","*/"],lineComment:"//"},brackets:[["(",")"],["[","]"],["{","}"]],autoClosingPairs:[["(",")"],["[","]"],["{","}"]],surroundingPairs:[["(",")"],["[","]"],["{","}"]]},definitions:{openBracket:{type:"string",description:d(8412,null)},closeBracket:{type:"string",description:d(8363,null)},bracketPair:{type:"array",items:[{$ref:"#/definitions/openBracket"},{$ref:"#/definitions/closeBracket"}]}},properties:{comments:{default:{blockComment:["/*","*/"],lineComment:{comment:"//",noIndent:!1}},description:d(8365,null),type:"object",properties:{blockComment:{type:"array",description:d(8361,null),items:[{type:"string",description:d(8359,null)},{type:"string",description:d(8360,null)}]},lineComment:{type:"object",description:d(8390,null),properties:{comment:{type:"string",description:d(8388,null)},noIndent:{type:"boolean",description:d(8389,null),default:!1}},required:["comment"],additionalProperties:!1}}},brackets:{default:[["(",")"],["[","]"],["{","}"]],markdownDescription:d(8362,null,"`colorizedBracketPairs`"),type:"array",items:{$ref:"#/definitions/bracketPair"}},colorizedBracketPairs:{default:[["(",")"],["[","]"],["{","}"]],markdownDescription:d(8364,null,"`brackets`"),type:"array",items:{$ref:"#/definitions/bracketPair"}},autoClosingPairs:{default:[["(",")"],["[","]"],["{","}"]],description:d(8357,null),type:"array",items:{oneOf:[{$ref:"#/definitions/bracketPair"},{type:"object",properties:{open:{$ref:"#/definitions/openBracket"},close:{$ref:"#/definitions/closeBracket"},notIn:{type:"array",description:d(8358,null),items:{enum:["string","comment"]}}}}]}},autoCloseBefore:{default:`;:.,=}])> 
	`,description:d(8356,null),type:"string"},surroundingPairs:{default:[["(",")"],["[","]"],["{","}"]],description:d(8413,null),type:"array",items:{oneOf:[{$ref:"#/definitions/bracketPair"},{type:"object",properties:{open:{$ref:"#/definitions/openBracket"},close:{$ref:"#/definitions/closeBracket"}}}]}},wordPattern:{default:"",description:d(8414,null),type:["string","object"],properties:{pattern:{type:"string",description:d(8417,null),default:""},flags:{type:"string",description:d(8415,null),default:"g",pattern:"^([gimuy]+)$",patternErrorMessage:d(8416,null)}}},indentationRules:{default:{increaseIndentPattern:"",decreaseIndentPattern:""},description:d(8371,null),type:"object",properties:{increaseIndentPattern:{type:["string","object"],description:d(8376,null),properties:{pattern:{type:"string",description:d(8379,null),default:""},flags:{type:"string",description:d(8378,null),default:"",pattern:"^([gimuy]+)$",patternErrorMessage:d(8377,null)}}},decreaseIndentPattern:{type:["string","object"],description:d(8372,null),properties:{pattern:{type:"string",description:d(8375,null),default:""},flags:{type:"string",description:d(8374,null),default:"",pattern:"^([gimuy]+)$",patternErrorMessage:d(8373,null)}}},indentNextLinePattern:{type:["string","object"],description:d(8380,null),properties:{pattern:{type:"string",description:d(8383,null),default:""},flags:{type:"string",description:d(8382,null),default:"",pattern:"^([gimuy]+)$",patternErrorMessage:d(8381,null)}}},unIndentedLinePattern:{type:["string","object"],description:d(8384,null),properties:{pattern:{type:"string",description:d(8387,null),default:""},flags:{type:"string",description:d(8386,null),default:"",pattern:"^([gimuy]+)$",patternErrorMessage:d(8385,null)}}}}},folding:{type:"object",description:d(8366,null),properties:{offSide:{type:"boolean",description:d(8370,null)},markers:{type:"object",description:d(8367,null),properties:{start:{type:"string",description:d(8369,null)},end:{type:"string",description:d(8368,null)}}}}},onEnterRules:{type:"array",description:d(8391,null),items:{type:"object",description:d(8391,null),required:["beforeText","action"],properties:{beforeText:{type:["string","object"],description:d(8404,null),properties:{pattern:{type:"string",description:d(8407,null),default:""},flags:{type:"string",description:d(8406,null),default:"",pattern:"^([gimuy]+)$",patternErrorMessage:d(8405,null)}}},afterText:{type:["string","object"],description:d(8400,null),properties:{pattern:{type:"string",description:d(8403,null),default:""},flags:{type:"string",description:d(8402,null),default:"",pattern:"^([gimuy]+)$",patternErrorMessage:d(8401,null)}}},previousLineText:{type:["string","object"],description:d(8408,null),properties:{pattern:{type:"string",description:d(8411,null),default:""},flags:{type:"string",description:d(8410,null),default:"",pattern:"^([gimuy]+)$",patternErrorMessage:d(8409,null)}}},action:{type:["string","object"],description:d(8392,null),required:["indent"],default:{indent:"indent"},properties:{indent:{type:"string",description:d(8394,null),default:"indent",enum:["none","indent","indentOutdent","outdent"],markdownEnumDescriptions:[d(8397,null),d(8395,null),d(8396,null),d(8398,null)]},appendText:{type:"string",description:d(8393,null),default:""},removeText:{type:"number",description:d(8399,null),default:0}}}}}}}},_Uo=oe.as(ea.JSONContribution);_Uo.registerSchema(EUo,TUo);var Tr=ae("statusbarService");function Jle(a){let i=a;return typeof i?.location?.id=="string"&&typeof i.alignment=="number"}function c9i(a){let i=a;return(typeof i?.primary=="number"||Jle(i?.primary))&&typeof i?.secondary=="number"}var GL={id:"statusBar.entry.showTooltip",title:""},d9i=["standard","warning","error","prominent","remote","offline"];function u9i(a){let i=a;return!!i?.content&&Array.isArray(i?.commands)}var Mc=ae("remoteAuthorityResolverService");var rkt=class{constructor(i){this.id=i;this.type=1}toString(){return`Managed(${this.id})`}},skt=class{constructor(i,e){this.host=i;this.port=e;this.type=0}toString(){return`WebSocket(${this.host}:${this.port})`}};var ow=class a extends Zs{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 sz(a){let i=a.indexOf("+");return i===-1?a:a.substring(0,i)}function cr(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 nw,EE=class{constructor(i,e=!1){Yve(this,nw);j2e(this,nw,new xe(i,{supportThemeIcons:e}))}static isMarkdownString(i){return i instanceof EE?!0:!i||typeof i!="object"?!1:i.appendCodeblock&&i.appendMarkdown&&i.appendText&&i.value!==void 0}get value(){return pf(this,nw).value}set value(i){pf(this,nw).value=i}get isTrusted(){return pf(this,nw).isTrusted}set isTrusted(i){pf(this,nw).isTrusted=i}get supportThemeIcons(){return pf(this,nw).supportThemeIcons}set supportThemeIcons(i){pf(this,nw).supportThemeIcons=i}get supportHtml(){return pf(this,nw).supportHtml}set supportHtml(i){pf(this,nw).supportHtml=i}get supportAlertSyntax(){return pf(this,nw).supportAlertSyntax}set supportAlertSyntax(i){pf(this,nw).supportAlertSyntax=i}get baseUri(){return pf(this,nw).baseUri}set baseUri(i){pf(this,nw).baseUri=i}appendText(i){return pf(this,nw).appendText(i),this}appendMarkdown(i){return pf(this,nw).appendMarkdown(i),this}appendCodeblock(i,e){return pf(this,nw).appendCodeblock(e??"",i),this}};nw=new WeakMap,EE=I([cr],EE);var sc=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 sc)return!0;let{line:e,character:t}=i;return typeof e=="number"&&typeof t=="number"}static of(i){if(i instanceof sc)return i;if(this.isPosition(i))return new sc(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 Br("line must be non-negative");if(e<0)throw Br("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 Br();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 sc(this.line+t,this.character+e)}with(i,e=this.character){if(i===null||e===null)throw Br();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 sc(t,e)}toJSON(){return{line:this.line,character:this.character}}[Symbol.for("debug.description")](){return`(${this.line}:${this.character})`}};sc=I([cr],sc);var Kc=class{static isRange(i){return i instanceof Kc?!0:!i||typeof i!="object"?!1:sc.isPosition(i.start)&&sc.isPosition(i.end)}static of(i){if(i instanceof Kc)return i;if(this.isRange(i))return new Kc(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 sc(i,e),r=new sc(t,o)):sc.isPosition(i)&&sc.isPosition(e)&&(n=sc.of(i),r=sc.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 Kc.isRange(i)?this.contains(i.start)&&this.contains(i.end):sc.isPosition(i)?!(sc.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=sc.Max(i.start,this._start),t=sc.Min(i.end,this._end);if(!e.isAfter(t))return new Kc(e,t)}union(i){if(this.contains(i))return this;if(i.contains(this))return i;let e=sc.Min(i.start,this._start),t=sc.Max(i.end,this.end);return new Kc(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 Br();let t;return i?sc.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 Kc(t,e)}toJSON(){return[this.start,this.end]}[Symbol.for("debug.description")](){return Kci(this)}};Kc=I([cr],Kc);function Kci(a){return a.isEmpty?`[${a.start.line}:${a.start.character})`:`[${a.start.line}:${a.start.character} -> ${a.end.line}:${a.end.character})`}var Kp=class{constructor(i){this.value=i}append(i){return new Kp(this.value?this.value+Kp.sep+i:i)}intersects(i){return this.contains(i)||i.contains(this)}contains(i){return this.value===i.value||i.value.startsWith(this.value+Kp.sep)}};Kp.sep=".",Kp=I([cr],Kp);Kp.Empty=new Kp("");Kp.QuickFix=Kp.Empty.append("quickfix");Kp.Refactor=Kp.Empty.append("refactor");Kp.RefactorExtract=Kp.Refactor.append("extract");Kp.RefactorInline=Kp.Refactor.append("inline");Kp.RefactorMove=Kp.Refactor.append("move");Kp.RefactorRewrite=Kp.Refactor.append("rewrite");Kp.Source=Kp.Empty.append("source");Kp.SourceOrganizeImports=Kp.Source.append("organizeImports");Kp.SourceFixAll=Kp.Source.append("fixAll");Kp.Notebook=Kp.Empty.append("notebook");var akt=(o=>(o[o.Hint=3]="Hint",o[o.Information=2]="Information",o[o.Warning=1]="Warning",o[o.Error=0]="Error",o))(akt||{}),aY=class{static is(i){return i?typeof i.message=="string"&&i.location&&Kc.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()}};aY=I([cr],aY);var Zle=class{constructor(i,e,t=0){if(!Kc.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:akt[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,aY.isEqual)}};Zle=I([cr],Zle);var y_=class{static isLocation(i){return i instanceof y_?!0:i?Kc.isRange(i.range)&&A.isUri(i.uri):!1}constructor(i,e){if(this.uri=i,e)if(Kc.isRange(e))this.range=Kc.of(e);else if(sc.isPosition(e))this.range=new Kc(e,e);else throw new Error("Illegal argument")}toJSON(){return{uri:this.uri,range:this.range}}};y_=I([cr],y_);var vj=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 Br("start must be positive");if(e<0)throw Br("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)}},cxe=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)}},O3e=class{constructor(i){this.cells=i}},$L=class{static isNotebookCellEdit(i){return i instanceof $L?!0:i?vj.isNotebookRange(i)&&Array.isArray(i.newCells):!1}static replaceCells(i,e){return new $L(i,e)}static insertCells(i,e){return new $L(new vj(i,i),e)}static deleteCells(i){return new $L(i,[])}static updateCellMetadata(i,e){let t=new $L(new vj(i,i),[]);return t.newCellMetadata=e,t}static updateNotebookMetadata(i){let e=new $L(new vj(0,0),[]);return e.newNotebookMetadata=i,e}constructor(i,e){this.range=i,this.newCells=e}};$L=I([cr],$L);var F3e=class a{constructor(i,e){this.data=i;this.mime=e;let t=RYt(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=Zn.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)}},W3e=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=RYt(r.mime);if(!t.has(s)||oL(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=_t(),this.metadata=e??t)}};var bj=class extends Kc{static isSelection(i){return i instanceof bj?!0:!i||typeof i!="object"?!1:Kc.isRange(i)&&sc.isPosition(i.anchor)&&sc.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 sc(i,e),r=new sc(t,o)):sc.isPosition(i)&&sc.isPosition(e)&&(n=sc.of(i),r=sc.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 DUo(this)}};bj=I([cr],bj);function DUo(a){let i=Kci(a);return a.isEmpty||(a.active.isEqual(a.start)?i=`|${i}`:i=`${i}|`),i}var TE=class{constructor(i){this._tabstop=1;this.value=i||""}static isSnippetString(i){return i instanceof TE?!0:!i||typeof i!="object"?!1:typeof i.value=="string"}static _escape(i){return i.replace(/\$|}|\\/g,"\\$&")}appendText(i){return this.value+=TE._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 TE;t._tabstop=this._tabstop,i(t),this._tabstop=t._tabstop,i=t.value}else i=TE._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 TE;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}};TE=I([cr],TE);var ece=class a{static isSnippetTextEdit(i){return i instanceof a?!0:i?Kc.isRange(i.range)&&TE.isSnippetString(i.snippet):!1}static replace(i,e){return new a(i,e)}static insert(i,e){return a.replace(new Kc(i,i),e)}constructor(i,e){this.range=i,this.snippet=e}};var lkt=(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))(lkt||{});var Sj=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 y_?this.location=o:t instanceof Kc&&(this.location=new y_(o,t)),Sj.validate(this)}toJSON(){return{name:this.name,kind:lkt[this.kind],location:this.location,containerName:this.containerName}}};Sj=I([cr],Sj);var Hx=class{static isTextEdit(i){return i instanceof Hx?!0:!i||typeof i!="object"?!1:Kc.isRange(i)&&typeof i.newText=="string"}static replace(i,e){return new Hx(i,e)}static insert(i,e){return Hx.replace(new Kc(i,i),e)}static delete(i){return Hx.replace(i,"")}static setEndOfLine(i){let e=new Hx(new Kc(new sc(0,0),new sc(0,0)),"");return e.newEol=i,e}get range(){return this._range}set range(i){if(i&&!Kc.isRange(i))throw Br("range");this._range=i}get newText(){return this._newText||""}set newText(i){if(i&&typeof i!="string")throw Br("newText");this._newText=i}get newEol(){return this._newEol}set newEol(i){if(i&&typeof i!="number")throw Br("newEol");this._newEol=i}constructor(i,e){this._range=i,this._newText=e}toJSON(){return{range:this.range,newText:this.newText,newEol:this._newEol}}};Hx=I([cr],Hx);var Ij=ae("notebookDocumentService"),Gci=["W","X","Y","Z","a","b","c","d","e","f"],LUo=new RegExp(`^[${Gci.join("")}]+`),p9i=7;function dxe(a){if(a.scheme!==Y.vscodeNotebookCell)return;let i=a.fragment.indexOf("s");if(i<0)return;let e=parseInt(a.fragment.substring(0,i).replace(LUo,""),p9i),t=Sl(a.fragment.substring(i+1)).toString();if(!isNaN(e))return{handle:e,notebook:a.with({scheme:t,fragment:null})}}function m9i(a,i){let e=i.toString(p9i),o=`${e.length<Gci.length?Gci[e.length-1]:"z"}${e}s${Qd(Je.fromString(a.scheme),!0,!0)}`;return a.with({scheme:Y.vscodeNotebookCell,fragment:o})}function h9i(a){if(a.scheme!==Y.vscodeNotebookMetadata)return;let i=Sl(a.fragment).toString();return a.with({scheme:i,fragment:null})}function g9i(a){let i=`${Qd(Je.fromString(a.scheme),!0,!0)}`;return a.with({scheme:Y.vscodeNotebookMetadata,fragment:i})}function V3e(a){if(a.scheme!==Y.vscodeNotebookCellOutput)return;let i=new URLSearchParams(a.query),e=i.get("openIn");if(!e)return;let t=i.get("outputId")??void 0,o=dxe(a.with({scheme:Y.vscodeNotebookCell,query:null})),n=i.get("outputIndex")?parseInt(i.get("outputIndex")||"",10):void 0,r=o?o.notebook:a.with({scheme:i.get("notebookScheme")||Y.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 $ci=class{constructor(){this._documents=new vt}getNotebook(i){if(i.scheme===Y.vscodeNotebookCell){let e=dxe(i);if(e){let t=this._documents.get(e.notebook);if(t)return t}}if(i.scheme===Y.vscodeNotebookCellOutput){let e=V3e(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)}};we(Ij,$ci,1);var qL="workbench.editor.notebook",lY="workbench.editor.notebookTextDiffEditor",f9i="workbench.editor.notebookMultiTextDiffEditor",cY="workbench.editor.interactive",uxe="workbench.editor.repl",v9i="workbench.editor.notebookOutputEditor";var jci=["application/json","application/javascript","text/html","image/svg+xml",Zn.latex,Zn.markdown,"image/png","image/jpeg",Zn.text],b9i=[Zn.latex,Zn.markdown,"application/json","text/html","image/svg+xml","image/png","image/jpeg",Zn.text],S9i=new Map([["ms-toolsai.jupyter",new Set(["jupyter-notebook","interactive"])],["ms-toolsai.jupyter-renderers",new Set(["jupyter-notebook","interactive"])]]),az="_notAvailable";var B3e;(t=>{t.scheme=Y.vscodeNotebookMetadata;function i(o){return g9i(o)}t.generate=i;function e(o){return h9i(o)}t.parse=e})(B3e||={});var Zo;(c=>{c.scheme=Y.vscodeNotebookCell;function i(u,p){return m9i(u,p)}c.generate=i;function e(u){return dxe(u)}c.parse=e;function t(u,p){return u.with({scheme:Y.vscodeNotebookCellOutput,query:new URLSearchParams({openIn:"editor",outputId:p??"",notebookScheme:u.scheme!==Y.file?u.scheme:""}).toString()})}c.generateCellOutputUriWithId=t;function o(u,p,h){return u.with({scheme:Y.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:Y.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 V3e(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 ckt=a=>ri?a.replace(/\//g,"\\"):a,ukt=class{constructor(i=[],e=jci){this.defaultOrder=e;this.order=[...new Set(i)].map(t=>({pattern:t,matches:zm(ckt(t),{ignoreCase:!0})}))}sort(i){let e=new Map(ht.map(i,o=>[o,ckt(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:zm(ckt(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=ckt(i);for(let o=0;o<e;o++)if(this.order[o].matches(t))return o;return-1}};function H3e(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 tce=new Q("notebookEditorCursorAtBoundary","none"),ice=new Q("notebookEditorCursorAtLineBoundary","none");function pkt(a){let i=a;return!!((typeof i.include=="string"||eP(i.include))&&(typeof i.exclude=="string"||eP(i.exclude)))}var ft={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 _O=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]}}}},RUo=new TextDecoder;function I9i(a){let i=[],e=!1;for(let r of a)(i.length===0||e)&&(i.push(r),e=!0);let t=PUo(i),o=Je.concat(i.map(r=>Je.wrap(r))),n=WUo(o);return t=t||n.byteLength!==o.byteLength,{data:n,didCompression:t}}var dkt="\x1B[A",qci=dkt.split("").map(a=>a.charCodeAt(0)),MUo=10;function PUo(a){let i=!1;return a.forEach((e,t)=>{if(t===0||e.length<dkt.length)return;let o=a[t-1],n=e.subarray(0,dkt.length);if(n[0]===qci[0]&&n[1]===qci[1]&&n[2]===qci[2]){let r=o.lastIndexOf(MUo);if(r===-1)return;i=!0,a[t-1]=o.subarray(0,r),a[t]=e.subarray(dkt.length)}}),i}function AUo(a){let i=a;do a=i,i=a.replace(/[^\n]\x08/gm,"");while(i.length<a.length);return a}function NUo(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 OUo=8,FUo=13;function WUo(a){return!a.buffer.includes(OUo)&&!a.buffer.includes(FUo)?a:Je.fromString(NUo(AUo(RUo.decode(a.buffer))))}var dY=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 Hx(e,t),metadata:o})}insert(i,e,t,o){this.replace(i,new Kc(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,$L.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):ece.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}}ZG(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 vt;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()}};dY=I([cr],dY);var sce,uY=class{constructor(i){Yve(this,sce);j2e(this,sce,i)}static from(...i){let e=i;return new uY(function(){if(e){for(let t of e)t&&typeof t.dispose=="function"&&t.dispose();e=void 0}})}dispose(){typeof pf(this,sce)=="function"&&(pf(this,sce).call(this),j2e(this,sce,void 0))}};sce=new WeakMap,uY=I([cr],uY);var z3e=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}};z3e=I([cr],z3e);var pxe=class extends z3e{constructor(i,e,t,o){super(i,e),this.canIncreaseVerbosity=t,this.canDecreaseVerbosity=o}};pxe=I([cr],pxe);var w9i=(t=>(t[t.Text=0]="Text",t[t.Read=1]="Read",t[t.Write=2]="Write",t))(w9i||{}),mxe=class{constructor(i,e=0){this.range=i,this.kind=e}toJSON(){return{range:this.range,kind:w9i[this.kind]}}};mxe=I([cr],mxe);var hxe=class{constructor(i,e){this.uri=i,this.highlights=e}toJSON(){return{uri:this.uri,highlights:this.highlights.map(i=>i.toJSON())}}};hxe=I([cr],hxe);var wj=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(wj.validate)}constructor(i,e,t,o,n){this.name=i,this.detail=e,this.kind=t,this.range=o,this.selectionRange=n,this.children=[],wj.validate(this)}};wj=I([cr],wj);var mkt=class{constructor(i,e){this.title=i,this.kind=e}};mkt=I([cr],mkt);var gxe=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")}};gxe=I([cr],gxe);var Nkt=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}},Okt=class{constructor(i,e){this.fromRanges=e,this.from=i}},Fkt=class{constructor(i,e){this.fromRanges=e,this.to=i}};var hkt=class{constructor(i,e){this.range=i,this.command=e}get isResolved(){return!!this.command}};hkt=I([cr],hkt);var gkt=class{constructor(i,e){this.label=i,this.documentation=e}};gkt=I([cr],gkt);var fkt=class{constructor(i,e){this.label=i,this.documentation=e,this.parameters=[]}};fkt=I([cr],fkt);var vkt=class{constructor(){this.activeSignature=0;this.activeParameter=0;this.signatures=[]}};vkt=I([cr],vkt);var fxe=class{constructor(i){this.value=i}};fxe=I([cr],fxe);var vxe=class{constructor(i,e,t){this.position=i,this.label=e,this.kind=t}};vxe=I([cr],vxe);var Yci=($=>($[$.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",$))(Yci||{});var bxe=class{constructor(i,e){this.label=i,this.kind=e}toJSON(){return{label:this.label,kind:this.kind&&Yci[this.kind],detail:this.detail,documentation:this.documentation,sortText:this.sortText,filterText:this.filterText,preselect:this.preselect,insertText:this.insertText,textEdit:this.textEdit}}};bxe=I([cr],bxe);var bkt=class{constructor(i=[],e=!1){this.items=i,this.isIncomplete=e}};bkt=I([cr],bkt);var Skt=class{constructor(i,e,t){this.insertText=i,this.range=e,this.command=t}};Skt=I([cr],Skt);var Ikt=class{constructor(i){this.commands=void 0;this.suppressSuggestions=void 0;this.items=i}};Ikt=I([cr],Ikt);function C9i(a,i){return`${Ei.toKey(a)}.${i}`}var Xci=(t=>(t[t.Keyboard=1]="Keyboard",t[t.Mouse=2]="Mouse",t[t.Command=3]="Command",t))(Xci||{});(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})(Xci||={});var Jci=(o=>(o[o.Other=0]="Other",o[o.Comment=1]="Comment",o[o.String=2]="String",o[o.RegEx=3]="RegEx",o))(Jci||{});(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})(Jci||={});var Sxe=class{constructor(i,e){if(e&&!A.isUri(e))throw Br("target");if(!Kc.isRange(i)||i.isEmpty)throw Br("range");this.range=i,this.target=e}};Sxe=I([cr],Sxe);var oce=class{constructor(i,e,t,o){this.red=i,this.green=e,this.blue=t,this.alpha=o}};oce=I([cr],oce);var ykt=class{constructor(i,e){if(e&&!(e instanceof oce))throw Br("color");if(!Kc.isRange(i)||i.isEmpty)throw Br("range");this.range=i,this.color=e}};ykt=I([cr],ykt);var Ixe=class{constructor(i){if(!i||typeof i!="string")throw Br("label");this.label=i}};Ixe=I([cr],Ixe);var Ux=class{constructor(i,e){this.label=e;if(typeof i!="string")throw Br("name");if(typeof e!="string")throw Br("name");this._id=i}static from(i){switch(i){case"clean":return Ux.Clean;case"build":return Ux.Build;case"rebuild":return Ux.Rebuild;case"test":return Ux.Test;default:return}}get id(){return this._id}};Ux.Clean=new Ux("clean","Clean"),Ux.Build=new Ux("build","Build"),Ux.Rebuild=new Ux("rebuild","Rebuild"),Ux.Test=new Ux("test","Test"),Ux=I([cr],Ux);function x9i(a){let i="";for(let e=0;e<a.length;e++)i+=a[e].replace(/,/g,",,")+",";return i}var K3e=class{constructor(i,e,t){if(typeof i!="string")throw Br("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 Br("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 x9i(i)}};K3e=I([cr],K3e);var G3e=class{constructor(i,e,t){this._args=[];if(Array.isArray(e)){if(!i)throw Br("command can't be undefined or null");if(typeof i!="string"&&typeof i.value!="string")throw Br("command");this._command=i,e&&(this._args=e),this._options=t}else{if(typeof i!="string")throw Br("commandLine");this._commandLine=i,this._options=e}}get commandLine(){return this._commandLine}set commandLine(i){if(typeof i!="string")throw Br("commandLine");this._commandLine=i}get command(){return this._command?this._command:""}set command(i){if(typeof i!="string"&&typeof i.value!="string")throw Br("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 x9i(i)}};G3e=I([cr],G3e);var Qci=class{constructor(i){this._callback=i}computeId(){return"customExecution"+_t()}set callback(i){this._callback=i}get callback(){return this._callback}},zx=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 K3e?this._definition={type:zx.ProcessType,id:this._execution.computeId()}:this._execution instanceof G3e?this._definition={type:zx.ShellType,id:this._execution.computeId()}:this._execution instanceof Qci?this._definition={type:zx.ExtensionCallbackType,id:this._execution.computeId()}:this._definition={type:zx.EmptyType,id:_t()}}get definition(){return this._definition}set definition(i){if(i==null)throw Br("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 Br("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;(zx.EmptyType===e||zx.ProcessType===e||zx.ShellType===e||zx.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 Br("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}};zx.ExtensionCallbackType="customExecution",zx.ProcessType="process",zx.ShellType="shell",zx.EmptyType="$empty",zx=I([cr],zx);var KUo;(i=>{function a(e){let t=e;return Xo(t.value)?t.tooltip&&!Ae(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})(KUo||={});var yxe=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=Xo(t.checkboxState)?t.checkboxState:yi(t.checkboxState)&&Xo(t.checkboxState.state)?t.checkboxState.state:void 0,n=!Xo(t.checkboxState)&&yi(t.checkboxState)?t.checkboxState.tooltip:void 0;if(o===void 0||o!==1&&o!==0||n!==void 0&&!Ae(n))return console.log("INVALID tree item, invalid checkboxState",t.checkboxState),!1}if(i instanceof yxe)return!0;if(t.label!==void 0&&!Ae(t.label)&&!t.label?.label)return console.log("INVALID tree item, invalid label",t.label),!1;if(t.id!==void 0&&!Ae(t.id))return console.log("INVALID tree item, invalid id",t.id),!1;if(t.iconPath!==void 0&&!Ae(t.iconPath)&&!A.isUri(t.iconPath)&&(!t.iconPath||!Ae(t.iconPath.id))){let o=t.iconPath;if(!o||!Ae(o.light)&&!A.isUri(o.light)&&!Ae(o.dark)&&!A.isUri(o.dark))return console.log("INVALID tree item, invalid iconPath",t.iconPath),!1}return t.description!==void 0&&!Ae(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&&!Ae(t.tooltip)&&!(t.tooltip instanceof EE)?(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&&!Ae(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}};yxe=I([cr],yxe);var $3e=class{constructor(i){this.value=i}async asString(){return typeof this.value=="string"?this.value:JSON.stringify(this.value)}asFile(){}};$3e=I([cr],$3e);var _xe=class extends $3e{},Wkt=class extends _xe{$b;constructor(i){super(""),this.$b=i}asFile(){return this.$b}},Vkt=class{constructor(i,e,t,o){this.name=i,this.uri=e,this._itemId=t,this._getData=o}data(){return this._getData()}},yj,ace,q3e,wxe=class{constructor(i){Yve(this,ace);Yve(this,yj,new Map);for(let[e,t]of i??[]){let o=pf(this,yj).get(Q2e(this,ace,q3e).call(this,e));o?o.push(t):pf(this,yj).set(Q2e(this,ace,q3e).call(this,e),[t])}}get(i){return pf(this,yj).get(Q2e(this,ace,q3e).call(this,i))?.[0]}set(i,e){pf(this,yj).set(Q2e(this,ace,q3e).call(this,i),[e])}forEach(i,e){for(let[t,o]of pf(this,yj))for(let n of o)i.call(e,n,t,this)}*[Symbol.iterator](){for(let[i,e]of pf(this,yj))for(let t of e)yield[i,t]}};yj=new WeakMap,ace=new WeakSet,q3e=function(i){return i.toLowerCase()},wxe=I([cr],wxe);var wkt=class{constructor(i,e,t){this.insertText=i,this.title=e,this.kind=t}};wkt=I([cr],wkt);var hY=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)}};hY.Empty=new hY("");hY.Text=new hY("text");hY.TextUpdateImports=hY.Text.append("updateImports");var Cj=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}};Cj=I([cr],Cj);Cj.File=new Cj("file");Cj.Folder=new Cj("folder");var Ckt=class{constructor(i){this.id=i}};Ckt=I([cr],Ckt);var pY=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 Br("base");if(typeof e!="string")throw Br("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()}}};pY=I([cr],pY);var GUo=new WeakMap;var nce=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=GUo.get(this)??_t()),this._id}};nce=I([cr],nce);var xkt=class extends nce{constructor(i,e,t,o,n,r){if(super(e,t,o,n,r),i===null)throw Br("location");this.location=i}};xkt=I([cr],xkt);var kkt=class extends nce{constructor(i,e,t,o,n,r){super(e,t,o,n,r),this.functionName=i}};kkt=I([cr],kkt);var Ekt=class extends nce{constructor(i,e,t,o,n,r,s,l){if(super(o,n,r,s,l),!e)throw Br("dataId");this.label=i,this.dataId=e,this.canPersist=t}};Ekt=I([cr],Ekt);var Tkt=class{constructor(i,e,t){this.command=i,this.args=e||[],this.options=t}};Tkt=I([cr],Tkt);var _kt=class{constructor(i,e){this.port=i,this.host=e}};_kt=I([cr],_kt);var Dkt=class{constructor(i){this.path=i}};Dkt=I([cr],Dkt);var Lkt=class{constructor(i){this.implementation=i}};Lkt=I([cr],Lkt);var Cxe=class{constructor(i,e){this.range=i,this.expression=e}};Cxe=I([cr],Cxe);var xxe=class{constructor(i,e){this.range=i,this.text=e}};xxe=I([cr],xxe);var kxe=class{constructor(i,e,t=!0){this.range=i,this.variableName=e,this.caseSensitiveLookup=t}};kxe=I([cr],kxe);var Exe=class{constructor(i,e){this.range=i,this.expression=e}};Exe=I([cr],Exe);var Txe=class{constructor(i,e){this.frameId=i,this.stoppedLocation=e}};Txe=I([cr],Txe);var cC=class extends Error{static FileExists(i){return new cC(i,"EntryExists",cC.FileExists)}static FileNotFound(i){return new cC(i,"EntryNotFound",cC.FileNotFound)}static FileNotADirectory(i){return new cC(i,"EntryNotADirectory",cC.FileNotADirectory)}static FileIsADirectory(i){return new cC(i,"EntryIsADirectory",cC.FileIsADirectory)}static NoPermissions(i){return new cC(i,"NoPermissions",cC.NoPermissions)}static Unavailable(i){return new cC(i,"Unavailable",cC.Unavailable)}constructor(i,e="Unknown",t){super(A.isUri(i)?i.toString(!0):i),this.code=t?.name??"Unknown",gJt(this,e),Object.setPrototypeOf(this,cC.prototype),typeof Error.captureStackTrace=="function"&&typeof t=="function"&&Error.captureStackTrace(this,t)}};cC=I([cr],cC);var Rkt=class{constructor(i,e,t){this.start=i,this.end=e,this.kind=t}};Rkt=I([cr],Rkt);var U3e=class{constructor(){}};U3e.Back={iconPath:new Cj("arrow-left")},U3e=I([cr],U3e);var Mkt=class{constructor(i){this.kind=i}};Mkt=I([cr],Mkt);var Bkt=class{constructor(i,e=[]){this.uri=i;this.provides=Yl(e)}};var Pkt=class{constructor(i,e){this.label=i;this.timestamp=e}};Pkt=I([cr],Pkt);var Akt=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}};Akt=I([cr],Akt);var mY=class{constructor(i){this.message=i}static diff(i,e,t){let o=new mY(i);return o.expectedOutput=e,o.actualOutput=t,o}};mY=I([cr],mY);var rce=class{constructor(i){this.id=i}};rce=I([cr],rce);var j3e=class{constructor(i,e){this.covered=i;this.total=e;p8e(this)}};function p8e(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 Hkt=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 j3e(0,0),o=new j3e(0,0),n=new j3e(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}},Ukt=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}},zkt=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}},Kkt=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 Gkt=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 Q3e=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 EE(i):i}},Y3e=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 EE(i):i,this.vulnerabilities=e}},$kt=class{constructor(i,e,t,o){this.title=i,this.message=e,this.data=t,this.buttons=o}},X3e=class{constructor(i,e){this.value=i,this.baseUri=e}},J3e=class{constructor(i,e,t){this.value=i,this.title=e,this.readOnly=t}};var qkt=class{constructor(i,e,t,o){this.description=i,this.agentName=e,this.prompt=t,this.result=o}};var Z3e=class{constructor(i,e){this.value=i,this.value2=i,this.title=e}},e8e=class{constructor(i){this.value=i}};var t8e=class{constructor(i,e,t){this.value=i,this.id=e,this.metadata=t}},i8e=class{constructor(i,e,t,o){this.hookType=i,this.stopReason=e,this.systemMessage=t,this.metadata=o}},o8e=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 EE(i):i}},n8e=class{constructor(i){this.value=i}},r8e=class{constructor(i,e,t){this.value=i,this.iconPath=e,this.options=t}},s8e=class{constructor(i,e,t){this.value=i,this.isEdit=e,this.undoStopId=t}},jkt=class{constructor(i,e,t){this.value=i,this.license=e,this.snippet=t}},a8e=class{constructor(i,e){this.uri=i;this.range=e}},Qkt=class{constructor(i){this.extensions=i}},Ykt=class{constructor(i,e,t,o,n){this.title=e;this.description=t;this.author=o;this.linkTag=n;oh(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 Xkt=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}},l8e=class{constructor(i,e=!0){this.questions=i,this.allowSkip=e}},c8e=class{constructor(i,e){this.uri=i,e===!0?(this.isDone=!0,this.edits=[]):this.edits=Array.isArray(e)?e:[e]}},Jkt=class{constructor(i,e){this.uri=i,e===!0?(this.isDone=!0,this.edits=[]):this.edits=Array.isArray(e)?e:[e]}},Zkt=class{constructor(i){this.edits=i}};var d8e=class{constructor(i,e,t){this.toolName=i,this.toolCallId=e,this.errorMessage=t}};var eEt=class{constructor(i,e,t){this.mimeType=i,this.data=e,this.reference=t}},tEt=class{constructor(i){this.diagnostics=i}};var lce=class{constructor(i,e,t){this.callId=i,this.content=e,this.isError=t??!1}};var iEt=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 qS(i)]:this._content=i}get content(){return this._content}},oEt=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 qS(i)]:this._content=i}get content(){return this._content}set content2(i){i&&(this.content=i.map(e=>typeof e=="string"?new qS(e):e))}get content2(){return this.content.map(i=>i instanceof qS?i.value:i)}},cce=class{constructor(i,e,t){this.callId=i,this.name=e,this.input=t}};var qS=class{constructor(i,e){this.value=i,e=e}toJSON(){return{$mid:21,value:this.value,audience:this.audience}}},w_=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(Je.fromString(t).buffer,e)}static text(i,e=Zn.text){return new a(Je.fromString(i).buffer,e)}toJSON(){return{$mid:24,mimeType:this.mimeType,data:this.data,audience:this.audience}}};var Dxe=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}}},lz=class{constructor(i){this.value=i}toJSON(){return{$mid:23,value:this.value}}};var nEt=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??""}},u8e=class{constructor(i){this.content=i}toJSON(){return{$mid:20,content:this.content}}};var rEt=class{constructor(i,e){this.id=i;this.label=e}},sEt=class{constructor(i,e,t){this.label=i;this.name=e;this.instructions=t}};var aEt=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}},lEt=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 DO(a){switch(a.type){case"light":return Oe.fromHex("#F3F3F3");case"hcLight":return Oe.fromHex("#FFFFFF");case"hcDark":return Oe.fromHex("#000000");default:return Oe.fromHex("#252526")}}var gEt=J("tab.activeBackground",qo,d(4757,null)),_9i=J("tab.unfocusedActiveBackground",gEt,d(4777,null)),Zci=J("tab.inactiveBackground",{dark:"#2D2D2D",light:"#ECECEC",hcDark:null,hcLight:null},d(4769,null)),D9i=J("tab.unfocusedInactiveBackground",Zci,d(4782,null)),ZW=J("tab.activeForeground",{dark:Oe.white,light:"#333333",hcDark:Oe.white,hcLight:"#292929"},d(4760,null)),E9i=J("tab.inactiveForeground",{dark:ei(ZW,.5),light:ei(ZW,.7),hcDark:Oe.white,hcLight:"#292929"},d(4770,null)),L9i=J("tab.unfocusedActiveForeground",{dark:ei(ZW,.5),light:ei(ZW,.7),hcDark:Oe.white,hcLight:"#292929"},d(4778,null)),_7s=J("tab.unfocusedInactiveForeground",{dark:ei(E9i,.5),light:ei(E9i,.5),hcDark:Oe.white,hcLight:"#292929"},d(4783,null)),dEt=J("tab.hoverBackground",null,d(4766,null)),R9i=J("tab.unfocusedHoverBackground",{dark:ei(dEt,.5),light:ei(dEt,.7),hcDark:null,hcLight:null},d(4779,null)),uEt=J("tab.hoverForeground",null,d(4768,null)),M9i=J("tab.unfocusedHoverForeground",{dark:ei(uEt,.5),light:ei(uEt,.5),hcDark:null,hcLight:null},d(4781,null)),h8e=J("tab.border",{dark:"#252526",light:"#F3F3F3",hcDark:gi,hcLight:gi},d(4764,null)),P9i=J("tab.lastPinnedBorder",{dark:tIe,light:tIe,hcDark:gi,hcLight:gi},d(4672,null)),Lxe=J("tab.activeBorder",null,d(4758,null)),A9i=J("tab.unfocusedActiveBorder",{dark:ei(Lxe,.5),light:ei(Lxe,.7),hcDark:null,hcLight:null},d(4762,null)),m8e=J("tab.activeBorderTop",{dark:null,light:null,hcDark:null,hcLight:"#B5200D"},d(4759,null)),N9i=J("tab.unfocusedActiveBorderTop",{dark:ei(m8e,.5),light:ei(m8e,.7),hcDark:null,hcLight:"#B5200D"},d(4763,null)),O9i=J("tab.selectedBorderTop",m8e,d(4775,null)),D7s=J("tab.selectedBackground",gEt,d(4774,null)),L7s=J("tab.selectedForeground",ZW,d(4776,null)),pEt=J("tab.hoverBorder",null,d(4767,null)),F9i=J("tab.unfocusedHoverBorder",{dark:ei(pEt,.5),light:ei(pEt,.7),hcDark:null,hcLight:gi},d(4780,null)),R7s=J("tab.dragAndDropBorder",{dark:ZW,light:ZW,hcDark:qs,hcLight:qs},d(4765,null)),Rxe=J("tab.activeModifiedBorder",{dark:"#3399CC",light:"#33AAEE",hcDark:null,hcLight:gi},d(4761,null)),mEt=J("tab.inactiveModifiedBorder",{dark:ei(Rxe,.5),light:ei(Rxe,.5),hcDark:Oe.white,hcLight:gi},d(4771,null)),W9i=J("tab.unfocusedActiveModifiedBorder",{dark:ei(Rxe,.5),light:ei(Rxe,.7),hcDark:Oe.white,hcLight:gi},d(4789,null)),V9i=J("tab.unfocusedInactiveModifiedBorder",{dark:ei(mEt,.5),light:ei(mEt,.5),hcDark:Oe.white,hcLight:gi},d(4790,null)),g8e=J("editorPane.background",qo,d(4668,null)),B9i=J("editorGroup.emptyBackground",null,d(4665,null)),M7s=J("editorGroup.focusedEmptyBorder",{dark:null,light:null,hcDark:Ad,hcLight:Ad},d(4666,null)),fEt=J("editorGroupHeader.tabsBackground",{dark:"#252526",light:"#F3F3F3",hcDark:null,hcLight:null},d(4772,null)),H9i=J("editorGroupHeader.tabsBorder",null,d(4773,null)),U9i=J("editorGroupHeader.noTabsBackground",qo,d(4667,null)),z9i=J("editorGroupHeader.border",{dark:null,light:null,hcDark:gi,hcLight:gi},d(4669,null)),vEt=J("editorGroup.border",{dark:"#444444",light:"#E7E7E7",hcDark:gi,hcLight:gi},d(4664,null)),_E=J("editorGroup.dropBackground",{dark:Oe.fromHex("#53595D").transparent(.5),light:Oe.fromHex("#2677CB").transparent(.18),hcDark:null,hcLight:Oe.fromHex("#0F4A85").transparent(.5)},d(4660,null)),K9i=J("editorGroup.dropIntoPromptForeground",dL,d(4663,null)),G9i=J("editorGroup.dropIntoPromptBackground",gm,d(4661,null)),$9i=J("editorGroup.dropIntoPromptBorder",{dark:null,light:null,hcDark:gi,hcLight:gi},d(4662,null)),q9i=J("sideBySideEditor.horizontalBorder",vEt,d(4723,null)),j9i=J("sideBySideEditor.verticalBorder",vEt,d(4724,null)),$Uo=J("outputView.background",null,d(4687,null));J("outputViewStickyScroll.background",$Uo,d(4688,null));var P7s=J("banner.background",{dark:Wy,light:Sp(Wy,.3),hcDark:Wy,hcLight:Wy},d(4648,null)),A7s=J("banner.foreground",QT,d(4649,null)),N7s=J("banner.iconForeground",fm,d(4650,null)),jL=J("statusBar.foreground",{dark:"#FFFFFF",light:"#FFFFFF",hcDark:"#FFFFFF",hcLight:od},d(4732,null)),Q9i=J("statusBar.noFolderForeground",jL,d(4744,null)),bEt=J("statusBar.background",{dark:"#007ACC",light:"#007ACC",hcDark:null,hcLight:null},d(4725,null)),SEt=J("statusBar.noFolderBackground",{dark:"#68217A",light:"#68217A",hcDark:null,hcLight:null},d(4742,null)),dce=J("statusBar.border",{dark:null,light:null,hcDark:gi,hcLight:gi},d(4726,null)),Y9i=J("statusBar.focusBorder",{dark:jL,light:jL,hcDark:null,hcLight:jL},d(4731,null)),X9i=J("statusBar.noFolderBorder",dce,d(4743,null)),O7s=J("statusBarItem.activeBackground",{dark:Oe.white.transparent(.18),light:Oe.white.transparent(.18),hcDark:Oe.white.transparent(.18),hcLight:Oe.black.transparent(.18)},d(4733,null)),J9i=J("statusBarItem.focusBorder",{dark:jL,light:jL,hcDark:null,hcLight:qs},d(4735,null)),JW=J("statusBarItem.hoverBackground",{dark:Oe.white.transparent(.12),light:Oe.black.transparent(.12),hcDark:Oe.black,hcLight:Oe.white},d(4736,null)),f8e=J("statusBarItem.hoverForeground",jL,d(4737,null)),Z9i=J("statusBarItem.compactHoverBackground",{dark:Oe.white.transparent(.12),light:Oe.black.transparent(.12),hcDark:Oe.black,hcLight:Oe.white},d(4734,null)),F7s=J("statusBarItem.prominentForeground",jL,d(4748,null)),W7s=J("statusBarItem.prominentBackground",Oe.black.transparent(.5),d(4747,null)),V7s=J("statusBarItem.prominentHoverForeground",f8e,d(4750,null)),B7s=J("statusBarItem.prominentHoverBackground",JW,d(4749,null)),edi=J("statusBarItem.errorBackground",{dark:Sp(Rse,.4),light:Sp(Rse,.4),hcDark:null,hcLight:"#B5200D"},d(4727,null)),H7s=J("statusBarItem.errorForeground",Oe.white,d(4728,null)),U7s=J("statusBarItem.errorHoverForeground",f8e,d(4730,null)),z7s=J("statusBarItem.errorHoverBackground",JW,d(4729,null)),e7i=J("statusBarItem.warningBackground",{dark:Sp(Bh,.4),light:Sp(Bh,.4),hcDark:null,hcLight:"#895503"},d(4753,null)),K7s=J("statusBarItem.warningForeground",Oe.white,d(4754,null)),G7s=J("statusBarItem.warningHoverForeground",f8e,d(4756,null)),$7s=J("statusBarItem.warningHoverBackground",JW,d(4755,null)),t7i=J("activityBar.background",{dark:"#333333",light:"#2C2C2C",hcDark:"#000000",hcLight:"#FFFFFF"},d(4635,null)),fY=J("activityBar.foreground",{dark:Oe.white,light:Oe.white,hcDark:Oe.white,hcLight:od},d(4640,null)),q7s=J("activityBar.inactiveForeground",{dark:ei(fY,.4),light:ei(fY,.4),hcDark:Oe.white,hcLight:od},d(4641,null)),i7i=J("activityBar.border",{dark:null,light:null,hcDark:gi,hcLight:gi},d(4638,null)),j7s=J("activityBar.activeBorder",{dark:fY,light:fY,hcDark:gi,hcLight:gi},d(4633,null)),Q7s=J("activityBar.activeFocusBorder",{dark:null,light:null,hcDark:null,hcLight:"#B5200D"},d(4634,null)),Y7s=J("activityBar.activeBackground",null,d(4632,null)),X7s=J("activityBar.dropBorder",{dark:fY,light:fY,hcDark:null,hcLight:null},d(4639,null)),kj=J("activityBarBadge.background",{dark:"#007ACC",light:"#007ACC",hcDark:"#000000",hcLight:"#0F4A85"},d(4636,null)),Ej=J("activityBarBadge.foreground",Oe.white,d(4637,null)),xj=J("activityBarTop.foreground",{dark:"#E7E7E7",light:"#424242",hcDark:Oe.white,hcLight:od},d(4642,null)),IEt=J("activityBarTop.activeBorder",{dark:xj,light:xj,hcDark:gi,hcLight:"#B5200D"},d(4644,null)),J7s=J("activityBarTop.activeBackground",null,d(4643,null)),yEt=J("activityBarTop.inactiveForeground",{dark:ei(xj,.6),light:ei(xj,.75),hcDark:Oe.white,hcLight:od},d(4647,null)),wEt=J("activityBarTop.dropBorder",xj,d(4646,null)),Z7s=J("activityBarTop.background",null,d(4645,null)),jS=J("panel.background",qo,d(4691,null)),cb=J("panel.border",{dark:Oe.fromHex("#808080").transparent(.35),light:Oe.fromHex("#808080").transparent(.35),hcDark:gi,hcLight:gi},d(4692,null)),o7i=J("panelTitle.border",{dark:null,light:null,hcDark:cb,hcLight:cb},d(4706,null)),eV=J("panelTitle.activeForeground",{dark:"#E7E7E7",light:"#424242",hcDark:Oe.white,hcLight:od},d(4690,null)),Pxe=J("panelTitle.inactiveForeground",{dark:ei(eV,.6),light:ei(eV,.75),hcDark:Oe.white,hcLight:od},d(4694,null)),Axe=J("panelTitle.activeBorder",{dark:eV,light:eV,hcDark:gi,hcLight:"#B5200D"},d(4689,null)),n7i=J("panelTitleBadge.background",kj,d(4704,null)),r7i=J("panelTitleBadge.foreground",Ej,d(4705,null)),eYs=J("panelInput.border",{dark:Vy,light:Oe.fromHex("#ddd"),hcDark:Vy,hcLight:Vy},d(4695,null)),Nxe=J("panel.dropBorder",eV,d(4693,null)),v8e=J("panelSection.dropBackground",_E,d(4697,null)),s7i=J("panelSectionHeader.background",{dark:Oe.fromHex("#808080").transparent(.2),light:Oe.fromHex("#808080").transparent(.2),hcDark:null,hcLight:null},d(4698,null)),a7i=J("panelSectionHeader.foreground",null,d(4700,null)),l7i=J("panelSectionHeader.border",gi,d(4699,null)),CEt=J("panelSection.border",cb,d(4696,null)),c7i=J("panelStickyScroll.background",jS,d(4701,null)),d7i=J("panelStickyScroll.border",null,d(4702,null)),u7i=J("panelStickyScroll.shadow",PU,d(4703,null)),tYs=J("browser.border",h8e,d(4651,null)),iYs=J("profileBadge.background",{dark:"#4D4D4D",light:"#C4C4C4",hcDark:Oe.white,hcLight:Oe.black},d(4707,null)),oYs=J("profileBadge.foreground",{dark:Oe.white,light:"#333333",hcDark:Oe.black,hcLight:Oe.white},d(4708,null)),p7i=J("statusBarItem.remoteBackground",kj,d(4740,null)),qUo=J("statusBarItem.remoteForeground",Ej,d(4741,null)),nYs=J("statusBarItem.remoteHoverForeground",f8e,d(4752,null)),rYs=J("statusBarItem.remoteHoverBackground",{dark:JW,light:JW,hcDark:JW,hcLight:null},d(4751,null)),sYs=J("statusBarItem.offlineBackground","#6c1717",d(4738,null)),aYs=J("statusBarItem.offlineForeground",qUo,d(4739,null)),lYs=J("statusBarItem.offlineHoverForeground",f8e,d(4746,null)),cYs=J("statusBarItem.offlineHoverBackground",{dark:JW,light:JW,hcDark:JW,hcLight:null},d(4745,null)),m7i=J("extensionBadge.remoteBackground",kj,d(4670,null)),h7i=J("extensionBadge.remoteForeground",Ej,d(4671,null)),op=J("sideBar.background",{dark:"#252526",light:"#F3F3F3",hcDark:"#000000",hcLight:"#FFFFFF"},d(4710,null)),nP=J("sideBar.foreground",null,d(4713,null)),hEt=J("sideBar.border",{dark:null,light:null,hcDark:gi,hcLight:gi},d(4711,null)),dYs=J("sideBarTitle.background",op,d(4720,null)),g7i=J("sideBarTitle.foreground",nP,d(4722,null)),Oxe=J("sideBarTitle.border",{dark:null,light:null,hcDark:hEt,hcLight:hEt},d(4721,null)),Tj=J("sideBar.dropBackground",_E,d(4712,null)),f7i=J("sideBarSectionHeader.background",{dark:Oe.fromHex("#808080").transparent(.2),light:Oe.fromHex("#808080").transparent(.2),hcDark:null,hcLight:null},d(4714,null)),v7i=J("sideBarSectionHeader.foreground",nP,d(4716,null)),tdi=J("sideBarSectionHeader.border",gi,d(4715,null)),uYs=J("sideBarActivityBarTop.border",tdi,d(4709,null)),b7i=J("sideBarStickyScroll.background",op,d(4717,null)),S7i=J("sideBarStickyScroll.border",null,d(4718,null)),I7i=J("sideBarStickyScroll.shadow",PU,d(4719,null)),cz=J("titleBar.activeForeground",{dark:"#CCCCCC",light:"#333333",hcDark:"#FFFFFF",hcLight:"#292929"},d(4785,null)),y7i=J("titleBar.inactiveForeground",{dark:ei(cz,.6),light:ei(cz,.6),hcDark:null,hcLight:"#292929"},d(4788,null)),Mxe=J("titleBar.activeBackground",{dark:"#3C3C3C",light:"#DDDDDD",hcDark:"#000000",hcLight:"#FFFFFF"},d(4784,null)),pYs=J("titleBar.inactiveBackground",{dark:ei(Mxe,.6),light:ei(Mxe,.6),hcDark:null,hcLight:null},d(4787,null)),w7i=J("titleBar.border",{dark:null,light:null,hcDark:gi,hcLight:gi},d(4786,null)),jUo=J("menubar.selectionForeground",cz,d(4675,null)),T9i=J("menubar.selectionBackground",{dark:Mse,light:Mse,hcDark:null,hcLight:null},d(4673,null)),mYs=J("menubar.selectionBorder",{dark:null,light:null,hcDark:qs,hcLight:qs},d(4674,null)),hYs=J("commandCenter.foreground",cz,d(4657,null),!1),gYs=J("commandCenter.activeForeground",jUo,d(4654,null),!1),fYs=J("commandCenter.inactiveForeground",y7i,d(4659,null),!1),C7i=J("commandCenter.background",{dark:Oe.white.transparent(.05),hcDark:null,light:Oe.black.transparent(.05),hcLight:null},d(4655,null),!1),vYs=J("commandCenter.activeBackground",{dark:Oe.white.transparent(.08),hcDark:T9i,light:Oe.black.transparent(.08),hcLight:T9i},d(4652,null),!1),bYs=J("commandCenter.border",{dark:ei(cz,.2),hcDark:gi,light:ei(cz,.2),hcLight:gi},d(4656,null),!1),SYs=J("commandCenter.activeBorder",{dark:ei(cz,.3),hcDark:cz,light:ei(cz,.3),hcLight:cz},d(4653,null),!1),IYs=J("commandCenter.inactiveBorder",ei(y7i,.25),d(4658,null),!1),x7i=J("notificationCenter.border",{dark:jT,light:jT,hcDark:gi,hcLight:gi},d(4676,null)),k7i=J("notificationToast.border",{dark:jT,light:jT,hcDark:gi,hcLight:gi},d(4686,null)),yYs=J("notifications.foreground",dL,d(4682,null)),gY=J("notifications.background",gm,d(4679,null)),wYs=J("notificationLink.foreground",WI,d(4684,null)),E7i=J("notificationCenterHeader.foreground",null,d(4678,null)),idi=J("notificationCenterHeader.background",{dark:RS(gY,.3),light:Sp(gY,.05),hcDark:gY,hcLight:gY},d(4677,null)),CYs=J("notifications.border",idi,d(4680,null)),xYs=J("notificationsErrorIcon.foreground",av,d(4681,null)),kYs=J("notificationsWarningIcon.foreground",Bh,d(4685,null)),EYs=J("notificationsInfoIcon.foreground",fm,d(4683,null)),xEt=J("window.activeBorder",{dark:null,light:null,hcDark:gi,hcLight:gi},d(4791,null)),kEt=J("window.inactiveBorder",{dark:null,light:null,hcDark:gi,hcLight:gi},d(4792,null));var EEt=ae("IExtensionStatusBarItemService");var b8e=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=m1(n),typeof r=="string"||Mr(r)){let w=typeof r=="string"?r:r.value;g+=`, ${w}`}let v;switch(c?.id){case edi:case e7i:v=c.id===edi?"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:Ir(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()}};b8e=I([m(0,Tr)],b8e);we(EEt,b8e,1);function YUo(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||uKi(i.accessibilityInformation))}var T7i={type:"object",required:["id","text","alignment","name"],properties:{id:{type:"string",markdownDescription:d(3075,null)},name:{type:"string",description:d(3077,null)},text:{type:"string",description:d(3079,null)},tooltip:{type:"string",description:d(3080,null)},command:{type:"string",description:d(3074,null)},alignment:{type:"string",enum:["left","right"],description:d(3073,null)},priority:{type:"number",description:d(3078,null)},accessibilityInformation:{type:"object",description:d(3070,null),required:["label"],properties:{role:{type:"string",description:d(3072,null)},label:{type:"string",description:d(3071,null)}}}}},XUo={description:d(3081,null),oneOf:[T7i,{type:"array",items:T7i}]},_7i=Tn.registerExtensionPoint({extensionPoint:"statusBarItems",jsonSchema:XUo}),Fxe=class{constructor(i){let e=new P;_7i.setHandler(t=>{e.clear();for(let o of t){if(!Ea(o.description,"contribStatusBarItems")){o.collector.error(`The ${_7i.name} is proposed API`);continue}let{value:n,collector:r}=o;for(let s of ht.wrap(n)){if(!YUo(s)){r.error(d(3076,null));continue}let l=C9i(o.description.identifier,s.id);i.setOrUpdateEntry(l,l,Ei.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)))}}})}};Fxe=I([m(0,EEt)],Fxe);var uce=/^([^.]+\..+)[:=](.+)$/,Su=class{constructor(i,e,t){this._args=i;this.paths=e;this.productService=t}get appRoot(){return wc(gn.asFileUri("").fsPath)}get userHome(){return A.file(this.paths.homeDir)}get userDataPath(){return this.paths.userDataDir}get appSettingsHome(){return A.file(Ld(this.userDataPath,"User"))}get tmpDir(){return A.file(this.paths.tmpDir)}get cacheHome(){return A.file(this.userDataPath)}get stateResource(){return je(this.appSettingsHome,"globalStorage","storage.json")}get userRoamingDataHome(){return this.appSettingsHome.with({scheme:Y.vscodeUserData})}get userDataSyncHome(){return je(this.appSettingsHome,"sync")}get logsHome(){if(!this.args.logsPath){let i=Pmt(new Date).replace(/-|:|\.\d+Z$/g,"");this.args.logsPath=Ld(this.userDataPath,"logs",i)}return A.file(this.args.logsPath)}get sync(){return this.args.sync}get workspaceStorageHome(){return je(this.appSettingsHome,"workspaceStorage")}get localHistoryHome(){return je(this.appSettingsHome,"History")}get keyboardLayoutResource(){return je(this.userRoamingDataHome,"keyboardLayout.json")}get argvResource(){let i=fp.VSCODE_PORTABLE;return i?A.file(Ld(i,"argv.json")):je(this.userHome,this.productService.dataFolderName,"argv.json")}get isExtensionDevelopment(){return!!this.args.extensionDevelopmentPath}get untitledWorkspacesHome(){return A.file(Ld(this.userDataPath,"Workspaces"))}get builtinExtensionsPath(){let i=this.args["builtin-extensions-dir"];return i?iN(i):th(Ld(gn.asFileUri("").fsPath,"..","extensions"))}get extensionsDownloadLocation(){let i=this.args["extensions-download-dir"];return i?A.file(iN(i)):A.file(Ld(this.userDataPath,"CachedExtensionVSIXs"))}get extensionsPath(){let i=this.args["extensions-dir"];if(i)return iN(i);let e=fp.VSCODE_EXTENSIONS;if(e)return e;let t=fp.VSCODE_PORTABLE;return t?Ld(t,"extensions"):je(this.userHome,this.productService.dataFolderName,"extensions").fsPath}get extensionDevelopmentLocationURI(){let i=this.args.extensionDevelopmentPath;if(Array.isArray(i))return i.map(e=>/^[^:/?#]+?:\/\//.test(e)?A.parse(e):A.file(th(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(th(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 JUo(this.args,this.isBuilt)}get debugRenderer(){return!!this.args.debugRenderer}get isBuilt(){return!fp.VSCODE_DEV}get verbose(){return!!this.args.verbose}get logLevel(){return this.args.log?.find(i=>!uce.test(i))}get extensionLogLevel(){let i=[];for(let e of this.args.log||[]){let t=uce.exec(e);t?.[1]&&t[2]&&i.push([t[1],t[2]])}return i.length?i:void 0}get serviceMachineIdResource(){return je(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=fp.VSCODE_PORTABLE;return i?A.file(Ld(i,"policy.json")):je(this.userHome,this.productService.dataFolderName,"policy.json")}}get agentSessionsWorkspace(){return je(this.appSettingsHome,"agent-sessions.code-workspace")}get editSessionId(){return this.args.editSessionId}get exportPolicyData(){return this.args["export-policy-data"]}get continueOn(){return this.args.continueOn}set continueOn(i){this.args.continueOn=i}get args(){return this._args}};I([mi],Su.prototype,"appRoot",1),I([mi],Su.prototype,"userHome",1),I([mi],Su.prototype,"userDataPath",1),I([mi],Su.prototype,"appSettingsHome",1),I([mi],Su.prototype,"tmpDir",1),I([mi],Su.prototype,"cacheHome",1),I([mi],Su.prototype,"stateResource",1),I([mi],Su.prototype,"userRoamingDataHome",1),I([mi],Su.prototype,"userDataSyncHome",1),I([mi],Su.prototype,"sync",1),I([mi],Su.prototype,"workspaceStorageHome",1),I([mi],Su.prototype,"localHistoryHome",1),I([mi],Su.prototype,"keyboardLayoutResource",1),I([mi],Su.prototype,"argvResource",1),I([mi],Su.prototype,"isExtensionDevelopment",1),I([mi],Su.prototype,"untitledWorkspacesHome",1),I([mi],Su.prototype,"builtinExtensionsPath",1),I([mi],Su.prototype,"extensionsDownloadLocation",1),I([mi],Su.prototype,"extensionsPath",1),I([mi],Su.prototype,"extensionDevelopmentLocationURI",1),I([mi],Su.prototype,"extensionDevelopmentKind",1),I([mi],Su.prototype,"extensionTestsLocationURI",1),I([mi],Su.prototype,"debugExtensionHost",1),I([mi],Su.prototype,"logLevel",1),I([mi],Su.prototype,"extensionLogLevel",1),I([mi],Su.prototype,"serviceMachineIdResource",1),I([mi],Su.prototype,"disableTelemetry",1),I([mi],Su.prototype,"disableExperiments",1),I([mi],Su.prototype,"disableWorkspaceTrust",1),I([mi],Su.prototype,"useInMemorySecretStorage",1),I([mi],Su.prototype,"policyFile",1),I([mi],Su.prototype,"agentSessionsWorkspace",1);function JUo(a,i){return ZUo(a["inspect-extensions"],a["inspect-brk-extensions"],5870,i,a.debugId,a.extensionEnvironment)}function ZUo(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 ru=Co,ac=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=>!uce.test(e)):this.options.developmentOptions?.logLevel!==void 0?$w(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=uce.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,$w(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 je(this.windowLogsPath,"window.log")}get userRoamingDataHome(){return A.file("/User").with({scheme:Y.vscodeUserData})}get argvResource(){return je(this.userRoamingDataHome,"argv.json")}get cacheHome(){return je(this.userRoamingDataHome,"caches")}get workspaceStorageHome(){return je(this.userRoamingDataHome,"workspaceStorage")}get localHistoryHome(){return je(this.userRoamingDataHome,"History")}get stateResource(){return je(this.userRoamingDataHome,"State","storage.json")}get userDataSyncHome(){return je(this.userRoamingDataHome,"sync",this.workspaceId)}get sync(){}get keyboardLayoutResource(){return je(this.userRoamingDataHome,"keyboardLayout.json")}get untitledWorkspacesHome(){return je(this.userRoamingDataHome,"Workspaces")}get serviceMachineIdResource(){return je(this.userRoamingDataHome,"machineid")}get extHostLogsPath(){return je(this.logsHome,"exthost")}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 je(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!1}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=w1i(e.path);return[{fileUri:e.with({path:t.path}),options:{selection:cn(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([mi],ac.prototype,"remoteAuthority",1),I([mi],ac.prototype,"expectsResolverExtension",1),I([mi],ac.prototype,"isBuilt",1),I([mi],ac.prototype,"logLevel",1),I([mi],ac.prototype,"windowLogsPath",1),I([mi],ac.prototype,"logFile",1),I([mi],ac.prototype,"userRoamingDataHome",1),I([mi],ac.prototype,"argvResource",1),I([mi],ac.prototype,"cacheHome",1),I([mi],ac.prototype,"workspaceStorageHome",1),I([mi],ac.prototype,"localHistoryHome",1),I([mi],ac.prototype,"stateResource",1),I([mi],ac.prototype,"userDataSyncHome",1),I([mi],ac.prototype,"sync",1),I([mi],ac.prototype,"keyboardLayoutResource",1),I([mi],ac.prototype,"untitledWorkspacesHome",1),I([mi],ac.prototype,"serviceMachineIdResource",1),I([mi],ac.prototype,"extHostLogsPath",1),I([mi],ac.prototype,"debugExtensionHost",1),I([mi],ac.prototype,"isExtensionDevelopment",1),I([mi],ac.prototype,"extensionDevelopmentLocationURI",1),I([mi],ac.prototype,"extensionDevelopmentLocationKind",1),I([mi],ac.prototype,"extensionTestsLocationURI",1),I([mi],ac.prototype,"extensionEnabledProposedApi",1),I([mi],ac.prototype,"debugRenderer",1),I([mi],ac.prototype,"enableSmokeTestDriver",1),I([mi],ac.prototype,"disableExtensions",1),I([mi],ac.prototype,"enableExtensions",1),I([mi],ac.prototype,"webviewExternalEndpoint",1),I([mi],ac.prototype,"extensionTelemetryLogResource",1),I([mi],ac.prototype,"disableTelemetry",1),I([mi],ac.prototype,"disableExperiments",1),I([mi],ac.prototype,"verbose",1),I([mi],ac.prototype,"logExtensionHostCommunication",1),I([mi],ac.prototype,"skipReleaseNotes",1),I([mi],ac.prototype,"skipWelcome",1),I([mi],ac.prototype,"disableWorkspaceTrust",1),I([mi],ac.prototype,"isSessionsWindow",1),I([mi],ac.prototype,"profile",1),I([mi],ac.prototype,"editSessionId",1),I([mi],ac.prototype,"filesToOpenOrCreate",1),I([mi],ac.prototype,"filesToDiff",1),I([mi],ac.prototype,"filesToMerge",1);var Gp=De,L7i="[",R7i="]",S8e="*",M7i=/\[(.+?)\]/g;var D7i=!to.quality,Bd;(l=>(l.COLOR_THEME_DARK=D7i?"Experimental Dark":"Default Dark Modern",l.COLOR_THEME_LIGHT=D7i?"Experimental Light":"Default Light Modern",l.COLOR_THEME_HC_DARK="Default High Contrast",l.COLOR_THEME_HC_LIGHT="Default High Contrast Light",l.COLOR_THEME_DARK_OLD="Default Dark+",l.COLOR_THEME_LIGHT_OLD="Default Light+",l.FILE_ICON_THEME="vs-seti",l.PRODUCT_ICON_THEME="Default"))(Bd||={});var P7i={"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"},A7i={"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"},DE;(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&&Ae(o._extensionId)&&Da(o._extensionIsBuiltin)&&Ae(o._extensionName)&&Ae(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})(DE||={});var odi="workbench.contrib.css.cache",N7i=Tn.registerExtensionPoint({extensionPoint:"css",jsonSchema:{description:d(17264,null),type:"array",items:{type:"object",properties:{path:{description:d(17265,null),type:"string"}},required:["path"]},defaultSnippets:[{body:[{path:"${1:styles.css}"}]}]}}),ndi=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 P;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()}},Wxe=class{constructor(i,e,t,o){this.themeService=t;this.storageService=o;this.disposables=new P;this.stylesheetsByExtension=new Map;this.pendingExtensions=new Map;this.watcher=this.disposables.add(new ndi(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())),N7i.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(!Ea(s.description,"css")){s.collector.error(`The '${N7i.name}' contribution point is proposed API.`);continue}let l=s.value,c=s.collector;if(!l||!Array.isArray(l)){c.error(d(17266,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&&Ei.equals(e.extensionData.extensionId,i))||!!(t.extensionData&&Ei.equals(t.extensionData.extensionId,i))||!!(o.extensionData&&Ei.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(17267,null));continue}let c=je(t,l.path);if(!La(c,t)){n.warn(d(17268,null,c.path,t.path));continue}let u=new P,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 P,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(odi,0);if(i)try{return JSON.parse(i)}catch{return}}cacheExtensionCSS(i,e){let t={extensionId:i,cssLocations:e};this.storageService.store(odi,JSON.stringify(t),0,1)}clearCacheForExtension(i){let e=this.getCachedCSS();e&&Ei.equals(e.extensionId,i)&&this.storageService.remove(odi,0)}createCSSLinkElement(i,e,t){let o=Xpt();return o.rel="stylesheet",o.type="text/css",o.className=`extension-contributed-css ${e}`,o.href=gn.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=gn.uriToBrowserUri(i);o.element.href=n.with({query:`v=${Date.now()}`}).toString(!0)}}dispose(){this.disposables.dispose()}};Wxe=I([m(0,be),m(1,ru),m(2,Gp),m(3,le)],Wxe);var I8e=class a{constructor(i){this._proxyIdentifierBrand=void 0;this.sid=i,this.nid=++a.count}static{this.count=0}},O7i=[];function Yi(a){let i=new I8e(a);return O7i[i.nid]=i,i}function y8e(a){return O7i[a].sid}var qh=class{constructor(i){this.value=i}};var F7i=class a{static{this._n=0}static mixin(i){return i._id=a._n++,i}};var Gi={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")},Zi={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")};function vo(a){return function(i){Bxe.INSTANCE.registerNamedCustomer(a,i)}}function QL(a){Bxe.INSTANCE.registerCustomer(a)}var TEt;(e=>{function a(){return Bxe.INSTANCE.getNamedCustomers()}e.getNamedCustomers=a;function i(){return Bxe.INSTANCE.getCustomers()}e.getCustomers=i})(TEt||={});var Bxe=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 vY(a){return a.tags.find(i=>i.startsWith("lp-"))?.split("lp-")[1]}var _j=ae("languagePackService"),_Et=class extends C{constructor(e){super();this.extensionGalleryService=e}async getAvailableLanguages(){let e=new $e;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=vY(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()===Dr.toLowerCase()&&(r??="",r+=d(2109,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}}};_Et=I([m(0,ta)],_Et);var DEt=class extends C{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()}};DEt=I([vo(Gi.MainThreadLocalization),m(1,be),m(2,_j)],DEt);var rn={EditorPane:"workbench.contributions.editors",EditorFactory:"workbench.contributions.editor.inputFactories"},Ys={id:"default",displayName:d(4628,null),providerDisplayName:d(4625,null)},W7i="workbench.editor.sidebysideEditor",SY="workbench.editors.textDiffEditor",LEt="workbench.editors.binaryResourceDiffEditor";function pce(a){let i=a;return!!i&&typeof i.getSelection=="function"&&!!i.onDidChangeSelection}function REt(a){let i=a;return!!i&&typeof i.getScrollPosition=="function"&&typeof i.setScrollPosition=="function"&&!!i.onDidChangeScroll}function Dj(a,i,e){for(let t of e.visibleEditorPanes)if(t.group.id===i&&a.matches(t.input))return t.getViewState()}function QS(a){if(Ta(a))return!1;let i=a;return A.isUri(i?.resource)}function db(a){if(Ta(a))return!1;let i=a;return i?.original!==void 0&&i.modified!==void 0}function bY(a){if(Ta(a))return!1;let i=a;return!i||i.resources&&!Array.isArray(i.resources)?!1:!!i.resources||!!i.multiDiffSource}function C_(a){if(Ta(a)||db(a))return!1;let i=a;return i?.primary!==void 0&&i.secondary!==void 0}function Hxe(a){if(Ta(a))return!1;let i=a;return i?i.resource===void 0||i.resource.scheme===Y.untitled||i.forceUntitled===!0:!1}function dC(a){if(Ta(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 rdi=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}},ph=new rdi;var w8e=class extends C{};function Ta(a){return a instanceof w8e}function e1o(a){let i=a;return A.isUri(i?.preferredResource)}function ldi(a){let i=a;return Ta(i?.primary)&&Ta(i?.secondary)}function Lj(a){let i=a;return Ta(i?.modified)&&Ta(i?.original)}function Uxe(a,i,e,t,o){return Aj(t,[pi({id:"workbench.action.openLargeFile",label:d(4627,null),run:()=>{let n={...e,limits:{size:Number.MAX_VALUE}};a.openEditor(i,n)}}),pi({id:"workbench.action.configureEditorLargeFileConfirmation",label:d(4626,null),run:()=>o.openUserSettings({query:"workbench.editorLargeFileConfirmation"})})],{forceMessage:!0,forceSeverity:gt.Warning})}function tV(a){return Ta(a?.editor)}function Rj(a){let i=a;return tV(a)&&i?.group!==void 0}function C8e(a){let i=a;return typeof i?.groupId=="number"&&Ta(i.editor)}function mce(a){return typeof a?.groupId=="number"}var sdi=class{getOriginalUri(i,e){if(!i)return;if(dC(i))return no.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(db(i)||bY(i)||C_(i)||dC(i))return;let t=e1o(i)?i.preferredResource:i.resource;return!t||!e?.filterByScheme?t:this.filterUri(t,e.filterByScheme)}getSideEditors(i){return ldi(i)||C_(i)?{primary:i.primary,secondary:i.secondary}:Lj(i)||db(i)?{primary:i.modified,secondary:i.original}:{primary:void 0,secondary:void 0}}getCanonicalUri(i,e){if(!i)return;if(dC(i))return no.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(db(i)||bY(i)||C_(i)||dC(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 zxe(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 no=new sdi;var adi=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 Oi(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)}};oe.add(rn.EditorFactory,new adi);async function V7i(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 Mj(a){let i=a;if(!i)return!1;let e=i;if(e.modified)return Mj(e.modified);let t=i;return!!(t.contributionsState&&t.viewState&&Array.isArray(t.cursorState))}function Pj(a){return A6(a)}function Aj(a,i,e){let t=dU(a,i);return t.forceMessage=e?.forceMessage,t.forceSeverity=e?.forceSeverity,t.allowDialog=e?.allowDialog,t}var un=ae("notebookService"),YL=class{constructor(i,e,t){this.viewType=i;this.serializer=e;this.extensionData=t}};var mh=ae("INotebookModelResolverService");var Us=class extends w8e{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(Ta(e))return this===e;let t=e.options?.override;return this.editorId!==t&&t!==void 0&&this.editorId!==void 0?!1:Xe(this.resource,no.getCanonicalUri(e))}prefersEditorPane(e){return e.at(0)}toUntyped(e){}isDisposed(){return this._store.isDisposed}dispose(){this.isDisposed()||this._onWillDispose.fire(),super.dispose()}};var YS=class extends C{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||!uo(u.expression,c.expression))&&(t=!0,this.mapFolderToParsedExpression.set(l,zm(c.expression)),this.mapFolderToConfiguredExpression.set(l,c)):u&&(t=!0,this.mapFolderToParsedExpression.delete(l),this.mapFolderToConfiguredExpression.delete(l))}let o=new Mn(this.contextService.getWorkspace().folders.map(s=>s.uri));for(let[s]of this.mapFolderToConfiguredExpression)s!==YS.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(YS.NO_FOLDER);n?(!r||!uo(r.expression,n.expression))&&(t=!0,this.mapFolderToParsedExpression.set(YS.NO_FOLDER,zm(n.expression)),this.mapFolderToConfiguredExpression.set(YS.NO_FOLDER,n)):r&&(t=!0,this.mapFolderToParsedExpression.delete(YS.NO_FOLDER),this.mapFolderToConfiguredExpression.delete(YS.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=Xl(s));let l=s,c=y1i(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(YS.NO_FOLDER),r=this.mapFolderToConfiguredExpression.get(YS.NO_FOLDER)),!n)return!1;let s;return o?s=Fc(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===Y.file?e.fsPath:e.path}};YS=I([m(2,Pe),m(3,B)],YS);var x8e=new Q("autoSaveAfterShortDelayContext",!1,!0);var lr=ae("filesConfigurationService"),x_=class extends C{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 il(1e3);this.autoSaveAfterShortDelayOverrides=new vt;this.autoSaveDisabledOverrides=new vt;this.readonlyIncludeMatcher=this._register(new v$(()=>this.createReadonlyMatcher(Jgt)));this.readonlyExcludeMatcher=this._register(new v$(()=>this.createReadonlyMatcher(Zgt)));this.sessionReadonlyOverrides=new vt(e=>this.uriIdentityService.extUri.getComparisonKey(e));this.autoSaveAfterShortDelayContext=x8e.bindTo(e);let u=t.getValue();this.currentGlobalAutoSaveConfiguration=this.computeAutoSaveConfiguration(void 0,u.files),this.currentFilesAssociationConfiguration=u?.files?.associations,this.currentHotExitConfiguration=u?.files?.hotExit||AS.ON_EXIT,this.onFilesConfigurationChange(u,!1),this.registerListeners()}static{this.DEFAULT_AUTO_SAVE_MODE=Gt?cv.AFTER_DELAY:cv.OFF}static{this.DEFAULT_AUTO_SAVE_DELAY=1e3}static{this.READONLY_MESSAGES={providerReadonly:{value:d(17045,null),isTrusted:!0},sessionReadonly:{value:d(17046,null,"workbench.action.files.setActiveEditorWriteableInSession"),isTrusted:!0},configuredReadonly:{value:d(17042,null,`workbench.action.openSettings?${encodeURIComponent('["files.readonly"]')}`,"workbench.action.files.toggleActiveEditorReadonlyInSession"),isTrusted:!0},fileLocked:{value:d(17043,null,"workbench.action.files.setActiveEditorWriteableInSession"),isTrusted:!0},fileReadonly:{value:d(17044,null),isTrusted:!0}}}createReadonlyMatcher(e){let t=this._register(new YS(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&&P$i(o))return o.readOnlyMessage??x_.READONLY_MESSAGES.providerReadonly;let n=this.sessionReadonlyOverrides.get(e);return typeof n=="boolean"?n===!0?x_.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:x_.READONLY_MESSAGES.configuredReadonly:this.configuredReadonlyFromPermissions&&t?.locked?x_.READONLY_MESSAGES.fileLocked:t?.readonly?x_.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;uo(this.currentFilesAssociationConfiguration,o)||(this.currentFilesAssociationConfiguration=o,t&&this._onDidChangeFilesAssociation.fire());let n=e?.files?.hotExit;n===AS.OFF||n===AS.ON_EXIT_AND_WINDOW_CLOSE?this.currentHotExitConfiguration=n:this.currentHotExitConfiguration=AS.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??x_.DEFAULT_AUTO_SAVE_MODE){case cv.AFTER_DELAY:{o="afterDelay",n=typeof t?.autoSaveDelay=="number"&&t.autoSaveDelay>=0?t.autoSaveDelay:x_.DEFAULT_AUTO_SAVE_DELAY,c=n<=x_.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 Us?no.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<=x_.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 C.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 C.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!==AS.OFF}get hotExitConfiguration(){return this.currentHotExitConfiguration}preventSaveConflicts(e,t){return this.configurationService.getValue("files.saveConflictResolution",{resource:e,overrideIdentifier:t})!=="overwriteFileOnDisk"}};x_=I([m(0,X),m(1,B),m(2,Pe),m(3,Co),m(4,dt),m(5,be),m(6,Ns),m(7,Nn)],x_);we(lr,x_,0);var sP=class extends C{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 Hut(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(sP.SETTING_ID_ENABLED)){let t=this.enabled;this.storeEnablementState(),t!==this.enabled&&this.patterns.length>0&&this._onDidChange.fire()}else e.affectsConfiguration(sP.SETTING_ID_PATTERNS)&&(this.cache.clear(),this.storeCustomPatterns(),this._onDidChange.fire())}))}storeEnablementState(){this.enabled=this.configurationService.getValue(sP.SETTING_ID_ENABLED)}storeCustomPatterns(){this.patterns=[];let e=this.configurationService.getValue(sP.SETTING_ID_PATTERNS);for(let t in e){let o=e[t];if(!this._templateRegexValidation.test(o))continue;let n=Xl(t),r=zm(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=Fc(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??c$(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(wc(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}};sP=I([m(0,B),m(1,Pe)],sP);var Sv=ae("ICustomEditorLabelService");we(Sv,sP,1);var IY=class extends Us{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){Xe(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=eft(this.resource),o,n=this.textResourceConfigurationService.inspect(this.resource,null,"workbench.editorLargeFileConfirmation");return e$e(n)&&(o=n.value*ll.MB),{size:o??t}}};IY=I([m(2,ot),m(3,be),m(4,lr),m(5,Nn),m(6,Sv)],IY);var Et=ae("editorGroupsService");function cdi(a){let i=a;return Ta(i?.editor)&&Ta(i?.replacement)}function hce(a){let i=a;return!!i&&typeof i.id=="number"&&Array.isArray(i.editors)}function pC(a){return a.getValue("workbench.editor.openSideBySideDirection")==="down"?1:3}var ee=ae("editorService"),Un=-1,vn=-2,hg=-3,ym=-4;function B7i(a){return typeof a=="number"||hce(a)}var Vt=Co;function gce(a){return a.scheme!==Y.file&&a.scheme!==Y.vscodeRemote}function XL(a){if(a.folders.length)return a.folders.every(i=>gce(i.uri))?a.folders[0].uri:void 0;if(a.configuration&&gce(a.configuration))return a.configuration}function MEt(a){return XL(a)?.scheme}function H7i(a){return XL(a)?.authority}function LO(a){return XL(a)!==void 0}var yo=ae("remoteAgentService"),RO=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 Pi(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 wn=ae("pathService"),yY=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||zo)(),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===Y.file||i.scheme===Y.vscodeRemote?nU(t??Ye(i),e===1):!0}get defaultUriScheme(){return yY.findDefaultUriScheme(this.environmentService,this.contextService)}static findDefaultUriScheme(i,e){if(i.remoteAuthority)return Y.vscodeRemote;let t=MEt(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:Y.file}userHome(i){return i?.preferLocal?this.localUserHome:this.resolveUserHome}get resolvedUserHome(){return this.maybeUnresolvedUserHome}get path(){return this.resolveOS.then(i=>i===1?Ms:Lo)}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:Y.file,authority:e,path:i,query:"",fragment:""})}};yY=I([m(1,yo),m(2,Vt),m(3,Pe)],yY);var ha=class extends IY{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(12147,null,this.getName()):d(12148,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(ha,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 ha.ID}get editorId(){return this.viewType}get capabilities(){let e=0;return this.resource.scheme===Y.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:eP(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 Og(t,o,this.pathService.defaultUriScheme)}async ensureAbsolutePath(e){if(e.scheme!==Y.untitled||Xl(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 YL))throw new Error("CANNOT open file notebook with this provider");let n=await o.serializer.dataToNotebook(Je.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 ha?this.viewType===e.viewType&&Xe(this.resource,e.resource):QS(e)&&e.resource.scheme===Zo.scheme?Xe(this.resource,Zo.parse(e.resource)?.notebook):!1}};ha=I([m(4,un),m(5,mh),m(6,dn),m(7,ot),m(8,be),m(9,lr),m(10,lt),m(11,ee),m(12,Nn),m(13,Sv),m(14,Vt),m(15,wn)],ha);function Nj(a){return!!a&&typeof a=="object"&&Array.isArray(a.editorInputs)&&a.editorInputs.every(i=>i instanceof ha)}function k8e(a){return!!a&&typeof a=="object"&&a.typeId===ha.ID}function ddi(a){return!a||typeof a!="object"?!1:typeof a.start=="number"&&typeof a.end=="number"}function fce(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 Lf(a){return a.reduce((e,t)=>{for(let o=t.start;o<t.end;o++)e.push(o);return e},[])}function MO(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 E8e(a,i){if(a=MO(a),i=MO(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 PEt(a,i){return i.start>=a.start&&i.end<=a.end}var Kxe="notebook.cell.expandCellInput",U7i="notebook.cell.execute",T8e="notebook.cell.detectLanguage",AEt="notebook.cell.changeLanguage",udi="notebook.cell.quitEdit",NEt="notebook.cell.expandCellOutput",pdi="jupyter-notebook",Gxe="ms-toolsai.jupyter",z7i=new Map([[pdi,Gxe]]),OEt=new Map;OEt.set(pdi,new Map);OEt.get(pdi)?.set("python",{extensionIds:["ms-python.python",Gxe],displayName:"Python + Jupyter"});function K7i(a){return!!a&&typeof a.handle=="number"}function qn(a){if(!a)return;if(a.getId()===qL)return a.getControl();if(a.getId()===lY)return a.getControl().inlineNotebookEditor;let i=a.input;if(i&&Nj(i))return a.getControl()?.notebookEditor}function wY(a,i){let e=Lf(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)}),MO(t)}function _8e(a,i){let e=[];return MO(i).forEach(t=>{e.push(...a.getCellsInRange(t))}),e}var Iv=class a extends s7{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)&&yi(e.cellEdit)}static lift(e){return e instanceof a?e:new a(e.resource,e.cellEdit,e.notebookVersionId,e.metadata)}},$xe=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 Iv(c,l.cellEdit,l.notebookVersionId,l.metadata)}else return l})}async apply(){let i=[],e=Pg(this._edits,(t,o)=>Al(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=qn(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}};$xe=I([m(5,ee),m(6,mh)],$xe);var FEt=class{constructor(i,e,t,o){this._bulkEditService=e;this._logService=t;this._uriIdentService=o}dispose(){}$tryApplyWorkspaceEdit(i,e,t){let o=iV(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))}};FEt=I([vo(Gi.MainThreadBulkEdits),m(1,ma),m(2,ne),m(3,dt)],FEt);function iV(a,i,e){if(!a||!a.edits)return a;let t=Xn(a);for(let o of t.edits){if(ja.is(o)&&(o.resource=i.asCanonicalUri(o.resource)),tu.is(o)){if(o.options){let n=o.options?.contents;if(n)if(n.type==="base64")o.options.contents=Promise.resolve(Sl(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(Iv.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 k_(a,i){let e=i==="image/gif";return typeof a=="string"&&(a=mdi(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 mdi(a){let i=a.includes(",")?a.split(",")[1]:a;return t1o(i)?Sl(i).buffer:new TextEncoder().encode(a)}function t1o(a){return/^[A-Za-z0-9+/]*={0,2}$/.test(a)&&(()=>{try{return atob(a),!0}catch{return!1}})()}async function WEt(a,i,e,t){await a.exists(i)||await a.createFolder(i);let n=t.split("/")[1]||"png",r=`image-${Date.now()}.${n}`,s=je(i,r),l=Je.wrap(e);return await a.writeFile(s,l),s}async function VEt(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=i1o(r.name);s&&Date.now()-s>o&&await a.del(r.resource)}catch(s){i.error("Failed to clean up old images",s)}}))}function i1o(a){let i=a.match(/image-(\d+)\./);if(i)return parseInt(i[1],10)}var jxe=ae("languageModelIgnoredFilesService"),BEt=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 _a=ae("requestService"),gdi=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}},HEt=class extends C{constructor(e){super();this.logService=e;this.counter=0}async logAndRequest(e,t){let o=`#${++this.counter}: ${e.url}`;this.logService.trace(`${o} - begin`,e.type,new gdi(e.headers??{}));try{let n=await t();return this.logService.trace(`${o} - end`,e.type,n.res.statusCode,n.res.headers),n}catch(n){throw this.logService.error(`${o} - error`,e.type,Cn(n)),n}}};function aP(a){return a.res.statusCode&&a.res.statusCode>=200&&a.res.statusCode<300||a.res.statusCode===1223}function UEt(a){return!!a.res.statusCode&&a.res.statusCode>=400&&a.res.statusCode<500}function q7i(a){return!!a.res.statusCode&&a.res.statusCode>=500&&a.res.statusCode<600}function zEt(a){return a.res.statusCode===204}async function E_(a){return zEt(a)?null:(await Kv(a.stream)).toString()}async function Kx(a){if(!aP(a))throw new Error("Server returned "+a.res.statusCode);return E_(a)}async function hh(a){if(!aP(a))throw new Error("Server returned "+a.res.statusCode);if(zEt(a))return null;let e=(await Kv(a.stream)).toString();try{return JSON.parse(e)}catch(t){throw t.message+=`:
`+e,t}}function fdi(a,i){j7i(a,i)}var vdi=["http.proxy","http.proxyStrictSSL","http.proxyKerberosServicePrincipal","http.noProxy","http.proxyAuthorization","http.proxySupport","http.systemCertificates","http.systemCertificatesNode","http.experimental.systemCertificatesV2","http.fetchAdditionalSupport","http.experimental.networkInterfaceCheckInterval"],o1o=!1,hdi=[],G7i,$7i;function j7i(a=!0,i=!0){if(G7i===a&&$7i===i)return;G7i=a,$7i=i;let e=oe.as(ii.Configuration),t=hdi;hdi=[{id:"http",order:15,title:d(2263,null),type:"object",scope:2,properties:{"http.useLocalProxyConfiguration":{type:"boolean",default:i,markdownDescription:d(2278,null),restricted:!0}}},{id:"http",order:15,title:d(2263,null),type:"object",scope:1,properties:{"http.electronFetch":{type:"boolean",default:!1,description:d(2261,null),restricted:!0}}},{id:"http",order:15,title:d(2263,null),type:"object",scope:a?1:2,properties:{"http.proxy":{type:"string",pattern:"^(https?|socks|socks4a?|socks5h?)://([^:]*(:[^@]*)?@)?([^:]+|\\[[:0-9a-fA-F]+\\])(:\\d+)?/?$|^$",markdownDescription:d(2266,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.proxyStrictSSL":{type:"boolean",default:!0,markdownDescription:d(2274,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.proxyKerberosServicePrincipal":{type:"string",markdownDescription:d(2268,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.noProxy":{type:"array",items:{type:"string"},markdownDescription:d(2265,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.proxyAuthorization":{type:["null","string"],default:null,markdownDescription:d(2267,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.proxySupport":{type:"string",enum:["off","on","fallback","override"],enumDescriptions:[d(2271,null),d(2272,null),d(2270,null),d(2273,null)],default:"override",markdownDescription:d(2269,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.systemCertificates":{type:"boolean",default:!0,markdownDescription:d(2275,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.systemCertificatesNode":{type:"boolean",tags:["experimental"],default:o1o,markdownDescription:d(2276,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0,experiment:{mode:"auto"}},"http.experimental.systemCertificatesV2":{type:"boolean",tags:["experimental"],default:!1,markdownDescription:d(2277,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.fetchAdditionalSupport":{type:"boolean",default:!0,markdownDescription:d(2262,null,"`#http.useLocalProxyConfiguration#`","`#http.proxySupport#`","`#http.systemCertificates#`"),restricted:!0},"http.experimental.networkInterfaceCheckInterval":{type:"number",default:300,minimum:-1,tags:["experimental"],markdownDescription:d(2264,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0,experiment:{mode:"auto"}}}}],e.updateConfigurations({add:hdi,remove:t})}j7i();var Qxe=ae("encryptionService"),roa=ae("encryptionMainService");function Q7i(a){return a==="kwallet"||a==="kwallet5"||a==="kwallet6"}function Y7i(a){return a==="gnome_any"||a==="gnome_libsecret"||a==="gnome_keyring"}var LE=ae("secretStorageService"),Yxe=class extends C{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 NT;this._type="unknown";this._onDidChangeValueDisposable=this._register(new P);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 RSt)}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}`}};Yxe=I([m(1,le),m(2,Qxe),m(3,ne)],Yxe);var ga=class extends Us{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 ga.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(H.once(H.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(4630,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 Us)return new ga(this.preferredName,this.preferredDescription,e,e,this.editorService);if(!db(e)&&!bY(e)&&!C_(e)&&!dC(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(Ta(o.editor))return{editor:new ga(this.preferredName,this.preferredDescription,o.editor,o.editor,this.editorService),options:{...o.options,viewState:Dj(this,e,this.editorService)}};if(QS(o.editor))return{editor:{label:this.preferredName,description:this.preferredDescription,primary:o.editor,secondary:o.editor,options:{...o.options,viewState:Dj(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&&!db(t)&&!db(o)&&!bY(t)&&!bY(o)&&!C_(t)&&!C_(o)&&!dC(t)&&!dC(o)){let n={label:this.preferredName,description:this.preferredDescription,primary:t,secondary:o};return typeof e?.preserveViewState=="number"&&(n.options={viewState:Dj(this,e.preserveViewState,this.editorService)}),n}}matches(e){return this===e?!0:Lj(e)||db(e)?!1:e instanceof ga?this.primary.matches(e.primary)&&this.secondary.matches(e.secondary):C_(e)?this.primary.matches(e.primary)&&this.secondary.matches(e.secondary):!1}};ga=I([m(4,ee)],ga);var D8e=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 Us&&s instanceof Us)return this.createEditorInput(i,t.name,t.description,s,r)}}getSerializers(i,e){let t=oe.as(rn.EditorFactory);return[t.getEditorSerializer(i),t.getEditorSerializer(e)]}},KEt=class extends D8e{createEditorInput(i,e,t,o,n){return i.createInstance(ga,e,t,o,n)}};var gg=class extends C{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 eS=ae("ILanguageDetectionService"),L8e="languageDetection",X7i="automaticlanguagedetection.likelywrong",J7i="automaticlanguagedetection.stats";var rw=class extends gg{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(rw.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===L8e||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()??Fr))return;let e=await this.languageDetectionService.detectLanguage(this.textEditorModelHandle),t=this.getLanguageId();if(e&&e!==t&&!this.isDisposed()){this.setLanguageIdInternal(e,L8e);let o=this.languageService.getLanguageName(e);this.accessibilityService.alert(d(4631,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===Fr?t.createByFilepathOrFirstLine(e??null,n):t.createById(o)}updateTextEditorModel(e,t,o){this.isResolved()&&(e&&this.modelService.updateModel(this.textEditorModel,e,o),t&&t!==Fr&&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()}};rw=I([m(0,Ct),m(1,kt),m(2,eS),m(3,Bi)],rw);var Xxe=class extends gg{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 Jxe=class extends Xxe{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 Fa=class extends ga{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 Fa.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(4629,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]=wIe([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===LEt):e.find(t=>t.typeId===SY)}async createModel(){let[e,t]=await Promise.all([this.original.resolve(),this.modified.resolve()]);return t instanceof rw&&e instanceof rw?new Jxe(e,t):new Xxe(XYt(e)?e:void 0,XYt(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 Fa?this.modified.matches(e.modified)&&this.original.matches(e.original)&&e.forceOpenAsBinary===this.forceOpenAsBinary:db(e)?this.modified.matches(e.modified)&&this.original.matches(e.original):!1}dispose(){this.cachedModel&&(this.cachedModel.dispose(),this.cachedModel=void 0),super.dispose()}};Fa=I([m(5,ee)],Fa);var GEt=class extends D8e{createEditorInput(i,e,t,o,n){return i.createInstance(Fa,e,t,o,n,void 0)}};var Qa=new Q("workbenchState",void 0,{type:"string",description:d(4623,null)}),mC=new Q("workspaceFolderCount",0,d(4624,null)),PO=new Q("openFolderWorkspaceSupport",!0,!0),T_=new Q("enterMultiRootWorkspaceSupport",!0,!0),xY=new Q("emptyWorkspaceSupport",!0,!0),R8e=new Q("dirtyWorkingCopies",!1,d(4569,null)),ub=new Q("remoteName","",d(4601,null)),JL=new Q("virtualWorkspace","",d(4622,null)),$Et=new Q("temporaryWorkspace",!1,d(4616,null)),$p=new Q("isSessionsWindow",!1,d(4588,null)),qEt=new Q("hasWebFileSystemAccess",!1,!0),Z7i=new Q("embedderIdentifier",void 0,d(4577,null)),jEt=new Q("inAutomation",!1,d(4580,null)),lP=new Q("isFullscreen",!1,d(4586,null)),sw=new Q("isAuxiliaryWindowFocusedContext",!1,d(4583,null)),vce=new Q("isWindowAlwaysOnTop",!1,d(4589,null)),Xc=new Q("isAuxiliaryWindow",!1,d(4582,null)),bce=new Q("activeEditorIsDirty",!1,d(4557,null)),Zxe=new Q("activeEditorIsNotPreview",!1,d(4560,null)),QEt=new Q("activeEditorIsFirstInGroup",!1,d(4558,null)),Sce=new Q("activeEditorIsLastInGroup",!1,d(4559,null)),ZL=new Q("activeEditorIsPinned",!1,d(4561,null)),eYi=new Q("activeEditorIsReadonly",!1,d(4562,null)),eke=new Q("activeCompareEditorCanSwap",!1,d(4548,null)),YEt=new Q("activeEditorCanToggleReadonly",!0,d(4552,null)),XEt=new Q("activeEditorCanRevert",!1,d(4551,null)),oV=new Q("activeEditorCanSplitInGroup",!0),fr=new Q("activeEditor",null,{type:"string",description:d(4549,null)}),AO=new Q("activeEditorAvailableEditorIds","",d(4550,null)),M8e=new Q("textCompareEditorVisible",!1,d(4618,null)),tS=new Q("textCompareEditorActive",!1,d(4617,null)),hC=new Q("sideBySideEditorActive",!1,d(4613,null)),JEt=new Q("groupEditorsCount",0,d(4579,null)),Ice=new Q("activeEditorGroupEmpty",!1,d(4553,null)),tYi=new Q("activeEditorGroupIndex",0,d(4554,null)),iYi=new Q("activeEditorGroupLast",!1,d(4555,null)),ME=new Q("activeEditorGroupLocked",!1,d(4556,null)),iS=new Q("multipleEditorGroups",!1,d(4591,null)),oYi=iS.toNegated(),Oj=new Q("multipleEditorsSelectedInGroup",!1,d(4592,null)),ZEt=new Q("twoEditorsSelectedInGroup",!1,d(4621,null)),eTt=new Q("SelectedEditorsInGroupFileOrUntitledResourceContextKey",!0,d(4610,null)),Fj=new Q("editorPartMultipleEditorGroups",!1,d(4575,null)),Ona=Fj.toNegated(),nV=new Q("editorPartMaximizedEditorGroup",!1,d(4571,null)),rV=new Q("editorPartModal",!1,d(4572,null)),tTt=new Q("editorPartModalMaximized",!1,d(4573,null)),yce=new Q("editorPartModalNavigation",!1,d(4574,null)),wce=new Q("editorIsOpen",!1,d(4570,null)),gC=new Q("inZenMode",!1,d(4581,null)),P8e=new Q("isCenteredLayout",!1,d(4587,null)),Cce=new Q("splitEditorsVertically",!1,d(4614,null)),iTt=new Q("mainEditorAreaVisible",!0,d(4590,null)),dz=new Q("editorTabsVisible",!0,d(4576,null)),cP=new Q("sideBarVisible",!1,d(4612,null)),sV=new Q("sideBarFocus",!1,d(4611,null)),nYi=new Q("activeViewlet","",d(4564,null)),kY=new Q("statusBarFocused",!1,d(4615,null)),EY=new Q("titleBarStyle","custom",d(4619,null)),xce=new Q("titleBarVisible",!1,d(4620,null)),aV=new Q("isCompactTitleBar",!1,d(4584,null)),A8e=new Q("bannerFocused",!1,d(4568,null)),__=new Q("notificationFocus",!0,d(4594,null)),N8e=new Q("notificationCenterVisible",!1,d(4593,null)),lV=new Q("notificationToastsVisible",!1,d(4595,null)),rYi=new Q("activeAuxiliary","",d(4547,null)),sYi=new Q("auxiliaryBarFocus",!1,d(4565,null)),D_=new Q("auxiliaryBarVisible",!1,d(4567,null)),tke=new Q("auxiliaryBarMaximized",!1,d(4566,null)),aYi=new Q("activePanel","",d(4563,null)),kce=new Q("panelFocus",!1,d(4597,null)),TY=new Q("panelPosition","bottom",d(4599,null)),cV=new Q("panelAlignment","center",d(4596,null)),_Y=new Q("panelVisible",!1,d(4600,null)),oTt=new Q("panelMaximized",!1,d(4598,null)),Vl=new Q("focusedView","",d(4578,null));function O8e(a){return`view.${a}.visible`}var RE=class{constructor(i,e,t,o){this._contextKeyService=i;this._fileService=e;this._languageService=t;this._modelService=o;this._schemeKey=RE.Scheme.bindTo(this._contextKeyService),this._filenameKey=RE.Filename.bindTo(this._contextKeyService),this._dirnameKey=RE.Dirname.bindTo(this._contextKeyService),this._pathKey=RE.Path.bindTo(this._contextKeyService),this._langIdKey=RE.LangId.bindTo(this._contextKeyService),this._resourceKey=RE.Resource.bindTo(this._contextKeyService),this._extensionKey=RE.Extension.bindTo(this._contextKeyService),this._hasResource=RE.HasResource.bindTo(this._contextKeyService),this._isFileSystemResource=RE.IsFileSystemResource.bindTo(this._contextKeyService)}static{this.Scheme=new Q("resourceScheme",void 0,{type:"string",description:d(4608,null)})}static{this.Filename=new Q("resourceFilename",void 0,{type:"string",description:d(4605,null)})}static{this.Dirname=new Q("resourceDirname",void 0,{type:"string",description:d(4603,null)})}static{this.Path=new Q("resourcePath",void 0,{type:"string",description:d(4607,null)})}static{this.LangId=new Q("resourceLangId",void 0,{type:"string",description:d(4606,null)})}static{this.Resource=new Q("resource",void 0,{type:"URI",description:d(4602,null)})}static{this.Extension=new Q("resourceExtname",void 0,{type:"string",description:d(4604,null)})}static{this.HasResource=new Q("resourceSet",void 0,{type:"boolean",description:d(4609,null)})}static{this.IsFileSystemResource=new Q("isFileSystemResource",void 0,{type:"boolean",description:d(4585,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,!Xe(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?Ye(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?ms(i):null),this._hasResource.set(!!i),this._isFileSystemResource.set(i?this._fileService.hasProvider(i):!1)}))}uriToPath(i){return i.scheme===Y.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}};RE=I([m(0,X),m(1,be),m(2,kt),m(3,Ct)],RE);var Fo=class extends RE{constructor(e,t,o,n){super(e,t,o,n);this._disposables=new P;this._disposables.add(t.onDidChangeFileSystemProviderRegistrations(()=>{let r=this.get();this._isFileSystemResource.set(!!(r&&t.hasProvider(r)))})),this._disposables.add(n.onModelAdded(r=>{Xe(r.uri,this.get())&&this._setLangId()})),this._disposables.add(n.onModelLanguageChanged(r=>{Xe(r.model.uri,this.get())&&this._setLangId()}))}dispose(){this._disposables.dispose()}};Fo=I([m(0,X),m(1,be),m(2,kt),m(3,Ct)],Fo);var CY=class extends RE{};function nTt(a,i,e){if(!i){a.set("");return}let t=bdi(i,e);a.set(t.join(","))}function bdi(a,i){if(a.resource?.scheme===Y.untitled&&a.editorId!==Ys.id)return[];if(a instanceof Fa){let e=bdi(a.original,i),t=new Set(bdi(a.modified,i));return e.filter(o=>t.has(o))}return a.resource?i.getEditors(a.resource).map(e=>e.id):[]}var dV="__";function Ece(a){return typeof a=="object"&&a!==null&&"wwwAuthenticate"in a&&typeof a.wwwAuthenticate=="string"}var Cs=ae("IAuthenticationService");var DY=ae("IAuthenticationExtensionsService");var xs;(n=>(n.Setup={hidden:new Q("chatSetupHidden",!1,!0),installed:new Q("chatSetupInstalled",!1,!0),disabled:new Q("chatSetupDisabled",!1,!0),untrusted:new Q("chatSetupUntrusted",!1,!0),later:new Q("chatSetupLater",!1,!0),registered:new Q("chatSetupRegistered",!1,!0)},n.Entitlement={signedOut:new Q("chatEntitlementSignedOut",!1,!0),canSignUp:new Q("chatPlanCanSignUp",!1,!0),planFree:new Q("chatPlanFree",!1,!0),planPro:new Q("chatPlanPro",!1,!0),planProPlus:new Q("chatPlanProPlus",!1,!0),planBusiness:new Q("chatPlanBusiness",!1,!0),planEnterprise:new Q("chatPlanEnterprise",!1,!0),organisations:new Q("chatEntitlementOrganisations",void 0,!0),internal:new Q("chatEntitlementInternal",!1,!0),sku:new Q("chatEntitlementSku",void 0,!0)},n.chatQuotaExceeded=new Q("chatQuotaExceeded",!1,!0),n.completionsQuotaExceeded=new Q("completionsQuotaExceeded",!1,!0),n.chatAnonymous=new Q("chatAnonymous",!1,!0)))(xs||={});var vr=ae("chatEntitlementService");function dP(a){return a===6||a===7||a===8||a===9}function sTt(a){switch(a){case 6:return d(16665,null);case 7:return d(16666,null);case 8:return d(16662,null);case 9:return d(16663,null);default:return d(16664,null)}}var rTt={upgradePlanUrl:to.defaultChatAgent?.upgradePlanUrl??"",providerUriSetting:to.defaultChatAgent?.providerUriSetting??"",entitlementSignupLimitedUrl:to.defaultChatAgent?.entitlementSignupLimitedUrl??"",chatQuotaExceededContext:to.defaultChatAgent?.chatQuotaExceededContext??"",completionsQuotaExceededContext:to.defaultChatAgent?.completionsQuotaExceededContext??""},lYi="chat.allowAnonymousAccess";function Sdi(a,i,e){return!(a.getValue(lYi)!==!0||i!==1||e.hidden||e.disabled)}function cYi(a,i,e){e.publicLog2("chatEntitlements",{chatHidden:!!a.hidden,chatDisabled:!!a.disabled,chatEntitlement:a.entitlement,chatRegistered:!!a.registered,chatAnonymous:Sdi(i,a.entitlement,a)})}var F8e=class extends C{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:rTt.chatQuotaExceededContext,completionsQuotaExceeded:rTt.completionsQuotaExceededContext};this._onDidChangeAnonymous=this._register(new E);this.onDidChangeAnonymous=this._onDidChangeAnonymous.event;this.anonymousObs=ui(this.onDidChangeAnonymous,()=>this.anonymous);if(this.chatQuotaExceededContextKey=xs.chatQuotaExceeded.bindTo(this.contextKeyService),this.completionsQuotaExceededContextKey=xs.completionsQuotaExceeded.bindTo(this.contextKeyService),this.anonymousContextKey=xs.chatAnonymous.bindTo(this.contextKeyService),this.anonymousContextKey.set(this.anonymous),this.onDidChangeEntitlement=H.map(H.filter(this.contextKeyService.onDidChangeContext,c=>c.affectsSome(new Set([xs.Entitlement.planPro.key,xs.Entitlement.planBusiness.key,xs.Entitlement.planEnterprise.key,xs.Entitlement.planProPlus.key,xs.Entitlement.planFree.key,xs.Entitlement.canSignUp.key,xs.Entitlement.signedOut.key,xs.Entitlement.organisations.key,xs.Entitlement.internal.key,xs.Entitlement.sku.key])),this._store),()=>{},this._store),this.entitlementObs=ui(this.onDidChangeEntitlement,()=>this.entitlement),this.onDidChangeSentiment=H.map(H.filter(this.contextKeyService.onDidChangeContext,c=>c.affectsSome(new Set([xs.Setup.hidden.key,xs.Setup.disabled.key,xs.Setup.untrusted.key,xs.Setup.installed.key,xs.Setup.later.key,xs.Setup.registered.key])),this._store),()=>{},this._store),this.sentimentObs=ui(this.onDidChangeSentiment,()=>this.sentiment),Gt&&!o.remoteAuthority){xs.Setup.hidden.bindTo(this.contextKeyService).set(!0);return}if(!t.defaultChatAgent)return;let l=this.context=new co(()=>this._register(e.createInstance(uz)));this.requests=new co(()=>this._register(e.createInstance(W8e,l.value,{clearQuotas:()=>this.clearQuotas(),acceptQuotas:c=>this.acceptQuotas(c)}))),this.registerListeners()}get entitlement(){return this.contextKeyService.getContextKeyValue(xs.Entitlement.planPro.key)===!0?6:this.contextKeyService.getContextKeyValue(xs.Entitlement.planBusiness.key)===!0?8:this.contextKeyService.getContextKeyValue(xs.Entitlement.planEnterprise.key)===!0?9:this.contextKeyService.getContextKeyValue(xs.Entitlement.planProPlus.key)===!0?7:this.contextKeyService.getContextKeyValue(xs.Entitlement.planFree.key)===!0?5:this.contextKeyService.getContextKeyValue(xs.Entitlement.canSignUp.key)===!0?3:this.contextKeyService.getContextKeyValue(xs.Entitlement.signedOut.key)===!0?1:2}get isInternal(){return this.contextKeyService.getContextKeyValue(xs.Entitlement.internal.key)===!0}get organisations(){return this.contextKeyService.getContextKeyValue(xs.Entitlement.organisations.key)}get sku(){return this.contextKeyService.getContextKeyValue(xs.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 $e,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&&cYi(this.context.value.state,this.configurationService,this.telemetryService),this._onDidChangeAnonymous.fire())};this._register(this.configurationService.onDidChangeConfiguration(r=>{r.affectsConfiguration(lYi)&&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(xs.Setup.installed.key)===!0,hidden:this.contextKeyService.getContextKeyValue(xs.Setup.hidden.key)===!0,disabled:this.contextKeyService.getContextKeyValue(xs.Setup.disabled.key)===!0,untrusted:this.contextKeyService.getContextKeyValue(xs.Setup.untrusted.key)===!0,later:this.contextKeyService.getContextKeyValue(xs.Setup.later.key)===!0,registered:this.contextKeyService.getContextKeyValue(xs.Setup.registered.key)===!0}}get anonymous(){return Sdi(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)}};F8e=I([m(0,F),m(1,nt),m(2,Vt),m(3,X),m(4,B),m(5,Te)],F8e);var W8e=class extends C{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 $e;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 $e,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"?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){let s;for(let l of n){if(r.isCancellationRequested)return s;try{let c=await this.requestService.request({type:t,url:e,data:t==="POST"?JSON.stringify(o):void 0,disableCache:!0,headers:{Authorization:`Bearer ${l.accessToken}`}},r),u=c.res.statusCode;if(u&&u!==200){s=c;continue}return c}catch(c){r.isCancellationRequested||this.logService.error(`[chat entitlement] request: error ${c}`)}}return s}update(e){this.state=e,this.context.update({entitlement:this.state.entitlement,organisations:this.state.organisations,sku:this.state.sku,copilotTrackingId:this.state.copilotTrackingId}),e.quotas&&this.chatQuotasAccessor.acceptQuotas(e.quotas)}async forceResolveEntitlement(e=ve.None){let 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(rTt.entitlementSignupLimitedUrl,"POST",t,e,ve.None);if(!o)return await this.onUnknownSignUpError(d(16670,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 E_(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(16671,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 E_(o)}catch{}if(!n)return await this.onUnknownSignUpError(d(16669,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(16668,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:gt.Error,message:d(16672,null),detail:e,primaryButton:d(16667,null)});return o}return!1}onUnprocessableSignUpError(e,t){this.logService.error(e),this.lifecycleService.willShutdown||this.dialogService.prompt({type:gt.Error,message:d(16673,null),detail:t,buttons:[{label:d(16661,null),run:()=>{}},{label:d(16660,null),run:()=>this.openerService.open(A.parse(rTt.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,ve.None);return{defaultAccount:t,entitlements:o}}dispose(){this.pendingResolveCts.dispose(!0),super.dispose()}};W8e=I([m(2,Te),m(3,ne),m(4,_a),m(5,ct),m(6,Qe),m(7,ao),m(8,Um),m(9,Cs)],W8e);var uz=class extends C{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=xs.Entitlement.canSignUp.bindTo(e),this.signedOutContextKey=xs.Entitlement.signedOut.bindTo(e),this.freeContextKey=xs.Entitlement.planFree.bindTo(e),this.proContextKey=xs.Entitlement.planPro.bindTo(e),this.proPlusContextKey=xs.Entitlement.planProPlus.bindTo(e),this.businessContextKey=xs.Entitlement.planBusiness.bindTo(e),this.enterpriseContextKey=xs.Entitlement.planEnterprise.bindTo(e),this.organisationsContextKey=xs.Entitlement.organisations.bindTo(e),this.isInternalContextKey=xs.Entitlement.internal.bindTo(e),this.skuContextKey=xs.Entitlement.sku.bindTo(e),this.hiddenContext=xs.Setup.hidden.bindTo(e),this.laterContext=xs.Setup.later.bindTo(e),this.installedContext=xs.Setup.installed.bindTo(e),this.disabledContext=xs.Setup.disabled.bindTo(e),this.untrustedContext=xs.Setup.untrusted.bindTo(e),this.registeredContext=xs.Setup.registered.bindTo(e),this._state=this.storageService.getObject(uz.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(uz.CHAT_DISABLED_CONFIGURATION_KEY)&&this.updateContext()}))}withConfiguration(e){return this.configurationService.getValue(uz.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||dP(this._state.entitlement)?this._state.registered=!0:this._state.entitlement===3&&(this._state.registered=!1)),Sdi(this.configurationService,this._state.entitlement,this._state)&&(this._state.sku="no_auth_limited_copilot"),t!==JSON.stringify(this._state))return this.storageService.store(uz.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.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)}`),cYi(e,this.configurationService,this.telemetryService),this._onDidChange.fire()}suspend(){this.suspendedState={...this._state},this.updateBarrier=new Np}resume(){this.suspendedState=void 0,this.updateBarrier?.open(),this.updateBarrier=void 0}};uz=I([m(0,X),m(1,le),m(2,ne),m(3,B),m(4,Te)],uz);we(vr,F8e,0);var qp="local",aTt="agent";function L_(a){return a===2||a===3}function ike(a){let i=a;return i&&i.uri instanceof A&&typeof i.insertions=="number"&&typeof i.deletions=="number"}var Ls=ae("chatSessionsService");var cc=(t=>(t.Ask="ask",t.Edit="edit",t.Agent="agent",t))(cc||{});function dYi(a){switch(a){case"ask":case"edit":case"agent":return a;default:return}}function pz(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 r1o=new Set([Y.vscodeChatEditor,Y.walkThrough,Y.vscodeLocalChatSession,Y.vscodeSettings,Y.webviewPanel,Y.vscodeUserData,Y.extension,"ccreq","openai-codex"]);function oke(a,i){let e=a.get(Ls);return!(r1o.has(i)||e.getContentProviderSchemes().includes(i))}var V8e="workbench.action.chat.manage",uYi=30;var nke=new Q("inModelsEditor",!1),lTt=new Q("inModelsSearch",!1);var ie;(oo=>{oo.responseVote=new Q("chatSessionResponseVote","",{type:"string",description:d(7582,null)}),oo.responseDetectedAgentCommand=new Q("chatSessionResponseDetectedAgentOrCommand",!1,{type:"boolean",description:d(7562,null)}),oo.responseSupportsIssueReporting=new Q("chatResponseSupportsIssueReporting",!1,{type:"boolean",description:d(7554,null)}),oo.responseIsFiltered=new Q("chatSessionResponseFiltered",!1,{type:"boolean",description:d(7553,null)}),oo.responseHasError=new Q("chatSessionResponseError",!1,{type:"boolean",description:d(7552,null)}),oo.requestInProgress=new Q("chatSessionRequestInProgress",!1,{type:"boolean",description:d(7581,null)}),oo.currentlyEditing=new Q("chatSessionCurrentlyEditing",!1,{type:"boolean",description:d(7579,null)}),oo.currentlyEditingInput=new Q("chatSessionCurrentlyEditingInput",!1,{type:"boolean",description:d(7580,null)});let l;(_r=>(_r.Sent="s",_r.QueueOrSteer="qs"))(l=oo.EditingRequestType||={}),oo.editingRequestType=new Q("chatEditingSentRequest",void 0,{type:"string",description:d(7528,null)}),oo.isResponse=new Q("chatResponse",!1,{type:"boolean",description:d(7551,null)}),oo.isRequest=new Q("chatRequest",!1,{type:"boolean",description:d(7549,null)}),oo.isPendingRequest=new Q("chatRequestIsPending",!1,{type:"boolean",description:d(7550,null)}),oo.itemId=new Q("chatItemId","",{type:"string",description:d(7538,null)}),oo.lastItemId=new Q("chatLastItemId",[],{type:"string",description:d(7539,null)}),oo.editApplied=new Q("chatEditApplied",!1,{type:"boolean",description:d(7522,null)}),oo.inputHasText=new Q("chatInputHasText",!1,{type:"boolean",description:d(7578,null)}),oo.inputHasFocus=new Q("chatInputHasFocus",!1,{type:"boolean",description:d(7577,null)}),oo.inChatInput=new Q("inChatInput",!1,{type:"boolean",description:d(7575,null)}),oo.inChatSession=new Q("inChat",!1,{type:"boolean",description:d(7569,null)}),oo.inChatQuestionCarousel=new Q("inChatQuestionCarousel",!1,{type:"boolean",description:d(7571,null)}),oo.inChatEditor=new Q("inChatEditor",!1,{type:"boolean",description:d(7570,null)}),oo.inChatTodoList=new Q("inChatTodoList",!1,{type:"boolean",description:d(7574,null)}),oo.inChatTip=new Q("inChatTip",!1,{type:"boolean",description:d(7573,null)}),oo.multipleChatTips=new Q("multipleChatTips",!1,{type:"boolean",description:d(7584,null)}),oo.inChatTerminalToolOutput=new Q("inChatTerminalToolOutput",!1,{type:"boolean",description:d(7572,null)}),oo.chatModeKind=new Q("chatAgentKind","ask",{type:"string",description:d(7508,null)}),oo.chatPermissionLevel=new Q("chatPermissionLevel","default",{type:"string",description:d(7547,null)}),oo.chatModeName=new Q("chatModeName","",{type:"string",description:d(7542,null)}),oo.chatModelId=new Q("chatModelId","",{type:"string",description:d(7540,null)}),oo.supported=x.or(ep.negate(),ub.notEqualsTo(""),x.has("config.chat.experimental.serverlessWebEnabled")),oo.enabled=new Q("chatIsEnabled",!1,{type:"boolean",description:d(7536,null)}),oo.lockedToCodingAgent=new Q("lockedToCodingAgent",!1,{type:"boolean",description:d(7583,null)}),oo.chatSessionHasCustomAgentTarget=new Q("chatSessionHasCustomAgentTarget",!1,{type:"boolean",description:d(7556,null)}),oo.chatSessionHasTargetedModels=new Q("chatSessionHasTargetedModels",!1,{type:"boolean",description:d(7559,null)}),oo.agentSupportsAttachments=new Q("agentSupportsAttachments",!1,{type:"boolean",description:d(7519,null)}),oo.withinEditSessionDiff=new Q("withinEditSessionDiff",!1,{type:"boolean",description:d(7586,null)}),oo.filePartOfEditSession=new Q("filePartOfEditSession",!1,{type:"boolean",description:d(7566,null)}),oo.extensionParticipantRegistered=new Q("chatPanelExtensionParticipantRegistered",!1,{type:"boolean",description:d(7544,null)}),oo.panelParticipantRegistered=new Q("chatPanelParticipantRegistered",!1,{type:"boolean",description:d(7546,null)}),oo.chatEditingCanUndo=new Q("chatEditingCanUndo",!1,{type:"boolean",description:d(7524,null)}),oo.chatEditingCanRedo=new Q("chatEditingCanRedo",!1,{type:"boolean",description:d(7523,null)}),oo.languageModelsAreUserSelectable=new Q("chatModelsAreUserSelectable",!1,{type:"boolean",description:d(7541,null)}),oo.chatSessionHasModels=new Q("chatSessionHasModels",!1,{type:"boolean",description:d(7558,null)}),oo.chatSessionOptionsValid=new Q("chatSessionOptionsValid",!0,{type:"boolean",description:d(7561,null)}),oo.extensionInvalid=new Q("chatExtensionInvalid",!1,{type:"boolean",description:d(7529,null)}),oo.inputCursorAtTop=new Q("chatCursorAtTop",!1),oo.inputHasAgent=new Q("chatInputHasAgent",!1),oo.location=new Q("chatLocation",void 0),oo.inQuickChat=new Q("quickChatHasFocus",!1,{type:"boolean",description:d(7576,null)}),oo.inAgentSessionsWelcome=new Q("inAgentSessionsWelcome",!1,{type:"boolean",description:d(7568,null)}),oo.chatSessionType=new Q("chatSessionType","",{type:"string",description:d(7563,null)}),oo.hasFileAttachments=new Q("chatHasFileAttachments",!1,{type:"boolean",description:d(7533,null)}),oo.chatSessionIsEmpty=new Q("chatSessionIsEmpty",!0,{type:"boolean",description:d(7560,null)}),oo.hasPendingRequests=new Q("chatHasPendingRequests",!1,{type:"boolean",description:d(7534,null)}),oo.chatSessionHasDebugData=new Q("chatSessionHasDebugData",!1,{type:"boolean",description:d(7557,null)}),oo.chatSessionHasAttachedDebugData=new Q("chatSessionHasAttachedDebugData",!1,{type:"boolean",description:d(7555,null)}),oo.remoteJobCreating=new Q("chatRemoteJobCreating",!1,{type:"boolean",description:d(7548,null)}),oo.hasRemoteCodingAgent=new Q("hasRemoteCodingAgent",!1,d(7567,null)),oo.hasCanDelegateProviders=new Q("chatHasCanDelegateProviders",!1,{type:"boolean",description:d(7532,null)}),oo.enableRemoteCodingAgentPromptFileOverlay=new Q("enableRemoteCodingAgentPromptFileOverlay",!1,d(7565,null)),oo.skipChatRequestInProgressMessage=new Q("chatSkipRequestInProgressMessage",!1,{type:"boolean",description:d(7564,null)}),oo.Setup=xs.Setup,oo.Entitlement=xs.Entitlement,oo.chatQuotaExceeded=xs.chatQuotaExceeded,oo.completionsQuotaExceeded=xs.completionsQuotaExceeded,oo.Editing={hasToolConfirmation:new Q("chatHasToolConfirmation",!1,{type:"boolean",description:d(7527,null)}),hasElicitationRequest:new Q("chatHasElicitationRequest",!1,{type:"boolean",description:d(7525,null)}),hasQuestionCarousel:new Q("chatHasQuestionCarousel",!1,{type:"boolean",description:d(7526,null)})},oo.Tools={toolsCount:new Q("toolsCount",0,{type:"number",description:d(7585,null)})},oo.foregroundSessionCount=new Q("chatForegroundSessionCount",0,{type:"number",description:d(7530,null)}),oo.Modes={hasCustomChatModes:new Q("chatHasCustomAgents",!1,{type:"boolean",description:d(7531,null)}),agentModeDisabledByPolicy:new Q("chatAgentModeDisabledByPolicy",!1,{type:"boolean",description:d(7520,null)})},oo.panelLocation=new Q("chatPanelLocation",void 0,{type:"number",description:d(7545,null)}),oo.agentSessionsViewerFocused=new Q("agentSessionsViewerFocused",!0,{type:"boolean",description:d(7514,null)}),oo.agentSessionsViewerOrientation=new Q("agentSessionsViewerOrientation",void 0,{type:"number",description:d(7515,null)}),oo.agentSessionsViewerPosition=new Q("agentSessionsViewerPosition",void 0,{type:"number",description:d(7516,null)}),oo.agentSessionsViewerVisible=new Q("agentSessionsViewerVisible",void 0,{type:"boolean",description:d(7517,null)}),oo.agentSessionType=new Q("chatSessionType","",{type:"string",description:d(7518,null)}),oo.agentSessionSection=new Q("agentSessionSection","",{type:"string",description:d(7513,null)}),oo.isArchivedAgentSession=new Q("agentSessionIsArchived",!1,{type:"boolean",description:d(7511,null)}),oo.isReadAgentSession=new Q("agentSessionIsRead",!1,{type:"boolean",description:d(7512,null)}),oo.hasMultipleAgentSessionsSelected=new Q("agentSessionHasMultipleSelected",!1,{type:"boolean",description:d(7510,null)}),oo.hasAgentSessionChanges=new Q("agentSessionHasChanges",!1,{type:"boolean",description:d(7509,null)}),oo.isKatexMathElement=new Q("chatIsKatexMathElement",!1,{type:"boolean",description:d(7537,null)}),oo.hasUsedCreateSlashCommands=new Q("chatHasUsedCreateSlashCommands",!1,{type:"boolean",description:d(7535,null)}),oo.contextUsageHasBeenOpened=new Q("chatContextUsageHasBeenOpened",!1,{type:"boolean",description:d(7521,null)}),oo.newChatButtonExperimentIcon=new Q("chatNewChatButtonExperimentIcon","",{type:"string",description:d(7543,null)})})(ie||={});var Idi;(e=>(e.inEditingMode=x.or(ie.chatModeKind.isEqualTo("edit"),ie.chatModeKind.isEqualTo("agent")),e.chatSetupTriggerContext=x.or(ie.Setup.installed.negate(),ie.Entitlement.canSignUp)))(Idi||={});var Wj=ae("ILanguageModelsConfigurationService");var R_;(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})(R_||={});async function Tce(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 hYi(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 Wr=ae("ILanguageModelsService"),pYi={type:"object",required:["vendor","displayName"],properties:{vendor:{type:"string",description:d(7613,null)},displayName:{type:"string",description:d(7609,null)},configuration:{type:"object",description:d(7607,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(7608,null)}}}},additionalProperties:{$ref:"http://json-schema.org/draft-07/schema#",properties:{secret:{type:"boolean",description:d(7608,null)}}}}}]},managementCommand:{type:"string",description:d(7611,null),deprecated:!0,deprecationMessage:d(7612,null)},when:{type:"string",description:d(7615,null)}}},s1o=Tn.registerExtensionPoint({extensionPoint:"languageModelChatProviders",jsonSchema:{description:d(7606,null),oneOf:[pYi,{type:"array",items:pYi}]},activationEventsGenerator:function*(a){for(let i of a)yield`onLanguageModelChatProvider:${i.vendor}`}}),ydi="chatModelPickerPreferences",mYi="chatModelRecentlyUsed",wdi="chat.participantNameRegistry",Cdi="chat.modelsControl",Vj=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 P;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 NT;this._modelPickerUserPreferences={};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=Le(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,ydi,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(s1o.setHandler((u,{added:p,removed:h})=>{let g=[],f=[];for(let v of p)for(let b of ht.wrap(v.value)){if(this._vendors.has(b.vendor)){v.collector.error(d(7614,null,b.vendor));continue}if(Jl(b.vendor)){v.collector.error(d(7610,null));continue}if(b.vendor.trim()!==b.vendor){v.collector.error(d(7616,null));continue}g.push(b)}for(let v of h)for(let b of ht.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(Jl(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(ydi,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(ydi,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=x.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(R_.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 u=await o.provideLanguageModelChatInfo({silent:e},ve.None);if(u.length){n.push(...u);let p=[];for(let h of u)t.isDefault?h.metadata.isUserSelectable||this._modelPickerUserPreferences[h.identifier]===!0?p.push(h.identifier):this._logService.trace(`[LM] Skipping model ${h.identifier} from model picker as it is not user selectable.`):p.push(h.identifier);r.push({modelIdentifiers:p})}}catch(u){r.push({modelIdentifiers:[],status:{message:Cn(u),severity:gt.Error}})}let s=this._languageModelsConfigurationService.getLanguageModelsProviderGroups();for(let u of s){if(u.vendor!==i)continue;let p=await this._resolveConfiguration(u,t.configuration);try{let h=await o.provideLanguageModelChatInfo({group:u.name,silent:e,configuration:p},ve.None);h.length&&(n.push(...h),r.push({group:u,modelIdentifiers:h.map(g=>g.identifier)}))}catch(h){r.push({group:u,modelIdentifiers:[],status:{message:Cn(h),severity:gt.Error}})}}this._modelsGroups.set(i,r);let l=this._clearModelCache(i),c=!1;for(let u of n){if(this._modelCache.has(u.identifier)){this._logService.warn(`[LM] Model ${u.identifier} is already registered. Skipping.`);continue}this._modelCache.set(u.identifier,u.metadata),c=c||!uo(l.get(u.identifier),u.metadata),l.delete(u.identifier)}this._logService.trace(`[LM] Resolved language models for vendor ${i}`,n),c=c||l.size>0,c?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._providers.get(this._modelCache.get(i)?.vendor||"");if(!r)throw new Error(`Chat provider for model ${i} is not registered.`);return r.sendChatRequest(i,t,e,o,n)}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)}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(so(l))return;throw l}}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 P;try{await new Promise(s=>{let l=r.add(this._quickInputService.createInputBox());l.title=d(7598,null),l.placeholder=d(7601,null),l.value=o,l.ignoreFocusOut=!0,r.add(l.onDidChangeValue(c=>{if(!c){l.validationMessage=d(7599,null),l.severity=gt.Error;return}if(!t&&i.some(u=>u.name===c)){l.validationMessage=d(7602,null),l.severity=gt.Error;return}l.validationMessage=void 0,l.severity=gt.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 P;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(7604,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 P;try{let s=await new Promise((l,c)=>{let u=r.add(this._quickInputService.createInputBox());u.title=`${i}: ${t.title??e}`,u.placeholder=d(7600,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(7605,null),u.severity=gt.Error;return}if((t.type==="number"||t.type==="integer")&&isNaN(Number(p))){u.validationMessage=d(7603,null),u.severity=gt.Error;return}if(t.type==="boolean"&&p!=="true"&&p!=="false"){u.validationMessage=d(7597,null),u.severity=gt.Error;return}u.validationMessage=void 0,u.severity=gt.Ignore})),r.add(u.onDidAccept(()=>{if(!u.value&&o){u.validationMessage=d(7605,null),u.severity=gt.Error;return}l(u.value),u.hide()})),r.add(u.onDidHide(p=>{p.reason===2?c(new ho):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 id(Vj.SECRET_INPUT,i)}decodeSecretKey(i){if(Ae(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}async _resolveConfiguration(i,e){if(!e)return{};let t={};for(let o in i){if(o==="vendor"||o==="name"||o==="range")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&&Ae(s)){let l=`${Vj.SECRET_KEY_PREFIX}${Ir(_t()).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},ve.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(mYi,0,[])}_saveRecentlyUsedModels(){this._storageService.store(mYi,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||!yi(n)||(e[n.id]={label:n.label,featured:n.featured,exists:this._modelExistsInCache(n.id)})}if(i?.paid){let o=Array.isArray(i.paid)?i.paid:Object.values(i.paid);for(let n of o)!n||!yi(n)||(t[n.id]={label:n.label,featured:n.featured,minVSCodeVersion:n.minVSCodeVersion,exists:this._modelExistsInCache(n.id)})}this._modelsControlManifest={free:e,paid:t},this._onDidChangeModelsControlManifest.fire(this._modelsControlManifest)}_modelExistsInCache(i){for(let e of this._modelCache.values())if(e.id===i)return!0;return!1}_initChatControlData(){if(this._chatControlUrl=this._productService.chatParticipantRegistry,!this._chatControlUrl)return;let i=this._storageService.get(wdi,-1);try{this._restrictedChatParticipants.set(JSON.parse(i??"{}"),void 0)}catch{this._storageService.remove(wdi,-1)}let e=this._storageService.get(Cdi,-1);try{let t=JSON.parse(e??"{}");yi(t)&&this._setModelsControlManifest(t)}catch{this._storageService.remove(Cdi,-1)}this._refreshChatControlData()}_refreshChatControlData(){this._chatControlDisposed||this._fetchChatControlData().catch(i=>this._logService.warn("Failed to fetch chat control data",i)).then(()=>Pi(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},ve.None)}catch(o){this._logService.warn("[LM] Failed to request chat control data",Cn(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 hh(i)}catch(o){this._logService.warn("[LM] Failed to parse chat control response",Cn(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(wdi,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(Cdi,JSON.stringify(e.models),-1,1))}dispose(){this._chatControlDisposed=!0,this._store.dispose(),this._providers.clear()}};Vj=I([m(0,lt),m(1,ne),m(2,le),m(3,X),m(4,Wj),m(5,Ge),m(6,LE),m(7,nt),m(8,_a)],Vj);var Gx=ae("IAuthenticationAccessService"),B8e=class extends C{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=Ei.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=Ei.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=Ei.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})}};B8e=I([m(0,le),m(1,nt)],B8e);we(Gx,B8e,1);var cTt=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 P;this._providerRegistrations=new jt;this._lmProviderChange=new E;this._pendingProgress=new Map;this._ignoredFileProviderRegistrations=new jt;this._proxy=i.getProxy(Zi.ExtHostChatProvider)}dispose(){this._lmProviderChange.dispose(),this._providerRegistrations.dispose(),this._ignoredFileProviderRegistrations.dispose(),this._store.dispose()}$registerLanguageModelProvider(i){let e=new P;try{e.add(this._chatProviderService.registerLanguageModelProvider(i,{onDidChange:H.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 Go,u=new kpt;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=Je.wrap(await k_(p.value.data.buffer))})),await this._proxy.$startChatRequest(t,l,n,new qh(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=nEt.tryDeserialize(e)??n6(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 qh(c));this._logService.trace("[CHAT] request DONE",i.value,t)}catch(c){this._logService.error("[CHAT] extension request ERRORED in STREAM",In(c,!0),i.value,t),this._proxy.$acceptResponseDone(t,QG(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",In(c,!0),i.value,t),this._proxy.$acceptResponseDone(t,QG(c))})}$countTokens(i,e,t){return this._chatProviderService.computeTokenLength(i,e,t)}_registerAuthenticationProvider(i,e){let t=dV+i.value;if(this._authenticationService.getProviderIds().includes(t))return C.None;let o=e.accountLabel??d(3040,null),n=new P,r=new xdi(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)}};cTt=I([vo(Gi.MainThreadLanguageModels),m(1,Wr),m(2,ne),m(3,Cs),m(4,Gx),m(5,lt),m(6,jxe)],cTt);var xdi=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(3039,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 ake="copilot";var At=ae("chatWidgetService"),$x=Symbol("ChatViewPaneTarget"),M_=ae("quickChatService"),NO=ae("chatAccessibilityService");function XI(a){return typeof a.viewId=="string"}function _ce(a){return!XI(a)}var LY=ae("chatCodeBlockContextProviderService"),Vr=`workbench.panel.chat.view.${ake}`,eR="workbench.panel.chat";var cs;(r=>{r.scheme=Y.vscodeLocalChatSession;function i(s){let l=Qd(Je.wrap(new TextEncoder().encode(s)),!1,!0);return A.from({scheme:r.scheme,authority:qp,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===qp?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=Sl(l[1]);return{chatSessionType:c,sessionId:new TextDecoder().decode(u.buffer)}}})(cs||={});function P_(a){let i=cs.parseLocalSessionId(a);return i||a.toString()}function fg(a){return a.scheme===Y.vscodeChatEditor?qp:a.scheme===cs.scheme?a.authority||qp:a.scheme}var np=(r=>(r.Local="local",r.Background="copilotcli",r.Cloud="copilot-cloud-agent",r.Claude="claude-code",r.Codex="openai-codex",r.Growth="copilot-growth",r))(np||{});function gYi(a){return a==="local"||a==="copilotcli"||a==="copilot-cloud-agent"||a==="claude-code"}function Rf(a){let i=A.isUri(a)?fg(a):a;switch(i){case"local":case"copilotcli":case"copilot-cloud-agent":case"claude-code":case"openai-codex":return i;default:return}}function XS(a){switch(a){case"local":return d(5651,null);case"copilotcli":return d(5649,null);case"copilot-cloud-agent":return d(5650,null);case"claude-code":return"Claude";case"openai-codex":return"Codex";case"copilot-growth":return"Growth"}}function A_(a){switch(a){case"local":return M.vm;case"copilotcli":return M.worktree;case"copilot-cloud-agent":return M.cloud;case"openai-codex":return M.openai;case"claude-code":return M.claude;case"copilot-growth":return M.lightbulb}}function dTt(a){switch(a){case"local":case"copilotcli":case"copilot-cloud-agent":return!0;case"claude-code":case"openai-codex":case"copilot-growth":return!1}}function uTt(a){switch(a){case"local":case"copilotcli":case"copilot-cloud-agent":return!0;case"claude-code":case"openai-codex":case"copilot-growth":return!1}}function kdi(a){switch(a){case"local":return d(5648,null);case"copilotcli":return d(5643,null);case"copilot-cloud-agent":return d(5645,null);case"claude-code":return d(5644,null);case"openai-codex":return d(5646,null);case"copilot-growth":return d(5647,null)}}var vaa=J("agentSessionReadIndicator.foreground",{dark:ei(ko,.2),light:ei(ko,.2),hcDark:null,hcLight:null},d(5640,null)),baa=J("agentSessionSelectedBadge.border",{dark:ei(QT,.3),light:ei(QT,.3),hcDark:ko,hcLight:ko},d(5641,null)),Saa=J("agentSessionSelectedUnfocusedBadge.border",{dark:ei(ko,.3),light:ei(ko,.3),hcDark:ko,hcLight:ko},d(5642,null)),lke="agentSession.rename",cke="agentSession.delete";function Bj(a){return a.lastRequestStarted??a.created}var Tdi="chat-dynamic-variable",JS=class extends C{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 JS.ID}_subscribeToEditor(){this._editorListener.value=this.widget.inputEditor.onDidChangeModelContent(e=>{let t=[],o=!1;this._variables=si(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)})),Ue(t.filter(Ac)),(o||t.length>0)&&this.widget.refreshParsedInput(),this.updateDecorations()})}getInputState(e){e[JS.ID]=this.variables}setInputState(e){let t=e[JS.ID];Array.isArray(t)||(t=[]),this.disposeVariables(),this._variables=[];for(let o of t)l1o(o)&&this.addReference(o)}addReference(e){Edi(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=>Edi(n.range)),o=this.widget.inputEditor.setDecorationsByType("chat",Tdi,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 xe(this.labelService.getUriLabel(t,{relative:!0}));if(nv(t)){let o=e.fullName?` ${e.fullName}`:"",n=`#${t.range.startLineNumber}-${t.range.endLineNumber}`;return new xe(o+this.labelService.getUriLabel(t.uri,{relative:!0})+n)}else return}disposeVariables(){for(let e of this._variables)Ac(e)&&e.dispose()}dispose(){this.disposeVariables(),super.dispose()}};JS=I([m(1,ot)],JS);function l1o(a){return a&&typeof a.id=="string"&&z.isIRange(a.range)&&Edi(a.range)&&"data"in a}function Edi(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 c1o(a){return"widget"in a&&"range"in a&&"variableData"in a}var H8e=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(!c1o(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(JS.ID)?.addReference({id:t.id,range:o,isFile:!0,data:n})}};W(H8e);var br=ae("chatAgentService"),dke=class extends C{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(x.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=x.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 uke(o.data,t)),Z(()=>{o.impl=void 0,this._onDidChangeAgents.fire(void 0),o.data.isDefault&&this._hasDefaultAgent.set(ht.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 uke(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 uke(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 ju(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(x.deserialize(t.data.when))}getAgentByFullyQualifiedId(e){let t=ht.find(this._agents.values(),o=>Hj(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 uke(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){let s=this._agents.get(e);if(!s?.impl)throw new Error(`No activated agent with id "${e}"`);return await s.impl.invoke(t,o,n,r)}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=ht.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}}};dke=I([m(0,X),m(1,B)],dke);var uke=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}},mz=ae("chatAgentNameService"),pke=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=>mr(n,n.includes(".")?e.extensionId.value:e.extensionPublisherId)):!0)}};pke=I([m(0,Wr)],pke);function Hj(a){return`${a.extensionId.value}.${a.id}`}function d1o(a){return a.name!==void 0}function pTt(a){let i=d1o(a)?a:{...a,name:a.id};return i.extensionPublisherId||(i.extensionPublisherId=a.extensionPublisher??""),i.extensionDisplayName||(i.extensionDisplayName=""),i.extensionId||(i.extensionId=new Ei("")),Xn(i)}var fYi="onCustomAgentProvider",vYi="onInstructionsProvider",bYi="onPromptFileProvider",SYi="onSkillProvider",nr=ae("IPromptsService");function IYi(a){if(typeof a!="object"||a===null)return!1;let i=a;return typeof i.userInvocable=="boolean"&&typeof i.agentInvocable=="boolean"}var RY="https://aka.ms/vscode-ghcp-prompt-snippets",mTt="https://aka.ms/vscode-ghcp-custom-instructions",U8e="https://aka.ms/vscode-ghcp-custom-chat-modes",hTt="https://aka.ms/vscode-agent-skills",gTt="https://aka.ms/vscode-chat-hooks",PE="prompt",z8e="instructions",K8e="chatagent",_di="skill",hz=[PE,z8e,K8e,_di];function yYi(a){switch(a){case"prompt":return PE;case"instructions":return z8e;case"agent":return K8e;case"skill":return _di;case"hook":return"jsonc";default:throw new Error(`Unknown prompt type: ${a}`)}}function Mf(a){switch(a){case PE:return"prompt";case z8e:return"instructions";case K8e:return"agent";case _di:return"skill";default:return}}var fc=(n=>(n.instructions="instructions",n.prompt="prompt",n.agent="agent",n.skill="skill",n.hook="hook",n))(fc||{});function wYi(a){return Object.values(fc).includes(a)}var uP;(n=>{n.icon=M.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(7587,null);return r.filterUri&&(l=d(7588,null,Ye(r.filterUri))),l}n.label=o})(uP||={});var uV;(t=>{function a(o){return A.isUri(o.value)?o.value:nv(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:Qd(Je.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=Sl(o.value.$base64).buffer,n}return o}t.fromExport=e})(uV||={});function CYi(a){return a.kind==="implicit"}function MY(a){return a.kind==="string"}function xYi(a){return a.kind==="terminalCommand"}function fTt(a){return a.kind==="paste"}function vTt(a){return a.kind==="workspace"}function pV(a){return a.kind==="image"}function bTt(a){return a.kind==="notebookOutput"}function STt(a){return a.kind==="element"}function pP(a){return a.kind==="promptFile"}function PY(a){return a.kind==="promptText"}function ITt(a){return a.kind==="scmHistoryItem"}function yTt(a){return a.kind==="scmHistoryItemChange"}function wTt(a){return a.kind==="scmHistoryItemChangeRange"}function qx(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 mP(a,i,e,t=!1,o){return{id:`${i}__${a.toString()}`,name:`prompt:${Ye(a)}`,value:a,kind:"promptFile",modelDescription:"Prompt instructions file",isRoot:i!=="vscode.prompt.instructions",originLabel:e,toolReferences:o,automaticallyAdded:t}}function kYi(a,i=!1,e){return{id:"vscode.prompt.instructions.text",name:"prompt:instructionsList",value:a,kind:"promptText",modelDescription:"Prompt instructions list",automaticallyAdded:i,toolReferences:e}}function Dce(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 CTt(a,i){return{kind:"toolset",id:a.id,icon:a.icon,name:a.referenceName,value:Array.from(a.getTools()).map(e=>Dce(e)),range:i}}var Uj=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 Ddi;(i=>{function a(e,t){return e.text===t.text&&D9t(e.parts,t.parts,(o,n)=>o.kind===n.kind&&di.equals(o.range,n.range)&&z.equalsRange(o.editorRange,n.editorRange)&&o.text===n.text)}i.equals=a})(Ddi||={});function kTt(a){let i=a.parts.map(t=>t.promptText).join("").trimStart(),e=a.text.length-i.length;return{message:i,diff:e}}var pb=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}},su="#",vg="@",yu="/",xTt=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`${su}${this.variableName}${i}`}get promptText(){return this.text}},ZS=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`${su}${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}}},OO=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`${su}${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}}},zu=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`${vg}${this.agent.name}`}get promptText(){return""}},Pf=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`${yu}${this.command.name}`}get promptText(){return""}},jx=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`${yu}${this.slashCommand.command}`}get promptText(){return`${yu}${this.slashCommand.command}`}},Qx=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`${yu}${this.name}`}get promptText(){return`${yu}${this.name}`}},tR=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(su,"")}get promptText(){return this.text}toVariableEntry(){return this.id==="vscode.problems"?uP.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 EYi(a){return{text:a.text,parts:a.parts.map(i=>{if(i.kind===pb.Kind)return new pb(new di(i.range.start,i.range.endExclusive),i.editorRange,i.text);if(i.kind===xTt.Kind)return new xTt(new di(i.range.start,i.range.endExclusive),i.editorRange,i.variableName,i.variableArg,i.variableId||"");if(i.kind===ZS.Kind)return new ZS(new di(i.range.start,i.range.endExclusive),i.editorRange,i.toolName,i.toolId,i.displayName,i.icon);if(i.kind===OO.Kind)return new OO(new di(i.range.start,i.range.endExclusive),i.editorRange,i.id,i.name,i.icon,i.tools??[]);if(i.kind===zu.Kind){let e=i.agent;return e=pTt(e),new zu(new di(i.range.start,i.range.endExclusive),i.editorRange,e)}else{if(i.kind===Pf.Kind)return new Pf(new di(i.range.start,i.range.endExclusive),i.editorRange,i.command);if(i.kind===jx.Kind)return new jx(new di(i.range.start,i.range.endExclusive),i.editorRange,i.slashCommand);if(i.kind===Qx.Kind)return new Qx(new di(i.range.start,i.range.endExclusive),i.editorRange,i.name);if(i.kind===tR.Kind)return new tR(new di(i.range.start,i.range.endExclusive),i.editorRange,i.text,i.id,i.modelDescription,Xn(i.data),i.fullName,i.icon,i.isFile,i.isDirectory);throw new Error(`Unknown chat request part: ${i.kind}`)}})}}function TYi(a){let i=a.parts.find(t=>t instanceof zu),e=a.parts.find(t=>t instanceof Pf);return{agentPart:i,commandPart:e}}function ETt(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+=`${vg}${r.name} `,o&&(n+=`${yu}${o} `)}return n+e}var TTt=ae("IChatVariablesService");var FO=ae("chatSlashCommandService"),mke=class extends C{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)}};mke=I([m(0,lt)],mke);function _Yi(a){let i=[];return DYi(a.node,i),i.join("")}function DYi(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)DYi(e,i)}function _Tt(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 Rn;(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(8069,null)}:r.type==="mcp"?{ordinal:2,label:r.label}:r.type==="user"?{ordinal:0,label:d(8071,null)}:{ordinal:3,label:r.label}}n.classify=o})(Rn||={});function mV(a){return typeof a=="object"&&typeof a?.input=="string"&&(typeof a?.output=="string"||Array.isArray(a?.output))}function zj(a){return typeof a=="object"&&typeof a?.output=="object"&&typeof a?.output?.mimeType=="string"&&a?.output?.type==="data"}function DTt(a){return a.map(i=>{switch(i.kind){case"promptTsx":return $8e(i);case"text":return i.value;case"data":return d(8070,null,ll.formatSize(i.value.data.byteLength),i.value.mimeType||"unknown")}}).join(", ")}function LYi(a){return a.content.some(i=>i.kind==="data")}function $8e(a){return _Yi(a.value)}function Km(a){return!!a&&a.getTools!==void 0}var hke=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 k6;this._toolSets=new k6;this.isHomogenous=Ce(l=>!ht.some(this._tools.observable.read(l),c=>!Rn.equals(c.source,this.source))&&!ht.some(this._toolSets.observable.read(l),c=>!Rn.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?C.None:(this._toolSets.add(i,e),Z(()=>{this._toolSets.delete(i)}))}getTools(i){return ht.concat(ht.filter(this._tools.observable.read(i),e=>this._contextKeyService.contextMatchesRules(e.when)),...ht.map(this._toolSets.observable.read(i),e=>e.getTools(i)))}},G8e=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 ht.filter(this._toolSet.getTools(i),e=>_Tt(e,this.model))}},jn=ae("ILanguageModelToolsService");function RYi(a){return A.from({scheme:Y.inMemory,path:`/lm/tool/${a}/tool_input.json`})}function q8e(a){return typeof a!="string"&&(a=a.id),A.from({scheme:Y.vscode,authority:"schemas",path:`/lm/tool/${a}`})}var jp;(s=>(s.execute="execute",s.edit="edit",s.search="search",s.agent="agent",s.read="read",s.web="web",s.todo="todo"))(jp||={});var Kj;(e=>(e.runSubagent="runSubagent",e.vscode="vscode"))(Kj||={});var u1o=/^@([\w_\-\.]+)(?=(\s|$|\b))/i,p1o=/^#([\w_\-]+)(:\d+)?(?=(\s|$|\b))/i,m1o=/^\/([\p{L}\d_\-\.:]+)(?=(\s|$|\b))/iu,AE=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&&(Km(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===su?b=this.tryToParseVariable(t.slice(g),g,new Ie(c,u),r,s,l):v===vg?b=this.tryToParseAgent(t.slice(g),t,g,new Ie(c,u),r,o,n):v===yu&&(b=this.tryToParseSlashCommand(t.slice(g),t,g,new Ie(c,u),r,o,n)),b||(b=this.tryToParseDynamicVariable(t.slice(g),g,new Ie(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 pb(new di(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 pb(new di(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(u1o);if(!l)return;let[c,u]=l,p=new di(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 zu)||n.some(y=>y instanceof pb&&y.text.trim()!==""||!(y instanceof zu)))return;let b=n.at(-1)?.range.endExclusive??0;if(e.slice(b,t).trim()==="")return new zu(p,h,f)}tryToParseVariable(i,e,t,o,n,r){let s=i.match(p1o);if(!s)return;let[l,c]=s,u=new di(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 ZS(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 ZS(u,p,v.toolReferenceName??v.displayName,v.id,v.displayName,v.icon).toVariableEntry());return new OO(u,p,g.id,g.referenceName,g.icon,f)}}tryToParseSlashCommand(i,e,t,o,n,r,s){let l=i.match(m1o);if(!l||n.some(y=>!(y instanceof zu)&&!(y instanceof pb&&y.text.trim()==="")))return;let u=n.at(-1)?.range.endExclusive??0;if(e.slice(u,t).trim()!=="")return;let[h,g]=l,f=new di(t,t+h.length),v=new z(o.lineNumber,o.column,o.lineNumber,o.column+h.length),b=n.find(y=>y instanceof zu)?.agent??(s?.forcedAgent?s.forcedAgent:void 0);if(b){let y=b.slashCommands.find(w=>w.name===g);if(y)return new Pf(f,v,y)}let S=s?.attachmentCapabilities??b?.capabilities??s?.attachmentCapabilities;if(!b||S?.supportsPromptAttachments){let w=this.slashCommandService.getCommands(r,s?.mode??"ask").find(T=>T.command===g);if(w)return new jx(f,v,w);{let N=this.agentService.getDefaultAgent(r,s?.mode)?.slashCommands.find(O=>O.name===g);if(N)return new Pf(f,v,N)}if(this.promptsService.isValidSlashCommandName(g))return new Qx(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 di(e,e+r);return new tR(l,n.range,s,n.id,n.modelDescription,n.data,n.fullName,n.icon,n.isFile,n.isDirectory)}}};AE=I([m(0,br),m(1,TTt),m(2,FO),m(3,nr)],AE);function WO(a){if(!a.viewModel||!a.supportsFileReferences)return[];let i=a.getContrib(JS.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 gz(a){return a.input.selectedToolsModel.entriesMap.get()}var gke=class{constructor(i){this.chatWidgetService=i}getDynamicVariables(i){let e=this.chatWidgetService.getWidgetBySessionResource(i);return e?WO(e):[]}getSelectedToolAndToolSets(i){let e=this.chatWidgetService.getWidgetBySessionResource(i);return e?gz(e):new Map}};gke=I([m(0,At)],gke);function h1o(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 MYi(a){return!!a&&typeof a=="object"&&"documents"in a&&Array.isArray(a.documents)&&a.documents.every(h1o)}function PYi(a){return!!a&&typeof a=="object"&&typeof a.variableName=="string"}function RTt(a){return!!a&&typeof a=="object"&&"command"in a&&"language"in a}var lo;(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 P;return new Promise(b=>{g&&v.add(g.onCancellationRequested(()=>{b({type:0})})),v.add(he(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 P;return new Promise(b=>{g&&v.add(g.onCancellationRequested(()=>{b({type:0})})),v.add(he(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})(lo||={});var LTt=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=>{ux(e=>{let t=this.state.read(e);t.working||(e.dispose(),i(t))})})}toJSON(){return{kind:"mcpServersStarting",didStartServerIds:this.didStartServerIds}}};function AYi(a){return!!a&&a.kind==="reply"&&typeof a.message=="string"&&typeof a.agentId=="string"}function NYi(a){return Wo(a,{created:!0})?a:{created:a.startTime,lastRequestStarted:a.startTime,lastRequestEnded:a.endTime}}var Gj;(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})(Gj||={});var Si=ae("IChatService"),Lce="accessibility.voice.keywordActivation",j8e="chat.stopCancellationNoop",fz="chat.pendingRequestChange";var Q8e=(t=>(t[t.Output=1]="Output",t[t.OutputItems=2]="OutputItems",t[t.ExecutionState=3]="ExecutionState",t))(Q8e||{}),AY=ae("INotebookExecutionService");var eI;(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})(eI||={});var Ldi=class{constructor(i){this.content=i;this.kind="progressTask";this.deferred=new Go;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}}},MTt=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g){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._agents=this._register(new jt);this._agentCompletionProviders=this._register(new jt);this._agentIdsToCompletionProviders=this._register(new jt);this._chatParticipantDetectionProviders=this._register(new jt);this._promptFileProviders=this._register(new jt);this._promptFileProviderEmitters=this._register(new jt);this._promptFileContentRegistrations=this._register(new jt);this._pendingProgress=new Map;this._activeTasks=new Map;this._unresolvedAnchors=new Map;this._proxy=e.getProxy(Zi.ExtHostChatAgents2),this._register(this._chatService.onDidDisposeSession(f=>{for(let v of f.sessionResource)this._proxy.$releaseSession(v)})),this._register(this._chatService.onDidPerformUserAction(f=>{if(typeof f.agentId=="string"){for(let[v,b]of this._agents)if(b.id===f.agentId){f.action.kind==="vote"?this._proxy.$acceptFeedback(v,f.result??{},f.action):this._proxy.$acceptAction(v,f.result||{},f);break}}})),this._register(this._chatService.onDidReceiveQuestionCarouselAnswer(f=>{this._proxy.$handleQuestionCarouselAnswer(f.requestId,f.resolveId,f.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&&Rf(t)==="local";this._proxy.$acceptActiveChatSession(o?t:void 0)}async _pushCustomAgents(){try{let t=(await this._promptsService.getCustomAgents(ve.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(ve.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(ve.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=b.isUntitled;if(w){let k=await this._chatSessionService.createNewChatSessionItem(b.chatSessionType,p,f);k&&(y=k.resource,w=!1,v?.setContributedChatSession({chatSessionType:b.chatSessionType,chatSessionResource:y,isUntitled:!1,initialSessionOptions:b.initialSessionOptions}),this._chatSessionService.registerSessionResourceAlias(b.chatSessionResource,y))}S={chatSessionResource:y,isUntitled:w,initialSessionOptions:b.initialSessionOptions?.map(k=>({optionId:k.optionId,value:typeof k.value=="string"?k.value:k.value.id}))}}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=>Ei.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:Xn(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,Xn(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,Xn(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,ve.None);continue}if(u.kind==="usage"){l&&l.setUsage({kind:"usage",promptTokens:u.promptTokens,completionTokens:u.completionTokens,promptTokenDetails:u.promptTokenDetails});continue}let h=u.kind==="notebookEdit"?OYi.fromChatEdit(u):Xn(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 Ldi(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=Xn(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:Y.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=>Yr(k)).join(""),h=new RegExp(`[${p}]\\S*`,"g"),g=My(s.column,h,r.getLineContent(s.lineNumber),0)?.word??"";if(g&&!o.some(k=>g.startsWith(k)))return;let v=this._instantiationService.createInstance(AE).parseChatRequestWithReferences(WO(u),gz(u),r.getValue()).parts.find(k=>k instanceof zu),b=this._agents.get(e)?.id;if(v?.agent.id!==b)return;let S=g1o(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),N=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:H8e.ID,title:"",arguments:[{id:k.id,widget:u,range:N,variableData:Xn(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(!wYi(t)){this._logService.error(`[MainThreadChatAgents2] Invalid contribution type: ${t}`);return}let r=new E;this._promptFileProviderEmitters.set(e,r);let s=new jt;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()}};MTt=I([vo(Gi.MainThreadChatAgents2),m(1,br),m(2,Ls),m(3,Si),m(4,zt),m(5,At),m(6,F),m(7,ne),m(8,lt),m(9,dt),m(10,nr),m(11,jn)],MTt);function g1o(a,i,e){let t=My(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 OYi;(i=>{function a(e){return{kind:"notebookEdit",uri:A.revive(e.uri),done:e.done,edits:e.edits.map(eI.fromCellEditOperationDto)}}i.fromChatEdit=a})(OYi||={});var NY=ae("codeMapperService"),PTt=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 Rce=class extends C{constructor(e,t){super();this.codeMapperService=t;this.providers=this._register(new jt);this._responseMap=new Map;this._proxy=e.getProxy(Zi.ExtHostCodeMapper)}$registerCodeMapperProvider(e,t){let o={displayName:t,mapCode:async(r,s,l)=>{let c=String(Rce._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(Qk.isTextEdit)?o.textEdit(r,n):o.notebookEdit(r,n.map(eI.fromCellEditOperationDto)):o.textEdit(r,[])}return Promise.resolve()}};Rce._requestHandlePool=0,Rce=I([vo(Gi.MainThreadCodeMapper),m(1,NY)],Rce);var Rdi="vscode://schemas/toolsParameters",f1o={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}"}}}}]},v1o=oe.as(ea.JSONContribution);v1o.registerSchema(Rdi,f1o);var WYi=Tn.registerExtensionPoint({extensionPoint:"languageModelTools",activationEventsGenerator:function*(a){for(let i of a)yield`onLanguageModelTool:${i.name}`},jsonSchema:{description:d(8067,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(8055,null),type:"string",pattern:"^(?!copilot_|vscode_)[\\w-]+$"},toolReferenceName:{markdownDescription:d(8056,null,"`canBeReferencedInPrompt`"),type:"string",pattern:"^[\\w-]+$"},displayName:{description:d(8053,null),type:"string"},userDescription:{description:d(8066,null),type:"string"},modelDescription:{description:d(8054,null),type:"string"},inputSchema:{description:d(8051,null),$ref:Rdi},canBeReferencedInPrompt:{markdownDescription:d(8042,null,"`ChatRequest#toolReferences`"),type:"boolean"},icon:{markdownDescription:d(8045,null),anyOf:[{type:"string"},{type:"object",properties:{light:{description:d(8047,null),type:"string"},dark:{description:d(8046,null),type:"string"}}}]},when:{markdownDescription:d(8043,null),type:"string"},tags:{description:d(8065,null),type:"array",items:{type:"string",pattern:"^(?!copilot_|vscode_)"}}}}}}),b1o=Tn.registerExtensionPoint({extensionPoint:"languageModelToolSets",deps:[WYi],jsonSchema:{description:d(8068,null),type:"array",items:{additionalProperties:!1,type:"object",defaultSnippets:[{body:{name:"${1}",description:"${2}",tools:["${3}"]}}],required:["name","description","tools"],properties:{name:{description:d(8060,null),type:"string",pattern:"^[\\w-]+$"},description:{description:d(8058,null),type:"string"},icon:{markdownDescription:d(8059,null),type:"string"},tools:{markdownDescription:d(8061,null),type:"array",minItems:1,items:{type:"string"}}}}}});function FYi(a,i){return`${a.value}/${i}`}function Y8e(a,i){return`toolset:${a.value}/${i}`}var Mce=class{constructor(i,e){this._registrationDisposables=new jt;WYi.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_"))&&!Ea(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_"))&&!Ea(n.description,"chatParticipantPrivate")&&n.collector.error(`Extension '${n.description.identifier.value}' CANNOT register tool with tags starting with "vscode_" or "copilot_"`),r.legacyToolReferenceFullNames&&!Ea(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:je(n.description.extensionLocation,s),light:je(n.description.extensionLocation,s)}:s&&(l={dark:je(n.description.extensionLocation,s.dark),light:je(n.description.extensionLocation,s.light)});let c=i.defaultChatAgent?.chatExtensionId?Ei.equals(n.description.identifier,i.defaultChatAgent.chatExtensionId):Ea(n.description,"chatParticipantPrivate"),u=c?Rn.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?x.deserialize(r.when):void 0,alwaysDisplayInputOutput:!c};try{let h=e.registerToolData(p);this._registrationDisposables.set(FYi(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(FYi(n.description.identifier,r.name))}),b1o.setHandler((t,o)=>{for(let n of o.added){if(!Ea(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?Ei.equals(n.description.identifier,i.defaultChatAgent.chatExtensionId):Ea(n.description,"chatParticipantPrivate"),s=r?Rn.Internal:{type:"extension",label:n.description.displayName??n.description.name,extensionId:n.description.identifier};for(let l of n.value){if(Jl(l.name)){n.collector.error(`Tool set '${l.name}' CANNOT have an empty name`);continue}if(l.legacyFullNames&&!Ea(n.description,"contribLanguageModelToolSets")){n.collector.error(`Tool set '${l.name}' CANNOT use 'legacyFullNames' without the 'contribLanguageModelToolSets' API proposal enabled`);continue}if(JA(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 P,g=l.referenceName??l.name,f=e.getToolSetByName(g),v=r&&f?.source===Rn.Internal,b;if(v?b=f:b=e.createToolSet(s,Y8e(n.description.identifier,l.name),g,{icon:l.icon?q.fromString(l.icon):void 0,description:l.description,legacyFullNames:l.legacyFullNames}),Ui(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(Y8e(n.description.identifier,l.name),h)}}for(let n of o.removed)for(let r of n.value)this._registrationDisposables.deleteAndDispose(Y8e(n.description.identifier,r.name))})}static{this.ID="workbench.contrib.toolsExtensionPointHandler"}};Mce=I([m(0,nt),m(1,jn)],Mce);var Mdi=class extends C{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(8064,null),d(8063,null),d(8062,null)],n=t.map(r=>[new xe(`\`${r.name}\``),r.displayName,r.userDescription??r.modelDescription]);return{data:{headers:o,rows:n},dispose:()=>{}}}};oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:"languageModelTools",label:d(8048,null),access:{canToggle:!1},renderer:new Mt(Mdi)});var Pdi=class extends C{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(8050,null),d(8052,null),d(8057,null),d(8044,null)],n=t.map(r=>[new xe(`\`${r.name}\``),r.referenceName?new xe(`\`#${r.referenceName}\``):"none",r.tools.join(", "),r.description]);return{data:{headers:o,rows:n},dispose:()=>{}}}};oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:"languageModelToolSets",label:d(8049,null),access:{canToggle:!1},renderer:new Mt(Pdi)});var ATt=class extends C{constructor(e,t,o){super();this._languageModelToolsService=t;this._logService=o;this._tools=this._register(new jt);this._runningToolCalls=new Map;this._proxy=e.getProxy(Zi.ExtHostLanguageModelTools),this._register(this._languageModelToolsService.onDidChangeTools(n=>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,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(Xn(e),(r,s)=>this._proxy.$countTokensForInvocation(e.callId,r,s),t??ve.None),n={content:o.content,toolMetadata:o.toolMetadata,toolResultError:o.toolResultError};return LYi(o)?new qh(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 qh?c.value:c;return Xn(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&&oh(t.icon))n={dark:A.revive(t.icon)};else{let u=t.icon;n={dark:A.revive(u.dark),light:u.light?A.revive(u.light):void 0}}let r=Xn(t.source),s={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:r,icon:n,models:t.models,canBeReferencedInPrompt:!!t.userDescription&&!t.toolSet},l=t.id,c=new P;if(c.add(this._languageModelToolsService.registerTool(s,{invoke:async(u,p,h,g)=>{try{this._runningToolCalls.set(u.callId,{countTokens:p,progress:h});let f=await this._proxy.$invokeTool(u,g),v=f instanceof qh?f.value:f;return Xn(v)}finally{this._runningToolCalls.delete(u.callId)}},handleToolStream:o?(u,p)=>this._proxy.$handleToolStream(l,u,p):void 0,prepareToolInvocation:(u,p)=>this._proxy.$prepareToolInvocation(l,u,p)})),t.toolSet){let u=this._languageModelToolsService.getToolSet(Y8e(e,t.toolSet))||this._languageModelToolsService.getToolSet(t.toolSet);!u||!(u instanceof hke)?this._logService.warn(`ToolSet ${t.toolSet} not found for tool ${t.id} from extension ${e.value}`):c.add(u.addTool(s))}this._tools.set(l,c)}$unregisterTool(e){this._tools.deleteAndDispose(e)}};ATt=I([vo(Gi.MainThreadLanguageModelTools),m(1,jn),m(2,ne)],ATt);var VYi=ae("embeddingsService"),Adi=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}`))}};we(VYi,Adi,1);var NTt=class{constructor(i,e){this.embeddingsService=e;this._store=new P;this._providers=this._store.add(new jt);this._proxy=i.getProxy(Zi.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)}};NTt=I([vo(Gi.MainThreadEmbeddings),m(1,VYi)],NTt);var Ndi=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 BYi(a,i){if(i.serializeBuffersForPostMessage){let e=new Ndi,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=S1o(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 Je.wrap(s)});return{message:o,buffers:n}}else return{message:JSON.stringify(a),buffers:[]}}function S1o(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 HYi(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 OY=class extends C{constructor(e,t,o){super();this._openerService=t;this._productService=o;this._webviews=new Map;this._proxy=e.getProxy(Zi.ExtHostWebviews)}static{this.standardSupportedLinkSchemes=new Set([Y.http,Y.https,Y.mailto,Y.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=fke(t))}async $postMessage(e,t,...o){let n=this.tryGetWebview(e);if(!n)return!1;let{message:r,arrayBuffers:s}=HYi(t,o);return n.postMessage(r,s)}hookupWebviewEventDelegate(e,t,o){let n=new P;n.add(t.onDidClickLink(r=>this.onDidClickLink(e,r))),n.add(t.onMessage(r=>{let s=BYi(r.message,o);this._proxy.$onMessage(e,s.message,new qh(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 OY.standardSupportedLinkSchemes.has(t.scheme)||!Gt&&this._productService.urlProtocol===t.scheme?!0:t.scheme===Y.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(3064,null,ur(e))}</body>
		</html>`}};OY=I([m(1,Qe),m(2,nt)],OY);function Pce(a){return{id:a.id,location:A.revive(a.location)}}function fke(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 Bl=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 X8e(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 X8e(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 X8e(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}}},X8e=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(){mf(this.mementoObj)?this.storageService.remove(this.id,this.scope):this.storageService.store(this.id,this.mementoObj,this.scope,this.target)}};var OTt=new Q("webviewFindWidgetVisible",!1),bz=new Q("webviewFindWidgetFocused",!1),FTt=new Q("webviewFindWidgetEnabled",!1),wm=ae("webviewService");function UYi(a,i){return a.allowMultipleAPIAcquire===i.allowMultipleAPIAcquire&&a.allowScripts===i.allowScripts&&a.allowForms===i.allowForms&&$i(a.localResourceRoots,i.localResourceRoots,Xe)&&$i(a.portMapping,i.portMapping,(e,t)=>e.extensionHostPort===t.extensionHostPort&&e.webviewPort===t.webviewPort)&&I1o(a,i)}function I1o(a,i){return a.enableCommandUris===i.enableCommandUris?!0:Array.isArray(a.enableCommandUris)&&Array.isArray(i.enableCommandUris)?$i(a.enableCommandUris,i.enableCommandUris):!1}var $j=class{constructor(i,e){this._memento=new Bl(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=_t();return this._state[t]=n,this._memento.saveMemento(),n}_getKey(i,e){return JSON.stringify({viewType:i,key:e})}};$j=I([m(1,le)],$j);var vz=class{constructor(i,e){this._store=new $j(i,e)}getOrigin(i,e){return this._store.getOrigin(i,e.value)}};vz=I([m(1,le)],vz);var Odi=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,Me(i.getDomNode()))}dispose(){this.editor.changeViewZones(i=>this._id&&i.removeZone(this._id))}},WTt=class{constructor(i,e,t){this._editorService=e;this._webviewService=t;this._disposables=new P;this._insets=new Map;this._proxy=i.getProxy(Zi.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()&&Xe(f.getModel().uri,A.revive(t))){c=f;break}if(!c){setTimeout(()=>this._proxy.$onDidDispose(i));return}let u=new P,p=this._webviewService.createWebviewElement({title:void 0,options:{enableFindWidget:!1},contentOptions:fke(r),extension:{id:s,location:A.revive(l)}}),h=new Odi(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=fke(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}};WTt=I([vo(Gi.MainThreadEditorInsets),m(1,Kt),m(2,wm)],WTt);var VTt={},kd={exports:VTt};(function(a,i){if(typeof VTt=="object"&&typeof kd=="object")kd.exports=i();else if(typeof define=="function"&&define.amd)define([],i);else{var e=i();for(var t in e)(typeof VTt=="object"?VTt: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=ba,o=typeof t=="object"&&t.env&&t.env.NODE_DEBUG&&/\bsemver\b/i.test(t.env.NODE_DEBUG)?function(){var Ut=Array.prototype.slice.call(arguments,0);Ut.unshift("SEMVER"),console.log.apply(console,Ut)}: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++,N="v?"+l[g]+l[S]+"?"+l[k]+"?";l[T]="^"+N+"$";var O="[v=\\s]*"+l[f]+l[y]+"?"+l[k]+"?",V=c++;l[V]="^"+O+"$";var U=c++;l[U]="((?:<|>)?=?)";var G=c++;l[G]=l[p]+"|x|X|\\*";var $=c++;l[$]=l[u]+"|x|X|\\*";var te=c++;l[te]="[v=\\s]*("+l[$]+")(?:\\.("+l[$]+")(?:\\.("+l[$]+")(?:"+l[S]+")?"+l[k]+"?)?)?";var pe=c++;l[pe]="[v=\\s]*("+l[G]+")(?:\\.("+l[G]+")(?:\\.("+l[G]+")(?:"+l[y]+")?"+l[k]+"?)?)?";var de=c++;l[de]="^"+l[U]+"\\s*"+l[te]+"$";var se=c++;l[se]="^"+l[U]+"\\s*"+l[pe]+"$";var Se=c++;l[Se]="(?:^|[^\\d])(\\d{1,16})(?:\\.(\\d{1,16}))?(?:\\.(\\d{1,16}))?(?:$|[^\\d])";var ke=c++;l[ke]="(?:~>?)";var Ee=c++;l[Ee]="(\\s*)"+l[ke]+"\\s+",s[Ee]=new RegExp(l[Ee],"g");var He=c++;l[He]="^"+l[ke]+l[te]+"$";var Ve=c++;l[Ve]="^"+l[ke]+l[pe]+"$";var Fe=c++;l[Fe]="(?:\\^)";var Qt=c++;l[Qt]="(\\s*)"+l[Fe]+"\\s+",s[Qt]=new RegExp(l[Qt],"g");var Ze=c++;l[Ze]="^"+l[Fe]+l[te]+"$";var Ti=c++;l[Ti]="^"+l[Fe]+l[pe]+"$";var ti=c++;l[ti]="^"+l[U]+"\\s*("+O+")$|^$";var bo=c++;l[bo]="^"+l[U]+"\\s*("+N+")$|^$";var Ro=c++;l[Ro]="(\\s*)"+l[U]+"\\s*("+O+"|"+l[te]+")",s[Ro]=new RegExp(l[Ro],"g");var _o=c++;l[_o]="^\\s*("+l[te]+")\\s+-\\s+("+l[te]+")\\s*$";var sr=c++;l[sr]="^\\s*("+l[pe]+")\\s+-\\s+("+l[pe]+")\\s*$";var ln=c++;l[ln]="(<|>)?=?\\s*\\*";for(var en=0;en<35;en++)o(en,l[en]),s[en]||(s[en]=new RegExp(l[en]));function Ws(Ut,_i){if(Ut instanceof ba)return Ut;if(typeof Ut!="string"||Ut.length>n||!(_i?s[V]:s[T]).test(Ut))return null;try{return new ba(Ut,_i)}catch{return null}}function ba(Ut,_i){if(Ut instanceof ba){if(Ut.loose===_i)return Ut;Ut=Ut.version}else if(typeof Ut!="string")throw new TypeError("Invalid Version: "+Ut);if(Ut.length>n)throw new TypeError("version is longer than "+n+" characters");if(!(this instanceof ba))return new ba(Ut,_i);o("SemVer",Ut,_i),this.loose=_i;var eo=Ut.trim().match(_i?s[V]:s[T]);if(!eo)throw new TypeError("Invalid Version: "+Ut);if(this.raw=Ut,this.major=+eo[1],this.minor=+eo[2],this.patch=+eo[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");eo[4]?this.prerelease=eo[4].split(".").map((function(Ar){if(/^[0-9]+$/.test(Ar)){var na=+Ar;if(na>=0&&na<r)return na}return Ar})):this.prerelease=[],this.build=eo[5]?eo[5].split("."):[],this.format()}i.parse=Ws,i.valid=function(Ut,_i){var eo=Ws(Ut,_i);return eo?eo.version:null},i.clean=function(Ut,_i){var eo=Ws(Ut.trim().replace(/^[=v]+/,""),_i);return eo?eo.version:null},i.SemVer=ba,ba.prototype.format=function(){return this.version=this.major+"."+this.minor+"."+this.patch,this.prerelease.length&&(this.version+="-"+this.prerelease.join(".")),this.version},ba.prototype.toString=function(){return this.version},ba.prototype.compare=function(Ut){return o("SemVer.compare",this.version,this.loose,Ut),Ut instanceof ba||(Ut=new ba(Ut,this.loose)),this.compareMain(Ut)||this.comparePre(Ut)},ba.prototype.compareMain=function(Ut){return Ut instanceof ba||(Ut=new ba(Ut,this.loose)),Dg(this.major,Ut.major)||Dg(this.minor,Ut.minor)||Dg(this.patch,Ut.patch)},ba.prototype.comparePre=function(Ut){if(Ut instanceof ba||(Ut=new ba(Ut,this.loose)),this.prerelease.length&&!Ut.prerelease.length)return-1;if(!this.prerelease.length&&Ut.prerelease.length)return 1;if(!this.prerelease.length&&!Ut.prerelease.length)return 0;var _i=0;do{var eo=this.prerelease[_i],Ar=Ut.prerelease[_i];if(o("prerelease compare",_i,eo,Ar),eo===void 0&&Ar===void 0)return 0;if(Ar===void 0)return 1;if(eo===void 0)return-1;if(eo!==Ar)return Dg(eo,Ar)}while(++_i)},ba.prototype.inc=function(Ut,_i){switch(Ut){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",_i);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",_i);break;case"prepatch":this.prerelease.length=0,this.inc("patch",_i),this.inc("pre",_i);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",_i),this.inc("pre",_i);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 eo=this.prerelease.length;--eo>=0;)typeof this.prerelease[eo]=="number"&&(this.prerelease[eo]++,eo=-2);eo===-1&&this.prerelease.push(0)}_i&&(this.prerelease[0]===_i?isNaN(this.prerelease[1])&&(this.prerelease=[_i,0]):this.prerelease=[_i,0]);break;default:throw new Error("invalid increment argument: "+Ut)}return this.format(),this.raw=this.version,this},i.inc=function(Ut,_i,eo,Ar){typeof eo=="string"&&(Ar=eo,eo=void 0);try{return new ba(Ut,eo).inc(_i,Ar).version}catch{return null}},i.diff=function(Ut,_i){if(Dh(Ut,_i))return null;var eo=Ws(Ut),Ar=Ws(_i);if(eo.prerelease.length||Ar.prerelease.length){for(var na in eo)if((na==="major"||na==="minor"||na==="patch")&&eo[na]!==Ar[na])return"pre"+na;return"prerelease"}for(var na in eo)if((na==="major"||na==="minor"||na==="patch")&&eo[na]!==Ar[na])return na},i.compareIdentifiers=Dg;var Id=/^[0-9]+$/;function Dg(Ut,_i){var eo=Id.test(Ut),Ar=Id.test(_i);return eo&&Ar&&(Ut=+Ut,_i=+_i),eo&&!Ar?-1:Ar&&!eo?1:Ut<_i?-1:Ut>_i?1:0}function yd(Ut,_i,eo){return new ba(Ut,eo).compare(new ba(_i,eo))}function uu(Ut,_i,eo){return yd(Ut,_i,eo)>0}function Jm(Ut,_i,eo){return yd(Ut,_i,eo)<0}function Dh(Ut,_i,eo){return yd(Ut,_i,eo)===0}function Rp(Ut,_i,eo){return yd(Ut,_i,eo)!==0}function Uv(Ut,_i,eo){return yd(Ut,_i,eo)>=0}function Cr(Ut,_i,eo){return yd(Ut,_i,eo)<=0}function sx(Ut,_i,eo,Ar){var na;switch(_i){case"===":typeof Ut=="object"&&(Ut=Ut.version),typeof eo=="object"&&(eo=eo.version),na=Ut===eo;break;case"!==":typeof Ut=="object"&&(Ut=Ut.version),typeof eo=="object"&&(eo=eo.version),na=Ut!==eo;break;case"":case"=":case"==":na=Dh(Ut,eo,Ar);break;case"!=":na=Rp(Ut,eo,Ar);break;case">":na=uu(Ut,eo,Ar);break;case">=":na=Uv(Ut,eo,Ar);break;case"<":na=Jm(Ut,eo,Ar);break;case"<=":na=Cr(Ut,eo,Ar);break;default:throw new TypeError("Invalid operator: "+_i)}return na}function Lg(Ut,_i){if(Ut instanceof Lg){if(Ut.loose===_i)return Ut;Ut=Ut.value}if(!(this instanceof Lg))return new Lg(Ut,_i);o("comparator",Ut,_i),this.loose=_i,this.parse(Ut),this.semver===Nw?this.value="":this.value=this.operator+this.semver.version,o("comp",this)}i.rcompareIdentifiers=function(Ut,_i){return Dg(_i,Ut)},i.major=function(Ut,_i){return new ba(Ut,_i).major},i.minor=function(Ut,_i){return new ba(Ut,_i).minor},i.patch=function(Ut,_i){return new ba(Ut,_i).patch},i.compare=yd,i.compareLoose=function(Ut,_i){return yd(Ut,_i,!0)},i.rcompare=function(Ut,_i,eo){return yd(_i,Ut,eo)},i.sort=function(Ut,_i){return Ut.sort((function(eo,Ar){return i.compare(eo,Ar,_i)}))},i.rsort=function(Ut,_i){return Ut.sort((function(eo,Ar){return i.rcompare(eo,Ar,_i)}))},i.gt=uu,i.lt=Jm,i.eq=Dh,i.neq=Rp,i.gte=Uv,i.lte=Cr,i.cmp=sx,i.Comparator=Lg;var Nw={};function gp(Ut,_i){if(Ut instanceof gp)return Ut.loose===_i?Ut:new gp(Ut.raw,_i);if(Ut instanceof Lg)return new gp(Ut.value,_i);if(!(this instanceof gp))return new gp(Ut,_i);if(this.loose=_i,this.raw=Ut,this.set=Ut.split(/\s*\|\|\s*/).map((function(eo){return this.parseRange(eo.trim())}),this).filter((function(eo){return eo.length})),!this.set.length)throw new TypeError("Invalid SemVer Range: "+Ut);this.format()}function uf(Ut){return!Ut||Ut.toLowerCase()==="x"||Ut==="*"}function KG(Ut,_i,eo,Ar,na,Rg,wo,tn,Pt,Ke,ye,Be,Tt){return((_i=uf(eo)?"":uf(Ar)?">="+eo+".0.0":uf(na)?">="+eo+"."+Ar+".0":">="+_i)+" "+(tn=uf(Pt)?"":uf(Ke)?"<"+(+Pt+1)+".0.0":uf(ye)?"<"+Pt+"."+(+Ke+1)+".0":Be?"<="+Pt+"."+Ke+"."+ye+"-"+Be:"<="+tn)).trim()}function e6(Ut,_i){for(var eo=0;eo<Ut.length;eo++)if(!Ut[eo].test(_i))return!1;if(_i.prerelease.length){for(eo=0;eo<Ut.length;eo++)if(o(Ut[eo].semver),Ut[eo].semver!==Nw&&Ut[eo].semver.prerelease.length>0){var Ar=Ut[eo].semver;if(Ar.major===_i.major&&Ar.minor===_i.minor&&Ar.patch===_i.patch)return!0}return!1}return!0}function ax(Ut,_i,eo){try{_i=new gp(_i,eo)}catch{return!1}return _i.test(Ut)}function II(Ut,_i,eo,Ar){var na,Rg,wo,tn,Pt;switch(Ut=new ba(Ut,Ar),_i=new gp(_i,Ar),eo){case">":na=uu,Rg=Cr,wo=Jm,tn=">",Pt=">=";break;case"<":na=Jm,Rg=Uv,wo=uu,tn="<",Pt="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(ax(Ut,_i,Ar))return!1;for(var Ke=0;Ke<_i.set.length;++Ke){var ye=_i.set[Ke],Be=null,Tt=null;if(ye.forEach((function(Ht){Ht.semver===Nw&&(Ht=new Lg(">=0.0.0")),Be=Be||Ht,Tt=Tt||Ht,na(Ht.semver,Be.semver,Ar)?Be=Ht:wo(Ht.semver,Tt.semver,Ar)&&(Tt=Ht)})),Be.operator===tn||Be.operator===Pt||(!Tt.operator||Tt.operator===tn)&&Rg(Ut,Tt.semver)||Tt.operator===Pt&&wo(Ut,Tt.semver))return!1}return!0}Lg.prototype.parse=function(Ut){var _i=this.loose?s[ti]:s[bo],eo=Ut.match(_i);if(!eo)throw new TypeError("Invalid comparator: "+Ut);this.operator=eo[1],this.operator==="="&&(this.operator=""),eo[2]?this.semver=new ba(eo[2],this.loose):this.semver=Nw},Lg.prototype.toString=function(){return this.value},Lg.prototype.test=function(Ut){return o("Comparator.test",Ut,this.loose),this.semver===Nw||(typeof Ut=="string"&&(Ut=new ba(Ut,this.loose)),sx(Ut,this.operator,this.semver,this.loose))},Lg.prototype.intersects=function(Ut,_i){if(!(Ut instanceof Lg))throw new TypeError("a Comparator is required");var eo;if(this.operator==="")return eo=new gp(Ut.value,_i),ax(this.value,eo,_i);if(Ut.operator==="")return eo=new gp(this.value,_i),ax(Ut.semver,eo,_i);var Ar=!(this.operator!==">="&&this.operator!==">"||Ut.operator!==">="&&Ut.operator!==">"),na=!(this.operator!=="<="&&this.operator!=="<"||Ut.operator!=="<="&&Ut.operator!=="<"),Rg=this.semver.version===Ut.semver.version,wo=!(this.operator!==">="&&this.operator!=="<="||Ut.operator!==">="&&Ut.operator!=="<="),tn=sx(this.semver,"<",Ut.semver,_i)&&(this.operator===">="||this.operator===">")&&(Ut.operator==="<="||Ut.operator==="<"),Pt=sx(this.semver,">",Ut.semver,_i)&&(this.operator==="<="||this.operator==="<")&&(Ut.operator===">="||Ut.operator===">");return Ar||na||Rg&&wo||tn||Pt},i.Range=gp,gp.prototype.format=function(){return this.range=this.set.map((function(Ut){return Ut.join(" ").trim()})).join("||").trim(),this.range},gp.prototype.toString=function(){return this.range},gp.prototype.parseRange=function(Ut){var _i=this.loose;Ut=Ut.trim(),o("range",Ut,_i);var eo=_i?s[sr]:s[_o];Ut=Ut.replace(eo,KG),o("hyphen replace",Ut),Ut=Ut.replace(s[Ro],"$1$2$3"),o("comparator trim",Ut,s[Ro]),Ut=(Ut=(Ut=Ut.replace(s[Ee],"$1~")).replace(s[Qt],"$1^")).split(/\s+/).join(" ");var Ar=_i?s[ti]:s[bo],na=Ut.split(" ").map((function(Rg){return(function(wo,tn){return o("comp",wo),wo=(function(Pt,Ke){return Pt.trim().split(/\s+/).map((function(ye){return(function(Be,Tt){o("caret",Be,Tt);var Ht=Tt?s[Ti]:s[Ze];return Be.replace(Ht,(function(Do,io,xr,oo,Gr){var Sa;return o("caret",Be,Do,io,xr,oo,Gr),uf(io)?Sa="":uf(xr)?Sa=">="+io+".0.0 <"+(+io+1)+".0.0":uf(oo)?Sa=io==="0"?">="+io+"."+xr+".0 <"+io+"."+(+xr+1)+".0":">="+io+"."+xr+".0 <"+(+io+1)+".0.0":Gr?(o("replaceCaret pr",Gr),Gr.charAt(0)!=="-"&&(Gr="-"+Gr),Sa=io==="0"?xr==="0"?">="+io+"."+xr+"."+oo+Gr+" <"+io+"."+xr+"."+(+oo+1):">="+io+"."+xr+"."+oo+Gr+" <"+io+"."+(+xr+1)+".0":">="+io+"."+xr+"."+oo+Gr+" <"+(+io+1)+".0.0"):(o("no pr"),Sa=io==="0"?xr==="0"?">="+io+"."+xr+"."+oo+" <"+io+"."+xr+"."+(+oo+1):">="+io+"."+xr+"."+oo+" <"+io+"."+(+xr+1)+".0":">="+io+"."+xr+"."+oo+" <"+(+io+1)+".0.0"),o("caret return",Sa),Sa}))})(ye,Ke)})).join(" ")})(wo,tn),o("caret",wo),wo=(function(Pt,Ke){return Pt.trim().split(/\s+/).map((function(ye){return(function(Be,Tt){var Ht=Tt?s[Ve]:s[He];return Be.replace(Ht,(function(Do,io,xr,oo,Gr){var Sa;return o("tilde",Be,Do,io,xr,oo,Gr),uf(io)?Sa="":uf(xr)?Sa=">="+io+".0.0 <"+(+io+1)+".0.0":uf(oo)?Sa=">="+io+"."+xr+".0 <"+io+"."+(+xr+1)+".0":Gr?(o("replaceTilde pr",Gr),Gr.charAt(0)!=="-"&&(Gr="-"+Gr),Sa=">="+io+"."+xr+"."+oo+Gr+" <"+io+"."+(+xr+1)+".0"):Sa=">="+io+"."+xr+"."+oo+" <"+io+"."+(+xr+1)+".0",o("tilde return",Sa),Sa}))})(ye,Ke)})).join(" ")})(wo,tn),o("tildes",wo),wo=(function(Pt,Ke){return o("replaceXRanges",Pt,Ke),Pt.split(/\s+/).map((function(ye){return(function(Be,Tt){Be=Be.trim();var Ht=Tt?s[se]:s[de];return Be.replace(Ht,(function(Do,io,xr,oo,Gr,Sa){o("xRange",Be,Do,io,xr,oo,Gr,Sa);var _r=uf(xr),sl=_r||uf(oo),Dd=sl||uf(Gr);return io==="="&&Dd&&(io=""),_r?Do=io===">"||io==="<"?"<0.0.0":"*":io&&Dd?(sl&&(oo=0),Dd&&(Gr=0),io===">"?(io=">=",sl?(xr=+xr+1,oo=0,Gr=0):Dd&&(oo=+oo+1,Gr=0)):io==="<="&&(io="<",sl?xr=+xr+1:oo=+oo+1),Do=io+xr+"."+oo+"."+Gr):sl?Do=">="+xr+".0.0 <"+(+xr+1)+".0.0":Dd&&(Do=">="+xr+"."+oo+".0 <"+xr+"."+(+oo+1)+".0"),o("xRange return",Do),Do}))})(ye,Ke)})).join(" ")})(wo,tn),o("xrange",wo),wo=(function(Pt,Ke){return o("replaceStars",Pt,Ke),Pt.trim().replace(s[ln],"")})(wo,tn),o("stars",wo),wo})(Rg,_i)})).join(" ").split(/\s+/);return this.loose&&(na=na.filter((function(Rg){return!!Rg.match(Ar)}))),na=na.map((function(Rg){return new Lg(Rg,_i)}))},gp.prototype.intersects=function(Ut,_i){if(!(Ut instanceof gp))throw new TypeError("a Range is required");return this.set.some((function(eo){return eo.every((function(Ar){return Ut.set.some((function(na){return na.every((function(Rg){return Ar.intersects(Rg,_i)}))}))}))}))},i.toComparators=function(Ut,_i){return new gp(Ut,_i).set.map((function(eo){return eo.map((function(Ar){return Ar.value})).join(" ").trim().split(" ")}))},gp.prototype.test=function(Ut){if(!Ut)return!1;typeof Ut=="string"&&(Ut=new ba(Ut,this.loose));for(var _i=0;_i<this.set.length;_i++)if(e6(this.set[_i],Ut))return!0;return!1},i.satisfies=ax,i.maxSatisfying=function(Ut,_i,eo){var Ar=null,na=null;try{var Rg=new gp(_i,eo)}catch{return null}return Ut.forEach((function(wo){Rg.test(wo)&&(Ar&&na.compare(wo)!==-1||(na=new ba(Ar=wo,eo)))})),Ar},i.minSatisfying=function(Ut,_i,eo){var Ar=null,na=null;try{var Rg=new gp(_i,eo)}catch{return null}return Ut.forEach((function(wo){Rg.test(wo)&&(Ar&&na.compare(wo)!==1||(na=new ba(Ar=wo,eo)))})),Ar},i.validRange=function(Ut,_i){try{return new gp(Ut,_i).range||"*"}catch{return null}},i.ltr=function(Ut,_i,eo){return II(Ut,_i,"<",eo)},i.gtr=function(Ut,_i,eo){return II(Ut,_i,">",eo)},i.outside=II,i.prerelease=function(Ut,_i){var eo=Ws(Ut,_i);return eo&&eo.prerelease.length?eo.prerelease:null},i.intersects=function(Ut,_i,eo){return Ut=new gp(Ut,eo),_i=new gp(_i,eo),Ut.intersects(_i)},i.coerce=function(Ut){if(Ut instanceof ba)return Ut;if(typeof Ut!="string")return null;var _i=Ut.match(s[Se]);return _i==null?null:Ws((_i[1]||"0")+"."+(_i[2]||"0")+"."+(_i[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 Vma=kd.exports.SEMVER_SPEC_VERSION,Bma=kd.exports.parse,vke=kd.exports.valid,zYi=kd.exports.coerce,Hma=kd.exports.clean,Uma=kd.exports.inc,zma=kd.exports.major,Kma=kd.exports.minor,Gma=kd.exports.patch,$ma=kd.exports.prerelease,iR=kd.exports.gt,BTt=kd.exports.gte,qma=kd.exports.lt,KYi=kd.exports.lte,HTt=kd.exports.eq,jma=kd.exports.neq,Qma=kd.exports.cmp,Yma=kd.exports.compare,Xma=kd.exports.rcompare,Jma=kd.exports.compareIdentifiers,Zma=kd.exports.rcompareIdentifiers,eha=kd.exports.compareBuild,tha=kd.exports.sort,iha=kd.exports.rsort,oha=kd.exports.diff,nha=kd.exports.validRange,J8e=kd.exports.satisfies,rha=kd.exports.maxSatisfying,sha=kd.exports.minSatisfying,aha=kd.exports.minVersion,lha=kd.exports.gtr,cha=kd.exports.ltr,dha=kd.exports.outside,uha=kd.exports.intersects,pha=kd.exports.SemVer,mha=kd.exports.Comparator,hha=kd.exports.Range;var y1o=a=>d(1999,null,a),GYi=d(2012,null,"ms-dotnettools.csharp"),bke=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=gO.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(1998,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(1997,null,this.location):d(1996,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]=M3e(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]=M3e(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(1986,null,Cn(r))),r}if(n.length)throw new Error(d(1991,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(2010,null,t.length));let o=await this.extensionGalleryService.getExtensions(t,{compatible:!0},ve.None),n=[];for(let s of o)for(let l of e)Ot(l.identifier,s.identifier)&&iR(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(2009,null));return}this.logger.info(d(2008,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(1988,null,s.identifier.id,Cn(s.error))):this.logger.info(d(2005,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=>Ot(h.identifier,{id:l}));if(p){if(!t&&(!c||c==="prerelease"&&p.preRelease))return this.logger.info(d(1983,null,l,p.manifest.version,l)),!1;if(c&&p.manifest.version===c)return this.logger.info(d(1982,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(`${y1o(l?`${s}@${l}`:s)}
${GYi}`),o.push(s);return}try{let h=await this.extensionGalleryService.getManifest(u,ve.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=>Ot(h.identifier,u.identifier));if(p){if(u.version===p.manifest.version){this.logger.info(d(1982,null,l?`${s}@${l}`:s));return}this.logger.info(d(2011,null,s,u.version))}c.isBuiltin?this.logger.info(l?d(1994,null,s,l):d(1993,null,s)):this.logger.info(l?d(1995,null,s,l):d(1992,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(1987,null,l.identifier.id,Cn(l.error))),o.push(l.identifier.id)):this.logger.info(d(2002,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(2006,null,Ye(i)))}catch(s){if(so(s))this.logger.info(d(1985,null,Ye(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)mj.test(r.id)&&n.push({...r,preRelease:t});if(n.length){let r=await this.extensionGalleryService.getExtensions(n,{targetPlatform:o},ve.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:Df(i.publisher,i.name)},r=o.find(s=>Ot(n,s.identifier)&&iR(s.manifest.version,i.version));if(r)return this.logger.info(d(1989,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 Jb(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=>Ot(u.identifier,{id:s}));if(!c.length)throw new Error(`${this.notInstalled(s)}
${GYi}`);if(c.some(u=>u.type===0)){this.logger.info(d(1984,null,s));return}if(!e&&c.some(u=>u.isBuiltin)){this.logger.info(d(1990,null,s));return}this.logger.info(d(2007,null,s));for(let u of c)await this.extensionManagementService.uninstall(u,{profileLocation:t}),n.push(u);this.location?this.logger.info(d(2004,null,s,this.location)):this.logger.info(d(2003,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===Y.file){this.logger.info(o.location.fsPath);return}})})}notInstalled(i){return this.location?d(2001,null,i,this.location):d(2000,null,i)}};bke=I([m(2,ls),m(3,ta),m(4,nt)],bke);var w1o=ls;var Gc=ae("extensionManagementServerService"),Hd=w1o;var Os=ae("extensionEnablementService"),$ha=ae("IWebExtensionsScannerService");var tQe="security.workspace.trust.enabled",Bdi="security.workspace.trust.startupPrompt",Hdi="security.workspace.trust.banner",eQe="security.workspace.trust.untrustedFiles",UTt="security.workspace.trust.emptyWindow",zTt="extensions.supportUntrustedWorkspaces",C1o="content.trust.model.key",Fdi=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}},Ske=class extends C{constructor(e,t){super();this.configurationService=e;this.environmentService=t}isWorkspaceTrustEnabled(){return this.environmentService.disableWorkspaceTrust?!1:!!this.configurationService.getValue(tQe)}};Ske=I([m(0,B),m(1,Vt)],Ske);var Ike=class extends C{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=C1o;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}=TI(),{promise:this._workspaceTrustInitializedPromise,resolve:this._workspaceTrustInitializedPromiseResolve}=TI(),this._storedTrustState=new Vdi(Gt&&this.isEmptyWorkspace()?void 0:this.storageService),this._trustTransitionManager=this._register(new Wdi),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(Y.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===Y.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&&Vje(n,this.environmentService)&&(n=await this.getCanonicalUri(n)),this._canonicalWorkspace=new Fdi(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&&Vje(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(UTt):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?xx(this.workspaceService.getWorkspace())&&e.folders.length===0:!1}isTrustedVirtualResource(e){return gce(e)&&e.scheme!=="vscode-vfs"}isTrustedByRemote(e){return!this.environmentService.remoteAuthority||!this._remoteAuthority?!1:S6(M7(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=VS(this._canonicalWorkspace);if(!$g(e)||e.uri.scheme!==Y.file&&e.uri.scheme!==Y.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=VS(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=VS(this._canonicalWorkspace);if(!$g(t)||t.uri.scheme!==Y.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)}};Ike=I([m(0,B),m(1,Mc),m(2,le),m(3,dt),m(4,Vt),m(5,Pe),m(6,BL),m(7,be)],Ike);var Z8e=class extends C{constructor(e,t){super();this.configurationService=e;this.workspaceTrustManagementService=t;this._resourcesTrustRequestPromises=new vt;this._resourcesTrustRequestResolvers=new vt;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(eQe)}set untrustedFilesSetting(e){this.configurationService.updateValue(eQe,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}H.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()}};Z8e=I([m(0,B),m(1,ns)],Z8e);var Wdi=class extends C{constructor(){super(...arguments);this.participants=new Vs}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()}},Vdi=class{constructor(i){this._acceptsOutOfWorkspaceFilesKey="acceptsOutOfWorkspaceFiles";this._isEmptyWorkspaceTrustedKey="isEmptyWorkspaceTrusted";i?(this._memento=new Bl("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()}};we(Vd,Z8e,1);var xp=ae("extensionManifestPropertiesService"),iQe=class extends C{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 Fd;let r=t.inspect(zTt).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")),Gt&&!o.includes("-web")&&!o.includes("web")&&t.includes("web")&&n.push("web"),n}return t}getUserConfiguredExtensionKind(e){if(this._configuredExtensionKindsMap===null){let o=new Fd,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(Da(n))return n;if(n){let r=n.supported;if(Da(r)||r==="limited")return r}return o?.default!==void 0?o.default:!0}deduceExtensionKind(e){if(e.main)return e.browser?Gt?["workspace","web"]:["workspace"]:["workspace"];if(e.browser)return["web"];let t=[...F8i];if((dr(e.extensionPack)||dr(e.extensionDependencies))&&(t=Gt?["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",Df(e.publisher,e.name)),t}getSupportedExtensionKindsForExtensionPoint(e){if(this._extensionPointExtensionKindsMap===null){let o=new Map;Tn.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:Gt?["workspace","web"]:["workspace"]}getConfiguredExtensionKind(e){let t={id:Df(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 Fd;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=Df(e.publisher,e.name);return this._productExtensionKindsMap.get(t)}getProductVirtualWorkspaceSupport(e){if(this._productVirtualWorkspaceSupportMap===null){let o=new Fd;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=Df(e.publisher,e.name);return this._productVirtualWorkspaceSupportMap.get(t)}getConfiguredVirtualWorkspaceSupport(e){if(this._configuredVirtualWorkspaceSupportMap===null){let o=new Fd,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=Df(e.publisher,e.name);return this._configuredVirtualWorkspaceSupportMap.get(t)}getConfiguredExtensionWorkspaceTrustRequest(e){let t=Df(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=Df(e.publisher,e.name);return this._productExtensionWorkspaceTrustRequestMap.get(t)}toArray(e){return Array.isArray(e)?e:e==="ui"?["ui","workspace"]:[e]}};iQe=I([m(0,nt),m(1,B),m(2,BL),m(3,ne)],iQe);we(xp,iQe,1);qe.registerCommand("_remoteCLI.openExternal",function(a,i){return a.get(Qe).open(Ae(i)?i:A.revive(i),{openExternal:!0,allowTunneling:!0})});qe.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)});qe.registerCommand("_remoteCLI.getSystemStatus",function(a){return a.get(ge).executeCommand("_issues.getSystemStatus")});qe.registerCommand("_remoteCLI.manageExtensions",async function(a,i){let e=a.get(F),o=a.get(Gc).remoteExtensionManagementServer?.extensionManagementService;if(!o)return;let n=[],r=new class extends Zbe{log(l,c){n.push(c)}},s=e.createChild(new Io([ls,o]));try{let l=s.createInstance(oQe,r);if(i.list)await l.listExtensions(!!i.list.showVersions,i.list.category,void 0);else{let c=u=>u.map(p=>Ae(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 oQe=class extends bke{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(Y.vscodeRemote,c):void 0}get location(){return this._location}validateExtensionKind(e){return!this._extensionManifestPropertiesService.canExecuteOnWorkspace(e)&&!(Gt&&this._extensionManifestPropertiesService.canExecuteOnWeb(e))?(this.logger.info(d(3005,null,Jb(e.publisher,e.name))),!1):!0}};oQe=I([m(1,ls),m(2,ta),m(3,ot),m(4,Vt),m(5,xp),m(6,nt)],oQe);var KTt=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)}};KTt=I([vo(Gi.MainThreadClipboard),m(1,Wi),m(2,ne)],KTt);var GTt=class{constructor(i,e,t){this._commandService=e;this._extensionService=t;this._commandRegistrations=new jt;this._proxy=i.getProxy(Zi.ExtHostCommands),this._generateCommandsDocumentationRegistration=qe.registerCommand("_generateCommandsDocumentation",()=>this._generateCommandsDocumentation())}dispose(){this._commandRegistrations.dispose(),this._generateCommandsDocumentationRegistration.dispose()}async _generateCommandsDocumentation(){let i=await this._proxy.$getContributedCommandMetadata(),e=qe.getCommands();for(let[o,n]of e)n.metadata&&(i[o]=n.metadata);let t=[];for(let o in i)t.push("`"+o+"` - "+x1o(i[o]));console.log(t.join(`
`))}$registerCommand(i){this._commandRegistrations.set(i,qe.registerCommand(i,(e,...t)=>this._proxy.$executeContributedCommand(i,...t).then(o=>Xn(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 qh&&(e=e.value);for(let o=0;o<e.length;o++)e[o]=Xn(e[o]);if(t&&e.length>0&&!qe.getCommand(i))throw await this._extensionService.activateByEvent(`onCommand:${i}`),new Error("$executeCommand:retry");return this._commandService.executeCommand(i,...e)}$getCommands(){return Promise.resolve([...qe.getCommands().keys()])}};GTt=I([vo(Gi.MainThreadCommands),m(1,ge),m(2,lt)],GTt);function x1o(a){if(typeof a=="string")return a;{let e=[Ae(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 $Tt=class{constructor(i,e,t,o){this._workspaceContextService=e;this.configurationService=t;this._environmentService=o;let n=i.getProxy(Zi.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=OKi()),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=oe.as(ii.Configuration).getConfigurationProperties();if(t[i]&&(t[i].scope===5||t[i].scope===6))return 6}return 5}};$Tt=I([vo(Gi.MainThreadConfiguration),m(1,Pe),m(2,B),m(3,Co)],$Tt);function qTt(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 k1o(a){if(!a)return a;let i=a.indexOf(`
`);return i===-1?a:a.substring(0,i)}function qYi(a,i){let{args:e,stack:t}=qTt(a),o=typeof e[0]=="string"&&e.length===1,n=k1o(t);n&&(n=`(${n.trim()})`);let r=[];if(typeof e[0]=="string"?n&&o?r=[`%c[${i}] %c${e[0]} %c${n}`,yke("blue"),yke(""),yke("grey")]:r=[`%c[${i}] %c${e[0]}`,yke("blue"),yke(""),...e.slice(1)]:r=[`%c[${i}]%`,yke("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 yke(a){return`color: ${a}`}function jYi(a,i,e=null){let t=qTt(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 QYi(a,i,e){let t=qTt(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 VO(a){let i=a.isExtensionDevelopment,e=!0,t=a.extensionDevelopmentLocationURI;if(t)for(let s of t)s.scheme!==Y.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 jTt=class{constructor(i,e,t){this._environmentService=e;this._logService=t;let o=VO(this._environmentService);this._isExtensionDevTestFromCli=o.isExtensionDevTestFromCli}dispose(){}$logExtensionHostMessage(i){this._isExtensionDevTestFromCli?jYi(this._logService,i):(QYi(this._logService,i,"Extension Host"),qYi(i,"Extension Host"))}};jTt=I([vo(Gi.MainThreadConsole),m(1,Co),m(2,ne)],jTt);var jh="workbench.view.debug",Iz="workbench.debug.variablesView",Yx="workbench.debug.watchExpressionsView",qj="workbench.debug.callStackView",Ace="workbench.debug.loadedScriptsView",Xx="workbench.debug.breakPointsView",QTt="workbench.debug.disassemblyView",YTt="workbench.panel.repl",ld="workbench.panel.repl.view",wke=new Q("debugType",void 0,{type:"string",description:d(9237,null)}),YYi=new Q("debugConfigurationType",void 0,{type:"string",description:d(9228,null)}),Fs=new Q("debugState","inactive",{type:"string",description:d(9236,null)}),Udi="debugUx",hP=new Q(Udi,"default",{type:"string",description:d(9238,null)}),XTt=new Q("hasDebugged",!1,{type:"boolean",description:d(9246,null)}),Xa=new Q("inDebugMode",!1,{type:"boolean",description:d(9248,null)}),BO=new Q("inDebugRepl",!1,{type:"boolean",description:d(9249,null)}),nQe=new Q("breakpointWidgetVisible",!1,{type:"boolean",description:d(9218,null)}),zdi=new Q("inBreakpointWidget",!1,{type:"boolean",description:d(9247,null)}),Cke=new Q("breakpointsFocused",!0,{type:"boolean",description:d(9216,null)}),rQe=new Q("watchExpressionsFocused",!0,{type:"boolean",description:d(9274,null)}),sQe=new Q("watchExpressionsExist",!1,{type:"boolean",description:d(9273,null)}),JTt=new Q("variablesFocused",!0,{type:"boolean",description:d(9270,null)}),FY=new Q("expressionSelected",!1,{type:"boolean",description:d(9242,null)}),ZTt=new Q("breakpointInputFocused",!1,{type:"boolean",description:d(9212,null)}),yv=new Q("callStackItemType",void 0,{type:"string",description:d(9224,null)}),e_t=new Q("callStackSessionIsAttach",!1,{type:"boolean",description:d(9226,null)}),WY=new Q("callStackItemStopped",!1,{type:"boolean",description:d(9223,null)}),Kdi=new Q("callStackSessionHasOneThread",!1,{type:"boolean",description:d(9225,null)}),XYi=new Q("callStackFocused",!0,{type:"boolean",description:d(9222,null)}),yz=new Q("watchItemType",void 0,{type:"string",description:d(9275,null)}),VY=new Q("canViewMemory",void 0,{type:"boolean",description:d(9227,null)}),O_=new Q("breakpointItemType",void 0,{type:"string",description:d(9214,null)}),Gdi=new Q("breakpointItemBytes",void 0,{type:"boolean",description:d(9213,null)}),$di=new Q("breakpointHasModes",!1,{type:"boolean",description:d(9211,null)}),t_t=new Q("breakpointSupportsCondition",!1,{type:"boolean",description:d(9217,null)}),aQe=new Q("loadedScriptsSupported",!1,{type:"boolean",description:d(9254,null)}),JYi=new Q("loadedScriptsItemType",void 0,{type:"string",description:d(9253,null)}),fC=new Q("focusedSessionIsAttach",!1,{type:"boolean",description:d(9243,null)}),wz=new Q("focusedSessionIsNoDebug",!1,{type:"boolean",description:d(9244,null)}),lQe=new Q("stepBackSupported",!1,{type:"boolean",description:d(9259,null)}),i_t=new Q("restartFrameSupported",!1,{type:"boolean",description:d(9257,null)}),o_t=new Q("stackFrameSupportsRestart",!1,{type:"boolean",description:d(9258,null)}),Nce=new Q("jumpToCursorSupported",!1,{type:"boolean",description:d(9251,null)}),BY=new Q("stepIntoTargetsSupported",!1,{type:"boolean",description:d(9260,null)}),jj=new Q("breakpointsExist",!1,{type:"boolean",description:d(9215,null)}),fa=new Q("debuggersAvailable",!1,{type:"boolean",description:d(9231,null)}),n_t=new Q("debugExtensionAvailable",!0,{type:"boolean",description:d(9229,null)}),ZYi=new Q("debugProtocolVariableMenuContext",void 0,{type:"string",description:d(9232,null)}),cQe=new Q("debugSetVariableSupported",!1,{type:"boolean",description:d(9235,null)}),xke=new Q("debugSetDataBreakpointAddressSupported",!1,{type:"boolean",description:d(9233,null)}),dQe=new Q("debugSetExpressionSupported",!1,{type:"boolean",description:d(9234,null)}),Cz=new Q("breakWhenValueChangesSupported",!1,{type:"boolean",description:d(9219,null)}),HY=new Q("breakWhenValueIsAccessedSupported",!1,{type:"boolean",description:d(9220,null)}),UY=new Q("breakWhenValueIsReadSupported",!1,{type:"boolean",description:d(9221,null)}),gP=new Q("terminateDebuggeeSupported",!1,{type:"boolean",description:d(9262,null)}),zY=new Q("suspendDebuggeeSupported",!1,{type:"boolean",description:d(9261,null)}),uQe=new Q("terminateThreadsSupported",!1,{type:"boolean",description:d(9263,null)}),hV=new Q("variableEvaluateNamePresent",!1,{type:"boolean",description:d(9264,null)}),Oce=new Q("variableIsReadonly",!1,{type:"boolean",description:d(9267,null)}),kke=new Q("variableValue",!1,{type:"string",description:d(9272,null)}),KY=new Q("variableType",!1,{type:"string",description:d(9271,null)}),eXi=new Q("variableInterfaces",!1,{type:"array",description:d(9266,null)}),r_t=new Q("variableName",!1,{type:"string",description:d(9269,null)}),tXi=new Q("variableLanguage",!1,{type:"string",description:d(9268,null)}),iXi=new Q("variableExtensionId",!1,{type:"string",description:d(9265,null)}),s_t=new Q("exceptionWidgetVisible",!1,{type:"boolean",description:d(9241,null)}),qdi=new Q("multiSessionRepl",!1,{type:"boolean",description:d(9256,null)}),a_t=new Q("multiSessionDebug",!1,{type:"boolean",description:d(9255,null)}),Eke=new Q("disassembleRequestSupported",!1,{type:"boolean",description:d(9239,null)}),xz=new Q("disassemblyViewFocus",!1,{type:"boolean",description:d(9240,null)}),l_t=new Q("languageSupportsDisassembleRequest",!1,{type:"boolean",description:d(9252,null)}),c_t=new Q("focusedStackFrameHasInstructionReference",!1,{type:"boolean",description:d(9245,null)}),d_t=a=>d(9230,null,a),gV="editor.contrib.debug",fP="editor.contrib.breakpoint",vC="debug",u_t={enum:["neverOpen","openOnSessionStart","openOnFirstSessionStart"],default:"openOnFirstSessionStart",description:d(9250,null)};function oR(a){switch(a){case 1:return"initializing";case 2:return"stopped";case 3:return"running";default:return"inactive"}}var Fce="vscode-debug-memory";function kz(a){let i=a.presentationHint??a.source.presentationHint;return i==="deemphasize"||i==="subtle"}var Li=ae("debugService");var E1o;(e=>(e.deserialize=t=>t,e.serialize=t=>t))(E1o||={});var jdi;(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))(jdi||={});var p_t=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(9210,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 Pi(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 Pi(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 T1o=/{([^}]+)}/g;function nXi(a,i,e){return a.replace(T1o,function(t,o){return i&&o.length>0&&o[0]!=="_"?t:e&&e.hasOwnProperty(o)?e[o]:t})}function rXi(a){let i={};for(let e of Object.keys(a))e.startsWith("!")||(i[e]=a[e]);return i}function Wce(a){return a.configuration.request==="attach"&&!pQe(a)&&(!a.parentSession||Wce(a.parentSession))}function pQe(a){let i=a.configuration.type;if(i)return i==="vslsShare"&&(i=a.configuration.adapterProxy?.configuration?.type||i),mr(i,"extensionhost")||mr(i,"pwa-extensionhost")?a:a.parentSession?pQe(a.parentSession):void 0}function sXi(a){return a.type&&(a.label||a.program||a.runtime)}function _1o(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 m_t(a,i,e,t){if(a.evaluatableExpressionProvider.has(i)){let o=a.evaluatableExpressionProvider.ordered(i),n=si(await Promise.all(o.map(async r=>{try{return await r.provideEvaluatableExpression(i,e,t??ve.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}=_1o(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 D1o=/^[a-zA-Z][a-zA-Z0-9\+\-\.]+:/;function GY(a){return!!(a&&a.match(D1o))}function aXi(a){if(typeof a.path=="string"&&!(typeof a.sourceReference=="number"&&a.sourceReference>0)){if(GY(a.path))return A.parse(a.path);if(Xl(a.path))return A.file(a.path)}return a.path}function lXi(a){if(typeof a.path=="object"){let i=A.revive(a.path);if(i)return i.scheme===Y.file?i.fsPath:i.toString()}return a.path}function cXi(a,i){let e=i?aXi:lXi,t=Xi(a);return uXi(t,(o,n)=>{o&&n&&(n.path=e(n))}),t}function dXi(a,i){let e=i?aXi:lXi,t=Xi(a);return uXi(t,(o,n)=>{!o&&n&&(n.path=e(n))}),t}function uXi(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 Qdi(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):oXi(i.presentation.order,e.presentation.order):-1:e.presentation.group?1:oXi(i.presentation.order,e.presentation.order):-1:e.presentation?1:0)}function oXi(a,i){return typeof a!="number"?typeof i!="number"?0:1:typeof i!="number"?-1:a-i}async function mQe(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===Y.untitled&&await i.save({editor:t.input,groupId:t.group.id})}await a.reloadConfiguration()}var pXi=(a,i)=>!a||!i?a===i:a.name===i.name&&a.path===i.path&&a.sourceReference===i.sourceReference;function h_t(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_t(a,i,e=[]){let t=i.getSession(),o=[[ZYi.key,i.variableMenuContext||""],[hV.key,!!i.evaluateName],[VY.key,!!t?.capabilities.supportsReadMemoryRequest&&i.memoryReference!==void 0],[Oce.key,!!i.presentationHint?.attributes?.includes("readOnly")||i.presentationHint?.lazy],[KY.key,i.type],[wke.key,t?.configuration.type],...e];return a.createOverlay(o)}var f_t=d(9343,null),Ez=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:f_t},this.available=!1,n=`${vC}:${f_t}`),this.uri=hQe(this.raw,n,e,t,o)}get name(){return this.raw.name||Ra(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===vC}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?vn:Un):Promise.resolve(void 0)}static getEncodedDebugData(i){let e,t,o;switch(i.scheme){case Y.file:e=th(i.fsPath);break;case vC: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:Ra(i),path:e,sourceReference:t,sessionId:o}}};function hQe(a,i,e,t,o){let n=r=>typeof a.sourceReference=="number"&&a.sourceReference>0?A.from({scheme:vC,path:r?.replace(/^\/+/g,"/"),query:`session=${e}&ref=${a.sourceReference}`}):r&&GY(r)?t.asCanonicalUri(A.parse(r)):r&&Xl(r)?t.asCanonicalUri(A.file(r)):t.asCanonicalUri(A.from({scheme:vC,path:r,query:`session=${e}`}));try{return n(i)}catch{return o.error("Invalid path from debug adapter: "+i),n("/invalidDebugSource")}}var L1o=Re("disassembly-editor-label-icon",M.debug,d(9344,null)),nR=class a extends Us{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(9345,null)}getIcon(){return L1o}matches(e){return e instanceof a}};var Ho=ae("textFileService");var v_t=class extends As{constructor(e,t,o){super(e,10);this.textFileOperationResult=t;this.options=o}static isTextFileOperationError(e){return e instanceof Error&&!Jn(e.textFileOperationResult)}};function gQe(a){let i=a;return zut(i.setEncoding,i.getEncoding,i.save,i.revert,i.isDirty,i.getLanguageId)}function Tke(a){let i=!1;return{read(){return i?null:(i=!0,a)}}}function mXi(a){if(!(typeof a>"u"))return typeof a=="string"?Je.fromString(a):{read:()=>{let i=a.read();return typeof i=="string"?Je.fromString(i):null}}}var vP=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 Hl(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(Ae(s.value)&&Ae(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 Hl(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 Hl(this.session,this.threadId,this,0,"",void 0,d(9294,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 Hl(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())!==Jc.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(9299,null):Jc.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 Ydi(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)}var rR=class{constructor(i,e,t,o,n){this.session=i;this.visualizer=e;this.treeId=t;this.treeItem=o;this.original=n;this.id=_t()}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}}},Jc=class a extends vP{constructor(e,t=_t()){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(9295,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);Ydi(this,o)}},Hl=class extends vP{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);Ydi(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);Ydi(this,o)}toString(){return this.name?`${this.name}: ${this.value}`:this.value}toJSON(){return{sessionId:this.getSession()?.getId(),container:this.parent instanceof Jc?{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}}},Tz=class extends vP{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}}},vQe=class extends Tz{constructor(i,e,t){super(i,e,t,0,!1)}toString(){return this.name}},NE=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=Vbe(`${t.name}:${t.line}:${t.column}`,o);while(e.has(o));return e.add(o),new Tz(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 vQe(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===f_t?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 nR))return i.openEditor(nR.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)}},P1o=["breakpoint","step","function breakpoint"],bP=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&&(P1o.includes(e)||!kz(o))))}get stateLabel(){return this.stoppedDetails?this.stoppedDetails.description||(this.stoppedDetails.reason?d(9297,null,this.stoppedDetails.reason):d(9296,null)):d(9298,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 $e;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 NE(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)}},hXi=(a,i,e,t="memory")=>A.from({scheme:Fce,authority:a,path:"/"+encodeURIComponent(i)+`/${encodeURIComponent(t)}.bin`,query:e?`?range=${e.fromOffset}:${e.toOffset}`:void 0}),b_t=class extends C{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=Sl(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=Je.alloc(c-s.byteLength);u.buffer.fill(0),s=Je.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,Qd(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})}},Xdi=class{constructor(i,e){this.enabled=i;this.id=e}getId(){return this.id}};function fQe(a,i){return Nu({supportsConditionalBreakpoints:!!i.supportsConditionalBreakpoints,supportsHitConditionalBreakpoints:!!i.supportsHitConditionalBreakpoints,supportsLogPoints:!!i.supportsLogPoints,supportsFunctionBreakpoints:!!i.supportsFunctionBreakpoints,supportsDataBreakpoints:!!i.supportsDataBreakpoints,supportsInstructionBreakpoints:!!i.supportsInstructionBreakpoints},a)}var Vce=class extends Xdi{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=Uo(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}}},wv=class extends Vce{constructor(e,t,o,n,r=_t()){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?hQe(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(9293,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`${Ra(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")&&!Jn(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)}},tI=class extends Vce{constructor(i,e=_t()){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}},ZI=class extends Vce{constructor(e,t=_t()){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}},SP=class extends Vce{constructor(e,t=_t()){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}},iI=class extends Vce{constructor(i,e=_t()){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}},$Y=class{constructor(i,e){this.sessionId=i;this.threadId=e}getId(){return`${this.sessionId}:${this.threadId}`}},_ke=class extends C{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(he(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(he(r=>{this.watchExpressions=e.watchExpressions.read(r),this._onDidChangeWatchExpressions.fire(void 0)})),this._register(KUi(()=>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 Go;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 SP({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 wv({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,fQe(r,t))}}),this.functionBreakpoints.forEach(n=>{if(!o)n.setSessionData(e,void 0);else{let r=o.get(n.getId());r&&n.setSessionData(e,fQe(r,t))}}),this.dataBreakpoints.forEach(n=>{if(!o)n.setSessionData(e,void 0);else{let r=o.get(n.getId());r&&n.setSessionData(e,fQe(r,t))}}),this.exceptionBreakpoints.forEach(n=>{if(!o)n.setSessionData(e,void 0);else{let r=o.get(n.getId());r&&n.setSessionData(e,fQe(r,t))}}),this.instructionBreakpoints.forEach(n=>{if(!o)n.setSessionData(e,void 0);else{let r=o.get(n.getId());r&&n.setSessionData(e,fQe(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()?Ra(e.uri).localeCompare(Ra(t.uri)):e.lineNumber===t.lineNumber?e.column&&t.column?e.column-t.column:1:e.lineNumber-t.lineNumber),this.breakpoints=Uo(this.breakpoints,e=>`${e.uri.toString()}:${e.lineNumber}:${e.column}`)}setEnablement(e,t){if(e instanceof wv||e instanceof tI||e instanceof SP||e instanceof ZI||e instanceof iI){let o=[];e.enabled!==t&&(e instanceof wv||e instanceof tI||e instanceof ZI||e instanceof iI)&&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 tI(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 ZI(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 iI(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 Jc(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)}};_ke=I([m(1,Ho),m(2,dt),m(3,ne)],_ke);var qY=ae("debugVisualizerService"),Zdi=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)}},gXi={object:[],dispose:()=>{}},Dke=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=[];A1o.setHandler((o,{added:n,removed:r})=>{this.registrations=this.registrations.filter(s=>!r.some(l=>Ei.equals(l.description.identifier,s.extensionId))),n.forEach(s=>this.processExtensionRegistration(s.description))})}async getApplicableFor(i,e){if(!(i instanceof Hl))return gXi;let t=i.getThreadId();if(t===void 0)return gXi;let o=this.getVariableContext(t,i),n=g_t(this.contextKeyService,i,[[r_t.key,i.name],[kke.key,i.value],[KY.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(fXi(l.extensionId,l.id));return u&&{handle:u,result:await u.provideDebugVisualizers(o,e)}})),s={object:r.filter(mo).flatMap(l=>l.result.map(c=>new Zdi(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=fXi(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 Hl))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 rR(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 rR(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 Hl?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 Hl;o=o.parent)o.parent instanceof Tz&&(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=x.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)}}};Dke=I([m(0,X),m(1,lt),m(2,ne)],Dke);var fXi=(a,i)=>`${Ei.toKey(a)}\0${i}`,A1o=Tn.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 S_t=class{constructor(i,e,t){this.debugService=e;this.visualizerService=t;this._toDispose=new P;this._debugAdaptersHandleCounter=1;this._visualizerHandles=new Map;this._visualizerTreeHandles=new Map;this._proxy=i.getProxy(Zi.ExtHostDebugService);let o=new jt;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 P,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(H.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 Ei(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(jdi.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 eui(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 Zs(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 Zs(n?n.message:"custom request failed"))):Promise.reject(new Zs("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 Zs("debug session not found"))}$stopDebugging(i){if(i){let e=this.debugService.getModel().getSession(i,!0);if(e)return this.debugService.stopSession(e,Wce(e))}else return this.debugService.stopSession(void 0);return Promise.reject(new Zs("debug session not found"))}$appendDebugConsole(i){this.debugService.getViewModel().focusedSession?.appendToRepl({output:i,sev:gt.Warning})}$acceptDAMessage(i,e){this.getDebugAdapter(i).acceptMessage(dXi(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(mo)}};S_t=I([vo(Gi.MainThreadDebugService),m(1,Li),m(2,qY)],S_t);var eui=class extends p_t{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,cXi(e,!0))}async stopSession(){return await this.cancelPendingRequests(),Promise.resolve(this._proxy.$stopDASession(this._handle))}};var Cv=ae("IFileDecorationsService");var tui=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 Go;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 ho)});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()],ve.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))}},I_t=class{constructor(i,e){this._decorationsService=e;this._provider=new Map;this._proxy=i.getProxy(Zi.ExtHostDecorations)}dispose(){this._provider.forEach(i=>Ue(i)),this._provider.clear()}$registerDecorationProvider(i,e){let t=new E,o=new tui(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&&(Ue(e),this._provider.delete(i))}};I_t=I([vo(Gi.MainThreadDecorations),m(1,Cv)],I_t);var Bce=class{constructor(i,e,t){this._markerService=e;this._uriIdentService=t;this._activeOwners=new Set;this._proxy=i.getProxy(Zi.ExtHostDiagnostics),this._markerListener=this._markerService.onMarkerChanged(this._forwardMarkers,this),this.extHostId=`extHost${Bce.ExtHostCounter++}`}dispose(){this._markerListener.dispose();for(let i of this._activeOwners){let e=new vt;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)}};Bce.ExtHostCounter=1,Bce=I([vo(Gi.MainThreadDiagnostics),m(1,Ns),m(2,dt)],Bce);var Hce=class{constructor(i,e){this._fileDialogService=e}dispose(){}async $showOpenDialog(i){let e=Hce._convertOpenOptions(i);return e.defaultUri||(e.defaultUri=await this._fileDialogService.defaultFilePath()),Promise.resolve(this._fileDialogService.showOpenDialog(e))}async $showSaveDialog(i){let e=Hce._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}};Hce=I([vo(Gi.MainThreadDialogs),m(1,dn)],Hce);var y_t=class{constructor(i,e,t,o,n){this._textModelResolverService=e;this._languageService=t;this._modelService=o;this._editorWorkerService=n;this._resourceContentProvider=new jt;this._pendingUpdate=new Map;this._proxy=i.getProxy(Zi.ExtHostDocumentContentProviders)}dispose(){this._resourceContentProvider.dispose(),Ue(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 $e;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=>An.replace(z.lift(s.range),s.text)))}catch(r){mt(r)}}};y_t=I([vo(Gi.MainThreadDocumentContentProviders),m(1,Nt),m(2,kt),m(3,Ct),m(4,$s)],y_t);var Wa=ae("workingCopyService"),iui=class extends Error{constructor(i,e){super(i),this.name="WorkingCopyLeakError",this.stack=e}},oui=class a extends C{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 vt;this.mapWorkingCopyToListeners=this._register(new jt);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 P;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 iui(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}};we(Wa,oui,1);var Lke=class extends C{constructor(e,t){super();this.logService=e;this.configurationService=t;this.participants=new Vs}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()}};Lke=I([m(0,ne),m(1,B)],Lke);var Rke=class extends C{constructor(e,t){super();this.logService=e;this.progressService=t;this.saveParticipants=new Vs}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 $e(n);e.model?.pushStackElement(),o.report({message:d(17611,null)});let s=!1;if(await this.progressService.withProgress({priority:3,location:15,cancellable:d(17612,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 wa(p,r.token)}catch(p){so(p)?r.token.isCancellationRequested||(r.cancel(),s=!0):this.logService.error(p)}}},()=>{r.cancel()}),e.model?.pushStackElement(),r.dispose(),s)throw new ho}dispose(){this.saveParticipants.clear(),super.dispose()}};Rke=I([m(0,ne),m(1,Bo)],Rke);var kp=ae("workingCopyFileService"),bQe=class extends C{constructor(e,t,o,n){super();this.fileService=e;this.workingCopyService=t;this.uriIdentityService=n;this._onWillRunWorkingCopyFileOperation=this._register(new JH);this.onWillRunWorkingCopyFileOperation=this._onWillRunWorkingCopyFileOperation.event;this._onDidFailWorkingCopyFileOperation=this._register(new JH);this.onDidFailWorkingCopyFileOperation=this._onDidFailWorkingCopyFileOperation.event;this._onDidRunWorkingCopyFileOperation=this._register(new JH);this.onDidRunWorkingCopyFileOperation=this._onDidRunWorkingCopyFileOperation.event;this.correlationIds=0;this.workingCopyProviders=[];this.fileOperationParticipants=this._register(o.createInstance(Lke)),this.saveParticipants=this._register(o.createInstance(Rke)),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 fn.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,ve.None);let l;try{t?l=await fn.settled(e.map(c=>this.fileService.createFile(c.resource,c.contents,{overwrite:c.overwrite}))):l=await fn.settled(e.map(c=>this.fileService.createFolder(c.resource)))}catch(c){throw await this._onDidFailWorkingCopyFileOperation.fireAsync(s,ve.None),c}return await this._onDidRunWorkingCopyFileOperation.fireAsync(s,ve.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,ve.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 fn.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,ve.None),c}return await this._onDidRunWorkingCopyFileOperation.fireAsync(l,ve.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,ve.None);for(let s of e){let l=this.getDirty(s.resource);await fn.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,ve.None),s}await this._onDidRunWorkingCopyFileOperation.fireAsync(r,ve.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=Zm(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)}};bQe=I([m(0,be),m(1,Wa),m(2,F),m(3,dt)],bQe);we(kp,bQe,1);var SQe=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=Ue(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&&Ue(this._data.slice(0,i-this._maxSize))}},nui=class extends C{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}},Mke=class extends C{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 vt;this._modelReferenceCollection=this._store.add(new SQe(l.extUri)),this._proxy=e.getProxy(Zi.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(H.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(){Ue(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 nui(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 Zs("Invalid uri. Scheme and authority or path must be set.");let n=this._uriIdentityService.asCanonicalUri(o),r;switch(n.scheme){case Y.untitled:r=this._handleUntitledScheme(n,t);break;case Y.file:default:r=this._handleAsResourceInput(n,t);break}let s;try{s=await r}catch(l){throw new Zs(`cannot open ${n.toString()}. Detail: ${In(l)}`)}if(s)if(ar.isEqual(s,n)){if(this._modelTrackers.has(n))return n;throw new Zs(`cannot open ${n.toString()}. Detail: Files above 50MB cannot be synchronized with extensions.`)}else throw new Zs(`cannot open ${n.toString()}. Detail: Actual document opened as ${s.toString()}`);else throw new Zs(`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 Zs("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=Og(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()),H.once(o.onDidRevert)(()=>this._modelReferenceCollection.remove(n)),this._proxy.$acceptDirtyStateChanged(n,!0),n}};Mke=I([m(1,Ct),m(2,Ho),m(3,be),m(4,Nt),m(5,Vt),m(6,dt),m(7,kp),m(8,wn)],Mke);var w_t=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 Yt(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}},C_t=class{constructor(i,e,t,o,n,r,s){this._modelListeners=new P;this._codeEditorListeners=new P;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(w_t.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(Yt.liftSelection);this._setProperties(new w_t(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=hKi(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(zh.guessNeedsClipboard(e)){let c=new y1(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=Qr.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 W_(a,i,e=Un){if(e===Un||e===vn||e===hg||e===ym)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],pC(i))}t=a.getGroups(2)[e]}return t?.id??vn}function bC(a,i){let e=typeof i=="number"?a.getGroup(i):i;return a.getGroups(2).indexOf(e??a.activeGroup)}var OE=ae("quickDiff"),IQe=J("editorGutter.modifiedBackground",{dark:"#1B81A8",light:"#2090D3",hcDark:"#1B81A8",hcLight:"#2090D3"},d(13131,null));J("editorGutter.modifiedSecondaryBackground",{dark:Sp(IQe,.5),light:RS(IQe,.7),hcDark:"#1B81A8",hcLight:"#2090D3"},d(13132,null));var yQe=J("editorGutter.addedBackground",{dark:"#487E02",light:"#48985D",hcDark:"#487E02",hcLight:"#48985D"},d(13125,null));J("editorGutter.addedSecondaryBackground",{dark:Sp(yQe,.5),light:RS(yQe,.7),hcDark:"#487E02",hcLight:"#48985D"},d(13126,null));var wQe=J("editorGutter.deletedBackground",av,d(13127,null));J("editorGutter.deletedSecondaryBackground",{dark:Sp(wQe,.4),light:RS(wQe,.3),hcDark:"#F48771",hcLight:"#B5200D"},d(13128,null));var Pke=J("minimapGutter.modifiedBackground",IQe,d(13135,null)),Ake=J("minimapGutter.addedBackground",yQe,d(13133,null)),Nke=J("minimapGutter.deletedBackground",wQe,d(13134,null)),jY=J("editorOverviewRuler.modifiedForeground",ei(IQe,.6),d(13138,null)),QY=J("editorOverviewRuler.addedForeground",ei(yQe,.6),d(13136,null)),YY=J("editorOverviewRuler.deletedForeground",ei(wQe,.6),d(13137,null)),zCa=J("editorGutter.itemGlyphForeground",{dark:od,light:od,hcDark:Oe.black,hcLight:Oe.white},d(13130,null)),KCa=J("editorGutter.itemBackground",{dark:W$(xf,qo),light:Sp(W$(xf,qo),.05),hcDark:Oe.white,hcLight:Oe.black},d(13129,null));function CQe(a){return a.originalEndLineNumber===0?1:a.modifiedEndLineNumber===0?2:0}function vXi(a,i){switch(i){case 0:return a.getColor(IQe);case 1:return a.getColor(yQe);case 2:return a.getColor(wQe)}}function x_t(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 bXi(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 xQe(a){return a.modifiedEndLineNumber===0?a.modifiedStartLineNumber===0?1:a.modifiedStartLineNumber:a.modifiedEndLineNumber}function SXi(a,i){return a===1&&i.modifiedStartLineNumber===0&&i.modifiedEndLineNumber===0?!0:a>=i.modifiedStartLineNumber&&a<=(i.modifiedEndLineNumber||i.modifiedStartLineNumber)}var Uce="workbench.view.scm",Af="workbench.scm",k_t="workbench.scm.repositories",IP="workbench.scm.history";var $c=ae("scm");var au=ae("scmView");var dl=ae("chatEditingService");function Qj(a){return new Promise(i=>{ux(e=>{a.state.read(e)!==0&&(e.dispose(),i())})})}function E_t(a,i){return{originalURI:a,modifiedURI:i,added:0,removed:0,quitEarly:!1,identical:!1,isFinal:!1,isBusy:!1}}var _z="chat-editing-multi-diff-source",sR=new Q("chatEditingWidgetFileState",void 0,d(7595,null)),IXi=new Q("chatEditingAgentSupportsReadonlyReferences",void 0,d(7594,null)),kQe=new Q("decidedChatEditingResource",[]),Oke=new Q("chatEditingResource",void 0),T_t=new Q("inChatEditingSession",void 0),Zx=new Q("hasUndecidedChatEditingResource",!1),zce=new Q("hasAppliedChatEdits",!1),Yj=new Q("applyingChatEditsFailed",!1);function yXi(a){return typeof a=="object"&&!!a&&Wo(a,{sessionResource:!0})}function wXi(a,i){return A.from({scheme:_z,authority:b$(Je.fromString(a.chatSessionResource.toString())),query:i?"previous":void 0})}function EQe(a){let i=A.parse(Fbe(a.authority).toString()),e=a.query==="previous";return{chatSessionResource:i,showPreviousChanges:e}}var HO=ae("IQuickDiffModelService"),N1o={algorithm:"advanced",maxComputationTimeMs:1e3},TQe=class extends Ww{constructor(e){super();this._instantiationService=e}createReferencedObject(e,t,o){return this._instantiationService.createInstance(_Qe,t,o)}destroyReferencedObject(e,t){t.dispose()}};TQe=I([m(0,F)],TQe);var Fke=class{constructor(i,e,t){this.instantiationService=i;this.textFileService=e;this.uriIdentityService=t;this._references=this.instantiationService.createInstance(TQe)}createQuickDiffModelReference(i,e=N1o){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)}};Fke=I([m(0,F),m(1,Ho),m(2,dt)],Fke);var _Qe=class extends C{constructor(e,t,o,n,r,s,l,c,u){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._originalEditorModels=new vt;this._originalEditorModelsDisposables=this._register(new P);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 jt;this._model=e,this._register(e.textEditorModel.onDidChangeContent(()=>this.triggerDiff())),this._register(H.filter(s.onDidChangeConfiguration,p=>p.affectsConfiguration("scm.diffDecorationsIgnoreTrimWhitespace")||p.affectsConfiguration("diffEditor.ignoreTrimWhitespace"))(this.triggerDiff,this)),this._register(o.onDidAddRepository(this.onDidAddRepository,this));for(let p of o.repositories)this.onDidAddRepository(p);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(he(p=>{for(let h of this._chatEditingService.editingSessionsObs.read(p))p.store.add(he(g=>{for(let f of h.entries.read(g))f.state.read(g);this.triggerDiff()}))})),this.triggerDiff()}get originalTextModels(){return ht.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 P;t.add(e.provider.onDidChangeResources(this.triggerDiff,this));let o=H.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=eGe(this.changes,t,(r,s)=>x_t(r.change,s.change));this._allChanges=e,this._changes=t,this._quickDiffChanges=o,this._onDidChange.fire({changes:t,diff:n})}diff(){return this.progressService.withProgress({location:3,delay:250},async()=>{let e=await this.getQuickDiffsPromise();if(this._disposed||this._model.isDisposed()||e.length===0)return Promise.resolve({allChanges:[],changes:[],mapChanges:new Map});let t=e.filter(h=>this.editorWorkerService.canComputeDirtyDiff(h.originalResource,this._model.resource));if(t.length===0)return Promise.resolve({allChanges:[],changes:[],mapChanges:new Map});let o=t.find(h=>h.kind==="primary"),n=this.configurationService.getValue("scm.diffDecorationsIgnoreTrimWhitespace"),r=n==="inherit"?this.configurationService.getValue("diffEditor.ignoreTrimWhitespace"):n!=="false",s=[],l=[];for(let h of t){let g=await this._diff(h.originalResource,this._model.resource,r);if(g.changes&&g.changes2&&g.changes.length===g.changes2.length)for(let f=0;f<g.changes.length;f++){let v=g.changes2[f];if(o&&h.kind==="secondary"){let b=s.find(S=>S.change2.modified.equals(v.modified)&&S.change2.original.length===v.original.length);if(b){let y=this._originalEditorModels.get(o.originalResource)?.textEditorModel?.getValueInRange(b.change2.toRangeMapping().originalRange),k=this._originalEditorModels.get(h.originalResource)?.textEditorModel?.getValueInRange(v.toRangeMapping().originalRange);if(y===k){l.push({providerId:h.id,original:h.originalResource,modified:this._model.resource,change:g.changes[f],change2:g.changes2[f]});continue}}}s.push({providerId:h.id,original:h.originalResource,modified:this._model.resource,change:g.changes[f],change2:g.changes2[f]})}}let c=s.sort((h,g)=>x_t(h.change,g.change)),u=[...s,...l].sort((h,g)=>x_t(h.change,g.change)),p=new Map;for(let h=0;h<c.length;h++){let g=c[h].providerId;p.has(g)||p.set(g,[]),p.get(g).push(h)}return{allChanges:u,changes:c,mapChanges:p}})}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?pii(Tae.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),gQe(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(xQe(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(xQe(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()}};_Qe=I([m(2,$c),m(3,OE),m(4,$s),m(5,B),m(6,Nt),m(7,dl),m(8,Bo)],_Qe);var XY=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 P;this._instanceId=String(++XY.INSTANCE_COUNT),this._proxy=e.getProxy(Zi.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=>{Ue(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(he(n=>{let r=o.read(n);this._proxy.$acceptEditorDiffInformation(e,r)})),this._textEditorsListenersMap[e]=t}handleTextEditorRemoved(i){Ue(this._textEditorsListenersMap[i]),delete this._textEditorsListenersMap[i]}_updateActiveAndVisibleTextEditors(){let i=this._getTextEditorPositionData();uo(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]=bC(this._editorGroupService,e.group))}return i}_getTextEditorDiffInformation(i,e){let t=i.getCodeEditor();if(!t)return Oo(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=Ce(s=>{let l=n.read(s);if(!l)return Oo(void 0);if(U6(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})))):Oo(void 0)}let c=this._configurationService.getValue("diffEditor.diffAlgorithm"),u=this._quickDiffModelService.createQuickDiffModelReference(l.modified.uri,{algorithm:c});return u?(e.push(u),ui(H.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)})):Oo(void 0)});return hs({owner:this,equalsFn:(s,l)=>$i(s,l,(c,u)=>qKi(this._uriIdentityService,c,u))},s=>{let l=n.read(s),c=r.read(s).read(s);if(!l||!c)return;let u=U6(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,W_(this._editorGroupService,this._configurationService,e.position));if(!r)return;let s=r.getControl(),l=ca(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}},W_(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(Br(`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(Br(`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(Br(`TextEditor(${i})`))}$tryRevealRange(i,e,t){let o=this._editorLocator.getEditor(i);return o?(o.revealRange(e,t),Promise.resolve()):Promise.reject(Br(`TextEditor(${i})`))}$trySetOptions(i,e){let t=this._editorLocator.getEditor(i);return t?(t.setConfiguration(e),Promise.resolve(void 0)):Promise.reject(Br(`TextEditor(${i})`))}$tryApplyEdits(i,e,t,o){let n=this._editorLocator.getEditor(i);return n?Promise.resolve(n.applyEdits(e,t,o)):Promise.reject(Br(`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(Br(`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()}}};XY=I([m(2,Kt),m(3,ee),m(4,Et),m(5,B),m(6,HO),m(7,dt)],XY);qe.registerCommand("_workbench.revertAllDirty",async function(a){if(!a.get(Co).extensionTestsLocationURI)throw new Error("Command is only available when running extension tests.");let e=a.get(Wa);for(let t of e.dirtyWorkingCopies)await t.revert({soft:!0})});var ys=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}},aui=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 ht.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}};oe.add(rn.EditorPane,new aui);function CXi(a,i){let e=a.get(ee),t=a.get(dt),o=a.get(Wa);return new Promise(n=>{let r=[...i],s=e.onDidCloseEditor(async l=>{if(l.context===2)return;let c=no.getOriginalUri(l.editor,{supportSideBySide:1}),u=no.getOriginalUri(l.editor,{supportSideBySide:2});if(l.context===1){let p=no.getOriginalUri(e.activeEditor,{supportSideBySide:1}),h=no.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===Y.untitled&&t.extUri.isEqual(p,c.with({scheme:p.scheme}))||u?.scheme===Y.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 fn.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 JY(a,i,e,t){let o=a.getAriaLabel();return e&&!e.isPinned(a)&&(o=d(3495,null,o)),e?.isSticky(i??a)&&(o=d(3494,null,o)),e&&typeof t=="number"&&t>1&&(o=`${o}, ${e.ariaLabel}`),o}var Xj=class extends Jd{constructor(e,t,o){super(t);this.id=e;this.memento=new Bl(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 Wke=class extends Xj{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=Oi(this.getContainer()),t=this._register(Vn(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 as)),this.actionRunner}updateTitleArea(){this._onTitleAreaUpdate.fire()}isVisible(){return this.visible}getControl(){}},D_t=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)}},L_t=class extends C{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 Kce=class{constructor(i){this.defaultValue=i}verify(i){return this.isType(i)?i:this.defaultValue}},Qp=class extends Kce{isType(i){return typeof i=="boolean"}},Vke=class extends Kce{isType(i){return typeof i=="number"}},R_t=class extends Kce{isType(i){return i instanceof Set}},SC=class extends Kce{constructor(i,e){super(i),this.allowedValues=e}isType(i){return this.allowedValues.includes(i)}},DQe=class extends Kce{constructor(e,t){super(e);this.verifier=t}verify(e){return this.isType(e)?cui(this.verifier,e):this.defaultValue}isType(e){return yi(e)}};function cui(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 FE=new ai(220,70),Jj=new ai(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),Ja={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 xXi(a){return a.affectsConfiguration("workbench.editor")||a.affectsConfiguration("workbench.iconTheme")||a.affectsConfiguration("window.density")}function dui(a,i){let e={...Ja,hasIcons:i.getFileIconTheme().hasFileIcons},t=a.getValue();if(t?.workbench?.editor)if(Object.assign(e,t.workbench.editor),yi(t.workbench.editor.autoLockGroups)){e.autoLockGroups=Ja.autoLockGroups;for(let[n,r]of Object.entries(t.workbench.editor.autoLockGroups))r===!0&&e.autoLockGroups.add(n)}else e.autoLockGroups=Ja.autoLockGroups;let o=a.getValue();return o?.window?.density?.editorTabHeight&&(e.tabHeight=o.window.density.editorTabHeight),O1o(e)}function O1o(a){return typeof a.showTabs=="boolean"&&(a.showTabs=a.showTabs?"multiple":"single"),cui({wrapTabs:new Qp(Ja.wrapTabs),scrollToSwitchTabs:new Qp(Ja.scrollToSwitchTabs),highlightModifiedTabs:new Qp(Ja.highlightModifiedTabs),tabActionCloseVisibility:new Qp(Ja.tabActionCloseVisibility),tabActionUnpinVisibility:new Qp(Ja.tabActionUnpinVisibility),showTabIndex:new Qp(Ja.showTabIndex),alwaysShowEditorActions:new Qp(Ja.alwaysShowEditorActions),pinnedTabsOnSeparateRow:new Qp(Ja.pinnedTabsOnSeparateRow),focusRecentEditorAfterClose:new Qp(Ja.focusRecentEditorAfterClose),showIcons:new Qp(Ja.showIcons),enablePreview:new Qp(Ja.enablePreview),enablePreviewFromQuickOpen:new Qp(Ja.enablePreviewFromQuickOpen),enablePreviewFromCodeNavigation:new Qp(Ja.enablePreviewFromCodeNavigation),closeOnFileDelete:new Qp(Ja.closeOnFileDelete),closeEmptyGroups:new Qp(Ja.closeEmptyGroups),revealIfOpen:new Qp(Ja.revealIfOpen),swipeToNavigate:new Qp(Ja.swipeToNavigate),mouseBackForwardToNavigate:new Qp(Ja.mouseBackForwardToNavigate),restoreViewState:new Qp(Ja.restoreViewState),splitOnDragAndDrop:new Qp(Ja.splitOnDragAndDrop),allowDropIntoGroup:new Qp(Ja.allowDropIntoGroup),dragToOpenWindow:new Qp(Ja.dragToOpenWindow),centeredLayoutFixedWidth:new Qp(Ja.centeredLayoutFixedWidth),hasIcons:new Qp(Ja.hasIcons),tabSizingFixedMinWidth:new Vke(Ja.tabSizingFixedMinWidth),tabSizingFixedMaxWidth:new Vke(Ja.tabSizingFixedMaxWidth),showTabs:new SC(Ja.showTabs,["multiple","single","none"]),tabActionLocation:new SC(Ja.tabActionLocation,["left","right"]),tabSizing:new SC(Ja.tabSizing,["fit","shrink","fixed"]),pinnedTabSizing:new SC(Ja.pinnedTabSizing,["normal","compact","shrink"]),tabHeight:new SC(Ja.tabHeight,["default","compact"]),preventPinnedEditorClose:new SC(Ja.preventPinnedEditorClose,["keyboardAndMouse","keyboard","mouse","never"]),titleScrollbarSizing:new SC(Ja.titleScrollbarSizing,["default","large"]),titleScrollbarVisibility:new SC(Ja.titleScrollbarVisibility,["auto","visible","hidden"]),openPositioning:new SC(Ja.openPositioning,["left","right","first","last"]),openSideBySideDirection:new SC(Ja.openSideBySideDirection,["right","down"]),labelFormat:new SC(Ja.labelFormat,["default","short","medium","long"]),splitInGroupLayout:new SC(Ja.splitInGroupLayout,["vertical","horizontal"]),splitSizing:new SC(Ja.splitSizing,["distribute","split","auto"]),doubleClickTabToToggleEditorGroupSizes:new SC(Ja.doubleClickTabToToggleEditorGroupSizes,["maximize","expand","off"]),editorActionsLocation:new SC(Ja.editorActionsLocation,["default","titleBar","hidden"]),autoLockGroups:new R_t(Ja.autoLockGroups),limit:new DQe(Ja.limit,{enabled:new Qp(Ja.limit.enabled),value:new Vke(Ja.limit.value),perEditorGroup:new Qp(Ja.limit.perEditorGroup),excludeDirty:new Qp(Ja.limit.excludeDirty)}),decorations:new DQe(Ja.decorations,{badges:new Qp(Ja.decorations.badges),colors:new Qp(Ja.decorations.colors)})},a)}function uui(a,i,e){return!i||!a.activeEditor||i.matches(a.activeEditor)?{...e,viewState:a.activeEditorPane?.getViewState()}:e||Object.create(null)}function ZY(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=si([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 pa=class a extends Wke{constructor(e,t,o,n,r){super(e,o,n,r);this.group=t;this.onDidChangeSizeConstraints=H.None;this._onDidChangeControl=this._register(new E);this.onDidChangeControl=this._onDidChangeControl.event}static{this.EDITOR_MEMENTOS=new Map}get minimumWidth(){return FE.width}get maximumWidth(){return Jj.width}get minimumHeight(){return FE.height}get maximumHeight(){return Jj.height}get input(){return this._input}get options(){return this._options}get window(){return qv(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 pui(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()}},pui=class a extends C{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),Ta(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){Ta(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],mf(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,H.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(Xe(e,l))c=t;else{let p=Dbe(l.path,e.path);c=je(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 Ta(e)?e.resource:e}doLoad(){if(!this.cache){this.cache=new il(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],mf(n)&&e.delete(o))}}};var zO=class extends pa{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 jt)),this.editorViewStateDisposables.has(e)||this.editorViewStateDisposables.set(e,H.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(no.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}};zO=I([m(3,Te),m(4,F),m(5,le),m(6,Nn),m(7,De),m(8,ee),m(9,Et)],zO);var aR=class extends zO{constructor(e,t,o,n,r,s,l,c,u,p){super(e,t,aR.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(H.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=yi(e.editor)?Xi(e.editor):Object.create(null);return Object.assign(t,this.getConfigurationOverrides(e)),t.ariaLabel=this.computeAriaLabel(),t}computeAriaLabel(){return this.input?JY(this.input,void 0,this.group,this.editorGroupService.count):d(4049,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 mui(t)}}async setInput(e,t,o,n){await super.setInput(e,t,o,n),this.inputListener.value=e.onDidChangeCapabilities(()=>this.onDidChangeInputCapabilities(e)),this.updateEditorConfiguration(),Oi(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=$Ge(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()}};aR=I([m(2,Te),m(3,F),m(4,le),m(5,Nn),m(6,De),m(7,ee),m(8,Et),m(9,be)],aR);var mui=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 ds=ae("paneCompositePartService");var RQe="views",MQe=d(4796,null),Bke=Re("default-view-icon",M.window,d(4793,null)),on;(e=>(e.ViewContainersRegistry="workbench.registry.view.containers",e.ViewsRegistry="workbench.registry.view"))(on||={});function WE(a){switch(a){case 0:return"sidebar";case 1:return"panel";case 2:return"auxiliarybar";case 3:return"chatbar"}}var hui=class extends C{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},$H(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)}};oe.add(on.ViewContainersRegistry,new hui);function F1o(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 gui=class extends C{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 KH}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(F1o)}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(4794,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}};oe.add(on.ViewsRegistry,new gui);var Ri=ae("viewDescriptorService");var Zj=class{constructor(i,e){this.resolved=!1;this._hasResolve=!1;Nu(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}}},A_t=class extends Error{constructor(e){super(d(4795,null,e));this.name="NoTreeViewError"}static is(e){return!!e&&e.name==="NoTreeViewError"}};var fui=class{constructor(i){this.editor=i;this.id=`${i.getId()},${i.getModel().id}`}},NQe=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}},AQe=class{constructor(i,e,t){this.documents=i;this.textEditors=e;this.activeEditor=t}static compute(i,e){if(!i)return new NQe([],[...e.documents.values()],[],[...e.textEditors.values()],void 0,e.activeEditor);let t=HH(i.documents,e.documents),o=X2e(i.textEditors,e.textEditors),n=i.activeEditor!==e.activeEditor?i.activeEditor:void 0,r=i.activeEditor!==e.activeEditor?e.activeEditor:void 0;return new NQe(t.removed,t.added,o.removed,o.added,n,r)}};var PQe=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 P;this._toDisposeOnEditorRemove=new jt;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),H.filter(this._paneCompositeService.onDidPaneCompositeOpen,r=>r.viewContainerLocation===1)(r=>this._activeEditorOrder=1,void 0,this._toDispose),H.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(),hn(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 AQe(this._currentState.documents.add(i),this._currentState.textEditors,this._currentState.activeEditor),this._onDidChangeState(new NQe([],[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 fui(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 AQe(e,t,o),r=AQe.compute(this._currentState,n);r.isEmpty||(this._currentState=n,this._onDidChangeState(r))}_getActiveEditorFromPanel(){let i=this._paneCompositeService.getActivePaneComposite(1);if(i instanceof aR){let e=i.getControl();if(pn(e))return e}}_getActiveEditorFromEditorPart(){let i=this._editorService.activeTextEditorControl;return Ec(i)&&(i=i.getModifiedEditor()),i}};PQe=I([m(1,Ct),m(2,Kt),m(3,ee),m(4,ds)],PQe);var N_t=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 P;this._textEditors=new Map;this._proxy=i.getProxy(Zi.ExtHostDocumentsAndEditors),this._mainThreadDocuments=this._toDispose.add(new Mke(i,this._modelService,this._textFileService,r,s,u,h,p,f)),i.set(Gi.MainThreadDocuments,this._mainThreadDocuments),this._mainThreadEditors=this._toDispose.add(new XY(this,i,n,this._editorService,this._editorGroupService,v,b,h)),i.set(Gi.MainThreadTextEditors,this._mainThreadEditors),this._toDispose.add(new PQe(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 C_t(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 bC(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)}};N_t=I([QL,m(1,Ct),m(2,Ho),m(3,ee),m(4,Kt),m(5,be),m(6,Nt),m(7,Et),m(8,ds),m(9,Vt),m(10,kp),m(11,dt),m(12,Wi),m(13,wn),m(14,B),m(15,HO)],N_t);var vui={LEFT:"left",RIGHT:"right",FIRST:"first",LAST:"last"};function OQe(a){let i=a;return!!(i&&typeof i=="object"&&Array.isArray(i.editors)&&Array.isArray(i.mru))}function kXi(a){let i=a;return i.kind===5&&i.editorIndex!==void 0}function EXi(a){let i=a;return i.kind===7&&i.editorIndex!==void 0&&i.oldEditorIndex!==void 0}function TXi(a){let i=a;return i.kind===6&&i.editorIndex!==void 0&&i.context!==void 0&&i.sticky!==void 0}var yP=class extends C{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;OQe(e)?this._id=this.deserialize(e):this._id=yP.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===vui.FIRST?(p=0,!o&&this.isSticky(p)&&(p=this.sticky+1)):this.editorOpenPositioning===vui.LAST?p=this.editors.length:(this.editorOpenPositioning===vui.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 P;this.editorListeners.add(t),t.add(H.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)&&(Ue(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 ga&&!(e instanceof ga))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 ga&&!(t instanceof ga))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(yP,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=oe.as(rn.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=oe.as(rn.EditorFactory);return typeof e.id=="number"?(this._id=e.id,yP.IDS=Math.max(e.id+1,yP.IDS)):this._id=yP.IDS++,e.locked&&(this.locked=!0),this.editors=si(e.editors.map((o,n)=>{let r,s=t.getEditorSerializer(o.id);if(s){let l=s.deserialize(this.instantiationService,o.value);l instanceof Us&&(r=l,this.registerEditorListeners(r))}return!r&&typeof e.sticky=="number"&&n<=e.sticky&&e.sticky--,r})),this.mru=si(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(){Ue(Array.from(this.editorListeners)),this.editorListeners.clear(),this.transient.clear(),super.dispose()}};yP=I([m(1,F),m(2,B)],yP);var t5=class extends rw{constructor(i,e,t,o,n){super(t,e,o,n,i)}dispose(){this.textEditorModelHandle&&this.modelService.destroyModel(this.textEditorModelHandle),super.dispose()}};t5=I([m(1,kt),m(2,Ct),m(3,eS),m(4,Bi)],t5);var ek=class extends IY{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!==Y.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)}};ek=I([m(2,ee),m(3,Ho),m(4,ot),m(5,be),m(6,lr),m(7,Nn),m(8,Sv)],ek);var IC=class extends ek{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 IC.ID}get editorId(){return Ys.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 t5))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"?lae(e):void 0,t),n}matches(e){return this===e?!0:e instanceof IC?Xe(e.resource,this.resource):QS(e)?super.matches(e):!1}dispose(){this.modelReference&&(this.modelReference.then(e=>e.dispose()),this.modelReference=void 0),this.cachedModel=void 0,super.dispose()}};IC=I([m(5,Nt),m(6,Ho),m(7,ee),m(8,be),m(9,ot),m(10,lr),m(11,Nn),m(12,Sv)],IC);var W1o=Re("chat-editor-label-icon",M.chatSparkle,d(7492,null)),Va=class extends Us{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===Y.vscodeChatEditor){let l=Sui.parse(e);if(!l||typeof l!="number")throw new Error("Invalid chat URI")}else if(e.scheme===Y.vscodeLocalChatSession){if(!cs.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 Sui.getNewEditorUri()}showConfirm(){return!!(this.model&&_Xi(this.model))}transferOutEditingSession(){return this.didTransferOutEditingSession=!0,this.model?.editingSession}async confirm(e){if(!this.model?.editingSession||this.didTransferOutEditingSession||this.getSessionType()!==qp)return 0;let t=d(7491,null),o=d(7488,null);return await FQe(this.model,this.dialogService,{titleOverride:t,messageOverride:o})?0:2}get editorId(){return Va.EditorID}get capabilities(){return super.capabilities|1024|128}copy(){return this.instantiationService.createInstance(Va,Va.getNewEditorUri(),{})}matches(e){return e instanceof Va?Xe(this.sessionResource,e.sessionResource):!1}get typeId(){return Va.TypeID}getName(){if(this.model?.title)return this.model.hasCustomTitle?this.model.title:oN(this.model.title,uYi);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(7493,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===qp?void 0:this.chatSessionsService.getAllChatSessionContributions().find(n=>n.type===e)?.displayName}getIcon(){let e=this.resolveIcon();return e?(this.cachedIcon=e,e):W1o}resolveIcon(){let e=this.getSessionType();if(e!==qp){let t=this.chatSessionsService.getIconForSessionType(e);if(t)return t}}getSessionType(){return fg(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",ve.None),!this.model&&cs.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 bui(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}};Va=I([m(2,Si),m(3,ct),m(4,Ls),m(5,F)],Va);var bui=class extends C{constructor(e){super();this.model=e;this._isResolved=!1}async resolve(){this._isResolved=!0}isResolved(){return this._isResolved}isDisposed(){return this._store.isDisposed}},Sui;(t=>{let a=Y.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})(Sui||={});var O_t=class{canSerialize(i){return i instanceof Va&&!!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=Xn(JSON.parse(e));if(t.sessionResource){let n=A.revive(t.sessionResource);return i.createInstance(Va,n,t.options)}let o=A.revive(t.resource);return o.scheme===Y.vscodeChatEditor&&t.sessionId&&(o=cs.forSession(t.sessionId)),i.createInstance(Va,o,t.options)}catch{return}}};async function FQe(a,i,e){let t=_Xi(a,e);if(!t)return!0;let o=d(7489,null),n=d(7490,null),r=e?.messageOverride??o,s=e?.titleOverride??n,{result:l}=await i.prompt({title:s,message:r+" "+d(7487,null,t),type:"info",cancelButton:!0,buttons:[{label:d(7485,null),run:async()=>(await a.editingSession.accept(),!0)},{label:d(7486,null),run:async()=>(await a.editingSession.reject(),!0)}]});return!!l}function _Xi(a,i){return!a.editingSession||a.willKeepAlive&&!i?.isArchiveAction?0:a.editingSession.entries.get().filter(o=>o.state.get()===0).length}var W_t=Object.freeze({id:"application",order:100,title:d(4538,null),type:"object"}),Cm=Object.freeze({id:"workbench",order:7,title:d(4546,null),type:"object"}),WQe=Object.freeze({id:"security",scope:1,title:d(4544,null),type:"object",order:7}),V_t=Object.freeze({id:"problems",title:d(4540,null),type:"object",order:101}),yui=Object.freeze({id:"window",order:8,title:d(4545,null),type:"object"}),rp={ConfigurationMigration:"base.contributions.configuration.migration"},Iui=class{constructor(){this.migrations=[];this._onDidRegisterConfigurationMigrations=new E;this.onDidRegisterConfigurationMigration=this._onDidRegisterConfigurationMigrations.event}registerConfigurationMigrations(i){this.migrations.push(...i)}},F_t=new Iui;oe.add(rp.ConfigurationMigration,F_t);var $ce=class extends C{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,F_t.migrations)})),this.migrateConfigurations(F_t.migrations),this._register(F_t.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})=>uo(h,r))?.value:p.value},l=await e.migrateFn(o,s);return Array.isArray(l)?l:[[e.key,l]]}};$ce=I([m(0,B),m(1,Pe)],$ce);var i5=class extends C{constructor(e){super();this.remoteAgentService=e;this._ready=new Go;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(!ri&&(await this.remoteAgentService.getEnvironment())?.os!==1)return;oe.as(ii.Configuration).registerConfiguration({...WQe,properties:{"security.allowedUNCHosts":{type:"array",items:{type:"string",pattern:"^[^\\\\]+$",patternErrorMessage:d(4542,null)},default:[],markdownDescription:d(4541,null),scope:3},"security.restrictUNCAccess":{type:"boolean",default:!0,markdownDescription:d(4543,null),scope:3}}})}};i5=I([m(0,yo)],i5);var wP="window.newWindowProfile",qce=class extends C{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(wP)&&this.setNewWindowProfile()})),this._register(this.userDataProfilesService.onDidChangeProfiles(()=>this.checkAndResetNewWindowProfileConfig()))}static{this.ID="workbench.contrib.dynamicWindowConfiguration"}registerNewWindowProfileConfiguration(){let e=oe.as(ii.Configuration),t={...yui,properties:{[wP]:{type:["string","null"],default:null,enum:[...this.userDataProfilesService.profiles.map(o=>o.name),null],enumItemLabels:[...this.userDataProfilesService.profiles.map(()=>""),d(4537,null)],description:d(4539,null),scope:1}}};this.configurationNode?e.updateConfigurations({add:[t],remove:[this.configurationNode]}):e.registerConfiguration(t),this.configurationNode=t}setNewWindowProfile(){let e=this.configurationService.getValue(wP);this.newWindowProfile=e?this.userDataProfilesService.profiles.find(t=>t.name===e):void 0}checkAndResetNewWindowProfileConfig(){let e=this.configurationService.getValue(wP);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(wP,t?.name)}};qce=I([m(0,an),m(1,B)],qce);var ul=ae("editorResolverService"),wui="workbench.editorAssociations",V1o=oe.as(ii.Configuration),B1o={...Cm,properties:{"workbench.editorAssociations":{type:"object",markdownDescription:d(16803,null),additionalProperties:{type:"string"}}}};V1o.registerConfiguration(B1o);function lR(a){switch(a){case"exclusive":return 5;case"default":return 4;case"builtin":return 3;default:return 1}}function eX(a,i){if(new Set([Y.extension,Y.webviewPanel,Y.vscodeWorkspaceTrust,Y.vscodeSettings]).has(i.scheme))return!1;let o=typeof a=="string"&&a.indexOf(Lo.sep)>=0?`${i.scheme}:${i.path}`:Ye(i);return Cp(a,o,{ignoreCase:!0})}var tX=ae("customEditorService"),DXi=new Q("activeCustomEditorId","",{type:"string",description:d(8572,null)}),LXi=new Q("focusedCustomEditorIsEditable",!1);var VQe=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&&eX(e.filenamePattern,i))}},Hke=class{constructor(i){this.allEditors=Uo(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||H1o(e,i));default:return!1}})}get bestAvailableEditor(){return Array.from(this.allEditors).sort((e,t)=>lR(e.priority)-lR(t.priority))[0]}};function H1o(a,i){return lR(a.priority)<lR(i.priority)}var iX=class extends C{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 wu=class extends Us{constructor(e,t,o){super();this._themeService=o;this._resourceId=_t();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 wu.typeId}get editorId(){return this.viewType}get capabilities(){return 138}get resource(){return A.from({scheme:Y.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:Ip(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)}};wu=I([m(2,De)],wu);var oi=ae("hostService");var fi=nc;function fV(a){return a===2||a===3}function KO(a){switch(a){case 0:return"left";case 1:return"right";case 2:return"bottom";case 3:return"top";default:return"bottom"}}var z1o={[KO(0)]:0,[KO(1)]:1,[KO(2)]:2,[KO(3)]:3};function RXi(a){return z1o[a]}function Cui(a){switch(a){case 0:return"always";case 1:return"never";case 2:return"preserve";default:return"preserve"}}var KLa={[Cui(0)]:0,[Cui(1)]:1,[Cui(2)]:2};function kui(a,i,e){if(!rwe(a))return!1;let t=wS(i),o=eO(a);if(!Gt){let r=a.getValue("window.customTitleBarVisibility");if(r==="never"&&o||r==="windowed"&&t)return!1}if(!K1o(a))return!0;if(o&&Mae(a))return!1;if(it&&kr)return!t;if(kr&&!t||dGe()&&!t)return!0;switch(Cy(i)?"hidden":Hje(a)){case"classic":return!t||!!e;case"compact":case"hidden":return!1;case"toggle":return!!e;case"visible":return!0;default:return Gt?!1:!t||!!e}}function K1o(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 MXi=new Q("activeWebviewPanelId","",{type:"string",description:d(15889,null)}),cR=class extends pa{constructor(e,t,o,n,r,s,l,c,u){super(cR.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 P);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(H.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 wu?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-${_t()}`,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&&!Gt&&(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 wu&&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 wu&&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 wu&&(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),vN(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 iX(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;Ao(o)?n=o:n=this._workbenchLayoutService.getContainer(this.window,"workbench.parts.editor"),e.layoutWebviewOverElement(this._element.parentElement,t,n)}trackFocus(e){let t=new P,o=Vn(e.container);return t.add(o),t.add(o.onDidFocus(()=>this._onDidFocusWebview.fire())),t.add(e.onDidFocus(()=>this._onDidFocusWebview.fire())),t}};cR=I([m(1,Te),m(2,De),m(3,le),m(4,Et),m(5,ee),m(6,fi),m(7,oi),m(8,X)],cR);var V_=ae("webviewEditorService");function B_t(a,i){return a.canResolve(i)}var o5=class extends wu{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=xn(e=>this._webviewWorkbenchService.resolveWebview(this,e));try{await this._resolvePromise}catch(e){if(!so(e))throw e}}return super.resolve()}transfer(e){if(super.transfer(e))return e._resolved=this._resolved,e}};I([mi],o5.prototype,"resolve",1),o5=I([m(2,De),m(3,V_)],o5);var Eui=class{constructor(){this._awaitingRevival=[]}enqueueForRestoration(i,e){let t=new Go,o=()=>{let r=this._awaitingRevival.findIndex(s=>i===s.input);r>=0&&this._awaitingRevival.splice(r,1)},n=hn(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})=>B_t(i,o));this._awaitingRevival=this._awaitingRevival.filter(({input:o})=>!B_t(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()})}},Uke=class extends C{constructor(e,t,o,n){super();this._editorService=t;this._instantiationService=o;this._webviewService=n;this._revivers=new Set;this._revivalPool=new Eui;this._onDidChangeActiveWebviewEditor=this._register(new E);this.onDidChangeActiveWebviewEditor=this._onDidChangeActiveWebviewEditor.event;this._register(e.registerContextKeyProvider({contextKey:MXi,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 wu?t=e:e instanceof Fa&&(e.primary instanceof wu?t=e.primary:e.secondary instanceof wu&&(t=e.secondary)),t?.webview.providedViewType??""}updateActiveWebview(){let e=this._editorService.activeEditor,t;e instanceof wu?t=e:e instanceof Fa&&(e.primary instanceof wu&&e.primary.webview===this._webviewService.activeWebview?t=e.primary:e.secondary instanceof wu&&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(wu,{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 Fa&&(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(o5,{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 $e;return this._revivalPool.reviveFor(e,t.token),Z(()=>{this._revivers.delete(e),t.dispose(!0)})}shouldPersist(e){return e instanceof o5?!0:ht.some(this._revivers.values(),t=>B_t(t,e))}async tryRevive(e,t){for(let o of this._revivers.values())if(B_t(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)}};Uke=I([m(0,Et),m(1,ee),m(2,F),m(3,wm)],Uke);var Gm=ae("workingCopyBackupService");var CP="";var Dz=!1,_ui=class{constructor(i,e,t){this.id=i;this.dependencies=e;this.callback=t}};var Dui=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 _ui(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(`${Y.vscodeFileResource}://${u9t}`))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=_t();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}}},Tui=new Map;async function bg(a,i,e){e===void 0&&(e=!!(globalThis._VSCODE_PRODUCT_JSON??globalThis.vscode?.context?.configuration()?.product)?.commit);let t=i?`${a}/${i}`:a;if(Tui.has(t))return Tui.get(t);let o;if(/^\w[\w\d+.-]*:\/\//.test(t))o=t;else{let l=`${Dz&&e&&!Gt?b6:sN}/${t}`;o=gn.asBrowserUri(l).toString(!0)}let n=Dui.INSTANCE.load(o);return Tui.set(t,n),n}function H_t(a,i){let t=!!(globalThis._VSCODE_PRODUCT_JSON??globalThis.vscode?.context?.configuration()?.product)?.commit,o=Dz&&t&&!Gt,n=`${a}/${i}`,s=`${o?b6:sN}/${n}`;return gn.asBrowserUri(s).toString(!0)}var mb="utf8",vV="utf8bom",n5="utf16be",r5="utf16le";var U_t=[254,255],Lui=[255,254],BQe=[239,187,191],G1o=512,$1o=512,q1o=512*8,j1o=512*128;var Rui=class extends Error{constructor(e,t){super(e);this.decodeStreamErrorKind=t}},Mui=class a{constructor(i){this.iconvLiteDecoder=i}static async create(i){let e;if(i!==mb)e=(await bg("@vscode/iconv-lite-umd","lib/iconv-lite-umd.js")).getDecoder(Pui(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 PXi(a,i){let e=i.minBytesRequiredForDetection??(i.guessEncoding?q1o:$1o);return new Promise((t,o)=>{let n=_I(p=>p.join("")),r=[],s=0,l,c=new $e,u=async()=>{try{let p=await zke({buffer:Je.concat(r),bytesRead:s},i.guessEncoding,i.candidateGuessEncodings);if(p.seemsBinary&&i.acceptTextOnly)throw new Rui("Stream is binary but only text is accepted for decoding",1);p.encoding=await i.overwriteEncoding(p.encoding),l=await Mui.create(p.encoding);let h=l.write(Je.concat(r).buffer);n.write(h),r.length=0,s=0,t({stream:n,detected:p})}catch(p){c.cancel(),n.destroy(),o(p)}};j0(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 AXi(a,i,e){let o=(await bg("@vscode/iconv-lite-umd","lib/iconv-lite-umd.js")).getEncoder(Pui(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 mb:case vV:return Je.wrap(Uint8Array.from(BQe));case n5:return Je.wrap(Uint8Array.from(U_t));case r5:return Je.wrap(Uint8Array.from(Lui))}let l=o.end();return l&&l.length>0?(n=!0,Je.wrap(l)):null}return n=!0,Je.wrap(o.write(s))}}}async function NXi(a){return(await bg("@vscode/iconv-lite-umd","lib/iconv-lite-umd.js")).encodingExists(Pui(a))}function Pui(a){return a===vV||a===null?mb:a}function Q1o(a,i){if(!a||i<U_t.length)return null;let e=a.readUInt8(0),t=a.readUInt8(1);if(e===U_t[0]&&t===U_t[1])return n5;if(e===Lui[0]&&t===Lui[1])return r5;if(i<BQe.length)return null;let o=a.readUInt8(2);return e===BQe[0]&&t===BQe[1]&&o===BQe[2]?vV:null}var Y1o=["ascii","utf-16","utf-32"];async function X1o(a,i){let e=await bg("jschardet","dist/jschardet.min.js"),t=a.slice(0,j1o),o=tzo(t.buffer);i&&(i=si(i.map(s=>ezo(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<=Y1o.indexOf(r)?null:Z1o(n.encoding)}var J1o={ibm866:"cp866",big5:"cp950"};function OXi(a){return a.replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}function Z1o(a){let i=OXi(a);return J1o[i]||i}function ezo(a){let i=OXi(a),e=HQe[i];return e?e.guessableName:void 0}function tzo(a){let i="";for(let e=0;e<a.length;e++)i+=String.fromCharCode(a[e]);return i}function zke({buffer:a,bytesRead:i},e,t){let o=Q1o(a,i),n=!1;if(o!==n5&&o!==r5&&a){let r=!0,s=!0,l=!1;for(let c=0;c<i&&c<G1o;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=r5:s?o=n5:n=!0)}return e&&!n&&!o&&a?X1o(a.slice(0,i),t).then(r=>({seemsBinary:!1,encoding:r})):{seemsBinary:n,encoding:o}}var aw={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}},HQe=(()=>{let a={};for(let i in aw)aw[i].guessableName&&(a[i]=aw[i]);return a})();var B_=class extends rw{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=CP;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===B_.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(lae(""))}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:mb}):typeof this.initialValue=="string"&&(t=Nbe(Je.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=WT(Je.fromString(this.initialValue||""));let s=await W9(await this.textFileService.getDecodedStream(this.resource,n,{encoding:mb}));this.createTextEditorModel(s,this.resource,this.preferredLanguageId),e=!0}let o=Oi(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<=B_.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:B_.FIRST_LINE_NAME_CANDIDATE_MAX_LENGTH+1}).trim().replace(/\s+/g," ").replace(/\u202E/g,"");o=o.substr(0,vpt(o,B_.FIRST_LINE_NAME_MAX_LENGTH)[0]),o&&E$().exec(o)&&(t=o),t!==this.cachedModelFirstLineWords&&(this.cachedModelFirstLineWords=t,this._onDidChangeName.fire())}isReadonly(){return!1}};B_=I([m(5,kt),m(6,Ct),m(7,Gm),m(8,Nn),m(9,Wa),m(10,Ho),m(11,ot),m(12,ee),m(13,eS),m(14,Bi)],B_);var H_=ae("untitledTextEditorService"),jce=class extends C{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 UD)}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:Y.untitled,authority:e.associatedResource.authority,fragment:e.associatedResource.fragment,path:e.associatedResource.path,query:e.associatedResource.query}),t.associatedResource=e.associatedResource):e.untitledResource?.scheme===Y.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:Y.untitled,path:`Untitled-${n}`}),n++;while(this.mapResourceToModel.has(t))}let o=this.instantiationService.createInstance(B_,t,!!e.associatedResource,e.initialValue,e.languageId,e.encoding);return this.registerModel(o),o}registerModel(e){let t=new P;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))),H.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===Y.untitled&&e.path.length>1&&!jce.UNTITLED_WITHOUT_ASSOCIATED_RESOURCE_REGEX.test(e.path)}canDispose(e){return e.isDisposed()?!0:this.doCanDispose(e)}async doCanDispose(e){return e.isDirty()?(await H.toPromise(e.onDidChangeDirty),this.canDispose(e)):!0}notifyDidSave(e,t){this._onDidSave.fire({source:e,target:t})}};jce=I([m(0,F),m(1,B)],jce);we(H_,jce,1);var Yp=class extends o5{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(H_).get(t.resource),c=l?.textEditorModel?.getValue(),u=c?Je.fromString(c):void 0;l?.revert();let p=r.get(wm).createWebviewOverlay({providedViewType:t.viewType,title:t.webviewTitle,options:{customClasses:n?.customClasses},contentOptions:{},extension:void 0}),h=e.createInstance(Yp,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 Yp.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===Y.untitled&&(e|=4),e}getName(){let e=this.getWebviewTitle();return e||(this._editorName??=this.customEditorLabelService.getName(this.resource)??No(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 Yp&&this.viewType===e.viewType&&Xe(this.resource,e.resource)}copy(){return Yp.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 Xe(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(Oi(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 Oi(this._modelRef),this.undoRedoService.undo(this.resource)}redo(){return Oi(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 Aj(d(8569,null),[pi({id:"openInOriginalWindow",label:d(8570,null),run:async()=>{let n=this.editorGroupsService.getPart(this.layoutService.getContainer(Me(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&&Me(this.webview.container).vscodeWindowId!==e?d(8568,null,this.getName()):!0}};Yp=I([m(3,De),m(4,V_),m(5,F),m(6,ot),m(7,tX),m(8,dn),m(9,Cl),m(10,be),m(11,lr),m(12,Et),m(13,fi),m(14,Sv)],Yp);var Kke=ae("IInteractiveDocumentService"),z_t=class extends C{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 $O=ae("IInteractiveHistoryService"),K_t=class extends C{constructor(){super(),this._history=new vt}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 zq([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 zq([e],50));return}}clearHistory(i){this._history.delete(i)}has(i){return!!this._history.has(i)}};var Zg=class extends Us{constructor(e,t,o,n,r,s,l,c,u,p,h){let g=ha.getOrCreate(r,e,void 0,"interactive",{});super();this._notebookService=u;this._fileDialogService=p;this.isScratchpad=h.getValue(ft.InteractiveWindowPromptToSave)!==!0,this._notebookEditorInput=g,this._register(this._notebookEditorInput),this.name=o??Zg.windowNames[e.path]??No(e.path,Am(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(Zg,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 Zg.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=H.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??Fr;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=je(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 Zg?Xe(this.resource,e.resource)&&Xe(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}};Zg=I([m(4,F),m(5,Nt),m(6,Kke),m(7,$O),m(8,un),m(9,dn),m(10,B)],Zg);var Qh=class a extends ro{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 FXi={start:"<<<<<<<",end:">>>>>>>"};var Lz=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 Aui([this]).toEdits(i)}},G_t=class{constructor(i,e){this.range=i;this.newText=e}equals(i){return z.equalsRange(this.range,i.range)&&this.newText===i.newText}},Aui=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 WXi(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 UQe(a){return a.startLineNumber===a.endLineNumber?new Zl(0,a.endColumn-a.startColumn):new Zl(a.endLineNumber-a.startLineNumber,a.endColumn-1)}function $_t(a,i){return a.lineNumber===i.lineNumber?new Zl(0,i.column-a.column):new Zl(i.lineNumber-a.lineNumber,i.column-1)}function zQe(a,i){return i.lineCount===0?new Ie(a.lineNumber,a.column+i.columnCount):new Ie(a.lineNumber+i.lineCount,i.columnCount+1)}function Nui(a,i){return a.endLineNumber<i.startLineNumber||a.endLineNumber===i.startLineNumber&&a.endColumn<=i.startColumn}var xP=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 ni;let e=i.startLineNumber-this.inputRange.startLineNumber,t=i.endLineNumberExclusive-this.inputRange.endLineNumberExclusive;return new a(i,Qh.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)}},qO=class a{constructor(i,e){this.lineRangeMappings=i;this.inputLineCount=e;eh(()=>Ty(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=KQe.compute(i,e).map(r=>new xP(r.output1Range,r.output2Range));return new a(n,t)}project(i){let e=ju(this.lineRangeMappings,n=>n.inputRange.startLineNumber<=i);if(!e)return new xP(Qh.fromLength(i,1),Qh.fromLength(i,1));if(e.inputRange.contains(i))return e;let t=Qh.fromLength(i,1),o=Qh.fromLength(i+e.outputRange.endLineNumberExclusive-e.inputRange.endLineNumberExclusive,1);return new xP(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)}},KQe=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=tl(u=>u.inputRange.startLineNumber,qd),o=Out(i.map(u=>({source:0,diff:u})),e.map(u=>({source:1,diff:u}))).sort(tl(u=>u.diff,t)),n=[new Array,new Array],r=[0,0],s=new Array;function l(u){let p=xP.join(n[0])||new xP(u,u.delta(r[0])),h=xP.join(n[1])||new xP(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}`}},s5=class a extends xP{constructor(e,t,o,n,r){super(e,o);this.inputTextModel=t;this.outputTextModel=n;this.rangeMappings=r||[new bV(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 Lz(this.inputRange,this.getOutputLines())}getReverseLineEdit(){return new Lz(this.outputRange,this.getInputLines())}getOutputLines(){return this.outputRange.getLines(this.outputTextModel)}getInputLines(){return this.inputRange.getLines(this.inputTextModel)}},bV=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)}},Qce=class a{constructor(i,e){this.rangeMappings=i;this.inputLineCount=e;eh(()=>Ty(i,(t,o)=>Nui(t.inputRange,o.inputRange)&&Nui(t.outputRange,o.outputRange)))}project(i){let e=ju(this.rangeMappings,n=>n.inputRange.getStartPosition().isBeforeOrEqual(i));if(!e)return new bV(z.fromPositions(i,i),z.fromPositions(i,i));if(WXi(e.inputRange,i))return e;let t=$_t(e.inputRange.getEndPosition(),i),o=zQe(e.outputRange.getEndPosition(),t);return new bV(z.fromPositions(i),z.fromPositions(o))}projectRange(i){let e=this.project(i.getStartPosition()),t=this.project(i.getEndPosition());return new bV(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 Yce=class{constructor(i,e){this.editorWorkerService=i;this.configurationService=e;this.mergeAlgorithm=pr("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 s5(VXi(p.original),i,VXi(p.modified),e,p.innerChanges?.map(h=>izo(h)))),c=i.getVersionId(),u=e.getVersionId();return n!==c||r!==u?{diffs:null}:(eh(()=>l.length===0||l[0].inputRange.startLineNumber===l[0].outputRange.startLineNumber&&Ty(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})}};Yce=I([m(0,$s),m(1,B)],Yce);function VXi(a){return Qh.fromLength(a.startLineNumber,a.length)}function izo(a){return new bV(a.originalRange,a.modifiedRange)}var oX=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 ni("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 Gke=class extends C{constructor(e,t,o){super();this.baseTextModel=e;this.textModel=t;this.diffComputer=o;this._recomputeCount=0;this._state=Le(this,1);this._diffs=Le(this,[]);this._barrier=new oX;this._isDisposed=!1;this._isInitializing=!0;let n=Wc("recompute");this._register(he(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),Ui(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&&Ui(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 ni("Cannot remove diffs when the model is not up to date")}removeDiffs(e,t,o){this.ensureUpToDate(),e.sort(tl(r=>r.inputRange.startLineNumber,qd)),e.reverse();let n=this._diffs.get();for(let r of e){let s=n.length;if(n=n.filter(l=>l!==r),s===n.length)throw new ni;this._barrier.runExclusivelyOrThrow(()=>{let l=r.getReverseLineEdit().toEdits(this.textModel.getLineCount());this.textModel.pushEditOperations(null,l,()=>null,o)}),n=n.map(l=>l.outputRange.isAfter(r.outputRange)?l.addOutputLineDelta(r.inputRange.length-r.outputRange.length):l)}this._diffs.set(n,t,0)}applyEditRelativeToOriginal(e,t,o){this.ensureUpToDate();let n=new s5(e.range,this.baseTextModel,Qh.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 ni("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 Lz(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),Qh.fromLineNumbers(o,n)}};function BXi(a,i){Object.entries(i).forEach(([e,t])=>{a.style.setProperty(e,ozo(t))})}function ozo(a){return typeof a=="number"?`${a}px`:a}function qke(a,i){let e=new P,t=[];return e.add(XD({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*HXi(a,i,e){let t=new bS(i);for(let o of a){t.takeWhile(r=>Fw.isGreaterThan(e(o,r)));let n=t.takeWhile(r=>Fw.isNeitherLessOrGreaterThan(e(o,r)));yield{left:o,rights:n||[]}}}function*q_t(a,i,e){let t=new bS(i);for(let o of a){let n=t.takeWhile(s=>Fw.isGreaterThan(e(o,s)));n&&(yield{rights:n});let r=t.takeWhile(s=>Fw.isNeitherLessOrGreaterThan(e(o,s)));yield{left:o,rights:r||[]}}}function j_t(a,i){return Object.assign(a,i)}function Q_t(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]=Q_t(e[t],o):e[t]=o}return e}var $ke=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)}};$ke=I([m(1,le)],$ke);var Y_t=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=s5.join(this.input1Diffs),this.input2CombinedDiff=s5.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 ni("must have at least one diff")}static fromDiffs(i,e,t,o,n){return KQe.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:oS.base};if(e.length===1)return{edit:e[0].diff.getLineEdit(),effectiveState:oS.base.withInputValue(e[0].inputNumber,!0,!1)};if(i.kind!==3)throw new ni;let t=i.smartCombination?this.smartCombineInputs(i.firstInput):this.dumbCombineInputs(i.firstInput);return t?{edit:t,effectiveState:i}:{edit:e[Oui(i.firstInput)-1].diff.getLineEdit(),effectiveState:oS.base.withInputValue(Oui(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=Out(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(Wut(tl(n=>n.diff.inputRange,z.compareRangesUsingStarts),tl(n=>n.input===i?1:2,qd))).map(n=>{let r=n.input===1?this.input1TextModel:this.input2TextModel;return new G_t(n.diff.inputRange,r.getValueInRange(n.diff.outputRange))}),o=nzo(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 Lz(this.baseRange,e.concat(t));return i===1?this.dumbInput1LineRangeEdit=o:this.dumbInput2LineRangeEdit=o,o}};function nzo(a,i,e){let t="",o=a.startLineNumber>1,n=o?new Ie(a.startLineNumber-1,e.getLineMaxColumn(a.startLineNumber-1)):new Ie(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 Ie(a.endLineNumberExclusive,1):new Ie(a.endLineNumberExclusive-1,1073741824),l=e.getValueInRange(z.fromPositions(n,s));t+=l;let c=mc(t);if(o){if(c[0]!=="")return;c.shift()}if(r){if(c[c.length-1]!=="")return;c.pop()}return new Lz(a,c)}function Oui(a){return a===1?2:1}var Xce=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}},GQe=class extends Xce{get kind(){return 0}toString(){return"base"}swap(){return this}withInputValue(i,e,t=!1){return i===1?e?new jke:this:e?new Jce:this}equals(i){return i.kind===0}},jke=class extends Xce{get kind(){return 1}get includesInput1(){return!0}toString(){return"1\u2713"}swap(){return new Jce}withInputValue(i,e,t=!1){return i===1?e?this:new GQe:e?new X_t(1,t):new Jce}equals(i){return i.kind===1}},Jce=class a extends Xce{get kind(){return 2}get includesInput2(){return!0}toString(){return"2\u2713"}swap(){return new jke}withInputValue(i,e,t=!1){return i===2?e?this:new GQe:e?new X_t(2,t):new a}equals(i){return i.kind===2}},X_t=class a extends Xce{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(Oui(this.firstInput),this.smartCombination)}withInputValue(e,t,o=!1){return t?this:e===1?new Jce:new jke}equals(e){return e.kind===3&&this.firstInput===e.firstInput&&this.smartCombination===e.smartCombination}getInput(e){return e===this.firstInput?1:2}},Fui=class extends Xce{get kind(){return 4}toString(){return"unrecognized"}swap(){return this}withInputValue(i,e,t=!1){return e?i===1?new jke:new Jce:this}equals(i){return i.kind===4}},oS;(e=>(e.base=new GQe,e.unrecognized=new Fui))(oS||={});var Zce=class extends gg{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 Gke(this.base,this.input1.textModel,this.diffComputer)),this.input2TextModelDiffs=this._register(new Gke(this.base,this.input2.textModel,this.diffComputer)),this.resultTextModelDiffs=this._register(new Gke(this.base,this.resultTextModel,this.diffComputer)),this.modifiedBaseRanges=Ce(this,h=>{let g=this.input1TextModelDiffs.diffs.read(h),f=this.input2TextModelDiffs.diffs.read(h);return Y_t.fromDiffs(g,f,this.base,this.input1.textModel,this.input2.textModel)}),this.modifiedBaseRangeResultStates=Ce(this,h=>new Map(this.modifiedBaseRanges.read(h).map(f=>[f,new J_t(f)]))),this.resultSnapshot=this.resultTextModel.createSnapshot(),this.baseInput1Diffs=this.input1TextModelDiffs.diffs,this.baseInput2Diffs=this.input2TextModelDiffs.diffs,this.baseResultDiffs=this.resultTextModelDiffs.diffs,this.input1ResultMapping=Ce(this,h=>this.getInputResultMapping(this.baseInput1Diffs.read(h),this.baseResultDiffs.read(h),this.input1.textModel.getLineCount())),this.resultInput1Mapping=Ce(this,h=>this.input1ResultMapping.read(h).reverse()),this.input2ResultMapping=Ce(this,h=>this.getInputResultMapping(this.baseInput2Diffs.read(h),this.baseResultDiffs.read(h),this.input2.textModel.getLineCount())),this.resultInput2Mapping=Ce(this,h=>this.input2ResultMapping.read(h).reverse()),this.baseResultMapping=Ce(this,h=>{let g=new qO(this.baseResultDiffs.read(h),-1);return new qO(g.lineRangeMappings.map(f=>f.inputRange.isEmpty||f.outputRange.isEmpty?new xP(f.inputRange.deltaStart(-1),f.outputRange.deltaStart(-1)):f),g.inputLineCount)}),this.resultBaseMapping=Ce(this,h=>this.baseResultMapping.read(h).reverse()),this.diffComputingState=Ce(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=Ce(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=Ce(this,h=>this.diffComputingState.read(h)===2),this.firstRun=!0,this.unhandledConflictsCount=Ce(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(lU(this.modifiedBaseRangeResultStates)),this._register(lU(this.input1ResultMapping)),this._register(lU(this.input2ResultMapping));let p=this.initialize();this.onInitialized=gf(this.diffComputingState,h=>h===2).then(async()=>{await p}),p.then(()=>{let h=!0;this._register(xM({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);Ui(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 gf(this.inputDiffComputingState,t=>t===2);let e=this.modifiedBaseRangeResultStates.get();Ui(t=>{for(let[o,n]of e){let r,s=!1;o.input1Diffs.length===0?(r=oS.base.withInputValue(2,!0),s=!0):o.input2Diffs.length===0?(r=oS.base.withInputValue(1,!0),s=!0):o.isEqualChange?(r=oS.base.withInputValue(1,!0),s=!0):(r=oS.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,Qh.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,Qh.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=qO.betweenOutputs(e,t,o);return new qO(n.lineRangeMappings.map(r=>r.inputRange.isEmpty||r.outputRange.isEmpty?new xP(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 Qce(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 Qce(o.flatMap(r=>r.rangeMappings),0).projectRange(t).outputRange}getLineRangeInResult(e,t){return this.resultTextModelDiffs.getResultLineRange(e,t)}translateResultRangeToBase(e){return new Qce(this.baseResultDiffs.get().flatMap(o=>o.rangeMappings),0).reverse().projectRange(e).outputRange}translateBaseRangeToResult(e){return new Qce(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=HXi(t,e,(r,s)=>r[0].baseRange.intersectsOrTouches(s.inputRange)?Fw.neitherLessOrGreaterThan:Qh.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 oS.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 oS.base.withInputValue(1,!0);if(n(e.input2Diffs))return oS.base.withInputValue(2,!0);let r=[oS.base.withInputValue(1,!0).withInputValue(2,!0,!0),oS.base.withInputValue(2,!0).withInputValue(1,!0,!0),oS.base.withInputValue(1,!0).withInputValue(2,!0,!1),oS.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 oS.unrecognized}getState(e){let t=this.modifiedBaseRangeResultStates.get().get(e);if(!t)throw new ni("object must be from this instance");return t.accepted}setState(e,t,o,n,r=!1){if(!this.isUpToDate.get())throw new ni("Cannot set state while updating");let s=this.modifiedBaseRangeResultStates.get().get(e);if(!s)throw new ni("object must be from this instance");let l=this.resultTextModelDiffs.findTouchingDiffs(e.baseRange),c=new R9;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 Wui(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(){Ui(e=>{this.resultTextModel.pushStackElement();for(let t of this.modifiedBaseRanges.get())this.getState(t).get().kind===4&&this.setState(t,oS.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(J_t),l=new WeakRef(this);this.undoRedoService.pushElement({type:0,resource:this.resultTextModel.uri,code:"setInputHandled",label:d(11529,null),redo(){let c=l.deref(),u=s.deref();c&&!c.isDisposed()&&u&&Ui(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&&Ui(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 gf(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,Qh.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,Qh.fromLineNumbers(l,e.length+1)),r.join(`
`)}get conflictCount(){return U_(this.modifiedBaseRanges.get(),e=>e.isConflicting)}get combinableConflictCount(){return U_(this.modifiedBaseRanges.get(),e=>e.isConflicting&&e.canBeCombined)}get conflictsResolvedWithBase(){return U_(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>e.isConflicting&&t.accepted.get().kind===0)}get conflictsResolvedWithInput1(){return U_(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>e.isConflicting&&t.accepted.get().kind===1)}get conflictsResolvedWithInput2(){return U_(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>e.isConflicting&&t.accepted.get().kind===2)}get conflictsResolvedWithSmartCombination(){return U_(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>{let o=t.accepted.get();return e.isConflicting&&o.kind===3&&o.smartCombination})}get manuallySolvedConflictCountThatEqualNone(){return U_(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>e.isConflicting&&t.accepted.get().kind===4)}get manuallySolvedConflictCountThatEqualSmartCombine(){return U_(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>{let o=t.accepted.get();return e.isConflicting&&t.computedFromDiffing&&o.kind===3&&o.smartCombination})}get manuallySolvedConflictCountThatEqualInput1(){return U_(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>{let o=t.accepted.get();return e.isConflicting&&t.computedFromDiffing&&o.kind===1})}get manuallySolvedConflictCountThatEqualInput2(){return U_(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>{let o=t.accepted.get();return e.isConflicting&&t.computedFromDiffing&&o.kind===2})}get manuallySolvedConflictCountThatEqualNoneAndStartedWithBase(){return U_(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>{let o=t.accepted.get();return e.isConflicting&&o.kind===4&&t.previousNonDiffingState?.kind===0})}get manuallySolvedConflictCountThatEqualNoneAndStartedWithInput1(){return U_(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>{let o=t.accepted.get();return e.isConflicting&&o.kind===4&&t.previousNonDiffingState?.kind===1})}get manuallySolvedConflictCountThatEqualNoneAndStartedWithInput2(){return U_(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>{let o=t.accepted.get();return e.isConflicting&&o.kind===4&&t.previousNonDiffingState?.kind===2})}get manuallySolvedConflictCountThatEqualNoneAndStartedWithBothNonSmart(){return U_(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 U_(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>{let o=t.accepted.get();return e.isConflicting&&o.kind===4&&t.previousNonDiffingState?.kind===3&&t.previousNonDiffingState?.smartCombination})}};Zce=I([m(7,kt),m(8,Cl)],Zce);function U_(a,i){let e=0;for(let t of a)i(t)&&e++;return e}var J_t=class{constructor(i){this.baseRange=i;this.accepted=Le(`BaseRangeState${this.baseRange.baseRange}`,oS.base),this.handledInput1=Le(`BaseRangeHandledState${this.baseRange.baseRange}.Input1`,!1),this.handledInput2=Le(`BaseRangeHandledState${this.baseRange.baseRange}.Input2`,!1),this.computedFromDiffing=!1,this.previousNonDiffingState=void 0,this.handled=Ce(this,e=>this.handledInput1.read(e)&&this.handledInput2.read(e))}};var Wui=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(11530,null);this.type=0}redo(){let i=this.mergeEditorModelRef.deref();if(!i||i.isDisposed())return;let e=this.stateRef.deref();e&&Ui(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&&Ui(t=>{e.handledInput1.set(this.input1Handled,t),e.handledInput2.set(this.input2Handled,t)})}};var Ep=new Q("isMergeEditor",!1,{type:"boolean",description:d(11584,null)}),Z_t=new Q("isMergeResultEditor",!1,{type:"boolean",description:d(11585,null)}),nX=new Q("mergeEditorLayout","mixed",{type:"string",description:d(11583,null)}),Qke=new Q("mergeEditorShowBase",!1,{type:"boolean",description:d(11587,null)}),$Qe=new Q("mergeEditorShowBaseAtTop",!1,{type:"boolean",description:d(11588,null)}),eDt=new Q("mergeEditorShowNonConflictingChanges",!1,{type:"boolean",description:d(11589,null)}),tDt=new Q("mergeEditorBaseUri","",{type:"string",description:d(11582,null)}),zXi=new Q("mergeEditorResultUri","",{type:"string",description:d(11586,null)}),qQe="mergeEditorCloseWithConflicts";var Yke=class{constructor(i,e,t,o){this._mergeEditorTelemetry=i;this._instantiationService=e;this._textModelService=t;this._modelService=o}async createInputModel(i){let e=new P,[t,o,n,r]=await Promise.all([this._textModelService.createModelReference(i.base),this._textModelService.createModelReference(i.result),iDt(i.input1,this._textModelService,e),iDt(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:H.None},s);e.add(l);let c=this._instantiationService.createInstance(Yce),u=this._instantiationService.createInstance(Zce,t.object.textEditorModel,n,r,l,c,{resetResult:!0},this._mergeEditorTelemetry);return e.add(u),await u.onInitialized,this._instantiationService.createInstance(jQe,u,e,o.object,i.result)}};Yke=I([m(1,F),m(2,Nt),m(3,Ct)],Yke);var jQe=class extends gg{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=Le(this,this.model.resultTextModel.getAlternativeVersionId()),this.altVersionId=ui(this,c=>this.model.resultTextModel.onDidChangeContent(c),()=>this.model.resultTextModel.getAlternativeVersionId()),this.isDirty=Ce(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){eh(()=>e.some(n=>n===this));let t=e.some(n=>n.isDirty.get()),o;if(t){let n=e.length>1,r=n?d(11506,null,e.length):d(11505,null,Ye(e[0].model.resultTextModel.uri)),s=e.some(c=>c.model.hasUnhandledConflicts.get()),l=[{label:s?d(11511,null):d(11508,null),run:()=>0},{label:d(11503,null),run:()=>1}];o=(await this.dialogService.prompt({type:gt.Info,message:r,detail:s?n?d(11502,null):d(11500,null):n?d(11501,null):d(11499,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(11510,null),detail:d(11509,null),primaryButton:d(11498,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){}};jQe=I([m(4,Ho),m(5,ct),m(6,ee)],jQe);var rX=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=ph.registerSource("merge-editor.source",d(11504,null))}async createInputModel(i){let e=new P,[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),iDt(i.input1,this._textModelService,e),iDt(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 ni;await s.save({source:rX.FILE_SAVED_SOURCE});let u=s.textEditorModel.getLinesContent().some(g=>g.startsWith(FXi.start)),p=this._instantiationService.createInstance(Yce),h=this._instantiationService.createInstance(Zce,t.object,n,r,o.object.textEditorModel,p,{resetResult:u},this._mergeEditorTelemetry);return e.add(h),await h.onInitialized,this._instantiationService.createInstance(QQe,h,e,s,this._mergeEditorTelemetry)}};rX=I([m(1,F),m(2,Nt),m(3,Ho),m(4,Ct),m(5,kt)],rX);var QQe=class extends gg{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,H.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(11523,null,e.length):d(11521,null,Ye(e[0].resultUri)),{result:s}=await this._dialogService.prompt({type:gt.Info,message:r,detail:n?t?d(11518,null):d(11515,null):t?d(11517,null):d(11514,null),buttons:[{label:n?d(11526,null):d(11525,null),run:()=>0},{label:d(11520,null),run:()=>1}],cancelButton:{run:()=>2}});return s}else if(n&&!this._storageService.getBoolean(qQe,0,!1)){let{confirmed:r,checkboxChecked:s}=await this._dialogService.confirm({message:t?d(11524,null,e.length):d(11522,null,Ye(e[0].resultUri)),detail:n?t?d(11519,null):d(11516,null):void 0,primaryButton:n?d(11513,null):d(11512,null),checkbox:{label:d(11507,null)}});return s&&this._storageService.store(qQe,!0,0,0),r?0:2}else return 0}};QQe=I([m(4,ct),m(5,le)],QQe);async function iDt(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 Xke=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",{})}};Xke=I([m(0,Te)],Xke);var a5=class{constructor(i,e,t,o){this.uri=i;this.title=e;this.detail=t;this.description=o}},hb=class extends ek{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=>{eh(()=>b.every(y=>y.editor instanceof hb));let S=b.map(y=>y.editor._inputModel).filter(mo);return await this._inputModel.confirmClose(S)}},this.mergeEditorModeFactory=this._instaService.createInstance(this.useWorkingCopy?Yke:rX,this._instaService.createInstance(Xke))}static{this.ID="mergeEditor.Input"}get useWorkingCopy(){return this.configurationService.getValue("mergeEditor.useWorkingCopy")??!1}dispose(){super.dispose()}get typeId(){return hb.ID}get editorId(){return Ys.id}get capabilities(){let e=super.capabilities|256;return this.useWorkingCopy&&(e|=4),e}getName(){return d(11497,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(he(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 hb?Xe(this.base,e.base)&&Xe(this.input1.uri,e.input1.uri)&&Xe(this.input2.uri,e.input2.uri)&&Xe(this.result,e.result):dC(e)?(this.editorId===e.options?.override||e.options?.override===void 0)&&Xe(this.base,e.base.resource)&&Xe(this.input1.uri,e.input1.resource)&&Xe(this.input2.uri,e.input2.resource)&&Xe(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),rzo(e))}};hb=I([m(4,F),m(5,ee),m(6,Ho),m(7,ot),m(8,be),m(9,B),m(10,lr),m(11,Nn),m(12,Sv),m(13,ne)],hb);function rzo(a){switch(a){case"input1":Jo(d(11494,null));break;case"input2":Jo(d(11495,null));break;case"result":Jo(d(11496,null));break}}var Jke=class extends C{constructor(e,t){super();this.model=e;this._instantiationService=t;this._documents=Pre(this.model,this.model.documents),this._documentsArr=Ce(this,o=>{let n=this._documents.read(o);return n==="loading"?[]:n}),this.isLoading=Ce(this,o=>this._documents.read(o)==="loading"),this.items=$v(this,this._documentsArr,(o,n)=>n.add(this._instantiationService.createInstance(YQe,o,this))).recomputeInitiallyAndOnChange(this._store),this.focusedDiffItem=Ce(this,o=>this.items.read(o).find(n=>n.isFocused.read(o))),this.activeDiffItem=TGe(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(){Ui(e=>{for(let t of this.items.get())t.collapsed.set(!0,e)})}expandAll(){Ui(e=>{for(let t of this.items.get())t.collapsed.set(!1,e)})}get contextKeys(){return this.model.contextKeys}},YQe=class extends C{constructor(e,t,o,n){super();this._editorViewModel=t;this._instantiationService=o;this._modelService=n;this.collapsed=Le(this,!1);this.lastTemplateData=Le(this,{contentHeight:500,selections:void 0});this.isActive=Ce(this,e=>this._editorViewModel.activeDiffItem.read(e)===this);this._isFocusedSource=Le(this,Oo(!1));this.isFocused=Ce(this,e=>this._isFocusedSource.read(e).read(e));this.isAlive=Le(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(Z9,r(this.documentDiffItem.options||{}));this.documentDiffItem.onOptionsDidChange&&this._register(this.documentDiffItem.onOptionsDidChange(()=>{s.updateOptions(r(this.documentDiffItem.options||{}))}));let l=new P,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(CW.createWithDisposable(this._instantiationService.createInstance(Y9,{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()])}};YQe=I([m(2,F),m(3,Ct)],YQe);var KXi=Re("multi-diff-editor-label-icon",M.diffMultiple,d(11611,null));var Rz=ae("multiDiffSourceResolverService"),ik=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 ni("Invalid arguments")}getKey(){return JSON.stringify([this.modifiedUri?.toString(),this.originalUri?.toString()])}},oDt=class{constructor(){this._resolvers=new Set}registerResolver(i){if(this._resolvers.has(i))throw new ni("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 xu=class extends Us{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 xpt(async()=>{let p=await this._createModel();this._register(p);let h=new Jke(p,this._instantiationService);return this._register(h),await Wp(h.waitForDiffs(),1e3),h}),this._resolvedSource=new kGe(async()=>{let p=this.initialResources?{resources:fbe.const(this.initialResources)}:await this._multiDiffSourceResolverService.resolve(this.multiDiffSource);return{source:p,resources:p?Pre(this,p.resources):Oo([])}}),this.resources=Ce(this,p=>this._resolvedSource.cachedPromiseResult.read(p)?.data?.resources.read(p)),this.textFileServiceOnDidChange=new Vui(this._textFileService.files.onDidChangeDirty,p=>p.resource.toString(),p=>p.toString()),this._isDirtyObservables=$v(this,this.resources.map(p=>p??[]),p=>{let h=p.modifiedUri?GXi(this.textFileServiceOnDidChange,this._textFileService,p.modifiedUri):Oo(!1),g=p.originalUri?GXi(this.textFileServiceOnDidChange,this._textFileService,p.originalUri):Oo(!1);return Ce(f=>h.read(f)||g.read(f))},p=>p.getKey()),this._isDirtyObservable=Ce(this,p=>this._isDirtyObservables.read(p).some(h=>h.read(p))).keepObserved(this._store),this.onDidChangeDirty=H.fromObservableLight(this._isDirtyObservable),this.closeHandler={async confirm(){return 1},showConfirm(){return!1}},this._register(he(p=>{let h=this.resources.read(p),g=this.label??d(11613,null);h&&h.length===1?this._name=d(11615,null,g):h?this._name=d(11614,null,g,h.length):this._name=g,this._onDidChangeLabel.fire()}))}static fromResourceMultiDiffEditorInput(e,t){if(!e.multiDiffSource&&!e.resources)throw new ni("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(xu,o,e.label,e.resources?.map(n=>new ik(n.original.resource,n.modified.resource,n.goToFileResource)),e.isTransient??!1)}static fromSerialized(e,t){return t.createInstance(xu,A.parse(e.multiDiffSourceUri),e.label,e.resources?.map(o=>new ik(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 xu.ID}getName(){return this._name}get editorId(){return Ys.id}getIcon(){return KXi}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=$v(this,e.resources,async(c,u)=>{let p,h,g=new P;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{...szo(h?.object.isReadonly()??!0),...azo(t.getValue(f))}},onOptionsDidChange:b=>this._textResourceConfigurationService.onDidChangeConfiguration(S=>{(S.affectsConfiguration(f,"editor")||S.affectsConfiguration(f,"diffEditor"))&&b()})};return u.add(CW.createOfNonDisposable(v,g,this))},c=>JSON.stringify([c.modifiedUri?.toString(),c.originalUri?.toString()])),n=Le("documents","loading"),r=Ce(async c=>{let u=o.read(c),h=(await Promise.all(u)).filter(mo);n.set(h,void 0)}),s=EM(r);return await r.get(),{dispose:()=>s.dispose(),documents:new pN(n),contextKeys:e.source?.contextKeys}}matches(e){return super.matches(e)?!0:e instanceof xu?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!==Y.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)])}))}};xu=I([m(4,Nt),m(5,Nn),m(6,F),m(7,Rz),m(8,Ho)],xu);var Vui=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 GXi(a,i,e){return ui(a.filteredEvent(e),()=>i.isDirty(e))}function szo(a){return{readOnly:!!a,readOnlyMessage:typeof a!="boolean"?a:void 0}}function azo(a){let i=Xi(a.editor);if(yi(a.diffEditor)){let e=Xi(a.diffEditor);e.diffCodeLens=e.codeLens,delete e.codeLens,e.diffWordWrap=e.wordWrap,delete e.wordWrap,Object.assign(i,e)}return i}var ede=class extends C{static{this.ID="workbench.contrib.multiDiffEditorResolver"}constructor(i,e){super(),this._register(i.registerEditor("*",{id:Ys.id,label:Ys.displayName,detail:Ys.providerDisplayName,priority:"builtin"},{},{createMultiDiffEditorInput:t=>({editor:xu.fromResourceMultiDiffEditorInput(t,e)})}))}};ede=I([m(0,ul),m(1,F)],ede);var nDt=class{canSerialize(i){return i instanceof xu&&!i.isTransient}serialize(i){if(this.canSerialize(i))return JSON.stringify(i.serialize())}deserialize(i,e){try{let t=zg(e);return xu.fromSerialized(t,i)}catch(t){mt(t);return}}};var Yo=ae("terminalService"),ku=ae("terminalConfigurationService"),xv=ae("terminalEditorService"),sX=ae("terminalEditingService"),jl=ae("terminalGroupService"),xm=ae("terminalInstanceService"),kv=ae("terminalChatService");var dR=a=>!Xo(a.instanceId),tde=class extends MouseEvent{},Mz="terminalEditor";var $Xi=["workbench.action.terminal.focusAccessibleBuffer"];var qXi={"terminal.integrated.accessibleViewPreserveCursorPosition":{markdownDescription:d(14534,null),type:"boolean",default:!1},"terminal.integrated.accessibleViewFocusOnCommandExecution":{markdownDescription:d(14533,null),type:"boolean",default:!1}};var jXi={"terminal.integrated.autoReplies":{markdownDescription:d(14535,null,'`"Terminate batch job (Y/N)": "Y\\r"`','`"\\r"`'),type:"object",additionalProperties:{oneOf:[{type:"string",description:d(14536,null)},{type:"null"}]},restricted:!0,default:{}}};var QXi=D.for("terminalChatWidget"),jO=D.for("terminalChatWidget.status"),g0a=D.for("terminalChatWidget.toolbar");var Ba;(c=>(c.focused=new Q("terminalChatFocus",!1,d(14538,null)),c.visible=new Q("terminalChatVisible",!1,d(14543,null)),c.requestActive=new Q("terminalChatActiveRequest",!1,d(14540,null)),c.inputHasText=new Q("terminalChatInputHasText",!1,d(14539,null)),c.responseContainsCodeBlock=new Q("terminalChatResponseContainsCodeBlock",!1,d(14541,null)),c.responseContainsMultipleCodeBlocks=new Q("terminalChatResponseContainsMultipleCodeBlocks",!1,d(14542,null)),c.hasChatAgent=new Q("terminalChatAgentRegistered",!1,d(14537,null)),c.hasChatTerminals=new Q("hasChatTerminals",!1,d(14544,null)),c.hasHiddenChatTerminals=new Q("hasHiddenChatTerminals",!1,d(14545,null))))(Ba||={});var S0a=ae("ptyService");var SV={Backend:"workbench.contributions.terminal.processBackend"},Bui=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()??""}};oe.add(SV.Backend,new Bui);var rDt=ae("localPtyService"),Xs=ae("terminalLogService");var YXi={"terminal.integrated.initialHint":{restricted:!0,markdownDescription:d(14826,null,"`#terminal.integrated.sendKeybindingsToShell#`"),type:"boolean",default:!0}};function sDt(a,i){let e=[{name:null,description:d(2334,null)}];return e.push(...a.map(t=>({name:t.profileName,description:lzo(t)}))),i&&e.push(...i.map(t=>({name:t.title,description:czo(t)}))),{values:e.map(t=>t.name),markdownDescriptions:e.map(t=>t.description)}}function lzo(a){let i=`$(${q.isThemeIcon(a.icon)?a.icon.id:a.icon?a.icon:M.terminal.id}) ${a.profileName}
- path: ${a.path}`;return a.args&&(Ae(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 czo(a){return`$(${q.isThemeIcon(a.icon)?a.icon.id:a.icon?a.icon:M.terminal.id}) ${a.title}
- extensionIdentifier: ${a.extensionIdentifier}`}function XXi(a,i){if(!a&&!i)return!0;if(Ae(a)&&Ae(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 JXi(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(yi(a)&&!A.isUri(a)&&!q.isThemeIcon(a)&&yi(i)&&!A.isUri(i)&&!q.isThemeIcon(i)){let e=a,t=i;if((A.isUri(e.light)||oh(e.light))&&(A.isUri(e.dark)||oh(e.dark))&&(A.isUri(t.light)||oh(t.light))&&(A.isUri(t.dark)||oh(t.dark)))return e.light.path===t.light.path&&e.dark.path===t.dark.path}if(A.isUri(a)&&A.isUri(i)||oh(a)||oh(i)){let e=a,t=i;return e.path===t.path&&e.scheme===t.scheme}return!1}var Gui={type:["string","null"],enum:["terminal.ansiBlack","terminal.ansiRed","terminal.ansiGreen","terminal.ansiYellow","terminal.ansiBlue","terminal.ansiMagenta","terminal.ansiCyan","terminal.ansiWhite"],default:null},$ui={type:"string",enum:Array.from(k$(),a=>a.id),markdownEnumDescriptions:Array.from(k$(),a=>`$(${a.id})`)},aX={args:{description:d(2318,null),type:"array",items:{type:"string"}},icon:{description:d(2321,null),...$ui},color:{description:d(2319,null),...Gui},env:{markdownDescription:d(2320,null),type:"object",additionalProperties:{type:["string","null"]},default:{}}},Hui={type:"object",required:["path"],properties:{path:{description:d(2329,null),type:["string","array"],items:{type:"string"}},overrideName:{description:d(2328,null),type:"boolean"},...aX}},Uui={type:"object",required:["path"],properties:{path:{description:d(2316,null),type:["string"],items:{type:"string"}},...aX}};function zui(a){let i=a===2?"linux":a===1?"osx":"windows";return d(2313,null,LT(a),'```json\n"terminal.integrated.profile.'+i+'": {\n  "bash": null\n}\n```',"[","](https://code.visualstudio.com/docs/terminal/profiles)")}var dzo={id:"terminal",order:100,title:d(2317,null),type:"object",properties:{"terminal.integrated.automationProfile.linux":{restricted:!0,markdownDescription:d(2304,null),type:["object","null"],default:null,anyOf:[{type:"null"},Uui],defaultSnippets:[{body:{path:"${1}",icon:"${2}"}}]},"terminal.integrated.automationProfile.osx":{restricted:!0,markdownDescription:d(2305,null),type:["object","null"],default:null,anyOf:[{type:"null"},Uui],defaultSnippets:[{body:{path:"${1}",icon:"${2}"}}]},"terminal.integrated.automationProfile.windows":{restricted:!0,markdownDescription:d(2306,null,"`terminal.integrated.automationShell.windows`"),type:["object","null"],default:null,anyOf:[{type:"null"},Uui],defaultSnippets:[{body:{path:"${1}",icon:"${2}"}}]},"terminal.integrated.profiles.windows":{restricted:!0,markdownDescription:zui(3),type:"object",default:{PowerShell:{source:"PowerShell",icon:M.terminalPowershell.id},"Command Prompt":{path:["${env:windir}\\Sysnative\\cmd.exe","${env:windir}\\System32\\cmd.exe"],args:[],icon:M.terminalCmd.id},"Git Bash":{source:"Git Bash",icon:M.terminalGitBash.id}},additionalProperties:{anyOf:[{type:"object",required:["source"],properties:{source:{description:d(2333,null),enum:["PowerShell","Git Bash"]},...aX}},{type:"object",required:["extensionIdentifier","id","title"],properties:{extensionIdentifier:{description:d(2331,null),type:"string"},id:{description:d(2330,null),type:"string"},title:{description:d(2332,null),type:"string"},...aX}},{type:"null"},Hui]}},"terminal.integrated.profiles.osx":{restricted:!0,markdownDescription:zui(1),type:"object",default:{bash:{path:"bash",args:["-l"],icon:M.terminalBash.id},zsh:{path:"zsh",args:["-l"]},fish:{path:"fish",args:["-l"]},tmux:{path:"tmux",icon:M.terminalTmux.id},pwsh:{path:"pwsh",icon:M.terminalPowershell.id}},additionalProperties:{anyOf:[{type:"object",required:["extensionIdentifier","id","title"],properties:{extensionIdentifier:{description:d(2326,null),type:"string"},id:{description:d(2325,null),type:"string"},title:{description:d(2327,null),type:"string"},...aX}},{type:"null"},Hui]}},"terminal.integrated.profiles.linux":{restricted:!0,markdownDescription:zui(2),type:"object",default:{bash:{path:"bash",icon:M.terminalBash.id},zsh:{path:"zsh"},fish:{path:"fish"},tmux:{path:"tmux",icon:M.terminalTmux.id},pwsh:{path:"pwsh",icon:M.terminalPowershell.id}},additionalProperties:{anyOf:[{type:"object",required:["extensionIdentifier","id","title"],properties:{extensionIdentifier:{description:d(2323,null),type:"string"},id:{description:d(2322,null),type:"string"},title:{description:d(2324,null),type:"string"},...aX}},{type:"null"},Hui]}},"terminal.integrated.useWslProfiles":{description:d(2315,null),type:"boolean",default:!0},"terminal.integrated.inheritEnv":{scope:1,description:d(2311,null),type:"boolean",default:!0},"terminal.integrated.persistentSessionScrollback":{scope:1,markdownDescription:d(2312,null),type:"number",default:100},"terminal.integrated.showLinkHover":{scope:1,description:d(2314,null),type:"boolean",default:!0},"terminal.integrated.ignoreProcessNames":{markdownDescription:d(2307,null,"`#terminal.integrated.confirmOnKill#`"),type:"array",items:{type:"string",uniqueItems:!0},default:["starship","oh-my-posh","bash","zsh"]}}};function ZXi(){oe.as(ii.Configuration).registerConfiguration(dzo),qui()}var Kui;function qui(a,i){let e=oe.as(ii.Configuration),t;a&&(t=sDt(a?.profiles,i));let o=Kui;Kui={id:"terminal",order:100,title:d(2317,null),type:"object",properties:{"terminal.integrated.defaultProfile.linux":{restricted:!0,markdownDescription:d(2308,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(2309,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(2310,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:[Kui],remove:o?[o]:[]})}var eJi={type:"boolean",enum:[!0,!1],enumDescriptions:[d(14703,null),d(14697,null)],description:d(14698,null)},jui={type:"object",required:["path"],properties:{path:{description:d(14725,null),type:"string"},...aX}},Qui={"chat.tools.terminal.enableAutoApprove":{description:d(14704,null),type:"boolean",default:!0,policy:{name:"ChatToolsTerminalEnableAutoApprove",category:"IntegratedTerminal",minimumVersion:"1.104",localization:{description:{key:"autoApproveMode.description",value:d(14704,null)}}}},"chat.tools.terminal.autoApprove":{markdownDescription:[d(14694,null,"`/`","`i`"),d(14696,null,"`true`","`false`","`null`"),d(14695,null,"`foo && bar`","`foo`","`bar`","`true`","`false`","`<(foo)`"),d(14681,null,"`{ approve: false, matchCommandLine: true }`"),d(14679,null,"`#chat.tools.terminal.ignoreDefaultAutoApproveRules#`","`true`"),[d(14692,null),`|${d(14693,null)}|${d(14683,null)}|`,"|---|---|",'| `"mkdir": true` | '+d(14684,null,"`mkdir`"),'| `"npm run build": true` | '+d(14685,null,"`npm run build`"),'| `"bin/test.sh": true` | '+d(14682,null,"`bin/test.sh`","`bin\\test.sh`","`./bin/test.sh`"),'| `"/^git (status\\|show\\\\b.*)$/": true` | '+d(14689,null,"`git status`","`git show`"),'| `"/^Get-ChildItem\\\\b/i": true` | '+d(14688,null,"`Get-ChildItem`"),'| `"/.*/": true` | '+d(14687,null),'| `"rm": false` | '+d(14690,null,"`rm`"),'| `"/\\\\.ps1/i": { approve: false, matchCommandLine: true }` | '+d(14686,null,'`".ps1"`'),'| `"rm": null` | '+d(14691,null,"`false`","`rm`")].join(`
`)].join(`

`),type:"object",additionalProperties:{anyOf:[eJi,{type:"object",properties:{approve:eJi,matchCommandLine:{type:"boolean",enum:[!0,!1],enumDescriptions:[d(14701,null),d(14700,null)],description:d(14699,null)}},required:["approve"]},{type:"null",description:d(14702,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(14712,null,"`#chat.tools.terminal.autoApprove#`")},"chat.tools.terminal.autoApproveWorkspaceNpmScripts":{restricted:!0,type:"boolean",default:!0,tags:["experimental"],markdownDescription:d(14705,null)},"chat.tools.terminal.blockDetectedFileWrites":{type:"string",enum:["never","outsideWorkspace","all"],enumDescriptions:[d(14709,null),d(14710,null),d(14707,null)],default:"outsideWorkspace",tags:["experimental"],markdownDescription:d(14708,null)},"chat.tools.terminal.shellIntegrationTimeout":{markdownDescription:d(14722,null,"`#terminal.integrated.shellIntegration.enabled#`"),type:"integer",minimum:-1,maximum:6e4,default:-1,markdownDeprecationMessage:d(14721,null,"`#terminal.integrated.shellIntegration.timeout#`")},"chat.tools.terminal.terminalProfile.linux":{restricted:!0,markdownDescription:d(14723,null),type:["object","null"],default:null,anyOf:[{type:"null"},jui],defaultSnippets:[{body:{path:"${1}"}}]},"chat.tools.terminal.terminalProfile.osx":{restricted:!0,markdownDescription:d(14724,null),type:["object","null"],default:null,anyOf:[{type:"null"},jui],defaultSnippets:[{body:{path:"${1}"}}]},"chat.tools.terminal.terminalProfile.windows":{restricted:!0,markdownDescription:d(14726,null),type:["object","null"],default:null,anyOf:[{type:"null"},jui],defaultSnippets:[{body:{path:"${1}"}}]},"chat.tools.terminal.autoReplyToPrompts":{type:"boolean",default:!1,tags:["experimental"],markdownDescription:d(14706,null)},"chat.tools.terminal.outputLocation":{markdownDescription:d(14714,null),type:"string",enum:["terminal","chat"],enumDescriptions:[d(14715,null),d(14713,null)],default:"chat",tags:["experimental"],experiment:{mode:"auto"}},"chat.tools.terminal.sandbox.enabled":{markdownDescription:d(14727,null),type:"boolean",default:!1,tags:["preview"],restricted:!0},"chat.tools.terminal.sandbox.network":{markdownDescription:d(14736,null,"`#chat.tools.terminal.sandbox.enabled#`"),type:"object",properties:{allowedDomains:{type:"array",description:d(14737,null,"`*.example.com`"),items:{type:"string"},default:[]},deniedDomains:{type:"array",description:d(14739,null),items:{type:"string"},default:[]},allowTrustedDomains:{type:"boolean",description:d(14738,null),default:!1}},default:{allowedDomains:[],deniedDomains:[],allowTrustedDomains:!1},tags:["preview"],restricted:!0},"chat.tools.terminal.sandbox.linuxFileSystem":{markdownDescription:d(14728,null,"`#chat.tools.terminal.sandbox.enabled#`"),type:"object",properties:{denyRead:{type:"array",description:d(14730,null),items:{type:"string"},default:[]},allowWrite:{type:"array",description:d(14729,null),items:{type:"string"},default:["."]},denyWrite:{type:"array",description:d(14731,null),items:{type:"string"},default:[]}},default:{denyRead:[],allowWrite:["."],denyWrite:[]},tags:["preview"],restricted:!0},"chat.tools.terminal.sandbox.macFileSystem":{markdownDescription:d(14732,null,"`#chat.tools.terminal.sandbox.enabled#`"),type:"object",properties:{denyRead:{type:"array",description:d(14734,null),items:{type:"string"},default:[]},allowWrite:{type:"array",description:d(14733,null),items:{type:"string"},default:["."]},denyWrite:{type:"array",description:d(14735,null),items:{type:"string"},default:[]}},default:{denyRead:[],allowWrite:["."],denyWrite:[]},tags:["preview"],restricted:!0},"chat.tools.terminal.preventShellHistory":{type:"boolean",default:!0,markdownDescription:[d(14716,null),`- \`bash\`: ${d(14717,null)}`,`- \`zsh\`: ${d(14720,null)}`,`- \`fish\`: ${d(14718,null)}`,`- \`pwsh\`: ${d(14719,null)}`].join(`
`)},"chat.tools.terminal.enforceTimeoutFromModel":{restricted:!0,type:"boolean",default:!0,tags:["experimental"],experiment:{mode:"auto"},markdownDescription:d(14711,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"])Qui[a]={deprecated:!0,markdownDeprecationMessage:d(14680,null,"`#chat.tools.terminal.autoApprove#`")};var tJi="terminal.integrated.shellIntegration",iJi={"terminal.integrated.shellIntegration.showCommandGuide":{restricted:!0,markdownDescription:d(14754,null),type:"boolean",default:!0}};var oJi=["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 nJi=["workbench.action.terminal.goToRecentDirectory","workbench.action.terminal.runRecentCommand"];var rJi={"terminal.integrated.shellIntegration.history":{restricted:!0,markdownDescription:d(14815,null),type:"number",default:100}};var sJi={"terminal.integrated.enableNotifications":{description:d(14853,null),type:"boolean",default:!0}};var aJi={"terminal.integrated.stickyScroll.enabled":{markdownDescription:d(14897,null,"https://code.visualstudio.com/docs/terminal/shell-integration","`#terminal.integrated.shellIntegration.enabled#`"),type:"boolean",default:!0},"terminal.integrated.stickyScroll.maxLineCount":{markdownDescription:d(14899,null),type:"number",default:5,minimum:1,maximum:10},"terminal.integrated.stickyScroll.ignoredCommands":{markdownDescription:d(14898,null),type:"array",items:{type:"string"},default:["clear","cls","clear-host","copilot","claude","codex","gemini"]}};var lJi=["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 uzo=["exe","bat","cmd","com","msi","ps1","vbs","js","jar","py","rb","pl","sh"],Pz="terminal.integrated.suggest";function Xui(a){return typeof a=="boolean"?a?{commands:"on",arguments:"on",unknown:"off"}:{commands:"off",arguments:"off",unknown:"off"}:a}var cJi={"terminal.integrated.suggest.enabled":{restricted:!0,markdownDescription:d(14988,null,"Windows PowerShell, PowerShell v7+, zsh, bash, fish","`#terminal.integrated.shellIntegration.enabled#`"),type:"boolean",default:!0},"terminal.integrated.suggest.providers":{restricted:!0,markdownDescription:d(14996,null),type:"object",properties:{}},"terminal.integrated.suggest.quickSuggestions":{restricted:!0,markdownDescription:d(14998,null,"`#terminal.integrated.suggest.suggestOnTriggerCharacters#`"),type:"object",properties:{commands:{description:d(15000,null),type:"string",enum:["on","off"]},arguments:{description:d(14999,null),type:"string",enum:["on","off"]},unknown:{description:d(15001,null),type:"string",enum:["on","off"]}},additionalProperties:!1,default:{commands:"off",arguments:"off",unknown:"off"}},"terminal.integrated.suggest.suggestOnTriggerCharacters":{restricted:!0,markdownDescription:d(15004,null),type:"boolean",default:!1},"terminal.integrated.suggest.runOnEnter":{restricted:!0,markdownDescription:d(15002,null),enum:["never","exactMatch","exactMatchIgnoreExtension","always"],markdownEnumDescriptions:[d(14983,null),d(14981,null),d(14982,null),d(14980,null)],default:"never"},"terminal.integrated.suggest.selectionMode":{markdownDescription:d(15006,null),type:"string",enum:["partial","always","never"],markdownEnumDescriptions:[d(15009,null),d(15007,null),d(15008,null)],default:"partial"},"terminal.integrated.suggest.windowsExecutableExtensions":{restricted:!0,markdownDescription:d(15011,null,uzo.sort().map(a=>`- ${a}`).join(`
`)),type:"object",default:{}},"terminal.integrated.suggest.showStatusBar":{restricted:!0,markdownDescription:d(15003,null),type:"boolean",default:!0},"terminal.integrated.suggest.cdPath":{restricted:!0,markdownDescription:d(14984,null),type:"string",enum:["off","relative","absolute"],markdownEnumDescriptions:[d(14986,null),d(14987,null),d(14985,null)],default:"absolute"},"terminal.integrated.suggest.inlineSuggestion":{restricted:!0,markdownDescription:d(14989,null),type:"string",enum:["off","alwaysOnTopExceptExactMatch","alwaysOnTop"],markdownEnumDescriptions:[d(14992,null),d(14991,null),d(14990,null)],default:"alwaysOnTop"},"terminal.integrated.suggest.upArrowNavigatesHistory":{restricted:!0,markdownDescription:d(15005,null),type:"boolean",default:!0},"terminal.integrated.suggest.insertTrailingSpace":{restricted:!0,markdownDescription:d(14993,null),type:"boolean",default:!1}},Yui;function Jui(a){let i=Yui;a??=new Map,a.has("lsp")||a.set("lsp",{id:"lsp",description:d(14994,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(14995,null,n)};let t={};for(let n in e)t[n]=e[n].default;Yui={id:"terminalSuggestProviders",order:100,title:d(15010,null),type:"object",properties:{"terminal.integrated.suggest.providers":{restricted:!0,markdownDescription:d(14997,null),type:"object",properties:e,default:t,tags:["preview"],additionalProperties:!1}}},oe.as(ii.Configuration).updateConfigurations({add:[Yui],remove:i?[i]:[]})}Jui();var Zui=["vim","vi","nano","tmux"];var dJi={"terminal.integrated.localEchoLatencyThreshold":{description:d(15017,null),type:"integer",minimum:-1,default:30,tags:["preview"]},"terminal.integrated.localEchoEnabled":{markdownDescription:d(15012,null,"`#terminal.integrated.localEchoLatencyThreshold#`"),type:"string",enum:["on","off","auto"],enumDescriptions:[d(15015,null),d(15014,null),d(15013,null)],default:"off",tags:["preview"]},"terminal.integrated.localEchoExcludePrograms":{description:d(15016,null),type:"array",items:{type:"string",uniqueItems:!0},default:Zui,tags:["preview"]},"terminal.integrated.localEchoStyle":{description:d(15018,null),default:"dim",anyOf:[{enum:["bold","dim","italic","underlined","inverted","#ff0000"]},{type:"string",format:"color-hex"}],tags:["preview"]}};var uJi={"terminal.integrated.mouseWheelZoom":{markdownDescription:it?d(15034,null):d(15033,null),type:"boolean",default:!1}};var lw=(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))(lw||{}),ty=(r=>(r[r.StickyScrollEnabled="terminal.integrated.stickyScroll.enabled"]="StickyScrollEnabled",r[r.SuggestEnabled="terminal.integrated.suggest.enabled"]="SuggestEnabled",r[r.AutoApprove="chat.tools.terminal.autoApprove"]="AutoApprove",r[r.EnableAutoApprove="chat.tools.terminal.enableAutoApprove"]="EnableAutoApprove",r[r.ShellIntegrationTimeout="chat.tools.terminal.shellIntegrationTimeout"]="ShellIntegrationTimeout",r[r.OutputLocation="chat.tools.terminal.outputLocation"]="OutputLocation",r))(ty||{}),ide=(e=>(e[e.ChatHasTerminals="hasChatTerminals"]="ChatHasTerminals",e[e.ChatHasHiddenTerminals="hasHiddenChatTerminals"]="ChatHasHiddenTerminals",e))(ide||{}),mJi={...qXi,...jXi,...Qui,...YXi,...iJi,...rJi,...sJi,...aJi,...cJi,...dJi,...uJi},hJi=[...$Xi,...oJi,...nJi,...lJi];var dc="terminal";var Ev="terminal.integrated",aDt=0,gJi=-5,lDt=Wn?1.1:1,JQe=1,ZQe=1e3,fJi="normal",vJi="bold",tpi=["normal","bold","100","200","300","400","500","600","700","800","900"],Sg=ae("terminalProfileResolverService");var iy=ae("terminalProfileService"),bJi=a=>typeof a.write=="function";var cDt=["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","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",...hJi],SJi={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(14264,null),type:"object",properties:{profiles:{type:"array",description:d(14267,null),items:{type:"object",required:["id","title"],defaultSnippets:[{body:{id:"$1",title:"$2"}}],properties:{id:{description:d(14268,null),type:"string"},title:{description:d(14269,null),type:"string"},icon:{description:d(14271,null),anyOf:[{type:"string"},{type:"object",properties:{light:{description:d(14273,null),type:"string"},dark:{description:d(14272,null),type:"string"}}}]},titleTemplate:{description:d(14270,null),type:"string"}}}},completionProviders:{type:"array",description:d(14265,null),items:{type:"object",required:["id"],defaultSnippets:[{body:{id:"$1",description:"$2"}}],properties:{description:{description:d(14266,null),type:"string"}}}}}}};var nS=[],lX=J("terminal.background",null,d(14275,null)),IJi=J("terminal.foreground",{light:"#333333",dark:"#CCCCCC",hcDark:"#FFFFFF",hcLight:"#292929"},d(14282,null)),yJi=J("terminalCursor.foreground",null,d(14292,null)),wJi=J("terminalCursor.background",null,d(14291,null)),eEe=J("terminal.selectionBackground",sv,d(14285,null)),CJi=J("terminal.inactiveSelectionBackground",{light:ei(eEe,.5),dark:ei(eEe,.5),hcDark:ei(eEe,.7),hcLight:ei(eEe,.5)},d(14284,null)),xJi=J("terminal.selectionForeground",{light:null,dark:null,hcDark:"#000000",hcLight:"#ffffff"},d(14286,null)),kJi=J("terminalCommandDecoration.defaultBackground",{light:"#00000040",dark:"#ffffff40",hcDark:"#ffffff80",hcLight:"#00000040"},d(14288,null)),EJi=J("terminalCommandDecoration.successBackground",{dark:"#1B81A8",light:"#2090D3",hcDark:"#1B81A8",hcLight:"#007100"},d(14290,null)),TJi=J("terminalCommandDecoration.errorBackground",{dark:"#F14C4C",light:"#E51400",hcDark:"#F14C4C",hcLight:"#B5200D"},d(14289,null)),uDt=J("terminalOverviewRuler.cursorForeground","#A0A0A0CC",d(14295,null)),jWa=J("terminal.border",cb,d(14276,null)),_Ji=J("terminalOverviewRuler.border",bft,d(14294,null)),DJi=J("terminal.findMatchBackground",{dark:Pse,light:Pse,hcDark:null,hcLight:"#0F4A85"},d(14278,null),!0),QWa=J("terminal.hoverHighlightBackground",ei(ogt,.5),d(14283,null)),LJi=J("terminal.findMatchBorder",{dark:null,light:null,hcDark:"#f38518",hcLight:"#0F4A85"},d(14279,null)),RJi=J("terminal.findMatchHighlightBackground",{dark:Kb,light:Kb,hcDark:null,hcLight:null},d(14280,null),!0),MJi=J("terminal.findMatchHighlightBorder",{dark:null,light:null,hcDark:"#f38518",hcLight:"#0F4A85"},d(14281,null)),PJi=J("terminalOverviewRuler.findMatchForeground",{dark:MN,light:MN,hcDark:"#f38518",hcLight:"#0F4A85"},d(14296,null)),YWa=J("terminal.dropBackground",_E,d(14277,null),!0),XWa=J("terminal.tab.activeBorder",Lxe,d(14287,null)),JWa=J("terminal.initialHintForeground",{dark:"#ffffff56",light:"#0007",hcDark:null,hcLight:null},d(14293,null)),dDt={"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 AJi(){for(let a in dDt){let i=dDt[a],e=a.substring(13);nS[i.index]=J(a,i.defaults,d(14274,null,e))}}function oy(a){let i;if(Ae(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 pDt(a){let i=[];for(let e in dDt)a.getColor(e)&&!e.toLowerCase().includes("bright")&&i.push(e);return i}function tEe(a){let i=new P,e=pDt(a),t=hr(void 0,void 0,i),o="";for(let n of e){let r=oy(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 NJi(a,i){let e=pDt(a),t="";for(let o of e){let n=oy(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 z_(a,i,e){let t=a.icon;if(!t)return;let o=[],n;if(e){if(Ae(t)&&(t.startsWith("$(")||jy().getIcon(t)))return o;Ae(t)&&(n=A.parse(t))}if(A.isUri(t)?n=t:!q.isThemeIcon(t)&&!Ae(t)&&(n=Ip(i)?t.dark:t.light),n instanceof A){let s=`terminal-uri-icon-${Ir(n.path).toString(36)}`;o.push(s),o.push("terminal-uri-icon")}return o}function cX(a,i){return Ae(i.icon)?i.icon:q.isThemeIcon(i.icon)?i.icon.id:a.get(Sg).getDefaultIcon().id}var at;(Ee=>(Ee.isOpen=new Q("terminalIsOpen",!1,!0),Ee.focus=new Q("terminalFocus",!1,d(14466,null)),Ee.focusInAny=new Q("terminalFocusInAny",!1,d(14467,null)),Ee.editorFocus=new Q("terminalEditorFocus",!1,d(14465,null)),Ee.count=new Q("terminalCount",0,d(14464,null)),Ee.groupCount=new Q("terminalGroupCount",0,!0),Ee.tabsNarrow=new Q("isTerminalTabsNarrow",!1,!0),Ee.terminalHasFixedWidth=new Q("terminalHasFixedWidth",!1,!0),Ee.tabsFocus=new Q("terminalTabsFocus",!1,d(14472,null)),Ee.webExtensionContributedProfile=new Q("terminalWebExtensionContributedProfile",!1,!0),Ee.terminalHasBeenCreated=new Q("terminalHasBeenCreated",!1,!0),Ee.terminalEditorActive=new Q("terminalEditorActive",!1,!0),Ee.tabsMouse=new Q("terminalTabsMouse",!1,!0),Ee.shellType=new Q("terminalShellType",void 0,{type:"string",description:d(14470,null)}),Ee.altBufferActive=new Q("terminalAltBufferActive",!1,d(14463,null)),Ee.suggestWidgetVisible=new Q("terminalSuggestWidgetVisible",!1,d(14471,null)),Ee.notFocus=Ee.focus.toNegated(),Ee.viewShowing=new Q("terminalViewShowing",!1,d(14476,null)),Ee.textSelected=new Q("terminalTextSelected",!1,d(14474,null)),Ee.textSelectedInFocused=new Q("terminalTextSelectedInFocused",!1,d(14475,null)),Ee.notTextSelected=Ee.textSelected.toNegated(),Ee.findVisible=new Q("terminalFindVisible",!1,!0),Ee.notFindVisible=Ee.findVisible.toNegated(),Ee.findInputFocus=new Q("terminalFindInputFocused",!1,!0),Ee.findFocus=new Q("terminalFindFocused",!1,!0),Ee.notFindFocus=Ee.findInputFocus.toNegated(),Ee.processSupported=new Q("terminalProcessSupported",!1,d(14468,null)),Ee.tabsSingularSelection=new Q("terminalTabsSingularSelection",!1,d(14473,null)),Ee.splitTerminalTabFocused=new Q("terminalSplitTerminal",!1,d(14461,null)),Ee.splitTerminalActive=new Q("terminalSplitPaneActive",!1,d(14462,null)),Ee.inTerminalRunCommandPicker=new Q("inTerminalRunCommandPicker",!1,d(14460,null)),Ee.terminalShellIntegrationEnabled=new Q("terminalShellIntegrationEnabled",!1,d(14469,null)),Ee.terminalDictationInProgress=new Q("terminalDictationInProgress",!1),Ee.shouldShowViewInlineActions=x.and(x.equals("view",dc),x.notEquals("config.terminal.integrated.tabs.hideCondition","never"),x.not(ide.ChatHasHiddenTerminals),x.or(x.not("config.terminal.integrated.tabs.enabled"),x.and(x.equals("config.terminal.integrated.tabs.showActions","singleTerminal"),x.equals("terminalGroupCount",1)),x.and(x.equals("config.terminal.integrated.tabs.showActions","singleTerminalOrNarrow"),x.or(x.equals("terminalGroupCount",1),x.has("isTerminalTabsNarrow"))),x.and(x.equals("config.terminal.integrated.tabs.showActions","singleGroup"),x.equals("terminalGroupCount",1)),x.equals("config.terminal.integrated.tabs.showActions","always")))))(at||={});var ef=class extends Us{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=at.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 ef.ID}get editorId(){return Mz}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(ef,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:gt.Warning,message:d(14122,null),primaryButton:d(14120,null),detail:e.length>1?e.map(o=>o.editor.getName()).join(`
`)+`

`+d(14123,null):d(14121,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),Ue(n),Ue([t,o])})),this._register(this._lifecycleService.onWillShutdown(r=>{this._isShuttingDown=!0,Ue(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=oy(this._terminalInstance);t&&e.push(t);let o=z_(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:Mz,pinned:!0,forceReload:!0}}}canReopen(){return!1}};ef=I([m(2,De),m(3,xm),m(4,F),m(5,B),m(6,ao),m(7,X),m(8,ct)],ef);var mDt=class{constructor(i,e,t,o,n){this._editorGroupsService=e;this._configurationService=t;this._logService=o;this._dispoables=new P;this._tabGroupModel=[];this._groupLookup=new Map;this._tabInfoLookup=new Map;this._multiDiffEditorInputListeners=new jt;this._proxy=i.getProxy(Zi.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 hb)return{kind:3,base:i.base,input1:i.input1.uri,input2:i.input2.uri,result:i.resource};if(i instanceof ek)return{kind:1,uri:i.resource};if(i instanceof ga&&!(i instanceof Fa)){let e=i.primary.resource,t=i.secondary.resource;return i.primary instanceof ek&&i.secondary instanceof ek&&Xe(e,t)&&e&&t?{kind:1,uri:e}:{kind:0}}if(i instanceof ha)return{kind:4,notebookType:i.viewType,uri:i.resource};if(i instanceof Yp)return{kind:6,viewType:i.viewType,uri:i.resource};if(i instanceof wu)return{kind:7,viewType:i.viewType};if(i instanceof ef)return{kind:8};if(i instanceof Fa){if(i.modified instanceof ek&&i.original instanceof ek)return{kind:2,modified:i.modified.resource,original:i.original.resource};if(i.modified instanceof ha&&i.original instanceof ha)return{kind:5,notebookType:i.original.viewType,modified:i.modified.resource,original:i.original.resource}}if(i instanceof Zg)return{kind:9,uri:i.resource,inputBoxUri:i.inputResource};if(i instanceof Va)return{kind:10};if(i instanceof xu){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=no.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 xu&&this._multiDiffEditorInputListeners.set(e,H.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 xu&&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:bC(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(EXi(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=W_(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===vn&&(p=pC(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)}};mDt=I([vo(Gi.MainThreadEditorTabs),m(1,Et),m(2,B),m(3,ne),m(4,ee)],mDt);var hDt=class{dispose(){}$onUnexpectedError(i){i?.$isError&&(i=n6(i)),mt(i)}};hDt=I([vo(Gi.MainThreadErrors)],hDt);var Yh="workbench.view.extensions",c5=L(10070,"Extensions");var zi=ae("extensionsWorkbenchService");var VE="extensions.autoUpdate",i6e="extensions.autoCheckUpdates",OJi="extensions.closeExtensionDetailsOnViewChange",IV="extensions.autoRestart",dX=class extends C{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?Ot(t.extension.identifier,e.identifier)&&(t.extension.server&&e.server&&t.extension.server!==e.server?t.updateWhenCounterExtensionChanges&&t.update():t.extension=e):t.update()}};dX=I([m(1,zi)],dX);var iEe="workbench.views.extensions.workspaceRecommendations",gDt="workbench.views.extensions.searchOutdated",fDt="workbench.extensions.action.toggleIgnoreExtension",vDt="workbench.extensions.action.installVSIX",o6e="workbench.extensions.command.installFromVSIX",yV="workbench.extensions.action.listWorkspaceUnsupportedExtensions",yC=new Q("defaultExtensionViews",!0),bDt=new Q("hasOutdatedExtensions",!1),fh=new Q("hasGallery",!1),uX=new Q("extensionsGalleryStatus","unavailable"),FJi=new Q("extensionResultListFocused ",!0),n6e=new Q("searchMcpServers",!1),SDt=new Q("searchAgentPlugins",!1),oEe="_theme_",pX="0_install",r6e="0_update",s6e=new D("extensionsSearchActionsMenu"),Xh=new D("extensionsFilterSubMenu");function kP(a){if(a===null)return"None";switch(a){case 1:return"LocalProcess";case 2:return"LocalWebWorker";case 3:return"Remote"}}function VJi(a){switch(a){case 0:return"None";case 1:return"Local";case 2:return"Remote"}}function BJi(a,i,e,t){let o=WJi(a,e),n=WJi(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 opi(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 WJi(a,i){let e=new Map;return a.forEach(t=>{let o=new ipi(t,i(t));e.set(o.key,o)}),e}var ipi=class{constructor(i,e){this.desc=i;this.kind=e}get key(){return Ei.toKey(this.desc.identifier)}get isUnderDevelopment(){return this.desc.isUnderDevelopment}},opi=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 HJi={Uninitialized:{type:"uninitialized"},Disabled:a=>({type:"disabled",reason:a}),Idle:(a,i)=>({type:"idle",updateType:a,error:i}),CheckingForUpdates:a=>({type:"checking for updates",explicit:a}),AvailableForDownload:a=>({type:"available for download",update:a}),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=ae("updateService");var IDt=class a{static{this._workerIdPool=0}createWorkerClient(i){let e,t=++a._workerIdPool;return i instanceof Worker||gzo(i)?e=Promise.resolve(i):e=this._createWorker(i),new Lht(new npi(e,t))}_createWorker(i){let e=this.getWorkerUrl(i),t=mzo(i.label,e,this._getWorkerLoadingFailedErrorMessage(i)),o=new Worker(yDt?yDt.createScriptURL(t):t,{name:i.label,type:"module"});return hzo(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)}},yDt=(()=>{let a=globalThis;return typeof self=="object"&&self.constructor&&self.constructor.name==="DedicatedWorkerGlobalScope"&&a.workerttPolicy!==void 0?a.workerttPolicy:Kg("defaultWorkerFactory",{createScriptURL:i=>i})})();function UJi(a,i){if(!a.startsWith("blob:"))throw new URIError("Not a blob-url: "+a);return new Worker(yDt?yDt.createScriptURL(a):a,{...i,type:"module"})}function mzo(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;kre.addSearchParam(r,!0,!0),r.toString()?i=`${i}?${r.toString()}#${a}`:i=`${i}#${a}`}let t=new Blob([si([`/*${a}*/`,`globalThis._VSCODE_NLS_MESSAGES = ${JSON.stringify(Y2e())};`,`globalThis._VSCODE_NLS_LANGUAGE = ${JSON.stringify(are())};`,`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 hzo(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 gzo(a){return!!a&&typeof a.then=="function"}var npi=class extends C{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 wC=ae("timerService"),rpi=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)}},nEe=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 Np;this._marks=new rpi;this._rndValueShouldSendTelemetry=Math.random()<.03;Promise.all([this._extensionService.whenInstalledExtensionsRegistered(),i.when(3),c.whenRestored,Promise.all(Array.from(oe.as(SV.Backend).backends.values()).map(u=>u.whenReady))]).then(()=>(this.setPerformanceMarks("renderer",S4i()),this._computeStartupMetrics())).then(u=>{this._startupMetrics=u,this._reportStartupTimes(u),this._barrier.open()}),this.perfBaseline=this._barrier.wait().then(()=>this._lifecycleService.when(4)).then(()=>Pi(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=UJi(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 Im(t.name),startTime:t.startTime})}async _computeStartupMetrics(){let i=this._isInitialStartup(),e;Gt?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}};nEe=I([m(0,ao),m(1,Pe),m(2,lt),m(3,zd),m(4,ds),m(5,ee),m(6,Bi),m(7,Te),m(8,fi)],nEe);var wDt=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 spi(i.getProxy(Zi.ExtHostExtensionService))),u._setAllMainProxyIdentifiers(Object.keys(Gi).map(p=>Gi[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=n6(e);this._internalExtensionService._onExtensionRuntimeError(i,t),console.error(`[${i.value}]${t.message}`),console.error(t.stack)}async $onExtensionActivationError(i,e,t){let o=n6(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=>Ot(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:gt.Error,message:d(3017,null,t,e.manifest.displayName||e.manifest.name),actions:{primary:[pi({id:"reload",label:d(3016,null),run:()=>this._hostService.reload()})]}});else{let o=this._extensionEnablementService.getEnablementState(e);o===5?this._notificationService.notify({severity:gt.Error,message:d(3015,null,t,e.manifest.displayName||e.manifest.name)}):o===0?this._notificationService.notify({severity:gt.Error,message:d(3018,null,t,e.manifest.displayName||e.manifest.name),actions:{primary:[pi({id:"manageWorkspaceTrust",label:d(3014,null),run:()=>this._commandService.executeCommand("workbench.trust.manage")})]}}):this._extensionEnablementService.canChangeEnablement(e)?this._notificationService.notify({severity:gt.Error,message:d(3010,null,t,e.manifest.displayName||e.manifest.name),actions:{primary:[pi({id:"enable",label:d(3012,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:gt.Error,message:d(3011,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}],ve.None))[0]}catch{}o?this._notificationService.notify({severity:gt.Error,message:d(3019,null,t,o.displayName,o.publisherDisplayName),actions:{primary:[pi({id:"install",label:d(3013,null),run:()=>this._extensionsWorkbenchService.install(o).then(()=>this._hostService.reload(),n=>this._notificationService.error(n))})]}}):this._notificationService.error(d(3020,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 gn.uriToBrowserUri(A.revive(i))}};wDt=I([vo(Gi.MainThreadExtensionService),m(1,lt),m(2,Ne),m(3,zi),m(4,oi),m(5,Os),m(6,wC),m(7,ge),m(8,Vt)],wDt);var spi=class{constructor(i){this._actual=i}async resolveAuthority(i,e){return fzo(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 fzo(a){return a.type==="ok"?{type:"ok",value:{...a.value,authority:vzo(a.value.authority)}}:a}function vzo(a){return{...a,connectTo:bzo(a.connectTo)}}function bzo(a){return a.type===0?new skt(a.host,a.port):new rkt(a.id)}var K_=class{constructor(i,e){this._fileService=e;this._fileProvider=new jt;this._disposables=new P;this._proxy=i.getProxy(Zi.ExtHostFileSystem);let t=i.getProxy(Zi.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 api(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:K_._asFileType(e)}}catch(e){return K_._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,K_._asFileType(t)]):[]}catch(e){return K_._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 K_._handleError(e)}}async $writeFile(i,e){try{await this._fileService.writeFile(A.revive(i),e)}catch(t){return K_._handleError(t)}}async $rename(i,e,t){try{await this._fileService.move(A.revive(i),A.revive(e),t.overwrite)}catch(o){return K_._handleError(o)}}async $copy(i,e,t){try{await this._fileService.copy(A.revive(i),A.revive(e),t.overwrite)}catch(o){return K_._handleError(o)}}async $mkdir(i){try{await this._fileService.createFolder(A.revive(i))}catch(e){return K_._handleError(e)}}async $delete(i,e){try{return await this._fileService.del(A.revive(i),e)}catch(t){return K_._handleError(t)}}static _handleError(i){if(i instanceof As)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=Gse(i);e!=="Unknown"&&(i.name=e)}throw i}$ensureActivation(i){return this._fileService.activateProvider(i)}};K_=I([vo(Gi.MainThreadFileSystem),m(1,be)],K_);var api=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=H.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,Je.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,Je.wrap(t).slice(o,o+n))}};var u5=class{constructor(i,e,t,o,n,r,s,l,c,u,p){this._fileService=e;this._logService=p;this._listener=new P;this._watches=new jt;this._proxy=i.getProxy(Zi.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 $e(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 wa(V,w.token)},()=>{w.cancel()}).finally(()=>{w.dispose(),clearTimeout(k)});if(!T||T.edit.edits.length===0)return;let N=T.edit.edits.some(V=>V.metadata?.needsConfirmation),O=s.getBoolean(u5.MementoKeyAdditionalEdits,0);if(c.extensionTestsLocationURI&&(O=!1),O===void 0){let V;if(T.extensionNames.length===1?v===0?V=d(3023,null,T.extensionNames[0]):v===3?V=d(3022,null,T.extensionNames[0]):v===2?V=d(3025,null,T.extensionNames[0]):V=d(3024,null,T.extensionNames[0]):v===0?V=d(3027,null,T.extensionNames.length):v===3?V=d(3026,null,T.extensionNames.length):v===2?V=d(3029,null,T.extensionNames.length):V=d(3028,null,T.extensionNames.length),N){let{confirmed:U}=await r.confirm({type:gt.Info,message:V,primaryButton:d(3038,null),cancelButton:d(3030,null)});if(O=!0,!U)return}else{let U;(se=>(se[se.OK=0]="OK",se[se.Preview=1]="Preview",se[se.Cancel=2]="Cancel"))(U||={});let{result:G,checkboxChecked:$}=await r.prompt({type:gt.Info,message:V,buttons:[{label:d(3037,null),run:()=>0},{label:d(3038,null),run:()=>1}],cancelButton:{label:d(3030,null),run:()=>2},checkbox:{label:d(3021,null)}});if(G===2)return;O=G===1,$&&s.store(u5.MementoKeyAdditionalEdits,O,0,0)}}l.info("[onWill-handler] applying additional workspace edit from extensions",T.extensionNames),await o.apply(iV(T.edit,u),{undoRedoGroupId:b?.undoRedoGroupId,showPreview:O})}_progressLabel(f){switch(f){case 0:return d(3033,null);case 2:return d(3035,null);case 3:return d(3032,null);case 1:return d(3034,null);case 4:return d(3036,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 P,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()}};u5.MementoKeyAdditionalEdits="file.particpants.additionalEdits",u5=I([vo(Gi.MainThreadFileSystemEventService),m(1,be),m(2,kp),m(3,ma),m(4,Bo),m(5,ct),m(6,le),m(7,ne),m(8,Co),m(9,dt),m(10,ne)],u5);W(class extends K{constructor(){super({id:"files.participants.resetChoice",title:{value:d(3031,null),original:"Reset choice for 'File operation needs preview'"},f1:!0})}run(i){i.get(le).remove(u5.MementoKeyAdditionalEdits,0)}});var BE=Symbol("unset"),EP=class{constructor(){this.root=new l6e;this._size=0}get size(){return this._size}get nodes(){return this.root.children?.values()||ht.empty()}get entries(){return this.root.children?.entries()||ht.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===BE?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!==BE){for(this._size--,e[t].node._value=BE;t>0;t--){let{node:n,part:r}=e[t];if(n.children?.size||n._value!==BE)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!==BE)break}for(let o of zJi(t))o._value!==BE&&(this._size--,yield o._value);t===this.root&&(this.root._value=BE,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===BE?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!==BE)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!==BE}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 l6e;o.children.set(s,l),o=l}else{let l=new l6e;o.children=new Map([[s,l]]),o=l}t?.(o)}let n=o._value===BE?0:1;e(o);let r=o._value===BE?0:1;this._size+=r-n}*values(){for(let{_value:i}of zJi(this.root))i!==BE&&(yield i)}};function*zJi(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 l6e=class{constructor(){this._value=BE}get value(){return this._value===BE?void 0:this._value}set value(i){this._value=i===void 0?BE:i}};var TP=(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))(TP||{}),Jh={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(TP).map(a=>[a,a]))},CC={SessionStart:{label:d(7687,null),description:d(7686,null)},UserPromptSubmit:{label:d(7695,null),description:d(7694,null)},PreToolUse:{label:d(7683,null),description:d(7682,null)},PostToolUse:{label:d(7679,null),description:d(7678,null)},PreCompact:{label:d(7681,null),description:d(7680,null)},SubagentStart:{label:d(7691,null),description:d(7690,null)},SubagentStop:{label:d(7693,null),description:d(7692,null)},Stop:{label:d(7689,null),description:d(7688,null)},SessionEnd:{label:d(7685,null),description:d(7684,null)},ErrorOccurred:{label:d(7677,null),description:d(7676,null)}};function xDt(a,i){if(!a)return i;let e={...a};for(let t of Object.values(TP)){let o=a[t],n=i[t];n&&n.length>0&&(e[t]=o?[...o,...n]:n)}return e}var xC={type:d(7669,null),command:d(7660,null),windows:d(7670,null),linux:d(7664,null),osx:d(7665,null),bash:d(7658,null),powershell:d(7666,null),cwd:d(7662,null),env:d(7663,null),timeout:d(7667,null),timeoutSec:d(7668,null)},Szo={type:"object",additionalProperties:!0,required:["type"],anyOf:[{required:["command"]},{required:["windows"]},{required:["linux"]},{required:["osx"]},{required:["bash"]},{required:["powershell"]}],errorMessage:d(7661,null),properties:{type:{type:"string",enum:["command"],description:xC.type},command:{type:"string",description:xC.command},windows:{type:"string",description:xC.windows},linux:{type:"string",description:xC.linux},osx:{type:"string",description:xC.osx},cwd:{type:"string",description:xC.cwd},env:{type:"object",additionalProperties:{type:"string"},description:xC.env},timeout:{type:"number",default:30,description:xC.timeout}}},Izo={type:"array",items:Szo};function $Ji(a,i){return Object.fromEntries(Object.entries(Jh[a]).map(([e,t])=>[e,{...i,description:CC[t]?.description}]))}var yzo=$Ji("vscode",Izo),wzo={type:"object",additionalProperties:!0,required:["type"],anyOf:[{required:["bash"]},{required:["powershell"]}],errorMessage:d(7659,null),properties:{type:{type:"string",enum:["command"],description:xC.type},bash:{type:"string",description:xC.bash},powershell:{type:"string",description:xC.powershell},cwd:{type:"string",description:xC.cwd},env:{type:"object",additionalProperties:{type:"string"},description:xC.env},timeoutSec:{type:"number",default:10,description:xC.timeoutSec}}},Czo={type:"array",items:wzo},xzo=$Ji("github-copilot",Czo),qJi={$schema:"http://json-schema.org/draft-07/schema#",type:"object",description:d(7671,null),additionalProperties:!0,required:["hooks"],properties:{hooks:{type:"object",description:d(7672,null),additionalProperties:!0}},if:{required:["version"],properties:{version:{type:"number"}}},then:{properties:{version:{type:"number",description:d(7675,null)},hooks:{properties:xzo}}},else:{properties:{hooks:{properties:yzo}}},defaultSnippets:[{label:d(7673,null),description:d(7674,null),body:{hooks:{SessionStart:[{type:"command",command:'${1:echo "Session started" >> session.log}'}],PreToolUse:[{type:"command",command:"${2:./scripts/validate.sh}",timeout:15}]}}}]},cpi="vscode://schemas/hooks";function c6e(a){if(Object.values(TP).includes(a))return a}function kzo(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 dpi(a,i){return i===1&&a.windows?a.windows:i===2&&a.osx?a.osx:i===3&&a.linux?a.linux:a.command}function jJi(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 p5(a,i){let e=dpi(a,i);return e||""}function KJi(a,i,e){let t=kzo(a);if(!t)return;let o;if(t.cwd){let n=v9(t.cwd,e);Xl(n)?o=A.file(n):i&&(o=je(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 d6e(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=GJi(r),l=KJi(s,i,e);l&&o.push(l)}else{let r=GJi(t),s=KJi(r,i,e);s&&o.push(s)}return o}function GJi(a){return a.type===void 0||a.type==="command"?{...a,type:"command"}:a}function lpi(a){switch(a.type){case"scalar":return a.value;case"sequence":return a.items.map(lpi);case"map":{let i={};for(let e of a.properties)i[e.key.value]=lpi(e.value);return i}}}function QJi(a,i,e,t="undefined"){let o={},n=Jh[t]??Jh.undefined;for(let r of a.properties){let s=r.key.value,l=n[s]??c6e(s);if(!l||r.value.type!=="sequence")continue;let c=[];for(let u of r.value.items){let p=lpi(u),h=d6e(p,i,e);c.push(...h)}c.length>0&&(o[l]||(o[l]=[]),o[l].push(...c))}return o}var wV=ae("IMcpGalleryManifestService");function m5(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 Tv;(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))(Tv||={});var YJi="ext.";function p6e(a,i){return Ei.toKey(a)+"/"+i}var upi;(i=>{function a(e,t){return e.id===t.id&&e.remoteAuthority===t.remoteAuthority&&e.label===t.label&&e.trustBehavior===t.trustBehavior&&uo(e.sandbox,t.sandbox)}i.equals=a})(upi||={});var CV;(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:_P.fromSerialized(o.launch),sandboxEnabled:o.sandboxEnabled,variableReplacement:o.variableReplacement?XJi.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())&&uo(o.launch,n.launch)&&uo(o.presentation,n.presentation)&&uo(o.variableReplacement,n.variableReplacement)&&uo(o.devMode,n.devMode)&&o.sandboxEnabled===n.sandboxEnabled}t.equals=e})(CV||={});var XJi;(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})(XJi||={});var rEe;(i=>i.Empty={working:!1,starting:[],serversRequiringInteraction:[]})(rEe||={});var es=ae("IMcpService"),hX=class{constructor(){this.participants=new w$}},nk;(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||={})})(nk||={});var sEe=a=>a.template!==void 0;var ppi=a=>a.replace(/[^a-z0-9_.-]/gi,"_"),JJi=a=>"/mcp."+ppi(a.label);var _P;(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 b$(Je.wrap(new Uint8Array(n)))}t.hash=e})(_P||={});var ir;(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(11448,null);case 1:return d(11447,null);case 2:return d(11446,null);case 3:return d(11445,null,r.message);default:Hr(r)}},n.toKindString=r=>{switch(r){case 0:return"stopped";case 1:return"starting";case 2:return"running";case 3:return"error";default:Hr(r)}},n.canBeStarted=r=>r===3||r===0,n.isRunning=r=>!(0,n.canBeStarted)(r.state)})(ir||={});var gX=class extends Error{constructor(e,t,o){super(`MPC ${t}: ${e}`);this.code=t;this.data=o}},u6e=class extends Error{},dw=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 Nf=ae("IMcpWorkbenchService"),mX=class extends C{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()}};mX=I([m(1,Nf)],mX);var ode=new Q("mcpServersGalleryStatus","unavailable"),fX=new Q("hasInstalledMcpServers",!0),aEe="workbench.views.mcp.installed",uw;(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:b$(Je.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:Fbe(n.authority).toString(),resourceURL:u}}o.toServer=t})(uw||={});var h5=ae("IMcpServerSampling"),gb=class a extends Error{constructor(e,t,o){super(t);this.code=e;this.data=o}static methodNotFound(e){return new a(Tv.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(Tv.INTERNAL_ERROR,`Unknown error: ${e.stack}`);return t.cause=e,t}};var m6e=ae("IMcpElicitationService"),ZJi="application/vnd.code.resource-link";var Pr=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 DDt={0:"unset",1:"queued",2:"running",3:"passed",4:"failed",5:"skipped",6:"errored"};var Spi={2:d(15408,null),4:d(15407,null),8:d(15406,null)},eZi=[2,4,8,16,32,64];var h6e;(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))})))(h6e||={});var mpi;(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?Ie.lift(o.position):void 0})))(mpi||={});var hpi;(e=>(e.serialize=t=>({message:t.message,type:0,expected:t.expected,actual:t.actual,contextValue:t.contextValue,location:t.location&&h6e.serialize(t.location),stackTrace:t.stackTrace?.map(mpi.serialize)}),e.deserialize=(t,o)=>({message:o.message,type:0,expected:o.expected,actual:o.actual,contextValue:o.contextValue,location:o.location&&h6e.deserialize(t,o.location),stackTrace:o.stackTrace&&o.stackTrace.map(n=>mpi.deserialize(t,n))})))(hpi||={});var f6e=(a,i)=>`${i?"s":"e"}${a}`,gpi;(e=>(e.serialize=t=>({message:t.message,type:1,offset:t.offset,length:t.length,location:t.location&&h6e.serialize(t.location)}),e.deserialize=(t,o)=>({message:o.message,type:1,offset:o.offset,length:o.length,location:o.location&&h6e.deserialize(t,o.location)})))(gpi||={});var XO;(t=>(t.serialize=o=>o.type===0?hpi.serialize(o):gpi.serialize(o),t.deserialize=(o,n)=>n.type===0?hpi.deserialize(o,n):gpi.deserialize(o,n),t.isDiffable=o=>o.type===0&&o.actual!==void 0&&o.expected!==void 0))(XO||={});var EDt;(t=>(t.serializeWithoutMessages=o=>({state:o.state,duration:o.duration,messages:[]}),t.serialize=o=>({state:o.state,duration:o.duration,messages:o.messages.map(XO.serialize)}),t.deserialize=(o,n)=>({state:n.state,duration:n.duration,messages:n.messages.map(r=>XO.deserialize(o,r))})))(EDt||={});var tZi="\0",lEe=(a,i)=>a+tZi+i,LDt=a=>{let i=a.indexOf(tZi);return{ctrlId:a.slice(0,i),tagId:a.slice(i+1)}},g6e;(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})))(g6e||={});var pR;(e=>(e.serialize=t=>({expand:t.expand,item:g6e.serialize(t.item)}),e.deserialize=(t,o)=>({controllerId:Pr.root(o.item.extId),expand:o.expand,item:g6e.deserialize(t,o.item)})))(pR||={});var TDt;(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}}))(TDt||={});var cEe=(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)},v6e;(t=>(t.serializeWithoutMessages=o=>({...pR.serialize(o),ownComputedState:o.ownComputedState,computedState:o.computedState,tasks:o.tasks.map(EDt.serializeWithoutMessages)}),t.serialize=o=>({...pR.serialize(o),ownComputedState:o.ownComputedState,computedState:o.computedState,tasks:o.tasks.map(EDt.serialize)}),t.deserialize=(o,n)=>({...pR.deserialize(o,n),ownComputedState:n.ownComputedState,computedState:n.computedState,tasks:n.tasks.map(r=>EDt.deserialize(o,r)),retired:!0})))(v6e||={});var Ipi;(e=>(e.empty=()=>({covered:0,total:0}),e.sum=(t,o)=>{t.covered+=o.covered,t.total+=o.total}))(Ipi||={});var ypi;(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:Ipi.empty()})))(ypi||={});function wpi(a){return{...a,location:a.location?.toJSON()}}function Cpi(a){return a.location=a.location?Ie.isIPosition(a.location)?Ie.lift(a.location):z.lift(a.location):void 0,a}var xpi;(e=>(e.serialize=t=>t.type===0?vpi.serialize(t):bpi.serialize(t),e.deserialize=t=>t.type===0?vpi.deserialize(t):bpi.deserialize(t)))(xpi||={});var fpi;(e=>(e.serialize=wpi,e.deserialize=Cpi))(fpi||={});var vpi;(e=>(e.serialize=wpi,e.deserialize=Cpi))(vpi||={});var bpi;(e=>(e.serialize=t=>({...wpi(t),branches:t.branches?.map(fpi.serialize)}),e.deserialize=t=>({...Cpi(t),branches:t.branches?.map(fpi.deserialize)})))(bpi||={});var RDt;(e=>(e.deserialize=(t,o)=>o.op===0?{op:o.op,item:pR.deserialize(t,o.item)}:o.op===1?{op:o.op,item:TDt.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:pR.serialize(t.item)}:t.op===1?{op:t.op,item:TDt.serialize(t.item)}:t))(RDt||={});var _Dt=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(pR.deserialize(this.uriIdentity,t.item),e);break;case 1:this.update(TDt.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=Pr.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++),cEe(t,i),e.update?.(t),t}remove(i,e){let t=this.items.get(i);if(!t)return;let o=Pr.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 dEe=ae("IAiSettingsSearchService");var b6e=(a,i)=>a===i,Ezo={range:(a,i)=>a===i?!0:!a||!i?!1:a.equalsRange(i),busy:b6e,label:b6e,description:b6e,error:b6e,sortText:b6e,tags:(a,i)=>!(a.length!==i.length||a.some(e=>!i.includes(e)))},wza=Object.entries(Ezo);var MDt=class extends Error{constructor(i){super(`TestItem with ID "${i}" is invalid. Make sure to create it from the createTestItem method.`)}};var Tzo=new WeakMap;var iZi=a=>{let i=Tzo.get(a);if(!i)throw new MDt(a?.id||"<unknown>");return i};var Rzo;(e=>{function a(t){let{selectionStartLineNumber:o,selectionStartColumn:n,positionLineNumber:r,positionColumn:s}=t,l=new sc(o-1,n-1),c=new sc(r-1,s-1);return new bj(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})(Rzo||={});var Rs;(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 Kc(o-1,n-1,r-1,s-1)}e.to=i})(Rs||={});var g5;(e=>{function a(t){return{uri:t.uri,range:Rs.from(t.range)}}e.from=a;function i(t){return new y_(A.revive(t.uri),Rs.to(t.range))}e.to=i})(g5||={});var Mzo;(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})(Mzo||={});var I6e;(e=>{function a(t){return new sc(t.lineNumber-1,t.column-1)}e.to=a;function i(t){return{lineNumber:t.line+1,column:t.character+1}}e.from=i})(I6e||={});var Pzo;(t=>{function a(o,n,r){return si(Yl(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:Az.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}})(Pzo||={});var kpi;(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})(kpi||={});var Azo;(e=>{function a(t){let o;return t.code&&(Ae(t.code)||Xo(t.code)?o=String(t.code):o={value:String(t.code.value),target:t.code.target}),{...Rs.from(t.range),message:t.message,source:t.source,code:o,severity:ADt.from(t.severity),relatedInformation:t.relatedInformation&&t.relatedInformation.map(Epi.from),tags:Array.isArray(t.tags)?si(t.tags.map(kpi.from)):void 0}}e.from=a;function i(t){let o=new Zle(Rs.to(t),t.message,ADt.to(t.severity));return o.source=t.source,o.code=Ae(t.code)?t.code:t.code?.value,o.relatedInformation=t.relatedInformation&&t.relatedInformation.map(Epi.to),o.tags=t.tags&&si(t.tags.map(kpi.to)),o}e.to=i})(Azo||={});var Epi;(e=>{function a(t){return{...Rs.from(t.location.range),message:t.message,resource:t.location.uri}}e.from=a;function i(t){return new aY(new y_(t.resource,Rs.to(t)),t.message)}e.to=i})(Epi||={});var ADt;(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})(ADt||={});var Nzo;(e=>{function a(t){return typeof t=="number"&&t>=1?t-1:t===-2?vn:Un}e.from=a;function i(t){if(typeof t=="number"&&t>=0)return t+1;throw new Error("invalid 'EditorGroupColumn'")}e.to=i})(Nzo||={});var Ku;(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 EE.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 Yc.walkTokens(Yc.lexer(l.value),p=>{p.type==="link"?u({href:p.href}):p.type==="image"&&typeof p.href=="string"&&u(iSt(p.href))}),l}r.from=e;function t(s,l){if(!s)return s;let c;try{c=zg(s)}catch{}if(!c)return s;let u=!1;return c=Gk(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 EE(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})(Ku||={});function Gpi(a){return typeof a>"u"?a:typeof a=="string"?A.file(a):a}var y6e;(i=>{function a(e){return typeof e>"u"?e:{contentText:e.contentText,contentIconPath:e.contentIconPath?Gpi(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})(y6e||={});var Tpi;(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?Gpi(e.gutterIconPath):void 0,gutterIconSize:e.gutterIconSize,overviewRulerColor:e.overviewRulerColor,before:e.before?y6e.from(e.before):void 0,after:e.after?y6e.from(e.after):void 0}}i.from=a})(Tpi||={});var nZi;(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})(nZi||={});var Ozo;(i=>{function a(e){return{isWholeLine:e.isWholeLine,rangeBehavior:e.rangeBehavior?nZi.from(e.rangeBehavior):void 0,overviewRulerLane:e.overviewRulerLane,light:e.light?Tpi.from(e.light):void 0,dark:e.dark?Tpi.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?Gpi(e.gutterIconPath):void 0,gutterIconSize:e.gutterIconSize,overviewRulerColor:e.overviewRulerColor,before:e.before?y6e.from(e.before):void 0,after:e.after?y6e.from(e.after):void 0}}i.from=a})(Ozo||={});var Nz;(e=>{function a(t){return{text:t.newText,eol:t.newEol&&Mpi.from(t.newEol),range:Rs.from(t.range)}}e.from=a;function i(t){let o=new Hx(Rs.to(t.range),t.text);return o.newEol=typeof t.eol>"u"?void 0:Mpi.to(t.eol),o}e.to=i})(Nz||={});var Fzo;(e=>{function a(t,o){let n={edits:[]};if(t instanceof dY){let r=new Mn;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:Qd(Je.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:Nz.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:Rs.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(C6e.from)}})}return n}e.from=a;function i(t){let o=new dY,n=new vt;for(let r of t.edits)if(r.textEdit){let s=r,l=A.revive(s.resource),c=Rs.to(s.textEdit.range),u=s.textEdit.text,p=s.textEdit.insertAsSnippet,h;p?h=ece.replace(c,new TE(u)):h=Hx.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})(Fzo||={});var f5;(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})(f5||={});var nde;(e=>{function a(t){if(t===1)return 1}e.from=a;function i(t){if(t===1)return 1}e.to=i})(nde||={});var _pi;(e=>{function a(t){return{name:t.name,kind:f5.from(t.kind),tags:t.tags&&t.tags.map(nde.from),containerName:t.containerName,location:w6e.from(t.location)}}e.from=a;function i(t){let o=new Sj(t.name,f5.to(t.kind),t.containerName,w6e.to(t.location));return o.tags=t.tags&&t.tags.map(nde.to),o}e.to=i})(_pi||={});var Wzo;(e=>{function a(t){let o={name:t.name||"!!MISSING: name!!",detail:t.detail,range:Rs.from(t.range),selectionRange:Rs.from(t.selectionRange),kind:f5.from(t.kind),tags:t.tags?.map(nde.from)??[]};return t.children&&(o.children=t.children.map(a)),o}e.from=a;function i(t){let o=new wj(t.name,t.detail,f5.to(t.kind),Rs.to(t.range),Rs.to(t.selectionRange));return dr(t.tags)&&(o.tags=t.tags.map(nde.to)),t.children&&(o.children=t.children.map(i)),o}e.to=i})(Wzo||={});var $pi;(e=>{function a(t){let o=new Nkt(f5.to(t.kind),t.name,t.detail||"",A.revive(t.uri),Rs.to(t.range),Rs.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:f5.from(t.kind),uri:t.uri,range:Rs.from(t.range),selectionRange:Rs.from(t.selectionRange),tags:t.tags?.map(nde.from)}}e.from=i})($pi||={});var Vzo;(i=>{function a(e){return new Okt($pi.to(e.from),e.fromRanges.map(t=>Rs.to(t)))}i.to=a})(Vzo||={});var Bzo;(i=>{function a(e){return new Fkt($pi.to(e.to),e.fromRanges.map(t=>Rs.to(t)))}i.to=a})(Bzo||={});var w6e;(e=>{function a(t){return{range:t.range&&Rs.from(t.range),uri:t.uri}}e.from=a;function i(t){return new y_(A.revive(t.uri),Rs.to(t.range))}e.to=i})(w6e||={});var Hzo;(e=>{function a(t){let o=t,n=t;return{originSelectionRange:o.originSelectionRange?Rs.from(o.originSelectionRange):void 0,uri:o.targetUri?o.targetUri:n.uri,range:Rs.from(o.targetRange?o.targetRange:n.range),targetSelectionRange:o.targetSelectionRange?Rs.from(o.targetSelectionRange):void 0}}e.from=a;function i(t){return{targetUri:A.revive(t.uri),targetRange:Rs.to(t.range),targetSelectionRange:t.targetSelectionRange?Rs.to(t.targetSelectionRange):void 0,originSelectionRange:t.originSelectionRange?Rs.to(t.originSelectionRange):void 0}}e.to=i})(Hzo||={});var Uzo;(e=>{function a(t){return{range:Rs.from(t.range),contents:Ku.fromMany(t.contents),canIncreaseVerbosity:t.canIncreaseVerbosity,canDecreaseVerbosity:t.canDecreaseVerbosity}}e.from=a;function i(t){let o=t.contents.map(Ku.to),n=Rs.to(t.range),r=t.canIncreaseVerbosity,s=t.canDecreaseVerbosity;return new pxe(o,n,r,s)}e.to=i})(Uzo||={});var zzo;(e=>{function a(t){return{range:Rs.from(t.range),expression:t.expression}}e.from=a;function i(t){return new Cxe(Rs.to(t.range),t.expression)}e.to=i})(zzo||={});var Kzo;(e=>{function a(t){if(t instanceof xxe)return{type:"text",range:Rs.from(t.range),text:t.text};if(t instanceof kxe)return{type:"variable",range:Rs.from(t.range),variableName:t.variableName,caseSensitiveLookup:t.caseSensitiveLookup};if(t instanceof Exe)return{type:"expression",range:Rs.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:Rs.to(t.range),text:t.text};case"variable":return{range:Rs.to(t.range),variableName:t.variableName,caseSensitiveLookup:t.caseSensitiveLookup};case"expression":return{range:Rs.to(t.range),expression:t.expression}}}e.to=i})(Kzo||={});var Gzo;(e=>{function a(t){return{frameId:t.frameId,stoppedLocation:Rs.from(t.stoppedLocation)}}e.from=a;function i(t){return new Txe(t.frameId,Rs.to(t.stoppedLocation))}e.to=i})(Gzo||={});var Dpi;(e=>{function a(t){return{range:Rs.from(t.range),kind:t.kind}}e.from=a;function i(t){return new mxe(Rs.to(t.range),t.kind)}e.to=i})(Dpi||={});var $zo;(e=>{function a(t){return{uri:t.uri,highlights:t.highlights.map(Dpi.from)}}e.from=a;function i(t){return new hxe(A.revive(t.uri),t.highlights.map(Dpi.to))}e.to=i})($zo||={});var rZi;(i=>{function a(e){switch(e){case 1:return 1;case 2:return 2;case 0:default:return 0}}i.to=a})(rZi||={});var qzo;(i=>{function a(e){return{triggerKind:rZi.to(e.triggerKind),triggerCharacter:e.triggerCharacter}}i.to=a})(qzo||={});var sZi;(e=>{function a(t){if(t===1)return 1}e.from=a;function i(t){if(t===1)return 1}e.to=i})(sZi||={});var jzo;(i=>{function a(e,t,o){return"icon"in e&&"command"in e?{command:t.toInternal(e.command,o),icon:VZi.fromThemeIcon(e.icon)}:{command:t.toInternal(e,o)}}i.from=a})(jzo||={});var aZi;(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})(aZi||={});var Qzo;(i=>{function a(e,t){let o=new bxe(e.label);return o.insertText=e.insertText,o.kind=aZi.to(e.kind),o.tags=e.tags?.map(sZi.to),o.detail=e.detail,o.documentation=Mr(e.documentation)?Ku.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=Rs.to(e.range):typeof e.range=="object"&&(o.range={inserting:Rs.to(e.range.insert),replacing:Rs.to(e.range.replace)}),o.keepWhitespace=typeof e.insertTextRules>"u"?!1:!!(e.insertTextRules&1),typeof e.insertTextRules<"u"&&e.insertTextRules&4?o.insertText=new TE(e.insertText):(o.insertText=e.insertText,o.textEdit=o.range instanceof Kc?new Hx(o.range,o.insertText):void 0),e.additionalTextEdits&&e.additionalTextEdits.length>0&&(o.additionalTextEdits=e.additionalTextEdits.map(n=>Nz.to(n))),o.command=t&&e.command?t.fromInternal(e.command):void 0,o}i.to=a})(Qzo||={});var Lpi;(e=>{function a(t){if(typeof t.label!="string"&&!Array.isArray(t.label))throw new TypeError("Invalid label");return{label:t.label,documentation:Ku.fromStrict(t.documentation)}}e.from=a;function i(t){return{label:t.label,documentation:Mr(t.documentation)?Ku.to(t.documentation):t.documentation}}e.to=i})(Lpi||={});var Rpi;(e=>{function a(t){return{label:t.label,documentation:Ku.fromStrict(t.documentation),parameters:Array.isArray(t.parameters)?t.parameters.map(Lpi.from):[],activeParameter:t.activeParameter}}e.from=a;function i(t){return{label:t.label,documentation:Mr(t.documentation)?Ku.to(t.documentation):t.documentation,parameters:Array.isArray(t.parameters)?t.parameters.map(Lpi.to):[],activeParameter:t.activeParameter}}e.to=i})(Rpi||={});var Yzo;(e=>{function a(t){return{activeSignature:t.activeSignature,activeParameter:t.activeParameter,signatures:Array.isArray(t.signatures)?t.signatures.map(Rpi.from):[]}}e.from=a;function i(t){return{activeSignature:t.activeSignature,activeParameter:t.activeParameter,signatures:Array.isArray(t.signatures)?t.signatures.map(Rpi.to):[]}}e.to=i})(Yzo||={});var Xzo;(i=>{function a(e,t){let o=new vxe(I6e.to(t.position),typeof t.label=="string"?t.label:t.label.map(lZi.to.bind(void 0,e)),t.kind&&cZi.to(t.kind));return o.textEdits=t.textEdits&&t.textEdits.map(Nz.to),o.tooltip=Mr(t.tooltip)?Ku.to(t.tooltip):t.tooltip,o.paddingLeft=t.paddingLeft,o.paddingRight=t.paddingRight,o}i.to=a})(Xzo||={});var lZi;(i=>{function a(e,t){let o=new fxe(t.label);return o.tooltip=Mr(t.tooltip)?Ku.to(t.tooltip):t.tooltip,vse.is(t.command)&&(o.command=e.fromInternal(t.command)),t.location&&(o.location=w6e.to(t.location)),o}i.to=a})(lZi||={});var cZi;(e=>{function a(t){return t}e.from=a;function i(t){return t}e.to=i})(cZi||={});var Jzo;(e=>{function a(t){return{range:Rs.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 Sxe(Rs.to(t.range),o);return n.tooltip=t.tooltip,n}e.to=i})(Jzo||={});var Zzo;(e=>{function a(t){let o=new Ixe(t.label);return t.textEdit&&(o.textEdit=Nz.to(t.textEdit)),t.additionalTextEdits&&(o.additionalTextEdits=t.additionalTextEdits.map(n=>Nz.to(n))),o}e.to=a;function i(t){return{label:t.label,textEdit:t.textEdit?Nz.from(t.textEdit):void 0,additionalTextEdits:t.additionalTextEdits?t.additionalTextEdits.map(o=>Nz.from(o)):void 0}}e.from=i})(Zzo||={});var eKo;(e=>{function a(t){return new oce(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})(eKo||={});var tKo;(e=>{function a(t){return{range:Rs.from(t.range)}}e.from=a;function i(t){return new gxe(Rs.to(t.range))}e.to=i})(tKo||={});var iKo;(i=>{function a(e){switch(e){case 2:return 2;case 1:return 1;case 3:case 4:return 3}}i.to=a})(iKo||={});var oKo;(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})(oKo||={});var Mpi;(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})(Mpi||={});var nKo;(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})(nKo||={});var rKo;(e=>{function a(t){let o={start:t.start+1,end:t.end+1};return t.kind&&(o.kind=Ppi.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=Ppi.to(t.kind)),o}e.to=i})(rKo||={});var Ppi;(e=>{function a(t){if(t)switch(t){case 1:return Yk.Comment;case 2:return Yk.Imports;case 3:return Yk.Region}}e.from=a;function i(t){if(t)switch(t.value){case Yk.Comment.value:return 1;case Yk.Imports.value:return 2;case Yk.Region.value:return 3}}e.to=i})(Ppi||={});var sKo;(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"?Rs.from(e.selection):void 0,override:typeof e.override=="boolean"?Ys.id:void 0}}i.from=a})(sKo||={});var Az;(o=>{function a(n){return n instanceof pY?n.toJSON():typeof n=="string"?n:i(n)||e(n)?new pY(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 pY(A.revive(n.baseUri),n.pattern)}o.to=t})(Az||={});var aKo;(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:Az.from(t.pattern)??void 0,exclusive:t.exclusive,notebookType:t.notebookType}}}else return}i.from=a})(aKo||={});var lKo;(e=>{function a(t){return{start:t.start,end:t.end}}e.from=a;function i(t){return new vj(t.start,t.end)}e.to=i})(lKo||={});var Api;(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})(Api||={});var Npi;(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})(Npi||={});var cKo;(e=>{function a(t){let o={metadata:t.metadata??Object.create(null),cells:[]};for(let n of t.cells)cxe.validate(n),o.cells.push(C6e.from(n));return o}e.from=a;function i(t){let o=new O3e(t.cells.map(C6e.to));return mf(t.metadata)||(o.metadata=t.metadata),o}e.to=i})(cKo||={});var C6e;(e=>{function a(t){return{cellKind:Npi.from(t.kind),language:t.languageId,mime:t.mime,source:t.value,metadata:t.metadata,internalMetadata:Api.from(t.executionSummary??{}),outputs:t.outputs?t.outputs.map(Fpi.from):[]}}e.from=a;function i(t){return new cxe(Npi.to(t.cellKind),t.source,t.language,t.mime,t.outputs?t.outputs.map(Fpi.to):void 0,t.metadata,t.internalMetadata?Api.to(t.internalMetadata):void 0)}e.to=i})(C6e||={});var Opi;(e=>{function a(t){return{mime:t.mime,valueBytes:Je.wrap(t.data)}}e.from=a;function i(t){return new F3e(t.valueBytes.buffer,t.mime)}e.to=i})(Opi||={});var Fpi;(e=>{function a(t){return{outputId:t.id,items:t.items.map(Opi.from),metadata:t.metadata}}e.from=a;function i(t){let o=t.items.map(Opi.to);return new W3e(o,t.outputId,t.metadata)}e.to=i})(Fpi||={});var dKo;(t=>{function a(o){return e(o)?{include:Az.from(o.include)??void 0,exclude:Az.from(o.exclude)??void 0}:Az.from(o)??void 0}t.from=a;function i(o){return e(o)?{include:Az.to(o.include),exclude:Az.to(o.exclude)}:Az.to(o)}t.to=i;function e(o){let n=o;return n?!Jn(n.include)&&!Jn(n.exclude):!1}})(dKo||={});var uKo;(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})(uKo||={});var pKo;(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})(pKo||={});var mKo;(i=>{function a(e){return{transientOutputs:e?.transientOutputs??!1,transientCellMetadata:e?.transientCellMetadata??{},transientDocumentMetadata:e?.transientDocumentMetadata??{},cellContentMetadata:e?.cellContentMetadata??{}}}i.from=a})(mKo||={});var hKo;(e=>{function a(t){return{uri:t.uri,provides:t.provides}}e.from=a;function i(t){return new Bkt(A.revive(t.uri),t.provides)}e.to=i})(hKo||={});var dZi;(e=>{function a(t){return{message:Ku.fromStrict(t.message)||"",type:0,expected:t.expectedOutput,actual:t.actualOutput,contextValue:t.contextValue,location:t.location&&{range:Rs.from(t.location.range),uri:t.location.uri},stackTrace:t.stackTrace?.map(o=>({label:o.label,position:o.position&&I6e.from(o.position),uri:o.uri&&A.revive(o.uri).toJSON()}))}}e.from=a;function i(t){let o=new mY(typeof t.message=="string"?t.message:Ku.to(t.message));return o.actualOutput=t.actual,o.expectedOutput=t.expected,o.contextValue=t.contextValue,o.location=t.location?w6e.to(t.location):void 0,o}e.to=i})(dZi||={});var x6e;(e=>(e.namespace=lEe,e.denamespace=LDt))(x6e||={});var gKo;(i=>{function a(e){return{controllerId:e.controllerId,profileId:e.profileId,group:uZi.from(e.kind)}}i.from=a})(gKo||={});var uZi;(e=>{let a={3:8,2:4,1:2};function i(t){return a.hasOwnProperty(t)?a[t]:2}e.from=i})(uZi||={});var pZi;(e=>{function a(t){let o=iZi(t).controllerId;return{extId:Pr.fromExtHostTestItem(t,o).toString(),label:t.label,uri:A.revive(t.uri),busy:t.busy,tags:t.tags.map(n=>x6e.namespace(o,n.id)),range:z.lift(Rs.from(t.range)),description:t.description||null,sortText:t.sortText||null,error:t.error&&Ku.fromStrict(t.error)||null}}e.from=a;function i(t){return{parent:void 0,error:void 0,id:Pr.fromString(t.extId).localId,label:t.label,uri:A.revive(t.uri),tags:(t.tags||[]).map(o=>{let{tagId:n}=x6e.denamespace(o);return new rce(n)}),children:{add:()=>{},delete:()=>{},forEach:()=>{},*[Symbol.iterator](){},get:()=>{},replace:()=>{},size:0},range:Rs.to(t.range||void 0),canResolveChildren:!1,busy:t.busy,description:t.description||void 0,sortText:t.sortText||void 0}}e.toPlain=i})(pZi||={});(e=>{function a(t){return{id:t.id}}e.from=a;function i(t){return new rce(t.id)}e.to=i})(x6e||={});var fKo;(e=>{let a=(t,o)=>{let n=t.value;if(!n)return;let r={...pZi.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(dZi.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 EP;for(let s of t.items)o.insert(Pr.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(mo)}}e.to=i})(fKo||={});var vKo;(r=>{function a(s){return{covered:s.covered,total:s.total}}function i(s){return"line"in s?I6e.from(s):Rs.from(s)}function e(s){if(s)return"endLineNumber"in s?Rs.to(s):I6e.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 Ukt(s.count,e(s.location),s.branches?.map(c=>new zkt(c.count,e(c.location),c.label)))}else return new Kkt(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 p8e(c.statementCoverage),p8e(c.branchCoverage),p8e(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 Hkt&&c.includesTests.length?c.includesTests.map(u=>Pr.fromExtHostTestItem(u,s).toString()):void 0}}r.fromFile=n})(vKo||={});var bKo;(i=>{function a(e){switch(e){case 1:return 1;case 2:return 2}}i.to=a})(bKo||={});var SKo;(e=>{function a(t){let o=new Gkt(f5.to(t.kind),t.name,t.detail||"",A.revive(t.uri),Rs.to(t.range),Rs.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:f5.from(t.kind),name:t.name,detail:t.detail??"",uri:t.uri,range:Rs.from(t.range),selectionRange:Rs.from(t.selectionRange),tags:t.tags?.map(nde.from)}}e.from=i})(SKo||={});var IKo;(i=>{function a(e){if(e)return{value:e.value,tooltip:e.tooltip}}i.from=a})(IKo||={});var PDt;(o=>{function a(n,r,s){let l=r.fileData;return l?new Wkt(new Vkt(l.name,A.revive(l.uri),l.id,wd(()=>s(l.id)))):n===Zn.uriList&&r.uriListData?new _xe(t(r.uriListData)):new _xe(r.asString)}o.to=a;async function i(n,r,s=_t()){let l=await r.asString();if(n===Zn.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 Uy.split(n).map(r=>{if(r.startsWith("#"))return r;try{return A.parse(r)}catch{}return r})}function t(n){return Uy.create(n.map(r=>typeof r=="string"?r:A.revive(r)))}})(PDt||={});var sde;(t=>{function a(o,n){let r=o.items.map(([s,l])=>[s,PDt.to(s,l,n)]);return new wxe(r)}t.toDataTransfer=a;async function i(o){return{items:await Promise.all(Array.from(o,async([r,s])=>[r,await PDt.from(r,s)]))}}t.from=i;async function e(o){return{items:await Promise.all(Array.from(o,async([r,s])=>[r,await PDt.from(r,s,s.id)]))}}t.fromList=e})(sde||={});var mZi;(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})(mZi||={});var k6e;(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})(k6e||={});var yKo;(e=>{function a(t){let o=t.content.map(s=>{if(s.type==="text")return new qS(s.value,s.audience);if(s.type==="tool_result"){let l=si(s.value.map(c=>c.type==="text"?new qS(c.value,c.audience):c.type==="data"?new w_(c.data.buffer,c.mimeType):c.type==="prompt_tsx"?new lz(c.value):void 0));return new lce(s.toolCallId,l,s.isError)}else{if(s.type==="image_url")return new w_(s.value.data.buffer,s.value.mimeType);if(s.type==="data")return new w_(s.data.buffer,s.mimeType);if(s.type==="tool_use")return new cce(s.toolCallId,s.name,s.parameters)}}).filter(s=>s!==void 0),n=k6e.to(t.role);return new iEt(n,o,t.name)}e.to=a;function i(t){let o=k6e.from(t.role),n=t.name,r=t.content;typeof r=="string"&&(r=[new qS(r)]);let s=r.map(l=>{if(l instanceof lce)return{type:"tool_result",toolCallId:l.callId,value:si(l.content.map(c=>c instanceof qS?{type:"text",value:c.value,audience:c.audience}:c instanceof lz?{type:"prompt_tsx",value:c.value}:c instanceof w_?{type:"data",mimeType:c.mimeType,data:Je.wrap(c.data),audience:c.audience}:void 0)),isError:l.isError};if(l instanceof w_)return hZi(l)?{type:"image_url",value:{mimeType:l.mimeType,data:Je.wrap(l.data)}}:{type:"data",mimeType:l.mimeType,data:Je.wrap(l.data),audience:l.audience};if(l instanceof cce)return{type:"tool_use",toolCallId:l.callId,name:l.name,parameters:l.input};if(l instanceof qS)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})(yKo||={});var wKo;(e=>{function a(t){let o=t.content.map(s=>{if(s.type==="text")return new qS(s.value,s.audience);if(s.type==="tool_result"){let l=s.value.map(c=>c.type==="text"?new qS(c.value,c.audience):c.type==="data"?new w_(c.data.buffer,c.mimeType):new lz(c.value));return new lce(s.toolCallId,l,s.isError)}else return s.type==="image_url"?new w_(s.value.data.buffer,s.value.mimeType):s.type==="data"?new w_(s.data.buffer,s.mimeType):s.type==="thinking"?new Dxe(s.value,s.id,s.metadata):new cce(s.toolCallId,s.name,s.parameters)}),n=k6e.to(t.role);return new oEt(n,o,t.name)}e.to=a;function i(t){let o=k6e.from(t.role),n=t.name,r=t.content;typeof r=="string"&&(r=[new qS(r)]);let s=r.map(l=>{if(l instanceof lce)return{type:"tool_result",toolCallId:l.callId,value:si(l.content.map(c=>c instanceof qS?{type:"text",value:c.value,audience:c.audience}:c instanceof lz?{type:"prompt_tsx",value:c.value}:c instanceof w_?{type:"data",mimeType:c.mimeType,data:Je.wrap(c.data),audience:c.audience}:void 0)),isError:l.isError};if(l instanceof w_)return hZi(l)?{type:"image_url",value:{mimeType:l.mimeType,data:Je.wrap(l.data)}}:{type:"data",mimeType:l.mimeType,data:Je.wrap(l.data),audience:l.audience};if(l instanceof cce)return{type:"tool_use",toolCallId:l.callId,name:l.name,parameters:l.input};if(l instanceof qS)return{type:"text",value:l.value};if(l instanceof Dxe)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})(wKo||={});function hZi(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 Wpi;(e=>{function a(t){return{kind:"markdownContent",content:Ku.from(t.value)}}e.from=a;function i(t){return new Q3e(Ku.to(t.content))}e.to=i})(Wpi||={});var gZi;(e=>{function a(t){return{kind:"codeblockUri",uri:t.value,isEdit:t.isEdit,undoStopId:t.undoStopId}}e.from=a;function i(t){return new s8e(A.revive(t.uri),t.isEdit,t.undoStopId)}e.to=i})(gZi||={});var fZi;(e=>{function a(t){return{kind:"markdownVuln",content:Ku.from(t.value),vulnerabilities:t.vulnerabilities}}e.from=a;function i(t){return new Y3e(Ku.to(t.content),t.vulnerabilities)}e.to=i})(fZi||={});var vZi;(i=>{function a(e){return{kind:"confirmation",title:e.title,message:Ku.from(e.message),data:e.data,buttons:e.buttons}}i.from=a})(vZi||={});var bZi;(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?Ku.from(r.message):void 0,options:r.options,defaultValue:r.defaultValue,allowFreeformInput:r.allowFreeformInput})),allowSkip:n.allowSkip}}o.from=e;function t(n){let r=n.questions.map(s=>new Xkt(s.id,i(s.type),s.title,{message:s.message?typeof s.message=="string"?new EE(s.message):Ku.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 l8e(r,n.allowSkip)}o.to=t})(bZi||={});var Vpi;(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:Ye(n),uri:n,children:r(o,n)}}}e.from=a;function i(t){let o=Xn(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 X3e(s,r)}e.to=i})(Vpi||={});var SZi;(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 J3e(o,t.multiDiffData.title,t.readOnly)}e.to=i})(SZi||={});var Bpi;(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)?_pi.from(t.value):g5.from(t.value)}}e.from=a;function i(t){let o=Xn(t);return new Z3e(A.isUri(o.inlineReference)?o.inlineReference:"location"in o.inlineReference?_pi.to(o.inlineReference):g5.to(o.inlineReference),t.name)}e.to=i})(Bpi||={});var IZi;(e=>{function a(t){return{kind:"progressMessage",content:Ku.from(t.value)}}e.from=a;function i(t){return new e8e(t.content.value)}e.to=i})(IZi||={});var yZi;(e=>{function a(t){return{kind:"thinking",value:t.value,id:t.id,metadata:t.metadata}}e.from=a;function i(t){return new t8e(t.value??"",t.id,t.metadata)}e.to=i})(yZi||={});var wZi;(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 i8e(t.hookType,t.stopReason,t.systemMessage,t.metadata)}e.to=i})(wZi||={});var CZi;(e=>{function a(t){return{kind:"warning",content:Ku.from(t.value)}}e.from=a;function i(t){return new o8e(t.content.value)}e.to=i})(CZi||={});var xZi;(i=>{function a(e){return{kind:"extensions",extensions:e.extensions}}i.from=a})(xZi||={});var kZi;(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})(kZi||={});var EZi;(e=>{function a(t){return{kind:"move",uri:t.uri,range:Rs.from(t.range)}}e.from=a;function i(t){return new a8e(A.revive(t.uri),Rs.to(t.range))}e.to=i})(EZi||={});var TZi;(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?Ku.from(c.invocationMessage):void 0,pastTenseMessage:c.pastTenseMessage?Ku.from(c.pastTenseMessage):void 0,toolSpecificData:p,subagentInvocationId:c.subAgentInvocationId}:{kind:"toolInvocationSerialized",toolCallId:c.toolCallId,toolId:c.toolName,invocationMessage:c.invocationMessage?Ku.from(c.invocationMessage):c.toolName,originMessage:c.originMessage?Ku.from(c.originMessage):void 0,pastTenseMessage:c.pastTenseMessage?Ku.from(c.pastTenseMessage):void 0,isConfirmed:c.isConfirmed,isComplete:!0,source:Rn.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?Je.wrap(p.data).toString():Qd(Je.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 y_?g5.from(u):A.revive(u))}:c instanceof qkt?{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 d8e(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}})(TZi||={});var CKo;(i=>{function a(e){return{kind:"progressTask",content:Ku.from(e.value)}}i.from=a})(CKo||={});var xKo;(i=>{function a(e){return{kind:"progressTaskResult",content:typeof e=="string"?Ku.from(e):void 0}}i.from=a})(xKo||={});var Hpi;(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 n8e(o.fromInternal(t.command)??{command:t.command.id,title:t.command.title})}e.to=i})(Hpi||={});var _Zi;(e=>{function a(t){return{kind:"textEdit",uri:t.uri,edits:t.edits.map(o=>Nz.from(o)),done:t.isDone}}e.from=a;function i(t){let o=new c8e(A.revive(t.uri),t.edits.map(n=>Nz.to(n)));return o.isDone=t.done,o}e.to=i})(_Zi||={});var DZi;(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(C6e.from)}}i.from=a})(DZi||={});var LZi;(i=>{function a(e){return{kind:"notebookEdit",uri:e.uri,edits:e.edits.map(DZi.from),done:e.isDone}}i.from=a})(LZi||={});var RZi;(i=>{function a(e){return{kind:"workspaceEdit",edits:e.edits.map(t=>({oldResource:t.oldResource,newResource:t.newResource}))}}i.from=a})(RZi||={});var Upi;(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:g5.from(t.value.value)},iconPath:o,options:t.options}:{kind:"reference",reference:A.isUri(t.value)||typeof t.value=="string"?t.value:g5.from(t.value),iconPath:o,options:t.options}}e.from=a;function i(t){let o=Xn(t),n=r=>A.isUri(r)?r:g5.to(r);return new r8e(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})(Upi||={});var MZi;(i=>{function a(e){return{kind:"codeCitation",value:e.value,license:e.license,snippet:e.snippet}}i.from=a})(MZi||={});var kKo;(t=>{function a(o,n,r){return o instanceof Q3e?Wpi.from(o):o instanceof Z3e?Bpi.from(o):o instanceof r8e?Upi.from(o):o instanceof e8e?IZi.from(o):o instanceof t8e?yZi.from(o):o instanceof i8e?wZi.from(o):o instanceof X3e?Vpi.from(o):o instanceof J3e?SZi.from(o):o instanceof n8e?Hpi.from(o,n,r):o instanceof c8e?_Zi.from(o):o instanceof Jkt?LZi.from(o):o instanceof Y3e?fZi.from(o):o instanceof s8e?gZi.from(o):o instanceof o8e?CZi.from(o):o instanceof $kt?vZi.from(o):o instanceof l8e?bZi.from(o):o instanceof jkt?MZi.from(o):o instanceof a8e?EZi.from(o):o instanceof Qkt?xZi.from(o):o instanceof Ykt?kZi.from(o,n,r):o instanceof d8e?TZi.from(o):o instanceof Zkt?RZi.from(o):{kind:"markdownContent",content:Ku.from("")}}t.from=a;function i(o,n){switch(o.kind){case"reference":return Upi.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 Wpi.to(o);case"inlineReference":return Bpi.to(o);case"progressMessage":return;case"treeData":return Vpi.to(o);case"command":return Hpi.to(o,n)}}t.toContent=e})(kKo||={});var EKo;(i=>{function a(e,t,o,n,r,s,l){let c=[],u=[];for(let g of e.variables.variables)g.kind==="tool"?c.push(g):g.kind==="toolset"?c.push(...g.value):u.push(g);let p=cs.parseLocalSessionId(e.sessionResource)??e.sessionResource.toString(),h={id:e.requestId,prompt:e.message,command:e.command,attempt:e.attempt??0,enableCommandDetection:e.enableCommandDetection??!0,isParticipantDetected:e.isParticipantDetected??!1,sessionId:p,sessionResource:e.sessionResource,references:u.map(g=>AZi.to(g,n,l)).filter(mo),toolReferences:c.map(NDt.to),location:PZi.to(e.location),acceptedConfirmationData:e.acceptedConfirmationData,rejectedConfirmationData:e.rejectedConfirmationData,location2:t,toolInvocationToken:Object.freeze({sessionResource:e.sessionResource}),tools:r,model:o,editedFileEvents:e.editedFileEvents,modeInstructions:e.modeInstructions?.content,modeInstructions2:NZi.to(e.modeInstructions),permissionLevel:e.permissionLevel,subAgentInvocationId:e.subAgentInvocationId,subAgentName:e.subAgentName,parentRequestId:e.parentRequestId,hasHooksEnabled:e.hasHooksEnabled??!1,hooks:e.hooks?BZi.to(e.hooks):void 0};return Ea(s,"chatParticipantPrivate")||(delete h.id,delete h.attempt,delete h.enableCommandDetection,delete h.isParticipantDetected,delete h.location,delete h.location2,delete h.editedFileEvents,delete h.sessionId,delete h.subAgentInvocationId,delete h.subAgentName,delete h.parentRequestId,delete h.hasHooksEnabled,delete h.hooks),Ea(s,"chatParticipantAdditions")||(delete h.acceptedConfirmationData,delete h.rejectedConfirmationData,delete h.tools),h}i.to=a})(EKo||={});var PZi;(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})(PZi||={});var AZi;(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(oh(n))n=A.revive(n);else if(n&&typeof n=="object"&&"uri"in n&&"range"in n&&oh(n.uri))n=g5.to(Xn(n));else if(pV(e)){let s=e.references?.[0]?.reference;n=new eEt(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&&ADt.to(e.filterSeverity),l=e.filterUri&&A.revive(e.filterUri).toString();n=new tEt(t.map(([c,u])=>e.filterUri&&c.toString()!==l?[c,[]]:[c,u.filter(p=>!(s&&p.severity>s||e.filterRange&&!z.areIntersectingOrTouching(e.filterRange,Rs.from(p.range))))]).filter(([,c])=>c.length>0))}let r;return(pP(e)||PY(e))&&e.toolReferences&&(r=qpi.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})(AZi||={});var NDt;(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})(NDt||={});var qpi;(i=>{function a(e){let t=[];for(let o of e)if(o.kind==="tool")t.push(NDt.to(o));else if(o.kind==="toolset")t.push(...o.value.map(NDt.to));else throw new Error("Invalid tool reference in prompt variables");return t}i.to=a})(qpi||={});var NZi;(i=>{function a(e){if(e)return{uri:A.revive(e.uri),name:e.name,content:e.content,toolReferences:qpi.to(e.toolReferences),metadata:e.metadata,isBuiltin:e.isBuiltin}}i.to=a})(NZi||={});var TKo;(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})(TKo||={});var OZi;(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 Gk(o,n=>{if(n.$mid===20)return new u8e(Gk(n.content,e));if(n.$mid===21)return new qS(n.value);if(n.$mid===22)return new Dxe(n.value,n.id,n.metadata);if(n.$mid===23)return new lz(n.value)})}})(OZi||={});var _Ko;(i=>{function a(e,t,o){if(t.action.kind==="vote")return;let n=OZi.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:mZi.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})(_Ko||={});var DKo;(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})(DKo||={});var zpi;(i=>{function a(e){return{...e,documentation:Ku.fromStrict(e.documentation)}}i.from=a})(zpi||={});var LKo;(i=>{function a(e,t){return Array.isArray(e)?{items:e.map(o=>zpi.from(o))}:{items:e.items.map(o=>zpi.from(o)),resourceOptions:e.resourceOptions?FZi.from(e.resourceOptions,t):void 0}}i.from=a})(LKo||={});var FZi;(i=>{function a(e,t){return{...e,pathSeparator:t,cwd:e.cwd,globPattern:Az.from(e.globPattern)??void 0}}i.from=a})(FZi||={});var RKo;(i=>{function a(e){return{kind:WZi.to(e.kind),acceptedLength:e.acceptedLength}}i.to=a})(RKo||={});var WZi;(i=>{function a(e){switch(e){case 0:return 1;case 1:return 2;case 2:return 3;default:return 0}}i.to=a})(WZi||={});var MKo;(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})(MKo||={});var PKo;(e=>{function a(t){return t===2?2:1}e.from=a;function i(t){return t===2?2:1}e.to=i})(PKo||={});var AKo;(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})(AKo||={});var NKo;(i=>{function a(e){return e.type==="mcp"?new sEt(e.label,e.serverLabel||e.label,e.instructions):e.type==="extension"?new rEt(e.extensionId.value,e.label):void 0}i.to=a})(NKo||={});var OKo;(e=>{function a(t){let o=new u8e(t.content.map(n=>n.kind==="text"?new qS(n.value,n.audience):n.kind==="data"?new w_(n.value.data.buffer,n.value.mimeType,n.audience):new lz(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&&P3e(o,"chatParticipantPrivate");let n=c=>{c.audience&&P3e(o,"languageModelToolResultAudience")},r=!1,s;Array.isArray(t.toolResultDetails)?s=t.toolResultDetails?.map(c=>A.isUri(c)?c:g5.from(c)):t.toolResultDetails2&&(s={output:{type:"data",mimeType:t.toolResultDetails2.mime,value:Je.wrap(t.toolResultDetails2.value)}},r=!0);let l={content:t.content.map(c=>{if(c instanceof qS)return n(c),{kind:"text",value:c.value,audience:c.audience};if(c instanceof lz)return{kind:"promptTsx",value:c.value};if(c instanceof w_)return n(c),r=!0,{kind:"data",value:{mimeType:c.mimeType,data:Je.wrap(c.data)},audience:c.audience};throw new Error("Unknown LanguageModelToolResult part type")}),toolResultMessage:Ku.fromStrict(t.toolResultMessage),toolResultDetails:s,toolMetadata:t.toolMetadata,toolResultError:t.hasError};return r?new qh(l):l}e.from=i})(OKo||={});var VZi;(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(oh(o))return A.revive(o);{let n=o;return{light:A.revive(n.light),dark:A.revive(n.dark)}}}else return}t.to=e})(VZi||={});var FKo;(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")}}})(FKo||={});var WKo;(t=>{function a(o){return!!o.uri}function i(o){return _P.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=_P.fromSerialized(o.launch);if(n.type===2)return new lEt(o.label,n.uri,Object.fromEntries(n.headers),o.cacheNonce==="$$NONE"?void 0:o.cacheNonce);{let r=new aEt(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})(WKo||={});var VKo;(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})(VKo||={});var BZi;(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=HZi.to(s);l&&r.push(l)}r.length>0&&(t[o]=r)}return t}i.to=a})(BZi||={});var HZi;(i=>{function a(e){let t=dpi(e,zo);if(t)return{command:t,cwd:e.cwd,env:e.env,timeout:e.timeout}}i.to=a})(HZi||={});var BKo;(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?Ku.from(t.description):void 0,badge:t.badge?Ku.from(t.badge):void 0,status:a(t.status),archived:t.archived,tooltip:Ku.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})(BKo||={});var ade=class{constructor(){this.requestIdPool=0;this.dataTransferFiles=new Map}add(i){let e=this.requestIdPool++;return this.dataTransferFiles.set(e,si(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 Je.wrap(await o.data())}dispose(){this.dataTransferFiles.clear()}};function zZi(a){return typeof a=="string"?!1:Array.isArray(a)?a.every(zZi):!!a.exclusive}var FDt=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}},cd=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)Hli(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 FDt(i.uri,i.getLanguageId(),t.uri,t.type,e):new FDt(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=jW(n.selector,o.uri,o.languageId,hx(i),o.notebookUri,o.notebookType),zZi(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:_6e(i.selector)&&!_6e(e.selector)?1:!_6e(i.selector)&&_6e(e.selector)?-1:i._time<e._time?1:i._time>e._time?-1:0}};function _6e(a){return typeof a=="string"?!1:Array.isArray(a)?a.some(_6e):!!a.isBuiltin}var cde=new cd,lde=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]=cde.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 qH(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(dr(t))return t}catch(t){ss(t)}return[]}async resolveOutgoingCalls(i,e){try{let t=await this.provider.provideOutgoingCalls(i,e);if(dr(t))return t}catch(t){ss(t)}return[]}},D6e=new Map;qe.registerCommand("_executePrepareCallHierarchy",async(a,...i)=>{let[e,t]=i;So(A.isUri(e)),So(Ie.isIPosition(t));let n=a.get(Ct).getModel(e),r;if(!n){let l=await a.get(Nt).createModelReference(e);n=l.object.textEditorModel,r=l}try{let s=await lde.create(n,t,ve.None);return s?(D6e.set(s.id,s),D6e.forEach((l,c,u)=>{u.size>10&&(l.dispose(),D6e.delete(c))}),[s.root]):[]}finally{r?.dispose()}});function KZi(a){return!0}qe.registerCommand("_executeProvideIncomingCalls",async(a,...i)=>{let[e]=i;So(KZi(e));let t=D6e.get(e._sessionId);return t?t.resolveIncomingCalls(e,ve.None):[]});qe.registerCommand("_executeProvideOutgoingCalls",async(a,...i)=>{let[e]=i;So(KZi(e));let t=D6e.get(e._sessionId);return t?t.resolveOutgoingCalls(e,ve.None):[]});var WDt;(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})(WDt||={});var jpi=class{constructor(i,e){this.symbol=i;this.provider=e}};async function VDt(a,i=ve.None){let e=[],t=WDt.all().map(async n=>{try{let r=await n.provideWorkspaceSymbols(a,i);if(!r)return;for(let s of r)e.push(new jpi(s,n))}catch(r){ss(r)}});if(await Promise.all(t),i.isCancellationRequested)return[];function o(n,r){let s=Al(n.symbol.name,r.symbol.name);return s===0&&(s=n.symbol.kind-r.symbol.kind),s===0&&(s=Al(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=Al(n.symbol.containerName??"",r.symbol.containerName??"")),s}return Pg(e,o).map(n=>n[0]).flat()}function SX(a){let i=a.get(ee),e=a.get(Pe),t=a.get(be);return i.editors.map(n=>no.getOriginalUri(n,{supportSideBySide:1})).filter(n=>!!n&&!e.isInsideWorkspace(n)&&t.hasProvider(n))}var GZi=/\s?[#:\(](?:line )?(\d*)(?:[#:,](\d*))?\)?:?\s*$/;function $Zi(a,i){if(!a||i?.some(o=>{let n=a.indexOf(o);return n===0||n>0&&!GZi.test(a.substring(n+1))}))return;let e,t=GZi.exec(a);if(t){let o=parseInt(t[1]??"",10);if(Xo(o)){e={startLineNumber:o,startColumn:1,endLineNumber:o,endColumn:1};let n=parseInt(t[2]??"",10);Xo(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 pEe=new Q("searchState",0);var ude=new cd,dde=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]=ude.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 qH(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(dr(t))return t}catch(t){ss(t)}return[]}async provideSubtypes(i,e){try{let t=await this.provider.provideSubtypes(i,e);if(dr(t))return t}catch(t){ss(t)}return[]}},L6e=new Map;qe.registerCommand("_executePrepareTypeHierarchy",async(a,...i)=>{let[e,t]=i;So(A.isUri(e)),So(Ie.isIPosition(t));let n=a.get(Ct).getModel(e),r;if(!n){let l=await a.get(Nt).createModelReference(e);n=l.object.textEditorModel,r=l}try{let s=await dde.create(n,t,ve.None);if(!s)return[];L6e.forEach((l,c,u)=>{u.size>10&&(l.dispose(),L6e.delete(c))});for(let l of s.roots)L6e.set(l._sessionId,s);return s.roots}finally{r?.dispose()}});function qZi(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)}qe.registerCommand("_executeProvideSupertypes",async(a,...i)=>{let[e]=i;So(qZi(e));let t=L6e.get(e._sessionId);return t?t.provideSupertypes(e,ve.None):[]});qe.registerCommand("_executeProvideSubtypes",async(a,...i)=>{let[e]=i;So(qZi(e));let t=L6e.get(e._sessionId);return t?t.provideSubtypes(e,ve.None):[]});var rS=ae("aiEditTelemetryService");var jZi="VSCode.ABExp.FeatureData",QZi=3600*1e3;var YZi=(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))(YZi||{}),BDt=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 Dr;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 LT(Pp);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(YZi);for(let t of e)i.set(t,this.getFilterValue(t));return i}};function HDt(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 XZi=(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))(XZi||{});var Oz=class extends C{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=>Ei.equals(l,"github.copilot")||Ei.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=HDt(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?Oz.trimVersionSuffix(this.copilotExtensionVersion):null;case"X-VSCode-CompletionsInChatExtensionVersion":return this.copilotCompletionsVersion?Oz.trimVersionSuffix(this.copilotCompletionsVersion):null;case"X-Copilot-RelatedPluginVersion-githubcopilotchat":return this.copilotChatExtensionVersion?Oz.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(XZi);for(let o of t)e.set(o,this.getFilterValue(o));return e}};Oz=I([m(0,lt),m(1,ne),m(2,le),m(3,vr),m(4,Um)],Oz);function UDt(a,i,e){return xO(a)===3&&!!i.tasConfig&&!e.disableExperiments&&!e.extensionTestsLocationURI&&!e.enableSmokeTestDriver&&a.getValue("workbench.enableExperiments")===!0}var kC=ae("assignmentService"),Qpi=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()}},Ypi=class extends C{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 P)}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)}},R6e=class extends C{constructor(e,t,o,n,r,s){super();this.telemetryService=e;this.configurationService=o;this.productService=n;this.instantiationService=s;this.tasSetupDisposables=new P;this.networkInitialized=!1;this._onDidRefetchAssignments=this._register(new E);this.onDidRefetchAssignments=this._onDidRefetchAssignments.event;this.experimentsEnabled=UDt(o,n,r),this.experimentsEnabled&&(this.tasClient=this.setupTASClient()),this.telemetry=this._register(new Ypi(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 Qpi(new Bl("experiment.service.memento",t));let l=o.getValue("experiments.overrideDelay"),c=typeof l=="number"?l:0;this.overrideInitDelay=Pi(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 BDt(this.productService.version,this.productService.nameLong,this.telemetryService.machineId,this.telemetryService.devDeviceId,e,this.productService.date??""),o=this.instantiationService.createInstance(Oz);this.tasSetupDisposables.add(o),this.tasSetupDisposables.add(o.onDidChangeFilters(()=>this.refetchAssignments()));let n=this.productService.tasConfig,r=new(await bg("tas-client","dist/tas-client.min.js")).ExperimentationService({filterProviders:[t,o],telemetry:this.telemetry,storageKey:jZi,keyValueStorage:this.keyValueStorage,assignmentContextTelemetryPropertyName:n.assignmentContextTelemetryPropertyName,telemetryEventName:n.telemetryEventName,endpoint:n.endpoint,refetchInterval:QZi});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)}};R6e=I([m(0,Te),m(1,le),m(2,B),m(3,nt),m(4,Vt),m(5,F)],R6e);we(kC,R6e,1);var KKo=oe.as(ii.Configuration);KKo.registerConfiguration({...Cm,properties:{"workbench.enableExperiments":{type:"boolean",description:d(16627,null),default:!0,scope:1,restricted:!0,tags:["usesOnlineServices"]}}});var Xpi=ae("inlineCompletionsUnificationService"),GKo="cmp-cht-",JZi="cmp-ext-",$Ko="inlineCompletionsUnificationCode",qKo="inlineCompletionsUnificationModel",jKo=new Q("isRunningUnificationExperiment",!1),zDt="chat.extensionUnification.enabled",M6e=class extends C{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 KDt(!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=jKo.bindTo(this._contextKeyService),this._assignmentService.addTelemetryAssignmentFilter({exclude:u=>u.startsWith(JZi)&&this._state.extensionUnification!==this._configurationService.getValue(zDt),onDidChange:H.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(zDt)&&(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($Ko),this._assignmentService.getTreatment(qKo),this._isExtensionUnificationActive()]),n=this._configurationService.getValue(zDt)===o,r=await this._assignmentService.getCurrentExperiments(),s=new KDt(e===!0,t===!0,o,r?.filter(c=>c.startsWith(GKo)||n&&c.startsWith(JZi))??[]);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(zDt)||!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}};M6e=I([m(0,kC),m(1,X),m(2,B),m(3,Os),m(4,ls),m(5,lt),m(6,nt)],M6e);var KDt=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)}};we(Xpi,M6e,1);var Ed=class extends C{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 jt);this._pasteEditProviders=new Map;this._documentOnDropEditProviders=new Map;if(this._proxy=e.getProxy(Zi.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=>Ed._reviveLocationDto(t)),e):(e.uri=A.revive(e.uri),e))}static _reviveLocationLinkDto(e){return e&&(Array.isArray(e)?(e.forEach(t=>Ed._reviveLocationLinkDto(t)),e):(e.uri=A.revive(e.uri),e))}static _reviveWorkspaceSymbolDto(e){return e&&(Array.isArray(e)?(e.forEach(Ed._reviveWorkspaceSymbolDto),e):(e.location=Ed._reviveLocationDto(e.location),e))}static _reviveCodeActionDto(e,t){return e?.forEach(o=>iV(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(Ed._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(Ed._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(Ed._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(Ed._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 vt;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?Ed._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(Ed._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:Ed._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=iV(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 P6e(e,this._proxy,o,this._uriIdentService);this._pasteEditProviders.set(e,n),this._registrations.set(e,hn(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,Ed._reviveWorkspaceSymbolDto(l.symbols)}};t&&(n.resolveWorkspaceSymbol=async(r,s)=>{let l=await this._proxy.$resolveWorkspaceSymbol(e,r,s);return l&&Ed._reviveWorkspaceSymbolDto(l)}),this._registrations.set(e,WDt.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=>iV(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 Jpi(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 Zpi(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=>Ed._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=Ed._inflateSuggestDto(l.range,u,r);return Nu(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 CU(n,r,s),k=this._instantiationService.createInstance(IX,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 IX&&o._emitDidChange(t)}$emitInlineCompletionModelInfoChange(e,t){let o=this._registrations.get(e);o instanceof IX&&o._setModelInfo(t)}$emitInlineCompletionProviderOptionsChange(e,t){let o=this._registrations.get(e);o instanceof IX&&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:Xn(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 ho;return p?{...l,tooltip:p.tooltip,label:Xn(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(Ed._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&&Ed._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,cde.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(Ed._reviveCallHierarchyItemDto)}},provideOutgoingCalls:async(o,n)=>{let r=await this._proxy.$provideCallHierarchyOutgoingCalls(e,o._sessionId,o._itemId,n);return r&&(r.forEach(s=>{s.to=Ed._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=Ed._reviveCallHierarchyItemDto(s.from)}),r)}}))}static _reviveRegExp(e){return new RegExp(e.pattern,e.flags)}static _reviveIndentationRule(e){return{decreaseIndentPattern:Ed._reviveRegExp(e.decreaseIndentPattern),increaseIndentPattern:Ed._reviveRegExp(e.increaseIndentPattern),indentNextLinePattern:e.indentNextLinePattern?Ed._reviveRegExp(e.indentNextLinePattern):void 0,unIndentedLinePattern:e.unIndentedLinePattern?Ed._reviveRegExp(e.unIndentedLinePattern):void 0}}static _reviveOnEnterRule(e){return{beforeText:Ed._reviveRegExp(e.beforeText),afterText:e.afterText?Ed._reviveRegExp(e.afterText):void 0,previousLineText:e.previousLineText?Ed._reviveRegExp(e.previousLineText):void 0,action:e.action}}static _reviveOnEnterRules(e){return e.map(Ed._reviveOnEnterRule)}$setLanguageConfiguration(e,t,o){let n={comments:o.comments,brackets:o.brackets,wordPattern:o.wordPattern?Ed._reviveRegExp(o.wordPattern):void 0,indentationRules:o.indentationRules?Ed._reviveIndentationRule(o.indentationRules):void 0,onEnterRules:o.onEnterRules?Ed._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,ude.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(Ed._reviveTypeHierarchyItemDto)}},provideSupertypes:async(o,n)=>{let r=await this._proxy.$provideTypeHierarchySupertypes(e,o._sessionId,o._itemId,n);return r&&r.map(Ed._reviveTypeHierarchyItemDto)},provideSubtypes:async(o,n)=>{let r=await this._proxy.$provideTypeHierarchySubtypes(e,o._sessionId,o._itemId,n);return r&&r.map(Ed._reviveTypeHierarchyItemDto)}}))}$registerDocumentOnDropEditProvider(e,t,o){let n=new A6e(e,this._proxy,o,this._uriIdentService);this._documentOnDropEditProviders.set(e,n),this._registrations.set(e,hn(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)}};Ed=I([vo(Gi.MainThreadLanguageFeatures),m(1,kt),m(2,bs),m(3,zt),m(4,dt),m(5,F),m(6,Xpi)],Ed);var P6e=class{constructor(i,e,t,o){this._handle=i;this._proxy=e;this._uriIdentService=o;this.dataTransfers=new ade;this.copyMimeTypes=t.copyMimeTypes??[],this.pasteMimeTypes=t.pasteMimeTypes??[],this.providedPasteEditKinds=t.providedPasteEditKinds?.map(n=>new Is(n))??[],t.supportsCopy&&(this.prepareDocumentPaste=async(n,r,s,l)=>{let c=await sde.fromList(s);if(l.isCancellationRequested)return;let u=await this._proxy.$prepareDocumentPaste(i,n.uri,r,c,l);if(!u)return;let p=new bx;for(let[h,g]of u.items)p.replace(h,NN(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 sde.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 Is(g.kind.value):new Is(""),yieldTo:g.yieldTo?.map(f=>({kind:new Is(f)})),additionalEdit:g.additionalEdit?iV(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=iV(s.additionalEdit,this._uriIdentService)),n})}resolveFileData(i,e){return this.dataTransfers.resolveFileData(i,e)}};P6e=I([m(3,dt)],P6e);var A6e=class{constructor(i,e,t,o){this._handle=i;this._proxy=e;this._uriIdentService=o;this.dataTransfers=new ade;this.dropMimeTypes=t?.dropMimeTypes??["*/*"],this.providedDropEditKinds=t?.providedDropKinds?.map(n=>new Is(n)),t?.supportsResolve&&(this.resolveDocumentDropEdit=async(n,r)=>{let s=await this._proxy.$resolvePasteEdit(this._handle,n._cacheId,r);return s.additionalEdit&&(n.additionalEdit=iV(s.additionalEdit,this._uriIdentService)),n})}async provideDocumentDropEdits(i,e,t,o){let n=this.dataTransfers.add(t);try{let r=await sde.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 Is(c)})),kind:l.kind?new Is(l.kind):void 0,additionalEdit:iV(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)}};A6e=I([m(3,dt)],A6e);var Jpi=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=Sli(n);return r.type==="full"?{resultId:String(r.id),data:r.data}:{resultId:String(r.id),edits:r.deltas}}},Zpi=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=Sli(o);if(n.type==="full")return{resultId:String(n.id),data:n.data};throw new Error("Unexpected")}},IX=class extends C{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 N=>{await this._proxy.$handleInlineCompletionSetCurrentModelId(this.handle,N)}:void 0,this.setProviderOption=this._supportsSetProviderOption?async(N,O)=>{await this._proxy.$handleInlineCompletionSetProviderOption(this.handle,N,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:zy.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:QKo(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,...q1(VW(this.providerId.extensionId))},l=this._instantiationService.createInstance(vO);Fwt(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()})`}};IX=I([m(17,zt),m(18,rS),m(19,F)],IX);function QKo(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 kV=ae("ILanguageStatusService"),emi=class{constructor(){this._provider=new cd;this.onDidChange=H.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=Al(e.source,t.source)),o===0&&(o=Al(e.id,t.id)),o})}};we(kV,emi,1);var GDt=class extends C{constructor(e,t,o,n,r){super();this._languageService=t;this._modelService=o;this._resolverService=n;this._languageStatusService=r;this._status=this._register(new jt);this._proxy=e.getProxy(Zi.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)}};GDt=I([vo(Gi.MainThreadLanguages),m(1,kt),m(2,Ct),m(3,Nt),m(4,kV)],GDt);var $Dt=class{constructor(i,e){this.loggerService=e;this.disposables=new P;let t=i.getProxy(Zi.ExtHostLogLevelServiceShape);this.disposables.add(e.onDidChangeLogLevel(o=>{N6(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)Kre(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()}};$Dt=I([vo(Gi.MainThreadLogger),m(1,ol)],$Dt);qe.registerCommand("_extensionTests.setLogLevel",function(a,i){let e=a.get(ol),t=a.get(Co);if(t.isExtensionDevelopment&&t.extensionTestsLocationURI){let o=Gre(i);o!==void 0&&e.setLogLevel(o)}});qe.registerCommand("_extensionTests.getLogLevel",function(a){let i=a.get(ne);return $w(i.getLevel())});var pde=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=>pi({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=pde.URGENT_NOTIFICATION_SOURCES.includes(s.id)),s||(s=d(3050,null));let c=[];o.source&&c.push(pi({id:o.source.identifier.value,label:d(3051,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});H.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(3049,null),run:()=>{}}:s={label:d(3052,null),run:()=>{}});let{result:l}=await this._dialogService.prompt({type:i,message:e,detail:t,buttons:r,cancelButton:s,custom:n});return l}};pde.URGENT_NOTIFICATION_SOURCES=["vscode.github-authentication","vscode.microsoft-authentication"],pde=I([vo(Gi.MainThreadMessageService),m(1,Ne),m(2,ge),m(3,ct),m(4,lt)],pde);function gEe(a){switch(a){case 100:return"req";case 101:return"cancel";case 102:return"subscribe";case 103:return"unsubscribe"}}function jDt(a){switch(a){case 200:return"init";case 201:return"reply:";case 202:case 203:return"replyErr:";case 204:return"event:"}}function mEe(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 YKo=yX(0);function hEe(a,i){if(i===0){a.write(YKo);return}let e=0;for(let o=i;o!==0;o=o>>>7)e++;let t=Je.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 QDt=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}},N6e=class{constructor(){this.buffers=[]}get buffer(){return Je.concat(this.buffers)}write(i){this.buffers.push(i)}};function yX(a){let i=Je.alloc(1);return i.writeUInt8(a,0),i}var mde={Undefined:yX(0),String:yX(1),Buffer:yX(2),VSBuffer:yX(3),Array:yX(4),Object:yX(5),Uint:yX(6)};function fEe(a,i){if(typeof i>"u")a.write(mde.Undefined);else if(typeof i=="string"){let e=Je.fromString(i);a.write(mde.String),hEe(a,e.byteLength),a.write(e)}else if(Je.isNativeBuffer(i)){let e=Je.wrap(i);a.write(mde.Buffer),hEe(a,e.byteLength),a.write(e)}else if(i instanceof Je)a.write(mde.VSBuffer),hEe(a,i.byteLength),a.write(i);else if(Array.isArray(i)){a.write(mde.Array),hEe(a,i.length);for(let e of i)fEe(a,e)}else if(typeof i=="number"&&(i|0)===i)a.write(mde.Uint),hEe(a,i);else{let e=Je.fromString(JSON.stringify(i));a.write(mde.Object),hEe(a,e.byteLength),a.write(e)}}function O6e(a){switch(a.read(1).readUInt8(0)){case 0:return;case 1:return a.read(mEe(a)).toString();case 2:return a.read(mEe(a)).buffer;case 3:return a.read(mEe(a));case 4:{let e=mEe(a),t=[];for(let o=0;o<e;o++)t.push(O6e(a));return t}case 5:return JSON.parse(a.read(mEe(a)).toString());case 6:return mEe(a)}}var tmi=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,jDt(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,jDt(i.type),i.data);return}}}send(i,e=void 0){let t=new N6e;return fEe(t,i),fEe(t,e),this.sendBuffer(t.buffer)}sendBuffer(i){try{return this.protocol.send(i),i.byteLength}catch{return 0}}onRawMessage(i){let e=new QDt(i),t=O6e(e),o=O6e(e),n=t[0];switch(n){case 100:return this.logger?.logIncoming(i.byteLength,t[1],1,`${gEe(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,`${gEe(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,`${gEe(n)}`),this.disposeActiveRequest({type:n,id:t[1]});case 103:return this.logger?.logIncoming(i.byteLength,t[1],1,`${gEe(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 $e,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),Ue(this.activeRequests.values()),this.activeRequests.clear()}};var qDt=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 ho):e.requestPromise(i,t,o,n)},listen(t,o){return e.isDisposed?H.None:e.requestEvent(i,t,o)}}}requestPromise(i,e,t,o=ve.None){let n=this.lastRequestId++,s={id:n,type:100,channelName:i,name:e,arg:t};if(o.isCancellationRequested)return Promise.reject(new ho);let l,c;return new Promise((p,h)=>{if(o.isCancellationRequested)return h(new ho);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=xn(b=>this.whenInitialized()),f.then(()=>{f=null,g()}));let v=()=>{f?(f.cancel(),f=null):this.sendRequest({id:n,type:101}),h(new ho)};l=o.onCancellationRequested(v),c={dispose:wd(()=>{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=xn(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,`${gEe(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,gEe(i.type));return}}}send(i,e=void 0){let t=new N6e;return fEe(t,i),fEe(t,e),this.sendBuffer(t.buffer)}sendBuffer(i){try{return this.protocol.send(i),i.byteLength}catch{return 0}}onBuffer(i){let e=new QDt(i),t=O6e(e),o=O6e(e),n=t[0];switch(n){case 200:return this.logger?.logIncoming(i.byteLength,0,0,jDt(n)),this.onResponse({type:t[0]});case 201:case 202:case 204:case 203:return this.logger?.logIncoming(i.byteLength,t[1],0,jDt(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 H.toPromise(this.onDidInitialize)}whenInitialized(){return this.state===1?Promise.resolve():this.onDidInitializePromise}dispose(){this.isDisposed=!0,this.protocolListener&&(this.protocolListener.dispose(),this.protocolListener=null),Ue(this.activeRequests.values()),this.activeRequests.clear(),this._onDidInitialize.dispose()}};I([mi],qDt.prototype,"onDidInitializePromise",1);var wX=class{constructor(i,e,t=null){let o=new N6e;fEe(o,e),i.send(o.buffer),this.channelClient=new qDt(i,t),this.channelServer=new tmi(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 CX(a){return{call(i,e,t){return a.then(o=>o.call(i,e,t))},listen(i,e){let t=new Mh;return a.then(o=>t.input=o.listen(i,e)),t.event}}}var dd;(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,H.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,H.buffer(l[h],h,!0,void 0,r)),u.get(h)}throw new Zs(`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]=Xn(g[b]);let v=f.apply(l,g);return v instanceof Promise||(v=Promise.resolve(v)),v}throw new Zs(`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&&!Jn(r.context)?p=[r.context,...u]:p=u;let h=await n.call(c,p);return s?h:Xn(h)};throw new Zs(`Property not found: ${String(c)}`)}})}o.toService=i;function e(n){return n[0]==="o"&&n[1]==="n"&&Hk(n.charCodeAt(2))}function t(n){return/^onDynamic/.test(n)&&Hk(n.charCodeAt(9))}})(dd||={});var vEe;(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})(vEe||={});var imi=null;function xX(){return imi||(imi=Je.alloc(0)),imi}var omi=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 xX();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=Je.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 ZZi(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 DP=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}},F6e=class extends C{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 omi,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:ZZi(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 DP(o,n,r,t)),this._isDisposed)break}}}readEntireBuffer(){return this._incomingData.read(this._incomingData.byteLength)}dispose(){this._isDisposed=!0,super.dispose()}},W6e=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=Je.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:ZZi(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=Je.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)}},nmi=class extends C{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 W6e(this._socket)),this._socketReader=this._register(new F6e(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 DP(1,0,0,e))}},YDt=class a extends wX{constructor(e,t,o=null){super(e,t,o);this.protocol=e}static fromSocket(e,t){return new a(new nmi(e),t)}get onDidDispose(){return this.protocol.onDidDispose}dispose(){super.dispose();let e=this.protocol.getSocket();this.protocol.sendDisconnect(),this.protocol.dispose(),e.end()}},S5=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=[]}},rmi=class{constructor(i){this.data=i,this.next=null}},smi=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 rmi(i);if(!this._first){this._first=e,this._last=e;return}this._last.next=e,this._last=e}},ami=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}},XDt=class{constructor(i){this._onControlMessage=new S5;this.onControlMessage=this._onControlMessage.event;this._onMessage=new S5;this.onMessage=this._onMessage.event;this._onDidDispose=new S5;this.onDidDispose=this._onDidDispose.event;this._onSocketClose=new S5;this.onSocketClose=this._onSocketClose.event;this._onSocketTimeout=new S5;this.onSocketTimeout=this._onSocketTimeout.event;this._loadEstimator=i.loadEstimator??ami.getInstance(),this._shouldSendKeepAlive=i.sendKeepAlive??!0,this._isReconnecting=!1,this._outgoingUnackMsg=new smi,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 P,this._socket=i.socket,this._socketWriter=this._socketDisposables.add(new W6e(this._socket)),this._socketReader=this._socketDisposables.add(new F6e(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 DP(5,0,0,xX());this._socketWriter.write(i),this._socketWriter.flush()}}sendPause(){let i=new DP(7,0,0,xX());this._socketWriter.write(i)}sendResume(){let i=new DP(8,0,0,xX());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 P,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 W6e(this._socket)),this._socketReader=this._socketDisposables.add(new F6e(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 DP(3,0,this._incomingAckId,xX());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 DP(6,0,0,xX())))}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 DP(1,e,this._incomingAckId,i);this._outgoingUnackMsg.push(t),this._isReconnecting||(this._socketWriter.write(t),this._recvAckCheck())}sendControl(i){let e=new DP(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 DP(3,0,this._incomingAckId,xX());this._socketWriter.write(i)}_sendKeepAlive(){this._incomingAckId=this._incomingMsgId;let i=new DP(9,0,this._incomingAckId,xX());this._socketWriter.write(i)}};var XKo=(a,i,e)=>{let t=new Uint8Array(16);for(let r=0;r<16;r++)t[r]=Math.round(Math.random()*256);let o=Qd(Je.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
`},eeo=Je.fromString(`\r
\r
`);async function teo(a,i,e,t,o){a.write(Je.fromString(XKo(i,e,t)));let n=new P;try{return await new Promise((r,s)=>{let l;n.add(a.onData(c=>{l?l=Je.concat([l,c],l.byteLength+c.byteLength):l=c;let u=l.indexOf(eeo);if(u===-1)return;r(a),a.pauseData();let p=l.slice(u+eeo.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 JDt=class extends C{constructor(e,t){super();this.debugLabel=e;this.pausableDataEmitter=this._register(new Pm);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){vEe.traceSocketEvent(this,this.debugLabel,e,t)}dispose(){this.ended||this.closeRemote(),this.didDisposeEmitter.fire(),super.dispose()}};var Fz=ae("remoteSocketFactoryService"),ZDt=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 eLt=class extends C{constructor(e,t){super();this._remoteSocketFactoryService=t;this._registrations=this._register(new jt);this._remoteSockets=new Map;this._proxy=e.getProxy(Zi.ExtHostManagedSockets)}async $registerSocketFactory(e){let t=this,o=new P,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),lmi.connect(g,t._proxy,s,l,c,f).then(v=>{o.add(H.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()}};eLt=I([vo(Gi.MainThreadManagedSockets),m(1,Fz)],eLt);var lmi=class a extends JDt{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 teo(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 tLt="text/x-code-output",bEe="Log",kX="text/x-code-log-output",SEe="log",Ul="workbench.panel.output",iLt=new Q("inOutput",!1),oeo=new Q("activeLogOutput",!1),oLt=new Q("activeLogOutput.isLog",!1),nLt=new Q("activeLogOutput.levelSettable",!1),rLt=new Q("activeLogOutput.level",""),sLt=new Q("activeLogOutput.levelIsDefault",!1),aLt=new Q("outputView.scrollLock",!1),lLt=new Q("activeOutputChannel",""),cLt=new Q("output.filter.trace",!0),dLt=new Q("output.filter.debug",!0),uLt=new Q("output.filter.info",!0),pLt=new Q("output.filter.warning",!0),mLt=new Q("output.filter.error",!0),IEe=new Q("outputFilterFocus",!1),hLt=new Q("output.filter.categories",""),Ml=ae("outputService");var sS={OutputChannels:"workbench.contributions.outputChannels"};function LP(a){return!!a.source&&!Array.isArray(a.source)}function EV(a){return Array.isArray(a.source)}var cmi=class extends C{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&&EV(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))}};oe.add(sS.OutputChannels,new cmi);var Ft=ae("viewsService");var EX=class extends C{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(Zi.ExtHostOutputService);let s=()=>{let l=this._viewsService.isViewVisible(Ul)?this._outputService.getActiveChannel():void 0;this._proxy.$setVisibleChannel(l?l.id:null),this._outputStatusItem.value=void 0};this._register(H.any(this._outputService.onActiveOutputChannel,H.filter(this._viewsService.onDidChangeViewVisibility,({id:l})=>l===Ul))(()=>s())),s()}async $register(e,t,o,n){let r=(EX._extensionIdPool.get(n)||0)+1;EX._extensionIdPool.set(n,r);let s=`extension-output-${n}-#${r}-${e}`,l=A.revive(t);return oe.as(sS.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):Xo(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(Ul)&&n[Ul]){this._showChannelQuietly(o);return}this._outputService.showChannel(o.id,t)}_showChannelQuietly(e){let t={name:d(3054,null),text:"$(output)",ariaLabel:d(3055,null,e.label),command:`workbench.action.output.show.${e.id}`,tooltip:d(3056,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(Ul)){let t=this._outputService.getActiveChannel();t&&e===t.id&&this._viewsService.closeView(Ul)}}async $dispose(e){this._getChannel(e)?.dispose()}_getChannel(e){return this._outputService.getChannel(e)}};EX._extensionIdPool=new Map,EX=I([vo(Gi.MainThreadOutputService),m(1,Ml),m(2,Ft),m(3,B),m(4,Tr)],EX);var hde=class{constructor(i,e,t){this._commandService=t;this._progress=new Map;this._proxy=i.getProxy(Zi.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=hde.URGENT_PROGRESS_SOURCES.includes(t);e={...e,priority:n?3:0,location:15,secondaryActions:[pi({id:t,label:d(3057,null),run:()=>this._commandService.executeCommand("_extensions.manage",t)})]}}try{this._progressService.withProgress(e,o,()=>this._proxy.$acceptProgressCanceled(i))}catch(n){ss(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})})}};hde.URGENT_PROGRESS_SOURCES=["vscode.github-authentication","vscode.microsoft-authentication"],hde=I([vo(Gi.MainThreadProgress),m(1,Bo),m(2,ge)],hde);var gLt=class{constructor(i,e){this.quickDiffService=e;this.providerDisposables=new jt;this.proxy=i.getProxy(Zi.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,ve.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()}};gLt=I([vo(Gi.MainThreadQuickDiff),m(1,OE)],gLt);var fLt=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(Zi.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 P,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=Ra(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)||Tre(e)?1:0,n=new co(()=>js(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(oh(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}};fLt=I([vo(Gi.MainThreadQuickOpen),m(1,Ge),m(2,ot),m(3,Sv),m(4,Ct),m(5,kt)],fLt);var vLt=class extends C{constructor(e,t,o){super();this._environmentService=t;this._proxy=e.getProxy(Zi.ExtHostExtensionService);let n=this._environmentService.remoteAuthority;n&&this._register(o.onDidChangeConnectionData(()=>{let r=o.getConnectionData(n);r&&this._proxy.$updateRemoteConnectionData(r)}))}};vLt=I([QL,m(1,Vt),m(2,Mc)],vLt);var dmi=class{constructor(i){this._proxy=i.getProxy(Zi.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(3058,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 pm(n,o)}},bLt=class{constructor(i,e,t){this._textFileService=t;this._saveParticipantDisposable=this._textFileService.files.addSaveParticipant(e.createInstance(dmi,i))}dispose(){this._saveParticipantDisposable.dispose()}};bLt=I([QL,m(1,F),m(2,Ho)],bLt);var EC=ae("speechService"),TV=new Q("hasSpeechProvider",!1,{type:"boolean",description:d(13572,null)}),TX=new Q("speechToTextInProgress",!1,{type:"boolean",description:d(13599,null)}),SLt=new Q("textToSpeechInProgress",!1,{type:"boolean",description:d(13600,null)});var umi="accessibility.voice.speechLanguage",pmi={"da-DK":{name:d(13573,null)},"de-DE":{name:d(13574,null)},"en-AU":{name:d(13575,null)},"en-CA":{name:d(13576,null)},"en-GB":{name:d(13577,null)},"en-IE":{name:d(13578,null)},"en-IN":{name:d(13579,null)},"en-NZ":{name:d(13580,null)},"en-US":{name:d(13581,null)},"es-ES":{name:d(13582,null)},"es-MX":{name:d(13583,null)},"fr-CA":{name:d(13584,null)},"fr-FR":{name:d(13585,null)},"hi-IN":{name:d(13586,null)},"it-IT":{name:d(13587,null)},"ja-JP":{name:d(13588,null)},"ko-KR":{name:d(13589,null)},"nl-NL":{name:d(13590,null)},"pt-PT":{name:d(13592,null)},"pt-BR":{name:d(13591,null)},"ru-RU":{name:d(13593,null)},"sv-SE":{name:d(13594,null)},"tr-TR":{name:d(13595,null)},"zh-CN":{name:d(13596,null)},"zh-HK":{name:d(13597,null)},"zh-TW":{name:d(13598,null)}};function ILt(a,i=Dr){if(typeof a=="string"){if(a==="auto"){if(i!=="en"){let e=i.split("-");return ILt(`${e[0]}-${(e[1]??e[0]).toUpperCase()}`)}}else if(pmi[a])return a}return"en-US"}var yLt=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(Zi.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:H.None};let s=new P,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:H.None,synthesize:async()=>{}};let s=new P,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 P;try{await wa(H.toPromise(H.filter(c.event,h=>h.status===2,p),p),n)}finally{p.dispose()}}}},createKeywordRecognitionSession:n=>{if(n.isCancellationRequested)return{onDidChange:H.None};let r=new P,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()}};yLt=I([vo(Gi.MainThreadSpeech),m(1,EC),m(2,ne)],yLt);var Wz=ae("editSessionIdentityService");var mmi=class{constructor(i){this.timeout=2e4;this._proxy=i.getProxy(Zi.ExtHostWorkspace)}async participate(i,e){let t=new Promise((o,n)=>{setTimeout(()=>n(new Error(d(3009,null))),this.timeout),this._proxy.$onWillCreateEditSessionIdentity(i.uri,e,this.timeout).then(o,n)});return pm(t,e)}},wLt=class{constructor(i,e,t){this._editSessionIdentityService=t;this._saveParticipantDisposable=this._editSessionIdentityService.addEditSessionIdentityCreateParticipant(e.createInstance(mmi,i))}dispose(){this._saveParticipantDisposable.dispose()}};wLt=I([QL,m(1,F),m(2,Wz)],wLt);var yEe=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 Lo.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([mi],yEe.prototype,"name",1);function reo(a,i){typeof a.element<"u"&&i.push(a.element);for(let e of a.children)reo(e,i);return i}var Xp=class{constructor(i,e=A.file("/"),t=ar){this.extUri=t;this.root=new yEe(e,"",i)}static getRoot(i){for(;i.parent;)i=i.parent;return i}static collect(i){return reo(i,[])}static isResourceNode(i){return i instanceof yEe}add(i,e){let t=this.extUri.relativePath(this.root.uri,i)||i.path,o=new b9(!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 yEe(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 b9(!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 b9(!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 JO="scm-graph-incoming-changes",_X="scm-graph-outgoing-changes";var RP=22,vh=11,gde=5,I5=4,DX=2,vde=J("scmGraph.historyItemRefColor",B$e,d(13070,null)),V6e=J("scmGraph.historyItemRemoteRefColor",cgt,d(13071,null)),aeo=J("scmGraph.historyItemBaseRefColor","#EA5C00",d(13066,null)),ZKo=J("scmGraph.historyItemHoverDefaultLabelForeground",ko,d(13068,null)),gmi=J("scmGraph.historyItemHoverDefaultLabelBackground",rv,d(13067,null)),fmi=J("scmGraph.historyItemHoverLabelForeground",jS,d(13069,null)),W8a=J("scmGraph.historyItemHoverAdditionsForeground",{light:"#587C0C",dark:"#81B88B",hcDark:"#A1E3AD",hcLight:"#374E06"},d(13059,null)),V8a=J("scmGraph.historyItemHoverDeletionsForeground",{light:"#AD0707",dark:"#C74E39",hcDark:"#C74E39",hcLight:"#AD0707"},d(13060,null)),seo=[J("scmGraph.foreground1","#FFB000",d(13061,null)),J("scmGraph.foreground2","#DC267F",d(13062,null)),J("scmGraph.foreground3","#994F00",d(13063,null)),J("scmGraph.foreground4","#40B0A6",d(13064,null)),J("scmGraph.foreground5","#B66DFF",d(13065,null))];function hmi(a,i){if(a.id===JO)return V6e;if(a.id===_X)return vde;for(let e of a.references??[]){let t=i.get(e.id);if(t!==void 0)return t}}function CLt(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=wt(a),e}function fde(a,i,e,t){let o=document.createElementNS("http://www.w3.org/2000/svg","circle");return o.setAttribute("cx",`${vh*(a+1)}`),o.setAttribute("cy",`${vh}`),o.setAttribute("r",`${i}`),o.style.strokeWidth=`${e}px`,t&&(o.style.fill=wt(t)),o}function e2o(a,i,e,t){let o=document.createElementNS("http://www.w3.org/2000/svg","circle");return o.setAttribute("cx",`${vh*(a+1)}`),o.setAttribute("cy",`${vh}`),o.setAttribute("r",`${I5+1}`),o.style.stroke=wt(t),o.style.strokeWidth=`${e}px`,o.style.strokeDasharray="4,2",o}function xLt(a,i,e,t,o=1){let n=CLt(t,o);return n.setAttribute("d",`M ${a} ${i} V ${e}`),n}function t2o(a,i){for(let e=a.length-1;e>=0;e--)if(a[e].id===i)return e;return-1}function leo(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:vde,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=CLt(u);p.push(`M ${vh*(c+1)} 0`),p.push(`A ${vh} ${vh} 0 0 1 ${vh*c} ${vh}`),p.push(`H ${vh*(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=xLt(vh*(c+1),0,RP,u);i.append(p)}else{let p=[],h=CLt(u);p.push(`M ${vh*(c+1)} 0`),p.push("V 6"),p.push(`A ${gde} ${gde} 0 0 1 ${vh*(c+1)-gde} ${RP/2}`),p.push(`H ${vh*(l+1)+gde}`),p.push(`A ${gde} ${gde} 0 0 0 ${vh*(l+1)} ${RP/2+gde}`),p.push(`V ${RP}`),h.setAttribute("d",p.join(" ")),i.append(h)}l++}}for(let c=1;c<e.parentIds.length;c++){let u=t2o(o,e.parentIds[c]);if(u===-1)continue;let p=[],h=CLt(o[u].color);p.push(`M ${vh*u} ${RP/2}`),p.push(`A ${vh} ${vh} 0 0 1 ${vh*(u+1)} ${RP}`),p.push(`M ${vh*u} ${RP/2}`),p.push(`H ${vh*(r+1)} `),h.setAttribute("d",p.join(" ")),i.append(h)}if(n!==-1){let c=xLt(vh*(r+1),0,RP/2,t[n].color);i.append(c)}if(e.parentIds.length>0){let c=xLt(vh*(r+1),RP/2,RP,s);i.append(c)}if(a.kind==="HEAD"){let c=fde(r,I5+3,DX,s);i.append(c);let u=fde(r,DX,I5);i.append(u)}else if(a.kind==="incoming-changes"||a.kind==="outgoing-changes"){let c=fde(r,I5+3,DX,s);i.append(c);let u=fde(r,I5+1,DX+1);i.append(u);let p=e2o(r,I5+1,DX-1,s);i.append(p)}else if(e.parentIds.length>1){let c=fde(r,I5+2,DX,s);i.append(c);let u=fde(r,I5-1,DX,s);i.append(u)}else{let c=fde(r,I5+1,DX,s);i.append(c)}return i.style.height=`${RP}px`,i.style.width=`${vh*(Math.max(t.length,o.length,1)+1)}px`,i}function vmi(a,i){let e=Wzi("svg",{style:{height:`${RP}px`,width:`${vh*(a.length+1)}px`}});for(let t=0;t<a.length;t++){let o=t===i?3:1,n=xLt(vh*(t+1),0,RP,a[t].color,o);e.root.append(n)}return e.root}function ceo(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=>Xi(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:hmi(p,i)??y.color}),b=!0);continue}v.push(Xi(y))}for(let y=b?1:0;y<p.parentIds.length;y++){let w;if(y===0)w=hmi(p,i);else{let k=a.find(T=>T.id===p.parentIds[y]);w=k?hmi(k,i):void 0}w||(l=Y0(l+1,seo.length),w=seo[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(N=>N.id===p.id),T=k!==-1?k:f.length;w=T<v.length?v[T].color:T<f.length?f[T].color:vde}return{...y,color:w}});S.sort((y,w)=>o2o(y,w,e,t,o)),c.push({historyItem:{...p,references:S},kind:h,inputSwimlanes:f,outputSwimlanes:v})}return i2o(c,e,t,n,r,s),c}function deo(a){let i=a.historyItem,e=a.inputSwimlanes,t=e.findIndex(o=>o.id===i.id);return t!==-1?t:e.length}function i2o(a,i,e,t,o,n){if(i?.revision!==e?.revision&&n){if(t&&e&&e.revision!==n){let r=Jve(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===V6e?{...g,id:JO}:g),outputSwimlanes:a[r].outputSwimlanes.map(g=>g.id===n&&g.color===V6e?{...g,id:JO}:g)};let c=a[r].outputSwimlanes.map(g=>Xi(g)),u=a[s].inputSwimlanes.map(g=>Xi(g)),p=a[0].historyItem.displayId?.length??0,h={id:JO,displayId:"0".repeat(p),parentIds:[n],author:e?.name,subject:d(13057,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:_X,displayId:a[0].historyItem.displayId?"0".repeat(a[0].historyItem.displayId.length):void 0,parentIds:[i.revision],author:i?.name,subject:d(13058,null),message:""},l=a[r].inputSwimlanes.slice(0),c=l.slice(0).concat({id:i.revision,color:vde});a.splice(r,0,{historyItem:s,kind:"outgoing-changes",inputSwimlanes:l,outputSwimlanes:c}),a[r+1].inputSwimlanes.push({id:i.revision,color:vde})}}}}function o2o(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 B6e(a,i,e){let t=new P;if(i.tooltip===void 0)return{content:i.message,disposables:t};if(Mr(i.tooltip))return{content:i.tooltip,disposables:t};let o=i.tooltip.slice();if(e&&i.references?.length){let r=new xe("",{supportHtml:!0,supportThemeIcons:!0});for(let s of i.references){let l=q.isThemeIcon(s.icon)?s.icon.id:"",c=s.color?wt(s.color):wt(gmi),u=s.color?wt(fmi):wt(ZKo);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(yW(r))continue;let s=a.render(r);n.appendChild(s.element),t.add(s)}return{content:n,disposables:t}}function bde(a){if(a!==void 0){if(q.isThemeIcon(a))return a;if(oh(a))return A.revive(a);{let i=a;return{light:A.revive(i.light),dark:A.revive(i.dark)}}}}function ueo(a){let i=bde(a.authorIcon),e=a.references?.map(t=>({...t,icon:bde(t.icon)}));return{...a,authorIcon:i,references:e}}function wEe(a,i){return a?{...a,icon:bde(a.icon),color:i}:void 0}var bmi=class extends C{constructor(e,t,o){super();this.modelService=t;this.languageService=o;this._register(e.registerTextModelContentProvider(Y.vscodeSourceControl,this))}async provideTextContent(e){let t=this.modelService.getModel(e);return t||this.modelService.createModel("",this.languageService.createById("scminput"),e)}},Smi=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 Xp(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()}},Imi=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}}},ymi=class{constructor(i,e){this.proxy=i;this.handle=e;this._onDidChangeArtifacts=new E;this.onDidChangeArtifacts=this._onDidChangeArtifacts.event;this._disposables=new P;this._disposables.add(this._onDidChangeArtifacts)}async provideArtifactGroups(i){return(await this.proxy.$provideArtifactGroups(this.handle,i??ve.None))?.map(t=>({...t,icon:bde(t.icon)}))}async provideArtifacts(i,e){return(await this.proxy.$provideArtifacts(this.handle,i,e??ve.None))?.map(o=>({...o,icon:bde(o.icon)}))}$onDidChangeArtifacts(i){this._onDidChangeArtifacts.fire(i)}dispose(){this._disposables.dispose()}},wmi=class{constructor(i,e){this.proxy=i;this.handle=e;this._historyItemRef=rg({owner:this,equalsFn:VT},void 0);this._historyItemRemoteRef=rg({owner:this,equalsFn:VT},void 0);this._historyItemBaseRef=rg({owner:this,equalsFn:VT},void 0);this._historyItemRefChanges=Le(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??ve.None);return t?ueo(t):void 0}async resolveHistoryItemChatContext(i,e){return this.proxy.$resolveHistoryItemChatContext(this.handle,i,e??ve.None)}async resolveHistoryItemChangeRangeChatContext(i,e,t,o){return this.proxy.$resolveHistoryItemChangeRangeChatContext(this.handle,i,e,t,o??ve.None)}async resolveHistoryItemRefsCommonAncestor(i,e){return this.proxy.$resolveHistoryItemRefsCommonAncestor(this.handle,i,e??ve.None)}async provideHistoryItemRefs(i,e){return(await this.proxy.$provideHistoryItemRefs(this.handle,i,e??ve.None))?.map(o=>({...o,icon:bde(o.icon)}))}async provideHistoryItems(i,e){return(await this.proxy.$provideHistoryItems(this.handle,i,e??ve.None))?.map(o=>ueo(o))}async provideHistoryItemChanges(i,e,t){return(await this.proxy.$provideHistoryItemChanges(this.handle,i,e,t??ve.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){Ui(o=>{this._historyItemRef.set(wEe(i,vde),o),this._historyItemRemoteRef.set(wEe(e,V6e),o),this._historyItemBaseRef.set(wEe(t,aeo),o)})}$onDidChangeHistoryItemRefs(i){let e=i.added.map(n=>wEe(n)),t=i.modified.map(n=>wEe(n)),o=i.removed.map(n=>wEe(n));this._historyItemRefChanges.set({added:e,modified:t,removed:o,silent:i.silent},void 0)}},Cmi=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=Le(this,void 0);this._count=Le(this,void 0);this._statusBarCommands=Le(this,void 0);this._commitTemplate=Le(this,"");this._actionButton=Le(this,void 0);this._artifactProvider=Le(this,void 0);this._historyProvider=Le(this,void 0);if(r){let g=this._workspaceContextService.getWorkspaceFolder(r);g?.uri.toString()===r.toString()?this._name=g.name:r.path!=="/"&&(this._name=Ye(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,ve.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,ve.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 ymi(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 wmi(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 Smi(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,N=q.isThemeIcon(k)?k:A.revive(k),O=(q.isThemeIcon(T)?T:A.revive(T))||N,V={icon:N,iconDark:O,tooltip:g,strikeThrough:f,faded:v};return new Imi(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,ve.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()}},kLt=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 P;this._proxy=i.getProxy(Zi.ExtHostSCM),this._disposables.add(new bmi(this.textModelService,this.modelService,this.languageService))}dispose(){Ue(this._repositories.values()),this._repositories.clear(),Ue(this._repositoryDisposables.values()),this._repositoryDisposables.clear(),this._disposables.dispose()}async $registerSourceControl(i,e,t,o,n,r,s,l){this._repositoryBarriers.set(i,new Np);let c=await this.textModelService.createModelReference(A.revive(l)),u=new Cmi(this._proxy,i,e,t,o,n?A.revive(n):void 0,bde(r),s,c.object.textEditorModel,this.quickDiffService,this._uriIdentService,this.workspaceContextService),p=this.scmService.registerSCMProvider(u);this._repositories.set(i,p);let h=hn(c,H.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)}};kLt=I([vo(Gi.MainThreadSCM),m(1,$c),m(2,au),m(3,kt),m(4,Ct),m(5,Nt),m(6,OE),m(7,dt),m(8,Pe)],kLt);var xmi="workbench.view.search";var ny="workbench.view.search",Vz="search-result",_Lt="search.exclude",y5=2e4,meo="\u27EA ",heo=" characters skipped \u27EB",n2o=(meo.length+heo.length+5)*2,Jp=ae("searchService");function ZO(a){return!!a.rangeLocations&&!!a.previewText}function kmi(a){return!!a.resource}function DLt(a){return!!a.keyword}function Emi(a){return!!a.message}var ELt=class{constructor(i){this.resource=i;this.results=[]}},LX=class{constructor(i,e,t,o){this.rangeLocations=[];this.webviewIndex=o;let n=Array.isArray(e)?e:[e];if(t&&t.matchLines===1&&r2o(n)){i=h1i(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+n2o){let g=meo+(p-l)+heo;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 U6e(0,u.startColumn-s,u.endColumn-s)})}this.previewText=r}else{let r=Array.isArray(e)?e[0].startLineNumber:e.startLineNumber,s=uUi(e,l=>({preview:new TLt(l.startLineNumber-r,l.startColumn,l.endLineNumber-r,l.endColumn),source:l}));this.rangeLocations=Array.isArray(s)?s:[s],this.previewText=i}}};function r2o(a){let i=a[0].startLineNumber;for(let e of a)if(e.startLineNumber!==i||e.endLineNumber!==i)return!1;return!0}var TLt=class{constructor(i,e,t,o){this.startLineNumber=i,this.startColumn=e,this.endLineNumber=t,this.endColumn=o}},U6e=class extends TLt{constructor(i,e,t){super(i,e,i,t)}};function MP(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=Nu(o,Xi(e)),o=Nu(o,Xi(t),!0),o}function Sde(a,i){let e=a.ignoreGlobCase?{ignoreCase:!0}:void 0;return a.excludePattern&&Cp(a.excludePattern,i,e)?!1:a.includePattern||a.usingSearchPaths?a.includePattern&&Cp(a.includePattern,i,e)?!0:a.usingSearchPaths?!!a.folderQueries&&a.folderQueries.some(t=>{let o=t.folder.fsPath;if(rU(i,o,a.ignoreGlobCase)){let n=SM(o,i);return!t.includePattern||!!Cp(t.includePattern,n,e)}else return!1}):!1:!0}var H6e=class extends Error{constructor(e,t){super(e);this.code=t}};function geo(a){let i=a.message;if(so(a))return new H6e(i,7);try{let e=JSON.parse(i);return new H6e(e.message,e.code)}catch{return new H6e(i,6)}}var Ci={SearchViewVisibleKey:new Q("searchViewletVisible",!0),SearchViewFocusedKey:new Q("searchViewletFocus",!1),SearchResultListFocusedKey:new Q("searchResultListFocused",!0),InputBoxFocusedKey:new Q("inputBoxFocus",!1),SearchInputBoxFocusedKey:new Q("searchInputBoxFocus",!1),ReplaceInputBoxFocusedKey:new Q("replaceInputBoxFocus",!1),PatternIncludesFocusedKey:new Q("patternIncludesInputBoxFocus",!1),PatternExcludesFocusedKey:new Q("patternExcludesInputBoxFocus",!1),ReplaceActiveKey:new Q("replaceActive",!1),HasSearchResults:new Q("hasSearchResult",!1),FirstMatchFocusKey:new Q("firstMatchFocus",!1),FileMatchOrMatchFocusKey:new Q("fileMatchOrMatchFocus",!1),FileMatchOrFolderMatchFocusKey:new Q("fileMatchOrFolderMatchFocus",!1),FileMatchOrFolderMatchWithResourceFocusKey:new Q("fileMatchOrFolderMatchWithResourceFocus",!1),FileFocusKey:new Q("fileMatchFocus",!1),FolderFocusKey:new Q("folderMatchFocus",!1),ResourceFolderFocusKey:new Q("folderMatchWithResourceFocus",!1),IsEditableItemKey:new Q("isEditableItem",!0),MatchFocusKey:new Q("matchFocus",!1),SearchResultHeaderFocused:new Q("searchResultHeaderFocused",!1),ViewHasSearchPatternKey:new Q("viewHasSearchPattern",!1),ViewHasReplacePatternKey:new Q("viewHasReplacePattern",!1),ViewHasFilePatternKey:new Q("viewHasFilePattern",!1),ViewHasSomeCollapsibleKey:new Q("viewHasSomeCollapsibleResult",!1),InTreeViewKey:new Q("inTreeView",!1),hasAIResultProvider:new Q("hasAIResultProviderKey",!1),AIResultsTitle:new Q("aiResultsTitle",!1),AIResultsRequested:new Q("aiResultsRequested",!1)};var LLt=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(Zi.ExtHostSearch),this._proxy.$enableExtensionHostSearch()}dispose(){this._searchProvider.forEach(i=>i.dispose()),this._searchProvider.clear(),this._aiSearchProviderHandles.clear(),Ci.hasAIResultProvider.bindTo(this.contextKeyService).set(!1)}$registerTextSearchProvider(i,e){this._searchProvider.set(i,new z6e(this._searchService,1,e,i,this._proxy))}$registerAITextSearchProvider(i,e){Ci.hasAIResultProvider.bindTo(this.contextKeyService).set(!0),this._aiSearchProviderHandles.add(i),this._searchProvider.set(i,new z6e(this._searchService,2,e,i,this._proxy))}$registerFileSearchProvider(i,e){this._searchProvider.set(i,new z6e(this._searchService,0,e,i,this._proxy))}$unregisterProvider(i){Ue(this._searchProvider.get(i)),this._searchProvider.delete(i),this._aiSearchProviderHandles.delete(i)&&this._aiSearchProviderHandles.size===0&&Ci.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)}};LLt=I([vo(Gi.MainThreadSearch),m(1,Jp),m(2,Te),m(3,B),m(4,X)],LLt);var Tmi=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)}},z6e=class{constructor(i,e,t,o,n){this._scheme=t;this._handle=o;this._proxy=n;this._registrations=new P;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=ve.None){return this.doSearch(i,void 0,e)}textSearch(i,e,t=ve.None){return this.doSearch(i,e,t)}doSearch(i,e,t=ve.None){if(!i.folderQueries.length)throw new Error("Empty folderQueries");let o=new Tmi(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(Xn(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 RLt=class extends C{constructor(e,t){super();this.statusbarService=t;this._entryDisposables=this._register(new jt);this._proxy=e.getProxy(Zi.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)}};RLt=I([vo(Gi.MainThreadStatusBar),m(1,EEt)],RLt);var Hz=ae("IExtensionStorageService"),a2o=/^extensionKeys\/([^.]+\..+)@(\d+\.\d+\.\d+(-.*)?)$/,pw=class extends C{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=pw.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/${jle(e.id)}@${e.version}`}static fromKey(e){let t=a2o.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 pw.readAllExtensionsWithKeysForSync(t)){let l=o.find(c=>Ot(c.identifier,{id:r}))?.manifest.version;for(let c of s)l!==c&&n.push(pw.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=pw.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=pw.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(Ae(e))return e;let t=e.manifest?e.manifest.publisher:e.publisher,o=e.manifest?e.manifest.name:e.name;return Jb(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>pw.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(pw.toKey(e),JSON.stringify(t),0,1)}getKeysForSync(e){let t=this.productService.extensionSyncedKeys?.[e.id.toLowerCase()],o=this.storageService.get(pw.toKey(e),0),n=o?JSON.parse(o):void 0;return n&&t?Uo([...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)}};pw=I([m(0,le),m(1,nt),m(2,ne)],pw);async function feo(a,i,e,t){return t.invokeFunction(async o=>{let n=o.get(Co),r=o.get(an),s=o.get(Hz),l=o.get(le),c=o.get(dt),u=o.get(be),p=o.get(Pe),h=o.get(ne),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}'`,Cn(k))}h.info(`Migrated ${e?"global":"workspace"} extension storage from ${a} to ${i}`),l.store(g,!0,b,1)}})}var MLt=class{constructor(i,e,t,o,n){this._extensionStorageService=e;this._storageService=t;this._instantiationService=o;this._logService=n;this._storageListener=new P;this._sharedStorageKeysToWatch=new Map;this._proxy=i.getProxy(Zi.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&&Gt&&i!==i.toLowerCase()&&(t=i.toLowerCase()),t&&(Gt&&t!==t.toLowerCase()&&this._extensionStorageService.getExtensionState(t.toLowerCase(),e)&&!this._extensionStorageService.getExtensionState(t,e)&&(t=t.toLowerCase()),await feo(t,i,e,this._instantiationService))}catch(t){this._logService.error(t)}}};MLt=I([vo(Gi.MainThreadStorage),m(1,Hz),m(2,le),m(3,F),m(4,ne)],MLt);var Ide=class extends C{constructor(e,t,o,n,r){super();this._telemetryService=t;this._configurationService=o;this._environmentService=n;this._productService=r;this._proxy=e.getProxy(Zi.ExtHostTelemetry),KL(this._productService,this._environmentService)&&this._register(this._configurationService.onDidChangeConfiguration(s=>{(s.affectsConfiguration(bN)||s.affectsConfiguration(zre))&&this._proxy.$onDidChangeTelemetryLevel(this.telemetryLevel)})),this._proxy.$initializeTelemetryLevel(this.telemetryLevel,KL(this._productService,this._environmentService),this._productService.enabledTelemetryLevels)}get telemetryLevel(){return KL(this._productService,this._environmentService)?this._telemetryService.telemetryLevel:0}$publicLog(e,t=Object.create(null)){t[Ide._name]=!0,this._telemetryService.publicLog(e,t)}$publicLog2(e,t){this.$publicLog(e,t)}};Ide._name="pluginHostTelemetry",Ide=I([vo(Gi.MainThreadTelemetry),m(1,Te),m(2,B),m(3,Co),m(4,nt)],Ide);var PLt=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=Ae(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 RX=class extends C{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){}};RX=I([m(3,Yo)],RX);var Uz=ae("environmentVariableService");function yde(a){return[...a.entries()]}function G6e(a){return a?[...a.entries()]:[]}function $6e(a){return new Map(a)}function q6e(a){return new Map(a??[])}function _mi(a){return Array.from(a.entries()).map(i=>[i[0],yde(i[1].map),G6e(i[1].descriptionMap)])}function veo(a){return new Map(a.map(i=>[i[0],{map:$6e(i[1]),descriptionMap:q6e(i[2])}]))}var j6e=ae("terminalLinkProviderService");var CEe=ae("terminalQuickFixService");var ALt=class{constructor(i){this.completion=i;this.score=uv.Default;this.isInvalid=!1;this.textLabel=typeof i.label=="string"?i.label:i.label?.label,this.labelLow=this.textLabel.toLowerCase()}};function beo(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 xEe=class extends ALt{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,(Dmi(e)||e.kind===11)&&n&&(this.labelLow=this.labelLow.replaceAll("/","\\")),Dmi(e)){let r=this.labelLow.lastIndexOf(".");r>0&&(this.labelLowExcludeFileExt=this.labelLow.substring(0,r),this.fileExtLow=this.labelLow.substring(r+1))}(Dmi(e)||e.kind===1)&&(n&&(this.labelLowNormalizedPath=this.labelLow.replaceAll("\\","/")),e.kind===1&&(this.labelLowNormalizedPath=this.labelLowNormalizedPath.replace(/\/$/,""))),this.punctuationPenalty=l2o(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 Dmi(a){return!!(a.kind===0||a.isFileOverride)}function l2o(a){return No(a).startsWith("_")||/^[\[\]\{\}\(\)\.,;:!?\/\\\-_@#~*%^=$]+$/.test(a)}function Seo(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 Ieo(a){return a.replace(/^[a-zA-Z]:\\/,i=>`/${i[0].toLowerCase()}/`).replace(/\\/g,"/")}var PX=ae("terminalCompletionService");var kEe=class extends C{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=fp}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 Pi(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 te=b.length-1;te>=0;te--)if(b[te]==="\\"&&(te===b.length-1||b[te+1]!==" ")){$=te;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(/^~[\\\/]?/),N=d2o(s,e.pathSeparator,w,l),O=T?"tilde":N?"absolute":"relative",V=A.revive(e.cwd),U;if(O==="relative"&&w.length>0){let $=(l?w.replaceAll("\\","/"):w).replaceAll("\\ "," ");if($.startsWith("./")){let pe=$.replace(/^\.\/+/,"").replace(/\/+$/,"");if(pe){let de=V.path.replace(/\/+$/,"").split("/"),se=pe.split("/");if(se.length<=de.length&&se.every((ke,Ee)=>de[de.length-se.length+Ee]===ke))try{await this._fileService.stat(V),U=V}catch{return}}else try{await this._fileService.stat(V),U=V}catch{return}}if(!U){let pe=A.joinPath(V,$);try{await this._fileService.stat(pe),U=pe}catch{return}}}else O==="relative"&&(U=V);if(O==="relative"&&!U)try{await this._fileService.stat(V),U=V}catch{return}switch(O){case"tilde":{let $=this._getHomeDir(l,r);$&&(U=A.joinPath(Q6e(V,$),w.slice(1).replaceAll("\\ "," "))),U||b.match(/^~[\\\/]$/)&&(U=l?"Home directory":"$HOME");break}case"absolute":{s==="gitbash"?U=Q6e(V,Seo(w,this._processEnv.SystemDrive)):U=Q6e(V,w.replaceAll("\\ "," "));break}case"relative":{U??=V;break}}if(!U)return;if(Ae(U))return h.push({label:w,provider:n,kind:1,detail:U,replacementRange:[o-b.length,o]}),h;let G=await this._fileService.resolve(U,{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&&($=Lmi(w,e,k));break}}h.push({label:$,provider:n,kind:1,detail:MX(this._labelService,U,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 te,pe;if(c&&$.isDirectory)$.isSymbolicLink?te=9:te=1;else if(u&&$.isFile){if(v&&!l&&!$.executable)return;$.isSymbolicLink?te=8:te=0}if(te===void 0)return;let de=w;if(de.length>0&&!de.endsWith(e.pathSeparator)&&(de+=e.pathSeparator),de+=$.name,O==="relative"&&(de=Lmi(de,e,k)),$.isDirectory&&!de.endsWith(e.pathSeparator)&&(de+=e.pathSeparator),de=c2o(de,s,e.pathSeparator),$.isFile&&p){let se=$.resource.fsPath,Se=!this._fileService.hasCapability($.resource,1024);if(!Cp(p,se,{ignoreCase:Se}))return}if($.isSymbolicLink)try{let se=await this._fileService.realpath($.resource);se&&!Xe($.resource,se)&&(pe=`${MX(this._labelService,$.resource,e.pathSeparator,te,s)} -> ${MX(this._labelService,se,e.pathSeparator,te,s)}`)}catch{}h.push({label:de,provider:n,kind:te,detail:pe??MX(this._labelService,$.resource,e.pathSeparator,te,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 te=this._getEnvVar("CDPATH",r);if(te){let pe=te.split(l?";":":");for(let de of pe)try{let se=await this._fileService.resolve(Q6e(V,de),{resolveSingleChildDescendants:!0});if(se?.children)for(let Se of se.children){if(!Se.isDirectory)continue;let ke=$==="relative",Ee=1,He=ke?No(Se.resource.fsPath):s==="gitbash"?Ieo(Se.resource.fsPath):MX(this._labelService,Se.resource,e.pathSeparator,Ee,s),Ve=ke?`CDPATH ${MX(this._labelService,Se.resource,e.pathSeparator,Ee,s)}`:"CDPATH";h.push({label:He,provider:n,kind:Ee,detail:Ve,replacementRange:[o-b.length,o]})}}catch{}}}}if(this._logService.trace("TerminalCompletionService#resolveResources parent dir"),O==="relative"&&c){let $=`..${e.pathSeparator}`;w.length>0&&($=Lmi(w+$,e,k));let te=A.joinPath(U,".."+e.pathSeparator);h.push({label:$,provider:n,kind:1,detail:MX(this._labelService,te,e.pathSeparator,1,s),replacementRange:[o-b.length,o]})}if(this._logService.trace("TerminalCompletionService#resolveResources tilde"),O==="relative"&&!w.match(/[\\\/]/)){let $,te=this._getHomeDir(l,r);te&&($=Q6e(V,te)),$||($=l?"Home directory":"$HOME"),h.push({label:"~",provider:n,kind:1,detail:Ae($)?$:MX(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)}};kEe=I([m(0,B),m(1,be),m(2,ot),m(3,Xs)],kEe);function MX(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 Lmi(a,i,e){return e?a:a.startsWith(i.pathSeparator)?`.${a}`:`.${i.pathSeparator}${a}`}function c2o(a,i,e){return i===void 0||i==="pwsh"||i==="cmd"?a:a.replace(/[\[\]\(\)'"\\\`\*\?;|&<>]/g,"\\$&")}function d2o(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 Q6e(a,i){return a.scheme==="file"?A.file(i):a.with({path:i})}var OLt=class extends C{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=zo;this._proxy=e.getProxy(Zi.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],yde(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||zo,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 RX(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=fn.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"&&Wo(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(Y6e,(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=hn(e,t)}$stopSendingCommandEvents(){this._sendCommandEventListener.clear()}$startLinkProvider(){this._linkProvider.value=this._terminalLinkProviderService.registerLinkProvider(new Rmi(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=u2o(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=>yeo(e,t,g));if(h)return yeo(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 P;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:$6e(o),descriptionMap:q6e(n)};this._environmentVariableService.set(e,r)}else this._environmentVariableService.delete(e)}};OLt=I([vo(Gi.MainThreadTerminalService),m(1,Yo),m(2,j6e),m(3,CEe),m(4,F),m(5,Uz),m(6,ne),m(7,Sg),m(8,yo),m(9,jl),m(10,xv),m(11,iy),m(12,PX),m(13,Vt)],OLt);var Y6e=class extends C{constructor(e,t){super();this._callback=e;this._terminalService=t;this._register(this._bufferer=new PLt(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))}};Y6e=I([m(1,Yo)],Y6e);var Rmi=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 u2o(a,i){let e=a.join(`
`).match(i.lineMatcher);return e?{regexMatch:e,outputLines:a}:void 0}function yeo(a,i,e){let t=0;return Wo(e,{uri:!0})?(e.uri=A.revive(e.uri),t=1):Wo(e,{id:!0})&&(t=3),{id:a,type:t,source:i,...e}}var FLt=class extends C{constructor(e,t,o,n){super();this._terminalService=t;this._extensionService=n;this._proxy=e.getProxy(Zi.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=>H.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,xeo(g.instance),g.data.command,Ceo(g.data),g.data.isTrusted,g.data.cwd),r.get(f)?.dispose(),r.set(f,H.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,Ceo(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,xeo(e));let t=e.capabilities.get(0);t&&this._proxy.$cwdChange(e.instanceId,t.getCwd())}};FLt=I([vo(Gi.MainThreadTerminalShellIntegration),m(1,Yo),m(2,Vt),m(3,lt)],FLt);function Ceo(a){switch(a.commandLineConfidence){case"high":return 2;case"medium":return 1;default:return 0}}function xeo(a){return a.shellLaunchConfig.type!=="Task"}var WLt=class{constructor(i,e){this._themeService=e,this._proxy=i.getProxy(Zi.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()}};WLt=I([vo(Gi.MainThreadTheming),m(1,De)],WLt);var VLt=class extends C{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 jt);this._dndControllers=new Map;this._proxy=e.getProxy(Zi.ExtHostTreeViews)}async $registerTreeViewDataProvider(e,t){this.logService.trace("MainThreadTreeViews#$registerTreeViewDataProvider",e,t),this.extensionService.whenInstalledExtensionsRegistered().then(()=>{let o=new Pmi(e,this._proxy,this.notificationService),n=new P;this._dataProviders.set(e,{dataProvider:o,dispose:()=>n.dispose()});let r=t.hasHandleDrag||t.hasHandleDrop?new Mmi(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=Jn(r.select)?!1:r.select,l=Jn(r.focus)?!1:r.focus,c=Math.min(Xo(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=oe.as(on.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()}};VLt=I([vo(Gi.MainThreadTreeViews),m(1,Ft),m(2,Ne),m(3,lt),m(4,ne),m(5,Te)],VLt);var Mmi=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 ade}async handleDrop(i,e,t,o,n,r){let s=this.dataTransfersCache.add(i);try{let l=await sde.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 bx;return o.items.forEach(([r,s])=>{let l=r===Zn.uriList&&s.uriListData?Uy.create(s.uriListData.map(c=>typeof c=="string"?c:A.revive(c))):s.asString;n.replace(r,NN(l))}),n}resolveDropFileData(i,e){return this.dataTransfersCache.resolveFileData(i,e)}},Pmi=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=>(A_t.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 Zj(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=Uo([...Object.keys(i instanceof Zj?i.asTreeItem():i),...Object.keys(e)]);for(let o of t)i[o]=e[o];i instanceof Zj&&i.resetResolve()}}};var tF=ae("downloadService");var BLt=class extends C{constructor(e,t){super();this.downloadService=t}$download(e,t){return this.downloadService.download(A.revive(e),A.revive(t))}};BLt=I([vo(Gi.MainThreadDownloadService),m(1,tF)],BLt);var nI=ae("urlService");var p2o=300*1e3,m2o=30*1e3,Ami="extensionUrlHandler.urlToHandle",h2o="extensions.confirmedUriHandlerExtensionIds",keo="extensionUrlHandler.confirmedExtensions";function Eeo(a){return/^[a-z0-9][a-z0-9\-]*\.[a-z0-9][a-z0-9\-]*$/i.test(a)}var HLt=class{constructor(i){this.storageService=i}get extensions(){let i=this.storageService.get(keo,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(keo,JSON.stringify(i),0,1)}},Omi=ae("extensionUrlHandler"),J6e=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}},X6e=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 HLt(r);let u=MI(It,()=>this.garbageCollect(),m2o),p=this.storageService.get(Ami,1);p&&(this.storageService.remove(Ami,1),this.handleURL(A.revive(JSON.parse(p)),{trusted:!0})),this.disposable=hn(i.registerHandler(this),u);let h=PP.cache;setTimeout(()=>h.forEach(([g,f])=>this.handleURL(g,f)))}async handleURL(i,e){if(!Eeo(i.authority))return!1;let t=J6e.getHandler(i);if(t){let p=await t.handleURL(i);if(p)return p}let o=i.authority,n=this.extensionHandlers.get(Ei.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=>mr(p,o))||this.didUserTrustExtension(Ei.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(16900,null,r),checkbox:{label:d(16909,null)},primaryButton:d(16905,null),custom:{markdownDetails:[{markdown:new xe(`<div title="${p}" aria-label='${p}'>${h}</div>`,{supportHtml:!0})}]}});if(!g.confirmed)return!0;g.checkboxChecked&&this.userTrustedExtensionsStorage.add(Ei.toKey(o))}let l=this.extensionHandlers.get(Ei.toKey(o));if(l)return n?!1:await this.handleURLByExtension(o,l,i,e);let c=new Date().getTime(),u=this.uriBuffer.get(Ei.toKey(o));return u||(u=[],this.uriBuffer.set(Ei.toKey(o),u)),u.push({timestamp:c,uri:i}),await this.extensionService.activateByEvent(`onUri:${Ei.toKey(o)}`,1),!0}registerExtensionHandler(i,e){this.extensionHandlers.set(Ei.toKey(i),e);let t=this.uriBuffer.get(Ei.toKey(i))||[];for(let{uri:o}of t)this.handleURLByExtension(i,e,o);this.uriBuffer.delete(Ei.toKey(i))}unregisterExtensionHandler(i){this.extensionHandlers.delete(Ei.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(16902,null)}
${i.toString()}`,action:d(16906,null)},enable:!0,installPreReleaseVersion:this.productService.quality!=="stable"})}catch(n){so(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(16907,null,e),primaryButton:d(16908,null)})).confirmed)return;this.storageService.store(Ami,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<p2o),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(h2o);return Array.isArray(i)?i:[]}dispose(){this.disposable.dispose(),this.extensionHandlers.clear(),this.uriBuffer.clear()}};X6e=I([m(0,nI),m(1,lt),m(2,ct),m(3,ge),m(4,oi),m(5,le),m(6,B),m(7,Ne),m(8,nt)],X6e);we(Omi,X6e,0);var PP=class{static{this.ID="workbench.contrib.extensionUrlBootstrapHandler"}static{this._cache=[]}static get cache(){PP.disposable.dispose();let i=PP._cache;return PP._cache=[],i}constructor(i){PP.disposable=i.registerHandler(this)}async handleURL(i,e){return Eeo(i.authority)?(PP._cache.push([i,e]),!0):!1}};PP=I([m(0,nI)],PP);pt(PP.ID,PP,ut.BlockRestore);var Nmi=class extends K{constructor(){super({id:"workbench.extensions.action.manageAuthorizedExtensionURIs",title:L(16903,"Manage Authorized Extension URIs..."),category:L(16901,"Extensions"),menu:{id:D.CommandPalette,when:ep.toNegated()}})}async run(i){let e=i.get(le),t=i.get(Ge),o=new HLt(e),n=o.extensions.map(s=>({label:s,picked:!0}));if(n.length===0){await t.pick([{label:d(16904,null)}]);return}let r=await t.pick(n,{canPickMany:!0});r&&o.set(r.map(s=>s.label))}};W(Nmi);var _eo=A.parse("trustedDomains:/Trusted Domains"),_Ee="http.linkProtectionTrustedDomains",ULt="http.linkProtectionTrustedDomainsContent";async function Deo(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||!Xe(t.uri,i))return;let o=$le(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 zLt={id:"workbench.action.manageTrustedDomain",description:{description:L(15598,"Manage Trusted Domains"),args:[]},handler:async a=>{let i=a.get(ee);await Deo(i,_eo)}};async function Leo(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(15602,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(15601,null,f),toTrust:f+":*",id:"trust"})}}else p.push({type:"item",label:d(15603,null,c),toTrust:u,id:"trust"});p.push({type:"item",label:d(15600,null),toTrust:"*",id:"trust"}),p.push({type:"item",label:d(15599,null),id:"manage"});let g=await t.pick(p,{activeItem:p[0]});if(g&&g.id)switch(g.id){case"manage":{let f=_eo.with({fragment:e.toString()});return await Deo(n,f),a}case"trust":{let f=g.toTrust;if(a.indexOf(f)===-1)return o.remove(ULt,-1),o.store(_Ee,JSON.stringify([...a,f]),-1,0),[...a,f]}}return[]}async function Reo(a){let{defaultTrustedDomains:i,trustedDomains:e}=DEe(a);return{defaultTrustedDomains:i,trustedDomains:e}}function DEe(a){let i=a.get(le),e=a.get(nt),t=a.get(ru),o=[...e.linkProtectionTrustedDomains??[],...t.options?.additionalTrustedDomains??[]],n=[];try{let r=i.get(_Ee,-1);r&&(n=JSON.parse(r))}catch{}return{defaultTrustedDomains:o,trustedDomains:n}}function Fmi(a){let i=typeof a=="string"?A.parse(a):a;return i.with({path:i.path.replace(/\/+$/,""),query:null,fragment:null})}function LEe(a,i){let e=Fmi(a),t;if(/^[^./:]*:\/\//.test(i))t=Fmi(i);else{if(e.scheme!=="http"&&e.scheme!=="https")return!1;t=Fmi(`${e.scheme}://${i}`)}return Wmi(e.scheme,t.scheme)&&Wmi(e.authority,t.authority,!0)&&(t.path==="/"||Wmi(e.path,t.path))}function Wmi(a,i,e=!1){let t=Array.from({length:a.length+1}).map(()=>Array.from({length:i.length+1}).map(()=>{}));return w5(t,e,a,i,0,0)}function w5(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(w5(a,i,e,t,o+1,n+1)),t[n]+t[n+1]==="*."&&(["/",":"].includes(e[o])||r.push(w5(a,i,e,t,o+1,n)),r.push(w5(a,i,e,t,o,n+2))),t[n]==="*"&&(o+1===e.length?r.push(w5(a,i,e,t,o+1,n+1)):r.push(w5(a,i,e,t,o+1,n)),r.push(w5(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(w5(a,i,e,t,s,n+2))}else r.push(w5(a,i,e,t,o,n+2));return a[o][n]=r.some(s=>s===!0)}function KLt(a,i){if(a=A.parse(e9e(a)),i=i.map(e9e),t9e(a.authority))return!0;for(let e=0;e<i.length;e++)if(i[e]==="*"||LEe(a,i[e]))return!0;return!1}function e9e(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 g2o=/^(.+\.)?localhost(:\d+)?$/i,f2o=/^127.0.0.1(:\d+)?$/,v2o=/^\[::1\](:\d+)?$/;function t9e(a){return g2o.test(a)||f2o.test(a)||v2o.test(a)}var _V=ae("ITrustedDomainService");var REe=class extends C{constructor(e,t){super();this._instantiationService=e;this._storageService=t;this._onDidChangeTrustedDomains=this._register(new E);this.onDidChangeTrustedDomains=this._onDidChangeTrustedDomains.event;let o=()=>new hN(It,()=>{let{defaultTrustedDomains:n,trustedDomains:r}=this._instantiationService.invokeFunction(DEe);return[...n,...r]});this._staticTrustedDomainsResult=o(),this._register(this._storageService.onDidChangeValue(-1,_Ee,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(DEe),n=[...t,...o];return KLt(e,n)}};REe=I([m(0,F),m(1,le)],REe);var Vmi=class{constructor(i,e,t,o){this.proxy=i;this.handle=e;this.extensionId=t;this.extensionDisplayName=o}async handleURL(i,e){return Ei.equals(this.extensionId,i.authority)?(await this.proxy.$handleExternalUri(this.handle,i),!0):!1}},GLt=class extends C{constructor(e,t,o,n){super();this.urlService=o;this.extensionUrlHandler=n;this.handlers=new Map;this.proxy=e.getProxy(Zi.ExtHostUrls)}async $registerUriHandler(e,t,o){let n=new Vmi(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()}};GLt=I([vo(Gi.MainThreadUrls),m(1,_V),m(2,nI),m(3,Omi)],GLt);var wde="default",$Lt="workbench.externalUriOpeners",Bmi={type:"string",enum:[]},Meo="\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",Hmi={...Cm,properties:{[$Lt]:{type:"object",markdownDescription:d(10135,null),defaultSnippets:[{body:{"example.com":"$1"}}],additionalProperties:{anyOf:[{type:"string",markdownDescription:d(10137,null,Meo)},{type:"string",markdownDescription:d(10137,null,Meo),enum:[wde],enumDescriptions:[d(10136,null)]},Bmi]}}}};function Peo(a,i){Bmi.enum=a,Bmi.enumDescriptions=i,oe.as(ii.Configuration).notifyConfigurationSchemaUpdated(Hmi)}var AX=class extends C{constructor(e,t){super();this._extensionService=t;this._openers=new Map;this._memento=new Bl(AX.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);Peo(e,t)}};AX=I([m(0,le),m(1,lt)],AX);var Aeo=244;function MEe(a){return{...a,override:Ys.id,pinned:!0}}var Po=ae("preferencesService"),qLt="editor.contrib.defineKeybinding",PEe=".vscode/settings.json",i9e="workbench.settings.openDefaultSettings",o9e="workbench.settings.useSplitJSON",Umi="workbench.settings.alwaysShowAdvancedSettings",AEe="settings";var NX=ae("externalUriOpenerService"),NEe=class extends C{constructor(e,t,o,n,r){super();this.configurationService=t;this.logService=o;this.preferencesService=n;this.quickInputService=r;this._providers=new Vs;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===wde)return[];let u=r.get(o.preferredOpenerId);if(u)return[u]}let s=this.getConfiguredOpenerForUri(r,e);if(s)return s===wde?[]:[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(ht.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($Lt)||{};for(let[n,r]of Object.entries(o))if(LEe(t,n)){if(r===wde)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:Gt?d(10140,null):d(10139,null),opener:void 0},{type:"separator"},{label:d(10138,null),opener:"configureDefault"});let s=await this.quickInputService.pick(r,{placeHolder:d(10141,null,t.toString())});return s?typeof s.opener>"u"?!1:s.opener==="configureDefault"?(await this.preferencesService.openUserSettings({jsonEditor:!0,revealSetting:{key:$Lt,edit:!0}}),!0):s.opener.openExternalUri(t,o,n):!0}};NEe=I([m(0,Qe),m(1,B),m(2,ne),m(3,Po),m(4,Ge)],NEe);var jLt=class extends C{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(Zi.ExtHostUriOpeners),this._register(o.registerExternalOpenerProvider(this)),this._contributedExternalUriOpenersStore=this._register(new AX(t,n))}async*getOpeners(e){if(!(e.scheme!==Y.http&&e.scheme!==Y.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(!so(s)){let l=new st("default",d(3063,null),void 0,void 0,async()=>{await this.openerService.open(o,{allowTunneling:!1,allowContributedOpeners:wde})});l.tooltip=o.toString(),this.notificationService.notify({severity:St.Error,message:d(3062,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()}};jLt=I([vo(Gi.MainThreadUriOpeners),m(1,le),m(2,NX),m(3,lt),m(4,Qe),m(5,Ne)],jLt);var zmi=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=[]}},QLt=new zmi;var b2o=1e4,Cde=ae("IUserActivityService"),n9e=class extends C{constructor(e){super();this.markInactive=this._register(new Dt(()=>{this.isActive=!1,this.changeEmitter.fire(!1)},b2o));this.changeEmitter=this._register(new E);this.active=0;this.isActive=!0;this.onDidChangeIsActive=this.changeEmitter.event;this._register(aN(()=>QLt.take(this,e)))}markActive(e){if(e?.extendOnly&&!this.isActive)return C.None;if(e?.whenHeldFor){let t=new P;return t.add(nn(()=>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()})}};n9e=I([m(0,F)],n9e);we(Cde,n9e,1);var YLt=class{constructor(i,e,t,o){this.hostService=e;this.openerService=t;this.userActivityService=o;this.disposables=new P;this.proxy=i.getProxy(Zi.ExtHostWindow),H.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(){H.latch(this.hostService.onDidChangeActiveWindow)(async i=>{let e=await this.hostService.getNativeWindowHandle(i);this.proxy.$onDidChangeActiveNativeWindowHandle(e?Qd(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}};YLt=I([vo(Gi.MainThreadWindow),m(1,oi),m(2,Qe),m(3,Cde)],YLt);var XLt=ae("powerService");var JLt=class extends C{constructor(e,t){super();this.powerService=t;this.proxy=e.getProxy(Zi.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)}};JLt=I([vo(Gi.MainThreadPower),m(1,XLt)],JLt);var OX=class extends C{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=>{Xe(this.resource,l.resource)&&(this._onDidChangeDirty.fire(),this._onDidChangeContent.fire())})),this._register(s.onWillStop(l=>{l.veto(!0,d(8573,null,this.name))}))}static async create(e,t,o){return e.invokeFunction(async n=>{let s=await n.get(Nt).createModelReference(o);return e.createInstance(OX,t,o,s)})}get resource(){return this._resource}get name(){return No(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)}};OX=I([m(3,Ho),m(4,ot),m(5,lt)],OX);var FX=class extends C{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 Pi(100,ve.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()}};FX=I([m(1,be)],FX);var FEe=class extends C{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 jt);this._editorRenameBackups=new Map;this._webviewOriginStore=new vz("mainThreadCustomEditors.origins",r),this._proxyCustomEditors=e.getProxy(Zi.ExtHostCustomEditors),this._register(l.registerWorkingCopyProvider(v=>{let b=[];for(let S of s.workingCopies)S instanceof DV&&La(v,S.editorResource)&&b.push(S);return b})),this._register(g.registerResolver({canResolve:v=>(v instanceof Yp&&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,Pce(e),t,o,n,!0,r)}$registerCustomEditorProvider(e,t,o,n,r){this.registerEditorProvider(0,Pce(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 P;c.add(this._customEditorService.registerCustomEditorCapabilities(o,{supportsMultipleEditorsPerDocument:s})),c.add(this._webviewWorkbenchService.registerResolver({canResolve:u=>u instanceof Yp&&u.viewType===o,resolveWebview:async(u,p)=>{let h=_t(),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,{},ve.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},bC(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=OX.create(this._instantiationService,o,t);return this._customEditorService.models.add(t,o,l)}case 0:{let l=DV.create(this._instantiationService,this._proxyCustomEditors,o,t,n,()=>Array.from(this.mainThreadWebviewPanels.webviewInputs).filter(c=>c instanceof Yp&&Xe(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 DV))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 DV&&o.isDirty()){let n=await o.backup(ve.None);n.meta&&this._editorRenameBackups.set(o.editorResource.toString(),n.meta)}})())}};FEe=I([m(3,lt),m(4,le),m(5,Wa),m(6,kp),m(7,tX),m(8,Et),m(9,ee),m(10,F),m(11,V_),m(12,dt)],FEe);var OEe;(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})(OEe||={});var DV=class extends FX{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super(DV.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=OEe.Allowed;this._currentEditIndex=-1;this._savePoint=-1;this._edits=[];this.typeId=CP;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=H.None;this._fromBackup=n,this._isDirtyFromContentChange=s,r&&(this._register(f.registerWorkingCopy(this)),this._register(b.onWillStop(S=>{S.veto(!0,d(3008,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(DV,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=`/${m6(t.with({query:null,fragment:null}).toString(!0))}`;return A.from({scheme:Y.vscodeCustomEditor,authority:o,path:n,query:JSON.stringify(t.toJSON())})}get name(){return No(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===Y.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(3007,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,ve.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=xn(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=Og(this._editorResource,t,this._pathService.defaultUriScheme);return this._fileDialogService.pickFileToSave(o,e?.availableFileSystems)}async saveCustomEditorAs(e,t,o){return this._editable?(await xn(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 OEe.Pending(xn(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=OEe.Allowed,r.meta.backupId=c,this._backupId=c)}catch(c){if(so(c))throw c;this._hotExitState===s&&(this._hotExitState=OEe.NotAllowed),c.message&&(l=c.message)}if(this._hotExitState===OEe.Allowed)return r;throw new Error(`Cannot backup in this state: ${l}`)}};DV=I([m(7,dn),m(8,be),m(9,ot),m(10,Cl),m(11,Vt),m(12,Wa),m(13,wn),m(14,lt)],DV);var Kmi=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()}},Gmi=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}},WEe=class extends C{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 Gmi("mainThreadWebview-");this._webviewInputs=new Kmi;this._revivers=this._register(new jt);this.webviewOriginStore=new vz("mainThreadWebviewPanel.origins",l),this._proxy=e.getProxy(Zi.ExtHostWebviewPanels),this._register(H.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=Pce(e),u=this.webviewOriginStore.getOrigin(o,c.id),p=this._webviewWorkbenchService.openWebview({origin:u,providedViewType:o,title:n.title,options:I2o(n.panelOptions),contentOptions:fke(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=S2o(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===Un||this._editorGroupService.count===1&&this._editorGroupService.activeGroup.isEmpty)return Un;if(e.viewColumn===vn)return vn;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=pC(this._configurationService);return this._editorGroupService.addGroup(o,n)}}return Un}$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=_t();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},bC(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 wu))return;s.updateGroup(n.id);let l=this._webviewInputs.getHandleForInput(s);l&&(t[l]={visible:r===n.activeEditor,active:s===e,position:bC(this._editorGroupService,n.id)})};for(let n of this._editorGroupService.groups)for(let r of n.editors)r instanceof Fa?(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)}};WEe=I([m(2,B),m(3,Et),m(4,ee),m(5,lt),m(6,le),m(7,V_)],WEe);function S2o(a){if(a)return q.isThemeIcon(a)?a:{light:A.revive(a.light),dark:A.revive(a.dark)}}function I2o(a){return{enableFindWidget:a.enableFindWidget,retainContextWhenHidden:a.retainContextWhenHidden}}var VEe=ae("webviewViewService"),ZLt=class extends C{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,ve.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}=TI();return this._awaitingRevival.set(e,{webview:t,resolve:s}),r}return n.resolve(t,o)}};var BEe=class extends C{constructor(e,t,o,n){super();this.mainThreadWebviews=t;this._telemetryService=o;this._webviewViewService=n;this._webviewViews=this._register(new jt);this._webviewViewProviders=this._register(new jt);this._proxy=e.getProxy(Zi.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=Pce(e),r=this._webviewViewService.register(t,{resolve:async(s,l)=>{let c=_t();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 P;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}};BEe=I([m(2,Te),m(3,VEe)],BEe);var UEe=ae("chatOutputRendererService"),HEe=class extends C{constructor(e,t,o){super();this._contextKeyService=e;this._extensionService=t;this._webviewService=o;this._contributions=new Map;this._renderers=new Map;this._register(w2o.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 ho;if(!s)throw new Error(`No renderer registered found for mime type: ${e}`);let l=new P,c=l.add(this._webviewService.createWebviewElement({title:"",origin:n.origin??_t(),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(he(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,Me(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 pm(this._extensionService.whenInstalledExtensionsRegistered(),t);for(let[o,n]of this._contributions)if(n.mimes.some(r=>Y$e(r,[e]))){await pm(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(Ea(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})}}};HEe=I([m(0,X),m(1,lt),m(2,wm)],HEe);var y2o={type:"object",additionalProperties:!1,required:["viewType","mimeTypes"],properties:{viewType:{type:"string",description:d(6577,null)},mimeTypes:{type:"array",description:d(6576,null),items:{type:"string"}}}},w2o=Tn.registerExtensionPoint({extensionPoint:"chatOutputRenderers",activationEventsGenerator:function*(a){for(let i of a)yield`onChatOutputRenderer:${i.viewType}`},jsonSchema:{description:d(6578,null),type:"array",items:y2o}});var zEe=class extends C{constructor(e,t,o){super();this._mainThreadWebview=t;this._rendererService=o;this._webviewHandlePool=0;this.registeredRenderers=new Map;this._proxy=e.getProxy(Zi.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,Je.wrap(r),c,l)}},{extension:{id:t,location:A.revive(o)}})}$unregisterChatOutputRenderer(e){this.registeredRenderers.get(e)?.dispose()}};zEe=I([m(2,UEe)],zEe);var tRt=class extends C{constructor(i,e){super();let t=this._register(e.createInstance(OY,i));i.set(Gi.MainThreadWebviews,t);let o=this._register(e.createInstance(WEe,i,t));i.set(Gi.MainThreadWebviewPanels,o);let n=this._register(e.createInstance(FEe,i,t,o));i.set(Gi.MainThreadCustomEditors,n);let r=this._register(e.createInstance(BEe,i,t));i.set(Gi.MainThreadWebviewViews,r);let s=this._register(e.createInstance(zEe,i,t));i.set(Gi.MainThreadChatOutputRenderer,s)}};tRt=I([QL,m(1,F)],tRt);function C2o(a){return typeof a=="object"&&"uri"in a&&"pattern"in a}var aS=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(Dae),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(Dae),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(iRt),!i.length)return{}}else i=iRt(i);return e?this.parseSearchPaths(i):{pattern:$mi(...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=si(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=>Sde(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=>Sde(l,u.fsPath));return l.extraFileResources=c&&c.length?c:void 0,l}commonQueryFromFileList(i){let e=[],t=new vt,o={},n=!1;return i.forEach(r=>{if(r.scheme===Y.walkThrough)return;if(wpt(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=SM(l.fsPath,r.fsPath);Oi(c.includePattern)[jmi(u.replace(/\\/g,"/"))]=!0}else r.fsPath&&(n=!0,o[jmi(r.fsPath)]=!0)}),{folderQueries:e,includePattern:o,usingSearchPaths:!0,excludePattern:n?void 0:{"**/*":!0}}}isCaseSensitive(i,e){if(e.isSmartCase){if(i.isRegExp){if(gGe(i.pattern,!0))return!0}else if(gGe(i.pattern))return!0}return!!i.isCaseSensitive}isMultiline(i){return i.isMultiline||i.isRegExp&&I$e(i.pattern)||i.pattern.indexOf(`
`)>=0?!0:!!i.isMultiline}parseSearchPaths(i){let e=p=>Xl(p)||/^\.\.?([\/\\]|$)/.test(p),o=(Array.isArray(i)?i:k2o(i)).map(p=>{let h=this.pathService.resolvedUserHome;return h?v9(p,h.scheme===Y.file?h.fsPath:h.path):p}),n=wI(o,p=>e(p)?"searchPaths":"exprSegments"),r=(n.exprSegments||[]).map(p=>ih(p,"/")).map(p=>ih(p,"\\")).map(p=>(p[0]==="."&&(p="*"+p),E2o(p))),s={},l=this.expandSearchPathPatterns(n.searchPaths||[]);l&&l.length&&(s.searchPaths=l);let c=r.flat(),u=$mi(...c);return u&&(s.pattern=u),s}getExcludesForFolder(i,e){return e.disregardExcludeSettings?void 0:MP(i,!e.disregardSearchExcludeSettings)}expandSearchPathPatterns(i){if(!i||!i.length)return[];let e=i.flatMap(o=>{let{pathPortion:n,globPortion:r}=x2o(o);return r&&(r=qmi(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?$mi(o.pattern):void 0})}),Array.from(t.values())}expandOneSearchPath(i){if(Xl(i)){let e=this.workspaceContextService.getWorkspace().folders;return e[0]&&e[0].uri.scheme!==Y.file?[{searchPath:e[0].uri.with({path:i})}]:[{searchPath:A.file(th(i))}]}if(this.workspaceContextService.getWorkbenchState()===2){let e=this.workspaceContextService.getWorkspace().folders[0].uri;if(i=iRt(i),i.startsWith("../")||i===".."){let o=Lo.resolve(e.path,i);return[{searchPath:e.with({path:o})}]}let t=qmi(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(`^${Yr(n.name)}(?:/(.*)|$)`));return r?{match:r,folder:n}:null}).filter(mo);if(o.length)return o.map(n=>{let r=n.match[1];return{searchPath:n.folder.uri,pattern:r&&qmi(r)}});{let n=i.match(/\.[\/\\](.+)[\/\\]?/),r=n?n[1]:i,s=d(17203,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(Dae(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&&C2o(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=>Xe(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)?Ye(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}}};aS=I([m(0,B),m(1,Pe),m(2,Et),m(3,ne),m(4,wn),m(5,dt)],aS);function x2o(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 $mi(...a){return a.length?a.reduce((i,e)=>(i[e]=!0,i),Object.create(null)):void 0}function k2o(a){return HL(a,",").map(i=>i.trim()).filter(i=>!!i.length)}function E2o(a){return[`**/${a}/**`,`**/${a}`].map(e=>e.replace(/\*\*\/\*\*/g,"**"))}function iRt(a){return a.replace(/\\/g,"/")}function qmi(a){return iRt(a).replace(/^\.\//,"").replace(/\/+$/g,"")}function jmi(a){return a.replace(/([?*[\]])/g,"[$1]")}function Neo(a,i){a=Uo(a,o=>o.toString());let e=[],t=i.getWorkspace();return a&&a.forEach(o=>{let n;if(i.getWorkbenchState()===2)n=Fc(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=Fc(r.uri,o);c===""?n=`./${r.name}`:n=`./${r.name}/${c}`}else n=o.fsPath}}n&&e.push(jmi(n))}),e}var T2o=7e3;function Oeo(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}=TI(),s=u=>r({activationEvent:u}),l=Promise.all(t.map(u=>_2o(a,u,s))).then(()=>{}),c=D2o(a,i.identifier,o,s);return Promise.all([l,c]).then(()=>{r(void 0)}),n}async function _2o(a,i,e){for(let t of a.folders)if(await a.exists(je(A.revive(t),i))){e(`workspaceContains:${i}`);return}}async function D2o(a,i,e,t){if(e.length===0)return Promise.resolve(void 0);let o=new $e,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(",")}`)},T2o),s=!1;try{s=await n}catch(l){so(l)||mt(l)}o.dispose(),clearTimeout(r),s&&t(`workspaceContains:${e.join(",")}`)}function KEe(a,i,e,t){let o=a.get(F),n=a.get(Jp),s=o.createInstance(aS).file(i.map(l=>Dae(A.revive(l))),{_reason:"checkExists",includePattern:e,exists:!0});return n.fileSearch(s,t).then(l=>!!l.limitHit,l=>so(l)?!1:Promise.reject(l))}var Of=ae("workspaceEditingService");var oRt=ae("canonicalUriIdentityService");var nRt=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){this._searchService=e;this._contextService=t;this._editSessionIdentityService=o;this._canonicalUriService=n;this._editorService=r;this._workspaceEditingService=s;this._notificationService=l;this._requestService=c;this._instantiationService=u;this._labelService=p;this._environmentService=h;this._workspaceTrustManagementService=f;this._workspaceTrustRequestService=v;this._textFileService=b;this._toDispose=new P;this._activeCancelTokens=Object.create(null);this.registeredEditSessionProviders=new Map;this.registeredCanonicalUriProviders=new Map;this._queryBuilder=this._instantiationService.createInstance(aS),this._proxy=i.getProxy(Zi.ExtHostWorkspace);let S=this._contextService.getWorkspace();S.configuration&&!kr&&!g.hasProvider(S.configuration)?this._proxy.$initializeWorkspace(this.getWorkspaceData(S),this.isWorkspaceTrusted()):this._contextService.getCompleteWorkspace().then(y=>this._proxy.$initializeWorkspace(this.getWorkspaceData(y),this.isWorkspaceTrusted())),this._contextService.onDidChangeWorkspaceFolders(this._onDidChangeWorkspace,this,this._toDispose),this._contextService.onDidChangeWorkbenchState(this._onDidChangeWorkspace,this,this._toDispose),this._workspaceTrustManagementService.onDidChangeTrust(this._onDidGrantWorkspaceTrust,this,this._toDispose),this._workspaceTrustManagementService.onDidChangeTrustedFolders(this._onDidChangeWorkspaceTrustedFolders,this,this._toDispose)}dispose(){this._toDispose.dispose();for(let i in this._activeCancelTokens)this._activeCancelTokens[i].cancel()}$updateWorkspaceFolders(i,e,t,o){let n=o.map(r=>({uri:A.revive(r.uri),name:r.name}));return this._notificationService.status(this.getStatusMessage(i,n.length,t),{hideAfter:10*1e3}),this._workspaceEditingService.updateFolders(e,t,n,!0)}getStatusMessage(i,e,t){let o,n=e>0,r=t>0;return n&&!r?e===1?o=d(3067,null,i):o=d(3066,null,i,e):r&&!n?t===1?o=d(3069,null,i):o=d(3068,null,i,t):o=d(3065,null,i),o}_onDidChangeWorkspace(){this._proxy.$acceptWorkspaceData(this.getWorkspaceData(this._contextService.getWorkspace()))}getWorkspaceData(i){return this._contextService.hasWorkspaceData()?{configuration:i.configuration||void 0,isUntitled:i.configuration?_q(i.configuration,this._environmentService):!1,folders:i.folders,id:i.id,name:this._labelService.getWorkspaceLabel(i),transient:i.transient}:null}$startFileSearch(i,e,t){let o=A.revive(i),n=this._contextService.getWorkspace(),r=this._queryBuilder.file(o?[o]:n.folders,Xn(e));return this._searchService.fileSearch(r,t).then(s=>s.results.map(l=>l.resource),s=>so(s)?null:Promise.reject(s))}$startTextSearch(i,e,t,o,n){let r=A.revive(e),s=this._contextService.getWorkspace(),l=r?[r]:s.folders.map(h=>h.uri),c=this._queryBuilder.text(i,l,Xn(t));c._reason="startTextSearch";let u=h=>{h.results&&this._proxy.$handleTextSearchResult(h,o)};return this._searchService.textSearch(c,n,u).then(h=>({limitHit:h.limitHit}),h=>so(h)?null:Promise.reject(h))}$checkExists(i,e,t){return this._instantiationService.invokeFunction(o=>KEe(o,i,e,t))}async $save(i,e){let t=A.revive(i),o=[...this._editorService.findEditors(t,{supportSideBySide:1})],n=await this._editorService.save(o,{reason:1,saveAs:e.saveAs,force:!e.saveAs});return this._saveResultToUris(n).at(0)}_saveResultToUris(i){return i.success?si(i.editors.map(e=>no.getCanonicalUri(e,{supportSideBySide:1}))):[]}$saveAll(i){return this._editorService.saveAll({includeUntitled:i}).then(e=>e.success)}$resolveProxy(i){return this._requestService.resolveProxy(i)}$lookupAuthorization(i){return this._requestService.lookupAuthorization(i)}$lookupKerberosAuthorization(i){return this._requestService.lookupKerberosAuthorization(i)}$loadCertificates(){return this._requestService.loadCertificates()}$requestResourceTrust(i){let e={...i,uri:A.revive(i.uri)};return this._workspaceTrustRequestService.requestResourcesTrust(e)}$requestWorkspaceTrust(i){return this._workspaceTrustRequestService.requestWorkspaceTrust(i)}async $isResourceTrusted(i){let e=A.revive(i);return(await this._workspaceTrustManagementService.getUriTrustInfo(e)).trusted}isWorkspaceTrusted(){return this._workspaceTrustManagementService.isWorkspaceTrusted()}_onDidGrantWorkspaceTrust(){this._proxy.$onDidGrantWorkspaceTrust()}_onDidChangeWorkspaceTrustedFolders(){this._proxy.$onDidChangeWorkspaceTrustedFolders()}$registerEditSessionIdentityProvider(i,e){let t=this._editSessionIdentityService.registerEditSessionIdentityProvider({scheme:e,getEditSessionIdentifier:async(o,n)=>this._proxy.$getEditSessionIdentifier(o.uri,n),provideEditSessionIdentityMatch:async(o,n,r,s)=>this._proxy.$provideEditSessionIdentityMatch(o.uri,n,r,s)});this.registeredEditSessionProviders.set(i,t),this._toDispose.add(t)}$unregisterEditSessionIdentityProvider(i){this.registeredEditSessionProviders.get(i)?.dispose(),this.registeredEditSessionProviders.delete(i)}$registerCanonicalUriProvider(i,e){let t=this._canonicalUriService.registerCanonicalUriProvider({scheme:e,provideCanonicalUri:async(o,n,r)=>{let s=await this._proxy.$provideCanonicalUri(o,n,r);return s&&A.revive(s)}});this.registeredCanonicalUriProviders.set(i,t),this._toDispose.add(t)}$unregisterCanonicalUriProvider(i){this.registeredCanonicalUriProviders.get(i)?.dispose(),this.registeredCanonicalUriProviders.delete(i)}$resolveDecoding(i,e){return this._textFileService.resolveDecoding(A.revive(i),e)}$validateDetectedEncoding(i,e,t){return this._textFileService.validateDetectedEncoding(A.revive(i),e,t)}$resolveEncoding(i,e){return this._textFileService.resolveEncoding(A.revive(i),e)}};nRt=I([vo(Gi.MainThreadWorkspace),m(1,Jp),m(2,Pe),m(3,Wz),m(4,oRt),m(5,ee),m(6,Of),m(7,Ne),m(8,_a),m(9,F),m(10,ot),m(11,Co),m(12,be),m(13,ns),m(14,Vd),m(15,Ho)],nRt);var GEe=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(){}};GEe=I([m(0,qt)],GEe);var zz="comments";var vc;(h=>(h.activeCursorHasCommentingRange=new Q("activeCursorHasCommentingRange",!1,{description:d(8567,null),type:"boolean"}),h.activeCursorHasComment=new Q("activeCursorHasComment",!1,{description:d(8565,null),type:"boolean"}),h.activeEditorHasCommentingRange=new Q("activeEditorHasCommentingRange",!1,{description:d(8564,null),type:"boolean"}),h.WorkspaceHasCommenting=new Q("workspaceHasCommenting",!1,{description:d(8566,null),type:"boolean"}),h.commentThreadIsEmpty=new Q("commentThreadIsEmpty",!1,{type:"boolean",description:d(8562,null)}),h.commentIsEmpty=new Q("commentIsEmpty",!1,{type:"boolean",description:d(8560,null)}),h.commentContext=new Q("comment",void 0,{type:"string",description:d(8556,null)}),h.commentThreadContext=new Q("commentThread",void 0,{type:"string",description:d(8561,null)}),h.commentControllerContext=new Q("commentController",void 0,{type:"string",description:d(8557,null)}),h.commentFocused=new Q("commentFocused",!1,{type:"boolean",description:d(8558,null)}),h.commentWidgetVisible=new Q("commentWidgetVisible",!1,{type:"boolean",description:d(8563,null)}),h.commentingEnabled=new Q("commentingEnabled",!0,{description:d(8559,null),type:"boolean"})))(vc||={});var HE=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}},mw=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 HE(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 a9e(a){return!!a.comments&&!!a.comments.length&&a.comments.some(i=>Mr(i.body)?i.body.value.length>0:i.body.length>0)}var Kz=class a extends C{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]=mw.createCommentNode(e,t,A.parse(p.id),c):c.comments&&c.comments.length&&p.commentThreads.push(mw.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(mw.createCommentNode(e,t,p.resource,c))}else l.push(new mw(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=>a9e(e.thread)))}getMessage(){return this._resourceCommentThreads.length?"":d(8499,null)}groupByResource(i,e,t){let o=[],n=new Map;for(let r of Pg(t,a._compareURIs))n.set(r[0].resource,new mw(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 km=ae("commentService"),Qmi="comments.continueOnComments",$Ee=class extends C{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 Kz);this.commentsModel=this._commentsModel;this._commentingRangeResources=new Set;this._commentingRangeResourceHintSchemes=new Set;this._handleConfiguration(),this._handleZenMode(),this._workspaceHasCommenting=vc.WorkspaceHasCommenting.bindTo(n),this._commentingEnabled=vc.commentingEnabled.bindTo(n);let c=this._register(new P),u=H.debounce(this.storageService.onDidChangeValue(1,Qmi,c),(p,h)=>p?.external?p:h,500);c.add(u(p=>{if(!p.external)return;let h=this.storageService.getObject(Qmi,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!==Y.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(zz)?.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(GEe);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,ve.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,ve.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,ve.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(Qmi,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())}};$Ee=I([m(0,F),m(1,fi),m(2,B),m(3,X),m(4,le),m(5,ne),m(6,Ct)],$Ee);function Gz(a){if(a?.resource)return A.isUri(a.resource)?a.resource:a.resource.primary}var AP={onDidChangeVisibility:H.None},Za=class extends C{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(Y$)&&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(l9e,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)),Ue(e)}clear(){this.widgets=Ue(this.widgets),this.labels=[]}dispose(){super.dispose(),this.clear()}};Za=I([m(1,F),m(2,B),m(3,Ct),m(4,Pe),m(5,kt),m(6,Cv),m(7,De),m(8,ot),m(9,Ho)],Za);var rk=class extends Za{get element(){return this.label}constructor(i,e,t,o,n,r,s,l,c,u,p){super(AP,t,o,n,r,s,l,c,u,p),this.label=this._register(this.create(i,e))}};rk=I([m(2,F),m(3,B),m(4,Ct),m(5,Pe),m(6,kt),m(7,Cv),m(8,De),m(9,ot),m(10,Ho)],rk);var l9e=class extends Lc{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=Gz(this.label);t&&Xe(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=Gz(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){Gz(this.label)?.scheme===e&&this.render({updateIcon:!1,updateDecoration:!1})}notifyUntitledLabelChange(e){Xe(e,Gz(this.label))&&this.render({updateIcon:!1,updateDecoration:!1})}notifyWorkspaceFoldersChange(){if(typeof this.computedWorkspaceFolderLabel=="string"){let e=Gz(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(Ra(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=Gz(e),n=e?.resource&&!A.isUri(e.resource);if(!t.forceLabel&&!n&&o?.scheme===Y.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===Y.vscodeNotebookCell){let u=this.notebookDocumentService.getNotebook(o),p=u?.getCellIndex(o);u&&p!==void 0&&typeof e.name=="string"&&(t.title=d(3496,null,e.name,`${p+1}`)),typeof e.name=="string"&&u&&p!==void 0&&typeof e.name=="string"&&(e.name=d(3496,null,e.name,`${p+1}`))}if(!t.forceLabel&&!n&&o?.scheme===Y.vscodeNotebookCellOutput){let u=this.notebookDocumentService.getNotebook(o),p=V3e(o);if(p?.cellFragment){if(!p.notebook)return;let h=p.notebook.with({scheme:Y.vscodeNotebookCell,fragment:p.cellFragment}),g=u?.getCellIndex(h),f=p.outputIndex;g!==void 0&&f!==void 0&&typeof e.name=="string"?e.name=d(3497,null,e.name,`${g+1}`,`${f+1}`):g!==void 0&&typeof e.name=="string"&&(e.name=d(3498,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=Gz(e),o=Gz(this.label);return t&&o?t.toString()!==o.toString():!(!t&&!o)}hasPathLabelChanged(e){let t=Gz(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=Gz(this.label);if(this.options?.title!==void 0&&(t.title=this.options.title),o&&o.scheme!==Y.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=js(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}};l9e=I([m(2,kt),m(3,Ct),m(4,Cv),m(5,ot),m(6,Ho),m(7,Pe),m(8,Ij)],l9e);var xde=class extends C{constructor(e,t,o,n){super();this.configurationService=e;this._date=R(o,_("span.timestamp")),this._date.style.display="none",this._useRelativeTime=this.useRelativeTimeSetting,this.hover=this._register(t.setupManagedHover(Ni("mouse"),this._date,"")),this.setTimestamp(n)}get useRelativeTimeSetting(){return this.configurationService.getValue(zz).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 Bs(e,!0,!0)}getDateString(e){return e.toLocaleString(Dr)}};var Ymi=J("commentsView.resolvedIcon",{dark:WXt,light:WXt,hcDark:gi,hcLight:gi},d(8429,null)),Xmi=J("commentsView.unresolvedIcon",{dark:H$e,light:H$e,hcDark:gi,hcLight:gi},d(8431,null));J("editorCommentsWidget.replyInputBackground",DW,d(8425,null));var L2o=J("editorCommentsWidget.resolvedBorder",{dark:Ymi,light:Ymi,hcDark:gi,hcLight:gi},d(8428,null)),Jmi=J("editorCommentsWidget.unresolvedBorder",{dark:Xmi,light:Xmi,hcDark:gi,hcLight:gi},d(8430,null)),Jsl=J("editorCommentsWidget.rangeBackground",ei(Jmi,.1),d(8427,null)),Zsl=J("editorCommentsWidget.rangeActiveBackground",ei(Jmi,.1),d(8426,null)),R2o=new Map([[0,Jmi],[1,L2o]]),M2o=new Map([[0,Xmi],[1,Ymi]]),Feo="--comment-thread-state-color",Zmi="--comment-view-thread-state-color",Weo="--comment-thread-state-background-color";function Veo(a,i,e){let t=a!==void 0?e.get(a):void 0;return t!==void 0?i.getColor(t):void 0}function Beo(a,i){return Veo(a,i,R2o)}function Heo(a,i){return Veo(a,i,M2o)}var LV=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?Hw(i,"!"):i).trim(),negate:o}}static{this._filter=Dye}static{this._messageFilter=Up}};var Eu="workbench.panel.comments",Ueo="Comments",d9e=L(8503,"Comments"),ehi=class a{static{this.RESOURCE_ID="resource-with-comments"}static{this.COMMENT_ID="comment-node"}getHeight(i){return i instanceof HE&&i.hasReply()?44:22}getTemplateId(i){return i instanceof mw?a.RESOURCE_ID:i instanceof HE?a.COMMENT_ID:""}},thi=class{constructor(i){this.labels=i;this.templateId="resource-with-comments"}renderTemplate(i){let e=R(i,_(".resource-container")),t=this.labels.create(e),o=R(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()}},Ede=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 Ef(n,"inline")}dispose(){this.contextKeyService=void 0}};Ede=I([m(0,qt)],Ede);var c9e=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=R(i,_(".comment-thread-container")),t=R(e,_(".comment-metadata-container")),o=R(t,_(".comment-metadata")),n=R(o,_(".icon")),r=R(o,_(".user")),s=new xde(this.configurationService,this.hoverService,R(o,_(".timestamp-container"))),l=R(o,_(".relevance")),c=R(o,_(".separator")),u=R(o,_(".text")),p=R(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=R(t,_(".actions")),v=new ji(f,{actionViewItemProvider:this.actionViewItemProvider}),b=R(e,_(".comment-snippet-container")),S={container:b,icon:R(b,_(".icon")),count:R(b,_(".count")),lastReplyDetail:R(b,_(".reply-detail")),separator:R(b,_(".separator")),timestamp:new xde(this.configurationService,this.hoverService,R(b,_(".timestamp-container")))};S.separator.innerText="\xB7",S.icon.classList.add(...q.asClassNameArray(M.indent));let y=[g.timestamp,S.timestamp];return{threadMetadata:g,repliesMetadata:S,actionBar:v,disposables:y}}getCountString(i){return i>2?d(8504,null,i-1):i===2?d(8505,null):d(8500,null)}getRenderedComment(i){let e=nb(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(8507,null,r.alt):d(8506,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?M.commentDraft:i===0?M.commentUnresolved:M.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(8509,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(Zmi,`${c}`),t.threadMetadata.icon.style.color=`var(${Zmi})`}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 P;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(Ni("mouse"),t.threadMetadata.commentPreview,u.element.textContent??""))}i.element.range&&(i.element.range.startLineNumber===i.element.range.endLineNumber?t.threadMetadata.range.textContent=d(8501,null,i.element.range.startLineNumber):t.threadMetadata.range.textContent=d(8502,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(8508,null,l.userName),t.repliesMetadata.timestamp.setTimestamp(l.timestamp?new Date(l.timestamp):void 0)}getCommentThreadWidgetStateColor(i,e){return i!==void 0?Heo(i,e):void 0}disposeTemplate(i){i.disposables.forEach(e=>e.dispose()),i.actionBar.dispose()}};c9e=I([m(2,B),m(3,tt),m(4,De)],c9e);var rRt=class{constructor(i){this.options=i}filter(i,e){return this.options.filter===""&&this.options.showResolved&&this.options.showUnresolved?1:i instanceof mw?this.filterResourceMarkers(i):this.filterCommentNode(i,e)}filterResourceMarkers(i){if(this.options.textFilter.text&&!this.options.textFilter.negate){let e=LV._filter(this.options.textFilter.text,Ye(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=LV._messageFilter(this.options.textFilter.text,typeof i.comment.body=="string"?i.comment.body:i.comment.body.value)||LV._messageFilter(this.options.textFilter.text,i.comment.userName)||i.replies.map(n=>LV._messageFilter(this.options.textFilter.text,n.comment.userName)||LV._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}},qEe=class extends mg{constructor(e,t,o,n,r,s,l,c,u){let p=new ehi,h=Ca.bind(void 0,s),g=s.createInstance(Ede);g.setContextKeyService(n);let f=[s.createInstance(thi,e),s.createInstance(c9e,h,g)];super("CommentsTree",t,p,f,{accessibilityProvider:o.accessibilityProvider,identityProvider:{getId:v=>v instanceof Kz?"root":v instanceof mw?`${v.uniqueOwner}-${v.id}`:v instanceof HE?`${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 HE))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 Lr(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}};qEe=I([m(3,X),m(4,fo),m(5,F),m(6,B),m(7,ze),m(8,_e)],qEe);var sRt=class a extends C{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"&&Me(this.element).clearTimeout(this.animationTimer),R(this.element,this.body)):this.animationTimer=Me(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"),R(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=Vn(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 P),o=this._register(new On(this.header,"keydown")),n=H.map(o.event,s=>new Ii(s),t);this._register(H.filter(n,s=>s.keyCode===3||s.keyCode===10,t)(()=>this.setExpanded(!this.isExpanded()),null)),this._register(H.filter(n,s=>s.keyCode===15,t)(()=>this.setExpanded(!1),null)),this._register(H.filter(n,s=>s.keyCode===17,t)(()=>this.setExpanded(!0),null)),this._register(ws.addTarget(this.header));let r=this.header;[re.CLICK,Gn.Tap].forEach(s=>{this._register(j(r,s,l=>{l.defaultPrevented||this.setExpanded(!this.isExpanded())}))}),this.body=R(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}`:""}},ihi=class a extends C{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 Oe(new Bt(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",yc&&e.dataTransfer?.setData(Aa.TEXT,t),$N(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&&($t.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 aRt=class extends C{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=R(e,_(".monaco-pane-view")),this.splitview=this._register(new vu(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 P),n=this._register(new On(this.element,"keydown")),r=H.map(H.filter(n.event,s=>Ao(s.target)&&s.target.classList.contains("pane-header"),o),s=>new Ii(s),o);this._register(H.filter(r,s=>s.keyCode===16,o)(()=>this.focusPrevious())),this._register(H.filter(r,s=>s.keyCode===18,o)(()=>this.focusNext()))}addPane(e,t,o=this.splitview.length){let n=new P;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 ihi(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()?Wl.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 vu(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"&&Me(this.element).clearTimeout(this.animationTimer),this.element.classList.add("animated"),this.animationTimer=Me(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 lRt=class{constructor(i){this.nodes=i}toString(){return this.nodes.map(i=>typeof i=="string"?i:i.label).join("")}};I([mi],lRt.prototype,"toString",1);var N2o=/\[([^\]]+)\]\(((?:https?:\/\/|command:|file:)[^\)\s]+)(?: (["'])(.+?)(\3))?\)/gi;function lS(a){let i=[],e=0,t;for(;t=N2o.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 lRt(i)}var O2o=()=>({msLoopTime:-1,msDelayTime:-1,dispose:()=>{}}),zeo=O2o;function Keo(a){zeo=a}function Geo(a,i){return zeo(a,i)}var ohi="done",nhi="active",cRt="infinite",dRt="infinite-long-running",rhi="discrete",F2o=d(28,null);var fb=class a extends C{constructor(e,t){super();this.progressSignal=this._register(new me);this.workedVal=0,this.showDelayedScheduler=this._register(new Dt(()=>bn(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:F2o),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(nhi,cRt,dRt,rhi),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(ohi),this.element.classList.contains(cRt)?(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(rhi,ohi,dRt),this.element.classList.add(nhi,cRt),this.longRunningScheduler.schedule(),this}infiniteLongRunning(){this.element.classList.add(dRt)}total(e){return this.workedVal=0,this.totalWork=e,this.element.setAttribute("aria-valuemax",e.toString()),this}hasTotal(){return Xo(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(cRt,dRt,ohi),this.element.classList.add(nhi,rhi),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=Geo(a.PROGRESS_SIGNAL_DEFAULT_DELAY),typeof e=="number"?this.showDelayedScheduler.schedule(e):bn(this.element)}hide(){xo(this.element),this.showDelayedScheduler.cancel(),this.progressSignal.clear()}};var uRt=class extends C{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?zbt: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()}}},RV;(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})(RV||={});var jEe=class extends C{constructor(e,t){super();this.progressBar=e;this.scope=t;this.progressState=RV.None;this.registerListeners()}registerListeners(){this._register(this.scope.onDidChangeActive(()=>{this.scope.isActive?this.onDidScopeActivate():this.onDidScopeDeactivate()}))}onDidScopeActivate(){if(this.progressState.type!==RV.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=RV.Infinite:this.progressState=new RV.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 RV.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 RV.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=RV.Infinite,this.progressBar.infinite().show())},done:()=>{this.progressState=RV.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 RV.While(e,t||0,Date.now());try{this.doShowWhile(t),await e}catch{}finally{(this.progressState.type!==3||this.progressState.whilePromise===e)&&(this.progressState=RV.None,this.scope.isActive&&this.progressBar.stop().hide())}}doShowWhile(e){this.scope.isActive&&this.progressBar.infinite().show(e)}},QEe=class extends C{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 $eo=new D("menu.view.filter"),TC=new D("submenu.view.filter");fe.appendMenuItem($eo,{submenu:TC,title:d(4248,null),group:"navigation",icon:M.filter});var shi=class extends mE{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()}},$z=class extends Ma{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 jo(300),this._register(Z(()=>this.delayedFilterUpdate.cancel())),e.focusContextKey&&(this.focusContextKey=new Q(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=R(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(4249,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(4247,null,t),this._accessibilityHelpHintAnnounced=!0,this._labelResetTimeout?.dispose(),this._labelResetTimeout=nn(()=>{this.filterInputBox.setAriaLabel(this.options.ariaLabel||d(4249,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(D1,e,this.contextViewService,{placeholder:this.options.placeholder,ariaLabel:this.options.ariaLabel,history:new Set(t),showHistoryHint:()=>ML(this.keybindingService),inputBoxStyles:pl}));this.options.text&&(o.value=this.options.text),this._register(o.onDidChange(r=>this.delayedFilterUpdate.trigger(()=>this.onDidInputChange(o)))),this._register(Vo(o.inputElement,re.KEY_DOWN,r=>this.onInputKeyDown(r))),this._register(Vo(e,re.KEY_DOWN,r=>this.handleKeyboardEvent(r))),this._register(Vo(e,re.KEY_UP,r=>this.handleKeyboardEvent(r))),this._register(Vo(o.inputElement,re.CLICK,r=>{r.stopPropagation(),r.preventDefault()}));let n=this._register(Vn(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=R(e,_(".viewpane-filter-badge.hidden"));return t.style.backgroundColor=wt(rv),t.style.color=wt(Yw),t.style.border=`1px solid ${wt(gi)}`,t}createToolBar(e){return this.instantiationService.createInstance(Ln,e,$eo,{hiddenItemStrategy:-1,actionViewItemProvider:(t,o)=>{if(t instanceof Cc&&t.item.submenu.id===TC.id)return this.moreFiltersActionViewItem=this.instantiationService.createInstance(shi,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())}};$z=I([m(1,F),m(2,_n),m(3,X),m(4,_e),m(5,B),m(6,Bi)],$z);var Tde=class extends C{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=hl(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 hl(e).secondary}return[]}};Tde=I([m(3,X),m(4,qt)],Tde);var YEe=class extends Tde{constructor(i,e,t,o,n){let r=o.createScoped(i);r.createKey("viewContainer",e.id);let s=r.createKey("viewContainerLocation",WE(t.getViewContainerLocation(e)));super(D.ViewContainerTitle,D.ViewContainerTitleContext,{shouldForwardArgs:!0,renderShortTitle:!0},r,n),this._register(r),this._register(H.filter(t.onDidChangeContainerLocation,l=>l.viewContainer===e)(()=>s.set(WE(t.getViewContainerLocation(e)))))}};YEe=I([m(2,Ri),m(3,X),m(4,qt)],YEe);var pRt=new st("viewpane.action.filter"),W2o=Re("view-pane-container-expanded",M.chevronDown,d(4252,null)),V2o=Re("view-pane-container-collapsed",M.chevronRight,d(4251,null)),qeo=oe.as(on.ViewsRegistry),u9e=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 P;this.enabledDisposables=this.disposables.add(new P);this.renderDisposables=this.disposables.add(new P);this.disposables.add(H.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=R(this.container,_(".welcome-view"));this.element=_(".welcome-view-content",{tabIndex:0,role:"region","aria-label":d(4254,null)}),this._wide&&this.element.classList.add("wide"),this.scrollableElement=new Pa(this.element,{alwaysConsumeMouseWheel:!0,horizontal:2,vertical:3}),R(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),H.chain(qeo.onDidChangeViewWelcomeContent,t=>t.filter(o=>o===this.delegate.id))(this.onDidChangeViewWelcomeContent,this,this.enabledDisposables),this.onDidChangeViewWelcomeContent()}onDidChangeViewWelcomeContent(){let i=qeo.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=lS(s);if(l.nodes.length===1&&typeof l.nodes[0]!="string"){let c=l.nodes[0],u=R(this.element,_(".button-container")),p=new Mi(u,{title:c.title,supportIcons:!0,secondary:!!(n&&e>0),...Ko});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());H.filter(this.contextKeyService.onDidChangeContext,v=>v.affectsSome(g))(h,null,this.renderDisposables)}}else{let c=R(this.element,_("p"));for(let u of l.nodes)if(typeof u=="string")R(c,...Bn(u));else{let p=this.renderDisposables.add(this.instantiationService.createInstance(Xg,c,u,{}));if(o&&u.href.startsWith("command:")){let h=()=>p.enabled=this.contextKeyService.contextMatchesRules(o);h();let g=new Set(o.keys());H.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()}};u9e=I([m(2,F),m(3,Qe),m(4,X),m(5,ao)],u9e);var zr=class extends sRt{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 jt);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",WE(s.getViewLocationById(this.id)));this._register(H.filter(s.onDidChangeLocation,v=>v.views.some(b=>b.id===this.id))(()=>g.set(WE(s.getViewLocationById(this.id)))));let f=this._register(this.instantiationService.createChild(new Io([X,this.scopedContextKeyService])));this.menuActions=this._register(f.createInstance(Tde,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=Vn(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=R(e,_(`.twisty-container${q.asCSSSelector(this.getTwistyIcon(this.isExpanded()))}`)),this.renderHeaderTitle(e,this.title);let t=R(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(4253,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=H.filter(this.configurationService.onDidChangeConfiguration,r=>r.affectsConfiguration(zr.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?W2o:V2o}style(e){super.style(e);let t=this.getIcon();if(this.iconContainer){let o=n_(e.headerForeground,wt(ko));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||Bke}renderHeaderTitle(e,t){this.iconContainer=R(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}`;Vh(s,`
				mask: ${Na(o)} no-repeat 50% 50%;
				mask-size: 24px;
				-webkit-mask: ${Na(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=R(e,_("h3.title",{},r)),this.titleContainerHover=this._register(this.hoverService.setupManagedHover(Ni("mouse"),this.titleContainer,r)),this._titleDescription&&this.setTitleDescription(this._titleDescription),this.iconContainerHover=this._register(this.hoverService.setupManagedHover(Ni("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(4250,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=emt(this.titleContainer,_("span.description",{},e)),this.titleDescriptionContainerHover=this._register(this.hoverService.setupManagedHover(Ni("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(u9e,e,this))}layoutBody(e,t){this.viewWelcomeController?.layout(e,t)}onDidScrollRoot(){}getProgressIndicator(){if(this.progressBar===void 0&&(this.progressBar=this._register(new fb(this.element,kx)),this.progressBar.hide()),this.progressIndicator===void 0){let e=this;this.progressIndicator=this._register(new jEe(Oi(this.progressBar),this._register(new class extends QEe{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 qz(this.viewDescriptorService.getViewLocationById(this.id))}focus(){this.viewWelcomeController?.enabled?this.viewWelcomeController.focus():this.element&&this.element.focus(),(sa(this.element)||ts(this.element))&&this._onDidFocus.fire()}setActions(){if(this.toolbar){let e=[...this.menuActions.getPrimaryActions()];this.shouldShowFilterInHeader()&&e.unshift(pRt),this.toolbar.setActions(yq(e),yq(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===pRt.id){let o=this;return new class extends oc{constructor(){super(null,e)}setFocusable(){}get trapsArrowNavigation(){return!0}render(n){n.classList.add("viewpane-filter-container");let r=o.getFilterWidget();R(n,r.element),r.relayout()}}}return Ca(this.instantiationService,e,{...t,menuAsChild:e instanceof Cc})}getActionsContext(){}getActionRunner(){}getOptimalWidth(){return 0}saveState(){}shouldShowWelcome(){return!1}getFilterWidget(){}shouldShowFilterInHeader(){return!1}};zr=I([m(1,_e),m(2,ze),m(3,B),m(4,X),m(5,Ri),m(6,F),m(7,Qe),m(8,De),m(9,tt)],zr);var iF=class extends zr{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 Io([X,this.scopedContextKeyService])));this.filterWidget=this._register(h.createInstance($z,i.filterOptions)),this._register(this.filterWidget.onDidAcceptFilterText(()=>this.focusBodyContent()))}getFilterWidget(){return this.filterWidget}renderBody(i){super.renderBody(i),this.filterContainer=R(i,_(".viewpane-filter-container"))}layoutBody(i,e){super.layoutBody(i,e),this.dimension=new ai(e,i);let t=!this.filterContainer?.hasChildNodes(),o=this.shouldShowFilterInHeader();t!==o&&(o&&Fi(this.filterContainer),this.updateActions(),o||R(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()}};iF=I([m(1,_e),m(2,ze),m(3,B),m(4,X),m(5,Ri),m(6,F),m(7,Qe),m(8,De),m(9,tt)],iF);function qz(a){let i,e,t,o,n;switch(a){case 1:i=jS,e=v8e,t=c7i,o=d7i,n=u7i;break;case 0:case 2:default:i=op,e=Tj,t=b7i,o=S7i,n=I7i}return{background:i,overlayBackground:e,listOverrideStyles:{listBackground:i,treeStickyScrollBackground:t,treeStickyScrollBorder:o,treeStickyScrollShadow:n}}}var Fn=class extends K{constructor(i){super(i),this.desc=i}run(i,...e){let t=i.get(Ft).getActiveViewWithId(this.desc.viewId);if(t)return this.runInView(i,t,...e)}};var p9e=new Q("commentsFilterFocus",!1);var jeo=new Q("commentsView.showResolvedFilter",!0),Qeo=new Q("commentsView.showUnResolvedFilter",!0),ahi=new Q("commentsView.sortBy","resourceAscending"),mRt=class extends C{constructor(e,t){super();this.contextKeyService=t;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._showUnresolved=Qeo.bindTo(this.contextKeyService),this._showResolved=jeo.bindTo(this.contextKeyService),this._sortBy=ahi.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 Fn{constructor(){super({id:"commentsFocusViewFromFilter",title:d(8528,null),keybinding:{when:p9e,weight:200,primary:2066},viewId:Eu})}async runInView(a,i){i.focus()}});W(class extends Fn{constructor(){super({id:"commentsClearFilterText",title:d(8526,null),keybinding:{when:p9e,weight:200,primary:9},viewId:Eu})}async runInView(a,i){i.clearFilterText()}});W(class extends Fn{constructor(){super({id:"commentsFocusFilter",title:d(8527,null),keybinding:{when:Vl.isEqualTo(Eu),weight:200,primary:2084},viewId:Eu})}async runInView(a,i){i.focusFilter()}});W(class extends Fn{constructor(){super({id:`workbench.actions.${Eu}.toggleUnResolvedComments`,title:d(8535,null),category:d(8525,null),toggled:{condition:Qeo,title:d(8536,null)},menu:{id:TC,group:"1_filter",when:x.equals("view",Eu),order:1},viewId:Eu})}async runInView(a,i){i.filters.showUnresolved=!i.filters.showUnresolved}});W(class extends Fn{constructor(){super({id:`workbench.actions.${Eu}.toggleResolvedComments`,title:d(8532,null),category:d(8525,null),toggled:{condition:jeo,title:d(8529,null)},menu:{id:TC,group:"1_filter",when:x.equals("view",Eu),order:1},viewId:Eu})}async runInView(a,i){i.filters.showResolved=!i.filters.showResolved}});var lhi=new D("submenu.filter.commentSort");fe.appendMenuItem(TC,{submenu:lhi,title:d(8524,null),group:"2_sort",icon:M.history,when:x.equals("view",Eu)});W(class extends Fn{constructor(){super({id:`workbench.actions.${Eu}.toggleSortByUpdatedAt`,title:d(8534,null),category:d(8525,null),icon:M.history,viewId:Eu,toggled:{condition:x.equals(ahi.key,"updatedAtDescending"),title:d(8531,null)},menu:{id:lhi,group:"navigation",order:1,isHiddenByDefault:!1}})}async runInView(a,i){i.filters.sortBy="updatedAtDescending"}});W(class extends Fn{constructor(){super({id:`workbench.actions.${Eu}.toggleSortByResource`,title:d(8533,null),category:d(8525,null),icon:M.history,viewId:Eu,toggled:{condition:x.equals(ahi.key,"resourceAscending"),title:d(8530,null)},menu:{id:lhi,group:"navigation",order:0,isHiddenByDefault:!1}})}async runInView(a,i){i.filters.sortBy="resourceAscending"}});var B2o=J("editorGutter.commentRangeForeground",{dark:W$(xf,qo),light:Sp(W$(xf,qo),.05),hcDark:Oe.white,hcLight:Oe.black},d(8434,null)),Yeo=J("editorOverviewRuler.commentForeground",B2o,d(8437,null)),Xeo=J("editorOverviewRuler.commentUnresolvedForeground",Yeo,d(8438,null)),H2o=J("editorOverviewRuler.commentDraftForeground",Xeo,d(8436,null)),Jeo=J("editorGutter.commentGlyphForeground",{dark:od,light:od,hcDark:Oe.black,hcLight:Oe.white},d(8433,null));J("editorGutter.commentUnresolvedGlyphForeground",Jeo,d(8435,null));J("editorGutter.commentDraftGlyphForeground",Jeo,d(8432,null));var _de=class a extends C{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:Ss(this._threadHasDraft?H2o:this._threadState===0?Xeo:Yeo),position:2},collapseOnReplaceEdit:!0,linesDecorationsClassName:e};return po.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 jz=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 P;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 Cc?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 $I(this.container,{contextMenuProvider:this.contextMenuService,actions:l,actionRunner:this._toDispose.add(new class extends as{async runAction(f,v){return h(f)}}),secondary:!o,title:p,addPrimaryActionToDropdown:!1,small:!0,...Ko}):new Mi(this.container,{secondary:!o,title:p,small:!0,...Ko});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 ry=class extends C{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)}))}};go(ry.ID,ry,2);var Zeo=new Q("editorDictation.inProgress",!1),eto=L(8167,"Voice"),dhi=class extends wl{constructor(){super({id:"workbench.action.editorDictation.start",title:L(8163,"Start Dictation in Editor"),category:eto,precondition:x.and(TV,TX.toNegated(),ue.readOnly.toNegated()),f1:!0,keybinding:{primary:2612,weight:200,secondary:ri?[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&&_C.get(e)?.stop()})}_C.get(e)?.start()}},m9e=class a extends wl{static{this.ID="workbench.action.editorDictation.stop"}constructor(){super({id:a.ID,title:L(8164,"Stop Dictation in Editor"),category:eto,precondition:Zeo,f1:!0,keybinding:{primary:9,weight:300}})}runEditorCommand(i,e){_C.get(e)?.stop()}},uhi=class extends C{constructor(e,t){super();this.editor=e;this.suppressMouseDown=!0;this.allowEditorOverflow=!0;this.domNode=document.createElement("div");let o=this._register(new ji(this.domNode)),n=t.lookupKeybinding(m9e.ID)?.getLabel();o.push(pi({id:m9e.ID,label:n?d(8165,null,n):d(8166,null),class:q.asClassName(M.micFilled),run:()=>_C.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)}},_C=class extends C{constructor(e,t,o,n){super();this.editor=e;this.speechService=t;this.sessionDisposables=this._register(new me);this.widget=this._register(new uhi(this.editor,n)),this.editorDictationInProgress=Zeo.bindTo(o)}static{this.ID="editorDictation"}static get(e){return e.getContribution(_C.ID)}async start(){let e=new P;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=Oi(this.editor.getPosition()));let p=new Ie(o.lineNumber,o.column+c.length);this.editor.executeEdits(_C.ID,[An.replace(z.fromPositions(o,o.with(void 0,o.column+n)),c)],[Yt.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 $e;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()}};_C=I([m(1,EC),m(2,X),m(3,_e)],_C);go(_C.ID,_C,4);W(dhi);W(m9e);var sy=ae("snippetService");var phi=class{constructor(i){this.isBogous=!1,this.isTrivial=!1,this.usesClipboardVariable=!1,this.usesSelectionVariable=!1,this.codeSnippet=i;let e=new zh().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 Tx&&r.isFinalTabstop}let n=[...e.children];for(;n.length>0;){let r=n.shift();if(r instanceof Wae){if(r.children.length===0&&!eQi[r.name]){let s=t.has(r.name)?t.get(r.name):++o;t.set(r.name,s);let l=new Tx(s).appendChild(new Qb(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())}},Dde=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 hN(Ki(),()=>new phi(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===Y.file?i.fsPath:i.path,t=No(e),o=n=>n.includes("/")?e:t;if(this.exclude){for(let n of this.exclude.filter(Boolean))if(Cp(n,o(n),{ignoreCase:!0}))return!1}if(this.include){for(let n of this.include.filter(Boolean))if(Cp(n,o(n),{ignoreCase:!0}))return!0;return!1}return!0}};function U2o(a){return yi(a)&&!!a.body}var XEe=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=Am(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"===No(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=Ur(i);if(Vx(e)==="object")for(let[t,o]of Object.entries(e))if(U2o(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(13559,null):this.isGlobalSnippets?p=d(13558,null):p=d(13557,null);for(let h of ht.wrap(n))t.push(new Dde(!!o,l,i,h,s,r,p,this.source,this._extension?`${Fc(this._extension.extensionLocation,this.location)}/${i}`:`${No(this.location.path)}/${i}`,c,u,this._extension?.identifier))}};var WX=[],mhi=[],hhi=[];function h9e(a,i=!1){oto(a,!1,i)}function ito(a){oto(a,!0,!1)}function oto(a,i,e){let t=z2o(a,i);WX.push(t),t.userConfigured?hhi.push(t):mhi.push(t),e&&!t.userConfigured&&WX.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 z2o(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?zm(a.filepattern,{ignoreCase:!0}):void 0,filepatternOnPath:a.filepattern?a.filepattern.indexOf(Lo.sep)>=0:!1}}function nto(){WX=WX.filter(a=>a.userConfigured),mhi=[]}function rto(){WX=WX.filter(a=>!a.userConfigured),hhi=[]}function JEe(a,i){return ato(a,i).map(e=>e.mime)}function sto(a,i){return ato(a,i).map(e=>e.id)}function ato(a,i){let e;if(a)switch(a.scheme){case Y.file:e=a.fsPath;break;case Y.data:{e=g$.parseMetaData(a).get(g$.META_DATA_LABEL);break}case Y.vscodeNotebookCell:e=void 0;break;default:e=a.path}if(!e)return[{id:"unknown",mime:Zn.unknown}];e=e.toLowerCase();let t=No(e),o=tto(e,t,hhi);if(o)return[o,{id:Fr,mime:Zn.text}];let n=tto(e,t,mhi);if(n)return[n,{id:Fr,mime:Zn.text}];if(i){let r=K2o(i);if(r)return[r,{id:Fr,mime:Zn.text}]}return[{id:"unknown",mime:Zn.unknown}]}function tto(a,i,e){let t,o,n;for(let r=e.length-1;r>=0;r--){let s=e[r];if(l1i(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)&&gpt(i,s.extension)&&(n=s)}if(t)return t;if(o)return o;if(n)return n}function K2o(a){if(Spt(a)&&(a=a.substring(1)),a.length>0)for(let i=WX.length-1;i>=0;i--){let e=WX[i];if(!e.firstline)continue;let t=a.match(e.firstline);if(t&&t.length>0)return e}}var MV=Object.prototype.hasOwnProperty,lto="vs.editor.nullLanguage",ghi=class{constructor(){this._languageIdToLanguage=[];this._languageToLanguageId=new Map;this._register(lto,0),this._register(Fr,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]||lto}},gRt=class a extends C{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 ghi,this._dynamicLanguages=[],this._languages={},this._mimeTypesMap={},this._nameMap={},this._lowercaseNameMap={},e&&(this._initializeFromRegistry(),this._register(LM.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={},nto();let e=[].concat(LM.getLanguages()).concat(this._dynamicLanguages);this._registerLanguages(e)}registerLanguage(e){return LM.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})}),oe.as(ii.Configuration).registerOverrideIdentifiers(this.getRegisteredLanguageIds()),this._onDidChange.fire()}_registerLanguage(e){let t=e.id,o;MV.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)h9e({id:o,mime:n,extension:l},this._warnOnOverwrite)}if(Array.isArray(t.filenames))for(let l of t.filenames)h9e({id:o,mime:n,filename:l},this._warnOnOverwrite),e.filenames.push(l);if(Array.isArray(t.filenamePatterns))for(let l of t.filenamePatterns)h9e({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);xbe(c)||h9e({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?MV.call(this._languages,e):!1}getRegisteredLanguageIds(){return Object.keys(this._languages)}getSortedRegisteredLanguageNames(){let e=[];for(let t in this._nameMap)MV.call(this._nameMap,t)&&e.push({languageName:t,languageId:this._nameMap[t]});return e.sort((t,o)=>Uw(t.languageName,o.languageName)),e}getLanguageName(e){return MV.call(this._languages,e)?this._languages[e].name:null}getMimeType(e){return MV.call(this._languages,e)&&this._languages[e].mimetypes[0]||null}getExtensions(e){return MV.call(this._languages,e)?this._languages[e].extensions:[]}getFilenames(e){return MV.call(this._languages,e)?this._languages[e].filenames:[]}getIcon(e){return MV.call(this._languages,e)&&this._languages[e].icons[0]||null}getConfigurationFiles(e){return MV.call(this._languages,e)?this._languages[e].configurationFiles||[]:[]}getLanguageIdByLanguageName(e){let t=e.toLowerCase();return MV.call(this._lowercaseNameMap,t)?this._lowercaseNameMap[t]:null}getLanguageIdByMimeType(e){return e&&MV.call(this._mimeTypesMap,e)?this._mimeTypesMap[e]:null}guessLanguageIdByFilepathOrFirstLine(e,t){return!e&&!t?[]:sto(e,t)}};var fRt=class a extends C{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 gRt(!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 g9e(this.onDidChange,()=>this._createAndGetLanguageIdentifier(e))}createByMimeType(e){return new g9e(this.onDidChange,()=>{let t=this.getLanguageIdByMimeType(e);return this._createAndGetLanguageIdentifier(t)})}createByFilepathOrFirstLine(e,t){return new g9e(this.onDidChange,()=>{let o=this.guessLanguageIdByFilepathOrFirstLine(e,t);return this._createAndGetLanguageIdentifier(o)})}_createAndGetLanguageIdentifier(e){return(!e||!this.isRegisteredLanguageId(e))&&(e=Fr),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),kc.getOrCreate(e),this._onDidRequestRichLanguageFeatures.fire(e))}},g9e=class{constructor(i,e){this._value=ui(this,i,()=>e()),this.onDidChange=H.fromObservable(this._value)}get languageId(){return this._value.get()}};var C5=Tn.registerExtensionPoint({extensionPoint:"languages",jsonSchema:{description:d(17112,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(17122,null),type:"string"},aliases:{description:d(17113,null),type:"array",items:{type:"string"}},extensions:{description:d(17115,null),default:[".foo"],type:"array",items:{type:"string"}},filenames:{description:d(17117,null),type:"array",items:{type:"string"}},filenamePatterns:{description:d(17116,null),type:"array",items:{type:"string"}},mimetypes:{description:d(17123,null),type:"array",items:{type:"string"}},firstLine:{description:d(17118,null),type:"string"},configuration:{description:d(17114,null),type:"string",default:"./language-configuration.json"},icon:{type:"object",description:d(17119,null),properties:{light:{description:d(17121,null),type:"string"},dark:{description:d(17120,null),type:"string"}}}}}},activationEventsGenerator:function*(a){for(let i of a)i.id&&i.configuration&&(yield`onLanguage:${i.id}`)}}),fhi=class extends C{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)cto(p)&&n.push({id:p.id,name:(p.aliases||[])[0]||p.id,extensions:p.extensions||[],hasGrammar:!1,hasSnippets:!1});let r=a6(n,p=>p.id);if((t?.grammars||[]).forEach(p=>{if(!Ae(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(!Ae(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(17100,null),d(17101,null),d(17096,null),d(17097,null),d(17111,null)],u=n.sort((p,h)=>p.id.localeCompare(h.id)).map(p=>[p.id,p.name,new xe().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:()=>{}}}};oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:"languages",label:d(17102,null),access:{canToggle:!1},renderer:new Mt(fhi)});var f9e=class extends fRt{constructor(e,t,o,n){super(o.verbose||o.isExtensionDevelopment||!o.isBuilt);this.logService=n;this._configurationService=t,this._extensionService=e,C5.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(17098,null,C5.name));continue}for(let p=0,h=u.value.length;p<h;p++){let g=u.value[p];if(cto(g,u.collector)){let f;g.configuration&&(f=je(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:je(u.description.extensionLocation,g.icon.light),dark:je(u.description.extensionLocation,g.icon.dark)}})}}}this._registry.setDynamicLanguages(s)}),this.updateMime(),this._register(this._configurationService.onDidChangeConfiguration(r=>{r.affectsConfiguration(Y$)&&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();rto(),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}`;ito({id:o,mime:n,filepattern:t})}),this._onDidChange.fire()}};f9e=I([m(0,lt),m(1,B),m(2,Co),m(3,ne)],f9e);function vRt(a){return typeof a>"u"?!0:Array.isArray(a)?a.every(i=>typeof i=="string"):!1}function cto(a,i){return a?typeof a.id!="string"?(i?.error(d(17110,null,"id")),!1):vRt(a.extensions)?vRt(a.filenames)?typeof a.firstLine<"u"&&typeof a.firstLine!="string"?(i?.error(d(17107,null,"firstLine")),!1):typeof a.configuration<"u"&&typeof a.configuration!="string"?(i?.error(d(17104,null,"configuration")),!1):vRt(a.aliases)?vRt(a.mimetypes)?typeof a.icon<"u"&&(typeof a.icon!="object"||typeof a.icon.light!="string"||typeof a.icon.dark!="string")?(i?.error(d(17108,null,"icon","light","dark")),!1):!0:(i?.error(d(17109,null,"mimetypes")),!1):(i?.error(d(17103,null,"aliases")),!1):(i?.error(d(17106,null,"filenames")),!1):(i?.error(d(17105,null,"extensions")),!1):(i?.error(d(17099,null,C5.name)),!1)}we(kt,f9e,0);var dto="_snippet.markAsUsed";qe.registerCommand(dto,(a,...i)=>{let e=a.get(sy),[t]=i;t instanceof Dde&&e.updateUsageTimestamp(t)});var VX=class{constructor(i,e){this.snippet=i;this.label={label:i.prefix,description:i.name},this.detail=d(13538,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:dto,title:"",arguments:[i]}}resolve(){return this.documentation=new xe().appendCodeblock("",zh.asInsertText(this.snippet.codeSnippet)),this}static compareByLabel(i,e){return Al(i.label.label,e.label.label)}},ZEe=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 En,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 U of c)if(!(U.prefixLow.match(/^\s/)&&!b.prefixLow.match(/^\s/))&&Jqe(U.prefixLow,0,U.prefixLow.length,b.prefixLow,0,b.prefixLow.length)){S=U;break}if(!S)continue;let y=S.startColumn-1,w=b.prefixLow.length-(u-y),k=kbe(s,b.prefixLow,u,u+w,u-y),T=e.with(void 0,y+1),N=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)&&N++;let O=z.fromPositions({lineNumber:n,column:S.startColumn},{lineNumber:n,column:N}),V=O.setEndPosition(n,e.column);v.push(new VX(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 VX(b,{replace:y,insert:S}))}return this._disambiguateSnippets(v),{suggestions:v,duration:o.elapsed()}}_disambiguateSnippets(i){i.sort(VX.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(13539,null,i[o].label.label,i[o].snippet.name);o>e+1&&(i[e].label.label=d(13539,null,i[e].label.label,i[e].snippet.name),e=o)}}resolveCompletionItem(i){return i instanceof VX?i.resolve():i}_computeSnippetPositions(i,e,t,o){let n=[];for(let r=1;r<t.startColumn;r++){let s=i.getWordAtPosition(new Ie(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}};ZEe=I([m(0,kt),m(1,sy),m(2,bs)],ZEe);var mn=ae("IUserDataProfileService"),UE=ae("IUserDataProfileManagementService");var v9e="profile";function uto(a,i){return A.from({scheme:i.urlProtocol,authority:v9e,path:a.startsWith("/")?a:`/${a}`})}var vhi="profile-";function eTe(a){return a.authority===v9e||new RegExp(`^${vhi}`).test(a.authority)}var PV=ae("IUserDataProfileImportExportService"),pto=Re("defaultProfile-icon",M.settings,d(17523,null)),bhi=L(17525,"Profiles"),oF={...bhi},b9e="code-profile",S9e=[{name:d(17524,null),extensions:[b9e]}],I9e=new Q("currentProfile",""),mto=new Q("isCurrentProfileTransient",!1),x5=new Q("hasProfiles",!1);var Shi;(t=>{function a(o,n,r){if(Jl(n.path))return o.collector.error(d(13564,null,o.description.name,String(n.path))),null;if(Jl(n.language)&&!n.path.endsWith(".code-snippets"))return o.collector.error(d(13563,null,o.description.name,String(n.path))),null;if(!Jl(n.language)&&!r.isRegisteredLanguageId(n.language))return o.collector.error(d(13562,null,o.description.name,String(n.language))),null;let s=o.description.extensionLocation,l=je(s,n.path);return La(l,s)?{language:n.language,location:l}:(o.collector.error(d(13565,null,o.description.name,l.path,s.path)),null)}t.toValidSnippet=a,t.snippetsContribution={description:d(13566,null),type:"array",defaultSnippets:[{body:[{language:"",path:""}]}],items:{type:"object",defaultSnippets:[{body:{language:"${1:id}",path:"./snippets/${2:id}.json."}}],properties:{language:{description:d(13567,null),type:"string"},path:{description:d(13568,null),type:"string"}}}},t.point=Tn.registerExtensionPoint({extensionPoint:"snippets",deps:[C5],jsonSchema:t.snippetsContribution})})(Shi||={});function G2o(a,i,e){return hn(a.watch(i),a.onDidFilesChange(t=>{t.affects(i)&&e()}))}var BX=class{constructor(i){this._storageService=i;let e=i.get(BX._key,0,""),t;try{t=JSON.parse(e)}catch{}this._ignored=SS(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(BX._key,JSON.stringify(Array.from(this._ignored)),0,0)}};BX=I([m(0,le)],BX);var HX=class{constructor(i){this._storageService=i;let e=i.get(HX._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(HX._key,JSON.stringify(e),0,0)}};HX=I([m(0,le)],HX);var tTe=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 P;this._pendingWork=[];this._files=new vt;this._pendingWork.push(Promise.resolve(c.when(3).then(()=>{this._initExtensionSnippets(),this._initUserSnippets(),this._initWorkspaceSnippets()}))),Y8i(new ZEe(this._languageService,this,p)),this._enablement=u.createInstance(BX),this._usageTimestamps=u.createInstance(HX)}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=>dre(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(){Shi.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=Shi.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 XEe(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(13561,null,e.description.name))},s=>{e.collector.warn(d(13560,null,r.location.toString()))})}}})}_initWorkspaceSnippets(){let i=new P,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 P,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 P,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=>{La(r.model.resource,e)&&n()})),t.add(G2o(this._fileService,e,n)),t.add(o),n()}_addSnippetFile(i,e){let t=ms(i);if(e===1&&t===".json"){let o=Ye(i).replace(/\.json/,"");this._files.set(i,new XEe(e,i,[o],void 0,this._fileService,this._extensionResourceLoaderService))}else t===".code-snippets"&&this._files.set(i,new XEe(e,i,void 0,void 0,this._fileService,this._extensionResourceLoaderService));return{dispose:()=>this._files.delete(i)}}};tTe=I([m(0,Co),m(1,mn),m(2,Pe),m(3,kt),m(4,ne),m(5,be),m(6,Ho),m(7,Bx),m(8,ao),m(9,F),m(10,bs)],tTe);function hto(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 ay=class{constructor(i,e,t,o,n){this._editor=i;this._snippetService=e;this._clipboardService=t;this._languageFeaturesService=o;this._activeSnippets=[];this._hasSnippets=ay.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 Q("hasSnippetCompletions",void 0)}static get(i){return i.getContribution(ay.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=hto(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 VX(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 y1(this._editor,5);if(e=await this._clipboardService.readText(),!t.validate(this._editor))return}Qr.get(this._editor)?.insert(i.codeSnippet,{overwriteBefore:i.prefix.length,overwriteAfter:0,clipboardText:e})}else this._activeSnippets.length>1&&this._completionProvider&&ywt(this._editor,this._completionProvider)}};ay=I([m(1,sy),m(2,Wi),m(3,zt),m(4,X)],ay);go(ay.ID,ay,0);var $2o=xc.bindToContribution(ay.get);qi(new $2o({id:"insertSnippet",precondition:ay.ContextKey,handler:a=>a.performSnippetCompletions(),kbOpts:{weight:100,kbExpr:x.and(ue.editorTextFocus,ue.tabDoesNotMoveFocus,Qr.InSnippetMode.toNegated()),primary:2}}));var ly="editor.contrib.selectionClipboard";var iTe=new Q("commentEditorFocused",!1),Lde=90,q2o=450,G_=class extends jr{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g){let f={contributions:[{id:ry.ID,ctor:ry,instantiation:2},{id:Hm.ID,ctor:Hm,instantiation:2},{id:El.ID,ctor:El,instantiation:0},{id:Qr.ID,ctor:Qr,instantiation:4},{id:ay.ID,ctor:ay,instantiation:0},{id:_C.ID,ctor:_C,instantiation:4},...aa.getSomeEditorContributions([ou.ID,lh.ID,Fx.ID,iu.ID,kl.ID,Yg.ID,ly,Rc.ID,Zu.ID,GW.ID])],contextMenuId:D.SimpleEditorContext};super(i,e,f,n,r,s,t,l,c,u,p,h,g),this._commentEditorFocused=iTe.bindTo(t),this._commentEditorEmpty=vc.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 aa.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}}};G_=I([m(4,F),m(5,Kt),m(6,ge),m(7,De),m(8,Ne),m(9,Bi),m(10,bs),m(11,zt),m(12,eC)],G_);function SRt(a,i,e){let t=i.getLayoutInfo(),o=i.getOption(75),n=i._getViewModel()?.getLineCount()*o;if(n>t.height||n<t.height&&e>Lde){let r=Math.ceil((n-t.height)/o),s=t.height+o*r;return Kn(s,Lde,Kn(a.getLayoutInfo().height-90,Lde,q2o))}return e}var j2o=0,IRt="commenteditordecoration",oTe=class extends C{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=Lde;this._container=R(t,_(".comment-form-container")),this._form=R(this._container,_(".comment-form")),this.commentEditor=this._register(this._scopedInstatiationService.createInstance(G_,this._form,G_.getEditorOptions(v),s,this._parentThread)),this.commentEditorIsEmpty=vc.commentIsEmpty.bindTo(this._contextKeyService),this.commentEditorIsEmpty.set(!this._pendingComment),this.initialize(h)}async initialize(e){this.avatar=R(this._form,_(".avatar-container")),this.updateAuthorInfo();let t=this._commentThread.comments&&this._commentThread.comments.length>0,o=_t()+"-"+(t?this._commentThread.threadId:++j2o),n=JSON.stringify({extensionId:this._commentThread.extensionId,commentThreadId:this._commentThread.threadId}),r=A.from({scheme:Y.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=R(this._container,_(".validation-error.hidden"));let c=R(this._container,_(".form-actions"));this._formActions=R(c,_(".other-actions")),this.createCommentWidgetFormActions(this._formActions,l.object.textEditorModel),this._editorActions=R(c,_(".editor-actions")),this.createCommentWidgetEditorActions(this._editorActions,l.object.textEditorModel)}calculateEditorHeight(){let e=SRt(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 Ie(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=R(this.avatar,_("img.avatar"));e.src=gn.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(8447,null):this._commentOptions?.placeHolder||d(8446,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 Ie(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 jz(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 jz(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 Ie(1,1)},this._container.classList.remove("expand"),this._error.textContent="",this._error.classList.add("hidden")}createReplyButton(e,t){this._reviewThreadReplyButton=R(t,_(`button.review-thread-reply-button.${tE}`)),this._register(this.hoverService.setupManagedHover(Ni("mouse"),this._reviewThreadReplyButton,this._commentOptions?.prompt||d(8447,null))),this._reviewThreadReplyButton.textContent=this._commentOptions?.prompt||d(8447,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(),Ue(this._commentThreadDisposables)}};oTe=I([m(12,km),m(13,B),m(14,_e),m(15,ze),m(16,tt),m(17,Nt)],oTe);var UX=class a extends st{constructor(e,t){super(a.ID,t||d(8555,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}},yRt=class extends Lr{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=R(this.label,_(".reaction-icon")),t=A.revive(i.icon);e.style.backgroundImage=Na(t)}else{let e=R(this.label,_("span.reaction-label"));e.innerText=i.label}if(i.count){let e=R(this.label,_("span.reaction-count"));e.innerText=`${i.count}`}}getTooltip(){let i=this.action,e=i.enabled?d(8554,null):"";if(i.count===void 0)return d(8550,null,e,i.label);if(i.reactors===void 0||i.reactors.length===0){if(i.count===1)return d(8551,null,e,i.label);if(i.count>1)return d(8549,null,e,i.count,i.label)}else{if(i.reactors.length<=10&&i.reactors.length===i.count)return d(8552,null,e,i.reactors.join(", "),i.label);if(i.count>1){let t=i.reactors.slice(0,10);return d(8553,null,e,t.join(", "),i.count-t.length,i.label)}}}},y9e=class a extends st{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 Ihi=class extends as{async runAction(i,e){await i.run(...e)}},nTe=class extends C{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 P);this._commentEditor=null;this._commentEditorModel=null;this._editorHeight=Lde;this._actionRunner=this._register(new Ihi);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 P);this._domNode=_("div.review-comment"),this._contextKeyService=this._register(f.createScoped(this._domNode)),this._commentContextValue=vc.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=R(this._domNode,_("div.avatar-container")),this.updateCommentUserIcon(this.comment.userIconPath),this._commentDetailsContainer=R(this._domNode,_(".review-comment-contents")),this.createHeader(this._commentDetailsContainer),this._body=document.createElement("div"),this._body.classList.add("comment-body",tE),v.getValue(zz)?.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 UT({forceIntegerValues:!0,smoothScrollDuration:125,scheduleAtNextAnimationFrame:n=>$r(Me(e),n)})),this._scrollableElement=this._register(new AN(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 On(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=R(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=R(this._avatar,_("img.avatar"));t.src=gn.uriToBrowserUri(A.revive(e)).toString(!0),t.onerror=o=>t.remove()}}get onDidClick(){return this._onDidClick.event}createTimestamp(e){this._timestamp=R(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 xde(this.configurationService,this.hoverService,this._timestamp,t),this._register(this._timestampWidget)):this._timestampWidget?.dispose()}createHeader(e){let t=R(e,_(`div.comment-title.${tE}`)),o=R(t,_("comment-header-info")),n=R(o,_("strong.author"));n.innerText=this.comment.userName,this.createTimestamp(o),this._isPendingLabel=R(o,_("span.isPending")),this.comment.label?this._isPendingLabel.innerText=this.comment.label:this._isPendingLabel.innerText="",this._actionsToolbarContainer=R(t,_(".comment-actions")),this.createActionsToolbar()}getToolbarActions(e){let t=e.getActions({shouldForwardArgs:!0}),r={primary:[],secondary:[]};return Y2o(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 Ju(this._actionsToolbarContainer,this.contextMenuService,{actionViewItemProvider:(e,t)=>e.id===UX.ID?new wp(e,e.menuActions,this.contextMenuService,{...t,actionViewItemProvider:(o,n)=>this.actionViewItemProvider(o,n),classNames:["toolbar-toggle-pickReactions",...q.asClassNameArray(M.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===UX.ID?t={label:!1,icon:!0}:t={label:!1,icon:!0},e.id===y9e.ID?new yRt(e):e instanceof Eo?this.instantiationService.createInstance(ml,e,{hoverDelegate:t.hoverDelegate}):e instanceof Cc?this.instantiationService.createInstance(mE,e,t):new Lr({},e,t)}async submitComment(){this._commentEditor&&this._commentFormActions&&(await this._commentFormActions.triggerDefaultAction(),this.pendingEdit=void 0)}createReactionPicker(e){let t=this._reactionActions.add(new UX(()=>{n?.show()},d(8443,null))),o=[];e&&e.length&&(o=e.map(r=>this._reactionActions.add(new st(`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(8445,null,s.message):d(8444,null);this.notificationService.error(l)}})))),t.menuActions=o;let n=this._reactionActions.add(new wp(t,t.menuActions,this.contextMenuService,{actionViewItemProvider:(r,s)=>r.id===UX.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=R(e,_("div.comment-reactions")),this._reactionsActionBar.value=new ji(this._reactionActionsContainer,{actionViewItemProvider:(n,r)=>n.id===UX.ID?new wp(n,n.menuActions,this.contextMenuService,{actionViewItemProvider:(s,l)=>this.actionViewItemProvider(s,l),classNames:["toolbar-toggle-pickReactions",...q.asClassNameArray(M.reactions)],anchorAlignmentProvider:()=>1}):this.actionViewItemProvider(n,r)}),o.map(n=>{let r=this._reactionActions.add(new y9e(`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(8442,null,s.message):d(8441,null):l=s.message?d(8440,null,s.message):d(8439,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=R(e,_(".edit-textarea"));this._commentEditor=this.instantiationService.createInstance(G_,t,G_.getEditorOptions(this.configurationService),this._contextKeyService,this.parentThread),this._editModeDisposables.add(this._commentEditor);let o=A.from({scheme:Y.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 Ie(s,l))}this.pendingEdit=void 0,this._commentEditor.layout({width:t.clientWidth-14,height:this._editorHeight}),this._commentEditor.focus(),$r(Me(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=SRt(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=D6(this._body),r=this._body.scrollHeight,s=qbe(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=R(this._commentDetailsContainer,_(".edit-container")),await this.createCommentEditor(this._commentEditContainer);let e=R(this._commentEditContainer,_(".form-actions")),t=R(e,_(".other-actions"));this.createCommentWidgetFormActions(t);let o=R(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 jz(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 jz(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 yn(Me(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()}};nTe=I([m(8,F),m(9,km),m(10,Ne),m(11,ze),m(12,X),m(13,B),m(14,tt),m(15,_e),m(16,Nt),m(17,Qn)],nTe);function Y2o(a,i,e,t=o=>o==="navigation"){for(let o of a){let[n,r]=o;if(e&&(r=r.map(s=>s instanceof Eo&&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 li),s.push(...r)}}}var rTe=class extends C{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 jt;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=R(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 Ii(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=Fm(this.container);e.height===0&&e.width===0||ai.equals(this._containerClientArea,e)||(this._containerClientArea=e,this._onDidResize.fire(e))}getDimensions(){return Fm(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=Yn(this._commentElements[0].domNode),n=Yn(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(8539,null,this._commentThread.comments?.length,this._commentThread.range.startLineNumber,this._commentThread.range.endLineNumber,this._commentThread.label):this._commentsElement.ariaLabel=d(8538,null,this._commentThread.comments?.length,this._commentThread.label):this._commentsElement.ariaLabel=d(8537,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(nTe,this._parentEditor,this._commentThread,e,this._pendingEdits?this._pendingEdits[e.uniqueIdInThread]:void 0,this.owner,this.parentResourceUri,this._parentCommentThreadWidget,this._markdownRendererOptions),o=new P;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()}};rTe=I([m(9,km)],rTe);var X2o=Re("review-comment-collapse",M.chevronUp,d(8540,null)),gto="expand-review-action "+q.asClassName(X2o),J2o="expand-review-action "+q.asClassName(M.trashcan);function yhi(a){return!!a&&a.length>0}var sTe=class extends C{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=R(this._headElement,_(".review-title"));this._headingLabel=R(e,_("span.filename")),this.createThreadLabel();let t=R(this._headElement,_(".review-actions"));this._actionbarWidget=new ji(t,{actionViewItemProvider:Ca.bind(void 0,this._instantiationService)}),this._register(this._actionbarWidget);let o=yhi(this._commentThread.comments)?gto:J2o;if(this._collapseAction=new st("workbench.action.hideComment",d(8541,null),o,!0,()=>this._delegate.collapse()),!yhi(this._commentThread.comments)){let r=this._register(new me);r.value=this._commentThread.onDidChangeComments(()=>{yhi(this._commentThread.comments)&&(this._collapseAction.class=gto,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(8542,null))),e&&(this._headingLabel.textContent=ur(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 yn(Me(this._headElement),e);this._contextMenuActionRunner||(this._contextMenuActionRunner=this._register(new as)),this._contextMenuService.showContextMenu({getAnchor:()=>o,getActions:()=>t,actionRunner:this._contextMenuActionRunner,getActionsContext:()=>({commentControlHandle:this._commentThread.controllerHandle,commentThreadHandle:this._commentThread.commentThreadHandle,$mid:7})})}};sTe=I([m(4,X),m(5,F),m(6,ze)],sTe);var aTe=class extends C{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=R(e,_(".comment-additional-actions")),R(this._container,_(".section-separator")),this._buttonBar=R(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 jz(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)}};aTe=I([m(5,_e),m(6,ze)],aTe);function Z2o(a,i,e){let t=new Set;return hn(...a.map((o,n)=>hn(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 whi=new Q("navigableContainerFocused",!1),nF=class{constructor(i,e,t){this.logService=e;this.configurationService=t;this.containers=new Set;this.focused=whi.bindTo(i),nF.INSTANCE=this}static{this.ID="workbench.contrib.navigableContainerManager"}dispose(){this.containers.clear(),this.focused.reset(),nF.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),hn(Z2o(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)}))):C.None}static getActive(){return this.INSTANCE?.lastContainer}};nF=I([m(0,X),m(1,ne),m(2,B)],nF);function zE(a){return nF.register(a)}pt(nF.ID,nF,ut.BlockStartup);yt.registerCommandAndKeybindingRule({id:"widgetNavigation.focusPrevious",weight:200,when:x.and(whi,x.or(rc?.negate(),Pyt)),primary:2064,handler:()=>{nF.getActive()?.focusPreviousWidget()}});yt.registerCommandAndKeybindingRule({id:"widgetNavigation.focusNext",weight:200,when:x.and(whi,x.or(rc?.negate(),Ayt)),primary:2066,handler:()=>{nF.getActive()?.focusNextWidget()}});var LC=new Q("accessibilityHelpIsShown",!1,!0),ud=new Q("accessibleViewIsShown",!1,!0),Mde=new Q("accessibleViewSupportsNavigation",!1,!0),w9e=new Q("accessibleViewVerbosityEnabled",!1,!0),C9e=new Q("accessibleViewGoToSymbolSupported",!1,!0),wRt=new Q("accessibleViewOnLastLine",!1,!0),Kd=new Q("accessibleViewCurrentProviderId",void 0,void 0),lTe=new Q("accessibleViewInCodeBlock",void 0,void 0),Pde=new Q("accessibleViewContainsCodeBlocks",void 0,void 0),x9e=new Q("accessibleViewHasUnassignedKeybindings",void 0,void 0),k9e=new Q("accessibleViewHasAssignedKeybindings",void 0,void 0);var DC={type:"boolean",default:!0,tags:["accessibility"]},CRt=Object.freeze({id:"accessibility",title:d(4922,null),type:"object"}),Zp={type:"string",enum:["auto","on","off"],default:"auto",enumDescriptions:[d(4929,null),d(4932,null),d(4931,null)],tags:["accessibility"]},vb={type:"object",tags:["accessibility"],additionalProperties:!1,default:{sound:"auto",announcement:"auto"}},bb={type:"string",enum:["auto","off"],default:"auto",enumDescriptions:[d(4923,null),d(4924,null)],tags:["accessibility"]},Qz={type:"object",tags:["accessibility"],additionalProperties:!1,default:{sound:"auto"}},eGo={...CRt,scope:5,properties:{"accessibility.verbosity.terminal":{description:d(4950,null),...DC},"accessibility.verbosity.diffEditor":{description:d(4938,null),...DC},"accessibility.verbosity.panelChat":{description:d(4935,null),...DC},"accessibility.verbosity.inlineChat":{description:d(4944,null),...DC},"accessibility.verbosity.terminalChatOutput":{description:d(4951,null),...DC},"accessibility.verbosity.inlineCompletions":{description:d(4943,null),...DC},"accessibility.verbosity.keybindingsEditor":{description:d(4945,null),...DC},"accessibility.verbosity.notebook":{description:d(4946,null),...DC},"accessibility.verbosity.hover":{description:d(4942,null),...DC},"accessibility.verbosity.notification":{description:d(4947,null),...DC},"accessibility.verbosity.emptyEditorHint":{description:d(4940,null),...DC},"accessibility.verbosity.replEditor":{description:d(4948,null),...DC},"accessibility.verbosity.comments":{description:d(4936,null),...DC},"accessibility.verbosity.diffEditorActive":{description:d(4939,null),...DC},"accessibility.verbosity.debug":{description:d(4937,null),...DC},"accessibility.verbosity.walkthrough":{description:d(4952,null),...DC},"accessibility.accessibleView.closeOnKeyPress":{markdownDescription:d(4934,null),type:"boolean",default:!0},"accessibility.verbosity.sourceControl":{description:d(4949,null),...DC},"accessibility.verbosity.find":{description:d(4941,null),...DC},"accessibility.signalOptions.volume":{description:d(4809,null),type:"number",minimum:0,maximum:100,default:70,tags:["accessibility"]},"accessibility.signalOptions.debouncePositionChanges":{description:d(4802,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(4805,null),type:"number",minimum:0,default:3e3},sound:{description:d(4806,null),type:"number",minimum:0,default:400}},tags:["accessibility"]},"accessibility.signalOptions.experimental.delays.warningAtPosition":{type:"object",additionalProperties:!1,properties:{announcement:{description:d(4807,null),type:"number",minimum:0,default:3e3},sound:{description:d(4808,null),type:"number",minimum:0,default:1e3}},tags:["accessibility"]},"accessibility.signalOptions.experimental.delays.errorAtPosition":{type:"object",additionalProperties:!1,properties:{announcement:{description:d(4803,null),type:"number",minimum:0,default:3e3},sound:{description:d(4804,null),type:"number",minimum:0,default:1e3}},tags:["accessibility"]},"accessibility.signals.lineHasBreakpoint":{...vb,description:d(4847,null),properties:{sound:{description:d(4849,null),...Zp},announcement:{description:d(4848,null),...bb}}},"accessibility.signals.lineHasInlineSuggestion":{...Qz,description:d(4856,null),properties:{sound:{description:d(4857,null),...Zp,default:"off"}}},"accessibility.signals.nextEditSuggestion":{...vb,description:d(4861,null),properties:{sound:{description:d(4863,null),...Zp},announcement:{description:d(4862,null),...bb}}},"accessibility.signals.lineHasError":{...vb,description:d(4850,null),properties:{sound:{description:d(4852,null),...Zp},announcement:{description:d(4851,null),...bb,default:"off"}}},"accessibility.signals.lineHasFoldedArea":{...vb,description:d(4853,null),properties:{sound:{description:d(4855,null),...Zp,default:"off"},announcement:{description:d(4854,null),...bb}}},"accessibility.signals.lineHasWarning":{...vb,description:d(4858,null),properties:{sound:{description:d(4860,null),...Zp},announcement:{description:d(4859,null),...bb,default:"off"}}},"accessibility.signals.positionHasError":{...vb,description:d(4876,null),properties:{sound:{description:d(4878,null),...Zp},announcement:{description:d(4877,null),...bb,default:"on"}}},"accessibility.signals.positionHasWarning":{...vb,description:d(4879,null),properties:{sound:{description:d(4881,null),...Zp},announcement:{description:d(4880,null),...bb,default:"on"}}},"accessibility.signals.onDebugBreak":{...vb,description:d(4873,null),properties:{sound:{description:d(4875,null),...Zp},announcement:{description:d(4874,null),...bb}}},"accessibility.signals.noInlayHints":{...vb,description:d(4864,null),properties:{sound:{description:d(4866,null),...Zp},announcement:{description:d(4865,null),...bb}}},"accessibility.signals.taskCompleted":{...vb,description:d(4895,null),properties:{sound:{description:d(4897,null),...Zp},announcement:{description:d(4896,null),...bb}}},"accessibility.signals.taskFailed":{...vb,description:d(4898,null),properties:{sound:{description:d(4900,null),...Zp},announcement:{description:d(4899,null),...bb}}},"accessibility.signals.terminalCommandFailed":{...vb,description:d(4904,null),properties:{sound:{description:d(4906,null),...Zp},announcement:{description:d(4905,null),...bb}}},"accessibility.signals.terminalCommandSucceeded":{...vb,description:d(4907,null),properties:{sound:{description:d(4909,null),...Zp},announcement:{description:d(4908,null),...bb}}},"accessibility.signals.terminalQuickFix":{...vb,description:d(4910,null),properties:{sound:{description:d(4912,null),...Zp},announcement:{description:d(4911,null),...bb}}},"accessibility.signals.terminalBell":{...vb,description:d(4901,null),properties:{sound:{description:d(4903,null),...Zp},announcement:{description:d(4902,null),...bb}}},"accessibility.signals.diffLineInserted":{...Qz,description:d(4829,null),properties:{sound:{description:d(4894,null),...Zp}}},"accessibility.signals.diffLineModified":{...Qz,description:d(4830,null),properties:{sound:{description:d(4831,null),...Zp}}},"accessibility.signals.diffLineDeleted":{...Qz,description:d(4827,null),properties:{sound:{description:d(4828,null),...Zp}}},"accessibility.signals.chatEditModifiedFile":{...Qz,description:d(4810,null),properties:{sound:{description:d(4811,null),...Zp}}},"accessibility.signals.notebookCellCompleted":{...vb,description:d(4867,null),properties:{sound:{description:d(4869,null),...Zp},announcement:{description:d(4868,null),...bb}}},"accessibility.signals.notebookCellFailed":{...vb,description:d(4870,null),properties:{sound:{description:d(4872,null),...Zp},announcement:{description:d(4871,null),...bb}}},"accessibility.signals.progress":{...vb,description:d(4882,null),default:{sound:"auto",announcement:"off"},properties:{sound:{description:d(4884,null),...Zp},announcement:{description:d(4883,null),...bb}}},"accessibility.signals.chatRequestSent":{...vb,description:d(4812,null),properties:{sound:{description:d(4814,null),...Zp},announcement:{description:d(4813,null),...bb}}},"accessibility.signals.chatResponseReceived":{...Qz,description:d(4815,null),properties:{sound:{description:d(4816,null),...Zp}}},"accessibility.signals.codeActionTriggered":{...Qz,description:d(4825,null),properties:{sound:{description:d(4826,null),...Zp}}},"accessibility.signals.codeActionApplied":{...Qz,description:d(4823,null),properties:{sound:{description:d(4824,null),...Zp}}},"accessibility.signals.voiceRecordingStarted":{...Qz,description:d(4913,null),properties:{sound:{description:d(4914,null),...Zp}},default:{sound:"on"}},"accessibility.signals.voiceRecordingStopped":{...Qz,description:d(4915,null),properties:{sound:{description:d(4916,null),...Zp,default:"off"}}},"accessibility.signals.clear":{...vb,description:d(4820,null),properties:{sound:{description:d(4822,null),...Zp},announcement:{description:d(4821,null),...bb}}},"accessibility.signals.editsUndone":{...vb,description:d(4835,null),properties:{sound:{description:d(4837,null),...Zp},announcement:{description:d(4836,null),...bb}}},"accessibility.signals.editsKept":{...vb,description:d(4832,null),properties:{sound:{description:d(4834,null),...Zp},announcement:{description:d(4833,null),...bb}}},"accessibility.signals.save":{type:"object",tags:["accessibility"],additionalProperties:!1,markdownDescription:d(4885,null),properties:{sound:{description:d(4890,null),type:"string",enum:["userGesture","always","never"],default:"never",enumDescriptions:[d(4893,null),d(4891,null),d(4892,null)]},announcement:{description:d(4886,null),type:"string",enum:["userGesture","always","never"],default:"never",enumDescriptions:[d(4889,null),d(4887,null),d(4888,null)]}},default:{sound:"never",announcement:"never"}},"accessibility.signals.format":{type:"object",tags:["accessibility"],additionalProperties:!1,markdownDescription:d(4838,null),properties:{sound:{description:d(4845,null),type:"string",enum:["userGesture","always","never"],default:"never",enumDescriptions:[d(4846,null),d(4839,null),d(4844,null)]},announcement:{description:d(4840,null),type:"string",enum:["userGesture","always","never"],default:"never",enumDescriptions:[d(4843,null),d(4841,null),d(4842,null)]}},default:{sound:"never",announcement:"never"}},"accessibility.signals.chatUserActionRequired":{...vb,markdownDescription:d(4817,null),properties:{sound:{description:d(4819,null),type:"string",enum:["auto","on","off"],enumDescriptions:[d(4930,null),d(4932,null),d(4931,null)]},announcement:{description:d(4818,null),...bb}},default:{sound:"auto",announcement:"auto"},tags:["accessibility"]},"accessibility.underlineLinks":{type:"boolean",description:d(4917,null),default:!1},"accessibility.debugWatchVariableAnnouncements":{type:"boolean",description:d(4798,null),default:!0},"accessibility.replEditor.readLastExecutionOutput":{type:"boolean",description:d(4801,null),default:!0},"accessibility.replEditor.autoFocusReplExecution":{type:"string",enum:["none","input","lastExecution"],default:"input",description:d(4928,null)},"accessibility.windowTitleOptimized":{type:"boolean",default:!0,markdownDescription:d(4921,null,"`#window.title#`","`activeEditorState`")},"accessibility.openChatEditedFiles":{type:"boolean",default:!1,markdownDescription:d(4800,null)},"accessibility.verboseChatProgressUpdates":{type:"boolean",default:!0,markdownDescription:d(4918,null)}}};function fto(){let a=oe.as(ii.Configuration);a.registerConfiguration(eGo),a.registerConfiguration({...Cm,properties:{"accessibility.dimUnfocused.enabled":{description:d(4926,null),type:"boolean",default:!1,tags:["accessibility"],scope:1},"accessibility.dimUnfocused.opacity":{markdownDescription:d(4927,null,"`#accessibility.dimUnfocused.enabled#`"),type:"number",minimum:.2,maximum:1,default:.75,tags:["accessibility"],scope:1},"accessibility.hideAccessibleView":{description:d(4799,null),type:"boolean",default:!1,tags:["accessibility"]},"accessibility.verboseChatProgressUpdates":{type:"boolean",default:!0,markdownDescription:d(4918,null)},"accessibility.chat.showCheckmarks":{type:"boolean",default:!1,tags:["accessibility"],markdownDescription:d(4797,null)}}})}var E9e=0,Rde=class extends C{constructor(e){super();this.speechService=e;this._register(H.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));oe.as(ii.Configuration).registerConfiguration({...CRt,properties:{"accessibility.voice.speechTimeout":{markdownDescription:d(4955,null),type:"number",default:E9e,minimum:0,tags:["accessibility"]},"accessibility.voice.ignoreCodeBlocks":{markdownDescription:d(4953,null),type:"boolean",default:!1,tags:["accessibility"]},"accessibility.voice.speechLanguage":{markdownDescription:d(4954,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(4920,null),d(4919,null)],markdownDescription:d(4925,null),default:"off",tags:["accessibility"]}}})}getLanguages(){return{auto:{name:d(4933,null)},...pmi}}};Rde=I([m(0,EC)],Rde);oe.as(rp.ConfigurationMigration).registerConfigurationMigrations([{key:"audioCues.volume",migrateFn:(a,i)=>[["accessibility.signalOptions.volume",{value:a}],["audioCues.volume",{value:void 0}]]}]);oe.as(rp.ConfigurationMigration).registerConfigurationMigrations([{key:"audioCues.debouncePositionChanges",migrateFn:a=>[["accessibility.signalOptions.debouncePositionChanges",{value:a}],["audioCues.debouncePositionChanges",{value:void 0}]]}]);oe.as(rp.ConfigurationMigration).registerConfigurationMigrations([{key:"accessibility.signalOptions",migrateFn:(a,i)=>{let e=Chi(i,"general"),t=Chi(i,"errorAtPosition"),o=Chi(i,"warningAtPosition"),n=tGo(i),r=iGo(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}}]);oe.as(rp.ConfigurationMigration).registerConfigurationMigrations([{key:"accessibility.signals.sounds.volume",migrateFn:a=>[["accessibility.signalOptions.volume",{value:a}],["accessibility.signals.sounds.volume",{value:void 0}]]}]);oe.as(rp.ConfigurationMigration).registerConfigurationMigrations([{key:"accessibility.signals.debouncePositionChanges",migrateFn:a=>[["accessibility.signalOptions.debouncePositionChanges",{value:a}],["accessibility.signals.debouncePositionChanges",{value:void 0}]]}]);function Chi(a,i){return a(`accessibility.signalOptions.experimental.delays.${i}`)||a("accessibility.signalOptions")?.["experimental.delays"]?.[`${i}`]||a("accessibility.signalOptions")?.delays?.[`${i}`]}function tGo(a){return a("accessibility.signalOptions.volume")||a("accessibility.signalOptions")?.volume||a("accessibility.signals.sounds.volume")||a("audioCues.volume")}function iGo(a){return a("accessibility.signalOptions.debouncePositionChanges")||a("accessibility.signalOptions")?.debouncePositionChanges||a("accessibility.signals.debouncePositionChanges")||a("audioCues.debouncePositionChanges")}oe.as(rp.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}]]}}]);oe.as(rp.ConfigurationMigration).registerConfigurationMigrations([{key:"accessibility.signals.chatResponsePending",migrateFn:(a,i)=>[["accessibility.signals.progress",{value:a}],["accessibility.signals.chatResponsePending",{value:void 0}]]}]);oe.as(rp.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(mo));oe.as(rp.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 zX=class extends C{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=vc.commentThreadIsEmpty.bindTo(this._contextKeyService),this._threadIsEmpty.set(!l.comments||!l.comments.length),this._focusedContextKey=vc.commentFocused.bindTo(this._contextKeyService),this._commentMenus=this.commentService.getCommentMenus(this._owner),this._register(this._header=this._scopedInstantiationService.createInstance(sTe,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(Vn(S));this._register(zE({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(rTe,this._parentEditor,this._owner,this._parentResourceUri,S,this._markdownOptions,this._commentThread,this._pendingEdits,this._scopedInstantiationService,this),this._register(this._body),this._setAriaLabel(),this._commentThreadContextValue=vc.commentThreadContext.bindTo(this._contextKeyService),this._commentThreadContextValue.set(l.contextValue);let w=vc.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(8543,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(8544,null,e,t):o&&(e=d(8545,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,Ue(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(zz).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(),Ue(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(oTe,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(aTe,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()}};zX=I([m(12,km),m(13,B),m(14,_e)],zX);function vto(a,i){return Beo(a,i)??i.getColor(p_)}function bto(a){let i=a.comments;return i?i.some(e=>e.state===1):!1}function Sto(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 Ito(a,i){if(!a)return null;let{lineNumber:e}=a;return i.target.range?e:null}var cTe=class extends aO{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 P;this._commentThreadDisposables=[];this._contextKeyService=this._globalToDispose.add(u.createScoped(this.domNode)),this._scopedInstantiationService=this._globalToDispose.add(s.createChild(new Io([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(zX,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(8546,null),primaryButton:d(8547,null),type:gt.Warning,checkbox:{label:d(8548,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=bto(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 _de(this.editor,e?.endLineNumber??-1);let o=bto(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=vto(this._commentThread.state,this.themeService.getColorTheme())||Oe.transparent;this.style({frameColor:e,arrowColor:e}),this.container?.style.setProperty(Feo,`${e}`),this.container?.style.setProperty(Weo,`${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=tC.capture(this.editor);this._relayout(s),c.restore(this.editor)}}_applyTheme(){let e=vto(this._commentThread.state,this.themeService.getColorTheme())||Oe.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()}};cTe=I([m(5,F),m(6,De),m(7,km),m(8,X),m(9,B),m(10,ct)],cTe);var kRt=class{constructor(i,e){this.range=i;this.options=e}get id(){return this._decorationId}set id(i){this._decorationId=i}},ERt=class a extends C{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=po.createDynamic(t);let o={description:a.description,isWholeLine:!1,zIndex:20,className:"comment-thread-range-current",shouldFillLineOnLineBreak:!0};this.activeDecorationOptions=po.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 kRt(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;Ue(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 kRt(l,this.decorationOptions)))});e.changeDecorations(r=>{this.decorationIds=r.deltaDecorations(this.decorationIds,n),n.forEach((s,l)=>s.id=this.decorationIds[l])})}dispose(){Ue(this.threadCollapseStateListeners),this.currentThreadCollapseStateListener?.dispose(),super.dispose()}};var khi="editor.contrib.review",Yz=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}},TRt=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=po.createDynamic(i);let e={description:a.description,isWholeLine:!0,linesDecorationsClassName:"comment-range-glyph line-hover"};this.hoverDecorationOptions=po.createDynamic(e);let t={description:a.description,isWholeLine:!0,linesDecorationsClassName:"comment-range-glyph multiline-add"};this.multilineDecorationOptions=po.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===_de.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 Yz(i,l.uniqueOwner,l.extensionId,l.label,p,this.multilineDecorationOptions,l.commentingRanges,!0)),this._lineHasThread(i,h)||r.push(new Yz(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 Yz(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 Yz(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 Yz(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 Yz(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 Yz(i,l.uniqueOwner,l.extensionId,l.label,g,this.decorationOptions,l.commentingRanges,!0))}}else r.push(new Yz(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 Ehi(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 KX(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=Ec(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 Bu&&e.extUri.isEqual(v,S.uri)){g&&pn(b)&&RC.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?vn:Un).then(b=>{if(b){let S=b.getControl();g&&pn(S)&&RC.get(S)?.revealCommentThread(g,f,!0,u)}})}var RC=class extends C{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 P);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=vc.activeCursorHasCommentingRange.bindTo(u),this._activeCursorHasComment=vc.activeCursorHasComment.bindTo(u),this._activeEditorHasCommentingRange=vc.activeEditorHasCommentingRange.bindTo(u),this._commentWidgetVisible=vc.commentWidgetVisible.bindTo(u),!(e instanceof zc)&&(this.editor=e,this._commentingRangeDecorator=this._register(new TRt),this._register(this._commentingRangeDecorator.onDidChangeDecorationsCount(v=>{v===0?this.clearEditorListeners():this._editorDisposables.length===0&&this.registerEditorListeners()})),this._register(this._commentThreadRangeDecorator=new ERt(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,[]),Ue(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",IRt,{})),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(){Ue(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===_de.description){n=!1;break}else r.options.description===TRt.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()===P$.IDiffEditor?o.getOriginalEditor()===e:!1)}beginCompute(){return this._computePromise=xn(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(si(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=si(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(khi)}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=xy(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?Or(d(8479,null,n)):Or(d(8480,null,n,r)))}}nextCommentingRange(){this._findNearestCommentingRange()}previousCommentingRange(){this._findNearestCommentingRange(!0)}dispose(){super.dispose(),Ue(this._editorDisposables),Ue(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 jo(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?Or(d(8484,null,t)):Or(d(8485,null))}else Or(d(8483,null))})}async openCommentsView(e){if(e.comments&&e.comments.length>0&&a9e(e)){let t=this.configurationService.getValue(zz).openView;if(t==="file")return this.viewsService.openView(Eu);if((t==="firstFile"||t==="firstFileUnresolved"&&e.state===0)&&!this.viewsService.getViewWithId(Eu)?.hasRendered)return this.viewsService.openView(Eu)}}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(cTe,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?Sto(e):null}onEditorMouseUp(e){let t=Ito(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(8481,null)):this.notificationService.error(d(8482,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(8486,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 st("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=[]}};RC=I([m(1,km),m(2,F),m(3,Kt),m(4,ze),m(5,Ge),m(6,Ft),m(7,B),m(8,X),m(9,ee),m(10,_e),m(11,Bi),m(12,Ne)],RC);var T9e={id:D.AccessibleView,group:"navigation",when:ud},_9e={id:D.CommandPalette,group:"",order:1},Thi=class extends K{constructor(){super({id:"editor.action.accessibleViewNext",precondition:x.and(ud,Mde),keybinding:{primary:606,weight:200},menu:[_9e,{...T9e,when:x.and(ud,Mde)}],icon:M.arrowDown,title:d(4999,null)})}run(i){i.get(Wd).next()}};W(Thi);var _hi=class extends K{constructor(){super({id:"editor.action.accessibleViewNextCodeBlock",precondition:x.and(Pde,x.or(x.equals(Kd.key,"panelChat"),x.equals(Kd.key,"inlineChat"),x.equals(Kd.key,"quickChat"))),keybinding:{primary:2572,mac:{primary:2572},weight:200},icon:M.arrowRight,menu:{...T9e,when:x.and(ud,Pde)},title:d(5000,null)})}run(i){i.get(Wd).navigateToCodeBlock("next")}};W(_hi);var Dhi=class extends K{constructor(){super({id:"editor.action.accessibleViewPreviousCodeBlock",precondition:x.and(Pde,x.or(x.equals(Kd.key,"panelChat"),x.equals(Kd.key,"inlineChat"),x.equals(Kd.key,"quickChat"))),keybinding:{primary:2571,mac:{primary:2571},weight:200},icon:M.arrowLeft,menu:{...T9e,when:x.and(ud,Pde)},title:d(5002,null)})}run(i){i.get(Wd).navigateToCodeBlock("previous")}};W(Dhi);var Lhi=class extends K{constructor(){super({id:"editor.action.accessibleViewPrevious",precondition:x.and(ud,Mde),keybinding:{primary:604,weight:200},icon:M.arrowUp,menu:[_9e,{...T9e,when:x.and(ud,Mde)}],title:d(5001,null)})}run(i){i.get(Wd).previous()}};W(Lhi);var Rhi=class extends K{constructor(){super({id:"editor.action.accessibleViewGoToSymbol",precondition:x.and(x.or(ud,LC),C9e),keybinding:{primary:3117,secondary:[3161],weight:210},icon:M.symbolMisc,menu:[_9e,{...T9e,when:x.and(x.or(ud,LC),C9e)}],title:d(4998,null)})}run(i){i.get(Wd).goToSymbol()}};W(Rhi);function yto(a){return a.register(),a}var Ade=yto(new SN({id:"editor.action.accessibilityHelp",precondition:void 0,kbOpts:{primary:571,weight:200,linux:{primary:1595,secondary:[571]},kbExpr:LC.toNegated()},menuOpts:[{menuId:D.CommandPalette,group:"",title:d(4991,null),order:1}]})),dTe=yto(new SN({id:"editor.action.accessibleView",precondition:void 0,kbOpts:{primary:572,weight:200,linux:{primary:1596,secondary:[572]}},menuOpts:[{menuId:D.CommandPalette,group:"",title:d(4995,null),order:1}]})),Mhi=class extends K{constructor(){super({id:"editor.action.accessibleViewDisableHint",precondition:x.and(x.or(ud,LC),w9e),keybinding:{primary:576,weight:200},icon:M.bellSlash,menu:[_9e,{id:D.AccessibleView,group:"navigation",when:x.and(x.or(ud,LC),w9e)}],title:d(4997,null)})}run(i){i.get(Wd).disableHint()}};W(Mhi);var Phi=class extends K{constructor(){super({id:"editor.action.accessibilityHelpConfigureKeybindings",precondition:x.and(LC,x9e),icon:M.recordKeys,keybinding:{primary:553,weight:200},menu:[{id:D.AccessibleView,group:"navigation",order:3,when:x9e}],title:d(4993,null)})}async run(i){await i.get(Wd).configureKeybindings(!0)}};W(Phi);var Ahi=class extends K{constructor(){super({id:"editor.action.accessibilityHelpConfigureAssignedKeybindings",precondition:x.and(LC,k9e),icon:M.recordKeys,keybinding:{primary:543,weight:200},menu:[{id:D.AccessibleView,group:"navigation",order:4,when:k9e}],title:d(4992,null)})}async run(i){await i.get(Wd).configureKeybindings(!1)}};W(Ahi);var Nhi=class extends K{constructor(){super({id:"editor.action.accessibilityHelpOpenHelpLink",precondition:x.and(LC),keybinding:{primary:550,weight:200},title:d(4994,null)})}run(i){i.get(Wd).openHelpLink()}};W(Nhi);var Ohi=class extends K{constructor(){super({id:"editor.action.accessibleViewAcceptInlineCompletion",precondition:x.and(ud,x.equals(Kd.key,"inlineCompletions")),keybinding:{primary:2138,mac:{primary:346},weight:200},icon:M.check,menu:[_9e,{id:D.AccessibleView,group:"navigation",order:0,when:x.and(ud,x.equals(Kd.key,"inlineCompletions"))}],title:d(4996,null)})}async run(i){let e=i.get(Kt),t=e.getActiveCodeEditor()||e.getFocusedCodeEditor();if(!t)return;let o=Rc.get(t)?.model.get(),n=o?.state.get();!o||!n||(await o.accept(t),o.stop(),t.focus())}};W(Ohi);var _Rt=new Q("commentsView.hasComments",!1),DRt=new Q("commentsView.someCommentsExpanded",!1),Fhi=new Q("commentsView.commentFocused",!1),nGo="commentsViewState";function rGo(a){let i=[];for(let e of a.resourceCommentThreads){let t=[];for(let o of e.commentThreads)a9e(o.thread)&&t.push({element:o});t.length>0&&i.push({element:e,children:t})}return i}var uTe=class extends iF{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){let S=new Bl(nGo,v),y=S.getMemento(1,1);super({...e,filterOptions:{placeholder:d(8513,null),ariaLabel:d(8512,null),history:y.filterHistory||[],text:y.filter||"",focusContextKey:p9e.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=_Rt.bindTo(s),this.someCommentsExpandedContextKey=DRt.bindTo(s),this.commentsFocusedContextKey=Fhi.bindTo(s),this.stateMemento=S,this.viewState=y,this.filters=this._register(new mRt({showResolved:this.viewState.showResolved!==!1,showUnresolved:this.viewState.showUnresolved!==!1,sortBy:this.viewState.sortBy??"resourceAscending"},this.contextKeyService)),this.filter=new rRt(new LV(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 HE)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 HE);)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 HE);)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(zE({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 LV(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(8523,null,t,e)),this.filterWidget.checkMoreFilters(!this.filters.showResolved||!this.filters.showUnresolved)}renderBody(e){super.renderBody(e),e.classList.add("comments-panel");let t=R(e,_(".comments-panel-container"));this.treeContainer=R(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&&sa(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,rGo(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=R(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=Ye(e);return t?t.startLineNumber===t.endLineNumber?d(8516,null,t.startLineNumber,t.startColumn,o):d(8515,null,t.startLineNumber,t.endLineNumber,o):d(8514,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(dTe.id)?.getAriaLabel();o=u?d(8510,null,u):d(8511,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(8519,null,c.userName,c.bodyLabel,c.locationLabel,c.replyCountLabel,l)+n+o:d(8518,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(8521,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(8517,null,e.replies.length):""}createTree(){this.treeLabels=this._register(this.instantiationService.createInstance(Za,this)),this.tree=this._register(this.instantiationService.createInstance(qEe,this.treeLabels,this.treeContainer,{overrideStyles:this.getLocationBasedColors().listOverrideStyles,selectionNavigation:!0,filter:this.filter,sorter:{compare:(e,t)=>{if(e instanceof Kz||t instanceof Kz)return 0;if(this.filters.sortBy==="updatedAtDescending")return e.lastUpdatedAt>t.lastUpdatedAt?-1:1;if(this.filters.sortBy==="resourceAscending"){if(e instanceof mw&&t instanceof mw){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 HE&&t instanceof HE&&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 Kz?d(8522,null):e instanceof mw?d(8520,null,Ye(e.resource),e.resource.fsPath):e instanceof HE?this.getScreenReaderInfoForNode(e,!0):"",getWidgetAriaLabel(){return d9e.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 mw||e instanceof HE))return;let r=e instanceof mw?e.commentThreads[0].thread:e.thread,s=e instanceof mw?e.commentThreads[0].comment:void 0;return KX(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}};uTe=I([m(1,F),m(2,Ri),m(3,ee),m(4,B),m(5,X),m(6,ze),m(7,_e),m(8,Qe),m(9,De),m(10,km),m(11,tt),m(12,dt),m(13,le),m(14,wn)],uTe);function wto(a,i,e){let t,o,n,r,s;if(i){for(r=i.offset,s=r+i.length,n=r;n>0&&!D9e(a,n-1);)n--;let w=s;for(;w<a.length&&!D9e(a,w);)w++;o=a.substring(n,w),t=sGo(o,e)}else o=a,t=0,n=0,r=0,s=a.length;let l=Vhi(e,a),c=!1,u=0,p;e.insertSpaces?p=Whi(" ",e.tabSize||4):p="	";let h=$le(o,!1),g=!1;function f(){return l+Whi(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=Whi(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 N=h.getTokenOffset()+n;S(T,w,N),y=k}return b}function rF(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 Whi(a,i){let e="";for(let t=0;t<i;t++)e+=a;return e}function sGo(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 Vhi(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 D9e(a,i){return`\r
`.indexOf(a.charAt(i))!==-1}function Sb(a,i,e,t,o){let n=i.slice(),s=zL(a,[]),l,c;for(;n.length>0&&(c=n.pop(),l=lC(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=lC(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 GX(a,{offset:h,length:g-h,content:""},t)}else return GX(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 GX(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 GX(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 GX(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?[]:GX(a,{offset:s?s.offset:0,length:s?s.length:0,content:JSON.stringify(e)},t)}function GX(a,i,e){let t=Bhi(a,i),o=i.offset,n=i.offset+i.content.length;if(i.length===0||i.content.length===0){for(;o>0&&!D9e(t,o-1);)o--;for(;n<t.length&&!D9e(t,n);)n++}let r=wto(t,{offset:o,length:n-o},e);for(let l=r.length-1;l>=0;l--){let c=r[l];t=Bhi(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 Bhi(a,i){return a.substring(0,i.offset)+i.content+a.substring(i.offset+i.length)}function Nde(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=Bhi(a,n);else throw new Error("Overlapping edit");t=n.offset}return a}var Ff=ae("workspacesService");function L9e(a){return a.hasOwnProperty("workspace")}function Ode(a){return a.hasOwnProperty("folderUri")}var LRt=class extends C{constructor(e){super();this.channelName=e;this._onDidReceiveData=this._register(new E);this.onDidReceiveData=this._onDidReceiveData.event;if("BroadcastChannel"in It)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.",Cn(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))};It.addEventListener("storage",e),this._register(Z(()=>It.removeEventListener("storage",e)))}postData(e){this.broadcastChannel?this.broadcastChannel.postMessage(e):(localStorage.removeItem(this.channelName),localStorage.setItem(this.channelName,JSON.stringify(e)))}};var Wf=class{constructor(i){this.identifier=i}},rI=class{constructor(i){this.identifier=i}};async function RRt(a){let i=[],e=Zn.uriList.toLowerCase();if(a.has(e))try{let t=await a.get(e)?.asString(),o=JSON.stringify(Uy.parse(t??""));i.push(...SJt(o))}catch{}return i}var sF=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=>TIe(u,i));if(!r.length)return;await this.hostService.focus(e);let s=oe.as(mW.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=si(r.filter(p=>p.allowWorkspaceOpen&&p.resource?.scheme===Y.file).map(p=>p.resource));if(u.length>0&&await this.handleWorkspaceDrop(u))return}let l=si(r.filter(u=>u.isExternal&&u.resource?.scheme===Y.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(o7(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):xx(this.contextService.getWorkspace())?await this.workspaceEditingService.addFolders(t):await this.workspaceEditingService.createAndEnterWorkspace(t),!0)}};sF=I([m(1,be),m(2,Ff),m(3,ee),m(4,Of),m(5,oi),m(6,Pe),m(7,F)],sF);function Ig(a,i,e,t){if(i.length===0||!e.dataTransfer)return;let o=a.get(Ho),n=a.get(ee),r=a.get(be),s=a.get(ot),l=si(i.map(f=>A.isUri(f)?{resource:f}:C8e(f)?A.isUri(f.editor.resource)?{resource:f.editor.resource}:void 0:{resource:f.selection?fL(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=ri?`\r
`:`
`;e.dataTransfer.setData(Aa.TEXT,c.map(({resource:b})=>s.getUriLabel(b,{noPrefix:!0})).join(f));let v=c.find(({isDirectory:b})=>!b);if(v){let b=gn.uriToFileUri(v.resource);b.scheme===Y.file&&e.dataTransfer.setData(Aa.DOWNLOAD_URL,[Zn.binary,Ye(v.resource),b.toString()].join(":"))}}let u=c.filter(({isDirectory:f})=>!f);u.length&&e.dataTransfer.setData(Aa.RESOURCES,JSON.stringify(u.map(({resource:f})=>f.toString())));let p=oe.as(mW.DragAndDropContribution).getAll();for(let f of p)f.setData(l,e);let h=[];for(let f of i){let v;if(C8e(f)){let b=f.editor.toUntyped({preserveViewState:f.groupId});b&&(v={...b,resource:no.getCanonicalUri(b)})}else if(A.isUri(f)){let{selection:b,uri:S}=EIe(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(Xe(y.input.resource,b)){let w=y.getViewState();if(w)return w}})()})}}h.push(v)}}h.length&&e.dataTransfer.setData(Ll.EDITORS,yIe(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?fL(v.resource,v.options.selection):v.resource):db(v)?v.modified.resource&&f.push(v.modified.resource):C_(v)?v.primary.resource&&f.push(v.primary.resource):dC(v)&&f.push(v.result.resource);t?.disableStandardTransfer||e.dataTransfer.setData(Zn.uriList,Uy.create(f.slice(0,1))),e.dataTransfer.setData(Aa.INTERNAL_URI_LIST,Uy.create(f))}}var Hhi=class{constructor(i,e){this.type=i;this.id=e}update(i){}getData(){return{type:this.type,id:this.id}}},Fde=class{constructor(i){this.compositeId=i}get id(){return this.compositeId}},Wde=class{constructor(i){this.viewId=i}get id(){return this.viewId}},KE=class a extends C{constructor(){super();this.transferData=VI.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"?Wde.prototype:Fde.prototype)}))}static get INSTANCE(){return a.instance||(a.instance=new a,Mp(a.instance)),a.instance}readDragData(e){if(this.transferData.hasData(e==="view"?Wde.prototype:Fde.prototype)){let t=this.transferData.getData(e==="view"?Wde.prototype:Fde.prototype);if(t?.[0])return new Hhi(e,t[0].id)}}writeDragData(e,t){this.transferData.setData([t==="view"?new Wde(e):new Fde(e)],t==="view"?Wde.prototype:Fde.prototype)}registerTarget(e,t){let o=new P;return o.add(new Om(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 P;return n.add(new Om(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 E5(a,i,e){a&&(a.dropEffect=e?i:"none")}var k5=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=si(i.map(this.toResource));return e.length===1?Ye(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=>Ig(n,t,e))}onWillDragElements(i,e){}onDragOver(i,e,t,o,n){return!1}drop(i,e,t,o,n){}dispose(){}};k5=I([m(1,F)],k5);var Uhi=class a extends C{constructor(){super();this.broadcaster=this._register(new LRt(a.CHANNEL_NAME));this.draggedOver=!1;this.registerListeners()}static{this.CHANNEL_NAME="monaco-workbench-global-dragged-over"}registerListeners(){this._register(H.runAndSubscribe(Fg,({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:It,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))}},lGo=new Uhi;function MRt(){return lGo.isDraggedOver}var T5=new D("Views");fe.appendMenuItem(D.ViewContainerTitle,{submenu:T5,title:d(4259,null),order:1});var pTe=class a extends Jd{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?v8e:Tj)||"";let e=this.getColor(qs);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 Om(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}},Ha=class extends Xj{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 Oi(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 aRt(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 yn(Me(e),c)))),this._register(ws.addTarget(e)),this._register(j(e,Gn.Contextmenu,c=>this.showContextMenu(new yn(Me(e),c)))),this._menuActions=this._register(this.instantiationService.createInstance(YEe,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(KE.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 pTe(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 pTe(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)&&E5(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(gs(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):Ca(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 fV(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 yn(Me(c.draggableElement),h),c)}),p=H.latch(H.map(c.onDidChange,()=>!c.isExpanded()))(h=>{this.viewContainerModel.setCollapsed(n.id,h)});t.push({pane:c,size:l||c.minimumSize,index:s,disposable:hn(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:wt(p?a7i:v7i),headerBackground:wt(p?s7i:f7i),headerBorder:wt(p?l7i:tdi),dropBackground:wt(p?v8e:Tj),leftBorder:p?wt(CEt):void 0});let h=new P;h.add(o),h.add(hn(e,r,s,l,u,c));let g={pane:e,disposable:h};this.paneItems.splice(n,0,g),Oi(this.paneview).addPane(e,t,n);let f;this.viewDescriptorService.canMoveViews()&&(e.draggableElement&&h.add(KE.INSTANCE.registerDraggable(e.draggableElement,()=>({type:"view",id:e.id}),{})),h.add(KE.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 pTe(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 pTe(e.dropTargetElement,this.orientation??0,void 0,this.viewDescriptorService.getViewContainerLocation(this.viewContainer),this.themeService))}}},onDragOver:v=>{E5(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(N=>N.id===y.id),T=this.panes.findIndex(N=>N.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),Oi(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),Oi(this.paneview).movePane(e,t),this.viewContainerModel.move(r.id,s.id),this.updateTitleArea()}resizePane(e,t){Oi(this.paneview).resizePane(e,t)}getPaneSize(e){return Oi(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()}};Ha=I([m(2,F),m(3,B),m(4,fi),m(5,ze),m(6,Te),m(7,lt),m(8,De),m(9,le),m(10,Pe),m(11,Ri),m(12,ne)],Ha);var R9e=class extends K{constructor(i){super(i),this.desc=i}run(i,...e){let t=i.get(Ft).getActiveViewPaneContainerWithId(this.desc.viewPaneContainerId);if(t)return this.runInViewPaneContainer(i,t,...e)}},mTe=class extends K{constructor(e,t){super(e);this.offset=t}async run(e){let t=e.get(Ri),o=e.get(X),n=Vl.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 mTe{constructor(){super({id:"views.moveViewUp",title:d(4258,null),keybinding:{primary:Ai(2089,16),weight:201,when:Vl.notEqualsTo("")}},-1)}});W(class extends mTe{constructor(){super({id:"views.moveViewLeft",title:d(4256,null),keybinding:{primary:Ai(2089,15),weight:201,when:Vl.notEqualsTo("")}},-1)}});W(class extends mTe{constructor(){super({id:"views.moveViewDown",title:d(4255,null),keybinding:{primary:Ai(2089,18),weight:201,when:Vl.notEqualsTo("")}},1)}});W(class extends mTe{constructor(){super({id:"views.moveViewRight",title:d(4257,null),keybinding:{primary:Ai(2089,17),weight:201,when:Vl.notEqualsTo("")}},1)}});W(class extends K{constructor(){super({id:"vscode.moveViews",title:d(4260,null)})}async run(i,e){if(!Array.isArray(e?.viewIds)||typeof e?.destinationId!="string")return Promise.reject("Invalid arguments");let t=i.get(Ri),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(Ft).openViewContainer(o.id,!0)}}});var zhi=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}}},Khi=class{constructor(i){this.thread=i;this.disposableStore=new P}dispose(){this.disposableStore.dispose()}},Ghi=class extends C{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 jt)}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 zhi(t,this.handle,e,o,A.revive(n).toString(),r,s,!0,l,c),p=new Khi(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===Y.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!==Y.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}}},Cto=Re("comments-view-icon",M.commentDiscussion,d(3006,null)),PRt=class extends C{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 P);this._openViewListener=this._register(new me);this._onChangeContainerListener=this._register(new me);this._onChangeContainerLocationListener=this._register(new me);this._proxy=e.getProxy(Zi.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 Ghi(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);KX(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(Eu);if(!e){let t=oe.as(on.ViewContainersRegistry).registerViewContainer({id:Eu,title:d9e,ctorDescriptor:new Mt(Ha,[Eu,{mergeViewWithContainerWhenSingleView:!0}]),storageId:Ueo,hideIfEmpty:!0,icon:Cto,order:10},1);oe.as(on.ViewsRegistry).registerViews([{id:Eu,name:d9e,canToggleVisibility:!1,ctorDescriptor:new Mt(uTe),canMoveView:!0,containerIcon:Cto,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===Eu&&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===Eu)&&(this.setComments(),this.registerViewOpenedListener())})),this._onChangeContainerLocationListener.value||(this._onChangeContainerLocationListener.value=this._viewDescriptorService.onDidChangeContainerLocation(t=>{let o=this._viewDescriptorService.getViewContainerByViewId(Eu);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)}};PRt=I([vo(Gi.MainThreadComments),m(1,km),m(2,Ft),m(3,Ri),m(4,dt),m(5,ee)],PRt);var qX=ae("notebookCellStatusBarService");var ARt=class{constructor(i,e,t,o){this._notebookService=e;this._cellStatusBarService=t;this._logService=o;this._disposables=new P;this._notebookSerializer=new Map;this._notebookCellStatusBarRegistrations=new Map;this._proxy=i.getProxy(Zi.ExtHostNotebook)}dispose(){this._disposables.dispose(),Ue(this._notebookSerializer.values())}$registerNotebookSerializer(i,e,t,o,n){let r=new P;r.add(this._notebookService.registerNotebookSerializer(t,e,{options:o,dataToNotebook:async s=>{let l=new En,c;if(s.byteLength===0&&t==="interactive")c=eI.fromNotebookDataDto({cells:[],metadata:{}});else{let u=await this._proxy.$dataToNotebook(i,s,ve.None);c=eI.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 En,c=this._proxy.$notebookToData(i,new qh(eI.toNotebookDataDto(s)),ve.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(dGo(p))throw new As(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=si([{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=>Xn(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)}};ARt=I([vo(Gi.MainThreadNotebook),m(1,un),m(2,qX),m(3,ne)],ARt);qe.registerCommand("_executeDataToNotebook",async(a,...i)=>{let[e,t]=i;So(typeof e=="string","string"),So(t instanceof Je,"VSBuffer");let n=await a.get(un).withNotebookDataProvider(e);if(!(n instanceof YL))return;let r=await n.serializer.dataToNotebook(t);return new qh(eI.toNotebookDataDto(r))});qe.registerCommand("_executeNotebookToData",async(a,i,e)=>{So(typeof i=="string","string");let o=await a.get(un).withNotebookDataProvider(i);if(!(o instanceof YL))return;let n=eI.fromNotebookDataDto(e.value);return await o.serializer.notebookToData(n)});function dGo(a){let i=a;return typeof i?.fileOperationResult=="number"&&typeof i?.message=="string"}var Zc=ae("INotebookEditorWidgetService");var rs=ae("INotebookExecutionStateService");var NRt=100;var Tl=ae("INotebookKernelService"),mR=ae("INotebookKernelHistoryService");var $hi=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=dr(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=dr(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)}},qhi=class{constructor(i){this.notebookType=i}},ORt=class{constructor(i,e,t,o,n,r){this._languageService=e;this._notebookKernelService=t;this._notebookExecutionStateService=o;this._notebookService=n;this._editors=new jt;this._disposables=new P;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(Zi.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 $hi{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 P);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(eI.fromCellExecuteUpdateDto))}catch(o){mt(o)}}$completeExecution(i,e){try{this._executions.get(i)?.complete(eI.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 qhi(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,ve.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))}};ORt=I([vo(Gi.MainThreadNotebookKernels),m(1,kt),m(2,Tl),m(3,rs),m(4,un),m(5,Zc)],ORt);var hTe=class{constructor(i,e,t){this._notebookEditorModelResolverService=e;this._uriIdentityService=t;this._disposables=new P;this._documentEventListenersMapping=new vt;this._proxy=i.getProxy(Zi.ExtHostNotebookDocuments),this._modelReferenceCollection=new SQe(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(),Ue(this._documentEventListenersMapping.values())}handleNotebooksAdded(i){for(let e of i){let t=new P;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=>eI.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(eI.toNotebookOutputDto)});break;case 9:n.rawEvents.push({kind:s.kind,index:s.index,outputId:s.outputId,outputItems:s.outputItems.map(eI.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 qh(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(H.once(e.object.notebook.onWillDispose)(()=>{e.dispose()}),this._proxy.$acceptDirtyStateChanged(e.object.resource,!0),i.content){let t=eI.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}};hTe=I([m(1,mh),m(2,dt)],hTe);var jhi=class{constructor(i,e){this.editor=i;this.disposables=e}dispose(){this.disposables.dispose()}},gTe=class{constructor(i,e,t,o,n){this._editorService=e;this._notebookEditorService=t;this._editorGroupService=o;this._configurationService=n;this._disposables=new P;this._mainThreadEditors=new Map;this._proxy=i.getProxy(Zi.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(),Ue(this._mainThreadEditors.values())}handleEditorsAdded(i){for(let e of i){let t=new P;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 jhi(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=qn(e);t&&this._mainThreadEditors.has(t.getId())&&(i[t.getId()]=bC(this._editorGroupService,e.group))}uo(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},W_(this._editorGroupService,this._configurationService,t.position)),r=qn(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}))}};gTe=I([m(1,ee),m(2,Zc),m(3,Et),m(4,B)],gTe);var FRt=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=HH(i.documents,e.documents),o=X2e(i.textEditors,e.textEditors),n=i.activeEditor!==e.activeEditor?e.activeEditor:void 0,r=X2e(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])}}},Vde=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 P;this._editorListeners=new jt;this._proxy=i.getProxy(Zi.ExtHostNotebook),this._mainThreadNotebooks=e.createInstance(hTe,i),this._mainThreadEditors=e.createInstance(gTe,i),i.set(Gi.MainThreadNotebookDocuments,this._mainThreadNotebooks),i.set(Gi.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(),hn(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=qn(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=qn(s);l?.hasModel()&&e.has(l.getId())&&t.set(l.getId(),l)}let r=new FRt(new Set(this._notebookService.listNotebookDocuments()),e,n,t);this._onDelta(FRt.delta(this._currentState,r)),this._currentState=r}_onDelta(i){if(Vde._isDeltaEmpty(i))return;let e={removedDocuments:i.removedDocuments,removedEditors:i.removedEditors,newActiveEditor:i.newActiveEditor,visibleEditors:i.visibleEditors,addedDocuments:i.addedDocuments.map(Vde._asModelAddData),addedEditors:i.addedEditors.map(this._asEditorAddData,this)};this._proxy.$acceptDocumentAndEditorsDelta(new qh(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(eI.toNotebookCellDto)}}_asEditorAddData(i){let e=this._editorService.visibleEditorPanes.find(t=>qn(t)===i);return{id:i.getId(),documentUri:i.textModel.uri,selections:i.getSelections(),visibleRanges:i.visibleRanges,viewColumn:e&&bC(this._editorGroupService,e.group),viewType:i.getViewModel().viewType}}};Vde=I([QL,m(1,F),m(2,un),m(3,Zc),m(4,ee),m(5,Et),m(6,ne)],Vde);var fTe=ae("INotebookRendererMessagingService");var WRt=class extends C{constructor(e,t){super();this.messaging=t;this.proxy=e.getProxy(Zi.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)}};WRt=I([vo(Gi.MainThreadNotebookRenderers),m(1,fTe)],WRt);var _v=ae("INotebookLoggingService");var Vf=ae("workingCopyEditorService"),M9e=class extends C{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}};M9e=I([m(0,ee)],M9e);we(Vf,M9e,1);var aF=ae("elevatedFileService");function xto(a){return!!a.stat}var _5=class extends FX{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 Abe;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=gL,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:gL,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=gL: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 UU&&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,ve.None)),this.installModelListeners(this._model)}async doUpdateModel(e){this.trace("doUpdateModel()"),this.ignoreDirtyOnModelContentChange=!0;try{await this.model?.update(e,ve.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 wa(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 $e;return this.progressService.withProgress({title:d(17607,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<_5.UNDO_REDO_SAVE_PARTICIPANTS_AUTO_SAVE_THROTTLE_THRESHOLD&&await Pi(_5.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){so(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(17608,null)}),this.trace(`doSave(${e}) - before write()`);let r=Oi(this.lastResolvedFileStat),s=this;return this.saveSequentializer.run(e,(async()=>{try{let l={mtime:r.mtime,etag:t.ignoreModifiedSince||!this.filesConfigurationService.preventSaveConflicts(r.resource)?gL: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 wa(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,Oi(u),l):c=await this.fileService.writeFile(r.resource,Oi(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(17609,null,this.name),n.push(pi({id:"fileWorkingCopy.overwrite",label:d(17594,null),run:()=>this.save({...t,ignoreModifiedSince:!0,reason:1})})),n.push(pi({id:"fileWorkingCopy.revert",label:d(17603,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);A6(e)&&n.push(...e.actions),h&&(p||u)?n.push(pi({id:"fileWorkingCopy.saveElevated",label:u?ri?d(17595,null):d(17596,null):ri?d(17605,null):d(17606,null),run:()=>{this.save({...t,writeElevated:!0,writeUnlock:u,reason:1})}})):c?n.push(pi({id:"fileWorkingCopy.unlock",label:d(17594,null),run:()=>this.save({...t,writeUnlock:!0,reason:1})})):n.push(pi({id:"fileWorkingCopy.retry",label:d(17602,null),run:()=>this.save({...t,reason:1})})),n.push(pi({id:"fileWorkingCopy.saveAs",label:d(17604,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(pi({id:"fileWorkingCopy.revert",label:d(17603,null),run:()=>this.revert()})),c?u&&h?r=ri?d(17600,null,this.name):d(17601,null,this.name):r=d(17599,null,this.name):h&&p?r=ri?d(17597,null,this.name):d(17598,null,this.name):r=d(17593,null,this.name,In(e,!1))}let s=this.notificationService.notify({id:`${Ir(this.resource.toString())}`,severity:St.Error,message:r,actions:{primary:n}}),l=this._register(H.once(H.any(this.onDidSave,this.onDidRevert))(()=>s.close()));this._register(H.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()}};_5=I([m(5,be),m(6,ne),m(7,kp),m(8,lr),m(9,Gm),m(10,Wa),m(11,Ne),m(12,Vf),m(13,ee),m(14,aF),m(15,Bo)],_5);var lF=class extends gg{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 P);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&&lF._isStoredFileWorkingCopy(this._workingCopy)?this._workingCopyManager.stored.canDispose(this._workingCopy):!0}isDirty(){return this._workingCopy?.isDirty()??!1}isModified(){return this._workingCopy?.isModified()??!1}isOrphaned(){return lF._isStoredFileWorkingCopy(this._workingCopy)&&this._workingCopy.hasState(4)}hasAssociatedFilePath(){return!lF._isStoredFileWorkingCopy(this._workingCopy)&&!!this._workingCopy?.hasAssociatedFilePath}isReadonly(){return lF._isStoredFileWorkingCopy(this._workingCopy)?this._workingCopy?.isReadonly():this._filesConfigurationService.isReadonly(this.resource)}get hasErrorState(){return this._workingCopy&&Wo(this._workingCopy,{hasState:!0})?this._workingCopy.hasState(5):!1}async revert(e){return So(this.isResolved()),this._workingCopy.revert(e)}async save(e){return So(this.isResolved()),this._workingCopy.save(e)}async load(e){return!this._workingCopy||!this._workingCopy.model?(this.resource.scheme===Y.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}),So(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)}};lF=I([m(5,lr)],lF);var AV=class extends C{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(ft.remoteSaving);(s||e.uri.scheme===Y.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 VRt("Failed to get notebook serializer")})),t.isCancellationRequested)throw new ho;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=uGo(o);this._telemetryService.publicLogError2("notebook/SaveError",{isRemote:this._notebookModel.uri.scheme===Y.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 Kv(e),r=await o.dataToNotebook(n);if(t.isCancellationRequested)throw new ho;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 YL)){let t="CANNOT open notebook with this provider";throw new VRt(t)}return e.serializer}get versionId(){return this._notebookModel.alternativeVersionId}pushStackElement(){this._notebookModel.pushStackElement()}},bTe=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 AV(o,this._notebookService,this._configurationService,this._telemetryService,this._notebookLogService)}};bTe=I([m(1,un),m(2,B),m(3,Te),m(4,_v)],bTe);var VRt=class extends Error{constructor(i){super(i),this.name="NotebookSaveError"}};function uGo(a){if(a.name==="NotebookSaveError")return a.message;if(a instanceof As)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 Qhi=class{constructor(i){this._proxy=i.getProxy(Zi.ExtHostNotebookDocumentSaveParticipant)}async participate(i,e,t,o){if(!i.model||!(i.model instanceof AV))return;let n,r=new Promise((s,l)=>{n=setTimeout(()=>l(new Error(d(3053,null))),1750),this._proxy.$participateInSave(i.resource,e.reason,o).then(c=>{clearTimeout(n)}).then(s,l)});return pm(r,o)}},BRt=class{constructor(i,e,t){this.workingCopyFileService=t;this._saveParticipantDisposable=this.workingCopyFileService.addSaveParticipant(e.createInstance(Qhi,i))}dispose(){this._saveParticipantDisposable.dispose()}};BRt=I([QL,m(1,F),m(2,kp)],BRt);var HRt=class{constructor(i,e){this._disposables=new P;this._proxy=i.getProxy(Zi.ExtHostInteractive),this._disposables.add(e.onWillAddInteractiveDocument(t=>{this._proxy.$willAddInteractiveDocument(t.inputUri,`
`,Fr,t.notebookUri)})),this._disposables.add(e.onWillRemoveInteractiveDocument(t=>{this._proxy.$willRemoveInteractiveDocument(t.inputUri,t.notebookUri)}))}dispose(){this._disposables.dispose()}};HRt=I([vo(Gi.MainThreadInteractive),m(1,Kke)],HRt);var pGo={type:"object",additionalProperties:!1,properties:{type:{type:"string",description:d(14025,null)},required:{type:"array",items:{type:"string"}},properties:{type:"object",description:d(14026,null),additionalProperties:{$ref:"http://json-schema.org/draft-07/schema#"}},when:{type:"string",markdownDescription:d(14027,null),default:""}}},Eto;(i=>{function a(e,t,o){if(!e)return;let n=Ae(e.type)?e.type:void 0;if(!n||n.length===0){o.error(d(14029,null));return}let r=[];if(Array.isArray(e.required))for(let s of e.required)Ae(s)&&r.push(s);return{extensionId:t.value,taskType:n,required:r,properties:e.properties?Xi(e.properties):{},when:e.when?x.deserialize(e.when):void 0}}i.from=a})(Eto||={});var mGo=Tn.registerExtensionPoint({extensionPoint:"taskDefinitions",activationEventsGenerator:function*(a){for(let i of a)i.type&&(yield`onTaskType:${i.type}`)},jsonSchema:{description:d(14028,null),type:"array",items:pGo}}),Yhi=class{constructor(){this._onDefinitionsChanged=new E;this.onDefinitionsChanged=this._onDefinitionsChanged.event;this.taskTypes=Object.create(null),this.readyPromise=new Promise((i,e)=>{mGo.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=Eto.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=Xi(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}},sk=new Yhi;var NV="settings",ITe=new Q("taskRunning",!1,d(14032,null)),A9e=new Q("taskTerminalActive",!1,d(14034,null)),MC=L(14033,"Tasks"),yTe=(t=>(t[t.Escape=1]="Escape",t[t.Strong=2]="Strong",t[t.Weak=3]="Weak",t))(yTe||{}),D5="$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})(yTe||={});var N9e;(i=>i.defaults={cwd:"${workspaceFolder}"})(N9e||={});var Bde=(t=>(t[t.Always=1]="Always",t[t.Silent=2]="Silent",t[t.Never=3]="Never",t))(Bde||{});(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})(Bde||={});var wTe=(t=>(t[t.Never=1]="Never",t[t.OnProblem=2]="OnProblem",t[t.Always=3]="Always",t))(wTe||{});(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})(wTe||={});var CTe=(t=>(t[t.Shared=1]="Shared",t[t.Dedicated=2]="Dedicated",t[t.New=3]="New",t))(CTe||{});(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})(CTe||={});var zRt;(i=>i.defaults={echo:!0,reveal:1,revealProblems:1,focus:!1,panel:1,showReuseMessage:!0,clear:!1,preserveTerminalName:!1})(zRt||={});var L5=(t=>(t[t.Shell=1]="Shell",t[t.Process=2]="Process",t[t.CustomExecution=3]="CustomExecution",t))(L5||{});(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})(L5||={});var R5;(i=>{function a(e){return Ae(e)?e:e.value}i.value=a})(R5||={});var $m;(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 Ae(s)?o(s)?{_id:s,isDefault:!1}:void 0:s}r.from=n})($m||={});var gl;(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})(gl||={});var KRt;(i=>i.defaults={reevaluateOnRerun:!0,runOn:1,instanceLimit:1,instancePolicy:"prompt"})(KRt||={});var STe=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(Ae(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}},pd=class a extends STe{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===gl.User?NV: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!==gl.Workspace&&(t+=this._source.kind),JSON.stringify({type:D5,folder:e,id:t})}getWorkspaceFolder(){return this._source.config.workspaceFolder}getWorkspaceFileName(){return this._source.config.workspace&&this._source.config.workspace.configuration?Ye(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)}},tf=class a extends STe{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?Ye(this._source.config.workspace.configuration):void 0}getWorkspaceFolder(){return this._source.config.workspaceFolder}getFolderId(){return this._source.kind===gl.User?NV:this._source.config.workspaceFolder?.uri.toString()}getKey(){let i=this.getFolderId();if(!i)return;let e=this.configurationProperties.identifier;return this._source.kind!==gl.Workspace&&(e+=this._source.kind),JSON.stringify({type:D5,folder:i,id:e})}},bh=class a extends STe{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)}},GE=class a extends STe{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)}},Hde=(e=>(e[e.Process=1]="Process",e[e.Terminal=2]="Terminal",e))(Hde||{});(i=>i._default=2)(Hde||={});var URt=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 Gu;(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})(Gu||={});var P9e;(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})(P9e||={});var OV;(i=>{function a(e,t){let o=sk.get(e.type);if(o===void 0){let l=Xi(e);return delete l._key,P9e.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]=Xi(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(14031,null,JSON.stringify(e,void 0,0),l));return}}}return P9e.create(n)}i.createTaskIdentifier=a})(OV||={});var GRt=Re("rerun-task",M.refresh,d(14030,null)),$Rt="workbench.action.tasks.rerunForActiveTerminal",qRt="workbench.action.tasks.rerunAllRunningTasks";var Xhi=new Q("customExecutionSupported",!1,d(14035,null)),Ude=new Q("shellExecutionSupported",!1,d(14038,null)),jRt=new Q("taskCommandsRegistered",!1,d(14039,null)),xTe=new Q("processExecutionSupported",!1,d(14036,null)),QRt=new Q("serverlessWebContext",!1,d(14037,null)),kTe=new Q("tasksAvailable",!1,d(14040,null)),Sh=x.or(x.and(Ude,xTe),Xhi),yg=ae("taskService");var sp=ae("configurationResolverService"),YRt=($=>($.Unknown="unknown",$.Env="env",$.Config="config",$.Command="command",$.Input="input",$.ExtensionInstallFolder="extensionInstallFolder",$.WorkspaceFolder="workspaceFolder",$.Cwd="cwd",$.WorkspaceFolderBasename="workspaceFolderBasename",$.UserHome="userHome",$.LineNumber="lineNumber",$.ColumnNumber="columnNumber",$.SelectedText="selectedText",$.File="file",$.FileWorkspaceFolder="fileWorkspaceFolder",$.FileWorkspaceFolderBasename="fileWorkspaceFolderBasename",$.RelativeFile="relativeFile",$.RelativeFileDirname="relativeFileDirname",$.FileDirname="fileDirname",$.FileExtname="fileExtname",$.FileBasename="fileBasename",$.FileBasenameNoExtension="fileBasenameNoExtension",$.FileDirnameBasename="fileDirnameBasename",$.ExecPath="execPath",$.ExecInstallFolder="execInstallFolder",$.PathSeparator="pathSeparator",$.PathSeparatorAlias="/",$))(YRt||{}),Tto=Object.values(YRt).filter(a=>typeof a=="string"),Bf=class extends Zs{constructor(e,t){super(t);this.variable=e}};var cS=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=ri?"windows":it?"osx":Wn?"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=ht.first(i);if(!t)break;let[o,n]=t;yield n,i.delete(o)}this.newReplacementNotifiers.delete(e)}resolved(){return ht.map(ht.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||ht.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 Jhi;(i=>{function a(e){return{id:e.id,task:$_.from(e.task)}}i.from=a})(Jhi||={});var _to;(i=>{function a(e){return{execution:{id:e.execution.id,task:$_.from(e.execution.task)}}}i.from=a})(_to||={});var Zhi;(i=>{function a(e){return{execution:{id:e.execution.id,task:$_.from(e.execution.task)},hasErrors:e.hasErrors}}i.from=a})(Zhi||={});var Dto;(i=>{function a(e,t){return{id:e.id,processId:t}}i.from=a})(Dto||={});var Lto;(i=>{function a(e,t){return{id:e.id,exitCode:t}}i.from=a})(Lto||={});var egi;(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=OV.createTaskIdentifier(t,console);return n===void 0&&o&&(n={_key:_t(),type:"$executeOnly"}),n}e.to=i})(egi||={});var tgi;(e=>{function a(t){if(t!=null)return Object.assign(Object.create(null),t)}e.from=a;function i(t){return t==null?zRt.defaults:Object.assign(Object.create(null),zRt.defaults,t)}e.to=i})(tgi||={});var igi;(e=>{function a(t){if(t!=null)return Object.assign(Object.create(null),t)}e.from=a;function i(t){return t==null?KRt.defaults:Object.assign(Object.create(null),KRt.defaults,t)}e.to=i})(igi||={});var ogi;(e=>{function a(t){if(t!=null)return{cwd:t.cwd,env:t.env}}e.from=a;function i(t){return t==null?N9e.defaults:{cwd:t.cwd||N9e.defaults.cwd,env:t.env}}e.to=i})(ogi||={});var JRt;(t=>{function a(o){let n=o;return n&&!!n.process}t.is=a;function i(o){let n=Ae(o.name)?o.name:o.name.value,r=o.args?o.args.map(l=>Ae(l)?l:l.value):[],s={process:n,args:r};return o.options&&(s.options=ogi.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=ogi.to(o.options),n}t.to=e})(JRt||={});var ngi;(e=>{function a(t){if(t==null)return;let o={cwd:t.cwd||N9e.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})(ngi||={});var ZRt;(t=>{function a(o){let n=o;return n&&(!!n.commandLine||!!n.command)}t.is=a;function i(o){let n={};return o.name&&Ae(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=ngi.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=ngi.to(o.options)),n}t.to=e})(ZRt||={});var ETe;(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})(ETe||={});var rgi;(e=>{function a(t){let o={label:t.label};return t.kind===gl.Extension?(o.extensionId=t.extension,t.workspaceFolder?o.scope=t.workspaceFolder.uri:o.scope=t.scope):t.kind===gl.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:gl.Extension,label:t.label,extension:t.extensionId,scope:n,workspaceFolder:r}}e.to=i})(rgi||={});var sgi;(i=>{function a(e){let t=e;return!!t&&Ae(t.id)&&!!t.workspaceFolder}i.is=a})(sgi||={});var $_;(e=>{function a(t){if(t==null||!pd.is(t)&&!bh.is(t)&&!tf.is(t))return;let o={_id:t._id,name:t.configurationProperties.name,definition:egi.from(t.getDefinition(!0)),source:rgi.from(t._source),execution:void 0,presentationOptions:!tf.is(t)&&t.command?tgi.from(t.command.presentation):void 0,isBackground:t.configurationProperties.isBackground,problemMatchers:[],hasDefinedMatchers:bh.is(t)?t.hasDefinedMatchers:!1,runOptions:igi.from(t.runOptions)};if(o.group=Rto.from(t.configurationProperties.group),t.configurationProperties.detail&&(o.detail=t.configurationProperties.detail),!tf.is(t)&&t.command)switch(t.command.runtime){case 2:o.execution=JRt.from(t.command);break;case 1:o.execution=ZRt.from(t.command);break;case 3:o.execution=ETe.from(t.command);break}if(t.configurationProperties.problemMatchers)for(let n of t.configurationProperties.problemMatchers)Ae(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&&(ZRt.is(t.execution)?l=ZRt.to(t.execution):JRt.is(t.execution)?l=JRt.to(t.execution):ETe.is(t.execution)&&(l=ETe.to(t.execution))),!l)return;l.presentation=tgi.to(t.presentationOptions);let c=rgi.to(t.source,o),u=d(3059,null,c.label,t.name),p=egi.to(t.definition,n),h=ETe.is(t.execution)&&t._id?t._id:`${t.source.extensionId}.${p._key}`;return new bh(h,c,u,p.type,p,l,t.hasDefinedMatchers,igi.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})($_||={});var Rto;(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})(Rto||={});var Mto;(e=>{function a(t){return t}e.from=a;function i(t){return t}e.to=i})(Mto||={});var XRt=class extends C{constructor(e,t,o,n){super();this._taskService=t;this._workspaceContextServer=o;this._configurationResolverService=n;this._proxy=e.getProxy(Zi.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=Jhi.from(s.getTaskExecution()),c=l.task.definition;if(l.task?.execution&&ETe.is(l.task.execution)&&r.resolvedVariables){let u=cS.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(Dto.from(s.getTaskExecution(),r.processId)):r.kind==="processEnded"?this._proxy.$onDidEndTaskProcess(Lto.from(s.getTaskExecution(),r.exitCode)):r.kind==="end"?this._proxy.$OnDidEndTask(Jhi.from(s.getTaskExecution())):r.kind==="problemMatcherStarted"?this._proxy.$onDidStartTaskProblemMatchers(_to.from({execution:s.getTaskExecution()})):r.kind==="problemMatcherEnded"?this._proxy.$onDidEndTaskProblemMatchers(Zhi.from({execution:s.getTaskExecution(),hasErrors:!1})):r.kind==="problemMatcherFoundErrors"&&this._proxy.$onDidEndTaskProblemMatchers(Zhi.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=$_.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=$_.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=$_.from(r);return s?(s.name=s.name===void 0?"":s.name,Promise.resolve(this._proxy.$resolveTask(e,s)).then(l=>{if(l)return $_.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(Mto.to(e)).then(t=>{let o=[];for(let n of t){let r=$_.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(sgi.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:$_.from(o)};throw new Error("Task not found")}else throw new Error("No workspace folder")}else{let t=$_.to(e,this._workspaceContextServer,!0);return{id:t._id,task:$_.from(t)}}}$executeTask(e){return new Promise((t,o)=>{if(sgi.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:$_.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=$_.to(e,this._workspaceContextServer,!0);this._taskService.run(n).then(void 0,s=>{});let r={id:n._id,task:$_.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 Zs("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=Pp}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])}Ae(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)}};XRt=I([vo(Gi.MainThreadTask),m(1,yg),m(2,Pe),m(3,sp)],XRt);var eMt=class extends C{constructor(e,t){super();this._labelService=t;this._resourceLabelFormatters=this._register(new jt)}$registerResourceLabelFormatter(e,t){t.priority=!0;let o=this._labelService.registerCachedFormatter(t);this._resourceLabelFormatters.set(e,o)}$unregisterResourceLabelFormatter(e){this._resourceLabelFormatters.deleteAndDispose(e)}};eMt=I([vo(Gi.MainThreadLabelService),m(1,ot)],eMt);var ap=ae("tunnelService"),YLl=ae("sharedTunnelsService");function agi(a){let i=a;return!!(i.tunnelRemotePort&&i.tunnelRemoteHost&&i.localAddress&&i.privacy&&i.dispose)}function Pto(a){return!!a.forwardPort}function DTe(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 Ato(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=DTe(A.parse(t));if(o)return o}}}var _Te=["localhost","127.0.0.1","0:0:0:0:0:0:0:1","::1"];function jX(a){return _Te.indexOf(a)>=0}var O9e=["0.0.0.0","0:0:0:0:0:0:0:0","::"];function M5(a){return O9e.indexOf(a)>=0}function Nto(a,i,e,t){if(e===1)return!1;if(e===2&&M5(i)){let o=/(\d+)\.(\d+)\.(\d+)/g.exec(t);if(o?.length===4&&parseInt(o[1])>=18)return!1}return a<1024}var tMt=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()}},TTe=class extends C{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){(M5(e)||jX(e))&&(e=_Te[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];jX(e)?(o.push(..._Te),o.push(...O9e)):M5(e)&&o.push(...O9e);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!!DTe(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}};TTe=I([m(0,ne),m(1,B)],TTe);var Oto=ae("IExtHostInitDataService");var Fto=ae("IExtHostRpcService");var lgi=class extends tMt{},oMt;(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})(oMt||={});var wRl=ae("IExtHostTunnelService"),iMt=class extends C{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(Gi.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 lgi(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 uY(()=>{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,ve.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(3211,null),themeIcon:"lock"},{id:"public",label:d(3212,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}),oMt.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}};iMt=I([m(0,Fto),m(1,Oto),m(2,ne)],iMt);var fGo=10*1e3,nMt="remote.tunnels.toRestore",cgi="remote.tunnels.toRestoreExpiration",vGo=1e3*60*60*24*14,Wto="onTunnel",Kde=new Q("forwardedPortsViewEnabled",!1,d(17195,null)),Xz=new Q("forwardedPortsViewOnlyEnabled",!1,d(17195,null));function W9e(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 dgi={source:0,description:d(17197,null)},sMt={source:1,description:d(17196,null)};function Vto(a,i,e){let t=a.get(Tp(i,e));if(t)return t;if(jX(i))for(let o of _Te){let n=Tp(o,e);if(a.has(n))return a.get(n)}else if(M5(i))for(let o of O9e){let n=Tp(o,e);if(a.has(n))return a.get(n)}}function Ib(a,i,e){let t=Vto(a,i,e);if(t)return t;let o=M5(i)?"localhost":jX(i)?"0.0.0.0":void 0;if(o)return Vto(a,o,e)}function Tp(a,i){return a+":"+i}function bGo(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 rMt=class a extends C{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&&Ae(e.host)&&Xo(e.port)}findNextIndex(e,t,o,n,r){if(r>=n.length)return-1;let s=!jX(t)&&!M5(t),c=n.slice(r).findIndex(u=>Xo(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||!yi(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(Ae(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 Xo(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||!yi(r)?s={}:s=Xi(r),s[`${e}`]||(s[`${e}`]={});for(let l in t)s[`${e}`][l]=t[l];return this.configurationService.updateValue(a.SETTING,s,o)}},zde=class extends C{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 rMt(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=Tp(f.tunnelRemoteHost,f.tunnelRemotePort),b=Ib(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:dgi}),this.remoteTunnels.set(v,f)}}),this.detected=new Map,this._register(this.tunnelService.onTunnelOpened(async h=>{let g=Tp(h.tunnelRemoteHost,h.tunnelRemotePort);if(!Ib(this.forwarded,h.tunnelRemoteHost,h.tunnelRemotePort)&&!Ib(this.detected,h.tunnelRemoteHost,h.tunnelRemotePort)&&!Ib(this.inProgress,h.tunnelRemoteHost,h.tunnelRemotePort)&&h.localAddress){let f=Ib(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:dgi})}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(Wto))?(this.contextKeyService.createKey(Xz.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=Tp(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?Ir(t.configuration.path):t.folders.length>0?Ir(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(nMt)}async getRestoreExpirationStorageKey(){return this.addStorageKeyPostfix(cgi)}async getTunnelRestoreValue(){let e=this.storageService.get(nMt,1);if(e)return this.storageService.remove(nMt,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=Ib(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(Tp(o.remoteHost,o.remotePort),o)}}}if(this.restoreComplete=!0,this.onRestoreComplete.fire(),!this.restoreListener){let e=await this.getTunnelRestoreStorageKey();this.restoreListener=this._register(new P),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(cgi));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(cgi,nMt);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()+vGo,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()+fGo>n.getTime())return;this.mismatchCooldown=n;let r=d(17194,null,t,e.tunnelRemotePort,e.tunnelLocalPort);return this.dialogService.info(r)}async forward(e,t){return!this.restoreComplete&&this.environmentService.remoteAuthority&&await H.toPromise(this.onRestoreComplete.event),this.doForward(e,t)}async doForward(e,t){await this.extensionService.activateByEvent(Wto);let o=Ib(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=Tp(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=Ib(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??dgi,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 Ib(this.remoteTunnels,t.remote.host,t.remote.port)}async name(e,t,o){let n=Ib(this.forwarded,e,t),r=Tp(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=Tp(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=Tp(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=Ib(this._candidates??new Map,t.remoteAddress.host,t.remoteAddress.port),n=typeof t.localAddress=="string"?t.localAddress:Tp(t.localAddress.host,t.localAddress.port);this.detected.set(Tp(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(17198,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=Tp(n.host,n.port);o.set(r,{host:n.host,port:n.port,detail:n.detail,pid:n.pid}),t.delete(r);let s=Ib(this.forwarded,n.host,n.port);s&&(s.runningProcess=n.detail,s.hasRunningProcess=!0,s.pid=n.pid)}),t.forEach((n,r)=>{let s=W9e(r);if(!s)return;let l=Ib(this.forwarded,s.host,s.port);l&&(l.runningProcess=void 0,l.hasRunningProcess=!1,l.pid=void 0);let c=Ib(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=Ib(this._candidates??new Map,_Te[0],u.port)??u;if(p){o.set(u.port,p);let h=bGo(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,ve.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??rMt.providedActionToAction(h?.autoForwardAction),requireLocalPort:p?.requireLocalPort,protocol:p?.protocol})}),c}addAttributesProvider(e){this.portAttributesProviders.push(e)}};I([Nd(1e3)],zde.prototype,"storeForwarded",1),zde=I([m(0,ap),m(1,le),m(2,B),m(3,Vt),m(4,Mc),m(5,Pe),m(6,ne),m(7,ct),m(8,lt),m(9,X)],zde);var Gd=ae("remoteExplorerService"),B9e="remote.explorerType",P5="~remote.forwardedPorts",aMt="~remote.forwardedPortsContainer",A5="remote.autoForwardPorts",q_="remote.autoForwardPortsSource",H9e="remote.autoForwardPortsFallback",Jz="process",QX="output",LTe="hybrid";var SGo={type:"object",required:["id"],properties:{id:{description:d(17186,null),type:"string"}}},IGo=Tn.registerExtensionPoint({extensionPoint:"remoteHelp",jsonSchema:{description:d(17187,null),type:"object",properties:{getStarted:{description:d(17191,null),oneOf:[{type:"string"},SGo]},documentation:{description:d(17188,null),type:"string"},feedback:{description:d(17189,null),type:"string",markdownDeprecationMessage:d(17190,null,"`reportIssue`")},reportIssue:{description:d(17193,null),type:"string"},issues:{description:d(17192,null),type:"string"}}}});var V9e=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(zde),IGo.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(B9e,this._targetType.toString(),1,1),this.storageService.store(B9e,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}};V9e=I([m(0,le),m(1,ap),m(2,F)],V9e);we(Gd,V9e,1);var lMt=class extends C{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(Zi.ExtHostTunnelService),this._register(o.onTunnelOpened(()=>this._proxy.$onDidTunnelsChange())),this._register(o.onTunnelClosed(()=>this._proxy.$onDidTunnelsChange()))}processFindingEnabled(){return(!!this.configurationService.getValue(A5)||this.tunnelService.hasTunnelProvider)&&this.configurationService.getValue(q_)!==QX}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(A5)||t.affectsConfiguration(q_)))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),oMt.fromServiceTunnel(o)}async elevationPrompt(e,t,o){return this.notificationService.prompt(St.Info,d(3060,null,o,e.remoteAddress.port,e.localAddressPort),[{label:d(3061,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:Tp(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(Kde.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:{oe.as(ii.Configuration).registerDefaultConfigurations([{overrides:{"remote.autoForwardPorts":!1}}]);break}case 2:{oe.as(ii.Configuration).registerDefaultConfigurations([{overrides:{"remote.autoForwardPortsSource":QX}}]);break}case 3:{oe.as(ii.Configuration).registerDefaultConfigurations([{overrides:{"remote.autoForwardPortsSource":LTe}}]);break}default:}}).catch(()=>{})}};lMt=I([vo(Gi.MainThreadTunnelService),m(1,Gd),m(2,ap),m(3,Ne),m(4,B),m(5,ne),m(6,yo),m(7,X)],lMt);var OP=ae("IAuthenticationUsageService"),U9e=class extends C{constructor(e,t,o,n){super();this._storageService=e;this._authenticationService=t;this._logService=o;this._queue=this._register(new Op);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)}}};U9e=I([m(0,le),m(1,Cs),m(2,ne),m(3,nt)],U9e);we(OP,U9e,1);var mgi="/.well-known",oPl=`${mgi}/oauth-protected-resource`,nPl=`${mgi}/oauth-authorization-server`,rPl=`${mgi}/openid-configuration`;function Hto(a){if(typeof a!="object"||a===null)return!1;let i=a;return i.access_token!==void 0&&i.token_type!==void 0}function hgi(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 cMt(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 ggi(a){return`onAuthenticationRequest:${a}`}async function RTe(a,i){let e=await a.get(`${i.urlProtocol}.loginAccount`);if(e)try{let t=JSON.parse(e);if(t&&Ae(t.id)&&Ae(t.accessToken)&&Ae(t.providerId))return t}catch(t){console.error(`Failed parsing current auth session value: ${t}`)}}var wGo={type:"object",additionalProperties:!1,properties:{id:{type:"string",description:d(16648,null)},label:{type:"string",description:d(16650,null)},authorizationServerGlobs:{type:"array",items:{type:"string",description:d(16646,null)},description:d(16647,null)}}},CGo=Tn.registerExtensionPoint({extensionPoint:"authentication",jsonSchema:{description:d(16653,null),type:"array",items:wGo},activationEventsGenerator:function*(a){for(let i of a)i.id&&(yield`onAuthenticationRequest:${i.id}`)}}),z9e=class extends C{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 jt);this._dynamicAuthenticationProviderIds=new Set;this._delegates=[];this._disposedSource=new $e;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(CGo.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(Jl(s.id)){r.collector.error(d(16651,null));continue}if(Jl(s.label)){r.collector.error(d(16652,null));continue}this.declaredProviders.some(l=>l.id===s.id)?r.collector.error(d(16649,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(Jl(e.id))throw new Error(d(16651,null));if(Jl(e.label))throw new Error(d(16652,null));if(this.declaredProviders.some(t=>t.id===e.id))throw new Error(d(16649,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 P;o.add(t.onDidChangeSessions(n=>this._onDidChangeSessions.fire({providerId:e,label:t.label,event:n}))),Ac(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(Ece(t)){if(!r.getSessionsFromChallenges)throw new Error(`The authentication provider '${e}' does not support getting sessions from challenges.`);return await r.getSessionsFromChallenges({challenges:hgi(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(Ece(t)){if(!n.createSessionFromChallenges)throw new Error(`The authentication provider '${e}' does not support creating sessions from challenges.`);return await n.createSessionFromChallenges({challenges:hgi(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=>Cp(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(!mr(r,n))return!1}if(e.authorizationServers){let n=t.toString(!0);for(let r of e.authorizationServers){let s=r.toString(!0);if(mr(s,n)||Cp(s,n,{ignoreCase:!0}))return!0}}return!1}async tryActivateProvider(e,t){await this._extensionService.activateByEvent(ggi(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 P;try{let r=await Wp(wa(H.toPromise(H.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()}}};z9e=I([m(0,lt),m(1,Gx),m(2,ru),m(3,ne)],z9e);we(Cs,z9e,1);var YX=ae("dynamicAuthenticationProviderStorageService");var uMt=class extends C{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)}},fgi=class extends uMt{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)}},dMt=class extends C{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 jt);this._sentProviderUsageEvents=new Set;this._suppressUnregisterEvent=!1;this._sentClientIdUsageEvents=new Set;this._proxy=e.getProxy(Zi.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),N=await this.dynamicAuthProviderStorageService.getClientRegistration(T),O=N?.clientId,V=N?.clientSecret,U;return O?U=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,U)}}))}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 fgi(this._proxy,e,t,o,c,n?A.revive(n):void 0,l):new uMt(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(ggi(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 Go,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 Wp(t.p,300*1e3))throw new Error("Timed out waiting for URI handler");return await t.p}$showContinueNotification(e){let t=d(3002,null),o=d(3001,null),n=new Go,r=!1,l=this.notificationService.prompt(gt.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(2987,null,t,e.label):d(2986,null,t,e.label);let l=[{label:d(2979,null),run(){return!0}}];n?.learnMore&&l.push({label:d(2999,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:gt.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(2996,null),detail:d(2997,null,e,t),type:gt.Warning,cancelButton:!0,buttons:[{label:d(2998,null,e),run:()=>e},{label:d(3000,null,t),run:()=>t}]});if(!o.result)throw new ho;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=Ece(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:gt.Info,message:d(2994,null),detail:d(2993,null,e,t),buttons:[{label:d(2988,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(2995,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:gt.Info,message:d(2991,null),detail:d(2992,null,e,t),buttons:[{label:d(2989,null),run:async()=>{try{await this.clipboardService.writeText(t)}catch{this.notificationService.error(d(2990,null))}return!0}}],cancelButton:{label:d(2980,null),run:()=>!1}}))return;let n=d(2978,null),r=await this.quickInputService.input({title:n,prompt:d(2982,null),placeHolder:d(2981,null),ignoreFocusLost:!0,validateInput:async l=>{if(!l||l.trim().length===0)return d(2983,null)}});if(!r||r.trim().length===0)return;let s=await this.quickInputService.input({title:n,prompt:d(2985,null,r),placeHolder:d(2984,null),password:!0,ignoreFocusLost:!0});return{clientId:r.trim(),clientSecret:s?.trim()||void 0}}};dMt=I([vo(Gi.MainThreadAuthentication),m(1,nt),m(2,Cs),m(3,DY),m(4,Gx),m(5,OP),m(6,ct),m(7,Ne),m(8,lt),m(9,Te),m(10,Qe),m(11,ne),m(12,nI),m(13,YX),m(14,Wi),m(15,Ge)],dMt);var pMt="timeline",xGo="timeline",Zz=ae(xGo);var mMt=class{constructor(i,e,t){this.logService=e;this._timelineService=t;this._providerEmitters=new Map;this._proxy=i.getProxy(Zi.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 Xn(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(){}};mMt=I([vo(Gi.MainThreadTimeline),m(1,ne),m(2,Zz)],mMt);var Uto=0,hMt=class{constructor(i,e,t,o){this.result=i;this.fromTaskId=e;this.uriIdentityService=t;this.accessor=o;this.fileCoverage=new vt;this.didAddCoverage=Wc(this);this.tree=new EP;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 N5(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=Xi(i);c.id=String(Uto++),c.uri=this.treePathToUri(r.slice(0,s.length)),l.value=new fMt(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 EP;for(let t of this.tree.values())if(t instanceof N5){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 K9e(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("/")})}},Gde=(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},gMt=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 Gde(this.statement,this.branch,this.declaration)}},fMt=class extends gMt{},K9e=class extends fMt{constructor(i,e){super({id:String(Uto++),uri:i,statement:{covered:0,total:0}},e)}},N5=class extends gMt{constructor(e,t,o){super(e,t);this.accessor=o}get hasSynchronousDetails(){return this._details instanceof Array||this.resolved}async detailsForTest(e,t=ve.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=ve.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 kGo={deserialize:a=>JSON.parse(a),serialize:a=>JSON.stringify(a)},dS=class extends C{constructor(e,t){super();this.storage=t;this.key=e.key,this.scope=e.scope,this.target=e.target,this.serialization=e.serialization??kGo,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)}};dS=I([m(1,le)],dS);var EGo={6:d(15347,null),4:d(15348,null),3:d(15349,null),1:d(15350,null),2:d(15351,null),5:d(15352,null),0:d(15353,null)},vMt=(a,i)=>d(15346,null,fu(a),EGo[i]),bMt={4:d(15344,null),2:d(15345,null),8:d(15343,null)};var Ji;(Ze=>(Ze.providerCount=new Q("testing.providerCount",0),Ze.canRefreshTests=new Q("testing.canRefresh",!1,{type:"boolean",description:d(15369,null)}),Ze.isRefreshingTests=new Q("testing.isRefreshing",!1,{type:"boolean",description:d(15385,null)}),Ze.isContinuousModeOn=new Q("testing.isContinuousModeOn",!1,{type:"boolean",description:d(15382,null)}),Ze.hasDebuggableTests=new Q("testing.hasDebuggableTests",!1,{type:"boolean",description:d(15376,null)}),Ze.hasRunnableTests=new Q("testing.hasRunnableTests",!1,{type:"boolean",description:d(15380,null)}),Ze.hasCoverableTests=new Q("testing.hasCoverableTests",!1,{type:"boolean",description:d(15374,null)}),Ze.hasNonDefaultProfile=new Q("testing.hasNonDefaultProfile",!1,{type:"boolean",description:d(15378,null)}),Ze.hasConfigurableProfile=new Q("testing.hasConfigurableProfile",!1,{type:"boolean",description:d(15373,null)}),Ze.supportsContinuousRun=new Q("testing.supportsContinuousRun",!1,{type:"boolean",description:d(15390,null)}),Ze.isParentRunningContinuously=new Q("testing.isParentRunningContinuously",!1,{type:"boolean",description:d(15384,null)}),Ze.activeEditorHasTests=new Q("testing.activeEditorHasTests",!1,{type:"boolean",description:d(15366,null)}),Ze.cursorInsideTestRange=new Q("testing.cursorInsideTestRange",!1,{type:"boolean",description:d(15372,null)}),Ze.isTestCoverageOpen=new Q("testing.isTestCoverageOpen",!1,{type:"boolean",description:d(15386,null)}),Ze.hasCoverageInFile=new Q("testing.hasCoverageInFile",!1,{type:"boolean",description:d(15375,null)}),Ze.hasPerTestCoverage=new Q("testing.hasPerTestCoverage",!1,{type:"boolean",description:d(15379,null)}),Ze.hasInlineCoverageDetails=new Q("testing.hasInlineCoverageDetails",!1,{type:"boolean",description:d(15377,null)}),Ze.isCoverageFilteredToTest=new Q("testing.isCoverageFilteredToTest",!1,{type:"boolean",description:d(15383,null)}),Ze.coverageToolbarEnabled=new Q("testing.coverageToolbarEnabled",!0,{type:"boolean",description:d(15371,null)}),Ze.inlineCoverageEnabled=new Q("testing.inlineCoverageEnabled",!1,{type:"boolean",description:d(15381,null)}),Ze.canGoToRelatedCode=new Q("testing.canGoToRelatedCode",!1,{type:"boolean",description:d(15367,null)}),Ze.canGoToRelatedTest=new Q("testing.canGoToRelatedTest",!1,{type:"boolean",description:d(15368,null)}),Ze.peekHasStack=new Q("testing.peekHasStack",!1,{type:"boolean",description:d(15387,null)}),Ze.capabilityToContextKey={2:Ze.hasRunnableTests,8:Ze.hasCoverableTests,4:Ze.hasDebuggableTests,16:Ze.hasNonDefaultProfile,32:Ze.hasConfigurableProfile,64:Ze.supportsContinuousRun},Ze.hasAnyResults=new Q("testing.hasAnyResults",!1),Ze.viewMode=new Q("testing.explorerViewMode","list"),Ze.viewSorting=new Q("testing.explorerViewSorting","location"),Ze.isRunning=new Q("testing.isRunning",!1),Ze.isInPeek=new Q("testing.isInPeek",!1),Ze.isPeekVisible=new Q("testing.isPeekVisible",!1),Ze.peekItemType=new Q("peekItemType",void 0,{type:"string",description:d(15388,null)}),Ze.controllerId=new Q("controllerId",void 0,{type:"string",description:d(15370,null)}),Ze.testItemExtId=new Q("testId",void 0,{type:"string",description:d(15391,null)}),Ze.testItemHasUri=new Q("testing.testItemHasUri",!1,{type:"boolean",description:d(15392,null)}),Ze.testItemIsHidden=new Q("testing.testItemIsHidden",!1,{type:"boolean",description:d(15393,null)}),Ze.testMessageContext=new Q("testMessage",void 0,{type:"string",description:d(15394,null)}),Ze.testResultOutdated=new Q("testResultOutdated",void 0,{type:"boolean",description:d(15395,null)}),Ze.testResultState=new Q("testResultState",void 0,{type:"string",description:d(15396,null)}),Ze.testProfileContextGroup=new Q("testing.profile.context.group",void 0,{type:"string",description:d(15389,null)})))(Ji||={});var $d=ae("testProfileService"),hR=(a,i)=>a.controllerId===i.controllerId&&(Pr.isRoot(i.item.extId)||!a.tag||i.item.tags.includes(a.tag)),vgi=(a,i)=>a.isDefault!==i.isDefault?a.isDefault?-1:1:a.label.localeCompare(i.label),SMt=a=>[[Ji.hasRunnableTests.key,(a&2)!==0],[Ji.hasDebuggableTests.key,(a&4)!==0],[Ji.hasCoverableTests.key,(a&8)!==0]],MTe=class extends C{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 dS({key:"testingPreferredProfiles2",scope:1,target:1},t)),this.capabilitiesContexts={2:Ji.hasRunnableTests.bindTo(e),4:Ji.hasDebuggableTests.bindTo(e),8:Ji.hasCoverableTests.bindTo(e),16:Ji.hasNonDefaultProfile.bindTo(e),32:Ji.hasConfigurableProfile.bindTo(e),64:Ji.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(vgi)):(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(vgi),o.isDefault!==void 0){let s=Xi(this.userDefaults.get({}));bgi(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(Pr.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||[]:[...ht.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&&bgi(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&&bgi(o,r,s.isDefault)}n.profiles.sort(vgi)}this.userDefaults.store(o),this.changeEmitter.fire()}getDefaultProfileForTest(e,t){return this.getControllerProfiles(t.controllerId).find(o=>(o.group&e)!==0&&hR(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 eZi)this.capabilitiesContexts[t].set((e&t)!==0)}};MTe=I([m(0,X),m(1,le)],MTe);var bgi=(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 FP={2:6,6:5,4:4,1:3,3:2,0:0,5:1},ak=a=>a===6||a===4,Gto=a=>a===6||a===4||a===3,WNl=iSe(FP,(a,i)=>({statusNode:!0,state:Number(i),priority:a})),G9e=(a,i)=>FP[i]-FP[a],PTe=(...a)=>{switch(a.length){case 0:return 0;case 1:return a[0];case 2:return FP[a[0]]>FP[a[1]]?a[0]:a[1];default:{let i=a[0];for(let e=1;e<a.length;e++)FP[i]<FP[a[e]]&&(i=a[e]);return i}}},$9e=Object.keys(FP).map(a=>Number(a)).sort(G9e),Sgi={3:0,5:1,4:2,6:3},q9e=()=>new Uint32Array($9e.length);var TGo=a=>"getOwnDuration"in a,Igi=(a,i,e=!1)=>{let t=a.getCurrentComputedState(i);if(t===void 0||e){t=a.getOwnState(i)??0;let o=0,n=q9e();for(let r of a.getChildren(i)){let s=Igi(a,r);o++,n[s]++,t=s===5&&t===0?5:PTe(t,s)}o>_Go&&qto.set(i,n),a.setComputedState(i,t)}return t},$to=(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=$to(a,n);r!==void 0&&(t=(t||0)+r)}}a.setComputedDuration(i,t)}return t},_Go=64,qto=new WeakMap,$de=(a,i,e,t=!0)=>{let o=a.getCurrentComputedState(i),n=FP[o],r=e??Igi(a,i,!0),s=FP[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=qto.get(p);h&&(h[c]--,h[u]++);let g=a.getCurrentComputedState(p);if(s>n){if(g!==void 0&&FP[g]>=s||h&&h[u]>1)break;a.setComputedState(p,r),l.add(p)}else{if(g===void 0||FP[g]>n||h&&h[c]>0)break;u=Igi(a,p,!0),a.setComputedState(p,u),l.add(p)}c=g}}if(TGo(a)&&t)for(let c of ht.concat(ht.single(i),a.getParents(i))){let u=a.getCurrentComputedDuration(c),p=$to(a,c,!0);if(u===p)break;a.setComputedDuration(c,p),l.add(c)}return l};var DGo={buffers:[],length:0,onDidWriteData:H.None,endPromise:Promise.resolve(),getRange:()=>Je.alloc(0),getRangeIter:()=>[]},ygi=class{constructor(){this.writeDataEmitter=new E;this.endDeferred=new Go;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=Je.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=Je.fromString(jto(e,!0)),s=Je.fromString(jto(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()}},Qto=function*(a,i){for(let e of Pr.fromString(i.item.extId).idsToRoot())yield a.getStateById(e.toString())},Yto=a=>{for(let i of $9e)if(a[i]>0)return i;return 0},jto=(a,i)=>`\x1B]633;SetMark;Id=${f6e(a,i)};Hidden\x07`,LGo=(a,i,e)=>({controllerId:a,expand:0,item:{...i},children:[],tasks:[],ownComputedState:0,computedState:0});var Ih=class extends C{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(15402,null,new Date().toLocaleString(Dr));this.counts=q9e();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=Pr.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(v6e.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(v6e.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:Le(this,void 0),otherMessages:[],output:new ygi});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=Sgi[r.tasks[s].state],c=Sgi[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(Pr.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=PTe(...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]++,$de(this.computedStateAccessor,e).forEach(u=>this.changeEmitter.fire(u===e?l:{item:u,result:this,reason:0}))}addTestToRun(e,t,o){let n=LGo(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}};Ih=I([m(4,Te)],Ih);var IMt=class{constructor(i,e,t=!0){this.serialized=e;this.persist=t;this.counts=q9e();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(15403,null),ctrlId:o.ctrlId,running:!1,coverage:Le(this,void 0),output:DGo,otherMessages:[]})),this.name=e.name,this.request=e.request;for(let o of e.items){let n=v6e.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 wgi=128,RGo=16,MGo=1024*128,PGo=.2,wMt=ae("ITestResultStorage"),yMt=1,j9e=class extends C{constructor(e,t,o){super();this.uriIdentityService=e;this.logService=o;this.stored=this._register(new dS({key:"storedTestResults",scope:1,target:1},t))}async read(){let e=await Promise.all(this.stored.get([]).map(async o=>{if(o.rev===yMt)try{let n=await this.readForResultId(o.id);return n?{rec:o,result:new IMt(this.uriIdentityService,n)}:void 0}catch(n){this.logService.warn(`Error deserializing stored test result ${o.id}`,n);return}})),t=e.filter(mo);return t.length!==e.length&&this.stored.store(t.map(({rec:o})=>o)),t.map(({result:o})=>o)}getResultOutputWriter(e){let t=Obe();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=MGo;for(let s=0;s<e.length&&s<wgi&&(r>0||o.length<RGo);s++){let l=e[s],c=t.get(l.id);if(c!==void 0){t.delete(l.id),o.push({id:l.id,rev:yMt,bytes:c}),r-=c;continue}let u=l.toJSON();if(!u)continue;let p=Je.fromString(JSON.stringify(u));n.push(this.storeForResultId(l.id,u)),o.push({id:l.id,rev:yMt,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)}};j9e=I([m(0,dt),m(1,le),m(2,ne)],j9e);var ATe=class extends j9e{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),Je.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 Je.alloc(0)}}async readOutputForResultId(e){try{let{value:t}=await this.fileService.readFileStream(this.getResultOutputPath(e));return t}catch{return WT(Je.alloc(0))}}async storeOutputForResultId(e,t){await this.fileService.createFile(this.getResultOutputPath(e),t)}async persist(e){await super.persist(e),Math.random()<PGo&&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===yMt).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`)}};ATe=I([m(0,dt),m(1,le),m(2,ne),m(3,Pe),m(4,be),m(5,Co)],ATe);var AGo=a=>a.results.length>0&&a.results[0].completedAt===void 0,ed=ae("testResultService"),NTe=class extends C{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=wd(()=>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(()=>Ue(this._resultsDisposables))),this.isRunning=Ji.isRunning.bindTo(e),this.hasAnyResults=Ji.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=_t();return this.push(new Ih(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 Ih(e.id,e.persist,o,this.insertOrderCounter++,this.telemetryService))}push(e){if(e.completedAt===void 0)this.results.unshift(e);else{let o=xy(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>wgi&&(this.results.pop(),this._resultsDisposables.pop()?.dispose());let t=new P;if(this._resultsDisposables.push(t),e instanceof Ih)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 Ih?e.insertOrder:-1;return(t instanceof Ih?t.insertOrder:-1)-o})}updateIsRunning(){this.isRunning.set(AGo(this))}async persistImmediately(){await this.loadResults(),this.storage.persist(this.results)}};NTe=I([m(0,X),m(1,wMt),m(2,$d),m(3,Te)],NTe);var Es=ae("testService"),Xto=a=>!ht.some(a.rootItems,i=>i.children.size>0),Jto=(a,i)=>{if(typeof i=="string"&&(i=Pr.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},Zto=async(a,i,e=ve.None)=>{let t=[...Pr.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}},Q9e=(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())})})},qde=async function*(a,i,e,t=!0,o=!0){let n=new Vs,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 Go?c.isSettled?u=c.value||ht.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(()=>Q9e(a,h)):h.item.busy&&(g=Q9e(a,h))),g?n.push(Go.fromPromise(g.then(()=>h.children))):h.children.size&&n.push(h.children)}}}}l.length&&(yield l)},eio=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 Q9e(a,r),o.push(r.children.values())))}},tio=(a,i)=>{if(i.length<2)return i;let e=new EP;for(let n of i)e.insert(Pr.fromString(n.item.extId).path,n);let t=[],o=(n,r)=>{if(r.value)return r.value;Ey(!!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 Pr(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 CMt=class extends C{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(Zi.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(H.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 Ih&&this.proxy.$disposeRun(l.id)})}))}$markTestRetired(e){let t;if(e){t=new EP;for(let o of e)t.insert(Pr.fromString(o).path,void 0)}for(let o of this.resultService.results)o instanceof Ih&&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=>g6e.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=ypi.deserialize(this.uriIdentityService,o);Ui(l=>{let c=r.coverage.read(void 0);c?c.append(s,l):(c=new hMt(n,t,this.uriIdentityService,{getCoverageDetails:(u,p,h)=>this.proxy.$getCoverageDetails(u,p,h).then(g=>g.map(xpi.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 Ih)for(let s of n)r.appendMessage(o,t,XO.deserialize(this.uriIdentityService,s))}$registerTestController(e,t,o){let n=new P,r=Le(`${e}.label`,t),s=Le(`${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&&Ui(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(RDt.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=>RDt.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 Ih?t(o):void 0}};CMt=I([vo(Gi.MainThreadTesting),m(1,dt),m(2,Es),m(3,$d),m(4,ed)],CMt);var xMt=class extends C{constructor(e,t,o,n){super();this.secretStorageService=t;this.logService=o;this._sequencer=new NT;this._proxy=e.getProxy(Zi.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}}};xMt=I([vo(Gi.MainThreadSecretState),m(1,LE),m(2,ne),m(3,ru)],xMt);var OTe=ae("shareService");var kMt=class{constructor(i,e){this.shareService=e;this.providers=new Map;this.providerDisposables=new Map;this.proxy=i.getProxy(Zi.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,ve.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(),Ue(this.providerDisposables.values()),this.providerDisposables.clear()}};kMt=I([vo(Gi.MainThreadShare),m(1,OTe)],kMt);var EMt=class extends C{constructor(e,t){super();this.userDataProfileImportExportService=t;this.registeredHandlers=this._register(new jt);this.proxy=e.getProxy(Zi.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?Xn(c):null},readProfile:async(r,s)=>this.proxy.$readProfile(e,r,s)}))}async $unregisterProfileContentHandler(e){this.registeredHandlers.deleteAndDispose(e)}};EMt=I([vo(Gi.MainThreadProfileContentHandlers),m(1,PV)],EMt);var FTe=ae("IAiRelatedInformationService");var TMt=class extends C{constructor(e,t){super();this._aiRelatedInformationService=t;this._registrations=this._register(new jt);this._proxy=e.getProxy(Zi.ExtHostAiRelatedInformation)}$getAiRelatedInformation(e,t){return this._aiRelatedInformationService.getRelatedInformation(e,t,ve.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)}};TMt=I([vo(Gi.MainThreadAiRelatedInformation),m(1,FTe)],TMt);var Cgi=ae("IAiEmbeddingVectorService"),jde=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=En.create(),o=[],n=Pi(jde.DEFAULT_TIMEOUT),r=e.onCancellationRequested(()=>{r.dispose(),n.cancel()});for(let s of this._providers)o.push(xn(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(xn(async s=>{let l=s.onCancellationRequested(()=>{n.cancel(),l.dispose()});throw await n,new Error("Embedding vector provider timed out")}));try{let s=await Dre(o);return s.length===1?s[0]:s}finally{t.stop(),this.logService.trace(`[AiEmbeddingVectorService]: getEmbeddingVector took ${t.elapsed()}ms`)}}};jde=I([m(0,ne)],jde);we(Cgi,jde,1);var _Mt=class extends C{constructor(e,t){super();this._AiEmbeddingVectorService=t;this._registrations=this._register(new jt);this._proxy=e.getProxy(Zi.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)}};_Mt=I([vo(Gi.MainThreadAiEmbeddingVector),m(1,Cgi)],_Mt);var DMt=class extends C{constructor(e,t){super();this._settingsSearchService=t;this._registrations=this._register(new jt);this._proxy=e.getProxy(Zi.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)}};DMt=I([vo(Gi.MainThreadAiSettingsSearch),m(1,dEe)],DMt);var WTe=ae("IWorkbenchMcpGatewayService");var md=ae("mcpRegistry");var Qde=ae("IAuthenticationMcpAccessService"),Y9e=class extends C{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})}};Y9e=I([m(0,le),m(1,nt)],Y9e);we(Qde,Y9e,1);var zl=ae("activityService"),X9e=class{constructor(i,e){this.descriptorFn=i;this.stylesFn=e}getDescription(){return this.descriptorFn(null)}getColors(i){return this.stylesFn?.(i)}},qc=class extends X9e{constructor(e,t){super(t,void 0);this.number=e;this.number=e}getDescription(){return this.descriptorFn(this.number)}},eK=class extends X9e{constructor(e,t,o){super(t,o);this.icon=e}},PC=class extends X9e{constructor(i){super(i,void 0)}},J9e=class extends eK{constructor(i){super(M.warning,i,e=>({badgeBackground:e.getColor(q2i),badgeForeground:e.getColor($2i),badgeBorder:void 0}))}};var Yde=ae("IAuthenticationMcpUsageService"),Z9e=class extends C{constructor(e,t,o,n){super();this._storageService=e;this._authenticationService=t;this._logService=o;this._queue=new Op;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)}}};Z9e=I([m(0,le),m(1,Cs),m(2,ne),m(3,nt)],Z9e);we(Yde,Z9e,1);var e7e=" ",i7e=ae("IAuthenticationMcpService"),t7e=class extends C{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(e7e);t.some(s=>cMt(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 qc(e,()=>d(16643,null));this._accountBadgeDisposable.value=this.activityService.showAccountsActivity({badge:t})}}removeAccessRequest(e,t){let o=this._sessionAccessRequestItems.get(e)||{};o[t]&&(Ue(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(e7e)}`;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(e7e)}`;return this.storageService.get(n,1)??this.storageService.get(n,-1)}removeSessionPreference(e,t,o){let n=`${t}-${e}-${o.join(e7e)}`;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:St.Info,message:d(16639,null,n,e.label,t),buttons:[{label:d(16638,null),run:()=>0},{label:d(16640,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 P,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(16645,null)}),c.items=p,c.title=d(16642,null,o,this._authenticationService.getProvider(e).label),c.placeholder=d(16641,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=fe.appendMenuItem(D.AccountsContext,{group:"3_accessRequests",command:{id:`${e}${t}Access`,title:d(16637,null,c.label,o)}}),p=qe.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(e7e);if(s&&s[l]&&s[l].requestingMcpServerIds.includes(o))return;let u=`${e}:${o}:signIn${Object.keys(s||[]).length}`,p=fe.appendMenuItem(D.AccountsContext,{group:"2_signInRequests",command:{id:u,title:d(16644,null,r.label,n)}}),h=qe.registerCommand({id:u,handler:async g=>{let v=await g.get(Cs).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()}};t7e=I([m(0,zl),m(1,le),m(2,ct),m(3,Ge),m(4,nt),m(5,Cs),m(6,Yde),m(7,Qde)],t7e);we(i7e,t7e,1);var LMt=class extends C{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 kgi;this._collectionDefinitions=this._register(new jt);this._gateways=this._register(new jt);this._register(n.onDidChangeSessions(b=>this._onDidChangeAuthSessions(b.providerId,b.label)));let f=this._proxy=e.getProxy(Zi.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,_P.toSerialized(S));return _P.fromSerialized(y)},start:(b,S,y,w)=>{let k=++this._serverIdCounter,T=new xgi(e.extensionHostKind,()=>f.$stopMcp(k),N=>f.$sendMessage(k,JSON.stringify(N)));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(he(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(CV.toSerialized(r))}this._proxy.$onDidChangeMcpServerDefinitions(t)}$upsertMcpCollection(e,t){let o=t.map(CV.fromSerialized),n=this._collectionDefinitions.get(e.id);if(n)n.servers.set(o,void 0);else{let r=Le("mcpServers",o),s=new Ei(e.extensionId),l=new P,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?_P.fromSerialized(f):void 0}):void 0,trustBehavior:e.isTrustedByDefault?nk.Kind.Trusted:nk.Kind.TrustedOnNonce,remoteAuthority:this._extHostContext.remoteAuthority,serverDefinitions:r})},p=DT(this._extensionService.extensions,g=>Ei.equals(s,g.identifier)?g.contributes?.mcpServerDefinitionProviders?.find(f=>p6e(s,f.id)===e.id)?.when:void 0),h=p&&x.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),ir.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 dw("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 dw("authentication");h=p.supportsMultipleAccounts?await this.authenticationMcpServersService.selectSession(o,t.id,t.label,n,l):l[0]}else{if(s)throw new dw("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(3044,null),detail:d(3045,null,e,t),type:gt.Warning,cancelButton:!0,buttons:[{label:d(3046,null,e),run:()=>e},{label:d(3047,null,t),run:()=>t}]});if(!o.result)throw new ho;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!==ir.Kind.Running))try{await this._getSessionForProvider(n,l,e,r,void 0,!0)}catch(u){dw.is(u)&&(s.pushLog(4,d(3048,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=_t();return this._gateways.set(t,e),{address:e.address,gatewayId:t}}$disposeMcpGateway(e){this._gateways.deleteAndDispose(e)}async loginPrompt(e,t,o){let n=o?d(3043,null,e,t):d(3042,null,e,t),r=[{label:d(3041,null),run(){return!0}}],{result:s}=await this.dialogService.prompt({type:gt.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()}};LMt=I([vo(Gi.MainThreadMcp),m(1,md),m(2,ct),m(3,Cs),m(4,i7e),m(5,Qde),m(6,Yde),m(7,YX),m(8,lt),m(9,X),m(10,Te),m(11,WTe)],LMt);var xgi=class extends C{constructor(e,t,o){super();this.stop=t;this.send=o;this.state=Le("mcpServerState",{state:ir.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(nn(()=>{this.pushLog(3,`Starting server from ${kP(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(){ir.isRunning(this.state.get())&&(this.pushLog(4,"Extension host shut down, server will stop."),this.state.set({state:ir.Kind.Stopped},void 0)),this.dispose()}dispose(){ir.isRunning(this.state.get())&&this.stop(),super.dispose()}},kgi=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 iio(a){return yi(a)&&typeof a.asAttachment=="function"}function Xde(a){return(i,e)=>Ce(o=>{let n=i.read(o),r=new $e(e);return o.store.add(Z(()=>r.dispose(!0))),new Au(a(n,r.token))}).map((o,n)=>{let r=o.promiseResult.read(n);return{picks:r?.data||[],busy:r===void 0}})}var uS=ae("IContextPickService"),RMt=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?Al(e.label,t.label):o<n?1:-1}),Z(()=>{let e=this._picks.indexOf(i);e>=0&&this._picks.splice(e,1)})}};var Q_=ae("chatContextService"),o7e=class extends C{constructor(e,t){super();this._contextPickService=e;this._extensionService=t;this._providers=new Map;this._workspaceContext=new Map;this._registeredPickers=this._register(new jt);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?Ye(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=jW(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,ve.None);if(!s)return;let l=s.resourceUri??e,u={value:void 0,name:s.label??Ye(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,ve.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(ve.None)||[])().then(c=>c.map(u=>({label:u.label??(u.resourceUri?Ye(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,ve.None));let g=h.label??(h.resourceUri?Ye(h.resourceUri):"Unknown");return{kind:"generic",id:g,name:g,icon:h.icon,value:h.value}}}))),placeholder:e}},type:"pickerPick",label:e,icon:t}}};o7e=I([m(0,uS),m(1,lt)],o7e);we(Q_,o7e,1);function PMt(a){return{...a,resourceUri:a.resourceUri?A.revive(a.resourceUri):void 0}}function Egi(a){return a.map(PMt)}var MMt=class extends C{constructor(e,t){super();this._chatContextService=t;this._providers=new Map;this._proxy=e.getProxy(Zi.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 Egi(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 Egi(n)},resolveChatContext:async(o,n)=>{let r=await this._proxy.$resolveExplicitChatContext(e,o,n);return PMt(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?PMt(l):void 0},resolveChatContext:async(n,r)=>{let s=await this._proxy.$resolveResourceChatContext(e,n,r);return PMt(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,Egi(t))}$executeChatContextItemCommand(e){return this._proxy.$executeChatContextItemCommand(e)}};MMt=I([vo(Gi.MainThreadChatContext),m(1,Q_)],MMt);var em=ae("chatDebugService");var AMt=class extends C{constructor(e,t){super();this._chatDebugService=t;this._providerDisposables=new Map;this._activeSessionResources=new Map;this._proxy=e.getProxy(Zi.ExtHostChatDebug)}$registerChatDebugLogProvider(e){let t=new P;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)=>this._proxy.$resolveChatDebugLogEvent(e,o,n)}))}$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)}_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}}}};AMt=I([vo(Gi.MainThreadChatDebug),m(1,em)],AMt);var n7e=ae("chatStatusItemService"),Tgi=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()}};we(n7e,Tgi,1);var NMt=class extends C{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)}};NMt=I([vo(Gi.MainThreadChatStatus),m(1,n7e)],NMt);function FV(a){return a?a instanceof Array?a.length>0:a.files>0||a.insertions>0||a.deletions>0:!1}function JX(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 VTe(a){return a.providerType==="local"}function gR(a){let i=a;return A.isUri(i?.resource)&&typeof i.setArchived=="function"&&typeof i.setRead=="function"}function OMt(a){let i=a;return Array.isArray(i?.sessions)&&typeof i?.getSession=="function"}function hw(a){let i=a;return typeof i.section=="string"&&Array.isArray(i.sessions)}function FMt(a){if(typeof a=="object"&&a!==null){let i=a;return i.$mid===25&&typeof i.session=="object"&&i.session!==null}return!1}var _gi="agentSessionsOutput",NGo=d(5714,null);function OGo(a){switch(a){case 0:return"Failed";case 1:return"Completed";case 2:return"InProgress";case 3:return"NeedsInput";default:return`Unknown(${a})`}}var r7e=class extends C{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?(oe.as(sS.OutputChannels).removeChannel(_gi),this.isChannelRegistered=!1):!e&&!this.isChannelRegistered&&(oe.as(sS.OutputChannels).registerChannel({id:_gi,label:NGo,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: ${OGo(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=JX(s.changes);c&&n.push(`  Changes: ${c.files} files, +${c.insertions} -${c.deletions}`)}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(`    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(`  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(_gi);t&&t.append(`${e}
`)}};r7e=I([m(1,ne),m(2,Ml),m(3,vr)],r7e);var cF=class extends C{constructor(e,t,o,n,r,s,l,c){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._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.resolver=this._register(new ya(300));this.providersToResolve=new Set;this._sessions=new vt,this.cache=this.instantiationService.createInstance(tK);for(let u of this.cache.loadCachedSessions()){let p=this.toAgentSession(u);this._sessions.set(p.resource,p)}this.sessionStates=this.cache.loadSessionStates(),this.logger=this._register(this.instantiationService.createInstance(r7e,()=>({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(({chatSessionType:e})=>this.updateItems([e],ve.None))),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){if(Array.isArray(e))for(let t of e)this.providersToResolve.add(t);else this.providersToResolve.add(e);return this.resolver.trigger(async t=>{if(!(t.isCancellationRequested||this.lifecycleService.willShutdown))try{return this._onWillResolve.fire(),await this.doResolve(t)}finally{this._onDidResolve.fire()}})}async doResolve(e){let t=Array.from(this.providersToResolve);this.providersToResolve.clear();let o=t.includes(void 0)?void 0:si(t);await this.chatSessionsService.refreshChatSessionItems(o,e),await this.updateItems(o,e)}async updateItems(e,t){let o=new Map;for(let l of this.chatSessionsService.getAllChatSessionContributions())o.set(l.type,l);let n=await this.chatSessionsService.getChatSessionItems(e,t),r=new Set,s=new vt;for(let{chatSessionType:l,items:c}of n){if(r.add(l),t.isCancellationRequested)return;for(let u of c){let p,h,g=Rf(l);g!==void 0?(h=XS(g),p=A_(g)):(h=o.get(l)?.name??l,p=u.iconPath??M.terminal);let f=u.changes,v=f&&!(f instanceof Array)?{files:f.files,insertions:f.insertions,deletions:f.deletions}:f;s.set(u.resource,this.toAgentSession({providerType:l,providerLabel:h,resource:u.resource,label:u.label.split(`
`)[0],description:u.description,icon:p,badge:u.badge,tooltip:u.tooltip,status:u.status??1,archived:u.archived,timing:u.timing,changes:v,metadata:u.metadata}))}}for(let[,l]of this._sessions)!r.has(l.providerType)&&(gYi(l.providerType)||o.has(l.providerType))&&s.set(l.resource,l);this._sessions=s,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),isRead:()=>this.isRead(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()}isRead(e){if(this.isArchived(e))return!0;let t=this.sessionStates.get(e.resource)?.read;return t===cF.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=cF.UNREAD_MARKER,n.read===cF.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(cF.READ_DATE_BASELINE_KEY,1,0);return e>0||(e=this.productService.quality==="stable"?Date.now()-10080*60*1e3:Date.now(),this.storageService.store(cF.READ_DATE_BASELINE_KEY,e,1,1)),e}};cF=I([m(0,Ls),m(1,ao),m(2,F),m(3,le),m(4,nt),m(5,At),m(6,Pe),m(7,ns)],cF);var tK=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:t.status,archived:t.archived,timing:t.timing,changes:t.changes,metadata:t.metadata}));this.storageService.store(tK.SESSIONS_STORAGE_KEY,pU(e),1,1)}loadCachedSessions(){let i=this.storageService.get(tK.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??t.timing.startTime??0,lastRequestStarted:t.timing.lastRequestStarted??t.timing.startTime,lastRequestEnded:t.timing.lastRequestEnded??t.timing.endTime},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,read:o.read}));this.storageService.store(tK.STATE_STORAGE_KEY,JSON.stringify(e),1,1)}loadSessionStates(){let i=new vt,e=this.storageService.get(tK.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,read:o.read})}catch{}return i}};tK=I([m(0,le)],tK);var BTe=class extends C{constructor(e){super();this.instantiationService=e}get model(){return this._model||(this._model=this._register(this.instantiationService.createInstance(cF)),this._model.resolve(void 0)),this._model}getSession(e){return this.model.getSession(e)}};BTe=I([m(0,F)],BTe);var ia=ae("agentSessions");function ZX(a,i){if(i!==void 0)return typeof i=="function"?i(a):i}function fR(a){return RTt(a)&&(a={kind:"terminal",commandLine:{original:a.command,toolEdited:void 0,userEdited:void 0},language:a.language}),a}async function HTe(a){if(!a.editingSession)return;await Qj(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 Mn,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 dF=ae("chatTodoListService"),s7e=class{constructor(i){this.memento=new Bl("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 P_(i)}};s7e=I([m(0,le)],s7e);var UTe=class extends C{constructor(e){super();this._onDidUpdateTodos=this._register(new E);this.onDidUpdateTodos=this._onDidUpdateTodos.event;this.todoListStorage=new s7e(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)}};UTe=I([m(0,le)],UTe);var Dgi=class extends C{constructor(e,t,o,n,r){super();this._progressObservable=Le(this,[]);this._isCompleteObservable=Le(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}get progressObs(){return this._progressObservable}get isCompleteObs(){return this._isCompleteObservable}initialize(e){return this._initializationPromise||(this._initializationPromise=this._doInitializeContent(e)),this._initializationPromise}async _doInitializeContent(e){try{let t=await pm(this._proxy.$provideChatSessionContent(this._providerHandle,this.sessionResource,e),e);this._options=t.options,this.title=t.title,this.history.length=0,this.history.push(...t.history.map(s=>{if(s.type==="request"){let l=s.variableData?.variables.map(c=>({...c,value:Xn(c.value)}));return{type:"request",prompt:s.prompt,participant:s.participant,command:s.command,variableData:l?{variables:l}:void 0,id:s.id,modelId:s.modelId}}return{type:"response",parts:s.parts.map(l=>Xn(l)),participant:s.participant}})),t.hasActiveResponseCallback&&!this.interruptActiveResponseCallback&&(this.interruptActiveResponseCallback=async()=>{let s=()=>(this._disposalPending&&(this._proxy.$disposeChatSessionContent(this._providerHandle,this.sessionResource),this._disposalPending=!1),this._proxy.$interruptChatSessionActiveResponse(this._providerHandle,this.sessionResource,"ongoing"),!0);return t.supportsInterruption?s():this._dialogService.confirm({message:d(3004,null)}).then(l=>l.confirmed?s():(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))}),t.hasRequestHandler&&!this.requestHandler&&(this.requestHandler=async(s,l,c,u)=>{this._progressObservable.set([],void 0),this._isCompleteObservable.set(!1,void 0);let p=0,h=he(g=>{let f=this._progressObservable.read(g),v=this._isCompleteObservable.read(g);if(f.length>p){let b=f.slice(p);l(b),p=f.length}v&&h.dispose()});try{await this._proxy.$invokeChatSessionRequestHandler(this._providerHandle,this.sessionResource,s,c,u),!this._isCompleteObservable.get()&&!this.interruptActiveResponseCallback&&this._markComplete()}catch(g){let f={kind:"progressMessage",content:{value:`Error: ${g instanceof Error?g.message:String(g)}`,isTrusted:!1}};throw this._addProgress([f]),this._markComplete(),g}finally{h.dispose()}}),this._isInitialized=!0;let o=t.hasActiveResponseCallback,n=t.hasRequestHandler,r=o||n;for(let[s,l]of this._pendingProgressChunks)this._logService.debug(`Processing ${l.length} pending progress chunks for session ${this.sessionResource}, requestId ${s}`),this._addProgress(l);this._pendingProgressChunks.clear(),r||this._isCompleteObservable.set(!0,void 0)}catch(t){throw this._logService.error(`Failed to initialize chat session ${this.sessionResource}:`,t),t}}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)}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()}},Lgi=class extends C{constructor(e,t){super();this._onDidChangeChatSessionItems=this._register(new E);this.onDidChangeChatSessionItems=this._onDidChangeChatSessionItems.event;this._items=new vt;this._proxy=e,this._handle=t}get items(){return Array.from(this._items.values())}refresh(e){return this._proxy.$refreshChatSessionItems(this._handle,e)}async newChatSessionItem(e,t){let o=await pm(this._proxy.$newChatSessionItem(this._handle,e,t),t);if(!o)return;let n={...o,resource:A.revive(o.resource),changes:Xn(o.changes)};return this._items.set(n.resource,n),this._onDidChangeChatSessionItems.fire(),n}acceptChange(e){for(let t of e.addedOrUpdated)this._items.set(t.resource,t);for(let t of e.removed)this._items.delete(t);this._onDidChangeChatSessionItems.fire()}addOrUpdateItem(e){this._items.set(e.resource,e),this._onDidChangeChatSessionItems.fire()}fireOnDidChangeChatSessionItems(){this._onDidChangeChatSessionItems.fire()}},WMt=class extends C{constructor(e,t,o,n,r,s,l,c,u,p){super();this._extHostContext=e;this._agentSessionsService=t;this._chatSessionsService=o;this._chatService=n;this._chatWidgetService=r;this._chatTodoListService=s;this._dialogService=l;this._editorService=c;this.editorGroupService=u;this._logService=p;this._itemControllerRegistrations=this._register(new jt);this._contentProvidersRegistrations=this._register(new jt);this._sessionTypeToHandle=new Map;this._activeSessions=new vt;this._sessionDisposables=new vt;this._proxy=this._extHostContext.getProxy(Zi.ExtHostChatSessions),this._register(this._chatSessionsService.onRequestNotifyExtension(({sessionResource:h,updates:g,waitUntil:f})=>{let v=this._getHandleForSessionType(h.scheme);this._logService.trace(`[MainThreadChatSessions] onRequestNotifyExtension received: scheme '${h.scheme}', handle ${v}, ${g.length} update(s)`),v!==void 0?f(this.notifyOptionsChange(v,h,g)):this._logService.warn(`[MainThreadChatSessions] Cannot notify option change for scheme '${h.scheme}': no provider registered. Registered schemes: [${Array.from(this._sessionTypeToHandle.keys()).join(", ")}]`)})),this._register(this._agentSessionsService.model.onDidChangeSessionArchivedState(h=>{for(let[g,{chatSessionType:f}]of this._itemControllerRegistrations)f===h.providerType&&this._proxy.$onDidChangeChatSessionItemState(g,h.resource,h.isArchived())}))}_getHandleForSessionType(e){return this._sessionTypeToHandle.get(e)}$registerChatSessionItemController(e,t){let o=new P,n=o.add(new Lgi(this._proxy,e));o.add(this._chatSessionsService.registerChatSessionItemController(t,n)),this._itemControllerRegistrations.set(e,{chatSessionType:t,controller:n,dispose:()=>o.dispose()}),o.add(this._chatSessionsService.registerChatModelChangeListeners(this._chatService,t,()=>n.fireOnDidChangeChatSessionItems()))}getController(e){let t=this._itemControllerRegistrations.get(e);if(!t)throw new Error(`No chat session controller registered for handle ${e}`);return t.controller}$onDidChangeChatSessionItems(e){this.getController(e).fireOnDidChangeChatSessionItems()}async _resolveSessionItem(e){let t=A.revive(e.resource),o=this._chatService.getSession(t);if(o&&(e=await this.handleSessionModelOverrides(o,e)),!e.changes||!o){let n=(await this._chatService.getMetadataForSession(t))?.stats,r={files:n?.fileCount||0,insertions:n?.added||0,deletions:n?.removed||0};FV(r)&&(e.changes=r)}return{...e,changes:Xn(e.changes),resource:t,iconPath:e.iconPath,tooltip:e.tooltip?this._reviveTooltip(e.tooltip):void 0,archived:e.archived}}async $updateChatSessionItems(e,t){let o=this.getController(e),n=await Promise.all(t.addedOrUpdated.map(r=>this._resolveSessionItem(r)));o.acceptChange({addedOrUpdated:n,removed:t.removed.map(r=>A.revive(r))})}async $addOrUpdateChatSessionItem(e,t){let o=this.getController(e),n=await this._resolveSessionItem(t);o.addOrUpdateItem(n)}$onDidChangeChatSessionOptions(e,t,o){let n=A.revive(t);this._chatSessionsService.notifySessionOptionsChange(n,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);let p=this.editorGroupService.groups.find(v=>v.editors.some(b=>Xe(b.resource,n)))??this.editorGroupService.activeGroup,h={title:{preferred:l?.getName()||void 0,fallback:d(3003,null,u?.displayName)}},g=await this._chatSessionsService.getOrCreateChatSession(A.revive(r),ve.None);if(l){g.transferredState=l instanceof Va?{editingSession:l.transferOutEditingSession(),inputState:c?.object?.inputModel.toJSON()}:void 0,await this._editorService.replaceEditors([{editor:l,replacement:{resource:r,options:h}}],p);return}c&&(g.transferredState={editingSession:c.object.editingSession,inputState:c.object.inputModel.toJSON()});let f=this._chatWidgetService.getWidgetBySessionResource(n);f&&XI(f.viewContext)?await this._chatWidgetService.openSession(r,void 0,{preserveFocus:!0}):(await this._chatService.acquireOrLoadSession(r,"panel",ve.None))?.dispose()}finally{c?.dispose()}}async handleSessionModelOverrides(e,t){if(e.getRequests().filter(n=>n.response&&!n.response.isComplete).length&&(t.description=this._chatSessionsService.getInProgressSessionDescription(e)),!(t.changes instanceof Array)){let n=await HTe(e);n&&(t.changes={files:n.fileCount,insertions:n.added,deletions:n.removed})}return e.lastRequest?.response?.state===4&&(t.status=3),t}async _provideChatSessionContent(e,t,o){let n=this._activeSessions.get(t);if(!n){n=new Dgi(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{if(await n.initialize(o),n.options){for(let[r,s]of this._sessionTypeToHandle)if(s===e){for(let[l,c]of Object.entries(n.options))this._chatSessionsService.setSessionOption(t,l,c);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 Xn(u)});s.handleProgressChunk(o,l)}$handleProgressComplete(e,t,o){let n=A.revive(t),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,ve.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,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()}_reviveTooltip(e){if(e){if(typeof e=="string")return e;if(typeof e=="object"&&"value"in e)return xe.lift(e)}}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,o,ve.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)}}};WMt=I([vo(Gi.MainThreadChatSessions),m(1,ia),m(2,Ls),m(3,Si),m(4,At),m(5,dF),m(6,ct),m(7,ee),m(8,Et),m(9,ne)],WMt);var VMt=class extends C{constructor(e,t){super();this._dataChannelService=t;this._proxy=e.getProxy(Zi.ExtHostDataChannels),this._register(this._dataChannelService.onDidSendData(o=>{this._proxy.$onDidReceiveData(o.channelId,o.data)}))}};VMt=I([vo(Gi.MainThreadDataChannels),m(1,O7)],VMt);var eJ=ae("meteredConnectionService"),KTe="network.meteredConnection";function Rgi(){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 BMt=class extends C{constructor(e,t){super();this._onDidChangeIsConnectionMetered=this._register(new E);this.onDidChangeIsConnectionMetered=this._onDidChangeIsConnectionMetered.event;this._isBrowserConnectionMetered=t,this._meteredConnectionSetting=e.getValue(KTe),this._isConnectionMetered=this._meteredConnectionSetting==="on"||this._meteredConnectionSetting!=="off"&&this._isBrowserConnectionMetered,this._register(e.onDidChangeConfiguration(o=>{if(o.affectsConfiguration(KTe)){let n=e.getValue(KTe);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 HMt=class extends C{constructor(e,t){super();this.meteredConnectionService=t;this._proxy=e.getProxy(Zi.ExtHostMeteredConnection),this._proxy.$initializeIsConnectionMetered(this.meteredConnectionService.isConnectionMetered),this._register(this.meteredConnectionService.onDidChangeIsConnectionMetered(o=>{this._proxy.$onDidChangeIsConnectionMetered(o)}))}};HMt=I([vo(Gi.MainThreadMeteredConnection),m(1,eJ)],HMt);var GTe=class extends C{constructor(e){super();this.logService=e;this._delegateBarrier=new f$(1e4)}get repositories(){return this._delegate?.repositories??[]}setDelegate(e){if(this._delegate)throw this.logService.error("[GitService][setDelegate] GitExtension delegate is already set."),new ni("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)}};GTe=I([m(0,ne)],GTe);var UMt=class extends C{constructor(e,t,o){super();this.delegate=o;this.rootUri=e,this.state=rg({owner:this,equalsFn:VT},t)}updateState(e){this.state.set(e,void 0)}async getRefs(e,t){return this.delegate.getRefs(this.rootUri,e,t)}};var tJ=ae("gitService");function nio(a){switch(a){case 0:return 0;case 1:return 1;case 2:return 2;default:throw new Error(`Unknown GitRefType: ${a}`)}}function oio(a){return{HEAD:a?.HEAD?{type:nio(a.HEAD.type),name:a.HEAD.name,commit:a.HEAD.commit,remote:a.HEAD.remote,upstream:a.HEAD.upstream,ahead:a.HEAD.ahead,behind:a.HEAD.behind}:void 0}}var zMt=class extends C{constructor(e,t){super();this.gitService=t;this._openRepositorySequencer=new Nm;this._repositoryHandles=new vt;this._repositories=new Map;this._proxy=e.getProxy(Zi.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=oio(o.state),l=new UMt(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:nio(s.type)}))}async $onDidChangeRepository(e){let t=this._repositories.get(e);if(!t)return;let o=await this._proxy.$getRepositoryState(e);o&&t.updateState(oio(o))}};zMt=I([vo(Gi.MainThreadGitExtension),m(1,tJ)],zMt);var $Te=class{constructor(i){this.instantiationService=i;this.instantiationService.createInstance(Oxt),this.instantiationService.createInstance(Wxt),this.instantiationService.createInstance(Vxt),this.instantiationService.createInstance(Kxt),this.instantiationService.createInstance(sY),this.instantiationService.createInstance(Fxe),this.instantiationService.createInstance(Wxe)}static{this.ID="workbench.contrib.extensionPoints"}};$Te=I([m(0,F)],$Te);pt($Te.ID,$Te,ut.BlockStartup);var Mgi=class extends C{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))),H.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()}},KMt=class a extends C{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 tae}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=!mre(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 Mgi(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=qTe.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 H.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=Agi.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 GMt(a){return a instanceof qTe}var Pgi=class extends C{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()}},qTe=class a extends C{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||so(e.message))return;let o;typeof e.severity=="number"?o=e.severity:o=St.Info;let n=a.parseNotificationMessage(e.message);if(!n)return;let r;e.actions?r=e.actions:A6(e.message)&&(r={primary:e.message.actions});let s=e.priority??0;return(s===0||s===1)&&o!==St.Error&&(t.global===1?s=2:C9(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=In(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=lS(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===St.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 Pgi),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)}},Jde=class a extends st{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}},Agi=class{static create(i,e){if(!i||so(i))return;let t;if(i instanceof Error?t=In(i,!1):typeof i=="string"&&(t=i),!!t)return{message:t,options:e}}};function WP(a){let i=a.getValue("workbench.notifications.position");return i==="bottom-left"||i==="top-right"?i:"bottom-right"}var Ngi=(()=>{if(it&&kr)return"${activeEditorShort}${separator}${rootName}${separator}${profileName}";let a="${dirty}${activeEditorShort}${separator}${rootName}${separator}${profileName}${separator}${appName}";return Gt?a+"${separator}${remoteName}":a})(),Ogi=it?" \u2014 ":" - ",VP=class extends C{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 P);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=ri?d(4236,null):d(4237,null)}static{this.NLS_EXTENSION_HOST=d(4235,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()?VP.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):Ec(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;qD(t)||(t=this.productService.nameLong);let o=qv(this.windowId,!0).window;!o.document.title&&it&&t===this.productService.nameLong&&(o.document.title=`${this.productService.nameLong} ${VP.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?`${VP.NLS_EXTENSION_HOST} - ${e}`:VP.NLS_EXTENSION_HOST),this.properties.isAdmin&&(t=VP.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=no.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&&!Gt)l=this.labelService.getHostLabel(Y.vscodeRemote,this.environmentService.remoteAuthority);else{let pe=XL(t);pe&&(l=this.labelService.getHostLabel(pe.scheme,pe.authority))}let c=e?e.getTitle(0):"",u=e?e.getTitle(1):c,p=e?e.getTitle(2):u,h=r?Ye(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()?VP.TITLE_DIRTY:"",T=this.productService.nameLong,N=this.userDataProfileService.currentProfile.isDefault?"":this.userDataProfileService.currentProfile.name,O=this.viewsService.getFocusedViewName(),V=n?this.decorationsService.getDecoration(n,!1)?.tooltip:void 0,U=this.editorService.activeTextEditorLanguageId,G={};for(let[pe,de]of this.variables)G[de]=this.contextKeyService.getContextKeyValue(pe)??"";let $=this.configurationService.getValue("window.title");typeof $!="string"&&($=Ngi),!this.titleIncludesEditorState&&this.accessibilityService.isScreenReaderOptimized()&&this.configurationService.getValue("accessibility.windowTitleOptimized")&&($+="${separator}${activeEditorState}");let te=this.configurationService.getValue("window.titleSeparator");return typeof te!="string"&&(te=Ogi),$gt($,{...G,activeEditorShort:c,activeEditorLong:p,activeEditorMedium:u,activeEditorLanguageId:U,activeFolderShort:h,activeFolderMedium:g,activeFolderLong:f,rootName:v,rootPath:S,rootNameShort:b,folderName:y,folderPath:w,dirty:k,appName:T,remoteName:l,profileName:N,focusedView:O,activeEditorState:V,separator:{label:te}})}isCustomTitleFormat(){if(this.accessibilityService.isScreenReaderOptimized()||this.titleIncludesEditorState)return!0;let e=this.configurationService.inspect("window.title"),t=this.configurationService.inspect("window.titleSeparator");if(e$e(e)||e$e(t))return!0;let n=oe.as(ii.Configuration).getConfigurationProperties();return e.defaultValue!==n["window.title"]?.defaultDefaultValue}};VP=I([m(1,B),m(2,X),m(3,ee),m(4,ru),m(5,Pe),m(6,ot),m(7,mn),m(8,nt),m(9,Ft),m(10,Cv),m(11,Bi)],VP);var $Mt=oe.as(ii.Configuration);(function(){pt($ce.ID,$ce,ut.Eventually),pt(i5.ID,i5,ut.AfterRestored),$Mt.registerConfiguration({...Cm,properties:{"workbench.externalBrowser":{type:"string",markdownDescription:d(4300,null),included:kr,restricted:!0},"workbench.editor.titleScrollbarSizing":{type:"string",enum:["default","large"],enumDescriptions:[d(4489,null),d(4490,null)],description:d(4395,null),default:"default"},"workbench.editor.titleScrollbarVisibility":{type:"string",enum:["auto","visible","hidden"],enumDescriptions:[d(4491,null),d(4493,null),d(4492,null)],description:d(4398,null),default:"auto"},"workbench.editor.showTabs":{type:"string",enum:["multiple","single","none"],enumDescriptions:[d(4473,null),d(4475,null),d(4474,null)],description:d(4382,null),default:"multiple"},"workbench.editor.editorActionsLocation":{type:"string",enum:["default","titleBar","hidden"],markdownEnumDescriptions:[d(4439,null,"`#workbench.editor.showTabs#`","`none`"),d(4441,null,"`#window.customTitleBarVisibility#`","`never`"),d(4440,null)],markdownDescription:d(4316,null),default:"default"},"workbench.editor.alwaysShowEditorActions":{type:"boolean",markdownDescription:d(4295,null),default:!1},"workbench.editor.wrapTabs":{type:"boolean",markdownDescription:d(4524,null,"`#workbench.editor.showTabs#`","`multiple`"),default:!1},"workbench.editor.scrollToSwitchTabs":{type:"boolean",markdownDescription:d(4371,null,"`#workbench.editor.showTabs#`","`multiple`"),default:!1},"workbench.editor.highlightModifiedTabs":{type:"boolean",markdownDescription:d(4329,null,"`#workbench.editor.showTabs#`","multiple"),default:!1},"workbench.editor.decorations.badges":{type:"boolean",markdownDescription:d(4311,null),default:!0},"workbench.editor.decorations.colors":{type:"boolean",markdownDescription:d(4312,null),default:!0},[sP.SETTING_ID_ENABLED]:{type:"boolean",markdownDescription:d(4445,null),default:!0},[sP.SETTING_ID_PATTERNS]:{type:"object",markdownDescription:(()=>{let e=d(4450,null);return e+=`
- `+[d(4444,null),d(4448,null),d(4447,null),d(4446,null),d(4449,null)].join(`
- `),e+=`

`+d(4309,null),e})(),additionalProperties:{type:["string","null"],markdownDescription:d(4451,null),minLength:1,pattern:".*[a-zA-Z0-9].*"},default:{}},"workbench.editor.labelFormat":{type:"string",enum:["default","short","medium","long"],enumDescriptions:[d(4452,null),d(4455,null),d(4454,null),d(4453,null)],default:"default",description:d(4394,null)},"workbench.editor.untitled.labelFormat":{type:"string",enum:["content","name"],enumDescriptions:[d(4494,null),d(4495,null)],default:"content",description:d(4399,null)},"workbench.editor.empty.hint":{type:"string",enum:["text","hidden"],default:"text",markdownDescription:d(4442,null)},"workbench.editor.languageDetection":{type:"boolean",default:!0,description:d(4456,null),scope:6},"workbench.editor.historyBasedLanguageDetection":{type:"boolean",default:!0,description:d(4443,null)},"workbench.editor.preferHistoryBasedLanguageDetection":{type:"boolean",default:!1,description:d(4464,null)},"workbench.editor.languageDetectionHints":{type:"object",default:{untitledEditors:!0,notebookEditors:!0},description:d(4470,null),additionalProperties:!1,properties:{untitledEditors:{type:"boolean",description:d(4471,null)},notebookEditors:{type:"boolean",description:d(4472,null)}}},"workbench.editor.tabActionLocation":{type:"string",enum:["left","right"],default:"right",markdownDescription:d(4393,null,"`#workbench.editor.showTabs#`","`multiple`")},"workbench.editor.tabActionCloseVisibility":{type:"boolean",default:!0,description:d(4481,null)},"workbench.editor.tabActionUnpinVisibility":{type:"boolean",default:!0,description:d(4482,null)},"workbench.editor.showTabIndex":{type:"boolean",default:!1,markdownDescription:d(4384,null,"`#workbench.editor.showTabs#`","`multiple`")},"workbench.editor.tabSizing":{type:"string",enum:["fit","shrink","fixed"],default:"fit",enumDescriptions:[d(4484,null),d(4486,null),d(4485,null)],markdownDescription:d(4396,null,"`#workbench.editor.showTabs#`","`multiple`")},"workbench.editor.tabSizingFixedMinWidth":{type:"number",default:50,minimum:38,markdownDescription:d(4488,null,"`#workbench.editor.tabSizing#`","`fixed`")},"workbench.editor.tabSizingFixedMaxWidth":{type:"number",default:160,minimum:38,markdownDescription:d(4487,null,"`#workbench.editor.tabSizing#`","`fixed`")},"window.density.editorTabHeight":{type:"string",enum:["default","compact"],default:"default",markdownDescription:d(4483,null,"`#workbench.editor.showTabs#`","`multiple`")},"workbench.editor.pinnedTabSizing":{type:"string",enum:["normal","compact","shrink"],default:"normal",enumDescriptions:[d(4461,null),d(4460,null),d(4462,null)],markdownDescription:d(4360,null,"`#workbench.editor.showTabs#`","`multiple`")},"workbench.editor.pinnedTabsOnSeparateRow":{type:"boolean",default:!1,markdownDescription:d(4463,null,"`#workbench.editor.showTabs#`","`multiple`")},"workbench.editor.preventPinnedEditorClose":{type:"string",enum:["keyboardAndMouse","keyboard","mouse","never"],default:"keyboardAndMouse",enumDescriptions:[d(4466,null),d(4468,null),d(4469,null),d(4467,null)],description:d(4465,null)},"workbench.editor.splitSizing":{type:"string",enum:["auto","distribute","split"],default:"auto",enumDescriptions:[d(4478,null),d(4479,null),d(4480,null)],description:d(4389,null)},"workbench.editor.splitOnDragAndDrop":{type:"boolean",default:!0,description:d(4388,null)},"workbench.editor.dragToOpenWindow":{type:"boolean",default:!0,markdownDescription:d(4315,null)},"workbench.editor.focusRecentEditorAfterClose":{type:"boolean",description:d(4325,null),default:!0},"workbench.editor.showIcons":{type:"boolean",description:d(4383,null),default:!0},"workbench.editor.enablePreview":{type:"boolean",description:d(4320,null),default:!0},"workbench.editor.enablePreviewFromQuickOpen":{type:"boolean",markdownDescription:d(4322,null,"`#workbench.editor.showTabs#`","`multiple`"),default:!1},"workbench.editor.enablePreviewFromCodeNavigation":{type:"boolean",markdownDescription:d(4321,null,"`#workbench.editor.showTabs#`","`multiple`"),default:!1},"workbench.editor.closeOnFileDelete":{type:"boolean",description:d(4304,null),default:!1},"workbench.editor.openPositioning":{type:"string",enum:["left","right","first","last"],default:"right",markdownDescription:d(4317,null,"`left`","`right`","`first`","`last`")},"workbench.editor.openSideBySideDirection":{type:"string",enum:["right","down"],default:"right",markdownDescription:d(4386,null)},"workbench.editor.closeEmptyGroups":{type:"boolean",description:d(4303,null),default:!0},"workbench.editor.revealIfOpen":{type:"boolean",description:d(4367,null),default:!1},"workbench.editor.useModal":{type:"string",enum:["off","some","all"],enumDescriptions:[d(4402,null),d(4403,null),d(4401,null)],description:d(4400,null),default:to.quality!=="stable"?"some":"off",tags:["experimental"],experiment:{mode:"auto"}},"workbench.editor.swipeToNavigate":{type:"boolean",description:d(4392,null),default:!1,included:it&&!Gt},"workbench.editor.mouseBackForwardToNavigate":{type:"boolean",description:d(4345,null),default:!0},"workbench.editor.navigationScope":{type:"string",enum:["default","editorGroup","editor"],default:"default",markdownDescription:d(4348,null),enumDescriptions:[d(4457,null),d(4459,null),d(4458,null)]},"workbench.editor.restoreViewState":{type:"boolean",markdownDescription:d(4366,null,"`#workbench.editor.sharedViewState#`"),default:!0,scope:6},"workbench.editor.sharedViewState":{type:"boolean",description:d(4380,null),default:!1},"workbench.editor.restoreEditors":{type:"boolean",description:d(4365,null),default:!0},"workbench.editor.splitInGroupLayout":{type:"string",enum:["vertical","horizontal"],default:"horizontal",markdownDescription:d(4387,null),enumDescriptions:[d(4477,null),d(4476,null)]},"workbench.editor.centeredLayoutAutoResize":{type:"boolean",default:!0,description:d(4301,null)},"workbench.editor.centeredLayoutFixedWidth":{type:"boolean",default:!1,description:d(4302,null)},"workbench.editor.doubleClickTabToToggleEditorGroupSizes":{type:"string",enum:["maximize","expand","off"],default:"expand",markdownDescription:d(4314,null,"`#workbench.editor.showTabs#`","`multiple`"),enumDescriptions:[d(4437,null),d(4436,null),d(4438,null)]},"workbench.editor.limit.enabled":{type:"boolean",default:!1,description:d(4336,null)},"workbench.editor.limit.value":{type:"number",default:10,exclusiveMinimum:0,markdownDescription:d(4338,null,"`#workbench.editor.limit.perEditorGroup#`")},"workbench.editor.limit.excludeDirty":{type:"boolean",default:!1,description:d(4337,null)},"workbench.editor.limit.perEditorGroup":{type:"boolean",default:!1,description:d(4359,null)},"workbench.localHistory.enabled":{type:"boolean",default:!0,description:d(4339,null),scope:5},"workbench.localHistory.maxFileSize":{type:"number",default:256,minimum:1,description:d(4341,null),scope:5},"workbench.localHistory.maxFileEntries":{type:"number",default:50,minimum:0,description:d(4340,null),scope:5},"workbench.localHistory.exclude":{type:"object",patternProperties:{".*":{type:"boolean"}},markdownDescription:d(4323,null),scope:5},"workbench.localHistory.mergeWindow":{type:"number",default:10,minimum:1,markdownDescription:d(4344,null),scope:5},"workbench.commandPalette.history":{type:"number",description:d(4306,null),default:50,minimum:0},"workbench.commandPalette.preserveInput":{type:"boolean",description:d(4361,null),default:!1},"workbench.commandPalette.experimental.suggestCommands":{type:"boolean",tags:["experimental"],description:d(4391,null),default:!1},"workbench.commandPalette.experimental.askChatLocation":{type:"string",tags:["experimental"],description:d(4297,null),default:"chatView",enum:["chatView","quickChat"],enumDescriptions:[d(4298,null),d(4299,null)]},"workbench.commandPalette.showAskInChat":{type:"boolean",tags:["experimental"],description:d(4381,null),default:!0},"workbench.commandPalette.experimental.enableNaturalLanguageSearch":{type:"boolean",tags:["experimental"],description:d(4319,null),default:!0},"workbench.quickOpen.closeOnFocusLost":{type:"boolean",description:d(4305,null),default:!0},"workbench.quickOpen.preserveInput":{type:"boolean",description:d(4509,null),default:!1},"workbench.settings.openDefaultSettings":{type:"boolean",description:d(4352,null),default:!1},"workbench.settings.useSplitJSON":{type:"boolean",markdownDescription:d(4404,null),default:!1},"workbench.settings.openDefaultKeybindings":{type:"boolean",description:d(4351,null),default:!1},"workbench.settings.alwaysShowAdvancedSettings":{type:"boolean",description:d(4294,null),default:to.quality!=="stable"},"workbench.sideBar.location":{type:"string",enum:["left","right"],default:"left",description:d(4385,null)},"workbench.panel.showLabels":{type:"boolean",default:!0,description:d(4358,null)},"workbench.panel.defaultLocation":{type:"string",enum:["left","bottom","top","right"],default:"bottom",description:d(4356,null)},"workbench.panel.opensMaximized":{type:"string",enum:["always","never","preserve"],default:"preserve",description:d(4357,null),enumDescriptions:[d(4505,null),d(4506,null),d(4507,null)]},"workbench.secondarySideBar.defaultVisibility":{type:"string",enum:["hidden","visibleInWorkspace","visible","maximizedInWorkspace","maximized"],default:"visibleInWorkspace",description:d(4372,null),enumDescriptions:[d(4518,null),d(4522,null),d(4521,null),d(4520,null),d(4519,null)]},"workbench.secondarySideBar.forceMaximized":{type:"boolean",default:!1,tags:["experimental"],description:d(4373,null)},"workbench.secondarySideBar.showLabels":{type:"boolean",default:!0,markdownDescription:d(4374,null,"`#workbench.activityBar.location#`","`top`")},"workbench.statusBar.visible":{type:"boolean",default:!0,description:d(4390,null)},"workbench.notifications.position":{type:"string",enum:["bottom-right","bottom-left","top-right"],default:"bottom-right",description:d(4350,null),enumDescriptions:[d(4503,null),d(4502,null),d(4504,null)],tags:["experimental"],experiment:{mode:"auto"}},"workbench.notifications.showInTitleBar":{type:"boolean",default:!0,description:d(4349,null)},"workbench.activityBar.location":{type:"string",enum:["default","top","bottom","hidden"],default:"default",markdownDescription:d(4293,null),enumDescriptions:[d(4433,null),d(4435,null),d(4432,null),d(4434,null)]},"workbench.activityBar.autoHide":{type:"boolean",default:!1,markdownDescription:d(4290,null,"`#workbench.activityBar.location#`","`top`","`bottom`")},"workbench.activityBar.compact":{type:"boolean",default:!1,markdownDescription:d(4291,null,"`#workbench.activityBar.location#`","`default`")},"workbench.activityBar.iconClickBehavior":{type:"string",enum:["toggle","focus"],default:"toggle",markdownDescription:d(4292,null,"`#workbench.activityBar.location#`","`default`"),enumDescriptions:[d(4431,null),d(4430,null)]},"workbench.view.alwaysShowHeaderActions":{type:"boolean",default:!1,description:d(4405,null)},"workbench.view.showQuietly":{type:"object",description:d(4523,null),scope:4,properties:{"workbench.panel.output":{type:"boolean",description:d(4508,null)}},additionalProperties:!1},"workbench.fontAliasing":{type:"string",enum:["default","antialiased","none","auto"],default:"default",description:d(4328,null),enumDescriptions:[d(4498,null),d(4496,null),d(4499,null),d(4497,null)],included:it},"workbench.settings.editor":{type:"string",enum:["ui","json"],enumDescriptions:[d(4378,null),d(4377,null)],description:d(4376,null),default:"ui",scope:4},"workbench.settings.showAISearchToggle":{type:"boolean",default:!0,description:d(4379,null)},"workbench.hover.delay":{type:"number",description:d(4500,null),default:it?1500:500,minimum:0},"workbench.hover.reducedDelay":{type:"number",description:d(4501,null),default:500,minimum:0},"workbench.reduceMotion":{type:"string",description:d(4510,null),enumDescriptions:[d(4513,null),d(4512,null),d(4511,null)],default:"auto",tags:["accessibility"],enum:["on","off","auto"]},"workbench.reduceTransparency":{type:"string",description:d(4514,null),enumDescriptions:[d(4517,null),d(4516,null),d(4515,null)],default:"off",tags:["accessibility"],enum:["on","off","auto"]},"workbench.navigationControl.enabled":{type:"boolean",default:!0,markdownDescription:Gt?d(4347,null):d(4346,null,"`#window.customTitleBarVisibility#`","`never`")},"workbench.layoutControl.enabled":{type:"boolean",default:!0,markdownDescription:Gt?d(4334,null):d(4333,null,"`#window.customTitleBarVisibility#`","`never`")},"workbench.layoutControl.type":{type:"string",enum:["menu","toggles","both"],enumDescriptions:[d(4331,null),d(4332,null),d(4330,null)],default:"both",description:d(4335,null)},"workbench.tips.enabled":{type:"boolean",default:!0,description:d(4397,null)}}});let i=d(4429,null);i+=`
- `+[d(4283,null),d(4282,null),d(4281,null),d(4280,null),d(4287,null),d(4286,null),d(4285,null),d(4326,null),d(4327,null),d(4368,null),d(4369,null),d(4370,null),d(4363,null),d(4296,null),d(4364,null),d(4313,null),d(4324,null),d(4289,null),d(4288,null),d(4284,null,"`accessibility.windowTitleOptimized`"),d(4375,null)].join(`
- `),$Mt.registerConfiguration({...yui,properties:{"window.title":{type:"string",default:Ngi,markdownDescription:i},"window.titleSeparator":{type:"string",default:Ogi,markdownDescription:d(4428,null,"`#window.title#`")},"window.commandCenter":{type:"boolean",default:!0,markdownDescription:Gt?d(4407,null):d(4406,null,"`#window.customTitleBarVisibility#`","`never`")},"window.menuBarVisibility":{type:"string",enum:["classic","visible","toggle","hidden","compact"],markdownEnumDescriptions:[d(4414,null),d(4420,null),it?d(4419,null):d(4418,null),d(4417,null),Gt?d(4416,null):d(4415,null,"`#window.titleBarStyle#`","`native`","`#window.menuStyle#`","`native`","`inherit`")],default:Gt?"compact":"classic",scope:1,markdownDescription:it?d(4343,null):d(4342,null),included:ri||Wn||Gt},"window.enableMenuBarMnemonics":{type:"boolean",default:!0,scope:1,description:d(4318,null),included:ri||Wn},"window.customMenuBarAltFocus":{type:"boolean",default:!0,scope:1,markdownDescription:d(4310,null),included:ri||Wn},"window.openFilesInNewWindow":{type:"string",enum:["on","off","default"],enumDescriptions:[d(4424,null),d(4423,null),it?d(4422,null):d(4421,null)],default:"off",scope:1,markdownDescription:it?d(4354,null):d(4353,null)},"window.openFoldersInNewWindow":{type:"string",enum:["on","off","default"],enumDescriptions:[d(4427,null),d(4426,null),d(4425,null)],default:"default",scope:1,markdownDescription:d(4355,null)},"window.confirmBeforeClose":{type:"string",enum:["always","keyboardOnly","never"],enumDescriptions:[Gt?d(4409,null):d(4408,null),Gt?d(4411,null):d(4410,null),Gt?d(4413,null):d(4412,null)],default:Gt&&!bbe()?"keyboardOnly":"never",markdownDescription:Gt?d(4308,null):d(4307,null),scope:1}}}),pt(qce.ID,qce,ut.Eventually),$Mt.registerConfiguration({...V_t,properties:{"problems.visibility":{type:"boolean",default:!0,description:d(4362,null)}}}),$Mt.registerConfiguration({id:"zenMode",order:9,title:d(4536,null),type:"object",properties:{"zenMode.fullScreen":{type:"boolean",default:!0,description:d(4526,null)},"zenMode.centerLayout":{type:"boolean",default:!0,description:d(4525,null)},"zenMode.showTabs":{type:"string",enum:["multiple","single","none"],description:d(4531,null),enumDescriptions:[d(4532,null),d(4534,null),d(4533,null)],default:"multiple"},"zenMode.hideStatusBar":{type:"boolean",default:!0,description:d(4529,null)},"zenMode.hideActivityBar":{type:"boolean",default:!0,description:d(4527,null)},"zenMode.hideLineNumbers":{type:"boolean",default:!0,description:d(4528,null)},"zenMode.restore":{type:"boolean",default:!0,description:d(4530,null)},"zenMode.silentNotifications":{type:"boolean",default:!0,description:d(4535,null)}}})})();oe.as(rp.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}}]);oe.as(rp.ConfigurationMigration).registerConfigurationMigrations([{key:"workbench.activityBar.location",migrateFn:a=>{let i=[];return a==="side"&&i.push(["workbench.activityBar.location",{value:"default"}]),i}}]);oe.as(rp.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}}]);oe.as(rp.ConfigurationMigration).registerConfigurationMigrations([{key:"workbench.editor.useModal",migrateFn:a=>{let i=[];return a==="default"?i.push(["workbench.editor.useModal",{value:"some"}]):a==="on"&&i.push(["workbench.editor.useModal",{value:"all"}]),i}}]);function Fgi(a,i){return[pi({id:"undo",label:d(3437,null),run:()=>rh().execCommand("undo")}),pi({id:"redo",label:d(3435,null),run:()=>rh().execCommand("redo")}),new li,pi({id:"editor.action.clipboardCutAction",label:d(3433,null),run:()=>{i.trace("TextInputActionsProvider#cut"),rh().execCommand("cut")}}),pi({id:"editor.action.clipboardCopyAction",label:d(3432,null),run:()=>{i.trace("TextInputActionsProvider#copy"),rh().execCommand("copy")}}),pi({id:"editor.action.clipboardPasteAction",label:d(3434,null),run:async e=>{i.trace("TextInputActionsProvider#paste");let t=await a.readText();if(L6(e)||Wre(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 li,pi({id:"editor.action.selectAll",label:d(3436,null),run:()=>rh().execCommand("selectAll")})]}var YTe=class extends C{constructor(e,t,o,n){super();this.layoutService=e;this.contextMenuService=t;this.clipboardService=o;this.logService=n;this.textInputActions=new co(()=>Fgi(this.clipboardService,this.logService));this.registerListeners()}static{this.ID="workbench.contrib.textInputActionsProvider"}registerListeners(){this._register(H.runAndSubscribe(this.layoutService.onDidAddContainer,({container:e,disposables:t})=>{t.add(j(e,"contextmenu",o=>this.onContextMenu(Me(e),o)))},{container:this.layoutService.mainContainer,disposables:this._store}))}onContextMenu(e,t){if(t.defaultPrevented)return;let o=t.target;if(!L6(o)&&!Wre(o))return;$t.stop(t,!0);let n=new yn(e,t);this.contextMenuService.showContextMenu({getAnchor:()=>n,getActions:()=>this.textInputActions.value,getActionsContext:()=>o})}};YTe=I([m(0,fi),m(1,ze),m(2,Wi),m(3,ne)],YTe);pt(YTe.ID,YTe,ut.BlockRestore);var eue="rendererLog",vR={id:eue,name:d(17130,null)},iK="workbench.action.showWindowLog";var XTe=ae("policy"),iJ=class extends C{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),ht.reduce(this.policies.entries(),(o,[n,r])=>({...o,[n]:r}),{})}getPolicyValue(e){return this.policies.get(e)}serialize(){return ht.reduce(Object.entries(this.policyDefinitions),(e,[t,o])=>({...e,[t]:{definition:o,value:this.policies.get(t)}}),{})}},l7e=class{constructor(){this.onDidChange=H.None;this.policyDefinitions={}}async updatePolicyDefinitions(){return{}}getPolicyValue(){}serialize(){}};var Wgi=class extends K{constructor(){super({id:"workbench.action.inspectContextKeys",title:L(3232,"Inspect Context Keys"),category:We.Developer,f1:!0})}run(i){let e=i.get(X),t=new P,o=hr(void 0,void 0,t);Vh("*","cursor: crosshair !important;",o);let n=document.createElement("div"),r=rh();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 On(r,"mousemove",!0));t.add(s.event(u=>{let p=u.target,h=Yn(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 On(r,"mousedown",!0));H.once(l.event)(u=>{u.preventDefault(),u.stopPropagation()},null,t);let c=t.add(new On(r,"mouseup",!0));H.once(c.event)(u=>{u.preventDefault(),u.stopPropagation();let p=e.getContext(u.target);console.log(p.collectAllValues()),Ue(t)},null,t)}},Vgi=class a extends K{constructor(){super({id:"workbench.action.toggleScreencastMode",title:L(3263,"Toggle Screencast Mode"),category:We.Developer,f1:!0})}run(i){if(a.disposable){a.disposable.dispose(),a.disposable=void 0;return}let e=i.get(nc),t=i.get(B),o=i.get(_e),n=new P,r=e.activeContainer,s=R(r,_(".screencast-mouse"));n.add(Z(()=>s.remove()));let l=R(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(pe,de){let se=new P;se.add(se.add(new On(pe,"mousedown",!0)).event(Se=>c.fire(Se))),se.add(se.add(new On(pe,"mouseup",!0)).event(Se=>u.fire(Se))),se.add(se.add(new On(pe,"mousemove",!0)).event(Se=>p.fire(Se))),de.add(se),n.add(Z(()=>de.delete(se))),n.add(se)}for(let{window:pe,disposables:de}of Gw())h(e.getContainer(pe),de);n.add(Fg(({window:pe,disposables:de})=>h(e.getContainer(pe),de))),n.add(e.onDidChangeActiveContainer(()=>{e.activeContainer.appendChild(s),e.activeContainer.appendChild(l)}));let g=()=>{s.style.borderColor=Oe.fromHex(t.getValue("screencastMode.mouseIndicatorColor")).toString()},f,v=()=>{f=Kn(t.getValue("screencastMode.mouseIndicatorSize")||20,20,100),s.style.height=`${f}px`,s.style.width=`${f}px`};g(),v(),n.add(c.event(pe=>{s.style.top=`${pe.clientY-f/2}px`,s.style.left=`${pe.clientX-f/2}px`,s.style.display="block",s.style.transform="scale(1)",s.style.transition="transform 0.1s";let de=p.event(se=>{s.style.top=`${se.clientY-f/2}px`,s.style.left=`${se.clientX-f/2}px`,s.style.transform=`scale(${.8})`});H.once(u.event)(()=>{s.style.display="none",de.dispose()})}));let b=()=>{l.style.fontSize=`${Kn(t.getValue("screencastMode.fontSize")||56,20,100)}px`},S=()=>{l.style.bottom=`${Kn(t.getValue("screencastMode.verticalOffset")||0,0,90)}%`},y,w=()=>{y=Kn(t.getValue("screencastMode.keyboardOverlayTimeout")||800,500,5e3)};b(),S(),w(),n.add(t.onDidChangeConfiguration(pe=>{pe.affectsConfiguration("screencastMode.verticalOffset")&&S(),pe.affectsConfiguration("screencastMode.fontSize")&&b(),pe.affectsConfiguration("screencastMode.keyboardOverlayTimeout")&&w(),pe.affectsConfiguration("screencastMode.mouseIndicatorColor")&&g(),pe.affectsConfiguration("screencastMode.mouseIndicatorSize")&&v()}));let k=n.add(new E),T=n.add(new E),N=n.add(new E),O=n.add(new E);function V(pe,de){let se=new P;se.add(se.add(new On(pe,"keydown",!0)).event(Se=>k.fire(Se))),se.add(se.add(new On(pe,"compositionstart",!0)).event(Se=>T.fire(Se))),se.add(se.add(new On(pe,"compositionupdate",!0)).event(Se=>N.fire(Se))),se.add(se.add(new On(pe,"compositionend",!0)).event(Se=>O.fire(Se))),de.add(se),n.add(Z(()=>de.delete(se))),n.add(se)}for(let{window:pe,disposables:de}of Gw())V(pe,de);n.add(Fg(({window:pe,disposables:de})=>V(pe,de)));let U=0,G,$=!1,te=n.add(new Dt(()=>{l.textContent="",G=void 0,U=0},y));n.add(T.event(pe=>{$=!0})),n.add(N.event(pe=>{pe.data&&$?(U>20&&(l.innerText="",U=0),G=G??R(l,_("span.key")),G.textContent=pe.data):$&&(l.innerText="",R(l,_("span.key",{},"Backspace"))),te.schedule(y)})),n.add(O.event(pe=>{G=void 0,U++})),n.add(k.event(pe=>{if(pe.key==="Process"||/[\uac00-\ud787\u3131-\u314e\u314f-\u3163\u3041-\u3094\u30a1-\u30f4\u30fc\u3005\u3006\u3024\u4e00-\u9fa5]/u.test(pe.key)){pe.code==="Backspace"||pe.code.includes("Key")?$=!0:(G=void 0,$=!1),te.schedule(y);return}if(pe.isComposing)return;let de=t.getValue("screencastMode.keyboardOptions"),se=new Ii(pe),Se=o.softDispatch(se,se.target);if(Se.kind===2&&Se.commandId&&!(de.showSingleEditorCursorMoves??!0)&&["cursorLeft","cursorRight","cursorUp","cursorDown"].includes(Se.commandId))return;(se.ctrlKey||se.altKey||se.metaKey||se.shiftKey||U>20||se.keyCode===1||se.keyCode===9||se.keyCode===16||se.keyCode===18||se.keyCode===15||se.keyCode===17)&&(l.innerText="",U=0);let ke=o.resolveKeyboardEvent(se),Ee=this._isKbFound(Se)&&Se.commandId?this.getCommandDetails(Se.commandId):void 0,He=Ee?.title,Ve=ke.getLabel();if(Ee&&((de.showCommandGroups??!1)&&Ee.category&&(He=`${Ee.category}: ${He} `),this._isKbFound(Se)&&Se.commandId)){let Fe=o.lookupKeybindings(Se.commandId).filter(Qt=>Qt.getLabel()?.endsWith(Ve??""));Fe.length>0&&(Ve=Fe[Fe.length-1].getLabel())}(de.showCommands??!0)&&He&&R(l,_("span.title",{},`${He} `)),((de.showKeys??!0)||(de.showKeybindings??!0)&&this._isKbFound(Se))&&(Ve=Ve?.replace("UpArrow","\u2191")?.replace("DownArrow","\u2193")?.replace("LeftArrow","\u2190")?.replace("RightArrow","\u2192"),R(l,_("span.key",{},Ve??""))),U++,te.schedule(y)})),a.disposable=n}_isKbFound(i){return i.kind===2}getCommandDetails(i){let e=fe.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=qe.getCommand(i);if(t?.metadata?.description)return{title:typeof t.metadata.description=="string"?t.metadata.description:t.metadata.description.value}}},Bgi=class extends K{constructor(){super({id:"workbench.action.logStorage",title:L(3234,"Log Storage Database Contents"),category:We.Developer,f1:!0})}run(i){let e=i.get(le),t=i.get(ct);e.log(),t.info(d(3262,null),d(3261,null))}},Hgi=class extends K{constructor(){super({id:"workbench.action.logWorkingCopies",title:L(3235,"Log Working Copies"),category:We.Developer,f1:!0})}async run(i){let e=i.get(Wa),t=i.get(Gm),o=i.get(ne),n=i.get(Ml),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(eue,!0)}},Ugi=class a extends K{static{this.SIZE_THRESHOLD=1024*16}constructor(){super({id:"workbench.action.removeLargeStorageDatabaseEntries",title:L(3239,"Remove Large Storage Database Entries..."),category:We.Developer,f1:!0})}async run(i){let e=i.get(le),t=i.get(Ge),o=i.get(mn),n=i.get(ct),r=i.get(Co),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:ll.formatSize(f.length),detail:d(3233,null,p===-1?d(3231,null):p===0?d(3238,null):d(3265,null),h===1?d(3236,null):d(3264,null))})}s.sort((p,h)=>h.size-p.size);let l=await new Promise(p=>{let h=new P,g=h.add(t.createQuickPick());g.items=s,g.canSelectMany=!0,g.ok=!1,g.customButton=!0,g.hideCheckAll=!0,g.customLabel=d(3243,null),g.placeholder=d(3245,null),s.length===0&&(g.description=d(3244,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(3241,null),detail:d(3242,null,l.map(p=>p.label).join(`
`)),primaryButton:d(3240,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)}},tue,qMt=new Set,iue=new Q("dirtyWorkingCopies","stopped"),zgi=class extends K{constructor(){super({id:"workbench.action.startTrackDisposables",title:L(3259,"Start Tracking Disposables"),category:We.Developer,f1:!0,precondition:x.and(iue.isEqualTo("pending").negate(),iue.isEqualTo("started").negate())})}run(i){iue.bindTo(i.get(X)).set("started"),qMt.clear(),tue=new Gut,obe(tue)}},Kgi=class extends K{constructor(){super({id:"workbench.action.snapshotTrackedDisposables",title:L(3258,"Snapshot Tracked Disposables"),category:We.Developer,f1:!0,precondition:iue.isEqualTo("started")})}run(i){iue.bindTo(i.get(X)).set("pending"),qMt=new Set(tue?.computeLeakingDisposables(1e3)?.leaks.map(t=>t.value))}},Ggi=class extends K{constructor(){super({id:"workbench.action.stopTrackDisposables",title:L(3260,"Stop Tracking Disposables"),category:We.Developer,f1:!0,precondition:iue.isEqualTo("pending")})}run(i){let e=i.get(ee);if(iue.bindTo(i.get(X)).set("stopped"),tue){let o=new Set;for(let r of new Set(tue.computeLeakingDisposables(1e3)?.leaks)??[])qMt.has(r.value)&&o.add(r);let n=tue.computeLeakingDisposables(1e3,Array.from(o));n&&e.openEditor({resource:void 0,contents:n.details})}obe(null),tue=void 0,qMt.clear()}},$gi=class extends K{constructor(){super({id:"workbench.action.showPolicyDiagnostics",title:L(3237,"Policy Diagnostics"),category:We.Developer,f1:!0})}async run(i){let e=i.get(ee),t=i.get(B),o=i.get(nt),n=i.get(Um),r=i.get(Cs),s=i.get(Gx),l=i.get(XTe),c=oe.as(ii.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 N=(await r.getSessions(k)).find(O=>O.id===f.sessionId);if(N){b=N.account.id,S=N.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),N={name:y,key:w,property:k,inspection:T};T.policyValue!==void 0?f.push(N):v.push(N)}}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 N of T)if(N.getPolicyValue&&N.getPolicyValue(y)!==void 0)return b.set(y,N.constructor.name),N.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),N=S(y.name);u+=`| ${y.key} | ${y.name} | ${N} | \`${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(N=>N.allowed!==!1).map(N=>`${N.name}${N.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(Wgi);W(Vgi);W(Bgi);W(Hgi);W(Ugi);W($gi);to.commit||(W(zgi),W(Kgi),W(Ggi));var WGo=oe.as(ii.Configuration);WGo.registerConfiguration({id:"screencastMode",order:9,title:d(3257,null),type:"object",properties:{"screencastMode.verticalOffset":{type:"number",default:20,minimum:0,maximum:90,description:d(3254,null)},"screencastMode.fontSize":{type:"number",default:56,minimum:20,maximum:100,description:d(3246,null)},"screencastMode.keyboardOptions":{type:"object",description:d(3247,null),properties:{showKeys:{type:"boolean",default:!0,description:d(3251,null)},showKeybindings:{type:"boolean",default:!0,description:d(3250,null)},showCommands:{type:"boolean",default:!0,description:d(3249,null)},showCommandGroups:{type:"boolean",default:!1,description:d(3248,null)},showSingleEditorCursorMoves:{type:"boolean",default:!0,description:d(3252,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(3253,null)},"screencastMode.mouseIndicatorColor":{type:"string",format:"color-hex",default:"#FF0000",description:d(3255,null)},"screencastMode.mouseIndicatorSize":{type:"number",default:20,minimum:20,maximum:100,description:d(3256,null)}}});var jMt=class a extends K{static{this.ID="workbench.action.keybindingsReference"}static{this.AVAILABLE=!!(Wn?to.keyboardShortcutsUrlLinux:it?to.keyboardShortcutsUrlMac:to.keyboardShortcutsUrlWin)}constructor(){super({id:a.ID,title:{...L(3268,"Keyboard Shortcuts Reference"),mnemonicTitle:d(3270,null)},category:We.Help,f1:!0,keybinding:{weight:200,when:null,primary:Ai(2089,2096)},menu:{id:D.MenubarHelpMenu,group:"2_reference",order:1}})}run(i){let e=i.get(nt),t=i.get(Qe),o=Wn?e.keyboardShortcutsUrlLinux:it?e.keyboardShortcutsUrlMac:e.keyboardShortcutsUrlWin;o&&t.open(A.parse(o))}},QMt=class a extends K{static{this.ID="workbench.action.openVideoTutorialsUrl"}static{this.AVAILABLE=!!to.introductoryVideosUrl}constructor(){super({id:a.ID,title:{...L(3283,"Video Tutorials"),mnemonicTitle:d(3275,null)},category:We.Help,f1:!0,menu:{id:D.MenubarHelpMenu,group:"2_reference",order:2}})}run(i){let e=i.get(nt),t=i.get(Qe);e.introductoryVideosUrl&&t.open(A.parse(e.introductoryVideosUrl))}},YMt=class a extends K{static{this.ID="workbench.action.openTipsAndTricksUrl"}static{this.AVAILABLE=!!to.tipsAndTricksUrl}constructor(){super({id:a.ID,title:{...L(3281,"Tips and Tricks"),mnemonicTitle:d(3273,null)},category:We.Help,f1:!0,menu:{id:D.MenubarHelpMenu,group:"2_reference",order:3}})}run(i){let e=i.get(nt),t=i.get(Qe);e.tipsAndTricksUrl&&t.open(A.parse(e.tipsAndTricksUrl))}},XMt=class a extends K{static{this.ID="workbench.action.openDocumentationUrl"}static{this.AVAILABLE=!!(Gt?to.serverDocumentationUrl:to.documentationUrl)}constructor(){super({id:a.ID,title:{...L(3278,"Documentation"),mnemonicTitle:d(3269,null)},category:We.Help,f1:!0,menu:{id:D.MenubarHelpMenu,group:"1_welcome",order:3}})}run(i){let e=i.get(nt),t=i.get(Qe),o=Gt?e.serverDocumentationUrl:e.documentationUrl;o&&t.open(A.parse(o))}},JMt=class a extends K{static{this.ID="workbench.action.openNewsletterSignupUrl"}static{this.AVAILABLE=!!to.newsletterSignupUrl}constructor(){super({id:a.ID,title:L(3277,"Signup for the VS Code Newsletter"),category:We.Help,f1:!0})}run(i){let e=i.get(nt),t=i.get(Qe),o=i.get(Te);t.open(A.parse(`${e.newsletterSignupUrl}?machineId=${encodeURIComponent(o.machineId)}`))}},ZMt=class a extends K{static{this.ID="workbench.action.openYouTubeUrl"}static{this.AVAILABLE=!!to.youTubeUrl}constructor(){super({id:a.ID,title:{...L(3284,"Join Us on YouTube"),mnemonicTitle:d(3276,null)},category:We.Help,f1:!0,menu:{id:D.MenubarHelpMenu,group:"3_feedback",order:1}})}run(i){let e=i.get(nt),t=i.get(Qe);e.youTubeUrl&&t.open(A.parse(e.youTubeUrl))}},ePt=class a extends K{static{this.ID="workbench.action.openRequestFeatureUrl"}static{this.AVAILABLE=!!to.requestFeatureUrl}constructor(){super({id:a.ID,title:{...L(3282,"Search Feature Requests"),mnemonicTitle:d(3274,null)},category:We.Help,f1:!0,menu:{id:D.MenubarHelpMenu,group:"3_feedback",order:2}})}run(i){let e=i.get(nt),t=i.get(Qe);e.requestFeatureUrl&&t.open(A.parse(e.requestFeatureUrl))}},tPt=class a extends K{static{this.ID="workbench.action.openLicenseUrl"}static{this.AVAILABLE=!!(Gt?to.serverLicense:to.licenseUrl)}constructor(){super({id:a.ID,title:{...L(3279,"View License"),mnemonicTitle:d(3271,null)},category:We.Help,f1:!0,menu:{id:D.MenubarHelpMenu,group:"4_legal",order:1}})}run(i){let e=i.get(nt),t=i.get(Qe),o=Gt?e.serverLicenseUrl:e.licenseUrl;if(o)if(Dr){let n=o.indexOf("?")>0?"&":"?";t.open(A.parse(`${o}${n}lang=${Dr}`))}else t.open(A.parse(o))}},iPt=class a extends K{static{this.ID="workbench.action.openPrivacyStatementUrl"}static{this.AVAILABLE=!!to.privacyStatementUrl}constructor(){super({id:a.ID,title:{...L(3280,"Privacy Statement"),mnemonicTitle:d(3272,null)},category:We.Help,f1:!0,menu:{id:D.MenubarHelpMenu,group:"4_legal",order:2}})}run(i){let e=i.get(nt),t=i.get(Qe);e.privacyStatementUrl&&t.open(A.parse(e.privacyStatementUrl))}},qgi=class a extends K{static{this.ID="workbench.action.getStartedWithAccessibilityFeatures"}constructor(){super({id:a.ID,title:L(3267,"Get Started with Accessibility Features"),category:We.Help,f1:!0,menu:{id:D.MenubarHelpMenu,group:"1_welcome",order:6}})}run(i){i.get(ge).executeCommand("workbench.action.openWalkthrough","SetupAccessibility")}},oPt=class a extends K{static{this.ID="workbench.action.askVScode"}constructor(){super({id:a.ID,title:L(3266,"Ask @vscode"),category:We.Help,f1:!0,precondition:x.equals("chatSetupHidden",!1)})}async run(i){i.get(ge).executeCommand("workbench.action.chat.open",{mode:"agent",query:"@vscode ",isPartialQuery:!0})}};fe.appendMenuItem(D.MenubarHelpMenu,{command:{id:oPt.ID,title:L(3266,"Ask @vscode")},order:7,group:"1_welcome",when:x.equals("chatSetupHidden",!1)});jMt.AVAILABLE&&W(jMt);QMt.AVAILABLE&&W(QMt);YMt.AVAILABLE&&W(YMt);XMt.AVAILABLE&&W(XMt);JMt.AVAILABLE&&W(JMt);ZMt.AVAILABLE&&W(ZMt);ePt.AVAILABLE&&W(ePt);tPt.AVAILABLE&&W(tPt);iPt.AVAILABLE&&W(iPt);W(qgi);W(oPt);function jgi(a){let i=a?.getHTMLElement();i&&!sa(i)&&a?.domFocus()}async function VGo(a,i){if(!Zae.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 bR(a,i){if(!a)return;await VGo(a,i);let e=a.getFocus();e.length&&a.reveal(e[0]),a.setAnchor(e[0]),jgi(a)}yt.registerCommandAndKeybindingRule({id:"list.focusDown",weight:200,when:rc,primary:18,mac:{primary:18,secondary:[300]},handler:(a,i)=>{bR(a.get(fo).lastFocusedList,async e=>{let t=new KeyboardEvent("keydown");await e.focusNext(typeof i=="number"?i:1,!1,t)})}});yt.registerCommandAndKeybindingRule({id:"list.focusUp",weight:200,when:rc,primary:16,mac:{primary:16,secondary:[302]},handler:(a,i)=>{bR(a.get(fo).lastFocusedList,async e=>{let t=new KeyboardEvent("keydown");await e.focusPrevious(typeof i=="number"?i:1,!1,t)})}});yt.registerCommandAndKeybindingRule({id:"list.focusAnyDown",weight:200,when:rc,primary:530,mac:{primary:530,secondary:[812]},handler:(a,i)=>{bR(a.get(fo).lastFocusedList,async e=>{let t=new KeyboardEvent("keydown",{altKey:!0});await e.focusNext(typeof i=="number"?i:1,!1,t)})}});yt.registerCommandAndKeybindingRule({id:"list.focusAnyUp",weight:200,when:rc,primary:528,mac:{primary:528,secondary:[814]},handler:(a,i)=>{bR(a.get(fo).lastFocusedList,async e=>{let t=new KeyboardEvent("keydown",{altKey:!0});await e.focusPrevious(typeof i=="number"?i:1,!1,t)})}});yt.registerCommandAndKeybindingRule({id:"list.focusPageDown",weight:200,when:rc,primary:12,handler:a=>{bR(a.get(fo).lastFocusedList,async i=>{let e=new KeyboardEvent("keydown");await i.focusNextPage(e)})}});yt.registerCommandAndKeybindingRule({id:"list.focusPageUp",weight:200,when:rc,primary:11,handler:a=>{bR(a.get(fo).lastFocusedList,async i=>{let e=new KeyboardEvent("keydown");await i.focusPreviousPage(e)})}});yt.registerCommandAndKeybindingRule({id:"list.focusFirst",weight:200,when:rc,primary:14,handler:a=>{bR(a.get(fo).lastFocusedList,async i=>{let e=new KeyboardEvent("keydown");await i.focusFirst(e)})}});yt.registerCommandAndKeybindingRule({id:"list.focusLast",weight:200,when:rc,primary:13,handler:a=>{bR(a.get(fo).lastFocusedList,async i=>{let e=new KeyboardEvent("keydown");await i.focusLast(e)})}});yt.registerCommandAndKeybindingRule({id:"list.focusAnyFirst",weight:200,when:rc,primary:526,handler:a=>{bR(a.get(fo).lastFocusedList,async i=>{let e=new KeyboardEvent("keydown",{altKey:!0});await i.focusFirst(e)})}});yt.registerCommandAndKeybindingRule({id:"list.focusAnyLast",weight:200,when:rc,primary:525,handler:a=>{bR(a.get(fo).lastFocusedList,async i=>{let e=new KeyboardEvent("keydown",{altKey:!0});await i.focusLast(e)})}});function aio(a,i){if(a instanceof hc||a instanceof A1||a instanceof dO){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 Jy||a instanceof SE||a instanceof gv){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 Qgi(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])}yt.registerCommandAndKeybindingRule({id:"list.expandSelectionDown",weight:200,when:x.and(rc,E7),primary:1042,handler:(a,i)=>{let e=a.get(fo).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),aio(e,t);let n=e.getFocus();n.length&&e.reveal(n[0]),jgi(e)}});yt.registerCommandAndKeybindingRule({id:"list.expandSelectionUp",weight:200,when:x.and(rc,E7),primary:1040,handler:(a,i)=>{let e=a.get(fo).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),aio(e,t);let n=e.getFocus();n.length&&e.reveal(n[0]),jgi(e)}});yt.registerCommandAndKeybindingRule({id:"list.collapse",weight:200,when:x.and(rc,x.or($we,wni)),primary:15,mac:{primary:15,secondary:[2064]},handler:a=>{let i=a.get(fo).lastFocusedList;if(!i||!(i instanceof Jy||i instanceof SE||i instanceof gv))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&&bR(i,r=>{let s=new KeyboardEvent("keydown");r.setFocus([n],s)})}}});yt.registerCommandAndKeybindingRule({id:"list.stickyScroll.collapse",weight:250,when:Gwe,primary:15,mac:{primary:15,secondary:[2064]},handler:a=>{let i=a.get(fo).lastFocusedList;!i||!(i instanceof Jy||i instanceof SE||i instanceof gv)||Qgi(i,e=>i.collapse(e))}});yt.registerCommandAndKeybindingRule({id:"list.collapseAll",weight:200,when:rc,primary:2063,mac:{primary:2063,secondary:[3088]},handler:a=>{let i=a.get(fo).lastFocusedList;i&&!(i instanceof hc||i instanceof A1||i instanceof dO)&&i.collapseAll()}});yt.registerCommandAndKeybindingRule({id:"list.collapseAllToFocus",weight:200,when:rc,handler:a=>{let i=a.get(fo).lastFocusedList,e=IE("keydown",!0);if(i instanceof Jy||i instanceof SE||i instanceof gv){let t=i,o=t.getFocus();o.length>0&&t.collapse(o[0],!0),t.setSelection(o,e),t.setAnchor(o[0])}}});yt.registerCommandAndKeybindingRule({id:"list.focusParent",weight:200,when:rc,handler:a=>{let i=a.get(fo).lastFocusedList;if(!i||!(i instanceof Jy||i instanceof SE||i instanceof gv))return;let e=i,t=e.getFocus();if(t.length===0)return;let o=t[0],n=e.getParentElement(o);n&&bR(i,r=>{let s=new KeyboardEvent("keydown");r.setFocus([n],s)})}});yt.registerCommandAndKeybindingRule({id:"list.expand",weight:200,when:x.and(rc,x.or(qwe,Cni)),primary:17,handler:a=>{let i=a.get(fo).lastFocusedList;if(i){if(i instanceof Jy||i instanceof SE){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&&bR(i,r=>{let s=new KeyboardEvent("keydown");r.setFocus([o],s)})}}else if(i instanceof gv){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&&bR(i,s=>{let l=new KeyboardEvent("keydown");s.setFocus([n],l)})}})}}}});function Ygi(a,i){let e=a.get(fo).lastFocusedList,t=IE("keydown",i);if(e instanceof hc||e instanceof A1||e instanceof dO){let o=e;o.setAnchor(o.getFocus()[0]),o.setSelection(o.getFocus(),t)}else if(e instanceof Jy||e instanceof SE||e instanceof gv){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)}}yt.registerCommandAndKeybindingRule({id:"list.select",weight:200,when:rc,primary:3,mac:{primary:3,secondary:[2066]},handler:a=>{Ygi(a,!1)}});yt.registerCommandAndKeybindingRule({id:"list.stickyScrollselect",weight:250,when:Gwe,primary:3,mac:{primary:3,secondary:[2066]},handler:a=>{let i=a.get(fo).lastFocusedList;!i||!(i instanceof Jy||i instanceof SE||i instanceof gv)||Qgi(i,e=>i.setSelection([e]))}});yt.registerCommandAndKeybindingRule({id:"list.selectAndPreserveFocus",weight:200,when:rc,handler:a=>{Ygi(a,!0)}});yt.registerCommandAndKeybindingRule({id:"list.selectAll",weight:200,when:x.and(rc,E7),primary:2079,handler:a=>{let i=a.get(fo).lastFocusedList;if(i instanceof hc||i instanceof A1||i instanceof dO){let e=i,t=new KeyboardEvent("keydown");e.setSelection(ig(e.length),t)}else if(i instanceof Jy||i instanceof SE||i instanceof gv){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)}}});yt.registerCommandAndKeybindingRule({id:"list.toggleSelection",weight:200,when:rc,primary:3075,handler:a=>{let i=a.get(fo).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]])}});yt.registerCommandAndKeybindingRule({id:"list.showHover",weight:200,primary:Ai(2089,2087),when:rc,handler:async a=>{let e=a.get(fo).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=BGo(s);l&&a.get(tt).showManagedHover(l)}});function BGo(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}yt.registerCommandAndKeybindingRule({id:"list.toggleExpand",weight:200,when:rc,primary:10,handler:a=>{let i=a.get(fo).lastFocusedList;if(i instanceof Jy||i instanceof SE||i instanceof gv){let e=i,t=e.getFocus();if(!e.options.disableExpandOnSpacebar&&t.length>0&&e.isCollapsible(t[0])){e.toggleCollapsed(t[0]);return}}Ygi(a,!0)}});yt.registerCommandAndKeybindingRule({id:"list.stickyScrolltoggleExpand",weight:250,when:Gwe,primary:10,handler:a=>{let i=a.get(fo).lastFocusedList;!i||!(i instanceof Jy||i instanceof SE||i instanceof gv)||Qgi(i)}});yt.registerCommandAndKeybindingRule({id:"list.clear",weight:200,when:x.and(rc,H5e),primary:9,handler:a=>{let i=a.get(fo).lastFocusedList;if(!i)return;let e=i.getSelection(),t=new KeyboardEvent("keydown");if(e.length>1)if(Zae.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)}});qe.registerCommand({id:"list.triggerTypeNavigation",handler:a=>{a.get(fo).lastFocusedList?.triggerTypeNavigation()}});qe.registerCommand({id:"list.toggleFindMode",handler:a=>{let i=a.get(fo).lastFocusedList;if(i instanceof LW||i instanceof gv){let e=i;e.findMode=e.findMode===1?0:1}}});qe.registerCommand({id:"list.toggleFindMatchType",handler:a=>{let i=a.get(fo).lastFocusedList;if(i instanceof LW||i instanceof gv){let e=i;e.findMatchType=e.findMatchType===1?0:1}}});qe.registerCommandAlias("list.toggleKeyboardNavigation","list.triggerTypeNavigation");qe.registerCommandAlias("list.toggleFilterOnType","list.toggleFindMode");yt.registerCommandAndKeybindingRule({id:"list.find",weight:200,when:x.and(B5e,yni),primary:2596,secondary:[61],handler:a=>{let i=a.get(fo).lastFocusedList;i instanceof hc||i instanceof A1||i instanceof dO||(i instanceof LW||i instanceof gv)&&i.openFind()}});yt.registerCommandAndKeybindingRule({id:"list.closeFind",weight:200,when:x.and(B5e,xni),primary:9,handler:a=>{let i=a.get(fo).lastFocusedList;(i instanceof LW||i instanceof gv)&&i.closeFind()}});yt.registerCommandAndKeybindingRule({id:"list.scrollUp",weight:200,when:x.and(rc,Pyt?.negate()),primary:2064,handler:a=>{let i=a.get(fo).lastFocusedList;i&&(i.scrollTop-=10)}});yt.registerCommandAndKeybindingRule({id:"list.scrollDown",weight:200,when:x.and(rc,Ayt?.negate()),primary:2066,handler:a=>{let i=a.get(fo).lastFocusedList;i&&(i.scrollTop+=10)}});yt.registerCommandAndKeybindingRule({id:"list.scrollLeft",weight:200,when:rc,handler:a=>{let i=a.get(fo).lastFocusedList;i&&(i.scrollLeft-=10)}});yt.registerCommandAndKeybindingRule({id:"list.scrollRight",weight:200,when:rc,handler:a=>{let i=a.get(fo).lastFocusedList;i&&(i.scrollLeft+=10)}});W(class extends K{constructor(){super({id:"tree.toggleStickyScroll",title:{...L(3418,"Toggle Tree Sticky Scroll"),mnemonicTitle:d(3417,null)},category:"View",metadata:{description:d(3419,null)},f1:!0})}run(i){let e=i.get(B),t=!e.getValue("workbench.tree.enableStickyScroll");e.updateValue("workbench.tree.enableStickyScroll",t)}});var HGo={separatorBorder:Oe.transparent};function BP(a){return a===0?1:0}var Xgi=class{constructor(i){this.isLayoutEnabled=i}};function UGo(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 zGo(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 WV(a,i){if(Math.abs(a)>i)throw new Error("Invalid index");return Y0(a,i+1)}var yb=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 P;this._onDidScroll=new E;this.onDidScrollDisposable=C.None;this.onDidScroll=this._onDidScroll.event;this.childrenChangeDisposable=C.None;this._onDidSashReset=new E;this.onDidSashReset=this._onDidSashReset.event;this.splitviewSashResetDisposable=C.None;this.childrenSashResetDisposable=C.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 vu(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 vu(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=H.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=WV(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=WV(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=WV(i,this.children.length),e=WV(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=WV(i,this.children.length),e=WV(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=WV(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=WV(i,this.children.length),this.splitview.getViewSize(i)}isChildVisible(i){return i=WV(i,this.children.length),this.splitview.isViewVisible(i)}setChildVisible(i,e){if(i=WV(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=WV(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=H.map(H.any(...this.children.map(o=>o.onDidChange)),()=>{});this.childrenChangeDisposable.dispose(),this.childrenChangeDisposable=i(this._onDidChange.fire,this._onDidChange);let e=H.any(...this.children.map((o,n)=>H.map(o.onDidSashReset,r=>[n,...r])));this.childrenSashResetDisposable.dispose(),this.childrenSashResetDisposable=e(this._onDidSashReset.fire,this._onDidSashReset);let t=H.any(H.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 C.None;if(this.getChildSize(0)!==i.getChildSize(0))return C.None;let[e,t]=this.children,[o,n]=i.children;if(!(e instanceof wb)||!(t instanceof wb))return C.None;if(!(o instanceof wb)||!(n instanceof wb))return C.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 KGo(a){let[i,e]=H.split(a.onDidChange,cn);return H.any(e,H.map(H.latch(H.map(i,t=>[a.minimumWidth,a.maximumWidth,a.minimumHeight,a.maximumHeight]),$i),t=>{}))}var wb=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=H.None;this.onDidSashReset=H.None;this._onDidLinkedWidthNodeChange=new Mh;this._linkedWidthNode=void 0;this._onDidLinkedHeightNodeChange=new Mh;this._linkedHeightNode=void 0;this._onDidSetLinkedNode=new E;this.disposables=new P;this._boundarySashes={};this.cachedWidth=0;this.cachedHeight=0;this.cachedTop=0;this.cachedLeft=0;this._orthogonalSize=o,this._size=n;let r=KGo(i);this._onDidViewChange=H.map(r,s=>s&&(this.orientation===0?s.width:s.height),this.disposables),this.onDidChange=H.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:H.None,this._linkedWidthNode=i,this._onDidSetLinkedNode.fire(void 0)}get linkedHeightNode(){return this._linkedHeightNode}set linkedHeightNode(i){this._onDidLinkedHeightNodeChange.input=i?i._onDidViewChange:H.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?.(UGo(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 lio(a,i,e){if(a instanceof yb){let t=new yb(BP(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 yb?r.orthogonalSize:r.size,l=a.size===0?0:Math.round(i*s/a.size);o+=l,n===0&&(l+=i-o),t.addChild(lio(r,e,l),l,0,!0)}return a.dispose(),t}else{let t=new wb(a.view,BP(a.orientation),a.layoutController,e);return a.dispose(),t}}var oue=class a{constructor(i={}){this.onDidSashResetRelay=new Mh;this._onDidScroll=new Mh;this._onDidChange=new Mh;this._boundarySashes={};this.disposable2x2=C.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||HGo,this.proportionalLayout=typeof i.proportionalLayout<"u"?!!i.proportionalLayout:!0,this.layoutController=new Xgi(!1),this.root=new yb(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=H.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=lio(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=zGo(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=C.None;let[o,n]=Mg(t),[r,s]=this.getNode(o);if(s instanceof yb){let l=new wb(i,BP(s.orientation),this.layoutController,s.orthogonalSize);try{s.addChild(l,e,n)}catch(c){throw l.dispose(),c}}else{let[,l]=Mg(r),[,c]=Mg(o),u=0,p=l.getChildCachedVisibleSize(c);typeof p=="number"&&(u=Wl.Invisible(p)),l.removeChild(c).dispose();let g=new yb(s.orientation,s.layoutController,this.styles,this.proportionalLayout,s.size,s.orthogonalSize,l.edgeSnapping);l.addChild(g,s.size,c);let f=new wb(s.view,l.orientation,this.layoutController,s.size);g.addChild(f,u,0),typeof e!="number"&&e.type==="split"&&(e=Wl.Split(0));let v=new wb(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=C.None;let[t,o]=Mg(i),[n,r]=this.getNode(t);if(!(r instanceof yb))throw new Error("Invalid location");let s=r.children[o];if(!(s instanceof wb))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 wb||(r.removeChild(0),r.dispose(),this.root=g,this.boundarySashes=this.boundarySashes,this.trySet2x2()),s.view}let[,l]=Mg(n),[,c]=Mg(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 yb){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 wb(p.view,BP(p.orientation),this.layoutController,p.size),f=u?p.orthogonalSize:Wl.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 yb))throw new Error("Invalid location");o.moveChild(e,t),this.trySet2x2()}swapViews(i,e){this.hasMaximizedView()&&this.exitMaximizedView();let[t,o]=Mg(i),[,n]=this.getNode(t);if(!(n instanceof yb))throw new Error("Invalid from location");let r=n.getChildSize(o),s=n.children[o];if(!(s instanceof wb))throw new Error("Invalid from location");let[l,c]=Mg(e),[,u]=this.getNode(l);if(!(u instanceof yb))throw new Error("Invalid to location");let p=u.getChildSize(c),h=u.children[c];if(!(h instanceof wb))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]=Mg(i),[n,r]=this.getNode(t);if(!(r instanceof yb))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]=Mg(n),[,u]=Mg(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]=Mg(i),[,o]=this.getNode(e);if(!(o instanceof yb))throw new Error("Invalid location");return o.getChildCachedVisibleSize(t)}expandView(i){this.hasMaximizedView()&&this.exitMaximizedView();let[e,t]=this.getNode(i);if(!(t instanceof wb))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 wb))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 wb))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 wb?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 wb?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 wb))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 yb))throw new Error("Invalid location");e.distributeViewSizes(),this.trySet2x2()}isViewVisible(i){let[e,t]=Mg(i),[,o]=this.getNode(e);if(!(o instanceof yb))throw new Error("Invalid from location");return o.isChildVisible(t)}setViewVisible(i,e){if(this.hasMaximizedView()){this.exitMaximizedView();return}let[t,o]=Mg(i),[,n]=this.getNode(t);if(!(n instanceof yb))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,BP(e),t,i.size),visible:l.visible}));n=new yb(e,this.layoutController,this.styles,this.proportionalLayout,i.size,o,void 0,s)}else n=new wb(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 wb)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,BP(e),l))}return{children:n,box:o}}getNode(i,e=this.root,t=[]){if(i.length===0)return[t,e];if(!(e instanceof yb))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=C.None,this.root.children.length!==2)return;let[i,e]=this.root.children;!(i instanceof yb)||!(e instanceof yb)||(this.disposable2x2=i.trySet2x2(e))}getViewMap(i,e){e||(e=this.root),e instanceof yb?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 GGo(a){switch(a){case 0:return 1;case 1:return 0;case 2:return 3;case 3:return 2}}function oJ(a){return!!a.children}function dio(a,i){if(i.length===0)return a;if(!oJ(a))throw new Error("Invalid location");let[e,...t]=i;return dio(a.children[e],t)}function $Go(a,i){return!(a.start>=i.end||i.start>=a.end)}function uio(a,i){let e=efi(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 qGo(a,i,e){let t=[];function o(n,r,s){if(oJ(n))for(let l of n.children)o(l,r,s);else{let{offset:l,range:c}=uio(n.box,r);l===s.offset&&$Go(c,s.range)&&t.push(n)}}return o(a,i,e),t}function Jgi(a,i){return i.length%2===0?BP(a):a}function efi(a){return a===0||a===1?0:1}function cio(a,i,e){let t=Jgi(a,i),o=efi(e);if(t===o){let[n,r]=Mg(i);return(e===3||e===1)&&(r+=1),[...n,r]}else{let n=e===3||e===1?1:0;return[...i,n]}}function jGo(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 pio(a){let i=a.parentElement;if(!i)throw new Error("Invalid grid element");if(/\bmonaco-grid-view\b/.test(i.className))return[];let e=jGo(i),t=i.parentElement.parentElement.parentElement.parentElement;return[...pio(t),e]}var JTe;(o=>{o.Distribute={type:"distribute"},o.Split={type:"split"},o.Auto={type:"auto"};function t(n){return{type:"invisible",cachedVisibleSize:n}}o.Invisible=t})(JTe||={});var Zgi=class extends C{constructor(e,t={}){super();this.views=new Map;this.didLayout=!1;e instanceof oue?(this.gridview=e,this.gridview.getViewMap(this.views)):this.gridview=new oue(t),this._register(this.gridview),this._register(this.gridview.onDidSashReset(this.onDidSashReset,this)),e instanceof oue||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=efi(n);this.views.size===1&&this.orientation!==r&&(this.orientation=r);let s=this.getViewLocation(o),l=cio(this.gridview.orientation,s,n),c;if(typeof t=="number")c=t;else if(t.type==="split"){let[,u]=Mg(s);c=Wl.Split(u)}else if(t.type==="distribute")c=Wl.Distribute;else if(t.type==="auto"){let[,u]=Mg(s);c=Wl.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=Wl.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=Wl.Distribute;else if(t?.type==="auto"){let r=o[o.length-1];n=Wl.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]=Mg(r),c=this.getViewLocation(o),u=cio(this.gridview.orientation,c,n),[p,h]=Mg(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]=Mg(o),[s,l]=Mg(t);if($i(n,s))this.gridview.moveView(n,r,l);else{let c=this.getViewSize(e),u=Jgi(this.gridview.orientation,o),p=this.getViewCachedVisibleSize(e),h=typeof p>"u"?u===1?c.width:c.height:JTe.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=dio(r,n),l=uio(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})),qGo(r,GGo(t),l).map(c=>c.view)}getViewLocation(e){let t=this.views.get(e);if(!t)throw new Error("View not found");return pio(t)}onDidSashReset(e){let t=r=>{let s=this.gridview.getView(r);if(oJ(s))return!1;let l=Jgi(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]=Mg(e);t([...o,n+1])||this.gridview.distributeViewSizes(o)}},O5=class a extends Zgi{constructor(){super(...arguments);this.initialLayoutContext=!0}static serializeNode(e,t){let o=t===0?e.box.width:e.box.height;if(!oJ(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,BP(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=oue.deserialize(e,t,o);return new a(n,o)}static from(e,t={}){return a.deserialize(tfi(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 mio(a){return!!a.groups}function hio(a,i){if(!i&&a.groups&&a.groups.length<=1&&(a.groups=void 0),!mio(a))return;let e=0,t=0;for(let s of a.groups)hio(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 gio(a){return mio(a)?{type:"branch",data:a.groups.map(i=>gio(i)),size:a.size}:{type:"leaf",data:a.data,size:a.size}}function fio(a,i){if(a.type==="branch"){let e=a.data.map(t=>fio(t,BP(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 tfi(a){hio(a,!0);let i=gio(a),{width:e,height:t}=fio(i,a.orientation);return{root:i,orientation:a.orientation,width:e||1,height:t||1}}var ZTe=class extends K{constructor(e,t){super(e);this.direction=t}run(e){let t=e.get(fi),o=e.get(Et),n=e.get(ds),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 ZTe{constructor(){super({id:"workbench.action.navigateLeft",title:L(3423,"Navigate to the View on the Left"),category:We.View,f1:!0},2)}});W(class extends ZTe{constructor(){super({id:"workbench.action.navigateRight",title:L(3424,"Navigate to the View on the Right"),category:We.View,f1:!0},3)}});W(class extends ZTe{constructor(){super({id:"workbench.action.navigateUp",title:L(3425,"Navigate to the View Above"),category:We.View,f1:!0},0)}});W(class extends ZTe{constructor(){super({id:"workbench.action.navigateDown",title:L(3422,"Navigate to the View Below"),category:We.View,f1:!0},1)}});var nPt=class extends K{constructor(e,t){super(e);this.focusNext=t}run(e){let t=e.get(fi),o=e.get(ee);this.focusNextOrPreviousPart(t,o,this.focusNext)}findVisibleNeighbour(e,t,o){let n=Ki(),r=Cy(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 nPt{constructor(){super({id:"workbench.action.focusNextPart",title:L(3420,"Focus Next Part"),category:We.View,f1:!0,keybinding:{primary:64,weight:200}},!0)}});W(class extends nPt{constructor(){super({id:"workbench.action.focusPreviousPart",title:L(3421,"Focus Previous Part"),category:We.View,f1:!0,keybinding:{primary:1088,weight:200}},!1)}});var vio="inQuickOpen",bio=new Q(vio,!1,d(4261,null)),$E=x.has(vio),ifi="inFilesPicker",ofi=x.and($E,x.has(ifi));function Y_(a,i){return e=>{let t=e.get(_e),o=e.get(Ge),r={keybindings:t.lookupKeybindings(a)};o.navigate(!!i,r)}}var oK=class extends C{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:F2i(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()}};oK=I([m(0,ee),m(1,Et)],oK);function nfi(a){return a?.hasOwnProperty("folderUri")}function Sio(a){return a?.hasOwnProperty("workspace")}var wio="inRecentFilesPicker",rPt=class extends K{constructor(){super(...arguments);this.removeFromRecentlyOpened={iconClass:q.asClassName(M.removeClose),tooltip:d(3468,null)};this.dirtyRecentlyOpenedFolder={iconClass:"dirty-workspace "+q.asClassName(M.closeDirty),tooltip:d(3445,null),alwaysVisible:!0};this.dirtyRecentlyOpenedWorkspace={...this.dirtyRecentlyOpenedFolder,tooltip:d(3446,null)};this.windowOpenedRecentlyOpenedFolder={iconClass:"opened-workspace "+q.asClassName(M.window),tooltip:d(3459,null),alwaysVisible:!0};this.windowOpenedRecentlyOpenedWorkspace={...this.windowOpenedRecentlyOpenedFolder,tooltip:d(3460,null)};this.activeWindowOpenedRecentlyOpenedFolder={iconClass:"opened-workspace "+q.asClassName(M.windowActive),tooltip:d(3439,null),alwaysVisible:!0};this.activeWindowOpenedRecentlyOpenedWorkspace={...this.activeWindowOpenedRecentlyOpenedFolder,tooltip:d(3440,null)}}async run(e){let t=e.get(Ff),o=e.get(Ge),n=e.get(Pe),r=e.get(ot),s=e.get(_e),l=e.get(Ct),c=e.get(kt),u=e.get(oi),p=e.get(ct),[h,g,f]=await Promise.all([u.getWindows({includeAuxiliaryWindows:!1}),t.getRecentlyOpened(),t.getDirtyWorkspaces()]),v=!1,b=new vt,S=new vt;for(let se of f)nfi(se)?b.set(se.folderUri,!0):(S.set(se.workspace.configPath,se.workspace),v=!0);let y=Ki().vscodeWindowId,w=new vt;for(let se of h){let Se=se.id===y;$g(se.workspace)?w.set(se.workspace.uri,{isActive:Se}):TL(se.workspace)&&w.set(se.workspace.configPath,{isActive:Se})}let k=new vt,T=new vt;for(let se of g.workspaces)Ode(se)?k.set(se.folderUri,!0):(T.set(se.workspace.configPath,se.workspace),v=!0);let N=[];for(let se of g.workspaces){let Se=Ode(se)?b.has(se.folderUri):S.has(se.workspace.configPath),ke=Ode(se)?w.get(se.folderUri):w.get(se.workspace.configPath);N.push(this.toQuickPick(l,c,r,se,{isDirty:Se,windowState:ke}))}for(let se of f)nfi(se)&&!k.has(se.folderUri)?N.push(this.toQuickPick(l,c,r,se,{isDirty:!0,windowState:void 0})):Sio(se)&&!T.has(se.workspace.configPath)&&N.push(this.toQuickPick(l,c,r,se,{isDirty:!0,windowState:void 0}));let O=g.files.map(se=>this.toQuickPick(l,c,r,se,{isDirty:!1,windowState:void 0})),V=g.workspaces[0],U=V&&n.isCurrentWorkspace(L9e(V)?V.workspace:V.folderUri),G,$={type:"separator",label:v?d(3470,null):d(3451,null)},te={type:"separator",label:d(3450,null)},pe=[$,...N,te,...O],de=await o.pick(pe,{contextKey:wio,activeItem:[...N,...O][U?1:0],placeHolder:it?d(3463,null):d(3462,null),matchOnDescription:!0,sortByLabel:!1,onKeyMods:se=>G=se,quickNavigate:this.isQuickNavigate()?{keybindings:s.lookupKeybindings(this.desc.id)}:void 0,hideInput:this.isQuickNavigate(),onDidTriggerItemButton:async se=>{if(se.button===this.removeFromRecentlyOpened||se.button===this.windowOpenedRecentlyOpenedFolder||se.button===this.windowOpenedRecentlyOpenedWorkspace)await t.removeRecentlyOpened([se.item.resource]),se.removeItem();else if(se.button===this.dirtyRecentlyOpenedFolder||se.button===this.dirtyRecentlyOpenedWorkspace){let Se=se.button===this.dirtyRecentlyOpenedWorkspace,{confirmed:ke}=await p.confirm({title:Se?d(3447,null):d(3442,null),message:Se?d(3448,null):d(3443,null),detail:Se?d(3449,null):d(3444,null)});ke&&(u.openWindow([se.item.openable],{remoteAuthority:se.item.remoteAuthority||null}),o.cancel())}}});if(de)return u.openWindow([de.openable],{forceNewWindow:G?.ctrlCmd,forceReuseWindow:G?.alt,remoteAuthority:de.remoteAuthority||null})}toQuickPick(e,t,o,n,r){let s,l,c,u,p=!1;Ode(n)?(u=n.folderUri,l=js(e,t,u,1),s={folderUri:u},c=n.label||o.getWorkspaceLabel(u,{verbose:2})):L9e(n)?(u=n.workspace.configPath,l=js(e,t,u,2),s={workspaceUri:u},c=n.label||o.getWorkspaceLabel(n.workspace,{verbose:2}),p=!0):(u=n.fileUri,l=js(e,t,u,0),s={fileUri:u},c=n.label||o.getUriLabel(u,{appendWorkspaceSuffix:!0}));let{name:h,parentPath:g}=_$i(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(3466,null,h):d(3465,null,h):h,description:g,buttons:f,openable:s,resource:u,remoteAuthority:n.remoteAuthority}}},F5=class a extends rPt{static{this.ID="workbench.action.openRecent"}constructor(){super({id:a.ID,title:{...L(3461,"Open Recent..."),mnemonicTitle:d(3454,null)},category:We.File,f1:!0,keybinding:{weight:200,primary:2096,mac:{primary:304}},menu:{id:D.MenubarRecentMenu,group:"y_more",order:1}})}isQuickNavigate(){return!1}},rfi=class extends rPt{constructor(){super({id:"workbench.action.quickOpenRecent",title:L(3464,"Quick Open Recent..."),category:We.File,f1:!1})}isQuickNavigate(){return!0}},sfi=class extends K{constructor(){super({id:"workbench.action.toggleFullScreen",title:{...L(3469,"Toggle Full Screen"),mnemonicTitle:d(3457,null)},category:We.View,f1:!0,keybinding:{weight:200,primary:69,mac:{primary:2340}},precondition:xyt.toNegated(),toggled:lP,menu:[{id:D.MenubarAppearanceMenu,group:"1_toggle_view",order:1}]})}run(i){return i.get(oi).toggleFullScreen(Ki())}},nJ=class a extends K{static{this.ID="workbench.action.reloadWindow"}constructor(){super({id:a.ID,title:L(3467,"Reload Window"),category:We.Developer,f1:!0,keybinding:{weight:250,when:Gq,primary:2096}})}async run(i){return i.get(oi).reload()}},afi=class extends K{constructor(){super({id:"workbench.action.showAboutDialog",title:{...L(3438,"About"),mnemonicTitle:d(3452,null)},category:We.Help,f1:!0,menu:{id:D.MenubarHelpMenu,group:"z_about",order:1,when:Mx.toNegated()}})}run(i){return i.get(ct).about()}},lfi=class extends K{constructor(){super({id:"workbench.action.newWindow",title:{...L(3458,"New Window"),mnemonicTitle:d(3455,null)},f1:!0,keybinding:{weight:200,primary:Gt?ri?Ai(2089,1068):3628:3116,secondary:Gt?[3116]:void 0},menu:{id:D.MenubarFileMenu,group:"1_new",order:3}})}run(i){return i.get(oi).openWindow({remoteAuthority:null})}},cfi=class extends K{constructor(){super({id:"workbench.action.blur",title:L(3441,"Remove keyboard focus from focused element")})}run(){let i=Pn();Ao(i)&&i.blur()}};W(lfi);W(sfi);W(rfi);W(F5);W(nJ);W(afi);W(cfi);var Cio=x.and($E,x.has(wio)),Iio="workbench.action.quickOpenNavigateNextInRecentFilesPicker";yt.registerCommandAndKeybindingRule({id:Iio,weight:250,handler:Y_(Iio,!0),when:Cio,primary:2096,mac:{primary:304}});var yio="workbench.action.quickOpenNavigatePreviousInRecentFilesPicker";yt.registerCommandAndKeybindingRule({id:yio,weight:250,handler:Y_(yio,!1),when:Cio,primary:3120,mac:{primary:1328}});qe.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")});fe.appendMenuItem(D.MenubarFileMenu,{group:"z_ConfirmClose",command:{id:"workbench.action.toggleConfirmBeforeClose",title:d(3453,null),toggled:x.notEquals("config.window.confirmBeforeClose","never")},order:1,when:ep});fe.appendMenuItem(D.MenubarFileMenu,{title:d(3456,null),submenu:D.MenubarRecentMenu,group:"2_open",order:4});var e_e="addRootFolder",sPt=L(3491,"Add Folder to Workspace..."),dfi="setRootFolder",SR="_workbench.pickWorkspaceFolder";qe.registerCommand({id:"workbench.action.files.openFileFolderInNewWindow",handler:a=>a.get(dn).pickFileFolderAndOpen({forceNewWindow:!0})});qe.registerCommand({id:"_files.pickFolderAndOpen",handler:(a,i)=>a.get(dn).pickFolderAndOpen(i)});qe.registerCommand({id:"workbench.action.files.openFolderInNewWindow",handler:a=>a.get(dn).pickFolderAndOpen({forceNewWindow:!0})});qe.registerCommand({id:"workbench.action.files.openFileInNewWindow",handler:a=>a.get(dn).pickFileAndOpen({forceNewWindow:!0})});qe.registerCommand({id:"workbench.action.openWorkspaceInNewWindow",handler:a=>a.get(dn).pickWorkspaceAndOpen({forceNewWindow:!0})});qe.registerCommand({id:e_e,handler:async a=>{let i=a.get(Of),e=await xio(a);e?.length&&await i.addFolders(e.map(t=>({uri:t})))}});qe.registerCommand({id:dfi,handler:async a=>{let i=a.get(Of),e=a.get(Pe),t=await xio(a);t?.length&&await i.updateFolders(0,e.getWorkspace().folders.length,t.map(o=>({uri:o})))}});async function xio(a){let i=a.get(dn),e=a.get(wn);return await i.showOpenDialog({openLabel:$$(d(3490,null)),title:d(3492,null),canSelectFolders:!0,canSelectMany:!0,defaultUri:await i.defaultFolderPath(),availableFileSystems:[e.defaultUriScheme]})}qe.registerCommand(SR,async function(a,i){let e=a.get(Ge),t=a.get(ot),o=a.get(Pe),n=a.get(Ct),r=a.get(kt),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:js(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(3493,null)),typeof c.matchOnDescription!="boolean"&&(c.matchOnDescription=!0);let u=(i?i[1]:void 0)||ve.None,p=await e.pick(l,c,u);if(p)return s[l.indexOf(p)]});qe.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=o7(o)||o.scheme===Y.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"}]}});qe.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"}]}});qe.registerCommand("_workbench.removeFromRecentlyOpened",function(a,i){return a.get(Ff).removeRecentlyOpened([i])});qe.registerCommand({id:"vscode.removeFromRecentlyOpened",handler:(a,i)=>{let e=a.get(Ff);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}]}});qe.registerCommand("_workbench.addToRecentlyOpened",async function(a,i){let e=a.get(Ff),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])});qe.registerCommand("_workbench.getRecentlyOpened",async function(a){return a.get(Ff).getRecentlyOpened()});var n_e=L(3489,"Workspaces"),t_e=class a extends K{static{this.ID="workbench.action.files.openFile"}constructor(){super({id:a.ID,title:L(3483,"Open File..."),category:We.File,f1:!0,keybinding:{when:Mx.toNegated(),weight:200,primary:2093}})}async run(i,e){return i.get(dn).pickFileAndOpen({forceNewWindow:!1,telemetryExtraData:e})}},nK=class a extends K{static{this.ID="workbench.action.files.openFolder"}constructor(){super({id:a.ID,title:L(3485,"Open Folder..."),category:We.File,f1:!0,precondition:PO,keybinding:{weight:200,primary:void 0,linux:{primary:Ai(2089,2093)},win:{primary:Ai(2089,2093)}}})}async run(i,e){return i.get(dn).pickFolderAndOpen({forceNewWindow:!1,telemetryExtraData:e})}},i_e=class a extends K{static{this.ID="workbench.action.files.openFolderViaWorkspace"}constructor(){super({id:a.ID,title:L(3485,"Open Folder..."),category:We.File,f1:!0,precondition:x.and(PO.toNegated(),Qa.isEqualTo("workspace")),keybinding:{weight:200,primary:2093}})}run(i){return i.get(ge).executeCommand(dfi)}},aPt=class a extends K{static{this.ID="workbench.action.files.openFileFolder"}static{this.LABEL=L(3484,"Open...")}constructor(){super({id:a.ID,title:a.LABEL,category:We.File,f1:!0,precondition:x.and(Mx,PO),keybinding:{weight:200,primary:2093}})}async run(i,e){return i.get(dn).pickFileFolderAndOpen({forceNewWindow:!1,telemetryExtraData:e})}},lPt=class a extends K{static{this.ID="workbench.action.openWorkspace"}constructor(){super({id:a.ID,title:L(3486,"Open Workspace from File..."),category:We.File,f1:!0,precondition:T_})}async run(i,e){return i.get(dn).pickWorkspaceAndOpen({telemetryExtraData:e})}},c7e=class a extends K{static{this.ID="workbench.action.closeFolder"}constructor(){super({id:a.ID,title:L(3471,"Close Workspace"),category:n_e,f1:!0,precondition:x.and(Qa.notEqualsTo("empty"),xY),keybinding:{weight:200,primary:Ai(2089,36)}})}async run(i){let e=i.get(oi),t=i.get(Vt);return e.openWindow({forceReuseWindow:!0,remoteAuthority:t.remoteAuthority})}},ufi=class a extends K{static{this.ID="workbench.action.openWorkspaceConfigFile"}constructor(){super({id:a.ID,title:L(3487,"Open Workspace Configuration File"),category:n_e,f1:!0,precondition:Qa.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}})}},o_e=class a extends K{static{this.ID="workbench.action.addRootFolder"}constructor(){super({id:a.ID,title:sPt,category:n_e,f1:!0,precondition:x.or(T_,Qa.isEqualTo("workspace"))})}run(i){return i.get(ge).executeCommand(e_e)}},d7e=class a extends K{static{this.ID="workbench.action.removeRootFolder"}constructor(){super({id:a.ID,title:L(3474,"Remove Folder from Workspace..."),category:n_e,f1:!0,precondition:x.and(mC.notEqualsTo("0"),x.or(T_,Qa.isEqualTo("workspace")))})}async run(i){let e=i.get(ge),t=i.get(Of),o=await e.executeCommand(SR);o&&await t.removeFolders([o.uri])}},cPt=class a extends K{static{this.ID="workbench.action.saveWorkspaceAs"}constructor(){super({id:a.ID,title:L(3488,"Save Workspace As..."),category:n_e,f1:!0,precondition:T_})}async run(i){let e=i.get(Of),t=i.get(Pe),o=await e.pickNewWorkspacePath();if(o&&o7(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)}}},dPt=class a extends K{static{this.ID="workbench.action.duplicateWorkspaceInNewWindow"}constructor(){super({id:a.ID,title:L(3473,"Duplicate As Workspace in New Window"),category:n_e,f1:!0,precondition:T_})}async run(i){let e=i.get(Pe),t=i.get(Of),o=i.get(oi),n=i.get(Ff),r=i.get(Vt),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(o_e);W(d7e);W(t_e);W(nK);W(i_e);W(aPt);W(lPt);W(ufi);W(c7e);W(cPt);W(dPt);fe.appendMenuItem(D.MenubarFileMenu,{group:"2_open",command:{id:t_e.ID,title:d(3479,null)},order:1,when:Mx.toNegated()});fe.appendMenuItem(D.MenubarFileMenu,{group:"2_open",command:{id:nK.ID,title:d(3480,null)},order:2,when:PO});fe.appendMenuItem(D.MenubarFileMenu,{group:"2_open",command:{id:i_e.ID,title:d(3480,null)},order:2,when:x.and(PO.toNegated(),Qa.isEqualTo("workspace"))});fe.appendMenuItem(D.MenubarFileMenu,{group:"2_open",command:{id:aPt.ID,title:d(3478,null)},order:1,when:x.and(Mx,PO)});fe.appendMenuItem(D.MenubarFileMenu,{group:"2_open",command:{id:lPt.ID,title:d(3481,null)},order:3,when:T_});fe.appendMenuItem(D.MenubarFileMenu,{group:"3_workspace",command:{id:e_e,title:d(3475,null)},when:x.or(T_,Qa.isEqualTo("workspace")),order:1});fe.appendMenuItem(D.MenubarFileMenu,{group:"3_workspace",command:{id:cPt.ID,title:d(3482,null)},order:2,when:T_});fe.appendMenuItem(D.MenubarFileMenu,{group:"3_workspace",command:{id:dPt.ID,title:d(3472,null)},order:3,when:T_});fe.appendMenuItem(D.MenubarFileMenu,{group:"6_close",command:{id:c7e.ID,title:d(3476,null)},order:3,when:x.and(Qa.isEqualTo("folder"),xY)});fe.appendMenuItem(D.MenubarFileMenu,{group:"6_close",command:{id:c7e.ID,title:d(3477,null)},order:3,when:x.and(Qa.isEqualTo("workspace"),xY)});var W5={primary:2094,secondary:[2083],mac:{primary:2094,secondary:void 0}};yt.registerCommandAndKeybindingRule({id:"workbench.action.closeQuickOpen",weight:200,when:$E,primary:9,secondary:[1033],handler:a=>a.get(Ge).cancel(2)});yt.registerCommandAndKeybindingRule({id:"workbench.action.acceptSelectedQuickOpenItem",weight:200,when:$E,primary:0,handler:a=>a.get(Ge).accept()});yt.registerCommandAndKeybindingRule({id:"workbench.action.alternativeAcceptSelectedQuickOpenItem",weight:200,when:$E,primary:0,handler:a=>a.get(Ge).accept({ctrlCmd:!0,alt:!1})});yt.registerCommandAndKeybindingRule({id:"workbench.action.focusQuickOpen",weight:200,when:$E,primary:0,handler:a=>{a.get(Ge).focus()}});var kio="workbench.action.quickOpenNavigateNextInFilePicker";yt.registerCommandAndKeybindingRule({id:kio,weight:250,handler:Y_(kio,!0),when:ofi,primary:W5.primary,secondary:W5.secondary,mac:W5.mac});var Eio="workbench.action.quickOpenNavigatePreviousInFilePicker";yt.registerCommandAndKeybindingRule({id:Eio,weight:250,handler:Y_(Eio,!1),when:ofi,primary:W5.primary|1024,secondary:[W5.secondary[0]|1024],mac:{primary:W5.mac.primary|1024,secondary:void 0}});yt.registerCommandAndKeybindingRule({id:"workbench.action.quickPickManyToggle",weight:200,when:$E,primary:0,handler:a=>{a.get(Ge).toggle()}});yt.registerCommandAndKeybindingRule({id:"workbench.action.quickInputBack",weight:250,when:$E,primary:0,win:{primary:527},mac:{primary:344},linux:{primary:2648},handler:a=>{a.get(Ge).back()}});W(class extends K{constructor(){super({id:"workbench.action.quickOpen",title:L(3428,"Go to File..."),metadata:{description:"Quick access",args:[{name:"prefix",schema:{type:"string"}}]},keybinding:{weight:200,primary:W5.primary,secondary:W5.secondary,mac:W5.mac},f1:!0})}run(i,e){i.get(Ge).quickAccess.show(typeof e=="string"?e:void 0,{preserveValue:typeof e=="string"})}});W(class extends K{constructor(){super({id:"workbench.action.quickOpenWithModes",title:d(3429,null),icon:M.search,menu:{id:D.CommandCenterCenter,order:100}})}run(i){let e=i.get(Ge),t={includeHelp:!0,from:"commandCenter"};e.quickAccess.show(void 0,{preserveValue:!0,providerOptions:t})}});qe.registerCommand("workbench.action.quickOpenPreviousEditor",async a=>{a.get(Ge).quickAccess.show("",{itemActivation:2})});var r_e=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(Ge),n=t.lookupKeybindings(this.id),r=this.quickNavigate?{keybindings:n}:void 0;o.navigate(this.next,r)}},pfi=class extends r_e{constructor(){super("workbench.action.quickOpenNavigateNext",L(3426,"Navigate Next in Quick Open"),!0,!0)}},mfi=class extends r_e{constructor(){super("workbench.action.quickOpenNavigatePrevious",L(3427,"Navigate Previous in Quick Open"),!1,!0)}},hfi=class extends r_e{constructor(){super("workbench.action.quickOpenSelectNext",L(3430,"Select Next in Quick Open"),!0,!1,{weight:250,when:$E,primary:0,mac:{primary:300}})}},gfi=class extends r_e{constructor(){super("workbench.action.quickOpenSelectPrevious",L(3431,"Select Previous in Quick Open"),!1,!1,{weight:250,when:$E,primary:0,mac:{primary:302}})}};W(hfi);W(gfi);W(pfi);W(mfi);var Dio=[{key:"commandPalette",id:D.CommandPalette,description:d(16527,null),supportsSubmenus:!1},{key:"touchBar",id:D.TouchBarContext,description:d(16565,null),supportsSubmenus:!1},{key:"editor/title",id:D.EditorTitle,description:d(16538,null)},{key:"editor/title/run",id:D.EditorTitleRun,description:d(16540,null)},{key:"editor/context",id:D.EditorContext,description:d(16534,null)},{key:"editor/context/copy",id:D.EditorContextCopy,description:d(16535,null)},{key:"editor/context/share",id:D.EditorContextShare,description:d(16536,null),proposed:"contribShareMenu"},{key:"explorer/context",id:D.ExplorerContext,description:d(16541,null)},{key:"explorer/context/share",id:D.ExplorerContextShare,description:d(16542,null),proposed:"contribShareMenu"},{key:"editor/title/context",id:D.EditorTitleContext,description:d(16537,null)},{key:"editor/title/context/share",id:D.EditorTitleContextShare,description:d(16539,null),proposed:"contribShareMenu"},{key:"debug/callstack/context",id:D.DebugCallStackContext,description:d(16528,null)},{key:"debug/variables/context",id:D.DebugVariablesContext,description:d(16531,null)},{key:"debug/watch/context",id:D.DebugWatchContext,description:d(16532,null)},{key:"debug/toolBar",id:D.DebugToolBar,description:d(16530,null)},{key:"debug/createConfiguration",id:D.DebugCreateConfiguration,proposed:"contribDebugCreateConfiguration",description:d(16529,null)},{key:"notebook/variables/context",id:D.NotebookVariablesContext,description:d(16551,null)},{key:"menuBar/home",id:D.MenubarHomeMenu,description:d(16546,null),proposed:"contribMenuBarHome",supportsSubmenus:!1},{key:"menuBar/edit/copy",id:D.MenubarCopy,description:d(16552,null)},{key:"scm/title",id:D.SCMTitle,description:d(16560,null)},{key:"scm/sourceControl",id:D.SCMSourceControl,description:d(16557,null)},{key:"scm/repositories/title",id:D.SCMSourceControlTitle,description:d(16559,null),proposed:"contribSourceControlTitleMenu"},{key:"scm/repository",id:D.SCMSourceControlInline,description:d(16558,null)},{key:"scm/resourceState/context",id:D.SCMResourceContext,description:d(16555,null)},{key:"scm/resourceFolder/context",id:D.SCMResourceFolderContext,description:d(16553,null)},{key:"scm/resourceGroup/context",id:D.SCMResourceGroupContext,description:d(16554,null)},{key:"scm/change/title",id:D.SCMChangeContext,description:d(16517,null)},{key:"scm/inputBox",id:D.SCMInputBox,description:d(16547,null),proposed:"contribSourceControlInputBoxMenu"},{key:"scm/history/title",id:D.SCMHistoryTitle,description:d(16556,null),proposed:"contribSourceControlHistoryTitleMenu"},{key:"scm/historyItem/context",id:D.SCMHistoryItemContext,description:d(16544,null),proposed:"contribSourceControlHistoryItemMenu"},{key:"scm/historyItemRef/context",id:D.SCMHistoryItemRefContext,description:d(16545,null),proposed:"contribSourceControlHistoryItemMenu"},{key:"scm/artifactGroup/context",id:D.SCMArtifactGroupContext,description:d(16516,null),proposed:"contribSourceControlArtifactGroupMenu"},{key:"scm/artifact/context",id:D.SCMArtifactContext,description:d(16515,null),proposed:"contribSourceControlArtifactMenu"},{key:"statusBar/remoteIndicator",id:D.StatusBarRemoteIndicatorMenu,description:d(16562,null),supportsSubmenus:!1},{key:"terminal/context",id:D.TerminalInstanceContext,description:d(16563,null)},{key:"terminal/title/context",id:D.TerminalTabContext,description:d(16564,null)},{key:"view/title",id:D.ViewTitle,description:d(16603,null)},{key:"viewContainer/title",id:D.ViewContainerTitle,description:d(16596,null),proposed:"contribViewContainerTitle"},{key:"view/item/context",id:D.ViewItemContext,description:d(16597,null)},{key:"comments/comment/editorActions",id:D.CommentEditorActions,description:d(16501,null),proposed:"contribCommentEditorActionsMenu"},{key:"comments/commentThread/title",id:D.CommentThreadTitle,description:d(16502,null)},{key:"comments/commentThread/context",id:D.CommentThreadActions,description:d(16500,null),supportsSubmenus:!1},{key:"comments/commentThread/additionalActions",id:D.CommentThreadAdditionalActions,description:d(16500,null),supportsSubmenus:!0,proposed:"contribCommentThreadAdditionalMenu"},{key:"comments/commentThread/title/context",id:D.CommentThreadTitleContext,description:d(16503,null),proposed:"contribCommentPeekContext"},{key:"comments/comment/title",id:D.CommentTitle,description:d(16498,null)},{key:"comments/comment/context",id:D.CommentActions,description:d(16496,null),supportsSubmenus:!1},{key:"comments/commentThread/comment/context",id:D.CommentThreadCommentContext,description:d(16497,null),proposed:"contribCommentPeekContext"},{key:"commentsView/commentThread/context",id:D.CommentsViewThreadActions,description:d(16499,null),proposed:"contribCommentsViewThreadMenus"},{key:"notebook/toolbar",id:D.NotebookToolbar,description:d(16574,null)},{key:"notebook/kernelSource",id:D.NotebookKernelSource,description:d(16573,null),proposed:"notebookKernelSource"},{key:"notebook/cell/title",id:D.NotebookCellTitle,description:d(16572,null)},{key:"notebook/cell/execute",id:D.NotebookCellExecute,description:d(16571,null)},{key:"interactive/toolbar",id:D.InteractiveToolbar,description:d(16511,null)},{key:"interactive/cell/title",id:D.InteractiveCellTitle,description:d(16510,null)},{key:"issue/reporter",id:D.IssueReporter,description:d(16512,null)},{key:"testing/item/context",id:D.TestItem,description:d(16589,null)},{key:"testing/item/gutter",id:D.TestItemGutter,description:d(16590,null)},{key:"testing/profiles/context",id:D.TestProfilesContext,description:d(16594,null)},{key:"testing/item/result",id:D.TestPeekElement,description:d(16591,null)},{key:"testing/message/context",id:D.TestMessageContext,description:d(16593,null)},{key:"testing/message/content",id:D.TestMessageContent,description:d(16592,null)},{key:"extension/context",id:D.ExtensionContext,description:d(16543,null)},{key:"timeline/title",id:D.TimelineTitle,description:d(16599,null)},{key:"timeline/item/context",id:D.TimelineItemContext,description:d(16598,null)},{key:"ports/item/context",id:D.TunnelContext,description:d(16600,null)},{key:"ports/item/origin/inline",id:D.TunnelOriginInline,description:d(16601,null)},{key:"ports/item/port/inline",id:D.TunnelPortInline,description:d(16602,null)},{key:"file/newFile",id:D.NewFile,description:d(16508,null),supportsSubmenus:!1},{key:"webview/context",id:D.WebviewContext,description:d(16626,null)},{key:"file/share",id:D.MenubarShare,description:d(16561,null),proposed:"contribShareMenu"},{key:"editor/inlineCompletions/actions",id:D.InlineCompletionsActions,description:d(16509,null),supportsSubmenus:!1,proposed:"inlineCompletionsAdditions"},{key:"editor/content",id:D.EditorContent,description:d(16566,null),proposed:"contribEditorContentMenu"},{key:"editor/lineNumber/context",id:D.EditorLineNumberContext,description:d(16507,null)},{key:"mergeEditor/result/title",id:D.MergeInputResultToolbar,description:d(16548,null),proposed:"contribMergeEditorMenus"},{key:"multiDiffEditor/content",id:D.MultiDiffEditorContent,description:d(16549,null),proposed:"contribEditorContentMenu"},{key:"multiDiffEditor/resource/title",id:D.MultiDiffEditorFileToolbar,description:d(16550,null),proposed:"contribMultiDiffEditorMenus"},{key:"diffEditor/gutter/hunk",id:D.DiffEditorHunkToolbar,description:d(16533,null),proposed:"contribDiffEditorGutterToolBarMenus"},{key:"diffEditor/gutter/selection",id:D.DiffEditorSelectionToolbar,description:d(16533,null),proposed:"contribDiffEditorGutterToolBarMenus"},{key:"searchPanel/aiResults/commands",id:D.SearchActionMenu,description:d(16584,null)},{key:"editor/context/chat",id:D.ChatTextEditorMenu,description:d(16526,null),supportsSubmenus:!1,proposed:"chatParticipantPrivate"},{key:"chat/input/editing/sessionToolbar",id:D.ChatEditingSessionChangesToolbar,description:d(16520,null),proposed:"chatSessionsProvider"},{key:"chat/input/editing/sessionApplyActions",id:D.ChatEditingSessionApplySubmenu,description:d(16519,null),proposed:"chatSessionsProvider"},{key:"chat/chatSessions",id:D.AgentSessionsContext,description:d(16524,null),supportsSubmenus:!1,proposed:"chatSessionsProvider"},{key:"chatSessions/newSession",id:D.AgentSessionsCreateSubMenu,description:d(16525,null),supportsSubmenus:!1,proposed:"chatSessionsProvider"},{key:"chat/multiDiff/context",id:D.ChatMultiDiffContext,description:d(16522,null),supportsSubmenus:!1,proposed:"chatSessionsProvider"},{key:"chat/editor/inlineGutter",id:D.ChatEditorInlineMenu,description:d(16521,null),supportsSubmenus:!1,proposed:"contribChatEditorInlineGutterMenu"},{key:"chat/contextUsage/actions",id:D.ChatContextUsageActions,description:d(16518,null),proposed:"chatParticipantAdditions"},{key:"chat/newSession",id:D.ChatNewMenu,description:d(16523,null),proposed:"chatSessionsProvider"}],rJ;(v=>{function a(b){return typeof b.command=="string"}v.isMenuItem=a;function i(b,S){return typeof b.command!="string"?(S.error(d(16581,null,"command")),!1):b.alt&&typeof b.alt!="string"?(S.error(d(16576,null,"alt")),!1):b.when&&typeof b.when!="string"?(S.error(d(16576,null,"when")),!1):b.group&&typeof b.group!="string"?(S.error(d(16576,null,"group")),!1):!0}v.isValidMenuItem=i;function e(b,S){return typeof b.submenu!="string"?(S.error(d(16581,null,"submenu")),!1):b.when&&typeof b.when!="string"?(S.error(d(16576,null,"when")),!1):b.group&&typeof b.group!="string"?(S.error(d(16576,null,"group")),!1):!0}v.isValidSubmenuItem=e;function t(b,S){if(!Array.isArray(b))return S.error(d(16580,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(16579,null)),!1):typeof b.id!="string"?(S.error(d(16581,null,"id")),!1):typeof b.label!="string"?(S.error(d(16581,null,"label")),!1):!0}v.isValidSubmenu=o;let n={type:"object",required:["command"],properties:{command:{description:d(16615,null),type:"string"},alt:{description:d(16614,null),type:"string"},when:{description:d(16618,null),type:"string"},group:{description:d(16616,null),type:"string"}}},r={type:"object",required:["submenu"],properties:{submenu:{description:d(16617,null),type:"string"},when:{description:d(16618,null),type:"string"},group:{description:d(16616,null),type:"string"}}},s={type:"object",required:["id","label"],properties:{id:{description:d(16623,null),type:"string"},label:{description:d(16624,null),type:"string"},icon:{description:d(16620,null),anyOf:[{type:"string"},{type:"object",properties:{light:{description:d(16622,null),type:"string"},dark:{description:d(16621,null),type:"string"}}}]}}};v.menusContribution={description:d(16619,null),type:"object",properties:a6(Dio,b=>b.key,b=>({markdownDescription:b.proposed?d(16577,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(16625,null),type:"array",items:s};function u(b,S){return b?Jl(b.command)?(S.error(d(16581,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(16576,null,"precondition")),!1):!(b.category&&!h(b.category,S,"category")||!p(b.icon,S)):(S.error(d(16570,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(16575,null)),!1)}function h(b,S,y){return typeof b>"u"?(S.error(d(16582,null,y)),!1):typeof b=="string"&&Jl(b)?(S.error(d(16581,null,y)),!1):typeof b!="string"&&(Jl(b.original)||Jl(b.value))?(S.error(d(16583,null,`${y}.value`,`${y}.original`)),!1):!0}let g={type:"object",required:["command","title"],properties:{command:{description:d(16607,null),type:"string"},title:{description:d(16613,null),type:"string"},shortTitle:{markdownDescription:d(16612,null),type:"string"},category:{description:d(16606,null),type:"string"},enablement:{description:d(16611,null),type:"string"},icon:{description:d(16608,null),anyOf:[{type:"string"},{type:"object",properties:{light:{description:d(16610,null),type:"string"},dark:{description:d(16609,null),type:"string"}}}]}}};v.commandsContribution={description:d(16605,null),oneOf:[g,{type:"array",items:g}]}})(rJ||={});var Tio=new P,vfi=Tn.registerExtensionPoint({extensionPoint:"commands",jsonSchema:rJ.commandsContribution,activationEventsGenerator:function*(a){for(let i of a)i.command&&(yield`onCommand:${i.command}`)}});vfi.setHandler(a=>{function i(e,t){if(!rJ.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:je(t.description.extensionLocation,o),light:je(t.description.extensionLocation,o)}:u={dark:je(t.description.extensionLocation,o.dark),light:je(t.description.extensionLocation,o.light)});let p=fe.getCommand(c);p&&(p.source?t.collector.info(d(16505,null,e.command,p.source.title,p.source.id)):t.collector.info(d(16504,null,e.command))),Tio.add(fe.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:x.deserialize(n),icon:u}))}Tio.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 p7e=new Map,Lio=Tn.registerExtensionPoint({extensionPoint:"submenus",jsonSchema:rJ.submenusContribution});Lio.setHandler(a=>{p7e.clear();for(let i of a){let{value:e,collector:t}=i;for(let[,o]of Object.entries(e)){if(!rJ.isValidSubmenu(o,t))continue;if(!o.id){t.warn(d(16586,null,o.id));continue}if(p7e.has(o.id)){t.info(d(16585,null,o.id));continue}if(!o.label){t.warn(d(16587,null,o.label));continue}let n;o.icon&&(typeof o.icon=="string"?n=q.fromString(o.icon)||{dark:je(i.description.extensionLocation,o.icon)}:n={dark:je(i.description.extensionLocation,o.icon.dark),light:je(i.description.extensionLocation,o.icon.light)});let r={id:D.for(`api:${o.id}`),label:o.label,icon:n};p7e.set(o.id,r)}}});var YGo=new Map(Dio.map(a=>[a.key,a])),_io=new P,ffi=new Map,XGo=Tn.registerExtensionPoint({extensionPoint:"menus",jsonSchema:rJ.menusContribution,deps:[Lio]});XGo.setHandler(a=>{_io.clear(),ffi.clear();for(let i of a){let{value:e,collector:t}=i;for(let o of Object.entries(e)){if(!rJ.isValidItems(o[1],t))continue;let n=YGo.get(o[0]);if(!n){let r=p7e.get(o[0]);r&&(n={key:o[0],id:r.id,description:""})}if(n){if(n.proposed&&!Ea(i.description,n.proposed)){t.error(d(16578,null,o[0],n.proposed,i.description.identifier.value));continue}for(let r of o[1]){let s;if(rJ.isMenuItem(r)){let l=fe.getCommand(r.command),c=r.alt&&fe.getCommand(r.alt)||void 0;if(!l){t.error(d(16568,null,r.command));continue}r.alt&&!c&&t.warn(d(16567,null,r.alt)),r.command===r.alt&&t.info(d(16506,null)),s={command:l,alt:c,group:void 0,order:void 0,when:void 0}}else{if(n.supportsSubmenus===!1){t.error(d(16595,null));continue}let l=p7e.get(r.submenu);if(!l){t.error(d(16569,null,r.submenu));continue}let c=ffi.get(n.id.id);if(c||(c=new Set,ffi.set(n.id.id,c)),c.has(l.id.id)){t.warn(d(16588,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(16604,null,"`viewContainer/title`","`viewContainer == workbench.view.debug`",'"when"'));continue}s.when=x.deserialize(r.when),_io.add(fe.appendMenuItem(n.id,s))}}}}});var u7e=class extends C{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=a6(o,p=>p.id),r=e.contributes?.menus||{},s=a6(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(16493,null),d(16494,null),d(16513,null),d(16514,null)],u=o.sort((p,h)=>p.id.localeCompare(h.id)).map(p=>[new xe().appendMarkdown(`\`${p.id}\``),typeof p.title=="string"?p.title:p.title.value,p.keybindings,new xe().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(ZA){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]}};u7e=I([m(0,_e)],u7e);oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:"commands",label:d(16495,null),access:{canToggle:!1},renderer:new Mt(u7e)});var sue=".vscode",m7e="settings",uPt=`${sue}/${m7e}.json`,Rio="vscode://schemas/settings/default",Mio="vscode://schemas/settings/user",Pio="vscode://schemas/settings/profile",Aio="vscode://schemas/settings/machine",pPt="vscode://schemas/settings/workspace",Nio="vscode://schemas/settings/folder",VV="vscode://schemas/launch",aue="vscode://schemas/tasks",s_e="vscode://schemas/mcp",AC=[1,3],JGo=[2,4,5,6,7],Oio=[4,5,6],bfi=[1,...Oio],Sfi=[2,3,4,5,6,7],a_e=[4,5,6,7],sJ=[5,6,7],qE="tasks",rK="launch",Dv="mcp",X_=Object.create(null);X_[qE]=`${sue}/${qE}.json`;X_[rK]=`${sue}/${rK}.json`;X_[Dv]=`${sue}/${Dv}.json`;var mPt=Object.create(null);mPt[qE]=`${qE}.json`;mPt[Dv]=`${Dv}.json`;var Lv=B,Fio=`{
	"version": "2.0.0",
	"tasks": []
}`,IR="workbench.settings.applyToAllProfiles";var ZGo=oe.as(ea.JSONContribution),hPt=oe.as(ii.Configuration),Wio={type:"object",defaultSnippets:[{body:{title:"",properties:{}}}],properties:{title:{description:d(3179,null),type:"string"},order:{description:d(3175,null),type:"integer"},properties:{description:d(3176,null),type:"object",propertyNames:{pattern:"\\S+",patternErrorMessage:d(3178,null)},additionalProperties:{anyOf:[{title:d(3177,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(3147,null),d(3157,null),d(3166,null),d(3163,null),d(3155,null),d(3156,null)],markdownDescription:d(3149,null)},enumDescriptions:{type:"array",items:{type:"string"},description:d(3151,null)},markdownEnumDescriptions:{type:"array",items:{type:"string"},description:d(3160,null)},enumItemLabels:{type:"array",items:{type:"string"},markdownDescription:d(3152,null,"`enum`")},markdownDescription:{type:"string",description:d(3159,null)},deprecationMessage:{type:"string",description:d(3148,null)},markdownDeprecationMessage:{type:"string",description:d(3158,null)},editPresentation:{type:"string",enum:["singlelineText","multilineText"],enumDescriptions:[d(3164,null),d(3161,null)],default:"singlelineText",description:d(3150,null)},order:{type:"integer",description:d(3162,null)},ignoreSync:{type:"boolean",description:d(3153,null)},keywords:{type:"array",items:{type:"string"},description:d(3154,null)},tags:{type:"array",items:{type:"string",enum:["accessibility","advanced","experimental","telemetry","usesOnlineServices"],enumDescriptions:[d(3132,null),d(3133,null),d(3140,null),d(3146,null),d(3171,null),d(3173,null)]},additionalItems:!0,markdownDescription:d(3165,null)}}}]}}}},HP,Vio=Tn.registerExtensionPoint({extensionPoint:"configurationDefaults",jsonSchema:{$ref:Gmt},canHandleResolver:!0});Vio.setHandler((a,{added:i,removed:e})=>{HP&&hPt.deltaConfiguration(HP);let t=HP={};if(queueMicrotask(()=>{HP===t&&(hPt.deltaConfiguration(HP),HP=void 0)}),e.length){let o=e.map(n=>({overrides:Xi(n.value),source:{id:n.description.identifier.value,displayName:n.description.displayName}}));HP.removedDefaults=o}if(i.length){let o=hPt.getConfigurationProperties(),n=[7,4,5,6],r=i.map(s=>{let l=Xi(s.value);for(let c of Object.keys(l)){let u=o[c];if(u?.disallowConfigurationDefault){s.collector.warn(d(3136,null,c)),delete l[c];continue}if(!lg.test(c)&&u?.scope&&!n.includes(u.scope)){s.collector.warn(d(3134,null,c)),delete l[c];continue}}return{overrides:l,source:{id:s.description.identifier.value,displayName:s.description.displayName}}});HP.addedDefaults=r}});var e$o=Tn.registerExtensionPoint({extensionPoint:"configuration",deps:[Vio],jsonSchema:{description:d(3174,null),oneOf:[Wio,{type:"array",items:Wio}]},canHandleResolver:!0}),Ifi=new Fd;e$o.setHandler((a,{added:i,removed:e})=>{if(HP??={},e.length){let r=[];for(let s of e)r.push(...Ifi.get(s.description.identifier)||[]),Ifi.delete(s.description.identifier);HP.removedConfigurations=r}let t=new Set;function o(r,s){let l=Xi(r);return l.title&&typeof l.title!="string"&&s.collector.error(d(3144,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=to.extensionConfigurationPolicy;if(l){typeof l!="object"&&(s.collector.error(d(3142,null)),r.properties={});for(let p in l){let h=l[p],g=OYt(p,h,s.description.identifier.value);if(g){delete l[p],s.collector.warn(g);continue}if(t.has(p)&&!FYt.has(s.description.identifier.value.toLowerCase())){delete l[p],s.collector.warn(d(3135,null,p));continue}if(!yi(h)){delete l[p],s.collector.error(d(3143,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?qmt(h.scope.toString()):4}}let u=r.allOf;if(u){s.collector.error(d(3141,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)),Ifi.set(s.description.identifier,l),r.push(...l)}HP.addedConfigurations=r}hPt.deltaConfiguration(HP),HP=void 0});ZGo.registerSchema("vscode://schemas/workspaceConfig",{allowComments:!0,allowTrailingCommas:!0,default:{folders:[{path:""}],settings:{}},required:["folders"],properties:{folders:{minItems:0,uniqueItems:!0,description:d(3181,null),items:{type:"object",defaultSnippets:[{body:{path:"$1"}}],oneOf:[{properties:{path:{type:"string",description:d(3185,null)},name:{type:"string",description:d(3184,null)}},required:["path"]},{properties:{uri:{type:"string",description:d(3190,null)},name:{type:"string",description:d(3184,null)}},required:["uri"]}]}},settings:{type:"object",default:{},description:d(3187,null),$ref:pPt},launch:{type:"object",default:{configurations:[],compounds:[]},description:d(3182,null),$ref:VV},tasks:{type:"object",default:{version:"2.0.0",tasks:[]},description:d(3188,null),$ref:aue},mcp:{type:"object",default:{inputs:[],servers:{"mcp-server-time":{command:"uvx",args:["mcp_server_time","--local-timezone=America/Los_Angeles"]}}},description:d(3183,null),$ref:s_e},extensions:{type:"object",default:{},description:d(3180,null),$ref:"vscode://schemas/extensions"},remoteAuthority:{type:"string",doNotSuggest:!0,description:d(3186,null)},transient:{type:"boolean",doNotSuggest:!0,description:d(3189,null)}},errorMessage:d(3172,null)});var yfi=class extends C{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=$mt(t),n=o?Object.keys(o):[],r=[d(3168,null),d(3139,null),d(3137,null)],s=n.sort((l,c)=>l.localeCompare(c)).map(l=>[new xe().appendMarkdown(`\`${l}\``),o[l].markdownDescription?new xe(o[l].markdownDescription,!1):o[l].description??"",new xe().appendCodeblock("json",JSON.stringify(cn(o[l].default)?r$e(o[l].type):o[l].default,null,2))]);return{data:{headers:r,rows:s},dispose:()=>{}}}};oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:"configuration",label:d(3169,null),access:{canToggle:!1},renderer:new Mt(yfi)});var wfi=class extends C{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.configurationDefaults}render(e){let t=e.contributes?.configurationDefaults??{},o=[d(3145,null),d(3167,null),d(3138,null)],n=[];for(let r of Object.keys(t).sort((s,l)=>s.localeCompare(l))){let s=t[r];if(lg.test(r)){let l=yU(r),c=new xe().appendMarkdown(`${l.join(", ")}`);for(let u of Object.keys(s).sort((p,h)=>p.localeCompare(h))){let p=[];p.push(c),p.push(new xe().appendMarkdown(`\`${u}\``)),p.push(new xe().appendCodeblock("json",JSON.stringify(s[u],null,2))),n.push(p)}}else{let l=[];l.push(""),l.push(new xe().appendMarkdown(`\`${r}\``)),l.push(new xe().appendCodeblock("json",JSON.stringify(s,null,2))),n.push(l)}}return{data:{headers:o,rows:n},dispose:()=>{}}}};oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:"configurationDefaults",label:d(3170,null),access:{canToggle:!1},renderer:new Mt(wfi)});var l_e=class extends Wke{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(pRt),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 Cc&&n.item.submenu===T5);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 li,...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()}};l_e=I([m(1,Te),m(2,le),m(3,F),m(4,De),m(5,ze),m(6,lt),m(7,Pe)],l_e);var gPt=class a extends D_t{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)}},yR={Viewlets:"workbench.contributions.viewlets",Panels:"workbench.contributions.panels",Auxiliary:"workbench.contributions.auxiliary",ChatBar:"workbench.contributions.chatbar"},c_e=class extends L_t{registerPaneComposite(i){super.registerComposite(i)}deregisterPaneComposite(i){super.deregisterComposite(i)}getPaneComposite(i){return this.getComposite(i)}getPaneComposites(){return this.getComposites()}};oe.add(yR.Viewlets,new c_e);oe.add(yR.Panels,new c_e);oe.add(yR.Auxiliary,new c_e);oe.add(yR.ChatBar,new c_e);var fPt=class extends st{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 Cfi(a){return Array.isArray(a.items)}function Bio(a){let i=a;return!!i.picks&&i.additionalPicks instanceof Promise}var yh=class extends C{constructor(e,t){super();this.prefix=e;this.options=t}provide(e,t,o){let n=new P;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 P;r=u.add(new $e(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(Cfi(b)?(y=b.items,w=b.active):y=b,y.length===0){if(S)return!1;(h.length>0||e.hideInput)&&this.options?.noResultsPick&&(HD(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 Pi(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;Cfi(b.picks)?(k=b.picks.items,T=b.picks.active):k=b.picks;let N,O;if(Cfi(w)?(N=w.items,O=w.active):N=w,N.length>0||!S){let V;if(!T&&!O){let U=e.activeItems[0];U&&k.indexOf(U)!==-1&&(V=U)}f({items:[...k,...N],active:T||O||V})}}finally{p.isCancellationRequested||(e.busy=!1),y=!0}})()])};if(g!==null)if(Bio(g))await v(g);else if(!(g instanceof Promise))f(g);else{e.busy=!0;try{let b=await g;if(p.isCancellationRequested)return;Bio(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;typeof p?.accept=="function"&&(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 d_e=new co(()=>{let a=Wu.Collator(void 0,{numeric:!0,sensitivity:"base"}).value;return{collator:a,collatorIsNumeric:a.resolvedOptions().numeric}}),u_e=new co(()=>({collator:Wu.Collator(void 0,{numeric:!0}).value})),xfi=new co(()=>({collator:Wu.Collator(void 0,{numeric:!0,sensitivity:"accent"}).value}));function jE(a,i,e=!1){let t=a||"",o=i||"",n=d_e.value.collator.compare(t,o);return d_e.value.collatorIsNumeric&&n===0&&t!==o?t<o?-1:1:n}function h7e(a,i){let e=u_e.value.collator;return a=a||"",i=i||"",V5(e,a,i)}function Uio(a,i){let e=u_e.value.collator;return a=a||"",i=i||"",Xio(a,i)||V5(e,a,i)}function zio(a,i){let e=u_e.value.collator;return a=a||"",i=i||"",Yio(a,i)||V5(e,a,i)}function Kio(a,i){return a=a||"",i=i||"",a===i?0:a<i?-1:1}function kfi(a,i){let[e,t]=Hio(a),[o,n]=Hio(i),r=d_e.value.collator.compare(t,n);if(r===0){if(d_e.value.collatorIsNumeric&&t!==n)return t<n?-1:1;if(r=d_e.value.collator.compare(e,o),d_e.value.collatorIsNumeric&&r===0&&e!==o)return e<o?-1:1}return r}function Gio(a,i){a=a||"",i=i||"";let e=aJ(a),t=aJ(i),o=u_e.value.collator,n=xfi.value.collator;return V5(n,e,t)||V5(o,a,i)}function $io(a,i){a=a||"",i=i||"";let e=aJ(a),t=aJ(i),o=u_e.value.collator,n=xfi.value.collator;return V5(n,e,t)||Xio(a,i)||V5(o,a,i)}function qio(a,i){a=a||"",i=i||"";let e=aJ(a),t=aJ(i),o=u_e.value.collator,n=xfi.value.collator;return V5(n,e,t)||Yio(a,i)||V5(o,a,i)}function jio(a,i){a=a||"",i=i||"";let e=aJ(a).toLowerCase(),t=aJ(i).toLowerCase();return e!==t?e<t?-1:1:a!==i?a<i?-1:1:0}var Qio=/^(.*?)(\.([^.]*))?$/;function Hio(a,i=!1){let e=a?Qio.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 aJ(a){let i=a?Qio.exec(a):[];return i&&i[1]&&i[1].charAt(0)!=="."&&i[3]||""}function V5(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 vPt(a){let i=a.charAt(0);return i.toLocaleUpperCase()!==i}function bPt(a){let i=a.charAt(0);return i.toLocaleLowerCase()!==i}function Yio(a,i){return vPt(a)&&bPt(i)?-1:bPt(a)&&vPt(i)?1:0}function Xio(a,i){return bPt(a)&&vPt(i)?-1:vPt(a)&&bPt(i)?1:0}function t$o(a,i,e=!1){return e||(a=a&&a.toLowerCase(),i=i&&i.toLowerCase()),a===i?0:a<i?-1:1}function lJ(a,i,e=!1){let t=a.split(Rd),o=i.split(Rd),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 jE(t[c],o[c],e);if(s)return-1;if(l)return 1;let u=t$o(t[c],o[c],e);if(u!==0)return u}}function p_e(a,i,e){let t=a.toLowerCase(),o=i.toLowerCase(),n=i$o(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=jE(t,o);return l!==0?l:t.localeCompare(o)}function i$o(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 IPt=0,Jio=[IPt,[]];function Zio(a,i,e,t){if(!a||!i)return Jio;let o=a.length,n=i.length;if(o<n)return Jio;let r=a.toLowerCase();return o$o(i,e,n,a,r,o,t)}function o$o(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,N=f+y-1,O=w?s[T]:0,V=v&&w?s[N]:0,U=v&&w?l[N]:0,G;!V&&v?G=0:G=n$o(b,S,t,o,y,U),G&&V+G>=O&&(r||v||o.startsWith(i,y))?(l[k]=U+1,s[k]=V+G):(l[k]=IPt,s[k]=O)}}let c=[],u=e-1,p=n-1;for(;u>=0&&p>=0;){let h=u*n+p;l[h]===IPt||(c.push(p),u--),p--}return[s[e*n-1],c.reverse()]}function n$o(a,i,e,t,o,n){let r=0;if(!r$o(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=s$o(e.charCodeAt(o-1));s?r+=s:_ye(e.charCodeAt(o))&&n===0&&(r+=2)}return r}function r$o(a,i){return a===i?!0:a==="/"||a==="\\"?i==="/"||i==="\\":!1}function s$o(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 noo=[void 0,[]];function dJ(a,i,e=0,t=0){let o=i;return o.values&&o.values.length>1?a$o(a,o.values,e,t):roo(a,i,e,t)}function a$o(a,i,e,t){let o=0,n=[];for(let r of i){let[s,l]=roo(a,r,e,t);if(typeof s!="number")return noo;o+=s,n.push(...l)}return[o,_fi(n)]}function roo(a,i,e,t){let o=wL(i.normalized,i.normalizedLowercase,e,a,a.toLowerCase(),t,{firstMatchCanBeWeak:!0,boostFullMatch:!0});return o?[o[0],ua(o)]:noo}var yPt=Object.freeze({score:0}),SPt=1<<18,Efi=1<<17,Tfi=65536;function l$o(a,i,e,t){let o=t.values?t.values:[t];return Ir({[t.normalized]:{values:o.map(r=>({value:r.normalized,expectContiguousMatch:r.expectContiguousMatch})),label:a,description:i,allowNonContiguousMatches:e}})}function cJ(a,i,e,t,o){if(!a||!i.normalized)return yPt;let n=t.getItemLabel(a);if(!n)return yPt;let r=t.getItemDescription(a),s=l$o(n,r,e,i),l=o[s];if(l)return l;let c=c$o(n,r,t.getItemPath(a),i,e);return o[s]=c,c}function c$o(a,i,e,t,o){let n=!e||!t.containsPathSeparator;return e&&(Wn?t.pathNormalized===e:mr(t.pathNormalized,e))?{score:SPt,labelMatch:[{start:0,end:a.length}],descriptionMatch:i?[{start:0,end:i.length}]:void 0}:t.values&&t.values.length>1?d$o(a,i,e,t.values,n,o):soo(a,i,e,t,n,o)}function d$o(a,i,e,t,o,n){let r=0,s=[],l=[];for(let c of t){let{score:u,labelMatch:p,descriptionMatch:h}=soo(a,i,e,c,o,n);if(u===IPt)return yPt;r+=u,p&&s.push(...p),h&&l.push(...h)}return{score:r,labelMatch:_fi(s),descriptionMatch:_fi(l)}}function soo(a,i,e,t,o,n){if(o||!i){let[r,s]=Zio(a,t.normalized,t.normalizedLowercase,n&&!t.expectContiguousMatch);if(r){let l=pae(t.normalized,a),c;if(l){c=Efi;let u=Math.round(t.normalized.length/a.length*100);c+=u}else c=Tfi;return{score:c+r,labelMatch:l||eoo(s)}}}if(i){let r=i;e&&(r=`${i}${Rd}`);let s=r.length,l=`${r}${a}`,[c,u]=Zio(l,t.normalized,t.normalizedLowercase,n&&!t.expectContiguousMatch);if(c){let p=eoo(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 yPt}function eoo(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 _fi(a){let i=a.sort((o,n)=>o.start-n.start),e=[],t;for(let o of i)!t||!u$o(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 u$o(a,i){return!(a.end<i.start||i.end<a.start)}function g7e(a,i,e,t,o,n){let r=cJ(a,e,t,o,n),s=cJ(i,e,t,o,n),l=r.score,c=s.score;if((l===SPt||c===SPt)&&l!==c)return l===SPt?-1:1;if(l>Tfi||c>Tfi){if(l!==c)return l>c?-1:1;if(l<Efi&&c<Efi){let b=p$o(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=too(a,r,o),g=too(i,s,o);return h&&g&&h!==g?g>h?-1:1:m$o(a,i,e,o)}function too(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 p$o(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 m$o(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?p_e(o,n,e.normalized):r&&s&&r!==s?p_e(r,s,e.normalized):u&&p&&u!==p?p_e(u,p,e.normalized):0}function ioo(a){return a.startsWith('"')&&a.endsWith('"')}var aoo=" ";function uF(a){typeof a!="string"&&(a="");let i=a.toLowerCase(),{pathNormalized:e,normalized:t,normalizedLowercase:o}=ooo(a),n=e.indexOf(Rd)>=0,r=ioo(a),s,l=a.split(aoo);if(l.length>1)for(let c of l){let u=ioo(c),{pathNormalized:p,normalized:h,normalizedLowercase:g}=ooo(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 ooo(a){let i;ri?i=a.replace(/\//g,Rd):i=a.replace(/\\/g,Rd);let e=i.replace(/[\*\u2026\s"]/g,"").replace(/(?<=.)#$/,"");return{pathNormalized:i,normalized:e,normalizedLowercase:e.toLowerCase()}}function m_e(a){return Array.isArray(a)?uF(a.map(i=>i.original).join(aoo)):uF(a.original)}var lue=class extends yh{constructor(e,t,o,n,r){super(e,{canAcceptInBackground:!0,noResultsPick:{label:d(3976,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=uF(e),o=this.doGetEditorPickItems().filter(r=>{if(!t.normalized)return!0;let s=cJ(r,t,!0,r7,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):g7e(s,l,t,!0,r7,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=no.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(3975,null,c,t.get(n)):d(3974,null,c,t.get(n)):s?d(3973,null,c):c,description:l,iconClasses:js(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(M.closeDirty):q.asClassName(M.close),tooltip:d(3972,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})}})}};lue=I([m(1,Et),m(2,ee),m(3,Ct),m(4,kt)],lue);var J_=class extends lue{static{this.PREFIX="edt active "}constructor(i,e,t,o){super(J_.PREFIX,i,e,t,o)}doGetEditors(){let i=this.editorGroupService.activeGroup;return i.getEditors(0).map(e=>({editor:e,groupId:i.id}))}};J_=I([m(0,Et),m(1,ee),m(2,Ct),m(3,kt)],J_);var BV=class extends lue{static{this.PREFIX="edt "}constructor(i,e,t,o){super(BV.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}};BV=I([m(0,Et),m(1,ee),m(2,Ct),m(3,kt)],BV);var UP=class extends lue{static{this.PREFIX="edt mru "}constructor(i,e,t,o){super(UP.PREFIX,i,e,t,o)}doGetEditors(){let i=[];for(let e of this.editorService.getEditors(0))i.push(e);return i}};UP=I([m(0,Et),m(1,ee),m(2,Ct),m(3,kt)],UP);function h$o(a){let i=a;return typeof i?.primary=="object"&&typeof i.secondary=="object"}var of=class extends zO{constructor(e,t,o,n,r,s,l,c,u){super(of.ID,e,of.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 Mh);this.onDidChangeSizeConstraints=H.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 P);this.editorDisposables=this._register(new P);this.dimension=new ai(0,0);this.lastFocusedSide=void 0;this.orientation=this.configurationService.getValue(of.SIDE_BY_SIDE_LAYOUT_SETTING)==="vertical"?0:1,this.registerListeners()}static{this.ID=W7i}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(of.SIDE_BY_SIDE_LAYOUT_SETTING)&&(this.orientation=this.configurationService.getValue(of.SIDE_BY_SIDE_LAYOUT_SETTING)==="vertical"?0:1,this.splitview&&this.recreateSplitview())}recreateSplitview(){let e=Oi(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 vu(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=Wl.Distribute,n=Wl.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=Oi(this.secondaryEditorContainer);this.splitview.addView({element:r,layout:l=>this.layoutPane(this.secondaryEditorPane,l),minimumSize:this.orientation===1?FE.width:FE.height,maximumSize:Number.POSITIVE_INFINITY,onDidChange:H.None},o);let s=Oi(this.primaryEditorContainer);this.splitview.addView({element:s,layout:l=>this.layoutPane(this.primaryEditorPane,l),minimumSize:this.orientation===1?FE.width:FE.height,maximumSize:Number.POSITIVE_INFINITY,onDidChange:H.None},n),this.updateStyles()}getTitle(){return this.input?this.input.getName():d(4044,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=h$o(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,Oi(this.secondaryEditorContainer)),this.primaryEditorPane=this.doCreateEditor(e.primary,Oi(this.primaryEditorContainer)),this.layout(this.dimension),this._onDidChangeSizeConstraints.input=H.any(H.map(this.secondaryEditorPane.onDidChangeSizeConstraints,()=>{}),H.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=oe.as(rn.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()),pce(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(pce(e)){let t=e.getSelection();if(t)return new Dfi(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,Oi(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 ai(t,this.dimension.height):new ai(this.dimension.width,t))}getControl(){return this.getLastFocusedEditorPane()?.getControl()}getPrimaryEditorPane(){return this.primaryEditorPane}getSecondaryEditorPane(){return this.secondaryEditorPane}tracksEditorViewState(e){return e instanceof ga}computeEditorViewState(e){if(!this.input||!Xe(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 ga&&(t=e.primary.resource,o=e.secondary.resource),!(!o||!t))return A.from({scheme:"sideBySide",path:`${m6(o.toString())}${m6(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(j9i)??"",this.primaryEditorContainer.style.borderTopWidth="0"):(this.primaryEditorContainer.style.borderTopWidth="1px",this.primaryEditorContainer.style.borderTopStyle="solid",this.primaryEditorContainer.style.borderTopColor=this.getColor(q9i)??"",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)}};of=I([m(1,Te),m(2,F),m(3,De),m(4,le),m(5,B),m(6,Nn),m(7,ee),m(8,Et)],of);var Dfi=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 QE(a,i,e){let t=!1,o=g$o(a);if(Mj(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 g$o(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 Z_=class extends aR{constructor(e,t,o,n,r,s,l,c,u,p){super(Z_.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=SY}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(4048,null)}createEditorControl(e,t){this.diffEditorControl=this._register(this.instantiationService.createInstance(Hu,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 Jxe)){this.openAsBinary(e,t);return}let s=Oi(this.diffEditorControl),l=r,c=l.textDiffEditorModel?s.createViewModel(l.textDiffEditorModel):null;this._previousViewModel=c,await c?.waitForDiff(),s.setModel(c);let u=!1;Mj(t?.viewState)||(u=this.restoreTextDiffEditorViewState(e,t,o,s));let p=!1;t&&(p=QE(t,s,1)),!p&&!u&&s.revealFirstDiff(),s.updateOptions({...this.getReadonlyConfiguration(l.modifiedModel?.isReadonly()),originalEditable:!l.originalModel?.isReadonly()}),s.handleInitialized(),this.inputLifecycleStopWatch=new En(!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 WN?n=d(4047,null,ll.formatSize(e.size)):n=d(4046,null),Uxe(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(Fa,e.getName(),e.getDescription(),o,n,!0),s=oe.as(rn.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&&QE(e,Oi(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(yi(e.diffEditor)){let n=Xi(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 Fa&&!this.input.original.isReadonly(),lineDecorationsWidth:"2ch"}}updateReadonly(e){e instanceof Fa?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 Hu&&(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 Fa}computeEditorViewState(e){if(!this.diffEditorControl)return;let t=this.diffEditorControl.getModel();if(!t?.modified||!t.original)return;let o=this.toEditorViewStateResource(t);if(o&&Xe(o,e))return this.diffEditorControl.saveViewState()??void 0}toEditorViewStateResource(e){let t,o;if(e instanceof Fa?(t=e.original.resource,o=e.modified.resource):Ta(e)||(t=e.original.uri,o=e.modified.uri),!(!t||!o))return A.from({scheme:"diff",path:`${m6(t.toString())}${m6(o.toString())}`})}};Z_=I([m(1,Te),m(2,F),m(3,le),m(4,Nn),m(5,ee),m(6,De),m(7,Et),m(8,be),m(9,Po)],Z_);var wPt="toggle.diff.renderSideBySide",CPt="workbench.action.compareEditor.nextChange",xPt="workbench.action.compareEditor.previousChange",Rfi="workbench.action.compareEditor.focusPrimarySide",Mfi="workbench.action.compareEditor.focusSecondarySide",Pfi="workbench.action.compareEditor.focusOtherSide",loo="workbench.action.compareEditor.openSide",Afi="toggle.diff.ignoreTrimWhitespace",kPt="workbench.action.compareEditor.swapSides";function coo(){yt.registerCommandAndKeybindingRule({id:loo,weight:200,when:ue.inDiffEditor,primary:Ai(2089,1069),handler:async s=>{let l=s.get(ee),c=l.activeEditor,u=l.activeTextEditorControl;if(!Ec(u)||!(c instanceof Fa))return;let p;return u.getOriginalEditor().hasTextFocus()?p=c.original:p=c.modified,l.openEditor(p)}}),fe.appendMenuItem(D.CommandPalette,{command:{id:loo,title:L(3633,"Open Active Diff Side")}}),yt.registerCommandAndKeybindingRule({id:CPt,weight:200,when:M8e,primary:575,handler:(s,...l)=>i(s,l,!0)}),fe.appendMenuItem(D.CommandPalette,{command:{id:CPt,title:L(3632,"Go to Next Change")}}),yt.registerCommandAndKeybindingRule({id:xPt,weight:200,when:M8e,primary:1599,handler:(s,...l)=>i(s,l,!1)}),fe.appendMenuItem(D.CommandPalette,{command:{id:xPt,title:L(3634,"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 Z_&&(!u||p.input instanceof Fa&&Xe(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(Nn),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(Nn),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 Fa)||!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)}}yt.registerCommandAndKeybindingRule({id:wPt,weight:200,when:void 0,primary:void 0,handler:(s,...l)=>o(s,l)}),yt.registerCommandAndKeybindingRule({id:Rfi,weight:200,when:void 0,primary:void 0,handler:(s,...l)=>t(s,l,1)}),yt.registerCommandAndKeybindingRule({id:Mfi,weight:200,when:void 0,primary:void 0,handler:(s,...l)=>t(s,l,0)}),yt.registerCommandAndKeybindingRule({id:Pfi,weight:200,when:void 0,primary:void 0,handler:(s,...l)=>t(s,l,2)}),yt.registerCommandAndKeybindingRule({id:Afi,weight:200,when:void 0,primary:void 0,handler:(s,...l)=>n(s,l)}),yt.registerCommandAndKeybindingRule({id:kPt,weight:200,when:void 0,primary:void 0,handler:(s,...l)=>r(s,l)}),fe.appendMenuItem(D.CommandPalette,{command:{id:wPt,title:L(3636,"Toggle Inline View"),category:d(3631,null)},when:tS}),fe.appendMenuItem(D.CommandPalette,{command:{id:kPt,title:L(3635,"Swap Left and Right Editor Side"),category:d(3631,null)},when:x.and(tS,eke)})}function lp(a,i,e,t){let o=f$o(a,i,e,t),n=o.length&&o[0].preserveFocus||!1,r={groupedEditors:[],preserveFocus:n};for(let s of o){let l=S$o(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 f$o(a,i,e,t){let o=t.lastFocusedList,n=o instanceof hc&&o.getHTMLElement()===Pn(),r=b$o(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=doo(r,n,i,e,t);return v$o(r,s)}function v$o(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 b$o(a,i,e,t,o){let n=a.filter(r=>mce(r)||A.isUri(r));for(let r of n)if(mce(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(uoo(s))return Nfi(s,void 0,t)}}function doo(a,i,e,t,o){if(i){let r=o.lastFocusedList.getSelectedElements().filter(uoo);if(r.length>1)return r.map(s=>Nfi(s,a.preserveFocus,t));if(r.length===0)return doo(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=>Nfi({editor:s,groupId:n.id},a.preserveFocus,t))}return[a]}function Nfi(a,i,e){if(hce(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 uoo(a){return hce(a)||C8e(a)}function S$o(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 cue="workbench.action.closeUnmodifiedEditors",B5="workbench.action.closeEditorsInGroup",f7e="workbench.action.closeEditorsAndGroup",EPt="workbench.action.closeEditorsToTheRight",OC="workbench.action.closeActiveEditor",Ofi="workbench.action.closeActivePinnedEditor",TPt="workbench.action.closeGroup",g_e="workbench.action.closeOtherEditors",aK="moveActiveEditor",lK="copyActiveEditor",cK="layoutEditorGroups",_Pt="workbench.action.keepEditor",Ffi="workbench.action.toggleKeepEditors",DPt="workbench.action.toggleEditorGroupLock",LPt="workbench.action.lockEditorGroup",H5="workbench.action.unlockEditorGroup",Wfi="workbench.action.showEditorsInGroup",f_e="workbench.action.reopenWithEditor",I$o="reopenActiveEditorWith",RPt="workbench.action.pinEditor",U5="workbench.action.unpinEditor",uJ="workbench.action.splitEditor",z5="workbench.action.splitEditorUp",dK="workbench.action.splitEditorDown",K5="workbench.action.splitEditorLeft",uK="workbench.action.splitEditorRight",v_e="workbench.action.moveEditorToAboveGroup",b_e="workbench.action.moveEditorToBelowGroup",S_e="workbench.action.moveEditorToLeftGroup",I_e="workbench.action.moveEditorToRightGroup",y_e="workbench.action.toggleMaximizeEditorGroup",MPt="workbench.action.splitEditorInGroup",y$o="workbench.action.toggleSplitEditorInGroup",PPt="workbench.action.joinEditorInGroup",Vfi="workbench.action.toggleSplitEditorInGroupLayout",Bfi="workbench.action.focusFirstSideEditor",Hfi="workbench.action.focusSecondSideEditor",w$o="workbench.action.focusOtherSideEditor",C$o="workbench.action.focusLeftGroupWithoutWrap",x$o="workbench.action.focusRightGroupWithoutWrap",k$o="workbench.action.focusAboveGroupWithoutWrap",E$o="workbench.action.focusBelowGroupWithoutWrap",poo="workbench.action.openEditorAtIndex",v7e="workbench.action.moveEditorToNewWindow",b7e="workbench.action.copyEditorToNewWindow",APt="workbench.action.moveEditorGroupToNewWindow",NPt="workbench.action.copyEditorGroupToNewWindow",OPt="workbench.action.newEmptyEditorWindow",Ufi="workbench.action.closeModalEditor",zfi="workbench.action.moveModalEditorToMain",Kfi="workbench.action.moveModalEditorToWindow",Gfi="workbench.action.toggleModalEditorMaximized",$fi="workbench.action.navigateModalEditorPrevious",qfi="workbench.action.navigateModalEditorNext",Zh="_workbench.open",NC="_workbench.diff",T$o="_workbench.openWith",goo=[uJ,OC,U5,H5,y_e],moo=function(a){return!(!yi(a)||!Ae(a.to)||!cn(a.by)&&!Ae(a.by)||!cn(a.value)&&!Xo(a.value))};function _$o(){let a={type:"object",required:["to"],properties:{to:{type:"string",enum:["left","right"]},by:{type:"string",enum:["tab","group"]},value:{type:"number"}}};yt.registerCommandAndKeybindingRule({id:aK,weight:200,when:ue.editorTextFocus,primary:0,handler:(n,r)=>i(!0,r,n),metadata:{description:d(3912,null),args:[{name:d(3911,null),description:d(3910,null),constraint:moo,schema:a}]}}),yt.registerCommandAndKeybindingRule({id:lK,weight:200,when:ue.editorTextFocus,primary:0,handler:(n,r)=>i(!1,r,n),metadata:{description:d(3909,null),args:[{name:d(3908,null),description:d(3907,null),constraint:moo,schema:a}]}}),[{id:v_e,to:"up"},{id:b_e,to:"down"},{id:S_e,to:"left"},{id:I_e,to:"right"}].forEach(({id:n,to:r})=>{qe.registerCommand(n,function(s,...l){let c=lp(l,s.get(ee),s.get(Et),s.get(fo));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(Et).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(Et),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=pC(p)===3?2:0;h=u.addGroup(s,g)}break;case"next":h=u.findGroup({location:2},s),h||(h=u.addGroup(s,pC(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=ZY(s,l);n?s.moveEditors(g,h):s.id!==h.id&&s.copyEditors(g,h),h.focus()}}}function D$o(){function a(i,e){if(!e||typeof e!="object")return;i.get(Et).applyLayout(e)}qe.registerCommand(cK,(i,e)=>{a(i,e)}),qe.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(3913,null),d(3914,null)]},groups:{$ref:"#/definitions/editorGroupsSchema",default:[{},{}]}}}}]}}),qe.registerCommand({id:"vscode.getEditorLayout",handler:i=>i.get(Et).getLayout(),metadata:{description:"Get Editor Layout",args:[],returns:"An editor layout object, in the same format as vscode.setEditorLayout"}})}function L$o(){function a(i,e,t){return i?[{...i.editorOptions,...e??Object.create(null)},i.sideBySide?vn:t]:[e,t]}qe.registerCommand({id:"vscode.open",handler:(i,e)=>{i.get(ge).executeCommand(Zh,e)},metadata:{description:"Opens the provided resource in the editor.",args:[{name:"Uri"}]}}),qe.registerCommand(Zh,async function(i,e,t,o,n){let r=i.get(ee),s=i.get(Et),l=i.get(Qe),c=i.get(wn),u=i.get(B),p=i.get(H_),h=typeof e=="string"?e:A.from(e,!0),[g,f]=t??[];if(f||typeof g=="number"||jd(h,Y.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,W_(s,u,b))}else{if(jd(h,Y.command))return;await l.open(h,{openToSide:n?.sideBySide,editorOptions:n?.editorOptions})}}),qe.registerCommand({id:"vscode.diff",handler:(i,e,t,o)=>{i.get(ge).executeCommand(NC,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"}]}}),qe.registerCommand(NC,async function(i,e,t,o,n,r){let s=i.get(ee),l=i.get(Et),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},W_(l,c,g))}),qe.registerCommand(T$o,async(i,e,t,o)=>{let n=i.get(ee),r=i.get(Et),s=i.get(B),[l,c]=o??[];await n.openEditor({resource:A.from(e,!0),options:{pinned:!0,...c,override:t}},W_(r,s,l))}),qe.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"}]}}),qe.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})}),qe.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=>Xe(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 R$o(){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)}};qe.registerCommand({id:poo,handler:a});for(let e=0;e<9;e++){let t=e,o=e+1;yt.registerCommandAndKeybindingRule({id:poo+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 M$o(){for(let e=1;e<8;e++)yt.registerCommandAndKeybindingRule({id:a(e),weight:200,when:void 0,primary:2048|i(e),handler:t=>{let o=t.get(Et),n=t.get(B);if(e>o.count)return;let r=o.getGroups(2);if(r[e])return r[e].focus();let s=pC(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 jfi(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 P$o(){[{id:z5,direction:0},{id:dK,direction:1},{id:K5,direction:2},{id:uK,direction:3}].forEach(({id:a,direction:i})=>{qe.registerCommand(a,function(e,...t){let o=lp(t,e.get(ee),e.get(Et),e.get(fo));jfi(e.get(Et),i,o)})})}function A$o(){function a(e,t,...o){let n=e.get(Et),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=lp(o,e.get(ee),e.get(Et),e.get(fo)),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})}))}yt.registerCommandAndKeybindingRule({id:OC,weight:200,when:void 0,primary:2101,win:{primary:2110,secondary:[2101]},handler:(e,...t)=>a(e,!1,...t)}),qe.registerCommand(Ofi,(e,...t)=>a(e,!0,...t)),yt.registerCommandAndKeybindingRule({id:B5,weight:200,when:void 0,primary:Ai(2089,53),handler:(e,...t)=>{let o=lp(t,e.get(ee),e.get(Et),e.get(fo));return Promise.all(o.groupedEditors.map(async({group:n})=>{await n.closeAllEditors({excludeSticky:!0})}))}}),yt.registerCommandAndKeybindingRule({id:TPt,weight:200,when:x.and(Ice,iS),primary:2101,win:{primary:2110,secondary:[2101]},handler:(e,...t)=>{let o=e.get(Et),n=lp(t,e.get(ee),o,e.get(fo));n.groupedEditors.length&&o.removeGroup(n.groupedEditors[0].group)}}),yt.registerCommandAndKeybindingRule({id:cue,weight:200,when:void 0,primary:Ai(2089,51),handler:(e,...t)=>{let o=lp(t,e.get(ee),e.get(Et),e.get(fo));return Promise.all(o.groupedEditors.map(async({group:n})=>{await n.closeEditors({savedOnly:!0,excludeSticky:!0},{preserveFocus:o.preserveFocus})}))}}),yt.registerCommandAndKeybindingRule({id:g_e,weight:200,when:void 0,primary:void 0,mac:{primary:2610},handler:(e,...t)=>{let o=lp(t,e.get(ee),e.get(Et),e.get(fo));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})}))}}),yt.registerCommandAndKeybindingRule({id:EPt,weight:200,when:void 0,primary:void 0,handler:async(e,...t)=>{let o=lp(t,e.get(ee),e.get(Et),e.get(fo));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})}}}),yt.registerCommandAndKeybindingRule({id:f_e,weight:200,when:void 0,primary:void 0,handler:(e,...t)=>i(e,0,...t)}),yt.registerCommandAndKeybindingRule({id:I$o,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(ul),s=e.get(Te),l=lp(o,n,e.get(Et),e.get(fo)),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(!Rj(f))return;let v=c.get(u);v||(v=[],c.set(u,v)),v.push({editor:h,replacement:f.editor,forceReplaceDirty:h.resource?.scheme===Y.untitled,options:f.options}),s.publicLog2("workbenchEditorReopen",{scheme:h.resource?.scheme??"",ext:h.resource?ms(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)}qe.registerCommand(f7e,async(e,...t)=>{let o=e.get(Et),n=lp(t,e.get(ee),o,e.get(fo));if(n.groupedEditors.length){let{group:r}=n.groupedEditors[0];await r.closeAllEditors(),r.count===0&&o.getGroup(r.id)&&o.removeGroup(r)}})}function N$o(){let a=[{id:C$o,direction:2},{id:x$o,direction:3},{id:k$o,direction:0},{id:E$o,direction:1}];for(let i of a)qe.registerCommand(i.id,async e=>{let t=e.get(Et);(t.findGroup({direction:i.direction},t.activeGroup,!1)??t.activeGroup).focus()})}function O$o(){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(ga,void 0,void 0,s,s),forceReplaceDirty:!0}])}W(class extends K{constructor(){super({id:MPt,title:L(3925,"Split Editor in Group"),category:We.View,precondition:oV,f1:!0,keybinding:{weight:200,when:oV,primary:Ai(2089,3165)}})}run(e,...t){return a(e,lp(t,e.get(ee),e.get(Et),e.get(fo)))}});async function i(e){if(!e.groupedEditors.length)return;let{group:t,editors:o}=e.groupedEditors[0],n=o[0];if(!n||!(n instanceof ga))return;let r,s=t.activeEditorPane;if(s instanceof of&&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:PPt,title:L(3918,"Join Editor in Group"),category:We.View,precondition:hC,f1:!0,keybinding:{weight:200,when:hC,primary:Ai(2089,3165)}})}run(e,...t){return i(lp(t,e.get(ee),e.get(Et),e.get(fo)))}}),W(class extends K{constructor(){super({id:y$o,title:L(3927,"Toggle Split Editor in Group"),category:We.View,precondition:x.or(oV,hC),f1:!0})}async run(e,...t){let o=lp(t,e.get(ee),e.get(Et),e.get(fo));if(!o.groupedEditors.length)return;let{editors:n}=o.groupedEditors[0];n[0]instanceof ga?await i(o):n[0]&&await a(e,o)}}),W(class extends K{constructor(){super({id:Vfi,title:L(3929,"Toggle Layout of Split Editor in Group"),category:We.View,precondition:hC,f1:!0})}async run(e){let t=e.get(B),o=t.getValue(of.SIDE_BY_SIDE_LAYOUT_SETTING),n;return o!=="horizontal"?n="horizontal":n="vertical",t.updateValue(of.SIDE_BY_SIDE_LAYOUT_SETTING,n)}})}function F$o(){W(class extends K{constructor(){super({id:Bfi,title:L(3915,"Focus First Side in Active Editor"),category:We.View,precondition:x.or(hC,tS),f1:!0})}async run(a){let i=a.get(ee),e=a.get(ge),t=i.activeEditorPane;t instanceof of?t.getSecondaryEditorPane()?.focus():t instanceof Z_&&await e.executeCommand(Mfi)}}),W(class extends K{constructor(){super({id:Hfi,title:L(3917,"Focus Second Side in Active Editor"),category:We.View,precondition:x.or(hC,tS),f1:!0})}async run(a){let i=a.get(ee),e=a.get(ge),t=i.activeEditorPane;t instanceof of?t.getPrimaryEditorPane()?.focus():t instanceof Z_&&await e.executeCommand(Rfi)}}),W(class extends K{constructor(){super({id:w$o,title:L(3916,"Focus Other Side in Active Editor"),category:We.View,precondition:x.or(hC,tS),f1:!0})}async run(a){let i=a.get(ee),e=a.get(ge),t=i.activeEditorPane;t instanceof of?t.getPrimaryEditorPane()?.hasFocus()?t.getSecondaryEditorPane()?.focus():t.getPrimaryEditorPane()?.focus():t instanceof Z_&&await e.executeCommand(Pfi)}})}function W$o(){yt.registerCommandAndKeybindingRule({id:_Pt,weight:200,when:void 0,primary:Ai(2089,3),handler:async(i,...e)=>{let t=lp(e,i.get(ee),i.get(Et),i.get(fo));for(let{group:o,editors:n}of t.groupedEditors)for(let r of n)o.pinEditor(r)}}),qe.registerCommand({id:Ffi,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=lp(t,i.get(ee),i.get(Et),i.get(fo)).groupedEditors[0]?.group;n?.lock(e??!n.isLocked)}W(class extends K{constructor(){super({id:DPt,title:L(3926,"Toggle Editor Group Lock"),category:We.View,f1:!0})}async run(i,...e){a(i,void 0,...e)}}),W(class extends K{constructor(){super({id:LPt,title:L(3919,"Lock Editor Group"),category:We.View,precondition:ME.toNegated(),f1:!0})}async run(i,...e){a(i,!0,...e)}}),W(class extends K{constructor(){super({id:H5,title:L(3930,"Unlock Editor Group"),precondition:ME,category:We.View,f1:!0})}async run(i,...e){a(i,!1,...e)}}),yt.registerCommandAndKeybindingRule({id:RPt,weight:200,when:ZL.toNegated(),primary:Ai(2089,1027),handler:async(i,...e)=>{let t=lp(e,i.get(ee),i.get(Et),i.get(fo));for(let{group:o,editors:n}of t.groupedEditors)for(let r of n)o.stickEditor(r)}}),yt.registerCommandAndKeybindingRule({id:U5,weight:200,when:ZL,primary:Ai(2089,1027),handler:async(i,...e)=>{let t=lp(e,i.get(ee),i.get(Et),i.get(fo));for(let{group:o,editors:n}of t.groupedEditors)for(let r of n)o.unstickEditor(r)}}),yt.registerCommandAndKeybindingRule({id:Wfi,weight:200,when:void 0,primary:void 0,handler:(i,...e)=>{let t=i.get(Et),o=i.get(Ge),r=lp(e,i.get(ee),t,i.get(fo)).groupedEditors[0]?.group;return r&&t.activateGroup(r),o.quickAccess.show(J_.PREFIX)}})}function V$o(){W(class extends K{constructor(){super({id:zfi,title:L(3921,"Open Modal Editor in Main Window"),category:We.View,f1:!0,icon:M.openInProduct,precondition:rV,menu:{id:D.ModalEditorTitle,group:"navigation",order:0,when:$p.negate()}})}run(a){let i=a.get(Et);for(let e of i.parts)if(h_e(e)){e.close({mergeAllEditorsToMainPart:!0});break}}}),W(class extends K{constructor(){super({id:Kfi,title:L(3920,"Open Modal Editor in New Window"),category:We.View,f1:!0,icon:M.emptyWindow,precondition:rV,menu:{id:D.ModalEditorTitle,group:"navigation",order:0,when:$p}})}async run(a){let i=a.get(Et);for(let e of i.parts)if(h_e(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(),e.close();break}}}),W(class extends K{constructor(){super({id:Gfi,title:L(3928,"Maximize Modal Editor"),category:We.View,f1:!0,precondition:rV,icon:M.screenFull,toggled:{condition:tTt,title:d(3924,null)},menu:{id:D.ModalEditorTitle,group:"navigation",order:1}})}run(a){let i=a.get(Et);for(let e of i.parts)if(h_e(e)){e.toggleMaximized();break}}}),W(class extends K{constructor(){super({id:Ufi,title:L(3906,"Close Modal Editor"),category:We.View,f1:!0,icon:M.close,precondition:rV,keybinding:[{primary:9,weight:210,when:ue.focus.toNegated()},{primary:9,weight:99,when:ue.focus}],menu:{id:D.ModalEditorTitle,group:"navigation",order:2}})}async run(a){let i=a.get(Et);for(let e of i.parts)if(h_e(e)){e.close();break}}}),W(class extends K{constructor(){super({id:$fi,title:L(3923,"Navigate to Previous Item in Modal Editor"),category:We.View,precondition:x.and(rV,yce),keybinding:{primary:528,weight:210,when:x.and(rV,yce)}})}run(a){let i=a.get(Et);for(let e of i.parts)if(h_e(e)){let t=e.navigation;t&&t.current>0&&t.navigate(t.current-1);break}}}),W(class extends K{constructor(){super({id:qfi,title:L(3922,"Navigate to Next Item in Modal Editor"),category:We.View,precondition:x.and(rV,yce),keybinding:{primary:530,weight:210,when:x.and(rV,yce)}})}run(a){let i=a.get(Et);for(let e of i.parts)if(h_e(e)){let t=e.navigation;t&&t.current<t.total-1&&t.navigate(t.current+1);break}}})}function h_e(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===It.vscodeWindowId}function foo(){_$o(),D$o(),coo(),L$o(),R$o(),A$o(),W$o(),O$o(),F$o(),M$o(),P$o(),N$o(),V$o()}var FPt=class extends C{constructor(){super(...arguments);this._onDidChangeCheckboxState=this._register(new E);this.onDidChangeCheckboxState=this._onDidChangeCheckboxState.event}setCheckboxState(e){this._onDidChangeCheckboxState.fire([e])}},S7e=class a extends C{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 hv("",e.checkbox.isChecked,{...kf,size:15}),this.setHover(e.checkbox),this.setAccessibilityInformation(e.checkbox),this.toggle.domNode.classList.add(a.checkboxClass),this.toggle.domNode.tabIndex=1,R(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(4238,null):d(4239,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 C_e=ae("accessibleViewInformationService"),w_e=class extends C{constructor(e){super();this._storageService=e}hasShownAccessibleView(e){return this._storageService.getBoolean(`${qGe}${e}`,-1,!1)===!0}};w_e=I([m(0,le)],w_e);var eD=class extends zr{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}=oe.as(on.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 WPt(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}}};eD=I([m(1,_e),m(2,ze),m(3,B),m(4,X),m(5,Ri),m(6,F),m(7,Qe),m(8,De),m(9,Ne),m(10,tt),m(11,C_e)],eD);var w7e=class{constructor(){this.label={label:"root"};this.handle="0";this.parentHandle=void 0;this.collapsibleState=2;this.children=void 0}};function boo(a){let i=qe.getCommand(a);if(i)return fe.getCommand(i.id)?.precondition}function Soo(a,i){let e=a.originalId?a.originalId:a.id,t=boo(e);return t?i.contextMatchesRules(t):!0}function voo(a){return!!a&&typeof a!="string"&&!!a.element&&!!a.disposables}var B$o=d(4242,null),H$o=new Q("customTreeView",!1),Qfi=class extends nu{},x_e=class extends C{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 P);this._height=0;this._width=0;this.refreshing=!1;this.root=new w7e,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(y7e,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:qz(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 w7e){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 w7e?Jfi(e,void 0):Jfi(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 qc(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 Q(`treeView.${this.id}.enableCollapseAll`,e,d(4244,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 Q(`treeView.${this.id}.enableRefresh`,e,d(4245,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(4243,null),menu:{id:D.ViewTitle,when:x.and(x.equals("view",e.id),e.refreshContextKey),group:"navigation",order:Number.MAX_SAFE_INTEGER-1},icon:M.refresh})}async run(){return e.refresh()}})),this._register(W(class extends K{constructor(){super({id:`workbench.actions.treeView.${e.id}.collapseAll`,title:d(4240,null),menu:{id:D.ViewTitle,when:x.and(x.equals("view",e.id),e.collapseAllContextKey),group:"navigation",order:Number.MAX_SAFE_INTEGER},precondition:e.collapseAllToggleContextKey,icon:M.collapseAll})}async run(){if(e.tree)return new fPt(e.tree,!0).run()}}))}setVisibility(e){this.initialize(),e=!!e,this.isVisible!==e&&(this.isVisible=e,this.tree&&(this.isVisible?bn(this.tree.getHTMLElement()):xo(this.tree.getHTMLElement()),this.isVisible&&this.elementsToRefresh.length&&this.dataProvider&&(this.doRefresh(this.elementsToRefresh),this.elementsToRefresh=[])),Vw(()=>{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,R(e,this.domNode)}create(){this.domNode=_(".tree-explorer-viewlet-tree-view"),this.messageElement=R(this.domNode,_(".message")),this.updateMessage(),this.treeContainer=R(this.domNode,_(".customview-tree")),this.treeContainer.classList.add("file-icon-themable-tree","show-file-icons");let e=this._register(Vn(this.domNode));this._register(e.onDidFocus(()=>this.focused=!0)),this._register(e.onDidBlur(()=>this.focused=!1))}createTree(){this.treeDisposables.clear();let e=Ca.bind(void 0,this.instantiationService),t=this.treeDisposables.add(this.instantiationService.createInstance(I7e,this.id));this.treeLabels=this.treeDisposables.add(this.instantiationService.createInstance(Za,this));let o=this.instantiationService.createInstance(Zfi,this,p=>this.progressService.withProgress({location:this.id},()=>p)),n=this.treeDisposables.add(new evi(this.themeService,this.logService)),r=this.treeDisposables.add(new FPt),s=this.treeDisposables.add(this.instantiationService.createInstance(G5,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(Qfi,this.id,this.treeContainer,new Xfi,[s],o,{identityProvider:new Yfi,accessibilityProvider:{getAriaLabel(p){if(p.accessibilityInformation)return p.accessibilityInformation.label;if(Ae(p.tooltip))return p.tooltip;{if(p.resourceUri&&!p.label)return null;let h="";if(p.label){let g=Mr(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?Mr(p.label.label)?p.label.label.value:p.label.label:p.resourceUri?Ye(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:qz(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 WPt(this.notificationService,()=>this.tree.getSelection()));s.actionRunner=c,this.tree.contextKeyService.createKey(this.id,!0),H$o.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(S7e.checkboxClass))return;let h=this.tree.getSelection(),g=await this.resolveCommand(h.length===1?h[0]:void 0);if(g&&Soo(g,this.contextKeyService)){let f=g.arguments||[];(g.id===Zh||g.id===NC)&&(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 Zj&&e.hasResolve&&(await e.resolve(ve.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 Lr(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(B$o),this.updateContentAreas()}processMessage(e,t){let o=e.value.split(`
`),n=[],r=!1;for(let l of o){let c=lS(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 Mi(p,{title:u.title,secondary:r,supportIcons:!0,...Ko});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===Y.command){let f=boo(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 xe(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)Ao(l)?s.appendChild(l):s.appendChild(l.element);return s}showMessage(e){if(voo(this._messageValue)&&this._messageValue.disposables.dispose(),Mr(e)){let t=new P,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"&&!Jl(this._messageValue)?this.messageElement.textContent=this._messageValue:voo(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-nh(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 jbe(e,t)}return 0}updateCheckboxes(e){return Ioo(e)}async refresh(e,t){if(this.dataProvider&&this.tree){this.refreshing&&await H.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 Q(`treeView.${this.id}.toggleCollapseAll`,!1,d(4246,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===Pn()&&this.focus(),this.domNode.removeAttribute("tabindex"))}get container(){return this._container}};x_e=I([m(2,De),m(3,F),m(4,ge),m(5,B),m(6,Bo),m(7,ze),m(8,_e),m(9,Ne),m(10,Ri),m(11,tt),m(12,X),m(13,zl),m(14,ne),m(15,Qe),m(16,Qn)],x_e);var Yfi=class{getId(i){return i.handle}},Xfi=class{getHeight(i){return G5.ITEM_HEIGHT}getTemplateId(i){return G5.TREE_TEMPLATE_ID}};async function Jfi(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 Zfi=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(Jfi(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)})}},G5=class extends C{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(mv,"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 G5.TREE_TEMPLATE_ID}set actionRunner(e){this._actionRunner=e}renderTemplate(e){e.classList.add("custom-view-tree-node-item");let t=R(e,_("")),o=this.labels.create(e,{supportHighlights:!0,hoverDelegate:this._hoverDelegate}),n=Sf(o.element,_(".custom-view-tree-node-item-icon")),r=R(o.element,_(".actions")),s=new ji(r,{actionViewItemProvider:this.actionViewItemProvider});return{resourceLabel:o,icon:n,checkboxContainer:t,actionBar:s,container:e}}getHover(e,t,o){return!(o instanceof Zj)||!o.hasResolve?t&&!o.tooltip?void 0:o.tooltip===void 0?Mr(e)?{markdown:e,markdownNotSupportedFallback:e.value}:e:Ae(o.tooltip)?o.tooltip!==""?o.tooltip:void 0:{markdown:o.tooltip,markdownNotSupportedFallback:t?void 0:qa(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?Mr(e)?e.value:e:""}}processLabel(e,t){if(!Mr(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:Ye(r)}:void 0,l=Ae(n.description)?n.description:r&&n.description===!0?this.labelService.getUriLabel(ci(r),{relative:!0}):void 0,c=s?Mr(s.label)?s.label.value:s.label:void 0,u=s?.highlights&&c?s.highlights.map(([N,O])=>{if(N<0&&(N=c.length+N),O<0&&(O=c.length+O),N>=c.length||O>c.length)return{start:0,end:0};if(N>O){let V=N;N=O,O=V}return{start:N,end:O}}):void 0,{label:p,bold:h,italic:g,strikethrough:f,supportIcons:v}=this.processLabel(s?.label,u),b=Ip(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=Soo(n.command,this.contextKeyService)),this.renderCheckbox(n,o),r){let N=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:N,extraClasses:["custom-view-tree-node-item-resourceLabel"],matches:u||ua(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||ua(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=Na(S);else{let N;this.shouldShowThemeIcon(!!r,n.themeIcon)&&(N=q.asClassName(n.themeIcon),n.themeIcon.color&&(o.icon.style.color=this.themeService.getColorTheme().getColor(n.themeIcon.color.id)?.toString()??"")),o.icon.className=N?`custom-view-tree-node-item-icon ${N}`:"",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 S7e(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 G$i.id:return 0;case X$.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=Ioo(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()}};G5=I([m(7,De),m(8,B),m(9,ot),m(10,X),m(11,tt),m(12,F)],G5);var evi=class extends C{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(Ip(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===X$.id:e.collapsibleState!==0)?o.hasFileIcons&&o.hasFolderIcons:o.hasFileIcons}return!1}},WPt=class extends as{constructor(e,t){super();this.getSelectedResources=t;this._register(this.onDidRun(o=>{o.error&&!so(o.error)&&e.error(d(4241,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)}},I7e=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 li),e.push(...t.values()));return e}createGroups(i){let e=[],t=new Map;for(let o of i)o instanceof li?(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=Ef(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()}};I7e=I([m(1,qt)],I7e);var k_e=class extends x_e{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 Im(this.extensionId),id:this.id}),this.createTree(),this.progressService.withProgress({location:this.id},()=>this.extensionService.activateByEvent(`onView:${this.id}`)).then(()=>Pi(2e3)).then(()=>{this.updateMessage()}),this.activated=!0)}};k_e=I([m(3,De),m(4,F),m(5,ge),m(6,B),m(7,Bo),m(8,ze),m(9,_e),m(10,Ne),m(11,Ri),m(12,X),m(13,tt),m(14,lt),m(15,zl),m(16,Te),m(17,ne),m(18,Qe),m(19,Qn)],k_e);var pK=class extends x_e{activate(){this.activated||(this.createTree(),this.activated=!0)}},y7e=class{constructor(i,e,t,o,n){this.treeId=i;this.labelService=e;this.instantiationService=t;this.treeViewsDragAndDropService=o;this.logService=n;this.treeItemsTransfer=VI.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=_t();this.dragCancellationToken=new $e,this.treeViewsDragAndDropService.addDragOperationTransfer(t,this.handleDragAndLog(this.dndController,e,t,this.dragCancellationToken.token)),this.treeItemsTransfer.setData([new sC(t)],sC.prototype),i.dataTransfer.clearData(Zn.text),this.dndController.dragMimeTypes.find(o=>o===Zn.uriList)&&i.dataTransfer?.setData(Aa.RESOURCES,""),this.dndController.dragMimeTypes.forEach(o=>{i.dataTransfer?.setData(o,"")})}addResourceInfoToTransfer(i,e){if(e.length&&i.dataTransfer){this.instantiationService.invokeFunction(o=>Ig(o,e,i));let t=e.filter(o=>o.scheme===Y.file).map(o=>o.fsPath);t.length&&i.dataTransfer.setData(Ll.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=$se(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===Aa.RESOURCES.toLowerCase()){s.add(Zn.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?Mr(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(sC.prototype)&&(l=this.treeItemsTransfer.getData(sC.prototype)[0].identifier);let c=$se(n.dataTransfer,!0),u=new bx;for(let[h,g]of c)if((h===this.treeMimeType||r.dropMimeTypes.includes(h)||g.asFile()&&r.dropMimeTypes.includes(Aa.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,ve.None,l,s?.id,s?.itemHandles)}onDragEnd(i){i.dataTransfer?.dropEffect==="none"&&this.dragCancellationToken?.cancel()}dispose(){}};y7e=I([m(1,ot),m(2,F),m(3,Yq),m(4,ne)],y7e);function Ioo(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 Hf="workbench.view.explorer",Cb="workbench.explorer.fileView",yoo=new Q("explorerViewletVisible",!0,{type:"boolean",description:d(10523,null)}),$5=new Q("foldersViewVisible",!0,{type:"boolean",description:d(10525,null)}),lu=new Q("explorerResourceIsFolder",!1,{type:"boolean",description:d(10514,null)}),tvi=new Q("explorerResourceReadonly",!1,{type:"boolean",description:d(10518,null)}),pF=tvi.toNegated(),ivi=new Q("explorerResourceParentReadonly",!1,{type:"boolean",description:d(10517,null)}),VPt=new Q("explorerResourceAvailableEditorIds",""),FC=new Q("explorerResourceIsRoot",!1,{type:"boolean",description:d(10515,null)}),BPt=new Q("explorerResourceCut",!1,{type:"boolean",description:d(10513,null)}),due=new Q("explorerResourceMoveableToTrash",!1,{type:"boolean",description:d(10516,null)}),ovi=new Q("filesExplorerFocus",!0,{type:"boolean",description:d(10524,null)}),woo=new Q("openEditorsFocus",!0,{type:"boolean",description:d(10526,null)}),C7e=new Q("explorerViewletFocus",!0,{type:"boolean",description:d(10522,null)}),HPt=new Q("explorerFindProviderActive",!1,{type:"boolean",description:d(10512,null)}),uue=new Q("explorerViewletCompressedFocus",!0,{type:"boolean",description:d(10520,null)}),x7e=new Q("explorerViewletCompressedFirstFocus",!0,{type:"boolean",description:d(10519,null)}),k7e=new Q("explorerViewletCompressedLastFocus",!0,{type:"boolean",description:d(10521,null)}),Coo=new Q("viewHasSomeCollapsibleItem",!1,{type:"boolean",description:d(10527,null)}),WC=x.and($5,ovi,x.not(Uu)),xoo=x.and($5,C7e,x.not(Uu)),mF="workbench.editors.files.textFileEditor",pue="workbench.editors.files.fileEditorInput",UPt="workbench.editors.files.binaryFileEditor",E_e="code-text-binary";var wR=class extends C{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:wR.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=wR.textFileToResource(e),o=await this.resolveEditorModel(e);if(!this.fileWatcherDisposable.value){let n=new P;this.fileWatcherDisposable.value=n,n.add(this.fileService.onDidFilesChange(r=>{r.contains(t,0)&&this.resolveEditorModel(e,!1)})),o&&n.add(H.once(o.onWillDispose)(()=>this.fileWatcherDisposable.clear()))}return o}async resolveEditorModel(e,t=!0){let o=wR.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}};wR=I([m(0,Ho),m(1,be),m(2,kt),m(3,Ct)],wR);var wh=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 no.getOriginalUri(this.editor,{supportSideBySide:1})}};var nvi=Re("remote-explorer-get-started",M.star,d(12718,null)),rvi=Re("remote-explorer-documentation",M.book,d(12713,null)),TXl=Re("remote-explorer-feedback",M.twitter,d(12714,null)),svi=Re("remote-explorer-review-issues",M.issues,d(12727,null)),avi=Re("remote-explorer-report-issues",M.comment,d(12726,null)),koo=Re("remote-explorer-view-icon",M.remoteExplorer,d(12725,null)),zPt=Re("ports-view-icon",M.plug,d(12723,null)),_Xl=Re("ports-view-icon",M.plug,d(12722,null)),lvi=Re("private-ports-view-icon",M.lock,d(12724,null)),Eoo=Re("ports-forward-icon",M.plus,d(12717,null)),Too=Re("ports-stop-forward-icon",M.x,d(12728,null)),_oo=Re("ports-open-browser-icon",M.globe,d(12720,null)),Doo=Re("ports-open-preview-icon",M.openPreview,d(12721,null)),Loo=Re("ports-copy-address-icon",M.clippy,d(12712,null)),cvi=Re("ports-label-icon",M.tag,d(12719,null)),Roo=Re("ports-forwarded-without-process-icon",M.circleOutline,d(12715,null)),Moo=Re("ports-forwarded-with-process-icon",M.circleFilled,d(12716,null));var Poo=new Q("openPreviewEnabled",!1),dvi=class{constructor(i){this.remoteExplorerService=i;this.headerRowHeight=22}getHeight(i){return i.tunnelType==="Add"&&!this.remoteExplorerService.getEditableData(void 0)?30:22}},T_e=class{constructor(i,e){this.remoteExplorerService=i;this.tunnelService=e;this._candidates=new Map;this.input={label:d(12787,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:lvi.id,label:d(12811,null)},strip:()=>{}};this.model=i.tunnelModel,this.onForwardedPortsChanged=H.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(Tp(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=Tp(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=VC.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=VC.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))}};T_e=I([m(0,Gd),m(1,ap)],T_e);function D7e(a){return{label:"",tunnel:a,editId:0,tooltip:""}}var uvi=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 D7e(i);let e=i.processDescription?Moo:Roo,t="";return i instanceof VC&&(t=`${i.iconTooltip} ${i.tooltipPostfix}`),{label:"",icon:e,tunnel:i,editId:0,tooltip:t}}},pvi=class{constructor(){this.label=d(12803,null);this.tooltip=d(12804,null);this.weight=1;this.templateId="actionbar"}project(i){let e=i.tunnelType==="Add",t=i.label,o="";return i instanceof VC&&!e?o=`${i.portTooltip} ${i.tooltipPostfix}`:o=t,{label:t,tunnel:i,menuId:D.TunnelPortInline,editId:i.tunnelType==="Add"?1:2,tooltip:o}}},mvi=class a{constructor(){this.label=d(12796,null);this.tooltip=d(12797,null);this.weight=1;this.templateId="actionbar"}project(i){if(i.tunnelType==="Add")return D7e(i);let e=i.localAddress??"",t=e;return i instanceof VC&&(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"?it?o=d(12757,null):o=d(12756,null):it?o=d(12758,null):o=d(12759,null);let n=new xe("",!0),r=i.startsWith("http")?i:`http://${i}`;return n.appendLink(r,"Follow link").appendMarkdown(` (${o})`)}}},hvi=class{constructor(){this.label=d(12807,null);this.tooltip=d(12808,null);this.weight=2;this.templateId="actionbar"}project(i){return i.tunnelType==="Add"?D7e(i):{label:i.processDescription??"",tunnel:i,editId:0,tooltip:i instanceof VC?i.processTooltip:""}}},gvi=class{constructor(){this.label=d(12801,null);this.tooltip=d(12802,null);this.weight=1;this.templateId="actionbar"}project(i){if(i.tunnelType==="Add")return D7e(i);let e=i.source.description,t=`${i instanceof VC?i.originTooltip:""}. ${i instanceof VC?i.tooltipPostfix:""}`;return{label:e,menuId:D.TunnelOriginInline,tunnel:i,editId:0,tooltip:t}}},fvi=class{constructor(){this.label=d(12805,null);this.tooltip=d(12806,null);this.weight=1;this.templateId="actionbar"}project(i){if(i.tunnelType==="Add")return D7e(i);let e=i.privacy?.label,t="";return i instanceof VC&&(t=`${i.privacy.label} ${i.tooltipPostfix}`),{label:e,tunnel:i,icon:{id:i.privacy.themeIcon},editId:0,tooltip:t}}},E7e=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=Ni("mouse")}set actionRunner(i){this._actionRunner=i}renderTemplate(i){let e=R(i,_(".ports-view-actionbar-cell")),t=R(e,_(".ports-view-actionbar-cell-icon")),o=new P,n=new P;o.add(n);let r=o.add(new Lc(e,{supportHighlights:!0,hoverDelegate:this._hoverDelegate})),s=R(e,_(".actions")),l=o.add(new ji(s,{actionViewItemProvider:Ca.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 Mi(e.container,Ko)),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 VC&&(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",P5],[L7e.key,i.tunnel.tunnelType],[R7e.key,i.tunnel.closeable],[vvi.key,i.tunnel.privacy.id],[GPt.key,i.tunnel.protocol]],o=this.contextKeyService.createOverlay(t);if(i.menuId){let n=e.elementDisposables.add(this.menuService.createMenu(i.menuId,o)),r=Vm(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 Dc(t,this.contextViewService,{ariaLabel:d(12789,null),validationOptions:{validation:l=>{let c=e.validationMessage(l);return c?{content:c.content,formatContent:!0,type:c.severity===St.Error?3:1}:null}},placeholder:e.placeholder||"",inputBoxStyles:pl});n.value=o,n.focus(),n.select({start:0,end:e.startingValue?e.startingValue.length:0});let r=wd(async(l,c)=>{Ue(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,Vo(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()}};E7e=I([m(0,F),m(1,X),m(2,qt),m(3,_n),m(4,Gd),m(5,ge),m(6,B)],E7e);var VC=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=jX(this.remoteHost)||M5(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(12814,null)),i}get tooltipPostfix(){let i;return this.localAddress?i=d(12785,null,this.remoteHost,this.remotePort,this.localAddress):i=d(12784,null,this.remoteHost,this.remotePort),i}get iconTooltip(){return this.tunnelType==="Add"?this.label:`${this.processDescription?d(12800,null):d(12799,null)}`}get portTooltip(){return this.tunnelType==="Add"?"":`${this.name?d(12786,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:M.question.id,label:d(12812,null)}:{id:"private",themeIcon:lvi.id,label:d(12811,null)}}},L7e=new Q("tunnelType","Add",!0),R7e=new Q("tunnelCloseable",!1,!0),vvi=new Q("tunnelPrivacy",void 0,!0),Aoo=new Q("tunnelPrivacyEnabled",!1,!0),GPt=new Q("tunnelProtocol","http",!0),$Pt=new Q("tunnelViewFocus",!1,d(12798,null)),M7e="tunnelViewSelection",K$o=new Q(M7e,void 0,!0),Noo="tunnelViewMultiSelection",Ooo=new Q(Noo,void 0,!0),Foo=new Q("portChangable",!1,!0),Woo=new Q("protocolChangable",!0,!0),hF=class extends zr{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 P);this.isEditing=!1;this.titleActions=[];this.lastFocus=[];this.height=0;this.width=0;this.tunnelTypeContext=L7e.bindTo(r),this.tunnelCloseableContext=R7e.bindTo(r),this.tunnelPrivacyContext=vvi.bindTo(r),this.tunnelPrivacyEnabledContext=Aoo.bindTo(r),this.tunnelPrivacyEnabledContext.set(S.canChangePrivacy),this.protocolChangableContextKey=Woo.bindTo(r),this.protocolChangableContextKey.set(S.canChangeProtocol),this.tunnelProtocolContext=GPt.bindTo(r),this.tunnelViewFocusContext=$Pt.bindTo(r),this.tunnelViewSelectionContext=K$o.bindTo(r),this.tunnelViewMultiSelectionContext=Ooo.bindTo(r),this.portChangableContextKey=Foo.bindTo(r);let w=this.contextKeyService.createOverlay([["view",hF.ID]]),k=this._register(this.menuService.createMenu(D.TunnelTitle,w)),T=()=>{this.titleActions=Vm(k.getActions()),this.updateActions()};this._register(k.onDidChange(T)),T(),this._register(Z(()=>{this.titleActions=[]})),this.registerPrivacyActions(),this._register(H.once(this.tunnelService.onAddedTunnelProvider)(()=>{let N=!1;this.tunnelPrivacyEnabledContext.get()===!1&&(this.tunnelPrivacyEnabledContext.set(S.canChangePrivacy),N=!0),this.protocolChangableContextKey.get()===!0&&(this.protocolChangableContextKey.set(S.canChangeProtocol),N=!0),N&&(T(),this.registerPrivacyActions(),this.createTable(),this.table?.layout(this.height,this.width))}))}static{this.ID=P5}static{this.TITLE=L(12761,"Ports")}registerPrivacyActions(){for(let e of this.tunnelService.privacyOptions){let t=`remote.tunnel.privacy${e.id}`;qe.registerCommand(t,Uoo.handler(e.id)),fe.appendMenuItem(D.TunnelPrivacy,{order:0,command:{id:t,title:e.label,toggled:vvi.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=R(this.panelContainer,_(".customview-tree"));e.classList.add("ports-view"),e.classList.add("file-icon-themable-tree","show-file-icons");let t=new E7e(this.instantiationService,this.contextKeyService,this.menuService,this.contextViewService,this.remoteExplorerService,this.commandService,this.configurationService),o=[new uvi,new pvi,new mvi,new hvi];this.tunnelService.canChangePrivacy&&o.push(new fvi),o.push(new gvi),this.table=this.instantiationService.createInstance(rC,"RemoteTunnels",e,new dvi(this.remoteExplorerService),o,[t],{keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:l=>l.label},multipleSelectionSupport:!0,accessibilityProvider:{getAriaLabel:l=>l instanceof VC?`${l.tooltipPostfix} ${l.portTooltip} ${l.iconTooltip} ${l.processTooltip} ${l.originTooltip} ${this.tunnelService.canChangePrivacy?l.privacy.label:""}`:l.label,getWidgetAriaLabel:()=>d(12813,null)},openOnSingleClick:!0});let n=this.tableDisposables.add(new as);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(H.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(zP.ID,l.element)}})),this.tableDisposables.add(this.table.onDidOpen(l=>{!l.element||l.element.tunnelType!=="Forwarded"||l.browserEvent?.type==="dblclick"&&this.commandService.executeCommand(pJ.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=R(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(Tp(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:it?o=e.metaKey:o=e.ctrlKey,o}onSelectionChanged(e){let t=e.elements;t.length>1?this.tunnelViewMultiSelectionContext.set(t.map(o=>Tp(o.remoteHost,o.remotePort))):this.tunnelViewMultiSelectionContext.set(void 0)}onContextMenu(e,t){if(e.element!==void 0&&!(e.element instanceof VC))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 Lr(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)}};hF=I([m(2,_e),m(3,ze),m(4,X),m(5,B),m(6,F),m(7,Ri),m(8,Qe),m(9,Ge),m(10,ge),m(11,qt),m(12,De),m(13,Gd),m(14,tt),m(15,ap),m(16,_n)],hF);var KPt=class{constructor(i,e){this.id=hF.ID;this.name=hF.TITLE;this.canToggleVisibility=!0;this.hideByDefault=!1;this.group="details@0";this.order=-500;this.canMoveView=!0;this.containerIcon=zPt;this.ctorDescriptor=new Mt(hF,[i]),this.remoteAuthority=e.remoteAuthority?e.remoteAuthority.split("+")[0]:void 0}};function mJ(a){return a&&a.tunnelType&&a.remoteHost&&a.source}var pJ;(o=>{o.ID="remote.tunnel.label",o.LABEL=d(12775,null),o.COMMAND_ID_KEYWORD="label";function t(){return async(n,r)=>{let s=n.get(Gd),l;if(mJ(r))l=r;else{let c=n.get(X).getContextKeyValue(M7e),u=c?s.tunnelModel.forwarded.get(c):void 0;if(u){let p=n.get(ap);l=VC.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(12790,null),startingValue:p})})}}}o.handler=t})(pJ||={});var G$o=d(12792,null),bvi=65536,Voo=d(12791,null,bvi),Boo=d(12795,null),$$o=d(12794,null),gw;(c=>{c.INLINE_ID="remote.tunnel.forwardInline",c.COMMANDPALETTE_ID="remote.tunnel.forwardCommandPalette",c.LABEL=L(12770,"Forward a Port"),c.TREEITEM_LABEL=d(12773,null);let o=d(12774,null);function n(u,p,h,g){let f=W9e(h);if(f){if(f.port>=bvi)return{content:Voo,severity:St.Error};if(g&&p.isPortPrivileged(f.port))return{content:Boo,severity:St.Info};if(Ib(u.tunnelModel.forwarded,f.host,f.port))return{content:$$o,severity:St.Error}}else return{content:G$o,severity:St.Error};return null}function r(u,p,h,g){p?typeof p=="string"&&u.warn(d(12772,null,h,g,p)):u.warn(d(12771,null,h,g))}function s(){return async(u,p)=>{let h=u.get(Gd),g=u.get(Ne),f=u.get(ap);h.setEditable(void 0,1,{onFinish:async(v,b)=>{h.setEditable(void 0,1,null);let S;b&&(S=W9e(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(Gd),g=u.get(Ne),f=u.get(Ft),v=u.get(Ge),b=u.get(ap);await f.openView(hF.ID,!0);let S=await v.input({prompt:o,validateInput:w=>Promise.resolve(n(h,b,w,b.canElevate))}),y;S&&(y=W9e(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 Hoo(a,i,e){let t=a.map(o=>{let n=VC.createFromTunnel(i,e,o);return{label:n.label,description:n.processDescription,tunnel:n}});return t.length===0&&t.push({label:d(12765,null,gw.LABEL.value)}),t}var HV;(n=>{n.INLINE_ID="remote.tunnel.closeInline",n.COMMANDPALETTE_ID="remote.tunnel.closeCommandPalette",n.LABEL=L(12764,"Stop Forwarding Port");function t(){return async(r,s)=>{let l=r.get(X),c=r.get(Gd),u=[],p=l.getContextKeyValue(Noo);if(p)p.forEach(h=>{let g=c.tunnelModel.forwarded.get(h);g&&u?.push(g)});else if(mJ(s))u=[s];else{let h=l.getContextKeyValue(M7e),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(Ge),l=r.get(Gd),c=r.get(ap),u=r.get(ge),p=Hoo(Array.from(l.tunnelModel.forwarded.values()).filter(g=>g.closeable),l,c),h=await s.pick(p,{placeHolder:d(12766,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})(HV||={});var zP;(o=>{o.ID="remote.tunnel.open",o.LABEL=d(12776,null);function e(){return async(n,r)=>{let s;if(mJ(r)?s=Tp(r.remoteHost,r.remotePort):agi(r)&&(s=Tp(r.tunnelRemoteHost,r.tunnelRemotePort)),s){let l=n.get(Gd).tunnelModel,c=n.get(Qe);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})(zP||={});var UV;(o=>{o.ID="remote.tunnel.openPreview",o.LABEL=d(12781,null);function e(){return async(n,r)=>{let s;if(mJ(r)?s=Tp(r.remoteHost,r.remotePort):agi(r)&&(s=Tp(r.tunnelRemoteHost,r.tunnelRemotePort)),s){let l=n.get(Gd).tunnelModel,c=n.get(Qe),u=n.get(NX);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},ve.None);return h?h.openExternalUri(c.localUri,{sourceUri:p},ve.None):r.open(c.localUri)}return Promise.resolve()}o.run=t})(UV||={});var T7e;(t=>{t.ID="remote.tunnel.openCommandPalette",t.LABEL=d(12777,null);function e(){return async(o,n)=>{let r=o.get(Gd),s=o.get(ap),l=r.tunnelModel,c=o.get(Ge),u=o.get(Qe),p=o.get(ge),h=[...l.forwarded,...l.detected].map(f=>{let v=VC.createFromTunnel(r,s,f[1]);return{label:v.label,description:v.processDescription,tunnel:v}});h.length===0?h.push({label:d(12778,null)}):h.push({label:d(12780,null)});let g=await c.pick(h,{placeHolder:d(12779,null)});if(g&&g.tunnel)return zP.run(l,u,Tp(g.tunnel.remoteHost,g.tunnel.remotePort));if(g)return p.executeCommand(`${P5}.focus`)}}t.handler=e})(T7e||={});var zV;(s=>{s.INLINE_ID="remote.tunnel.copyAddressInline",s.COMMANDPALETTE_ID="remote.tunnel.copyAddressCommandPalette",s.INLINE_LABEL=d(12768,null),s.COMMANDPALETTE_LABEL=d(12767,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(Gd),p;if(mJ(c))p=c;else{let h=l.get(X).getContextKeyValue(M7e);p=h?u.tunnelModel.forwarded.get(h):void 0}if(p)return o(u,l.get(Wi),p)}}s.inlineHandler=n;function r(){return async(l,c)=>{let u=l.get(Ge),p=l.get(Gd),h=l.get(ap),g=l.get(ge),f=l.get(Wi),v=Array.from(p.tunnelModel.forwarded.values()).concat(Array.from(p.tunnelModel.detected.values())),b=await u.pick(Hoo(v,p,h),{placeHolder:d(12769,null)});b&&b.tunnel?await o(p,f,b.tunnel):b&&await g.executeCommand(gw.COMMANDPALETTE_ID)}}s.commandPaletteHandler=r})(zV||={});var _7e;(o=>{o.ID="remote.tunnel.changeLocalPort",o.LABEL=d(12762,null);function e(n,r,s){if(r.match(/^[0-9]+$/)){if(Number(r)>=bvi)return{content:Voo,severity:St.Error};if(s&&n.isPortPrivileged(Number(r)))return{content:Boo,severity:St.Info}}else return{content:d(12793,null),severity:St.Error};return null}function t(){return async(n,r)=>{let s=n.get(Gd),l=n.get(Ne),c=n.get(ap),u;if(mJ(r))u=r;else{let p=n.get(X).getContextKeyValue(M7e),h=p?s.tunnelModel.forwarded.get(p):void 0;if(h){let g=n.get(ap);u=VC.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(12763,null,h,v.tunnelLocalPort??v.localAddress))}},validationMessage:h=>e(c,h,c.canElevate),placeholder:d(12788,null)})}}}o.handler=t})(_7e||={});var Uoo;(i=>{function a(e){return async(t,o)=>{if(mJ(o)){let n=t.get(Gd);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})(Uoo||={});var q5;(s=>{s.ID_HTTP="remote.tunnel.setProtocolHttp",s.ID_HTTPS="remote.tunnel.setProtocolHttps",s.LABEL_HTTP=d(12782,null),s.LABEL_HTTPS=d(12783,null);async function o(l,c,u,p){if(mJ(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(Gd),l.get(Vt))}s.handlerHttp=n;function r(){return async(l,c)=>o(c,"https",l.get(Gd),l.get(Vt))}s.handlerHttps=r})(q5||={});var Svi=10,mue=L7e.isEqualTo("Forwarded"),hue=x.or(mue,L7e.isEqualTo("Detected")),hJ=Ooo.isEqualTo(void 0);yt.registerCommandAndKeybindingRule({id:pJ.ID,weight:200+Svi,when:x.and($Pt,mue,hJ),primary:60,mac:{primary:3},handler:pJ.handler()});qe.registerCommand(gw.INLINE_ID,gw.inlineHandler());qe.registerCommand(gw.COMMANDPALETTE_ID,gw.commandPaletteHandler());yt.registerCommandAndKeybindingRule({id:HV.INLINE_ID,weight:200+Svi,when:x.and(R7e,$Pt),primary:20,mac:{primary:2049,secondary:[20]},handler:HV.inlineHandler()});qe.registerCommand(HV.COMMANDPALETTE_ID,HV.commandPaletteHandler());qe.registerCommand(zP.ID,zP.handler());qe.registerCommand(UV.ID,UV.handler());qe.registerCommand(T7e.ID,T7e.handler());yt.registerCommandAndKeybindingRule({id:zV.INLINE_ID,weight:200+Svi,when:x.and($Pt,hue,hJ),primary:2081,handler:zV.inlineHandler()});qe.registerCommand(zV.COMMANDPALETTE_ID,zV.commandPaletteHandler());qe.registerCommand(_7e.ID,_7e.handler());qe.registerCommand(q5.ID_HTTP,q5.handlerHttp());qe.registerCommand(q5.ID_HTTPS,q5.handlerHttps());fe.appendMenuItem(D.CommandPalette,{command:{id:HV.COMMANDPALETTE_ID,title:HV.LABEL},when:Xz});fe.appendMenuItem(D.CommandPalette,{command:{id:gw.COMMANDPALETTE_ID,title:gw.LABEL},when:Xz});fe.appendMenuItem(D.CommandPalette,{command:{id:zV.COMMANDPALETTE_ID,title:zV.COMMANDPALETTE_LABEL},when:Xz});fe.appendMenuItem(D.CommandPalette,{command:{id:T7e.ID,title:T7e.LABEL},when:Xz});fe.appendMenuItem(D.TunnelContext,{group:"._open",order:0,command:{id:zP.ID,title:zP.LABEL},when:x.and(hue,hJ)});fe.appendMenuItem(D.TunnelContext,{group:"._open",order:1,command:{id:UV.ID,title:UV.LABEL},when:x.and(hue,hJ)});fe.appendMenuItem(D.TunnelContext,{group:"0_manage",order:1,command:{id:pJ.ID,title:pJ.LABEL,icon:cvi},when:x.and(mue,hJ)});fe.appendMenuItem(D.TunnelContext,{group:"2_localaddress",order:0,command:{id:zV.INLINE_ID,title:zV.INLINE_LABEL},when:x.and(hue,hJ)});fe.appendMenuItem(D.TunnelContext,{group:"2_localaddress",order:1,command:{id:_7e.ID,title:_7e.LABEL},when:x.and(mue,Foo,hJ)});fe.appendMenuItem(D.TunnelContext,{group:"2_localaddress",order:2,submenu:D.TunnelPrivacy,title:d(12809,null),when:x.and(mue,Aoo)});fe.appendMenuItem(D.TunnelContext,{group:"2_localaddress",order:3,submenu:D.TunnelProtocol,title:d(12810,null),when:x.and(mue,hJ,Woo)});fe.appendMenuItem(D.TunnelContext,{group:"3_forward",order:0,command:{id:HV.INLINE_ID,title:HV.LABEL},when:R7e});fe.appendMenuItem(D.TunnelContext,{group:"3_forward",order:1,command:{id:gw.INLINE_ID,title:gw.LABEL}});fe.appendMenuItem(D.TunnelProtocol,{order:0,command:{id:q5.ID_HTTP,title:q5.LABEL_HTTP,toggled:GPt.isEqualTo("http")}});fe.appendMenuItem(D.TunnelProtocol,{order:1,command:{id:q5.ID_HTTPS,title:q5.LABEL_HTTPS,toggled:GPt.isEqualTo("https")}});fe.appendMenuItem(D.TunnelPortInline,{group:"0_manage",order:0,command:{id:gw.INLINE_ID,title:gw.TREEITEM_LABEL,icon:Eoo},when:L7e.isEqualTo("Candidate")});fe.appendMenuItem(D.TunnelPortInline,{group:"0_manage",order:4,command:{id:pJ.ID,title:pJ.LABEL,icon:cvi},when:mue});fe.appendMenuItem(D.TunnelPortInline,{group:"0_manage",order:5,command:{id:HV.INLINE_ID,title:HV.LABEL,icon:Too},when:R7e});fe.appendMenuItem(D.TunnelLocalAddressInline,{order:-1,command:{id:zV.INLINE_ID,title:zV.INLINE_LABEL,icon:Loo},when:hue});fe.appendMenuItem(D.TunnelLocalAddressInline,{order:0,command:{id:zP.ID,title:zP.LABEL,icon:_oo},when:hue});fe.appendMenuItem(D.TunnelLocalAddressInline,{order:1,command:{id:UV.ID,title:UV.LABEL,icon:Doo},when:hue});J("ports.iconRunningProcessForeground",p7i,d(12760,null));var qPt=class a extends C{constructor(e,t){super();this._onDidMatchLocalUrl=this._register(new E);this.onDidMatchLocalUrl=this._onDidMatchLocalUrl.event;this.listeners=new Map;this.terminalDataWorkers=this._register(new jt);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 wM(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=CS(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 KV="workbench.view.remote",__e=class extends C{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(oe.as(on.ViewsRegistry).registerViewWelcomeContent(P5,{content:this.environmentService.remoteAuthority?d(12710,null,`command:${gw.INLINE_ID}`):d(12698,null,`command:${gw.INLINE_ID}`)})),this.enableBadgeAndStatusBar(),this.enableForwardedPortsFeatures(),this.environmentService.remoteAuthority||this._register(H.once(this.tunnelService.onTunnelOpened)(()=>{this.hasPortsInSession=!0}))}async getViewContainer(){return oe.as(on.ViewContainersRegistry).registerViewContainer({id:aMt,title:L(12699,"Ports"),icon:zPt,ctorDescriptor:new Mt(Ha,[aMt,{mergeViewWithContainerWhenSingleView:!0}]),storageId:aMt,hideIfEmpty:!0,order:5},1)}async enableForwardedPortsFeatures(){this.contextKeyListener.clear();let e=!!Kde.getValue(this.contextKeyService),t=!!Xz.getValue(this.contextKeyService);if(e||t){t||this.contextKeyService.createKey(Xz.key,!0);let o=await this.getViewContainer(),n=new KPt(new T_e(this.remoteExplorerService,this.tunnelService),this.environmentService),r=oe.as(on.ViewsRegistry);o&&(this.remoteExplorerService.enablePortsFeatures(!e),r.registerViews([n],o))}else this.contextKeyListener.value=this.contextKeyService.onDidChangeContext(o=>{o.affectsSome(new Set([...Kde.keys(),...Xz.keys()]))&&this.enableForwardedPortsFeatures()})}enableBadgeAndStatusBar(){let e=oe.as(on.ViewsRegistry).onViewsRegistered(t=>{t.find(o=>o.views.find(n=>n.id===P5))&&(this._register(H.debounce(this.remoteExplorerService.tunnelModel.onForwardPort,(o,n)=>n,50)(()=>{this.updateActivityBadge(),this.updateStatusBar()})),this._register(H.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(P5,{badge:new qc(this.remoteExplorerService.tunnelModel.forwarded.size,e=>e===1?d(12696,null):d(12697,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(12703,null);else{let n=Array.from(this.remoteExplorerService.tunnelModel.forwarded.values());n.push(...Array.from(this.remoteExplorerService.tunnelModel.detected.values())),e=d(12704,null,n.map(r=>r.remotePort).join(", "))}return{name:d(12711,null),text:`$(radio-tower) ${o}`,ariaLabel:e,tooltip:e,command:`${P5}.focus`}}};__e=I([m(0,X),m(1,Vt),m(2,Gd),m(3,ap),m(4,zl),m(5,Tr)],__e);var D_e=class{constructor(i,e){this.remoteExplorerService=i;this.logService=e;this.remoteExplorerService.tunnelModel.environmentTunnelsSet?this.restore():H.once(this.remoteExplorerService.tunnelModel.onEnvironmentTunnelsSet)(async()=>{await this.restore()})}async restore(){return this.logService.trace("ForwardedPorts: Doing first restore."),this.remoteExplorerService.restore()}};D_e=I([m(0,Gd),m(1,ne)],D_e);var L_e=class extends C{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(q_)?this.setup(S):y.affectsConfiguration(H9e)&&!this.portListener&&this.listenForPorts()}))}),this.storageService.getBoolean("processPortForwardingFallback",1,!0)||this.configurationService.updateValue(H9e,0,5))}getPortAutoFallbackNumber(){let e=this.configurationService.inspect(H9e);if(e.value!==void 0&&(e.value===0||e.value!==e.defaultValue))return e.value;let t=this.configurationService.inspect(q_);return t.applicationValue===Jz||t.userValue===Jz||t.userLocalValue===Jz||t.userRemoteValue===Jz||t.workspaceFolderValue===Jz||t.workspaceValue===Jz?0:e.value??20}listenForPorts(){let e=this.getPortAutoFallbackNumber();if(e===0){this.portListener?.dispose();return}this.procForwarder&&!this.portListener&&this.configurationService.getValue(q_)===Jz?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(q_,LTe),this.notificationService.notify({message:d(12700,null),severity:gt.Warning,actions:{primary:[pi({id:"switchBack",label:d(12702,null),run:async()=>{await this.configurationService.updateValue(q_,Jz),await this.configurationService.updateValue(H9e,0,5),this.portListener?.dispose(),this.portListener=void 0}}),pi({id:"showPortSourceSetting",label:d(12701,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(q_).default?.value!==QX&&oe.as(ii.Configuration).registerDefaultConfigurations([{overrides:{"remote.autoForwardPortsSource":QX}}]),this.outputForwarder=this._register(new QPt(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(q_)===Jz;n()?this.procForwarder=this._register(new YPt(!1,t,!o,this.configurationService,this.remoteExplorerService,this.notificationService,this.openerService,this.externalOpenerService,this.tunnelService,this.hostService,this.logService,this.contextKeyService)):this.configurationService.getValue(q_)===LTe&&(this.procForwarder=this._register(new YPt(!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 QPt(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()}};L_e=I([m(0,Yo),m(1,Ne),m(2,Qe),m(3,NX),m(4,Gd),m(5,Vt),m(6,X),m(7,Lv),m(8,Li),m(9,yo),m(10,ap),m(11,oi),m(12,ne),m(13,le),m(14,Po)],L_e);var jPt=class a extends C{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=Tp(t.tunnelRemoteHost,t.tunnelRemotePort);await zP.run(this.remoteExplorerService.tunnelModel,this.openerService,r);break}case"openPreview":{let r=Tp(t.tunnelRemoteHost,t.tunnelRemotePort);await UV.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(12705,null,o?` (${o})`:"",e.tunnelRemotePort)}linkMessage(){return d(12709,null,`command:${hF.ID}.focus`)}async showNotification(e){if(!await this.hostService.hadLastFocus())return;this.lastNotification?.close();let t=await this.basicMessage(e),o=[this.openBrowserChoice(e)];(!Gt||Poo.getValue(this.contextKeyService))&&o.push(this.openPreviewChoice(e)),e.tunnelLocalPort!==e.tunnelRemotePort&&this.tunnelService.canElevate&&this.tunnelService.isPortPrivileged(e.tunnelRemotePort)&&(t+=d(12707,null,e.tunnelRemotePort),o.unshift(this.elevateChoice(e))),e.privacy==="private"&&Gt&&this.tunnelService.canChangePrivacy&&o.push(this.makePublicChoice(e)),t+=this.linkMessage(),this.lastNotification=this.notificationService.prompt(gt.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(12708,null),run:async()=>{let t=Ib(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=Tp(e.tunnelRemoteHost,e.tunnelRemotePort);return{label:zP.LABEL,run:()=>zP.run(this.remoteExplorerService.tunnelModel,this.openerService,t)}}openPreviewChoice(e){let t=Tp(e.tunnelRemoteHost,e.tunnelRemotePort);return{label:UV.LABEL,run:()=>UV.run(this.remoteExplorerService.tunnelModel,this.openerService,this.externalOpenerService,t)}}elevateChoice(e){return{label:d(12706,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:sMt});!t||typeof t=="string"||(this.lastNotification?.close(),this.lastShownPort=t.tunnelRemotePort,this.lastNotification=this.notificationService.prompt(gt.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}))}}}},QPt=class extends C{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 jPt(t,r,o,n,c,u,p,h),this._register(s.onDidChangeConfiguration(f=>{f.affectsConfiguration(A5)&&this.tryStartStopUrlFinder()})),this.portsFeatures=this._register(this.remoteExplorerService.onEnabledPortsFeatures(()=>{this.tryStartStopUrlFinder()})),this.tryStartStopUrlFinder(),s.getValue(q_)===LTe&&this._register(this.tunnelService.onTunnelClosed(f=>this.notifier.hide([f.port])))}tryStartStopUrlFinder(){this.configurationService.getValue(A5)?this.startUrlFinder():this.stopUrlFinder()}startUrlFinder(){!this.urlFinder&&this.remoteExplorerService.portsFeaturesEnabled!==2||(this.portsFeatures?.dispose(),this.urlFinder=this._register(new qPt(this.terminalService,this.debugService)),this._register(this.urlFinder.onDidMatchLocalUrl(async e=>{if(Ib(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:sMt},t??null);o&&typeof o!="string"&&this.notifier.doAction([o])})))}stopUrlFinder(){this.urlFinder&&(this.urlFinder.dispose(),this.urlFinder=void 0)}},YPt=class extends C{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 jPt(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(A5)&&await this.startStopCandidateListener()})),this.portsFeatures=this._register(this.remoteExplorerService.onEnabledPortsFeatures(async()=>{await this.startStopCandidateListener()})),this.startStopCandidateListener()}async startStopCandidateListener(){this.configurationService.getValue(A5)?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(A5)&&(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(Tp(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=Tp(o.host,o.port);if(this.initialCandidates.has(r)&&n?.onAutoForward===void 0||this.notifiedOnly.has(r)||this.autoForwarded.has(r))continue;let s=Ib(this.remoteExplorerService.tunnelModel.forwarded,o.host,o.port);if(Ib(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:sMt},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=Ib(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 Ivi={webviewState:"webviewState"},gJ=class extends zr{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 P);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 Bl(`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 vz("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[Ivi.webviewState]=this._webview.value.state),this.memento.saveMemento(),super.saveState()}layoutBody(e,t){super.layoutBody(e,t),this.layoutWebview(new ai(t,e))}updateTreeVisibility(){this.isBodyVisible()?(this.activate(),this._webview.value?.claim(this,Me(this.element),void 0)):this._webview.value?.release(this)}activate(){if(this._activated)return;this._activated=!0;let e=this.extensionId?gJ.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[Ivi.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[Ivi.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 iX(Me(this.element),()=>this._webview.value));let o=this._webviewDisposables.add(new $e);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 qc(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 Nh(e,"monaco-scrollable-element")??void 0}};gJ=I([m(1,B),m(2,X),m(3,ze),m(4,F),m(5,_e),m(6,Qe),m(7,tt),m(8,De),m(9,Ri),m(10,zl),m(11,lt),m(12,Bo),m(13,le),m(14,Ft),m(15,wm),m(16,VEe)],gJ);var yvi={type:"object",properties:{id:{description:d(3128,null),type:"string",pattern:"^[a-zA-Z0-9_-]+$"},title:{description:d(3129,null),type:"string"},icon:{description:d(3127,null),type:"string"}},required:["id","title","icon"]},q$o={description:d(3130,null),type:"object",properties:{activitybar:{description:d(3101,null),type:"array",items:yvi},panel:{description:d(3102,null),type:"array",items:yvi},secondarySidebar:{description:d(3103,null),type:"array",items:yvi}},additionalProperties:!1};var wvi=(t=>(t.Visible="visible",t.Hidden="hidden",t.Collapsed="collapsed",t))(wvi||{}),P7e={type:"object",required:["id","name","icon"],defaultSnippets:[{body:{id:"${1:id}",name:"${2:name}",icon:"${3:icon}"}}],properties:{type:{markdownDescription:d(3123,null),type:"string",enum:["tree","webview"],markdownEnumDescriptions:[d(3122,null),d(3124,null)]},id:{markdownDescription:d(3115,null),type:"string"},name:{description:d(3120,null),type:"string"},when:{description:d(3125,null),type:"string"},icon:{description:d(3114,null),type:"string"},contextualTitle:{description:d(3112,null),type:"string"},visibility:{description:d(3116,null),type:"string",enum:["visible","hidden","collapsed"],default:"visible",enumDescriptions:[d(3119,null),d(3118,null),d(3117,null)]},initialSize:{type:"number",description:d(3131,null)},accessibilityHelpContent:{type:"string",markdownDescription:d(3111,null)}}},j$o={type:"object",required:["id","name"],properties:{id:{description:d(3115,null),type:"string"},name:{description:d(3120,null),type:"string"},when:{description:d(3125,null),type:"string"},group:{description:d(3113,null),type:"string"},remoteName:{description:d(3121,null),type:["string","array"],items:{type:"string"}}}},Q$o={description:d(3126,null),type:"object",properties:{explorer:{description:d(3106,null),type:"array",items:P7e,default:[]},debug:{description:d(3105,null),type:"array",items:P7e,default:[]},scm:{description:d(3108,null),type:"array",items:P7e,default:[]},test:{description:d(3109,null),type:"array",items:P7e,default:[]},remote:{description:d(3107,null),type:"array",items:j$o,default:[]}},additionalProperties:{description:d(3104,null),type:"array",items:P7e,default:[]}},Koo=Tn.registerExtensionPoint({extensionPoint:"viewsContainers",jsonSchema:q$o}),Y$o=Tn.registerExtensionPoint({extensionPoint:"views",deps:[Koo],jsonSchema:Q$o,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}`)}}),X$o=7,R_e=class{constructor(i,e){this.instantiationService=i;this.logService=e;this.viewContainersRegistry=oe.as(on.ViewContainersRegistry),this.viewsRegistry=oe.as(on.ViewsRegistry),this.handleAndRegisterCustomViewContainers(),this.handleAndRegisterCustomViews()}static{this.ID="workbench.contrib.viewsExtensionHandler"}handleAndRegisterCustomViewContainers(){Koo.setHandler((i,{added:e,removed:t})=>{t.length&&this.removeCustomViewContainers(t),e.length&&this.addCustomViewContainers(e,this.viewContainersRegistry.all)})}addCustomViewContainers(i,e){let t=oe.as(on.ViewContainersRegistry),o=X$o+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=oe.as(on.ViewContainersRegistry),t=i.reduce((o,n)=>(o.add(n.description.identifier),o),new QI);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(3097,null)),!1;for(let t of i){if(typeof t.id!="string"&&Jl(t.id))return e.error(d(3087,null,"id")),!1;if(!/^[a-z0-9_-]+$/i.test(t.id))return e.error(d(3087,null,"id")),!1;if(typeof t.title!="string")return e.error(d(3090,null,"title")),!1;if(typeof t.icon!="string")return e.error(d(3090,null,"icon")),!1;if(Jl(t.title))return e.warn(d(3088,null,"title")),!0}return!0}registerCustomViewContainers(i,e,t,o,n){return i.forEach(r=>{let l=q.fromString(r.icon)||je(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 Mt(Ha,[i,{mergeViewWithContainerWhenSingleView:!0}]),hideIfEmpty:!0,order:o,icon:t},r)),s}deregisterCustomViewContainer(i){this.viewContainersRegistry.deregisterViewContainer(i),oe.as(yR.Viewlets).deregisterPaneComposite(i.id)}handleAndRegisterCustomViews(){Y$o.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"&&!Ea(o.description,"contribViewsRemote")){r.warn(d(3099,null,s));return}if(s==="agentSessions"&&!Ea(o.description,"chatSessionsProvider")){r.warn(d(3089,null,s));return}let c=this.getViewContainer(s);c||r.warn(d(3098,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(3082,null,g.id));continue}if(this.viewsRegistry.getView(g.id)!==null){r.error(d(3083,null,g.id));continue}let f=Ei.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)||je(o.description.extensionLocation,g.icon));let b=this.convertInitialVisibility(g.visibility),S=this.getViewType(g.type);if(!S){r.error(d(3091,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;Ea(o.description,"contribAccessibilityHelpContent")&&g.accessibilityHelpContent&&(w=new xe(g.accessibilityHelpContent));let k={type:S,ctorDescriptor:S==="tree"?new Mt(eD):new Mt(gJ),id:g.id,name:{value:g.name,original:g.name},when:x.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!==KV,treeView:S==="tree"?this.instantiationService.createInstance(k_e,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===KV?!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(Hf)}removeViews(i){let e=i.reduce((t,o)=>(t.add(o.description.identifier),t),new QI);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(wvi).includes(i))return i}isValidViewDescriptors(i,e){if(!Array.isArray(i))return e.error(d(3086,null)),!1;for(let t of i){if(typeof t.id!="string")return e.error(d(3090,null,"id")),!1;if(typeof t.name!="string")return e.error(d(3090,null,"name")),!1;if(t.when&&typeof t.when!="string")return e.error(d(3085,null,"when")),!1;if(t.icon&&typeof t.icon!="string")return e.error(d(3085,null,"icon")),!1;if(t.contextualTitle&&typeof t.contextualTitle!="string")return e.error(d(3085,null,"contextualTitle")),!1;if(t.visibility&&!this.convertInitialVisibility(t.visibility))return e.error(d(3084,null,"visibility",Object.values(wvi).join(", "))),!1}return!0}getViewContainer(i){switch(i){case"explorer":return this.viewContainersRegistry.get(Hf);case"debug":return this.viewContainersRegistry.get(jh);case"scm":return this.viewContainersRegistry.get(Uce);case"remote":return this.viewContainersRegistry.get(KV);default:return this.viewContainersRegistry.get(`workbench.view.extension.${i}`)}}showCollapsed(i){switch(i.id){case Hf:case Uce:case jh:return!0}return!1}};R_e=I([m(0,F),m(1,ne)],R_e);var Cvi=class extends C{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(3092,null),d(3094,null),d(3093,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:()=>{}}}},xvi=class extends C{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(3095,null),d(3096,null),d(3093,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:()=>{}}}};oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:"viewsContainers",label:d(3110,null),access:{canToggle:!1},renderer:new Mt(Cvi)});oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:"views",label:d(3100,null),access:{canToggle:!1},renderer:new Mt(xvi)});pt(R_e.ID,R_e,ut.BlockStartup);var qm=class extends ek{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 P);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 qm.ID}get editorId(){return Ys.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){Xe(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?Og(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=Dj(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 qm?Xe(e.resource,this.resource):Hxe(e)?super.matches(e):!1}dispose(){this.modelResolve=void 0,this.disposeModelReference(),super.dispose()}disposeModelReference(){Ue(this.cachedUntitledTextEditorModelReference),this.cachedUntitledTextEditorModelReference=void 0}};qm=I([m(1,Ho),m(2,ot),m(3,ee),m(4,be),m(5,Vt),m(6,wn),m(7,lr),m(8,Nt),m(9,Nn),m(10,Sv)],qm);var fJ=class extends aR{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(4045,null)}createEditorControl(e,t){this.editorControl=this._register(this.instantiationService.createInstance(jr,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&&Xe(o,e))return this.editorControl.saveViewState()??void 0}setOptions(e){super.setOptions(e),e&&QE(e,Oi(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 gue=class extends fJ{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 rw))throw new Error("Unable to open file as text");let r=Oi(this.editorControl),s=n.textEditorModel;if(r.setModel(s),!Mj(e?.viewState)){let l=this.loadEditorViewState(i,t);l&&(e?.selection&&(l.cursorState=[]),r.restoreViewState(l))}e&&QE(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 qm||i instanceof IC}};gue=I([m(2,Te),m(3,F),m(4,le),m(5,Nn),m(6,De),m(7,Et),m(8,ee),m(9,be)],gue);var j5=class extends gue{constructor(e,t,o,n,r,s,l,c,u,p,h){super(j5.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 qm&&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()!==Fr)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!==Fr){this.input instanceof qm&&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)}}};j5=I([m(1,Te),m(2,F),m(3,le),m(4,Nn),m(5,De),m(6,ee),m(7,Et),m(8,Ct),m(9,kt),m(10,be)],j5);var hK=class extends gg{constructor(e,t,o){super();this.resource=e;this.name=t;this.fileService=o;this.mime=Zn.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()}};hK=I([m(2,be)],hK);var BC=class{constructor(i){this._container=i}set text(i){Fi(this._container,...Bn(i??""))}set title(i){!this.hover&&i?this.hover=yp().setupManagedHover(Ni("mouse"),this._container,i):this.hover&&this.hover.update(i)}dispose(){this.hover?.dispose()}};var gK=class extends pa{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 Pa(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]=_y(this.container,this.scrollbar);Rt(o);let r=new P,{icon:s,label:l,actions:c}=await this.getContents(e,t,r),u=oN(l,gK.PLACEHOLDER_LABEL_MAX_LENGTH),p=o.appendChild(_(".editor-placeholder-icon-container")),h=r.add(new BC(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",`${JY(e,void 0,this.group,void 0)}, ${u}`),c.length){let v=o.appendChild(_(".editor-placeholder-buttons-container")),b=r.add(new _x(v));for(let S=0;S<c.length;S++){let y=r.add(b.addButton({...Ko,secondary:S!==0}));y.label=c[S].label,r.add(y.onDidClick(w=>{w&&$t.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]=_y(this.container,this.scrollbar);fN(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()}};gK=I([m(2,Te),m(3,De),m(4,le)],gK);var Q5=class extends gK{constructor(e,t,o,n,r,s){super(Q5.ID,e,t,o,s);this.commandService=n;this.workspaceService=r}static{this.ID="workbench.editors.workspaceTrustRequiredEditor"}static{this.LABEL=d(3968,null)}static{this.DESCRIPTOR=ys.create(this,this.ID,this.LABEL)}getTitle(){return Q5.LABEL}async getContents(){return{icon:"$(workspace-untrusted)",label:$g(VS(this.workspaceService.getWorkspace()))?d(3964,null):d(3965,null),actions:[{label:d(3963,null),run:()=>this.commandService.executeCommand("workbench.trust.manage")}]}}};Q5=I([m(1,Te),m(2,De),m(3,ge),m(4,Pe),m(5,le)],Q5);var vJ=class extends gK{constructor(e,t,o,n,r,s,l){super(vJ.ID,e,t,o,n);this.fileService=r;this.dialogService=s;this.commandService=l}static{this.ID="workbench.editors.errorEditor"}static{this.LABEL=d(3962,null)}static{this.DESCRIPTOR=ys.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(3969,null):Pj(r)&&r.forceMessage?l=r.message:r?l=d(3970,null):l=d(3971,null);let c="$(error)";Pj(r)&&(r.forceSeverity===gt.Info?c="$(info)":r.forceSeverity===gt.Warning&&(c="$(warning)"));let u;return Pj(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(In(g)))}})):u=[{label:d(3966,null),run:()=>this.group.openEditor(e,{...t,source:1})},{label:d(3967,null),run:()=>this.commandService.executeCommand(iK)}],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??[]}}};vJ=I([m(1,Te),m(2,De),m(3,le),m(4,be),m(5,ct),m(6,ge)],vJ);var CR=class extends gK{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(3573,null)}async getContents(e,t){let o=await e.resolve();if(!(o instanceof hK))throw new Error("Unable to open file as binary");let n=o.getSize();return this.handleMetadataChanged(typeof n=="number"?ll.formatSize(n):""),{icon:"$(warning)",label:d(3574,null),actions:[{label:d(3575,null),run:async()=>{await this.callbacks.openInternal(e,t),this._onDidOpenInPlace.fire()}}]}}handleMetadataChanged(e){this.metadata=e,this._onDidChangeMetadata.fire()}getMetadata(){return this.metadata}};CR=I([m(5,le)],CR);var GV=class extends of{static{this.ID=LEt}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 CR&&e instanceof CR)return d(3572,null,e.getMetadata(),i.getMetadata())}};GV=I([m(1,Te),m(2,F),m(3,De),m(4,le),m(5,B),m(6,Nn),m(7,ee),m(8,Et)],GV);var kvi=class{constructor(i,e){this.primary=i;this.secondary=e}getEncoding(){return this.primary.getEncoding()}async setEncoding(i,e){await fn.settled([this.primary,this.secondary].map(t=>t.setEncoding(i,e)))}},Evi=class{constructor(i,e){this.primary=i;this.secondary=e}setLanguageId(i,e){[this.primary,this.secondary].forEach(t=>t.setLanguageId(i,e))}};function F7e(a){if(a instanceof qm)return a;if(a instanceof ga){let e=F7e(a.primary),t=F7e(a.secondary);return e&&t?new kvi(e,t):e}let i=a;return zut(i.setEncoding,i.getEncoding)?i:null}function XPt(a){if(a instanceof qm)return a;if(a instanceof ga){let e=XPt(a.primary),t=XPt(a.secondary);return e&&t?new Evi(e,t):e}let i=a;return typeof i.setLanguageId=="function"?i:null}var Tvi=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}},_vi=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 Tvi;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}},A7e=class extends C{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;GT.setTabFocusMode(t)}registerListeners(){this._register(GT.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;GT.setTabFocusMode(t),this._onDidChange.fire(t)}}))}};A7e=I([m(0,B)],A7e);var Dvi=class extends C{constructor(){super();this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;nW.setInputMode("insert"),this._register(nW.onDidChangeInputMode(e=>this._onDidChange.fire(e)))}},J$o=d(4023,null),Z$o=d(4022,null),eqo=d(4002,null),tqo=d(4001,null),Goo=d(3991,null),$oo=d(3990,null),N7e=class extends C{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 _vi;this.toRender=void 0;this.activeEditorListeners=this._register(new P);this.delayedRender=this._register(new me);this.currentMarkerStatus=this._register(l.createInstance(O7e)),this.tabFocusMode=this._register(l.createInstance(A7e)),this.inputMode=this._register(l.createInstance(Dvi)),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(H.runAndSubscribe(this.tabFocusMode.onDidChange,e=>{e!==void 0?this.onTabFocusModeChange(e):this.onTabFocusModeChange(this.configurationService.getValue("editor.tabFocusMode"))})),this._register(H.runAndSubscribe(this.inputMode.onDidChange,e=>this.onInputModeChange(e??"insert")))}registerCommands(){this._register(qe.registerCommand({id:`changeEditorIndentation${this.targetWindowId}`,handler:()=>this.showIndentationPicker()}))}async showIndentationPicker(){let e=ca(this.editorService.activeTextEditorControl);if(!e)return this.quickInputService.pick([{label:d(4003,null)}]);if(this.editorService.activeEditor?.isReadonly())return this.quickInputService.pick([{label:d(4005,null)}]);let t=[Oi(e.getAction(c3e.ID)),Oi(e.getAction(l3e.ID)),Oi(e.getAction(d3e.ID)),Oi(e.getAction(u3e.ID)),Oi(e.getAction(r3e.ID)),Oi(e.getAction(s3e.ID)),Oi(e.getAction(w4e.ID))].map(n=>({id:n.id,label:n.label,detail:IS.isDefaultVariant()||n.label===n.alias?void 0:n.alias,run:()=>{e.focus(),n.run()}}));return t.splice(3,0,{type:"separator",label:d(3995,null)}),t.unshift({type:"separator",label:d(3996,null)}),(await this.quickInputService.pick(t,{placeHolder:d(4006,null),matchOnDetail:!0}))?.run()}updateTabFocusModeElement(e){if(e){if(!this.tabFocusModeElement.value){let t=d(4035,null);this.tabFocusModeElement.value=this.statusbarService.addEntry({name:d(4034,null),text:t,ariaLabel:t,tooltip:d(3989,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(3997,null),o=d(4027,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(3983,null);this.columnSelectionModeElement.value=this.statusbarService.addEntry({name:d(4026,null),text:t,ariaLabel:t,tooltip:d(3988,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(ca(this.editorService.activeTextEditorControl)?.getModel()?.uri?.scheme===Y.vscodeNotebookCell){this.selectionElement.clear();return}let o={name:d(4033,null),text:e,ariaLabel:e,tooltip:d(3993,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(ca(this.editorService.activeTextEditorControl)?.getModel()?.uri?.scheme===Y.vscodeNotebookCell){this.indentationElement.clear();return}let o={name:d(4030,null),text:e,ariaLabel:e,tooltip:d(4019,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(4028,null),text:e,ariaLabel:e,tooltip:d(4017,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(4029,null),text:e,ariaLabel:e,tooltip:d(4018,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(4032,null),text:e,ariaLabel:e,tooltip:d(4020,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(4031,null),text:e,ariaLabel:e,tooltip:d(3992,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=Ah(qv(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
`?$oo:Goo: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?id(J$o,e.selections[0].positionLineNumber,e.selections[0].positionColumn,e.charactersSelected):id(Z$o,e.selections[0].positionLineNumber,e.selections[0].positionColumn);if(e.charactersSelected)return id(eqo,e.selections.length,e.charactersSelected);if(e.selections.length>0)return id(tqo,e.selections.length)}}updateStatusBar(){let e=this.editorService.activeEditor,t=this.editorService.activeEditorPane,o=t?ca(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(H.defer(o.onDidChangeCursorPosition)(()=>{this.onSelectionChange(o),this.currentMarkerStatus.update(o)})),this.activeEditorListeners.add(o.onDidChangeModelLanguage(()=>{this.onLanguageChange(o,e)})),this.activeEditorListeners.add(H.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 CR||t instanceof GV){let n=[];if(t instanceof GV){let r=t.getPrimaryEditorPane();r instanceof CR&&n.push(r);let s=t.getSecondaryEditorPane();s instanceof CR&&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&&XPt(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(4025,null,n.indentSize):d(4024,null,n.indentSize,n.tabSize):d(4036,null,n.tabSize)}}this.updateState(t)}onMetadataChange(e){let t={type:"metadata",metadata:void 0};(e instanceof CR||e instanceof GV)&&(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 Yt(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?F7e(e.input):null;if(n){let r=n.getEncoding(),s=typeof r=="string"?aw[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=no.getCanonicalUri(t.input,{supportSideBySide:1});if(o&&Xe(o,e)){let n=ca(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}};N7e=I([m(1,ee),m(2,Ge),m(3,kt),m(4,Ho),m(5,Tr),m(6,F),m(7,B)],N7e);var fue=class extends C{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 P;H.once(e.onWillDispose)(()=>t.dispose());let o=this.editorGroupService.getScopedInstantiationService(e);t.add(o.createInstance(N7e,e.windowId))}};fue=I([m(0,Et)],fue);var O7e=class extends C{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(H.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=mc(this.currentMarker.message)[0],o=`${this.getType(this.currentMarker)} ${t}`;this.statusBarEntryAccessor.value?this.statusBarEntryAccessor.value.update({name:d(3987,null),text:o,ariaLabel:o}):this.statusBarEntryAccessor.value=this.statusbarService.addEntry({name:d(3987,null),text:o,ariaLabel:o},"statusbar.currentProblem",0)}else this.statusBarEntryAccessor.clear()}hasToUpdateStatus(e,t){return!t||!e?!0:TW.makeKey(e)!==TW.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=>Xe(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=Al(e.resource.toString(),t.resource.toString());return o===0&&(o=cl.compare(e.severity,t.severity)),o===0&&(o=z.compareRangesUsingStarts(e,t)),o}};O7e=I([m(0,Tr),m(1,Ns),m(2,B)],O7e);var bJ=class a extends K{static{this.ID="workbench.action.editor.changeLanguageMode"}constructor(){super({id:a.ID,title:L(3982,"Change Language Mode"),f1:!0,keybinding:{weight:200,primary:Ai(2089,43)},precondition:x.not("notebookEditorFocused"),metadata:{description:d(3981,null),args:[{name:d(3980,null),constraint:i=>typeof i=="string"}]}})}async run(i,e){let t=i.get(Ge),o=i.get(ee),n=i.get(kt),r=i.get(eS),s=i.get(Ho),l=i.get(Po),c=i.get(B),u=i.get(Te),p=i.get(ge),h=i.get(ta),g=ca(o.activeTextEditorControl);if(!g){await t.pick([{label:d(4003,null)}]);return}let f=g.getModel(),v=no.getOriginalUri(o.activeEditor,{supportSideBySide:1}),b,S;f&&(S=f.getLanguageId(),b=n.getLanguageName(S)??void 0);let y=!!v;v?.scheme===Y.untitled&&!s.untitled.get(v)?.hasAssociatedFilePath&&(y=!1);let k=n.getSortedRegisteredLanguageNames().map(({languageName:$,languageId:te})=>{let pe=n.getExtensions(te).join(" "),de;return b===$?de=d(3998,null,te):de=d(3999,null,te),{id:te,label:$,meta:pe,iconClasses:Y1(te),description:de}});k.unshift({type:"separator",label:d(4000,null)});let T,N,O;if(y&&v){let $=ms(v)||Ye(v);h.isEnabled()&&(O=pi({id:"workbench.action.showLanguageExtensions",label:d(4021,null,$),run:()=>p.executeCommand("workbench.extensions.action.showExtensionsForLanguage",$)}),k.unshift(O)),N={label:d(3985,null,b)},k.unshift(N),T={label:d(3984,null,$)},k.unshift(T)}let V={label:d(3977,null)};f&&f.getValueLength()>0&&k.unshift(V);let U=typeof e=="string"?{label:e}:await t.pick(k,{placeHolder:d(4010,null),matchOnDescription:!0});if(!U)return;if(U===O){O.run();return}if(U===T){v&&this.configureFileAssociation(v,n,t,c);return}if(U===N){l.openUserSettings({jsonEditor:!0,revealSetting:{key:`[${S??null}]`,edit:!0}});return}let G=o.activeEditor;if(G){let $=XPt(G);if($){let te,pe;if(U===V){if(f){let de=no.getOriginalUri(G,{supportSideBySide:1});if(de){let se=n.guessLanguageIdByFilepathOrFirstLine(de,f.getLineContent(1))??void 0;(!se||se==="unknown")&&(pe=await r.detectLanguage(de),se=pe),se&&(te=n.createById(se))}}}else te=n.createById(U.id),v&&r.detectLanguage(v).then(de=>{let se=n.getLanguageIdByLanguageName(U.label)||"unknown";if(de===S&&S!==se){let Se=c.getValue("workbench.editor.preferHistoryBasedLanguageDetection")?"history":"classic";u.publicLog2(X7i,{currentLanguageId:b??"unknown",nextLanguageId:U.label,lineCount:f?.getLineCount()??-1,modelPreference:Se})}});if(typeof te<"u"&&($.setLanguageId(te.languageId,a.ID),v?.scheme===Y.untitled)){let de=c.getValue("workbench.editor.preferHistoryBasedLanguageDetection")?"history":"classic";u.publicLog2("setUntitledDocumentLanguage",{to:te.languageId,from:S??"none",modelPreference:de})}}g.focus()}}configureFileAssociation(i,e,t,o){let n=ms(i),r=Ye(i),s=e.guessLanguageIdByFilepathOrFirstLine(A.file(r)),c=e.getSortedRegisteredLanguageNames().map(({languageName:u,languageId:p})=>({id:p,label:u,iconClasses:Y1(p),description:p===s?d(3986,null):void 0}));setTimeout(async()=>{let u=await t.pick(c,{placeHolder:d(4011,null,n||r)});if(u){let p=o.inspect(Y$),h;n&&r[0]!=="."?h=`*${n}`:h=r;let g=2;p.workspaceValue?.[h]&&(g=5);let f=Xi(g===5?p.workspaceValue:p.userValue)||Object.create(null);f[h]=u.id,o.updateValue(Y$,f,g)}},50)}},JPt=class extends K{constructor(){super({id:"workbench.action.editor.changeEOL",title:L(3979,"Change End of Line Sequence"),f1:!0})}async run(i){let e=i.get(ee),t=i.get(Ge),o=ca(e.activeTextEditorControl);if(!o){await t.pick([{label:d(4003,null)}]);return}if(e.activeEditor?.isReadonly()){await t.pick([{label:d(4005,null)}]);return}let n=o.getModel(),r=[{label:Goo,eol:0},{label:$oo,eol:1}],s=n?.getEOL()===`
`?0:1,l=await t.pick(r,{placeHolder:d(4009,null),activeItem:r[s]});if(l){let c=ca(e.activeTextEditorControl);c?.hasModel()&&!e.activeEditor?.isReadonly()&&(n=c.getModel(),n.pushStackElement(),n.pushEOL(l.eol),n.pushStackElement())}o.focus()}},ZPt=class extends K{constructor(){super({id:"workbench.action.editor.changeEncoding",title:L(3978,"Change File Encoding"),f1:!0})}async run(i){let e=i.get(ee),t=i.get(Ge),o=i.get(be),n=i.get(Ho),r=i.get(Nn),s=i.get(ct),l=ca(e.activeTextEditorControl);if(!l){await t.pick([{label:d(4003,null)}]);return}let c=e.activeEditorPane;if(!c){await t.pick([{label:d(4003,null)}]);return}let u=F7e(c.input);if(!u){await t.pick([{label:d(4004,null)}]);return}let p={label:d(4016,null)},h={label:d(4013,null)};if(!IS.isDefaultVariant()){let V="Save with Encoding";V!==p.label&&(p.detail=V);let U="Reopen with Encoding";U!==h.label&&(h.detail=U)}let g;if(u instanceof qm?g=p:c.input.isReadonly()?g=h:g=await t.pick([h,p],{placeHolder:d(4006,null),matchOnDetail:!0}),!g)return;await Pi(50);let f=no.getOriginalUri(c.input,{supportSideBySide:1});if(!f||!o.hasProvider(f)&&f.scheme!==Y.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(aw).sort((V,U)=>V===S?-1:U===S?1:aw[V].order-aw[U].order).filter(V=>V===v&&v!==S?!1:!b||!aw[V].encodeOnly).map((V,U)=>(V===u.getEncoding()?y=U:aw[V].alias===u.getEncoding()&&(w=U),{id:V,label:aw[V].labelLong,description:V})),T=k.slice();v&&S!==v&&aw[v]&&(k.unshift({type:"separator"}),k.unshift({id:v,label:aw[v].labelLong,description:d(3994,null)}));let N=await t.pick(k,{placeHolder:b?d(4007,null):d(4008,null),activeItem:T[typeof y=="number"?y:typeof w=="number"?w:-1]});if(!N||!e.activeEditorPane)return;let O=F7e(e.activeEditorPane.input);if(typeof N.id<"u"&&O){if(b&&e.activeEditorPane.input.isDirty()){let{confirmed:V}=await s.confirm({message:d(4015,null),detail:d(4014,null),primaryButton:d(4012,null)});if(!V)return;await e.activeEditorPane.input.revert(e.activeEditorPane.group.id)}await O.setEncoding(N.id,b?1:0)}l.focus()}};var zs=ae("historyService");var cp=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)}},eAt=class extends K{getDirection(i){return pC(i)}async run(i,...e){let t=i.get(Et),o=i.get(B),n=i.get(ee),r=i.get(fo),s=this.getDirection(o),l=lp(e,n,t,r);jfi(t,s,l)}},tAt=class a extends eAt{static{this.ID=uJ}constructor(){super({id:a.ID,title:L(3884,"Split Editor"),f1:!0,keybinding:{weight:200,primary:2141},category:We.View})}},iAt=class extends eAt{constructor(){super({id:"workbench.action.splitEditorOrthogonal",title:L(3891,"Split Editor Orthogonal"),f1:!0,keybinding:{weight:200,primary:Ai(2089,2141)},category:We.View})}getDirection(i){return pC(i)===3?1:3}},oAt=class extends cp{constructor(){super({id:K5,title:L(3887,"Split Editor Left"),f1:!0,keybinding:{weight:200,primary:Ai(2089,2141)},category:We.View},K5)}},nAt=class extends cp{constructor(){super({id:uK,title:L(3888,"Split Editor Right"),f1:!0,keybinding:{weight:200,primary:Ai(2089,2141)},category:We.View},uK)}},rAt=class extends cp{static{this.LABEL=d(3889,null)}constructor(){super({id:z5,title:L(3890,"Split Editor Up"),f1:!0,keybinding:{weight:200,primary:Ai(2089,2141)},category:We.View},z5)}},sAt=class extends cp{static{this.LABEL=d(3885,null)}constructor(){super({id:dK,title:L(3886,"Split Editor Down"),f1:!0,keybinding:{weight:200,primary:Ai(2089,2141)},category:We.View},dK)}},aAt=class extends K{constructor(){super({id:"workbench.action.joinTwoGroups",title:L(3813,"Join Editor Group with Next Group"),f1:!0,category:We.View})}async run(i,e){let t=i.get(Et),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}}}}},lAt=class extends K{constructor(){super({id:"workbench.action.joinAllGroups",title:L(3812,"Join All Editor Groups"),f1:!0,category:We.View})}async run(i){let e=i.get(Et);e.mergeAllGroups(e.activeGroup)}},cAt=class extends K{constructor(){super({id:"workbench.action.navigateEditorGroups",title:L(3848,"Navigate Between Editor Groups"),f1:!0,category:We.View})}async run(i){let e=i.get(Et);e.findGroup({location:2},e.activeGroup,!0)?.focus()}},dAt=class extends K{constructor(){super({id:"workbench.action.focusActiveEditorGroup",title:L(3804,"Focus Active Editor Group"),f1:!0,category:We.View})}async run(i){i.get(Et).activeGroup.focus()}},fK=class extends K{constructor(e,t){super(e);this.scope=t}async run(e){let t=e.get(Et);t.findGroup(this.scope,t.activeGroup,!0)?.focus()}},uAt=class extends fK{constructor(){super({id:"workbench.action.focusFirstEditorGroup",title:L(3806,"Focus First Editor Group"),f1:!0,keybinding:{weight:200,primary:2070},category:We.View},{location:0})}},pAt=class extends fK{constructor(){super({id:"workbench.action.focusLastEditorGroup",title:L(3807,"Focus Last Editor Group"),f1:!0,category:We.View},{location:1})}},mAt=class extends fK{constructor(){super({id:"workbench.action.focusNextGroup",title:L(3809,"Focus Next Editor Group"),f1:!0,category:We.View},{location:2})}},hAt=class extends fK{constructor(){super({id:"workbench.action.focusPreviousGroup",title:L(3810,"Focus Previous Editor Group"),f1:!0,category:We.View},{location:3})}},gAt=class extends fK{constructor(){super({id:"workbench.action.focusLeftGroup",title:L(3808,"Focus Left Editor Group"),f1:!0,keybinding:{weight:200,primary:Ai(2089,2063)},category:We.View},{direction:2})}},fAt=class extends fK{constructor(){super({id:"workbench.action.focusRightGroup",title:L(3811,"Focus Right Editor Group"),f1:!0,keybinding:{weight:200,primary:Ai(2089,2065)},category:We.View},{direction:3})}},vAt=class extends fK{constructor(){super({id:"workbench.action.focusAboveGroup",title:L(3803,"Focus Editor Group Above"),f1:!0,keybinding:{weight:200,primary:Ai(2089,2064)},category:We.View},{direction:0})}},bAt=class extends fK{constructor(){super({id:"workbench.action.focusBelowGroup",title:L(3805,"Focus Editor Group Below"),f1:!0,keybinding:{weight:200,primary:Ai(2089,2066)},category:We.View},{direction:1})}},SJ=class extends st{constructor(e,t,o){super(e,t,q.asClassName(M.close));this.commandService=o}static{this.ID="workbench.action.closeActiveEditor"}static{this.LABEL=d(3779,null)}run(e){return this.commandService.executeCommand(OC,void 0,e)}};SJ=I([m(2,ge)],SJ);var gF=class extends st{constructor(e,t,o){super(e,t,q.asClassName(M.pinned));this.commandService=o}static{this.ID="workbench.action.unpinActiveEditor"}static{this.LABEL=d(3905,null)}run(e){return this.commandService.executeCommand(U5,void 0,e)}};gF=I([m(2,ge)],gF);var IJ=class extends st{constructor(e,t,o){super(e,t,q.asClassName(M.close));this.editorGroupService=o}static{this.ID="workbench.action.closeActiveEditor"}static{this.LABEL=d(3783,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})}};IJ=I([m(2,Et)],IJ);var SAt=class extends K{constructor(){super({id:"workbench.action.revertAndCloseActiveEditor",title:L(3879,"Revert and Close Editor"),f1:!0,category:We.View})}async run(i){let e=i.get(ee),t=i.get(ne),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)}}},IAt=class extends K{constructor(){super({id:"workbench.action.closeEditorsToTheLeft",title:L(3782,"Close Editors to the Left in Group"),f1:!0,category:We.View})}async run(i,e){let t=i.get(Et),{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}}},yAt=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(ne),o=i.get(Bo),n=i.get(Et),r=i.get(lr),s=i.get(dn),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}):kr&&(ri||Wn)&&!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 ga?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(3880,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})))}},vue=class a extends yAt{static{this.ID="workbench.action.closeAllEditors"}static{this.LABEL=L(3777,"Close All Editors")}constructor(){super({id:a.ID,title:a.LABEL,f1:!0,keybinding:{weight:200,primary:Ai(2089,2101)},icon:M.closeAll,category:We.View})}get excludeSticky(){return!0}},wAt=class extends yAt{constructor(){super({id:"workbench.action.closeAllGroups",title:L(3778,"Close All Editor Groups"),f1:!0,keybinding:{weight:200,primary:Ai(2089,3125)},category:We.View})}get excludeSticky(){return!1}async doCloseAll(i){await super.doCloseAll(i);for(let e of this.groupsToClose(i))i.removeGroup(e)}},CAt=class extends K{constructor(){super({id:"workbench.action.closeEditorsInOtherGroups",title:L(3781,"Close Editors in Other Groups"),f1:!0,category:We.View})}async run(i,e){let t=i.get(Et),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})}))}},xAt=class extends K{constructor(){super({id:"workbench.action.closeEditorInAllGroups",title:L(3780,"Close Editor in All Groups"),f1:!0,category:We.View})}async run(i){let e=i.get(ee),t=i.get(Et),o=e.activeEditor;o&&await Promise.all(t.getGroups(1).map(n=>n.closeEditor(o)))}},kAt=class extends K{constructor(e,t,o){super(e);this.direction=t;this.isMove=o}async run(e,t){let o=e.get(Et),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}}},P_e=class extends kAt{constructor(i,e){super(i,e,!0)}},EAt=class extends P_e{constructor(){super({id:"workbench.action.moveActiveEditorGroupLeft",title:L(3827,"Move Editor Group Left"),f1:!0,keybinding:{weight:200,primary:Ai(2089,15)},category:We.View},2)}},TAt=class extends P_e{constructor(){super({id:"workbench.action.moveActiveEditorGroupRight",title:L(3828,"Move Editor Group Right"),f1:!0,keybinding:{weight:200,primary:Ai(2089,17)},category:We.View},3)}},_At=class extends P_e{constructor(){super({id:"workbench.action.moveActiveEditorGroupUp",title:L(3829,"Move Editor Group Up"),f1:!0,keybinding:{weight:200,primary:Ai(2089,16)},category:We.View},0)}},DAt=class extends P_e{constructor(){super({id:"workbench.action.moveActiveEditorGroupDown",title:L(3826,"Move Editor Group Down"),f1:!0,keybinding:{weight:200,primary:Ai(2089,18)},category:We.View},1)}},A_e=class extends kAt{constructor(i,e){super(i,e,!1)}},LAt=class extends A_e{constructor(){super({id:"workbench.action.duplicateActiveEditorGroupLeft",title:L(3790,"Duplicate Editor Group Left"),f1:!0,category:We.View},2)}},RAt=class extends A_e{constructor(){super({id:"workbench.action.duplicateActiveEditorGroupRight",title:L(3791,"Duplicate Editor Group Right"),f1:!0,category:We.View},3)}},MAt=class extends A_e{constructor(){super({id:"workbench.action.duplicateActiveEditorGroupUp",title:L(3792,"Duplicate Editor Group Up"),f1:!0,category:We.View},0)}},PAt=class extends A_e{constructor(){super({id:"workbench.action.duplicateActiveEditorGroupDown",title:L(3789,"Duplicate Editor Group Down"),f1:!0,category:We.View},1)}},AAt=class extends K{constructor(){super({id:"workbench.action.minimizeOtherEditors",title:L(3823,"Expand Editor Group"),f1:!0,category:We.View,precondition:iS})}async run(i){i.get(Et).arrangeGroups(1)}},NAt=class extends K{constructor(){super({id:"workbench.action.minimizeOtherEditorsHideSidebar",title:L(3824,"Expand Editor Group and Hide Side Bars"),f1:!0,category:We.View,precondition:x.or(iS,cP,D_)})}async run(i){let e=i.get(Et),t=i.get(fi);t.setPartHidden(!0,"workbench.parts.sidebar"),t.setPartHidden(!0,"workbench.parts.auxiliarybar"),e.arrangeGroups(1)}},OAt=class extends K{constructor(){super({id:"workbench.action.evenEditorWidths",title:L(3801,"Reset Editor Group Sizes"),f1:!0,category:We.View})}async run(i){i.get(Et).arrangeGroups(2)}},FAt=class extends K{constructor(){super({id:"workbench.action.toggleEditorWidths",title:L(3902,"Toggle Editor Group Sizes"),f1:!0,category:We.View})}async run(i){i.get(Et).toggleExpandGroup()}},WAt=class extends K{constructor(){super({id:"workbench.action.maximizeEditorHideSidebar",title:L(3815,"Maximize Editor Group and Hide Side Bars"),f1:!0,category:We.View,precondition:x.or(x.and(nV.negate(),Fj),cP,D_)})}async run(i){let e=i.get(fi),t=i.get(Et);i.get(ee).activeEditor&&(e.setPartHidden(!0,"workbench.parts.sidebar"),e.setPartHidden(!0,"workbench.parts.auxiliarybar"),t.arrangeGroups(0))}},VAt=class extends K{constructor(){super({id:y_e,title:L(3903,"Toggle Maximize Editor Group"),f1:!0,category:We.View,precondition:x.or(Fj,nV),keybinding:{weight:200,primary:Ai(2089,2091)},menu:[{id:D.EditorTitle,order:-1e4,group:"navigation",when:nV},{id:D.EmptyEditorGroup,order:-1e4,group:"navigation",when:nV}],icon:M.screenFull,toggled:{condition:nV,title:d(3904,null)}})}async run(i,...e){let t=i.get(Et),o=i.get(ee),n=i.get(fo),r=lp(e,o,t,n);r.groupedEditors.length&&t.toggleMaximizeGroup(r.groupedEditors[0].group)}},yJ=class extends K{async run(i){let e=i.get(Et),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)}},BAt=class extends yJ{constructor(){super({id:"workbench.action.nextEditor",title:L(3865,"Open Next Editor"),f1:!0,keybinding:{weight:200,primary:2060,mac:{primary:2577,secondary:[3166]}},category:We.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}}}},HAt=class extends yJ{constructor(){super({id:"workbench.action.previousEditor",title:L(3868,"Open Previous Editor"),f1:!0,keybinding:{weight:200,primary:2059,mac:{primary:2575,secondary:[3164]}},category:We.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}}}},UAt=class extends yJ{constructor(){super({id:"workbench.action.nextEditorInGroup",title:L(3864,"Open Next Editor in Group"),f1:!0,keybinding:{weight:200,primary:Ai(2089,2060),mac:{primary:Ai(2089,2577)}},category:We.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}}},zAt=class extends yJ{constructor(){super({id:"workbench.action.previousEditorInGroup",title:L(3869,"Open Previous Editor in Group"),f1:!0,keybinding:{weight:200,primary:Ai(2089,2059),mac:{primary:Ai(2089,2575)}},category:We.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}}},KAt=class extends yJ{constructor(){super({id:"workbench.action.firstEditorInGroup",title:L(3802,"Open First Editor in Group"),f1:!0,category:We.View})}navigate(i){let e=i.activeGroup;return{editor:e.getEditors(1)[0],groupId:e.id}}},GAt=class extends yJ{constructor(){super({id:"workbench.action.lastEditorInGroup",title:L(3814,"Open Last Editor in Group"),f1:!0,keybinding:{weight:200,primary:533,secondary:[2078],mac:{primary:277,secondary:[2078]}},category:We.View})}navigate(i){let e=i.activeGroup,t=e.getEditors(1);return{editor:t[t.length-1],groupId:e.id}}},N_e=class a extends K{static{this.ID="workbench.action.navigateForward"}static{this.LABEL=d(3850,null)}constructor(){super({id:a.ID,title:{...L(3851,"Go Forward"),mnemonicTitle:d(3819,null)},f1:!0,icon:M.arrowRight,precondition:x.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:x.has("config.workbench.navigationControl.enabled")}]})}async run(i){await i.get(zs).goForward(0)}},O_e=class a extends K{static{this.ID="workbench.action.navigateBack"}static{this.LABEL=d(3844,null)}constructor(){super({id:a.ID,title:{...L(3845,"Go Back"),mnemonicTitle:d(3816,null)},f1:!0,precondition:x.has("canNavigateBack"),icon:M.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:x.has("config.workbench.navigationControl.enabled")}]})}async run(i){await i.get(zs).goBack(0)}},$At=class extends K{constructor(){super({id:"workbench.action.navigateLast",title:L(3854,"Go Previous"),f1:!0})}async run(i){await i.get(zs).goPrevious(0)}},qAt=class extends K{constructor(){super({id:"workbench.action.navigateForwardInEditLocations",title:L(3852,"Go Forward in Edit Locations"),f1:!0})}async run(i){await i.get(zs).goForward(1)}},jAt=class extends K{constructor(){super({id:"workbench.action.navigateBackInEditLocations",title:L(3846,"Go Back in Edit Locations"),f1:!0})}async run(i){await i.get(zs).goBack(1)}},QAt=class extends K{constructor(){super({id:"workbench.action.navigatePreviousInEditLocations",title:L(3855,"Go Previous in Edit Locations"),f1:!0})}async run(i){await i.get(zs).goPrevious(1)}},YAt=class extends K{constructor(){super({id:"workbench.action.navigateToLastEditLocation",title:L(3857,"Go to Last Edit Location"),f1:!0,keybinding:{weight:200,primary:Ai(2089,2095)}})}async run(i){await i.get(zs).goLast(1)}},XAt=class extends K{constructor(){super({id:"workbench.action.navigateForwardInNavigationLocations",title:L(3853,"Go Forward in Navigation Locations"),f1:!0})}async run(i){await i.get(zs).goForward(2)}},JAt=class extends K{constructor(){super({id:"workbench.action.navigateBackInNavigationLocations",title:L(3847,"Go Back in Navigation Locations"),f1:!0})}async run(i){await i.get(zs).goBack(2)}},ZAt=class extends K{constructor(){super({id:"workbench.action.navigatePreviousInNavigationLocations",title:L(3856,"Go Previous in Navigation Locations"),f1:!0})}async run(i){await i.get(zs).goPrevious(2)}},eNt=class extends K{constructor(){super({id:"workbench.action.navigateToLastNavigationLocation",title:L(3858,"Go to Last Navigation Location"),f1:!0})}async run(i){await i.get(zs).goLast(2)}},W7e=class a extends K{static{this.ID="workbench.action.reopenClosedEditor"}constructor(){super({id:a.ID,title:L(3876,"Reopen Closed Editor"),f1:!0,keybinding:{weight:200,primary:3122},category:We.View})}async run(i){await i.get(zs).reopenLastClosedEditor()}},V7e=class a extends K{static{this.ID="workbench.action.clearRecentFiles"}constructor(){super({id:a.ID,title:L(3776,"Clear Recently Opened..."),f1:!0,category:We.File})}async run(i){let e=i.get(ct),t=i.get(Ff),o=i.get(zs),{confirmed:n}=await e.confirm({type:"warning",message:d(3786,null),detail:d(3784,null),primaryButton:d(3773,null)});n&&(t.clearRecentlyOpened(),o.clearRecentlyOpened())}},B7e=class a extends K{static{this.ID="workbench.action.showEditorsInActiveGroup"}constructor(){super({id:a.ID,title:L(3883,"Show Editors in Active Group By Most Recently Used"),f1:!0,category:We.View})}async run(i){i.get(Ge).quickAccess.show(J_.PREFIX)}},H7e=class a extends K{static{this.ID="workbench.action.showAllEditors"}constructor(){super({id:a.ID,title:L(3881,"Show All Editors By Appearance"),f1:!0,keybinding:{weight:200,primary:Ai(2089,2094),mac:{primary:2562}},category:We.File})}async run(i){i.get(Ge).quickAccess.show(BV.PREFIX)}},U7e=class a extends K{static{this.ID="workbench.action.showAllEditorsByMostRecentlyUsed"}constructor(){super({id:a.ID,title:L(3882,"Show All Editors By Most Recently Used"),f1:!0,category:We.View})}async run(i){i.get(Ge).quickAccess.show(UP.PREFIX)}},F_e=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(Ge),n=t.lookupKeybindings(this.desc.id);o.quickAccess.show(this.prefix,{quickNavigateConfiguration:{keybindings:n},itemActivation:this.itemActivation})}},tNt=class extends F_e{constructor(){super({id:"workbench.action.quickOpenPreviousRecentlyUsedEditor",title:L(3874,"Quick Open Previous Recently Used Editor"),f1:!0,category:We.View},UP.PREFIX,void 0)}},iNt=class extends F_e{constructor(){super({id:"workbench.action.quickOpenLeastRecentlyUsedEditor",title:L(3872,"Quick Open Least Recently Used Editor"),f1:!0,category:We.View},UP.PREFIX,void 0)}},oNt=class extends F_e{constructor(){super({id:"workbench.action.quickOpenPreviousRecentlyUsedEditorInGroup",title:L(3875,"Quick Open Previous Recently Used Editor in Group"),f1:!0,keybinding:{weight:200,primary:2050,mac:{primary:258}},precondition:Ice.toNegated(),category:We.View},J_.PREFIX,void 0)}},nNt=class extends F_e{constructor(){super({id:"workbench.action.quickOpenLeastRecentlyUsedEditorInGroup",title:L(3873,"Quick Open Least Recently Used Editor in Group"),f1:!0,keybinding:{weight:200,primary:3074,mac:{primary:1282}},precondition:Ice.toNegated(),category:We.View},J_.PREFIX,3)}},rNt=class a extends K{static{this.ID="workbench.action.openPreviousEditorFromHistory"}constructor(){super({id:a.ID,title:L(3849,"Quick Open Previous Editor from History"),f1:!0})}async run(i){let e=i.get(_e),t=i.get(Ge),o=i.get(Et),n=e.lookupKeybindings(a.ID),r;o.activeGroup.count===0&&(r=1),t.quickAccess.show("",{quickNavigateConfiguration:{keybindings:n},itemActivation:r})}},sNt=class extends K{constructor(){super({id:"workbench.action.openNextRecentlyUsedEditor",title:L(3866,"Open Next Recently Used Editor"),f1:!0,category:We.View})}async run(i){i.get(zs).openNextRecentlyUsedEditor()}},aNt=class extends K{constructor(){super({id:"workbench.action.openPreviousRecentlyUsedEditor",title:L(3870,"Open Previous Recently Used Editor"),f1:!0,category:We.View})}async run(i){i.get(zs).openPreviouslyUsedEditor()}},lNt=class extends K{constructor(){super({id:"workbench.action.openNextRecentlyUsedEditorInGroup",title:L(3867,"Open Next Recently Used Editor In Group"),f1:!0,category:We.View})}async run(i){let e=i.get(zs),t=i.get(Et);e.openNextRecentlyUsedEditor(t.activeGroup.id)}},cNt=class extends K{constructor(){super({id:"workbench.action.openPreviousRecentlyUsedEditorInGroup",title:L(3871,"Open Previous Recently Used Editor In Group"),f1:!0,category:We.View})}async run(i){let e=i.get(zs),t=i.get(Et);e.openPreviouslyUsedEditor(t.activeGroup.id)}},dNt=class extends K{constructor(){super({id:"workbench.action.clearEditorHistoryWithoutConfirm",title:L(3775,"Clear Editor History without Confirmation"),f1:!0,precondition:jEt})}async run(i){i.get(zs).clear()}},uNt=class extends K{constructor(){super({id:"workbench.action.clearEditorHistory",title:L(3774,"Clear Editor History"),f1:!0})}async run(i){let e=i.get(ct),t=i.get(zs),{confirmed:o}=await e.confirm({type:"warning",message:d(3785,null),detail:d(3784,null),primaryButton:d(3773,null)});o&&t.clear()}},pNt=class extends cp{constructor(){super({id:"workbench.action.moveEditorLeftInGroup",title:L(3831,"Move Editor Left"),keybinding:{weight:200,primary:3083,mac:{primary:Ai(2089,3087)}},f1:!0,category:We.View},aK,{to:"left"})}},mNt=class extends cp{constructor(){super({id:"workbench.action.moveEditorRightInGroup",title:L(3832,"Move Editor Right"),keybinding:{weight:200,primary:3084,mac:{primary:Ai(2089,3089)}},f1:!0,category:We.View},aK,{to:"right"})}},hNt=class extends cp{constructor(){super({id:"workbench.action.moveEditorToStart",title:L(3843,"Move Editor to Start"),f1:!0,category:We.View},aK,{to:"first"})}},gNt=class extends cp{constructor(){super({id:"workbench.action.moveEditorToEnd",title:L(3835,"Move Editor to End"),f1:!0,category:We.View},aK,{to:"last"})}},fNt=class extends cp{constructor(){super({id:"workbench.action.moveEditorToPreviousGroup",title:L(3841,"Move Editor into Previous Group"),keybinding:{weight:200,primary:2575,mac:{primary:2319}},f1:!0,category:We.View},aK,{to:"previous",by:"group"})}},vNt=class extends cp{constructor(){super({id:"workbench.action.moveEditorToNextGroup",title:L(3840,"Move Editor into Next Group"),f1:!0,keybinding:{weight:200,primary:2577,mac:{primary:2321}},category:We.View},aK,{to:"next",by:"group"})}},bNt=class extends cp{constructor(){super({id:v_e,title:L(3833,"Move Editor into Group Above"),f1:!0,category:We.View},v_e)}},SNt=class extends cp{constructor(){super({id:b_e,title:L(3834,"Move Editor into Group Below"),f1:!0,category:We.View},b_e)}},INt=class extends cp{constructor(){super({id:S_e,title:L(3838,"Move Editor into Left Group"),f1:!0,category:We.View},S_e)}},yNt=class extends cp{constructor(){super({id:I_e,title:L(3842,"Move Editor into Right Group"),f1:!0,category:We.View},I_e)}},wNt=class extends cp{constructor(){super({id:"workbench.action.moveEditorToFirstGroup",title:L(3836,"Move Editor into First Group"),f1:!0,keybinding:{weight:200,primary:1558,mac:{primary:2326}},category:We.View},aK,{to:"first",by:"group"})}},CNt=class extends cp{constructor(){super({id:"workbench.action.moveEditorToLastGroup",title:L(3837,"Move Editor into Last Group"),f1:!0,keybinding:{weight:200,primary:1566,mac:{primary:2334}},category:We.View},aK,{to:"last",by:"group"})}},xNt=class extends cp{constructor(){super({id:"workbench.action.splitEditorToPreviousGroup",title:L(3899,"Split Editor into Previous Group"),f1:!0,category:We.View},lK,{to:"previous",by:"group"})}},kNt=class extends cp{constructor(){super({id:"workbench.action.splitEditorToNextGroup",title:L(3898,"Split Editor into Next Group"),f1:!0,category:We.View},lK,{to:"next",by:"group"})}},ENt=class extends cp{constructor(){super({id:"workbench.action.splitEditorToAboveGroup",title:L(3892,"Split Editor into Group Above"),f1:!0,category:We.View},lK,{to:"up",by:"group"})}},TNt=class extends cp{constructor(){super({id:"workbench.action.splitEditorToBelowGroup",title:L(3893,"Split Editor into Group Below"),f1:!0,category:We.View},lK,{to:"down",by:"group"})}},_Nt=class extends cp{static{this.ID="workbench.action.splitEditorToLeftGroup"}static{this.LABEL=d(3896,null)}constructor(){super({id:"workbench.action.splitEditorToLeftGroup",title:L(3897,"Split Editor into Left Group"),f1:!0,category:We.View},lK,{to:"left",by:"group"})}},DNt=class extends cp{constructor(){super({id:"workbench.action.splitEditorToRightGroup",title:L(3900,"Split Editor into Right Group"),f1:!0,category:We.View},lK,{to:"right",by:"group"})}},LNt=class extends cp{constructor(){super({id:"workbench.action.splitEditorToFirstGroup",title:L(3894,"Split Editor into First Group"),f1:!0,category:We.View},lK,{to:"first",by:"group"})}},RNt=class extends cp{constructor(){super({id:"workbench.action.splitEditorToLastGroup",title:L(3895,"Split Editor into Last Group"),f1:!0,category:We.View},lK,{to:"last",by:"group"})}},z7e=class a extends cp{static{this.ID="workbench.action.editorLayoutSingle"}constructor(){super({id:a.ID,title:L(3793,"Single Column Editor Layout"),f1:!0,category:We.View},cK,{groups:[{}],orientation:0})}},K7e=class a extends cp{static{this.ID="workbench.action.editorLayoutTwoColumns"}constructor(){super({id:a.ID,title:L(3797,"Two Columns Editor Layout"),f1:!0,category:We.View},cK,{groups:[{},{}],orientation:0})}},G7e=class a extends cp{static{this.ID="workbench.action.editorLayoutThreeColumns"}constructor(){super({id:a.ID,title:L(3794,"Three Columns Editor Layout"),f1:!0,category:We.View},cK,{groups:[{},{},{}],orientation:0})}},$7e=class a extends cp{static{this.ID="workbench.action.editorLayoutTwoRows"}constructor(){super({id:a.ID,title:L(3799,"Two Rows Editor Layout"),f1:!0,category:We.View},cK,{groups:[{},{}],orientation:1})}},q7e=class a extends cp{static{this.ID="workbench.action.editorLayoutThreeRows"}constructor(){super({id:a.ID,title:L(3795,"Three Rows Editor Layout"),f1:!0,category:We.View},cK,{groups:[{},{},{}],orientation:1})}},j7e=class a extends cp{static{this.ID="workbench.action.editorLayoutTwoByTwoGrid"}constructor(){super({id:a.ID,title:L(3796,"Grid Editor Layout (2x2)"),f1:!0,category:We.View},cK,{groups:[{groups:[{},{}]},{groups:[{},{}]}],orientation:0})}},Q7e=class a extends cp{static{this.ID="workbench.action.editorLayoutTwoColumnsBottom"}constructor(){super({id:a.ID,title:L(3798,"Two Columns Bottom Editor Layout"),f1:!0,category:We.View},cK,{groups:[{},{groups:[{},{}]}],orientation:1})}},Y7e=class a extends cp{static{this.ID="workbench.action.editorLayoutTwoRowsRight"}constructor(){super({id:a.ID,title:L(3800,"Two Rows Right Editor Layout"),f1:!0,category:We.View},cK,{groups:[{},{groups:[{},{}]}],orientation:0})}},W_e=class extends K{constructor(e,t){super(e);this.direction=t}async run(e){let t=e.get(Et),o=e.get(fi),n=rh(),r=o.hasFocus("workbench.parts.editor")||n.activeElement===n.body,s=t.addGroup(t.activeGroup,this.direction);t.activateGroup(s),r&&s.focus()}},MNt=class extends W_e{constructor(){super({id:"workbench.action.newGroupLeft",title:L(3862,"New Editor Group to the Left"),f1:!0,category:We.View},2)}},PNt=class extends W_e{constructor(){super({id:"workbench.action.newGroupRight",title:L(3863,"New Editor Group to the Right"),f1:!0,category:We.View},3)}},ANt=class extends W_e{constructor(){super({id:"workbench.action.newGroupAbove",title:L(3860,"New Editor Group Above"),f1:!0,category:We.View},0)}},NNt=class extends W_e{constructor(){super({id:"workbench.action.newGroupBelow",title:L(3861,"New Editor Group Below"),f1:!0,category:We.View},1)}},ONt=class extends K{constructor(){super({id:"workbench.action.toggleEditorType",title:L(3901,"Toggle Editor Type"),f1:!0,category:We.View,precondition:AO})}async run(i){let e=i.get(ee),t=i.get(ul),o=e.activeEditorPane;if(!o)return;let n=no.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)}},FNt=class extends K{constructor(){super({id:"workbench.action.reopenTextEditor",title:L(3877,"Reopen Editor with Text Editor"),f1:!0,category:We.View,precondition:AO})}async run(i){let e=i.get(ee),t=e.activeEditorPane;if(!t)return;let o=no.getCanonicalUri(t.input);o&&await e.replaceEditors([{editor:t.input,replacement:{resource:o,options:{override:Ys.id}}}],t.group)}},WNt=class extends K{constructor(e,t,o,n){super({id:e,title:t,category:We.View,precondition:fr,keybinding:o,f1:!0});this.move=n}async run(e,...t){let o=e.get(Et),n=e.get(ee),r=e.get(fo),s=lp(t,n,o,r);if(!s.groupedEditors.length)return;let l=await o.createAuxiliaryEditorPart(),{group:c,editors:u}=s.groupedEditors[0],p=ZY(c,u,s.preserveFocus);this.move?c.moveEditors(p,l.activeGroup):c.copyEditors(p,l.activeGroup),l.activeGroup.focus()}},VNt=class extends WNt{constructor(){super(v7e,{...L(3839,"Move Editor into New Window"),mnemonicTitle:d(3821,null)},void 0,!0)}},BNt=class extends WNt{constructor(){super(b7e,{...L(3788,"Copy Editor into New Window"),mnemonicTitle:d(3818,null)},{primary:Ai(2089,45),weight:200},!1)}},HNt=class extends K{constructor(e,t,o){super({id:e,title:t,category:We.View,f1:!0});this.move=o}async run(e){let t=e.get(Et),o=t.activeGroup,n=await t.createAuxiliaryEditorPart();t.mergeGroup(o,n.activeGroup,{mode:this.move?1:0}),n.activeGroup.focus()}},UNt=class extends HNt{constructor(){super(APt,{...L(3830,"Move Editor Group into New Window"),mnemonicTitle:d(3820,null)},!0)}},zNt=class extends HNt{constructor(){super(NPt,{...L(3787,"Copy Editor Group into New Window"),mnemonicTitle:d(3817,null)},!1)}},KNt=class extends K{constructor(){super({id:"workbench.action.restoreEditorsToMainWindow",title:{...L(3878,"Restore Editors into Main Window"),mnemonicTitle:d(3825,null)},f1:!0,precondition:sw,category:We.View})}async run(i){let e=i.get(Et);e.mergeAllGroups(e.mainPart.activeGroup)}},GNt=class extends K{constructor(){super({id:OPt,title:{...L(3859,"New Empty Editor Window"),mnemonicTitle:d(3822,null)},f1:!0,category:We.View})}async run(i){(await i.get(Et).createAuxiliaryEditorPart()).activeGroup.focus()}};var bue=class extends C{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 P);this.waitingOnConditionAutoSaveWorkingCopies=new vt(e=>this.uriIdentityService.extUri.getComparisonKey(e));this.waitingOnConditionAutoSaveEditors=new vt(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){Ue(this.scheduledAutoSavesAfterDelay.get(e)),this.scheduledAutoSavesAfterDelay.delete(e),this.waitingOnConditionAutoSaveWorkingCopies.delete(e.resource),this.waitingOnConditionAutoSaveEditors.delete(e.resource)}};bue=I([m(0,lr),m(1,oi),m(2,ee),m(3,Et),m(4,Wa),m(5,ne),m(6,Ns),m(7,dt)],bue);var Tu={Quickaccess:"workbench.contributions.quickaccess"},Rvi=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 si([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}}};oe.add(Tu.Quickaccess,new Rvi);var lk=ae("textEditorService"),Mvi=class extends Error{constructor(i,e){super(i),this.name="FileEditorInputLeakError",this.stack=e}},vK=class extends C{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 vt;this.fileEditorFactory=oe.as(rn.EditorFactory).getFileEditorFactory();this.mapLeakToCounter=new Map;this.registerDefaultEditor()}registerDefaultEditor(){this._register(this.editorResolverService.registerEditor("*",{id:Ys.id,label:Ys.displayName,detail:Ys.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(dC(e))return this.createTextEditor(e.result);if(db(e)){let n=this.createTextEditor(e.original),r=this.createTextEditor(e.modified);return this.instantiationService.createInstance(Fa,e.label,e.description,n,r,void 0)}if(C_(e)){let n=this.createTextEditor(e.primary),r=this.createTextEditor(e.secondary);return this.instantiationService.createInstance(ga,e.label,e.description,r,n)}let t=e;if(t.forceUntitled||!t.resource||t.resource.scheme===Y.untitled){let n={languageId:t.languageId,initialValue:t.contents,encoding:t.encoding},r;return t.resource?.scheme===Y.untitled?r=this.untitledTextEditorService.create({untitledResource:t.resource,...n}):r=this.untitledTextEditorService.create({associatedResource:t.resource,...n}),this.createOrGetCached(r.resource,()=>this.instantiationService.createInstance(qm,r))}let o=e;if(o.resource instanceof A){let n=o.label||Ye(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(IC,s,o.label,o.description,o.languageId,o.contents),l=>{l instanceof qm||(l instanceof IC?(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 H.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(vK.LEAK_REPORTED||this.editorInputCache.size<vK.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>vK.LEAK_REPORTING_THRESHOLD){vK.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 Mvi(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)}};vK=I([m(0,H_),m(1,F),m(2,dt),m(3,be),m(4,ul)],vK);we(lk,vK,0);var V_e=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=Og(t,this.environmentService.remoteAuthority,this.pathService.defaultUriScheme));let o,n=e.getLanguageId();(n!==Fr||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(lk).createTextEditor({resource:n,languageId:r,encoding:s,forceUntitled:!0})})}};V_e=I([m(0,lr),m(1,Vt),m(2,wn)],V_e);var Sue=class extends C{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===Y.untitled&&e.typeId===CP}isOpen(e,t){return this.handles(e)?t instanceof qm&&Xe(e.resource,t.resource):!1}createEditor(e){let t;return this.untitledTextEditorService.isUntitledWithAssociatedResource(e.resource)?t=Og(e.resource,this.environmentService.remoteAuthority,this.pathService.defaultUriScheme):t=e.resource,this.textEditorService.createTextEditor({resource:t,forceUntitled:!0})}};Sue=I([m(0,Vf),m(1,Vt),m(2,wn),m(3,lk),m(4,H_)],Sue);var fF=class extends C{constructor(e,t,o){super();this.editorResolverService=e;this.environmentService=o;this.configurationRegistry=oe.as(ii.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(3933,null),priority:"builtin"},{id:"mainThreadWebview-markdown.preview",label:d(3935,null),priority:"builtin"},{id:"mainThreadWebview-simpleBrowser.view",label:d(3936,null),priority:"builtin"},{id:"mainThreadWebview-browserPreview",label:d(3934,null),priority:"builtin"}]}static{this.AUTO_LOCK_REMOVE_EDITORS=new Set(["vscode-interactive-input","interactive","vscode.markdown.preview.editor"])}registerListeners(){this._register(H.debounce(this.editorResolverService.onDidChangeEditorRegistrations,(e,t)=>t)(()=>this.updateDynamicEditorConfigurations()))}updateDynamicEditorConfigurations(){let e=[...this.editorResolverService.getEditors(),...fF.AUTO_LOCK_EXTRA_EDITORS].filter(u=>!fF.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:fF.AUTO_LOCK_DEFAULT_ENABLED.has(u.id),description:u.label};let n=Object.create(null);for(let u of e)n[u.id]=fF.AUTO_LOCK_DEFAULT_ENABLED.has(u.id);let r=this.autoLockConfigurationNode;this.autoLockConfigurationNode={...Cm,properties:{"workbench.editor.autoLockGroups":{type:"object",description:d(3937,null),properties:o,default:n,additionalProperties:!1}}};let s=this.defaultBinaryEditorConfigurationNode;this.defaultBinaryEditorConfigurationNode={...Cm,properties:{"workbench.editor.defaultBinaryEditor":{type:"string",default:"",enum:[...t,""],description:d(3938,null)}}};let l=this.editorAssociationsConfigurationNode;this.editorAssociationsConfigurationNode={...Cm,properties:{"workbench.editorAssociations":{type:"object",markdownDescription:d(3931,null),patternProperties:{".*":{type:"string",enum:t}}}}};let c=this.editorLargeFileConfirmationConfigurationNode;this.editorLargeFileConfirmationConfigurationNode={...Cm,properties:{"workbench.editorLargeFileConfirmation":{type:"number",default:eft(this.environmentService.remoteAuthority)/ll.MB,minimum:1,scope:5,markdownDescription:d(3932,null)}}},this.configurationRegistry.updateConfigurations({add:[this.autoLockConfigurationNode,this.defaultBinaryEditorConfigurationNode,this.editorAssociationsConfigurationNode,this.editorLargeFileConfirmationConfigurationNode],remove:si([r,s,l,c])})}};fF=I([m(0,ul),m(1,lt),m(2,Vt)],fF);var Iue=class extends st{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)}},B_e=class extends oc{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(H.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(Yw),r=o?.badgeBackground??t.badgeBackground??e.getColor(rv),s=o?.badgeBorder??e.getColor(gi);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=R(e,_("a")),this.badge=R(e,_(".badge")),this.badgeContent=R(this.badge,_(".badge-content")),R(e,_(".active-item-indicator")),xo(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 Iue?this._action.activities:[]}updateActivity(){if(!this.badge||!this.badgeContent||!(this._action instanceof Iue))return;let{badges:e,type:t}=this.getVisibleBadges(this.getActivities());this.badgeDisposable.value=new P,Rt(this.badgeContent),xo(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")bn(this.badge),n.push("progress-badge");else if(t==="number"){let r=e.reduce((s,l)=>s+(l instanceof qc?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,bn(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))),bn(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 PC).map(r=>r.badge);if(t.length>0)return{badges:t,type:"progress"};let o=e.filter(r=>r.badge instanceof eK).map(r=>r.badge);if(o.length>0)return{badges:o,type:"icon"};let n=e.filter(r=>r.badge instanceof qc).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(3560,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()}};B_e=I([m(3,De),m(4,tt),m(5,B),m(6,_e)],B_e);var X7e=class extends Iue{constructor(e){super({id:"additionalComposites.action",name:d(3554,null),classNames:q.asClassNameArray(M.more)});this.showMenu=e}async run(){this.showMenu()}},H_e=class extends B_e{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 qc&&(n=o.number),n?t.label=d(3558,null,e.name,n):t.label=e.name||"",t})}};H_e=I([m(7,ze),m(8,De),m(9,tt),m(10,B),m(11,_e)],H_e);var U_e=class extends B_e{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=>{$t.stop(o,!0),this.showContextMenu(e)}));let t;this._register(KE.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);E5(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=>{$t.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 IIe(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(Gje(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(3555,null,this.compositeBarActionItem.name),this.toggleCompositePinnedAction.checked=!1,this.toggleCompositePinnedAction.enabled=this.compositeBar.getPinnedCompositeIds().length>1):(this.toggleCompositePinnedAction.label=d(3557,null,this.compositeBarActionItem.name),this.toggleCompositePinnedAction.enabled=!0),this.compositeBar.areBadgesEnabled(this.compositeBarActionItem.id)?this.toggleCompositeBadgeAction.label=d(3556,null):this.toggleCompositeBadgeAction.label=d(3559,null);let s=this.contextMenuActionsProvider();s.length&&(t.push(new li),t.push(...s));let l=Yn(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()}};U_e=I([m(8,ze),m(9,_e),m(10,F),m(11,De),m(12,tt),m(13,B),m(14,ge)],U_e);var J7e=class extends st{constructor(e,t){super("show.toggleCompositePinned",e?e.name:d(3561,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)}},Z7e=class extends st{constructor(e,t){super("show.toggleCompositeBadge",e?e.name:d(3562,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)}},wJ=class extends K{constructor(e,t,o){super(e);this.location=t;this.offset=o}async run(e){let t=e.get(ds),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 nqo=Re("auxiliarybar-maximize",M.screenFull,d(3531,null)),Pvi=Re("auxiliarybar-close",M.close,d(3523,null)),rqo=Re("auxiliarybar-right-layout-icon",M.layoutSidebarRight,d(3541,null)),sqo=Re("auxiliarybar-right-off-layout-icon",M.layoutSidebarRightOff,d(3542,null)),aqo=Re("auxiliarybar-left-layout-icon",M.layoutSidebarLeft,d(3539,null)),lqo=Re("auxiliarybar-left-off-layout-icon",M.layoutSidebarLeftOff,d(3540,null)),Y5=class a extends K{static{this.ID="workbench.action.toggleAuxiliaryBar"}static{this.LABEL=L(3538,"Toggle Secondary Side Bar Visibility")}constructor(){super({id:a.ID,title:a.LABEL,toggled:{condition:D_,title:d(3524,null),icon:Pvi,mnemonicTitle:d(3532,null)},icon:Pvi,category:We.View,metadata:{description:d(3534,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(fi),t=e.isVisible("workbench.parts.auxiliarybar");e.setPartHidden(t,"workbench.parts.auxiliarybar");let o=t?d(3521,null):d(3522,null);Jo(o)}};W(Y5);fe.appendMenuItem(D.AuxiliaryBarTitle,{command:{id:Y5.ID,title:d(3524,null),icon:Pvi},group:"navigation",order:2,when:x.equals("config.workbench.activityBar.location","default")});W(class extends K{constructor(){super({id:"workbench.action.closeAuxiliaryBar",title:L(3525,"Hide Secondary Side Bar"),category:We.View,precondition:D_,f1:!0})}run(a){a.get(fi).setPartHidden(!0,"workbench.parts.auxiliarybar")}});W(class Avi extends K{static{this.ID="workbench.action.focusAuxiliaryBar"}static{this.LABEL=L(3526,"Focus into Secondary Side Bar")}constructor(){super({id:Avi.ID,title:Avi.LABEL,category:We.View,f1:!0})}async run(i){let e=i.get(ds),t=i.get(fi);t.isVisible("workbench.parts.auxiliarybar")||t.setPartHidden(!1,"workbench.parts.auxiliarybar"),e.getActivePaneComposite(2)?.focus()}});fe.appendMenuItems([{id:D.LayoutControlMenu,item:{group:"2_pane_toggles",command:{id:Y5.ID,title:d(3544,null),toggled:{condition:D_,icon:aqo},icon:lqo},when:x.and(Xc.negate(),x.or(x.equals("config.workbench.layoutControl.type","toggles"),x.equals("config.workbench.layoutControl.type","both")),x.equals("config.workbench.sideBar.location","right")),order:0}},{id:D.LayoutControlMenu,item:{group:"2_pane_toggles",command:{id:Y5.ID,title:d(3544,null),toggled:{condition:D_,icon:rqo},icon:sqo},when:x.and(Xc.negate(),x.or(x.equals("config.workbench.layoutControl.type","toggles"),x.equals("config.workbench.layoutControl.type","both")),x.equals("config.workbench.sideBar.location","left")),order:2}},{id:D.ViewContainerTitleContext,item:{group:"3_workbench_layout_move",command:{id:Y5.ID,title:L(3527,"Hide Secondary Side Bar")},when:x.and(D_,x.equals("viewContainerLocation",WE(2))),order:2}}]);W(class extends wJ{constructor(){super({id:"workbench.action.previousAuxiliaryBarView",title:L(3535,"Previous Secondary Side Bar View"),category:We.View,f1:!0},2,-1)}});W(class extends wJ{constructor(){super({id:"workbench.action.nextAuxiliaryBarView",title:L(3533,"Next Secondary Side Bar View"),category:We.View,f1:!0},2,1)}});var Nvi=class a extends K{static{this.ID="workbench.action.maximizeAuxiliaryBar"}constructor(){super({id:a.ID,title:L(3528,"Maximize Secondary Side Bar"),tooltip:d(3529,null),category:We.View,f1:!0,precondition:tke.negate()})}run(i){i.get(fi).setAuxiliaryBarMaximized(!0)}};W(Nvi);var Ovi=class a extends K{static{this.ID="workbench.action.restoreAuxiliaryBar"}constructor(){super({id:a.ID,title:L(3536,"Restore Secondary Side Bar"),tooltip:d(3537,null),category:We.View,f1:!0,precondition:tke,keybinding:{weight:200,primary:2101,win:{primary:2110,secondary:[2101]}}})}run(i){i.get(fi).setAuxiliaryBarMaximized(!1)}};W(Ovi);var Fvi=class a extends K{static{this.ID="workbench.action.toggleMaximizedAuxiliaryBar"}constructor(){super({id:a.ID,title:L(3543,"Toggle Maximized Secondary Side Bar"),tooltip:d(3530,null),f1:!0,category:We.View,icon:nqo,toggled:{condition:tke,tooltip:d(3537,null)},menu:{id:D.AuxiliaryBarTitle,group:"navigation",order:1}})}run(i){i.get(fi).toggleMaximizedAuxiliaryBar()}};W(Fvi);var cqo=Re("panel-maximize",M.screenFull,d(4156,null)),Wvi=Re("panel-close",M.close,d(4151,null)),dqo=Re("panel-layout-icon",M.layoutPanel,d(4177,null)),uqo=Re("panel-layout-icon-off",M.layoutPanelOff,d(4178,null)),yue=class a extends K{static{this.ID="workbench.action.togglePanel"}static{this.LABEL=L(4179,"Toggle Panel Visibility")}constructor(){super({id:a.ID,title:a.LABEL,toggled:{condition:_Y,title:d(4152,null),icon:Wvi,mnemonicTitle:d(4159,null)},icon:Wvi,f1:!0,category:We.View,metadata:{description:d(4163,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(fi);e.setPartHidden(e.isVisible("workbench.parts.panel"),"workbench.parts.panel")}};W(yue);fe.appendMenuItem(D.PanelTitle,{command:{id:yue.ID,title:d(4152,null),icon:Wvi},group:"navigation",order:2});W(class extends K{constructor(){super({id:"workbench.action.closePanel",title:L(4153,"Hide Panel"),category:We.View,precondition:_Y,f1:!0})}run(a){a.get(fi).setPartHidden(!0,"workbench.parts.panel")}});W(class extends K{static{this.ID="workbench.action.focusPanel"}static{this.LABEL=d(4154,null)}constructor(){super({id:"workbench.action.focusPanel",title:L(4155,"Focus into Panel"),category:We.View,f1:!0})}async run(a){let i=a.get(fi),e=a.get(ds);i.isVisible("workbench.parts.panel")||i.setPartHidden(!1,"workbench.parts.panel"),e.getActivePaneComposite(1)?.focus()}});var qNt={LEFT:"workbench.action.positionPanelLeft",RIGHT:"workbench.action.positionPanelRight",BOTTOM:"workbench.action.positionPanelBottom",TOP:"workbench.action.positionPanelTop"},jNt={LEFT:"workbench.action.alignPanelLeft",RIGHT:"workbench.action.alignPanelRight",CENTER:"workbench.action.alignPanelCenter",JUSTIFY:"workbench.action.alignPanelJustify"};function Qoo(a,i,e,t,o){return{id:a,title:i,shortLabel:e,value:t,when:o}}function QNt(a,i,e,t){return Qoo(a,i,e,t,TY.notEqualsTo(KO(t)))}function YNt(a,i,e,t){return Qoo(a,i,e,t,cV.notEqualsTo(t))}var pqo=[QNt(qNt.TOP,L(4172,"Move Panel To Top"),d(4173,null),3),QNt(qNt.LEFT,L(4168,"Move Panel Left"),d(4169,null),0),QNt(qNt.RIGHT,L(4170,"Move Panel Right"),d(4171,null),1),QNt(qNt.BOTTOM,L(4166,"Move Panel To Bottom"),d(4167,null),2)],mqo=[YNt(jNt.LEFT,L(4147,"Set Panel Alignment to Left"),d(4148,null),"left"),YNt(jNt.RIGHT,L(4149,"Set Panel Alignment to Right"),d(4150,null),"right"),YNt(jNt.CENTER,L(4143,"Set Panel Alignment to Center"),d(4144,null),"center"),YNt(jNt.JUSTIFY,L(4145,"Set Panel Alignment to Justify"),d(4146,null),"justify")];fe.appendMenuItem(D.MenubarAppearanceMenu,{submenu:D.PanelPositionMenu,title:d(4165,null),group:"3_workbench_layout_move",order:4});pqo.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:We.View,f1:!0})}run(s){s.get(fi).setPanelPosition(n===void 0?2:n)}}),fe.appendMenuItem(D.PanelPositionMenu,{command:{id:e,title:o,toggled:r.negate()},order:5+i})});fe.appendMenuItem(D.MenubarAppearanceMenu,{submenu:D.PanelAlignmentMenu,title:d(4142,null),group:"3_workbench_layout_move",order:5});mqo.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:We.View,toggled:n.negate(),f1:!0})}run(r){r.get(fi).setPanelAlignment(o===void 0?"center":o)}}),fe.appendMenuItem(D.PanelAlignmentMenu,{command:{id:i,title:t,toggled:n.negate()},order:5})});W(class extends wJ{constructor(){super({id:"workbench.action.previousPanelView",title:L(4174,"Previous Panel View"),category:We.View,f1:!0},1,-1)}});W(class extends wJ{constructor(){super({id:"workbench.action.nextPanelView",title:L(4162,"Next Panel View"),category:We.View,f1:!0},1,1)}});var joo=x.or(cV.isEqualTo("center"),x.and(TY.notEqualsTo("bottom"),TY.notEqualsTo("top")));W(class extends K{constructor(){super({id:"workbench.action.toggleMaximizedPanel",title:L(4175,"Toggle Maximized Panel"),tooltip:d(4157,null),category:We.View,f1:!0,icon:cqo,precondition:joo,toggled:{condition:oTt,tooltip:d(4158,null)},menu:[{id:D.PanelTitle,group:"navigation",order:1,when:joo}]})}run(a){let i=a.get(fi),e=a.get(Ne);if(i.getPanelAlignment()!=="center"&&fV(i.getPanelPosition())){e.warn(d(4164,null));return}i.isVisible("workbench.parts.panel")?i.toggleMaximizedPanel():(i.setPartHidden(!1,"workbench.parts.panel"),i.isPanelMaximized()||i.toggleMaximizedPanel())}});fe.appendMenuItems([{id:D.LayoutControlMenu,item:{group:"2_pane_toggles",command:{id:yue.ID,title:d(4176,null),icon:uqo,toggled:{condition:_Y,icon:dqo}},when:x.and(Xc.negate(),x.or(x.equals("config.workbench.layoutControl.type","toggles"),x.equals("config.workbench.layoutControl.type","both"))),order:1}}]);var z_e=class extends K{constructor(e,t,o){super(o);this.source=e;this.destination=t}run(e,...t){let o=e.get(Ri),n=e.get(fi),r=e.get(Ft),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)}}},Vvi=class a extends z_e{static{this.ID="workbench.action.movePanelToSidePanel"}constructor(){super(1,2,{id:a.ID,title:L(4160,"Move Panel Views To Secondary Side Bar"),category:We.View,f1:!1})}},Bvi=class a extends z_e{static{this.ID="workbench.action.movePanelToSecondarySideBar"}constructor(){super(1,2,{id:a.ID,title:L(4160,"Move Panel Views To Secondary Side Bar"),category:We.View,f1:!0})}};W(Vvi);W(Bvi);var Hvi=class a extends z_e{static{this.ID="workbench.action.moveSidePanelToPanel"}constructor(){super(2,1,{id:a.ID,title:L(4161,"Move Secondary Side Bar Views To Panel"),category:We.View,f1:!1})}},Uvi=class a extends z_e{static{this.ID="workbench.action.moveSecondarySideBarToPanel"}constructor(){super(2,1,{id:a.ID,title:L(4161,"Move Secondary Side Bar Views To Panel"),category:We.View,f1:!0})}};W(Hvi);W(Uvi);var zvi={},hqo=new vae("quick-input-button-icon-");function gqo(a){if(!a)return;let i,e=a.dark.toString();return zvi[e]?i=zvi[e]:(i=hqo.nextId(),Vh(`.${i}, .hc-light .${i}`,`background-image: ${Na(a.light||a.dark)}`),Vh(`.vs-dark .${i}, .hc-black .${i}`,`background-image: ${Na(a.dark)}`),zvi[e]=i),i}var Kvi=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 Gvi(a,i,e){let t=a.iconClass||gqo(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 Kvi(i,a.tooltip||"","",t,!0,a.toggle.checked,o):{id:i,label:"",tooltip:a.tooltip||"",class:t,enabled:!0,run:o}}function X5(a,i,e){let t=[],o=[];return a.forEach((n,r)=>{let s=Gvi(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 Yoo(a,i,e){Fi(i);let t=lS(a),o=0;for(let n of t.nodes)if(typeof n=="string")i.append(...Bn(n));else{let r=n.title;!r&&n.href.startsWith("command:")?r=d(2249,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=>{Zpt(g)&&$t.stop(g,!0),e.callback(n.href)},c=e.disposables.add(new On(s,re.CLICK)).event,u=e.disposables.add(new On(s,re.KEY_DOWN)).event,p=H.chain(u,g=>g.filter(f=>{let v=new Ii(f);return v.equals(10)||v.equals(3)}));e.disposables.add(ws.addTarget(s));let h=e.disposables.add(new On(s,Gn.Tap)).event;H.any(c,h,p)(l,null,e.disposables),i.appendChild(s)}}var Joo="inQuickInput",Zoo=new Q(Joo,!1,d(2229,null)),G_e=x.has(Joo),fqo="quickInputAlignment",tYe=new Q(fqo,"top",d(2233,null)),kJ="quickInputType",eno=new Q(kJ,void 0,d(2235,null)),tno="cursorAtEndOfQuickInputBox",ino=new Q(tno,!1,d(2226,null)),ono=x.has(tno),eOt={iconClass:q.asClassName(M.quickInputBack),tooltip:d(2231,null),handle:-1},CJ=class a extends C{constructor(e){super();this.ui=e;this._visible=Le("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=gt.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 P);this.onDidTriggerButton=this.onDidTriggerButtonEmitter.event;this.onDidHide=this.onDidHideEmitter.event;this.onWillHide=this.onWillHideEmitter.event;this.onDispose=this.onDisposeEmitter.event}static{this.noPromptMessage=d(2227,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&&!Nc;this._ignoreFocusOut=e&&!Nc,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===eOt)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 Nl,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=X5(this._leftButtons,"left-button",c=>this.onDidTriggerButtonEmitter.fire(c));this.ui.leftActionBar.setActions(n.primary,n.secondary);let r=X5(this._rightButtons,"right-button",c=>this.onDidTriggerButtonEmitter.fire(c));this.ui.rightActionBar.setActions(r.primary,r.secondary);let s=X5(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)=>Gvi(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,Fi(this.ui.message),o&&Yoo(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(2232,null,this.step,this.totalSteps):this.step?String(this.step):""}showMessageDecoration(e){if(this.ui.inputBox.showDecoration(e),e!==gt.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()}},xJ=class a extends CJ{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 eN;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(2234,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?A4i: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(2230,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(Vp(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 Ii(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))}},XNt=class extends CJ{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(2228,null,e):CJ.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")}},JNt=class extends CJ{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?Fi(this.ui.widget,this._widget):Fi(this.ui.widget)),super.update())}},K_e=class extends mv{constructor(i,e){super("mouse",void 0,t=>this.getOverrideOptions(t),i,e)}getOverrideOptions(i){let e=(Ao(i.content)?i.content.textContent??"":typeof i.content=="string"?i.content:i.content.value).includes(`
`);return{persistence:{hideOnKeyDown:!1},appearance:{showHoverHint:e,skipFadeInAnimation:!0}}}};K_e=I([m(0,B),m(1,tt)],K_e);var vqo=Re("menuBar",M.layoutMenubar,d(3323,null)),bqo=Re("activity-bar-left",M.layoutActivitybarLeft,d(3287,null)),Sqo=Re("activity-bar-right",M.layoutActivitybarRight,d(3288,null)),tOt=Re("panel-left",M.layoutSidebarLeft,d(3364,null)),Iqo=Re("panel-left-off",M.layoutSidebarLeftOff,d(3365,null)),iOt=Re("panel-right",M.layoutSidebarRight,d(3366,null)),yqo=Re("panel-right-off",M.layoutSidebarRightOff,d(3367,null)),wqo=Re("panel-bottom",M.layoutPanel,d(3358,null)),Cqo=Re("statusBar",M.layoutStatusbar,d(3400,null)),xqo=Re("panel-align-left",M.layoutPanelLeft,d(3361,null)),kqo=Re("panel-align-right",M.layoutPanelRight,d(3362,null)),Eqo=Re("panel-align-center",M.layoutPanelCenter,d(3359,null)),Tqo=Re("panel-align-justify",M.layoutPanelJustify,d(3360,null)),_qo=Re("quickInputAlignmentTop",M.arrowUp,d(3371,null)),Dqo=Re("quickInputAlignmentCenter",M.circle,d(3370,null)),Lqo=Re("fullscreen",M.screenFull,d(3308,null)),Rqo=Re("centerLayoutIcon",M.layoutCentered,d(3293,null)),Mqo=Re("zenMode",M.target,d(3416,null)),Pqo="workbench.action.toggleActivityBarVisibility";W(class extends K{constructor(){super({id:"workbench.action.toggleCenteredLayout",title:{...L(3402,"Toggle Centered Layout"),mnemonicTitle:d(3331,null)},precondition:sw.toNegated(),category:We.View,f1:!0,toggled:P8e,menu:[{id:D.MenubarAppearanceMenu,group:"1_toggle_view",order:3}]})}run(a){let i=a.get(fi),e=a.get(Et);i.centerMainEditorLayout(!i.isMainEditorLayoutCentered()),e.activeGroup.focus()}});var nno="workbench.sideBar.location",oOt=class extends K{constructor(e,t,o){super({id:e,title:t,f1:!1});this.position=o}async run(e){let t=e.get(fi),o=e.get(B);if(t.getSideBarPosition()!==this.position)return o.updateValue(nno,KO(this.position))}},nOt=class a extends oOt{static{this.ID="workbench.action.moveSideBarRight"}constructor(){super(a.ID,L(3352,"Move Primary Side Bar Right"),1)}},rOt=class a extends oOt{static{this.ID="workbench.action.moveSideBarLeft"}constructor(){super(a.ID,L(3350,"Move Primary Side Bar Left"),0)}};W(nOt);W(rOt);var J5=class a extends K{static{this.ID="workbench.action.toggleSidebarPosition"}static{this.LABEL=d(3409,null)}static getLabel(i){return i.getSideBarPosition()===0?d(3353,null):d(3351,null)}constructor(){super({id:a.ID,title:L(3410,"Toggle Primary Side Bar Position"),category:We.View,f1:!0})}run(i){let e=i.get(fi),t=i.get(B),n=e.getSideBarPosition()===0?"right":"left";return t.updateValue(nno,n)}};W(J5);var rno=Re("configure-layout-icon",M.layout,d(3296,null));fe.appendMenuItem(D.LayoutControlMenu,{submenu:D.LayoutControlMenuSubmenu,title:d(3299,null),icon:rno,group:"1_workbench_layout",when:x.and(Xc.negate(),x.equals("config.workbench.layoutControl.type","menu"))});fe.appendMenuItems([{id:D.ViewContainerTitleContext,item:{group:"3_workbench_layout_move",command:{id:J5.ID,title:d(3335,null)},when:x.and(x.notEquals("config.workbench.sideBar.location","right"),x.equals("viewContainerLocation",WE(0))),order:1}},{id:D.ViewContainerTitleContext,item:{group:"3_workbench_layout_move",command:{id:J5.ID,title:d(3336,null)},when:x.and(x.equals("config.workbench.sideBar.location","right"),x.equals("viewContainerLocation",WE(0))),order:1}},{id:D.ViewContainerTitleContext,item:{group:"3_workbench_layout_move",command:{id:J5.ID,title:d(3333,null)},when:x.and(x.notEquals("config.workbench.sideBar.location","right"),x.equals("viewContainerLocation",WE(2))),order:1}},{id:D.ViewContainerTitleContext,item:{group:"3_workbench_layout_move",command:{id:J5.ID,title:d(3334,null)},when:x.and(x.equals("config.workbench.sideBar.location","right"),x.equals("viewContainerLocation",WE(2))),order:1}}]);fe.appendMenuItem(D.MenubarAppearanceMenu,{group:"3_workbench_layout_move",command:{id:J5.ID,title:d(3328,null)},when:x.notEquals("config.workbench.sideBar.location","right"),order:2});fe.appendMenuItem(D.MenubarAppearanceMenu,{group:"3_workbench_layout_move",command:{id:J5.ID,title:d(3327,null)},when:x.equals("config.workbench.sideBar.location","right"),order:2});W(class extends K{constructor(){super({id:"workbench.action.toggleEditorVisibility",title:{...L(3403,"Toggle Editor Area Visibility"),mnemonicTitle:d(3329,null)},category:We.View,f1:!0,toggled:iTt,precondition:x.and(sw.toNegated(),x.or(cV.isEqualTo("center"),TY.notEqualsTo("bottom")))})}run(a){a.get(fi).toggleMaximizedPanel()}});fe.appendMenuItem(D.MenubarViewMenu,{group:"2_appearance",title:d(3324,null),submenu:D.MenubarAppearanceMenu,order:1});var wue=class a extends K{static{this.ID="workbench.action.toggleSidebarVisibility"}static{this.LABEL=d(3297,null)}constructor(){super({id:a.ID,title:L(3407,"Toggle Primary Side Bar Visibility"),toggled:{condition:cP,title:d(3368,null),mnemonicTitle:d(3369,null)},metadata:{description:d(3355,null)},category:We.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(fi),t=e.isVisible("workbench.parts.sidebar");e.setPartHidden(t,"workbench.parts.sidebar");let o=t?d(3396,null):d(3398,null);Jo(o)}};W(wue);fe.appendMenuItems([{id:D.ViewContainerTitleContext,item:{group:"3_workbench_layout_move",command:{id:wue.ID,title:d(3297,null)},when:x.and(cP,x.equals("viewContainerLocation",WE(0))),order:2}},{id:D.LayoutControlMenu,item:{group:"2_pane_toggles",command:{id:wue.ID,title:d(3408,null),icon:Iqo,toggled:{condition:cP,icon:tOt}},when:x.and(Xc.negate(),x.or(x.equals("config.workbench.layoutControl.type","toggles"),x.equals("config.workbench.layoutControl.type","both")),x.equals("config.workbench.sideBar.location","left")),order:0}},{id:D.LayoutControlMenu,item:{group:"2_pane_toggles",command:{id:wue.ID,title:d(3408,null),icon:yqo,toggled:{condition:cP,icon:iOt}},when:x.and(Xc.negate(),x.or(x.equals("config.workbench.layoutControl.type","toggles"),x.equals("config.workbench.layoutControl.type","both")),x.equals("config.workbench.sideBar.location","right")),order:2}}]);var Cue=class a extends K{static{this.ID="workbench.action.toggleStatusbarVisibility"}static{this.statusbarVisibleKey="workbench.statusBar.visible"}constructor(){super({id:a.ID,title:{...L(3411,"Toggle Status Bar Visibility"),mnemonicTitle:d(3330,null)},category:We.View,f1:!0,toggled:x.equals("config.workbench.statusBar.visible",!0),menu:[{id:D.MenubarAppearanceMenu,group:"2_workbench_layout",order:3}]})}run(i){let e=i.get(fi),t=i.get(B),n=!e.isVisible("workbench.parts.statusbar",It);return t.updateValue(a.statusbarVisibleKey,n)}};W(Cue);var EJ=class extends K{constructor(e,t,o,n,r,s){super({id:n,title:o,category:We.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)}},iYe=class a extends EJ{static{this.ID="workbench.action.hideEditorTabs"}constructor(){let i=x.and(x.equals("config.workbench.editor.showTabs","none").negate(),gC.negate()),e=L(3311,"Hide Editor Tabs");super("workbench.editor.showTabs","none",e,a.ID,i,L(3312,"Hide Tab Bar"))}},oYe=class a extends EJ{static{this.ID="workbench.action.zenHideEditorTabs"}constructor(){let i=x.and(x.equals("config.zenMode.showTabs","none").negate(),gC),e=L(3313,"Hide Editor Tabs in Zen Mode");super("zenMode.showTabs","none",e,a.ID,i,L(3314,"Hide Tab Bar in Zen Mode"))}},nYe=class a extends EJ{static{this.ID="workbench.action.showMultipleEditorTabs"}constructor(){let i=x.and(x.equals("config.workbench.editor.showTabs","multiple").negate(),gC.negate()),e=L(3385,"Show Multiple Editor Tabs");super("workbench.editor.showTabs","multiple",e,a.ID,i,L(3386,"Show Tab Bar with multiple tabs"))}},rYe=class a extends EJ{static{this.ID="workbench.action.zenShowMultipleEditorTabs"}constructor(){let i=x.and(x.equals("config.zenMode.showTabs","multiple").negate(),gC),e=L(3387,"Show Multiple Editor Tabs in Zen Mode");super("zenMode.showTabs","multiple",e,a.ID,i,L(3388,"Show Tab Bar in Zen Mode"))}},sYe=class a extends EJ{static{this.ID="workbench.action.showEditorTab"}constructor(){let i=x.and(x.equals("config.workbench.editor.showTabs","single").negate(),gC.negate()),e=L(3389,"Show Single Editor Tab");super("workbench.editor.showTabs","single",e,a.ID,i,L(3390,"Show Tab Bar with one Tab"))}},aYe=class a extends EJ{static{this.ID="workbench.action.zenShowEditorTab"}constructor(){let i=x.and(x.equals("config.zenMode.showTabs","single").negate(),gC),e=L(3391,"Show Single Editor Tab in Zen Mode");super("zenMode.showTabs","single",e,a.ID,i,L(3392,"Show Tab Bar in Zen Mode with one Tab"))}};W(iYe);W(oYe);W(nYe);W(rYe);W(sYe);W(aYe);fe.appendMenuItem(D.MenubarAppearanceMenu,{submenu:D.EditorTabsBarShowTabsSubmenu,title:d(3401,null),group:"3_workbench_layout_move",order:10,when:gC.negate()});fe.appendMenuItem(D.MenubarAppearanceMenu,{submenu:D.EditorTabsBarShowTabsZenModeSubmenu,title:d(3401,null),group:"3_workbench_layout_move",order:10,when:gC});var lYe=class a extends K{static{this.ID="workbench.action.editorActionsTitleBar"}constructor(){super({id:a.ID,title:L(3339,"Move Editor Actions to Title Bar"),category:We.View,precondition:x.equals("config.workbench.editor.editorActionsLocation","titleBar").negate(),metadata:{description:L(3340,"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(lYe);var cYe=class a extends K{static{this.ID="workbench.action.editorActionsDefault"}constructor(){super({id:a.ID,title:L(3337,"Move Editor Actions to Tab Bar"),category:We.View,precondition:x.and(x.equals("config.workbench.editor.editorActionsLocation","default").negate(),x.equals("config.workbench.editor.showTabs","none").negate()),metadata:{description:L(3338,"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(cYe);var dYe=class a extends K{static{this.ID="workbench.action.hideEditorActions"}constructor(){super({id:a.ID,title:L(3309,"Hide Editor Actions"),category:We.View,precondition:x.equals("config.workbench.editor.editorActionsLocation","hidden").negate(),metadata:{description:L(3310,"Hide Editor Actions in the tab and title bar")},f1:!0})}run(i){return i.get(B).updateValue("workbench.editor.editorActionsLocation","hidden")}};W(dYe);var $vi=class a extends K{static{this.ID="workbench.action.showEditorActions"}constructor(){super({id:a.ID,title:L(3383,"Show Editor Actions"),category:We.View,precondition:x.equals("config.workbench.editor.editorActionsLocation","hidden"),metadata:{description:L(3384,"Make Editor Actions visible.")},f1:!0})}run(i){return i.get(B).updateValue("workbench.editor.editorActionsLocation","default")}};W($vi);fe.appendMenuItem(D.MenubarAppearanceMenu,{submenu:D.EditorActionsPositionSubmenu,title:d(3306,null),group:"3_workbench_layout_move",order:11});var uYe=class a extends K{static{this.ID="workbench.action.configureEditorTabs"}constructor(){super({id:a.ID,title:L(3300,"Configure Tabs"),category:We.View})}run(i){i.get(Po).openSettings({jsonEditor:!1,query:"workbench.editor tab"})}};W(uYe);var pYe=class a extends K{static{this.ID="workbench.action.configureEditor"}constructor(){super({id:a.ID,title:L(3298,"Configure Editors"),category:We.View})}run(i){i.get(Po).openSettings({jsonEditor:!1,query:"workbench.editor"})}};W(pYe);W(class extends K{constructor(){super({id:"workbench.action.toggleSeparatePinnedEditorTabs",title:L(3405,"Separate Pinned Editor Tabs"),category:We.View,precondition:x.equals("config.workbench.editor.showTabs","multiple"),metadata:{description:L(3406,"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(3413,"Toggle Zen Mode"),mnemonicTitle:d(3332,null)},precondition:sw.toNegated(),category:We.View,f1:!0,keybinding:{weight:200,primary:Ai(2089,56)},toggled:gC,menu:[{id:D.MenubarAppearanceMenu,group:"1_toggle_view",order:2}]})}run(a){return a.get(fi).toggleZenMode()}});yt.registerCommandAndKeybindingRule({id:"workbench.action.exitZenMode",weight:-900,handler(a){let i=a.get(fi),e=a.get(X);gC.getValue(e)&&i.toggleZenMode()},when:gC,primary:Ai(9,9)});if(ri||Wn||Gt){W(class extends K{constructor(){super({id:"workbench.action.toggleMenuBar",title:{...L(3404,"Toggle Menu Bar"),mnemonicTitle:d(3325,null)},category:We.View,f1:!0,toggled:x.and(Mx.toNegated(),x.notEquals("config.window.menuBarVisibility","hidden"),x.notEquals("config.window.menuBarVisibility","toggle"),x.notEquals("config.window.menuBarVisibility","compact")),menu:[{id:D.MenubarAppearanceMenu,group:"2_workbench_layout",order:0}]})}run(i){return i.get(fi).toggleMenuBar()}});for(let a of[D.TitleBarContext,D.TitleBarTitleContext])fe.appendMenuItem(a,{command:{id:"workbench.action.toggleMenuBar",title:d(3326,null),toggled:x.and(Mx.toNegated(),x.notEquals("config.window.menuBarVisibility","hidden"),x.notEquals("config.window.menuBarVisibility","toggle"),x.notEquals("config.window.menuBarVisibility","compact"))},when:x.and(sw.toNegated(),x.notEquals(EY.key,"native"),lP.negate()),group:"2_config",order:0})}W(class extends K{constructor(){super({id:"workbench.action.resetViewLocations",title:L(3375,"Reset View Locations"),category:We.View,f1:!0})}run(a){return a.get(Ri).reset()}});W(class extends K{constructor(){super({id:"workbench.action.moveView",title:L(3354,"Move View"),category:We.View,f1:!0})}async run(a){let i=a.get(Ri),e=a.get(F),t=a.get(Ge),o=a.get(X),n=a.get(ds),r=Vl.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 sOt;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(3395,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(3363,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(3380,null,l.title)}),c=!0),e.push({id:u.id,label:u.name.value}))})}),e}async getView(a,i,e,t){let o=new P,n=o.add(a.createQuickPick({useSeparators:!0}));return n.placeholder=d(3348,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 sOt=class extends K{constructor(){super({id:"workbench.action.moveFocusedView",title:L(3341,"Move Focused View"),category:We.View,precondition:Vl.notEqualsTo(""),f1:!0})}run(i,e){let t=i.get(Ri),o=i.get(Ft),n=i.get(Ge),r=i.get(X),s=i.get(ct),l=i.get(ds),c=e||Vl.getValue(r);if(c===void 0||c.trim()===""){s.error(d(3342,null));return}let u=t.getViewDescriptorById(c);if(!u?.canMoveView){s.error(d(3343,null));return}let p=new P,h=p.add(n.createQuickPick({useSeparators:!0}));h.placeholder=d(3347,null),h.title=d(3349,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(3344,null)}),b&&v===0||g.push({id:"_.sidebar.newcontainer",label:d(3345,null)}),b&&v===2||g.push({id:"_.auxiliarybar.newcontainer",label:d(3346,null)}),g.push({type:"separator",label:d(3393,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(3356,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(3379,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(sOt);W(class extends K{constructor(){super({id:"workbench.action.resetFocusedViewLocation",title:L(3374,"Reset Focused View Location"),category:We.View,f1:!0,precondition:Vl.notEqualsTo("")})}run(a){let i=a.get(Ri),e=a.get(X),t=a.get(ct),o=a.get(Ft),n=Vl.getValue(e),r=null;if(n!==void 0&&n.trim()!==""&&(r=i.getViewDescriptorById(n)),!r){t.error(d(3373,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 YE=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)}},qvi=class extends YE{constructor(){super({id:"workbench.action.increaseViewSize",title:L(3317,"Increase Current View Size"),f1:!0,precondition:sw.toNegated()})}run(i){this.resizePart(YE.RESIZE_INCREMENT,YE.RESIZE_INCREMENT,i.get(fi))}},jvi=class extends YE{constructor(){super({id:"workbench.action.increaseViewWidth",title:L(3316,"Increase Editor Width"),f1:!0,precondition:sw.toNegated()})}run(i){this.resizePart(YE.RESIZE_INCREMENT,0,i.get(fi),"workbench.parts.editor")}},Qvi=class extends YE{constructor(){super({id:"workbench.action.increaseViewHeight",title:L(3315,"Increase Editor Height"),f1:!0,precondition:sw.toNegated()})}run(i){this.resizePart(0,YE.RESIZE_INCREMENT,i.get(fi),"workbench.parts.editor")}},Yvi=class extends YE{constructor(){super({id:"workbench.action.decreaseViewSize",title:L(3305,"Decrease Current View Size"),f1:!0,precondition:sw.toNegated()})}run(i){this.resizePart(-YE.RESIZE_INCREMENT,-YE.RESIZE_INCREMENT,i.get(fi))}},Xvi=class extends YE{constructor(){super({id:"workbench.action.decreaseViewWidth",title:L(3304,"Decrease Editor Width"),f1:!0,precondition:sw.toNegated()})}run(i){this.resizePart(-YE.RESIZE_INCREMENT,0,i.get(fi),"workbench.parts.editor")}},Jvi=class extends YE{constructor(){super({id:"workbench.action.decreaseViewHeight",title:L(3303,"Decrease Editor Height"),f1:!0,precondition:sw.toNegated()})}run(i){this.resizePart(0,-YE.RESIZE_INCREMENT,i.get(fi),"workbench.parts.editor")}};W(qvi);W(jvi);W(Qvi);W(Yvi);W(Xvi);W(Jvi);W(class extends K{constructor(){super({id:"workbench.action.alignQuickInputTop",title:L(3290,"Align Quick Input Top"),f1:!1})}run(i){i.get(Ge).setAlignment("top")}});W(class extends K{constructor(){super({id:"workbench.action.alignQuickInputCenter",title:L(3289,"Align Quick Input Center"),f1:!1})}run(i){i.get(Ge).setAlignment("center")}});function Aqo(a){return a.iconA!==void 0}var $_e=(a,i,e,t)=>({id:a,active:i,label:e,visualIcon:t,activeIcon:M.eye,inactiveIcon:M.eyeClosed,activeAriaLabel:d(3381,null),inactiveAriaLabel:d(3382,null),useButtons:!0}),$V=(a,i,e,t)=>({id:a,active:i,label:e,visualIcon:t,activeIcon:M.check,activeAriaLabel:d(3285,null),useButtons:!1}),Nqo=x.and(Mx.toNegated(),x.notEquals("config.window.menuBarVisibility","hidden"),x.notEquals("config.window.menuBarVisibility","toggle"),x.notEquals("config.window.menuBarVisibility","compact")),aOt=[];(!it||!kr)&&aOt.push($_e("workbench.action.toggleMenuBar",Nqo,d(3322,null),vqo));aOt.push($_e(Pqo,x.notEquals("config.workbench.activityBar.location","hidden"),d(3286,null),{whenA:x.equals("config.workbench.sideBar.location","left"),iconA:bqo,iconB:Sqo}),$_e(wue.ID,cP,d(3394,null),{whenA:x.equals("config.workbench.sideBar.location","left"),iconA:tOt,iconB:iOt}),$_e(Y5.ID,D_,d(3379,null),{whenA:x.equals("config.workbench.sideBar.location","left"),iconA:iOt,iconB:tOt}),$_e(yue.ID,_Y,d(3356,null),wqo),$_e(Cue.ID,x.equals("config.workbench.statusBar.visible",!0),d(3399,null),Cqo));var sno=[$V(rOt.ID,x.equals("config.workbench.sideBar.location","left"),d(3321,null),tOt),$V(nOt.ID,x.equals("config.workbench.sideBar.location","right"),d(3378,null),iOt)],ano=[$V("workbench.action.alignPanelLeft",cV.isEqualTo("left"),d(3320,null),xqo),$V("workbench.action.alignPanelRight",cV.isEqualTo("right"),d(3377,null),kqo),$V("workbench.action.alignPanelCenter",cV.isEqualTo("center"),d(3294,null),Eqo),$V("workbench.action.alignPanelJustify",cV.isEqualTo("justify"),d(3318,null),Tqo)],lno=[$V("workbench.action.alignQuickInputTop",tYe.isEqualTo("top"),d(3414,null),_qo),$V("workbench.action.alignQuickInputCenter",tYe.isEqualTo("center"),d(3291,null),Dqo)],cno=[$V("workbench.action.toggleFullScreen",lP,d(3307,null),Lqo),$V("workbench.action.toggleZenMode",gC,d(3415,null),Mqo),$V("workbench.action.toggleCenteredLayout",P8e,d(3292,null),Rqo)],dno=new Set;for(let{active:a}of[...aOt,...sno,...ano,...lno,...cno])for(let i of a.keys())dno.add(i);W(class extends K{constructor(){super({id:"workbench.action.customizeLayout",title:L(3301,"Customize Layout..."),f1:!0,icon:rno,menu:[{id:D.LayoutControlMenuSubmenu,group:"z_end"},{id:D.LayoutControlMenu,when:x.and(Xc.toNegated(),x.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;Aqo(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(3412,null)},...aOt.map(t),{type:"separator",label:d(3397,null)},...sno.map(t),{type:"separator",label:d(3357,null)},...ano.map(t),{type:"separator",label:d(3372,null)},...lno.map(t),{type:"separator",label:d(3319,null)},...cno.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(Ge),r=i.get(_e),s=new P,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(3302,null);let c={alwaysVisible:!0,iconClass:q.asClassName(M.close),tooltip:d(3295,null)},u={alwaysVisible:!0,iconClass:q.asClassName(M.discard),tooltip:d(3376,null)};l.buttons=[u,c];let p;s.add(t.onDidChangeContext(h=>{h.affectsSome(dno)&&(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"),(!it||!kr)&&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()}});oe.as(rn.EditorPane).registerEditorPane(ys.create(j5,j5.ID,d(3762,null)),[new Mt(qm),new Mt(IC)]);oe.as(rn.EditorPane).registerEditorPane(ys.create(Z_,Z_.ID,d(3761,null)),[new Mt(Fa)]);oe.as(rn.EditorPane).registerEditorPane(ys.create(GV,GV.ID,d(3640,null)),[new Mt(Fa)]);oe.as(rn.EditorPane).registerEditorPane(ys.create(of,of.ID,d(3749,null)),[new Mt(ga)]);oe.as(rn.EditorFactory).registerEditorSerializer(qm.ID,V_e);oe.as(rn.EditorFactory).registerEditorSerializer(ga.ID,KEt);oe.as(rn.EditorFactory).registerEditorSerializer(Fa.ID,GEt);pt(bue.ID,bue,ut.BlockRestore);pt(fue.ID,fue,ut.BlockRestore);pt(Sue.ID,Sue,ut.BlockRestore);pt(fF.ID,fF,ut.BlockRestore);var tbi=oe.as(Tu.Quickaccess),lOt="inEditorsPicker",mno=x.and($E,x.has(lOt));tbi.registerQuickAccessProvider({ctor:J_,prefix:J_.PREFIX,contextKey:lOt,placeholder:d(3660,null),helpEntries:[{description:d(3637,null),commandId:B7e.ID}]});tbi.registerQuickAccessProvider({ctor:BV,prefix:BV.PREFIX,contextKey:lOt,placeholder:d(3660,null),helpEntries:[{description:d(3638,null),commandId:H7e.ID}]});tbi.registerQuickAccessProvider({ctor:UP,prefix:UP.PREFIX,contextKey:lOt,placeholder:d(3660,null),helpEntries:[{description:d(3639,null),commandId:U7e.ID}]});W(bJ);W(JPt);W(ZPt);W(N_e);W(O_e);W(BAt);W(HAt);W(UAt);W(zAt);W(KAt);W(GAt);W(sNt);W(aNt);W(lNt);W(cNt);W(W7e);W(V7e);W(H7e);W(U7e);W(B7e);W(vue);W(wAt);W(IAt);W(CAt);W(xAt);W(SAt);W(tAt);W(iAt);W(oAt);W(nAt);W(rAt);W(sAt);W(aAt);W(lAt);W(cAt);W(OAt);W(FAt);W(WAt);W(VAt);W(AAt);W(NAt);W(pNt);W(mNt);W(hNt);W(gNt);W(EAt);W(TAt);W(_At);W(DAt);W(LAt);W(RAt);W(MAt);W(PAt);W(fNt);W(vNt);W(wNt);W(CNt);W(INt);W(yNt);W(bNt);W(SNt);W(xNt);W(kNt);W(LNt);W(RNt);W(_Nt);W(DNt);W(ENt);W(TNt);W(dAt);W(uAt);W(pAt);W(hAt);W(mAt);W(gAt);W(fAt);W(vAt);W(bAt);W(MNt);W(PNt);W(ANt);W(NNt);W($At);W(qAt);W(jAt);W(QAt);W(YAt);W(XAt);W(JAt);W(ZAt);W(eNt);W(uNt);W(dNt);W(z7e);W(K7e);W(G7e);W($7e);W(q7e);W(j7e);W(Y7e);W(Q7e);W(ONt);W(FNt);W(tNt);W(iNt);W(oNt);W(nNt);W(rNt);W(VNt);W(BNt);W(UNt);W(zNt);W(KNt);W(GNt);var uno="workbench.action.quickOpenNavigateNextInEditorPicker";yt.registerCommandAndKeybindingRule({id:uno,weight:250,handler:Y_(uno,!0),when:mno,primary:2050,mac:{primary:258}});var pno="workbench.action.quickOpenNavigatePreviousInEditorPicker";yt.registerCommandAndKeybindingRule({id:pno,weight:250,handler:Y_(pno,!1),when:mno,primary:3074,mac:{primary:1282}});foo();it&&(fe.appendMenuItem(D.TouchBarContext,{command:{id:O_e.ID,title:O_e.LABEL,icon:{dark:gn.asFileUri("vs/workbench/browser/parts/editor/media/back-tb.png")}},group:"navigation",order:0}),fe.appendMenuItem(D.TouchBarContext,{command:{id:N_e.ID,title:N_e.LABEL,icon:{dark:gn.asFileUri("vs/workbench/browser/parts/editor/media/forward-tb.png")}},group:"navigation",order:1}));fe.appendMenuItem(D.EmptyEditorGroup,{command:{id:LPt,title:d(3670,null),icon:M.unlock},group:"navigation",order:10,when:x.and(Xc,ME.toNegated())});fe.appendMenuItem(D.EmptyEditorGroup,{command:{id:H5,title:d(3769,null),icon:M.lock,toggled:x.true()},group:"navigation",order:10,when:ME});fe.appendMenuItem(D.EmptyEditorGroup,{command:{id:TPt,title:d(3647,null),icon:M.close},group:"navigation",order:20,when:x.or(Xc,Fj)});fe.appendMenuItem(D.EmptyEditorGroupContext,{command:{id:z5,title:d(3758,null)},group:"2_split",order:10});fe.appendMenuItem(D.EmptyEditorGroupContext,{command:{id:dK,title:d(3752,null)},group:"2_split",order:20});fe.appendMenuItem(D.EmptyEditorGroupContext,{command:{id:K5,title:d(3756,null)},group:"2_split",order:30});fe.appendMenuItem(D.EmptyEditorGroupContext,{command:{id:uK,title:d(3757,null)},group:"2_split",order:40});fe.appendMenuItem(D.EmptyEditorGroupContext,{command:{id:OPt,title:d(3740,null)},group:"3_window",order:10});fe.appendMenuItem(D.EmptyEditorGroupContext,{command:{id:DPt,title:d(3764,null),toggled:ME},group:"4_lock",order:10,when:Xc.toNegated()});fe.appendMenuItem(D.EmptyEditorGroupContext,{command:{id:TPt,title:d(3641,null)},group:"5_close",order:10,when:iS});fe.appendMenuItem(D.EditorTabsBarContext,{command:{id:z5,title:d(3758,null)},group:"2_split",order:10});fe.appendMenuItem(D.EditorTabsBarContext,{command:{id:dK,title:d(3752,null)},group:"2_split",order:20});fe.appendMenuItem(D.EditorTabsBarContext,{command:{id:K5,title:d(3756,null)},group:"2_split",order:30});fe.appendMenuItem(D.EditorTabsBarContext,{command:{id:uK,title:d(3757,null)},group:"2_split",order:40});fe.appendMenuItem(D.EditorTabsBarContext,{command:{id:APt,title:d(3732,null)},group:"3_window",order:10});fe.appendMenuItem(D.EditorTabsBarContext,{command:{id:NPt,title:d(3656,null)},group:"3_window",order:20});fe.appendMenuItem(D.EditorTabsBarContext,{submenu:D.EditorTabsBarShowTabsSubmenu,title:d(3760,null),group:"4_config",order:10,when:gC.negate()});fe.appendMenuItem(D.EditorTabsBarShowTabsSubmenu,{command:{id:nYe.ID,title:d(3737,null),toggled:x.equals("config.workbench.editor.showTabs","multiple")},group:"1_config",order:10});fe.appendMenuItem(D.EditorTabsBarShowTabsSubmenu,{command:{id:sYe.ID,title:d(3750,null),toggled:x.equals("config.workbench.editor.showTabs","single")},group:"1_config",order:20});fe.appendMenuItem(D.EditorTabsBarShowTabsSubmenu,{command:{id:iYe.ID,title:d(3662,null),toggled:x.equals("config.workbench.editor.showTabs","none")},group:"1_config",order:30});fe.appendMenuItem(D.EditorTabsBarContext,{submenu:D.EditorTabsBarShowTabsZenModeSubmenu,title:d(3760,null),group:"4_config",order:10,when:gC});fe.appendMenuItem(D.EditorTabsBarShowTabsZenModeSubmenu,{command:{id:rYe.ID,title:d(3737,null),toggled:x.equals("config.zenMode.showTabs","multiple")},group:"1_config",order:10});fe.appendMenuItem(D.EditorTabsBarShowTabsZenModeSubmenu,{command:{id:aYe.ID,title:d(3750,null),toggled:x.equals("config.zenMode.showTabs","single")},group:"1_config",order:20});fe.appendMenuItem(D.EditorTabsBarShowTabsZenModeSubmenu,{command:{id:oYe.ID,title:d(3662,null),toggled:x.equals("config.zenMode.showTabs","none")},group:"1_config",order:30});fe.appendMenuItem(D.EditorTabsBarContext,{submenu:D.EditorActionsPositionSubmenu,title:d(3659,null),group:"4_config",order:20});fe.appendMenuItem(D.EditorActionsPositionSubmenu,{command:{id:cYe.ID,title:d(3760,null),toggled:x.equals("config.workbench.editor.editorActionsLocation","default")},group:"1_config",order:10,when:x.equals("config.workbench.editor.showTabs","none").negate()});fe.appendMenuItem(D.EditorActionsPositionSubmenu,{command:{id:lYe.ID,title:d(3763,null),toggled:x.or(x.equals("config.workbench.editor.editorActionsLocation","titleBar"),x.and(x.equals("config.workbench.editor.showTabs","none"),x.equals("config.workbench.editor.editorActionsLocation","default")))},group:"1_config",order:20});fe.appendMenuItem(D.EditorActionsPositionSubmenu,{command:{id:dYe.ID,title:d(3661,null),toggled:x.equals("config.workbench.editor.editorActionsLocation","hidden")},group:"1_config",order:30});fe.appendMenuItem(D.EditorTabsBarContext,{command:{id:uYe.ID,title:d(3655,null)},group:"9_configure",order:10});fe.appendMenuItem(D.EditorTitleContext,{command:{id:OC,title:d(3641,null)},group:"1_close",order:10});fe.appendMenuItem(D.EditorTitleContext,{command:{id:g_e,title:d(3649,null),precondition:JEt.notEqualsTo("1")},group:"1_close",order:20});fe.appendMenuItem(D.EditorTitleContext,{command:{id:EPt,title:d(3651,null),precondition:x.and(Sce.toNegated(),Oj.negate())},group:"1_close",order:30,when:dz});fe.appendMenuItem(D.EditorTitleContext,{command:{id:cue,title:d(3643,null)},group:"1_close",order:40});fe.appendMenuItem(D.EditorTitleContext,{command:{id:B5,title:d(3642,null)},group:"1_close",order:50});fe.appendMenuItem(D.EditorTitleContext,{command:{id:f_e,title:d(3745,null)},group:"1_open",order:10,when:AO});fe.appendMenuItem(D.EditorTitleContext,{command:{id:_Pt,title:d(3667,null),precondition:Zxe.toNegated()},group:"3_preview",order:10,when:x.has("config.workbench.editor.enablePreview")});fe.appendMenuItem(D.EditorTitleContext,{command:{id:RPt,title:d(3742,null)},group:"3_preview",order:20,when:ZL.toNegated()});fe.appendMenuItem(D.EditorTitleContext,{command:{id:U5,title:d(3771,null)},group:"3_preview",order:20,when:ZL});fe.appendMenuItem(D.EditorTitleContext,{command:{id:uJ,title:d(3757,null)},group:"5_split",order:10,when:Cce.negate()});fe.appendMenuItem(D.EditorTitleContext,{command:{id:uJ,title:d(3752,null)},group:"5_split",order:10,when:Cce});fe.appendMenuItem(D.EditorTitleContext,{submenu:D.EditorSplitMoveSubmenu,title:d(3751,null),group:"5_split",order:15});fe.appendMenuItem(D.EditorTitleContext,{command:{id:v7e,title:d(3736,null)},group:"7_new_window",order:10});fe.appendMenuItem(D.EditorTitleContext,{command:{id:b7e,title:d(3658,null)},group:"7_new_window",order:20});fe.appendMenuItem(D.EditorTitleContext,{submenu:D.EditorTitleContextShare,title:d(3747,null),group:"11_share",order:-1,when:Oj.negate()});fe.appendMenuItem(D.EditorSplitMoveSubmenu,{command:{id:z5,title:d(3758,null)},group:"1_split",order:10});fe.appendMenuItem(D.EditorSplitMoveSubmenu,{command:{id:dK,title:d(3752,null)},group:"1_split",order:20});fe.appendMenuItem(D.EditorSplitMoveSubmenu,{command:{id:K5,title:d(3756,null)},group:"1_split",order:30});fe.appendMenuItem(D.EditorSplitMoveSubmenu,{command:{id:uK,title:d(3757,null)},group:"1_split",order:40});fe.appendMenuItem(D.EditorSplitMoveSubmenu,{command:{id:v_e,title:d(3730,null)},group:"2_move",order:10});fe.appendMenuItem(D.EditorSplitMoveSubmenu,{command:{id:b_e,title:d(3731,null)},group:"2_move",order:20});fe.appendMenuItem(D.EditorSplitMoveSubmenu,{command:{id:S_e,title:d(3734,null)},group:"2_move",order:30});fe.appendMenuItem(D.EditorSplitMoveSubmenu,{command:{id:I_e,title:d(3735,null)},group:"2_move",order:40});fe.appendMenuItem(D.EditorSplitMoveSubmenu,{command:{id:MPt,title:d(3755,null),precondition:Oj.negate()},group:"3_split_in_group",order:10,when:oV});fe.appendMenuItem(D.EditorSplitMoveSubmenu,{command:{id:PPt,title:d(3665,null),precondition:Oj.negate()},group:"3_split_in_group",order:10,when:hC});fe.appendMenuItem(D.EditorTitle,{command:{id:wPt,title:d(3664,null),toggled:x.equals("config.diffEditor.renderSideBySide",!1)},group:"1_diff",order:10,when:x.has("isInDiffEditor")});fe.appendMenuItem(D.EditorTitle,{command:{id:Wfi,title:d(3748,null)},group:"3_open",order:10});fe.appendMenuItem(D.EditorTitle,{command:{id:B5,title:d(3642,null)},group:"5_close",order:10});fe.appendMenuItem(D.EditorTitle,{command:{id:cue,title:d(3643,null)},group:"5_close",order:20});fe.appendMenuItem(D.EditorTitle,{command:{id:Ffi,title:d(3765,null),toggled:x.has("config.workbench.editor.enablePreview")},group:"7_settings",order:10});fe.appendMenuItem(D.EditorTitle,{command:{id:y_e,title:d(3671,null)},group:"8_group_operations",order:5,when:x.and(nV.negate(),Fj)});fe.appendMenuItem(D.EditorTitle,{command:{id:y_e,title:d(3770,null)},group:"8_group_operations",order:5,when:nV});fe.appendMenuItem(D.EditorTitle,{command:{id:DPt,title:d(3669,null),toggled:ME},group:"8_group_operations",order:10,when:Xc.toNegated()});fe.appendMenuItem(D.EditorTitle,{command:{id:pYe.ID,title:d(3654,null)},group:"9_configure",order:10});function vF(a,i,e,t,o,n){let r={command:{id:a.id,title:a.title,icon:a.icon,toggled:a.toggled,precondition:o},group:"navigation",when:i,order:e};t&&(r.alt={id:t.id,title:t.title,icon:t.icon}),fe.appendMenuItem(D.EditorTitle,r),n&&fe.appendMenuItem(D.CompactWindowEditorTitle,r)}var ibi=1e5,q_e=1e6;vF({id:uJ,title:d(3754,null),icon:M.splitHorizontal},Cce.negate(),ibi,{id:dK,title:d(3753,null),icon:M.splitVertical});vF({id:uJ,title:d(3753,null),icon:M.splitVertical},Cce,ibi,{id:uK,title:d(3754,null),icon:M.splitHorizontal});vF({id:Vfi,title:d(3766,null),icon:M.editorLayout},hC,ibi-1);vF({id:OC,title:d(3641,null),icon:M.close},x.and(dz.toNegated(),bce.toNegated(),ZL.toNegated()),q_e,{id:B5,title:d(3642,null),icon:M.closeAll});vF({id:OC,title:d(3641,null),icon:M.closeDirty},x.and(dz.toNegated(),bce,ZL.toNegated()),q_e,{id:B5,title:d(3642,null),icon:M.closeAll});vF({id:U5,title:d(3771,null),icon:M.pinned},x.and(dz.toNegated(),bce.toNegated(),ZL),q_e,{id:OC,title:d(3641,null),icon:M.close});vF({id:U5,title:d(3771,null),icon:M.pinnedDirty},x.and(dz.toNegated(),bce,ZL),q_e,{id:OC,title:d(3641,null),icon:M.close});vF({id:LPt,title:d(3668,null),icon:M.unlock},x.and(Xc,ME.toNegated()),q_e-1);vF({id:H5,title:d(3768,null),icon:M.lock,toggled:x.true()},ME,q_e-1);var Oqo=Re("diff-editor-previous-change",M.arrowUp,d(3744,null));vF({id:xPt,title:d(3739,null),icon:Oqo},tS,10,void 0,ue.hasChanges,!0);var Fqo=Re("diff-editor-next-change",M.arrowDown,d(3741,null));vF({id:CPt,title:d(3738,null),icon:Fqo},tS,11,void 0,ue.hasChanges,!0);vF({id:kPt,title:d(3759,null),icon:M.arrowSwap},x.and(tS,eke),15,void 0,void 0);var Wqo=Re("diff-editor-toggle-whitespace",M.whitespace,d(3767,null));fe.appendMenuItem(D.EditorTitle,{command:{id:Afi,title:d(3663,null),icon:Wqo,precondition:tS,toggled:x.equals("config.diffEditor.ignoreTrimWhitespace",!1)},group:"navigation",when:tS,order:20});fe.appendMenuItem(D.CommandPalette,{command:{id:_Pt,title:L(3666,"Keep Editor"),category:We.View},when:x.has("config.workbench.editor.enablePreview")});fe.appendMenuItem(D.CommandPalette,{command:{id:RPt,title:L(3743,"Pin Editor"),category:We.View}});fe.appendMenuItem(D.CommandPalette,{command:{id:U5,title:L(3772,"Unpin Editor"),category:We.View}});fe.appendMenuItem(D.CommandPalette,{command:{id:OC,title:L(3644,"Close Editor"),category:We.View}});fe.appendMenuItem(D.CommandPalette,{command:{id:Ofi,title:L(3650,"Close Pinned Editor"),category:We.View}});fe.appendMenuItem(D.CommandPalette,{command:{id:B5,title:L(3646,"Close All Editors in Group"),category:We.View}});fe.appendMenuItem(D.CommandPalette,{command:{id:cue,title:L(3653,"Close Saved Editors in Group"),category:We.View}});fe.appendMenuItem(D.CommandPalette,{command:{id:g_e,title:L(3648,"Close Other Editors in Group"),category:We.View}});fe.appendMenuItem(D.CommandPalette,{command:{id:EPt,title:L(3652,"Close Editors to the Right in Group"),category:We.View},when:Sce.toNegated()});fe.appendMenuItem(D.CommandPalette,{command:{id:f7e,title:L(3645,"Close Editor Group"),category:We.View},when:iS});fe.appendMenuItem(D.CommandPalette,{command:{id:f_e,title:L(3746,"Reopen Editor With..."),category:We.View},when:AO});fe.appendMenuItem(D.MenubarRecentMenu,{group:"1_editor",command:{id:W7e.ID,title:d(3699,null),precondition:x.has("canReopenClosedEditor")},order:1});fe.appendMenuItem(D.MenubarRecentMenu,{group:"z_clear",command:{id:V7e.ID,title:d(3672,null)},order:1});fe.appendMenuItem(D.MenubarFileMenu,{title:d(3701,null),submenu:D.MenubarShare,group:"45_share",order:1});fe.appendMenuItem(D.MenubarViewMenu,{group:"2_appearance",title:d(3674,null),submenu:D.MenubarLayoutMenu,order:2});fe.appendMenuItem(D.MenubarLayoutMenu,{group:"1_split",command:{id:z5,title:{...L(3713,"Split Up"),mnemonicTitle:d(3712,null)}},order:1});fe.appendMenuItem(D.MenubarLayoutMenu,{group:"1_split",command:{id:dK,title:{...L(3705,"Split Down"),mnemonicTitle:d(3704,null)}},order:2});fe.appendMenuItem(D.MenubarLayoutMenu,{group:"1_split",command:{id:K5,title:{...L(3709,"Split Left"),mnemonicTitle:d(3708,null)}},order:3});fe.appendMenuItem(D.MenubarLayoutMenu,{group:"1_split",command:{id:uK,title:{...L(3711,"Split Right"),mnemonicTitle:d(3710,null)}},order:4});fe.appendMenuItem(D.MenubarLayoutMenu,{group:"2_split_in_group",command:{id:MPt,title:{...L(3707,"Split in Group"),mnemonicTitle:d(3706,null)}},when:oV,order:1});fe.appendMenuItem(D.MenubarLayoutMenu,{group:"2_split_in_group",command:{id:PPt,title:{...L(3686,"Join in Group"),mnemonicTitle:d(3685,null)}},when:hC,order:1});fe.appendMenuItem(D.MenubarLayoutMenu,{group:"3_new_window",command:{id:v7e,title:{...L(3733,"Move Editor into New Window"),mnemonicTitle:d(3688,null)}},order:1});fe.appendMenuItem(D.MenubarLayoutMenu,{group:"3_new_window",command:{id:b7e,title:{...L(3657,"Copy Editor into New Window"),mnemonicTitle:d(3673,null)}},order:2});fe.appendMenuItem(D.MenubarLayoutMenu,{group:"4_layouts",command:{id:z7e.ID,title:{...L(3703,"Single"),mnemonicTitle:d(3702,null)}},order:1});fe.appendMenuItem(D.MenubarLayoutMenu,{group:"4_layouts",command:{id:K7e.ID,title:{...L(3725,"Two Columns"),mnemonicTitle:d(3724,null)}},order:3});fe.appendMenuItem(D.MenubarLayoutMenu,{group:"4_layouts",command:{id:G7e.ID,title:{...L(3717,"Three Columns"),mnemonicTitle:d(3716,null)}},order:4});fe.appendMenuItem(D.MenubarLayoutMenu,{group:"4_layouts",command:{id:$7e.ID,title:{...L(3727,"Two Rows"),mnemonicTitle:d(3726,null)}},order:5});fe.appendMenuItem(D.MenubarLayoutMenu,{group:"4_layouts",command:{id:q7e.ID,title:{...L(3719,"Three Rows"),mnemonicTitle:d(3718,null)}},order:6});fe.appendMenuItem(D.MenubarLayoutMenu,{group:"4_layouts",command:{id:j7e.ID,title:{...L(3721,"Grid (2x2)"),mnemonicTitle:d(3720,null)}},order:7});fe.appendMenuItem(D.MenubarLayoutMenu,{group:"4_layouts",command:{id:Y7e.ID,title:{...L(3729,"Two Rows Right"),mnemonicTitle:d(3728,null)}},order:8});fe.appendMenuItem(D.MenubarLayoutMenu,{group:"4_layouts",command:{id:Q7e.ID,title:{...L(3723,"Two Columns Bottom"),mnemonicTitle:d(3722,null)}},order:9});fe.appendMenuItem(D.MenubarGoMenu,{group:"1_history_nav",command:{id:"workbench.action.navigateToLastEditLocation",title:d(3687,null),precondition:x.has("canNavigateToLastEditLocation")},order:3});fe.appendMenuItem(D.MenubarSwitchEditorMenu,{group:"1_sideBySide",command:{id:Bfi,title:d(3675,null)},when:x.or(hC,tS),order:1});fe.appendMenuItem(D.MenubarSwitchEditorMenu,{group:"1_sideBySide",command:{id:Hfi,title:d(3700,null)},when:x.or(hC,tS),order:2});fe.appendMenuItem(D.MenubarSwitchEditorMenu,{group:"2_any",command:{id:"workbench.action.nextEditor",title:d(3689,null)},order:1});fe.appendMenuItem(D.MenubarSwitchEditorMenu,{group:"2_any",command:{id:"workbench.action.previousEditor",title:d(3694,null)},order:2});fe.appendMenuItem(D.MenubarSwitchEditorMenu,{group:"3_any_used",command:{id:"workbench.action.openNextRecentlyUsedEditor",title:d(3692,null)},order:1});fe.appendMenuItem(D.MenubarSwitchEditorMenu,{group:"3_any_used",command:{id:"workbench.action.openPreviousRecentlyUsedEditor",title:d(3697,null)},order:2});fe.appendMenuItem(D.MenubarSwitchEditorMenu,{group:"4_group",command:{id:"workbench.action.nextEditorInGroup",title:d(3690,null)},order:1});fe.appendMenuItem(D.MenubarSwitchEditorMenu,{group:"4_group",command:{id:"workbench.action.previousEditorInGroup",title:d(3695,null)},order:2});fe.appendMenuItem(D.MenubarSwitchEditorMenu,{group:"5_group_used",command:{id:"workbench.action.openNextRecentlyUsedEditorInGroup",title:d(3693,null)},order:1});fe.appendMenuItem(D.MenubarSwitchEditorMenu,{group:"5_group_used",command:{id:"workbench.action.openPreviousRecentlyUsedEditorInGroup",title:d(3698,null)},order:2});fe.appendMenuItem(D.MenubarGoMenu,{group:"2_editor_nav",title:d(3714,null),submenu:D.MenubarSwitchEditorMenu,order:1});fe.appendMenuItem(D.MenubarSwitchGroupMenu,{group:"1_focus_index",command:{id:"workbench.action.focusFirstEditorGroup",title:d(3679,null)},order:1});fe.appendMenuItem(D.MenubarSwitchGroupMenu,{group:"1_focus_index",command:{id:"workbench.action.focusSecondEditorGroup",title:d(3683,null)},order:2});fe.appendMenuItem(D.MenubarSwitchGroupMenu,{group:"1_focus_index",command:{id:"workbench.action.focusThirdEditorGroup",title:d(3684,null),precondition:iS},order:3});fe.appendMenuItem(D.MenubarSwitchGroupMenu,{group:"1_focus_index",command:{id:"workbench.action.focusFourthEditorGroup",title:d(3680,null),precondition:iS},order:4});fe.appendMenuItem(D.MenubarSwitchGroupMenu,{group:"1_focus_index",command:{id:"workbench.action.focusFifthEditorGroup",title:d(3678,null),precondition:iS},order:5});fe.appendMenuItem(D.MenubarSwitchGroupMenu,{group:"2_next_prev",command:{id:"workbench.action.focusNextGroup",title:d(3691,null),precondition:iS},order:1});fe.appendMenuItem(D.MenubarSwitchGroupMenu,{group:"2_next_prev",command:{id:"workbench.action.focusPreviousGroup",title:d(3696,null),precondition:iS},order:2});fe.appendMenuItem(D.MenubarSwitchGroupMenu,{group:"3_directional",command:{id:"workbench.action.focusLeftGroup",title:d(3681,null),precondition:iS},order:1});fe.appendMenuItem(D.MenubarSwitchGroupMenu,{group:"3_directional",command:{id:"workbench.action.focusRightGroup",title:d(3682,null),precondition:iS},order:2});fe.appendMenuItem(D.MenubarSwitchGroupMenu,{group:"3_directional",command:{id:"workbench.action.focusAboveGroup",title:d(3676,null),precondition:iS},order:3});fe.appendMenuItem(D.MenubarSwitchGroupMenu,{group:"3_directional",command:{id:"workbench.action.focusBelowGroup",title:d(3677,null),precondition:iS},order:4});fe.appendMenuItem(D.MenubarGoMenu,{group:"2_editor_nav",title:d(3715,null),submenu:D.MenubarSwitchGroupMenu,order:2});z4i(Fft);var cy=class extends Xj{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 obi(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||(Sf(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 Oi(this.partLayout).layout(e,t)}get onDidChange(){return this._onDidChange.event}layout(e,t,o,n){this._dimension=new ai(e,t),this._contentPosition={top:o,left:n}}setVisible(e){this._onDidVisibilityChange.fire(e)}},obi=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 ai(i,Math.min(e,a.TITLE_HEIGHT)):t=ai.None;let o;this.headerVisible?o=new ai(i,Math.min(e,a.HEADER_HEIGHT)):o=ai.None;let n;this.footerVisible?n=new ai(i,Math.min(e,a.Footer_HEIGHT)):n=ai.None;let r=i;this.options&&typeof this.options.borderWidth=="function"&&(r-=this.options.borderWidth());let s=new ai(r,e-t.height-o.height-n.height);return this.contentArea&&fN(this.contentArea,s.width,s.height),{headerSize:o,titleSize:t,contentSize:s,footerSize:n}}setFooterVisibility(i){this.footerVisible=i}setHeaderVisibility(i){this.headerVisible=i}},TJ=class extends Xj{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(rh())}};var j_e=class extends C{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 P);this.editorPanesRegistry=oe.as(rn.EditorPane);this.editorOperation=this._register(new Eye(s)),this.registerListeners()}get minimumWidth(){return this._activeEditorPane?.minimumWidth??FE.width}get minimumHeight(){return this._activeEditorPane?.minimumHeight??FE.height}get maximumWidth(){return this._activeEditorPane?.maximumWidth??Jj.width}get maximumHeight(){return this._activeEditorPane?.maximumHeight??Jj.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&&(!Pj(e)||e.allowDialog)&&(s=await this.doShowErrorDialog(e,t)),s)return{error:e};let l={...o};return so(e)||(l.error=e),{...await this.doOpenEditor(vJ.DESCRIPTOR,t,l,n,r),error:e}}async doShowErrorDialog(e,t){let o=gt.Error,n,r=In(e),s;Pj(e)&&(s=e.actions,o=e.forceSeverity??gt.Error,e.forceMessage&&(n=e.message,r=void 0)),n||(n=d(3959,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(3960,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(In(g))),u=!0}return u}async doOpenEditor(e,t,o,n,r=Object.create(null)){let s=this.doShowEditorPane(e),l=Pn(),{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(qv(this.groupView.windowId,!0).window)),{pane:s,changed:c,cancelled:u}}shouldRestoreFocus(e){if(!this.layoutService.isRestored()||!e)return!0;let t=Pn();return!!(!t||t===e.ownerDocument.body||e===t||!Oh(t)||gs(t,this.editorGroupParent))}getEditorPaneDescriptor(e){return e.hasCapability(16)&&!this.workspaceTrustService.isWorkspaceTrusted()?Q5.DESCRIPTOR:Oi(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=Oi(t.getContainer());return this.editorPanesParent.appendChild(o),bn(o),t.setVisible(!0),this.pagePosition&&t.layout(new ai(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(),xo(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(),xo(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 ai(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)}}};j_e=I([m(3,fi),m(4,F),m(5,rd),m(6,ns),m(7,ne),m(8,ct),m(9,oi)],j_e);var hno=x.and(x.equals("chatSetupHidden",!1),x.equals("chatSetupDisabled",!1)),Vqo={text:d(3949,null),id:"workbench.action.chat.open",when:{native:hno,web:hno}},Bqo={text:d(3956,null),id:"workbench.action.showCommands"},Hqo={text:d(3955,null),id:"workbench.action.quickOpen"},Uqo={text:d(3950,null),id:"workbench.action.files.openFile"},zqo={text:d(3952,null),id:"workbench.action.files.openFolder"},Kqo={text:d(3951,null),id:"workbench.action.files.openFileFolder"},Gqo={text:d(3953,null),id:"workbench.action.openRecent"},$qo={text:d(3948,null),id:"workbench.action.files.newUntitledFile"},qqo={text:d(3947,null),id:"workbench.action.findInFiles"},jqo={text:d(3958,null),id:"workbench.action.terminal.toggleTerminal",when:{web:x.equals("terminalProcessSupported",!0)}},Qqo={text:d(3957,null),id:"workbench.action.debug.start",when:{web:x.equals("terminalProcessSupported",!0)}},Yqo={text:d(3954,null),id:"workbench.action.openSettings"},bno=[Vqo,Bqo],gno=si([...bno,Gqo,...it&&!Gt?[Kqo]:[Uqo,zqo],it&&!Gt?$qo:void 0]),fno=[...bno],vno=[Hqo,qqo,Qqo,jqo,Yqo],xR=class extends C{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 P);this.keybindingLabels=this._register(new P);this.enabled=!1;this.cachedWhen=this.storageService.getObject(xR.CACHED_WHEN,0,Object.create(null)),this.workbenchState=this.contextService.getWorkbenchState();let l=bt(".editor-group-watermark",[bt(".watermark-container",[bt(".letterpress"),bt(".shortcuts@shortcuts")])]);R(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(xR.SETTINGS_KEY)&&this.enabled!==this.configurationService.getValue(xR.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=[...gno,...fno,...vno];for(let o of t){let n=Gt?o.when?.web:o.when?.native;n&&(this.cachedWhen[o.id]=this.contextKeyService.contextMatchesRules(n))}this.storageService.store(xR.CACHED_WHEN,JSON.stringify(this.cachedWhen),0,1)}}))}render(){if(this.enabled=this.configurationService.getValue(xR.SETTINGS_KEY),Rt(this.shortcuts),this.transientDisposables.clear(),!this.enabled)return;let e=this.filterEntries(this.workbenchState!==1?fno:gno);if(e.length<xR.MINIMUM_ENTRIES){let n=this.filterEntries(vno);l6(n),e.push(...n.slice(0,xR.MINIMUM_ENTRIES-e.length))}let t=R(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=R(t,_("dl")),l=R(s,_("dt"));l.textContent=n.text;let c=R(s,_("dd"));this.keybindingLabels.add(new ah(c,zo,{renderUnboundKeybindings:!0,...l_})).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=Gt?o.when?.web:o.when?.native;return!n||this.contextKeyService.contextMatchesRules(n)}).filter(o=>!!qe.getCommand(o.id)).filter(o=>!!this.keybindingService.lookupKeybinding(o.id))}};xR=I([m(1,_e),m(2,Pe),m(3,X),m(4,B),m(5,le)],xR);var _J=class{},bK=class{constructor(i,e,t=1,o,n){this._disposables=new P;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 Pa(this._domNode,{vertical:2,horizontal:t,horizontalScrollbarSize:e,useShadows:!1,scrollYToX:!0}),this._separatorIcon=o,this._disposables.add(this._scrollable),this._disposables.add(Vo(this._domNode,"click",l=>this._onClick(l))),i.appendChild(this._scrollable.getDomNode());let r=hr(this._domNode);this._style(r,n);let s=Vn(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&&ai.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 P;return e.add(T6(Me(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 o7t(Me(this._domNode),()=>{o7t(Me(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 ts(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=dUi(this._items,i,(o,n)=>o.equals(n)),t=this._items.splice(e,this._items.length-e,...i.slice(e)),this._render(e),Ue(t),Ue(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 kR=ae("IOutlineService");var qV=ae("IEditorBreadcrumbsService"),nbi=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)}};we(qV,nbi,1);var XE=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()}}}}}};oe.as(ii.Configuration).registerConfiguration({id:"breadcrumbs",title:d(3617,null),order:101,type:"object",properties:{"breadcrumbs.enabled":{description:d(3576,null),type:"boolean",default:!0},"breadcrumbs.filePath":{description:d(3577,null),type:"string",default:"on",enum:["on","off","last"],enumDescriptions:[d(3580,null),d(3579,null),d(3578,null)]},"breadcrumbs.symbolPath":{description:d(3608,null),type:"string",default:"on",enum:["on","off","last"],enumDescriptions:[d(3611,null),d(3610,null),d(3609,null)]},"breadcrumbs.symbolSortOrder":{description:d(3613,null),type:"string",default:"position",scope:6,enum:["position","name","type"],enumDescriptions:[d(3615,null),d(3614,null),d(3616,null)]},"breadcrumbs.icons":{description:d(3607,null),type:"boolean",default:!0},"breadcrumbs.symbolPathSeparator":{description:d(3612,null),type:"string",default:".",scope:6},"breadcrumbs.showFiles":{type:"boolean",default:!0,scope:6,markdownDescription:d(3590,null)},"breadcrumbs.showModules":{type:"boolean",default:!0,scope:6,markdownDescription:d(3595,null)},"breadcrumbs.showNamespaces":{type:"boolean",default:!0,scope:6,markdownDescription:d(3596,null)},"breadcrumbs.showPackages":{type:"boolean",default:!0,scope:6,markdownDescription:d(3601,null)},"breadcrumbs.showClasses":{type:"boolean",default:!0,scope:6,markdownDescription:d(3583,null)},"breadcrumbs.showMethods":{type:"boolean",default:!0,scope:6,markdownDescription:d(3594,null)},"breadcrumbs.showProperties":{type:"boolean",default:!0,scope:6,markdownDescription:d(3602,null)},"breadcrumbs.showFields":{type:"boolean",default:!0,scope:6,markdownDescription:d(3589,null)},"breadcrumbs.showConstructors":{type:"boolean",default:!0,scope:6,markdownDescription:d(3585,null)},"breadcrumbs.showEnums":{type:"boolean",default:!0,scope:6,markdownDescription:d(3586,null)},"breadcrumbs.showInterfaces":{type:"boolean",default:!0,scope:6,markdownDescription:d(3592,null)},"breadcrumbs.showFunctions":{type:"boolean",default:!0,scope:6,markdownDescription:d(3591,null)},"breadcrumbs.showVariables":{type:"boolean",default:!0,scope:6,markdownDescription:d(3606,null)},"breadcrumbs.showConstants":{type:"boolean",default:!0,scope:6,markdownDescription:d(3584,null)},"breadcrumbs.showStrings":{type:"boolean",default:!0,scope:6,markdownDescription:d(3603,null)},"breadcrumbs.showNumbers":{type:"boolean",default:!0,scope:6,markdownDescription:d(3598,null)},"breadcrumbs.showBooleans":{type:"boolean",default:!0,scope:6,markdownDescription:d(3582,null)},"breadcrumbs.showArrays":{type:"boolean",default:!0,scope:6,markdownDescription:d(3581,null)},"breadcrumbs.showObjects":{type:"boolean",default:!0,scope:6,markdownDescription:d(3599,null)},"breadcrumbs.showKeys":{type:"boolean",default:!0,scope:6,markdownDescription:d(3593,null)},"breadcrumbs.showNull":{type:"boolean",default:!0,scope:6,markdownDescription:d(3597,null)},"breadcrumbs.showEnumMembers":{type:"boolean",default:!0,scope:6,markdownDescription:d(3587,null)},"breadcrumbs.showStructs":{type:"boolean",default:!0,scope:6,markdownDescription:d(3604,null)},"breadcrumbs.showEvents":{type:"boolean",default:!0,scope:6,markdownDescription:d(3588,null)},"breadcrumbs.showOperators":{type:"boolean",default:!0,scope:6,markdownDescription:d(3600,null)},"breadcrumbs.showTypeParameters":{type:"boolean",default:!0,scope:6,markdownDescription:d(3605,null)}}});var xue=class{constructor(i,e){this.uri=i;this.kind=e}},Y_e=class{constructor(i,e){this.element=i;this.outline=e}},Q_e=class{constructor(i,e,t,o,n){this.resource=i;this.editor=e;this._workspaceService=o;this._outlineService=n;this._disposables=new P;this._currentOutline=new me;this._outlineDisposables=new P;this._onDidUpdate=new E;this.onDidUpdate=this._onDidUpdate.event;this._cfgFilePath=XE.FilePath.bindTo(t),this._cfgSymbolPath=XE.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 Y_e(e[t].element,this._currentOutline.value));return e.length===0&&!this._currentOutline.value.isEmpty&&i.push(new Y_e(this._currentOutline.value,this._currentOutline.value)),i}_initFilePathInfo(i){if($0(i,Y.untitled,Y.data))return{folder:void 0,path:[]};let e={folder:this._workspaceService.getWorkspaceFolder(i)??void 0,path:[]},t=i;for(;t&&t.path!=="/"&&!(e.folder&&Xe(e.folder.uri,t));){e.path.unshift(new xue(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 xue(e.folder.uri,2)),e}_onDidChangeWorkspaceFolders(){this._fileInfo=this._initFilePathInfo(this.resource),this._onDidUpdate.fire(this)}_bindToEditor(i){let e=new $e;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)})}};Q_e=I([m(2,B),m(3,Pe),m(4,kR)],Q_e);var J_e=class{constructor(i,e,t,o,n){this.resource=e;this._instantiationService=t;this._themeService=o;this._configurationService=n;this._disposables=new P;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(KXt);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(jT)}`,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(){}};J_e=I([m(2,F),m(3,De),m(4,B)],J_e);var rbi=class{getHeight(i){return 22}getTemplateId(i){return"FileStat"}},sbi=class{getId(i){return A.isUri(i)?i.toString():Tq(i)?i.id:oC(i)?i.uri.toString():i.resource.toString()}},mYe=class{constructor(i){this._fileService=i}hasChildren(i){return A.isUri(i)||Tq(i)||oC(i)||i.isDirectory}async getChildren(i){if(Tq(i))return i.folders;let e;return oC(i)?e=i.uri:A.isUri(i)?e=i:e=i.resource,(await this._fileService.resolve(e)).children??[]}};mYe=I([m(0,be)],mYe);var hYe=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;oC(n)?(r=n.uri,s=2):(r=n.resource,s=n.isDirectory?1:0),t.setFile(r,{fileKind:s,hidePath:!0,fileDecorations:o,matches:ua(i.filterData),extraClasses:["picker-item"]})}disposeTemplate(i){i.dispose()}};hYe=I([m(1,B)],hYe);var abi=class{getKeyboardNavigationLabel(i){return i.name}},lbi=class{getWidgetAriaLabel(){return d(3630,null)}getAriaLabel(i){return i.name}},gYe=class{constructor(i,e,t){this._workspaceService=i;this._cachedExpressions=new Map;this._disposables=new P;let o=XE.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?Lo.join(r.uri.path,u):u;l[p]=s[u]}let c=!t.hasCapability(r.uri,1024);this._cachedExpressions.set(r.uri.toString(),zm(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(oC(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())(SM(t.uri.path,i.resource.path),Ye(i.resource))}};gYe=I([m(0,Pe),m(1,B),m(2,be)],gYe);var cbi=class{compare(i,e){return oC(i)&&oC(e)?i.index-e.index:i.isDirectory===e.isDirectory?jE(i.name,e.name):i.isDirectory?-1:1}},Z_e=class extends J_e{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(Za,AP);return this._disposables.add(o),this._instantiationService.createInstance(nu,"BreadcrumbsFilePicker",e,new rbi,[this._instantiationService.createInstance(hYe,o)],this._instantiationService.createInstance(mYe),{multipleSelectionSupport:!1,sorter:new cbi,filter:this._instantiationService.createInstance(gYe),identityProvider:new sbi,keyboardNavigationLabelProvider:new abi,accessibilityProvider:this._instantiationService.createInstance(lbi),showNotFoundMessage:!1,overrideStyles:{listBackground:KXt}})}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(oC(l)&&Xe(l.uri,t)){s=l;break}else if(Xe(l.resource,t)){s=l;break}s&&(r.reveal(s,.5),r.setFocus([s],this._fakeEvent)),r.domFocus()}_previewElement(e){return C.None}async _revealElement(e,t,o){return!oC(e)&&e.isFile?(this._onWillPickElement.fire(),await this._editorService.openEditor({resource:e.resource,options:t},o?vn:void 0),!0):!1}};Z_e=I([m(2,F),m(3,De),m(4,B),m(5,Pe),m(6,ee)],Z_e);var fYe=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)}};fYe=I([m(2,Nn)],fYe);var cOt=class extends J_e{_createTree(i,e){let{config:t}=e.outline;return this._instantiationService.createInstance(pO,"BreadcrumbsOutlinePicker",i,t.delegate,t.renderers,t.treeDataSource,{...t.options,sorter:this._instantiationService.createInstance(fYe,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 DJ=class extends _J{constructor(e,t,o,n){super();this.model=e;this.element=t;this.options=o;this._instantiationService=n;this._disposables=new P}dispose(){this._disposables.dispose()}equals(e){return e instanceof DJ?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||xo(s.iconClass),this._disposables.add(Z(()=>{r.disposeTemplate(s)})),t instanceof _f&&o.uri&&this._disposables.add(this._instantiationService.invokeFunction(l=>Sno(l,e,t.symbol.name,{symbol:t.symbol,uri:o.uri},this.model,this.options.dragEditor)))}};DJ=I([m(3,F)],DJ);var LJ=class extends _J{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 P}dispose(){this._disposables.dispose()}equals(e){return e instanceof LJ?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(Cd[this.element.kind].toLowerCase()),this._disposables.add(t),this._disposables.add(this._instantiationService.invokeFunction(o=>Sno(o,e,Ye(this.element.uri),this.element.uri,this.model,this.options.dragEditor)))}};LJ=I([m(5,F)],LJ);function Sno(a,i,e,t,o,n){let r=a.get(F);return i.draggable=!0,new Om(i,{onDragStart:s=>{s.dataTransfer&&(s.dataTransfer.effectAllowed="copyMove",r.invokeFunction(l=>{A.isUri(t)?Ig(l,[t],s):(Ig(l,[{resource:t.uri,selection:t.symbol.range}],s),_Ie([{name:t.symbol.name,fsPath:t.uri.fsPath,range:t.symbol.range,kind:t.symbol.kind}],s)),n&&o.editor?.input&&VI.getInstance().setData([new Wf({editor:o.editor.input,groupId:o.editor.group.id})],Wf.prototype)}),$N(s,i,e))}})}var Xqo=Re("breadcrumb-separator",M.chevronRight,d(3629,null)),bc=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 P;this._breadcrumbsDisposables=new P;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"),R(i,this.domNode),this._cfUseQuickPick=XE.UseQuickPick.bindTo(p),this._cfShowIcons=XE.Icons.bindTo(p),this._cfTitleScrollbarSizing=XE.TitleScrollbarSizing.bindTo(p),this._cfTitleScrollbarVisibility=XE.TitleScrollbarVisibility.bindTo(p),this._labels=this._instantiationService.createInstance(Za,AP);let g=this._cfTitleScrollbarSizing.getValue()??"default",f=e.widgetStyles??f1,v=this._cfTitleScrollbarVisibility?.getValue()??"auto";this._widget=new bK(this.domNode,bc.SCROLLBAR_SIZES[g],bc.SCROLLBAR_VISIBILITY[v],Xqo,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=bc.CK_BreadcrumbsPossible.bindTo(this._contextKeyService),this._ckBreadcrumbsVisible=bc.CK_BreadcrumbsVisible.bindTo(this._contextKeyService),this._ckBreadcrumbsActive=bc.CK_BreadcrumbsActive.bindTo(this._contextKeyService),this._hoverDelegate=Ni("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 Q("breadcrumbsPossible",!1,d(3619,null))}static{this.CK_BreadcrumbsVisible=new Q("breadcrumbsVisible",!1,d(3620,null))}static{this.CK_BreadcrumbsActive=new Q("breadcrumbsActive",!1,d(3618,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=no.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=no.getOriginalUri(this._editorGroup.activeEditor,{supportSideBySide:1});this.show(),this._ckBreadcrumbsPossible.set(!0);let o=this._instantiationService.createInstance(Q_e,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 xue?this._instantiationService.createInstance(LJ,o,f,h,this._labels,this._hoverDelegate):this._instantiationService.createInstance(DJ,o,f,h));g.length===0?(this._widget.setEnabled(!1),this._widget.setItems([new class extends _J{render(f){f.textContent=d(3627,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(bc.SCROLLBAR_SIZES[p]),this._widget.setHorizontalScrollbarVisibility(bc.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 Y_e?"@":"");return}let o,n;this._contextViewService.showContextView({render:r=>{i.item instanceof LJ?o=this._instantiationService.createInstance(Z_e,r,i.item.model.resource):i.item instanceof DJ&&(o=this._instantiationService.createInstance(cOt,r,i.item.model.resource));let s=o.onWillPickElement(()=>this._contextViewService.hideContextView({source:this,didPick:!0})),l=Xd.getInstance(Me(this.domNode)).onDidChange(()=>this._contextViewService.hideContextView({source:this})),c=Vn(r),u=c.onDidBlur(()=>{this._breadcrumbsPickerIgnoreOnceItem=this._widget.isDOMFocused()?i.item:void 0,this._contextViewService.hideContextView({source:this})});return this._breadcrumbsPickerShowing=!0,this._updateCkBreadcrumbsActive(),hn(o,s,l,c,u)},getAnchor:()=>{if(!n){let r=Me(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=Yn(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 yn){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 xue)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],bc.Payload_Pick)}else e.outline.reveal(e,{pinned:o},t===vn,!1)}_getEditorGroup(i){return i===bc.Payload_RevealAside?vn:i===bc.Payload_Reveal?Un:void 0}};bc=I([m(3,X),m(4,_n),m(5,F),m(6,Ge),m(7,be),m(8,ee),m(9,ot),m(10,B),m(11,qV)],bc);var RJ=class{constructor(i,e,t,o,n,r){this._container=i;this._editorGroup=e;this._options=t;this._instantiationService=n;this._disposables=new P;this._controlDisposables=new P;this._onDidEnablementChange=this._disposables.add(new E);this._onDidVisibilityChange=this._disposables.add(new E);let s=this._disposables.add(XE.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(bc,this._container,this._options,this._editorGroup));return this._controlDisposables.add(i.onDidVisibilityChange(()=>this._onDidVisibilityChange.fire())),i}dispose(){this._disposables.dispose(),this._controlDisposables.dispose()}};RJ=I([m(3,B),m(4,F),m(5,be)],RJ);W(class extends K{constructor(){super({id:"breadcrumbs.toggle",title:L(3624,"Toggle Breadcrumbs"),shortTitle:L(3625,"Breadcrumbs"),category:We.View,toggled:{condition:x.equals("config.breadcrumbs.enabled",!0),title:d(3626,null),mnemonicTitle:d(3628,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=XE.IsEnabled.bindTo(e),o=t.getValue();t.updateValue(!o),t.dispose()}});function dbi(a,i){let e=a.get(Et),o=a.get(qV).getWidget(e.activeGroup.id);if(o){let n=o.getItems().at(-1);o.setFocused(n),i&&o.setSelection(n,bc.Payload_Pick)}}W(class extends K{constructor(){super({id:"breadcrumbs.focusAndSelect",title:L(3623,"Focus and Select Breadcrumbs"),precondition:bc.CK_BreadcrumbsVisible,keybinding:{weight:200,primary:3161,when:bc.CK_BreadcrumbsPossible},f1:!0})}run(i,...e){dbi(i,!0)}});W(class extends K{constructor(){super({id:"breadcrumbs.focus",title:L(3622,"Focus Breadcrumbs"),precondition:bc.CK_BreadcrumbsVisible,keybinding:{weight:200,primary:3157,when:bc.CK_BreadcrumbsPossible},f1:!0})}run(i,...e){dbi(i,!1)}});yt.registerCommandAndKeybindingRule({id:"breadcrumbs.toggleToOn",weight:200,primary:3161,when:x.not("config.breadcrumbs.enabled"),handler:async a=>{let i=a.get(F),e=a.get(B),t=XE.IsEnabled.bindTo(e);return t.getValue()||(await t.updateValue(!0),await Pi(50)),t.dispose(),i.invokeFunction(dbi,!0)}});yt.registerCommandAndKeybindingRule({id:"breadcrumbs.focusNext",weight:200,primary:17,secondary:[2065],mac:{primary:17,secondary:[529]},when:x.and(bc.CK_BreadcrumbsVisible,bc.CK_BreadcrumbsActive),handler(a){let i=a.get(Et),t=a.get(qV).getWidget(i.activeGroup.id);t&&t.focusNext()}});yt.registerCommandAndKeybindingRule({id:"breadcrumbs.focusPrevious",weight:200,primary:15,secondary:[2063],mac:{primary:15,secondary:[527]},when:x.and(bc.CK_BreadcrumbsVisible,bc.CK_BreadcrumbsActive),handler(a){let i=a.get(Et),t=a.get(qV).getWidget(i.activeGroup.id);t&&t.focusPrev()}});yt.registerCommandAndKeybindingRule({id:"breadcrumbs.focusNextWithPicker",weight:201,primary:2065,mac:{primary:529},when:x.and(bc.CK_BreadcrumbsVisible,bc.CK_BreadcrumbsActive,rc),handler(a){let i=a.get(Et),t=a.get(qV).getWidget(i.activeGroup.id);t&&t.focusNext()}});yt.registerCommandAndKeybindingRule({id:"breadcrumbs.focusPreviousWithPicker",weight:201,primary:2063,mac:{primary:527},when:x.and(bc.CK_BreadcrumbsVisible,bc.CK_BreadcrumbsActive,rc),handler(a){let i=a.get(Et),t=a.get(qV).getWidget(i.activeGroup.id);t&&t.focusPrev()}});yt.registerCommandAndKeybindingRule({id:"breadcrumbs.selectFocused",weight:200,primary:3,secondary:[18],when:x.and(bc.CK_BreadcrumbsVisible,bc.CK_BreadcrumbsActive),handler(a){let i=a.get(Et),t=a.get(qV).getWidget(i.activeGroup.id);t&&t.setSelection(t.getFocused(),bc.Payload_Pick)}});yt.registerCommandAndKeybindingRule({id:"breadcrumbs.revealFocused",weight:200,primary:10,secondary:[2051],when:x.and(bc.CK_BreadcrumbsVisible,bc.CK_BreadcrumbsActive),handler(a){let i=a.get(Et),t=a.get(qV).getWidget(i.activeGroup.id);t&&t.setSelection(t.getFocused(),bc.Payload_Reveal)}});yt.registerCommandAndKeybindingRule({id:"breadcrumbs.selectEditor",weight:201,primary:9,when:x.and(bc.CK_BreadcrumbsVisible,bc.CK_BreadcrumbsActive),handler(a){let i=a.get(Et),t=a.get(qV).getWidget(i.activeGroup.id);t&&(t.setFocused(void 0),t.setSelection(void 0),i.activeGroup.activeEditorPane?.focus())}});yt.registerCommandAndKeybindingRule({id:"breadcrumbs.revealFocusedFromTreeAside",weight:200,primary:2051,when:x.and(bc.CK_BreadcrumbsVisible,bc.CK_BreadcrumbsActive,rc),handler(a){let i=a.get(ee),t=a.get(fo).lastFocusedList;if(!(t instanceof pO)&&!(t instanceof nu))return;let o=t.getFocus()[0];if(A.isUri(o?.resource))return i.openEditor({resource:o.resource,options:{pinned:!0}},vn);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(3621,"Copy Breadcrumbs Path"),category:We.View,precondition:bc.CK_BreadcrumbsVisible,f1:!0,menu:[{id:D.EditorTitleContext,group:"1_cutcopypaste",order:100,when:bc.CK_BreadcrumbsPossible}]})}async run(i){let e=i.get(Et),t=i.get(Wi),o=i.get(B),n=i.get(kR);if(!e.activeGroup.activeEditorPane)return;let r=await n.createOutline(e.activeGroup.activeEditorPane,2,ve.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=XE.SymbolPathSeparator.bindTo(o),p=u.getValue(c&&{resource:c})??".";u.dispose();let h=l.join(p);await t.writeText(h)}});var vYe=class extends as{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)}},GP=class extends Jd{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=VI.getInstance();this.groupTransfer=VI.getInstance();this.treeItemsTransfer=VI.getInstance();this.editorActionsToolbarDisposables=this._register(new P);this.editorActionsDisposables=this._register(new P);this.renderDropdownAsChildElement=!1;let b=this.create(e);this.contextMenuContextKeyService=this._register(this.contextKeyService.createScoped(b));let S=this._register(this.instantiationService.createChild(new Io([X,this.contextMenuContextKeyService])));this.resourceContext=this._register(S.createInstance(Fo)),this.editorPinnedContext=Zxe.bindTo(this.contextMenuContextKeyService),this.editorIsFirstContext=QEt.bindTo(this.contextMenuContextKeyService),this.editorIsLastContext=Sce.bindTo(this.contextMenuContextKeyService),this.editorStickyContext=ZL.bindTo(this.contextMenuContextKeyService),this.editorAvailableEditorIds=AO.bindTo(this.contextMenuContextKeyService),this.editorCanSplitInGroupContext=oV.bindTo(this.contextMenuContextKeyService),this.sideBySideEditorContext=hC.bindTo(this.contextMenuContextKeyService),this.groupLockedContext=ME.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(4037,null),getKeyBinding:o=>this.getKeybinding(o),actionRunner:this.editorActionsToolbarDisposables.add(new vYe(t)),anchorAlignmentProvider:()=>1,renderDropdownAsChildElement:this.renderDropdownAsChildElement,telemetrySource:"editorPart",resetMenu:D.EditorTitle,overflowBehavior:{maxItems:9,exempted:goo},highlightToggledItems:!0})),this.editorActionsToolbar.context=t,this.editorActionsToolbarDisposables.add(this.editorActionsToolbar.actionRunner.onDidRun(o=>{o.error&&!so(o.error)&&this.notificationService.error(o.error)}))}actionViewItemProvider(e,t){let o=this.groupView.activeEditorPane;if(o instanceof pa){let n=o.getActionViewItem(e,t);if(n)return n}return Ca(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=Oi(this.editorActionsToolbar),{primary:o,secondary:n}=this.prepareEditorActions(e.actions);t.setActions(yq(o),yq(n))}getEditorPaneAwareContextKeyService(){return this.groupView.activeEditorPane?.scopedContextKeyService??this.contextKeyService}clearEditorActionsToolbar(){if(!this.editorActionsEnabled)return;Oi(this.editorActionsToolbar).setActions([],[])}onGroupDragStart(e,t){if(e.target!==t)return!1;let o=this.isNewWindowOperation(e);this.groupTransfer.setData([new rI(this.groupView.id)],rI.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&&yc&&e.dataTransfer?.setData(Aa.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(4038,null,r,this.groupView.count-1)),$N(e,t,r)}return o}async onGroupDragEnd(e,t,o,n){if(this.groupTransfer.clearData(rI.prototype),e.target!==o||!n||MRt())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&&!it||e.altKey&&it)||t===this.groupView.id}doFillResourceDataTransfers(e,t,o){return e.length?(this.instantiationService.invokeFunction(Ig,e.map(n=>({editor:n,groupId:this.groupView.id})),t,{disableStandardTransfer:o}),!0):!1}onTabContextMenu(e,t,o){this.resourceContext.set(no.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===ga.ID),nTt(this.editorAvailableEditorIds,e,this.editorResolverService);let n=o;Vp(t)&&(n=new yn(Me(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"?GP.EDITOR_TAB_HEIGHT.normal:GP.EDITOR_TAB_HEIGHT.compact}getHoverTitle(e){let t=e.getTitle(2);return this.tabsModel.isPinned(e)?t:{markdown:new xe("",{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())}};GP=I([m(5,ze),m(6,F),m(7,X),m(8,_e),m(9,Ne),m(10,Ge),m(11,De),m(12,ul),m(13,oi)],GP);var dOt=class extends C{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}},eDe=class extends dOt{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)}},tDe=class extends dOt{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 sI=class extends GP{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(IJ,IJ.ID,IJ.LABEL));this.unpinEditorAction=this._register(this.instantiationService.createInstance(gF,gF.ID,gF.LABEL));this.tabResourceLabels=this._register(this.instantiationService.createInstance(Za,AP));this.tabLabels=[];this.tabActionBars=[];this.tabDisposables=[];this.dimensions={container:ai.None,available:ai.None};this.layoutScheduler=this._register(new me);this.path=ri?Ms:Lo;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(ws.addTarget(this.tabsContainer)),this.tabSizingFixedDisposables=this._register(new P),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 f9(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]=_y(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"?sI.SCROLLBAR_SIZES.default:sI.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[Gn.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;$t.stop(l),this.editorService.openEditor({resource:void 0,options:{pinned:!0,index:this.groupView.count,override:Ys.id}},this.groupView.id)}));this._register(j(e,re.MOUSE_DOWN,s=>{s.button===1&&s.preventDefault()})),Wn&&this._register(j(e,re.MOUSE_UP,s=>{s.button===1&&s.preventDefault()}));let o,n=!1;this._register(new Om(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(Wf.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(rI.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<sI.MOUSE_WHEEL_EVENT_THRESHOLD-2*(Math.abs(s.deltaX)+Math.abs(s.deltaY)))return;this.lastMouseWheelEventTime=c;let u;if(s.deltaX+s.deltaY<-sI.MOUSE_WHEEL_DISTANCE_THRESHOLD)u=-1;else if(s.deltaX+s.deltaY>sI.MOUSE_WHEEL_DISTANCE_THRESHOLD)u=1;else return;let p=this.groupView.getEditorByIndex(this.groupView.getIndexOfEditor(l)+u);p&&(this.groupView.openEditor(p),$t.stop(s,!0))}));let r=s=>{$t.stop(s);let l=e;Vp(s)&&(l=new yn(Me(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,Gn.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]=_y(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=Oi(this.tabsContainer);for(;e.children.length>this.tabsModel.count;)e.lastChild?.remove(),Ue(this.tabDisposables.pop());this.computeTabLabels(),this.redraw({forceRevealActiveTab:!0})}else this.tabsContainer&&Rt(this.tabsContainer),this.tabDisposables=Ue(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||!uo(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=Oi(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=ws.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 vYe({groupId:this.groupView.id,get editorIndex(){return u.toEditorIndex(e)}}),h=new ji(c,{ariaLabel:d(4043,null),actionRunner:p}),g=h.onWillRun(y=>{y.action.id===this.closeEditorAction.id&&this.blockRevealActiveTabOnce()}),f=hn(p,h,g,Z(Zm(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(hn(r,S,f,l)),n}toEditorIndex(e){let t=Oi(this.tabsModel.getEditorByIndex(e));return this.groupView.getIndexOfEditor(t)}registerTabListeners(e,t,o,n){let r=new P,s=async(p,h)=>{if(e.blur(),Vp(p)&&(p.button!==0||it&&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=Oi(this.groupView.activeEditor);this.lastSingleSelectSelectedEditor=v,f=v}await this.selectEditorsBetween(g,f)}else if(p.ctrlKey&&!it||p.metaKey&&it)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=>{$t.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,Gn.Tap,p=>s(p,!0))),r.add(j(e,Gn.Change,p=>{n.setScrollPosition({scrollLeft:n.getScrollPosition().scrollLeft-p.translationX})})),r.add(j(e,re.MOUSE_UP,async p=>{if($t.stop(p),e.blur(),Vp(p)&&(p.button!==0||it&&p.ctrlKey)||this.originatesFromTabActionBar(p))return;!(p.ctrlKey&&!it||p.metaKey&&it)&&!p.shiftKey&&this.groupView.selectedEditors.length>1&&await this.unselectAllEditors()})),r.add(j(e,re.AUXCLICK,p=>{if(p.button===1){$t.stop(p,!0);let h=this.tabsModel.getEditorByIndex(t);if(h){if(zxe(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 Ii(p);h.shiftKey&&h.keyCode===68&&l(p)})),r.add(j(e,Gn.Contextmenu,p=>{l(p)})),r.add(j(e,re.KEY_UP,p=>{let h=new Ii(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&&$t.stop(p,!0),n.setScrollPosition({scrollLeft:o.scrollLeft})}));for(let p of[Gn.Tap,re.DBLCLICK])r.add(j(e,p,h=>{if(p===re.DBLCLICK)$t.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=>{$t.stop(p,!0);let h=this.tabsModel.getEditorByIndex(t);h&&this.onTabContextMenu(h,p,e)},!0));let c,u=!1;return r.add(new Om(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 Wf({editor:f,groupId:this.groupView.id})),Wf.prototype),p.dataTransfer)if(p.dataTransfer.effectAllowed="copyMove",g.length>1){let f=`${h.getName()} + ${g.length-1}`;$N(p,e,f)}else p.dataTransfer.setDragImage(e,0,0);this.doFillResourceDataTransfers(g,p,u),$r(Me(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(Wf.prototype)||p.dataTransfer&&(p.dataTransfer.dropEffect="copy"),this.updateDropFeedback(e,!0,p,t)},onDragOver:(p,h)=>{if(h>=sI.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(Wf.prototype);if(this.editorTransfer.clearData(Wf.prototype),!u||MRt()||!h||h.length===0)return;let g=await this.maybeCreateAuxiliaryEditorPartAt(p,e);if(!g)return;let f=g.activeGroup,v=ZY(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(rI.prototype)){let t=this.groupTransfer.getData(rI.prototype);return!(Array.isArray(t)&&t.length>0&&t[0].identifier===this.groupView.id)}return!!(this.editorTransfer.hasData(Wf.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 ni;let n=this.groupView.getIndexOfEditor(t);if(n===-1)throw new ni;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=Oi(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=Oi(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:JY(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"?$H(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)$H(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),$H(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=wIe(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(H9i);!t&&Ug(this.theme.type)&&(t=this.getColor(h8e)||this.getColor(gi)),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=sI.TAB_WIDTH.compact;break;case"shrink":v=sI.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:no.getOriginalUri(e,{supportSideBySide:3})},{title:this.getHoverTitle(e),extraClasses:si(["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=no.getOriginalUri(e,{supportSideBySide:1});f?o.setAttribute("data-resource-name",Ra(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?Lxe:A9i);n.classList.toggle("tab-border-bottom",!!u),n.style.setProperty("--tab-border-bottom-color",u??"")}let c=null;t&&(s&&(c=this.getColor(e?m8e:N9i)),c===null&&l&&(c=this.getColor(O9i))),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(Rxe):e&&!t?s=this.getColor(mEt):!e&&t?s=this.getColor(W9i):s=this.getColor(V9i),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(P9i):void 0)||this.getColor(h8e)||this.getColor(gi);t.style.borderRight=s?`1px solid ${s}`:"",t.style.outlineColor=this.getColor(qs)||""}prepareEditorActions(e){return this.groupsView.activeGroup===this.groupView?e:{primary:this.groupsView.partOptions.alwaysShowEditorActions?e.primary:e.primary.filter(o=>o.id===H5),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=$r(Me(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 ai(e.container.width,this.computeHeight())),this.dimensions.used}doLayout(e,t){e.container!==ai.None&&e.available!==ai.None&&this.doLayoutTabs(e,t);let o=this.dimensions.used,n=this.dimensions.used=new ai(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]=_y(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]=_y(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=sI.TAB_WIDTH.compact;break;case"shrink":T=sI.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<sI.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(){Oi(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 Oi(this.tabsContainer).children[e]}getLastTab(){return this.getTabAtIndex(this.tabsModel.count-1)}blockRevealActiveTabOnce(){this.blockRevealActiveTab=!0}originatesFromTabActionBar(e){let t;return Vp(e)?t=e.target||e.srcElement:t=e.initialTarget,!!Nh(t,"action-item","tab")}async onDrop(e,t,o){$t.stop(e,!0),this.updateDropFeedback(o,!1,e,t),o.classList.remove("scroll");let n=this.tabsModel instanceof tDe?t+this.groupView.stickyCount:t,r={sticky:this.tabsModel instanceof eDe&&this.tabsModel.stickyCount===n,index:n};if(this.groupTransfer.hasData(rI.prototype)){let s=this.groupTransfer.getData(rI.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(rI.prototype)}}else if(this.editorTransfer.hasData(Wf.prototype)){let s=this.editorTransfer.getData(Wf.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(Wf.prototype)}else if(this.treeItemsTransfer.hasData(sC.prototype)){let s=this.treeItemsTransfer.getData(sC.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 RRt(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(sC.prototype)}else this.instantiationService.createInstance(sF,{allowWorkspaceOpen:!1}).handleDrop(e,Me(this.parent),()=>this.groupView,()=>this.groupView.focus(),r)}dispose(){super.dispose(),this.tabDisposables=Ue(this.tabDisposables)}};sI=I([m(5,ze),m(6,F),m(7,X),m(8,_e),m(9,Ne),m(10,Ge),m(11,De),m(12,ee),m(13,wn),m(14,Yq),m(15,ul),m(16,oi)],sI);is((a,i)=>{let e=a.getColor(h8e);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(qs);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(gi);o&&i.addRule(`
			.monaco-workbench .part.editor > .content .editor-group-container > .title .editor-actions {
				outline: 1px solid ${o}
			}
		`);let n=a.getColor(dEt);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(R9i);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(uEt);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(M9i);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(pEt);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(F9i);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};
			}
		`),!Ug(a.type)&&!Vb&&!t){let p=DO(a),h=a.getColor(qo),g=a.getColor(fEt),f=a.getColor(_E),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,U=!1)=>`
			.monaco-workbench .part.editor > .content:not(.dragged-over) .editor-group-container${U?".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${U?".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${U?".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${U?".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,U,G)=>`
				.monaco-workbench .part.editor > .content:not(.dragged-over) .editor-group-container${U?".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${U?".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${U?".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${U?".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(gEt);if(w&&v&&b){let O=w.flatten(v),V=w.flatten(b);i.addRule(y(O,V,!0,!0))}let k=a.getColor(_9i);if(k&&v&&b){let O=k.flatten(v),V=k.flatten(b);i.addRule(y(O,V,!1,!0))}let T=a.getColor(Zci);if(T&&v&&b){let O=T.flatten(v),V=T.flatten(b);i.addRule(y(O,V,!0,!1))}let N=a.getColor(D9i);if(N&&v&&b){let O=N.flatten(v),V=N.flatten(b);i.addRule(y(O,V,!1,!1))}}});var uOt=class extends GP{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(ws.addTarget(t));let o=_(".label-container");return t.appendChild(o),this.editorLabel=this._register(this.instantiationService.createInstance(rk,o,{})).element,this._register(j(this.editorLabel.element,re.CLICK,n=>this.onTitleLabelClick(n))),this.breadcrumbsControlFactory=this._register(this.instantiationService.createInstance(RJ,o,this.groupView,{showFileIcons:!1,showSymbolIcons:!0,showDecorationColors:!1,widgetStyles:{...f1,breadcrumbsBackground:Oe.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 Om(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,Gn.Tap,n=>this.onTitleTap(n)));for(let n of[re.CONTEXT_MENU,Gn.Contextmenu])this._register(j(e,n,r=>{this.tabsModel.activeEditor&&this.onTabContextMenu(this.tabsModel.activeEditor,r,e)}))}onTitleLabelClick(e){$t.stop(e,!1),setTimeout(()=>this.quickInputService.quickAccess.show())}onTitleDoubleClick(e){$t.stop(e),this.groupView.pinEditor()}onTitleAuxClick(e){e.button===1&&this.tabsModel.activeEditor&&($t.stop(e,!0),zxe(this.tabsModel,this.tabsModel.activeEditor,2,this.groupsView.partOptions)||this.groupView.closeEditor(this.tabsModel.activeEditor))}onTitleTap(e){let t=e.initialTarget;!Ao(t)||!this.editorLabel||!gs(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=Oi(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||!uo(e.decorations,t.decorations))&&this.redraw()}updateStyles(){this.redraw()}handleBreadcrumbsEnablementChange(){Oi(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]=_y(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:no.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(ZW)||"":r.style.color=this.getColor(L9i)||"",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===OC||o.id===H5),secondary:e.secondary}}getHeight(){return this.tabHeight}layout(e){return this.breadcrumbsControl?.layout(void 0),new ai(e.container.width,this.getHeight())}};var iDe=class extends C{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 eDe(this.model)),c=this._register(new tDe(this.model));this.stickyEditorTabsControl=this._register(this.instantiationService.createInstance(sI,this.parent,t,this.groupsView,this.groupView,l)),this.unstickyEditorTabsControl=this._register(this.instantiationService.createInstance(sI,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 ai(e.available.width,e.available.height-t.height)},n=this.unstickyEditorTabsControl.layout(o);return new ai(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()}};iDe=I([m(5,F)],iDe);var pOt=class extends GP{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 ai(e.container.width,this.getHeight())}};var oDe=class extends Jd{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 P);this.breadcrumbsControlDisposables=this._register(new P);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=pOt;break;case"single":e=uOt;break;default:e=this.groupsView.partOptions.pinnedTabsOnSeparateRow?iDe:sI;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(RJ,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 ai(e.container.width,bc.HEIGHT),this.breadcrumbsControl.layout(o)),new ai(e.container.width,t.height+(o?o.height:0))}getHeight(){let e=this.editorTabsControl.getHeight(),t=this.breadcrumbsControl?.isHidden()===!1?bc.HEIGHT:0;return{total:e+t,offset:e}}};oDe=I([m(5,F),m(6,De)],oDe);var Uf=class extends Jd{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N,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=N;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 wM(e=>this.handleDisposedEditors(e),0));this.mapEditorToPendingConfirmation=new Map;this.containerToolBarMenuDisposable=this._register(new me);this.whenRestoredPromise=new Go;this.whenRestored=this.whenRestoredPromise.p;this._disposed=!1;this.element=_("div");this._onDidChange=this._register(new Mh);this.onDidChange=this._onDidChange.event;e instanceof Uf?this.model=this._register(e.model.clone()):OQe(e)?this.model=this._register(l.createInstance(yP,e)):this.model=this._register(l.createInstance(yP,void 0)),this.scopedContextKeyService=this._register(this.contextKeyService.createScoped(this.element)),this.element.classList.add(...si(["editor-group-container",this.model.isLocked?"locked":void 0])),this.registerContainerListeners(),this.createContainerToolbar(),this.createContainerContextMenu(),this._register(this.instantiationService.createInstance(xR,this.element)),this.progressBar=this._register(new fb(this.element,kx)),this.progressBar.hide(),this.scopedInstantiationService=this._register(this.instantiationService.createChild(new Io([X,this.scopedContextKeyService],[rd,this._register(new uRt(this.progressBar,this))]))),this.resourceContext=this._register(this.scopedInstantiationService.createInstance(Fo)),this.handleGroupContextKeys(),this.titleContainer=_(".title"),this.element.appendChild(this.titleContainer),this.titleControl=this._register(this.scopedInstantiationService.createInstance(oDe,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(j_e,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(Uf,null,e,t,o,n,s)}static createFromSerialized(e,t,o,n,r,s,l){return s.createInstance(Uf,e,t,o,n,r,l)}static createCopy(e,t,o,n,r,s,l){return s.createInstance(Uf,e,t,o,n,r,l)}handleGroupContextKeys(){let e=this.editorPartsView.bind(bce,this),t=this.editorPartsView.bind(Zxe,this),o=this.editorPartsView.bind(QEt,this),n=this.editorPartsView.bind(Sce,this),r=this.editorPartsView.bind(ZL,this),s=this.editorPartsView.bind(JEt,this),l=this.editorPartsView.bind(ME,this),c=Oj.bindTo(this.scopedContextKeyService),u=ZEt.bindTo(this.scopedContextKeyService),p=eTt.bindTo(this.scopedContextKeyService),h=this.editorPartsView.bind(fr,this),g=this.editorPartsView.bind(eYi,this),f=this.editorPartsView.bind(XEt,this),v=this.editorPartsView.bind(YEt,this),b=this.editorPartsView.bind(eke,this),S=this.editorPartsView.bind(M8e,this),y=this.editorPartsView.bind(tS,this),w=this.editorPartsView.bind(AO,this),k=this.editorPartsView.bind(oV,this),T=this.editorPartsView.bind(hC,this),N=this._register(new me),O=()=>{N.clear(),this.scopedContextKeyService.bufferChangeEvents(()=>{let U=this.activeEditor,G=this.activeEditorPane;if(this.resourceContext.set(no.getOriginalUri(U,{supportSideBySide:1})),nTt(w,U,this.editorResolverService),U?(k.set(U.hasCapability(32)),T.set(U.typeId===ga.ID),e.set(U.isDirty()&&!U.isSaving()),N.value=U.onDidChangeDirty(()=>{e.set(U.isDirty()&&!U.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 $=no.getOriginalUri(G.input,{supportSideBySide:1}),te=no.getOriginalUri(G.input,{supportSideBySide:2});b.set(G.input instanceof Fa&&!G.input.original.isReadonly()&&!!$&&(this.fileService.hasProvider($)||$.scheme===Y.untitled)&&!!te&&(this.fileService.hasProvider(te)||te.scheme===Y.untitled)),v.set(!!$&&this.fileService.hasProvider($)&&!this.fileService.hasCapability($,2048));let pe=G?.getId()===SY;y.set(pe),S.set(pe)}else h.reset(),f.reset(),g.reset(),b.reset(),v.reset()})},V=U=>{switch(U.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:U.editor&&U.editor===this.model.activeEditor&&t.set(this.model.isPinned(this.model.activeEditor));break;case 13:U.editor&&U.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===Y.untitled)));break}s.set(this.count)};this._register(this.onDidModelChange(U=>V(U))),this._register(this.onDidActiveEditorChange(()=>O())),O(),V({kind:8}),V({kind:3})}registerContainerListeners(){this._register(j(this.element,re.DBLCLICK,e=>{this.isEmpty&&($t.stop(e),this.editorService.openEditor({resource:void 0,options:{pinned:!0,override:Ys.id}},this.id))})),this._register(j(this.element,re.AUXCLICK,e=>{this.isEmpty&&e.button===1&&($t.stop(e,!0),this.groupsView.removeGroup(this))}))}createContainerToolbar(){let e=_(".editor-group-container-toolbar");this.element.appendChild(e);let t=this._register(new ji(e,{ariaLabel:d(3940,null),highlightToggledItems:!0})),o=this._register(this.menuService.createMenu(D.EmptyEditorGroup,this.scopedContextKeyService)),n=()=>{this.containerToolBarMenuDisposable.value=Z(()=>t.clear());let r=hl(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,Gn.Contextmenu,()=>this.onShowContainerContextMenu()))}onShowContainerContextMenu(e){if(!this.isEmpty)return;let t=this.element;e&&(t=new yn(Me(this.element),e)),this.contextMenuService.showContextMenu({menuId:D.EmptyEditorGroupContext,contextKeyService:this.contextKeyService,getAnchor:()=>t,onHide:()=>this.focus()})}doTrackFocus(){let e=this._register(Vn(this.element));this._register(e.onDidFocus(()=>{this.isEmpty&&this._onDidFocus.fire()}));let t=o=>{let n;if(Vp(o)){if(o.button!==0||it&&o.ctrlKey)return;n=o.target}else n=o.initialTarget;Nh(n,"monaco-action-bar",this.titleContainer)||Nh(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,Gn.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(3941,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 Uf?o=uui(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=Pn(),l=this.doShowEditor(n,{active:!0,isNew:!1},o,r).then(()=>{this.groupsView.activeGroup===this&&s&&sa(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:kXi(e)&&this.onDidOpenEditor(e.editor,e.editorIndex);break;case 6:TXi(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 ga&&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 Uf&&t.model.contains(e,{strictEquals:!0,supportSideBySide:4}))return!1;return!0}toResourceTelemetryDescriptor(e){if(!e)return;let t=e?e.scheme===Y.file?e.fsPath:e.path:void 0;if(!t)return;let o=ms(e),n=o.indexOf("?");return o=n!==-1?o.substr(0,n):o,{mimeType:new Im(JEe(e).join(", ")),scheme:e.scheme,ext:o,path:Ir(t)}}toEditorTelemetryDescriptor(e){let t=e.getTelemetryDescriptor(),o=no.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(3945,null,this.groupsLabel,this._index+1):d(3944,null,this._index+1)}get ariaLabel(){return this.groupsLabel?d(3943,null,this.groupsLabel,this._index+1):d(3942,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&&Xe(n.resource,o))return!0;if(t?.supportSideBySide===1||t?.supportSideBySide===4){let r=no.getCanonicalUri(n,{supportSideBySide:1});if(r&&Xe(r,o))return!0}if(t?.supportSideBySide===2||t?.supportSideBySide===4){let r=no.getCanonicalUri(n,{supportSideBySide:2});if(r&&Xe(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=si(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 fn.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(3946,null)),!1}let s=uui(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=Pn();return t===e.ownerDocument.body?!0:gs(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 ga&&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 ga&&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):kr&&(ri||Wn)&&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(Me(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 ga?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 pa){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=hl(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(B9i)||"":this.element.style.backgroundColor="";let t=this.getColor(z9i)||this.getColor(gi);!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"?fEt:U9i)||"",this.editorContainer.style.backgroundColor=this.getColor(qo)||""}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 ai(e,t),available:new ai(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()}};Uf=I([m(6,F),m(7,X),m(8,De),m(9,Te),m(10,_e),m(11,qt),m(12,ze),m(13,dn),m(14,ee),m(15,lr),m(16,dt),m(17,ne),m(18,ul),m(19,oi),m(20,ct),m(21,be)],Uf);function yno(a){return a.getValue("editor.dropIntoEditor.enabled")}function wno(a){return a.shiftKey}var kue=class extends Jd{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=VI.getInstance();this.groupTransfer=VI.getInstance();this.treeItemsTransfer=VI.getInstance();this.cleanupOverlayScheduler=this._register(new Dt(()=>this.dispose(),300)),this.enableDropIntoEditor=yno(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:kue.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=RL(d(3939,null,it?"\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=Oi(this.overlay);e.style.backgroundColor=this.getColor(_E)||"";let t=this.getColor(qs);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(G9i)??"",this.dropIntoPromptElement.style.color=this.getColor(K9i)??"";let o=this.getColor($9i);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 Om(e,{onDragOver:t=>{if(this.enableDropIntoEditor&&wno(t)){this.dispose();return}let o=this.groupTransfer.hasData(rI.prototype),n=this.editorTransfer.hasData(Wf.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(Wf.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=>{$t.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(rI.prototype)){let e=this.groupTransfer.getData(rI.prototype);if(Array.isArray(e)&&e.length>0)return this.editorGroupService.getGroup(e[0].identifier)}else if(this.editorTransfer.hasData(Wf.prototype)){let e=this.editorTransfer.getData(Wf.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(rI.prototype)){let n=this.groupTransfer.getData(rI.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(rI.prototype)}}else if(this.editorTransfer.hasData(Wf.prototype)){let n=this.editorTransfer.getData(Wf.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=ZY(this.groupView,r.map(h=>h.identifier.editor));c?l.copyEditors(p,u):l.moveEditors(p,u)}u.focus()}this.editorTransfer.clearData(Wf.prototype)}}else if(this.treeItemsTransfer.hasData(sC.prototype)){let n=this.treeItemsTransfer.getData(sC.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 RRt(l);r.push(...c.map(u=>({...u,options:{...u.options,pinned:!0}})))}}r.length&&this.editorService.openEditors(r,o(),{validateTrust:!0})}this.treeItemsTransfer.clearData(sC.prototype)}else this.instantiationService.createInstance(sF,{allowWorkspaceOpen:!Gt||xx(this.contextService.getWorkspace())}).handleDrop(e,Me(this.groupView.element),()=>o(),r=>r?.focus())}isCopyOperation(e,t){return t?.editor.hasCapability(8)?!1:e.ctrlKey&&!it||e.altKey&&it}isToggleSplitOperation(e){return e.altKey&&!it||e.shiftKey&&it}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=Oi(this.overlay);b.style.opacity="1",setTimeout(()=>b.classList.add("overlay-move-transition"),0),this.currentDropOperation={splitDirection:v}}doPositionOverlay(e){let[t,o]=_y(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=Oi(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}};kue=I([m(1,De),m(2,B),m(3,F),m(4,ee),m(5,Et),m(6,Yq),m(7,Pe)],kue);var nDe=class extends Jd{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=VI.getInstance();this.groupTransfer=VI.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,Me(this.container)])this._register(j(e,re.DRAG_END,()=>this.onDragEnd()))}onDragEnter(e){if(yno(this.configurationService)&&wno(e))return;if(this.counter++,!this.editorTransfer.hasData(Wf.prototype)&&!this.groupTransfer.hasData(rI.prototype)&&e.dataTransfer){let o=oe.as(mW.DragAndDropContribution).getAll(),n=Array.from(o).map(r=>r.dataFormatKey);if(!gu(e,Aa.FILES,Ll.FILES,Aa.RESOURCES,Ll.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(kue,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=>gs(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)}};nDe=I([m(3,Et),m(4,De),m(5,B),m(6,F)],nDe);var bYe={targetWidth:900,leftMarginRatio:.1909,rightMarginRatio:.1909},ubi={type:"distribute"};function Cno(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:H.None}}function Jqo(a,i){return{element:a.element,get maximumSize(){return a.maximumWidth},get minimumSize(){return a.minimumWidth},onDidChange:H.map(a.onDidChange,e=>e&&e.width),layout:(e,t,o)=>a.layout(e,i(),o?.top??0,(o?.left??0)+t)}}var mOt=class{constructor(i,e,t={...bYe},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 P;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 vu(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={...bYe},this.resizeSplitViews()})),this.splitView.layout(this.lastLayoutPosition.width,this.lastLayoutPosition);let e=this.style?this.style.background:void 0;this.emptyViews=[Cno(e),Cno(e)],this.splitView.addView(this.emptyViews[0],ubi,0),this.splitView.addView(Jqo(this.view,()=>this.lastLayoutPosition.height),ubi,1),this.splitView.addView(this.emptyViews[1],ubi,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===bYe.targetWidth:i.leftMarginRatio===bYe.leftMarginRatio&&i.rightMarginRatio===bYe.rightMarginRatio}dispose(){this.splitViewDisposables.dispose(),this.splitView&&(this.splitView.dispose(),this.splitView=void 0)}};function Eue(a,i,e){let t=a.get(Et),o=a.get(B),n=tjo(i,e,t,o);return n instanceof Promise?n.then(r=>xno(r,i,e,t,o)):xno(n,i,e,t,o)}function xno(a,i,e,t,o){let n=t.activeModalEditorPart,r=o.getValue("workbench.editor.useModal");return n&&e!==ym&&r!=="all"&&(a=Zqo(a,i,n,t)),ejo(a,i,e,t)}function Zqo(a,i,e,t){let o=i.options;return e.groups.some(n=>n.id===a.id)&&(a=t.mainPart.activeGroup),o?.preserveFocus||e.close(),a}function ejo(a,i,e,t){let o;return t.activeGroup!==a&&i.options&&!i.options.inactive&&i.options.preserveFocus&&typeof i.options.activation!="number"&&e!==vn&&(o=1),[a,o]}function tjo(a,i,e,t){let o,n=tV(a)?a.editor:a,r=a.options;if(i&&typeof i!="number")o=i;else if(typeof i=="number"&&i>=0)o=e.getGroup(i);else if(i===vn){let s=pC(t),l=e.findGroup({direction:s});(!l||hOt(l,n))&&(l=e.addGroup(e.activeGroup,s)),o=l}else if(i===hg)o=e.createAuxiliaryEditorPart(r?.auxiliary).then(s=>s.activeGroup);else if(i===ym&&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(ijo(l,n)){o=l;break}}if(!o&&(r?.revealIfOpened||t.getValue("workbench.editor.revealIfOpen")||Ta(n)&&(n.hasCapability(1024)||n.hasCapability(8)))){let l,c;for(let u of s)if(kno(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(hOt(s,n)){for(let l of e.getGroups(1))if(!hOt(l,n)){s=l;break}hOt(s,n)?o=e.addGroup(s,pC(t)):o=s}else o=s}return o}function hOt(a,i){return!(!a.isLocked||kno(a,i))}function ijo(a,i){return a.activeEditor?a.activeEditor.matches(i):!1}function kno(a,i){for(let e of a.editors)if(e.matches(i))return!0;return!1}var pbi=class{constructor(){this.element=_(".grid-view-container");this._onDidChange=new Mh;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=H.None,this._gridWidget=i}layout(i,e,t,o){this.gridWidget?.layout(i,e,t,o)}dispose(){this._onDidChange.dispose()}},ck=class extends cy{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 Pm);this.onDidAddGroup=this._onDidAddGroup.event;this._onDidRemoveGroup=this._register(new Pm);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 Mh);this.onDidChangeSizeConstraints=H.any(this.onDidSetGridWidget.event,this._onDidChangeSizeConstraints.event);this._onDidScroll=this._register(new Mh);this.onDidScroll=H.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 P);this.gridWidgetView=this._register(new pbi);this.enforcedPartOptions=[];this.top=0;this.left=0;this.sideGroup={openEditor:(e,t)=>{let[o]=this.scopedInstantiationService.invokeFunction(n=>Eue(n,{editor:e,options:t},vn));return o.openEditor(e,t)}};this._isReady=!1;this.whenReadyPromise=new Go;this.whenReady=this.whenReadyPromise.p;this.whenRestoredPromise=new Go;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 Io([X,this.scopedContextKeyService]))),this._partOptions=dui(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){xXi(e)&&this.handleChangedPartOptions()}handleChangedPartOptions(){let e=this._partOptions,t=dui(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[ck.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=si(this.mostRecentActiveGroups.map(o=>this.getGroup(o)));return Uo([...t,...this.groups])}case 2:{let t=[];return this.gridWidget&&this.fillGridNodes(t,this.gridWidget.getViews()),t}}}fillGridNodes(e,t){oJ(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(Me(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=tfi({orientation:this.toGridViewOrientation(e.orientation,this.isTwoDimensionalGrid()?this.gridWidget.orientation:BP(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?Pn()===e.ownerDocument.body?!0:ts(e):!1}isTwoDimensionalGrid(){let e=this.gridWidget.getViews();return oJ(e)?e.children.some(t=>oJ(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 JTe.Distribute;case"split":return JTe.Split;default:return JTe.Auto}}doCreateGroupView(e,t){let o;e instanceof Uf?o=Uf.createCopy(e,this.editorPartsView,this,this.groupsLabel,this.count,this.scopedInstantiationService,t):OQe(e)?o=Uf.createFromSerialized(e,this.editorPartsView,this,this.groupsLabel,this.count,this.scopedInstantiationService,t):o=Uf.createNew(this.editorPartsView,this,this.groupsLabel,this.count,this.scopedInstantiationService,t),this.groupViews.set(o.id,o);let n=new P;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()})),H.once(o.onWillDispose)(()=>{Ue(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 So(Ao(e)),this.scopedInstantiationService.createInstance(nDe,this,e,t)}get minimumWidth(){return Math.min(this.centeredLayoutWidget.minimumWidth,this.layoutService.getMaximumEditorDimensions(this.layoutService.getContainer(Me(this.container))).width)}get maximumWidth(){return this.centeredLayoutWidget.maximumWidth}get minimumHeight(){return Math.min(this.centeredLayoutWidget.minimumHeight,this.layoutService.getMaximumEditorDimensions(this.layoutService.getContainer(Me(this.container))).height)}get maximumHeight(){return this.centeredLayoutWidget.maximumHeight}get snap(){return this.layoutService.getPanelAlignment()==="center"}get onDidChange(){return H.any(this.centeredLayoutWidget.onDidChange,this.onDidSetGridWidget.event)}get gridSeparatorBorder(){return this.theme.getColor(vEt)||this.theme.getColor(gi)||Oe.transparent}updateStyles(){this.container.style.backgroundColor=this.getColor(qo)||"";let e={separatorBorder:this.gridSeparatorBorder,background:this.theme.getColor(g8e)||Oe.transparent};this.gridWidget.style(e),this.centeredLayoutWidget.styles(e)}createContentArea(e,t){return this.element=e,this.windowId!==It.vscodeWindowId&&this.container.classList.add("auxiliary"),e.appendChild(this.container),this._willRestoreState=!t||t.restorePreviousState,this.doCreateGridControl(),this.centeredLayoutWidget=this._register(new mOt(this.container,this.gridWidgetView,this.profileMemento[ck.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,fn.settled(this.groups.map(o=>o.whenRestored)).finally(()=>{this.whenRestoredPromise.complete()}),this.container}handleContextKeys(){let e=Fj.bindTo(this.scopedContextKeyService),t=nV.bindTo(this.scopedContextKeyService),o=dz.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(C$(o,()=>o.classList.remove("visible"))),this._register(KE.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(KE.INSTANCE.registerTarget(o,{onDragOver:p=>{$t.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 O5(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=O5.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(ai.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[ck.EDITOR_PART_UI_STATE_STORAGE_KEY]:this.workspaceMemento[ck.EDITOR_PART_UI_STATE_STORAGE_KEY]=this.createState()),this.centeredLayoutWidget){let e=this.centeredLayoutWidget.state;this.centeredLayoutWidget.isDefault(e)?delete this.profileMemento[ck.EDITOR_PART_CENTERED_VIEW_STORAGE_KEY]:this.profileMemento[ck.EDITOR_PART_CENTERED_VIEW_STORAGE_KEY]=e}super.saveState()}loadState(){return this.workspaceMemento[ck.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()}};ck=I([m(4,F),m(5,De),m(6,B),m(7,le),m(8,fi),m(9,oi),m(10,X)],ck);var rDe=class extends ck{constructor(i,e,t,o,n,r,s,l){super(i,"workbench.parts.editor","",It.vscodeWindowId,e,t,o,n,r,s,l)}};rDe=I([m(1,F),m(2,De),m(3,B),m(4,le),m(5,fi),m(6,oi),m(7,X)],rDe);async function Tno(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 _no(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 Dno(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 ojo=d(2112,null),njo=d(2110,null),rjo=d(2111,null),gOt={open:ojo,close:njo,find:rjo};async function Lno(a,i){let e=[];return await Rno(a,e,i.logsHome,i.logsHome),e}async function Rno(a,i,e,t){let o=await a.resolve(e);for(let{resource:n,isDirectory:r}of o.children||[])if(r)await Rno(a,i,n,t);else{let s=(await a.readFile(n)).value.toString();if(s){let l=Fc(t,n);l&&i.push({relativePath:l,contents:s})}}}var SYe=class{constructor(i,e,t,o){this.fileService=i;this.environmentService=e;this.lifecycleService=t;this.logService=o}async getLogs(){return Lno(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 oe.as(Qi.Workbench).whenRestored,this.logService.info("[driver] Workbench contributions created.")}async setValue(i,e){let t=It.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(It.document.querySelector(i)!==It.document.activeElement){let t=[],o=It.document.activeElement;for(;o;){let n=o.tagName,r=o.id?`#${o.id}`:"",s=si(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=It.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}=gN(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=It.document.querySelector(i);if(!t)throw new Error(`Editor not found: ${i}`);if(r7t(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(L6(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=It.document.querySelector(i);if(!e)throw new Error(`Editor not found: ${i}`);if(r7t(e)){let t=e.editContext;if(!t)throw new Error(`Edit context not found: ${i}`);return{selectionStart:t.selectionStart,selectionEnd:t.selectionEnd}}else{if(L6(e))return{selectionStart:e.selectionStart,selectionEnd:e.selectionEnd};throw new Error(`Unknown type of element: ${i}`)}}async getTerminalBuffer(i){let e=It.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=It.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:Dr,locale:abe})}getLocalizedStrings(){return Promise.resolve({open:gOt.open,close:gOt.close,find:gOt.find})}async _getElementXY(i,e){let t=It.document.querySelector(i);if(!t)return Promise.reject(new Error(`Element not found: ${i}`));let{left:o,top:n}=gN(t),{width:r,height:s}=Fm(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}}};SYe=I([m(0,be),m(1,Co),m(2,ao),m(3,ne)],SYe);function fOt(a){Object.assign(It,{driver:a.createInstance(SYe)})}var tD=class extends C{constructor(e,t={getWindowsCount:Kbe,getWindows:Gw},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(Me(this)),t.apply(this,[n])}}onElementFocus(e){!e.document.hasFocus()&&wzi()&&(e.focus(),!this.environmentService.extensionTestsLocationURI&&!e.document.hasFocus()&&this.hostService.focus(e))}enableMultiWindowAwareTimeout(e,t={getWindowsCount:Kbe,getWindows:Gw}){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=tD.TIMEOUT_HANDLES++;tD.TIMEOUT_DISPOSABLES.set(u,c);let p=wd(r,()=>{Ue(c),tD.TIMEOUT_DISPOSABLES.delete(u)});for(let{window:h,disposables:g}of t.getWindows()){if(Cy(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"?tD.TIMEOUT_DISPOSABLES.get(r):void 0;s?(Ue(s),tD.TIMEOUT_DISPOSABLES.delete(r)):n.apply(this,[r])}}static async confirmOnShutdown(e,t){let o=e.get(ct),n=e.get(B),r=t===2?it?d(4273,null):d(4272,null):d(4263,null),s=t===2?it?d(4271,null):d(4265,null):d(4262,null),l=await o.confirm({message:r,primaryButton:s,checkbox:{label:d(4264,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=qv(e);n&&s$(o,n.window)}}))}registerContextMenuListeners(e){if(e!==It)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)))}};tD=I([m(2,oi),m(3,Vt),m(4,ze),m(5,fi)],tD);var vOt=class extends tD{constructor(e,t,o,n,r,s,l,c,u,p){super(It,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=Nc&&It.visualViewport?It.visualViewport:It;this._register(j(e,re.RESIZE,()=>{this.layoutService.layout(),Nc&&It.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=>$t.stop(t,!0))),this._register(j(this.layoutService.mainContainer,re.DROP,t=>$t.stop(t,!0)))}onWillShutdown(){H.toPromise(H.any(H.once(new On(It.document.body,re.KEY_DOWN,!0).event),H.once(new On(It.document.body,re.MOUSE_DOWN,!0).event))).then(async()=>{await Pi(3e3),await this.dialogService.prompt({type:gt.Error,message:d(4276,null),detail:d(4277,null),buttons:[{label:d(4274,null),run:()=>It.location.reload()}]})})}create(){this.setupOpenHandlers(),this.registerLabelFormatters(),this.registerCommands(),this.setupDriver()}setupDriver(){this.environmentService.enableSmokeTestDriver&&fOt(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(jd(e,Y.http)||jd(e,Y.https))Vb?Pzi(e,!t)||await this.dialogService.prompt({type:gt.Warning,message:d(4278,null),custom:{markdownDetails:[{markdown:new xe(d(4279,null,"https://aka.ms/allow-vscode-popup"),!0)}]},buttons:[{label:d(4275,null),run:()=>t?l7t(e):PGe(e)}],cancelButton:!0}):t?l7t(e):PGe(e);else{let o=()=>{this.lifecycleService.withExpectedShutdown({disableShutdownHandling:!0},()=>It.location.href=e)};o();let n=async()=>{let{downloadUrl:r}=this.productService,s,l=[{label:d(4267,null),run:()=>o()}];r!==void 0?(s=d(4268,null,this.productService.nameLong,this.productService.nameLong),l.push({label:d(4266,null),run:async()=>{await this.openerService.open(A.parse(r)),n()}})):s=d(4269,null,this.productService.nameLong,this.productService.nameLong),await this.hostService.withExpectedShutdown(()=>this.dialogService.prompt({type:gt.Info,message:d(4270,null),detail:s,buttons:l,cancelButton:!0}))};jd(e,this.productService.urlProtocol)&&await n()}return!0}})}registerLabelFormatters(){this._register(this.labelService.registerFormatter({scheme:Y.vscodeUserData,priority:!0,formatting:{label:"(Settings) ${path}",separator:"/"}}))}registerCommands(){qe.registerCommand("workbench.experimental.requestUsbDevice",async(e,t)=>Tno(t)),qe.registerCommand("workbench.experimental.requestSerialPort",async(e,t)=>_no(t)),qe.registerCommand("workbench.experimental.requestHidDevice",async(e,t)=>Dno(t))}};vOt=I([m(0,Qe),m(1,ao),m(2,ct),m(3,ot),m(4,nt),m(5,ru),m(6,fi),m(7,F),m(8,oi),m(9,ze)],vOt);var $P=ae("auxiliaryWindowService");var sjo=new ai(FSt.width,FSt.height),Tue=class extends tD{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)),Gt?(this._register(j(this.container,re.DROP,e=>$t.stop(e,!0))),this._register(j(this.container,re.WHEEL,e=>e.preventDefault(),{passive:!1})),this._register(j(this.container,re.CONTEXT_MENU,e=>$t.stop(e,!0)))):(this._register(j(this.window.document.body,re.DRAG_OVER,e=>$t.stop(e))),this._register(j(this.window.document.body,re.DROP,e=>$t.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"&&bf.getInstance().isModifierPressed)&&this.confirmBeforeClose(e)}handleVetoBeforeClose(e,t){this.preventUnload(e)}preventUnload(e){e.preventDefault(),e.returnValue=d(16654,null)}confirmBeforeClose(e){this.preventUnload(e)}handleUnload(){this._onUnload.fire()}layout(){let e=Fm(this.window.document.body,sjo,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:RT(this.window),compact:this.compact}}dispose(){this._store.isDisposed||(this._onWillDispose.fire(),super.dispose())}};Tue=I([m(3,B),m(4,oi),m(5,Vt),m(6,ze),m(7,fi)],Tue);var Z5=class extends C{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=sg(It)+1}async open(e){sn("code/auxiliaryWindow/willOpen");let t=await this.openWindow(e);if(!t)throw new Error(d(16658,null));let o=await this.resolveWindowId(t);_ut(t,o);let n=new P,{container:r,stylesLoaded:s}=this.createContainer(t,n,e),l=this.createAuxiliaryWindow(t,r,s);l.updateOptions({compact:e?.compact??!1});let c=new P;this.windows.set(t.vscodeWindowId,l),c.add(Z(()=>this.windows.delete(t.vscodeWindowId)));let u=new P;return H.once(l.onWillDispose)(()=>{t.close(),n.dispose(),c.dispose(),u.dispose()}),c.add(bzi(t)),this._onDidOpenAuxiliaryWindow.fire({window:l,disposables:u}),sn("code/auxiliaryWindow/didOpen"),this.telemetryService.publicLog2("auxiliaryWindowOpen",{bounds:!!e?.bounds}),l}createAuxiliaryWindow(e,t,o){return new Tue(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=FSt,r=Math.max(e?.bounds?.width??n.width,owe.WIDTH),s=Math.max(e?.bounds?.height??n.height,owe.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=si(["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=It.open(lbe?"":"about:blank",void 0,c.join(","));return!u&&Gt?(await this.dialogService.prompt({type:gt.Warning,message:d(16656,null),custom:{markdownDetails:[{markdown:new xe(d(16657,null,"https://aka.ms/allow-vscode-popup"),!0)}]},buttons:[{label:d(16655,null),run:()=>this.openWindow(e)}],cancelButton:!0})).result:u?.window}async resolveWindowId(e){return Z5.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=It.document.querySelector(o);if(n){let r=Ypt(e.document.head);if(tmt(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=It.document.querySelector('link[rel="icon"]');if(t){let o=Xpt(e.document.head);tmt(t,o)}}applyCSS(e,t){sn("code/auxiliaryWindow/willApplyCSS");let o=new Map,n=new Np;n.wait().then(()=>sn("code/auxiliaryWindow/didLoadCSSStyles"));let r=t.add(new P),s=0;function l(){--s===0&&(r.dispose(),n.open())}function c(u){if(W2i(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 It.document.head.querySelectorAll('link[rel="stylesheet"], style'))c(u)}finally{l()}return t.add(V2i(e)),t.add(MGe.observe(It.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(Ao(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))}}})),sn("code/auxiliaryWindow/didApplyCSS"),{stylesLoaded:n}}applyHTML(e,t){sn("code/auxiliaryWindow/willApplyHTML");let o=_("div",{role:"application"});return Czi(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(imt(It.document.documentElement,e.document.documentElement)),t.add(imt(It.document.body,e.document.body)),t.add(imt(this.layoutService.mainContainer,o,["class"])),sn("code/auxiliaryWindow/didApplyHTML"),o}getWindow(e){return this.windows.get(e)}};Z5=I([m(0,fi),m(1,ct),m(2,B),m(3,Te),m(4,oi),m(5,Vt),m(6,ze)],Z5);we($P,Z5,1);var qP=ae("titleService");var bOt=Mp(new E);W(class extends K{constructor(){super({id:"workbench.action.toggleCompactAuxiliaryWindow",title:L(3571,"Toggle Window Compact Mode"),category:We.View,f1:!0,precondition:sw})}async run(){bOt.fire({windowId:Ki().vscodeWindowId,compact:"toggle"})}});W(class extends K{constructor(){super({id:"workbench.action.enableCompactAuxiliaryWindow",title:d(3570,null),icon:M.screenFull,menu:{id:D.LayoutControlMenu,when:x.and(aV.toNegated(),Xc),order:0}})}async run(){bOt.fire({windowId:Ki().vscodeWindowId,compact:!0})}});W(class extends K{constructor(){super({id:"workbench.action.disableCompactAuxiliaryWindow",title:d(3569,null),icon:M.screenNormal,menu:{id:D.LayoutControlMenu,when:x.and(aV,Xc),order:0}})}async run(){bOt.fire({windowId:Ki().vscodeWindowId,compact:!1})}});var jV=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 P,n=!!e?.compact;function r(){let T=0;return y&&(T+=S.height),f&&v&&(T+=f.height),T}function s(T){y?bn(S.container):xo(S.container),T&&u.layout()}function l(T){f&&(v?bn(f.container):xo(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 N=y;y=!n&&t.configurationService.getValue(jV.STATUS_BAR_VISIBILITY)!==!1,N!==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(_ue,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 Io([ee,this.editorService.createScoped(h,o)]))),f,v=!1;if(kr&&rwe(this.configurationService)){f=o.add(this.titleService.createAuxiliaryTitlebarPart(u.container,h,g)),f.updateOptions({compact:n}),v=kui(this.configurationService,u.window,void 0);let T=()=>{let N=v;v=kui(this.configurationService,u.window,void 0),N!==v&&l(!0)};o.add(f.onDidChange(()=>u.layout())),o.add(this.layoutService.onDidChangePartVisibility(()=>T())),o.add(Bk(N=>{N===u.window.vscodeWindowId&&T()})),l(!1)}else o.add(g.createInstance(VP,u.window));let S=o.add(this.statusbarService.createAuxiliaryStatusbarPart(u.container,g)),y=!n&&this.configurationService.getValue(jV.STATUS_BAR_VISIBILITY)!==!1;o.add(this.configurationService.onDidChangeConfiguration(T=>{T.affectsConfiguration(jV.STATUS_BAR_VISIBILITY)&&(y=!n&&this.configurationService.getValue(jV.STATUS_BAR_VISIBILITY)!==!1,s(!0))})),s(!1);let w=o.add(H.once(h.onWillClose)(()=>u.window.close()));o.add(H.once(u.onUnload)(()=>{o.isDisposed||(w.dispose(),h.close(),o.dispose())})),o.add(H.once(this.lifecycleService.onDidShutdown)(()=>o.dispose())),o.add(u.onBeforeUnload(T=>{for(let N of h.groups)for(let O of N.editors){let V=O.canMove(N.id,this.editorPartsView.mainPart.activeGroup.id);if(typeof V=="string"){N.openEditor(O),T.veto(V);return}}})),o.add(u.onWillLayout(T=>{let N=f?.height??0;f?.layout(T.width,N,0,0);let O=T.height-r();h.layout(T.width,O,N,0),S.layout(T.width,S.height,T.height-S.height,0)})),u.layout(),o.add(bOt.event(T=>{if(T.windowId===u.window.vscodeWindowId){let N;typeof T.compact=="boolean"?N=T.compact:N=!n,c(N)}})),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 Io([Tr,this.statusbarService.createScoped(S,o)])));return{part:h,instantiationService:k,disposables:o}}};jV=I([m(1,F),m(2,$P),m(3,ao),m(4,B),m(5,Tr),m(6,qP),m(7,ee),m(8,fi)],jV);var _ue=class extends ck{constructor(e,t,o,n,r,s,l,c,u,p,h){let g=_ue.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(){Xc.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",It)||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}};_ue=I([m(4,F),m(5,De),m(6,B),m(7,le),m(8,fi),m(9,oi),m(10,X)],_ue);var ajo=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",Ufi,zfi,Kfi,Gfi,$fi,qfi]),sDe=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 P,t=_(".monaco-modal-editor-block");this.layoutService.mainContainer.appendChild(t),e.add(Z(()=>t.remove())),e.add(j(t,re.MOUSE_DOWN,k=>{k.target===t&&($t.stop(k,!0),v.close())}));let o=this.configurationService.getValue("workbench.editor.useModal");e.add(this.configurationService.onDidChangeConfiguration(k=>{k.affectsConfiguration("workbench.editor.useModal")&&(o=this.configurationService.getValue("workbench.editor.useModal"))})),e.add(j(t,re.KEY_DOWN,k=>{let T=new Ii(k);if(o!=="all"){let N=this.keybindingService.softDispatch(T,this.layoutService.mainContainer);N.kind===2&&N.commandId&&N.commandId.startsWith("workbench.")&&!ajo.has(N.commandId)&&$t.stop(T,!0)}}));let n=t.appendChild(_(".modal-editor-shadow")),r="modal-editor-title",s=_(".part.editor.modal-editor-part",{role:"dialog","aria-modal":"true","aria-labelledby":r});n.appendChild(s);let l=s.appendChild(_(".modal-editor-header")),c=R(l,_("div.modal-editor-title.show-file-icons"));c.id=r,c.textContent="";let u=R(l,_("div.modal-editor-navigation"));xo(u),e.add(j(u,re.DBLCLICK,k=>$t.stop(k,!0)));let p=e.add(new Mi(u,{title:d(4042,null)}));p.icon=M.chevronLeft,p.element.classList.add("modal-editor-nav-button"),e.add(p.onDidClick(()=>{let k=v.navigation;k&&k.current>0&&k.navigate(k.current-1)}));let h=R(u,_("span.modal-editor-nav-label"));h.setAttribute("aria-live","polite");let g=e.add(new Mi(u,{title:d(4041,null)}));g.icon=M.chevronRight,g.element.classList.add("modal-editor-nav-button"),e.add(g.onDidClick(()=>{let k=v.navigation;k&&k.current<k.total-1&&k.navigate(k.current+1)}));let f=R(l,_("div.modal-editor-action-container")),v=e.add(this.instantiationService.createInstance(Due,It.vscodeWindowId,this.editorPartsView,t,i));e.add(this.editorPartsView.registerPart(v)),v.create(s),e.add(H.once(v.onWillClose)(()=>e.dispose())),e.add(H.runAndSubscribe(v.onDidChangeNavigation,(k=>{k&&k.total>1?(bn(u),h.textContent=d(4040,null,k.current+1,k.total),p.enabled=k.current>0,g.enabled=k.current<k.total-1):xo(u)}),v.navigation));let b=this.editorService.createScoped(v,e),S=e.add(v.scopedInstantiationService.createChild(new Io([ee,b])));e.add(S.createInstance(Ln,f,D.ModalEditorTitle,{hiddenItemStrategy:-1,highlightToggledItems:!0,menuOptions:{shouldForwardArgs:!0}}));let y=e.add(S.createInstance(rk,c,{}));e.add(H.runAndSubscribe(b.onDidActiveEditorChange,()=>{let k=v.activeGroup.activeEditor;if(k){let{labelFormat:T}=v.partOptions;y.element.setResource({resource:no.getOriginalUri(k,{supportSideBySide:3}),name:k.getName(),description:k.getDescription(T==="short"?0:T==="long"?2:1)||""},{icon:k.getIcon(),extraClasses:k.getLabelExtraClasses()})}else y.element.clear();v.notifyActiveEditorChanged()})),e.add(j(l,re.DBLCLICK,k=>{$t.stop(k),v.toggleMaximized()})),e.add(j(l,re.CLICK,k=>{$t.stop(k),v.activeGroup.focus()}));let w=()=>{let k=this.layoutService.mainContainerDimension,T=this.layoutService.mainContainerOffset.top,N=Math.max(k.height-T,0),O,V;if(v.maximized){let te=Math.max(T,16);O=Math.max(k.width-16,0),V=Math.max(N-te,0)}else{let pe=k.width*.8,de=N*.8;O=Math.min(pe,1400,k.width),V=Math.min(de,900,N)}V=Math.min(V,N),s.style.width=`${O}px`,s.style.height=`${V}px`;let U=2;v.layout(O-U,V-U-33,0,0)};return e.add(H.runAndSubscribe(this.layoutService.onDidLayoutMainContainer,w)),e.add(v.onDidChangeMaximized(()=>w())),this.hostService.setWindowDimmed(It,!0),e.add(Z(()=>this.hostService.setWindowDimmed(It,!1))),v.activeGroup.focus(),{part:v,instantiationService:S,disposables:e}}};sDe=I([m(1,F),m(2,ee),m(3,fi),m(4,_e),m(5,oi),m(6,B)],sDe);var Due=class extends ck{constructor(e,t,o,n,r,s,l,c,u,p,h){let g=Due.COUNTER++;super(t,`workbench.parts.modalEditor.${g}`,d(4039,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._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._navigation=n?.navigation,this.enforceModalPartOptions()}static{this.COUNTER=1}get maximized(){return this._maximized}get navigation(){return this._navigation}create(e,t){this.previousMainWindowActiveElement=It.document.activeElement,super.create(e,t)}enforceModalPartOptions(){let e=this.groups.reduce((t,o)=>t+o.count,0);this.optionsDisposable.value=this.enforcePartOptions({showTabs:e>1?"multiple":"none",enablePreview:!0,closeEmptyGroups:!0,tabActionCloseVisibility:e>1,editorActionsLocation:"default",tabHeight:"default",wrapTabs:!1,allowDropIntoGroup:!1})}notifyActiveEditorChanged(){this.enforceModalPartOptions()}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._onDidChangeMaximized.fire(this._maximized)}handleContextKeys(){rV.bindTo(this.scopedContextKeyService).set(!0);let t=tTt.bindTo(this.scopedContextKeyService);t.set(this._maximized),this._register(this.onDidChangeMaximized(n=>t.set(n)));let o=yce.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(It,"workbench.parts.editor");!Ao(this.previousMainWindowActiveElement)||!this.previousMainWindowActiveElement.isConnected||t?.contains(this.previousMainWindowActiveElement)?e.focus():this.previousMainWindowActiveElement.focus(),this.doClose({mergeConfirmingEditorsToMainPart:!1})}saveState(){}close(e){return this.doClose({...e,mergeConfirmingEditorsToMainPart:!0})}doClose(e){let t=!0;if(e?.mergeConfirmingEditorsToMainPart){if(!e.mergeAllEditorsToMainPart)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}dispose(){this._navigation=void 0,super.dispose()}};Due=I([m(4,F),m(5,De),m(6,B),m(7,le),m(8,fi),m(9,oi),m(10,X)],Due);var QV=class extends TJ{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._isReady=!1;this.whenReadyPromise=new Go;this.whenReady=this.whenReadyPromise.p;this.whenRestoredPromise=new Go;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 jt);this.editorWorkingSets=(()=>{let s=this.storageService.get(QV.EDITOR_WORKING_SETS_STORAGE_KEY,1);return s?JSON.parse(s):[]})(),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(rDe,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(Tr),s=this._register(this.mainPart.scopedInstantiationService.createChild(new Io([ee,n.createScoped(this.mainPart,this._store)],[Tr,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(jV,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(sDe,this).create({...e,maximized:e?.maximized??this.modalEditorMaximized});return this.modalEditorPart=t,this.modalPartInstantiationService=o,n.add(Z(()=>{this.modalPartInstantiationService=void 0,this.modalEditorPart=void 0})),n.add(t.onDidChangeMaximized(r=>{this.modalEditorMaximized=r})),this._onDidAddGroup.fire(t.activeGroup),t}registerPart(e){let t=this._register(new P);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!==It.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(3961,null,e+1)}getPartByDocument(e){if(this._parts.size>1){let t=Pn();for(let o of this._parts)if(o!==this.mainPart&&o.element?.ownerDocument===e){let n=o.getContainer();if(n&&gs(t,n))return o}}return super.getPartByDocument(e)}getPart(e){if(this._parts.size>1)if(Ao(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"}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[QV.EDITOR_PARTS_UI_STATE_STORAGE_KEY]}saveState(){let e=this.createState();e.auxiliary.length===0?delete this.workspaceMemento[QV.EDITOR_PARTS_UI_STATE_STORAGE_KEY]:this.workspaceMemento[QV.EDITOR_PARTS_UI_STATE_STORAGE_KEY]=e}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:_t(),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(QV.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=Uo([...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)}};QV=I([m(0,F),m(1,le),m(2,De),m(3,$P),m(4,X)],QV);we(Et,QV,0);var jP=ae("bannerService");var IYe=class extends cy{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 A8e.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];Ao(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=R(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=Na(e.icon)));let n=R(this.element,_("div.message-container"));if(n.setAttribute("aria-hidden","true"),n.appendChild(this.getBannerMessage(e.message)),this.messageActionsContainer=R(this.element,_("div.message-actions-container")),e.actions)for(let c of e.actions)this._register(this.instantiationService.createInstance(Xg,this.messageActionsContainer,{...c,tabIndex:-1},{}));let r=R(this.element,_("div.action-container"));this.actionBar=this._register(new ji(r));let s=e.closeLabel??d(3551,null),l=this._register(new st("banner.close",s,q.asClassName(lE),!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"}}};IYe=I([m(0,De),m(1,fi),m(2,le),m(3,X),m(4,F),m(5,Qn)],IYe);we(jP,IYe,0);yt.registerCommandAndKeybindingRule({id:"workbench.banner.focusBanner",weight:200,primary:9,when:A8e,handler:a=>{a.get(jP).focus()}});yt.registerCommandAndKeybindingRule({id:"workbench.banner.focusNextAction",weight:200,primary:17,secondary:[18],when:A8e,handler:a=>{a.get(jP).focusNextAction()}});yt.registerCommandAndKeybindingRule({id:"workbench.banner.focusPreviousAction",weight:200,primary:15,secondary:[16],when:A8e,handler:a=>{a.get(jP).focusPreviousAction()}});var mbi=class a extends K{static{this.ID="workbench.action.focusBanner"}static{this.LABEL=L(3552,"Focus Banner")}constructor(){super({id:a.ID,title:a.LABEL,category:We.View,f1:!0})}async run(i){i.get(fi).focusPart("workbench.parts.banner")}};W(mbi);var SOt=class extends st{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)}},IOt=class extends st{constructor(e,t,o){super(e,d(4189,null,t),void 0,!0);this.model=o}async run(){this.model.hide(this.id)}},aDe=class extends st{constructor(e,t){super("statusbar.manage.extension",d(4190,null));this.extensionId=e;this.commandService=t}run(){return this.commandService.executeCommand("_extensions.manage",this.extensionId)}};aDe=I([m(1,ge)],aDe);yt.registerCommandAndKeybindingRule({id:"workbench.statusBar.focusPrevious",weight:200,primary:15,secondary:[16],when:kY,handler:a=>{a.get(Tr).focusPreviousEntry()}});yt.registerCommandAndKeybindingRule({id:"workbench.statusBar.focusNext",weight:200,primary:17,secondary:[18],when:kY,handler:a=>{a.get(Tr).focusNextEntry()}});yt.registerCommandAndKeybindingRule({id:"workbench.statusBar.focusFirst",weight:200,primary:14,when:kY,handler:a=>{let i=a.get(Tr);i.focus(!1),i.focusNextEntry()}});yt.registerCommandAndKeybindingRule({id:"workbench.statusBar.focusLast",weight:200,primary:13,when:kY,handler:a=>{let i=a.get(Tr);i.focus(!1),i.focusPreviousEntry()}});yt.registerCommandAndKeybindingRule({id:"workbench.statusBar.clearFocus",weight:200,primary:9,when:kY,handler:a=>{let i=a.get(Tr),e=a.get(ee);i.isEntryFocused()?i.focus(!1):e.activeEditorPane&&e.activeEditorPane.focus()}});var hbi=class extends K{constructor(){super({id:"workbench.action.focusStatusBar",title:L(4188,"Focus Status Bar"),category:We.View,f1:!0})}async run(i){i.get(fi).focusPart("workbench.parts.statusbar",Ki())}};W(hbi);var yOt=class a extends C{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=>Jle(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=>ts(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?xo(o.container):bn(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=>Jle(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=>Jle(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 lDe=class extends C{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(ws.addTarget(this.labelContainer)),this.label=this._register(new gbi(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 Oi(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?bn(this.labelContainer):xo(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;u9i(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=Mr(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!==GL||this.hover)?(this.commandMouseListener.value=j(this.labelContainer,re.CLICK,()=>this.executeCommand(o)),this.commandTouchListener.value=j(this.labelContainer,Gn.Tap,()=>this.executeCommand(o)),this.commandKeyboardListener.value=j(this.labelContainer,re.KEY_DOWN,n=>{let r=new Ii(n);r.equals(10)||r.equals(3)?($t.stop(n),this.executeCommand(o)):(r.equals(9)||r.equals(15)||r.equals(17))&&($t.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 d9i)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:Mr(e)?Mr(t)&&nje(e,t):e===t}async executeCommand(e){if(e===GL)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(In(n))}}}applyColor(e,t,o){let n;if(o?this.backgroundListener.clear():this.foregroundListener.clear(),t)if(xSe(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??""}};lDe=I([m(3,ge),m(4,tt),m(5,Ne),m(6,Te),m(7,De)],lDe);var gbi=class extends BC{constructor(e){super(e);this.container=e;this.progressCodicon=Qo(xje);this.currentText="";this.currentShowProgress=!1}set showProgress(e){this.currentShowProgress!==e&&(this.currentShowProgress=e,this.progressCodicon=Qo(e==="syncing"?xje:cE),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}`),R(this.container,...Bn(t))}else super.text=e}};var SK=class extends cy{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=SK.HEIGHT;this.maximumHeight=SK.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 yOt(r)),this.onDidChangeEntryVisibility=this.viewModel.onDidChangeEntryVisibility,this.hoverDelegate=this._register(this.instantiationService.createInstance(mv,"element",{instantHover:!0,dynamicDelay(u){if(typeof u=="function"||Ao(u)||Dwe(u)&&typeof u.markdown=="function"||T3i(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 c9i(n)?r=n:r={primary:n,secondary:Ir(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 P,s=this.doCreateStatusItem(t,o),l=r.add(this.instantiationService.createInstance(lDe,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 kY.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(ws.addTarget(e)),this._register(j(e,Gn.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=Oi(this.leftItemsContainer),t=Oi(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=Oi(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(Jle(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(JW),r=this.getColor(Z9i);if(this.compactEntriesDisposable.value=new P,n&&r&&!Ug(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){$t.stop(e,!0);let t=new yn(Me(this.element),e),o;this.contextMenuService.showContextMenu({getAnchor:()=>t,getActions:()=>(o=this.getContextMenuActions(t),o),onHide:()=>{o&&jH(o)}})}getContextMenuActions(e){let t=[];t.push(pi({id:Cue.ID,label:d(4191,null),run:()=>this.instantiationService.invokeFunction(r=>new Cue().run(r))})),t.push(new li);let o=new Set;for(let r of this.viewModel.entries)o.has(r.id)||(t.push(new SOt(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 li),n.extensionId&&t.push(this.instantiationService.createInstance(aDe,n.extensionId)),t.push(new IOt(n.id,n.name,this.viewModel))),t}updateStyles(){super.updateStyles();let e=Oi(this.getContainer()),t=[...this.styleOverrides].sort((c,u)=>c.priority-u.priority)[0],o=this.getColor(t?.background??(this.contextService.getWorkbenchState()!==1?bEt:SEt))||"";e.style.backgroundColor=o;let n=this.getColor(t?.foreground??(this.contextService.getWorkbenchState()!==1?jL:Q9i))||"";e.style.color=n;let r=this.getColor(J9i);this.updateCompactEntries();let s=this.getColor(t?.border??(this.contextService.getWorkbenchState()!==1?dce:X9i))||this.getColor(gi);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(Y9i);this.styleElement||(this.styleElement=hr(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(qs)??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()}};SK=I([m(1,F),m(2,De),m(3,Pe),m(4,le),m(5,fi),m(6,ze),m(7,X)],SK);var yYe=class extends SK{constructor(i,e,t,o,n,r,s){super("workbench.parts.statusbar",i,e,t,o,n,r,s)}};yYe=I([m(0,F),m(1,De),m(2,Pe),m(3,le),m(4,fi),m(5,ze),m(6,X)],yYe);var Lue=class extends SK{constructor(e,t,o,n,r,s,l,c){let u=Lue.COUNTER++;super(`workbench.parts.auxiliaryStatus.${u}`,t,o,n,r,s,l,c);this.container=e;this.height=SK.HEIGHT}static{this.COUNTER=1}};Lue=I([m(1,F),m(2,De),m(3,Pe),m(4,le),m(5,fi),m(6,ze),m(7,X)],Lue);var wYe=class extends TJ{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(yYe)),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(Lue,o),r=this.registerPart(n);return n.create(o),H.once(n.onWillDispose)(()=>r.dispose()),this._onDidCreateAuxiliaryStatusbarPart.fire(n),n}createScoped(e,t){return t.add(this.instantiationService.createInstance(CYe,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 P,s=new Set,l=e;function c(u){let p=new P;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 P;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 P;for(let o of this.parts)t.add(o.overrideStyle(e));return t}};wYe=I([m(0,F),m(1,le),m(2,De)],wYe);var CYe=class extends C{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)}};CYe=I([m(1,Tr)],CYe);we(Tr,wYe,0);var wOt=class extends K{constructor(){super({id:"menu.resetHiddenStates",title:L(1809,"Reset All Menus"),category:We.View,f1:!0})}run(i){i.get(qt).resetHiddenStates(),i.get(ne).info("did RESET all menu hidden states")}};we(qt,awe,1);W(wOt);var cDe=!1;function COt(a){return a.scheme===Y.file?a.fsPath:a.path}var Mno=0,dDe=class{constructor(i,e,t,o,n,r,s){this.id=++Mno;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 xOt=class{constructor(i,e){this.resourceLabel=i;this.reason=e}},kOt=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(2667,null,i.join(", "))),e.length>0&&t.push(d(2669,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)}},fbi=class{constructor(i,e,t,o,n,r,s){this.id=++Mno;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 kOt),this.removedResources.has(e)||this.removedResources.set(e,new xOt(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 kOt),this.invalidatedResources.has(e)||this.invalidatedResources.set(e,new xOt(i,0)))}toString(){return`[id:${this.id}] [group:${this.groupId}] [${this.invalidatedResources?"INVALID":"  VALID"}] ${this.actual.constructor.name} - ${this.actual}`}},EOt=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 gqe(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++}},kYe=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}},Pno=new EOt("","");Pno.locked=!0;var xYe=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=R9.None,t=$U.None){if(i.type===0){let o=COt(i.resource),n=this.getUriComparisonKey(i.resource);this._pushElement(new dDe(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=COt(s),c=this.getUriComparisonKey(s);o.has(c)||(o.add(c),n.push(l),r.push(c))}n.length===1?this._pushElement(new dDe(i,n[0],r[0],e.id,e.nextOrder(),t.id,t.nextOrder())):this._pushElement(new fbi(i,n,r,e.id,e.nextOrder(),t.id,t.nextOrder()))}cDe&&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 EOt(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=COt(n.resource),s=this.getUriComparisonKey(n.resource),l=new dDe(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=COt(n.resource),s=this.getUriComparisonKey(n.resource),l=new dDe(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)),cDe&&this._print("removeElements")}setElementsValidFlag(i,e,t){let o=this.getUriComparisonKey(i);this._editStacks.has(o)&&this._editStacks.get(o).setElementsValidFlag(e,t),cDe&&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 gqe(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))}cDe&&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 $U){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 C.None;let e=i.actual.prepareUndoRedo();return typeof e>"u"?C.None:e}_invokeResourcePrepare(i,e){if(i.actual.type!==1||typeof i.actual.prepareUndoRedo>"u")return e(C.None);let t=i.actual.prepareUndoRedo();return t?Ac(t)?e(t):t.then(o=>e(o)):e(C.None)}_getAffectedEditStacks(i){let e=[];for(let t of i.strResources)e.push(this._editStacks.get(t)||Pno);return new kYe(e)}_tryToSplitAndUndo(i,e,t,o){if(e.canSplit())return this._splitPastWorkspaceElement(e,t),this._notificationService.warn(o),new uDe(this._undo(i,0,!0));for(let n of e.strResources)this.removeElements(n);return this._notificationService.warn(o),new uDe}_checkWorkspaceUndo(i,e,t,o){if(e.removedResources)return this._tryToSplitAndUndo(i,e,e.removedResources,d(2659,null,e.label,e.removedResources.createMessage()));if(o&&e.invalidatedResources)return this._tryToSplitAndUndo(i,e,e.invalidatedResources,d(2659,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(2660,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(2662,null,e.label,r.join(", "))):t.isValid()?null:this._tryToSplitAndUndo(i,e,null,d(2661,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:gt.Info,message:d(2666,null,e.label),buttons:[{label:d(2670,null,t.editStacks.length),run:()=>0},{label:d(2668,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(2654,null,e.label);this._notificationService.warn(o);return}return this._invokeResourcePrepare(e,o=>(i.moveBackward(e),this._safeInvokeWithLocks(e,()=>e.actual.undo(),new kYe([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 $U){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{cDe&&this._print("undo")}}async _confirmAndContinueUndo(i,e,t){if((await this._dialogService.confirm({message:d(2663,null,t.label),primaryButton:d(2665,null),cancelButton:d(2664,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 $U){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 uDe(this._redo(i));for(let n of e.strResources)this.removeElements(n);return this._notificationService.warn(o),new uDe}_checkWorkspaceRedo(i,e,t,o){if(e.removedResources)return this._tryToSplitAndRedo(i,e,e.removedResources,d(2655,null,e.label,e.removedResources.createMessage()));if(o&&e.invalidatedResources)return this._tryToSplitAndRedo(i,e,e.invalidatedResources,d(2655,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(2656,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(2658,null,e.label,r.join(", "))):t.isValid()?null:this._tryToSplitAndRedo(i,e,null,d(2657,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(2653,null,e.label);this._notificationService.warn(t);return}return this._invokeResourcePrepare(e,t=>(i.moveForward(e),this._safeInvokeWithLocks(e,()=>e.actual.redo(),new kYe([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 $U){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{cDe&&this._print("redo")}}}};xYe=I([m(0,ct),m(1,Ne)],xYe);var uDe=class{constructor(i){this.returnValue=i}};we(Cl,xYe,1);var MJ=ae("IMcpResourceScannerService"),EYe=class extends C{constructor(e,t){super();this.fileService=e;this.uriIdentityService=t;this.resourcesAccessQueueMap=new vt}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=Ur(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(hu(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):Hr(t,`Invalid Target: ${ise(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,Je.fromString(JSON.stringify(t,null,"	"))):await this.fileService.del(e)}async writeScannedMcpServersToWorkspaceFolder(e,t){await this.fileService.writeFile(e,Je.fromString(JSON.stringify(t,null,"	")))}async writeScannedMcpServersToWorkspace(e,t){let o;try{let n=await this.fileService.readFile(e),r=[];if(o=Ur(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(hu(n)!==1)throw n;o={settings:{}}}o.settings||(o.settings={}),o.settings.mcp=t,await this.fileService.writeFile(e,Je.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 Op,this.resourcesAccessQueueMap.set(e,t)),t}};EYe=I([m(0,be),m(1,dt)],EYe);we(MJ,EYe,1);var TYe=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=Zm(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))}};TYe=I([m(0,lt),m(1,ne)],TYe);we(Wz,TYe,1);var vbi=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)}};we(oRt,vbi,1);var bbi=ae("keybindingEditingService"),_Ye=class extends C{constructor(e,t,o,n){super();this.textModelResolverService=e;this.textFileService=t;this.fileService=o;this.userDataProfileService=n;this.queue=new Op}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=Ur(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(Sb(n.getValue(),[r,"key"],t,{tabSize:s,insertSpaces:l,eol:c})[0],n);let u=Sb(n.getValue(),[r,"when"],o,{tabSize:s,insertSpaces:l,eol:c});u.length>0&&this.applyEditsToBuffer(u[0],n)}else this.applyEditsToBuffer(Sb(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=Ur(t.getValue()),l=this.findUserKeybindingEntryIndex(e,s);l!==-1&&this.applyEditsToBuffer(Sb(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);Ur(t.getValue()).every(u=>!this.areSame(u,l))&&this.applyEditsToBuffer(Sb(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=Ur(t.getValue()),l=this.findUnassignedDefaultKeybindingEntryIndex(e,s).reverse();for(let c of l)this.applyEditsToBuffer(Sb(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=x.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=x.deserialize(e.when),n=x.deserialize(t.when);return!(o&&!n||!o&&n||o&&n&&!o.equals(n)||!uo(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)?An.replace(r,e.content):An.insert(o,e.content);t.pushEditOperations([new Yt(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(17081,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(17082,null));if(n.result){if(!Array.isArray(n.result))throw e.dispose(),new Error(d(17080,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:Ur(e.getValue(),t,{allowTrailingComma:!0,allowEmptyContent:!0}),parseErrors:t}}getEmptyContent(){return"// "+d(17079,null)+`
[
]`}};_Ye=I([m(0,Nt),m(1,Ho),m(2,be),m(3,mn)],_Ye);we(bbi,_Ye,1);var TOt=class a{constructor(i,e,t){this.themeService=i;this._refCounter=0;this.data=e;let o=Ir(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;Vh(`.${this.itemColorClassName}`,`color: ${Mue(t)};`,e),q.isThemeIcon(o)?this._createIconCSSRule(o,t,e):o&&Vh(`.${this.itemBadgeClassName}::after`,`content: "${o}"; color: ${Mue(t)};`,e)}_appendForMany(i,e){let{color:t}=i.find(r=>!!r.color)??i[0];Vh(`.${this.itemColorClassName}`,`color: ${Mue(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&&Vh(`.${this.itemBadgeClassName}::after`,`content: "${o.join(", ")}"; color: ${Mue(t)};`,e),Vh(`.${this.bubbleBadgeClassName}::after`,`content: "\uEA71"; color: ${Mue(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=jy().getIcon(i.id);if(!n)return;let r=this.themeService.getProductIconTheme().getIcon(n);r&&Vh(`.${this.iconBadgeClassName}::after`,`content: '${r.fontCharacter}';
			color: ${i.color?Mue(i.color.id):Mue(e)};
			font-family: ${WS(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){EN(this.itemColorClassName,i),EN(this.itemBadgeClassName,i),EN(this.bubbleBadgeClassName,i),EN(this.iconBadgeClassName,i)}},Sbi=class{constructor(i){this._themeService=i;this._dispoables=new P;this._styleElement=hr(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=TOt.keyOf(i),o=this._decorationRules.get(t);o||(o=new TOt(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=Uo(i.filter(u=>!Jl(u.tooltip)).map(u=>u.tooltip)).join(" \u2022 "),c=i.some(u=>u.strikethrough);return e&&(r=o.bubbleBadgeClassName,l=d(16757,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)}}}},Ibi=class{constructor(i){this._data=Yu.forUris(i=>!0);this._data.fill(!0,Yl(i))}affectsResource(i){return this._data.hasElementOrSubtree(i)}},pDe=class{constructor(i,e){this.source=i;this.thenable=e}};function Mue(a){return a?wt(a):"inherit"}var DYe=class{constructor(i,e){this._store=new P;this._onDidChangeDecorationsDelayed=this._store.add(new gbe({merge:i=>i.flat()}));this._onDidChangeDecorations=this._store.add(new E);this.onDidChangeDecorations=this._onDidChangeDecorations.event;this._provider=new Vs;this._decorationStyles=new Sbi(e),this._data=Yu.forUris(t=>i.extUri.ignorePathCasing(t)),this._store.add(this._onDidChangeDecorationsDelayed.event(t=>{this._onDidChangeDecorations.fire(new Ibi(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 pDe)&&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 pDe)&&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 pDe&&(o.source.cancel(),i.delete(t));let n=new $e,r=t.provideDecorations(e,n.token);if(FT(r)){let s=new pDe(n,Promise.resolve(r).then(l=>{i.get(t)===s&&this._keepItem(i,t,e,l)}).catch(l=>{!so(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}};DYe=I([m(0,dt),m(1,De)],DYe);we(Cv,DYe,1);var _Ot=class extends C{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 Go,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 LYe=class extends C{constructor(e,t){super();this.environmentService=e;this.logService=t;this.model=this._register(new _Ot);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:gt.Info,message:e,detail:t})}async warn(e,t){await this.prompt({type:gt.Warning,message:e,detail:t})}async error(e,t){await this.prompt({type:gt.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}};LYe=I([m(0,Vt),m(1,ne)],LYe);we(ct,LYe,1);var PJ=class extends C{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(Vo(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,xo(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 Dc(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 hv(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 _x(this.buttonsContainer,{alignment:this.options?.alignment===1?1:0})),n=this.rearrangeButtons(this.buttons,this.options.cancelId),r=c=>{e({button:n[c].index,checkboxChecked:this.checkbox?this.checkbox.checked:void 0,values:this.inputs.length>0?this.inputs.map(u=>u.value):void 0})};n.forEach((c,u)=>{let p=n[u].index===0,h,g=this.options.buttonOptions?.[n[u]?.index];if(p&&this.options?.primaryButtonDropdown){let f=f4i(this.options.primaryButtonDropdown.actions)?this.options.primaryButtonDropdown.actions.getActions():this.options.primaryButtonDropdown.actions;h=this._register(o.addButtonWithDropdown({...this.options.primaryButtonDropdown,...this.buttonStyles,dropdownLayer:2600,actions:f.map(v=>pi({...v,run:async()=>{await v.run(),r(u)}}))}))}else g?.sublabel?h=this._register(o.addButtonWithDescription({secondary:!p,...this.buttonStyles})):h=this._register(o.addButton({secondary:!p,...this.buttonStyles}));g?.styleButton&&g.styleButton(h),h.label=$$(n[u].label,!0),h instanceof e5e&&g?.sublabel&&(h.description=g?.sublabel),this._register(h.onDidClick(f=>{f&&$t.stop(f),r(u)}))});let s=Me(this.container);this._register(j(s,"keydown",c=>{let u=new Ii(c);if(u.equals(512)&&u.preventDefault(),u.equals(3)){this.inputs.some(h=>h.hasFocus())&&($t.stop(c),e({button:n.find(h=>h.index!==this.options.cancelId)?.index??0,checkboxChecked:this.checkbox?this.checkbox.checked:void 0,values:this.inputs.length>0?this.inputs.map(h=>h.value):void 0}));return}if(it&&u.equals(2082)){$t.stop(c);let h=n.find(g=>g.index===1&&g.index!==this.options.cancelId);h&&e({button:h.index,checkboxChecked:this.checkbox?this.checkbox.checked:void 0,values:this.inputs.length>0?this.inputs.map(g=>g.value):void 0});return}if(u.equals(10))return;let p=!1;if(u.equals(2)||u.equals(17)||u.equals(1026)||u.equals(15)){let h=[],g=-1;if(this.messageContainer){let f=this.messageContainer.querySelectorAll("a");for(let v of f)h.push(v),sa(v)&&(g=h.length-1)}for(let f of this.inputs)h.push(f),f.hasFocus()&&(g=h.length-1);if(this.checkbox&&(h.push(this.checkbox),this.checkbox.hasFocus()&&(g=h.length-1)),this.buttonBar)for(let f of this.buttonBar.buttons)f instanceof $I?(h.push(f.primaryButton),f.primaryButton.hasFocus()&&(g=h.length-1),h.push(f.dropdownButton),f.dropdownButton.hasFocus()&&(g=h.length-1)):(h.push(f),f.hasFocus()&&(g=h.length-1));if(this.footerContainer){let f=this.footerContainer.querySelectorAll("a");for(let v of f)h.push(v),sa(v)&&(g=h.length-1)}if(u.equals(2)||u.equals(17)){let f=(g+1)%h.length;h[f].focus()}else{g===-1&&(g=h.length);let f=g-1;f===-1&&(f=h.length-1),h[f].focus()}p=!0}p?$t.stop(c,!0):this.options.keyEventProcessor&&this.options.keyEventProcessor(u)},!0)),this._register(j(s,"keyup",c=>{$t.stop(c,!0);let u=new Ii(c);!this.options.disableCloseAction&&u.equals(9)&&t()},!0)),this._register(j(this.element,"focusout",c=>{c.relatedTarget&&this.element&&(gs(c.relatedTarget,this.element)||(this.focusToReturn=c.relatedTarget,c.target&&(c.target.focus(),$t.stop(c,!0))))},!1));let l="codicon-modifier-spin";if(this.iconElement.classList.remove(...q.asClassNameArray(M.dialogError),...q.asClassNameArray(M.dialogWarning),...q.asClassNameArray(M.dialogInfo),...q.asClassNameArray(M.loading),l),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(M.dialogError));break;case"warning":this.iconElement.classList.add(...q.asClassNameArray(M.dialogWarning));break;case"pending":this.iconElement.classList.add(...q.asClassNameArray(M.loading),l);break;case"none":this.iconElement.classList.add("no-codicon");break;default:this.iconElement.classList.add(...q.asClassNameArray(M.dialogInfo));break}if(!this.options.disableCloseAction&&!this.options.disableCloseButton){let c=this._register(new ji(this.toolbarContainer,{})),u=this._register(new st("dialog.close",d(2,null),q.asClassName(M.dialogClose),!0,async()=>{e({button:this.options.cancelId||0,checkboxChecked:this.checkbox?this.checkbox.checked:void 0})}));c.push(u,{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"),bn(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((c,u)=>{c.index===0&&o.buttons[u].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&&gs(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(it||Wn){if(typeof t=="number"&&o[t]){let n=o.splice(t,1)[0];o.splice(1,0,n)}o.reverse()}else if(ri&&typeof t=="number"&&o[t]){let n=o.splice(t,1)[0];o.push(n)}return o}};var ljo=new Set(["workbench.action.quit","workbench.action.reloadWindow","copy","cut","editor.action.selectAll","editor.action.clipboardCopyAction","editor.action.clipboardCutAction","editor.action.clipboardPasteAction"]);function mDe(a,i,e,t,o=ljo){return{keyEventProcessor:n=>{let r=i.softDispatch(n,e.activeContainer);r.kind===2&&r.commandId&&(o.has(r.commandId)||$t.stop(n,!0))},buttonStyles:Ko,checkboxStyles:kf,inputBoxStyles:pl,dialogStyles:C4i,onVisibilityChange:(n,r)=>t.setWindowDimmed(n,r),...a}}var RYe=class extends C{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:C9(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 bm(()=>this.updateWindowProgress())],n=t(o[1]),r=setTimeout(()=>{r=void 0,this.windowProgressStack.unshift(o),this.updateWindowProgress(),Promise.all([Pi(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(17182,null,n,r),c=u?d(17184,null,u,n,r):l;else if(n)l=n,c=u?d(17183,null,u,n):l;else if(r)l=r,c=u?d(17183,null,u,r):l;else{this.updateWindowProgress(e+1);return}let p={name:d(17185,null),text:l,showProgress:t.type||!0,ariaLabel:l,tooltip:fu(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 C{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 Go;return this.withWindowProgress({location:10,title:e.title?lS(e.title).toString():void 0,command:"notifications.showList",type:e.type},v=>{function b(y){y.message&&v.report({message:lS(y.message).toString()})}n.step&&b(n.step);let S=n.onDidReport(y=>b(y));return f.p.finally(()=>S.dispose()),H.once(n.onWillDispose)(()=>f.complete()),f.p}),Z(()=>f.complete())},s=(f,v,b)=>{let S=new P,y=e.primaryActions?Array.from(e.primaryActions):[],w=e.secondaryActions?Array.from(e.secondaryActions):[];if(e.buttons&&e.buttons.forEach((O,V)=>{let U=new class extends st{constructor(){super(`progress.button.${O}`,O,void 0,!0)}async run(){n.cancel(V)}};S.add(U),y.push(U)}),e.cancellable){let O=new class extends st{constructor(){super("progress.cancel",typeof e.cancellable=="string"?e.cancellable:d(17180,null),void 0,!0)}async run(){n.cancel()}};S.add(O),y.push(O)}let k=this.notificationService.notify({severity:St.Info,message:fu(f),source:e.source,actions:{primary:y,secondary:w},progress:typeof b=="number"&&b>=0?{total:100,worked:b}:{infinite:!0},priority:v}),T,N=O=>{Ue(T),!O&&!n.done&&(T=r())};return S.add(k.onDidChangeVisibility(N)),v===2&&N(!1),H.once(k.onDidClose)(()=>{S.dispose(),Ue(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 H.once(n.onWillDispose)(()=>g.dispose()),(async()=>{try{typeof e.delay=="number"&&e.delay>0?await n.promise:await Promise.all([Pi(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 PC(()=>"")}),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),Ue(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 P,r,s=!1,l=f=>{let v=e.buttons||[];return e.sticky||v.push(e.cancellable?typeof e.cancellable=="boolean"?d(17180,null):e.cancellable:d(17181,null)),r=new PJ(this.layoutService.activeContainer,f,v,mDe({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),Ue(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,Ue(n)}),e.title&&h(e.title),g}};RYe=I([m(0,zl),m(1,ds),m(2,Ri),m(3,Ft),m(4,Ne),m(5,Tr),m(6,nc),m(7,_e),m(8,Cde),m(9,oi)],RYe);we(Bo,RYe,1);var hDe=class extends C{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 Vs;this._transientWatchers=this._register(new jt);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 Cbi(hr())}_getOrCreateStyleSheet(e){if(!e)return this._getOrCreateGlobalStyleSheet();let t=e.getContainerDomNode();if(!x$(t))return this._getOrCreateGlobalStyleSheet();let o=e.getId();if(!this._editorStyleSheets.has(o)){let n=new wbi(this,o,hr(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 xbi(this._themeService,l,c):s=new kbi(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 ybi(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)}};hDe=I([m(0,De)],hDe);var ybi=class extends C{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)}},wbi=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){Vh(i,e,this._styleSheet)}removeRulesContainingSelector(i){EN(i,this._styleSheet)}},Cbi=class{get sheet(){return this._styleSheet.sheet}constructor(i){this._styleSheet=i}ref(){}unref(){}insertRule(i,e){Vh(i,e,this._styleSheet)}removeRulesContainingSelector(i){EN(i,this._styleSheet)}},xbi=class{constructor(i,e,t){this._styleSheet=e,this._styleSheet.ref(),this._parentTypeKey=t.parentTypeKey,this.refCount=0,this._beforeContentRules=new gDe(3,t,i),this._afterContentRules=new gDe(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()}},kbi=class{constructor(i,e,t,o){this._disposables=new P;this.description=i,this._styleSheet=t,this._styleSheet.ref(),this.refCount=0;let n=p=>{let h=new gDe(p,o,e);if(this._disposables.add(h),h.hasContent)return h.className},r=p=>{let h=new gDe(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()}},MYe={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};"},gDe=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=PYe.getClassName(this._providerArgs.key,i);this._providerArgs.parentTypeKey&&(o=o+" "+PYe.getClassName(this._providerArgs.parentTypeKey,i)),this._className=o,this._unThemedSelector=PYe.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(id(MYe.contentIconPath,Na(A.revive(i.contentIconPath)))),typeof i.contentText=="string"){let o=i.contentText.match(/^.*$/m)[0].replace(/['\\]/g,"\\$&");e.push(id(MYe.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(id(MYe.gutterIconPath,Na(A.revive(i.gutterIconPath)))),typeof i.gutterIconSize<"u"&&e.push(id(MYe.gutterIconSize,i.gutterIconSize))),e.join("")}collectBorderSettingsCSSText(i,e){return this.collectCSSText(i,["border","borderColor","borderRadius","borderSpacing","borderStyle","borderWidth"],e)?(e.push(id("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(id(MYe[n],r))}return t.length!==o}resolveValue(i){if(xSe(i)){this._usesThemeColors=!0;let e=this._theme.getColor(i.id);return e?e.toString():"transparent"}return i}};var PYe=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 AYe=class extends hDe{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(Ec(e))return e.getModifiedEditor();let t=this.editorService.activeEditorPane?.getControl();return MU(t)&&pn(t.activeCodeEditor)?t.activeCodeEditor:null}async doOpenCodeEditorFromDiff(e,t,o){let n=this.editorService.activeTextEditorControl;if(!o&&Ec(n)&&e.options&&e.resource&&t===n.getModifiedEditor()&&n.getModel()&&Xe(e.resource,n.getModel()?.modified.uri)){let r=n.getModifiedEditor();return QE(e.options,r,0),r}return null}async doOpenCodeEditor(e,t,o){if(!this.configurationService.getValue().workbench?.editor?.enablePreviewFromCodeNavigation&&t&&!e.options?.pinned&&!o&&!Xe(t.getModel()?.uri,e.resource)){for(let s of this.editorService.visibleEditorPanes)if(ca(s.getControl())===t){s.group.pinEditor();break}}let r=await this.editorService.openEditor(e,o?vn:Un);if(r){let s=r.getControl();if(pn(s))return s;if(MU(s)&&pn(s.activeCodeEditor))return s.activeCodeEditor}return null}};AYe=I([m(0,ee),m(1,De),m(2,B)],AYe);we(Kt,AYe,1);var zf=ae("jsonEditingService");var DOt=class extends Error{constructor(e,t){super(e);this.code=t}};var IK=class{constructor(i,e,t,o,n,r,s){this._resolvedKeybindingItemBrand=void 0;this.resolvedKeybinding=i,this.chords=i?fDe(i.getDispatchChords()):[],i&&this.chords.length===0&&(this.chords=fDe(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 fDe(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 LOt(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=qe.getCommand(o);if(r&&typeof r.metadata=="object"&&dr(r.metadata.args))return}i.push(o)}};for(let o of fe.getMenuItems(D.CommandPalette))Kk(o)&&t(o.command.id,!0);for(let o of aa.getEditorActions())t(o.id,!0);for(let o of qe.getCommands().keys())t(o,!1);return i}var e4="keybinding.entry.template",Ano=d(17135,null),Nno=d(17136,null),Ono=d(17139,null);function Vno(a,i){let e=i?` +when:${i}`:"";return`@command:${a}${e}`}var cjo=GN(z9,Gy),djo=/@command:\s*([^\+]+)/i,ujo=/\+when:\s*(.+)/i,Fno=/@source:\s*(user|default|system|extension)/i,Wno=/@ext:\s*((".+")|([^\s]+))/i,pjo=/@keybinding:\s*((\".+\")|(\S+))/i,dk=class extends gg{constructor(e,t,o){super();this.keybindingsService=t;this.extensionService=o;this._keybindingItems=[],this._keybindingItemsSortedByPrecedence=[],this.modifierLabels={ui:YN.modifierLabels[e],aria:_St.modifierLabels[e],user:Xye.modifierLabels[e]}}fetch(e,t=!1){let o=t?this._keybindingItemsSortedByPrecedence:this._keybindingItems,n=djo.exec(e);if(n&&n[1]){let r=n[1].trim(),s=o.filter(l=>l.command===r);if(s.length){let l=ujo.exec(e);if(l&&l[1]){let c=l[1].trim();s=this.filterByWhen(s,r,c)}}return s.map(l=>({id:dk.getId(l),keybindingItem:l,templateId:e4}))}if(Fno.test(e))o=this.filterBySource(o,e),e=e.replace(Fno,"");else{let r=Wno.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(Wno,"")}else{let s=pjo.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:dk.getId(r),keybindingItem:r,templateId:e4}))}filterBySource(e,t){return/@source:\s*default/i.test(t)||/@source:\s*system/i.test(t)?e.filter(o=>o.source===Ano):/@source:\s*user/i.test(t)?e.filter(o=>o.source===Ono):/@source:\s*extension/i.test(t)?e.filter(o=>!Ae(o.source)||o.source===Nno):e}filterByExtension(e,t){return t=t.toLowerCase().trim(),e.filter(o=>!Ae(o.source)&&(Ei.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 Ebi(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:dk.getId(u),templateId:e4,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 IK(void 0,t,null,x.deserialize(o),!1,null,!1),l=new Map([[t,r]]);return[dk.toKeybindingEntry(t,s,l,this.getExtensionsMapping())]}splitKeybindingWords(e){let t=[];for(let o of e)t.push(...si(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(dk.toKeybindingEntry(r.command,r,e,t)),o.set(r.command,!0));let n=this.keybindingsService.getDefaultKeybindings().map(r=>r.command);for(let r of LOt(o)){let s=new IK(void 0,r,null,void 0,n.indexOf(r)===-1,null,!1);this._keybindingItemsSortedByPrecedence.push(dk.toKeybindingEntry(r,s,e,t))}return this._keybindingItemsSortedByPrecedence=Uo(this._keybindingItemsSortedByPrecedence,r=>dk.getId(r)),this._keybindingItems=this._keybindingItemsSortedByPrecedence.slice(0).sort((r,s)=>dk.compareKeybindingData(r,s)),super.resolve()}static getId(e){return e.command+(e?.keybinding?.getAriaLabel()??"")+e.when+(Ae(e.source)?e.source:e.source.identifier.value)}getExtensionsMapping(){let e=new Fd;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=fe.getCommand(e),s=o.get(e),l=Ono;if(t.isDefault){let c=t.extensionId??(t.resolvedKeybinding?void 0:r?.source?.id);l=c?n.get(c)??Nno:Ano}return{keybinding:t.resolvedKeybinding,keybindingItem:t,command:e,commandLabel:dk.getCommandLabel(r,s),commandDefaultLabel:dk.getCommandDefaultLabel(r),when:t.when?t.when.serialize():"",source:l}}static getCommandDefaultLabel(e){if(!IS.isDefaultVariant()&&e&&e.title&&e.title.original){let t=e.category?e.category.original:void 0,o=e.title.original;return t?d(17134,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(17134,null,o,n):n}return t||""}};dk=I([m(1,_e),m(2,lt)],dk);var Ebi=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,GN(Gy,K9),o),this.commandLabelMatches=e.commandLabel?this.matches(t,e.commandLabel,(s,l)=>Gy(s,e.commandLabel,!0),o):null,this.commandDefaultLabelMatches=e.commandDefaultLabel?this.matches(t,e.commandDefaultLabel,(s,l)=>Gy(s,e.commandDefaultLabel,!0),o):null,this.whenMatches=e.when?this.matches(null,e.when,GN(Gy,K9),o):null,Ae(e.source)?this.sourceMatches=this.matches(t,e.source,(s,l)=>Gy(s,e.source,!0),o):this.extensionLabelMatches=e.source.displayName?this.matches(t,e.source.displayName,(s,l)=>Gy(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?cjo(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 Uo(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&&Uw(e,s)===0||l&&Uw(e,l)===0||c&&Uw(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)||!mf(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(Uw(o,e)===0)return!0}else if(SW(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!!(mr(this.modifierLabels.ui.altKey,i)||mr(this.modifierLabels.aria.altKey,i)||mr(this.modifierLabels.user.altKey,i)||mr(d(17138,null),i))}wordMatchesCtrlModifier(i){return!!(mr(this.modifierLabels.ui.ctrlKey,i)||mr(this.modifierLabels.aria.ctrlKey,i)||mr(this.modifierLabels.user.ctrlKey,i))}wordMatchesMetaModifier(i){return!!(mr(this.modifierLabels.ui.metaKey,i)||mr(this.modifierLabels.aria.metaKey,i)||mr(this.modifierLabels.user.metaKey,i)||mr(d(17137,null),i))}wordMatchesShiftModifier(i){return!!(mr(this.modifierLabels.ui.shiftKey,i)||mr(this.modifierLabels.aria.shiftKey,i)||mr(this.modifierLabels.user.shiftKey,i))}};var mjo=Re("keybindings-editor-label-icon",M.keyboard,d(17132,null)),iD=class extends Us{constructor(e){super();this.searchOptions=null;this.resource=void 0;this.keybindingsModel=e.createInstance(dk,zo)}static{this.ID="workbench.input.keybindings"}get typeId(){return iD.ID}getName(){return d(17133,null)}getIcon(){return mjo}async resolve(){return this.keybindingsModel}matches(e){return e instanceof iD}dispose(){this.keybindingsModel.dispose(),super.dispose()}};iD=I([m(0,F)],iD);var hjo=Re("settings-editor-label-icon",M.settings,d(17147,null)),oD=class extends Us{constructor(e){super();this.resource=A.from({scheme:Y.vscodeSettings,path:"settingseditor"});this._settingsModel=e.createSettings2EditorModel()}static{this.ID="workbench.input.settings2"}matches(e){return super.matches(e)||e instanceof oD}get typeId(){return oD.ID}getName(){return d(17146,null)}getIcon(){return hjo}async resolve(){return this._settingsModel}dispose(){this._settingsModel.dispose(),super.dispose()}};oD=I([m(0,Po)],oD);var gjo=Re("preferences-editor-label-icon",M.settings,d(17145,null)),AJ=class a extends Us{constructor(){super(...arguments);this.resource=A.from({scheme:Y.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(17144,null)}getIcon(){return gjo}async resolve(){return null}};function vDe(a,...i){return i.some(e=>a.includes(e))}function Bno(a){return a===""||Jn(a)}function Tbi(a){let i=Array.isArray(a.type)?a.type:[a.type],e=vDe(i,"null"),t=(vDe(i,"number")||vDe(i,"integer"))&&(i.length===1||i.length===2&&e),o=bjo(a),n=vjo(a),r=Sjo(a),s=Ijo(a);return l=>{if(e&&Bno(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(17153,null)),t&&(Bno(l)||typeof l=="boolean"||Array.isArray(l)||isNaN(+l)?c.push(d(17158,null)):c.push(...o.filter(u=>!u.isValid(+l)).map(u=>u.message))),a.type==="string"&&(a.enum&&!SS(a.enum)?c.push(d(17175,null)):Ae(l)?c.push(...n.filter(u=>!u.isValid(l)).map(u=>u.message)):c.push(d(17176,null))),c.length?a.errorMessage?[a.errorMessage,...c].join(" "):c.join(" "):""}}function _bi(a,i){if(typeof i>"u")return;if(!(Array.isArray(i)?i:[i]).some(t=>fjo(a,t)))return d(17150,null,JSON.stringify(i))}function fjo(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 MOt(a){try{return new RegExp(a,"u")}catch{try{return new RegExp(a)}catch{return console.error(d(17151,null),a),/.*/}}}function vjo(a){let i=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,e;return typeof a.pattern=="string"&&(e=MOt(a.pattern)),[{enabled:a.maxLength!==void 0,isValid:(t=>t.length<=a.maxLength),message:d(17161,null,a.maxLength)},{enabled:a.minLength!==void 0,isValid:(t=>t.length>=a.minLength),message:d(17163,null,a.minLength)},{enabled:e!==void 0,isValid:(t=>e.test(t)),message:a.patternErrorMessage||d(17168,null,a.pattern)},{enabled:a.format==="color-hex",isValid:(t=>Oe.Format.CSS.parseHex(t)),message:d(17154,null)},{enabled:a.format==="uri"||a.format==="uri-reference",isValid:(t=>!!t.length),message:d(17177,null)},{enabled:a.format==="uri"||a.format==="uri-reference",isValid:(t=>i.test(t)),message:d(17178,null)},{enabled:a.format==="uri",isValid:(t=>{let o=t.match(i);return!!(o&&o[2])}),message:d(17179,null)},{enabled:a.enum!==void 0,isValid:(t=>a.enum.includes(t)),message:d(17159,null,a.enum?a.enum.map(t=>`"${t}"`).join(", "):"[]")}].filter(t=>t.enabled)}function bjo(a){let i=Array.isArray(a.type)?a.type:[a.type],e=vDe(i,"null"),t=vDe(i,"integer")&&(i.length===1||i.length===2&&e);if(!(vDe(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(17155,null,n)},{enabled:r!==void 0&&(a.minimum===void 0||r>=a.minimum),isValid:(s=>s>r),message:d(17156,null,r)},{enabled:a.maximum!==void 0&&(n===void 0||n>a.maximum),isValid:(s=>s<=a.maximum),message:d(17160,null,a.maximum)},{enabled:a.minimum!==void 0&&(r===void 0||r<a.minimum),isValid:(s=>s>=a.minimum),message:d(17162,null,a.minimum)},{enabled:a.multipleOf!==void 0,isValid:(s=>s%a.multipleOf===0),message:d(17164,null,a.multipleOf)},{enabled:t,isValid:(s=>s%1===0),message:d(17157,null)}].filter(s=>s.enabled)}function Sjo(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(17152,null),o+=`
`,o;let n=t;if(a.uniqueItems&&new Set(n).size<n.length&&(o+=d(17174,null),o+=`
`),a.minItems&&n.length<a.minItems&&(o+=d(17173,null,a.minItems),o+=`
`),a.maxItems&&n.length>a.maxItems&&(o+=d(17172,null,a.maxItems),o+=`
`),i.type==="string"){if(!SS(n))return o+=d(17169,null),o+=`
`,o;if(typeof i.pattern=="string"){let s=MOt(i.pattern);n.forEach(l=>{s.test(l)||(o+=i.patternErrorMessage||d(17171,null,e(l),e(i.pattern)))})}let r=i.enum;r&&n.forEach(s=>{r.indexOf(s)===-1&&(o+=d(17170,null,e(s),"["+r.map(e).join(", ")+"]"),o+=`
`)})}else(i.type==="integer"||i.type==="number")&&n.forEach(r=>{let s=ROt(i,r);s&&(o+=`${r}: ${s}
`)});return o}}}return null}function Ijo(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 yi(n)?Object.keys(n).forEach(l=>{let c=n[l];if(o?.pattern&&!s&&!MOt(o.pattern).test(l)){let p=o.patternErrorMessage||d(17167,null,o.pattern);r.push(p+`
`),s=!0}if(i&&l in i){let u=ROt(i[l],c);u&&r.push(`${l}: ${u}
`);return}if(e){for(let u in e)if(RegExp(u).test(l)){let p=ROt(e[u],c);p&&r.push(`${l}: ${p}
`);return}}if(t===!1)r.push(d(17166,null,l));else if(typeof t=="object"){let u=ROt(t,c);u&&r.push(`${l}: ${u}
`)}}):r.push(d(17165,null)),r.length?a.errorMessage?[a.errorMessage,...r].join(" "):r.join(" "):""}}return null}function Hno(a,i){return a?.pattern?MOt(a.pattern).test(i):!0}function ROt(a,i){return Tbi(a)(i)}var wg={startLineNumber:-1,startColumn:-1,endLineNumber:-1,endColumn:-1};function Dbi(a){return a.startLineNumber===-1&&a.startColumn===-1&&a.endLineNumber===-1&&a.endColumn===-1}var NYe=class extends gg{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}},Pue=class extends NYe{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=Uno(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}}},NJ=class extends NYe{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(oe.as(ii.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")}};NJ=I([m(1,B)],NJ);function Uno(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),lg.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&&(Dbi(h.range)||Dbi(h.keyRange)||Dbi(h.valueRange))&&e.pop()}};return a.isDisposed()||Wx(a.getValue(),u),e.length>0?[{id:a.isDisposed()?"":a.id,sections:[{settings:e}],title:"",titleRange:wg,range:l}]:[]}var Aue=class extends Pue{constructor(){super(...arguments);this._configurationGroups=[]}get configurationGroups(){return this._configurationGroups}parse(){super.parse(),this._configurationGroups=Uno(this.settingsModel,(e,t)=>t.length===0)}isSettingsProperty(e,t){return e==="settings"&&t.length===1}},SDe=class extends C{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=oe.as(ii.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=si(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(17148,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:Ae(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=lg.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;lg.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:Ae(t.source)?void 0:t.source,deprecationMessage:t.markdownDeprecationMessage||t.deprecationMessage,deprecationMessageIsMarkdown:!!t.markdownDeprecationMessage,validator:Tbi(t),allKeysAreBoolean:b,editPresentation:t.editPresentation,order:t.order,nonLanguageSpecificDefaultValueSource:y,isLanguageTagSetting:S,categoryLabel:(Ae(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?sJ.indexOf(e.scope)!==-1:this.target===5?a_e.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 OYe;for(let n=t;n<e.length;n++)o.pushGroup(e[n],n===t,n===e.length-1);return o.getContent()}},IDe=class extends NYe{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 OYe(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 Yt(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))}]}}},OYe=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){let t=r=>r.replace(/`#(.*)#`/g,(s,l)=>`\`${l}\``);i.descriptionRanges=[];let o=e+"// ",n=i.deprecationMessage?.split(/\n/g)??[];for(let r of[...n,...i.description])r=t(r),this._contentByLines.push(o+r),i.descriptionRanges.push({startLineNumber:this.lineCountWithOffset,startColumn:this.lastLine.indexOf(r)+1,endLineNumber:this.lineCountWithOffset,endColumn:this.lastLine.length});i.enum&&i.enumDescriptions?.some(r=>!!r)&&i.enumDescriptions.forEach((r,s)=>{let l=yjo(String(i.enum[s])),c=r?`${l}: ${t(r)}`:l,u=c.split(/\n/g);u[0]=" - "+u[0],this._contentByLines.push(...u.map(p=>`${e}// ${p}`)),i.descriptionRanges.push({startLineNumber:this.lineCountWithOffset,startColumn:this.lastLine.indexOf(c)+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)}},Lbi=class extends OYe{constructor(e="	"){super(0);this.indent=e}pushGroup(e){this._pushGroup(e,this.indent)}},POt=class extends C{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 Lbi;e.pushLine("{");for(let t of this.defaultSettings.getRegisteredGroups())e.pushGroup(t);e.pushLine("}"),this._content=e.getContent()}return this._content}};function yjo(a){return a&&a.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}function Mbi(a){return"// "+d(17149,null)+`
`+a.getDefaultKeybindingsContent()}var bDe=class{constructor(i,e){this._uri=i;this.keybindingService=e}get uri(){return this._uri}get content(){return this._content||(this._content=Mbi(this.keybindingService)),this._content}getPreference(){return null}dispose(){}};bDe=I([m(1,_e)],bDe);var wjo=`{
}`,FYe=class extends C{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 Mn;this._settingsGroups=void 0;this._cachedSettingsEditor2Input=void 0;this.defaultKeybindingsResource=A.from({scheme:Y.vscode,authority:"defaultsettings",path:"/keybindings.json"});this.defaultSettingsRawResource=A.from({scheme:Y.vscode,authority:"defaultsettings",path:"/defaultSettings.jsonc"});this._register(h.onDidUpdateKeybindings(()=>{let N=g.getModel(this.defaultKeybindingsResource);N&&g.updateModel(N,Mbi(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(PEe)}createOrGetCachedSettingsEditor2Input(){return(!this._cachedSettingsEditor2Input||this._cachedSettingsEditor2Input.isDisposed())&&(this._cachedSettingsEditor2Input=new oD(this)),this._cachedSettingsEditor2Input}getFolderSettingsResource(e){let t=this.contextService.getWorkspaceFolder(e);return t?t.toResource(PEe):null}hasDefaultSettingsContent(e){return this.isDefaultSettingsResource(e)||Xe(e,this.defaultSettingsRawResource)||Xe(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(Xe(e,this.defaultSettingsRawResource))return this._defaultRawSettingsEditorModel||(this._defaultRawSettingsEditorModel=this._register(this.instantiationService.createInstance(POt,this.getDefaultSettings(3))),this._register(this._defaultRawSettingsEditorModel.onDidContentChanged(()=>this._onDidDefaultSettingsContentChanged.fire(e)))),this._defaultRawSettingsEditorModel.content;if(Xe(e,this.defaultKeybindingsResource))return this.instantiationService.createInstance(bDe,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(AJ),void 0,ym)}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():oe.as(ii.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,MEe(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(17143,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(17141,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:Ys.id},label:d(17140,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(iD),{...t},o);t.query&&n.search(t.query)}}openDefaultKeybindingsFile(){return this.editorService.openEditor({resource:this.defaultKeybindingsResource,label:d(17140,null)})}getEditorGroupFromOptions(e){return this.configurationService.getValue("workbench.editor.useModal")!=="off"&&!this.environmentService.enableSmokeTestDriver&&!this.environmentService.extensionTestsLocationURI?ym:e.openToSide?vn:e?.groupId!==void 0?this.editorGroupService.getGroup(e.groupId)??this.editorGroupService.activeGroup:Un}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(o9e),r=!!this.configurationService.getValue(i9e);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,{...MEe(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,MEe(t),o)}createSplitJsonEditorInput(e,t){let o=this.textEditorService.createTextEditor({resource:t}),n=this.textEditorService.createTextEditor({resource:this.getDefaultSettingsResource(e)});return this.instantiationService.createInstance(ga,o.getName(),void 0,n,o)}createSettings2EditorModel(){return this.instantiationService.createInstance(NJ,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===Y.vscode&&!!e.path.match(/\/(\d+\/)?settings\.json$/)}isDefaultWorkspaceSettingsResource(e){return e.authority==="defaultsettings"&&e.scheme===Y.vscode&&!!e.path.match(/\/(\d+\/)?workspaceSettings\.json$/)}isDefaultFolderSettingsResource(e){return e.authority==="defaultsettings"&&e.scheme===Y.vscode&&!!e.path.match(/\/(\d+\/)?resourceSettings\.json$/)}getDefaultSettingsResource(e){switch(e){case 5:return A.from({scheme:Y.vscode,authority:"defaultsettings",path:"/workspaceSettings.json"});case 6:return A.from({scheme:Y.vscode,authority:"defaultsettings",path:"/resourceSettings.json"})}return A.from({scheme:Y.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(Aue,r,e)}let n=await this.textModelResolverService.createModelReference(t);return this.instantiationService.createInstance(Pue,n,e)}async createDefaultSettingsEditorModel(e){let t=await this.textModelResolverService.createModelReference(e),o=this.getConfigurationTargetFromDefaultSettingsResource(e);return this.instantiationService.createInstance(IDe,e,t,this.getDefaultSettings(o))}getDefaultSettings(e){return e===5?(this._defaultWorkspaceSettingsContentModel??=this._register(new SDe(this.getMostCommonlyUsedSettings(),e,this.configurationService)),this._defaultWorkspaceSettingsContentModel):e===6?(this._defaultFolderSettingsContentModel??=this._register(new SDe(this.getMostCommonlyUsedSettings(),e,this.configurationService)),this._defaultFolderSettingsContentModel):(this._defaultUserSettingsContentModel??=this._register(new SDe(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(Ur(n.value)).indexOf("settings")===-1&&await this.jsonEditingService.write(t,[{path:["settings"],value:{}}],!0);return}await this.createIfNotExists(t,wjo)}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(17142,null,this.labelService.getUriLabel(e,{relative:!0}),Cn(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?ca(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&&El.get(r)?.triggerSuggest())}async getPositionToReveal(e,t,o,n){let r=n.getModel();if(!r)return null;let s=oe.as(ii.Configuration).getConfigurationProperties()[e],l=lg.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:r$e(u);if(h=h===void 0&&l?{}:h,h!==void 0){let g=o instanceof Aue?["settings",e]:[e];await this.jsonEditingService.write(o.uri,[{path:g,value:h}],!1),p=o.getPreference(e)}}if(p)if(t)if(yi(p.value)||Array.isArray(p.value)){c={lineNumber:p.valueRange.startLineNumber,column:p.valueRange.startColumn+1},n.setPosition(c),await this.instantiationService.invokeFunction(g=>rL.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=>rL.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(Uw(n.key,e)===0)return n}async handleURL(e){if(Uw(e.authority,AEe)!==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},()=>H.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()}};FYe=I([m(0,ee),m(1,Et),m(2,Ho),m(3,B),m(4,Ne),m(5,Pe),m(6,F),m(7,mn),m(8,an),m(9,Nt),m(10,_e),m(11,Ct),m(12,zf),m(13,ot),m(14,yo),m(15,lk),m(16,nI),m(17,lt),m(18,Bo),m(19,Vt)],FYe);we(Po,FYe,1);var WYe=class{constructor(i,e,t,o){this.fileService=i;this.textModelResolverService=e;this.textFileService=t;this.filesConfigurationService=o;this.queue=new Op}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?An.replace(n,i.content):An.insert(t,i.content);return e.pushEditOperations([new Yt(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 Sb(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 Ur(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 DOt(e,i))}toErrorMessage(i){if(i===0)return d(16718,null)}};WYe=I([m(0,be),m(1,Nt),m(2,Ho),m(3,lr)],WYe);we(zf,WYe,1);var bF=class extends rw{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=CP;this.capabilities=0;this.versionId=0;this.ignoreDirtyOnModelContentChange=!1;this.ignoreSaveFromSaveParticipants=!1;this.lastModelContentChangeFromUndoRedo=void 0;this.saveSequentializer=new Abe;this.dirty=!1;this.inConflictMode=!1;this.inOrphanMode=!1;this.inErrorMode=!1;this.hasEncodingSetExplicitly=!1;this.name=No(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=ph.registerSource("textFileEncoding.source",d(17239,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 Pi(100,ve.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:mb});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"),sn("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),sn("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=gL,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=mb;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:gL,value:await W9(await this.textFileService.getDecodedStream(this.resource,e.value,{encoding:mb})),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=gL: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 UU&&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,_c.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===Fr)&&!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 $e;return this.progressService.withProgress({title:d(17237,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<bF.UNDO_REDO_SAVE_PARTICIPANTS_AUTO_SAVE_THROTTLE_THRESHOLD&&await Pi(bF.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){so(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(17238,null)}),this.trace(`doSave(${e}) - before write()`);let r=Oi(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())?gL: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===vV||this.contentEncoding===n5||this.contentEncoding===r5){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:bF.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()}};bF=I([m(3,kt),m(4,Ct),m(5,be),m(6,Ho),m(7,Gm),m(8,ne),m(9,Wa),m(10,lr),m(11,ot),m(12,eS),m(13,Bi),m(14,wn),m(15,lt),m(16,Bo)],bF);var yDe=class extends C{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 vW&&s.setDelegate(this);for(let s of r.future)s instanceof vW&&s.setDelegate(this)}}))}prepareUndoRedo(e){let t=e.getMissingModels();if(t.length===0)return C.None;let o=t.map(async n=>{try{return await this._textModelService.createModelReference(n)}catch{return C.None}});return Promise.all(o).then(n=>({dispose:()=>Ue(n)}))}};yDe=I([m(0,Ct),m(1,Nt),m(2,Cl)],yDe);var VYe=class extends Ww{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 Set}createReferencedObject(e){return this.doCreateReferencedObject(e)}async doCreateReferencedObject(e,t){this.modelsToDispose.delete(e);let o=A.parse(e);if(o.scheme===Y.inMemory){if(!this.modelService.getModel(o))throw new Error(`Unable to resolve inMemory resource ${e}`);let r=this.instantiationService.createInstance(t5,o);if(this.ensureResolvedModel(r,e))return r}if(o.scheme===Y.untitled){let n=await this.textFileService.untitled.resolve({untitledResource:o});if(this.ensureResolvedModel(n,e))return n}if(this.fileService.hasProvider(o)){let n=await this.textFileService.files.resolve(o,{reason:2});if(this.ensureResolvedModel(n,e))return n}if(this.providers.has(o.scheme)){await this.resolveTextModelContent(e);let n=this.instantiationService.createInstance(t5,o);if(this.ensureResolvedModel(n,e))return n}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(Kzi(e))return!0;throw new Error(`Unable to resolve resource ${t}`)}destroyReferencedObject(e,t){A.parse(e).scheme!==Y.inMemory&&(this.modelsToDispose.add(e),(async()=>{try{let n=await t;if(!this.modelsToDispose.has(e)||(n instanceof bF?await this.textFileService.files.canDispose(n):n instanceof B_&&await this.textFileService.untitled.canDispose(n),!this.modelsToDispose.has(e)))return;n.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 resolveTextModelContent(e){let t=A.parse(e),o=this.providers.get(t.scheme)||[];for(let n of o){let r=await n.provideTextContent(t);if(r)return r}throw new Error(`Unable to resolve text model content for resource ${e}`)}};VYe=I([m(0,F),m(1,Ho),m(2,be),m(3,Ct)],VYe);var BYe=class extends C{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 yDe(this.modelService,this,this.undoRedoService))}get resourceModelCollection(){return this._resourceModelCollection||(this._resourceModelCollection=this.instantiationService.createInstance(VYe)),this._resourceModelCollection}get asyncModelCollection(){return this._asyncModelCollection||(this._asyncModelCollection=new tbe(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===Y.untitled||e.scheme===Y.inMemory?!0:this.resourceModelCollection.hasTextModelContentProvider(e.scheme)}};BYe=I([m(0,F),m(1,be),m(2,Cl),m(3,Ct),m(4,dt)],BYe);we(Nt,BYe,1);var yK=class extends C{constructor(e,t,o){super();this.editorGroupService=t;this.storageService=o;this.keyMap=new Map;this.mostRecentEditorsMap=new zH;this.editorsPerResourceCounter=new vt;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 P;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)})),H.once(e.onWillDispose)(()=>Ue(t))}onDidChangeEditorPartOptions(e){if(!uo(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 ga?(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(yK.STORAGE_KEY,1):this.storageService.store(yK.STORAGE_KEY,JSON.stringify(this.serialize()),1,1))}serialize(){let e=oe.as(rn.EditorFactory),t=[...this.mostRecentEditorsMap.values()],o=new Map;return{entries:si(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(yK.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)}};yK=I([m(1,Et),m(2,le)],yK);var Nue=class extends C{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 vt;this.closeOnFileDelete=!1;this.editorGroupsContainer=e??t,this.editorsObserver=this._register(this.instantiationService.createInstance(yK,this.editorGroupsContainer)),this.onConfigurationUpdated(),this.registerListeners()}createScoped(e,t){return t.add(new Nue(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 P;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})})),H.once(e.onWillDispose)(()=>{Ue(t)})}handleVisibleEditorsChange(){let e=new Mn;for(let t of this.visibleEditors){let o=Uo(si([no.getCanonicalUri(t,{supportSideBySide:1}),no.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)||(Ue(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=Dbe(s.path,e.path,this.uriIdentityService.extUri.ignorePathCasing(s));l=je(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)};Ta(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 FN?s=e.contains(r,2):s=this.uriIdentityService.extUri.isEqualOrParent(r,e),!s)return;let l=!1;t&&this.fileService.hasProvider(r)&&(await Pi(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 ga?(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)||Ec(t))return t;if(MU(t)&&pn(t.activeCodeEditor))return t.activeCodeEditor}}get activeTextEditorLanguageId(){let e,t=this.activeTextEditorControl;return Ec(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 si(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 of?(n.push(o.getPrimaryEditorPane()?.getControl()),n.push(o.getSecondaryEditorPane()?.getControl())):n.push(o.getControl());for(let r of n)(pn(r)||Ec(r))&&t.push(r)}return t}getVisibleTextEditorControls(e){return this.doGetVisibleTextEditorControls(si(this.editorGroupsContainer.getGroups(e===1?2:1).map(t=>t.activeEditorPane)))}get visibleEditors(){return si(this.editorGroupsContainer.groups.map(e=>e.activeEditor))}async openEditor(e,t,o){let n,r=Ta(e)?t:e.options,s;if(B7i(t)&&(o=t),!Ta(e)){let l=await this.editorResolverService.resolveEditor(e,o);if(l===1)return;Rj(l)&&(n=l.editor,r=l.options,s=l.group)}if(n||(n=Ta(e)?e:await this.textEditorService.resolveTextEditor(e)),!s){let l,c=this.instantiationService.invokeFunction(Eue,{editor:n,options:r},o);c instanceof Promise?[s,l]=await c:[s,l]=c,l&&(r={...r,activation:l})}return 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(!tV(s)){let p=await this.editorResolverService.resolveEditor(s,t);if(p===1)continue;Rj(p)&&(l=p,c=p.group)}if(l||(l=tV(s)?s:{editor:await this.textEditorService.resolveTextEditor(s),options:s.options}),!c){let p=this.instantiationService.invokeFunction(Eue,l,t);p instanceof Promise?[c]=await p:[c]=p}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 si(await fn.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 Mn,o=!1,n=!1;for(let r of e)if(tV(r)){let s=no.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 Fa)}else dC(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),db(r)?(A.isUri(r.original.resource)&&t.add(r.original.resource),A.isUri(r.modified.resource)&&t.add(r.modified.resource),o=!0):QS(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)||cn(o)?[]:void 0;if(cn(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(!Ta(r.replacement)){let l=await this.editorResolverService.resolveEditor(r.replacement,o);if(l===1)continue;Rj(l)&&(s={editor:r.editor,replacement:l.editor,options:l.options,forceReplaceDirty:r.forceReplaceDirty})}s||(s={editor:r.editor,replacement:cdi(r)?r.replacement:await this.textEditorService.resolveTextEditor(r.replacement),options:cdi(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 fn.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 Us?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:si(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 fn.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=>Ue(e)),this.activeOutOfWorkspaceWatchers.clear()}};Nue=I([m(1,Et),m(2,F),m(3,be),m(4,B),m(5,Pe),m(6,dt),m(7,ul),m(8,Vd),m(9,oi),m(10,lk)],Nue);we(ee,new Mt(Nue,[void 0],!1));var QP=class extends C{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 Pm);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(QP.cacheStorageID,0,JSON.stringify([])))),this.storageService.remove(QP.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(Eue,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(),C_(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=no.getCanonicalUri(r,{supportSideBySide:1});if(this.cache&&c&&this.resourceMatchesCache(c)&&await this.extensionService.whenInstalledExtensionsRegistered(),c===void 0)c=A.from({scheme:Y.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||tV(e)))return 2;if(!u){let g=this.getEditor(c,Ys.id);if(u=g?.editor,p=g?.conflictingDefault,!u)return 2}if(db(r)&&r.options?.override===void 0){let g=no.getCanonicalUri(r,{supportSideBySide:2});g||(g=A.from({scheme:Y.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,Ys.id);u=v,p=b}if(!u)return 2}if(r.options={override:u.editorInfo.id,...r.options},u.editorFactoryObject.createDiffEditorInput===void 0&&db(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(!Rj(o))return 2;let n=await this.resolveEditor(e.secondary,o.group??t);return Rj(n)?{group:o.group??n.group,editor:this.instantiationService.createInstance(ga,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=Zm(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&&eX(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(wui)||{},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(wui,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"||eX(n,e))&&o.push(s);return o.sort((n,r)=>lR(r.editorInfo.priority)===lR(n.editorInfo.priority)&&typeof r.globPattern=="string"&&typeof n.globPattern=="string"?r.globPattern.length-n.globPattern.length:lR(r.editorInfo.priority)-lR(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 Uo(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=>lR(p.editorInfo.priority)>=lR(s)&&p.editorInfo.id!==Ys.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=no.getCanonicalUri(e,{supportSideBySide:1});if(n&&typeof n.activation>"u"&&(n={...n,activation:n.preserveFocus?2:void 0}),dC(e)){if(!o.editorFactoryObject.createMergeEditorInput)return;let u=await o.editorFactoryObject.createMergeEditorInput(e,t);return{editor:u.editor,options:u.options??n}}if(db(e)){if(!o.editorFactoryObject.createDiffEditorInput)return;let u=await o.editorFactoryObject.createDiffEditorInput(e,t);return{editor:u.editor,options:u.options??n}}if(bY(e)){if(!o.editorFactoryObject.createMultiDiffEditorInput)return;let u=await o.editorFactoryObject.createMultiDiffEditorInput(e,t);return{editor:u.editor,options:u.options??n}}if(C_(e))throw new Error("Untyped side by side editor input not supported here.");if(Hxe(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=Uo([...this.editorGroupService.groups]);for(let r of n)for(let s of r.editors)Xe(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(QP.conflictingDefaultsStorageID,0,"{}")),c=`*${ms(e)}`,u=()=>{l[c]=[],s.forEach(g=>l[c].push(g.editorInfo.id)),this.storageService.store(QP.conflictingDefaultsStorageID,JSON.stringify(l),0,1)};if(l[c]?.find(g=>g===n.editorId))return;let h=this.notificationService.prompt(St.Warning,d(16795,null),[{label:d(16794,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(16796,null,t),run:u}]).onDidClose(()=>{u(),h.dispose()})}mapEditorsToQuickPickEntry(e,t){let o=this.editorGroupService.activeGroup.findEditors(e).at(0),n=e.scheme===Y.untitled?this._registeredEditors.filter(h=>h.editorInfo.priority!=="exclusive"):this.findMatchingEditors(e);n=Uo(n,h=>h.editorInfo.id);let r=this.getAssociationsForResource(e)[0]?.viewType;n=n.sort((h,g)=>h.editorInfo.id===Ys.id?-1:g.editorInfo.id===Ys.id?1:lR(g.editorInfo.priority)-lR(h.editorInfo.priority));let s=[],l=d(16800,null),c=d(16798,null),u=d(16799,null),p=r;if(!p&&n.length>2&&n[1]?.editorInfo.priority!=="option"&&(p=n[1]?.editorInfo.id),p||(p=Ys.id),n.forEach(h=>{let g=o?.editorId??Ys.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&&ms(e)!==""){let h={type:"separator"};s.push(h);let g={id:QP.configureDefaultID,label:d(16797,null,`*${ms(e)}`)};s.push(g)}return s}async doPickEditor(e,t){let o=no.getOriginalUri(e,{supportSideBySide:1});o===void 0&&(o=A.from({scheme:Y.untitled}));let n=this.mapEditorsToQuickPickEntry(o,t),r=new P,s=r.add(this.quickInputService.createQuickPick({useSeparators:!0})),l=t?d(16802,null,`*${ms(o)}`):d(16801,null,Ye(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(`*${ms(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(`*${ms(o)}`,h.item.id)})),s.show()});if(s.dispose(),u)return u.item.id===QP.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!==Ys.id)&&(eP(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(QP.cacheStorageID,JSON.stringify(Array.from(e)),0,1)}resourceMatchesCache(e){if(!this.cache)return!1;for(let t of this.cache)if(eX(t,e))return!0;return!1}};QP=I([m(0,Et),m(1,F),m(2,B),m(3,Ge),m(4,Ne),m(5,le),m(6,lt),m(7,ne)],QP);we(ul,QP,0);var Oue=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=En.create(),r=o.map(s=>xn(async l=>{try{return(await s.provideAiRelatedInformation(i,l)).filter(u=>e.includes(u.type))}catch{}return[]}));try{let s=await Wp(Promise.allSettled(r),Oue.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`)}}};Oue=I([m(0,ne)],Oue);we(FTe,Oue,1);var Pbi=class a extends C{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 Go;return this._embeddingsResultsPromises.set(e,n),await wa(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 Go;return this._llmRankedResultsPromises.set(e,n),await wa(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 Go;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 Go;o.complete(e.settings),this._llmRankedResultsPromises.set(e.query,o)}}}}};we(dEe,Pbi,1);var ER=class extends C{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 P);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 jt);this.resourceExcludeMatcher=this._register(new hN(It,()=>{let e=this._register(this.instantiationService.createInstance(YS,t=>MP(t?this.configurationService.getValue({resource:t}):this.configurationService.getValue())||Object.create(null),t=>t.affectsConfiguration(Xgt)||t.affectsConfiguration(_Lt)));return this._register(e.onExpressionChange(()=>this.removeExcludedFromHistory())),e}));this.editorHelper=this.instantiationService.createInstance(wDe),this.canNavigateBackContextKey=new Q("canNavigateBack",!1,d(17047,null)).bindTo(this.contextKeyService),this.canNavigateForwardContextKey=new Q("canNavigateForward",!1,d(17050,null)).bindTo(this.contextKeyService),this.canNavigateBackInNavigationsContextKey=new Q("canNavigateBackInNavigationLocations",!1,d(17049,null)).bindTo(this.contextKeyService),this.canNavigateForwardInNavigationsContextKey=new Q("canNavigateForwardInNavigationLocations",!1,d(17052,null)).bindTo(this.contextKeyService),this.canNavigateToLastNavigationLocationContextKey=new Q("canNavigateToLastNavigationLocation",!1,d(17054,null)).bindTo(this.contextKeyService),this.canNavigateBackInEditsContextKey=new Q("canNavigateBackInEditLocations",!1,d(17048,null)).bindTo(this.contextKeyService),this.canNavigateForwardInEditsContextKey=new Q("canNavigateForwardInEditLocations",!1,d(17051,null)).bindTo(this.contextKeyService),this.canNavigateToLastEditLocationContextKey=new Q("canNavigateToLastEditLocation",!1,d(17053,null)).bindTo(this.contextKeyService),this.canReopenClosedEditorContextKey=new Q("canReopenClosedEditor",!1,d(17055,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 P),t=()=>{e.clear(),this.configurationService.getValue(ER.MOUSE_NAVIGATION_SETTING)&&this._register(H.runAndSubscribe(this.layoutService.onDidAddContainer,({container:o,disposables:n})=>{let r=n.add(new P);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(ER.MOUSE_NAVIGATION_SETTING)&&t()})),t()}onMouseDownOrUp(e,t){switch(e.button){case 3:$t.stop(e),t&&this.goBack();break;case 4:$t.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)}pce(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 FN?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;Ta(e)?t=no.getOriginalUri(e):e instanceof FN||(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(ER.NAVIGATION_SCOPE_SETTING);t==="editorGroup"?this.editorNavigationScope=1:t==="editor"?this.editorNavigationScope=2:this.editorNavigationScope=0};this._register(this.configurationService.onDidChangeConfiguration(t=>{t.affectsConfiguration(ER.NAVIGATION_SCOPE_SETTING)&&e()})),e()}getStack(e=this.editorGroupService.activeGroup,t=e.activeEditor){switch(this.editorNavigationScope){case 2:{if(!t)return new Abi;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 P;n=r.add(this.instantiationService.createInstance(Fue,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 P;o=n.add(this.instantiationService.createInstance(Fue,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(Fue,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=no.getOriginalUri(t,{supportSideBySide:3});A.isUri(s)?r.push(s):s&&r.push(...si([s.primary,s.secondary])),this.removeFromRecentlyClosedEditors(t),this.recentlyClosedEditors.push({editorId:t.editorId,editor:n,resource:no.getOriginalUri(t),associatedResources:r,index:e.index,sticky:e.sticky}),this.recentlyClosedEditors.length>ER.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||(tGe(this.recentlyClosedEditors,e),this.reopenLastClosedEditor())}removeFromRecentlyClosedEditors(e){this.recentlyClosedEditors=this.recentlyClosedEditors.filter(t=>Ta(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>ER.MAX_HISTORY_ITEMS&&this.editorHelper.clearOnEditorDispose(this.history.pop(),this.editorHistoryListeners),Ta(e)&&this.editorHelper.onEditorDispose(e,()=>this.updateHistoryOnEditorDispose(o),this.editorHistoryListeners))}updateHistoryOnEditorDispose(e){if(Ta(e))if(!ldi(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);QS(r)&&this.includeInHistory(r)&&t.push(r)}this.replaceInHistory(e,...t)}else this.includeInHistory(e)||this.removeFromHistory(e)}includeInHistory(e){return Ta(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(ER.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)Ta(t)||!QS(t)||e.push({editor:{...t,resource:t.resource.toString()}});this.storageService.store(ER.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(Ta(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(Ta(o)?n=no.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()}};ER=I([m(0,ee),m(1,Et),m(2,Pe),m(3,le),m(4,B),m(5,be),m(6,Ff),m(7,F),m(8,fi),m(9,X),m(10,ne)],ER);we(zs,ER,0);var AOt=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}},Fue=class extends C{constructor(e,t){super();this.scope=e;this.instantiationService=t;this.selectionsStack=this._register(this.instantiationService.createInstance(t4,0,this.scope)),this.editsStack=this._register(this.instantiationService.createInstance(t4,1,this.scope)),this.navigationsStack=this._register(this.instantiationService.createInstance(t4,2,this.scope)),this.stacks=[this.selectionsStack,this.editsStack,this.navigationsStack],this.onDidChange=H.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)}};Fue=I([m(1,F)],Fue);var Abi=class{constructor(){this.onDidChange=H.None}canGoForward(){return!1}async goForward(){}canGoBack(){return!1}async goBack(){}async goPrevious(){}canGoLast(){return!1}async goLast(){}handleActiveEditorChange(){}handleActiveEditorSelectionChange(){}clear(){}remove(){}move(){}dispose(){}},t4=class extends C{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 jt);this.mapGroupToDisposable=this._register(new jt);this.stack=[];this.index=-1;this.previousIndex=-1;this.navigating=!1;this.currentSelectionState=void 0;this.editorHelper=o.createInstance(wDe),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=pce(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 AOt({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 AOt({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>t4.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);Ta(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(!pce(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)),Ta(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}};t4=I([m(2,F),m(3,ee),m(4,Et),m(5,ne)],t4);var wDe=class{constructor(i,e,t,o){this.uriIdentityService=i;this.lifecycleService=e;this.fileService=t;this.pathService=o}preferResourceEditorInput(i){let e=no.getOriginalUri(i);if(e?.scheme===Y.file||e?.scheme===Y.vscodeRemote||e?.scheme===Y.vscodeUserData||e?.scheme===this.pathService.defaultUriScheme){if(Ta(i)){let o=i.toUntyped();if(QS(o))return o}return i}else return Ta(i)?i:void 0}matchesEditor(i,e){return i instanceof FN||i instanceof ON?Ta(e)?!1:i instanceof FN?i.contains(e.resource,2):this.matchesFile(e.resource,i):Ta(i)?Ta(e)?i.matches(e):this.matchesFile(e.resource,i):Ta(e)?this.matchesFile(i.resource,e):i&&e&&this.uriIdentityService.extUri.isEqual(i.resource,e.resource)}matchesFile(i,e){if(e instanceof FN)return e.contains(i,2);if(e instanceof ON)return this.uriIdentityService.extUri.isEqualOrParent(i,e.resource);if(Ta(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=H.once(i.onWillDispose)(()=>e()),n=t.get(i);n||(n=new P,t.set(i,n)),n.add(o)}clearOnEditorDispose(i,e){Ta(i)&&e.deleteAndDispose(i)}};wDe=I([m(0,dt),m(1,ao),m(2,be),m(3,wn)],wDe);var NOt="workbench.actions.manage",OOt="workbench.actions.accounts";var HYe=class extends C{constructor(e,t,o){super();this.viewId=e;this.viewDescriptorService=t;this.activityService=o;this.activity=void 0;this.activityDisposable=C.None;this._register(H.filter(this.viewDescriptorService.onDidChangeContainer,n=>n.views.some(r=>r.id===e))(()=>this.update())),this._register(H.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()}};HYe=I([m(1,Ri),m(2,zl)],HYe);var UYe=class extends C{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 C.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(HYe,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(OOt,e)}showGlobalActivity(e){return this.showActivity(NOt,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)})}};UYe=I([m(0,Ri),m(1,F)],UYe);we(zl,UYe,1);var SF=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=Bb.lowerCaseToEnum(n);return[new KD(e.ctrl,e.shift,e.alt,e.meta,r),e.remains]}let o=vp.fromUserSettings(e.key);return[new Hb(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 tU(e):null}};var Cjo=/^(cursor|delete|undo|redo|tab|editor\.action\.clipboard)/,FOt=class extends C{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 EI,this._currentChordStatusMessage=null,this._ignoreSingleModifiers=CDe.EMPTY,this._currentSingleModifier=null,this._currentSingleModifierClearTimeout=new Nl,this._currentlyDispatchingCommandId=null,this._logging=!1}get onDidUpdateKeybindings(){return this._onDidUpdateKeybindings?this._onDidUpdateKeybindings.event:H.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 si(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"),m5e;let[n]=o.getDispatchChords();if(n===null)return this._log("\\ Keyboard event cannot be dispatched"),m5e;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 Xve("impossible");case 1:this._currentChordStatusMessage=this._notificationService.status(d(2102,null,t));break;default:{let o=this._currentChords.map(({label:n})=>n).join(", ");this._currentChordStatusMessage=this._notificationService.status(d(2105,null,o))}}this._scheduleLeaveChordMode(),ZT.enabled&&ZT.disable()}_leaveChordMode(){this._currentChordStatusMessage&&(this._currentChordStatusMessage.close(),this._currentChordStatusMessage=null),this._currentChordChecker.cancel(),this._currentChords=[],ZT.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=CDe.EMPTY,this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,!1):(this._ignoreSingleModifiers=CDe.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 CDe(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(2104,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(2104,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}Cjo.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(2103,null,e,r)}return e}},CDe=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 WOt=ae("keyboardLayoutService");function xjo(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 Kno(a,i){if(!a&&!i)return!0;if(!a||!i)return!1;for(let e=0;e<193;e++){let t=Bb.toString(e),o=a[t],n=i[t];if(!xjo(o,n))return!1}return!0}function kjo(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 Gno(a,i){if(!a&&!i)return!0;if(!a||!i)return!1;for(let e=0;e<193;e++){let t=Bb.toString(e),o=a[t],n=i[t];if(!kjo(o,n))return!1}return!0}var zYe=class{static writeKeybindingItem(i,e){if(!e.resolvedKeybinding)return;let t=JSON.stringify(e.resolvedKeybinding.getUserSettingsLabel());i.write(`{ "key": ${Ejo(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"?SF.parseKeybinding(i.key):null,t="when"in i&&typeof i.when=="string"?x.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 Ejo(a,i){return a.length<i?a+new Array(i-a.length).join(" "):a}var VOt=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 Tjo(a,i){return a?typeof a.command!="string"?(i.push(d(17069,null,"command")),!1):a.key&&typeof a.key!="string"?(i.push(d(17068,null,"key")),!1):a.when&&typeof a.when!="string"?(i.push(d(17068,null,"when")),!1):a.mac&&typeof a.mac!="string"?(i.push(d(17068,null,"mac")),!1):a.linux&&typeof a.linux!="string"?(i.push(d(17068,null,"linux")),!1):a.win&&typeof a.win!="string"?(i.push(d(17068,null,"win")),!1):!0:(i.push(d(17067,null)),!1)}var $no={type:"object",default:{command:"",key:""},required:["command","key"],properties:{command:{description:d(17073,null),type:"string"},args:{description:d(17072,null)},key:{description:d(17074,null),type:"string"},mac:{description:d(17076,null),type:"string"},linux:{description:d(17075,null),type:"string"},win:{description:d(17078,null),type:"string"},when:{description:d(17077,null),type:"string"}}},qno=Tn.registerExtensionPoint({extensionPoint:"keybindings",deps:[vfi],jsonSchema:{description:d(17071,null),oneOf:[$no,{type:"array",items:$no}]}}),_jo=[90,91,92,93,95,96,97,98,99,100,101,102,103,104,105],YV=new Map;YV.set(95,22);YV.set(96,23);YV.set(97,24);YV.set(98,25);YV.set(99,26);YV.set(100,27);YV.set(101,28);YV.set(102,29);YV.set(103,30);YV.set(104,21);var i4=class extends FOt{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(ue.isComposing.key,!1),this.kbsJsonSchema=new Obi,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 Nbi(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()})),qno.setHandler(g=>{let f=[];for(let v of g)this._handleKeybindingsExtensionPointUser(v.description.identifier,v.description.isBuiltin,v.value,v.collector,f);yt.setExtensionKeybindings(f),this.updateResolver()}),this.updateKeybindingsJsonSchema(),this._register(l.onDidRegisterExtensions(()=>this.updateKeybindingsJsonSchema())),this._register(H.runAndSubscribe(Fg,({window:g,disposables:f})=>f.add(this._registerKeyListeners(g)),{window:It,disposables:this._store})),this._register(Bk(g=>{if(g!==It.vscodeWindowId)return;let f=navigator.keyboard;og.keyboard!==2&&(wS(It)?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 P;return t.add(j(e,re.KEY_DOWN,o=>{if(this._keybindingHoldMode)return;this.isComposingGlobalContextKey.set(o.isComposing);let n=new Ii(o);this._log(`/ Received  keydown event - ${ZUi(o)}`),this._log(`| Converted keydown event - ${e1i(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 Ii(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(),tGe(this._contributions,o),this.updateKeybindingsJsonSchema()})}updateKeybindingsJsonSchema(){this.kbsJsonSchema.updateSchema(this._contributions.flatMap(e=>e.contribution.getSchemaAdditions()))}_printKeybinding(e){return Xye.toLabel(zo,e.chords,t=>t instanceof Hb?vp.toString(t.keyCode):Bb.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 yt.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 Go;let t=Vn(Me(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(yt.getDefaultKeybindings(),!0),t=this._resolveUserKeybindingItems(this.userKeybindings.keybindings,!1);this._cachedResolver=new MIt(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 IK(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 IK(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 IK(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 IK(c,r.command,r.commandArgs,s,t,null,!1)}}return o}_assertBrowserConflicts(e){if(og.keyboard===0||og.keyboard===1&&wS(It))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&&zo===2&&(n|=256),(n&o)===2560&&(t instanceof KD&&(t.scanCode===86||t.scanCode===85)||t instanceof Hb&&(t.keyCode===15||t.keyCode===17))||(n&o)===2048&&(t instanceof KD&&t.scanCode>=36&&t.scanCode<=45||t instanceof Hb&&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=SF.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(Tjo(n,l)){let c=this._asCommandRule(e,t,o++,n);c&&s.push(c)}l.length>0&&r.error(d(17059,null,qno.name,l.join(`
`)))}static bindToCurrentPlatform(e,t,o,n){if(zo===1&&n){if(n)return n}else if(zo===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=i4.bindToCurrentPlatform(c,u,p,h);if(!g)return;let f;t?f=300+o:f=400+o;let v=fe.getCommand(r),b=v&&v.precondition,S;return l&&b?S=x.and(b,x.deserialize(l)):l?S=x.deserialize(l):b&&(S=b),{id:r,args:s,when:S,weight:f,keybinding:SF.parseKeybinding(g),extensionId:e.value,isBuiltinExtension:t}}getDefaultKeybindingsContent(){let e=this._getResolver(),t=e.getDefaultKeybindings(),o=e.getDefaultBoundCommands();return i4._getDefaultKeybindings(t)+`

`+i4._getAllCommandsAsComment(o)}static _getDefaultKeybindings(e){let t=new VOt;t.writeLine("[");let o=e.length-1;return e.forEach((n,r)=>{zYe.writeKeybindingItem(t,n),r!==o?t.writeLine(","):t.writeLine()}),t.writeLine("]"),t.toString()}static _getAllCommandsAsComment(e){let o=LOt(e).sort().join(`
// - `);return"// "+d(17070,null)+`
// - `+o}mightProducePrintableCharacter(e){if(e.ctrlKey||e.metaKey||e.altKey)return!1;let t=Bb.toEnum(e.code);if(_jo.indexOf(t)!==-1)return!!(e.keyCode===Dy[t]||it&&e.keyCode===YV.get(t));if(Dy[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))}};i4=I([m(0,X),m(1,ge),m(2,Te),m(3,Ne),m(4,mn),m(5,oi),m(6,lt),m(7,be),m(8,dt),m(9,ne),m(10,WOt)],i4);var Nbi=class extends C{constructor(e,t,o,n){super();this.userDataProfileService=e;this.uriIdentityService=t;this.fileService=o;this._rawKeybindings=[];this._keybindings=[];this.watchDisposables=this._register(new P);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(H.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 uo(this._rawKeybindings,e)?!1:(this._rawKeybindings=e,this._keybindings=this._rawKeybindings.map(t=>zYe.readUserKeybindingItem(t)),!0)}async readUserKeybindings(){try{let e=await this.fileService.readFile(this.userDataProfileService.currentProfile.keybindingsResource),t=Ur(e.value.toString());return Array.isArray(t)?t.filter(o=>o&&typeof o=="object"):[]}catch{return[]}}},Obi=class a{constructor(){this.commandsSchemas=[];this.commandsEnum=[];this.removalCommandsEnum=[];this.commandsEnumDescriptions=[];this.schema={id:a.schemaId,type:"array",title:d(17065,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(17062,null)},commandType:{anyOf:[{$ref:"#/definitions/commandNames"},{type:"string",enum:this.removalCommandsEnum,enumDescriptions:this.commandsEnumDescriptions,description:d(17064,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(17063,null)},command:{anyOf:[{if:{type:"array"},then:{not:{type:"array"},errorMessage:d(17060,null,"string")},else:{$ref:"#/definitions/commandType"}},{$ref:"#/definitions/commandType"}]},when:{type:"string",description:d(17066,null)},args:{description:d(17061,null)}},$ref:"#/definitions/commandsSchemas"}};this.schemaRegistry=oe.as(ea.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?"":xq(s)?s.value:s),this.removalCommandsEnum.push(`-${r}`))},o=qe.getCommands();for(let[r,s]of o){let l=s.metadata;if(t(r,l?.description??fe.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=fe.getCommands();for(let r of n.keys())t(r);this.commandsSchemas.push(...i),this.schemaRegistry.notifySchemaChanged(a.schemaId)}};we(_e,i4,0);var KYe=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=zo,t=this.environmentService.remoteAuthority;if(t&&i&&i.scheme!==Y.file){let o=`resource.authority.os.${t}`;e=this.remoteEnvironment?this.remoteEnvironment.os:this.storageService.getNumber(o,1,zo),this.storageService.store(o,e,1,1)}return e}};KYe=I([m(0,B),m(1,yo),m(2,Vt),m(3,le)],KYe);we(sL,KYe,1);function OJ(a){return a.toString()}var Fbi=class{constructor(i,e,t){this.model=i;this._modelEventListeners=new P;this.model=i,this._modelEventListeners.add(i.onWillDispose(()=>e(i))),this._modelEventListeners.add(i.onDidChangeLanguage(o=>t(i,o)))}dispose(){this._modelEventListeners.dispose()}},Djo=Wn||it?1:2,Wbi=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}},IF=class extends C{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=iv.tabSize;e.editor&&typeof e.editor.tabSize<"u"&&(o=oW(e.editor.tabSize,iv.tabSize,1,100));let n="tabSize";e.editor&&typeof e.editor.indentSize<"u"&&e.editor.indentSize!=="tabSize"&&(n=oW(e.editor.indentSize,"tabSize",1,100));let r=iv.insertSpaces;e.editor&&typeof e.editor.insertSpaces<"u"&&(r=e.editor.insertSpaces==="false"?!1:!!e.editor.insertSpaces);let s=Djo,l=e.eol;l===`\r
`?s=2:l===`
`&&(s=1);let c=iv.trimAutoWhitespace;e.editor&&typeof e.editor.trimAutoWhitespace<"u"&&(c=e.editor.trimAutoWhitespace==="false"?!1:!!e.editor.trimAutoWhitespace);let u=iv.detectIndentation;e.editor&&typeof e.editor.detectIndentation<"u"&&(u=e.editor.detectIndentation==="false"?!1:!!e.editor.detectIndentation);let p=iv.largeFileOptimizations;e.editor&&typeof e.editor.largeFileOptimizations<"u"&&(p=e.editor.largeFileOptimizations==="false"?!1:!!e.editor.largeFileOptimizations);let h=iv.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:zo===3||zo===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=IF._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);IF._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&&uo(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(OJ(e.uri),e),this._disposedModelsHeapSize+=e.heapSize}_removeDisposedModel(e){let t=this._disposedModels.get(OJ(e));return t&&(this._disposedModelsHeapSize-=t.heapSize),this._disposedModels.delete(OJ(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(Bu,e,t,r,o);if(o&&this._disposedModels.has(OJ(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)jU(f)&&f.matchesResource(o)&&f.setModel(s);for(let f of p.future)jU(f)&&f.matchesResource(o)&&f.setModel(s);this._undoRedoService.setElementsValidFlag(o,!0,f=>jU(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=OJ(s.uri);if(this._models[l])throw new Error("ModelService: Cannot add model because it already exists!");let c=new Fbi(s,u=>this._onWillDispose(u),(u,p)=>this._onDidChangeLanguage(u,p));return this._models[l]=c,c}updateModel(e,t,o=_c.unknown({name:"updateModel"})){let n=this.getCreationOptions(e.getLanguageId(),e.uri,e.isForSimpleWidget),{textBuffer:r,disposable:s}=n1(t,n.defaultEOL);if(e.equalsTextBuffer(r)){s.dispose();return}e.pushStackElement(),e.pushEOL(r.getEOL()===`\r
`?1:0),e.pushEditOperations([],IF._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))),[An.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,Fr,o,n),this._onModelAdded.fire(r.model),r.model}destroyModel(e){let t=this._models[OJ(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=OJ(e),o=this._models[t];return o?o.model:null}_schemaShouldMaintainUndoRedoElements(e){return e.scheme===Y.file||e.scheme===Y.vscodeRemote||e.scheme===Y.vscodeUserData||e.scheme===Y.vscodeNotebookCell||e.scheme==="fake-fs"}_onWillDispose(e){let t=OJ(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)jU(p)&&p.matchesResource(e.uri)&&(r=!0,s+=p.heapSize(e.uri),p.setModel(e.uri));for(let p of u.future)jU(p)&&p.matchesResource(e.uri)&&(r=!0,s+=p.heapSize(e.uri),p.setModel(e.uri))}}let l=IF.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=>jU(u)&&u.matchesResource(e.uri)),this._insertDisposedModel(new Wbi(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);IF._setModelOptionsForModel(e,s,r),this._onModelModeChanged.fire({model:e,oldLanguageId:o})}_getSHA1Computer(){return new Wue}};IF=I([m(0,B),m(1,sL),m(2,Cl),m(3,F)],IF);var Wue=class a{static{this.MAX_MODEL_SIZE=10*1024*1024}canComputeSHA1(i){return i.getValueLength()<=a.MAX_MODEL_SIZE}computeSHA1(i){let e=new Ly,t=i.createSnapshot(),o;for(;o=t.read();)e.update(o);return e.digest()}};var GYe=class extends IF{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}};GYe=I([m(0,B),m(1,sL),m(2,Cl),m(3,wn),m(4,F)],GYe);we(Ct,GYe,1);var $Ye=class extends C{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=Dre([this._extensionService.activateByEvent("*"),Pi(3e4)])),L1i(this._starActivation)}async executeCommand(e,...t){this._logService.trace("CommandService#executeCommand",e);let o=`onCommand:${e}`;return qe.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),Dre([this._activateStar(),H.toPromise(H.filter(qe.onDidRegisterCommand,r=>r===e))])]),this._tryExecuteCommand(e,t))}_tryExecuteCommand(e,t){let o=qe.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()}};$Ye=I([m(0,F),m(1,lt),m(2,ne)],$Ye);we(ge,$Ye,1);var Vbi={};function dy(a,i){let e=Vbi[a];e||(Vbi[a]=e=[]),e.push(i)}function Bbi(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=Vbi[n];if(r){let s=t[n];if(typeof s=="string"){let l=Oe.fromHex(s);for(let c of r)i.colors[c]=l}}n!=="foreground"&&n!=="background"&&n!=="fontStyle"&&delete t[n]}}}dy("background",qo);dy("foreground",od);dy("selection",sv);dy("inactiveSelection",rGi);dy("selectionHighlightColor",YSe);dy("findMatchHighlight",Kb);dy("currentFindMatchHighlight",Pse);dy("hoverHighlight",ogt);dy("wordHighlight","editor.wordHighlightBackground");dy("wordHighlightStrong","editor.wordHighlightStrongBackground");dy("findRangeHighlight",lGi);dy("findMatchHighlight","peekViewResult.matchHighlightBackground");dy("referenceHighlight","peekViewEditor.matchHighlightBackground");dy("lineHighlight",PIe);dy("rangeHighlight",j$i);dy("caret",I9);dy("invisibles",AIe);dy("guide",fft);dy("activeGuide",vft);var Ljo=["ansiBlack","ansiRed","ansiGreen","ansiYellow","ansiBlue","ansiMagenta","ansiCyan","ansiWhite","ansiBrightBlack","ansiBrightRed","ansiBrightGreen","ansiBrightYellow","ansiBrightBlue","ansiBrightMagenta","ansiBrightCyan","ansiBrightWhite"];for(let a of Ljo)dy(a,"terminal."+a);function jno(a){return Rjo(a,null,null)}function Rjo(a,i,e){let t=a.length,o=0,n=1,r=0;t>0&&a.charCodeAt(0)===65279&&(o=1);function s(Fe){if(e===null)o=o+Fe;else for(;Fe>0;)a.charCodeAt(o)===10?(o++,n++,r=0):(o++,r++),Fe--}function l(Fe){e===null?o=Fe:s(Fe-o)}function c(){for(;o<t;){let Fe=a.charCodeAt(o);if(Fe!==32&&Fe!==9&&Fe!==13&&Fe!==10)break;s(1)}}function u(Fe){return a.substr(o,Fe.length)===Fe?(s(Fe.length),!0):!1}function p(Fe){let Qt=a.indexOf(Fe,o);l(Qt!==-1?Qt+Fe.length:t)}function h(Fe){let Qt=a.indexOf(Fe,o);if(Qt!==-1){let Ze=a.substring(o,Qt);return l(Qt+Fe.length),Ze}else{let Ze=a.substr(o);return l(t),Ze}}let g=0,f=null,v=[],b=[],S=null;function y(Fe,Qt){v.push(g),b.push(f),g=Fe,f=Qt}function w(){if(v.length===0)return k("illegal state stack");g=v.pop(),f=b.pop()}function k(Fe){throw new Error("Near offset "+o+": "+Fe+" ~~~"+a.substr(o,50)+"~~~")}let T={enterDict:function(){if(S===null)return k("missing <key>");let Fe={};e!==null&&(Fe[e]={filename:i,line:n,char:r}),f[S]=Fe,S=null,y(1,Fe)},enterArray:function(){if(S===null)return k("missing <key>");let Fe=[];f[S]=Fe,S=null,y(2,Fe)}},N={enterDict:function(){let Fe={};e!==null&&(Fe[e]={filename:i,line:n,char:r}),f.push(Fe),y(1,Fe)},enterArray:function(){let Fe=[];f.push(Fe),y(2,Fe)}};function O(){g===1?T.enterDict():g===2?N.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 U(){g===1?T.enterArray():g===2?N.enterArray():(f=[],y(2,f))}function G(){if(g===1)return k("unexpected </array>");if(g===2)w();else return k("unexpected </array>")}function $(Fe){if(g===1){if(S!==null)return k("too many <key>");S=Fe}else return k("unexpected <key>")}function te(Fe){if(g===1){if(S===null)return k("missing <key>");f[S]=Fe,S=null}else g===2?f.push(Fe):f=Fe}function pe(Fe){if(isNaN(Fe))return k("cannot parse float");if(g===1){if(S===null)return k("missing <key>");f[S]=Fe,S=null}else g===2?f.push(Fe):f=Fe}function de(Fe){if(isNaN(Fe))return k("cannot parse integer");if(g===1){if(S===null)return k("missing <key>");f[S]=Fe,S=null}else g===2?f.push(Fe):f=Fe}function se(Fe){if(g===1){if(S===null)return k("missing <key>");f[S]=Fe,S=null}else g===2?f.push(Fe):f=Fe}function Se(Fe){if(g===1){if(S===null)return k("missing <key>");f[S]=Fe,S=null}else g===2?f.push(Fe):f=Fe}function ke(Fe){if(g===1){if(S===null)return k("missing <key>");f[S]=Fe,S=null}else g===2?f.push(Fe):f=Fe}function Ee(Fe){return Fe.replace(/&#([0-9]+);/g,function(Qt,Ze){return String.fromCodePoint(parseInt(Ze,10))}).replace(/&#x([0-9a-f]+);/g,function(Qt,Ze){return String.fromCodePoint(parseInt(Ze,16))}).replace(/&amp;|&lt;|&gt;|&quot;|&apos;/g,function(Qt){switch(Qt){case"&amp;":return"&";case"&lt;":return"<";case"&gt;":return">";case"&quot;":return'"';case"&apos;":return"'"}return Qt})}function He(){let Fe=h(">"),Qt=!1;return Fe.charCodeAt(Fe.length-1)===47&&(Qt=!0,Fe=Fe.substring(0,Fe.length-1)),{name:Fe.trim(),isClosed:Qt}}function Ve(Fe){if(Fe.isClosed)return"";let Qt=h("</");return p(">"),Ee(Qt)}for(;o<t&&(c(),!(o>=t));){let Fe=a.charCodeAt(o);if(s(1),Fe!==60)return k("expected <");if(o>=t)return k("unexpected end of input");let Qt=a.charCodeAt(o);if(Qt===63){s(1),p("?>");continue}if(Qt===33){if(s(1),u("--")){p("-->");continue}p(">");continue}if(Qt===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 Ze=He();switch(Ze.name){case"dict":O(),Ze.isClosed&&V();continue;case"array":U(),Ze.isClosed&&G();continue;case"key":$(Ve(Ze));continue;case"string":te(Ve(Ze));continue;case"real":pe(parseFloat(Ve(Ze)));continue;case"integer":de(parseInt(Ve(Ze),10));continue;case"date":se(new Date(Ve(Ze)));continue;case"data":Se(Ve(Ze));continue;case"true":Ve(Ze),ke(!0);continue;case"false":Ve(Ze),ke(!1);continue}if(!/^plist/.test(Ze.name))return k("unexpected opened tag "+Ze.name)}return f}function Hbi(a,i,e){let t=Mjo(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(Qno(o)){let l=[];do l.push(o),o=t.next();while(Qno(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 Qno(a){return!!a&&!!a.match(/[\w\.:]+/)}function Mjo(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 Pjo=oe.as(Tse.ColorContribution),BOt=zxt(),Yno={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"]},o4=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:xDe(s.foreground),background:xDe(s.background),fontStyle:s.fontStyle,fontSize:s.fontSize,fontFamily:s.fontFamily,lineHeight:s.lineHeight}})}},i=[],e=this.getColor(od)||this.getDefault(od),t=this.getColor(qo)||this.getDefault(qo);i.push({settings:{foreground:xDe(e),background:xDe(t)}});let o=!1;this.themeTokenColors.forEach(n),this.customTokenColors.forEach(n),o||Njo[this.type].forEach(n),this.textMateThemingRules=i}return this.textMateThemingRules}getColor(i,e){let t=this.customColorMap[i];if(t instanceof Oe)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 BOt.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 tP.fromData(r)}resolveTokenStyleValue(i){if(i!==void 0){if(typeof i=="string"){let{type:e,modifiers:t,language:o}=Hxt(i,"");return this.getTokenStyle(e,t,o)}else if(typeof i=="object")return i}}getTokenColorIndex(){if(!this.tokenColorIndex){let i=new Ubi;this.tokenColors.forEach(e=>{i.add(e.settings.foreground),i.add(e.settings.background)}),this.semanticTokenRules.forEach(e=>i.add(e.style.foreground)),BOt.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 zbi;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}=Hxt(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 Pjo.resolveDefaultColor(i,this)}resolveScopes(i,e){this.themeTokenScopeMatchers||(this.themeTokenScopeMatchers=this.themeTokenColors.map(ero)),this.customTokenScopeMatchers||(this.customTokenScopeMatchers=this.customTokenColors.map(ero));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&&Ae(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),tP.fromSettings(o,n)}}defines(i){let e=this.customColorMap[i];return e instanceof Oe?!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);yi(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===M$e?this.customColorMap[e]=M$e:typeof t=="string"&&(this.customColorMap[e]=Oe.fromHex(t))}}setCustomTokenColors(i){this.customTokenColors=[],this.customSemanticHighlightingDeprecated=void 0,this.addCustomTokenColors(i);let e=this.getThemeSpecificColors(i);yi(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);yi(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)===L7i&&i.charAt(i.length-1)===R7i}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===S8e&&t===S8e||this.settingsId.startsWith(o)&&t===S8e||this.settingsId.endsWith(r)&&e===S8e}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(M7i)||[];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=iro(e,i[e]);t&&this.customSemanticTokenRules.push(t)}catch{}}addCustomTokenColors(i){for(let e in Yno){let t=e,o=i[t];if(o){let n=typeof o=="string"?{foreground:o}:o,r=Yno[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 tro(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]=Oe.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(rxe.toJSONObject),extensionData:DE.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(J$(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]=Oe.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]=Oe.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=rxe.fromJSONObject(BOt,s);l&&o.semanticTokenRules.push(l)}break}case"location":break;case"extensionData":o.extensionData=DE.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=Ajo(t.extensionId,i.path),r=`${o} ${n}`,s=i.label||No(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 Ajo(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 tro(a,i,e){if(ms(i)===".json"){let t=await a.readExtensionResource(i),o=[],n=Ur(t,o);if(o.length>0)return Promise.reject(new Error(d(17308,null,o.map(c=>EO(c.error)).join(", "))));if(Vx(n)!=="object")return Promise.reject(new Error(d(17309,null)));if(n.include&&await tro(a,je(ci(i),n.include),e),Array.isArray(n.settings))return Bbi(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(17310,null,i.toString())));for(let c in r){let u=r[c];u===M$e?delete e.colors[c]:typeof u=="string"&&(e.colors[c]=Oe.fromHex(r[c]))}}let s=n.tokenColors;if(s)if(Array.isArray(s))e.textMateRules.push(...s);else if(typeof s=="string")await Xno(a,je(ci(i),s),e);else return Promise.reject(new Error(d(17312,null,i.toString())));let l=n.semanticTokenColors;if(l&&typeof l=="object")for(let c in l)try{let u=iro(c,l[c]);u&&e.semanticTokenRules.push(u)}catch{return Promise.reject(new Error(d(17311,null,i.toString())))}}else return Xno(a,i,e)}function Xno(a,i,e){return a.readExtensionResource(i).then(t=>{try{let n=jno(t).settings;return Array.isArray(n)?(Bbi(n,e),Promise.resolve(null)):Promise.reject(new Error(d(17313,null)))}catch(o){return Promise.reject(new Error(d(17307,null,o.message)))}},t=>Promise.reject(new Error(d(17306,null,i.toString(),t.message))))}var Njo={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"}}]},Jno=a=>-1;function Zno(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(Ojo(i[n],o))return e=(n+1)*65536+o.length,!0;return!1})&&e!==void 0?e:-1}function Ojo(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 ero(a){let i=a.scope;if(!i||!a.settings)return Jno;let e=[];if(Array.isArray(i))for(let t of i)Hbi(t,Zno,e);else Hbi(i,Zno,e);return e.length===0?Jno: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 iro(a,i){let e=BOt.parseTokenSelector(a),t;if(typeof i=="string"?t=tP.fromSettings(i,void 0):Fjo(i)&&(t=tP.fromSettings(i.foreground,i.fontStyle,i.bold,i.underline,i.strikethrough,i.italic)),t)return{selector:e,style:t}}function Fjo(a){return a&&(Ae(a.foreground)||Ae(a.fontStyle)||Da(a.italic)||Da(a.underline)||Da(a.strikethrough)||Da(a.bold))}function HOt(a,i,e,t){let o=0;o|=e<<0;let n={},r=a.resolveScopes([i],n);if(i.length>0){let u=mji(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 Ubi=class{constructor(){this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null)}add(i){if(i=xDe(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=xDe(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)}},zbi=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 xDe(a){if(!a)return;typeof a!="string"&&(a=Oe.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=Wjo(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 Wjo(a){return a>=48&&a<=57||a>=65&&a<=70?a:a>=97&&a<=102?a-97+65:0}var Vjo="vscode://schemas/icon-theme",Bjo={type:"object",allowComments:!0,allowTrailingCommas:!0,definitions:{folderExpanded:{type:"string",description:d(17336,null)},folder:{type:"string",description:d(17335,null)},file:{type:"string",description:d(17330,null)},rootFolder:{type:"string",description:d(17360,null)},rootFolderExpanded:{type:"string",description:d(17361,null)},rootFolderNames:{type:"object",description:d(17363,null),additionalProperties:{type:"string",description:d(17337,null)}},rootFolderNamesExpanded:{type:"object",description:d(17364,null),additionalProperties:{type:"string",description:d(17362,null)}},folderNames:{type:"object",description:d(17339,null),additionalProperties:{type:"string",description:d(17337,null)}},folderNamesExpanded:{type:"object",description:d(17340,null),additionalProperties:{type:"string",description:d(17338,null)}},fileExtensions:{type:"object",description:d(17332,null),additionalProperties:{type:"string",description:d(17331,null)}},fileNames:{type:"object",description:d(17334,null),additionalProperties:{type:"string",description:d(17333,null)}},languageIds:{type:"object",description:d(17358,null),additionalProperties:{type:"string",description:d(17357,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(17349,null),items:{type:"object",properties:{id:{type:"string",description:d(17356,null),pattern:Q9.source,patternErrorMessage:Uye},src:{type:"array",description:d(17366,null),items:{type:"object",properties:{path:{type:"string",description:d(17342,null)},format:{type:"string",description:d(17341,null),enum:["woff","woff2","truetype","opentype","embedded-opentype","svg"]}},required:["path","format"]}},weight:{type:"string",description:d(17345,null),pattern:Hye.source},style:{type:"string",description:d(17344,null),pattern:Bye.source},size:{type:"string",description:d(17343,null),pattern:Cje.source}},required:["id","src"]}},iconDefinitions:{type:"object",description:d(17354,null),additionalProperties:{type:"object",description:d(17353,null),properties:{iconPath:{type:"string",description:d(17355,null)},fontCharacter:{type:"string",description:d(17346,null)},fontColor:{type:"string",format:"color-hex",description:d(17347,null),pattern:fSt.source},fontSize:{type:"string",description:d(17350,null),pattern:Cje.source},fontId:{type:"string",description:d(17348,null),pattern:Q9.source,patternErrorMessage:Uye}}}},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(17359,null)},highContrast:{$ref:"#/definitions/associations",description:d(17352,null)},hidesExplorerArrows:{type:"boolean",description:d(17351,null)},showLanguageModeIcons:{type:"boolean",description:d(17365,null)}}};function oro(){oe.as(ea.JSONContribution).registerSchema(Vjo,Bjo)}var XV=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||No(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=DE.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:DE.toJSONObject(this.extensionData),watch:this.watch});i.store(a.STORAGE_KEY,e,0,1)}},zOt=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=Ur(e,t);return t.length>0?Promise.reject(new Error(d(17269,null,t.map(n=>EO(n.error)).join(", ")))):Vx(o)!=="object"?Promise.reject(new Error(d(17270,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 je(l,b)}function u(b,S){function y(w,k){if(k){let T=r[k];T||(T=r[k]=new o_),T.push(w)}}if(b){let w=Hs`.show-file-icons`;S&&(w=Hs`${S} ${w}`);let k=Hs`.monaco-tl-twistie.collapsible:not(.collapsed) + .monaco-tl-contents`;b.folder&&(y(Hs`${w} .folder-icon::before`,b.folder),o.hasFolderIcons=!0),b.folderExpanded&&(y(Hs`${w} ${k} .folder-icon::before`,b.folderExpanded),o.hasFolderIcons=!0);let T=b.rootFolder||b.folder,N=b.rootFolderExpanded||b.folderExpanded;T&&(y(Hs`${w} .rootfolder-icon::before`,T),o.hasFolderIcons=!0),N&&(y(Hs`${w} ${k} .rootfolder-icon::before`,N),o.hasFolderIcons=!0),b.file&&(y(Hs`${w} .file-icon::before`,b.file),o.hasFileIcons=!0);let O=b.folderNames;if(O)for(let de in O){let se=new o_,Se=UOt(de.toLowerCase(),se);se.push(Hs`.${wK(Se)}-name-folder-icon`),y(Hs`${w} ${se.join("")}.folder-icon::before`,O[de]),o.hasFolderIcons=!0}let V=b.folderNamesExpanded;if(V)for(let de in V){let se=new o_,Se=UOt(de.toLowerCase(),se);se.push(Hs`.${wK(Se)}-name-folder-icon`),y(Hs`${w} ${k} ${se.join("")}.folder-icon::before`,V[de]),o.hasFolderIcons=!0}let U=b.rootFolderNames;if(U)for(let de in U){let se=de.toLowerCase();y(Hs`${w} .${wK(se)}-root-name-folder-icon.rootfolder-icon::before`,U[de]),o.hasFolderIcons=!0}let G=b.rootFolderNamesExpanded;if(G)for(let de in G){let se=de.toLowerCase();y(Hs`${w} ${k} .${wK(se)}-root-name-folder-icon.rootfolder-icon::before`,G[de]),o.hasFolderIcons=!0}let $=b.languageIds;if($){!$.jsonc&&$.json&&($.jsonc=$.json);for(let de in $)y(Hs`${w} .${wK(de)}-lang-file-icon.file-icon::before`,$[de]),o.hasFileIcons=!0,n=!0,s[de]=!0}let te=b.fileExtensions;if(te)for(let de in te){let se=new o_,ke=UOt(de.toLowerCase(),se).split(".");if(ke.length){for(let Ee=0;Ee<ke.length;Ee++)se.push(Hs`.${wK(ke.slice(Ee).join("."))}-ext-file-icon`);se.push(Hs`.ext-file-icon`)}y(Hs`${w} ${se.join("")}.file-icon::before`,te[de]),o.hasFileIcons=!0,n=!0}let pe=b.fileNames;if(pe)for(let de in pe){let se=new o_,Se=UOt(de.toLowerCase(),se);se.push(Hs`.${wK(Se)}-name-file-icon`),se.push(Hs`.name-file-icon`);let ke=Se.split(".");if(ke.length){for(let Ee=1;Ee<ke.length;Ee++)se.push(Hs`.${wK(ke.slice(Ee).join("."))}-ext-file-icon`);se.push(Hs`.ext-file-icon`)}y(Hs`${w} ${se.join("")}.file-icon::before`,pe[de]),o.hasFileIcons=!0,n=!0}}}if(u(t),u(t.light,Hs`.vs`),u(t.highContrast,Hs`.hc-black`),u(t.highContrast,Hs`.hc-light`),!o.hasFileIcons&&!o.hasFolderIcons)return o;let p=t.showLanguageModeIcons===!0||n&&t.showLanguageModeIcons!==!1,h=new o_,g=t.fonts,f=new Map;if(Array.isArray(g)){let b=this.tryNormalizeFontSize(g[0].size)||"150%";g.forEach(S=>{let y=new o_;y.push(...S.src.map(k=>Hs`${Na(c(k.path))} format(${WS(k.format)})`)),h.push(Hs`@font-face { src: ${y.join(", ")}; font-family: ${WS(S.id)}; font-weight: ${Tye(S.weight)}; font-style: ${Tye(S.style)}; font-display: block; }`);let w=this.tryNormalizeFontSize(S.size);w!==void 0&&w!==b&&f.set(S.id,w)}),h.push(Hs`.show-file-icons .file-icon::before, .show-file-icons .folder-icon::before, .show-file-icons .rootfolder-icon::before { font-family: ${WS(g[0].id)}; font-size: ${Vei(b)}; }`)}let v=WS("\\2001");for(let b in r){let S=r[b],y=t.iconDefinitions[b];if(y){if(y.iconPath)h.push(Hs`${S.join(", ")} { content: ${v}; background-image: ${Na(c(y.iconPath))}; }`);else if(y.fontCharacter||y.fontColor){let w=new o_;y.fontColor&&y.fontColor.match(fSt)&&w.push(Hs`color: ${Oji(y.fontColor)};`),y.fontCharacter&&w.push(Hs`content: ${WS(y.fontCharacter)};`);let k=y.fontSize??(y.fontId?f.get(y.fontId):void 0);k&&k.match(Cje)&&w.push(Hs`font-size: ${Vei(k)};`),y.fontId&&w.push(Hs`font-family: ${WS(y.fontId)};`),p&&w.push(Hs`background-image: unset;`),h.push(Hs`${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=Hs`.show-file-icons .${wK(b)}-lang-file-icon.file-icon::before`;h.push(Hs`${y} { content: ${v}; background-image: ${Na(S.dark)}; }`),h.push(Hs`.vs ${y} { content: ${v}; background-image: ${Na(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 UOt(a,i){let e=a.lastIndexOf("/");if(e>=0){let t=a.substring(0,e);return i.push(Hs`.${wK(t)}-name-dir-icon`),a.substring(e+1)}return a}function wK(a){return a=Tle(a),a1(a,!0)}var nro=["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"],qYe="vscode://schemas/textmate-colors",rro=`${qYe}#/definitions/colorGroup`,Hjo={type:"array",definitions:{colorGroup:{default:"#FF0000",anyOf:[{type:"string",format:"color-hex"},{$ref:"#/definitions/settings"}]},settings:{type:"object",description:d(17327,null),properties:{foreground:{type:"string",description:d(17325,null),format:"color-hex",default:"#ff0000"},background:{type:"string",deprecationMessage:d(17320,null)},fontStyle:{type:"string",description:d(17323,null),pattern:"^(\\s*\\b(italic|bold|underline|strikethrough))*\\s*$",patternErrorMessage:d(17315,null),defaultSnippets:[{label:d(17324,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(17321,null)},fontSize:{type:"number",description:d(17322,null)},lineHeight:{type:"number",description:d(17326,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(17316,null)},scope:{description:d(17317,null),anyOf:[{enum:nro},{type:"string"},{type:"array",items:{enum:nro}},{type:"array",items:{type:"string"}}]},settings:{$ref:"#/definitions/settings"}},required:["settings"],additionalProperties:!1}},Kbi="vscode://schemas/color-theme",Ujo={type:"object",allowComments:!0,allowTrailingCommas:!0,properties:{colors:{description:d(17329,null),$ref:Lse,additionalProperties:!1},tokenColors:{anyOf:[{type:"string",description:d(17328,null)},{description:d(17314,null),$ref:qYe}]},semanticHighlighting:{type:"boolean",description:d(17319,null)},semanticTokenColors:{type:"object",description:d(17318,null),$ref:sxe}}};function sro(){let a=oe.as(ea.JSONContribution);a.registerSchema(Kbi,Ujo),a.registerSchema(qYe,Hjo)}function aro(){return Tn.registerExtensionPoint({extensionPoint:"themes",jsonSchema:{description:d(17435,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(17436,null),type:"string"},label:{description:d(17437,null),type:"string"},uiTheme:{description:d(17439,null),enum:["vs","vs-dark","hc-black","hc-light"]},path:{description:d(17438,null),type:"string"}},required:["path","uiTheme"]}}})}function lro(){return Tn.registerExtensionPoint({extensionPoint:"iconThemes",jsonSchema:{description:d(17427,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(17428,null),type:"string"},label:{description:d(17429,null),type:"string"},path:{description:d(17430,null),type:"string"}},required:["path","id"]}}})}function cro(){return Tn.registerExtensionPoint({extensionPoint:"productIconThemes",jsonSchema:{description:d(17431,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(17432,null),type:"string"},label:{description:d(17433,null),type:"string"},path:{description:d(17434,null),type:"string"}},required:["path","id"]}}})}var Gbi=class extends C{constructor(){super(...arguments);this.type="markdown"}shouldRender(e){return!!e.contributes?.themes||!!e.contributes?.iconThemes||!!e.contributes?.productIconThemes}render(e){let t=new xe;if(e.contributes?.themes){t.appendMarkdown(`### ${d(17419,null)}

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

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

`);for(let o of e.contributes.productIconThemes)t.appendMarkdown(`- ${o.label}
`)}return{data:t,dispose:()=>{}}}};oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:"themes",label:d(17426,null),access:{canToggle:!1},renderer:new Mt(Gbi)});var kDe=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=DE.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||!Ae(r.path)){n?.error(d(17425,null,this.themesExtPoint.name,String(r.path)));return}if(this.idRequired&&(!r.id||!Ae(r.id))){n?.error(d(17424,null,this.themesExtPoint.name,String(r.id)));return}let s=je(e,r.path);La(s,e)||n?.warn(d(17421,null,this.themesExtPoint.name,s.path,e.path));let l=this.create(r,s,i);o.push(l)}),o):(n?.error(d(17423,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){if(this.builtInTheme&&this.builtInTheme.settingsId===i)return this.builtInTheme;let t=this.getThemes(),o;for(let n of t){if(n.settingsId===i)return n;n.settingsId===e&&(o=n)}return o}findThemeByExtensionLocation(i){return i?this.getThemes().filter(e=>e.location&&La(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 EDe=oe.as(ii.Configuration),Bue=[],Hue=[],Uue=[];function YP(a){return`\`#${a}#\``}var n4="colorThemeConfiguration",zjo={type:"string",markdownDescription:d(17388,null,YP("window.autoDetectColorScheme")),default:Gt?Bd.COLOR_THEME_LIGHT:Bd.COLOR_THEME_DARK,tags:[n4],enum:Bue,enumDescriptions:Uue,enumItemLabels:Hue,errorMessage:d(17389,null)},Kjo={type:"string",markdownDescription:d(17411,null,YP("window.autoDetectColorScheme")),default:Bd.COLOR_THEME_DARK,tags:[n4],enum:Bue,enumDescriptions:Uue,enumItemLabels:Hue,errorMessage:d(17389,null)},Gjo={type:"string",markdownDescription:d(17414,null,YP("window.autoDetectColorScheme")),default:Bd.COLOR_THEME_LIGHT,tags:[n4],enum:Bue,enumDescriptions:Uue,enumItemLabels:Hue,errorMessage:d(17389,null)},$jo={type:"string",markdownDescription:d(17412,null,YP("window.autoDetectHighContrast")),default:Bd.COLOR_THEME_HC_DARK,tags:[n4],enum:Bue,enumDescriptions:Uue,enumItemLabels:Hue,errorMessage:d(17389,null)},qjo={type:"string",markdownDescription:d(17413,null,YP("window.autoDetectHighContrast")),default:Bd.COLOR_THEME_HC_LIGHT,tags:[n4],enum:Bue,enumDescriptions:Uue,enumItemLabels:Hue,errorMessage:d(17389,null)},jjo={type:"boolean",markdownDescription:d(17392,null,YP("workbench.preferredDarkColorTheme"),YP("workbench.preferredLightColorTheme")),default:!1,tags:[n4]},dro={type:"object",description:d(17418,null),allOf:[{$ref:Lse}],default:{},defaultSnippets:[{body:{}}]},KOt={type:["string","null"],default:Bd.FILE_ICON_THEME,description:d(17407,null),enum:[null],enumItemLabels:[d(17410,null)],enumDescriptions:[d(17409,null)],errorMessage:d(17408,null)},GOt={type:["string","null"],default:Bd.PRODUCT_ICON_THEME,description:d(17415,null),enum:[Bd.PRODUCT_ICON_THEME],enumItemLabels:[d(17391,null)],enumDescriptions:[d(17390,null)],errorMessage:d(17416,null)},Qjo={type:"boolean",default:!0,markdownDescription:d(17387,null,YP("workbench.preferredHighContrastColorTheme"),YP("workbench.preferredHighContrastLightColorTheme")),scope:1,tags:[n4]},qOt={id:"workbench",order:7.1,type:"object",properties:{"workbench.colorTheme":zjo,"workbench.preferredDarkColorTheme":Kjo,"workbench.preferredLightColorTheme":Gjo,"workbench.preferredHighContrastColorTheme":$jo,"workbench.preferredHighContrastLightColorTheme":qjo,"workbench.iconTheme":KOt,"workbench.colorCustomizations":dro,"workbench.productIconTheme":GOt}};EDe.registerConfiguration(qOt);var Yjo={id:"window",order:8.1,type:"object",properties:{"window.autoDetectHighContrast":Qjo,"window.autoDetectColorScheme":jjo}};EDe.registerConfiguration(Yjo);function Vue(a){return{description:a,$ref:rro}}var $bi="^\\[[^\\]]*(\\]\\s*\\[[^\\]]*)*\\]$",uro={type:"object",properties:{comments:Vue(d(17394,null)),strings:Vue(d(17403,null)),keywords:Vue(d(17396,null)),numbers:Vue(d(17397,null)),types:Vue(d(17405,null)),functions:Vue(d(17395,null)),variables:Vue(d(17406,null)),textMateRules:{description:d(17404,null),$ref:qYe},semanticHighlighting:{description:d(17398,null),deprecationMessage:d(17399,null),markdownDeprecationMessage:d(17400,null,YP("editor.semanticTokenColorCustomizations")),type:"boolean"}},additionalProperties:!1},pro={description:d(17393,null),default:{},allOf:[{...uro,patternProperties:{"^\\[":{}}}]},qbi={type:"object",properties:{enabled:{type:"boolean",description:d(17401,null),suggestSortText:"0_enabled"},rules:{$ref:sxe,description:d(17402,null),suggestSortText:"0_rules"}},additionalProperties:!1},mro={description:d(17417,null),default:{},allOf:[{...qbi,patternProperties:{"^\\[":{}}}]},hro={id:"editor",order:7.2,type:"object",properties:{"editor.tokenColorCustomizations":pro,"editor.semanticTokenColorCustomizations":mro}};EDe.registerConfiguration(hro);function Qbi(a){a.sort((r,s)=>r.label.localeCompare(s.label)),Bue.splice(0,Bue.length,...a.map(r=>r.settingsId)),Uue.splice(0,Uue.length,...a.map(r=>r.description||"")),Hue.splice(0,Hue.length,...a.map(r=>r.label||""));let i={properties:{}},e={properties:{}},t={properties:{}},o={$ref:Lse,additionalProperties:!1},n={properties:uro.properties,additionalProperties:!1};for(let r of a){let s=`[${r.settingsId}]`;i.properties[s]=o,e.properties[s]=n,t.properties[s]=qbi}i.patternProperties={[$bi]:o},e.patternProperties={[$bi]:n},t.patternProperties={[$bi]:qbi},dro.allOf[1]=i,pro.allOf[1]=e,mro.allOf[1]=t,EDe.notifyConfigurationSchemaUpdated(qOt,hro)}function Ybi(a){KOt.enum.splice(1,Number.MAX_VALUE,...a.map(i=>i.settingsId)),KOt.enumItemLabels.splice(1,Number.MAX_VALUE,...a.map(i=>i.label)),KOt.enumDescriptions.splice(1,Number.MAX_VALUE,...a.map(i=>i.description||"")),EDe.notifyConfigurationSchemaUpdated(qOt)}function Xbi(a){GOt.enum.splice(1,Number.MAX_VALUE,...a.map(i=>i.settingsId)),GOt.enumItemLabels.splice(1,Number.MAX_VALUE,...a.map(i=>i.label)),GOt.enumDescriptions.splice(1,Number.MAX_VALUE,...a.map(i=>i.description||"")),EDe.notifyConfigurationSchemaUpdated(qOt)}var Xjo={dark:"workbench.preferredDarkColorTheme",light:"workbench.preferredLightColorTheme",hcDark:"workbench.preferredHighContrastColorTheme",hcLight:"workbench.preferredHighContrastLightColorTheme"},$Ot=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.configurationService.getValue("window.autoDetectColorScheme"))return this.hostColorService.dark?"dark":"light"}isDetectingColorScheme(){return this.configurationService.getValue("window.autoDetectColorScheme")}getColorThemeSettingId(){let i=this.getPreferredColorScheme();return i?Xjo[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(cn(e.workspaceFolderValue))if(cn(e.workspaceValue)){if(!cn(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(cn(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 zue="",JV=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 e5o(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 Jjo(i,t,o),this.isLoaded=!0,o.length&&e.error(d(17282,null,t.toString(),o.join(`
`))),this.styleSheetContent}static fromExtensionTheme(i,e,t){let o=t.extensionId+"-"+i.id,n=i.label||No(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(zue,d(17271,null),Bd.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=DE.fromJSONObject(t.extensionData);break}let{iconDefinitions:n,iconFontDefinitions:r}=t;if(Array.isArray(n)&&yi(r)){let s=new Map;for(let l of n){let{id:c,fontCharacter:u,fontId:p}=l;if(Ae(c)&&Ae(u))if(Ae(p)){let h=gSt.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]=gSt.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:DE.toJSONObject(this.extensionData),iconDefinitions:e,iconFontDefinitions:t});i.store(a.STORAGE_KEY,o,0,1)}};function Jjo(a,i,e){return a.readExtensionResource(i).then(t=>{let o=[],n=Ur(t,o);if(o.length>0)return Promise.reject(new Error(d(17272,null,o.map(u=>EO(u.error)).join(", "))));if(Vx(n)!=="object")return Promise.reject(new Error(d(17279,null)));if(!n.iconDefinitions||!Array.isArray(n.fonts)||!n.fonts.length)return Promise.reject(new Error(d(17280,null)));let r=ci(i),s=new Map;for(let u of n.fonts){let p=u.id;if(Ae(p)&&p.match(Q9)){let h;Ae(u.weight)&&u.weight.match(Hye)?h=u.weight:e.push(d(17276,null,u.id));let g;Ae(u.style)&&u.style.match(Bye)?g=u.style:e.push(d(17275,null,u.id));let f=[];if(Array.isArray(u.src))for(let v of u.src)if(Ae(v.path)&&Ae(v.format)&&v.format.match(Y5i)){let b=je(r,v.path);f.push({location:b,format:v.format})}else e.push(d(17274,null,u.id));f.length?s.set(p,{weight:h,style:g,src:f}):e.push(d(17281,null,u.id))}else e.push(d(17273,null,u.id))}let l=new Map,c=n.fonts[0].id;for(let u in n.iconDefinitions){let p=n.iconDefinitions[u];if(Ae(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(17277,null,u))}else e.push(d(17278,null,u))}return{iconDefinitions:l}})}var Zjo=jy();function e5o(a,i){let e=i.iconDefinitions,t=e.get(a.id),o=a.defaults;for(;!t&&q.isThemeIcon(o);){let n=Zjo.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 t5o="vscode://schemas/product-icon-theme",i5o={type:"object",allowComments:!0,allowTrailingCommas:!0,properties:{fonts:{type:"array",items:{type:"object",properties:{id:{type:"string",description:d(17385,null),pattern:Q9.source,patternErrorMessage:Uye},src:{type:"array",description:d(17386,null),items:{type:"object",properties:{path:{type:"string",description:d(17381,null)},format:{type:"string",description:d(17380,null),enum:["woff","woff2","truetype","opentype","embedded-opentype","svg"]}},required:["path","format"]}},weight:{type:"string",description:d(17383,null),anyOf:[{enum:["normal","bold","lighter","bolder"]},{type:"string",pattern:Hye.source}]},style:{type:"string",description:d(17382,null),anyOf:[{enum:["normal","italic","oblique"]},{type:"string",pattern:Bye.source}]}},required:["id","src"]}},iconDefinitions:{description:d(17384,null),$ref:vSt}}};function gro(){oe.as(ea.JSONContribution).registerSchema(t5o,i5o)}var jOt=ae("hostColorSchemeService");var r4=ae("IUserDataInitializationService"),QOt=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)))}},jYe=class{constructor(i,e,t){t.whenInstalledExtensionsRegistered().then(()=>this.initializeOtherResource(i,e))}async initializeOtherResource(i,e){await i.requiresInitialization()&&(sn("code/willInitOtherUserData"),await i.initializeOtherResources(e),sn("code/didInitOtherUserData"))}};jYe=I([m(0,r4),m(1,F),m(2,lt)],jYe);Gt&&oe.as(Qi.Workbench).registerWorkbenchContribution(jYe,3);function YOt(a){let i=new P,e=i.add(new E),t=jy();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 Jbi,n={},r=new o_,s=new o_;for(let l of t.getIcons()){let c=o.getIcon(l);if(!c)continue;let u=c.font,p=Hs`--vscode-icon-${a1(l.id)}-font-family`,h=Hs`--vscode-icon-${a1(l.id)}-content`;u?(n[u.id]=u.definition,s.push(Hs`${p}: ${WS(u.id)};`,Hs`${h}: ${WS(c.fontCharacter)};`),r.push(Hs`.codicon-${a1(l.id)}:before { content: ${WS(c.fontCharacter)}; font-family: ${WS(u.id)}; }`)):(s.push(Hs`${h}: ${WS(c.fontCharacter)}; ${p}: 'codicon';`),r.push(Hs`.codicon-${a1(l.id)}:before { content: ${WS(c.fontCharacter)}; }`))}for(let l in n){let c=n[l],u=c.weight?Hs`font-weight: ${Tye(c.weight)};`:Hs``,p=c.style?Hs`font-style: ${Tye(c.style)};`:Hs``,h=new o_;for(let g of c.src)h.push(Hs`${Na(g.location)} format(${WS(g.format)})`);r.push(Hs`@font-face { src: ${h.join(", ")}; font-family: ${WS(l)};${u}${p} font-display: block; }`)}return r.push(Hs`:root { ${s.join(" ")} }`),r.join(`
`)}}}var Jbi=class{getIcon(i){let e=jy(),t=i.defaults;for(;q.isThemeIcon(t);){let o=e.getIcon(t.id);if(!o)return;t=o.defaults}return t}};function vro(a){return`--vscode-${a.replace(/\./g,"-")}`}function o5o(a){return a!==null&&typeof a=="object"&&"light"in a&&"dark"in a}function n5o(a,i="px"){return{value:a,unit:i}}function yF(a,i="px"){let e=n5o(a,i);return{light:e,dark:e,hcDark:e,hcLight:e}}function QYe(a){return`${a.value}${a.unit}`}var r5o={SizeContribution:"base.contributions.sizes"};var Zbi=class extends C{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=QYe(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(o5o(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(`
`)}},YYe=new Zbi;oe.add(r5o.SizeContribution,YYe);function wF(a,i,e,t){return YYe.registerSize(a,i,e,t)}function XYe(){return YYe}var bro="vscode://schemas/workbench-sizes",Sro=oe.as(ea.JSONContribution);Sro.registerSchema(bro,YYe.getSizeSchema());var fro=new Dt(()=>Sro.notifySchemaChanged(bro),200);YYe.onDidChangeSchema(()=>{fro.isScheduled()||fro.schedule()});var pKc=wF("bodyFontSize",yF(13,"px"),d(2600,null)),mKc=wF("bodyFontSize.small",yF(12,"px"),d(2601,null)),hKc=wF("bodyFontSize.xSmall",yF(11,"px"),d(2602,null)),gKc=wF("codiconFontSize",yF(16,"px"),d(2603,null)),fKc=wF("cornerRadius.medium",yF(6,"px"),d(2606,null)),vKc=wF("cornerRadius.xSmall",yF(2,"px"),d(2609,null)),bKc=wF("cornerRadius.small",yF(4,"px"),d(2607,null)),SKc=wF("cornerRadius.large",yF(8,"px"),d(2605,null)),IKc=wF("cornerRadius.xLarge",yF(12,"px"),d(2608,null)),yKc=wF("cornerRadius.circle",yF(9999,"px"),d(2604,null)),wKc=wF("strokeThickness",yF(1,"px"),d(2610,null));function Iro(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 GSe().getColors()){let l=a.getColor(s.id,!0);l&&r.push(`${TN(s.id)}: ${l.toString()};`)}for(let s of XYe().getSizes()){let l=XYe().resolveDefaultSize(s.id,a);l&&r.push(`${vro(s.id)}: ${QYe(l)};`)}return n.addRule(`${i} { ${r.join(`
`)} }`),new eSi([...o].join(`
`))}var eSi=class{constructor(i){this.code=i}};var XOt="vscode-theme-defaults",tSi="vscode.vscode-theme-seti-vs-seti",yro="file-icons-enabled",s5o="contributedColorTheme",a5o="contributedFileIconTheme",l5o="contributedProductIconTheme",wro=oe.as(LJt.ThemingContribution);function c5o(a){switch(a){case"vs":return`vs ${XOt}-themes-light_vs-json`;case"vs-dark":return`vs-dark ${XOt}-themes-dark_vs-json`;case"hc-black":return`hc-black ${XOt}-themes-hc_black-json`;case"hc-light":return`hc-light ${XOt}-themes-hc_light-json`}return a}var d5o=aro(),u5o=lro(),p5o=cro(),JYe=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g){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.themeExtensionsActivated=new Map;this.container=c.mainContainer,this.settings=new $Ot(o,p),this.colorThemeRegistry=this._register(new kDe(d5o,o4.fromExtensionTheme)),this.colorThemeWatcher=this._register(new ZYe(s,r,this.reloadCurrentColorTheme.bind(this))),this.onColorThemeChange=this._register(new E({leakWarningThreshold:400})),this.currentColorTheme=o4.createUnloadedTheme(""),this.colorThemeSequencer=new Nm,this.fileIconThemeWatcher=this._register(new ZYe(s,r,this.reloadCurrentFileIconTheme.bind(this))),this.fileIconThemeRegistry=this._register(new kDe(u5o,XV.fromExtensionTheme,!0,XV.noIconTheme)),this.fileIconThemeLoader=new zOt(l,g),this.onFileIconThemeChange=this._register(new E({leakWarningThreshold:400})),this.currentFileIconTheme=XV.createUnloadedTheme(""),this.fileIconThemeSequencer=new Nm,this.productIconThemeWatcher=this._register(new ZYe(s,r,this.reloadCurrentProductIconTheme.bind(this))),this.productIconThemeRegistry=this._register(new kDe(p5o,JV.fromExtensionTheme,!0,JV.defaultTheme)),this.onProductIconThemeChange=this._register(new E),this.currentProductIconTheme=JV.createUnloadedTheme(""),this.productIconThemeSequencer=new Nm,this._register(this.onDidColorThemeChange(O=>GSe().notifyThemeUpdate(O)));let f=o4.fromStorageData(this.storageService),v=this.settings.colorTheme;f&&v!==f.settingsId&&(f=void 0);let b=v===Bd.COLOR_THEME_LIGHT?A7i:v===Bd.COLOR_THEME_DARK?P7i:void 0;if(!f){let O=r.options?.initialColorTheme;O&&(f=o4.createUnloadedThemeForThemeType(O.themeType,O.colors??b))}if(!f){let O=this.settings.getPreferredColorScheme()??(Gt?"light":"dark");f=o4.createUnloadedThemeForThemeType(O,b)}f.setCustomizations(this.settings),this.applyTheme(f,void 0,!0);let S=XV.fromStorageData(this.storageService);S&&this.applyAndSetFileIconTheme(S,!0);let y=JV.fromStorageData(this.storageService);y&&this.applyAndSetProductIconTheme(y,!0),e.whenInstalledExtensionsRegistered().then(O=>{this.installConfigurationListener(),this.installPreferredSchemeListener(),this.installRegistryListeners(),this.initialize().catch(mt)});let w=hr();w.id="codiconStyles";let k=this._register(YOt(this));function T(){w.textContent=k.getCSS()}let N=this._register(new Dt(T,0));this._register(k.onDidChange(()=>N.schedule())),N.schedule()}initialize(){let e=this.environmentService.extensionDevelopmentLocationURI,t=e&&e.length===1?e[0]:void 0,o=async()=>{let s=this.colorThemeRegistry.findThemeByExtensionLocation(t);if(s.length){let c=s.find(u=>u.type===this.currentColorTheme.type);return this.setColorTheme(c?c.id:s[0].id,void 0)}let l=this.colorThemeRegistry.findThemeBySettingsId(this.settings.colorTheme,void 0);if(!l){await this.userDataInitializationService.whenInitializationFinished();let c=this.currentColorTheme.type==="light"?Bd.COLOR_THEME_LIGHT:Bd.COLOR_THEME_DARK;l=this.colorThemeRegistry.findThemeBySettingsId(this.settings.colorTheme,c)}return this.setColorTheme(l&&l.id,void 0)},n=async()=>{let s=this.fileIconThemeRegistry.findThemeByExtensionLocation(t);if(s.length)return this.setFileIconTheme(s[0].id,8);let l=this.fileIconThemeRegistry.findThemeBySettingsId(this.settings.fileIconTheme);return l||(await this.userDataInitializationService.whenInitializationFinished(),l=this.fileIconThemeRegistry.findThemeBySettingsId(this.settings.fileIconTheme)),this.setFileIconTheme(l?l.id:tSi,void 0)},r=async()=>{let s=this.productIconThemeRegistry.findThemeByExtensionLocation(t);if(s.length)return this.setProductIconTheme(s[0].id,8);let l=this.productIconThemeRegistry.findThemeBySettingsId(this.settings.productIconTheme);return l||(await this.userDataInitializationService.whenInitializationFinished(),l=this.productIconThemeRegistry.findThemeBySettingsId(this.settings.productIconTheme)),this.setProductIconTheme(l?l.id:zue,void 0)};return Promise.all([o(),n(),r()])}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(Qbi(n.themes),await this.restoreColorTheme())this.currentColorTheme.settingsId===Bd.COLOR_THEME_DARK&&!cn(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(Bd.COLOR_THEME_DARK);await this.setColorTheme(r,"auto")}}));let t;this._register(this._register(this.fileIconThemeRegistry.onDidChange(async n=>{Ybi(n.themes),await this.restoreFileIconTheme()?this.currentFileIconTheme.id===tSi&&!cn(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(tSi,"auto"))})));let o;return this._register(this.productIconThemeRegistry.onDidChange(async n=>{Xbi(n.themes),await this.restoreProductIconTheme()?this.currentProductIconTheme.id===zue&&!cn(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(zue,"auto"))})),this._register(this.languageService.onDidChange(()=>this.reloadCurrentFileIconTheme())),Promise.all([this.getColorThemes(),this.getFileIconThemes(),this.getProductIconThemes()]).then(([n,r,s])=>{Qbi(n),Ybi(r),Xbi(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(je(n,"package.json"));return this.colorThemeRegistry.getMarketplaceThemes(JSON.parse(r),n,DE.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=Ae(e)?c5o(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 o4)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(17283,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=Iro(e,".monaco-workbench",wro.getThemingParticipants(),this.environmentService);iSi(t.code,s5o)}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=wro.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=Ae(e)?e:e.id;if(o!==this.currentFileIconTheme.id||!this.currentFileIconTheme.isLoaded){let r=this.fileIconThemeRegistry.findThemeById(o);!r&&e instanceof XV&&(r=e),r||(r=XV.noIconTheme),await r.ensureLoaded(this.fileIconThemeLoader),this.applyAndSetFileIconTheme(r)}let n=this.currentFileIconTheme;return n.isLoaded&&t!=="preview"&&(!n.location||!M7(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(je(n,"package.json"));return this.fileIconThemeRegistry.getMarketplaceThemes(JSON.parse(r),n,DE.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,iSi(e.styleSheetContent,a5o),e.id?this.container.classList.add(yro):this.container.classList.remove(yro),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=Ae(e)?e:e.id;if(o!==this.currentProductIconTheme.id||!this.currentProductIconTheme.isLoaded){let r=this.productIconThemeRegistry.findThemeById(o);!r&&e instanceof JV&&(r=e),r||(r=JV.defaultTheme),await r.ensureLoaded(this.extensionResourceLoaderService,this.logService),this.applyAndSetProductIconTheme(r)}let n=this.currentProductIconTheme;return n.isLoaded&&t!=="preview"&&(!n.location||!M7(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(je(n,"package.json"));return this.productIconThemeRegistry.getMarketplaceThemes(JSON.parse(r),n,DE.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,iSi(e.styleSheetContent,l5o),this.productIconThemeWatcher.update(e),e.id&&this.sendTelemetry(e.id,e.extensionData,"productIcon"),t||this.onProductIconThemeChange.fire(this.currentProductIconTheme)}};JYe=I([m(0,lt),m(1,le),m(2,B),m(3,Te),m(4,ru),m(5,be),m(6,Bx),m(7,fi),m(8,ne),m(9,jOt),m(10,r4),m(11,kt)],JYe);var ZYe=class{constructor(i,e,t){this.fileService=i;this.environmentService=e;this.onUpdate=t;this.watcherDisposables=new P}update(i){Xe(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 iSi(a,i){let e=It.document.head.getElementsByClassName(i);if(e.length===0){let t=hr();t.className=i,t.textContent=a}else e[0].textContent=a}sro();oro();gro();we(Gp,JYe,0);var m5o=Tn.registerExtensionPoint({extensionPoint:"resourceLabelFormatters",jsonSchema:{description:d(17085,null),type:"array",items:{type:"object",required:["scheme","formatting"],properties:{scheme:{type:"string",description:d(17090,null)},authority:{type:"string",description:d(17086,null)},formatting:{description:d(17087,null),type:"object",properties:{label:{type:"string",description:d(17089,null)},separator:{type:"string",description:d(17091,null)},stripPathStartingSeparator:{type:"boolean",description:d(17092,null)},tildify:{type:"boolean",description:d(17093,null)},workspaceSuffix:{type:"string",description:d(17088,null)}}}}}}}),h5o=/\//g,g5o=/[\\\/]/g,f5o=/\$\{(scheme|authoritySuffix|authority|path|(query)\.(.+?))\}/g;function v5o(a){return!!(a&&a[2]===":")}var eXe=class{constructor(i){this.formattersDisposables=new Map;m5o.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=Rd),!Ea(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)Ue(this.formattersDisposables.get(n))})}};eXe=I([m(0,ot)],eXe);oe.as(Qi.Workbench).registerWorkbenchContribution(eXe,3);var Cro=50,tXe=class extends C{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=zo,this.userHome=o.defaultUriScheme===Y.file?this.pathService.userHome({preferLocal:!0}):void 0;let l=this.storedFormattersMemento=new Bl("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??zo,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;Cp(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 T$i(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(Lo.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===Lo.sep&&(s=s.substring(l)),this.contextService.getWorkspace().folders.length>1&&!o.noPrefix){let u=n?.name??Ra(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===Ms.sep?n=Ms:t?.separator===Lo.sep?n=Lo:n=this.os===1?Ms:Lo,n.basename(o)}getWorkspaceLabel(e,t){if(Tq(e)){let o=VS(e);return $g(o)||TL(o)?this.getWorkspaceLabel(o,t):""}return A.isUri(e)?this.doGetSingleFolderWorkspaceLabel(e,t):$g(e)?this.doGetSingleFolderWorkspaceLabel(e.uri,t):TL(e)?this.doGetWorkspaceLabel(e.configPath,t):""}doGetWorkspaceLabel(e,t){if(_q(e,this.environmentService))return d(17084,null);if(xx(e))return d(17083,null);let o=Ye(e);o.endsWith(JN)&&(o=o.substr(0,o.length-JN.length-1));let n;switch(t?.verbose){case 0:n=o;break;case 2:n=d(17095,null,this.getUriLabel(je(ci(e),o)));break;case 1:default:n=d(17094,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=Ye(e)||Lo.sep;break}return t?.verbose===0?o:this.appendWorkspaceSuffix(o,e)}getSeparator(e,t){return this.findFormatting(A.from({scheme:e,authority:t}))?.separator||Lo.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>=Cro&&(o=Cro-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(f5o,(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":return t.stripPathStartingSeparator?e.path.slice(e.path[0]===t.separator?1:0):e.path;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&&v5o(n)&&(n=n.charAt(1).toUpperCase()+n.substr(2)),t.tildify&&!o&&this.userHome&&(n=Z$e(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?g5o:h5o,t)}appendWorkspaceSuffix(e,t){let o=this.findFormatting(t),n=o&&typeof o.workspaceSuffix=="string"?o.workspaceSuffix:void 0;return n?`${e} [${n}]`:e}};tXe=I([m(0,Vt),m(1,Pe),m(2,wn),m(3,yo),m(4,le),m(5,ao)],tXe);we(ot,tXe,1);var oSi="Offline";function oXe(a){return a instanceof iXe?!0:a instanceof Error&&a.name===oSi&&a.message===oSi}var iXe=class extends Error{constructor(){super(oSi),this.name=this.message}};var xro=/^(\^|>=)?((\d+)|x)\.((\d+)|x)\.((\d+)|x)(\-.*)?$/,b5o=/^-(\d{4})(\d{2})(\d{2})(\d{2})?(\d{2})?$/;function S5o(a){return a=a.trim(),a==="*"||xro.test(a)}function rSi(a){if(!S5o(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(xro);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 sSi(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=b5o.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 I5o(a,i,e){let t;typeof a=="string"?t=sSi(rSi(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=sSi(rSi(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 kro(a,i,e,t,o,n){let r=[];if(typeof t.publisher<"u"&&typeof t.publisher!="string")return r.push([gt.Error,d(2042,null)]),r;if(typeof t.name!="string")return r.push([gt.Error,d(2041,null,"name")]),r;if(typeof t.version!="string")return r.push([gt.Error,d(2043,null,"version")]),r;if(!t.engines)return r.push([gt.Error,d(2034,null,"engines")]),r;if(typeof t.engines.vscode!="string")return r.push([gt.Error,d(2035,null,"engines.vscode")]),r;if(typeof t.extensionDependencies<"u"&&!nSi(t.extensionDependencies))return r.push([gt.Error,d(2037,null,"extensionDependencies")]),r;if(typeof t.extensionAffinity<"u"&&!nSi(t.extensionAffinity))return r.push([gt.Error,d(2036,null,"extensionAffinity")]),r;if(typeof t.activationEvents<"u"){if(!nSi(t.activationEvents))return r.push([gt.Error,d(2030,null,"activationEvents")]),r;if(typeof t.main>"u"&&typeof t.browser>"u")return r.push([gt.Error,d(2031,null,"activationEvents","main","browser")]),r}if(typeof t.extensionKind<"u"&&typeof t.main>"u"&&r.push([gt.Warning,d(2038,null,"extensionKind")]),typeof t.main<"u"){if(typeof t.main!="string")return r.push([gt.Error,d(2039,null,"main")]),r;{let c=je(e,t.main);La(c,e)||r.push([gt.Warning,d(2040,null,c.path,e.path)])}}if(typeof t.browser<"u"){if(typeof t.browser!="string")return r.push([gt.Error,d(2032,null,"browser")]),r;{let c=je(e,t.browser);La(c,e)||r.push([gt.Warning,d(2033,null,c.path,e.path)])}}if(!vke(t.version))return r.push([gt.Error,d(2044,null)]),r;let s=[];if(!y5o(a,i,t,o,s))for(let c of s)r.push([gt.Error,c]);if(n&&t.enabledApiProposals?.length){let c=[];if(!s4([...t.enabledApiProposals],c))for(let u of c)r.push([gt.Error,u])}return r}function y5o(a,i,e,t,o){return t||typeof e.main>"u"&&typeof e.browser>"u"?!0:Ero(a,i,e.engines.vscode,o)}function Kue(a,i,e){return a==="*"||Ero(i,e,a)}function s4(a,i){if(a.length===0)return!0;let e=Array.isArray(i)?i:void 0,t=(Array.isArray(i)?void 0:i)??rz,o=[],n=W8i(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(2028,null,o[0])):e.push(d(2029,null,o.slice(0,o.length-1).map(r=>`'${r}'`).join(", "),o[o.length-1]))),!1):!0}function Ero(a,i,e,t=[]){let o=sSi(rSi(e));if(!o)return t.push(d(2048,null,e)),!1;if(o.majorBase===0){if(!o.majorMustEqual||!o.minorMustEqual)return t.push(d(2046,null,e)),!1}else if(!o.majorMustEqual)return t.push(d(2047,null,e)),!1;return I5o(a,i,o)?!0:(t.push(d(2045,null,a,e)),!1)}function nSi(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 JOt(a,i,e,t,o,n,r){let s={"X-Market-Client-Id":`VSCode ${a}`,"User-Agent":`VSCode ${a} (${i.nameShort})`};if(KL(i,e)&&xO(t)===3){let l=await TO(e,o,n);s["X-Market-User-Id"]=l,s["VSCode-SessionId"]=r.machineId||l}return s}var ZOt=Gt?"web":Pxt(Pp,ube),oFt="X-Market-Search-Activity-Id",aSi="Activityid",lSi="Server",cSi="X-Vss-E2eid",fw={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"},eB={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"},x5o=10,k5o={pageNumber:1,pageSize:x5o,sortBy:"NoneOrRelevance",sortOrder:0,flags:[],criteria:[],assetTypes:[]};var TDe=class a{constructor(i=k5o){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:Uo(i)})}withAssetTypes(...i){return new a({...this.state,assetTypes:i})}withSource(i){return new a({...this.state,source:i})}};function dSi(a,i){let e=(a||[]).filter(t=>t.statisticName===i)[0];return e?e.value:0}function E5o(a){let i="Microsoft.VisualStudio.Code.Translation.";return a.files.filter(t=>t.assetType.indexOf(i)===0).reduce((t,o)=>{let n=ZV(a,o.assetType);return n&&t.push([o.assetType.substring(i.length),n]),t},[])}function T5o(a){if(a.properties){let i=a.properties.filter(o=>o.key===fw.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 ZV(a,fw.Repository)}function _5o(a){return{uri:`${a.fallbackAssetUri}/${fw.VSIX}?redirect=true${a.targetPlatform?`&targetPlatform=${a.targetPlatform}`:""}`,fallbackUri:`${a.fallbackAssetUri}/${fw.VSIX}${a.targetPlatform?`?targetPlatform=${a.targetPlatform}`:""}`}}function ZV(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 Tro(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=>jle(o)):[]}function nFt(a){let i=a.properties?a.properties.filter(e=>e.key===eB.Engine):[];return i.length>0&&i[0].value||""}function D5o(a,i){a.properties=a.properties??[],a.properties.push({key:eB.Engine,value:i})}function _De(a){let i=a.properties?a.properties.filter(e=>e.key===eB.PreRelease):[];return i.length>0&&i[0].value==="true"}function Rro(a,i){return i.extensionProperties?.[a.toLowerCase()]?.hasPrereleaseVersion}function L5o(a,i){return i.extensionProperties?.[a.toLowerCase()]?.excludeVersionRange}function R5o(a){let i=a.properties?a.properties.filter(e=>e.key===eB.Private):[];return i.length>0&&i[0].value==="true"}function M5o(a){let i=a.properties?a.properties.filter(e=>e.key===eB.ExecutesCode):[];return i.length>0?i[0].value==="true":void 0}function pSi(a){let i=a.properties?a.properties.filter(t=>t.key===eB.EnabledApiProposals):[],e=i.length>0&&i[0].value||"";return e?e.split(","):[]}function P5o(a){let i=a.properties?a.properties.filter(t=>t.key===eB.LocalizedLanguages):[],e=i.length>0&&i[0].value||"";return e?e.split(","):[]}function A5o(a){return a.properties?.find(i=>i.key===eB.SponsorLink)?.value}function N5o(a){return a.properties?.find(i=>i.key===eB.SupportLink)?.value}function O5o(a){return a.indexOf("preview")!==-1}function Gue(a){return a.targetPlatform?B6i(a.targetPlatform):"undefined"}function eFt(a){let i=Uo(a.versions.map(Gue)),e=!!a.tags?.includes(Rxt),t=i.indexOf("web");return e?t===-1&&i.push("web"):t!==-1&&i.splice(t,1),i}function _ro(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(Gue(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 F5o(a,i,e){let t=[],o=-1,n=-1;for(let r of a){let s=Gue(r);if(!zle(s,e,i)){t.push(r);continue}_De(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 Dro(a,i,e){a.telemetryData={index:i,querySource:e,queryActivityId:a.queryContext?.[oFt]}}function uSi(a,i,e,t,o,n){let r=a.versions[0],s={manifest:ZV(i,fw.Manifest),readme:ZV(i,fw.Details),changelog:ZV(i,fw.Changelog),license:ZV(i,fw.License),repository:T5o(i),download:_5o(i),icon:ZV(i,fw.Icon),signature:ZV(i,fw.Signature),coreTranslations:E5o(i)},l=oP(t,a.linkType??"ExtensionDetailsViewUriTemplate"),c=oP(t,a.publisher.linkType??"PublisherViewUriTemplate"),u=oP(t,a.ratingLinkType??"ExtensionRatingViewUriTemplate"),p=Df(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:A5o(r),description:a.shortDescription??"",installCount:dSi(a.statistics,"install"),rating:dSi(a.statistics,"averagerating"),ratingCount:dSi(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:Tro(i,eB.Dependency),extensionPack:Tro(i,eB.ExtensionPack),engine:nFt(i),enabledApiProposals:pSi(i),localizedLanguages:P5o(i),targetPlatform:Gue(i),isPreReleaseVersion:_De(i),executesCode:M5o(i)},hasPreReleaseVersion:Rro(p,o)??_De(r),hasReleaseVersion:!0,private:R5o(r),preview:O5o(a.flags),isSigned:!!s.signature,queryContext:n,supportLink:N5o(r),detailsLink:l?PT(l,{publisher:a.publisher.publisherName,name:a.extensionName}):void 0,publisherLink:c?PT(c,{publisher:a.publisher.publisherName}):void 0,ratingLink:u?PT(u,{publisher:a.publisher.publisherName,name:a.extensionName}):void 0}}var FJ=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=JOt(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=ve.isCancellationToken(e)?{}:e,r=ve.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=oP(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 TDe().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??ZOt,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)=>Dro(h,g,e.source)),p}async getExtensionsUsingResourceApi(i,e,t,o,n){let r=[],s=[],l=[];for(let c of i)mj.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),Ae(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}.`,Cn(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=eFt(r),l=await this.getValidRawGalleryExtensionVersionFromLatestVersions(r,r.versions,i,e,s);return l?uSi(r,l,s,o,this.productService):"NOT_COMPATIBLE"}async getValidRawGalleryExtensionVersionFromLatestVersions(i,e,t,o,n){let r=o.targetPlatform??ZOt,s=F5o(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 iR(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||iR(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 ixe(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},ve.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=Rro(i.id,this.productService),c=L5o(i.id,this.productService);if(i.isPreReleaseVersion&&l===!1||c&&J8e(i.version,c))return!1;if(Ae(n)){if(i.version!==n)return!1}else if((n===0||n===1)&&i.isPreReleaseVersion!==(n===1))return!1;return!(e&&!zle(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:s4(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}.`,Cn(r)),!1}return t?Kue(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,fw.Manifest,e,{headers:o}),r=await hh(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}.`,Cn(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 TDe().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:ZOt,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];Dro(y,(p.pageNumber-1)*p.pageSize+S,i.source),Ot(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 ho;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=eFt(g),v={id:Df(g.publisher.publisherName,g.extensionName),uuid:g.extensionId},b=Da(e.includePreRelease)?e.includePreRelease:!!e.includePreRelease.find(y=>Ot(y,v))?.includePreRelease,S=await this.getValidRawGalleryExtensionVersion(g,g.versions,{compatible:e.compatible,targetPlatform:e.targetPlatform,productVersion:e.productVersion,version:e.versions?.find(y=>Ot(y,v))?.version??(b?2:0)},f);S&&h.push(uSi(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:Df(g.publisher.publisherName,g.extensionName),uuid:g.extensionId},v=Da(e.includePreRelease)?e.includePreRelease:!!e.includePreRelease.find(w=>Ot(w,f))?.includePreRelease,b=eFt(g);if(e.compatible&&(ixe(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=>Ot(w,f))?.version??(v?2:0)},b),y=S?uSi(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 En,g=new TDe().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:Df(i.publisher.publisherName,i.extensionName),uuid:i.extensionId},r=_ro(e,t.targetPlatform);if(t.compatible&&ixe(o,t.targetPlatform))return null;let s=Ae(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:_De(c),targetPlatform:Gue(c),engine:nFt(c),manifestAsset:ZV(c,fw.Manifest),enabledApiProposals:pSi(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(!nFt(e))try{let t=await this.getEngine(i,e.version,ZV(e,fw.Manifest));t&&D5o(e,t)}catch(t){this.logService.error(`Error while getting the engine for the version ${e.version}.`,Cn(t))}}async queryRawGalleryExtensions(i,e,t){let o=oP(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 En,u,p,h=0;try{if(u=await this.requestService.request({type:"POST",url:o,data:r,headers:l},t),u.res.statusCode&&u.res.statusCode>=400&&u.res.statusCode<500)return{galleryExtensions:[],total:h};let g=await hh(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?{[oFt]:u.res.headers.activityid}:{}}}return{galleryExtensions:[],total:h}}catch(g){if(so(g))throw p="Cancelled",g;{let f=Cn(g);throw p=oXe(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&&aP(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,lSi),activityId:this.getHeaderValue(u?.res.headers,aSi),endToEndId:this.getHeaderValue(u?.res.headers,cSi)})}}getHeaderValue(i,e){let t=i?.[e.toLowerCase()],o=Array.isArray(t)?t[0]:t;return o?new Im(o):void 0}async getLatestRawGalleryExtensionWithFallback(i,e,t){let[o,n]=i.id.split("."),r;try{let s=A.parse(PT(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(PT(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 En;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()},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 hh(o);return c||(n="NoData"),c}catch(s){let l;throw so(s)?l="Cancelled":oXe(s)?l="Offline":Cn(s).startsWith("XHR timeout")?l="Timeout":o&&UEt(o)?l="ClientError":o&&q7i(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,lSi),activityId:this.getHeaderValue(o?.res.headers,aSi),endToEndId:this.getHeaderValue(o?.res.headers,cSi)})}}async reportStatistic(i,e,t,o){if(Gt){this.logService.info("ExtensionGalleryService#reportStatistic: Skipped in web");return}let n=await this.extensionGalleryManifestService.getExtensionGalleryManifest();if(!n)return;let r=oP(n,"ExtensionStatisticsUriTemplate");if(!r)return;let s=PT(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},ve.None)}catch{}}async download(i,e,t){this.logService.trace("ExtensionGalleryService#download",i.identifier.id);let o=Qle(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?.[oFt],c=l&&typeof l=="string"?{[oFt]:l}:void 0,u=await this.getAsset(i.identifier.id,s,fw.VSIX,i.version,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()}`,Cn(h))}throw new xE(Cn(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,fw.Signature,i.version);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()}`,Cn(n))}throw new xE(Cn(o),"DownloadFailedWriting")}}async getReadme(i,e){if(i.assets.readme){let t=await this.getAsset(i.identifier.id,i.assets.readme,fw.Details,i.version,{},e);return await Kx(t)||""}return""}async getManifest(i,e){if(i.assets.manifest){let t=await this.getAsset(i.identifier.id,i.assets.manifest,fw.Manifest,i.version,{},e),o=await Kx(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),n=await Kx(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,fw.Changelog,i.version,{},e);return await Kx(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 TDe().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,ve.None);if(!n.length)return[];let r=eFt(n[0]);if(e&&ixe(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:_De(p),targetPlatform:Gue(p),engine:nFt(p),manifestAsset:ZV(p,fw.Manifest),enabledApiProposals:pSi(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 _ro(s,e?.targetPlatform??ZOt)){let h=u.get(p.version),g=h!==void 0?c[h]:void 0,f=Gue(p);g?g.targetPlatforms.push(f):(u.set(p.version,c.length),c.push({version:p.version,date:p.lastUpdated,isPreReleaseVersion:_De(p),targetPlatforms:[f]}))}return c}async getAsset(i,e,t,o,n={},r=ve.None){let s=await this.commonHeadersPromise,l={type:"GET"},c={...s,...n.headers||{}};n={...n,...l,headers:c};let u=e.uri,p=e.fallbackUri,h={...n,url:u,timeout:this.getRequestTimeout()},g;try{if(g=await this.requestService.request(h,r),g.res.statusCode===200)return g;let f=await Kx(g);throw new Error(`Expected 200, got back ${g.res.statusCode} instead.

${f}`)}catch(f){if(so(f))throw f;let v=Cn(f);this.telemetryService.publicLog2("galleryService:cdnFallback",{extension:i,assetType:t,message:v,extensionVersion:o,server:this.getHeaderValue(g?.res.headers,lSi),activityId:this.getHeaderValue(g?.res.headers,aSi),endToEndId:this.getHeaderValue(g?.res.headers,cSi)});let b={...n,url:p,timeout:this.getRequestTimeout()};return this.requestService.request(b,r)}}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()},ve.None);if(e.res.statusCode!==200)throw new Error("Could not get extensions report.");let t=await hh(e),o=[],n={},r=[],s=t?.autoUpdate??{};if(t){for(let l of t.malicious){if(!Ae(l))continue;let c=mj.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||Kue(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()]=Da(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(Axt);return Xo(i)&&i>=0?i:6e4}};FJ=I([m(1,_a),m(2,ne),m(3,Co),m(4,Te),m(5,be),m(6,nt),m(7,B),m(8,zp),m(9,vv)],FJ);var tFt=class extends FJ{constructor(i,e,t,o,n,r,s,l,c,u){super(i,e,t,o,n,r,s,l,c,u)}};tFt=I([m(0,le),m(1,_a),m(2,ne),m(3,Co),m(4,Te),m(5,be),m(6,nt),m(7,B),m(8,zp),m(9,vv)],tFt);var iFt=class extends FJ{constructor(i,e,t,o,n,r,s,l,c){super(void 0,i,e,t,o,n,r,s,l,c)}};iFt=I([m(0,_a),m(1,ne),m(2,Co),m(3,Te),m(4,be),m(5,nt),m(6,B),m(7,zp),m(8,vv)],iFt);var rXe=class extends FJ{constructor(i,e,t,o,n,r,s,l,c,u){super(i,e,t,o,n,r,s,l,c,u)}};rXe=I([m(0,le),m(1,_a),m(2,ne),m(3,Co),m(4,Te),m(5,be),m(6,nt),m(7,B),m(8,zp),m(9,vv)],rXe);we(ta,rXe,1);var CK=class extends C{constructor(e,t){super();this._onDidChangeEnablement=this._register(new E);this.onDidChangeEnablement=this._onDidChangeEnablement.event;this.storageManager=this._register(new sXe(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(nY)}async getDisabledExtensionsAsync(){return this.getDisabledExtensions()}_addToDisabledExtensions(e){let t=this.getDisabledExtensions();return t.every(o=>!Ot(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(Ot(n,e))return t.splice(o,1),this._setDisabledExtensions(t),!0}return!1}_setDisabledExtensions(e){this._setExtensions(nY,e)}_getExtensions(e){return this.storageManager.get(e,0)}_setExtensions(e,t){this.storageManager.set(e,t,0)}};CK=I([m(0,le),m(1,ls)],CK);var sXe=class extends C{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?(Jn(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(!Jn(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=>Ot(l,c))),s=n.filter(l=>!o.some(c=>Ot(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 sFt(){let a=oe.as(ii.Configuration).getConfigurationProperties();return Object.keys(a).filter(i=>!!a[i].disallowSyncIgnore)}function WJ(a=!1){let i=oe.as(ii.Configuration).getConfigurationProperties(),e=W5o(i,a),t=sFt();return Uo([...e,...t])}function W5o(a,i){let e=new Set;for(let t in a){if(i&&a[t].source)continue;let o=Ae(a[t].scope)?qmt(a[t].scope):a[t].scope;(a[t].ignoreSync||o===2||o===7)&&e.add(t)}return[...e.values()]}var Mro="settingsSync",V5o="settingsSync.keybindingsPerPlatform";function Pro(){let a="vscode://schemas/ignoredSettings",i=oe.as(ii.Configuration);i.registerConfiguration({id:"settingsSync",order:30,title:d(2696,null),type:"object",properties:{[V5o]:{type:"boolean",description:d(2699,null),default:!0,scope:1,tags:["sync","usesOnlineServices"]},"settingsSync.ignoredExtensions":{type:"array",markdownDescription:d(2697,null),items:[{type:"string",pattern:CO,errorMessage:d(2695,null)}],default:[],scope:1,uniqueItems:!0,disallowSyncIgnore:!0,tags:["sync","usesOnlineServices"]},"settingsSync.ignoredSettings":{type:"array",description:d(2698,null),default:[],scope:1,$ref:a,additionalProperties:!0,uniqueItems:!0,disallowSyncIgnore:!0,tags:["sync","usesOnlineServices"]}}});let e=oe.as(ea.JSONContribution),t=()=>{let o=sFt(),n=WJ(),r=Object.keys(Qw.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 Aro="0";function Nro(a){return a&&yi(a)&&Ae(a.id)&&Array.isArray(a.scopes)}var $ue=["settings","keybindings","snippets","prompts","tasks","extensions","globalState","profiles","mcp"];function mSi(a,...i){return a?[a,...i]:i}function aXe(a,i,e,t){return t.joinPath(e.userDataSyncHome,...mSi(a,i,`lastSync${i}.json`))}var TR=ae("IUserDataSyncStoreManagementService"),CF=ae("IUserDataSyncStoreService"),VJ=ae("IUserDataSyncLocalStoreService"),tB="x-operation-id",hSi="X-Execution-Id";function lXe(a){let i={};return i[hSi]=a,i}var Cg=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"}`}},Em=class extends Cg{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})(Cg||={});var iB="sync.store.url.type";function que(a){return`sync.enable.${a}`}var _l=ae("IUserDataSyncEnablementService"),aI=ae("IUserDataSyncService"),DDe=ae("IUserDataSyncResourceProviderService"),JE=ae("IUserDataAutoSyncService"),BJ=ae("IUserDataSyncUtilService"),uy=ae("IUserDataSyncLogService"),jue="userDataSync",HC="vscode-userdata-sync",Oro="preview";var LDe=ae("IUserDataSyncAccountService"),aFt=class extends C{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))}};aFt=I([m(0,CF),m(1,uy)],aFt);var a4=ae("IExtensionBisectService"),cXe=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}}},xK=class{constructor(i,e,t){this._storageService=e;this._envService=t;this._disabled=new Map;let o=e.get(xK._storageKey,-1);if(this._state=cXe.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||lCe(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=>Ot({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 cXe(e,0,e.length,0);this._storageService.store(xK._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 cXe(this._state.extensions,i?this._state.low:this._state.mid,i?this._state.mid:this._state.high);this._storageService.store(xK._storageKey,JSON.stringify(e),-1,1),await this._storageService.flush()}async reset(){this._storageService.remove(xK._storageKey,-1),await this._storageService.flush()}};xK=I([m(0,ne),m(1,le),m(2,Vt)],xK);we(a4,xK,1);var kK=class{constructor(i,e,t,o){this._extensionBisectService=e;this._notificationService=t;this._commandService=o;e.isActive&&(kK.ctxIsBisectActive.bindTo(i).set(!0),this._showBisectPrompt())}static{this.ctxIsBisectActive=new Q("isExtensionBisectActive",!1)}_showBisectPrompt(){let i={label:d(16813,null),run:()=>this._commandService.executeCommand("extension.bisect.next",!1)},e={label:d(16822,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(16806,null):d(16805,null,this._extensionBisectService.disabledCount);this._notificationService.prompt(St.Info,o,[i,e,t],{sticky:!0,priority:3})}};kK=I([m(0,X),m(1,a4),m(2,Ne),m(3,ge)],kK);oe.as(Qi.Workbench).registerWorkbenchContribution(kK,3);W(class extends K{constructor(){super({id:"extension.bisect.start",title:L(16824,"Start Extension Bisect"),category:We.Help,f1:!0,precondition:kK.ctxIsBisectActive.negate(),menu:{id:D.ViewContainerTitle,when:x.equals("viewContainer","workbench.view.extensions"),group:"2_enablement",order:4}})}async run(a){let i=a.get(ct),e=a.get(oi),t=a.get(ls),o=a.get(Os),n=a.get(a4),r=(await t.getInstalled(1)).filter(l=>o.isEnabled(l));(await i.confirm({message:d(16815,null),detail:d(16808,null,2+Math.log2(r.length)|0),primaryButton:d(16816,null)})).confirmed&&(await n.start(r),e.reload())}});W(class extends K{constructor(){super({id:"extension.bisect.next",title:L(16823,"Continue Extension Bisect"),category:We.Help,f1:!0,precondition:kK.ctxIsBisectActive})}async run(a,i){let e=a.get(ct),t=a.get(oi),o=a.get(a4),n=a.get(nt),r=a.get(nz),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(16812,null),d(16810,null,n.nameShort));else{let c=await e.confirm({type:St.Info,message:d(16812,null),primaryButton:d(16821,null),cancelButton:d(16807,null),detail:d(16809,null,l.id),checkbox:{label:d(16811,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:St.Info,message:d(16814,null),detail:d(16804,null,i.disabledCount),buttons:[{label:d(16819,null),run:()=>!1},{label:d(16817,null),run:()=>!0},{label:d(16820,null),run:()=>{}}],cancelButton:{label:d(16818,null),run:()=>null}});return e}});W(class extends K{constructor(){super({id:"extension.bisect.stop",title:L(16825,"Stop Extension Bisect"),category:We.Help,f1:!0,precondition:kK.ctxIsBisectActive})}async run(a){let i=a.get(a4),e=a.get(oi);await i.reset(),e.reload()}});var gSi="IWorkbenchExtensionEnablementService",fSi="chat.extensionUnification.enabled",dXe=class extends C{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 jo(0));this.storageManager=this._register(new sXe(e));let N=this._register(H.filter(r.onDidUninstallExtension,U=>!U.error)(({identifier:U})=>this._reset(U))),O=!1;this._register(Z(()=>O=!0)),this.extensionsManager=this._register(w.createInstance(uXe)),this.extensionsManager.whenInitialized().then(()=>{O||(N.dispose(),this._onDidChangeExtensions([],[],!1),this._register(this.extensionsManager.onDidChangeExtensions(({added:U,removed:G,isProfileSwitch:$})=>this._onDidChangeExtensions(U,G,$))),this.loopCheckForMaliciousExtensions())}),this._register(this.globalExtensionEnablementService.onDidChangeEnablement(({extensions:U,source:G})=>this._onDidChangeGloballyDisabledExtensions(U,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(U=>!!U);Gt&&this.environmentService.remoteAuthority===void 0?this._extensionUnificationEnabled=!1:this._extensionUnificationEnabled=this.configurationService.getValue(fSi),this._register(this.configurationService.onDidChangeConfiguration(U=>{U.affectsConfiguration(fSi)&&(this.configurationService.getValue(fSi)||(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(St.Info,d(16837,null),[{label:d(16839,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 Yle(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(NL(e.manifest))throw new Error(d(16836,null,e.manifest.displayName||e.identifier.id));if(this.userDataSyncEnablementService.isEnabled()&&this.userDataSyncAccountService.account&&Kri(e.manifest)&&e.manifest.contributes.authentication.some(o=>o.id===this.userDataSyncAccountService.account.authenticationProviderId))throw new Error(d(16834,null,e.manifest.displayName||e.identifier.id));if(this._isEnabledInEnv(e))throw new Error(d(16829,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(16826,null,e.manifest.displayName||e.identifier.id));case 4:throw new Error(d(16831,null,e.manifest.displayName||e.identifier.id));case 5:throw new Error(d(16832,null,e.manifest.displayName||e.identifier.id));case 1:throw new Error(d(16830,null,e.manifest.displayName||e.identifier.id));case 7:throw new Error(d(16827,null,e.manifest.displayName||e.identifier.id));case 6:throw new Error(d(16833,null,e.manifest.displayName||e.identifier.id));case 8:if(o)break;for(let n of Yle(this.extensionsManager.extensions,e))if(!this.isEnabled(n))throw new Error(d(16828,null,e.manifest.displayName||e.identifier.id,n.manifest.displayName||n.identifier.id))}}throwErrorIfCannotChangeWorkspaceEnablement(e){if(!this.hasWorkspace)throw new Error(d(16838,null));if(Kri(e.manifest))throw new Error(d(16835,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=>Ot(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=>Ot({id:h},c.identifier))||n.pack&&p.manifest.extensionPack?.some(h=>Ot({id:h},c.identifier)))){let p=l.findIndex(h=>Ot(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 Jxt(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&&!lCe(e.manifest,this.environmentService.remoteAuthority);let t=this.environmentService.disableExtensions;return Array.isArray(t)?t.some(o=>Ot({id:o},e.identifier)):!!Ot({id:s9i.value},e.identifier)}_isEnabledInEnv(e){let t=this.environmentService.enableExtensions;return Array.isArray(t)?t.some(o=>Ot({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(ikt);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=>Ot(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=>Ot(t,e))[0])return 13;if(this._getWorkspaceDisabledExtensions().filter(t=>Ot(t,e))[0])return 11}return this._isDisabledGlobally(e)?10:12}_isDisabledGlobally(e){return this.globalExtensionEnablementService.getDisabledExtensions().some(t=>Ot(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,gSi)}_disableExtension(e){return this._removeFromWorkspaceDisabledExtensions(e),this._removeFromWorkspaceEnabledExtensions(e),this.globalExtensionEnablementService.disableExtension(e,gSi)}_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=>!Ot(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(Ot(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=>!Ot(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(Ot(n,e))return t.splice(o,1),this._setEnabledExtensions(t),!0}return!1}_getWorkspaceEnabledExtensions(){return this._getExtensions(Cci)}_setEnabledExtensions(e){this._setExtensions(Cci,e)}_getWorkspaceDisabledExtensions(){return this._getExtensions(nY)}_setDisabledExtensions(e){this._setExtensions(nY,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!==gSi){await this.extensionsManager.whenInitialized();let o=this.extensionsManager.extensions.filter(n=>e.some(r=>Ot(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=>!Ot(l.identifier,s.identifier))&&n.push(s);for(let s of this.extensionsDisabledExtensions)r.every(l=>!Ot(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:LO(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)=>!Ae(o)&&!Ae(n)?Ot(o,n):o===n)?!1:(this.storageService.store("extensionsEnablement/malicious",JSON.stringify(e),-1,1),!0)}};dXe=I([m(0,le),m(1,nz),m(2,Pe),m(3,Vt),m(4,ls),m(5,B),m(6,Gc),m(7,_l),m(8,LDe),m(9,ao),m(10,Ne),m(11,oi),m(12,a4),m(13,zp),m(14,ns),m(15,Vd),m(16,xp),m(17,F),m(18,ne),m(19,nt)],dXe);var uXe=class extends C{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(H.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=>Ot(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=>Ot(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})}};uXe=I([m(0,Hd),m(1,Gc),m(2,ne)],uXe);we(Os,dXe,1);function RDe(a,i,e,t){try{H5o(a,i,e,t)}catch(o){a.error(o?.message??o)}return i}function H5o(a,i,e,t){let o=(n,r,s)=>{let l=n[r];if(Ae(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(2013,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(yi(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 pXe=class{constructor(i,e,t,o,n){this.extensionResourceLoaderService=t;this.logService=n;this.builtinExtensionsPromises=[];if(Gt){let r=o.extensionsGallery?.nlsBaseUrl;r&&o.commit&&!IS.isDefaultVariant()&&(this.nlsUrl=A.joinPath(A.parse(r),o.commit,o.version,IS.value()));let s=gn.asBrowserUri(D1i);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:[],description:"%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:[],description:"%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:[],description:"%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",description:"%json.schemas.url.desc%"},fileMatch:{type:"array",items:{type:"string",default:"MyFile.json",description:"%json.schemas.fileMatch.item.desc%"},minItems:1,description:"%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"},description:"%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:[".litcoffee",".md",".mkd",".mkdn",".mdwn",".mdown",".markdown",".markdn",".mdtxt",".mdtext",".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"}],"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.",description:"%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",description:"%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"}],configuration:[{title:"Simple Browser",properties:{"simpleBrowser.focusLockIndicator.enabled":{type:"boolean",default:!0,title:"Focus Lock Indicator Enabled",description:"%configuration.focusLockIndicator.enabled.description%"},"simpleBrowser.useIntegratedBrowser":{type:"boolean",default:!0,markdownDescription:"%configuration.useIntegratedBrowser.description%",scope:"application"}}}]},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.","configuration.useIntegratedBrowser.description":"When enabled, the `simpleBrowser.show` command will open URLs in the integrated browser instead of the Simple Browser webview. **Note:** This setting is only available on desktop."},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-2026",packageJSON:{name:"theme-2026",displayName:"2026 Themes",description:"Modern, minimal light and dark themes for 2026 with consistent neutral palette and accessible color contrast",version:"0.1.0",publisher:"vscode",license:"MIT",engines:{vscode:"^1.85.0"},categories:["Themes"],contributes:{themes:[{id:"Experimental Light",label:"VS Code Light",uiTheme:"vs",path:"./themes/2026-light.json"},{id:"Experimental Dark",label:"VS Code Dark",uiTheme:"vs-dark",path:"./themes/2026-dark.json"}]}},packageNLS:{displayName:"2026 Themes",description:"Modern, minimal light and dark themes for 2026 with consistent neutral palette and accessible color contrast","2026-light-label":"2026 Light","2026-dark-label":"2026 Dark"}},{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:"Default Dark+",label:"%darkPlusColorThemeLabel%",uiTheme:"vs-dark",path:"./themes/dark_plus.json"},{id:"Default Dark Modern",label:"%darkModernThemeLabel%",uiTheme:"vs-dark",path:"./themes/dark_modern.json"},{id:"Default Light+",label:"%lightPlusColorThemeLabel%",uiTheme:"vs",path:"./themes/light_plus.json"},{id:"Default 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",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",description:"%configuration.tsserver.nodePath%",scope:"window",keywords:["TypeScript"]},"typescript.tsserver.nodePath":{type:"string",description:"%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.enable#` 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=It.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=Df(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 RDe(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 RDe(this.logService,e,r,t)}catch(n){return this.logService.error(n),RDe(this.logService,e,t)}}};pXe=I([m(0,Vt),m(1,dt),m(2,Bx),m(3,nt),m(4,ne)],pXe);we(B8i,pXe,1);var nD=ae("extensionRecommendationsService"),uk=ae("IExtensionIgnoredRecommendationsService");var Yue=".vscode/extensions.json",EK=ae("IWorkspaceExtensionsConfigService"),mXe=class extends C{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(Yue))))&&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 Uo(e.flatMap(t=>t.recommendations?t.recommendations.map(o=>o.toLowerCase()):[]))}async getUnwantedRecommendations(){let e=await this.getExtensionsConfigs();return Uo(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 vt;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(16897,null)):await this.pickWorkspaceOrFolders(t.folders,t.configuration?t:void 0,d(16896,null));for(let u of c)Tq(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 vt;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(16897,null)):await this.pickWorkspaceOrFolders(t.folders,t.configuration?t:void 0,d(16896,null));for(let u of c)Tq(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(Yue),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(Yue),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(16899,null),workspaceOrFolder:l,iconClasses:js(this.modelService,this.languageService,l.uri,2)}));return t&&(r.push({type:"separator"}),r.push({label:d(16898,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=Ur(t.value.toString()).extensions;return o?this.parseExtensionConfig(o):void 0}catch{}}async resolveWorkspaceFolderExtensionConfig(e){try{let t=await this.fileService.readFile(e.toResource(Yue)),o=Ur(t.value.toString());return this.parseExtensionConfig(o)}catch{}return{}}parseExtensionConfig(e){return{recommendations:Uo((e.recommendations||[]).map(t=>t.toLowerCase())),unwantedRecommendations:Uo((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}}};mXe=I([m(0,Pe),m(1,be),m(2,Ge),m(3,Ct),m(4,kt),m(5,zf)],mXe);we(EK,mXe,1);var vSi="extensionsAssistant/ignored_recommendations",hXe=class extends C{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,vSi,this._store)(()=>this.onDidStorageChange())),this.initIgnoredWorkspaceRecommendations()}get globalIgnoredRecommendations(){return[...this._globalIgnoredRecommendations]}get ignoredRecommendations(){return Uo([...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(vSi,0,"[]")}setStoredIgnoredRecommendationsValue(e){this.storageService.store(vSi,e,0,0)}};hXe=I([m(0,EK),m(1,le)],hXe);we(uk,hXe,1);var bSi="extension.features.state",gXe=class extends C{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=oe.as(Ds.ExtensionFeaturesRegistry),this.extensionFeaturesState=this.loadState(),this.garbageCollectOldRequests(),this._register(e.onDidChangeValue(0,bSi,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(Da(n))return!n;let r=o.access.extensionsList?.[e._lower];return Da(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 Ei(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=>Ei.equals(p.identifier,e));l=(await this.dialogService.confirm({title:d(16840,null,n.label),message:d(16841,null,c?.displayName??e._lower,n.label),detail:o??n.description,custom:!0,primaryButton:d(16842,null),cancelButton:d(16843,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 Uo([...t.keys(),...this.extensionFeaturesState.keys()])){let n=new Ei(o),r=t.get(o),s=this.extensionFeaturesState.get(o);for(let l of Uo([...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;uo(p,h)||this._onDidChangeAccessData.fire({extension:n,featureId:l,accessData:p??{accessTimes:[]}})}}}}loadState(){let e={},t=this.storageService.get(bSi,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(bSi,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()}};gXe=I([m(0,le),m(1,ct),m(2,lt)],gXe);we(YI,gXe,1);var TK=class extends C{constructor(e){super();this.storageService=e;this.model=this._register(new KMt);this._onDidChangeFilter=this._register(new E);this.onDidChangeFilter=this._onDidChangeFilter.event;this.mapSourceToFilter=(()=>{let t=new Map;for(let o of this.storageService.getObject(TK.PER_SOURCE_FILTER_SETTINGS_KEY,-1,[]))t.set(o.id,o);return t})(),this.globalFilterEnabled=this.storageService.getBoolean(TK.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;C9(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(TK.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(TK.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:St.Info,message:e})}warn(e){if(Array.isArray(e)){for(let t of e)this.warn(t);return}this.model.addNotification({severity:St.Warning,message:e})}error(e){if(Array.isArray(e)){for(let t of e)this.error(t);return}this.model.addNotification({severity:St.Error,message:e})}notify(e){let t=new P;if(e.neverShowAgain){let n=this.toStorageScope(e.neverShowAgain),r=e.neverShowAgain.id;if(this.storageService.getBoolean(r,n))return new tae;let s=t.add(new st("workbench.notification.neverShowAgain",d(17131,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 H.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 tae;let f={label:d(17131,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 P,l=[],c=[];o.forEach((h,g)=>{let f=new Jde(`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 H.once(p.onDidClose)(()=>{s.dispose(),n&&typeof n.onCancel=="function"&&!r&&n.onCancel()}),p}status(e,t){return this.model.showStatusMessage(e,t)}};TK=I([m(0,le)],TK);we(Ne,TK,1);var fXe=class{constructor(i,e,t,o){this.keybindingsService=i;this.textModelService=e;this.textResourcePropertiesService=t;this.textResourceConfigurationService=o}async resolveDefaultCoreIgnoredSettings(){return WJ(!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")}}};fXe=I([m(0,_e),m(1,Nt),m(2,sL),m(3,Nn)],fXe);we(BJ,fXe,1);function PDe(a,i,e,t){let o=Sb(a,i,e,t)[0];return o&&(a=a.substring(0,o.offset)+o.content+a.substring(o.offset+o.length)),a}function uFt(a,i,e){let t=[];e?t=K5o(e):t=z5o(i);let o=[],n=[...sFt()];if(Array.isArray(t))for(let r of t)r.startsWith("-")?n.push(r.substring(1)):o.push(r);return Uo([...a,...o].filter(r=>!n.includes(r)))}function z5o(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 K5o(a){let i=Ur(a);return i?i["settingsSync.ignoredSettings"]||i["sync.ignoredSettings"]||[]:[]}function ySi(a,i,e,t){if(e.length){let o=ISi(i),n=Ur(i)||{},r=Ur(a);if(!r)return a;let s=[];for(let l of e){let c=n[l],u=r[l];c===void 0?a=PDe(a,[l],void 0,t):u!==void 0?a=PDe(a,[l],c,t):s.push(vXe(l,o))}s.sort((l,c)=>l.startOffset-c.startOffset),s.forEach(l=>a=G5o(l.setting.key,i,a,t))}return a}function G5o(a,i,e,t){let o=Ur(i),n=ISi(i),r=ISi(e),s=$5o(a,n,r);return q5o(e,a,o[a],s,r,t)}function $5o(a,i,e){let t=i.findIndex(n=>n.setting?.key===a),o=i[t-1];if(o){if(o.setting){let r=vXe(o.setting.key,e);if(r)return{index:e.indexOf(r),insertAfter:!0}}else{let r=SSi(t,i);if(r){let s=vXe(r.setting.key,e);if(s){let l=dFt(e.indexOf(s),e),c=ADe(i,r,i[t]);if(l){let u=ADe(e,s,l),p=cFt(c,u);return p?{index:e.indexOf(p),insertAfter:!0}:{index:e.indexOf(l),insertAfter:!1}}else{let u=ADe(e,s,e[e.length-1]),p=cFt(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=vXe(n.setting.key,e);if(r)return{index:e.indexOf(r),insertAfter:!1}}else{let r=dFt(t,i);if(r){let s=vXe(r.setting.key,e);if(s){let l=SSi(e.indexOf(s),e),c=ADe(i,i[t],r);if(l){let u=ADe(e,l,s),p=cFt(c.reverse(),u.reverse());return p?{index:e.indexOf(p),insertAfter:!1}:{index:e.indexOf(l),insertAfter:!0}}else{let u=ADe(e,e[0],s),p=cFt(c.reverse(),u.reverse());return p?{index:e.indexOf(p),insertAfter:!1}:{index:0,insertAfter:!1}}}}}}return{index:e.length-1,insertAfter:!0}}function q5o(a,i,e,t,o,n){let r;return t.index===-1?r=Sb(a,[i],e,n):r=j5o(a,i,e,t,o,n).map(s=>GX(a,s,n)[0]),Nde(a,r)}function j5o(a,i,e,t,o,n){let r=`${JSON.stringify(i)}: ${JSON.stringify(e)}`,s=Vhi(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=dFt(t.index,o),p=SSi(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+(dFt(t.index,o)?",":"")+s;return[{offset:l.startOffset,length:0,content:c}]}}function vXe(a,i){return i.filter(e=>e.setting?.key===a)[0]}function SSi(a,i){for(let e=a-1;e>=0;e--)if(i[e].setting)return i[e]}function dFt(a,i){for(let e=a+1;e<i.length;e++)if(i[e].setting)return i[e]}function ADe(a,i,e){let t=a.indexOf(i),o=a.indexOf(e);return a.filter((n,r)=>t<r&&r<o)}function cFt(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 ISi(a){let i=[],e=-1,t,o;return Wx(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 pFt=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,Je.fromString(e.settings))}};pFt=I([m(0,mn),m(1,be),m(2,ne)],pFt);var xF=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:ySi(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=ySi(t.settings,o||"{}",this.getIgnoredSettings(),n);await this.fileService.writeFile(e.settingsResource,Je.fromString(r))}getIgnoredSettings(){let i=oe.as(ii.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 As&&e.fileOperationResult===1)return null;throw e}}};xF=I([m(0,be),m(1,BJ),m(2,ne)],xF);var l4=class{constructor(i,e,t){this.profile=i;this.uriIdentityService=e;this.instantiationService=t;this.type="settings";this.handle="settings";this.label={label:d(17476,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:Zh,title:"",arguments:[this.profile.settingsResource,void 0,void 0]}}]}async hasContent(){return(await this.instantiationService.createInstance(xF).getSettingsContent(this.profile)).settings!==null}async getContent(){return this.instantiationService.createInstance(xF).getContent(this.profile)}isFromDefaultProfile(){return!this.profile.isDefault&&!!this.profile.useDefaultFlags?.settings}};l4=I([m(1,dt),m(2,F)],l4);var mFt=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,Je.fromString(e.keybindings))}};mFt=I([m(0,mn),m(1,be),m(2,ne)],mFt);var kF=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:Pp}}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,Je.fromString(t.keybindings))}async getKeybindingsContent(i){try{return(await this.fileService.readFile(i.keybindingsResource)).value.toString()}catch(e){if(e instanceof As&&e.fileOperationResult===1)return null;throw e}}};kF=I([m(0,be),m(1,ne)],kF);var c4=class{constructor(i,e,t){this.profile=i;this.uriIdentityService=e;this.instantiationService=t;this.type="keybindings";this.handle="keybindings";this.label={label:d(17474,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:Zh,title:"",arguments:[this.profile.keybindingsResource,void 0,void 0]}}]}async hasContent(){return(await this.instantiationService.createInstance(kF).getKeybindingsResourceContent(this.profile)).keybindings!==null}async getContent(){return this.instantiationService.createInstance(kF).getContent(this.profile)}};c4=I([m(1,dt),m(2,F)],c4);var hFt=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,Je.fromString(e.snippets[t]))}}};hFt=I([m(0,mn),m(1,be),m(2,dt)],hFt);var XP=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,Je.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 As&&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}};XP=I([m(0,be),m(1,dt)],XP);var d4=class{constructor(i,e,t){this.profile=i;this.instantiationService=e;this.uriIdentityService=t;this.type="snippets";this.label={label:d(17478,null)};this.collapsibleState=1;this.excludedSnippets=new Mn;this.handle=this.profile.snippetsHome.toString()}async getChildren(){let i=await this.instantiationService.createInstance(XP).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(17477,null,this.uriIdentityService.extUri.basename(t))}}:void 0,command:{id:Zh,title:"",arguments:[t,void 0,void 0]}}))}async hasContent(){return(await this.instantiationService.createInstance(XP).getSnippetsResources(this.profile)).length>0}async getContent(){return this.instantiationService.createInstance(XP).getContent(this.profile,this.excludedSnippets)}isFromDefaultProfile(){return!this.profile.isDefault&&!!this.profile.useDefaultFlags?.snippets}};d4=I([m(1,F),m(2,dt)],d4);var gFt=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,Je.fromString(e.tasks))}};gFt=I([m(0,mn),m(1,be),m(2,ne)],gFt);var EF=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,Je.fromString(t.tasks))}async getTasksContent(i){try{return(await this.fileService.readFile(i.tasksResource)).value.toString()}catch(e){if(e instanceof As&&e.fileOperationResult===1)return null;throw e}}};EF=I([m(0,be),m(1,ne)],EF);var u4=class{constructor(i,e,t){this.profile=i;this.uriIdentityService=e;this.instantiationService=t;this.type="tasks";this.handle="tasks";this.label={label:d(17479,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:Zh,title:"",arguments:[this.profile.tasksResource,void 0,void 0]}}]}async hasContent(){return(await this.instantiationService.createInstance(EF).getTasksResourceContent(this.profile)).tasks!==null}async getContent(){return this.instantiationService.createInstance(EF).getContent(this.profile)}isFromDefaultProfile(){return!this.profile.isDefault&&!!this.profile.useDefaultFlags?.tasks}};u4=I([m(1,dt),m(2,F)],u4);var fFt=class extends C{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)}},vFt=class extends fFt{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})}},NDe=class extends vFt{constructor(i){super(i,void 0)}async close(){this.dispose()}},ODe=class extends vFt{async close(){this.dispose()}},bFt=class extends fFt{constructor(e,t){super(e,void 0,t);this.onDidChangeItemsExternal=H.None}async close(){this.dispose()}};var TF=ae("IUserDataProfileStorageService"),bXe=class extends C{constructor(e,t){super();this.storageService=t;e&&(this.storageServicesMap=this._register(new jt))}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 wSi(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)}};bXe=I([m(1,le)],bXe);var SFt=class extends bXe{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=>Qy(u,o.profilesHome.scheme)),valueChanges:c.valueChanges.map(u=>({...u,profile:Qy(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 iwe(e)?new NDe(t):new ODe(t,e)}},wSi=class extends Rae{constructor(e){super({flushInterval:100});this.profileStorageDatabase=e}async doInitialize(){let e=await this.profileStorageDatabase,t=new XN(e);return this._register(t.onDidChangeStorage(o=>{this.emitDidChangeValue(0,o)})),this._register(Z(()=>{t.close(),t.dispose(),Ac(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 IFt=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=>Ot(u,s.identifier)),c=t.find(u=>Ot(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})=>Ot(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})),ve.None);await Promise.all(n.map(async l=>{let c=s.find(u=>Ot(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:{[hj]:!0,[UL]:!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)))}};IFt=I([m(0,mn),m(1,ls),m(2,ta),m(3,nz),m(4,ne)],IFt);var JP=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=>Ot(f,p.identifier)),g=s.find(f=>Ot(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})=>Ot(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})),ve.None),h=[];if(await Promise.all(c.map(async g=>{let f=p.find(v=>Ot(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:{[hj]:!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(17472,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=>Ot(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 P,n=o.add(this.instantiationService.createChild(new Io([le,t]))),r=o.add(n.createInstance(CK));try{return await e(r)}finally{o.dispose()}})}};JP=I([m(0,Hd),m(1,ta),m(2,TF),m(3,F),m(4,ne)],JP);var WDe=class{constructor(){this.type="extensions";this.handle="extensions";this.label={label:d(17471,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(17469,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(17470,null,t.displayName||t.identifier.id),accessibilityInformation:{label:d(17470,null,t.displayName||t.identifier.id)}}:void 0,themeIcon:M.extensions,command:{id:"extension.open",title:"",arguments:[t.identifier.id,void 0,!0]}}))}async hasContent(){return(await this.getExtensions()).length>0}},p4=class extends WDe{constructor(e,t){super();this.profile=e;this.instantiationService=t}isFromDefaultProfile(){return!this.profile.isDefault&&!!this.profile.useDefaultFlags?.extensions}getExtensions(){return this.instantiationService.createInstance(JP).getLocalExtensions(this.profile)}async getContent(){return this.instantiationService.createInstance(JP).getContent(this.profile,[...this.excludedExtensions.values()])}};p4=I([m(1,F)],p4);var FDe=class extends WDe{constructor(e,t){super();this.content=e;this.instantiationService=t}isFromDefaultProfile(){return!1}getExtensions(){return this.instantiationService.createInstance(JP).getProfileExtensions(this.content)}async getContent(){let e=this.instantiationService.createInstance(JP),t=await e.getProfileExtensions(this.content);return e.toContent(t,[...this.excludedExtensions.values()])}};FDe=I([m(1,F)],FDe);var yFt=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)}}};yFt=I([m(0,le)],yFt);var m4=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)}}};m4=I([m(0,le),m(1,TF),m(2,ne)],m4);var BDe=class{constructor(i,e){this.resource=i;this.uriIdentityService=e;this.type="globalState";this.handle="globalState";this.label={label:d(17473,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:Zh,title:"",arguments:[this.resource,void 0,void 0]}}]}},VDe=class extends BDe{constructor(e,t,o,n){super(t,o);this.profile=e;this.instantiationService=n}async hasContent(){let e=await this.instantiationService.createInstance(m4).getGlobalState(this.profile);return Object.keys(e.storage).length>0}async getContent(){return this.instantiationService.createInstance(m4).getContent(this.profile)}isFromDefaultProfile(){return!this.profile.isDefault&&!!this.profile.useDefaultFlags?.globalState}};VDe=I([m(2,dt),m(3,F)],VDe);var wFt=class extends BDe{constructor(e,t,o){super(t,o);this.content=e}async getContent(){return this.content}isFromDefaultProfile(){return!1}};wFt=I([m(2,dt)],wFt);var SXe=class{constructor(i){this.type=1,this.ctime=Date.now(),this.mtime=Date.now(),this.size=0,this.name=i}},UJ=class{constructor(i){this.type=2,this.ctime=Date.now(),this.mtime=Date.now(),this.size=0,this.name=i,this.entries=new Map}},Xue=class extends C{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 UJ("");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 Jr("file not found","EntryNotFound")}readFileStream(e){let t=this._lookupAsFile(e,!1).data,o=_I(n=>Je.concat(n.map(r=>Je.wrap(r))).buffer);return o.end(t),o}async writeFile(e,t,o){let n=Ye(e),r=this._lookupParentDirectory(e),s=r.entries.get(n);if(s instanceof UJ)throw Jr("file is directory","EntryIsADirectory");if(!s&&!o.create)throw Jr("file not found","EntryNotFound");if(s&&o.create&&!o.overwrite)throw Jr("file exists already","EntryExists");if(s||(s=new SXe(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=D$i(t),r=n&&!!t.append;if(o){if(o instanceof UJ)throw Jr("file is directory","EntryIsADirectory")}else{if(!n)throw Jr("file not found","EntryNotFound");let l=Ye(e),c=this._lookupParentDirectory(e);o=new SXe(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 Jr("No file with that descriptor open","Unavailable");if(!s.file.data)return Promise.resolve(0);let l=Je.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 Jr("No file with that descriptor open","Unavailable");let l=Je.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 Jr("file exists already","EntryExists");let n=this._lookup(e,!1),r=this._lookupParentDirectory(e),s=this._lookupParentDirectory(t),l=Ye(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=Ye(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 Jr("file exists already","EntryExists");let t=Ye(e),o=ci(e),n=this._lookupAsDirectory(o,!1),r=new UJ(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 UJ&&(s=n.entries.get(r)),!s){if(t)return;throw Jr("file not found","EntryNotFound")}n=s}return n}_lookupAsDirectory(e,t){let o=this._lookup(e,t);if(o instanceof UJ)return o;throw Jr("file not a directory","EntryNotADirectory")}_lookupAsFile(e,t){let o=this._lookup(e,t);if(o instanceof SXe)return o;throw Jr("file is a directory","EntryIsADirectory")}_lookupParentDirectory(e){let t=ci(e);return this._lookupAsDirectory(t,!1)}watch(e,t){return C.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 Q5o(a){let i=a;return!!(i&&typeof i=="object"&&i.name&&typeof i.name=="string"&&(cn(i.icon)||typeof i.icon=="string")&&(cn(i.settings)||typeof i.settings=="string")&&(cn(i.globalState)||typeof i.globalState=="string")&&(cn(i.extensions)||typeof i.extensions=="string"))}var IXe=class extends C{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(Y.file,this.fileUserDataProfileContentHandler=e.createInstance(yXe))}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 P,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(17483,null,u)});r=xn(async u=>{let h=await n.add(this.instantiationService.createInstance(Zue,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(17494,null)),await this.instantiationService.createInstance(JP).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 P,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(17483,null,u)});r=xn(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(17487,null)),await this.instantiationService.createInstance(xF).apply(e.settings,t)),!r.isCancellationRequested&&(e.keybindings&&(o.resourceTypeFlags?.keybindings??!0)&&!t.useDefaultFlags?.keybindings&&(n(d(17484,null)),await this.instantiationService.createInstance(kF).apply(e.keybindings,t)),!r.isCancellationRequested&&(e.tasks&&(o.resourceTypeFlags?.tasks??!0)&&!t.useDefaultFlags?.tasks&&(n(d(17486,null)),await this.instantiationService.createInstance(EF).apply(e.tasks,t)),!r.isCancellationRequested&&(e.snippets&&(o.resourceTypeFlags?.snippets??!0)&&!t.useDefaultFlags?.snippets&&(n(d(17485,null)),await this.instantiationService.createInstance(XP).apply(e.snippets,t)),!r.isCancellationRequested&&(e.globalState&&!t.useDefaultFlags?.globalState&&(n(d(17480,null)),await this.instantiationService.createInstance(m4).apply(e.globalState,t)),!r.isCancellationRequested&&e.extensions&&(o.resourceTypeFlags?.extensions??!0)&&!t.useDefaultFlags?.extensions&&(n(d(17494,null)),await this.instantiationService.createInstance(JP).apply(e.extensions,t,n,r))))))}async exportProfile(e,t){let o=new P;try{let n=o.add(this.instantiationService.createInstance(Zue,e,t));await this.doExportProfile(n,15)}finally{o.dispose()}}async createTroubleshootProfile(){let e=this.instantiationService.createInstance(Zue,this.userDataProfileService.currentProfile,void 0);try{let t=await e.getProfileTemplate(d(17513,null),void 0);await this.progressService.withProgress({location:15,delay:1e3,sticky:!0},async o=>{let n=s=>o.report({message:d(17514,null,s)}),r=await this.doCreateProfile(t,!0,!1,{useDefaultFlags:this.userDataProfileService.currentProfile.useDefaultFlags},n);r&&(n(d(17503,null)),await this.instantiationService.createInstance(JP).copy(this.userDataProfileService.currentProfile,r,!0),n(d(17512,null)),await this.userDataProfileManagementService.switchProfile(r))})}finally{e.dispose()}}async doExportProfile(e,t){let o=await e.getProfileToExport();if(!o)return;let n=new P;try{await this.progressService.withProgress({location:t,title:d(17502,null,oF.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),ve.None);if(!c)return;let u=d(17491,null,o.name);if(l.extensionId){let p=[],h=this.productService.webUrl?`${this.productService.webUrl}/${v9e}/${s}/${c.id}`:uto(`/${s}/${c.id}`,this.productService).toString();p.push({label:d(17482,null),run:()=>this.clipboardService.writeText(h)}),this.productService.webUrl?p.push({label:d(17497,null),run:async()=>{await this.openerService.open(h)}}):p.push({label:d(17498,null,l.name),run:async()=>{await this.openerService.open(c.link.toString())}}),await this.dialogService.prompt({type:gt.Info,message:u,buttons:p,cancelButton:d(17481,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(17495,null))}return Q5o(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(17506,null)),await this.instantiationService.createInstance(xF).apply(e.settings,s)),e.keybindings&&!s.useDefaultFlags?.keybindings&&(r(d(17505,null)),await this.instantiationService.createInstance(kF).apply(e.keybindings,s)),e.tasks&&!s.useDefaultFlags?.tasks&&(r(d(17508,null)),await this.instantiationService.createInstance(EF).apply(e.tasks,s)),e.snippets&&!s.useDefaultFlags?.snippets&&(r(d(17507,null)),await this.instantiationService.createInstance(XP).apply(e.snippets,s)),e.globalState&&!s.useDefaultFlags?.globalState&&(r(d(17504,null)),await this.instantiationService.createInstance(m4).apply(e.globalState,s)),e.extensions&&o&&!s.useDefaultFlags?.extensions&&(r(d(17503,null)),await this.instantiationService.createInstance(JP).apply(e.extensions,s)),s}async resolveProfileContent(e){if(await this.fileUserDataProfileContentHandler.canHandle(e))return this.fileUserDataProfileContentHandler.readProfile(e,ve.None);if(eTe(e)){let o,n;e.authority===v9e?(n=this.uriIdentityService.extUri.basename(e),o=this.uriIdentityService.extUri.basename(this.uriIdentityService.extUri.dirname(e))):(o=e.authority.substring(vhi.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,ve.None)}await this.extensionService.activateByEvent("onProfile");for(let o of this.profileContentHandlers.values()){let n=await o.readProfile(e,ve.None);if(n!==null)return n}let t=await this.requestService.request({type:"GET",url:e.toString(!0)},ve.None);if(t.res.statusCode===200)return await E_(t);{let o=await E_(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(17511,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:gt.Info,message:d(17500,null,n),primaryButton:d(17499,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(`${Yr(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}};IXe=I([m(0,F),m(1,mn),m(2,UE),m(3,an),m(4,lt),m(5,Ge),m(6,Bo),m(7,ct),m(8,Wi),m(9,Qe),m(10,_a),m(11,nt),m(12,dt)],IXe);var yXe=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(17496,null);this.description=d(17492,null)}async saveProfile(i,e,t){let o=await this.fileDialogService.showSaveDialog({title:d(17488,null),filters:S9e,defaultUri:this.uriIdentityService.extUri.joinPath(await this.fileDialogService.defaultFilePath(),`${i}.${b9e}`)});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!==Y.http&&i.scheme!==Y.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:S9e,title:d(17510,null)});return i?i[0]:null}};yXe=I([m(0,dn),m(1,dt),m(2,be),m(3,nt),m(4,Ho)],yXe);var Jue="userdataprofileexport",Fro="userdataprofileexportpreview",wXe=class extends C{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=Mr(e.label.label)?e.label.label.value:e.label.label;e.checkbox={isChecked:!e.isFromDefaultProfile(),tooltip:d(17509,null,t),accessibilityInformation:{label:d(17509,null,t)}},e.isFromDefaultProfile()&&(e.description=d(17493,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 l4?n=await p.getContent():p instanceof c4?r=await p.getContent():p instanceof u4?s=await p.getContent():p instanceof d4?l=await p.getContent():p instanceof WDe?c=await p.getContent():p instanceof BDe&&(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}};wXe=I([m(0,Ge)],wXe);var Zue=class extends wXe{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 P)}async fetchRoots(){this.disposables.clear(),this.disposables.add(this.fileService.registerProvider(Jue,this._register(new Xue)));let e=this._register(new Xue);this.disposables.add(this.fileService.registerProvider(Fro,e));let t=[],o=this.createExportPreviewProfile(this.profile);if(this.exportFlags?.settings??!0){let n=this.instantiationService.createInstance(xF),r=await n.getContent(this.profile);await n.apply(r,o);let s=this.instantiationService.createInstance(l4,o);await s.hasContent()&&t.push(s)}if(this.exportFlags?.keybindings??!0){let n=this.instantiationService.createInstance(kF),r=await n.getContent(this.profile);await n.apply(r,o);let s=this.instantiationService.createInstance(c4,o);await s.hasContent()&&t.push(s)}if(this.exportFlags?.snippets??!0){let n=this.instantiationService.createInstance(XP),r=await n.getContent(this.profile);await n.apply(r,o);let s=this.instantiationService.createInstance(d4,o);await s.hasContent()&&t.push(s)}if(this.exportFlags?.tasks??!0){let n=this.instantiationService.createInstance(EF),r=await n.getContent(this.profile);await n.apply(r,o);let s=this.instantiationService.createInstance(u4,o);await s.hasContent()&&t.push(s)}if(this.exportFlags?.globalState??!0){let n=je(o.globalStorageHome,"globalState.json").with({scheme:Fro}),r=this.instantiationService.createInstance(VDe,o,n),s=await r.getContent();s&&(await this.fileService.writeFile(n,Je.fromString(JSON.stringify(JSON.parse(s),null,"	"))),t.push(r))}if(this.exportFlags?.extensions??!0){let n=this.instantiationService.createInstance(p4,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:Jue}),keybindingsResource:e.keybindingsResource.with({scheme:Jue}),tasksResource:e.tasksResource.with({scheme:Jue}),mcpResource:e.mcpResource.with({scheme:Jue}),snippetsHome:e.snippetsHome.with({scheme:Jue}),promptsHome:e.promptsHome.with({scheme:Jue}),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(17489,null),title:d(17490,null),async validateInput(t){if(!t.trim())return d(17501,null)}}),!e)?null:super.getProfileTemplate(e,this.profile.icon)}};Zue=I([m(2,Ge),m(3,be),m(4,F)],Zue);we(PV,IXe,1);var CXe=class extends C{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(17519,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(17520,null))):this.changeCurrentProfile(v,d(17521,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(wP);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,VS(this.workspaceContextService.getWorkspace()));return await this.changeCurrentProfile(o),o}async createAndEnterTransientProfile(){let e=await this.userDataProfilesService.createTransientProfile(VS(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(17516,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(17515,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=VS(this.workspaceContextService.getWorkspace());await this.userDataProfilesService.setProfileForWorkspace(o,e),Eq(o)&&await this.changeCurrentProfile(e)}async getBuiltinProfileTemplates(){if(this.productService.profileTemplatesUrl)try{let e=await this.requestService.request({type:"GET",url:this.productService.profileTemplatesUrl},ve.None);if(e.res.statusCode===200)return await hh(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||!uo(this.userDataProfileService.currentProfile.useDefaultFlags,e.useDefaultFlags);if(n&&!o&&!await this.extensionService.stopExtensionHosts(d(17522,null)))throw this.userDataProfilesService.profiles.some(r=>r.id===this.userDataProfileService.currentProfile.id)&&await this.userDataProfilesService.setProfileForWorkspace(VS(this.workspaceContextService.getWorkspace()),this.userDataProfileService.currentProfile),new ho;if(await this.userDataProfileService.updateCurrentProfile(e),n)if(o){let{confirmed:r}=await this.dialogService.confirm({message:t??d(17518,null),primaryButton:d(17517,null)});r&&await this.hostService.reload()}else await this.extensionService.startExtensionHosts()}};CXe=I([m(0,an),m(1,mn),m(2,oi),m(3,ct),m(4,Pe),m(5,lt),m(6,Vt),m(7,nt),m(8,_a),m(9,B),m(10,dt),m(11,ne)],CXe);we(UE,CXe,0);function Wro(a){return a.toJSON()}var CFt=class{constructor(i){this._uriTransformer=i}transformIncoming(i){let e=this._uriTransformer.transformIncoming(i);return e===i?i:Wro(A.from(e))}transformOutgoing(i){let e=this._uriTransformer.transformOutgoing(i);return e===i?i:Wro(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)}},xFt=new class{transformIncoming(a){return a}transformOutgoing(a){return a}transformOutgoingURI(a){return a}transformOutgoingScheme(a){return a}};function CSi(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 Je)return null;for(let o in a)if(Object.hasOwnProperty.call(a,o)){let n=CSi(a[o],i,e,t+1);n!==null&&(a[o]=n)}}return null}function epe(a,i){let e=CSi(a,i,!1,0);return e===null?a:e}function kFt(a,i){let e=CSi(a,i,!0,0);return e===null?a:e}var HDe=class extends C{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=>Qy(n,this.profilesHome.scheme)),this._register(this.channel.listen("onDidChangeProfiles")(n=>{let r=n.added.map(c=>Qy(c,this.profilesHome.scheme)),s=n.removed.map(c=>Qy(c,this.profilesHome.scheme)),l=n.updated.map(c=>Qy(c,this.profilesHome.scheme));this._profiles=n.all.map(c=>Qy(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 Qy(n,this.profilesHome.scheme)}async createProfile(e,t,o,n){let r=await this.channel.call("createProfile",[e,t,o,n]);return Qy(r,this.profilesHome.scheme)}async createTransientProfile(e){let t=await this.channel.call("createTransientProfile",[e]);return Qy(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 Qy(o,this.profilesHome.scheme)}resetWorkspaces(){return this.channel.call("resetWorkspaces")}cleanUp(){return this.channel.call("cleanUp")}cleanUpTransientProfiles(){return this.channel.call("cleanUpTransientProfiles")}};var xSi="associatedRemoteProfiles",ZP=ae("IRemoteUserDataProfilesService"),xXe=class extends C{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 HDe(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 Zs("Remote profiles service not available in the current window");return this.remoteUserDataProfilesService.profiles}async getRemoteProfile(e){if(await this.initPromise,!this.remoteUserDataProfilesService)throw new Zs("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=Uo(e),e.length?t[this.environmentService.remoteAuthority]=e:delete t[this.environmentService.remoteAuthority],Object.keys(t).length?this.storageService.store(xSi,JSON.stringify(t),-1,1):this.storageService.remove(xSi,-1)}}parseAssociatedRemoteProfiles(){if(this.environmentService.remoteAuthority){let e=this.storageService.get(xSi,-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)}};xXe=I([m(0,Vt),m(1,yo),m(2,an),m(3,mn),m(4,le),m(5,ne)],xXe);we(ZP,xXe,1);var _K=ae("IRemoteExtensionsScannerService"),Vro="remoteExtensionsScanner";var oB=ae("localizationService"),EFt=ae("activeLanguageService");var kXe=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",[Dr,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(Vro,o=>i(o)):Promise.resolve(e)}};kXe=I([m(0,yo),m(1,Vt),m(2,mn),m(3,ZP),m(4,EFt),m(5,Hd),m(6,ne)],kXe);we(_K,kXe,1);var TSi=ae("embedderTerminalService"),kSi=class{constructor(){this._onDidCreateTerminal=new E;this.onDidCreateTerminal=H.buffer(this._onDidCreateTerminal.event,"onDidCreateTerminal")}createTerminal(i){let e={name:i.name,isFeatureTerminal:!0,customPtyImplementation(t,o,n){return new ESi(t,i.pty)}};this._onDidCreateTerminal.fire(e)}},ESi=class extends C{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}`)}};we(TSi,kSi,1);function _Si(a){return`${a}.hidden`}var EXe=class extends C{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(RQe,{name:MQe,group:vR})),this.globalViewsStateStorageId=_Si(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:cn(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:cn(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?cn(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,cn(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)}};EXe=I([m(2,le),m(3,ol)],EXe);var UDe=class extends C{constructor(e,t,o,n){super();this.viewContainer=e;this.contextKeyService=o;this.contextKeys=new ebe;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(RQe,{name:MQe,group:vR})),this._register(H.filter(o.onDidChangeContext,r=>r.affectsSome(this.contextKeys))(()=>this.onDidChangeContext())),this.viewDescriptorsState=this._register(t.createInstance(EXe,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=>oe.as(on.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||Bke,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)&&Xe(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=si(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];lUi(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=Jn(r.visible)?Jn(l.visibleWorkspace)?!s.hideByDefault:l.visibleWorkspace:r.visible;else{let c=l.visibleGlobal;l.visibleGlobal=Jn(r.visible)?Jn(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=Jn(r.collapsed)?Jn(l.collapsed)?!!s.collapsed:l.collapsed:r.collapsed}else l={active:!1,visibleGlobal:Jn(r.visible)?!s.hideByDefault:r.visible,visibleWorkspace:Jn(r.visible)?!s.hideByDefault:r.visible,collapsed:Jn(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}};UDe=I([m(1,F),m(2,X),m(3,ol)],UDe);function Bro(a){return`${a}.state`}var _R=class extends C{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 jt);this.viewsVisibilityActionDisposables=this._register(new jt);this.canRegisterViewsVisibilityActions=!1;this._onDidChangeViewContainers=this._register(new E);this.onDidChangeViewContainers=this._onDidChangeViewContainers.event;this.logger=new co(()=>s.createLogger(RQe,{name:MQe,group:vR})),this.isSessionsWindow=l.isSessionsWindow,this.activeViewContextKeys=new Map,this.movableViewContextKeys=new Map,this.defaultViewLocationContextKeys=new Map,this.defaultViewContainerLocationContextKeys=new Map,this.viewContainersRegistry=oe.as(on.ViewContainersRegistry),this.viewsRegistry=oe.as(on.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,_R.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(_R.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(_R.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(_R.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(_R.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(_Si(t?.storageId||Bro(e)),0))}registerGeneratedViewContainer(e,t){let o=t||this.generateContainerId(e),n=this.viewContainersRegistry.registerViewContainer({id:o,ctorDescriptor:new Mt(Ha,[o,{mergeViewWithContainerWhenSingleView:!0}]),title:{value:d(17573,null),original:"User View Container"},icon:e===0?Bke:void 0,storageId:Bro(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`${_R.COMMON_CONTAINER_ID_PREFIX}.${WE(e)}.${_t()}`}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(_R.VIEWS_CUSTOMIZATIONS,0,"{}")}setStoredViewCustomizationsValue(e){this.isSessionsWindow||this.storageService.store(_R.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 P;t=o.add(this.instantiationService.createInstance(UDe,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(H.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 P;return e.activeViewDescriptors.forEach((o,n)=>{o.remoteAuthority||(t.add(W(class extends R9e{constructor(){super({id:`${o.id}.toggleVisibility`,viewPaneContainerId:e.viewContainer.id,precondition:o.canToggleVisibility&&(!e.isVisible(o.id)||e.visibleViewDescriptors.length>1)?x.true():x.false(),toggled:x.has(`${o.id}.visible`),title:o.name,metadata:{description:L(17572,"Toggles the visibility of the {0} view if the view container it is located in is visible",o.name.value)},menu:[{id:T5,when:x.equals("viewContainer",e.viewContainer.id),order:n},{id:D.ViewContainerTitleContext,when:x.equals("viewContainer",e.viewContainer.id),order:n,group:"1_toggleVisibility"},{id:D.ViewTitleContext,when:x.or(...e.visibleViewDescriptors.map(r=>x.equals("view",r.id))),order:n,group:"2_toggleVisibility"}]})}async runInViewPaneContainer(r,s){s.toggleViewVisibility(o.id)}})),t.add(W(class extends R9e{constructor(){super({id:`${o.id}.removeView`,viewPaneContainerId:e.viewContainer.id,title:d(17569,null,o.name.value),metadata:{description:L(17570,"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)?x.true():x.false(),menu:[{id:D.ViewTitleContext,when:x.and(x.equals("view",o.id),x.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(17571,"Reset Location"),menu:[{id:D.ViewContainerTitleContext,group:"1_viewActions",when:x.or(x.and(x.equals("viewContainer",e.id),x.equals(`${e.id}.defaultViewContainerLocation`,!1)))}]})}run(n){t.moveViewContainerToLocation(e,t.getDefaultViewContainerLocation(e),void 0,this.desc.id),n.get(Ft).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 Q(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 Q(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 Q(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 Q(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 Q(t,!1).bindTo(this.contextKeyService),this.defaultViewContainerLocationContextKeys.set(t,o)),o}};_R=I([m(0,F),m(1,X),m(2,le),m(3,lt),m(4,Te),m(5,ol),m(6,Vt)],_R);we(Ri,_R,1);var zJ=class extends Ha{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}};zJ=I([m(2,B),m(3,fi),m(4,Te),m(5,le),m(6,F),m(7,De),m(8,ze),m(9,lt),m(10,Pe),m(11,Ri),m(12,ne)],zJ);var TXe=class extends C{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 jt);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=Vl.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=O8e(e.id),o=this.visibleViewContextKeys.get(t);return o||(o=new Q(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 P,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 P;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(DSi(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(Vl.key)??"";return this.viewDescriptorService.getViewDescriptorById(e.toString())}getFocusedViewName(){let e=this.editorService.activeTextEditorControl?.hasTextFocus()?d(17574,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 P;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(17579,null,h),original:`Show ${g}`}:{value:d(17580,null,h),original:`Toggle ${g}`}},category:We.View,precondition:x.has(DSi(e.id)),keybinding:r?{...r,weight:200}:void 0,f1:!0})}async run(p){let h=p.get(Et),g=p.get(Ri),f=p.get(fi),v=p.get(Ft),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(fe.appendMenuItem(D.MenubarViewMenu,{command:{id:o,title:n},group:u===0?"3_sidebar":u===2?"4_auxbar":"5_panel",when:x.has(DSi(e.id)),order:s??Number.MAX_VALUE}))}}return t}registerOpenViewAction(e){let t=new P,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(17579,null,c),original:`Show ${u}`}:{value:d(17580,null,c),original:`Toggle ${u}`}},category:We.View,precondition:x.has(`${e.id}.active`),keybinding:e.openCommandActionDescriptor?.keybindings?{...e.openCommandActionDescriptor.keybindings,weight:200}:void 0,f1:e.openCommandActionDescriptor?!0:void 0,metadata:{description:d(17576,null,e.name.value),args:[{name:"options",schema:{type:"object",properties:{preserveFocus:{type:"boolean",default:!1,description:d(17577,null)}}}}]}})}async run(l,c){let u=l.get(Et),p=l.get(Ri),h=l.get(fi),g=l.get(Ft),f=l.get(X);if(Vl.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(fe.appendMenuItem(D.MenubarViewMenu,{command:{id:n,title:e.openCommandActionDescriptor.mnemonicTitle},group:l===0?"3_sidebar":l===2?"4_auxbar":"5_panel",when:x.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(17575,"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:x.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(Ft).openView(e.id,!r?.preserveFocus)}})}registerResetViewLocationAction(e){return W(class extends K{constructor(){super({id:`${e.id}.resetViewLocation`,title:L(17578,"Reset Location"),menu:[{id:D.ViewTitleContext,when:x.or(x.and(x.equals("view",e.id),x.equals(`${e.id}.defaultViewLocation`,!1))),group:"1_hide",order:2}]})}run(o){let n=o.get(Ri),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(Ft).openView(e.id,!0)}})}registerPaneComposite(e,t){let o=this,n=class extends l_e{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 P),c=o.createViewPaneContainer(s,e,t,l,this.instantiationService);return c instanceof zJ||l.add(H.any(c.onDidAddViews,c.onDidRemoveViews,c.onTitleAreaUpdate)(()=>{this.updateTitleArea()})),c}};n=I([m(0,Te),m(1,Pe),m(2,le),m(3,F),m(4,De),m(5,ze),m(6,lt)],n),oe.as(this.paneCompositeService.getRegistryId(t)).registerPaneComposite(gPt.create(n,e.id,typeof e.title=="string"?e.title:e.title.value,Ae(e.icon)?e.icon:void 0,e.order,e.requestedIndex,e.icon instanceof A?e.icon:void 0))}deregisterPaneComposite(e,t){oe.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}};TXe=I([m(0,Ri),m(1,ds),m(2,X),m(3,fi),m(4,ee)],TXe);function DSi(a){return`viewContainer.${a}.enabled`}we(Ft,TXe,0);var KDe=class extends C{constructor(e,t,o){super();this.quickInputService=e;this.instantiationService=t;this.contextKeyService=o;this.registry=oe.as(Tu.Quickaccess);this.mapProviderToDescriptor=new Map;this.lastAcceptedPickerValues=new Map;this.visibleQuickAccess=void 0;this._register(Z(()=>{for(let n of this.mapProviderToDescriptor.values())Ac(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 P,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 Go,p.add(H.once(h.onWillAccept)(v=>{v.veto(),h.hide()}))),p.add(this.registerPickerListeners(h,n,r,e,o));let f=p.add(new $e);if(n&&p.add(n.provide(h,f.token,o?.providerOptions)),H.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 P,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]}};KDe=I([m(0,Ge),m(1,F),m(2,X)],KDe);var Y5o=_,_Ft=class extends C{constructor(e,t,o){super();this.parent=e;this._listFocusMode=!1;this.onDidChange=e=>this.findInput.onDidChange(e);this.container=R(this.parent,Y5o(".quick-input-box")),this.findInput=this._register(new _1(this.container,void 0,{label:"",inputBoxStyles:t,toggleStyles:o,actionViewItemProvider:T1(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===gt.Ignore?this.findInput.clearMessage():this.findInput.showMessage({type:e===gt.Info?1:e===gt.Warning?2:3,content:""})}stylesForType(e){return this.findInput.inputBox.stylesForType(e===gt.Info?1:e===gt.Warning?2:3)}setFocus(){this.findInput.focus()}layout(){this.findInput.inputBox.layout()}};var DK=_,DFt=class{constructor(i,e,t){this.index=i;this.hasCheckbox=e;this._hidden=!1;this._init=new co(()=>{let o=t.label??"",n=IW(o).text.trim(),r=t.ariaLabel||[o,this.saneDescription,this.saneDetail].map(s=>m1(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}},pS=class extends DFt{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?H.map(H.filter(this._onChecked.event,c=>c.element===this),c=>c.checked):H.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 h4=class extends DFt{constructor(e,t,o){super(e,!1,o);this.fireSeparatorButtonTriggered=t;this.separator=o;this.children=new Array;this.focusInsideSeparator=0}},LSi=class{getHeight(i){return i instanceof h4?30:i.saneDetail?44:22}getTemplateId(i){return i instanceof pS?GJ.ID:$J.ID}},RSi=class{getWidgetAriaLabel(){return d(2248,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 pS)))return{get value(){return i.checked},onDidChange:e=>i.onChecked(()=>e())}}},LFt=class{constructor(i,e,t){this.hoverDelegate=i;this.toggleStyles=e;this.contextMenuService=t}renderTemplate(i){let e=Object.create(null);e.toDisposeElement=new P,e.toDisposeTemplate=new P,e.entry=R(i,DK(".quick-input-list-entry"));let t=R(e.entry,DK("label.quick-input-list-label"));e.outerLabel=t,e.checkbox=e.toDisposeTemplate.add(new me),e.toDisposeTemplate.add(Vo(t,re.CLICK,c=>{if(e.checkbox.value&&!c.defaultPrevented&&e.checkbox.value.enabled){let u=!e.checkbox.value.checked;e.checkbox.value.checked=u,e.element.checked=u}}));let o=R(t,DK(".quick-input-list-rows")),n=R(o,DK(".quick-input-list-row")),r=R(o,DK(".quick-input-list-row"));e.label=new Lc(n,{supportHighlights:!0,supportDescriptionHighlights:!0,supportIcons:!0,hoverDelegate:this.hoverDelegate}),e.toDisposeTemplate.add(e.label),e.icon=Sf(e.label.element,DK(".quick-input-list-icon"));let s=R(n,DK(".quick-input-list-entry-keybinding"));e.keybinding=new ah(s,zo),e.toDisposeTemplate.add(e.keybinding);let l=R(r,DK(".quick-input-list-label-meta"));return e.detail=new Lc(l,{supportHighlights:!0,supportIcons:!0,hoverDelegate:this.hoverDelegate}),e.toDisposeTemplate.add(e.detail),e.separator=R(e.entry,DK(".quick-input-list-separator")),e.toolBar=new Ju(e.entry,this.contextMenuService,{...this.hoverDelegate?{hoverDelegate:this.hoverDelegate}:void 0,actionViewItemProvider:T1(this.toggleStyles),icon:!0,label:!1}),e.toolBar.getElement().classList.add("quick-input-list-entry-action-bar"),e.toDisposeTemplate.add(e.toolBar),e}disposeTemplate(i){i.toDisposeElement.dispose(),i.toDisposeTemplate.dispose()}disposeElement(i,e,t){t.toDisposeElement.clear(),t.toolBar.setActions([])}},GJ=class extends LFt{constructor(e,t,o,n){super(e,t,o);this.themeService=n;this._itemsWithSeparatorsFrequency=new Map}static{this.ID="quickpickitem"}get templateId(){return GJ.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 hv(e.saneLabel,e.checked,{...kf,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=Ip(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=Na(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:ur(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:ur(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}=X5(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)}};GJ=I([m(2,ze),m(3,De)],GJ);var $J=class extends LFt{constructor(e,t,o){super(e,t,o);this._visibleSeparatorsFrequency=new Map}static{this.ID="quickpickseparator"}get templateId(){return $J.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:ur(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}=X5(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)}};$J=I([m(2,ze)],$J);var KJ=class extends C{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=Le("VisibleCount",0);this.onChangedVisibleCount=H.fromObservable(this._visibleCountObservable,this._store);this._allVisibleCheckedObservable=Le("AllVisibleChecked",!1);this.onChangedAllVisibleChecked=H.fromObservable(this._allVisibleCheckedObservable,this._store);this._checkedCountObservable=Le("CheckedCount",0);this.onChangedCheckedCount=H.fromObservable(this._checkedCountObservable,this._store);this._checkedElementsObservable=rg({equalsFn:$i},new Array);this.onChangedCheckedElements=H.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 eN;this._hasCheckboxes=!1;this._inputElements=new Array;this._elementTree=new Array;this._itemElements=new Array;this._elementDisposable=this._register(new P);this._matchOnDescription=!1;this._matchOnDetail=!1;this._matchOnLabel=!0;this._matchOnLabelMode="fuzzy";this._matchOnMeta=!0;this._sortByLabel=!0;this._shouldLoop=!0;this._container=R(this.parent,DK(".quick-input-list")),this._separatorRenderer=s.createInstance($J,t,this.styles.toggle),this._itemRenderer=s.createInstance(GJ,t,this.styles.toggle),this._tree=this._register(s.createInstance(mg,"QuickInput",this._container,new LSi,[this._itemRenderer,this._separatorRenderer],{filter:{filter(c){return c.hidden?0:c instanceof h4?2:1}},sorter:{compare:(c,u)=>{if(!this.sortByLabel||!this._lastQueryString)return 0;let p=this._lastQueryString.toLowerCase();return J5o(c,u,p)}},accessibilityProvider:new RSi,setRowLineHeight:!1,multipleSelectionSupport:!1,hideTwistiesOfChildlessElements:!0,renderIndentGuides:"none",findWidgetEnabled:!1,indent:0,horizontalScrolling:!1,allowNonCollapsibleParents:!0,alwaysConsumeMouseWheel:!0})),this._tree.getHTMLElement().id=n,this._registerListeners()}get onDidChangeFocus(){return H.map(this._tree.onDidChangeFocus,e=>e.elements.filter(t=>t instanceof pS).map(t=>t.item),this._store)}get onDidChangeSelection(){return H.map(this._tree.onDidChangeSelection,e=>({items:e.elements.filter(t=>t instanceof pS).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(n7t(t.browserEvent.target)){e.cancel();return}if(!(!n7t(t.browserEvent.relatedTarget)&&gs(t.browserEvent.relatedTarget,t.element?.element)))try{await e.trigger(async()=>{t.element instanceof pS&&this.showHover(t.element)})}catch(o){if(!so(o))throw o}})),this._register(this._tree.onMouseOut(t=>{gs(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 pS);t.length!==e.elements.length&&(e.elements.length===1&&e.elements[0]instanceof h4&&(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 h4(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 pS(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 pS);break;case 2:{this._tree.scrollTop=0;let t=!1;this._tree.focusFirst(void 0,o=>o.element instanceof pS?t?!0:(t=!t,!1):!1);break}case 3:this._tree.scrollTop=this._tree.scrollHeight,this._tree.focusLast(void 0,t=>t.element instanceof pS);break;case 4:{let t=this._tree.getFocus();this._tree.focusNext(void 0,this._shouldLoop,void 0,n=>n.element instanceof pS?(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 pS))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 pS?(this._tree.reveal(t.element),!0):!1);break;case 7:this._tree.focusPreviousPage(void 0,t=>{if(!(t.element instanceof pS))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 h4)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 pS){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 pS));break}case 9:{let t,o=!!this._tree.getFocus()[0]?.separator;this._tree.focusPrevious(void 0,!0,void 0,n=>{if(n.element instanceof h4)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 pS&&!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?gq(e,IW(n.saneLabel))??void 0:void 0:r=this.matchOnLabel?X5o(t,IW(n.saneLabel))??void 0:void 0;let s=this.matchOnDescription?gq(e,IW(n.saneDescription||""))??void 0:void 0,l=this.matchOnDetail?gq(e,IW(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 pS),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 pS))return;if(this._lastHover&&!this._lastHover.isDisposed){this._lastHover.dispose();return}this.showHover(e);let t=new P;t.add(this._tree.onDidChangeFocus(o=>{o.elements[0]instanceof pS&&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 h4?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(){Ui(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([mi],KJ.prototype,"onDidChangeFocus",1),I([mi],KJ.prototype,"onDidChangeSelection",1),KJ=I([m(5,F),m(6,Bi)],KJ);function X5o(a,i){let{text:e,iconOffsets:t}=i;if(!t||t.length===0)return Hro(a,e);let o=Hw(e," "),n=e.length-o.length,r=Hro(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 Hro(a,i){let e=i.toLowerCase().indexOf(a.toLowerCase());return e!==-1?[{start:e,end:e+a.length}]:null}function J5o(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:p_e(a.saneSortLabel,i.saneSortLabel,e)}function Z5o(a,i={}){yt.registerCommandAndKeybindingRule({weight:200,when:G_e,metadata:{description:d(2237,null)},...a,secondary:MSi(a.primary,a.secondary??[],i)})}function pk(a,i={}){yt.registerCommandAndKeybindingRule({weight:200,when:x.and(x.or(x.equals(kJ,"quickPick"),x.equals(kJ,"quickTree")),G_e),metadata:{description:d(2240,null)},...a,secondary:MSi(a.primary,a.secondary??[],i)})}var _Xe=it?256:2048;function MSi(a,i,e={}){return e.withAltMod&&i.push(512+a),e.withCtrlMod&&(i.push(_Xe+a),e.withAltMod&&i.push(512+_Xe+a)),e.withCmdMod&&it&&(i.push(2048+a),e.withCtrlMod&&i.push(2304+a),e.withAltMod&&(i.push(2560+a),e.withCtrlMod&&i.push(2816+a))),i}function DR(a,i){return e=>{let t=e.get(Ge).currentQuickInput;if(t)return i&&t.quickNavigate?t.focus(i):t.focus(a)}}pk({id:"quickInput.pageNext",primary:12,handler:DR(6)},{withAltMod:!0,withCtrlMod:!0,withCmdMod:!0});pk({id:"quickInput.pagePrevious",primary:11,handler:DR(7)},{withAltMod:!0,withCtrlMod:!0,withCmdMod:!0});pk({id:"quickInput.first",primary:_Xe+14,handler:DR(1)},{withAltMod:!0,withCmdMod:!0});pk({id:"quickInput.last",primary:_Xe+13,handler:DR(3)},{withAltMod:!0,withCmdMod:!0});pk({id:"quickInput.next",primary:18,handler:DR(4)},{withCtrlMod:!0});pk({id:"quickInput.previous",primary:16,handler:DR(5)},{withCtrlMod:!0});var Uro=d(2238,null),zro=d(2239,null);it?(pk({id:"quickInput.nextSeparatorWithQuickAccessFallback",primary:2066,handler:DR(8,4),metadata:{description:Uro}}),pk({id:"quickInput.nextSeparator",primary:2578,secondary:[2322],handler:DR(8)},{withCtrlMod:!0}),pk({id:"quickInput.previousSeparatorWithQuickAccessFallback",primary:2064,handler:DR(9,5),metadata:{description:zro}}),pk({id:"quickInput.previousSeparator",primary:2576,secondary:[2320],handler:DR(9)},{withCtrlMod:!0})):(pk({id:"quickInput.nextSeparatorWithQuickAccessFallback",primary:530,handler:DR(8,4),metadata:{description:Uro}}),pk({id:"quickInput.nextSeparator",primary:2578,handler:DR(8)}),pk({id:"quickInput.previousSeparatorWithQuickAccessFallback",primary:528,handler:DR(9,5),metadata:{description:zro}}),pk({id:"quickInput.previousSeparator",primary:2576,handler:DR(9)}));yt.registerCommandAndKeybindingRule({id:"quickInput.accept",primary:3,weight:200,when:x.and(x.notEquals(kJ,"quickWidget"),G_e,x.not("isComposing")),metadata:{description:d(2236,null)},handler:a=>{a.get(Ge).currentQuickInput?.accept()},secondary:MSi(3,[],{withAltMod:!0,withCtrlMod:!0,withCmdMod:!0})});pk({id:"quickInput.acceptInBackground",when:x.and(G_e,x.equals(kJ,"quickPick"),x.or($h.negate(),ono)),primary:17,weight:250,handler:a=>{a.get(Ge).currentQuickInput?.accept(!0)}},{withAltMod:!0,withCtrlMod:!0,withCmdMod:!0});Z5o({id:"quickInput.hide",primary:9,handler:a=>{a.get(Ge).currentQuickInput?.hide()}},{withAltMod:!0,withCtrlMod:!0,withCmdMod:!0});pk({id:"quickInput.toggleCheckbox",when:x.and(G_e,x.or(x.equals(kJ,"quickPick"),x.equals(kJ,"quickTree")),$h.negate()),primary:10,handler:a=>{a.get(Ge).toggle()}});pk({id:"quickInput.toggleHover",primary:_Xe|10,handler:a=>{a.get(Ge).toggleHover()}});var DXe=_,RFt=class extends C{constructor(){super(...arguments);this._onDidChangeCheckboxState=this._register(new E);this.onDidChangeCheckboxState=this._onDidChangeCheckboxState.event}setCheckboxState(e,t){this._onDidChangeCheckboxState.fire({item:e,checked:t})}},LK=class extends C{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=LK.ID}static{this.ID="quickInputTreeElement"}renderTemplate(e){let t=new P,o=R(e,DXe(".quick-input-tree-entry")),n=t.add(new v7("",!1,{...kf,size:15}));o.appendChild(n.domNode);let r=R(o,DXe("label.quick-input-tree-label")),s=R(r,DXe(".quick-input-tree-rows")),l=R(s,DXe(".quick-input-tree-row")),c=Sf(l,DXe(".quick-input-tree-icon")),u=t.add(new Lc(l,{supportHighlights:!0,supportDescriptionHighlights:!0,supportIcons:!0,hoverDelegate:this._hoverDelegate})),p=t.add(new Ju(o,this._contextMenuService,{actionViewItemProvider:T1(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 P}}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(H.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=Ip(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=Na(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:ur(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}=X5(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){o.toDisposeElement.clear(),o.actionBar.setActions([])}disposeTemplate(e){e.toDisposeElement.dispose(),e.toDisposeTemplate.dispose()}};LK=I([m(5,ze),m(6,De)],LK);var MFt=class{getHeight(i){return 22}getTemplateId(i){return LK.ID}};function $De(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 PFt=class{constructor(i){this.onCheckedEvent=i}getWidgetAriaLabel(){return d(2253,null)}getAriaLabel(i){return i.ariaLabel||[i.label,i.description].map(e=>m1(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=>H.filter(this.onCheckedEvent,t=>t.item===i)(t=>e())}}};var AFt=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?gq(this.filterValue,IW(i.label))??void 0:void 0,o=this.matchOnDescription?gq(this.filterValue,IW(i.description||""))??void 0:void 0;return{visibility:e===1?1:t||o?1:i.children?2:0,data:{labelHighlights:t,descriptionHighlights:o}}}};var NFt=class extends C{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 e4o=_,t4o="quick-input-tree-flat",PSi=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}},qDe=class extends C{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=R(e,e4o(".quick-input-tree")),this._checkboxStateHandler=this._register(new RFt),this._renderer=this._register(this.instantiationService.createInstance(LK,t,this._onDidTriggerButton,this.onDidChangeCheckboxState,this._checkboxStateHandler,o.toggle)),this._filter=this.instantiationService.createInstance(AFt),this._sorter=this._register(new NFt),this._tree=this._register(this.instantiationService.createInstance(mg,"QuickInputTree",this._container,new MFt,[this._renderer],{accessibilityProvider:new PFt(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 PSi})),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=$De(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(t4o,!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(hv.CLASS_NAME)||this.updateCheckboxState(t,t.checked===!0)})),this._register(this._checkboxStateHandler.onDidChangeCheckboxState(e=>{this.updateCheckboxState(e.item,e.checked===!0)}))}updateCheckboxState(e,t){if((e.checked??!1)===t)return;e.checked=t,this._tree.rerender(e);let o=new Set,n=[...this._tree.getNode(e).children];for(;n.length;){let s=n.shift();s?.element&&!o.has(s.element)&&(o.add(s.element),(s.element.checked??!1)!==e.checked&&(s.element.checked=e.checked,this._tree.rerender(s.element)),n.push(...s.children))}let r=this._tree.getParentElement(e);for(;r;){let s=[...this._tree.getNode(r).children],l=$De(s);(r.checked??!1)!==l&&(r.checked=l,this._tree.rerender(r)),r=this._tree.getParentElement(r)}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())}};qDe=I([m(3,F)],qDe);var LXe=class a extends CJ{constructor(e){super(e);this.type="quickTree";this._value=Le("value","");this._ariaLabel=Le("ariaLabel",void 0);this._placeholder=Le("placeholder",void 0);this._matchOnDescription=Le("matchOnDescription",!1);this._matchOnLabel=Le("matchOnLabel",!0);this._sortByLabel=Le("sortByLabel",!0);this._activeItems=Le("activeItems",[]);this._itemTree=Le("itemTree",[]);this.onDidChangeValue=H.fromObservable(this._value,this._store);this.onDidChangeActive=H.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=H.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(2254,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=$De([...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(),Vw(()=>this.ui.count.setCount(this.ui.tree.getCheckedLeafItems().length));let e=$De([...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(he(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 LR=_,ASi="workbench.quickInput.viewState",qJ=class extends C{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};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=eOt;this.inQuickInputContext=Zoo.bindTo(n),this.quickInputTypeContext=eno.bindTo(n),this.endOfQuickInputBoxContext=ino.bindTo(n),this.idPrefix=e.idPrefix,this._container=e.container,this.styles=e.styles,this._register(H.runAndSubscribe(Fg,({window:l,disposables:c})=>this.registerKeyModsListeners(l,c),{window:It,disposables:this._store})),this._register(Szi(l=>{this.ui&&Me(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};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&&Me(this._container)!==Me(this.layoutService.activeContainer)&&(this.reparentUI(this.layoutService.activeContainer),this.layout(this.layoutService.activeContainerDimension,this.layoutService.activeContainerOffset.quickPickTop)),this.ui;let t=R(this._container,LR(".quick-input-widget.show-file-icons"));t.tabIndex=-1,t.style.display="none";let o=hr(t),n=R(t,LR(".quick-input-titlebar")),r=this._register(new Ju(n,this.contextMenuService,{hoverDelegate:this.options.hoverDelegate,actionViewItemProvider:T1(this.styles.toggle),icon:!0,label:!1}));r.getElement().classList.add("quick-input-left-action-bar");let s=R(n,LR(".quick-input-title")),l=this._register(new Ju(n,this.contextMenuService,{hoverDelegate:this.options.hoverDelegate,actionViewItemProvider:T1(this.styles.toggle),icon:!0,label:!1}));l.getElement().classList.add("quick-input-right-action-bar");let c=R(t,LR(".quick-input-header")),u=this._register(new v7(d(2245,null),!1,{...kf,size:15}));R(c,u.domNode),this._register(u.onChange(()=>{let Se=u.checked;pe.setAllVisibleChecked(Se===!0)})),this._register(j(u.domNode,re.CLICK,Se=>{(Se.x||Se.y)&&f.setFocus()}));let p=R(c,LR(".quick-input-description")),h=R(c,LR(".quick-input-and-message")),g=R(h,LR(".quick-input-filter")),f=this._register(new _Ft(g,this.styles.inputBox,this.styles.toggle));f.setAttribute("aria-describedby",`${this.idPrefix}message`);let v=R(g,LR(".quick-input-visible-count"));v.setAttribute("aria-live","polite"),v.setAttribute("aria-atomic","true");let b=this._register(new fv(v,{countFormat:d(2247,null)},this.styles.countBadge)),S=R(g,LR(".quick-input-count"));S.setAttribute("aria-live","polite");let y=this._register(new fv(S,{countFormat:d(2246,null)},this.styles.countBadge)),w=this._register(new Ju(c,this.contextMenuService,{hoverDelegate:this.options.hoverDelegate,actionViewItemProvider:T1(this.styles.toggle),icon:!0,label:!1}));w.getElement().classList.add("quick-input-inline-action-bar");let k=R(c,LR(".quick-input-action")),T=this._register(new Mi(k,this.styles.button));T.label=d(2242,null),this._register(T.onDidClick(Se=>{this.onDidAcceptEmitter.fire()}));let N=R(c,LR(".quick-input-action")),O=this._register(new Mi(N,{...this.styles.button,supportIcons:!0}));O.label=d(2241,null),this._register(O.onDidClick(Se=>{this.onDidCustomEmitter.fire()}));let V=R(h,LR(`#${this.idPrefix}message.quick-input-message`)),U=this._register(new fb(t,this.styles.progressBar));U.getContainer().classList.add("quick-input-progress");let G=R(t,LR(".quick-input-html-widget"));G.tabIndex=-1;let $=R(t,LR(".quick-input-description")),te=this.idPrefix+"list",pe=this._register(this.instantiationService.createInstance(KJ,t,this.options.hoverDelegate,this.options.linkOpenerDelegate,te,this.styles));f.setAttribute("aria-controls",te),this._register(pe.onDidChangeFocus(()=>{if(f.hasFocus()){let Se=pe.getActiveDescendant();Se?(f.setAttribute("aria-activedescendant",Se),f.setListFocusMode(!0)):(f.removeAttribute("aria-activedescendant"),f.setListFocusMode(!1))}})),this._register(pe.onChangedAllVisibleChecked(Se=>{u.checked=Se})),this._register(pe.onChangedVisibleCount(Se=>{b.setCount(Se)})),this._register(pe.onChangedCheckedCount(Se=>{Vw(()=>y.setCount(Se))})),this._register(pe.onLeave(()=>{setTimeout(()=>{this.controller&&(f.setFocus(),this.controller instanceof xJ&&this.controller.canSelectMany&&pe.clearFocus())},0)}));let de=this._register(this.instantiationService.createInstance(qDe,t,this.options.hoverDelegate,this.styles));this._register(de.tree.onDidChangeFocus(()=>{if(f.hasFocus()){let Se=de.getActiveDescendant();Se?(f.setAttribute("aria-activedescendant",Se),f.setListFocusMode(!0)):(f.removeAttribute("aria-activedescendant"),f.setListFocusMode(!1))}})),this._register(de.onLeave(()=>{setTimeout(()=>{this.controller&&(f.setFocus(),de.tree.setFocus([]))},0)})),this._register(de.onDidAccept(()=>{this.onDidAcceptEmitter.fire()})),this._register(de.tree.onDidChangeContentHeight(()=>this.updateLayout()));let se=Vn(t);return this._register(se),this._register(j(t,re.FOCUS,Se=>{let ke=this.getUI();if(gs(Se.relatedTarget,ke.inputContainer)){let Ee=ke.inputBox.isSelectionAtEnd();this.endOfQuickInputBoxContext.get()!==Ee&&this.endOfQuickInputBoxContext.set(Ee)}gs(Se.relatedTarget,ke.container)||(this.inQuickInputContext.set(!0),this.previousFocusElement=Ao(Se.relatedTarget)?Se.relatedTarget:void 0)},!0)),this._register(se.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(Se=>{let ke=this.getUI().inputBox.isSelectionAtEnd();this.endOfQuickInputBoxContext.get()!==ke&&this.endOfQuickInputBoxContext.set(ke),tN(Se.keyCode)||(f.removeAttribute("aria-activedescendant"),f.setListFocusMode(!1))})),this._register(j(t,re.FOCUS,Se=>{f.setFocus()})),this.dndController=this._register(this.instantiationService.createInstance(RXe,this._container,t,[{node:n,includeChildren:!0,excludeNodes:[r.getElement(),l.getElement()]},{node:c,includeChildren:!1}],this.viewState)),this._register(he(Se=>{let ke=this.dndController?.dndViewState.read(Se);ke&&(ke.top!==void 0&&ke.left!==void 0?this.viewState={...this.viewState,top:ke.top,left:ke.left}:this.viewState=void 0,this.updateLayout(),ke.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:N,customButton:O,list:pe,tree:de,progressBar:U,onDidAccept:this.onDidAcceptEmitter.event,onDidCustom:this.onDidCustomEmitter.event,onDidTriggerButton:this.onDidTriggerButtonEmitter.event,ignoreFocusOut:!1,keyMods:this.keyMods,show:Se=>this.show(Se),hide:()=>this.hide(),setVisibilities:Se=>this.setVisibilities(Se),setEnabled:Se=>this.setEnabled(Se),setContextKey:Se=>this.options.setContextKey(Se),linkOpenerDelegate:Se=>this.options.linkOpenerDelegate(Se)},this.updateStyles(),this.ui}reparentUI(e){this.ui&&(this._container=e,R(this._container,this.ui.container),this.dndController?.reparentUI(this._container))}pick(e,t={},o=ve.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(()=>{Ue(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&&Ae(t)?(e.severity=gt.Error,e.validationMessage=t):t&&!Ae(t)?(e.severity=t.severity,e.validationMessage=t.content):(e.severity=gt.Ignore,e.validationMessage=void 0)}input(e={},t=ve.None){return new Promise(o=>{if(t.isCancellationRequested){o(void 0);return}let n=this.createInputBox(),r=e.validateInput||(()=>Promise.resolve(void 0)),s=H.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||!Ae(h)&&h.severity!==gt.Error?(o(p),n.hide()):p===l&&this.setValidationOnInput(n,h)})}),t.onCancellationRequested(()=>{n.hide()}),n.onDidHide(()=>{Ue(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 xJ(t)}createInputBox(){let e=this.getUI(!0);return new XNt(e)}setAlignment(e){this.dndController?.setAlignment(e)}createQuickWidget(){let e=this.getUI(!0);return new JNt(e)}createQuickTree(){let e=this.getUI(!0);return new LXe(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="",Fi(t.widget),t.rightActionBar.setActions([]),t.inlineActionBar.setActions([]),t.checkAll.checked=!1,t.inputBox.placeholder="",t.inputBox.password=!1,t.inputBox.showDecoration(gt.Ignore),t.visibleCount.setCount(0),t.count.setCount(0),t.countContainer.style.right="4px",Fi(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();eOt.tooltip=n?d(2244,null,n):d(2243,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&&!ts(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 xJ&&this.controller.canSelectMany?this.getUI().list.toggleCheckbox():this.controller instanceof LXe&&this.getUI().tree.toggleCheckbox())}toggleHover(){this.isVisible()&&this.controller instanceof xJ&&this.getUI().list.toggleHover()}navigate(e,t){this.isVisible()&&this.getUI().list.displayed&&(this.getUI().list.focus(e?4:5),t&&this.controller instanceof xJ&&(this.controller.quickNavigate=t))}async accept(e={alt:!1,ctrlCmd:!1}){this.keyMods.alt=e.alt,this.keyMods.ctrlCmd=e.ctrlCmd,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,qJ.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=yje(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}=uSt(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(ASi,-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(ASi,JSON.stringify(e),-1,1):this.storageService.remove(ASi,-1))}};qJ=I([m(1,nc),m(2,F),m(3,X),m(4,le),m(5,ze)],qJ);var RXe=class extends C{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=Le(this,void 0);this._enabled=!0;this._snapThreshold=20;this._snapLineHorizontalRatio=.25;this._quickInputAlignmentContext=tYe.bindTo(s);let c=Uje(this.configurationService)==="custom";this._controlsOnLeft=c&&Pp===1,this._controlsOnRight=c&&(Pp===3||Pp===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(H.filter(this._layoutService.onDidLayoutContainer,e=>e.container===this._container)(e=>this.layoutContainer(e.dimension)))}registerMouseListeners(){let e=this._quickInputContainer;this._register(Fre(e,t=>{if(!this._enabled)return;let o=new yn(Me(e),t);if(o.detail!==2)return;let n=this._quickInputDragAreas.find(({node:r,includeChildren:s})=>s?gs(o.target,r):o.target===r);!n||n.excludeNodes?.some(r=>gs(o.target,r))||this.dndViewState.set({top:void 0,left:void 0,done:!0},void 0)})),this._register(C$(e,t=>{if(!this._enabled)return;let o=Me(this._layoutService.activeContainer),n=new yn(o,t),r=this._quickInputDragAreas.find(({node:g,includeChildren:f})=>f?gs(n.target,g):n.target===g);if(!r||r.excludeNodes?.some(g=>gs(n.target,g)))return;let s=this._quickInputContainer.getBoundingClientRect(),l=n.browserEvent.clientX-s.left,c=n.browserEvent.clientY-s.top,u=!1,p=$be(o,g=>{new yn(o,g).preventDefault(),u||(u=!0),this._layout(g.clientY-c,g.clientX-l)}),h=Fre(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/yS(Ki())):this._controlsOnRight&&(t=Math.min(t,this._container.clientWidth-this._quickInputContainer.clientWidth-140/yS(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)}};RXe=I([m(4,nc),m(5,X),m(6,B)],RXe);var jDe=class extends Jd{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(KDe))),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(Qe).open(r,{allowCommands:!0,fromUserGesture:!0})})},returnFocus:()=>e.focus(),styles:this.computeStyles(),hoverDelegate:this._register(this.instantiationService.createInstance(K_e))},n=this._register(this.instantiationService.createInstance(qJ,{...o,...t}));return n.layout(e.activeContainerDimension,e.activeContainerOffset.quickPickTop),this._register(e.onDidLayoutActiveContainer(r=>{Me(e.activeContainer)===Me(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 Q(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=ve.None){return this.controller.pick(e,t,o)}input(e={},t=ve.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:wt(sIe),quickInputForeground:wt(Sgt),quickInputTitleBackground:wt(p$i),widgetBorder:wt(jT),widgetShadow:wt(RN)},inputBox:pl,toggle:qg,countBadge:BS,button:Ko,progressBar:kx,keybindingLabel:l_,list:GI({listBackground:sIe,listFocusBackground:VU,listFocusForeground:WU,listInactiveFocusForeground:WU,listInactiveSelectionIconForeground:aIe,listInactiveFocusBackground:VU,listInactiveSelectionBackground:VU,listInactiveSelectionForeground:WU,listFocusOutline:qs,listInactiveFocusOutline:qs,treeStickyScrollBackground:sIe}),pickerGroup:{pickerGroupBorder:wt(m$i),pickerGroupForeground:wt(Igt)}}}};jDe=I([m(0,F),m(1,X),m(2,De),m(3,nc),m(4,B)],jDe);var MXe=class extends jDe{constructor(e,t,o,n,r,s){super(t,n,r,s,e);this.keybindingService=o;this.inQuickInputContext=bio.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})}};MXe=I([m(0,B),m(1,F),m(2,_e),m(3,X),m(4,De),m(5,nc)],MXe);we(Ge,MXe,1);var lI=ae("IUserDataSyncWorkbenchService");function Rv(a){switch(a){case"settings":return d(17562,null);case"keybindings":return d(17558,null);case"snippets":return d(17563,null);case"prompts":return d(17561,null);case"tasks":return d(17566,null);case"mcp":return d(17559,null);case"extensions":return d(17557,null);case"globalState":return d(17567,null);case"profiles":return d(17560,null);case"workspaceState":return d(17568,null)}}var Ch=L(17564,"Settings Sync"),Kro=Re("settings-sync-view-icon",M.sync,d(17565,null)),py=new Q("syncStatus","uninitialized"),rD=new Q("syncEnabled",!1),nB=new Q("userDataSyncAccountStatus","uninitialized"),tpe=new Q("enableSyncActivityViews",!1),OFt=new Q("enableSyncConflictsView",!1),jJ=new Q("hasConflicts",!1),PXe="workbench.userDataSync.actions.configure",DF="workbench.userDataSync.actions.showLog",rB="workbench.view.sync",QJ="workbench.views.sync.conflicts",FFt={id:"workbench.userDataSync.actions.downloadSyncActivity",title:L(17556,"Download Settings Sync Activity"),category:We.Developer,f1:!0,precondition:x.and(nB.isEqualTo("available"),py.notEqualsTo("uninitialized"))};var Gro="configurationSync.store",NSi="sync.previous.store",OSi="sync.donot-make-requests-until",WFt="sync.user-session-id",FSi="sync.machine-session-id",o4o=100,n4o=1e3*60*5,ipe=class extends C{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 P);this._register(H.filter(o.onDidChangeValue(-1,iB,n),()=>this.userDataSyncStoreType!==this.userDataSyncStore?.type,n)(()=>this.updateUserDataSyncStore()))}get userDataSyncStore(){return this._userDataSyncStore}get userDataSyncStoreType(){return this.storageService.get(iB,-1)}set userDataSyncStoreType(e){this.storageService.store(iB,e,-1,Gt?0:1)}updateUserDataSyncStore(){this._userDataSyncStore=this.toUserDataSyncStore(this.productService[Gro]),this._onDidChangeUserDataSyncStore.fire()}toUserDataSyncStore(e){if(e&&(e=Gt&&e.web?{...e,...e.web}:e,Ae(e.url)&&yi(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),[])}}}};ipe=I([m(0,nt),m(1,B),m(2,le)],ipe);var VFt=class extends ipe{constructor(i,e,t){super(i,e,t);let o=this.storageService.get(NSi,-1);o&&(this.previousConfigurationSyncStore=JSON.parse(o));let n=this.productService[Gro];n?this.storageService.store(NSi,JSON.stringify(n),-1,1):this.storageService.remove(NSi,-1)}async switch(i){i!==this.userDataSyncStoreType&&(this.userDataSyncStoreType=i,this.updateUserDataSyncStore())}async getPreviousUserDataSyncStore(){return this.toUserDataSyncStore(this.previousConfigurationSyncStore)}};VFt=I([m(0,nt),m(1,B),m(2,le)],VFt);var sB=class extends C{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=TO(r,s,l).then(c=>{let u={"X-Client-Name":`${t.applicationName}${Gt?"-web":""}`,"X-Client-Version":t.version};return t.commit&&(u["X-Client-Commit"]=t.commit),u}),this.session=new WSi(o4o,n4o,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?je(e,"v1"):void 0}initDonotMakeRequestsUntil(){let e=this.storageService.getNumber(OSi,-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(OSi,this._donotMakeRequestsUntil.getTime(),-1,1),this.resetDonotMakeRequestsUntilPromise=xn(t=>Pi(this._donotMakeRequestsUntil.getTime()-Date.now(),t).then(()=>this.setDonotMakeRequestsUntil(void 0))),this.resetDonotMakeRequestsUntilPromise.then(null,t=>null)):this.storageService.remove(OSi,-1),this._onDidChangeDonotMakeRequestsUntil.fire())}async getAllCollections(e={}){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let t=je(this.userDataSyncStoreUrl,"collection").toString();e={...e},e["Content-Type"]="application/json";let o=await this.request(t,{type:"GET",headers:e},[],ve.None);return(await hh(o))?.map(({id:n})=>n)||[]}async createCollection(e={}){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let t=je(this.userDataSyncStoreUrl,"collection").toString();e={...e},e["Content-Type"]=Zn.text;let o=await this.request(t,{type:"POST",headers:e},[],ve.None),n=await Kx(o);if(!n)throw new Em("Server did not return the collection id",t,"NoCollection",o.res.statusCode,o.res.headers[tB]);return n}async deleteCollection(e,t={}){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let o=e?je(this.userDataSyncStoreUrl,"collection",e).toString():je(this.userDataSyncStoreUrl,"collection").toString();t={...t},await this.request(o,{type:"DELETE",headers:t},[],ve.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},[],ve.None);return(await hh(r)||[]).map(({url:l,created:c})=>({ref:Fc(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=je(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},[],ve.None);return await Kx(s)}async deleteResource(e,t,o){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let n=t!==null?je(this.getResourceUrl(this.userDataSyncStoreUrl,o,e),t).toString():this.getResourceUrl(this.userDataSyncStoreUrl,o,e).toString(),r={};await this.request(n,{type:"DELETE",headers:r},[],ve.None)}async deleteResources(){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let e=je(this.userDataSyncStoreUrl,"resource").toString(),t={"Content-Type":Zn.text};await this.request(e,{type:"DELETE",headers:t},[],ve.None)}async readResource(e,t,o,n={}){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let r=je(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},[304],ve.None),l=null;if(s.res.statusCode===304&&(l=t),l===null){let c=s.res.headers.etag;if(!c)throw new Em("Server did not return the ref",r,"NoRef",s.res.statusCode,s.res.headers[tB]);let u=await Kx(s);if(!u&&s.res.statusCode===304)throw new Em("Empty response",r,"EmptyResponse",s.res.statusCode,s.res.headers[tB]);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"]=Zn.text,o&&(r["If-Match"]=o);let l=await this.request(s,{type:"POST",data:t,headers:r},[],ve.None),c=l.res.headers.etag;if(!c)throw new Em("Server did not return the ref",s,"NoRef",l.res.statusCode,l.res.headers[tB]);return c}async manifest(e,t={}){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let o=je(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},[304],ve.None),r=null;if(n.res.statusCode===304&&(r=e),!r){let l=n.res.headers.etag;if(!l)throw new Em("Server did not return the ref",o,"NoRef",n.res.statusCode,n.res.headers[tB]);let c=await Kx(n);if(!c&&n.res.statusCode===304)throw new Em("Empty response",o,"EmptyResponse",n.res.statusCode,n.res.headers[tB]);c&&(r={...JSON.parse(c),ref:l})}let s=this.storageService.get(WFt,-1);return s&&r&&s!==r.session&&this.clearSession(),r===null&&s&&this.clearSession(),r&&this.storageService.store(WFt,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=je(this.userDataSyncStoreUrl,"download","latest").toString();e={...e},e["Content-Type"]="application/json";let o=await this.request(t,{type:"GET",headers:e},[],ve.None);if(!aP(o))throw new Em("Server returned "+o.res.statusCode,t,"EmptyResponse",o.res.statusCode,o.res.headers[tB]);let n=await hh(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=je(this.userDataSyncStoreUrl,"download").toString(),t={},o=await this.request(e,{type:"GET",headers:t},[],ve.None);if(!aP(o))throw new Em("Server returned "+o.res.statusCode,e,"EmptyResponse",o.res.statusCode,o.res.headers[tB]);if(zEt(o))throw new Em("Empty response",e,"EmptyResponse",o.res.statusCode,o.res.headers[tB]);return o.stream}getResourceUrl(e,t,o){return t?je(e,"collection",t,"resource",o):je(e,"resource",o)}clearSession(){this.storageService.remove(WFt,-1),this.storageService.remove(FSi,-1)}async request(e,t,o,n){if(!this.authToken)throw new Em("No Auth Token Available",e,"Unauthorized",void 0,void 0);if(this._donotMakeRequestsUntil&&Date.now()<this._donotMakeRequestsUntil.getTime())throw new Em(`${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 Em)){let g="RequestFailed",f=Cn(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":so(h)&&(g="RequestCanceled"),h=new Em(`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[tB],c={url:e,status:s.res.statusCode,"execution-id":t.headers[hSi],"operation-id":l},u=aP(s)||s.res.statusCode&&o.includes(s.res.statusCode),p="";if(u?this.logService.trace("Request succeeded",c):(p=await E_(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 Em(`${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 Em(`${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 Em(`${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 Em(`${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 Em(`${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 Em(`${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 Em(`${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 Em(`${t.type} request '${e}' failed because of too large payload (413).`,e,"TooLarge",s.res.statusCode,l);if(s.res.statusCode===426)throw new Em(`${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 Em(`${t.type} request '${e}' failed because of too many requests (429).`,e,"TooManyRequestsAndRetryAfter",s.res.statusCode,l)):new Em(`${t.type} request '${e}' failed because of too many requests (429).`,e,"RemoteTooManyRequests",s.res.statusCode,l)}if(!u)throw new Em("Server returned "+s.res.statusCode,e,"Unknown",s.res.statusCode,l);return s}addSessionHeaders(e){let t=this.storageService.get(FSi,-1);t===void 0&&(t=_t(),this.storageService.store(FSi,t,-1,1)),e["X-Machine-Session-Id"]=t;let o=this.storageService.get(WFt,-1);o!==void 0&&(e["X-User-Session-Id"]=o)}};sB=I([m(1,nt),m(2,_a),m(3,uy),m(4,Co),m(5,be),m(6,le)],sB);var BFt=class extends sB{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)))}};BFt=I([m(0,TR),m(1,nt),m(2,_a),m(3,uy),m(4,Co),m(5,be),m(6,le)],BFt);var WSi=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 Em(`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 s4o(a){return!!(a&&a.ref!==void 0&&typeof a.ref=="string"&&a.ref!==""&&a.syncData!==void 0&&(a.syncData===null||NXe(a.syncData)))}function NXe(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 QDe(a,i){return`${Cre(a)}${i.isDefault?"":` (${i.name})`}`}var aB=class extends C{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=QDe(e.syncResource,e.profile),this.extUri=g.extUri,this.syncFolder=this.extUri.joinPath(n.userDataSyncHome,...mSi(e.profile.isDefault?void 0:e.profile.id,e.syncResource)),this.syncPreviewFolder=this.extUri.joinPath(this.syncFolder,Oro),this.lastSyncResource=aXe(e.profile.isDefault?void 0:e.profile.id,e.syncResource,n,this.extUri),this.currentMachineIdPromise=TO(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(),ve.None),l=[];for(let c of s){let u=await this.getAcceptResult(c,c.remoteResource,void 0,ve.None),{remoteChange:p}=await this.getAcceptResult(c,c.previewResource,c.remoteContent,ve.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:Aro,syncData:null}:Ae(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 Cg(d(2686,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 Cg)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=xn(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,ve.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,ve.None);return await this.fileService.writeFile(t.previewResource,Je.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=xn(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){hu(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:HC,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,Je.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 As&&s.fileOperationResult===1){this.logService.info(`${this.syncResourceLogLabel}: Last sync resource does not exist locally.`);break}else{if(s instanceof Cg)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 Cg&&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(s4o(t))return t}catch(t){this.logService.error(t)}}async writeLastSyncStoredRemoteUserData(e){await this.fileService.writeFile(this.lastSyncResource,Je.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(NXe(t))return t}catch(t){this.logService.error(t)}throw new Cg(d(2687,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 Cg&&r.code==="TooLarge"&&(r=new Cg(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(Mro)}};aB=I([m(2,be),m(3,Co),m(4,le),m(5,CF),m(6,VJ),m(7,_l),m(8,Te),m(9,uy),m(10,B),m(11,dt)],aB);var AXe=class extends aB{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,Je.fromString(e),o?void 0:t):await this.fileService.createFile(this.file,Je.fromString(e),{overwrite:o})}catch(n){throw n instanceof As&&n.fileOperationResult===1||n instanceof As&&n.fileOperationResult===3?new Cg(n.message,"LocalPreconditionFailed"):n}}async deleteLocalFile(){try{await this.fileService.del(this.file)}catch(e){if(!(e instanceof As&&e.fileOperationResult===1))throw e}}onFileChanges(e){e.contains(this.file)&&this.triggerLocalChange()}};AXe=I([m(3,be),m(4,Co),m(5,le),m(6,CF),m(7,VJ),m(8,_l),m(9,Te),m(10,uy),m(11,B),m(12,dt)],AXe);var HFt=class extends AXe{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=Ur(e,o,{allowEmptyContent:!0,allowTrailingComma:!0});return o.length>0||!cn(n)&&t!==Array.isArray(n)}getFormattingOptions(){return this._formattingOptions||(this._formattingOptions=this.userDataSyncUtilService.resolveFormattingOptions(this.file)),this._formattingOptions}};HFt=I([m(3,be),m(4,Co),m(5,le),m(6,CF),m(7,VJ),m(8,_l),m(9,Te),m(10,uy),m(11,BJ),m(12,B),m(13,dt)],HFt);var YJ=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=aXe(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(NXe(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,Je.fromString(JSON.stringify(i)))}};YJ=I([m(1,an),m(2,Co),m(3,ne),m(4,be),m(5,le),m(6,dt)],YJ);function OXe(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=UFt(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?UFt(e,i):{added:Object.keys(i).reduce((h,g)=>(h.add(g),h),new Set),removed:new Set,updated:new Set},s=e?UFt(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=Xi(i),u=!e;for(let h of s.added.values())h!==iB&&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===iB&&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=UFt(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 UFt(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];uo(l,c)||r.add(s)}return{added:o,removed:n,updated:r}}var ope="globalState.argv.",a4o=["locale"];function FXe(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?rF(a,{}):JSON.stringify(a)}var BSi=1,zFt=class extends aB{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=BSi;this.previewResource=this.extUri.joinPath(this.syncPreviewFolder,"globalState.json");this.baseResource=this.previewResource.with({scheme:HC,authority:"base"});this.localResource=this.previewResource.with({scheme:HC,authority:"local"});this.remoteResource=this.previewResource.with({scheme:HC,authority:"remote"});this.acceptedResource=this.previewResource.with({scheme:HC,authority:"accepted"});this.localGlobalStateProvider=v.createInstance(WXe),this._register(n.watch(this.extUri.dirname(this.environmentService.argvResource))),this._register(H.any(H.filter(n.onDidFilesChange,b=>b.contains(this.environmentService.argvResource)),H.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}=OXe(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=FXe(s,!1);return[{baseResource:this.baseResource,baseContent:r?FXe(r,!1):h,localResource:this.localResource,localContent:h,localUserData:s,remoteResource:this.remoteResource,remoteContent:n?FXe(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}=OXe(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}=OXe(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}=OXe(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&&FXe(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[`${ope}.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(ope)&&!r.includes(l)&&t.get(l)!==void 0):[];if(!Gt){let l=[...$ue.map(c=>que(c)),iB];s.push(...l),n.push(...l)}return{user:o,machine:n,unregistered:s}}};zFt=I([m(2,TF),m(3,be),m(4,CF),m(5,VJ),m(6,uy),m(7,Co),m(8,_l),m(9,Te),m(10,B),m(11,le),m(12,dt),m(13,F)],zFt);var WXe=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=Ur(o);for(let r of a4o)n[r]!==void 0&&(e[`${ope}${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(Cn(i))}return"{}"}async writeLocalGlobalState({added:i,removed:e,updated:t},o){let n=QDe("globalState",o),r={},s=new Map,l=await this.userDataProfileStorageService.readStorageData(o),c=(u,p)=>{for(let h of u){if(h.startsWith(ope)){r[h.substring(ope.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=PDe(p,[h],r[h],{});u!==p&&(this.logService.trace(`${n}: Updating locale...`),await this.fileService.writeFile(this.environmentService.argvResource,Je.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()]))}};WXe=I([m(0,be),m(1,Co),m(2,TF),m(3,uy)],WXe);var KFt=class extends YJ{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(ope)?t[n.substring(ope.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=PDe(n,[r],t[r],{});await this.fileService.writeFile(this.environmentService.argvResource,Je.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)}}};KFt=I([m(0,le),m(1,be),m(2,an),m(3,Co),m(4,uy),m(5,dt)],KFt);var YDe=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[iB]?.value}async sync(i){let e=lXe(_t());try{return await this.doSync(i,e)}catch(t){if(t instanceof Cg&&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[iB]={value:i,version:BSi};let n=await TO(this.environmentService,this.fileService,this.storageService),r={version:BSi,machineId:n,content:FXe(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(NXe(e))return e?JSON.parse(e.content):null;throw new Error("Invalid remote data")}};YDe=I([m(1,le),m(2,Co),m(3,be),m(4,ne)],YDe);var XJ=ae("IUserDataSyncMachinesService"),HSi="sync.currentMachineName",qro="Safari",jro="Chrome",Qro="Edge",Yro="Firefox",Xro="Android";function Jro(a){switch(a){case qro:case jro:case Qro:case Yro:case Xro:case LT(0):return!0}return!1}function $ro(){return cbe?qro:XH?jro:dbe?Qro:lbe?Yro:Jut?Xro:LT(Gt?0:Pp)}var LF=class extends C{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=TO(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:$ro()}),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(HSi,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(HSi,-1);if(t){if(!e.some(s=>s.name===t))return t;this.storageService.remove(HSi,-1)}let o=`${this.productService.embedderIdentifier?`${this.productService.embedderIdentifier} - `:""}${$ro()} (${this.productService.nameShort})`,n=new RegExp(`${Yr(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!==LF.VERSION)throw new Error(d(2701,null,this.productService.nameLong));return t}async writeMachinesData(e){let t=JSON.stringify(e),o=await this.userDataSyncStoreService.writeResource(LF.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[LF.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(LF.RESOURCE,this.userData)}parse(e){if(e.content!==null)try{return JSON.parse(e.content)}catch(t){this.logService.error(t)}return{version:LF.VERSION,machines:[]}}};LF=I([m(0,Co),m(1,be),m(2,le),m(3,CF),m(4,uy),m(5,nt)],LF);var GFt=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 l4o(a){let i=a;return A.isUri(i?.base)&&A.isUri(i?.input1?.uri)&&A.isUri(i?.input2?.uri)&&A.isUri(i?.result)}var sD=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N,O,V,U,G,$,te){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=N;this.instantiationService=O;this.editorService=V;this.userDataInitializationService=U;this.fileService=G;this.fileDialogService=$;this.userDataSyncMachinesService=te;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=rD.bindTo(y),this.syncStatusContext=py.bindTo(y),this.accountStatusContext=nB.bindTo(y),this.activityViewsEnablementContext=tpe.bindTo(y),this.hasConflicts=jJ.bindTo(y),this.enableConflictsViewContext=OFt.bindTo(y),this.userDataSyncStoreManagementService.userDataSyncStore&&(this.syncStatusContext.set(this.userDataSyncService.status),this._register(e.onDidChangeStatus(pe=>this.syncStatusContext.set(pe))),this.syncEnablementContext.set(l.isEnabled()),this._register(l.onDidChangeEnablement(pe=>this.syncEnablementContext.set(pe))),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(Gt){let t=await RTe(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(H.filter(H.any(this.authenticationService.onDidRegisterAuthenticationProvider,this.authenticationService.onDidUnregisterAuthenticationProvider),t=>this.isSupportedAuthenticationProviderId(t.id))(()=>this.update("authentication provider change"))),this._register(H.filter(this.userDataSyncAccountService.onTokenFailed,t=>!t)(()=>this.update("token failure"))),this._register(H.filter(this.authenticationService.onDidChangeSessions,t=>this.isSupportedAuthenticationProviderId(t.providerId))(({event:t})=>this.onDidChangeSessions(t))),this._register(this.storageService.onDidChangeValue(-1,sD.CACHED_SESSION_STORAGE_KEY,this._store)(()=>this.onDidChangeStorage())),this._register(H.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=>(Lj(o)?o.original.resource:l4o(o)?o.input1.uri:void 0)?.scheme!==HC?!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 GFt(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}`;fp.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(17535,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 ho;if(this.accountStatus!=="available")throw new Error(d(17534,null));let t=this.turnOnSyncCancellationToken=new $e,o=Gt?C.None:this.lifecycleService.onBeforeShutdown(n=>n.veto((async()=>{let{confirmed:r}=await this.dialogService.confirm({type:"warning",message:d(17551,null),title:d(17547,null),primaryButton:d(17555,null),cancelButton:d(17533,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(17552,null,Ch.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(!Gt||!this.userDataSyncStoreManagementService.userDataSyncStore)return;let e=this.userDataSyncStoreManagementService.userDataSyncStore.type==="insiders"?this.userDataSyncStoreManagementService.userDataSyncStore.stableUrl:this.userDataSyncStoreManagementService.userDataSyncStore.insidersUrl,t=this.instantiationService.createInstance(sB,e);t.setAuthToken(this.userDataSyncAccountService.account.token,this.userDataSyncAccountService.account.authenticationProviderId),await this.instantiationService.createInstance(YDe,t).sync(this.userDataSyncStoreManagementService.userDataSyncStore.type)}syncNow(){return this.userDataAutoSyncService.triggerSync(["Sync Now"],{immediately:!0,disableCache:!0})}async doTurnOnSync(e){let t=new P,o=await this.userDataSyncService.createManualSyncTask();try{await this.progressService.withProgress({location:10,title:Ch.value,command:DF,delay:500},async n=>{n.report({message:d(17554,null)}),t.add(this.userDataSyncService.onDidChangeStatus(r=>{r==="hasConflicts"?n.report({message:d(17546,null)}):n.report({message:d(17553,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(17527,null),n="";for(let s=0;s<t.length;s++)s===t.length-1&&s!==0?n+=o:s!==0&&(n+=", "),n+=Rv(t[s].syncResource);let r=t.length===1?Rv(t[0].syncResource):void 0;await this.dialogService.prompt({type:St.Warning,message:d(17529,null,n),detail:d(17545,null),buttons:[{label:d(17548,null),run:async()=>{let s=pm(H.toPromise(H.filter(this.userDataSyncService.onDidChangeConflicts,l=>l.length===0)),e);await this.showConflicts(this.userDataSyncService.conflicts[0]?.conflicts[0]),await s}},{label:r?d(17539,null,r):d(17538,null),run:async()=>this.replace(!0)},{label:r?d(17541,null,r):d(17540,null),run:()=>this.replace(!1)}],cancelButton:{run:()=>{throw new ho}}})}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(QJ);t&&e&&await t.open(e)}async resetSyncedData(){let{confirmed:e}=await this.dialogService.confirm({type:"info",message:d(17542,null),title:d(17543,null),primaryButton:d(17544,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(`${jue}.`));s&&o.push(s.resource)}return o}async showSyncActivity(){this.activityViewsEnablementContext.set(!0),await this.waitForActiveSyncViews(),await this.viewsService.openViewContainer(rB)}async downloadSyncActivity(){let e=await this.fileDialogService.showOpenDialog({title:d(17531,null),canSelectFiles:!1,canSelectFolders:!0,canSelectMany:!1,openLabel:d(17530,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(`${Yr(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(rB);if(e){let t=this.viewDescriptorService.getViewContainerModel(e);t.activeViewDescriptors.length||await H.toPromise(H.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(17536,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 P,r=n.add(this.quickInputService.createQuickPick({useSeparators:!0})),s=new Promise(l=>{n.add(r.onDidHide(()=>{n.dispose(),l(o)}))});if(r.title=Ch.value,r.ok=!1,r.ignoreFocusOut=!0,r.placeholder=d(17528,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 GFt(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(17550,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(17532,null):void 0,account:l,authenticationProvider:n})}o.push({type:"separator",label:d(17537,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(17549,null,s),authenticationProvider:n})}}return o}async doSignIn(e){let t;Nro(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(sD.CACHED_AUTHENTICATION_PROVIDER_KEY,-1)),this._cachedCurrentAuthenticationProviderId}set currentAuthenticationProviderId(e){this._cachedCurrentAuthenticationProviderId!==e&&(this._cachedCurrentAuthenticationProviderId=e,e===void 0?this.storageService.remove(sD.CACHED_AUTHENTICATION_PROVIDER_KEY,-1):this.storageService.store(sD.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(sD.CACHED_SESSION_STORAGE_KEY,-1)):(this.logService.info("Settings Sync: Updated current session",e),this.storageService.store(sD.CACHED_SESSION_STORAGE_KEY,e,-1,1)))}getStoredCachedSessionId(){return this.storageService.get(sD.CACHED_SESSION_STORAGE_KEY,-1)}get useWorkbenchSessionId(){return!this.storageService.getBoolean(sD.DONOT_USE_WORKBENCH_SESSION_STORAGE_KEY,-1,!1)}set useWorkbenchSessionId(e){this.storageService.store(sD.DONOT_USE_WORKBENCH_SESSION_STORAGE_KEY,!e,-1,1)}};sD=I([m(0,aI),m(1,dt),m(2,Cs),m(3,LDe),m(4,Ge),m(5,le),m(6,_l),m(7,JE),m(8,ne),m(9,nt),m(10,lt),m(11,ru),m(12,LE),m(13,Ne),m(14,Bo),m(15,ct),m(16,X),m(17,Ft),m(18,Ri),m(19,TR),m(20,ao),m(21,F),m(22,ee),m(23,r4),m(24,be),m(25,dn),m(26,XJ)],sD);we(lI,sD,0);var XDe=" ",VXe=class extends C{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(XDe);t.some(s=>cMt(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 qc(e,()=>d(16634,null));this._accountBadgeDisposable.value=this.activityService.showAccountsActivity({badge:t})}}removeAccessRequest(e,t){let o=this._sessionAccessRequestItems.get(e)||{};o[t]&&(Ue(o[t].disposables),delete o[t],this.updateBadgeCount())}updateAccountPreference(e,t,o){let n=Ei.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=Ei.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=Ei.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=`${Ei.toKey(t)}-${e}-${o.scopes.join(XDe)}`;this.storageService.store(r,o.id,1,1),this.storageService.store(r,o.id,-1,1)}getSessionPreference(e,t,o){let r=`${Ei.toKey(t)}-${e}-${o.join(XDe)}`;return this.storageService.get(r,1)??this.storageService.get(r,-1)}removeSessionPreference(e,t,o){let r=`${Ei.toKey(t)}-${e}-${o.join(XDe)}`;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:St.Info,message:d(16630,null,n,e.label,t),buttons:[{label:d(16629,null),run:()=>0},{label:d(16631,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 P,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(16636,null)}),c.items=p,c.title=d(16633,null,o,this._authenticationService.getProvider(e).label),c.placeholder=d(16632,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=fe.appendMenuItem(D.AccountsContext,{group:"3_accessRequests",command:{id:`${e}${t}Access`,title:d(16628,null,c.label,o)}}),p=qe.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=Ece(t)?`${t.wwwAuthenticate}:${t.fallbackScopes?.join(XDe)??""}`:`${t.join(XDe)}`;if(s&&s[l]&&s[l].requestingExtensionIds.includes(o))return;let u=`${e}:${o}:signIn${Object.keys(s||[]).length}`,p=fe.appendMenuItem(D.AccountsContext,{group:"2_signInRequests",command:{id:u,title:d(16635,null,r.label,n)}}),h=qe.registerCommand({id:u,handler:async g=>{let v=await g.get(Cs).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()}};VXe=I([m(0,zl),m(1,le),m(2,ct),m(3,Ge),m(4,nt),m(5,Cs),m(6,OP),m(7,Gx)],VXe);we(DY,VXe,1);var JJ=class extends C{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 Op;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(JJ.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(JJ.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"&&Hto(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)}};JJ=I([m(0,le),m(1,LE),m(2,ne)],JJ);we(YX,JJ,1);var RR=ae("IAuthenticationQueryService");var lB=class{constructor(i,e){this.providerId=i;this.queryService=e}},HXe=class extends lB{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===Ei.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}},$Ft=class extends lB{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}},UXe=class extends lB{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 HXe(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 HXe(this.providerId,this.accountName,r,this.queryService);e(s)}}},zXe=class extends lB{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 $Ft(this.providerId,this.accountName,r,this.queryService);e(s)}}},USi=class extends lB{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 UXe(this.providerId,this.accountName,this.queryService),o=e.getAllowedExtensions().map(l=>l.id);o.length>0&&e.removeAccess(o);let n=new zXe(this.providerId,this.accountName,this.queryService),s=n.getAllowedMcpServers().map(l=>l.id);s.length>0&&n.removeAccess(s)}forEach(e){new UXe(this.providerId,this.accountName,this.queryService).forEach(n=>{e(n.extensionId,"extension")}),new zXe(this.providerId,this.accountName,this.queryService).forEach(n=>{e(n.mcpServerId,"mcpServer")})}},qFt=class extends lB{constructor(e,t,o){super(e,o);this.accountName=t}extension(e){return new HXe(this.providerId,this.accountName,e,this.queryService)}mcpServer(e){return new $Ft(this.providerId,this.accountName,e,this.queryService)}extensions(){return new UXe(this.providerId,this.accountName,this.queryService)}mcpServers(){return new zXe(this.providerId,this.accountName,this.queryService)}entities(){return new USi(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)}},jFt=class extends lB{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)}},QFt=class extends lB{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[]}}},zSi=class extends lB{constructor(i,e){super(i,e)}account(i){return new qFt(this.providerId,i,this.queryService)}extension(i){return new jFt(this.providerId,i,this.queryService)}mcpServer(i){return new QFt(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 qFt(this.providerId,t.label,this.queryService);i(o)}}catch{}}},KSi=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(dV)))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(dV))continue;let n=this.queryService.authenticationExtensionsService.getAccountPreference(this.extensionId,o);n&&e.set(o,n)}return e}provider(i){return new jFt(i,this.extensionId,this.queryService)}},GSi=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(dV)))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(dV))continue;let n=this.queryService.authenticationMcpService.getAccountPreference(this.mcpServerId,o);n&&e.set(o,n)}return e}provider(i){return new QFt(i,this.mcpServerId,this.queryService)}},BXe=class extends C{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 zSi(e,this)}extension(e){return new KSi(e,this)}mcpServer(e){return new GSi(e,this)}getProviderIds(e){return this.authenticationService.getProviderIds().filter(t=>e||!t.startsWith(dV))}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")}};BXe=I([m(0,Cs),m(1,OP),m(2,Yde),m(3,Gx),m(4,Qde),m(5,DY),m(6,i7e),m(7,ne)],BXe);we(RR,BXe,1);var RK=_;var JDe=class extends Ma{constructor(e,t,o,n,r){super();this._keybindingService=t;this._configurationService=o;this._markdownRenderer=n;this._accessibilityService=r;this._messageListeners=new P;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 $Si(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?RK("div.workbench-hover-pointer"):void 0,this._hover=this._register(new e7(!e.appearance?.skipFadeInAnimation)),this._hover.containerDomNode.classList.add("workbench-hover"),e.appearance?.compact&&this._hover.containerDomNode.classList.add("workbench-hover","compact"),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:Xo(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=RK("div.hover-row.markdown-hover"),c=RK("div.hover-contents");if(typeof e.content=="string")c.textContent=e.content,c.style.whiteSpace="pre-wrap";else if(Ao(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=RK("div.hover-row.status-bar"),f=RK("div.actions");e.actions.forEach(v=>{let b=this._keybindingService.lookupKeybinding(v.commandId),S=b?b.getLabel():null;this._register(t7.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=RK("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"||Mr(e.content)&&!e.content.value.includes("](")&&!e.content.value.includes("</a>"):u=e.persistence.hideOnHover,e.appearance?.showHoverHint){let g=RK("div.hover-row.status-bar"),f=RK("div.info");f.textContent=d(2100,null,it?"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 YFt(p));if(this._register(h.onMouseOut(()=>{this._isLocked||this.dispose()})),u){let g=[...this._target.targetElements,this._hoverContainer];this._lockMouseTracker=this._register(new YFt(g)),this._register(this._lockMouseTracker.onMouseOut(()=>{this._isLocked||this.dispose()}))}else this._lockMouseTracker=h}get _targetWindow(){return Me(this._target.targetElements[0])}get _targetDocumentElement(){return Me(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=Sf(this._hoverContainer,RK("div")),n=R(this._hoverContainer,RK("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)&&ESt(this._configurationService.getValue("accessibility.verbosity.hover")===!0&&this._accessibilityService.isScreenReaderOptimized(),this._keybindingService.lookupKeybinding("editor.action.accessibleView")?.getAriaLabel());o&&Or(o),this.layout(),this.addFocusTrap()}layout(){this._hover.containerDomNode.classList.remove("right-aligned"),this._hover.contentsDomNode.style.maxHeight="";let e=p=>{let h=_6(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}};JDe=I([m(1,_e),m(2,B),m(3,Qn),m(4,Bi)],JDe);var YFt=class extends Ma{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 Nl(()=>this._fireIfMouseOutside(),this._eventDebounceDelay)}_fireIfMouseOutside(){this._isMouseIn||this._onMouseOut.fire()}addElement(e){if(this._elements.includes(e))return C.None;this._elements.push(e);let t=new P;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}},$Si=class{constructor(i){this._element=i;this.targetElements=[this._element]}dispose(){}};var XFt=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(Ae(i)||Ao(i)||i===void 0)o=i;else{this._cancellationTokenSource=new $e;let n=this._cancellationTokenSource.token,r;if(Dwe(i)?HD(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(2101,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?Mr(i)?!!i.value:!0:!1}get isDisposed(){return this._hoverWidget?.isDisposed}dispose(){this._hoverWidget?.dispose(),this._cancellationTokenSource?.dispose(!0),this._cancellationTokenSource=void 0}};var d4o=3,KXe=class extends C{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(yt.registerCommandAndKeybindingRule({id:"workbench.action.showHover",weight:0,primary:Ai(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=Ao(e)?[e]:e.targetElements;for(let o=this._hoverStack.length-1;o>=0;o--)for(let n of t)if(gs(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=eso(e.content)),!this._currentDelayedHover||this._currentDelayedHoverWasShown){if(this._currentHover?.isLocked)return;if(ZDe(this._currentHoverOptions)===ZDe(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&&ZDe(this._currentHoverOptions)===ZDe(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 Pi(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=iso(e,r)),s};return this._setupDelayedHover(e,n,o)}setupDelayedHoverAtMouse(e,t,o){let n=r=>({...typeof t=="function"?t():t,target:r?iso(e,r):e});return this._setupDelayedHover(e,n,o)}_setupDelayedHover(e,t,o){let n=new P;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 Ii(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=eso(e.content)),this._getContainingHoverIndex(e.target)>=0){if(this._hoverStack.length>=d4o)return}else if(this._currentHover?.isLocked||ZDe(this._currentHoverOptions)===ZDe(e))return;this._lastHoverOptions=e;let r=e.trapFocus||this._accessibilityService.isScreenReaderOptimized(),s=Pn(),l;t||r&&s&&(s.classList.contains("monaco-hover")||(l=s));let c=new P,u=this._instantiationService.createInstance(JDe,e);if(e.persistence?.sticky&&(u.isLocked=!0),e.position?.hoverPosition&&!Xo(e.position.hoverPosition)&&(e.target={targetElements:Ao(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(ts(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=Ao(e.target)?e.target:e.target.targetElements[0];e.container=this._layoutService.getContainer(Me(p))}if(e.persistence?.sticky)c.add(j(Me(e.container).document,re.MOUSE_DOWN,p=>{gs(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=Pn();if(p){let h=Me(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 It){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(Me(Ao(t.target)?t.target:t.target.targetElements[0])),p=new Oye(u,1),h={hover:n,options:t,contextView:p,lastFocusedElementBeforeOpen:r};this._hoverStack.push(h);let g=new jSi(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=Pn();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 Ii(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 u4o(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 Nl(async()=>{(!s||s.isDisposed)&&(s=new XFt(e,b||t,f>0),await s.update(typeof o=="function"?o():o,v,{...n,trapFocus:S}))},f),u=new P,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 P,b={targetElements:[t],dispose:()=>{}};if(e.placement===void 0||e.placement==="mouse"){let S=y=>{b.x=y.x+10,qSi(y,t)||l(!0,!0)};v.add(j(t,re.MOUSE_MOVE,S,!0))}r=v,qSi(f,t)&&v.add(c(typeof e.delay=="function"?e.delay(o):e.delay,!1,b))},!0));let h=f=>{if(p||r||!qSi(f,t))return;let v={targetElements:[t],dispose:()=>{}},b=new P,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};Oh(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()}};KXe=I([m(0,F),m(1,B),m(2,ze),m(3,_e),m(4,nc),m(5,Bi)],KXe);function ZDe(a){if(a!==void 0)return a?.id??a}function eso(a){if(!Ao(a))return typeof a=="string"?a.toString():a.value}function tso(a){let i=typeof a=="function"?a():a;if(Ae(i))return fu(i);if(Dwe(i))return i.markdownNotSupportedFallback}function u4o(a,i){function e(t){t?a.setAttribute("title",t):a.removeAttribute("title")}return e(tso(i)),{update:t=>e(tso(t)),show:()=>{},hide:()=>{},dispose:()=>e(void 0)}}var jSi=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 qSi(a,i){return Ao(a.target)&&p4o(a.target,i)===i}function p4o(a,i){for(i=i??Me(a).document.body;!a.hasAttribute("custom-hover")&&a!==i;)a=a.parentElement;return a}function iso(a,i){return{targetElements:[a],x:i.x+10}}we(tt,KXe,1);is((a,i)=>{let e=a.getColor(OU);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 QSi=class{constructor(){this._modifierObservables=new WeakMap}readModifierKeyStatus(i,e){let t=i instanceof Window?i:Me(i),o=this._modifierObservables.get(t);if(!o){let n=bf.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(Vn(i)),n=Le("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=Le("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 Vn(i)}};we(eC,QSi,1);var YSi=class{constructor(){this._factories=new Vs;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()})}};we(kR,YSi,1);var m4o="diagnosticsService",eLe=ae(m4o);function RF(a){let i=a;return!!i?.hostName&&!!i?.errorMessage}var JFt=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 ZFt=12,h4o=`${sN}/vscode-regexp-languagedetection`,g4o=`${b6}/vscode-regexp-languagedetection`,XSi=`${sN}/@vscode/vscode-languagedetection`,JSi=`${b6}/@vscode/vscode-languagedetection`,eA=class extends C{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 il(ZFt);this.historicalWorkspaceOpenedLanguageIds=new il(ZFt);this.dirtyBiases=!0;this.langBiases={};let g=Dz&&this._environmentService.isBuilt&&!Gt;this._languageDetectionWorkerClient=this._register(new ZSi(s,t,c,h,g?gn.asBrowserUri(`${JSi}/dist/lib/index.js`).toString(!0):gn.asBrowserUri(`${XSi}/dist/lib/index.js`).toString(!0),g?gn.asBrowserUri(`${JSi}/model/model.json`).toString(!0):gn.asBrowserUri(`${XSi}/model/model.json`).toString(!0),g?gn.asBrowserUri(`${JSi}/model/group1-shard1of1.bin`).toString(!0):gn.asBrowserUri(`${XSi}/model/group1-shard1of1.bin`).toString(!0),g?gn.asBrowserUri(`${g4o}/dist/index.js`).toString(!0):gn.asBrowserUri(`${h4o}/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<ZFt&&(this.workspaceLanguageIds.add(n),t++,t>ZFt))break}this.dirtyBiases=!0}isEnabledForLanguage(e){return!!e&&this._configurationService.getValue(eA.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(eA.historyBasedEnablementConfig),n=this._configurationService.getValue(eA.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(eA.globalOpenedLanguagesStorageKey,0,"[]"));this.historicalGlobalOpenedLanguageIds.fromJSON(t)}catch(t){console.error(t)}try{let t=JSON.parse(e.get(eA.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!==Y.untitled&&(this.sessionOpenedLanguageIds.add(t),this.historicalGlobalOpenedLanguageIds.set(t,!0),this.historicalWorkspaceOpenedLanguageIds.set(t,!0),e.store(eA.globalOpenedLanguagesStorageKey,JSON.stringify(this.historicalGlobalOpenedLanguageIds.toJSON()),0,1),e.store(eA.workspaceOpenedLanguagesStorageKey,JSON.stringify(this.historicalWorkspaceOpenedLanguageIds.toJSON()),1,1),this.dirtyBiases=!0)}))}};eA=I([m(0,Vt),m(1,kt),m(2,B),m(3,eLe),m(4,Pe),m(5,Ct),m(6,ee),m(7,Te),m(8,le),m(9,ne),m(10,Ay)],eA);var ZSi=class extends C{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 gx({esmModuleLocation:gn.asBrowserUri("vs/workbench/services/languageDetection/browser/languageDetectionWebWorkerMain.js"),label:"LanguageDetectionWorker"})));JFt.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(Z6.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(J7i,{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}};we(eS,eA,0);var eIi=class{constructor(){this.referenceProvider=new cd(this._score.bind(this));this.renameProvider=new cd(this._score.bind(this));this.newSymbolNamesProvider=new cd(this._score.bind(this));this.codeActionProvider=new cd(this._score.bind(this));this.definitionProvider=new cd(this._score.bind(this));this.typeDefinitionProvider=new cd(this._score.bind(this));this.declarationProvider=new cd(this._score.bind(this));this.implementationProvider=new cd(this._score.bind(this));this.documentSymbolProvider=new cd(this._score.bind(this));this.inlayHintsProvider=new cd(this._score.bind(this));this.colorProvider=new cd(this._score.bind(this));this.codeLensProvider=new cd(this._score.bind(this));this.documentFormattingEditProvider=new cd(this._score.bind(this));this.documentRangeFormattingEditProvider=new cd(this._score.bind(this));this.onTypeFormattingEditProvider=new cd(this._score.bind(this));this.signatureHelpProvider=new cd(this._score.bind(this));this.hoverProvider=new cd(this._score.bind(this));this.documentHighlightProvider=new cd(this._score.bind(this));this.multiDocumentHighlightProvider=new cd(this._score.bind(this));this.selectionRangeProvider=new cd(this._score.bind(this));this.foldingRangeProvider=new cd(this._score.bind(this));this.linkProvider=new cd(this._score.bind(this));this.inlineCompletionsProvider=new cd(this._score.bind(this));this.completionProvider=new cd(this._score.bind(this));this.linkedEditingRangeProvider=new cd(this._score.bind(this));this.inlineValuesProvider=new cd(this._score.bind(this));this.evaluatableExpressionProvider=new cd(this._score.bind(this));this.documentRangeSemanticTokensProvider=new cd(this._score.bind(this));this.documentSemanticTokensProvider=new cd(this._score.bind(this));this.documentDropEditProvider=new cd(this._score.bind(this));this.documentPasteEditProvider=new cd(this._score.bind(this))}setNotebookTypeResolver(i){this._notebookTypeResolver=i}_score(i){return this._notebookTypeResolver?.(i)}};we(zt,eIi,1);var GXe=class extends C{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 JCe(e.getLegend(),this._themeService,this._languageService,this._logService)),this._caches.get(e)}};GXe=I([m(0,De),m(1,ne),m(2,kt)],GXe);we(Ale,GXe,1);var f4=ae("textMateTokenizationFeature");var e0t=class extends C{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 En(!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 fse(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=Qu.getLanguageId(f);u[v]||(u[v]=!0,this._onDidEncounterLanguage.fire(v))}}let c;return o.equals(l.ruleStack)?c=o:c=l.ruleStack,new fse(l.tokens,l.fonts,c)}};var t0t=class extends C{constructor(e,t,o,n){super();this._encodedLanguageId=e;this._actual=t;this._maxTokenizationLineLength=n;this._register(lU(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()?bye(this._encodedLanguageId,o):this._actual.tokenizeEncoded(e,t,o)}createBackgroundTokenizer(e,t){if(this._actual.createBackgroundTokenizer)return this._actual.createBackgroundTokenizer(e,t)}};var i0t=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 $Xe=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 tIi(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}},tIi=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 o0t=class a extends C{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 Oqe,this._loggingEnabled=pr("editor.experimental.asyncTokenizationLogging",!1,this._configurationService),this._register(lU(this._loggingEnabled)),this._register(this._model.onDidChangeContent(u=>{this._shouldLog&&console.log("model change",{fileName:this._model.uri.fsPath.split("\\").pop(),changes:iIi(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(he(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=t1.deserialize(new Uint8Array(o)),l=fye.deserialize(n,Vqi());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 ro(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=>iIi(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=>iIi(g)).join(" then ");console.log("Considering non-processed changes",h)}let u=$Xe.fromMany(this._pendingChanges.map(h=>tei(h.changes))),p=new t1;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=$Xe.fromMany(this._pendingChanges.map(u=>tei(u.changes)));if(!this._applyStateStackDiffFn||!this._initialState){let{applyStateStackDiff:u,INITIAL:p}=await bg("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(Qc.replace(new di(c,u),l))}return Qc.compose(o)}get _shouldLog(){return this._loggingEnabled.get()}};function iIi(a){return a.map(i=>z.lift(i.range).toString()+" => "+i.text).join(" & ")}var v4=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 P,n=this._getWorkerProxy().then(r=>{if(o.isDisposed||!r)return;let s={controller:void 0,worker:this._worker};return o.add(f4o(i,()=>{let l=new o0t(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=>{v4._reportedMismatchingTokens||(v4._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=`${sN}/vscode-oniguruma`,e=`${b6}/vscode-oniguruma`,n=`${Dz&&this._environmentService.isBuilt&&!Gt?e:i}/release/onig.wasm`,r={grammarDefinitions:this._grammarDefinitions,onigurumaWASMUri:gn.asBrowserUri(n).toString(!0)},s=this._worker=this._webWorkerService.createWorkerClient(new gx({esmModuleLocation:gn.asBrowserUri("vs/workbench/services/textMate/browser/backgroundTokenization/worker/textMateTokenizationWorker.workerMain.js"),label:"TextMateWorker"}));return i0t.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}};v4=I([m(2,Bx),m(3,B),m(4,kt),m(5,Co),m(6,Ne),m(7,Te),m(8,Ay)],v4);function f4o(a,i){let e=new P,t=e.add(new P);function o(){a.isAttachedToEditor()?t.add(i()):t.clear()}return o(),e.add(a.onDidChangeAttached(()=>{o()})),e}var n0t=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];Xe(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 qXe="No TM Grammar registered for this language.",r0t=class extends C{constructor(i,e,t,o){super(),this._host=i,this._initialState=t.INITIAL,this._scopeRegistry=new n0t,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(qXe);let o=this._scopeRegistry.getGrammarDefinition(t);if(!o)throw new Error(qXe);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(qXe):l}return{languageId:i,grammar:s,initialState:this._initialState,containsEmbeddedLanguages:r,sourceExtensionId:o.sourceExtensionId}}};var cB=Tn.registerExtensionPoint({extensionPoint:"grammars",deps:[C5],jsonSchema:{description:d(17255,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(17259,null),type:"string"},scopeName:{description:d(17261,null),type:"string"},path:{description:d(17260,null),type:"string"},embeddedLanguages:{description:d(17257,null),type:"object"},tokenTypes:{description:d(17262,null),type:"object",additionalProperties:{enum:["string","comment","other"]}},injectTo:{description:d(17258,null),type:"array",items:{type:"string"}},balancedBracketScopes:{description:d(17256,null),type:"array",items:{type:"string"},default:["*"]},unbalancedBracketScopes:{description:d(17263,null),type:"array",items:{type:"string"},default:[]}},required:["scopeName","path"]}}});var dB=class extends C{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 P),this._currentTheme=null,this._currentTokenColorMap=null,this._currentTokenFontMap=null,this._threadedBackgroundTokenizerFactory=this._instantiationService.createInstance(v4,(h,g,f,v,b)=>this._reportTokenizationTime(h,g,f,v,!0,b),()=>this.getAsyncTokenizationEnabled()),this._vscodeOniguruma=null,this._styleElement=hr(),this._styleElement.className="vscode-tokens-styles",cB.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 Nht(()=>this._createTokenizationSupport(r.language));this._tokenizersRegistrations.add(s),this._tokenizersRegistrations.add(kc.registerFactory(r.language,s))}}}this._threadedBackgroundTokenizerFactory.setGrammarDefinitions(this._grammarDefinitions);for(let t of this._createdModes)kc.getOrCreate(t)}_validateGrammarDefinition(e,t){if(!S4o(e.description.extensionLocation,t,e.collector,this._languageService))return null;let o=je(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(17244,null));return}this._debugModePrintFunc=e,this._debugMode=!0,this._debugMode&&this._progressService.withProgress({location:15,buttons:[d(17254,null)]},o=>(o.report({message:d(17252,null)}),this._getVSCodeOniguruma().then(n=>(n.setDefaultDebugCall(!0),o.report({message:d(17253,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([bg("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 r0t({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=I4o("editor.maxTokenizationLineLength",e,-1,this._configurationService),s=new P,l=s.add(new e0t(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 t0t(o,l,s,r)}catch(t){return t.message&&t.message===qXe||mt(t),null}}_updateTheme(e,t){if(!t&&this._currentTheme&&this._currentTokenColorMap&&b4o(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=v4o(this._currentTokenColorMap),n=KN(o),r=hji(this._currentTokenFontMap);this._styleElement.textContent=n+r,kc.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([bg("vscode-oniguruma","release/main.js"),this._loadVSCodeOnigurumaWASM()]);return await e.loadWASM({data:t,print:o=>{this._debugModePrintFunc(o)}}),e})()),this._vscodeOniguruma}async _loadVSCodeOnigurumaWASM(){return Gt?await(await fetch(H_t("vscode-oniguruma","release/onig.wasm"))).arrayBuffer():await fetch(Dz&&this._environmentService.isBuilt?gn.asBrowserUri(`${ypt}/vscode-oniguruma/release/onig.wasm`).toString(!0):gn.asBrowserUri(`${sN}/vscode-oniguruma/release/onig.wasm`).toString(!0))}_reportTokenizationTime(e,t,o,n,r,s){let l=r?"async":"sync";dB.reportTokenizationTimeCounter[l]>50||(dB.reportTokenizationTimeCounter[l]===0&&setTimeout(()=>{dB.reportTokenizationTimeCounter[l]=0},1e3*60*60),dB.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}))}};dB=I([m(0,kt),m(1,Gp),m(2,Bx),m(3,Ne),m(4,ne),m(5,B),m(6,Bo),m(7,Vt),m(8,F),m(9,Te)],dB);function v4o(a){let i=[null];for(let e=1,t=a.length;e<t;e++)i[e]=Oe.fromHex(a[e]);return i}function b4o(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 S4o(a,i,e,t){if(i.language&&(typeof i.language!="string"||!t.isRegisteredLanguageId(i.language)))return e.error(d(17247,null,cB.name,String(i.language))),!1;if(!i.scopeName||typeof i.scopeName!="string")return e.error(d(17250,null,cB.name,String(i.scopeName))),!1;if(!i.path||typeof i.path!="string")return e.error(d(17248,null,cB.name,String(i.path))),!1;if(i.injectTo&&(!Array.isArray(i.injectTo)||i.injectTo.some(n=>typeof n!="string")))return e.error(d(17246,null,cB.name,JSON.stringify(i.injectTo))),!1;if(i.embeddedLanguages&&!yi(i.embeddedLanguages))return e.error(d(17245,null,cB.name,JSON.stringify(i.embeddedLanguages))),!1;if(i.tokenTypes&&!yi(i.tokenTypes))return e.error(d(17251,null,cB.name,JSON.stringify(i.tokenTypes))),!1;let o=je(a,i.path);return La(o,a)||e.warn(d(17249,null,cB.name,o.path,a.path)),!0}function I4o(a,i,e,t){return ui(o=>t.onDidChangeConfiguration(n=>{n.affectsConfiguration(a,{overrideIdentifier:i})&&o(n)}),()=>t.getValue(a,{overrideIdentifier:i})??e)}var tLe=class{static{this.ID="workbench.contrib.textMateTokenizationInstantiator"}constructor(i){}};tLe=I([m(0,f4)],tLe);we(f4,dB,0);pt(tLe.ID,tLe,ut.BlockRestore);qe.registerCommand("_workbench.colorizeTextMateTokens",async(a,i)=>{let e=a.get(Ho),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 kc.getOrCreate(t.getLanguageId());if(!o)throw new Error(`Cannot resolve tokenizer for language ${t.getLanguageId()}`);let n=new En,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 y4o="editor.experimental.preferTreeSitter";var w4o="@vscode/tree-sitter-wasm/wasm",C4o="tree-sitter.wasm";function oso(a){return`${Dz&&a.isBuilt?ypt:sN}/${w4o}`}var iLe=class extends C{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 bg("@vscode/tree-sitter-wasm","wasm/tree-sitter.js"),t=this._environmentService,o=this.isTest;return await e.Parser.init({locateFile(n,r){let s=`${oso(t)}/${C4o}`;return o?gn.asFileUri(s).toString(!0):gn.asBrowserUri(s).toString(!0)}}),e});this._supportsLanguage=new kI(e=>pr(`${y4o}.${e}`,!1,this._configurationService));this._languagesCache=new kI(e=>Au.fromFn(async()=>{let t=oso(this._environmentService),o=`tree-sitter-${e}`,n=`${t}/${o}.wasm`,[r,s]=await Promise.all([this._treeSitterImport.value,this._fileService.readFile(gn.asFileUri(n))]);return await r.Language.load(s.value.buffer)}));this._injectionQueries=new kI({getCacheKey:JSON.stringify},e=>{let t=async()=>{let o=`vs/editor/common/languages/${e.kind}/${e.languageId}.scm`,n=gn.asFileUri(o);if(!this._fileService.hasProvider(n))return;let r=await x4o(this._fileService,n);if(r!==void 0)return r.value.toString()};return Au.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)}};iLe=I([m(0,B),m(1,be),m(2,Co)],iLe);async function x4o(a,i){try{return await a.readFile(i)}catch(e){if(hu(e)===1)return;throw e}}var oLe=class{constructor(i){this._themeService=i;this._colorTheme=ui(this._themeService.onDidColorThemeChange,()=>this._themeService.getColorTheme()),this.onChange=Ce(this,e=>{this._colorTheme.read(e),e.reportChange(void 0)})}findMetadata(i,e,t,o){return HOt(this._colorTheme.read(o),i,e,t)}};oLe=I([m(0,Gp)],oLe);we(F9,iLe,0);we(ebt,oLe,0);var k4o=3e4,oIi=2,nIi={passive:!0,capture:!0},s0t=class extends C{constructor(i){super();let e=oIi,t=this._register(new ZD),o=this._register(new me);o.value=i.markActive();let n=()=>{++e===oIi&&(o.clear(),t.cancel())},r=s=>{e===oIi&&(o.value=i.markActive(),t.cancelAndSet(n,k4o,s)),e=0};this._register(H.runAndSubscribe(Fg,({window:s,disposables:l})=>{l.add(j(s.document,"touchstart",()=>r(s),nIi)),l.add(j(s.document,"mousedown",()=>r(s),nIi)),l.add(j(s.document,"keydown",()=>r(s),nIi))},{window:It,disposables:this._store})),r(It)}};QLt.add(s0t);var a0t=class extends C{constructor(e){super();this.value=e;this._totalTime=0;this._startTime=void 0;this._register(he(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 P,n=0,r;return o.add(he(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 nso(a,i,e){let t=Le("wasTrueRecently",!1),o;return e.add(he(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 l0t=ae("userAttentionService");var E4o=6e4,jXe=class extends C{constructor(e,t){super();this._logService=t;let o=this._register(e.createInstance(QXe));this.isVsCodeFocused=o.isVsCodeFocused,this.isUserActive=o.isUserActive,this._isTracingEnabled=ui(this,this._logService.onDidChangeLogLevel,()=>this._logService.getLevel()===1);let n=nso(this.isUserActive,E4o,this._store);this.hasUserAttention=Ce(this,r=>n.read(r)),this._timeKeeper=this._register(new a0t(this.hasUserAttention)),this._register(he(r=>{this._isTracingEnabled.read(r)&&(r.store.add(he(s=>{let l=this.isVsCodeFocused.read(s);this._logService.trace(`[UserAttentionService] VS Code focus changed: ${l}`)})),r.store.add(he(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()}};jXe=I([m(0,F),m(1,ne)],jXe);var QXe=class extends C{constructor(e,t){super();this._hostService=e;this._logService=t;this._isUserActive=Le(this,!1);this.isVsCodeFocused=ui(this,this._hostService.onDidChangeFocus,()=>this._hostService.hasFocus),this.isUserActive=this._isUserActive;let o=()=>{this._markUserActivity()};this._register(H.runAndSubscribe(Fg,({window:n,disposables:r})=>{r.add(j(n.document,"keydown",o,c0t)),r.add(j(n.document,"mousemove",o,c0t)),r.add(j(n.document,"mousedown",o,c0t)),r.add(j(n.document,"touchstart",o,c0t))},{window:It,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)}};QXe=I([m(0,oi),m(1,ne)],QXe);var c0t={passive:!0,capture:!0};we(l0t,jXe,1);var rIi=class{constructor(){this.onWillInstantiateEditorPane=ys.onWillInstantiateEditorPane}didInstantiateEditorPane(i){return ys.didInstantiateEditorPane(i)}};we(Lxt,rIi,1);var sIi=class extends C{constructor(){super();this._onDidSendData=this._register(new E);this.onDidSendData=this._onDidSendData.event}getDataChannel(e){return new aIi(e,this._onDidSendData)}},aIi=class{constructor(i,e){this.channelId=i;this._onDidSendData=e}sendData(i){this._onDidSendData.fire({channelId:this.channelId,data:i})}};we(O7,sIi,1);var aD=ae("IDefaultLogLevelsService"),YXe=class extends C{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()};uo(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??S7t(this.environmentService)}async _writeLogLevelsToArgv(e){let t=[];cn(e.default)||t.push($w(e.default));for(let[o,n]of e.extensions??[])t.push(`${o}=${$w(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=uce.exec(o);if(n&&n[1]&&n[2]){let r=Gre(n[2]);cn(r)||e.extensions?.push([n[1].toLowerCase(),r])}else{let r=Gre(o);cn(r)||(e.default=r)}}return!cn(e.default)||e.extensions?.length?e:void 0}async _readLogLevelsFromArgv(){try{let e=await this.fileService.readFile(this.environmentService.argvResource),t=Ur(e.value.toString());return Ae(t["log-level"])?[t["log-level"]]:Array.isArray(t["log-level"])?t["log-level"]:[]}catch(e){hu(e)!==1&&this.logService.error(e)}return[]}_getDefaultLogLevelFromEnv(){return S7t(this.environmentService)}_getExtensionsDefaultLogLevelsFromEnv(){let e=[];for(let[t,o]of this.environmentService.extensionLogLevel??[]){let n=Gre(o);cn(n)||e.push([t,n])}return e}};YXe=I([m(0,Vt),m(1,be),m(2,zf),m(3,ne),m(4,ol)],YXe);we(aD,YXe,1);var XXe=class extends C{constructor(e){super();this.layoutService=e;this.contextView=this._register(new Oye(this.layoutService.mainContainer,1)),this.layout(),this._register(e.onDidLayoutContainer(()=>this.layout()))}showContextView(e,t,o){let n;t?t===this.layoutService.getContainer(Me(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}};XXe=I([m(0,nc)],XXe);var d0t=class extends XXe{getContextViewElement(){return this.contextView.getViewElement()}};var nLe=class extends C{constructor(e,t){super();this._markerService=t;this._onDidChangeMarker=this._register(new E);this.onDidChangeMarker=this._onDidChangeMarker.event;this._suppressedRanges=new vt;this._markerDecorations=new vt;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 lIi(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===Y.inMemory||e.uri.scheme===Y.internal||e.uri.scheme===Y.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=>!ht.some(o,r=>z.areIntersectingOrTouching(r,n)))),e.update(t)&&this._onDidChangeMarker.fire(e.model)}};nLe=I([m(0,Ct),m(1,Ns)],nLe);var lIi=class extends C{constructor(e){super();this.model=e;this._map=new Uut;this._register(Z(()=>{this.model.deltaDecorations([...this._map.values()],[]),this._map.clear()}))}update(e){let{added:t,removed:o}=HH(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=Ss(w9),n=10,s={color:Ss(wGi),position:1};break;case 4:t="squiggly-warning",o=Ss(hqi),n=20,s={color:Ss(CGi),position:1};break;case 8:default:t="squiggly-error",o=Ss(NIe),n=30,s={color:Ss(xGi),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 npe=new Set([Y.inMemory,Y.vscodeSourceControl,Y.walkThrough,Y.walkThroughSnippet,Y.vscodeChatCodeBlock,Y.vscodeTerminal]),cIi=class{constructor(){this._byResource=new vt;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 vt,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()??ht.empty():A.isUri(i)?this._byResource.get(i)?.values()??ht.empty():ht.map(ht.concat(...this._byOwner.values()),e=>e[1])}},dIi=class{constructor(i){this.errors=0;this.infos=0;this.warnings=0;this.unknowns=0;this._data=new vt;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(npe.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}},u0t=class a{constructor(){this._onMarkerChanged=new d6({merge:a._merge});this.onMarkerChanged=this._onMarkerChanged.event;this._data=new cIi;this._stats=new dIi(this);this._filteredResources=new vt}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(JA(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=ht.first(n);r&&(t.push(r.resource),this._data.delete(r.resource,i))}if(dr(e)){let n=new vt;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(2152,null,e[0]):d(2153,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 Mn;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 vt;for(let t of i)for(let o of t)e.set(o,!0);return Array.from(e.keys())}};var JXe="data-keybinding-context",ZXe=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 uo(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}},sLe=class a extends ZXe{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)}},uIi=class a extends ZXe{constructor(e,t,o){super(e,null);this._configurationService=t;this._values=Yu.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 eJe(r))}else{let r=[];for(let s of n.affectedKeys){let l=`config.${s}`,c=this._values.findSuperstr(l);c!==void 0&&(r.push(...ht.map(c,([u])=>u)),this._values.deleteSuperstr(l)),this._values.has(l)&&(r.push(l),this._values.delete(l))}o.fire(new eJe(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()}}},pIi=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)}},p0t=class{constructor(i){this.key=i}affectsSome(i){return i.has(this.key)}allKeysContainedIn(i){return this.affectsSome(i)}},eJe=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))}},mIi=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 T4o(a,i){return a.allKeysContainedIn(new Set(Object.keys(i)))}var m0t=class extends C{constructor(e){super();this._onDidChangeContext=this._register(new Pm({merge:e=>new mIi(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 pIi(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 hIi(this,e)}createOverlay(e=ht.empty()){if(this._isDisposed)throw new Error("AbstractContextKeyService has been disposed");return new gIi(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 p0t(e))}removeContext(e){this._isDisposed||this.getContextValuesContainer(this._myContextId).removeValue(e)&&this._onDidChangeContext.fire(new p0t(e))}getContext(e){return this._isDisposed?sLe.INSTANCE:this.getContextValuesContainer(_4o(e))}dispose(){super.dispose(),this._isDisposed=!0}},rLe=class extends m0t{constructor(e){super(0);this._contexts=new Map;this._lastContextId=0,this.inputFocusedContext=$h.bindTo(this);let t=this._register(new uIi(this._myContextId,e,this._onDidChangeContext));this._contexts.set(this._myContextId,t),this._register(H.runAndSubscribe(Fg,({window:o,disposables:n})=>{let r=n.add(new me);n.add(j(o,re.FOCUS_IN,()=>{r.value=new P,this.updateInputContextKeys(o.document,r.value)},!0))},{window:It,disposables:this._store}))}updateInputContextKeys(e,t){function o(){return!!e.activeElement&&Oh(e.activeElement)}let n=o();if(this.inputFocusedContext.set(n),n){let r=t.add(Vn(e.activeElement));H.once(r.onDidBlur)(()=>{Ki().document===e&&this.inputFocusedContext.set(o()),r.dispose()},void 0,t)}}getContextValuesContainer(e){return this._isDisposed?sLe.INSTANCE:this._contexts.get(e)||sLe.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 ZXe(t,this.getContextValuesContainer(e))),t}disposeContext(e){this._isDisposed||this._contexts.delete(e)}updateParent(e){throw new Error("Cannot update parent of root ContextKeyService")}};rLe=I([m(0,B)],rLe);var hIi=class extends m0t{constructor(e,t){super(e.createChildContext());this._parentChangeListener=this._register(new me);if(this._parent=e,this._updateParentChangeListener(),this._domNode=t,this._domNode.hasAttribute(JXe)){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(JXe,String(this._myContextId))}_updateParentChangeListener(){this._parentChangeListener.value=this._parent.onDidChangeContext(e=>{let o=this._parent.getContextValuesContainer(this._myContextId).value;T4o(e,o)||this._onDidChangeContext.fire(e)})}dispose(){this._isDisposed||(this._parent.disposeContext(this._myContextId),this._domNode.removeAttribute(JXe),super.dispose())}getContextValuesContainer(e){return this._isDisposed?sLe.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={...$Ge(o,r),...$Ge(r,o)},l=Object.keys(s);this._onDidChangeContext.fire(new eJe(l))}},h0t=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)}},gIi=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 h0t(this.parent.getContext(i),this.overlay)}getContextValuesContainer(i){let e=this.parent.getContextValuesContainer(i);return new h0t(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=ht.empty()){return new a(this,i)}updateParent(){throw new Error("Not supported.")}};function _4o(a){for(;a;){if(a.hasAttribute(JXe)){let i=a.getAttribute(JXe);return i?parseInt(i,10):NaN}a=a.parentElement}return 0}function D4o(a,i,e){a.get(X).createKey(String(i),L4o(e))}function L4o(a){return Gk(a,i=>{if(typeof i=="object"&&i.$mid===1)return A.revive(i).toString();if(i instanceof A)return i.toString()})}qe.registerCommand("_setContext",D4o);qe.registerCommand({id:"getContextKeyInfo",handler(){return[...Q.all()].sort((a,i)=>a.key.localeCompare(i.key))},metadata:{description:d(1839,null),args:[]}});qe.registerCommand("_generateContextKeyInfo",function(){let a=[],i=new Set;for(let e of Q.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 aLe=class extends C{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,Ie.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}}}};aLe=I([m(0,B),m(1,Ct),m(2,kt)],aLe);var lLe=class{constructor(i,e){this.requestService=i;this.fileService=e}async download(i,e,t=ve.None){if(i.scheme===Y.file||i.scheme===Y.vscodeRemote){await this.fileService.copy(i,e);return}let o={type:"GET",url:i.toString(!0)},n=await this.requestService.request(o,t);if(n.res.statusCode===200)await this.fileService.writeFile(e,n.stream);else{let r=await Kx(n);throw new Error(`Expected 200, got back ${n.res.statusCode} instead.

${r}`)}}};lLe=I([m(0,_a),m(1,be)],lLe);var tJe=class{constructor(i){this._commandService=i}async open(i,e){if(!jd(i,Y.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=zg(decodeURIComponent(i.query))}catch{try{t=zg(i.query)}catch{}}return Array.isArray(t)||(t=[t]),await this._commandService.executeCommand(i.path,...t),!0}};tJe=I([m(0,ge)],tJe);var iJe=class{constructor(i){this._editorService=i}async open(i,e){typeof i=="string"&&(i=A.parse(i));let{selection:t,uri:o}=EIe(i);return i=o,i.scheme===Y.file&&(i=_re(i)),await this._editorService.openCodeEditor({resource:i,options:{selection:t,source:e?.fromUserGesture?1:0,...e?.editorOptions}},this._editorService.getFocusedCodeEditor(),e?.openToSide),!0}};iJe=I([m(0,Kt)],iJe);var cLe=class{constructor(i,e){this._openers=new Vs;this._validators=new Vs;this._resolvers=new Vs;this._resolvedUriTargets=new vt(i=>i.with({path:null,fragment:null,query:null}).toString());this._externalOpeners=new Vs;this._defaultExternalOpener={openExternal:async t=>($0(t,Y.http,Y.https)?PGe(t):It.location.href=t,!0)},this._openers.push({open:async(t,o)=>o?.openExternal||$0(t,Y.mailto,Y.http,Y.https,Y.vsls)?(await this._doOpenExternal(t,o),!0):!1}),this._openers.push(new tJe(e)),this._openers.push(new iJe(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===Y.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},ve.None))return!0}return this._defaultExternalOpener.openExternal(n,{sourceUri:t},ve.None)}dispose(){this._validators.clear()}};cLe=I([m(0,Kt),m(1,ge)],cLe);var MK=ae("IIgnoredExtensionsManagementService"),dLe=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 Uo([...e,...o].filter(r=>!n.includes(r)))}getConfiguredIgnoredExtensions(){return(this.configurationService.getValue("settingsSync.ignoredExtensions")||[]).map(i=>i.toLowerCase())}};dLe=I([m(0,B)],dLe);var uLe=class extends uU{constructor(i,e){super(),this.logger=this._register(i.createLogger(je(e.logsHome,`${jue}.log`),{id:jue,name:d(2700,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()}};uLe=I([m(0,ol),m(1,Co)],uLe);function R4o(a){return a.type==="gallery"}function M4o(a){return a.type===1||a.type===0}var P4o=/^(?<version>\d+\.\d+\.\d+(-.*)?)(@(?<platform>.+))?$/,pLe=class extends C{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(Kle)&&(this._allowedExtensionsConfigValue=this.getAllowedExtensionsValue(),this._onDidChangeAllowedExtensions.fire())}))}get allowedExtensionsConfigValue(){return this._allowedExtensionsConfigValue}getAllowedExtensionsValue(){let e=this.configurationService.getValue(Kle);if(!yi(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;R4o(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):M4o(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=ic("workbench.action.openSettings",{query:`@id:${Kle}`}).toString(),u=this._allowedExtensionsConfigValue[t],p=new xe(d(1961,null,c));if(!cn(u))return Da(u)?u?!0:p:u==="stable"&&r?new xe(d(1958,null,c)):o!=="*"&&Array.isArray(u)&&!u.some(f=>{let v=P4o.exec(f);if(v&&v.groups){let{platform:b,version:S}=v.groups;return!(S!==o||n!=="universal"&&b&&n!==b)}return!1})?new xe(d(1962,null,o,c)):!0;let h=l&&this.publisherOrgs.includes(l)?l:s,g=this._allowedExtensionsConfigValue[h];return cn(g)?this._allowedExtensionsConfigValue["*"]===!0?!0:p:Da(g)?g?!0:new xe(d(1960,null,h,c)):g==="stable"&&r?new xe(d(1959,null,h,c)):!0}};pLe=I([m(0,nt),m(1,B)],pLe);var PK=ae("IMcpGalleryService"),rso=ae("IMcpManagementService"),MR=ae("IAllowedMcpServersService"),mk="chat.mcp.access",b4="chat.mcp.gallery.serviceUrl",AK="chat.mcp.gallery.enabled",ZJ="chat.mcp.autostart",g0t="chat.mcp.apps.enabled";var aso;(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||!Ae(s.name)||!s.description||!Ae(s.description)||!s.version||!Ae(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})(aso||={});var f0t;(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||!yi(r.server)||!r.server.name||!Ae(r.server.name)||!r.server.description||!Ae(r.server.description)||!r.server.version||!Ae(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})(f0t||={});var fIi;(t=>{t.VERSION="v0";class i{constructor(){this.galleryMcpServerDataSerializers=[];this.galleryMcpServerDataSerializers.push(f0t.SERIALIZER),this.galleryMcpServerDataSerializers.push(aso.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})(fIi||={});var A4o=50,N4o={pageSize:A4o},vIi=class a{constructor(i=N4o){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})}},mLe=class extends C{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(fIi.VERSION,fIi.SERIALIZER),this.galleryMcpServerDataSerializers.set(f0t.VERSION,f0t.SERIALIZER)}isEnabled(){return this.mcpGalleryManifestService.mcpGalleryManifestStatus==="available"}async query(e,t=ve.None){let o=await this.mcpGalleryManifestService.getMcpGalleryManifest();if(!o)return{firstPage:{items:[],hasMore:!1},getNextPage:async()=>({items:[],hasMore:!1})};let n=new vIi;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 ho;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(2155,null));let n=A.parse(o);if(n.scheme===Y.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 xe(d(2156,null,o)).value;let r=await this.requestService.request({type:"GET",url:o},t),s=await E_(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":Cre(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=>Cre(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===Y.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},o),c=await hh(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},ve.None);if(o.res.statusCode&&o.res.statusCode>=400&&o.res.statusCode<500)return;let n=await hh(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=m5(t,"McpServerNamedResourceUriTemplate");if(o)return PT(o,{name:e})}getServerIdUrl(e,t){let o=m5(t,"McpServerIdUriTemplate");if(o)return PT(o,{id:e})}getLatestServerVersionUrl(e,t){let o=m5(t,"McpServerLatestVersionUriTemplate");if(o)return PT(o,{name:encodeURIComponent(e)})}getWebUrl(e,t){let o=m5(t,"McpServerWebUriTemplate");if(o)return PT(o,{name:e})}getPublisherUrl(e,t){let o=m5(t,"PublisherUriTemplate");if(o)return PT(o,{name:e})}getMcpGalleryUrl(e){return m5(e,"McpServersQueryService")}};mLe=I([m(0,_a),m(1,be),m(2,ne),m(3,wV)],mLe);var hLe=class extends C{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(mk)&&this._onDidChangeAllowedMcpServers.fire()}))}isAllowed(e){if(this.configurationService.getValue(mk)!=="none")return!0;let t=ic("workbench.action.openSettings",{query:`@id:${mk}`}).toString();return new xe(d(2154,null,t))}};hLe=I([m(0,B)],hLe);var rJe="workbench.actions.accounts.signIn";var O4o=new Q("defaultAccountStatus","uninitialized"),v0t="defaultAccount.cachedPolicyData",SIi=3600*1e3;function lso(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 gLe=class extends C{constructor(e){super();this.defaultAccount=null;this.initBarrier=new Np;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=lso(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){uo(this.defaultAccount,e)||(this.defaultAccount=e,this._onDidChangeDefaultAccount.fire(this.defaultAccount))}};gLe=I([m(0,nt)],gLe);var nJe=class extends C{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(),SIi));this.accountStatusContext=O4o.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(v0t,-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(v0t,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",Cn(t))}return null}async init(){if(Gt&&!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",Cn(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",Cn(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){uo(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){uo(this._policyData,e)||(this._policyData=e,this.cachePolicyData(e),this._onDidChangePolicyData.fire(this._policyData?.policyData??null))}setCopilotTokenInfo(e){uo(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(v0t,JSON.stringify(t),-1,1)}else this.logService.debug("[DefaultAccount] Removing cached policy data"),this.storageService.remove(v0t,-1)}scheduleAccountDataPoll(){this._defaultAccount&&this.accountDataPollScheduler.schedule(SIi)}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,Cn(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,Cn(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:`,Cn(o)),t===3)throw o;await Pi(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,ve.None);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 hh(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",Cn(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,ve.None);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 hh(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",Cn(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 cn(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,ve.None);if(o){if(!aP(o)){if(UEt(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 hh(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",Cn(n));return}}}async request(e,t,o,n,r){let s;for(let l of n){if(r.isCancellationRequested)return s;try{let c=await this.requestService.request({type:t,url:e,data:t==="POST"?JSON.stringify(o):void 0,disableCache:!0,headers:{Authorization:`Bearer ${l.accessToken}`}},r),u=c.res.statusCode;if(u===401||u===404){this.logService.debug(`[DefaultAccount] Received ${u} for URL ${e} with session ${l.id}, likely due to expired/revoked token or insufficient permissions.`,"Trying next session if available."),s=c;continue}return c}catch(c){r.isCancellationRequested||this.logService.error(`[DefaultAccount] request: error ${c}`,e)}}if(!s){this.logService.trace("[DefaultAccount]: No response received for request",e);return}return s}isDataStale(e){return Date.now()-e>=SIi}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(Ae(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?Uo([...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})}};nJe=I([m(1,B),m(2,Cs),m(3,DY),m(4,Te),m(5,lt),m(6,_a),m(7,ne),m(8,Vt),m(9,X),m(10,le),m(11,oi),m(12,ge)],nJe);var fLe=class extends C{static{this.ID="workbench.contributions.defaultAccountProvider"}constructor(i,e,t){super();let o=this._register(e.createInstance(nJe,lso(i.defaultChatAgent)));t.setDefaultAccountProvider(o)}};fLe=I([m(0,nt),m(1,F),m(2,Um)],fLe);W(class extends K{constructor(){super({id:rJe,title:L(16492,"Sign In")})}async run(a){await a.get(Um).signIn()}});pt(fLe.ID,fLe,ut.BlockStartup);var cso;(i=>{function a(e,t){return e.callstack<t.callstack?-1:e.callstack>t.callstack?1:0}i.compare=a})(cso||={});var sJe=class a{constructor(i,e=a.ERROR_FLUSH_TIMEOUT){this._flushHandle=void 0;this._buffer=[];this._disposables=new P;this._telemetryService=i,this._flushDelay=e;let t=i6.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),Zs.isErrorNoTelemetry(i)||i instanceof As||Lut.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:pU(i);e&&this._enqueue({msg:t,callstack:e})}_enqueue(i){let e=cx(this._buffer,i,cso.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 aJe=class extends sJe{installErrorListeners(){let i,e=this;typeof It.onerror=="function"&&(i=It.onerror),It.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&&(It.onerror=i)}))}_onUncaughtError(i,e,t,o,n){let r={callstack:i,msg:i,file:e,line:t,column:o};if(n){if(Zs.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 eZ=class extends C{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:It.innerHeight,innerWidth:It.innerWidth,outerHeight:It.outerHeight,outerWidth:It.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:Dr,pinnedViewlets:u.getPinnedPaneCompositeIds(0),restoredViewlet:y?y.getId():void 0,restoredEditors:n.visibleEditors.length,startupKind:o.startupKind}),this._register(new aJe(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())),KL(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(ms(e)!==".json")return"";if(Xe(e,this.userDataProfileService.currentProfile.settingsResource))return"global-settings";if(Xe(e,this.userDataProfileService.currentProfile.keybindingsResource))return"keybindings";if(La(e,this.userDataProfileService.currentProfile.snippetsHome))return"snippets";let t=this.contextService.getWorkspace().folders;for(let o of t)if(La(e,o.toResource(".vscode"))){let n=Ye(e);if(eZ.ALLOWLIST_WORKSPACE_JSON.indexOf(n)>-1)return`.vscode/${n}`}return""}getTelemetryData(e,t){let o=ms(e),n=o.indexOf("?");o=n!==-1?o.substr(0,n):o;let r=Ye(e),s=e.scheme===Y.file?e.fsPath:e.path,l={mimeType:new Im(JEe(e).join(", ")),ext:o,path:Ir(s),reason:t,allowlistedjson:void 0};return o===".json"&&eZ.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(14049,"Show Telemetry"),category:We.Developer,f1:!0})}async run(){for(let o of e.loggerService.getRegisteredLoggers())o.group?.id===qxt.id&&(e.loggerService.setLogLevel(o.resource,1),e.loggerService.setVisibility(o.resource,!0));e.outputService.showChannel(qxt.id)}})),[...this.loggerService.getRegisteredLoggers()].find(o=>o.id===qle)||await H.toPromise(H.filter(this.loggerService.onDidChangeLoggers,o=>[...o.added].some(n=>n.id===qle)));let t=!1;for(let o of this.loggerService.getRegisteredLoggers())if(o.id===qle){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===qxt.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)))}}};eZ=I([m(0,Te),m(1,Pe),m(2,ao),m(3,ee),m(4,_e),m(5,Gp),m(6,Vt),m(7,mn),m(8,ds),m(9,nt),m(10,ol),m(11,Ml),m(12,Ho)],eZ);var lJe=class extends C{constructor(e,t,o){super();this.configurationService=e;this.userDataProfilesService=t;this.telemetryService=o;this.configurationRegistry=oe.as(ii.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(Xo(n)||Da(n))return n.toString();let r=this.configurationRegistry.getConfigurationProperties()[e];if(Ae(n))return r?.enum?.includes(n)?n:void 0;if(Array.isArray(n)&&n.every(s=>Xo(s)||Da(s)||Ae(s)&&r?.enum?.includes(s)))return JSON.stringify(n)}reportTelemetry(e,t){let o=ise(t);switch(e){case"workbench.activityBar.location":this.telemetryService.publicLog2("workbench.activityBar.location",{settingValue:this.getValueToReport(e,t),source:o});return;case VE: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 nxe: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 IV:this.telemetryService.publicLog2("extensions.autoRestart",{settingValue:this.getValueToReport(e,t),source:o});return;case ty.OutputLocation:this.telemetryService.publicLog2("terminal.integrated.chatAgentTools.outputLocation",{settingValue:this.getValueToReport(e,t),source:o});return;case ty.SuggestEnabled:this.telemetryService.publicLog2("terminal.integrated.suggest.enabled",{settingValue:this.getValueToReport(e,t),source:o});return}}};lJe=I([m(0,B),m(1,an),m(2,Te)],lJe);var dso=oe.as(Qi.Workbench);dso.registerWorkbenchContribution(eZ,3);dso.registerWorkbenchContribution(lJe,4);var S0t=ae("preferencesSearchService");var uso=new Q("inPreferencesSearch",!1),I0t="settings.action.clearSearchResults",pso="settings.action.showAIResults",y0t="settings.action.toggleAiSearch",w0t="settings.action.showContextMenu",mso="settings.action.suggestFilters",lD=new Q("inSettingsEditor",!1),IIi=new Q("inSettingsJSONEditor",!1),rpe=new Q("inSettingsSearch",!1),C0t=new Q("settingsTocRowFocus",!1),cJe=new Q("settingRowFocus",!1),nf=new Q("inKeybindings",!1),vLe=new Q("inKeybindingsSearch",!1),x0t=new Q("keybindingsSearchHasValue",!1),MF=new Q("keybindingFocus",!1),spe=new Q("whenFocus",!1),k0t=new Q("aiSettingResultsAvailable",!1),hso="keybindings.editor.searchKeybindings",E0t="keybindings.editor.clearSearchResults",gso="keybindings.editor.clearSearchHistory",T0t="keybindings.editor.recordSearchKeys",_0t="keybindings.editor.toggleSortByPrecedence",bLe="keybindings.editor.defineKeybinding",D0t="keybindings.editor.addKeybinding",L0t="keybindings.editor.defineWhenExpression",fso="keybindings.editor.acceptWhenExpression",vso="keybindings.editor.rejectWhenExpression",R0t="keybindings.editor.removeKeybinding",M0t="keybindings.editor.resetKeybinding",P0t="keybindings.editor.copyKeybindingEntry",A0t="keybindings.editor.copyCommandKeybindingEntry",N0t="keybindings.editor.copyCommandTitle",O0t="keybindings.editor.showConflicts",bso="keybindings.editor.focusKeybindings",Sso="keybindings.editor.showDefaultKeybindings",Iso="keybindings.editor.showUserKeybindings",yso="keybindings.editor.showExtensionKeybindings",NK="modified",SLe="ext:",hk="feature:",dJe="id:",PF="lang:",wso="tag:",uB="hasPolicy",S4="workspaceTrust",ILe="requireTrustedWorkspace",I4="advanced";var F0t=!0,yIi=!0,wIi=1e3,W0t="local",V0t="tfIdf",Cso="filterModel",B0t="embeddingsFull",H0t="llmRanked";var b0t;async function xso(a,i,e){if(yIi&&i.isEnabled()&&!(a.sentiment.hidden||a.sentiment.disabled)){if(b0t)return b0t;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 Wp(i.getExtensions([{id:r,preRelease:!s}],ve.None),wIi);if(l?.length===1)o[n]=l[0];else return}catch{return}}return b0t={settingsEditorRecommendedExtensions:t,recommendedExtensionsGalleryInfo:o},b0t}}}function ape(a,i){let e=a??Number.MAX_SAFE_INTEGER,t=i??Number.MAX_SAFE_INTEGER;return e<t?-1:e>t?1:0}var U0t=d(12590,null),z0t=d(12589,null),kso=d(12588,null),Eso=new Set;["css","html","scss","less","json","js","ts","ie","id","php","scm"].forEach(a=>Eso.add(a));var OK=new Map;OK.set("power shell","PowerShell");OK.set("powershell","PowerShell");OK.set("javascript","JavaScript");OK.set("typescript","TypeScript");OK.set("github","GitHub");OK.set("jet brains","JetBrains");OK.set("jetbrains","JetBrains");OK.set("re sharper","ReSharper");OK.set("resharper","ReSharper");function CIi(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=>Eso.has(i.toLowerCase())?i.toUpperCase():i);for(let[i,e]of OK)a=a.replace(new RegExp(`\\b${i}\\b`,"gi"),e);return a}var yLe=oe.as(ea.JSONContribution),AF=class extends C{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=H.None;this._register(yLe.onDidChangeSchema(o=>{this._onDidChangeFile.fire([{resource:A.parse(o),type:0}])})),this._register(yLe.onDidChangeSchemaAssociations(()=>{this._onDidChangeFile.fire([{resource:AF.SCHEMA_ASSOCIATIONS,type:0}])})),this._register(e.onDidDefaultSettingsContentChanged(o=>{this._onDidChangeFile.fire([{resource:o,type:0}])}))}static{this.SCHEMA=Y.vscode}static{this.SCHEMA_ASSOCIATIONS=A.parse(`${Y.vscode}://schemas-associations/schemas-associations.json`)}async readFile(e){if(e.scheme!==AF.SCHEMA)throw new jG;let t;if(e.authority==="schemas"?t=this.getSchemaContent(e):e.authority===AF.SCHEMA_ASSOCIATIONS.authority?t=JSON.stringify(yLe.getSchemaAssociations()):e.authority==="defaultsettings"&&(t=this.preferencesService.getDefaultSettingsContent(e)),t)return Je.fromString(t).buffer;throw"EntryNotFound"}async stat(e){if(yLe.hasSchemaContent(e.toString())||this.preferencesService.hasDefaultSettingsContent(e)){let t=Date.now();return{type:1,permissions:1,mtime:t,ctime:t,size:0}}if(Xe(e,AF.SCHEMA_ASSOCIATIONS)){let t=Date.now();return{type:1,permissions:1,mtime:t,ctime:t,size:0}}throw"EntryNotFound"}watch(e,t){return C.None}async mkdir(e){}async readdir(e){return[]}async rename(e,t,o){}async delete(e,t){}async writeFile(){throw new jG}getSchemaContent(e){let t=Date.now(),o=yLe.getSchemaContent(e.toString())??"{}",n=this.logService.getLevel();if(n===2||n===1){let r=Date.now(),s=JSON.stringify(yLe.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}};AF=I([m(0,Po),m(1,ne)],AF);var lpe=class extends C{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(o9e)||p.affectsConfiguration(i9e))&&this.handleSettingsEditorRegistration()})),this.handleSettingsEditorRegistration();let u=this._register(this.instantiationService.createInstance(AF));this._register(e.registerProvider(AF.SCHEMA,u))}static{this.ID="workbench.contrib.preferences"}handleSettingsEditorRegistration(){Ue(this.editorOpeningListener),(this.configurationService.getValue(o9e)||this.configurationService.getValue(i9e))&&(this.editorOpeningListener=this.editorResolverService.registerEditor("**/settings.json",{id:ga.ID,label:d(12595,null),priority:"builtin"},{},{createEditorInput:({resource:e,options:t})=>{if(Xe(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(Xe(e,n[0].toResource(PEe)))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(Xe(e,r.toResource(PEe)))return{editor:this.preferencesService.createSplitJsonEditorInput(6,e),options:t}}return{editor:this.textEditorService.createTextEditor({resource:e}),options:t}}}))}dispose(){Ue(this.editorOpeningListener),super.dispose()}};lpe=I([m(0,be),m(1,F),m(2,Po),m(3,mn),m(4,Pe),m(5,B),m(6,ul),m(7,lk)],lpe);var F4o=oe.as(ii.Configuration);F4o.registerConfiguration({...Cm,properties:{"workbench.settings.enableNaturalLanguageSearch":{type:"boolean",description:d(12591,null),default:!0,scope:4,tags:["usesOnlineServices"]},"workbench.settings.settingsSearchTocBehavior":{type:"string",enum:["hide","filter"],enumDescriptions:[d(12594,null),d(12593,null)],description:d(12592,null),default:"filter",scope:4}}});var Tso=Re("settings-folder-dropdown",M.chevronDown,d(12377,null)),_so=Re("settings-more-action",M.gear,d(12375,null)),Dso=Re("keybindings-record-keys",M.recordKeys,d(12367,null)),Lso=Re("keybindings-sort",M.sortPrecedence,d(12368,null)),Rso=Re("keybindings-edit",M.edit,d(12366,null)),Mso=Re("keybindings-add",M.add,d(12365,null)),cpe=Re("settings-edit",M.edit,d(12373,null)),xIi=Re("settings-remove",M.close,d(12376,null)),Pso=Re("settings-discard",M.discard,d(12371,null)),wLe=Re("preferences-clear-input",M.clearAll,d(12370,null)),Aso=Re("preferences-ai-results",M.sparkle,d(12369,null)),Nso=Re("preferences-filter",M.filter,d(12374,null)),dpe=Re("preferences-open-settings",M.goToFile,d(12372,null));var uJe=class extends oc{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(Tso)),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(Ni("mouse"),this.anchorElement,"")),this._register(j(this.anchorElement,re.MOUSE_DOWN,t=>$t.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))),R(this.container,this.anchorElement),this.update()}onKeyUp(e){switch(new Ii(e).keyCode){case 3:case 10:this.onClick(e);return}}onClick(e){$t.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=>Xe(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&&Xe(this.folder.uri,o.uri),enabled:!0,class:void 0,run:()=>this._action.run(o)}})),e}labelWithCount(e,t){return t&&(e+=` (${t})`),e}};uJe=I([m(1,Pe),m(2,ze),m(3,tt)],uJe);var CLe=class extends Ma{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(Y.vscodeRemote,e);this.userLocalSettings.label=d(12399,null),this.userRemoteSettings.label=d(12400,null)+(t?` [${t}]`:""),this.workspaceSettings.label=d(12401,null),this.folderSettingsAction.label=d(12397,null)}create(e){let t=R(e,_(".settings-tabs-widget"));this.settingsSwitcherBar=this._register(new ji(t,{orientation:0,focusOnlyEnabledItems:!0,ariaLabel:d(12398,null),ariaRole:"tablist",actionViewItemProvider:(r,s)=>r.id==="folderSettings"?this.folderSettings:void 0})),this.userLocalSettings=this._register(new st("userSettings","",".settings-tab",!0,()=>this.updateTarget(3))),this.userLocalSettings.tooltip=d(12399,null),this.userRemoteSettings=this._register(new st("userSettingsRemote","",".settings-tab",!0,()=>this.updateTarget(4)));let o=this.environmentService.remoteAuthority,n=o&&this.labelService.getHostLabel(Y.vscodeRemote,o);this.userRemoteSettings.tooltip=d(12400,null)+(n?` [${n}]`:""),this.workspaceSettings=this._register(new st("workspaceSettings","",".settings-tab",!1,()=>this.updateTarget(5))),this.folderSettingsAction=this._register(new st("folderSettings","",".settings-tab",!1,async r=>{this.updateTarget(oC(r)?r.uri:3)})),this.folderSettings=this._register(this.instantiationService.createInstance(uJe,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(12401,null);t&&(o+=` (${t})`),this.workspaceSettings.label=o}else if(e===3){let o=d(12399,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&&Xe(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(12401,null)}};CLe=I([m(2,Pe),m(3,F),m(4,Vt),m(5,ot),m(6,kt)],CLe);var tZ=class extends Ma{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=R(e,_("div.settings-header-widget")),this.createSearchContainer(R(this.domNode,_("div.settings-search-container"))),this.controlsDiv=R(this.domNode,_("div.settings-search-controls")),this.options.showResultCount&&(this.countElement=R(this.controlsDiv,_(".settings-count-widget")),this.countElement.style.backgroundColor=wt(rv),this.countElement.style.color=wt(Yw),this.countElement.style.border=`1px solid ${wt(gi)}`),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(Vn(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=R(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=()=>ML(this.keybindingService);return new D1(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?yl(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()}};tZ=I([m(2,_n),m(3,F),m(4,X),m(5,_e)],tZ);var pJe=class extends C{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(cpe),glyphMarginHoverMessage:new xe().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 upe=class extends tZ{constructor(e,t,o,n,r,s){super(e,t,o,n,r,s);this.recordDisposables=this._register(new P);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 Ii(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)}};upe=I([m(2,_n),m(3,F),m(4,X),m(5,_e)],upe);var NF=class extends Ma{constructor(e,t){super();this.instantiationService=t;this._keybindingDisposables=this._register(new P);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=or(document.createElement("div")),this._domNode.setDisplay("none"),this._domNode.setClassName("defineKeybindingWidget"),this._domNode.setWidth(NF.WIDTH),this._domNode.setHeight(NF.HEIGHT);let o=d(12314,null);R(this._domNode.domNode,_(".message",void 0,o)),this._domNode.domNode.style.backgroundColor=wt(gm),this._domNode.domNode.style.color=wt(dL),this._keybindingInputWidget=this._register(this.instantiationService.createInstance(upe,this._domNode.domNode,{ariaLabel:o,history:new Set([]),inputBoxStyles:pl})),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=R(this._domNode.domNode,_(".output")),this._showExistingKeybindingsNode=R(this._domNode.domNode,_(".existing")),e&&R(e,this._domNode.domNode)}static{this.WIDTH=400}static{this.HEIGHT=110}get domNode(){return this._domNode.domNode}define(){return this._keybindingInputWidget.clear(),fn.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 Pi(0),this._keybindingInputWidget.focus());let t=this._onHide.event(()=>{e(this.getUserSettingsLabel()),t.dispose()})})}layout(e){let t=Math.round((e.height-NF.HEIGHT)/2);this._domNode.setTop(t);let o=Math.round((e.width-NF.WIDTH)/2);this._domNode.setLeft(o)}printExisting(e){if(e>0){let t=_("span.existingText"),o=e===1?d(12315,null,e):d(12313,null,e);R(t,document.createTextNode(o)),Jo(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 ah(this._outputNode,zo,l_)).set(this._chords?.[0]??void 0),this._chords)for(let n=1;n<this._chords.length;n++)this._outputNode.appendChild(document.createTextNode(d(12312,null))),this._keybindingDisposables.add(new ah(this._outputNode,zo,l_)).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()}};NF=I([m(1,F)],NF);var iZ=class extends C{constructor(e,t){super();this._editor=e;this._widget=this._register(t.createInstance(NF,null)),this._editor.addOverlayWidget(this)}static{this.ID="editor.contrib.defineKeybindingWidget"}getId(){return iZ.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 ai(e.width,e.height)),this._widget.define()}};iZ=I([m(1,F)],iZ);function Kf(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 xLe(){return{isSimpleWidget:!0,contributions:aa.getSomeEditorContributions([ry.ID,ly,Hm.ID,El.ID,Qr.ID,ay.ID])}}function kLe(a){return is((i,e)=>{let t=i.getColor(tgt);if(t){let o=i.getColor(Gb);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(pL);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 tA=class extends Ma{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=R(t,_(".suggest-input-container")),this.element=t,this.placeholderText=R(this.stylingContainer,_(".suggest-input-placeholder",void 0,s.placeholderText||""));let g=Nu(Kf(h),W4o(n));g.overflowWidgetsDomNode=s.overflowWidgetsDomNode;let f=this.getScopedContextKeyService(u),v=f?this._register(l.createChild(new Io([X,f]))):l;this.inputWidget=this._register(v.createInstance(jr,this.stylingContainer,g,{contributions:aa.getSomeEditorContributions([El.ID,Qr.ID,Hm.ID,ry.ID,ly]),isSimpleWidget:!0})),this._register(h.onDidChangeConfiguration(k=>{if(k.affectsConfiguration("editor.accessibilitySupport")||k.affectsConfiguration("editor.cursorBlinking")){let T=h.getValue("editor.accessibilitySupport"),N=h.getValue("editor.cursorBlinking");this.inputWidget.updateOptions({accessibilitySupport:T,cursorBlinking:N})}})),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(H.chain(this.inputWidget.onKeyDown,k=>k.filter(T=>T.keyCode===3))(k=>{k.preventDefault()},this)),this._register(H.chain(this.inputWidget.onKeyDown,k=>k.filter(T=>T.keyCode===18&&(it?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?E$(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,N)=>{let O=k.getValue(),V=T.column-1,U=0,G=0;if(w.wordDefinition){let $=My(T.column,w.wordDefinition,O,0);U=$?.word.length??0,G=$?$.startColumn-1:0}else G=O.lastIndexOf(" ",V-1)+1,U=V-G;return!w.alwaysShowSuggestions&&U>0&&w.triggerCharacters?.indexOf(O[G])===-1?{suggestions:[]}:{suggestions:o.provideResults(O).map($=>{let te,pe;return typeof $=="string"?te=$:(te=$.label,pe=$),{label:te,insertText:te,range:z.fromPositions(T.delta(0,-U),T),sortText:w.sortKey(te),kind:17,...pe}})}}})),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",[An.replace(t,e)]),this.inputWidget.setScrollTop(0),this.inputWidget.setPosition(new Ie(1,e.length+1))}getValue(){return this.inputWidget.getValue()}style(e){this.stylingContainer.style.backgroundColor=wt(e.inputBackground??Gb),this.stylingContainer.style.color=wt(e.inputForeground??pL),this.placeholderText.style.color=wt(e.inputPlaceholderForeground??u9),this.stylingContainer.style.borderWidth="1px",this.stylingContainer.style.borderStyle="solid",this.stylingContainer.style.borderColor=Ese(e.inputBorder??Vy,"transparent");let t=this.stylingContainer.getElementsByClassName("cursor")[0];t&&(t.style.backgroundColor=wt(e.inputForeground??pL))}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))}};tA=I([m(6,F),m(7,Ct),m(8,X),m(9,zt),m(10,B)],tA);var mJe=class extends tA{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 I7(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()}};mJe=I([m(1,F),m(2,Ct),m(3,X),m(4,zt),m(5,B)],mJe);var ELe=class extends mJe{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(qM(e,this)),e}};ELe=I([m(1,F),m(2,Ct),m(3,X),m(4,zt),m(5,B)],ELe);kLe(".suggest-input-container");function W4o(a){return{fontSize:13,lineHeight:20,wordWrap:"off",scrollbar:{vertical:"hidden"},roundedSelection:!1,guides:{indentation:!1},cursorWidth:1,fontFamily:HN,ariaLabel:a||"",snippetSuggestions:"none",suggest:{filterGraceful:!1,showIcons:!1},autoClosingBrackets:"never"}}var hJe=J("settings.headerForeground",{light:"#444444",dark:"#e7e7e7",hcDark:"#ffffff",hcLight:"#292929"},d(12597,null)),kIi=J("settings.settingsHeaderHoverForeground",ei(hJe,.7),d(12612,null)),zId=J("settings.modifiedItemIndicator",{light:new Oe(new Bt(102,175,224)),dark:new Oe(new Bt(12,125,157)),hcDark:new Oe(new Bt(0,73,122)),hcLight:new Oe(new Bt(102,175,224))},d(12598,null)),Oso=J("settings.headerBorder",cb,d(12611,null)),gJe=J("settings.sashBorder",cb,d(12613,null)),K0t=J("settings.dropdownBackground",FU,d(12607,null)),G0t=J("settings.dropdownForeground",Ose,d(12609,null)),$0t=J("settings.dropdownBorder",PN,d(12608,null)),q0t=J("settings.dropdownListBorder",DN,d(12610,null)),KId=J("settings.checkboxBackground",nIe,d(12604,null)),GId=J("settings.checkboxForeground",rIe,d(12606,null)),$Id=J("settings.checkboxBorder",bgt,d(12605,null)),TLe=J("settings.textInputBackground",Gb,d(12614,null)),_Le=J("settings.textInputForeground",pL,d(12616,null)),ZE=J("settings.textInputBorder",Vy,d(12615,null)),Fso=J("settings.numberInputBackground",Gb,d(12599,null)),Wso=J("settings.numberInputForeground",pL,d(12601,null)),Vso=J("settings.numberInputBorder",Vy,d(12600,null)),qId=J("settings.focusedRowBackground",{dark:ei(Xk,.6),light:ei(Xk,.6),hcDark:null,hcLight:null},d(12596,null)),jId=J("settings.rowHoverBackground",{dark:ei(Xk,.3),light:ei(Xk,.3),hcDark:null,hcLight:null},d(12603,null)),QId=J("settings.focusedRowBorder",Ad,d(12602,null));var Mv=_,xh=class extends pa{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super(xh.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.preferencesService=b;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 jo(300)),this._register(n.onDidUpdateKeybindings(()=>this.render(!!this.keybindingFocusContextKey.get()))),this.keybindingsEditorContextKey=nf.bindTo(this.contextKeyService),this.searchFocusContextKey=vLe.bindTo(this.contextKeyService),this.keybindingFocusContextKey=MF.bindTo(this.contextKeyService),this.searchHasValueContextKey=x0t.bindTo(this.contextKeyService),this.searchHistoryDelayer=this._register(new jo(500)),this.recordKeysAction=this._register(new st(T0t,d(12297,null),q.asClassName(Dso))),this.recordKeysAction.checked=!1,this.sortByPrecedenceAction=this._register(new st(_0t,d(12305,null),q.asClassName(Lso))),this.sortByPrecedenceAction.checked=!1,this.overflowWidgetsDomNode=Mv(".keybindings-overflow-widgets-container.monaco-editor")}static{this.ID="workbench.editor.keybindings"}create(e){super.create(e),this._register(zE({name:"keybindingsEditor",focusNotifiers:[this],focusNextWidget:()=>{this.searchWidget.hasFocus()&&this.focusKeybindings()},focusPreviousWidget:()=>{this.searchWidget.hasFocus()||this.focusSearch()}}))}createEditor(e){let t=R(e,Mv("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):Nc||this.searchWidget.focus()}get activeKeybindingEntry(){let e=this.keybindingsTable.getFocusedElements()[0];return e&&e.templateId===e4?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=R(e,_("")),this.ariaLabelElement.setAttribute("id","keybindings-editor-aria-label-element"),this.ariaLabelElement.setAttribute("aria-live","assertive")}createOverlayContainer(e){this.overlayContainer=R(e,Mv(".overlay-container")),this.overlayContainer.style.position="absolute",this.overlayContainer.style.zIndex="40",this.defineKeybindingWidget=this._register(this.instantiationService.createInstance(NF,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=R(e,Mv(".keybindings-header"));let t=d(12300,null),o=d(12301,null),n=this._register(new st(E0t,d(12280,null),q.asClassName(wLe),!1,async()=>this.clearSearchResults())),r=R(this.headerContainer,Mv(".search-row-container")),s=R(r,Mv(".search-container"));this.searchWidget=this._register(this.instantiationService.createInstance(upe,s,{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:c_({inputBorder:ZE})})),this._register(this.searchWidget.onDidChange(g=>{let f=!!g;n.enabled=f,this.searchHasValueContextKey.set(f),this.delayedFiltering.trigger(()=>this.filterKeybindings()),this.updateSearchOptions()})),this._register(this.searchWidget.onEscape(()=>this.recordKeysAction.checked=!1)),this.actionsContainer=R(s,_(".keybindings-search-actions-container"));let l=this.createRecordingBadge(this.actionsContainer);this._register(this.sortByPrecedenceAction.onDidChange(g=>{g.checked!==void 0&&this.renderKeybindingsEntries(!1),this.updateSearchOptions()})),this._register(this.recordKeysAction.onDidChange(g=>{g.checked!==void 0&&(l.classList.toggle("disabled",!g.checked),g.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 c=[this.recordKeysAction,this.sortByPrecedenceAction,n],u=this._register(new Ju(this.actionsContainer,this.contextMenuService,{actionViewItemProvider:(g,f)=>{if(g.id===this.sortByPrecedenceAction.id||g.id===this.recordKeysAction.id)return new Gae(null,g,{...f,keybinding:this.keybindingsService.lookupKeybinding(g.id)?.getLabel(),toggleStyles:qg})},getKeyBinding:g=>this.keybindingsService.lookupKeybinding(g.id)}));u.setActions(c),this._register(this.keybindingsService.onDidUpdateKeybindings(()=>u.setActions(c)));let p=R(r,Mv(".open-keybindings-json")),h=this._register(new Mi(p,{secondary:!0,title:!0,...Ko}));h.label=d(12295,null),this._register(h.onDidClick(()=>this.preferencesService.openGlobalKeybindingSettings(!0,{groupId:this.group.id})))}updateSearchOptions(){let e=this.input;e&&(e.searchOptions={searchValue:this.searchWidget.getValue(),recordKeybindings:!!this.recordKeysAction.checked,sortByPrecedence:!!this.sortByPrecedenceAction.checked})}createRecordingBadge(e){let t=R(e,_(".recording-badge.monaco-count-badge.long.disabled"));return t.textContent=d(12296,null),t.style.backgroundColor=wt(rv),t.style.color=wt(Yw),t.style.border=`1px solid ${wt(gi)}`,t}layoutSearchWidget(e){this.searchWidget.layout(e),this.headerContainer.classList.toggle("small",e.width<400),this.searchWidget.inputBox.inputElement.style.paddingRight=`${yl(this.actionsContainer)+12}px`}createBody(e){let t=R(e,Mv(".keybindings-body"));this.createTable(t)}createTable(e){this.keybindingsTableContainer=R(e,Mv(".keybindings-table-container")),this.keybindingsTable=this._register(this.instantiationService.createInstance(rC,"KeybindingsEditor",this.keybindingsTableContainer,new EIi,[{label:"",tooltip:"",weight:0,minimumWidth:40,maximumWidth:40,templateId:oZ.TEMPLATE_ID,project(t){return t}},{label:d(12281,null),tooltip:"",weight:.3,templateId:nZ.TEMPLATE_ID,project(t){return t}},{label:d(12290,null),tooltip:"",weight:.2,templateId:j0t.TEMPLATE_ID,project(t){return t}},{label:d(12308,null),tooltip:"",weight:.35,templateId:sZ.TEMPLATE_ID,project(t){return t}},{label:d(12306,null),tooltip:"",weight:.15,templateId:rZ.TEMPLATE_ID,project(t){return t}}],[this.instantiationService.createInstance(oZ,this),this.instantiationService.createInstance(nZ),this.instantiationService.createInstance(j0t),this.instantiationService.createInstance(sZ,this),this.instantiationService.createInstance(rZ)],{identityProvider:{getId:t=>t.id},horizontalScrolling:!1,accessibilityProvider:new TIi(this.configurationService),keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:t=>t.keybindingItem.commandLabel||t.keybindingItem.command},overrideStyles:{listBackground:qo},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)})),R(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 aa.getEditorActions())e.set(t.id,t.label);for(let t of fe.getMenuItems(D.CommandPalette))if(Kk(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(12289,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(12303,null,e.length):d(12302,null,e.length)}layoutKeybindingsTable(){if(!this.dimension)return;let e=this.dimension.height-(Yn(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===e4&&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===e4){let t=e.element;this.selectEntry(t),this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>[this.createCopyAction(t),this.createCopyCommandAction(t),this.createCopyCommandTitleAction(t),new li,...t.keybindingItem.keybinding?[this.createDefineKeybindingAction(t),this.createAddKeybindingAction(t)]:[this.createDefineKeybindingAction(t)],new li,this.createRemoveAction(t),this.createResetAction(t),new li,this.createDefineWhenExpressionAction(t),new li,this.createShowConflictsAction(t)]})}}onFocusChange(){this.keybindingFocusContextKey.reset();let e=this.keybindingsTable.getFocusedElements()[0];e&&e.templateId===e4&&this.keybindingFocusContextKey.set(!0)}createDefineKeybindingAction(e){return{label:e.keybindingItem.keybinding?d(12279,null):d(12278,null),enabled:!0,id:bLe,run:()=>this.defineKeybinding(e,!1)}}createAddKeybindingAction(e){return{label:d(12278,null),enabled:!0,id:D0t,run:()=>this.defineKeybinding(e,!0)}}createDefineWhenExpressionAction(e){return{label:d(12286,null),enabled:!!e.keybindingItem.keybinding,id:L0t,run:()=>this.defineWhenExpression(e)}}createRemoveAction(e){return{label:d(12298,null),enabled:!!e.keybindingItem.keybinding,id:R0t,run:()=>this.removeKeybinding(e)}}createResetAction(e){return{label:d(12299,null),enabled:!e.keybindingItem.keybindingItem.isDefault,id:M0t,run:()=>this.resetKeybinding(e)}}createShowConflictsAction(e){return{label:d(12304,null),enabled:!!e.keybindingItem.keybinding,id:O0t,run:()=>this.showSimilarKeybindings(e)}}createCopyAction(e){return{label:d(12284,null),enabled:!0,id:P0t,run:()=>this.copyKeybinding(e)}}createCopyCommandAction(e){return{label:d(12282,null),enabled:!0,id:A0t,run:()=>this.copyKeybindingCommand(e)}}createCopyCommandTitleAction(e){return{label:d(12283,null),enabled:!!e.keybindingItem.commandLabel,id:N0t,run:()=>this.copyKeybindingCommandTitle(e)}}onKeybindingEditingError(e){this.notificationService.error(typeof e=="string"?e:d(12287,null,`${e}`))}};xh=I([m(1,Te),m(2,De),m(3,_e),m(4,ze),m(5,bbi),m(6,X),m(7,Ne),m(8,Wi),m(9,F),m(10,ee),m(11,le),m(12,B),m(13,Bi),m(14,Po)],xh);var EIi=class{constructor(){this.headerRowHeight=30}getHeight(i){if(i.templateId===e4){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}},oZ=class{constructor(i,e){this.keybindingsEditor=i;this.keybindingsService=e;this.templateId=oZ.TEMPLATE_ID}static{this.TEMPLATE_ID="actions"}renderTemplate(i){let e=R(i,Mv(".actions"));return{actionBar:new ji(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(Rso),enabled:!0,id:"editKeybinding",tooltip:this.keybindingsService.appendKeybinding(d(12285,null),bLe),run:()=>this.keybindingsEditor.defineKeybinding(i,!1)}}createAddAction(i){return{class:q.asClassName(Mso),enabled:!0,id:"addKeybinding",tooltip:this.keybindingsService.appendKeybinding(d(12277,null),bLe),run:()=>this.keybindingsEditor.defineKeybinding(i,!1)}}disposeTemplate(i){i.actionBar.dispose()}};oZ=I([m(1,_e)],oZ);var nZ=class{constructor(i){this._hoverService=i;this.templateId=nZ.TEMPLATE_ID}static{this.TEMPLATE_ID="commands"}renderTemplate(i){let e=R(i,Mv(".command")),t=this._hoverService.setupManagedHover(Ni("mouse"),e,""),o=R(e,Mv(".command-label")),n=new Oa(o),r=R(e,Mv(".command-default-label")),s=new Oa(r),l=R(e,Mv(".command-id.code")),c=new Oa(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(12307,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()}};nZ=I([m(0,tt)],nZ);var j0t=class a{constructor(){this.templateId=a.TEMPLATE_ID}static{this.TEMPLATE_ID="keybindings"}renderTemplate(i){let e=R(i,Mv(".keybinding"));return{keybindingLabel:new ah(R(e,Mv("div.keybinding-label")),zo,l_)}}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 V4o(a,i){let e=new P;return e.add(j(a,re.CLICK,Ybe(i))),e.add(j(a,re.KEY_UP,t=>{let o=new Ii(t);(o.equals(10)||o.equals(3))&&(t.preventDefault(),t.stopPropagation(),i())})),e}var rZ=class{constructor(i,e){this.extensionsWorkbenchService=i;this.hoverService=e;this.templateId=rZ.TEMPLATE_ID}static{this.TEMPLATE_ID="source"}renderTemplate(i){let e=R(i,Mv(".source")),t=this.hoverService.setupManagedHover(Ni("mouse"),e,""),o=new Oa(R(e,Mv(".source-label"))),n=R(e,Mv(".extension-container")),r=R(n,Mv("a.extension-label",{tabindex:0})),s=new Oa(R(n,Mv(".extension-id-container.code")));return{sourceColumn:e,sourceColumnHover:t,sourceLabel:o,extensionLabel:r,extensionContainer:n,extensionId:s,disposables:new P}}renderElement(i,e,t){if(t.disposables.clear(),Ae(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(12288,null,n)),t.extensionLabel.textContent=n,t.disposables.add(V4o(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()}};rZ=I([m(0,zi),m(1,tt)],rZ);var fJe=class extends C{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=spe.bindTo(n);this.input=this._register(o.createInstance(tA,"keyboardshortcutseditor#wheninput",e,{provideResults:()=>{let s=[];for(let l of Q.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=>$t.stop(s))),this._register(Z(()=>r.reset())),this._register(t.onAcceptWhenExpression(()=>this._onDidAccept.fire(this.input.getValue()))),this._register(H.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)}};fJe=I([m(2,F),m(3,X)],fJe);var sZ=class{constructor(i,e,t){this.keybindingsEditor=i;this.hoverService=e;this.instantiationService=t;this.templateId=sZ.TEMPLATE_ID}static{this.TEMPLATE_ID="when"}renderTemplate(i){let e=R(i,Mv(".when")),t=R(e,Mv("div.when-label")),o=new Oa(t),n=R(e,Mv("div.when-input-container"));return{element:e,whenLabelContainer:t,whenLabel:o,whenInputContainer:n,disposables:new P}}renderElement(i,e,t){t.disposables.clear();let o=t.disposables.add(new P);t.disposables.add(this.keybindingsEditor.onDefineWhenExpression(n=>{if(i===n){t.element.classList.add("input-mode");let r=o.add(this.instantiationService.createInstance(fJe,t.whenInputContainer,this.keybindingsEditor));r.layout(new ai(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(Ni("mouse"),t.element,i.keybindingItem.when))):t.whenLabel.set("-")}disposeTemplate(i){i.disposables.dispose(),i.whenLabel.dispose()}};sZ=I([m(1,tt),m(2,F)],sZ);var TIi=class{constructor(i){this.configurationService=i}getWidgetAriaLabel(){return d(12291,null)}getAriaLabel({keybindingItem:i}){let e=[i.commandLabel?i.commandLabel:i.command,i.keybinding?.getAriaLabel()||d(12293,null),i.when?i.when:d(12294,null),Ae(i.source)?i.source:i.source.description??i.source.identifier.value];if(this.configurationService.getValue("accessibility.verbosity.keybindingsEditor")){let t=d(12292,null);e.push(t)}return e.join(", ")}};J("keybindingTable.headerBackground",U$e,"Background color for the keyboard shortcuts table header.");J("keybindingTable.rowsBackground",U$e,"Background color for the keyboard shortcuts table alternating rows.");is((a,i)=>{let e=a.getColor(ko);if(e){let p=e.transparent(.8).makeOpaque(DO(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(QT),o=a.getColor(Wy);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(ugt),r=a.getColor(xf);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(ZSe),l=a.getColor(c9);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(eIe),u=a.getColor(Xk);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 FK=class extends st{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(12360,"Configure Language Specific Settings...")}async run(){let t=this.languageService.getSortedRegisteredLanguageNames().map(({languageName:o,languageId:n})=>{let r=d(12361,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:js(this.modelService,this.languageService,s),description:r}});await this.quickInputService.pick(t,{placeHolder:d(12362,null)}).then(o=>{if(o){let n=this.languageService.getLanguageIdByLanguageName(o.label);if(typeof n=="string")return this.preferencesService.openLanguageSpecificSettings(n)}})}};FK=I([m(2,Ct),m(3,kt),m(4,Ge),m(5,Po)],FK);qe.registerCommand({id:"_getAllSettings",handler:()=>oe.as(ii.Configuration).getConfigurationProperties()});qe.registerCommand("_getAllCommands",function(a,i){let e=a.get(_e),t=a.get(X),o=[];for(let n of aa.getEditorActions()){let r=e.lookupKeybinding(n.id);i&&!t.contextMatchesRules(n.precondition)||o.push({command:n.id,label:n.label,description:xq(n.metadata?.description)?n.metadata.description.value:n.metadata?.description,precondition:n.precondition?.serialize(),keybinding:r?.getLabel()??"Not set"})}for(let n of fe.getMenuItems(D.CommandPalette))if(Kk(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=xq(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 Q0t;(i=>i.PreferencesEditorPane="workbench.registry.preferences.editorPanes")(Q0t||={});var _Ii=class extends C{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)}};oe.add(Q0t.PreferencesEditorPane,new _Ii);var DIi=class extends st{constructor(e,t){super(e.id,e.title,"",!0,t);this.descriptor=e}},y4=class extends pa{constructor(e,t,o,n,r,s){super(y4.ID,e,t,o,n);this.instantiationService=r;this.editorPanesRegistry=oe.as(Q0t.PreferencesEditorPane);this.preferencesTabActions=[];this.preferencesEditorPane=this._register(new me);this.searchFocusContextKey=uso.bindTo(s),this.element=_(".preferences-editor");let l=R(this.element,_(".preferences-editor-header")),c=R(l,_(".search-container"));this.searchWidget=this._register(this.instantiationService.createInstance(tZ,c,{focusKey:this.searchFocusContextKey,inputBoxStyles:c_({inputBorder:ZE})})),this._register(H.debounce(this.searchWidget.onDidChange,()=>{},300)(()=>{this.preferencesEditorPane.value?.search(this.searchWidget.getValue())}));let u=R(l,_(".preferences-tabs-container"));this.preferencesTabActionBar=this._register(new ji(u,{orientation:0,focusOnlyEnabledItems:!0,ariaLabel:d(12364,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=R(this.element,_(".preferences-editor-body"))}static{this.ID="workbench.editor.preferences"}createEditor(e){R(e,this.element)}layout(e){this.dimension=e,this.searchWidget.layout(e),this.searchWidget.inputBox.inputElement.style.paddingRight="12px",this.preferencesEditorPane.value?.layout(new ai(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 DIi(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(12363,null,t.descriptor.title)),this.searchWidget.inputBox.setAriaLabel(d(12363,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())}};y4=I([m(1,Te),m(2,De),m(3,le),m(4,F),m(5,X)],y4);var vJe=class extends Ma{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=Ese(MS,wt(qo)),this._domNode.style.color=Ese(YT,wt(od)),this._domNode.style.border=`1px solid ${wt(gi)}`,R(this._domNode,_("")).textContent=this.label,this.onclick(this._domNode,()=>this._onClick.fire())}},ppe=class extends C{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 P),t=()=>{if(e.clear(),!this.isVisible())return;let o=Vm(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}};ppe=I([m(1,qt),m(2,X)],ppe);var DLe=class extends ppe{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(vJe,e.label),n=o.getDomNode();return this.options.container.appendChild(n),t.add(Z(()=>n.remove())),o}getActionArg(){return this.options.getActionArg()}};DLe=I([m(1,F),m(2,qt),m(3,X)],DLe);var OF=class extends C{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 P)}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):MU(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&&Xe(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=po.register({description:"codeeditor-range-highlight-whole",stickiness:1,className:"rangeHighlight",isWholeLine:!0})}static{this._RANGE_HIGHLIGHT=po.register({description:"codeeditor-range-highlight",stickiness:1,className:"rangeHighlight"})}createRangeHighlightDecoration(e=!0){return e?OF._WHOLE_LINE_RANGE_HIGHLIGHT:OF._RANGE_HIGHLIGHT}dispose(){super.dispose(),this.editor?.getModel()&&(this.removeHighlightRange(),this.editor=null)}};OF=I([m(0,ee)],OF);var mpe=class extends vJe{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()}};mpe=I([m(3,_e)],mpe);var aZ=class extends ppe{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(mpe,this.editor,e.label,e.id)}isVisible(){return!(this.editor instanceof zc)&&this.editor?.hasModel()&&!this.editor.getOption(70)}getActionArg(){return this.editor.getModel()?.uri}};aZ=I([m(1,F),m(2,qt),m(3,X)],aZ);var LIi=d(16730,null),RIi=d(16735,null),Bso=d(16729,null),Hso=d(16728,null),LLe={definitions:{inputs:{type:"array",description:d(16739,null),items:{oneOf:[{type:"object",required:["id","type","description"],additionalProperties:!1,properties:{id:{type:"string",description:LIi},type:{type:"string",description:RIi,enum:["promptString"],enumDescriptions:[d(16738,null)]},description:{type:"string",description:Bso},default:{type:"string",description:Hso},password:{type:"boolean",description:d(16732,null)}}},{type:"object",required:["id","type","description","options"],additionalProperties:!1,properties:{id:{type:"string",description:LIi},type:{type:"string",description:RIi,enum:["pickString"],enumDescriptions:[d(16737,null)]},description:{type:"string",description:Bso},default:{type:"string",description:Hso},options:{type:"array",description:d(16731,null),items:{oneOf:[{type:"string"},{type:"object",required:["value"],additionalProperties:!1,properties:{label:{type:"string",description:d(16733,null)},value:{type:"string",description:d(16734,null)}}}]}}}},{type:"object",required:["id","type","command"],additionalProperties:!1,properties:{id:{type:"string",description:LIi},type:{type:"string",description:RIi,enum:["command"],enumDescriptions:[d(16736,null)]},command:{type:"string",description:d(16727,null)},args:{oneOf:[{type:"object",description:d(16726,null)},{type:"array",description:d(16726,null)},{type:"string",description:d(16726,null)}]}}}]}}}};var B4o="onMcpCollection:",bJe=a=>B4o+a;var RLe=Object.keys({"claude-desktop":!0,windsurf:!0,"cursor-global":!0,"cursor-workspace":!0}),zso={"claude-desktop":d(11375,null),windsurf:d(11381,null),"cursor-global":d(11377,null),"cursor-workspace":d(11379,null)},Kso={"claude-desktop":d(11376,null),windsurf:d(11382,null),"cursor-global":d(11378,null),"cursor-workspace":d(11380,null)},FF="mcp",lZ="chat.mcp.discovery.enabled",SJe="chat.mcp.serverSampling",Gso={"mcp-server-time":{command:"python",args:["-m","mcp_server_time","--local-timezone=America/Los_Angeles"],env:{}}},Uso={"my-mcp-server":{url:"http://localhost:3001/mcp",headers:{}}},$so=a=>({dev:{type:"object",markdownDescription:d(11350,null),examples:[{watch:"src/**/*.ts",debug:{type:"node"}}],properties:{watch:{description:d(11355,null),examples:["src/**/*.ts"],oneOf:[{type:"string"},{type:"array",items:{type:"string"}}]},...a&&{debug:{markdownDescription:d(11351,null),oneOf:[{type:"object",required:["type"],properties:{type:{type:"string",enum:["node"],description:d(11353,null)}},additionalProperties:!1},{type:"object",required:["type"],properties:{type:{type:"string",enum:["debugpy"],description:d(11354,null)},debugpyPath:{type:"string",description:d(11352,null)}},additionalProperties:!1}]}}}}}),IJe={type:"object",additionalProperties:!1,examples:[Gso["mcp-server-time"]],properties:{type:{type:"string",enum:["stdio"],description:d(11371,null)},sandboxEnabled:{type:"boolean",default:!1,description:d(11369,null)},command:{type:"string",description:d(11358,null)},cwd:{type:"string",description:d(11359,null),examples:["${workspaceFolder}"]},args:{type:"array",description:d(11349,null),items:{type:"string"}},envFile:{type:"string",description:d(11357,null),examples:["${workspaceFolder}/.env"]},env:{description:d(11356,null),additionalProperties:{anyOf:[{type:"null"},{type:"string"},{type:"number"}]}},...$so(!0)}},qso={id:s_e,type:"object",title:d(11370,null),allowTrailingCommas:!0,allowComments:!0,additionalProperties:!1,properties:{sandbox:{description:d(11361,null),type:"object",additionalProperties:!1,properties:{network:{description:d(11366,null),type:"object",additionalProperties:!1,properties:{allowedDomains:{description:d(11367,null),type:"array",items:{type:"string"},default:[]},deniedDomains:{description:d(11368,null),type:"array",items:{type:"string"},default:[]}}},filesystem:{description:d(11362,null),type:"object",additionalProperties:!1,properties:{denyRead:{description:d(11364,null),type:"array",items:{type:"string"},default:[]},allowWrite:{description:d(11363,null),type:"array",items:{type:"string"},default:[]},denyWrite:{description:d(11365,null),type:"array",items:{type:"string"},default:[]}}}}},servers:{examples:[Gso,Uso],additionalProperties:{oneOf:[IJe,{type:"object",additionalProperties:!1,required:["url"],examples:[Uso["my-mcp-server"]],properties:{type:{type:"string",enum:["http","sse"],description:d(11371,null)},url:{type:"string",format:"uri",pattern:"^https?:\\/\\/.+",patternErrorMessage:d(11373,null),description:d(11372,null)},headers:{type:"object",description:d(11360,null),additionalProperties:{type:"string"}},...$so(!1)}}]}},inputs:LLe.definitions.inputs}},jso={extensionPoint:"mcpServerDefinitionProviders",activationEventsGenerator:function*(a){for(let i of a)i.id&&(yield bJe(i.id))},jsonSchema:{description:d(11385,null),type:"array",defaultSnippets:[{body:[{id:"",label:""}]}],items:{additionalProperties:!1,type:"object",defaultSnippets:[{body:{id:"",label:""}}],properties:{id:{description:d(11386,null),type:"string"},label:{description:d(11387,null),type:"string"},when:{description:d(11388,null),type:"string"}}}}},MIi=class extends C{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(11374,null),d(11384,null)],n=t.map(r=>[new xe().appendMarkdown(`\`${r.id}\``),r.label]);return{data:{headers:o,rows:n},dispose:()=>{}}}};oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:FF,label:d(11383,null),access:{canToggle:!1},renderer:new Mt(MIi)});var hpe=class extends C{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 jo(200));this.settingHighlighter=this._register(r.createInstance(wJe,e)),this.editSettingActionRenderer=this._register(this.instantiationService.createInstance(yJe,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(CJe,e,t)),this.mcpSettingsRenderer=this._register(r.createInstance(xJe,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?yU(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))}};hpe=I([m(2,Po),m(3,B),m(4,F)],hpe);var MLe=class extends hpe{constructor(i,e,t,o,n){super(i,e,t,o,n),this.workspaceConfigurationRenderer=this._register(n.createInstance(cZ,i,e))}render(){super.render(),this.workspaceConfigurationRenderer.render()}};MLe=I([m(2,Po),m(3,B),m(4,F)],MLe);var yJe=class extends C{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(pJe,e)),this.editPreferenceWidgetForMouseMove=this._register(this.instantiationService.createInstance(pJe,e)),this.toggleEditPreferencesForMouseMoveDelayer=this._register(new jo(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 IDe}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(12381,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(cpe))===-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){$t.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 $l(`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 Ie(t,1)),getActions:()=>n}),!0}toAbsoluteCoords(e){let t=this.editor.getScrolledVisiblePosition(e),o=Yn(this.editor.getDomNode()),n=o.left+t.left,r=o.top+t.top+t.height;return{x:n,y:r+10}}getConfigurationsMap(){return oe.as(ii.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(12387,null):d(12379,null),tooltip:t?d(12387,null):d(12379,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})}};yJe=I([m(3,B),m(4,F),m(5,ze)],yJe);var wJe=class extends C{constructor(e,t){super();this.editor=e;this.fixedHighlighter=this._register(t.createInstance(OF)),this.volatileHighlighter=this._register(t.createInstance(OF))}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()}};wJe=I([m(1,F)],wJe);var CJe=class extends C{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 jo(200));this.codeActions=new vt(e=>this.uriIdentityService.extUri.getComparisonKey(e));this._register(this.editor.getModel().onDidChangeContent(()=>this.delayedRender())),this._register(H.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=oe.as(ii.Configuration).getConfigurationProperties();for(let o of this.settingsEditorModel.settingsGroups)for(let n of o.sections)for(let r of n.settings){if(lg.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(12391,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(12395,null)}):o.push(this.generateUnknownConfigurationMarker(n))}}handleLocalUserConfiguration(e,t,o){!this.userDataProfileService.currentProfile.isDefault&&!this.userDataProfileService.currentProfile.useDefaultFlags?.settings&&(Xe(this.userDataProfilesService.defaultProfile.settingsResource,this.settingsEditorModel.uri)&&!this.configurationService.isSettingAppliedForAllProfiles(e.key)?o.push({severity:1,tags:[1],...e.range,message:d(12380,null)}):Xe(this.userDataProfileService.currentProfile.settingsResource,this.settingsEditorModel.uri)&&(t.scope&&AC.includes(t.scope)?o.push(this.generateUnsupportedApplicationSettingMarker(e)):this.configurationService.isSettingAppliedForAllProfiles(e.key)&&o.push({severity:1,tags:[1],...e.range,message:d(12378,null,IR)}))),this.environmentService.remoteAuthority&&(t.scope===2||t.scope===3||t.scope===7)&&o.push({severity:1,tags:[1],...e.range,message:d(12393,null)})}handleRemoteUserConfiguration(e,t,o){t.scope===1&&o.push(this.generateUnsupportedApplicationSettingMarker(e))}handleWorkspaceConfiguration(e,t,o){if(t.scope&&AC.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&&AC.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(12394,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(12389,null)}}generateUnsupportedMachineSettingMarker(e){return{severity:1,tags:[1],...e.range,message:d(12390,null)}}generateUntrustedSettingMarker(e){return{severity:4,...e.range,message:d(12396,null)}}generateUnknownConfigurationMarker(e){return{severity:1,tags:[1],...e.range,message:d(12388,null)}}generateUntrustedSettingCodeActions(e){return[{title:d(12382,null),command:{id:"workbench.trust.manage",title:d(12382,null)},diagnostics:e,kind:gr.QuickFix.value}]}generatePreviewSettingMarker(e){return{severity:1,...e.range,message:U0t}}generateExperimentalSettingMarker(e){return{severity:1,...e.range,message:z0t}}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()}};CJe=I([m(2,Ns),m(3,Vt),m(4,Lv),m(5,ns),m(6,dt),m(7,zt),m(8,mn),m(9,an)],CJe);var xJe=class extends C{constructor(e,t,o,n,r){super();this.editor=e;this.settingsEditorModel=t;this.markerService=o;this.uriIdentityService=n;this.renderingDelayer=this._register(new jo(200));this.codeActions=new vt(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===FF){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(12385,null):d(12386,null);return{severity:4,...e.range,message:o}}generateMcpConfigurationCodeActions(e){let t=this.settingsEditorModel.configurationTarget===4,o=t?d(12383,null):d(12384,null),n=t?"workbench.mcp.openRemoteUserMcpJson":"workbench.mcp.openUserMcpJson";return[{title:o,command:{id:n,title:o},diagnostics:e,kind:gr.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()}};xJe=I([m(2,Ns),m(3,dt),m(4,zt)],xJe);var cZ=class extends C{constructor(e,t,o,n){super();this.editor=e;this.workspaceSettingsEditorModel=t;this.workspaceContextService=o;this.markerService=n;this.renderingDelayer=this._register(new jo(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 Aue){let t=[];for(let o of this.workspaceSettingsEditorModel.configurationGroups)for(let n of o.sections)for(let r of n.settings)cZ.supportedKeys.includes(r.key)||e.push({severity:1,tags:[1],...r.range,message:d(12392,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_=po.register({description:"dim-configuration",stickiness:1,inlineClassName:"dim-configuration"})}createDecoration(e){return{range:e,options:cZ._DIM_CONFIGURATION_}}dispose(){this.markerService.remove("WorkspaceConfigurationRenderer",[this.workspaceSettingsEditorModel.uri]),this.decorations.clear(),super.dispose()}};cZ=I([m(2,Pe),m(3,Ns)],cZ);var H4o=["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 Qso(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 H4o){let o=i.get(t);o&&e.push(o)}return{id:"commonlyUsed",label:d(12470,null),settings:e}}var kJe={id:"root",label:"root",children:[{id:"editor",label:d(12507,null),settings:["editor.*"],children:[{id:"editor/cursor",label:d(12471,null),settings:["editor.cursor*"]},{id:"editor/find",label:d(12480,null),settings:["editor.find.*"]},{id:"editor/font",label:d(12481,null),settings:["editor.font*"]},{id:"editor/format",label:d(12482,null),settings:["editor.format*"]},{id:"editor/diffEditor",label:d(12473,null),settings:["diffEditor.*"]},{id:"editor/multiDiffEditor",label:d(12487,null),settings:["multiDiffEditor.*"]},{id:"editor/minimap",label:d(12486,null),settings:["editor.minimap.*"]},{id:"editor/suggestions",label:d(12502,null),settings:["editor.*suggest*"]},{id:"editor/files",label:d(12479,null),settings:["files.*"]}]},{id:"workbench",label:d(12511,null),settings:["workbench.*"],children:[{id:"workbench/appearance",label:d(12457,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(12459,null),settings:["breadcrumbs.*"]},{id:"workbench/editor",label:d(12474,null),settings:["workbench.editor.*"]},{id:"workbench/settings",label:d(12500,null),settings:["workbench.settings.*"]},{id:"workbench/zenmode",label:d(12513,null),settings:["zenmode.*"]},{id:"workbench/screencastmode",label:d(12497,null),settings:["screencastMode.*"]}]},{id:"window",label:d(12510,null),settings:["window.*"],children:[{id:"window/newWindow",label:d(12489,null),settings:["window.*newwindow*"]}]},{id:"chat",label:d(12460,null),children:[{id:"chat/agent",label:d(12461,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(12462,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(12467,null),settings:["chat.agentSessionProjection.*","chat.sessions.*","chat.viewProgressBadge.*","chat.viewSessions.*","chat.restoreLastPanelSession","chat.exitAfterDelegation","chat.repoInfo.*"]},{id:"chat/tools",label:d(12468,null),settings:["chat.tools.*","chat.extensionTools.*"]},{id:"chat/mcp",label:d(12465,null),settings:["mcp","chat.mcp.*","mcp.*"]},{id:"chat/context",label:d(12463,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(12464,null),settings:["inlineChat.*"]},{id:"chat/miscellaneous",label:d(12466,null),settings:["chat.disableAIFeatures","chat.allowAnonymousAccess"]}]},{id:"features",label:d(12477,null),children:[{id:"features/accessibilitySignals",label:d(12456,null),settings:["accessibility.signal*"]},{id:"features/accessibility",label:d(12455,null),settings:["accessibility.*"]},{id:"features/explorer",label:d(12478,null),settings:["explorer.*","outline.*"]},{id:"features/search",label:d(12498,null),settings:["search.*"]},{id:"features/debug",label:d(12472,null),settings:["debug.*","launch"]},{id:"features/testing",label:d(12506,null),settings:["testing.*"]},{id:"features/scm",label:d(12496,null),settings:["scm.*"]},{id:"features/extensions",label:d(12476,null),settings:["extensions.*"]},{id:"features/terminal",label:d(12505,null),settings:["terminal.*"]},{id:"features/task",label:d(12503,null),settings:["task.*"]},{id:"features/problems",label:d(12493,null),settings:["problems.*"]},{id:"features/output",label:d(12492,null),settings:["output.*"]},{id:"features/comments",label:d(12469,null),settings:["comments.*"]},{id:"features/remote",label:d(12495,null),settings:["remote.*"]},{id:"features/timeline",label:d(12508,null),settings:["timeline.*"]},{id:"features/notebook",label:d(12490,null),settings:["notebook.*","interactiveWindow.*"]},{id:"features/mergeEditor",label:d(12485,null),settings:["mergeEditor.*"]},{id:"features/issueReporter",label:d(12483,null),settings:["issueReporter.*"],hide:!Gt}]},{id:"application",label:d(12458,null),children:[{id:"application/http",label:d(12494,null),settings:["http.*"]},{id:"application/keyboard",label:d(12484,null),settings:["keyboard.*"]},{id:"application/update",label:d(12509,null),settings:["update.*"]},{id:"application/telemetry",label:d(12504,null),settings:["telemetry.*"]},{id:"application/settingsSync",label:d(12501,null),settings:["settingsSync.*"]},{id:"application/network",label:d(12488,null),settings:["network.*"]},{id:"application/experimental",label:d(12475,null),settings:["application.experimental.*"]},{id:"application/other",label:d(12491,null),settings:["application.*"],hide:ri}]},{id:"security",label:d(12499,null),settings:["security.*"],children:[{id:"security/workspace",label:d(12512,null),settings:["security.workspace.*"]}]}]};var PLe=class extends wp{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=El.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(12526,null),d(12527,null),`@${NK}`),new li,this.createAction("extSettingsSearch",d(12518,null),d(12519,null),`@${SLe}`,!0),this.createAction("featuresSettingsSearch",d(12520,null),d(12521,null),`@${hk}`,!0),this.createAction("tagSettingsSearch",d(12536,null),d(12537,null),`@${wso}`,!0),this.createAction("langSettingsSearch",d(12524,null),d(12525,null),`@${PF}`,!0),this.createAction("idSettingsSearch",d(12522,null),d(12523,null),`@${dJe}`,!1),new li,this.createToggleAction("onlineSettingsSearch",d(12528,null),d(12529,null),"@tag:usesOnlineServices"),this.createToggleAction("policySettingsSearch",d(12530,null),d(12531,null),`@${uB}`),new li,this.createMutuallyExclusiveToggleAction("stableSettingsSearch",d(12534,null),d(12535,null),"@stable",["@tag:preview","@tag:experimental"]),this.createMutuallyExclusiveToggleAction("previewSettingsSearch",d(12532,null),d(12533,null),"@tag:preview",["@stable","@tag:experimental"]),this.createMutuallyExclusiveToggleAction("experimentalSettingsSearch",d(12516,null),d(12517,null),"@tag:experimental",["@stable","@tag:preview"]),new li,this.createToggleAction("advancedSettingsSearch",d(12514,null),d(12515,null),`@tag:${I4}`)]}};PLe=I([m(4,ze)],PLe);var pB=_,Yso=new Set,PIi=[],gpe=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 P;this.focusedIndex=0;this.defaultHoverOptions={trapFocus:!0,style:1,position:{hoverPosition:2}};this.indicatorsContainerElement=R(i,pB(".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 Ii(n);if(r.equals(10)||r.equals(3)){let s=t(!0);s&&i.add(s),n.preventDefault()}}))}createWorkspaceTrustIndicator(){let i=new P,e=pB("span.setting-indicator.setting-item-workspace-trust"),t=i.add(new BC(e));t.text="$(shield) "+d(12454,null);let o=d(12450,null),n=r=>this.hoverService.showInstantHover({...this.defaultHoverOptions,content:o,target:e,actions:[{label:d(12436,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 P,e=pB("span.setting-item-overrides"),t=i.add(new BC(e));return{element:e,label:t,disposables:i}}createSyncIgnoredIndicator(){let i=new P,e=pB("span.setting-indicator.setting-item-ignored"),t=i.add(new BC(e));t.text=d(12434,null);let o=d(12449,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 P,e=pB("span.setting-indicator.setting-item-default-overridden"),t=i.add(new BC(e));return t.text=d(12431,null),{element:e,label:t,disposables:i}}createPreviewIndicator(){let i=new P,e=pB("span.setting-indicator.setting-item-preview"),t=i.add(new BC(e));return{element:e,label:t,disposables:i}}createAdvancedIndicator(){let i=new P,e=pB("span.setting-indicator.setting-item-preview"),t=i.add(new BC(e));t.text=d(12420,null);let o=n=>this.hoverService.showInstantHover({...this.defaultHoverOptions,content:kso,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++)R(this.indicatorsContainerElement,i[t].element)}let e=this.parenthesizedIndicators.filter(t=>t.element.style.display!=="none");if(e.length){this.indicatorsContainerElement.style.display="inline",R(this.indicatorsContainerElement,pB("span",void 0,"("));for(let t=0;t<e.length-1;t++)R(this.indicatorsContainerElement,e[t].element),R(this.indicatorsContainerElement,pB("span.comma",void 0," \u2022 "));R(this.indicatorsContainerElement,e[e.length-1].element),R(this.indicatorsContainerElement,pB("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 Ii(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(),PIi!==e&&(PIi=e,Yso=new Set(PIi))}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(12446,null):d(12433,null);let o=e?U0t:z0t,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(12451,null):e==="workspace"?d(12452,null):d(12447,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(12445,null);let o=d(12442,null),n=r=>this.hoverService.showInstantHover({...this.defaultHoverOptions,content:o,actions:[{label:d(12444,null),commandId:"_settings.action.viewPolicySettings",run:s=>{t.fire(`@${uB}`)}}],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(12424,null);let o=d(12425,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(12422,null):d(12428,null);this.scopeOverridesIndicator.label.text=`${o} `;let n=i.overriddenScopeList[0],r=R(this.scopeOverridesIndicator.element,pB("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 Ii(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(12421,null):d(12427,null);this.scopeOverridesIndicator.label.text=o;let n="";if(i.overriddenScopeList.length){n=i.isConfigured?d(12423,null):d(12439,null);for(let l of i.overriddenScopeList){let c=this.getInlineScopeDisplayText(l);n+=`
- `+oSt(c,Y0t.create(l).toString(),U4o(l,this.languageService))}}if(i.overriddenDefaultsLanguageList.length){n&&(n+=`

`);let s=d(12435,null);n+=s;for(let l of i.overriddenDefaultsLanguageList){let c=this.languageService.getLanguageName(l);n+=`
- `+oSt(c??l,Y0t.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]=Y0t.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=Xso(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(12440,null,e.slice(0,-1).join(", ")+" & "+e.slice(-1))):t=d(12429,null,e);let o=n=>this.hoverService.showInstantHover({content:new xe().appendMarkdown(t),target:this.defaultOverrideIndicator.element,style:1,position:{hoverPosition:2}},n);this.addHoverDisposables(this.defaultOverrideIndicator.disposables,this.defaultOverrideIndicator.element,o)}this.render()}};gpe=I([m(1,Lv),m(2,tt),m(3,_l),m(4,kt),m(5,ge)],gpe);function Xso(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 U4o(a,i){let[e,t]=a.split(":"),o=e==="user"?d(12451,null):e==="workspace"?d(12452,null):d(12447,null);return t?d(12437,null,o,i.getLanguageName(t)):o}function z4o(a,i){let[e,t]=a.split(":"),o=e==="user"?d(12451,null):e==="workspace"?d(12452,null):d(12447,null);return t?d(12438,null,o.toLowerCase(),i.getLanguageName(t)):o}function Jso(a,i,e,t){let o=[];if(a.tags?.has("preview")?o.push(d(12446,null)):a.tags?.has("experimental")&&o.push(d(12433,null)),a.tags?.has("advanced")&&o.push(d(12420,null)),a.isUntrusted&&o.push(d(12453,null)),a.hasPolicyValue)o.push(d(12443,null));else if(a.settingsTarget===3&&i.isSettingAppliedForAllProfiles(a.setting.key))o.push(d(12426,null));else{let l=a.isConfigured?d(12422,null):d(12428,null),c=a.overriddenScopeList.map(u=>z4o(u,t)).join(", ");a.overriddenScopeList.length&&o.push(`${l} ${c}`)}Yso.has(a.setting.key)&&o.push(d(12448,null));let n=Xso(a);if(n!==void 0){Array.isArray(n)&&n.length===1&&(n=n[0]);let l;Array.isArray(n)?l=d(12441,null,n.slice(0,-1).join(", ")+" & "+n.slice(-1)):l=d(12430,null,n),o.push(l)}let r=a.overriddenDefaultsLanguageList.map(l=>t.getLanguageName(l)).join(", ");if(a.overriddenDefaultsLanguageList.length){let l=d(12432,null,r);o.push(l)}return o.join(". ")}var Y0t;(e=>{function a(t){return A.from({scheme:Y.internal,path:"/",query:encodeURIComponent(t)})}e.create=a;function i(t){let o=A.parse(t);return decodeURIComponent(o.query)}e.parse=i})(Y0t||={});var EJe=class extends C{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()}},Gf=class extends EJe{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 vw&&this._childSettingKeys.add(t.setting.key)})}containsSetting(e){return this._childSettingKeys.has(e)}},ALe=class extends EJe{constructor(e,t){super(e);this.extensionIds=t}},vw=class a extends EJe{constructor(e,t,o,n,r,s,l,c,u){super(K4o(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=w4(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($4o(this.setting,this.productService))this.valueType="extension-toggle";else if(this.setting.enum&&(!this.setting.type||X4o(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(q4o(this.setting))this.valueType="exclude";else if(j4o(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=Y4o(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=AIi(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=oe.as(ii.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(NK),this.setting.tags?.forEach(h=>this.tags.add(h)),this.setting.restricted&&this.tags.add(ILe),this.hasPolicyValue&&this.tags.add(uB))}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?AC.includes(this.setting.scope):o===6?sJ.includes(this.setting.scope):o===5?a_e.includes(this.setting.scope):o===4?Sfi.includes(this.setting.scope)||vdi.includes(this.setting.key):o===3&&t?bfi.includes(this.setting.scope)||vdi.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=kJe.children.find(n=>n.id==="chat");if(o?.children&&o.children.flatMap(r=>r.settings??[]).map(r=>Zso(r)).some(r=>r.test(this.setting.key)))return!0}let t=kJe.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=>Zso(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 Zso(a){return a=Yr(a).replace(/\\\*/g,".*"),new RegExp(`^${a}$`,"i")}var fpe=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 Gf&&(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 Gf&&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 Gf(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 vw(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)}};fpe=I([m(2,Lv),m(3,kt),m(4,mn),m(5,nt)],fpe);function AIi(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 K4o(a){return a.replace(/[\.\/]/,"_")}function w4(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=G4o(o,i),o=CIi(o),e&&(a=gSe(a),a="$(bracket) "+a);let n=CIi(a);return{category:o,label:n}}function G4o(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 $4o(a,i){return yIi&&!!i.extensionRecommendations&&!!a.displayExtensionId}function q4o(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 j4o(a){return a.key==="files.readonlyInclude"}function J0t(a){return a==="workbench.editor.customLabels.patterns"}function X0t(a){return a==="string"||a==="boolean"||a==="integer"||a==="number"}function Q4o(a,i){let{type:e}=a;if(Array.isArray(e)){if(J0t(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(!X0t(t))return!1;return"complex"}if(X0t(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(!X0t(n))return!1;return"complex"}return X0t(o)?"complex":!1}}return!1}return!1}function Y4o({key:a,type:i,objectProperties:e,objectPatternProperties:t,objectAdditionalProperties:o}){if(i!=="object"||Jn(e)&&Jn(t)&&Jn(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=Q4o(l,a);if(c===!1)return!1;c==="complex"&&(r="complex")}return r}function X4o(a){let i=["string","boolean","null","integer","number"];return(Array.isArray(a)?a:[a]).every(t=>i.includes(t))}var vpe=class extends fpe{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||ape(t.setting.internalOrder,o.setting.internalOrder):t.matchType===2?o.score-t.score:ape(t.setting.internalOrder,o.setting.internalOrder)),Uo(e,t=>t.setting.key)):e.sort((t,o)=>ape(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 vw&&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=Uo(o),o.length){let n=new ALe("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}};vpe=I([m(3,Lv),m(4,Vt),m(5,kt),m(6,mn),m(7,nt)],vpe);var J4o=/(^|\s)@tag:("([^"]*)"|[^"]\S*)/g,Z4o=/(^|\s)@ext:("([^"]*)"|[^"]\S*)?/g,e3o=/(^|\s)@feature:("([^"]*)"|[^"]\S*)?/g,t3o=/(^|\s)@id:("([^"]*)"|[^"]\S*)?/g,i3o=/(^|\s)@lang:("([^"]*)"|[^"]\S*)?/g;function Z0t(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=>!Jl(v))),""})}let e=[];a=a.replace(J4o,(s,l,c,u)=>(e.push(u||c),"")),a=a.replace(`@${NK}`,()=>(e.push(NK),"")),a=a.replace(`@${uB}`,()=>(e.push(uB),"")),a=a.replace(/@stable/g,()=>(e.push("stable"),""));let t=[],o=[],n=[],r=[];return a=i(a,Z4o,t),a=i(a,e3o,o),a=i(a,t3o,n),F0t&&(a=i(a,i3o,r)),a=a.trim(),{tags:e,extensionFilters:t,featureFilters:o,idFilters:n,languageFilter:r.length?r[0]:void 0,query:a}}var xb=_,NIi=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}},bpe=class extends C{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 NIi(this.getEmptyItem());this.listDisposables=this._register(new P);this.onDidChangeList=this._onDidChangeList.event;this.listElement=R(e,xb("div")),this.listElement.setAttribute("role","list"),this.getContainerClasses().forEach(r=>this.listElement.classList.add(r)),R(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(Vo(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=ts(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=MSt({selectBackground:K0t,selectForeground:G0t,selectBorder:$0t,selectListBorder:q0t});return new aE(t,o,this.contextViewService,n,{useCustomDrawn:!HS(this.configurationService)||!(Nc&&og.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 ji(r);return this.listDisposables.add(s),s.push(this.getActionsForItem(e,t),{icon:!0,label:!0}),this.addTooltipsToRow(n,e),e.selected&&o&&nn(()=>r.focus(),void 0,this.listDisposables),this.listDisposables.add(j(r,"click",l=>{l.stopPropagation()})),r}renderAddButton(){let e=xb(".setting-list-new-row"),t=this._register(new Mi(e,Ko));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||Nh(e.target,"monaco-action-bar"))return-1;let o=Nh(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())}};bpe=I([m(1,De),m(2,_n),m(3,B)],bpe);var dZ=class extends bpe{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(cpe),enabled:!0,id:"workbench.action.editListItem",tooltip:this.getLocalizedStrings().editActionTooltip,run:()=>this.editSetting(t)},{class:q.asClassName(xIi),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=xb(".setting-list-row"),n=R(o,xb(".setting-list-value")),r=R(o,xb(".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},$N(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=xb(".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(Vo(f.inputElement,re.KEY_DOWN,u))}let p;Jn(e.sibling)?n instanceof Dc&&n.element.classList.add("no-sibling"):(p=new Dc(o,this.contextViewService,{placeholder:this.getLocalizedStrings().siblingInputPlaceholder,inputBoxStyles:c_({inputBackground:TLe,inputForeground:_Le,inputBorder:ZE})}),p.element.classList.add("setting-list-siblingInput"),this.listDisposables.add(p),p.value=e.sibling,this.listDisposables.add(Vo(p.inputElement,re.KEY_DOWN,u)));let h=this.listDisposables.add(new Mi(o,Ko));h.label=d(12581,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 Mi(o,{secondary:!0,...Ko}));return g.label=d(12558,null),g.element.classList.add("setting-list-cancel-button"),this.listDisposables.add(g.onDidClick(()=>this.cancelEdit())),this.listDisposables.add(nn(()=>{n.focus(),n instanceof Dc&&n.select()})),o}isItemNew(e){return e.value.data===""}addTooltipsToRow(e,{value:t,sibling:o}){let n=Jn(o)?d(12574,null,t.data):d(12572,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(12584,null),editActionTooltip:d(12561,null),addButtonLabel:d(12556,null),inputPlaceholder:d(12571,null),siblingInputPlaceholder:d(12573,null)}}renderInputBox(e,t){let o=new Dc(t,this.contextViewService,{placeholder:this.getLocalizedStrings().inputPlaceholder,inputBoxStyles:c_({inputBackground:TLe,inputForeground:_Le,inputBorder:ZE})});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=xb(".setting-list-object-list-row");return o.render(n),t.appendChild(n),o}};dZ=I([m(1,De),m(2,_n),m(3,tt),m(4,B)],dZ);var eWt=class extends dZ{getContainerClasses(){return["setting-list-include-exclude-widget"]}addDragAndDrop(i,e,t){}addTooltipsToRow(i,e){let t=Jn(e.sibling)?d(12563,null,e.value.data):d(12565,null,e.value.data,e.sibling);e.source&&(t+=d(12562,null,e.source));let o=new xe().appendMarkdown(t),{rowElement:n}=i;this.listDisposables.add(this.hoverService.setupDelayedHover(n,{content:o})),n.setAttribute("aria-label",t)}getLocalizedStrings(){return{deleteActionTooltip:d(12582,null),editActionTooltip:d(12559,null),addButtonLabel:d(12557,null),inputPlaceholder:d(12564,null),siblingInputPlaceholder:d(12566,null)}}},tWt=class extends dZ{getContainerClasses(){return["setting-list-include-exclude-widget"]}addDragAndDrop(i,e,t){}addTooltipsToRow(i,e){let t=Jn(e.sibling)?d(12567,null,e.value.data):d(12569,null,e.value.data,e.sibling);e.source&&(t+=d(12562,null,e.source));let o=new xe().appendMarkdown(t),{rowElement:n}=i;this.listDisposables.add(this.hoverService.setupDelayedHover(n,{content:o})),n.setAttribute("aria-label",t)}getLocalizedStrings(){return{deleteActionTooltip:d(12583,null),editActionTooltip:d(12560,null),addButtonLabel:d(12557,null),inputPlaceholder:d(12568,null),siblingInputPlaceholder:d(12570,null)}}},Spe=class extends bpe{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,mo(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(cpe),enabled:!0,id:"workbench.action.editListItem",label:"",tooltip:this.getLocalizedStrings().editActionTooltip,run:()=>this.editSetting(t)}];return e.resetable&&o.push({class:q.asClassName(Pso),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(xIi),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=xb(".setting-list-row-header"),t=R(e,xb(".setting-list-object-key")),o=R(e,xb(".setting-list-object-value")),{keyHeaderText:n,valueHeaderText:r}=this.getLocalizedStrings();return t.textContent=n,o.textContent=r,e}renderItem(e,t){let o=xb(".setting-list-row");o.classList.add("setting-list-object-row"),this.propertyNames&&e.key.data&&!Hno(this.propertyNames,e.key.data)&&o.classList.add("invalid-key");let n=R(o,xb(".setting-list-object-key")),r=R(o,xb(".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=xb(".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(mo(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=xb(".setting-list-object-key"),c.textContent=e.key.data;let u,p=xb(".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 Mi(o,Ko));g.enabled=n.key.data!=="",g.label=d(12581,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 Mi(o,{secondary:!0,...Ko}));return f.label=d(12558,null),f.element.classList.add("setting-list-cancel-button"),this.listDisposables.add(f.onDidClick(()=>this.cancelEdit())),this.listDisposables.add(nn(()=>{let v=l??u;v.focus(),v instanceof Dc&&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=xb(o?".setting-list-object-input-key":".setting-list-object-input-value"),c=new Dc(l,this.contextViewService,{placeholder:o?d(12576,null):d(12580,null),inputBoxStyles:c_({inputBackground:TLe,inputForeground:_Le,inputBorder:ZE})});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(Vo(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=xb(".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(12578,null,t.key.data,t.value.data,t.source):s=d(12577,null,t.key.data,t.value.data);let l=new xe().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(12584,null),resetActionTooltip:d(12585,null),editActionTooltip:d(12561,null),addButtonLabel:d(12556,null),keyHeaderText:d(12575,null),valueHeaderText:d(12579,null)}}};Spe=I([m(1,De),m(2,_n),m(3,tt),m(4,B)],Spe);var Ipe=class extends bpe{constructor(e,t,o,n,r){super(e,t,o,r);this.hoverService=n;this.currentSettingKey=""}setValue(e,t){mo(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=xb(".blank-row"),n=xb(".blank-row-key");return{rowElement:o,keyElement:n}}renderEdit(e,t){let o=xb(".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=R(o,xb(".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)),$t.stop(h)})),o}renderEditWidget(e,t,o){let n=new Kh({icon:M.check,actionClassName:"setting-value-checkbox",isChecked:e,title:t,...b7});this.listDisposables.add(n);let r=xb(".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(12577,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(12584,null),resetActionTooltip:d(12585,null),editActionTooltip:d(12561,null),addButtonLabel:d(12556,null),keyHeaderText:d(12575,null),valueHeaderText:d(12579,null)}}};Ipe=I([m(1,De),m(2,_n),m(3,tt),m(4,B)],Ipe);var _p=_,o3o=new Set(["accessibility.signals.chatUserActionRequired","accessibility.signals.chatResponseReceived"]);function n3o(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 r3o(a,i){let e=new Set(a);return i.forEach(({key:t})=>e.delete(t.data)),e.size===0}function _Je(a){if(a.anyOf)return a.anyOf.map(_Je).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 DJe(a){return a.anyOf?a.anyOf.map(DJe).some(e=>e==="enum")?"enum":"string":a.type==="boolean"?"boolean":a.type==="string"&&mo(a.enum)&&a.enum.length>0?"enum":"string"}function OIi(a,i,e){return a==="boolean"?{type:a,data:!!i}:a==="enum"?{type:a,data:""+i,options:e}:{type:a,data:""+i}}function nao(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(mo(o)&&c in o){let b=_Je(o[c]);return{key:{type:"enum",data:c,options:l},value:OIi(DJe(o[c]),t[c],b),keyDescription:o[c].description,removable:Jn(u),resetable:!Jn(u),source:p}}let h=u===void 0||J0t(a.setting.key),g=!!u&&u!==t[c],f=s.find(({pattern:b})=>b.test(c))?.schema;if(f){let b=_Je(f);return{key:{type:"string",data:c},value:OIi(DJe(f),t[c],b),keyDescription:f.description,removable:h,resetable:g,source:p}}let v=_Je(typeof r=="boolean"?{}:r??{});return{key:{type:"string",data:c},value:OIi(typeof r=="object"?DJe(r):"string",t[c],v),keyDescription:typeof r=="object"?r.description:void 0,removable:h,resetable:g,source:p}}).filter(c=>!Jn(c.value.data))}function s3o(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 a3o(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 l3o(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 c3o(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;mo(i)&&n in i&&(r=i[n]);let s=r??o.find(({pattern:l})=>l.test(n))?.schema;if(mo(s)?r=s:mo(t)&&typeof t=="object"&&(r=t),mo(r)){let l=DJe(r);if(l==="boolean")return{type:l,data:r.default??!0};if(l==="enum"){let c=_Je(r);return{type:l,data:r.default??c[0].value,options:c}}else return{type:l,data:r.default??""}}}}function iWt(a){return a==="number"||a==="integer"}function d3o(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=iWt(r[l].type);break}}if(o===void 0&&n){for(let l in n)if(t.match(l)){o=iWt(n[l].type);break}}o===void 0&&s&&typeof s!="boolean"&&iWt(s.type)&&(o=!0),e[t]=o?Number(i[t]):i[t]}return e}function u3o(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 p3o(a,i){return a.setting.enum&&a.setting.uniqueItems?a.setting.enum.length-i.length>0:!0}function rao(a,i,e,t){let o=uao(i);return{tree:lao(a,o,e,t),leftoverSettings:o}}function sao(a,i,e,t){return[...uao(a)].filter(n=>n.restricted&&AIi(n.key,i,e,t).isConfigured)}async function aao(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?dao(new Set(l),e):l;cao(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)=>ape(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(12545,null),children:s}})}function lao(a,i,e,t){let o;a.children&&(o=a.children.filter(r=>r.hide!==!0).map(r=>lao(r,i,e,t)).filter(r=>r.children?.length||r.settings?.length));let n;if((e||a.settings)&&(n=dao(i,{include:{keyPatterns:[...e?.include?.keyPatterns??[],...a.settings??[]],tags:e?.include?.tags?[...e.include.tags]:[]},exclude:e?.exclude??{}}),cao(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 cao(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=ape(n.order,r.order);return c!==0?c:n.key.localeCompare(r.key)})}function dao(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 iao(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 iao(t,r)})),!n&&i.exclude?.tags?.length&&(n=i.exclude.tags.some(r=>t.tags?.includes(r))),o&&!n&&(e.push(t),o3o.has(t.key)||a.delete(t))}),e}var tao=new Map;function m3o(a){return a=Yr(a).replace(/\\\*/g,".*"),new RegExp(`^${a}$`,"i")}function iao(a,i){let e=tao.get(i);return e||(e=m3o(i),tao.set(i,e)),e.test(a.key)}function uao(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 pao="settings.text.template",mao="settings.multilineText.template",hao="settings.number.template",gao="settings.enum.template",fao="settings.bool.template",vao="settings.array.template",bao="settings.exclude.template",Sao="settings.include.template",Iao="settings.object.template",yao="settings.boolObject.template",oWt="settings.complex.template",wao="settings.complexObject.template",Cao="settings.newExtensions.template",xao="settings.group.template",kao="settings.extensionToggle.template";function h3o(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(hd.ELEMENT_FOCUSABLE_ATTR,"true"),e.setAttribute("tabindex","-1")})}function g3o(a){a.querySelectorAll(`[${hd.ELEMENT_FOCUSABLE_ATTR}="true"]`).forEach(e=>{e.removeAttribute(hd.ELEMENT_FOCUSABLE_ATTR),e.setAttribute("tabindex","0")})}var hd=class extends C{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=uFt(WJ(),this._configService),this._register(this._configService.onDidChangeConfiguration(y=>{this.ignoredSettings=uFt(WJ(),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 P,r=R(t,_p(hd.CONTENTS_SELECTOR));r.classList.add("settings-row-inner-container");let s=R(r,_p(".setting-item-title")),l=R(s,_p(".setting-item-cat-label-container")),c=R(l,_p("span.setting-item-category")),u=R(l,_p("span.setting-item-label")),p=n.add(new BC(u)),h=n.add(this._instantiationService.createInstance(gpe,s)),g=R(r,_p(".setting-item-description")),f=R(r,_p(".setting-item-modified-indicator"));n.add(this._hoverService.setupDelayedHover(f,{content:d(12546,null)}));let v=R(r,_p(".setting-item-value")),b=R(v,_p("div.setting-item-control")),S=R(r,_p(".setting-item-deprecation-message")),y=R(r,_p(".setting-toolbar-container")),w=this.renderSettingToolbar(y),k={toDispose:n,elementDisposables:n.add(new P),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=Vn(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(12552,null),w0t);return new Ju(e,this._contextMenuService,{toggleMenuTitle:t,renderDropdownAsChildElement:!Nc,moreIcon:_so})}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=>Ac(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(hd.SETTING_KEY_ATTR,n.setting.key),o.containerElement.setAttribute(hd.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(IR)&&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(_p(".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?g3o(t.containerElement):h3o(t.containerElement)}renderSettingMarkdown(e,t,o,n){o=ZIi(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"),Eao(r.element),r.element}disposeTemplate(e){e.toDispose.dispose()}disposeElement(e,t,o){o.elementDisposables?.clear()}};hd=I([m(2,De),m(3,_n),m(4,Qe),m(5,F),m(6,ge),m(7,ze),m(8,_e),m(9,B),m(10,lt),m(11,zi),m(12,nt),m(13,Te),m(14,tt),m(15,Qn)],hd);var FIi=class{constructor(){this.templateId=xao}renderTemplate(i){return i.classList.add("group-title"),{parent:i,toDispose:new P}}renderElement(i,e,t){t.parent.innerText="";let o=R(t.parent,_p("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()}},TJe=class{constructor(i){this._commandService=i;this.templateId=Cao}renderTemplate(i){let e=new P;i.classList.add("setting-item-new-extensions");let t=new Mi(i,{title:!0,...Ko});e.add(t),e.add(t.onDidClick(()=>{o.context&&this._commandService.executeCommand("workbench.extensions.action.showExtensionsWithIds",o.context.extensionIds)})),t.label=d(12547,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()}};TJe=I([m(0,ge)],TJe);var nWt=class a extends hd{constructor(){super(...arguments);this.templateId=oWt}static{this.EDIT_IN_JSON_LABEL=d(12543,null)}renderTemplate(e){let t=this.renderCommonTemplate(null,e,"complex"),o=R(t.controlElement,_p("a.edit-in-settings-button"));o.classList.add(hd.CONTROL_CLASS),o.role="button";let n=_p(".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=gSe(e.setting.key),r=d(12544,null,n),s=e.setting.isLanguageTagSetting;t.button.textContent=s?r:a.EDIT_IN_JSON_LABEL;let l=c=>{s?this._onApplyFilter.fire(`@${PF}${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 Ii(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&&_bi(e.value,e.setting.type);if(o){t.containerElement.classList.add("invalid-input"),t.validationErrorMessageElement.innerText=o;return}t.containerElement.classList.remove("invalid-input")}},WIi=class extends nWt{constructor(){super(...arguments);this.templateId=wao}renderTemplate(e){let t=this.renderCommonTemplate(null,e,"list"),o=t.toDispose.add(this._instantiationService.createInstance(Spe,t.controlElement));o.domNode.classList.add(hd.CONTROL_CLASS);let n=R(R(t.controlElement,_p(".complex-object-edit-in-settings-button-container")),_p("a.complex-object.edit-in-settings-button"));n.classList.add(hd.CONTROL_CLASS),n.role="button";let r=_p(".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=nao(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)}},VIi=class extends hd{constructor(){super(...arguments);this.templateId=vao}renderTemplate(e){let t=this.renderCommonTemplate(null,e,"list"),o=t.containerElement.querySelector(".setting-item-description"),n=_p(".setting-item-validation-message");o.after(n);let r=this._instantiationService.createInstance(dZ,t.controlElement);r.domNode.classList.add(hd.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=u3o(e),r=e.setting.enum?a3o(e):void 0;t.listWidget.setValue(n,{showAddButton:p3o(e,n),keySuggester:r}),t.context=e,t.elementDisposables.add(Z(()=>{t.listWidget.cancelEdit()})),t.onChange=s=>{if(s&&!cWt(e,t,s,!1)){let l=e.setting.arrayItemType,c=iWt(l)?s.map(u=>+u):s;o(c)}else o(s)},cWt(e,t,n.map(s=>s.value.data.toString()),!0)}},rWt=class extends hd{renderTemplateWithWidget(i,e){e.domNode.classList.add(hd.CONTROL_CLASS),i.toDispose.add(e);let t=i.containerElement.querySelector(".setting-item-description"),o=_p(".setting-item-validation-message");t.after(o);let n={...i,validationErrorMessageElement:o};return e instanceof Ipe?n.objectCheckboxWidget=e:n.objectDropdownWidget=e,this.addSettingElementFocusHandler(n),n}renderElement(i,e,t){super.renderSettingElement(i,e,t)}},BIi=class extends rWt{constructor(){super(...arguments);this.templateId=Iao}renderTemplate(e){let t=this.renderCommonTemplate(null,e,"list"),o=this._instantiationService.createInstance(Spe,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=J0t(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||Jn(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=nao(e),{key:r,objectProperties:s,objectPatternProperties:l,objectAdditionalProperties:c,propertyNames:u}=e.setting;t.objectDropdownWidget.setValue(n,{settingKey:r,showAddButton:c===!1?!r3o(Object.keys(s??{}),n)||mo(l):!0,keySuggester:l3o(e),valueSuggester:c3o(e),propertyNames:u}),t.context=e,t.elementDisposables.add(Z(()=>{t.objectDropdownWidget.cancelEdit()})),t.onChange=p=>{if(p&&!cWt(e,t,p,!1)){let h=d3o(e,p);o(h)}else o(p)},cWt(e,t,e.value,!0)}},HIi=class extends rWt{constructor(){super(...arguments);this.templateId=yao}renderTemplate(e){let t=this.renderCommonTemplate(null,e,"list"),o=this._instantiationService.createInstance(Ipe,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=s3o(e),{key:r}=e.setting;t.objectCheckboxWidget.setValue(n,{settingKey:r}),t.context=e,t.onChange=s=>{o(s)}}},sWt=class extends hd{renderTemplate(i){let e=this.renderCommonTemplate(null,i,"list"),t=this._instantiationService.createInstance(this.isExclude()?eWt:tWt,e.controlElement);t.domNode.classList.add(hd.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=n3o(i);e.includeExcludeWidget.setValue(o,{isReadOnly:i.hasPolicyValue}),e.context=i,e.elementDisposables.add(Z(()=>{e.includeExcludeWidget.cancelEdit()}))}},UIi=class extends sWt{constructor(){super(...arguments);this.templateId=bao}isExclude(){return!0}},zIi=class extends sWt{constructor(){super(...arguments);this.templateId=Sao}isExclude(){return!1}},f3o=c_({inputBackground:TLe,inputForeground:_Le,inputBorder:ZE}),aWt=class extends hd{constructor(){super(...arguments);this.MULTILINE_MAX_HEIGHT=150}renderTemplate(e,t){let o=this.renderCommonTemplate(null,e,"text"),n=R(o.containerElement,_p(".setting-item-validation-message")),r={flexibleHeight:t,flexibleWidth:!1,flexibleMaxHeight:this.MULTILINE_MAX_HEIGHT,inputBoxStyles:f3o},s=new Dc(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(hd.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=>{lWt(e,t,!1)||o(n)},lWt(e,t,!0)}},KIi=class extends aWt{constructor(){super(...arguments);this.templateId=pao}renderTemplate(e){let t=super.renderTemplate(e,!1);return t.toDispose.add(Vo(t.inputBox.inputElement,re.KEY_DOWN,o=>{(o.equals(16)||o.equals(18))&&o.preventDefault()})),t}},GIi=class extends aWt{constructor(){super(...arguments);this.templateId=mao}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()}},$Ii=class extends hd{constructor(){super(...arguments);this.templateId=gao}renderTemplate(e){let t=this.renderCommonTemplate(null,e,"enum"),o=MSt({selectBackground:K0t,selectForeground:G0t,selectBorder:$0t,selectListBorder:q0t}),n=new aE([],0,this._contextViewService,o,{useCustomDrawn:!HS(this._configService)||!(Nc&&og.pointerEvents)});t.toDispose.add(n),n.render(t.controlElement);let r=t.controlElement.querySelector("select");r&&(r.classList.add(hd.CONTROL_CLASS),r.tabIndex=0),t.toDispose.add(n.onDidSelect(c=>{l.onChange?.(c.index)}));let s=t.containerElement.insertBefore(_p(".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 P;t.elementDisposables.add(c);let u=!1;s.includes(e.defaultValue)||(s.unshift(e.defaultValue),r.unshift(""),n.unshift(""),u=!0);let p=oao(String(e.defaultValue)),h=s.map(String).map(oao).map((f,v)=>{let b=r[v]&&(l?ZIi(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(12550,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=""}},v3o=c_({inputBackground:Fso,inputForeground:Wso,inputBorder:Vso}),qIi=class extends hd{constructor(){super(...arguments);this.templateId=hao}renderTemplate(e){let t=super.renderCommonTemplate(null,e,"number"),o=R(t.containerElement,_p(".setting-item-validation-message")),n=new Dc(t.controlElement,this._contextViewService,{type:"number",inputBoxStyles:v3o});t.toDispose.add(n),t.toDispose.add(n.onDidChange(s=>{r.onChange?.(s)})),t.toDispose.add(n),n.inputElement.classList.add(hd.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=>{lWt(e,t,!1)||o(r(s))},lWt(e,t,!0)}},jIi=class extends hd{constructor(){super(...arguments);this.templateId=fao}renderTemplate(e){e.classList.add("setting-item"),e.classList.add("setting-item-bool");let t=new P,o=R(e,_p(hd.CONTENTS_SELECTOR));o.classList.add("settings-row-inner-container");let n=R(o,_p(".setting-item-title")),r=R(n,_p("span.setting-item-category")),s=R(n,_p("span.setting-item-label")),l=t.add(new BC(s)),c=t.add(this._instantiationService.createInstance(gpe,n)),u=R(o,_p(".setting-item-value-description")),p=R(u,_p(".setting-item-bool-control")),h=R(u,_p(".setting-item-description")),g=R(o,_p(".setting-item-modified-indicator"));t.add(this._hoverService.setupDelayedHover(g,{content:d(12546,null)}));let f=R(o,_p(".setting-item-deprecation-message")),v=new Kh({icon:M.check,actionClassName:"setting-value-checkbox",isChecked:!0,title:"",...b7});p.appendChild(v.domNode),t.add(v),t.add(v.onChange(()=>{y.onChange(v.checked)})),v.domNode.classList.add(hd.CONTROL_CLASS);let b=R(o,_p(".setting-toolbar-container")),S=this.renderSettingToolbar(b);t.add(S);let y={toDispose:t,elementDisposables:t.add(new P),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)),$t.stop(n)}))),t.checkbox.setTitle(e.setting.key),t.onChange=o}},QIi=class extends hd{constructor(){super(...arguments);this.templateId=kao;this._onDidDismissExtensionSetting=this._register(new E);this.onDidDismissExtensionSetting=this._onDidDismissExtensionSetting.event}renderTemplate(e){let t=super.renderCommonTemplate(null,e,"extension-toggle"),o=new Mi(t.containerElement,{title:!1,...Ko});o.element.classList.add("setting-item-extension-toggle-button"),o.label=d(12553,null);let n=new Mi(t.containerElement,{title:!1,secondary:!0,...Ko});n.element.classList.add("setting-item-extension-dismiss-button"),n.label=d(12542,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)}))}},NLe=class extends C{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 st("settings.resetSetting",d(12548,null),void 0,void 0,async u=>{u instanceof vw&&(u.isUntrusted||this._onDidChangeSetting.fire({key:u.setting.key,value:void 0,type:u.setting.type,manualReset:!0,scope:u.setting.scope}))}),new li,this._instantiationService.createInstance(uZ),this._instantiationService.createInstance(pZ),this._instantiationService.createInstance(mZ)];let r=(u,p)=>this.getActionsForSetting(u,p),s=u=>[],l=this._instantiationService.createInstance(QIi,[],s),c=[this._instantiationService.createInstance(jIi,this.settingActions,r),this._instantiationService.createInstance(qIi,this.settingActions,r),this._instantiationService.createInstance(VIi,this.settingActions,r),this._instantiationService.createInstance(nWt,this.settingActions,r),this._instantiationService.createInstance(WIi,this.settingActions,r),this._instantiationService.createInstance(KIi,this.settingActions,r),this._instantiationService.createInstance(GIi,this.settingActions,r),this._instantiationService.createInstance(UIi,this.settingActions,r),this._instantiationService.createInstance(zIi,this.settingActions,r),this._instantiationService.createInstance($Ii,this.settingActions,r),this._instantiationService.createInstance(BIi,this.settingActions,r),this._instantiationService.createInstance(HIi,this.settingActions,r),l];this.onDidClickOverrideElement=H.any(...c.map(u=>u.onDidClickOverrideElement)),this.onDidChangeSetting=H.any(...c.map(u=>u.onDidChangeSetting),this._onDidChangeSetting.event),this.onDidDismissExtensionSetting=l.onDidDismissExtensionSetting,this.onDidOpenSettings=H.any(...c.map(u=>u.onDidOpenSettings)),this.onDidClickSettingLink=H.any(...c.map(u=>u.onDidClickSettingLink)),this.onDidFocusSetting=H.any(...c.map(u=>u.onDidFocusSetting)),this.onDidChangeSettingHeight=H.any(...c.map(u=>u.onDidChangeSettingHeight)),this.onApplyFilter=H.any(...c.map(u=>u.onApplyFilter)),this.allRenderers=[...c,this._instantiationService.createInstance(FIi),this._instantiationService.createInstance(TJe)]}getActionsForSetting(e,t){let o=[];return!(e.scope&&AC.includes(e.scope))&&t===3&&o.push(this._instantiationService.createInstance(gZ,e)),this._userDataSyncEnablementService.isEnabled()&&!e.disallowSyncIgnore&&o.push(this._instantiationService.createInstance(hZ,e)),o.length&&o.splice(0,0,new li),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=Nh(e,hd.CONTENTS_CLASS);return t||null}getDOMElementsForSettingKey(e,t){return e.querySelectorAll(`[${hd.SETTING_KEY_ATTR}="${t}"]`)}getKeyForDOMElementInSetting(e){let t=this.getSettingDOMElementForDOMElement(e);return t&&t.getAttribute(hd.SETTING_KEY_ATTR)}getIdForDOMElementInSetting(e){let t=this.getSettingDOMElementForDOMElement(e);return t&&t.getAttribute(hd.SETTING_ID_ATTR)}dispose(){super.dispose(),this.settingActions.forEach(e=>{Ac(e)&&e.dispose()}),this.allRenderers.forEach(e=>{Ac(e)&&e.dispose()})}};NLe=I([m(0,F),m(1,ze),m(2,_n),m(3,_l)],NLe);function lWt(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(12555,null);return i.inputBox.inputElement.parentElement.setAttribute("aria-label",[o,t].join(" ")),e||Or(o+" "+t),!0}else i.inputBox.inputElement.parentElement.removeAttribute("aria-label")}return i.containerElement.classList.remove("invalid-input"),!1}function cWt(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(12555,null);return i.containerElement.setAttribute("aria-label",[a.setting.key,n,o].join(" ")),t||Or(n+" "+o),!0}else i.containerElement.setAttribute("aria-label",a.setting.key),i.containerElement.classList.remove("invalid-input")}return!1}function Eao(a){for(let i=0;i<a.childNodes.length;i++){let e=a.childNodes.item(i);(e.tagName&&e.tagName.toLowerCase())==="img"?e.remove():Eao(e)}}function ZIi(a,i=!0){return a.replace(/`#([^#\s`]+)#`|'#([^#\s']+)#'/g,(e,t,o)=>{let n=t??o,r=w4(n),s=`${r.category}: ${r.label}`;return i?`[${s}](#${n} "${n}")`:`"${s}"`})}function oao(a){return a&&a.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}var ype=class{constructor(i,e,t){this.viewState=i;this.isFilteringGroups=e;this.environmentService=t}filter(i,e){if(this.viewState.categoryFilter&&i instanceof vw&&!this.settingContainedInGroup(i.setting,this.viewState.categoryFilter))return!1;if(i instanceof vw&&this.viewState.settingsTarget!==3){let t=!!this.environmentService.remoteAuthority;if(!i.matchesScope(this.viewState.settingsTarget,t))return!1}return i instanceof Gf?this.isFilteringGroups&&this.viewState.categoryFilter?this.groupIsRelatedToCategory(i,this.viewState.categoryFilter)?2:!1:typeof i.count=="number"?i.count>0:2:!(i instanceof ALe&&(this.viewState.tagFilters?.size||this.viewState.categoryFilter))}settingContainedInGroup(i,e){return e.children.some(t=>t instanceof Gf?this.settingContainedInGroup(i,t):t instanceof vw?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}};ype=I([m(2,Vt)],ype);var YIi=class extends d1{getTemplateId(i){if(i instanceof Gf)return xao;if(i instanceof vw)return i.valueType==="extension-toggle"?kao:i.isConfigured&&_bi(i.value,i.setting.type)?oWt:i.valueType==="boolean"?fao:i.valueType==="integer"||i.valueType==="number"||i.valueType==="nullable-integer"||i.valueType==="nullable-number"?hao:i.valueType==="multiline-string"?mao:i.valueType==="string"?pao:i.valueType==="enum"?gao:i.valueType==="array"?vao:i.valueType==="exclude"?bao:i.valueType==="include"?Sao:i.valueType==="object"?Iao:i.valueType==="boolean-object"?yao:i.valueType==="complex-object"?wao:(i.valueType==="language-tag",oWt);if(i instanceof ALe)return Cao;throw new Error("unknown element type: "+i)}hasDynamicHeight(i){return!(i instanceof Gf)}estimateHeight(i){return i instanceof Gf?42:i instanceof vw&&i.valueType==="boolean"?78:104}},XIi=class extends O1{isCollapsible(i){return!1}setCollapsed(i,e,t){return!1}},JIi=class{constructor(i,e,t){this.configurationService=i;this.languageService=e;this.userDataProfilesService=t}getAriaLabel(i){if(i instanceof vw){let e=[];if(e.push(`${i.displayCategory} ${i.displayLabel}.`),i.isConfigured){let n=d(12551,null);e.push(n)}let t=Jso(i,this.configurationService,this.userDataProfilesService,this.languageService);t.length&&e.push(`${t}.`);let o=qa({value:ZIi(i.description,!1)});return o.length&&e.push(o),e.join(" ")}else return i instanceof Gf?i.label:i.id}getWidgetAriaLabel(){return d(12549,null)}},OLe=class extends mg{constructor(i,e,t,o,n,r,s,l,c){super("SettingsTree",i,new YIi,t,{horizontalScrolling:!1,supportDynamicHeights:!0,scrollToActiveElement:!0,identityProvider:{getId(u){return u.id}},accessibilityProvider:new JIi(r,l,c),styleController:u=>new fae(hr(i),u),filter:s.createInstance(ype,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(GI({listBackground:qo,listActiveSelectionBackground:qo,listActiveSelectionForeground:ko,listFocusAndSelectionBackground:qo,listFocusAndSelectionForeground:ko,listFocusBackground:qo,listFocusForeground:ko,listHoverForeground:ko,listHoverBackground:qo,listHoverOutline:qo,listFocusOutline:qo,listInactiveSelectionBackground:qo,listInactiveSelectionForeground:ko,listInactiveFocusBackground:qo,listInactiveFocusOutline:qo,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 XIi(i,e)}};OLe=I([m(3,X),m(4,fo),m(5,Lv),m(6,F),m(7,kt),m(8,an)],OLe);var uZ=class extends st{constructor(e){super(uZ.ID,uZ.LABEL);this.clipboardService=e}static{this.ID="settings.copySettingId"}static{this.LABEL=d(12541,null)}async run(e){return e&&await this.clipboardService.writeText(e.setting.key),Promise.resolve(void 0)}};uZ=I([m(0,Wi)],uZ);var pZ=class extends st{constructor(e){super(pZ.ID,pZ.LABEL);this.clipboardService=e}static{this.ID="settings.copySettingAsJSON"}static{this.LABEL=d(12539,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)}};pZ=I([m(0,Wi)],pZ);var mZ=class extends st{constructor(e,t){super(mZ.ID,mZ.LABEL);this.clipboardService=e;this.productService=t}static{this.ID="settings.copySettingAsURL"}static{this.LABEL=d(12540,null)}async run(e){if(e){let t=e.setting.key,o=this.productService.urlProtocol,n=A.from({scheme:o,authority:AEe,path:`/${t}`},!0);await this.clipboardService.writeText(n.toString())}return Promise.resolve(void 0)}};mZ=I([m(0,Wi),m(1,nt)],mZ);var hZ=class extends st{constructor(e,t){super(hZ.ID,hZ.LABEL);this.setting=e;this.configService=t;this._register(H.filter(t.onDidChangeConfiguration,o=>o.affectsConfiguration("settingsSync.ignoredSettings"))(()=>this.update())),this.update()}static{this.ID="settings.stopSyncingSetting"}static{this.LABEL=d(12554,null)}async update(){let e=uFt(WJ(),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=WJ().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)}};hZ=I([m(1,B)],hZ);var gZ=class extends st{constructor(e,t){super(gZ.ID,gZ.LABEL);this.setting=e;this.configService=t;this._register(H.filter(t.onDidChangeConfiguration,o=>o.affectsConfiguration(IR))(()=>this.update())),this.update()}static{this.ID="settings.applyToAllProfiles"}static{this.LABEL=d(12538,null)}update(){let e=this.configService.getValue(IR);this.checked=e.includes(this.setting.key)}async run(){let e=this.configService.getValue(IR)??[];this.checked?e.splice(e.indexOf(this.setting.key),1):e.push(this.setting.key);let t=Uo(e);this.checked?(await this.configService.updateValue(this.setting.key,this.configService.inspect(this.setting.key).application?.value,3),await this.configService.updateValue(IR,t.length?t:void 0,3)):(await this.configService.updateValue(IR,t.length?t:void 0,3),await this.configService.updateValue(this.setting.key,this.configService.inspect(this.setting.key).userLocal?.value,3))}};gZ=I([m(1,Lv)],gZ);var Tao=_,FLe=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 Gf&&this.updateGroupCount(t)});let e=i.children.filter(t=>t instanceof Gf).reduce((t,o)=>t+o.count,0);i.count=e+this.getGroupCount(i)}getGroupCount(i){return i.children.filter(e=>{if(!(e instanceof vw)||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}};FLe=I([m(1,Vt)],FLe);var _ao="settings.toc.entry",eyi=class{constructor(i){this._hoverService=i;this.templateId=_ao}renderTemplate(i){return{labelElement:R(i,Tao(".settings-toc-entry")),countElement:R(i,Tao(".settings-toc-count")),elementDisposables:new P}}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()}},tyi=class{getTemplateId(i){return _ao}getHeight(i){return 22}};function oyi(a,i){let e=a.children.filter(t=>t instanceof Gf);return ht.map(e,t=>{let o=t.children.some(n=>n instanceof Gf);return{element:t,collapsed:void 0,collapsible:o,children:t instanceof Gf?oyi(t,i):void 0}})}var iyi=class{getWidgetAriaLabel(){return d(12587,null)}getAriaLabel(i){return i&&i instanceof Gf?d(12586,null,i.label):""}getAriaLevel(i){let e=1;for(;i instanceof Gf&&i.parent;)e++,i=i.parent;return e}},WLe=class extends mg{constructor(i,e,t,o,n,r,s){let c={filter:s.createInstance(ype,e,!1),multipleSelectionSupport:!1,identityProvider:{getId(u){return u.id}},styleController:u=>new fae(hr(i),u),accessibilityProvider:s.createInstance(iyi),collapseByDefault:!0,horizontalScrolling:!1,hideTwistiesOfChildlessElements:!0,renderIndentGuides:"none"};super("SettingsTOC",i,new tyi,[new eyi(r)],c,s,t,o,n),this.style(GI({listBackground:qo,listFocusOutline:Ad,listActiveSelectionBackground:qo,listActiveSelectionForeground:hJe,listFocusAndSelectionBackground:qo,listFocusAndSelectionForeground:hJe,listFocusBackground:qo,listFocusForeground:kIi,listHoverForeground:kIi,listHoverBackground:qo,listInactiveSelectionBackground:qo,listInactiveSelectionForeground:hJe,listInactiveFocusBackground:qo,listInactiveFocusOutline:qo,treeIndentGuidesStroke:void 0,treeInactiveIndentGuidesStroke:void 0}))}};WLe=I([m(2,X),m(3,fo),m(4,B),m(5,tt),m(6,F)],WLe);function Rao(a){return ht.map(a.children,i=>({element:i,children:i instanceof Gf?Rao(i):void 0}))}var eT=_,nyi=d(12414,null),Dao="workbench.settings.settingsSearchTocBehavior",b3o=d(12418,null),Lao=d(12417,null),S3o="settingsEditorState",td=class extends pa{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N,O,V,U){super(td.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=N;this.keybindingService=V;this.chatEntitlementService=U;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 jo(200)),this.viewState={settingsTarget:3},this.settingFastUpdateDelayer=this._register(new jo(td.SETTING_UPDATE_FAST_DEBOUNCE)),this.settingSlowUpdateDelayer=this._register(new jo(td.SETTING_UPDATE_SLOW_DEBOUNCE)),this.searchInputDelayer=this._register(new jo(td.SEARCH_DEBOUNCE)),this.updatedConfigSchemaDelayer=this._register(new jo(td.CONFIG_SCHEMA_UPDATE_DELAYER)),this.inSettingsEditorContextKey=lD.bindTo(p),this.searchFocusContextKey=rpe.bindTo(p),this.tocRowFocused=C0t.bindTo(p),this.settingRowFocused=cJe.bindTo(p),this.aiResultsAvailable=k0t.bindTo(p),this.scheduledRefreshes=new Map,this.stopWatch=new En(!1),this.editorMemento=this.getEditorMemento(g,n,S3o),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(Umi)&&this.onConfigUpdate(void 0,!0,!0),G.source!==7&&this.onConfigUpdate(G.affectedKeys)})),this._register(U.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 P),F0t&&!td.SUGGESTIONS.includes(`@${PF}`)&&td.SUGGESTIONS.push(`@${PF}`),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=[`@${NK}`,"@tag:notebookLayout","@tag:notebookOutputLayout",`@tag:${ILe}`,`@tag:${S4}`,"@tag:sync","@tag:usesOnlineServices","@tag:telemetry","@tag:accessibility","@tag:preview","@tag:experimental",`@tag:${I4}`,`@${dJe}`,`@${SLe}`,`@${hk}scm`,`@${hk}explorer`,`@${hk}search`,`@${hk}debug`,`@${hk}extensions`,`@${hk}terminal`,`@${hk}task`,`@${hk}problems`,`@${hk}output`,`@${hk}comments`,`@${hk}remote`,`@${hk}timeline`,`@${hk}notebook`,`@${hk}chat`,`@${uB}`]}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(Umi)??!1?!0:this.viewState.tagFilters?.has(I4)??!1}shouldShowSetting(e){return!!(!e.tags?.includes(I4)||this.viewState.idFilters?.has(e.key)||this.viewState.query?.toLowerCase().includes(e.key.toLowerCase())||this.viewState.tagFilters?.has(uB))}disableAiSearchToggle(){this.showAiResultsAction&&(this.showAiResultsAction.checked=!1,this.showAiResultsAction.enabled=!1,this.aiResultsAvailable.set(!1),this.showAiResultsAction.label=Lao)}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 td.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 vw)return this.settingRenderers.getDOMElementsForSettingKey(this.settingsTree.getHTMLElement(),e.setting.key)[0]}get currentFocusContext(){return this._currentFocusContext}createEditor(e){e.setAttribute("tabindex","-1"),this.rootElement=R(e,eT(".settings-editor",{tabindex:"-1"})),this.createHeader(this.rootElement),this.createBody(this.rootElement),this.addCtrlAInterceptor(this.rootElement),this.updateStyles(),this._register(zE({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 NJ))){if(this.modelDisposables.clear(),this.modelDisposables.add(r.onDidChangeGroups(()=>{this.updatedConfigSchemaDelayer.trigger(()=>{this.onConfigUpdate(void 0,!1,!0)})})),this.defaultSettingsEditorModel=r,t=t||MEe({}),!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&&!Nc&&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 ai(o,20)),this.rootElement.classList.toggle("narrow-width",e.width<td.NARROW_TOTAL_WIDTH)}focus(){if(super.focus(),this._currentFocusContext===0)Nc||this.focusSearch();else if(this._currentFocusContext===3){let e=this.focusedSettingDOMElement;if(e){let t=e.querySelector(hd.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 ${hd.CONTROL_SELECTOR}`);o&&o.focus()}}focusTOC(){this.tocTree.domFocus()}showContextMenu(){let e=this.settingsTree.getFocus()[0],t=this.focusedSettingDOMElement;t&&e instanceof vw&&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&&!td.SUGGESTIONS.some(n=>o.startsWith(n)));this.searchWidget.setValue(t.join(" "))}updateInputAriaLabel(){let e=nyi;this.searchResultLabel&&(e+=`. ${this.searchResultLabel}`),this.lastSyncedLabel&&(e+=`. ${this.lastSyncedLabel}`),this.searchWidget.updateAriaLabel(e)}createHeader(e){this.headerContainer=R(e,eT(".settings-header")),this.searchContainer=R(this.headerContainer,eT(".search-container"));let t=this._register(new st(I0t,d(12402,null),q.asClassName(wLe),!1,async()=>this.clearSearchResults())),o=["action-label",q.asClassName(Aso)];this.showAiResultsAction=this._register(new st(pso,Lao,o.join(" "),!0)),this._register(this.showAiResultsAction.onDidChange(async()=>{await this.onDidToggleAiSearch()}));let n=this._register(new st(mso,d(12404,null),q.asClassName(Nso)));this.searchWidget=this._register(this.instantiationService.createInstance(tA,`${td.ID}.searchbox`,this.searchContainer,{triggerCharacters:["@",":"],provideResults:h=>{let g=h.split(/\s/g);return g[g.length-1].startsWith(`@${PF}`)?this.languageService.getRegisteredLanguageIds().map(v=>`@${PF}${v} `).sort().filter(v=>!h.includes(v)):g[g.length-1].startsWith(`@${SLe}`)?this.installedExtensionIds.map(v=>`@${SLe}${v} `).sort().filter(v=>!h.includes(v)):h===""||g[g.length-1].startsWith("@")?td.SUGGESTIONS.filter(f=>!h.includes(f)).map(f=>f.endsWith(":")?f:f+" "):[]}},nyi,"settingseditor:searchinput"+td.NUM_INSTANCES++,{placeholderText:nyi,focusContextKey:this.searchFocusContextKey,styleOverrides:{inputBorder:ZE}})),this._register(this.searchWidget.onDidFocus(()=>{this._currentFocusContext=0})),this._register(this.searchWidget.onInputDidChange(()=>{let h=this.searchWidget.getValue();t.enabled=!!h,this.searchInputDelayer.trigger(()=>this.onSearchInputChanged(!0))}));let r=R(this.headerContainer,eT(".settings-header-controls"));r.style.borderColor=wt(Oso);let s=R(r,eT(".settings-target-container"));this.settingsTargetsWidget=this._register(this.instantiationService.createInstance(CLe,s,{enableRemoteSettings:!0})),this.settingsTargetsWidget.settingsTarget=3,this._register(this.settingsTargetsWidget.onDidTargetChange(h=>this.onDidSettingsTargetChange(h))),this._register(j(s,re.KEY_DOWN,h=>{new Ii(h).keyCode===18&&this.focusSettings()}));let l=R(r,eT(".settings-right-controls")),c=R(l,eT(".open-settings-json")),u=this._register(new Mi(c,{secondary:!0,title:!0,...Ko}));if(u.label=d(12413,null),this._register(u.onDidClick(()=>this.openSettingsFile())),this.userDataSyncWorkbenchService.enabled&&this.userDataSyncEnablementService.canToggleEnablement()){let h=this._register(this.instantiationService.createInstance(LJe,this.window,l));this._register(h.onDidChangeLastSyncedLabel(g=>{this.lastSyncedLabel=g,this.updateInputAriaLabel()}))}this.controlsElement=R(this.searchContainer,_(".search-container-widgets")),this.countElement=R(this.controlsElement,_(".settings-count-widget.monaco-count-badge.long")),this.searchInputActionBar=this._register(new ji(this.controlsElement,{actionViewItemProvider:(h,g)=>{if(h.id===n.id)return this.instantiationService.createInstance(PLe,h,g,this.actionRunner,this.searchWidget);if(this.showAiResultsAction&&h.id===this.showAiResultsAction.id){let f=this.keybindingService.lookupKeybinding(y0t)?.getLabel();return new Gae(null,h,{...g,keybinding:f,toggleStyles:qg})}}}));let p=[t,n];this.searchInputActionBar.push(p,{label:!1,icon:!0}),this.disableAiSearchToggle(),this.updateAiSearchToggleVisibility()}toggleAiSearch(){this.searchInputActionBar&&this.showAiResultsAction&&this.searchInputActionBar.hasAction(this.showAiResultsAction)&&(this.showAiResultsAction.enabled||Or(d(12408,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(hd.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=Z0t(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=oe.as(ii.Configuration).getConfigurationProperties()[e?.revealSetting.key]?.scope;if(r&&AC.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=R(e,eT(".settings-body")),this.noResultsMessage=R(this.bodyContainer,eT(".no-results-message")),this.noResultsMessage.innerText=d(12409,null),this.clearFilterLinkContainer=eT("span.clear-search-filters"),this.clearFilterLinkContainer.textContent=" - ";let t=R(this.clearFilterLinkContainer,eT("a.pointer.prominent",{tabindex:0},d(12403,null)));this._register(j(t,re.CLICK,r=>{$t.stop(r,!1),this.clearSearchFilters()})),R(this.noResultsMessage,this.clearFilterLinkContainer),this.noResultsMessage.style.color=wt(od),this.tocTreeContainer=eT(".settings-toc-container"),this.settingsTreeContainer=eT(".settings-tree-container"),this.createTOC(this.tocTreeContainer),this.createSettingsTree(this.settingsTreeContainer),this.splitView=this._register(new vu(this.bodyContainer,{orientation:1,proportionalLayout:!0}));let o=this.storageService.getNumber("settingsEditor2.splitViewWidth",0,td.TOC_RESET_WIDTH);this.splitView.addView({onDidChange:H.None,element:this.tocTreeContainer,minimumSize:td.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:H.None,element:this.settingsTreeContainer,minimumSize:td.EDITOR_MIN_WIDTH,maximumSize:Number.POSITIVE_INFINITY,layout:(r,s,l)=>{this.settingsTreeContainer.style.width=`${r}px`,this.settingsTree.layout(l,r)}},Wl.Distribute,void 0,!0),this._register(this.splitView.onDidSashReset(()=>{let r=this.splitView.getViewSize(0)+this.splitView.getViewSize(1);this.splitView.resizeView(0,td.TOC_RESET_WIDTH),this.splitView.resizeView(1,r-td.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(gJe);this.splitView.style({separatorBorder:n})}addCtrlAInterceptor(e){this._register(Vo(e,re.KEY_DOWN,t=>{t.keyCode===31&&(it?t.metaKey:t.ctrlKey)&&!Oh(t.target)&&(t.browserEvent.stopPropagation(),t.browserEvent.preventDefault())}))}createTOC(e){this.tocTreeModel=this.instantiationService.createInstance(FLe,this.viewState),this.tocTree=this._register(this.instantiationService.createInstance(WLe,R(e,eT(".settings-toc-wrapper",{role:"navigation","aria-label":d(12415,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(`@${PF}`)){let t=this.searchWidget.getValue().split(" ").filter(o=>!o.startsWith(`@${PF}`)).join(" ");this.focusSearch(t,!1)}}createSettingsTree(e){this.settingRenderers=this._register(this.instantiationService.createInstance(NLe)),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(`@${PF}${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(`@${dJe}${t.settingKey}`)})),this.settingsTree=this._register(this.instantiationService.createInstance(OLe,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=Z0t(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},td.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(`@${NK}`)&&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(NK),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||(Ue(this.scheduledRefreshes.values()),this.scheduledRefreshes.clear());let o=new P,n=Vn(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:[I4]}},c=rao(kJe,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 xso(this.chatEntitlementService,this.extensionGalleryService,this.productService);if(g&&n.filter(b=>b.extensionInfo).length)for(let b in g.settingsEditorRecommendedExtensions){let S=g.recommendedExtensionsGalleryInfo[b];if(!S)continue;let y=S.identifier.id;await this.refreshInstalledExtensionsList();let w=this.installedExtensionIds.includes(y),k=n.findIndex(pe=>pe.extensionInfo&&pe.extensionInfo.id.toLowerCase()===y.toLowerCase()&&pe.sections.length===1&&pe.sections[0].settings.length===1&&pe.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 Wp(this.extensionGalleryService.getManifest(S,ve.None),wIi)??null}catch{continue}if(T===null)continue;let N=T?.contributes?.configuration,O;Array.isArray(N)?N.length===1&&(O=N[0].title):O=N?.title;let V=g.settingsEditorRecommendedExtensions[b],U=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??U,categoryLabel:"Extensions",title:U},te={sections:[{settings:[$]}],id:y,title:$.extensionGroupTitle,titleRange:wg,range:wg,extensionInfo:{id:y,displayName:S.displayName}};n.push(te),p.push(te),h=!0}if(u.children.push(await aao(this.extensionService,s,l)),u.children.unshift(Qso(n)),g&&h&&this.defaultSettingsEditorModel.setAdditionalGroups(p),!this.workspaceTrustManagementService.isWorkspaceTrusted()&&(this.viewState.settingsTarget instanceof A||this.viewState.settingsTarget===5)){let b=sao(n,this.viewState.settingsTarget,this.viewState.languageFilter,this.configurationService);b.length&&u.children.unshift({id:"workspaceTrust",label:d(12416,null),settings:b})}this.searchResultModel?.updateChildren();let f=this.settingsTree.firstVisibleElement,v;if(f instanceof vw?v=f.setting.key:f instanceof Gf&&(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 N of T.children)if(N instanceof Gf){let O=w([N]);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(fpe,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 Gf&&(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&&ts(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(hd.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!!Nh(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,Rao(this.currentSettingsModel.root))}refreshTOCTree(){this.isVisible()&&(this.tocTreeModel.update(),this.tocTree.setChildren(null,oyi(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(Dao)==="hide"?(this.splitView.setViewVisible(0,!1),this.splitView.style({separatorBorder:Oe.transparent})):this.layoutSplitView(this.dimension)}async triggerSearch(e,t){let o=this.editorProgressService.show(!0,800),n=this.viewState.tagFilters?.has(I4);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=Z0t(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(I4)&&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(vpe,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:Cso});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 $e;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=xn(s=>this.doAiSearch(e,s).then(l=>{l&&this.showAiResultsAction&&(this.showAiResultsAction.enabled=!0,this.aiResultsAvailable.set(!0),this.showAiResultsAction.label=b3o,this.renderResultCountMessages(!0))}).catch(l=>{so(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,W0t,t)}doRemoteSearch(e,t){let o=this.preferencesSearchService.getRemoteSearchProvider(e);return o?this.searchWithProvider(1,o,V0t,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,B0t,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;this.stopWatch.reset();let n=await o.getLLMRankedResults(t);if(this.stopWatch.stop(),t.isCancellationRequested)return null;if(n&&n.filterMatches.length>0){let r=this.stopWatch.elapsed();this.logSearchPerformance(H0t,r)}return this.searchResultModel.setResult(4,n),n}async searchWithProvider(e,t,o,n){this.stopWatch.reset();let r=await this._searchPreferencesModel(this.defaultSettingsEditorModel,t,n);if(this.stopWatch.stop(),n.isCancellationRequested)return null;if(r&&!this.canShowAdvancedSettings()&&(r.filterMatches=r.filterMatches.filter(s=>this.shouldShowSetting(s.setting))),r&&r.filterMatches.length>0){let s=this.stopWatch.elapsed();this.logSearchPerformance(o,s)}return this.searchResultModel??=this.instantiationService.createInstance(vpe,this.viewState,this.settingsOrderByTocIndex,this.workspaceTrustManagementService.isWorkspaceTrusted()),this.searchResultModel.setResult(e,r),r}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(12410,null);break;case 1:o=d(12412,null);break;default:o=d(12407,null,t)}else switch(t){case 0:o=d(12409,null);break;case 1:o=d(12411,null);break;default:o=d(12406,null,t)}this.searchResultLabel=o,this.updateInputAriaLabel(),this.countElement.innerText=o,Or(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 so(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(Dao)==="hide"&&this.searchResultModel)){let r=this.splitView.isViewVisible(0),s=this.bodyContainer.clientWidth>=td.NARROW_TOTAL_WIDTH;this.splitView.setViewVisible(0,s),!r&&s&&this.bodyContainer.clientWidth>=td.EDITOR_MIN_WIDTH+td.TOC_RESET_WIDTH&&this.splitView.resizeView(0,td.TOC_RESET_WIDTH),this.splitView.style({separatorBorder:s?this.theme.getColor(gJe):Oe.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()}};td=I([m(1,Te),m(2,Lv),m(3,Nn),m(4,De),m(5,Po),m(6,F),m(7,S0t),m(8,ne),m(9,X),m(10,le),m(11,Et),m(12,lI),m(13,_l),m(14,ns),m(15,lt),m(16,kt),m(17,ls),m(18,nt),m(19,ta),m(20,rd),m(21,mn),m(22,_e),m(23,vr)],td);var LJe=class extends C{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=R(t,eT(".turn-on-sync"));this.turnOnSyncButton=this._register(new Mi(l,{title:!0,...Ko})),this.lastSyncedLabel=R(t,eT(".last-synced-label")),xo(this.lastSyncedLabel),this.turnOnSyncButton.enabled=!0,this.turnOnSyncButton.label=d(12419,null),xo(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 ZD).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=Bs(e,!0,void 0,!0);t=d(12405,null,o)}else t="";this.lastSyncedLabel.textContent=t,this._onDidChangeLastSyncedLabel.fire(t)}update(){this.userDataSyncService.status!=="uninitialized"&&(this.userDataSyncEnablementService.isEnabled()||this.userDataSyncService.status!=="idle"?(bn(this.lastSyncedLabel),xo(this.turnOnSyncButton.element)):(xo(this.lastSyncedLabel),bn(this.turnOnSyncButton.element)))}};LJe=I([m(2,ge),m(3,aI),m(4,_l),m(5,Te)],LJe);var I3o="settings.action.search",y3o="settings.action.focusSettingsFile",w3o="settings.action.focusSettingsFromSearch",C3o="settings.action.focusSettingsList",x3o="settings.action.focusTOC",k3o="settings.action.focusSettingControl",E3o="settings.action.focusLevelUp",T3o="settings.switchToJSON",_3o="settings.filterByOnline",D3o="settings.filterUntrusted",L3o="workbench.action.openSettings",R3o="settings.filterByTelemetry";oe.as(rn.EditorPane).registerEditorPane(ys.create(td,td.ID,d(12355,null)),[new Mt(oD)]);oe.as(rn.EditorPane).registerEditorPane(ys.create(y4,y4.ID,d(12344,null)),[new Mt(AJ)]);var syi=class{canSerialize(i){return!0}serialize(i){return""}deserialize(i){return i.createInstance(AJ)}};oe.as(rn.EditorPane).registerEditorPane(ys.create(xh,xh.ID,d(12320,null)),[new Mt(iD)]);var ayi=class{canSerialize(i){return!0}serialize(i){return""}deserialize(i){return i.createInstance(iD)}},lyi=class{canSerialize(i){return!0}serialize(i){return""}deserialize(i){return i.createInstance(oD)}};oe.as(rn.EditorFactory).registerEditorSerializer(AJ.ID,syi);oe.as(rn.EditorFactory).registerEditorSerializer(iD.ID,ayi);oe.as(rn.EditorFactory).registerEditorSerializer(oD.ID,lyi);var cyi=L(12338,"Open Settings (UI)"),M3o=L(12340,"Open User Settings (JSON)"),P3o=L(12327,"Open Application Settings (JSON)"),my=We.Preferences;function ryi(a){return Da(a)?a:void 0}function A3o(a){return Ae(a)?a:void 0}function WF(a){yi(a)||(a={});let i={focusSearch:ryi(a?.focusSearch),openToSide:ryi(a?.openToSide),query:A3o(a?.query)};return Ae(a?.revealSetting?.key)&&(i={...i,revealSetting:{key:a.revealSetting.key,edit:ryi(a.revealSetting?.edit)}}),i}var VLe=class extends C{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:L3o,title:{...L(12345,"Settings"),mnemonicTitle:d(12323,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}:WF(o);return t.get(Po).openSettings({...n})}})),this._register(W(class extends K{constructor(){super({id:"workbench.action.openSettings2",title:L(12338,"Open Settings (UI)"),category:my,f1:!0})}run(t,o){return o=WF(o),t.get(Po).openSettings({jsonEditor:!1,...o})}})),this._register(W(class extends K{constructor(){super({id:"workbench.action.openSettingsJson",title:M3o,metadata:{description:L(12359,"Opens the JSON file containing the current user profile settings")},category:my,f1:!0})}run(t,o){return o=WF(o),t.get(Po).openSettings({jsonEditor:!0,...o})}}));let e=this;this._register(W(class extends K{constructor(){super({id:"workbench.action.openApplicationSettingsJson",title:P3o,category:my,menu:{id:D.CommandPalette,when:x.notEquals(I9e.key,e.userDataProfilesService.defaultProfile.id)}})}run(t,o){return o=WF(o),t.get(Po).openApplicationSettings({jsonEditor:!0,...o})}})),this._register(W(class extends K{constructor(){super({id:"workbench.action.openGlobalSettings",title:L(12334,"Open User Settings"),category:my,f1:!0})}run(t,o){return o=WF(o),t.get(Po).openUserSettings(o)}})),this._register(W(class extends K{constructor(){super({id:"workbench.action.openRawDefaultSettings",title:L(12335,"Open Default Settings (JSON)"),category:my,f1:!0})}run(t){return t.get(Po).openRawDefaultSettings()}})),this._register(W(class extends K{constructor(){super({id:FK.ID,title:FK.LABEL,category:my,f1:!0})}run(t){return t.get(F).createInstance(FK,FK.ID,FK.LABEL.value).run()}})),this._register(W(class extends K{constructor(){super({id:"workbench.action.openWorkspaceSettings",title:L(12341,"Open Workspace Settings"),category:my,menu:{id:D.CommandPalette,when:Qa.notEqualsTo("empty")}})}run(t,o){return o=typeof o=="string"?{query:o}:WF(o),t.get(Po).openWorkspaceSettings(o)}})),this._register(W(class extends K{constructor(){super({id:"workbench.action.openAccessibilitySettings",title:L(12326,"Open Accessibility Settings"),category:my,menu:{id:D.CommandPalette,when:Qa.notEqualsTo("empty")}})}async run(t){await t.get(Po).openSettings({jsonEditor:!1,query:"@tag:accessibility"})}})),this._register(W(class extends K{constructor(){super({id:"workbench.action.openWorkspaceSettingsFile",title:L(12342,"Open Workspace Settings (JSON)"),category:my,menu:{id:D.CommandPalette,when:Qa.notEqualsTo("empty")}})}run(t,o){return o=WF(o),t.get(Po).openWorkspaceSettings({jsonEditor:!0,...o})}})),this._register(W(class extends K{constructor(){super({id:"workbench.action.openFolderSettings",title:L(12329,"Open Folder Settings"),category:my,menu:{id:D.CommandPalette,when:Qa.isEqualTo("workspace")}})}async run(t,o){let n=t.get(ge),r=t.get(Po),s=await n.executeCommand(SR);s&&(o=WF(o),await r.openFolderSettings({folderUri:s.uri,...o}))}})),this._register(W(class extends K{constructor(){super({id:"workbench.action.openFolderSettingsFile",title:L(12331,"Open Folder Settings (JSON)"),category:my,menu:{id:D.CommandPalette,when:Qa.isEqualTo("workspace")}})}async run(t,o){let n=t.get(ge),r=t.get(Po),s=await n.executeCommand(SR);s&&(o=WF(o),await r.openFolderSettings({folderUri:s.uri,jsonEditor:!0,...o}))}})),this._register(W(class extends K{constructor(){super({id:"_workbench.action.openFolderSettings",title:d(12330,null),category:my,menu:{id:D.ExplorerContext,group:"2_workspace",order:20,when:x.and(FC,lu)}})}async run(t,o){if(A.isUri(o))await t.get(Po).openFolderSettings({folderUri:o});else{let n=t.get(ge),r=t.get(Po),s=await n.executeCommand(SR);s&&await r.openFolderSettings({folderUri:s.uri})}}})),this._register(W(class extends K{constructor(){super({id:_3o,title:d(12322,null),menu:{id:D.MenubarPreferencesMenu,group:"3_settings",order:1}})}run(t){let o=t.get(ee).activeEditorPane;o instanceof td?o.focusSearch("@tag:usesOnlineServices"):t.get(Po).openSettings({jsonEditor:!1,query:"@tag:usesOnlineServices"})}})),this._register(W(class extends K{constructor(){super({id:y0t,precondition:lD,keybinding:{primary:2087,weight:100,when:k0t},category:my,f1:!0,title:L(12354,"Toggle AI Settings Search")})}run(t){let o=t.get(ee).activeEditorPane;o instanceof td&&o.toggleAiSearch()}})),this._register(W(class extends K{constructor(){super({id:D3o,title:L(12319,"Show untrusted workspace settings")})}run(t){t.get(Po).openWorkspaceSettings({jsonEditor:!1,query:`@tag:${ILe}`})}})),this._register(W(class extends K{constructor(){super({id:R3o,title:d(12324,null)})}run(t){let o=t.get(ee).activeEditorPane;o instanceof td?o.focusSearch("@tag:telemetry"):t.get(Po).openSettings({jsonEditor:!1,query:"@tag:telemetry"})}})),this.registerSettingsEditorActions(),this.extensionService.whenInstalledExtensionsRegistered().then(()=>{let t=this.environmentService.remoteAuthority,o=this.labelService.getHostLabel(Y.vscodeRemote,t)||t;this._register(W(class extends K{constructor(){super({id:"workbench.action.openRemoteSettings",title:L(12336,"Open Remote Settings ({0})",o),category:my,menu:{id:D.CommandPalette,when:ub.notEqualsTo("")}})}run(n,r){return r=WF(r),n.get(Po).openRemoteSettings(r)}})),this._register(W(class extends K{constructor(){super({id:"workbench.action.openRemoteSettingsFile",title:L(12337,"Open Remote Settings (JSON) ({0})",o),category:my,menu:{id:D.CommandPalette,when:ub.notEqualsTo("")}})}run(n,r){return r=WF(r),n.get(Po).openRemoteSettings({jsonEditor:!0,...r})}}))})}registerSettingsEditorActions(){function e(o){let n=o.get(ee).activeEditorPane;return n instanceof td?n:null}function t(o){e(o)?.focusSearch()}this._register(W(class extends K{constructor(){super({id:I3o,precondition:lD,keybinding:{primary:2084,weight:100,when:null},category:my,f1:!0,title:L(12349,"Focus Settings Search")})}run(o){t(o)}})),this._register(W(class extends K{constructor(){super({id:I0t,precondition:lD,keybinding:{primary:9,weight:100,when:rpe},category:my,f1:!0,title:L(12346,"Clear Settings Search Results")})}run(o){e(o)?.clearSearchResults()}})),this._register(W(class extends K{constructor(){super({id:y3o,precondition:x.and(rpe,$n.Visible.toNegated()),keybinding:{primary:18,weight:100,when:null},title:d(12347,null)})}run(o){e(o)?.focusSettings()}})),this._register(W(class extends K{constructor(){super({id:w3o,precondition:x.and(rpe,$n.Visible.toNegated()),keybinding:{primary:18,weight:200,when:null},title:d(12347,null)})}run(o){e(o)?.focusSettings()}})),this._register(W(class extends K{constructor(){super({id:C3o,precondition:x.and(lD,C0t),keybinding:{primary:3,weight:200,when:null},title:d(12351,null)})}run(o){let n=e(o);n instanceof td&&n.focusSettings()}})),this._register(W(class extends K{constructor(){super({id:x3o,precondition:lD,f1:!0,keybinding:[{primary:15,weight:200,when:cJe}],category:my,title:L(12352,"Focus Settings Table of Contents")})}run(o){let n=e(o);n instanceof td&&n.focusTOC()}})),this._register(W(class extends K{constructor(){super({id:k3o,precondition:x.and(lD,cJe),keybinding:{primary:3,weight:200},title:d(12350,null)})}run(o){let n=e(o);if(!(n instanceof td))return;n.getContainer()?.ownerDocument.activeElement?.classList.contains("monaco-list")&&n.focusSettings(!0)}})),this._register(W(class extends K{constructor(){super({id:w0t,precondition:lD,keybinding:{primary:1091,weight:200,when:null},f1:!0,category:my,title:L(12353,"Show Setting Context Menu")})}run(o){let n=e(o);n instanceof td&&n.showContextMenu()}})),this._register(W(class extends K{constructor(){super({id:E3o,precondition:x.and(lD,rpe.toNegated(),IIi.toNegated()),keybinding:{primary:9,weight:200,when:null},f1:!0,category:my,title:L(12348,"Move Focus Up One Level")})}run(o){let n=e(o);n instanceof td&&(n.currentFocusContext===3?n.focusSettings():n.currentFocusContext===2?n.focusTOC():n.currentFocusContext===1&&n.focusSearch())}}))}registerKeybindingsActions(){let e=this,t=L(12343,"Preferences"),o="workbench.action.openGlobalKeybindings";this._register(W(class extends K{constructor(){super({id:o,title:L(12332,"Open Keyboard Shortcuts"),shortTitle:d(12321,null),category:t,icon:dpe,keybinding:{when:null,weight:200,primary:Ai(2089,2097)},menu:[{id:D.CommandPalette},{id:D.EditorTitle,when:Fo.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=fZ(n,r)?.id;return n.get(Po).openGlobalKeybindingSettings(!1,{query:s,groupId:l})}})),this._register(fe.appendMenuItem(D.MenubarPreferencesMenu,{command:{id:o,title:d(12321,null)},group:"2_configuration",order:4})),this._register(W(class extends K{constructor(){super({id:"workbench.action.openDefaultKeybindingsFile",title:L(12328,"Open Default Keyboard Shortcuts (JSON)"),category:t,menu:{id:D.CommandPalette}})}run(n){return n.get(Po).openDefaultKeybindingsFile()}})),this._register(W(class extends K{constructor(){super({id:"workbench.action.openGlobalKeybindingsFile",title:L(12333,"Open Keyboard Shortcuts (JSON)"),category:t,icon:dpe,menu:[{id:D.CommandPalette},{id:D.EditorTitle,when:x.and(nf),group:"navigation"}]})}run(n,...r){let s=fZ(n,r)?.id;return n.get(Po).openGlobalKeybindingSettings(!0,{groupId:s})}})),this._register(W(class extends K{constructor(){super({id:Sso,title:L(12356,"Show System Keybindings"),menu:[{id:D.EditorTitle,when:x.and(nf),group:"1_keyboard_preferences_actions"}]})}run(n,...r){let l=fZ(n,r)?.activeEditorPane;l instanceof xh&&l.search("@source:system")}})),this._register(W(class extends K{constructor(){super({id:yso,title:L(12357,"Show Extension Keybindings"),menu:[{id:D.EditorTitle,when:x.and(nf),group:"1_keyboard_preferences_actions"}]})}run(n,...r){let l=fZ(n,r)?.activeEditorPane;l instanceof xh&&l.search("@source:extension")}})),this._register(W(class extends K{constructor(){super({id:Iso,title:L(12358,"Show User Keybindings"),menu:[{id:D.EditorTitle,when:x.and(nf),group:"1_keyboard_preferences_actions"}]})}run(n,...r){let l=fZ(n,r)?.activeEditorPane;l instanceof xh&&l.search("@source:user")}})),this._register(W(class extends K{constructor(){super({id:E0t,title:d(12316,null),keybinding:{weight:200,when:x.and(nf,vLe,x0t),primary:9}})}run(n){let r=n.get(ee).activeEditorPane;r instanceof xh&&r.clearSearchResults()}})),this._register(W(class extends K{constructor(){super({id:gso,title:d(12317,null),category:t,menu:[{id:D.CommandPalette,when:x.and(nf)}]})}run(n){let r=n.get(ee).activeEditorPane;r instanceof xh&&r.clearKeyboardShortcutSearchHistory()}})),this.registerKeybindingEditorActions()}registerKeybindingEditorActions(){let e=this;yt.registerCommandAndKeybindingRule({id:bLe,weight:200,when:x.and(nf,MF,spe.toNegated()),primary:3,handler:(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof xh&&s.defineKeybinding(s.activeKeybindingEntry,!1)}}),yt.registerCommandAndKeybindingRule({id:D0t,weight:200,when:x.and(nf,MF),primary:Ai(2089,2079),handler:(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof xh&&s.defineKeybinding(s.activeKeybindingEntry,!0)}}),yt.registerCommandAndKeybindingRule({id:L0t,weight:200,when:x.and(nf,MF),primary:Ai(2089,2083),handler:(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof xh&&s.activeKeybindingEntry.keybindingItem.keybinding&&s.defineWhenExpression(s.activeKeybindingEntry)}}),yt.registerCommandAndKeybindingRule({id:R0t,weight:200,when:x.and(nf,MF,$h.toNegated()),primary:20,mac:{primary:2049},handler:(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof xh&&s.removeKeybinding(s.activeKeybindingEntry)}}),yt.registerCommandAndKeybindingRule({id:M0t,weight:200,when:x.and(nf,MF),primary:0,handler:(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof xh&&s.resetKeybinding(s.activeKeybindingEntry)}}),yt.registerCommandAndKeybindingRule({id:hso,weight:200,when:x.and(nf),primary:2084,handler:(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof xh&&s.focusSearch()}}),yt.registerCommandAndKeybindingRule({id:T0t,weight:200,when:x.and(nf,vLe),primary:553,mac:{primary:2601},handler:(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof xh&&s.recordSearchKeys()}}),yt.registerCommandAndKeybindingRule({id:_0t,weight:200,when:x.and(nf),primary:558,mac:{primary:2606},handler:(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof xh&&s.toggleSortByPrecedence()}}),yt.registerCommandAndKeybindingRule({id:O0t,weight:200,when:x.and(nf,MF),primary:0,handler:(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof xh&&s.showSimilarKeybindings(s.activeKeybindingEntry)}}),yt.registerCommandAndKeybindingRule({id:P0t,weight:200,when:x.and(nf,MF,spe.negate()),primary:2081,handler:async(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof xh&&await s.copyKeybinding(s.activeKeybindingEntry)}}),yt.registerCommandAndKeybindingRule({id:A0t,weight:200,when:x.and(nf,MF),primary:0,handler:async(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof xh&&await s.copyKeybindingCommand(s.activeKeybindingEntry)}}),yt.registerCommandAndKeybindingRule({id:N0t,weight:200,when:x.and(nf,MF),primary:0,handler:async(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof xh&&await s.copyKeybindingCommandTitle(s.activeKeybindingEntry)}}),yt.registerCommandAndKeybindingRule({id:bso,weight:200,when:x.and(nf,vLe),primary:2066,handler:(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof xh&&s.focusKeybindings()}}),yt.registerCommandAndKeybindingRule({id:vso,weight:200,when:x.and(nf,spe,$n.Visible.toNegated()),primary:9,handler:async(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof xh&&s.rejectWhenExpression(s.activeKeybindingEntry)}}),yt.registerCommandAndKeybindingRule({id:fso,weight:200,when:x.and(nf,spe,$n.Visible.toNegated()),primary:3,handler:async(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof xh&&s.acceptWhenExpression(s.activeKeybindingEntry)}});let t=this._register(new P),o=()=>{t.clear(),t.add(W(class extends K{constructor(){let r=Fo.Resource.isEqualTo(e.userDataProfileService.currentProfile.keybindingsResource.toString());super({id:"editor.action.defineKeybinding",title:L(12318,"Define Keybinding"),f1:!0,precondition:r,keybinding:{weight:200,when:r,primary:Ai(2089,2089)},menu:{id:D.EditorContent,when:r}})}async run(r){let s=r.get(ee).activeTextEditorControl;pn(s)&&s.getContribution(qLt)?.showDefineKeybindingWidget()}}))};o(),this._register(this.userDataProfileService.onDidChangeCurrentProfile(()=>o()))}updatePreferencesEditorMenuItem(){let e="_workbench.openWorkspaceSettingsEditor";this.workspaceContextService.getWorkbenchState()===3&&!qe.getCommand(e)&&(qe.registerCommand(e,()=>this.preferencesService.openWorkspaceSettings({jsonEditor:!1})),fe.appendMenuItem(D.EditorTitle,{command:{id:e,title:cyi,icon:dpe},when:x.and(Fo.Resource.isEqualTo(this.preferencesService.workspaceSettingsResource.toString()),Qa.isEqualTo("workspace"),x.not("isInDiffEditor")),group:"navigation",order:1})),this.updatePreferencesEditorMenuItemForWorkspaceFolders()}updatePreferencesEditorMenuItemForWorkspaceFolders(){for(let e of this.workspaceContextService.getWorkspace().folders){let t=`_workbench.openFolderSettings.${e.uri.toString()}`;qe.getCommand(t)||(qe.registerCommand(t,(o,...n)=>{let r=fZ(o,n)?.id;return this.workspaceContextService.getWorkbenchState()===2?this.preferencesService.openWorkspaceSettings({jsonEditor:!1,groupId:r}):this.preferencesService.openFolderSettings({folderUri:e.uri,jsonEditor:!1,groupId:r})}),fe.appendMenuItem(D.EditorTitle,{command:{id:t,title:cyi,icon:dpe},when:x.and(Fo.Resource.isEqualTo(this.preferencesService.getFolderSettingsResource(e.uri).toString()),x.not("isInDiffEditor")),group:"navigation",order:1}))}}};VLe=I([m(0,Vt),m(1,mn),m(2,Po),m(3,Pe),m(4,ot),m(5,lt),m(6,an)],VLe);var BLe=class extends C{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=x.and(lD.toNegated(),x.or(Fo.Resource.isEqualTo(this.userDataProfileService.currentProfile.settingsResource.toString()),Fo.Resource.isEqualTo(this.userDataProfilesService.defaultProfile.settingsResource.toString())),x.not("isInDiffEditor"));e.clear(),e.value=W(class extends K{constructor(){super({id:"_workbench.openUserSettingsEditor",title:cyi,icon:dpe,menu:[{id:D.EditorTitle,when:n,group:"navigation",order:1}]})}run(r,...s){let l=WF(s[0]),c=fZ(r,s)?.id;return r.get(Po).openUserSettings({jsonEditor:!1,...l,groupId:c})}})};t(),this._register(this.userDataProfileService.onDidChangeCurrentProfile(()=>{t()}));let o=x.and(IIi.toNegated(),lD);this._register(W(class extends K{constructor(){super({id:T3o,title:L(12339,"Open Settings (JSON)"),icon:dpe,menu:[{id:D.EditorTitle,when:o,group:"navigation",order:1}]})}run(n,...r){let l=fZ(n,r)?.activeEditorPane;return l instanceof td?l.switchToSettingsFile():null}}))}};BLe=I([m(0,mn),m(1,an)],BLe);var HLe=class extends C{constructor(e,t,o,n){super();this.editor=e;this.instantiationService=t;this.preferencesService=o;this.workspaceContextService=n;this.disposables=this._register(new P);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 Pue&&this.editor.getModel()&&(this.disposables.add(t),t.configurationTarget===5?this.currentRenderer=this.disposables.add(this.instantiationService.createInstance(MLe,this.editor,t)):this.currentRenderer=this.disposables.add(this.instantiationService.createInstance(hpe,this.editor,t))),this.currentRenderer?.render()}}};HLe=I([m(1,F),m(2,Po),m(3,Pe)],HLe);function fZ(a,i){return lp(i,a.get(ee),a.get(Et),a.get(fo)).groupedEditors[0]?.group}pt(VLe.ID,VLe,ut.BlockStartup);pt(lpe.ID,lpe,ut.BlockStartup);pt(BLe.ID,BLe,ut.AfterRestored);go(HLe.ID,HLe,1);fe.appendMenuItem(D.MenubarFileMenu,{title:d(12325,null),submenu:D.MenubarPreferencesMenu,group:"5_autosave",order:2,when:Mx.toNegated()});var dWt=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 Ie(r,e-t+1);t=l}return new Ie(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=$le(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 Ie(h,i.getLineMaxColumn(h)),prepend:`
[`,append:"]"}}};var vZ=class extends Ibe{constructor(i,e){if(super(),e.length===0)throw Br("chords");this._os=i,this._chords=e}getLabel(){return YN.toLabel(this._os,this._chords,i=>this._getLabel(i))}getAriaLabel(){return _St.toLabel(this._os,this._chords,i=>this._getAriaLabel(i))}getElectronAccelerator(){return this._chords.length>1||this._chords[0].isDuplicateModifierCase()?null:v4i.toLabel(this._os,this._chords,i=>this._getElectronAccelerator(i))}getUserSettingsLabel(){return Xye.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 rpt(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 N3o=!1;function O3o(a){N3o&&console.info(a)}var bZ=class extends vZ{constructor(i,e){super(1,e),this._mapper=i}_getLabel(i){return i.isDuplicateModifierCase()?"":this._mapper.getUILabelForKeyCode(i.keyCode)}_getUSLabelForKeybinding(i){return i.isDuplicateModifierCase()?"":vp.toString(i.keyCode)}getUSLabel(){return YN.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+=vp.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+"  "}},uWt=class{constructor(i,e,t){this._isUSStandard=i;this._mapAltGrToCtrlAlt=t;this._keyCodeToLabel=[];this._scanCodeToKeyCode=[],this._keyCodeToLabel=[],this._keyCodeExists=[],this._keyCodeToLabel[0]=vp.toString(0);for(let s=0;s<193;s++){let l=Dy[s];l!==-1&&(this._scanCodeToKeyCode[s]=l,this._keyCodeToLabel[l]=vp.toString(l),this._keyCodeExists[l]=!0)}let o=[],n=!1;this._codeInfo=[];for(let s in e)if(e.hasOwnProperty(s)){let l=Bb.toEnum(s);if(l===0){O3o(`Unknown scanCode ${s} in mapping.`);continue}let c=e[s],u=Dy[l];if(u!==-1){let S=opt[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=opt[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(Dy[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=Bb.toString(o),s=[0,2,5,7];for(let l of s){let c=!!(l&1),u=!!(l&2),p=!!(l&4),h=new KD(c,u,p,!1,o),g=this._resolveChord(h),f=g?vp.toString(g.keyCode):null,v=g?new bZ(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=bZ.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?vp.toUserSettingsUS(i):vp.toUserSettingsGeneral(i)}getElectronAcceleratorForKeyBinding(i){return vp.toElectronAccelerator(i.keyCode)}_getLabelForKeyCode(i){return this._keyCodeToLabel[i]||vp.toString(0)}resolveKeyboardEvent(i){let e=i.ctrlKey||this._mapAltGrToCtrlAlt&&i.altGraphKey,t=i.altKey||this._mapAltGrToCtrlAlt&&i.altGraphKey,o=new Hb(e,i.shiftKey,t,i.metaKey,i.keyCode);return new bZ(this,[o])}_resolveChord(i){if(!i)return null;if(i instanceof Hb)return this._keyCodeExists[i.keyCode]?i:null;let e=this._scanCodeToKeyCode[i.scanCode]||0;return e===0||!this._keyCodeExists[e]?null:new Hb(i.ctrlKey,i.shiftKey,i.altKey,i.metaKey,e)}resolveKeybinding(i){let e=fDe(i.chords.map(t=>this._resolveChord(t)));return e.length>0?[new bZ(this,e)]:[]}};var F3o=d(12309,null),RJe=class extends C{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(iZ,this._editor)),this._register(this._editor.onDidChangeModel(n=>this._update())),this._update()}_update(){this._keybindingDecorationRenderer.value=Mao(this._editor,this._userDataProfileService)?this._instantiationService.createInstance(wpe,this._editor):void 0}showDefineKeybindingWidget(){Mao(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=dWt.insertSnippet(this._editor.getModel(),this._editor.getPosition());n=r.prepend+n+r.append,this._editor.setPosition(r.position),Qr.get(this._editor)?.insert(n,{overwriteBefore:0,overwriteAfter:0})}}};RJe=I([m(1,F),m(2,mn)],RJe);var wpe=class extends C{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=Oi(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=Oi(this._editor.getModel()),t=[],o=zL(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 bZ&&(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"&&!wpe._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=SF.parseKeybinding(e),n=SF.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 xe().appendText(F3o),l="keybindingError",c=Ss(NIe)):(o&&t!==o?s=new xe(d(12310,null,t,o)):s=new xe(d(12311,null,t)),l="keybindingInfo",c=Ss(w9));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}}}}};wpe=I([m(1,_e)],wpe);function Mao(a,i){let e=a.getModel();return e?Xe(e.uri,i.currentProfile.keybindingsResource):!1}go(qLt,RJe,1);function W3o(a){let i=new Map;for(let e of a)i.set(e,(i.get(e)??0)+1);return i}var ULe=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 W3o(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 Pao(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 MJe=class extends C{constructor(e,t){super();this.instantiationService=e;this.configurationService=t}getLocalSearchProvider(e){return this.instantiationService.createInstance(PJe,e)}get remoteSearchAllowed(){return this.configurationService.getValue().workbench.settings.enableNaturalLanguageSearch}getRemoteSearchProvider(e){if(this.remoteSearchAllowed)return this._remoteSearchProvider??=this.instantiationService.createInstance(myi),this._remoteSearchProvider.setFilter(e),this._remoteSearchProvider}getAiSearchProvider(e){if(this.remoteSearchAllowed)return this._aiSearchProvider??=this.instantiationService.createInstance(AJe),this._aiSearchProvider.setFilter(e),this._aiSearchProvider}};MJe=I([m(0,F),m(1,B)],MJe);function hyi(a){return a.replace(/[":]/g," ").replace(/  /g," ").trim()}var PJe=class{constructor(i,e){this._filter=i;this.configurationService=e;this._filter=hyi(this._filter)}searchModel(i,e){if(!this._filter)return Promise.resolve(null);let t=l=>{let{matches:c,matchType:u,keyMatchScore:p}=new dyi(this._filter,l,!0,this.configurationService);return u===0||c.length===0?null:(mr(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&Aeo)),r=9,s=o.filter(l=>l.matchType&n||l.matchType&r||l.matchType===256).map(l=>({...l,providerName:W0t}));return Promise.resolve({filterMatches:s,exactMatch:s.some(l=>l.matchType===256)})}getGroupFilter(i){let e=u$(i,!1,{global:!0});return t=>t.id!=="defaultOverrides"&&e.test(t.title)}};PJe=I([m(1,B)],PJe);var dyi=class{constructor(i,e,t,o){this.searchDescription=t;this.configurationService=o;this.matchType=0;this.keyMatchScore=0;this.matches=Uo(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=Gy(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=SW(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=Gy(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=Xqe(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=z9(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=SW(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=SW(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}}},pWt=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}},uyi=class a{constructor(i){this._aiSettingsSearchService=i;this._filter="";this._recordProvider=new pWt}static{this.EMBEDDINGS_SETTINGS_SEARCH_MAX_PICKS=10}setFilter(i){this._filter=hyi(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=B0t;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}},pyi=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=hyi(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 ULe;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:V0t})}return e}},myi=class{constructor(){this._filter="";this._tfIdfSearchProvider=new pyi}setFilter(i){this._filter=i,this._tfIdfSearchProvider.setFilter(i)}async searchModel(i,e){return this._filter?await this._tfIdfSearchProvider.searchModel(i,e):null}},AJe=class{constructor(i){this.aiSettingsSearchService=i;this._filter="";this._embeddingsSearchProvider=new uyi(this.aiSettingsSearchService),this._recordProvider=new pWt}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:H0t});return t}};AJe=I([m(0,dEe)],AJe);we(S0t,MJe,1);var Aao="transientWordWrapState",fyi="isWordWrapMinified",vyi="isDominatedByLongLines",Nao=new Q("canToggleWordWrap",!1,!0),Oao=new Q("editorWordWrap",!1,d(8349,null));function iA(a,i,e){e.setTransientModelProperty(a,Aao,i)}function SZ(a,i){return i.getTransientModelProperty(a,Aao)}var mWt="editor.action.toggleWordWrap",gyi=class extends xi{constructor(){super({id:mWt,label:L(8351,"View: Toggle Word Wrap"),precondition:void 0,kbOpts:{kbExpr:null,primary:568,weight:100}})}run(i,e){let t=i.get(Kt),o=i.get(F);if(!$Le(t,e))return;let n=e.getModel(),r=SZ(n,t),s;r?s=null:s={wordWrapOverride:e.getOption(166).wrappingColumn===-1?"on":"off"},iA(n,s,t);let l=o.invokeFunction(JSt,e);if(l){let c=l.getOriginalEditor(),u=l.getModifiedEditor(),p=c===e?u:c;$Le(t,p)&&(iA(p.getModel(),s,t),l.updateOptions({}))}}},zLe=class extends C{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(fyi,r.isWordWrapMinified),l=this._contextKeyService.createKey(vyi,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(!$Le(this._codeEditorService,this._editor))return;let p=SZ(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})}};zLe=I([m(1,X),m(2,Kt)],zLe);var KLe=class extends C{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=SZ(e.getModel(),this._codeEditorService),n=SZ(t.getModel(),this._codeEditorService);o&&!n&&$Le(this._codeEditorService,e)&&(iA(t.getModel(),o,this._codeEditorService),this._diffEditor.updateOptions({})),!o&&n&&$Le(this._codeEditorService,t)&&(iA(e.getModel(),n,this._codeEditorService),this._diffEditor.updateOptions({}))}};KLe=I([m(1,Kt)],KLe);function $Le(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 GLe=class extends C{constructor(e,t,o){super();this._editorService=e;this._codeEditorService=t;this._contextService=o;this._register(H.runAndSubscribe(Fg,({window:n,disposables:r})=>{r.add(j(n,"focus",()=>this._update(),!0)),r.add(j(n,"blur",()=>this._update(),!0))},{window:It,disposables:this._store})),this._register(this._editorService.onDidActiveEditorChange(()=>this._update())),this._canToggleWordWrap=Nao.bindTo(this._contextService),this._editorWordWrap=Oao.bindTo(this._contextService),this._activeEditor=null,this._activeEditorListener=this._register(new P),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($Le(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)}};GLe=I([m(0,ee),m(1,Kt),m(2,X)],GLe);pt(GLe.ID,GLe,ut.AfterRestored);go(zLe.ID,zLe,0);Imt(KLe.ID,KLe);Jt(gyi);fe.appendMenuItem(D.EditorTitle,{command:{id:mWt,title:d(8352,null),icon:M.wordWrap},group:"navigation",order:1,when:x.and(x.has(vyi),x.has(fyi))});fe.appendMenuItem(D.EditorTitle,{command:{id:mWt,title:d(8353,null),icon:M.wordWrap},group:"navigation",order:1,when:x.and(ue.inDiffEditor.negate(),x.has(vyi),x.not(fyi))});fe.appendMenuItem(D.MenubarViewMenu,{command:{id:mWt,title:d(8350,null),toggled:Oao,precondition:Nao},order:1,group:"6_editor"});var oA=class{constructor(i,e){this._instaService=i;this._inputUri=A.from({scheme:"perf",path:"Startup Performance"});this._registration=e.registerTextModelContentProvider("perf",i.createInstance(NJe))}static get(){return Ule(oA.ID)}static{this.ID="workbench.contrib.perfview"}dispose(){this._registration.dispose()}getInputUri(){return this._inputUri}getEditorInput(){return this._instaService.createInstance(VK)}};oA=I([m(0,F),m(1,Nt)],oA);var VK=class extends IC{static{this.Id="PerfviewInput"}get typeId(){return VK.Id}constructor(i,e,t,o,n,r,s,l){super(oA.get().getInputUri(),d(12268,null),void 0,void 0,void 0,i,e,t,o,n,r,s,l)}};VK=I([m(0,Nt),m(1,Ho),m(2,ee),m(3,be),m(4,ot),m(5,lr),m(6,Nn),m(7,Sv)],VK);var NJe=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()){Ue(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)),iA(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(),Gt&&!this._remoteAgentService.getConnection()?.remoteAuthority?Promise.resolve():this._terminalService.whenConnected]).then(()=>{if(this._model&&!this._model.isDisposed()){let i=new byi;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/ll.GB).toFixed(2)} GB(${(e.freemem/ll.GB).toFixed(2)}GB free)`),e.meminfo&&i.li(`Memory(Process): ${(e.meminfo.workingSetSize/ll.KB).toFixed(2)} MB working set(${(e.meminfo.privateBytes/ll.KB).toFixed(2)}MB private, ${(e.meminfo.sharedBytes/ll.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=oe.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]",Dxt(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]),Gt&&(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(1)?.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=oe.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))}};NJe=I([m(0,Ct),m(1,kt),m(2,Kt),m(3,ao),m(4,wC),m(5,lt),m(6,nt),m(7,yo),m(8,Yo)],NJe);var byi=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 Syi=class{constructor(i,e){this.key=i;this.data=e;this.incoming=new Map;this.outgoing=new Map}},OJe=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 Syi(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 V3o=!1,hWt=class extends Error{constructor(i){super("cyclic dependency between services"),this.message=i.findCycleSlow()??`UNABLE to detect cycle, dumping graph: 
${i.toString()}`}},qLe=class a{constructor(i=new Io,e=!1,t,o=V3o){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 OJe(n=>n):void 0}dispose(){if(!this._isDisposed){this._isDisposed=!0,Ue(this._children),this._children.clear();for(let i of this._servicesToMaybeDispose)Ac(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=IZ.traceInvocation(this._enableTracing,i),o=!1;try{return i({get:r=>{if(o)throw Xve("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 Mt?(t=IZ.traceCreation(this._enableTracing,i.ctor),o=this._createInstance(i.ctor,i.staticArguments.concat(e),t)):(t=IZ.traceCreation(this._enableTracing,i),o=this._createInstance(i,e,t)),t.stop(),o}_createInstance(i,e=[],t){let o=Z0.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 Mt)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 Mt?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 OJe(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 hWt(o);for(let c of Z0.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 Mt){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 hWt(o);break}for(let{data:c}of l){if(this._getServiceInstanceOrDescriptor(c.id)instanceof Mt){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 Mt)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 v$(()=>{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 Vs,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 IZ=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 jLe=class extends C{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=H.once(this._editorService.onDidActiveEditorChange)(()=>this._scheduler.schedule())}_logSamples(){let e=vx.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"})}};jLe=I([m(0,B),m(1,ee),m(2,Te)],jLe);pt(oA.ID,oA,{lazy:!0});oe.as(rn.EditorFactory).registerEditorSerializer(VK.Id,class{canSerialize(){return!0}serialize(){return""}deserialize(a){return a.createInstance(VK)}});W(class extends K{constructor(){super({id:"perfview.show",title:L(12267,"Startup Performance"),category:We.Developer,f1:!0})}run(a){let i=a.get(ee),e=oA.get();return i.openEditor(e.getEditorInput(),{pinned:!0})}});W(class extends K{constructor(){super({id:"perf.insta.printAsyncCycles",title:L(12264,"Print Service Cycles"),category:We.Developer,f1:!0})}run(i){let e=i.get(F);if(e instanceof qLe){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(12266,"Print Service Traces"),category:We.Developer,f1:!0})}run(){if(IZ.all.size===0){console.log("Enable via `instantiationService.ts#_enableAllTracing`");return}for(let i of IZ.all)console.log(i)}});W(class extends K{constructor(){super({id:"perf.event.profiling",title:L(12265,"Print Emitter Profiles"),category:We.Developer,f1:!0})}run(){if(mbe.all.size===0){console.log("USE `EmitterOptions._profName` to enable profiling");return}for(let i of mbe.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`)}});oe.as(Qi.Workbench).registerWorkbenchContribution(jLe,4);var QLe=class{static{this.Id="perf.disposableTracking"}constructor(i){!i.isBuilt&&!i.extensionTestsLocationURI&&obe(new Kut)}};QLe=I([m(0,Co)],QLe);pt(QLe.Id,QLe,ut.Eventually);var Fao=new Q("userHasOpenedNotebook",!1),gWt=new Q("notebookFindWidgetFocused",!1),fWt=new Q("interactiveWindowOpen",!1),C4=new Q("mostRecentReplEditor",void 0),Ua=x.equals("activeEditor",qL),FJe=x.equals("activeEditor",cY),Iyi=x.equals("activeEditor",uxe),Wao=x.or(Ua,FJe,Iyi),mS=new Q("isCompositeNotebook",!1),rr=new Q("notebookEditorFocused",!1),$u=new Q("notebookCellListFocused",!1),PR=new Q("notebookOutputFocused",!1),yZ=new Q("notebookOutputInputFocused",!1),Kl=new Q("notebookEditable",!0),x4=new Q("notebookHasRunningCell",!1),mB=new Q("notebookHasSomethingRunning",!1),WJe=new Q("notebookUseConsolidatedOutputButton",!1),RNd=new Q("notebookBreakpointMargin",!1),Vao=new Q("notebookCellToolbarLocation","left"),VJe=new Q("notebookCursorNavigationMode",!1),YLe=new Q("notebookLastCellFailed",!1),Bao=new Q("notebookType",void 0),hS=new Q("notebookCellType",void 0),bw=new Q("notebookCellEditable",!1),Cpe=new Q("notebookCellFocused",!1),AR=new Q("notebookCellEditorFocused",!1),wZ=new Q("notebookCellMarkdownEditMode",!1),BJe=new Q("notebookCellLineNumbers","inherit"),xpe=new Q("notebookCellExecutionState",void 0),vWt=new Q("notebookCellExecuting",!1),gk=new Q("notebookCellHasOutputs",!1),bWt=new Q("notebookCellIsFirstOutput",!1),SWt=new Q("hasHiddenOutputs",!1),XLe=new Q("notebookCellOutputMimeType",void 0),JLe=new Q("notebookCellInputIsCollapsed",!1),HJe=new Q("notebookCellOutputIsCollapsed",!1),Hao=new Q("notebookCellResource",""),kpe=new Q("notebookCellHasErrorDiagnostics",!1),yyi=new Q("notebookCellOutputMimeTypeListForChat",[]),ZLe=new Q("notebookKernel",void 0),CZ=new Q("notebookKernelCount",0),eRe=new Q("notebookKernelSourceCount",0),Uao=new Q("notebookKernelSelected",!1),hB=new Q("notebookInterruptibleKernel",!1),IWt=new Q("notebookMissingKernelExtension",!1),yWt=new Q("notebookHasOutputs",!1),tRe=new Q("kernelHasVariableProvider",!1);var tT="_notebook.selectKernel",jm=L(11771,"Notebook"),VF="inline/cell",zao="inline/output",rf=100,Kao=201;function Epe(a){let i=qn(a.activeEditorPane);if(!i||!i.hasModel())return;let e=i.getActiveCell(),t=i.getSelectionViewModels();return{cell:e,selectedCells:t,notebookEditor:i}}function B3o(a,i){let t=a.get(Zc).listNotebookEditors().find(o=>o.hasModel()&&o.textModel.uri.toString()===i.toString());if(t&&t.hasModel())return t}function wWt(a,i){let e=A.revive(i);if(e){let t=B3o(a,e);if(t)return{notebookEditor:t}}}function xZ(a,i){let e;for(let[,t]of a.notebookEditor.codeEditors)if(Xe(t.getModel()?.uri,i.uri)){e=t;break}return e}var qu=class extends K{constructor(i){if(i.f1!==!1){i.f1=!1;let e={id:D.CommandPalette,when:x.or(Ua,FJe,Iyi)};i.menu?Array.isArray(i.menu)||(i.menu=[i.menu]):i.menu=[],i.menu=[...i.menu,e]}i.category=jm,super(i)}async run(i,e,...t){if(Cyi(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 Epe(i.get(ee))}},xg=class extends K{constructor(i){if(i.f1!==!1){i.f1=!1;let e={id:D.CommandPalette,when:Ua};i.menu?Array.isArray(i.menu)||(i.menu=[i.menu]):i.menu=[],i.menu=[...i.menu,e]}i.category=jm,super(i)}parseArgs(i,...e){}async run(i,...e){let t=e[0];if(Cyi(i,this.desc.id,t),Gao(t))return this.runWithContext(i,t);let n=this.parseArgs(i,...e);if(n)return this.runWithContext(i,n);let r=iRe(i);if(r){let s=r.getSelections().length===0?[r.getFocus()]:r.getSelections();return this.runWithContext(i,{ui:!1,notebookEditor:r,selectedCells:_8e(r,s)})}}},gd=class extends qu{isCellActionContext(i){return!!i&&!!i.notebookEditor&&!!i.cell}getCellContextFromArgs(i,e,...t){}async run(i,e,...t){if(Cyi(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)}},wyi=x.or(x.greater(CZ.key,0),x.greater(eRe.key,0));function Cyi(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=Gao(e)?"cellToolbar":mce(e)?"editorToolbar":"other";t.publicLog2("workbenchActionExecuted",{id:i,from:o})}}}function Gao(a){return!!a&&!!a.notebookEditor&&a.$mid===13}function H3o(a){if(a===void 0)return!1;let i=a.ranges;return!(!i||!Array.isArray(i)||i.some(e=>!ddi(e))||a.document&&!A.revive(a.document))}function iRe(a,i){let e=wWt(a,i)?.notebookEditor;if(e)return e;let t=qn(a.get(ee).activeEditorPane);if(!(!t||!t.hasModel()))return t}function BK(a,...i){let e=i[0];if(H3o(e)){let o=iRe(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(ddi(e)){let o=i[1],n=iRe(a,o);return n?{ui:!1,notebookEditor:n,selectedCells:n.getCellsInRange(e)}:void 0}let t=Epe(a.get(ee));return t?{ui:!1,notebookEditor:t.notebookEditor,selectedCells:t.selectedCells??[],cell:t.cell}:void 0}var UJe=[{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"}}}}];fe.appendMenuItem(D.NotebookCellTitle,{submenu:D.NotebookCellInsert,title:d(11773,null),group:"2_insert",when:Kl.isEqualTo(!0)});fe.appendMenuItem(D.EditorContext,{submenu:D.NotebookCellTitle,title:d(11772,null),group:"2_insert",when:rr});fe.appendMenuItem(D.NotebookCellTitle,{title:d(11770,null),submenu:D.EditorContextShare,group:"4_share"});var Tpe=Re("notebook-kernel-select",M.serverEnvironment,d(12079,null)),HK=Re("notebook-execute",M.play,d(12066,null)),$ao=Re("notebook-execute-above",M.runAbove,d(12063,null)),qao=Re("notebook-execute-below",M.runBelow,d(12065,null)),CWt=Re("notebook-stop",M.primitiveSquare,d(12082,null)),jao=Re("notebook-delete-cell",M.trash,d(12060,null)),Qao=Re("notebook-execute-all",M.runAll,d(12064,null)),Yao=Re("notebook-edit",M.pencil,d(12061,null)),Xao=Re("notebook-stop-edit",M.check,d(12081,null)),Jao=Re("notebook-move-up",M.arrowUp,d(12071,null)),Zao=Re("notebook-move-down",M.arrowDown,d(12070,null)),xyi=Re("notebook-clear",M.clearAll,d(12057,null)),elo=Re("notebook-split-cell",M.splitVertical,d(12080,null)),xWt=Re("notebook-state-success",M.check,d(12083,null)),oRe=Re("notebook-state-error",M.error,d(12062,null)),kWt=Re("notebook-state-pending",M.clock,d(12074,null)),Sw=Re("notebook-state-executing",M.sync,d(12067,null)),EWt=Re("notebook-collapsed",M.chevronRight,d(12058,null)),TWt=Re("notebook-expanded",M.chevronDown,d(12068,null)),tlo=Re("notebook-open-as-text",M.fileCode,d(12073,null)),kZ=Re("notebook-revert",M.discard,d(12077,null)),ilo=Re("notebook-diff-cell-toggle-whitespace",M.whitespace,d(12084,null)),olo=Re("notebook-render-output",M.preview,d(12076,null)),_Wt=Re("notebook-mimetype",M.code,d(12069,null)),zJe=Re("notebook-copy",M.copy,d(12059,null)),nlo=Re("notebook-save",M.save,d(12078,null)),rlo=Re("notebook-diff-editor-previous-change",M.arrowUp,d(12075,null)),slo=Re("notebook-diff-editor-next-change",M.arrowDown,d(12072,null)),DWt=Re("variables-view-icon",M.variableGroup,d(12085,null));function KJe(a){return"kernel"in a}function U3o(a){return"kernels"in a}function LWt(a){return"action"in a}function llo(a){return a.id==="installSuggested"&&"extensionIds"in a}function clo(a){return a.id==="install"}function alo(a){return"command"in a}function z3o(a){return"autoRun"in a&&!!a.autoRun}var dlo=200;function kyi(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(12131,null,e.description):e.description=d(12130,null)),e}var Eyi=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 P,p=u.add(this._quickInputService.createQuickPick({useSeparators:!0})),h=this._getKernelPickerQuickPickItems(o,r,this._notebookKernelService,n);if(h.length===1&&z3o(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(12136,null,this._labelService.getUriLabel(o.uri,{relative:!0})):d(12137,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?xn(S=>this._showInstallKernelExtensionRecommendation(o,p,this._extensionWorkbenchService,S)):void 0,v=H.debounce(H.any(this._notebookKernelService.onDidChangeSourceActions,this._notebookKernelService.onDidAddKernel,this._notebookKernelService.onDidRemoveKernel,this._notebookKernelService.onDidChangeNotebookAffinity),(S,y)=>S,dlo)(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(KJe(T)){let N=T.kernel.id,O=w.find(V=>KJe(V)&&V.kernel.id===N);O&&k.push(O)}else if(LWt(T)){let N=w.find(O=>LWt(O)&&O.action.action.id===T.action.action.id);N&&k.push(N)}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(KJe(e)){let o=e.kernel;return this._selecteKernel(i.textModel,o),!0}return clo(e)?await this._showKernelExtension(this._extensionWorkbenchService,this._extensionService,this._extensionManagementServerService,i.textModel.viewType,[]):llo(e)?await this._showKernelExtension(this._extensionWorkbenchService,this._extensionService,this._extensionManagementServerService,i.textModel.viewType,e.extensionIds,this._productService.quality!=="stable"):LWt(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}],ve.None))[0];if(h.enablementState===10||h.enablementState===11||h.enablementState===2)c.push(h);else if(!i.installed.some(g=>Ot(g.identifier,h.identifier)))await i.canInstall(h)===!0&&s.push(h);else if(t.remoteExtensionManagementServer){if(i.installed.some(g=>Ot(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(Cre).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:`$(${M.lightbulb.id}) `+d(12132,null),extensionIds:n.extensionIds})}return t.push({id:"install",label:d(12138,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 OEt.get(i)?.get(e)}},E4=class extends Eyi{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=kyi(t.selected,t.selected);r.push(l)}t.suggestions.filter(l=>l.id!==t.selected?.id).map(l=>kyi(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(12141,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 P,r=n.add(this._quickInputService.createQuickPick({useSeparators:!0})),s=await new Promise(l=>{r.title=t?d(12139,null):d(12140,null),r.placeholder=d(12142,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(alo(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(H.debounce(H.any(this._notebookKernelService.onDidChangeSourceActions,this._notebookKernelService.onDidAddKernel,this._notebookKernelService.onDidRemoveKernel),(c,u)=>c,dlo)(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(alo(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(KJe(l))return await this._selecteKernel(o,l.kernel),!0;if(U3o(l))return await this._selectOneKernel(o,l.label,l.kernels),!0;if(LWt(l))try{return await l.action.runAction(),!0}catch{return!1}else{if(clo(l))return await this._showKernelExtension(this._extensionWorkbenchService,this._extensionService,this._extensionManagementServerService,e.textModel.viewType,[]),!0;if(llo(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!==Gxe),l=[];for(let u of Pg(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(M.info),tooltip:d(12135,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=>kyi(l,void 0)),r=new P,s=r.add(this._quickInputService.createQuickPick({useSeparators:!0}));s.items=n,s.canSelectMany=!1,s.title=d(12143,null,t),r.add(s.onDidAccept(async()=>{s.selectedItems&&s.selectedItems.length>0&&KJe(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(Sw,"spin")),u.selected){t.label=u.selected.label;let p=u.selected.description??u.selected.detail;t.tooltip=p?d(12134,null,p):d(12133,null)}else t.label=d(12133,null);return}let s=o.getRunningSourceActions(e),l=(u,p)=>{let h=u.action;t.class=p?q.asClassName(q.modify(Sw,"spin")):q.asClassName(Tpe),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(Tpe),t.tooltip=c.description??c.detail??""):(t.label=d(12139,null),t.class=q.asClassName(Tpe),t.tooltip="")}static async resolveKernel(e,t,o,n){let r=o.getKernels(e);if(r.selected)return r.selected;await n.executeCommand(tT);let{selected:s}=o.getKernels(e);return s}};E4=I([m(0,Tl),m(1,nt),m(2,Ge),m(3,ot),m(4,ne),m(5,zi),m(6,lt),m(7,Gc),m(8,ge),m(9,mR),m(10,Qe)],E4);function K3o(a,i){let e;if(i!==void 0&&"notebookEditorId"in i){let t=i.notebookEditorId,o=a.visibleEditorPanes.find(n=>qn(n)?.getId()===t);e=qn(o)}else i!==void 0&&"notebookEditor"in i?e=i?.notebookEditor:e=qn(a.activeEditorPane);return e}function G3o(a,i,e,t){return!!(a&&(t&&"skipIfAlreadySelected"in t&&t.skipIfAlreadySelected||i&&a.id===i&&Ei.equals(a.extension,e)))}W(class extends K{constructor(){super({id:tT,category:jm,title:L(12144,"Select Notebook Kernel"),icon:Tpe,f1:!0,precondition:Ua,menu:[{id:D.EditorTitle,when:x.and(Ua,x.notEquals("config.notebook.globalToolbar",!0)),group:"navigation",order:-10},{id:D.NotebookToolbar,when:x.equals("config.notebook.globalToolbar",!0),group:"status",order:-10},{id:D.InteractiveToolbar,when:CZ.notEqualsTo(0),group:"status",order:-10}],metadata:{description:d(12145,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=K3o(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(Tl),{selected:c}=l.getMatchingKernel(s);if(G3o(c,n,r,i))return!0;let u=n?`${r}/${n}`:void 0;return e.createInstance(E4).showQuickPick(o,u)}});var gB=class extends Lr{constructor(e,t,o,n,r){let s=new st("fakeAction",void 0,q.asClassName(Tpe),!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}E4.updateKernelStatusAction(e,this._action,this._notebookKernelService,this._notebookKernelHistoryService),this.updateClass()}_resetAction(){this._action.enabled=!1,this._action.label="",this._action.class=""}};gB=I([m(3,Tl),m(4,mR)],gB);var RWt=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 Tyi="vscode://schemas/extensions",ulo={id:Tyi,allowComments:!0,allowTrailingCommas:!0,type:"object",title:d(10073,null),additionalProperties:!1,properties:{recommendations:{type:"array",description:d(10072,null),items:{type:"string",pattern:CO,errorMessage:d(10071,null)}},unwantedRecommendations:{type:"array",description:d(10074,null),items:{type:"string",pattern:CO,errorMessage:d(10071,null)}}}},_yi=["{","	// 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 plo=Re("extensions-view-icon",M.extensions,d(9873,null)),_pe=Re("extensions-manage",M.gear,d(9880,null)),mlo=Re("extensions-clear-search-results",M.clearAll,d(9870,null)),hlo=Re("extensions-refresh",M.refresh,d(9883,null)),MWt=Re("extensions-filter",M.filter,d(9874,null)),glo=Re("extensions-install-local-in-remote",M.cloudDownload,d(9877,null)),Dyi=Re("extensions-install-workspace-recommended",M.cloudDownload,d(9878,null)),flo=Re("extensions-configure-recommended",M.pencil,d(9871,null)),vlo=Re("extensions-sync-enabled",M.sync,d(9890,null)),GJe=Re("extensions-sync-ignored",M.syncIgnored,d(9891,null)),blo=Re("extensions-remote",M.remote,d(9884,null)),Lyi=Re("extensions-install-count",M.cloudDownload,d(9876,null)),Ryi=Re("extensions-private",M.lock,d(9879,null)),Slo=Re("extensions-rating",M.star,d(9882,null)),Myi=Re("extensions-pre-release",M.versions,d(9881,null)),$Je=Re("extensions-sponsor",M.heartFilled,d(9886,null)),qJe=Re("extensions-star-full",M.starFull,d(9888,null)),Ilo=Re("extensions-star-half",M.starHalf,d(9889,null)),PWt=Re("extensions-star-empty",M.starEmpty,d(9887,null)),gS=Re("extensions-error-message",M.error,d(9872,null)),_u=Re("extensions-warning-message",M.warning,d(9893,null)),kg=Re("extensions-info-message",M.info,d(9875,null)),NR=Re("extension-workspace-trust",M.shield,d(9892,null)),ylo=Re("extension-activation-time",M.history,d(9869,null)),wlo=Re("extension-restart-required",M.refresh,d(9885,null));var UK=ae("issueFormService"),UC=ae("workbenchIssueService");var EZ=class extends st{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(so(this.error))return;if(this.logService.error(this.error),this.error.name==="Unsupported"){let s=Gt?d(9854,null,this.productService.nameLong):this.productService.nameLong,l=d(9710,null,this.extension.displayName||this.extension.identifier.id,s),{confirmed:c}=await this.dialogService.confirm({type:St.Info,message:l,primaryButton:d(9803,null),cancelButton:d(9712,null)});c&&this.openerService.open(Gt?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:Cn(this.error),buttons:[{label:d(9782,null),run:()=>{let s=this.instantiationService.createInstance(Iw,{installPreReleaseVersion:!0});return s.extension=this.extension,s.run()}}],cancelButton:d(9708,null)});return}if(["Incompatible","IncompatibleApi","IncompatibleTargetPlatform","Malicious","Deprecated"].includes(this.error.name)){await this.dialogService.info(Cn(this.error));return}if("PackageNotSigned"===this.error.name){await this.dialogService.prompt({type:"error",message:d(9806,null,this.extension.displayName),detail:Cn(this.error),buttons:[{label:d(9768,null),run:()=>{let s=this.instantiationService.createInstance(Iw,{...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(9853,null,this.extension.displayName,this.productService.nameLong),detail:Cn(this.error),buttons:[{label:d(9795,null),run:()=>this.openerService.open("https://code.visualstudio.com/docs/editor/extension-marketplace#_the-extension-signature-cannot-be-verified-by-vs-code")},{label:d(9771,null),run:()=>{let s=this.instantiationService.createInstance(Iw,{...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(9853,null,this.extension.displayName,this.productService.nameLong),detail:Cn(this.error),buttons:[{label:d(9795,null),run:()=>this.openerService.open("https://code.visualstudio.com/docs/editor/extension-marketplace#_the-extension-signature-cannot-be-verified-by-vs-code")},{label:d(9812,null),run:()=>this.workbenchIssueService.openReporter({issueTitle:d(9814,null,this.extension.displayName),issueBody:d(9813,null)})},{label:d(9771,null),run:()=>{let s=this.instantiationService.createInstance(Iw,{...this.options,donotVerifySignature:!0});return s.extension=this.extension,s.run()}}],cancelButton:!0});return}let e=this.installOperation===3?d(9845,null,this.extension.displayName||this.extension.identifier.id):d(9779,null,this.extension.displayName||this.extension.identifier.id),t,o=[],n=await this.getDownloadUrl();n&&(t=d(9711,null,ic(iK).toString()),o.push({label:d(9735,null),run:()=>this.openerService.open(n).then(()=>{this.notificationService.prompt(St.Info,d(9786,null,this.extension.identifier.id),[{label:d(9794,null),run:()=>this.commandService.executeCommand(vDt)}])})}));let r=`${e}${t?` ${t}`:""}`;this.notificationService.prompt(St.Error,r,o)}async getDownloadUrl(){if(Nc||!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,ve.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},ve.None);if(t)return A.parse(t.assets.download.uri)}};EZ=I([m(5,nt),m(6,Qe),m(7,Ne),m(8,ct),m(9,ge),m(10,ne),m(11,Gc),m(12,F),m(13,ta),m(14,xp),m(15,UC)],EZ);var oa=class a extends st{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)}},qK=class extends oa{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(H.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 li]);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}},dRe=class extends jye{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)}}},Iw=class extends oa{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super("extensions.install",d(9766,null),Iw.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 um);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=Iw.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=Iw.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&&L3e(this.extension.private,await this.extensionGalleryManifestService.getExtensionGalleryManifest())){let{result:t}=await this.dialogService.prompt({type:St.Warning,message:d(9806,null,this.extension.displayName),detail:d(9807,null),buttons:[{label:d(9768,null),run:()=>(this.options.donotVerifySignature=!0,!0)}],cancelButton:{run:()=>!1}});if(!t)return}if(this.extension.deprecationInfo){let t=d(9719,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(9768,null),run:()=>0}];if(this.extension.deprecationInfo.extension){t=d(9721,null,this.extension.deprecationInfo.extension.displayName);let s=this.extension.deprecationInfo.extension;n.push({label:d(9827,null,this.extension.deprecationInfo.extension.displayName),run:async()=>{let[l]=await this.extensionsWorkbenchService.getExtensions([{id:s.id,preRelease:s.preRelease}],ve.None);return await this.extensionsWorkbenchService.open(l),1}})}else if(this.extension.deprecationInfo.settings){t=d(9723,null);let s=this.extension.deprecationInfo.settings;n.push({label:d(9713,null),run:async()=>(await this.preferencesService.openSettings({query:s.map(l=>`@id:${l}`).join(" ")}),2)})}else this.extension.deprecationInfo.additionalInfo&&(t=new xe(`${t} ${this.extension.deprecationInfo.additionalInfo}`));let{result:r}=await this.dialogService.prompt({type:St.Warning,message:d(9770,null,this.extension.displayName),detail:Ae(t)?t:void 0,custom:Ae(t)?void 0:{markdownDetails:[{markdown:t}]},buttons:n,cancelButton:{run:()=>3}});if(r!==0)return}this.extensionsWorkbenchService.open(this.extension,{showPreReleaseVersion:this.options.installPreReleaseVersion}),Jo(d(9790,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){Jo(d(9789,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=>$K(r,e)))return this.instantiationService.createInstance(fk);if((await this.workbenchThemeService.getFileIconThemes()).some(r=>$K(r,e)))return this.instantiationService.createInstance(vk);if((await this.workbenchThemeService.getProductIconThemes()).some(r=>$K(r,e)))return this.instantiationService.createInstance(bk)}async install(e){try{return await this.extensionsWorkbenchService.install(e,this.options)}catch(t){await this.instantiationService.createInstance(EZ,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(kO(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(9787,null):this.options.installPreReleaseVersion&&this.extension?.hasPreReleaseVersion?e?d(9780,null):d(9781,null):this.extension?.hasPreReleaseVersion?e?d(9766,null):d(9784,null):d(9766,null)}};Iw=I([m(1,zi),m(2,F),m(3,lt),m(4,Gp),m(5,ot),m(6,ct),m(7,Po),m(8,Te),m(9,Pe),m(10,zp),m(11,vv)],Iw);var TZ=class extends qK{set manifest(i){this.extensionActions.forEach(e=>e.manifest=i),this.update()}constructor(i,e){super("extensions.installActions",Iw.CLASS,[[i.createInstance(Iw,{installPreReleaseVersion:e.preferPreReleases}),i.createInstance(Iw,{installPreReleaseVersion:!e.preferPreReleases})]])}getLabel(i){return i.getLabel(!0)}};TZ=I([m(0,F),m(1,Hd)],TZ);var uRe=class a extends oa{static{this.LABEL=d(9791,null)}static{this.CLASS=`${oa.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"}`}},OR=class extends oa{constructor(e,t,o,n,r,s){super(e,OR.INSTALL_LABEL,OR.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(9766,null)}static{this.INSTALLING_LABEL=d(9791,null)}static{this.Class=`${oa.LABEL_ACTION_CLASS} prominent install-other-server`}static{this.InstallingClass=`${oa.LABEL_ACTION_CLASS} install-other-server installing`}update(){if(this.enabled=!1,this.class=OR.Class,this.canInstall()){let e=this.extensionsWorkbenchService.installed.filter(t=>Ot(t.identifier,this.extension.identifier)&&t.server===this.server)[0];e?e.state===0&&!e.local&&(this.enabled=!0,this.label=OR.INSTALLING_LABEL,this.class=OR.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:!!(NL(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),Jo(d(9790,null,this.extension.displayName)),this.extensionsWorkbenchService.installInServer(this.extension,this.server)}};OR=I([m(3,zi),m(4,Gc),m(5,xp)],OR);var T4=class extends OR{constructor(i,e,t,o){super("extensions.remoteinstall",t.remoteExtensionManagementServer,i,e,t,o)}getInstallLabel(){return this.extensionManagementServerService.remoteExtensionManagementServer?d(9773,null,this.extensionManagementServerService.remoteExtensionManagementServer.label):OR.INSTALL_LABEL}};T4=I([m(1,zi),m(2,Gc),m(3,xp)],T4);var _Z=class extends OR{constructor(i,e,t){super("extensions.localinstall",e.localExtensionManagementServer,!1,i,e,t)}getInstallLabel(){return d(9778,null)}};_Z=I([m(0,zi),m(1,Gc),m(2,xp)],_Z);var DZ=class extends OR{constructor(i,e,t){super("extensions.webInstall",e.webExtensionManagementServer,!1,i,e,t)}getInstallLabel(){return d(9769,null)}};DZ=I([m(0,zi),m(1,Gc),m(2,xp)],DZ);var iT=class extends oa{constructor(e,t,o){super("extensions.uninstall",iT.UninstallLabel,iT.UninstallClass,!1);this.extensionsWorkbenchService=e;this.userDataProfilesService=t;this.dialogService=o;this.update()}static{this.UninstallLabel=d(9838,null)}static{this.UninstallingLabel=d(9843,null)}static{this.UninstallClass=`${oa.LABEL_ACTION_CLASS} uninstall`}static{this.UnInstallingClass=`${oa.LABEL_ACTION_CLASS} uninstall uninstalling`}update(){if(!this.extension){this.enabled=!1;return}let e=this.extension.state;if(e===2){this.label=iT.UninstallingLabel,this.class=iT.UnInstallingClass,this.enabled=!1;return}if(this.label=this.extension.local?.isApplicationScoped&&this.userDataProfilesService.profiles.length>1?d(9839,null):iT.UninstallLabel,this.class=iT.UninstallClass,this.tooltip=iT.UninstallLabel,e!==1){this.enabled=!1;return}if(this.extension.isBuiltin){this.enabled=!1;return}this.enabled=!0}async run(){if(this.extension){Jo(d(9842,null,this.extension.displayName));try{await this.extensionsWorkbenchService.uninstall(this.extension),Jo(d(9841,null,this.extension.displayName))}catch(e){so(e)||this.dialogService.error(Cn(e))}}}};iT=I([m(0,zi),m(1,an),m(2,ct)],iT);var nA=class extends oa{constructor(e,t,o,n,r){super("extensions.update",d(9844,null),nA.DisabledClass,!1);this.verbose=e;this.extensionsWorkbenchService=t;this.dialogService=o;this.openerService=n;this.instantiationService=r;this.updateThrottler=this._register(new um);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(9847,null,this.extension.latestVersion):d(9844,null))}async computeAndUpdateEnablement(){if(this.enabled=!1,this.class=nA.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?nA.EnabledClass:nA.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(9851,null,this.extension.displayName),message:d(9850,null,e),buttons:[{label:d(9844,null),run:()=>"update"},{label:d(9817,null),run:()=>"review"},{label:d(9708,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{Jo(d(9852,null,this.extension.displayName,this.extension.latestVersion)),await this.extensionsWorkbenchService.install(this.extension,t),Jo(d(9849,null,this.extension.displayName,this.extension.latestVersion))}catch(o){this.instantiationService.createInstance(EZ,this.extension,t,this.extension.latestVersion,3,o).run()}}};nA=I([m(1,zi),m(2,ct),m(3,Qe),m(4,F)],nA);var zC=class extends oa{constructor(e,t,o,n){super(zC.ID,zC.LABEL.value,zC.DisabledClass);this.extensionsWorkbenchService=e;this.extensionEnablementService=t;this.allowedExtensionsService=o;this._register(n.onDidChangeConfiguration(r=>{r.affectsConfiguration(VE)&&this.update()})),this._register(o.onDidChangeAllowedExtensionsConfigValue(r=>this.update())),this.update()}static{this.ID="workbench.extensions.action.toggleAutoUpdateForExtension"}static{this.LABEL=L(9737,"Auto Update")}static{this.EnabledClass=`${oa.EXTENSION_ACTION_CLASS} auto-update`}static{this.DisabledClass=`${this.EnabledClass} hide`}update(){if(this.enabled=!1,this.class=zC.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=zC.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?Jo(d(9736,null,this.extension.displayName)):Jo(d(9725,null,this.extension.displayName))}};zC=I([m(0,zi),m(1,Os),m(2,zp),m(3,B)],zC);var BF=class extends oa{constructor(e){super(BF.ID,BF.LABEL);this.extensionsWorkbenchService=e}static{this.ID="workbench.extensions.action.toggleAutoUpdatesForPublisher"}static{this.LABEL=d(9833,null)}update(){}async run(){if(!this.extension)return;Jo(d(9765,null,this.extension.publisherDisplayName));let e=!this.extensionsWorkbenchService.isAutoUpdateEnabledFor(this.extension.publisher);await this.extensionsWorkbenchService.updateAutoUpdateEnablementFor(this.extension.publisher,e),e?Jo(d(9736,null,this.extension.displayName)):Jo(d(9725,null,this.extension.displayName))}};BF=I([m(0,zi)],BF);var HF=class extends oa{constructor(e,t){super("extensionsAction.migrateDeprecatedExtension",d(9801,null),HF.DisabledClass,!1);this.small=e;this.extensionsWorkbenchService=t;this.update()}static{this.EnabledClass=`${oa.LABEL_ACTION_CLASS} migrate`}static{this.DisabledClass=`${this.EnabledClass} disabled`}update(){if(this.enabled=!1,this.class=HF.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=>Ot(t.identifier,{id:e}))||(this.enabled=!0,this.class=HF.EnabledClass,this.tooltip=d(9800,null,this.extension.deprecationInfo.extension.displayName),this.label=this.small?d(9799,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}],ve.None);await this.extensionsWorkbenchService.install(t,{isMachineScoped:e?.isMachineScoped})}};HF=I([m(1,zi)],HF);var fB=class extends oa{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(jJe,this,e),this._actionViewItem}run(e){return this._actionViewItem?.showMenu(e),Promise.resolve()}};fB=I([m(4,F)],fB);var jJe=class extends Lr{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=Yn(this.element),n={x:o.left,y:o.top+o.height+10};this.contextMenuService.showContextMenu({getAnchor:()=>n,getActions:()=>t,actionRunner:this.actionRunner,onHide:()=>jH(t)})}}getActions(e){let t=[];for(let o of e)t=[...t,...o,new li];return t.length?t.slice(0,t.length-1):t}};jJe=I([m(2,ze)],jJe);async function Clo(a,i,e){return e.invokeFunction(async t=>{let o=t.get(zi),n=t.get(Os),r=t.get(qt),s=t.get(nD),l=t.get(uk),c=t.get(Gp),u=t.get(OP),p=t.get(zp),h=[];if(a){switch(h.push(["extension",a.identifier.id]),h.push(["isBuiltinExtension",a.isBuiltin]),h.push(["isDefaultApplicationScopedExtension",a.local&&Xq(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=>$K(y,a))]),h.push(["extensionHasFileIconThemes",v.some(y=>$K(y,a))]),h.push(["extensionHasProductIconThemes",b.some(y=>$K(y,a))]),h.push(["extensionHasAccountPreferences",S]),h.push(["canSetLanguage",o.canSetLanguage(a)]),h.push(["isActiveLanguagePackExtension",a.gallery&&Dr===vY(a.gallery)])}return r.getMenuActions(D.ExtensionContext,i.createOverlay(h),{shouldForwardArgs:!0})})}function QJe(a,i){let e=[];for(let[,t]of a)e.push(t.map(o=>o instanceof $l?o:i.createInstance(YJe,o)));return e}async function Nyi(a,i,e){let t=await Clo(a,i,e);return QJe(t,e)}var rA=class extends fB{constructor(e,t,o){super(rA.ID,"","",!0,e);this.extensionService=t;this.contextKeyService=o;this.tooltip=d(9797,null),this.update()}static{this.ID="extensions.manage"}static{this.Class=`${oa.ICON_ACTION_CLASS} manage `+q.asClassName(_pe)}static{this.HideManageExtensionClass=`${this.Class} hide`}async getActionGroups(){let e=[],t=await Clo(this.extension,this.contextKeyService,this.instantiationService),o=[],n=[],r=[],s=[];for(let[l,c]of t)l===pX?n.push(...QJe([[l,c]],this.instantiationService)[0]):l===r6e?r.push(...QJe([[l,c]],this.instantiationService)[0]):l===oEe?o.push(...QJe([[l,c]],this.instantiationService)[0]):s.push(...QJe([[l,c]],this.instantiationService));return o.length&&e.push(o),e.push([this.instantiationService.createInstance(D4),this.instantiationService.createInstance(_4)]),e.push([this.instantiationService.createInstance(R4),this.instantiationService.createInstance(L4)]),r.length&&e.push(r),e.push([...n.length?n:[],this.instantiationService.createInstance(oT,this.extension,!1),this.instantiationService.createInstance(iT)]),s.forEach(l=>e.push(l)),e.forEach(l=>l.forEach(c=>{c instanceof oa&&(c.extension=this.extension)})),e}async run(){return await this.extensionService.whenInstalledExtensionsRegistered(),super.run(await this.getActionGroups())}update(){if(this.class=rA.HideManageExtensionClass,this.enabled=!1,this.extension){let e=this.extension.state;this.enabled=e===1,this.class=this.enabled||e===2?rA.Class:rA.HideManageExtensionClass}}};rA=I([m(0,F),m(1,lt),m(2,X)],rA);var AWt=class extends fB{constructor(e,t){super("extensionEditor.manageExtension","",`${oa.ICON_ACTION_CLASS} manage ${q.asClassName(_pe)}`,!0,t);this.contextKeyService=e;this.tooltip=d(9797,null)}update(){}async run(){let e=[];return(await Nyi(this.extension,this.contextKeyService,this.instantiationService)).forEach(t=>e.push(t)),e.forEach(t=>t.forEach(o=>{o instanceof oa&&(o.extension=this.extension)})),super.run(e)}},YJe=class extends oa{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===fDt?this.checked=!this.extensionsWorkbenchService.isExtensionIgnoredToSync(this.extension):this.action.id===zC.ID?this.checked=this.extensionsWorkbenchService.isAutoUpdateEnabledFor(this.extension):this.action.id===BF.ID?this.checked=this.extensionsWorkbenchService.isAutoUpdateEnabledFor(this.extension.publisher):this.checked=this.action.checked)}async run(){if(this.extension){let e=this.extension.local?Jb(this.extension.local.manifest.publisher,this.extension.local.manifest.name):this.extension.gallery?Jb(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)}}};YJe=I([m(1,zi)],YJe);var dD=class extends oa{constructor(e,t){super(dD.ID,dD.LABEL,dD.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(9836,null)}static{this.EnabledClass=`${oa.LABEL_ACTION_CLASS} prominent pre-release`}static{this.DisabledClass=`${this.EnabledClass} hide`}update(){this.enabled=!1,this.class=dD.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=dD.EnabledClass,this.extension.preRelease?(this.label=d(9834,null),this.tooltip=d(9835,null)):(this.label=d(9829,null),this.tooltip=d(9830,null)))))}async run(){this.extension&&(this.extensionsWorkbenchService.open(this.extension,{showPreReleaseVersion:!this.extension.preRelease}),await this.extensionsWorkbenchService.togglePreRelease(this.extension))}};dD=I([m(0,zi),m(1,zp)],dD);var oT=class extends oa{constructor(e,t,o,n,r,s,l,c,u){super(oT.ID,oT.LABEL,oa.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(9767,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(9805,null));return}let o=t.map((r,s)=>({id:r.version,label:r.version,description:`${Bs(new Date(Date.parse(r.date)),!0)}${r.isPreReleaseVersion?` (${d(9810,null)})`:""}${r.version===this.extension?.local?.manifest.version?` (${d(9716,null)})`:""}`,ariaLabel:`${r.isPreReleaseVersion?"Pre-Release version":"Release version"} ${r.version}`,isPreReleaseVersion:r.isPreReleaseVersion})),n=await this.quickInputService.pick(o,{placeHolder:d(9825,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(EZ,this.extension,r,n.id,2,s).run()}}return null}};oT=I([m(2,zi),m(3,Hd),m(4,ta),m(5,Ge),m(6,F),m(7,ct),m(8,zp)],oT);var _4=class extends oa{constructor(e,t){super(_4.ID,_4.LABEL,oa.LABEL_ACTION_CLASS);this.extensionsWorkbenchService=e;this.extensionEnablementService=t;this.tooltip=d(9744,null),this.update()}static{this.ID="extensions.enableForWorkspace"}static{this.LABEL=d(9743,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)}};_4=I([m(0,zi),m(1,Os)],_4);var D4=class extends oa{constructor(e,t){super(D4.ID,D4.LABEL,oa.LABEL_ACTION_CLASS);this.extensionsWorkbenchService=e;this.extensionEnablementService=t;this.tooltip=d(9746,null),this.update()}static{this.ID="extensions.enableGlobally"}static{this.LABEL=d(9745,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)}};D4=I([m(0,zi),m(1,Os)],D4);var L4=class extends oa{constructor(e,t,o,n){super(L4.ID,L4.LABEL,oa.LABEL_ACTION_CLASS);this.workspaceContextService=e;this.extensionsWorkbenchService=t;this.extensionEnablementService=o;this.extensionService=n;this.tooltip=d(9731,null),this.update(),this._register(this.extensionService.onDidChangeExtensions(()=>this.update()))}static{this.ID="extensions.disableForWorkspace"}static{this.LABEL=d(9730,null)}update(){this.enabled=!1,this.extension&&this.extension.local&&!this.extension.isWorkspaceScoped&&this.extensionService.extensions.some(e=>Ot({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)}};L4=I([m(0,Pe),m(1,zi),m(2,Os),m(3,lt)],L4);var R4=class extends oa{constructor(e,t,o){super(R4.ID,R4.LABEL,oa.LABEL_ACTION_CLASS);this.extensionsWorkbenchService=e;this.extensionEnablementService=t;this.extensionService=o;this.tooltip=d(9733,null),this.update(),this._register(this.extensionService.onDidChangeExtensions(()=>this.update()))}static{this.ID="extensions.disableGlobally"}static{this.LABEL=d(9732,null)}update(){this.enabled=!1,this.extension&&this.extension.local&&!this.extension.isWorkspaceScoped&&this.extensionService.extensions.some(e=>Ot({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)}};R4=I([m(0,zi),m(1,Os),m(2,lt)],R4);var nRe=class extends qK{constructor(i){super("extensions.enable",oa.LABEL_ACTION_CLASS,[[i.createInstance(D4),i.createInstance(_4)]])}};nRe=I([m(0,F)],nRe);var rRe=class extends qK{constructor(i){super("extensions.disable",oa.LABEL_ACTION_CLASS,[[i.createInstance(R4),i.createInstance(L4)]])}};rRe=I([m(0,F)],rRe);var zK=class extends oa{constructor(e,t,o,n,r,s){super("extensions.runtimeState","",zK.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=`${oa.LABEL_ACTION_CLASS} prominent reload`}static{this.DisabledClass=`${this.EnabledClass} disabled`}update(){if(this.enabled=!1,this.tooltip="",this.class=zK.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=zK.EnabledClass,this.tooltip=t.reason,this.label=t.action==="reloadWindow"?d(9811,null):t.action==="restartExtensions"?d(9815,null):t.action==="quitAndInstall"?d(9816,null):t.action==="applyUpdate"||t.action==="downloadUpdate"?d(9846,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()}}};zK=I([m(0,oi),m(1,zi),m(2,zd),m(3,lt),m(4,nt),m(5,Te)],zK);function $K(a,i){return!!(i&&a.extensionData&&Ei.equals(a.extensionData.extensionId,i.identifier.id))}function Oyi(a,i,e,t){let o=[];for(let n of a)$K(n,e)&&!(t&&n===i)&&o.push({label:n.label,id:n.id});return t&&(o.push({type:"separator",label:d(9716,null)}),o.push({label:i.label,id:i.id})),o}var fk=class extends oa{constructor(e,t,o,n){super(fk.ID,fk.TITLE.value,fk.DisabledClass,!1);this.workbenchThemeService=t;this.quickInputService=o;this.extensionEnablementService=n;this._register(H.any(e.onDidChangeExtensions,t.onDidColorThemeChange)(()=>this.update(),this)),this.update()}static{this.ID="workbench.extensions.action.setColorTheme"}static{this.TITLE=L(9856,"Set Color Theme")}static{this.EnabledClass=`${oa.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?fk.EnabledClass:fk.DisabledClass})}computeEnablement(e){return!!this.extension&&this.extension.state===1&&this.extensionEnablementService.isEnabledEnablementState(this.extension.enablementState)&&e.some(t=>$K(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 jo(100),s=Oyi(o,n,this.extension,e),l=await this.quickInputService.pick(s,{placeHolder:d(9820,null),onDidFocus:c=>r.trigger(()=>this.workbenchThemeService.setColorTheme(c.id,void 0)),ignoreFocusLost:t});return this.workbenchThemeService.setColorTheme(l?l.id:n.id,"auto")}};fk=I([m(0,lt),m(1,Gp),m(2,Ge),m(3,Os)],fk);var vk=class extends oa{constructor(e,t,o,n){super(vk.ID,vk.TITLE.value,vk.DisabledClass,!1);this.workbenchThemeService=t;this.quickInputService=o;this.extensionEnablementService=n;this._register(H.any(e.onDidChangeExtensions,t.onDidFileIconThemeChange)(()=>this.update(),this)),this.update()}static{this.ID="workbench.extensions.action.setFileIconTheme"}static{this.TITLE=L(9858,"Set File Icon Theme")}static{this.EnabledClass=`${oa.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?vk.EnabledClass:vk.DisabledClass})}computeEnablement(e){return!!this.extension&&this.extension.state===1&&this.extensionEnablementService.isEnabledEnablementState(this.extension.enablementState)&&e.some(t=>$K(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 jo(100),s=Oyi(o,n,this.extension,e),l=await this.quickInputService.pick(s,{placeHolder:d(9822,null),onDidFocus:c=>r.trigger(()=>this.workbenchThemeService.setFileIconTheme(c.id,void 0)),ignoreFocusLost:t});return this.workbenchThemeService.setFileIconTheme(l?l.id:n.id,"auto")}};vk=I([m(0,lt),m(1,Gp),m(2,Ge),m(3,Os)],vk);var bk=class extends oa{constructor(e,t,o,n){super(bk.ID,bk.TITLE.value,bk.DisabledClass,!1);this.workbenchThemeService=t;this.quickInputService=o;this.extensionEnablementService=n;this._register(H.any(e.onDidChangeExtensions,t.onDidProductIconThemeChange)(()=>this.update(),this)),this.update()}static{this.ID="workbench.extensions.action.setProductIconTheme"}static{this.TITLE=L(9859,"Set Product Icon Theme")}static{this.EnabledClass=`${oa.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?bk.EnabledClass:bk.DisabledClass})}computeEnablement(e){return!!this.extension&&this.extension.state===1&&this.extensionEnablementService.isEnabledEnablementState(this.extension.enablementState)&&e.some(t=>$K(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 jo(100),s=Oyi(o,n,this.extension,e),l=await this.quickInputService.pick(s,{placeHolder:d(9823,null),onDidFocus:c=>r.trigger(()=>this.workbenchThemeService.setProductIconTheme(c.id,void 0)),ignoreFocusLost:t});return this.workbenchThemeService.setProductIconTheme(l?l.id:n.id,"auto")}};bk=I([m(0,lt),m(1,Gp),m(2,Ge),m(3,Os)],bk);var FR=class extends oa{constructor(e){super(FR.ID,FR.TITLE.value,FR.DisabledClass,!1);this.extensionsWorkbenchService=e;this.update()}static{this.ID="workbench.extensions.action.setDisplayLanguage"}static{this.TITLE=L(9857,"Set Display Language")}static{this.EnabledClass=`${oa.LABEL_ACTION_CLASS} language`}static{this.DisabledClass=`${this.EnabledClass} disabled`}update(){this.enabled=!1,this.class=FR.DisabledClass,this.extension&&this.extensionsWorkbenchService.canSetLanguage(this.extension)&&(this.extension.gallery&&Dr===vY(this.extension.gallery)||(this.enabled=!0,this.class=FR.EnabledClass))}async run(){return this.extension&&this.extensionsWorkbenchService.setLanguage(this.extension)}};FR=I([m(0,zi)],FR);var KC=class extends oa{constructor(e,t){super(KC.ID,KC.TITLE.value,KC.DisabledClass,!1);this.extensionsWorkbenchService=e;this.localeService=t;this.update()}static{this.ID="workbench.extensions.action.clearLanguage"}static{this.TITLE=L(9855,"Clear Display Language")}static{this.EnabledClass=`${oa.LABEL_ACTION_CLASS} language`}static{this.DisabledClass=`${this.EnabledClass} disabled`}update(){this.enabled=!1,this.class=KC.DisabledClass,this.extension&&this.extensionsWorkbenchService.canSetLanguage(this.extension)&&(this.extension.gallery&&Dr!==vY(this.extension.gallery)||(this.enabled=!0,this.class=KC.EnabledClass))}async run(){return this.extension&&this.localeService.clearLocalePreference()}};KC=I([m(0,zi),m(1,oB)],KC);var Dpe=class extends st{constructor(e,t){super(Dpe.ID,Dpe.LABEL,void 0,!1);this.extensionWorkbenchService=t;this.extensionId=e}static{this.ID="workbench.extensions.action.showRecommendedExtension"}static{this.LABEL=d(9828,null)}async run(){await this.extensionWorkbenchService.openSearch(`@id:${this.extensionId}`);let[e]=await this.extensionWorkbenchService.getExtensions([{id:this.extensionId}],{source:"install-recommendation"},ve.None);return e?this.extensionWorkbenchService.open(e):null}};Dpe=I([m(1,zi)],Dpe);var sA=class extends st{constructor(e,t,o){super(sA.ID,sA.LABEL,void 0,!1);this.instantiationService=t;this.extensionWorkbenchService=o;this.extensionId=e}static{this.ID="workbench.extensions.action.installRecommendedExtension"}static{this.LABEL=d(9793,null)}async run(){await this.extensionWorkbenchService.openSearch(`@id:${this.extensionId}`);let[e]=await this.extensionWorkbenchService.getExtensions([{id:this.extensionId}],{source:"install-recommendation"},ve.None);if(e){await this.extensionWorkbenchService.open(e);try{await this.extensionWorkbenchService.install(e)}catch(t){this.instantiationService.createInstance(EZ,e,void 0,e.latestVersion,2,t).run()}}}};sA=I([m(1,F),m(2,zi)],sA);var Lpe=class extends st{constructor(e,t){super(Lpe.ID,"Ignore Recommendation");this.extension=e;this.extensionRecommendationsManagementService=t;this.class=Lpe.Class,this.tooltip=d(9764,null),this.enabled=!0}static{this.ID="extensions.ignore"}static{this.Class=`${oa.LABEL_ACTION_CLASS} ignore`}run(){return this.extensionRecommendationsManagementService.toggleGlobalIgnoredRecommendation(this.extension.identifier.id,!0),Promise.resolve()}};Lpe=I([m(1,uk)],Lpe);var Rpe=class extends st{constructor(e,t){super(Rpe.ID,"Undo");this.extension=e;this.extensionRecommendationsManagementService=t;this.class=Rpe.Class,this.tooltip=d(9837,null),this.enabled=!0}static{this.ID="extensions.ignore"}static{this.Class=`${oa.LABEL_ACTION_CLASS} undo-ignore`}run(){return this.extensionRecommendationsManagementService.toggleGlobalIgnoredRecommendation(this.extension.identifier.id,!1),Promise.resolve()}};Rpe=I([m(1,uk)],Rpe);var sRe=class extends st{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(9809,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=Ur(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=zL(e),r=lC(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,_yi).then(()=>({created:!0,extensionsFileResource:e,content:_yi})))}};sRe=I([m(2,Pe),m(3,be),m(4,Ho),m(5,ee),m(6,zf),m(7,Nt)],sRe);var KK=class extends sRe{static{this.ID="workbench.extensions.action.configureWorkspaceRecommendedExtensions"}static{this.LABEL=d(9715,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(Yue));case 3:return this.openWorkspaceConfigurationFile(this.contextService.getWorkspace().configuration)}return Promise.resolve()}};KK=I([m(2,be),m(3,Ho),m(4,Pe),m(5,ee),m(6,zf),m(7,Nt)],KK);var GK=class extends sRe{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(9714,null)}run(){let t=this.contextService.getWorkspace().folders.length===1?Promise.resolve(this.contextService.getWorkspace().folders[0]):this.commandService.executeCommand(SR);return Promise.resolve(t).then(o=>o?this.openExtensionsFile(o.toResource(Yue)):null)}};GK=I([m(2,be),m(3,Ho),m(4,Pe),m(5,ee),m(6,zf),m(7,Nt),m(8,ge)],GK);var UF=class extends st{constructor(e,t,o){super("extensions.action.statusLabel","",UF.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=`${oa.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&&Ot(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?UF.ENABLED_CLASS:UF.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=>Ot({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(kO(this.extension.local)):!1},r=()=>this.extension.local?this.extensionService.extensions.every(s=>!(Ot({id:s.identifier.value,uuid:s.uuid},this.extension.identifier)&&this.extension.server===this.extensionManagementServerService.getExtensionManagementServer(kE(s))))?!0:this.extensionService.canRemoveExtension(kO(this.extension.local)):!1;if(e!==null){if(e===0&&this.status===1)return this.initialStatus===3&&n()?d(9788,null):this.initialStatus===1&&this.version!==t&&n()?d(9848,null):null;if(e===2&&this.status===3)return this.initialStatus=this.status,r()?d(9840,null):null}if(o!==null){let s=this.extensionEnablementService.isEnabledEnablementState(o),l=this.extensionEnablementService.isEnabledEnablementState(this.enablementState);if(!s&&l)return n()?d(9738,null):null;if(s&&!l)return r()?d(9726,null):null}return null}run(){return Promise.resolve()}};UF=I([m(0,lt),m(1,Gc),m(2,Os)],UF);var LZ=class extends fB{constructor(e,t,o,n){super("extensions.sync","",LZ.SYNC_CLASS,!1,n);this.configurationService=e;this.extensionsWorkbenchService=t;this.userDataSyncEnablementService=o;this._register(H.filter(this.configurationService.onDidChangeConfiguration,r=>r.affectsConfiguration("settingsSync.ignoredExtensions"))(()=>this.update())),this._register(o.onDidChangeEnablement(()=>this.update())),this.update()}static{this.IGNORED_SYNC_CLASS=`${oa.ICON_ACTION_CLASS} extension-sync ${q.asClassName(GJe)}`}static{this.SYNC_CLASS=`${this.ICON_ACTION_CLASS} extension-sync ${q.asClassName(vlo)}`}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?LZ.IGNORED_SYNC_CLASS:LZ.SYNC_CLASS,this.tooltip=e?d(9763,null):d(9832,null)}}async run(){return super.run([[new st("extensions.syncignore",this.extensionsWorkbenchService.isExtensionIgnoredToSync(this.extension)?d(9831,null):d(9734,null),void 0,!0,()=>this.extensionsWorkbenchService.toggleExtensionIgnoredToSync(this.extension))]])}};LZ=I([m(0,B),m(1,zi),m(2,_l),m(3,F)],LZ);var cD=class extends oa{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super("extensions.status","",`${cD.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 um);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=`${oa.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:_u,message:new xe(d(9796,null))},!0);return}if(this.extension.state===3&&this.extension.gallery&&!this.extension.gallery.isSigned&&L3e(this.extension.private,await this.extensionGalleryManifestService.getExtensionGalleryManifest())){this.updateStatus({icon:_u,message:new xe(d(9808,null))},!0);return}if(this.extension.deprecationInfo){if(this.extension.deprecationInfo.extension){let r=`[${this.extension.deprecationInfo.extension.displayName}](${ic("extension.open",this.extension.deprecationInfo.extension.id)})`;this.updateStatus({icon:_u,message:new xe(d(9722,null,r))},!0)}else if(this.extension.deprecationInfo.settings){let r=`[${d(9826,null)}](${ic("workbench.action.openSettings",this.extension.deprecationInfo.settings.map(s=>`@id:${s}`).join(" "))}})`;this.updateStatus({icon:_u,message:new xe(d(9724,null,r))},!0)}else{let r=new xe(d(9720,null));this.extension.deprecationInfo.additionalInfo&&r.appendMarkdown(` ${this.extension.deprecationInfo.additionalInfo}`),this.updateStatus({icon:_u,message:r},!0)}return}if(this.extension.missingFromGallery){this.updateStatus({icon:_u,message:new xe(d(9802,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 xe;s.appendMarkdown(`${r} `),s.appendMarkdown(d(9707,null,this.extension.hasChangelog()?ic("extension.open",this.extension.identifier.id,"changelog").toString():this.extension.repository?this.extension.repository:ic("extension.open",this.extension.identifier.id).toString())),this.updateStatus({icon:_u,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:_u,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:_u,message:new xe(d(9727,null,r.value))},!0);return}}if(this.extension.enablementState===2){this.updateStatus({message:new xe(d(9729,null))},!0);return}if(this.extension.enablementState===3){this.updateStatus({message:new xe(d(9739,null))},!0);return}if(this.extension.enablementState===5){let r=hle(this.extension.local.manifest.capabilities?.virtualWorkspaces);this.updateStatus({icon:kg,message:new xe(r?BM(r):d(9728,null))},!0);return}if(LO(this.contextService.getWorkspace())){let r=this.extensionManifestPropertiesService.getExtensionVirtualWorkspaceSupportType(this.extension.local.manifest),s=hle(this.extension.local.manifest.capabilities?.virtualWorkspaces);if(r==="limited"||s){this.updateStatus({icon:_u,message:new xe(s?BM(s):d(9752,null))},!0);return}}if(this.extension.enablementState===9){this.updateStatus({icon:kg,message:new xe(d(9749,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=hle(this.extension.local.manifest.capabilities?.untrustedWorkspaces);this.updateStatus({icon:NR,message:new xe(r?BM(r):d(9748,null))},!0);return}if(this.workspaceTrustEnablementService.isWorkspaceTrustEnabled()&&!this.workspaceTrustService.isWorkspaceTrusted()){let r=this.extensionManifestPropertiesService.getExtensionUntrustedWorkspaceSupportType(this.extension.local.manifest),s=hle(this.extension.local.manifest.capabilities?.untrustedWorkspaces);if(r==="limited"||s){this.enabled=!0,this.updateStatus({icon:NR,message:new xe(s?BM(s):d(9751,null))},!0);return}}if(this.extension.enablementState===1&&!this.extensionsWorkbenchService.installed.some(r=>Ot(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 xe(`${d(9774,null,this.extensionManagementServerService.remoteExtensionManagementServer.label)} [${d(9795,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 xe(`${d(9772,null,this.extensionManagementServerService.remoteExtensionManagementServer.label)} [${d(9795,null)}](https://code.visualstudio.com/api/advanced-topics/remote-extensions#architecture-and-extension-kinds)`):Gt&&(r=new xe(`${d(9717,null,this.productService.nameLong)} [${d(9795,null)}](https://code.visualstudio.com/api/advanced-topics/remote-extensions#architecture-and-extension-kinds)`))):this.extensionManagementServerService.webExtensionManagementServer===this.extension.server&&(r=new xe(`${d(9709,null,this.productService.nameLong)} [${d(9795,null)}](https://code.visualstudio.com/api/advanced-topics/remote-extensions#architecture-and-extension-kinds)`)),r&&this.updateStatus({icon:_u,message:r},!0);return}let e=new Ei(this.extension.identifier.id),t=oe.as(Ds.ExtensionFeaturesRegistry).getExtensionFeatures();for(let r of t){let s=this.extensionFeaturesManagementService.getAccessData(e,r.id)?.current?.status,l=`[${d(9798,null)}](${ic("extension.open",this.extension.identifier.id,"features",!1,r.id)})`;if(s?.severity===St.Error){this.updateStatus({icon:gS,message:new xe().appendText(s.message).appendMarkdown(` ${l}`)},!0);return}if(s?.severity===St.Warning){this.updateStatus({icon:_u,message:new xe().appendText(s.message).appendMarkdown(` ${l}`)},!0);return}}if(this.extensionManagementServerService.remoteExtensionManagementServer){if(NL(this.extension.local.manifest)){if(!this.extensionsWorkbenchService.installed.some(l=>Ot(l.identifier,this.extension.identifier)&&l.server!==this.extension.server)){let l=this.extension.server===this.extensionManagementServerService.localExtensionManagementServer?new xe(d(9775,null,this.extensionManagementServerService.remoteExtensionManagementServer.label)):new xe(d(9776,null));this.updateStatus({icon:kg,message:l},!0)}return}let r=this.extensionService.extensions.filter(l=>Ot({id:l.identifier.value,uuid:l.uuid},this.extension.identifier))[0],s=r?this.extensionManagementServerService.getExtensionManagementServer(kE(r)):null;if(this.extension.server===this.extensionManagementServerService.localExtensionManagementServer&&s===this.extensionManagementServerService.remoteExtensionManagementServer){this.extensionManifestPropertiesService.prefersExecuteOnWorkspace(this.extension.local.manifest)&&this.updateStatus({icon:kg,message:new xe(`${d(9742,null)} [${d(9795,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:kg,message:new xe(`${d(9741,null)} [${d(9795,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:kg,message:new xe(`${d(9740,null)} [${d(9795,null)}](https://code.visualstudio.com/api/advanced-topics/remote-extensions#architecture-and-extension-kinds)`)},!0);return}}if(this.extension.enablementState===8){this.updateStatus({icon:_u,message:new xe(d(9747,null)).appendMarkdown(`&nbsp;[${d(9718,null)}](${ic("extension.open",this.extension.identifier.id,"dependencies")})`)},!0);return}if(!this.extension.local.isValid){let r=this.extension.local.validations.filter(([s])=>s===St.Error).map(([,s])=>s);this.updateStatus({icon:_u,message:new xe(r.join(" ").trim())},!0);return}let o=this.workbenchExtensionEnablementService.isEnabled(this.extension.local),n=this.extensionService.extensions.some(r=>Ot({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 xe(d(9861,null))},!0);return}if(this.extensionManagementServerService.localExtensionManagementServer&&this.extensionManagementServerService.remoteExtensionManagementServer&&this.extension.server===this.extensionManagementServerService.remoteExtensionManagementServer){this.updateStatus({message:new xe(d(9750,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 xe(d(9762,null))},!0);return}if(this.extension.enablementState===11){this.updateStatus({message:new xe(d(9860,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===NR?-1:o.icon===NR?1:n.icon===gS?-1:o.icon===gS?1:n.icon===_u?-1:o.icon===_u?1:n.icon===kg?-1:o.icon===kg?1:0)),t&&(e?.icon===gS?this.class=`${cD.CLASS} extension-status-error ${q.asClassName(gS)}`:e?.icon===_u?this.class=`${cD.CLASS} extension-status-warning ${q.asClassName(_u)}`:e?.icon===kg?this.class=`${cD.CLASS} extension-status-info ${q.asClassName(kg)}`:e?.icon===NR?this.class=`${cD.CLASS} ${q.asClassName(NR)}`:this.class=`${cD.CLASS} hide`),this._onDidChangeStatus.fire()}async run(){if(this._status[0]?.icon===NR)return this.commandService.executeCommand("workbench.trust.manage")}};cD=I([m(0,Gc),m(1,ot),m(2,ge),m(3,BL),m(4,ns),m(5,zi),m(6,lt),m(7,xp),m(8,Pe),m(9,nt),m(10,zp),m(11,Os),m(12,YI),m(13,vv)],cD);var aA=class extends st{constructor(e=aA.ID,t=aA.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(9783,null)}get enabled(){return this.extensionsWorkbenchService.local.some(e=>this.isEnabled(e))}async run(){let e=await this.quickInputService.pick(this.getExtensionEntries(),{placeHolder:d(9824,null),matchOnDetail:!0});e&&e.extension&&(await this.instantiationService.createInstance(oT,e.extension,!0).run(),await this.extensionsWorkbenchService.openSearch(e.extension.identifier.id))}isEnabled(e){return this.instantiationService.createInstance(oT,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))}};aA=I([m(2,zi),m(3,Ge),m(4,F),m(5,Os)],aA);var aRe=class extends st{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(9821,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:St.Info,message:d(9804,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(9792,null)},()=>this.installExtensions(t)),this.notificationService.info(d(9761,null)))}}};aRe=I([m(1,zi),m(2,Ge),m(3,Ne),m(4,Bo)],aRe);var lRe=class extends aRe{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(9818,null,this.extensionManagementServerService.remoteExtensionManagementServer.label):""}getQuickPickTitle(){return d(9777,null,this.extensionManagementServerService.remoteExtensionManagementServer.label)}getExtensionsToInstall(e){return e.filter(t=>{let o=this.instantiationService.createInstance(T4,!0);return o.extension=t,o.enabled})}async installExtensions(e){let t=[],o=[],n=await this.extensionManagementServerService.remoteExtensionManagementServer.extensionManagementService.getTargetPlatform();await fn.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},ve.None))[0];if(l){t.push(l);return}}let s=await this.extensionManagementServerService.localExtensionManagementServer.extensionManagementService.zip(r.local);o.push(s)})),await fn.settled(t.map(r=>this.extensionManagementServerService.remoteExtensionManagementServer.extensionManagementService.installFromGallery(r)));try{await fn.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)}}}};lRe=I([m(0,zi),m(1,Ge),m(2,Bo),m(3,Ne),m(4,Gc),m(5,ta),m(6,F),m(7,be),m(8,ne)],lRe);var cRe=class extends aRe{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(9819,null)}getQuickPickTitle(){return d(9785,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&&Ot(o.identifier,t.identifier)))}async installExtensions(e){let t=[],o=[],n=await this.extensionManagementServerService.localExtensionManagementServer.extensionManagementService.getTargetPlatform();await fn.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},ve.None))[0];if(l){t.push(l);return}}let s=await this.extensionManagementServerService.remoteExtensionManagementServer.extensionManagementService.zip(r.local);o.push(s)})),await fn.settled(t.map(r=>this.extensionManagementServerService.localExtensionManagementServer.extensionManagementService.installFromGallery(r)));try{await fn.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)}}}};cRe=I([m(1,zi),m(2,Ge),m(3,Bo),m(4,Ne),m(5,Gc),m(6,ta),m(7,be),m(8,ne)],cRe);qe.registerCommand("workbench.extensions.action.showExtensionsForLanguage",function(a,i){return a.get(zi).openSearch(`ext:${i.replace(/^\./,"")}`)});var mRe="workbench.extensions.action.showExtensionsWithIds";qe.registerCommand(mRe,function(a,i){return a.get(zi).openSearch(i.map(t=>`@id:${t}`).join(" "))});J("extensionButton.background",{dark:H$,light:H$,hcDark:null,hcLight:null},d(9753,null));J("extensionButton.foreground",{dark:Fse,light:Fse,hcDark:null,hcLight:null},d(9755,null));J("extensionButton.hoverBackground",{dark:Wse,light:Wse,hcDark:null,hcLight:null},d(9756,null));J("extensionButton.border",{dark:oIe,light:oIe,hcDark:gi,hcLight:gi},d(9754,null));J("extensionButton.separator",vgt,d(9760,null));var xlo=J("extensionButton.prominentBackground",{dark:MS,light:MS,hcDark:null,hcLight:null},d(9757,null));J("extensionButton.prominentForeground",{dark:YT,light:YT,hcDark:null,hcLight:null},d(9758,null));J("extensionButton.prominentHoverBackground",{dark:B$,light:B$,hcDark:null,hcLight:null},d(9759,null));is((a,i)=>{let e=a.getColor(av);e&&(i.addRule(`.extension-editor .header .actions-status-container > .status ${q.asCSSSelector(gS)} { color: ${e}; }`),i.addRule(`.extension-editor .body .subcontent .runtime-status ${q.asCSSSelector(gS)} { color: ${e}; }`),i.addRule(`.monaco-hover.extension-hover .markdown-hover .hover-contents ${q.asCSSSelector(gS)} { color: ${e}; }`));let t=a.getColor(Bh);t&&(i.addRule(`.extension-editor .header .actions-status-container > .status ${q.asCSSSelector(_u)} { color: ${t}; }`),i.addRule(`.extension-editor .body .subcontent .runtime-status ${q.asCSSSelector(_u)} { color: ${t}; }`),i.addRule(`.monaco-hover.extension-hover .markdown-hover .hover-contents ${q.asCSSSelector(_u)} { color: ${t}; }`));let o=a.getColor(fm);o&&(i.addRule(`.extension-editor .header .actions-status-container > .status ${q.asCSSSelector(kg)} { color: ${o}; }`),i.addRule(`.extension-editor .body .subcontent .runtime-status ${q.asCSSSelector(kg)} { color: ${o}; }`),i.addRule(`.monaco-hover.extension-hover .markdown-hover .hover-contents ${q.asCSSSelector(kg)} { color: ${o}; }`))});var $3o="NotebookEditorViewState",uD=class extends pa{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super(uD.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 P);this._widgetDisposableStore=this._register(new P);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,$3o),this._register(this._fileService.onDidChangeFileSystemProviderCapabilities(w=>this._onDidChangeFileSystemProvider(w.scheme))),this._register(this._fileService.onDidChangeFileSystemProviderRegistrations(w=>this._onDidChangeFileSystemProvider(w.scheme)))}static{this.ID=qL}get onDidFocus(){return this._onDidFocusWidget.event}get onDidBlur(){return this._onDidBlurWidget.event}_onDidChangeFileSystemProvider(e){this.input instanceof ha&&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=R(e,_(".notebook-editor")),this._rootElement.id=`notebook-editor-element-${_t()}`}getActionViewItem(e,t){if(e.id===tT)return this._register(this._instantiationService.createInstance(gB,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&&ts(e.getDomNode()||ts(e.getOverflowContainerDomNode())):!1}async setInput(e,t,o,n,r){try{let s=!1,l=Pi(1e4);l.then(()=>{s=!0,this._handlePerfMark(c,e)});let c=new RWt;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||""),vN(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(11994,null,e.viewType));await this._extensionsWorkbenchService.whenInitialized;let f=this._extensionsWorkbenchService.local.find(v=>v.identifier.id===g);throw Aj(new Error(d(11995,null,e.viewType)),[pi({id:"workbench.notebook.action.installOrEnableMissing",label:f?d(11997,null,e.viewType):d(11998,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(sA,g).run()}catch(S){this.logService.error(`Failed to install or enable extension ${g}`,S),v.dispose()}}}),pi({id:"workbench.notebook.action.openAsText",label:d(11996,null),run:async()=>{let v=await this._workingCopyBackupService.resolve({resource:e.resource,typeId:_O.create(e.viewType)});if(v){let b=await Kv(v.value);this._editorService.openEditor({resource:void 0,contents:b.toString()})}else this._editorService.openEditor({resource:e.resource,options:{override:Ys.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),Pj(s))throw s;if(s.fileOperationResult===7){let c;throw s instanceof WN?c=d(12001,null,ll.formatSize(s.size)):c=d(12000,null),Uxe(this.group,e,t,c,this._preferencesService)}throw Aj(s instanceof Error?s:new Error(s?s.message:""),[pi({id:"workbench.notebook.action.openInTextEditor",label:d(11999,null),run:async()=>{let c=this._editorService.activeEditorPane;if(!c)return;let u=no.getCanonicalUri(c.input);if(u&&u.toString()===e.resource?.toString())return this._editorService.openEditor({resource:u,options:{override:Ys.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,N,O;if(o){let V=new En;for(let U of o.cells)U.cellKind===2?(S=(S||0)+1,T=(T||0)+U.getTextLength(),w=(w||0)+U.outputs.length,k=(k||0)+U.outputs.reduce((G,$)=>G+$.outputs.reduce((te,pe)=>te+pe.data.byteLength,0),0)):(y=(y||0)+1,N=(T||0)+U.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:ms(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:N,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 ha)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 Fyi(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 ha){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 uD&&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 ha))&&(this.input.resource.toString()!==this.textModel?.uri.toString()&&this._widget.value?.hasModel()||this.isVisible()&&this._widget.value.layout(e,this._rootElement,t))}};uD=I([m(1,Te),m(2,De),m(3,F),m(4,le),m(5,ee),m(6,Et),m(7,Zc),m(8,X),m(9,be),m(10,Nn),m(11,rd),m(12,un),m(13,zi),m(14,Gm),m(15,ne),m(16,Po)],uD);var Fyi=class a{constructor(i,e){this.cellUri=i;this.selections=e}compare(i){return i instanceof a?Xe(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 klo(a,i){if(a?.getId()===uD.ID){let e=a.getControl();if(e){for(let[t,o]of e.codeEditors)if(o===i)return!0}}return!1}var Mpe=Object.freeze({type:"type",displayName:"displayName",selector:"selector",priority:"priority"}),lA=Object.freeze({id:"id",displayName:"displayName",mimeTypes:"mimeTypes",entrypoint:"entrypoint",hardDependencies:"dependencies",optionalDependencies:"optionalDependencies",requiresMessaging:"requiresMessaging"}),JJe=Object.freeze({type:"type",entrypoint:"entrypoint",localResourceRoots:"localResourceRoots"}),j3o={description:d(12026,null),type:"array",defaultSnippets:[{body:[{type:"",displayName:"",selector:[{filenamePattern:""}]}]}],items:{type:"object",required:[Mpe.type,Mpe.displayName,Mpe.selector],properties:{[Mpe.type]:{type:"string",description:d(12030,null)},[Mpe.displayName]:{type:"string",description:d(12027,null)},[Mpe.selector]:{type:"array",description:d(12028,null),items:{type:"object",properties:{filenamePattern:{type:"string",description:d(12029,null)},excludeFileNamePattern:{type:"string",description:d(12043,null)}}}},[Mpe.priority]:{type:"string",markdownDeprecationMessage:d(12048,null),enum:["default","option"],markdownEnumDescriptions:[d(12049,null),d(12050,null)],default:"default"}}}},Elo=Object.freeze({id:"",displayName:"",mimeTypes:[""],entrypoint:""}),Q3o={description:d(12031,null),type:"array",defaultSnippets:[{body:[Elo]}],items:{defaultSnippets:[{body:Elo}],allOf:[{type:"object",required:[lA.id,lA.displayName],properties:{[lA.id]:{type:"string",description:d(12041,null)},[lA.displayName]:{type:"string",description:d(12032,null)},[lA.hardDependencies]:{type:"array",uniqueItems:!0,items:{type:"string"},markdownDescription:d(12035,null)},[lA.optionalDependencies]:{type:"array",uniqueItems:!0,items:{type:"string"},markdownDescription:d(12036,null)},[lA.requiresMessaging]:{default:"never",enum:["always","optional","never"],enumDescriptions:[d(12038,null),d(12040,null),d(12039,null)],description:d(12037,null)}}},{oneOf:[{required:[lA.entrypoint,lA.mimeTypes],properties:{[lA.mimeTypes]:{type:"array",description:d(12042,null),items:{type:"string"}},[lA.entrypoint]:{description:d(12033,null),type:"string"}}},{required:[lA.entrypoint],properties:{[lA.entrypoint]:{description:d(12033,null),type:"object",required:["extends","path"],properties:{extends:{type:"string",description:d(12034,null)},path:{type:"string",description:d(12033,null)}}}}}]}]}},Y3o={description:d(12046,null),type:"array",defaultSnippets:[{body:[{type:"",entrypoint:""}]}],items:{type:"object",required:[JJe.type,JJe.entrypoint],properties:{[JJe.type]:{type:"string",description:d(12047,null)},[JJe.entrypoint]:{type:"string",description:d(12044,null)},[JJe.localResourceRoots]:{type:"array",items:{type:"string"},description:d(12045,null)}}}},Tlo=Tn.registerExtensionPoint({extensionPoint:"notebooks",jsonSchema:j3o,activationEventsGenerator:function*(a){for(let i of a)i.type&&(yield`onNotebookSerializer:${i.type}`)}}),_lo=Tn.registerExtensionPoint({extensionPoint:"notebookRenderer",jsonSchema:Q3o,activationEventsGenerator:function*(a){for(let i of a)i.id&&(yield`onRenderer:${i.id}`)}}),Dlo=Tn.registerExtensionPoint({extensionPoint:"notebookPreload",jsonSchema:Y3o}),Wyi=class extends C{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(12051,null),d(12053,null)],n=t.sort((r,s)=>r.type.localeCompare(s.type)).map(r=>[r.type,r.displayName]);return{data:{headers:o,rows:n},dispose:()=>{}}}},Vyi=class extends C{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(12054,null),d(12052,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:()=>{}}}};oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:"notebooks",label:d(12056,null),access:{canToggle:!1},renderer:new Mt(Wyi)});oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:"notebookRenderer",label:d(12055,null),access:{canToggle:!1},renderer:new Mt(Vyi)});var Byi=class extends gg{constructor(e,t){super();this.original=e;this.modified=t}},yw=class extends Fa{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=ha.getOrCreate(e,r,void 0,s),c=ha.getOrCreate(e,t,void 0,s);return e.createInstance(yw,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 yw.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 Byi(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 yw?this.modified.matches(e.modified)&&this.original.matches(e.original)&&this.viewType===e.viewType:db(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}};yw=I([m(5,ee)],yw);var NWt=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)}},OWt=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)})}},FWt=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 MZ=class extends C{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=>{oL(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=>oL(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=I9i(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 M4=class a extends C{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 P);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 MZ(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:X3o(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(n1(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===Fr||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 Ly,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=Ir([Ir(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 QK(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=mc(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(){Ue(this._outputs);let e=new N9([],"",`
`,!1,!1,!0,!0);e.dispose(),this._textBuffer=e,super.dispose()}};function jK(a){return{source:a.getValue(),language:a.language,mime:a.mime,cellKind:a.cellKind,outputs:a.outputs.map(i=>({outputs:i.outputs,outputId:_t()})),metadata:{}}}function X3o(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 QK(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),rF(t?Hyi(n):n,{})}function Hyi(a){return Array.isArray(a)?a.map(Hyi):a!=null&&typeof a=="object"&&Object.keys(a).length>0?Object.keys(a).sort().reduce((i,e)=>(i[e]=Hyi(a[e]),i),{}):a}var Uyi=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()}}},zyi=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 Uyi(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)}},Kyi=class extends Pm{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}},PZ=class extends C{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===Y.vscodeNotebookCell&&f instanceof Bu){let v=Zo.parse(f.uri);if(v&&Xe(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 Kyi({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 zyi(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 M4(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),Ue(this._cellListeners.values()),this._cellListeners.clear(),Ue(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=>Wo(n,{outputs:!0})&&n.outputs.some(r=>r.outputId===e));if(o){if(Wo(o,{index:!0}))return o.index;if(Wo(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=PZ.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:DM(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=DM(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||Wo(t,{index:!0})&&!this.newCellsFromLastEdit.has(this.cells[t.index].handle)||Wo(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(Wo(u,{index:!0}))h=u.index;else if(Wo(u,{handle:!0}))h=this._getCellIndexByHandle(u.handle),this._assertIndex(h);else if(Wo(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(mo),c=this._mergeCellEdits(s).sort((u,p)=>u.end===void 0||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 MZ(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 M4(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 Bu&&(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=H3e(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 OWt(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 FWt(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 MZ(l))},!1,o);return}new MM(new WWt(e.outputs),new WWt(t)).ComputeDiff(!1).changes.map(l=>({start:l.originalStart,deleteCount:l.originalLength,newOutputs:t.slice(l.modifiedStart,l.modifiedStart+l.modifiedLength).map(c=>new MZ(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 NWt(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){if(this._indexIsInvalid(e))throw new Error(`model index out of range ${e}`)}_indexIsInvalid(e){return e<0||e>=this._cells.length}findNextMatch(e,t,o,n,r,s){this._assertIndex(t.cellIndex);let c=new Oy(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 Ie(1,1)}return null}findMatches(e,t,o,n){let s=new Oy(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}};PZ=I([m(5,Cl),m(6,Ct),m(7,kt),m(8,eS),m(9,rs),m(10,_v)],PZ);var WWt=class{constructor(i){this.outputs=i}getElements(){return this.outputs.map(i=>Ir(i.outputs.map(e=>({mime:e.mime,data:e.data}))))}};var VWt=class{constructor(i){this.value=new Set(i),this.defined=this.value.size>0}matches(i){return i.some(e=>this.value.has(e))}},BWt=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:je(this.extensionLocation,i.entrypoint)}:this.entrypoint={extends:i.entrypoint.extends,path:je(this.extensionLocation,i.entrypoint.path)},this.displayName=i.displayName,this.mimeTypes=i.mimeTypes,this.mimeTypeGlobs=this.mimeTypes.map(e=>zm(e,{ignoreCase:!0})),this.hardDependencies=new VWt(i.dependencies??ht.empty()),this.optionalDependencies=new VWt(i.optionalDependencies??ht.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)}},HWt=class{constructor(i){this.type=i.type,this.entrypoint=je(i.extension.extensionLocation,i.entrypoint),this.extensionLocation=i.extension.extensionLocation,this.localResourceRoots=i.localResourceRoots.map(e=>je(i.extension.extensionLocation,e))}};var AZ=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"||eP(i))&&Cp(i,No(e.fsPath),{ignoreCase:!0}))return!0;if(!pkt(i))return!1;let t=i.include,o=i.exclude;return Cp(t,No(e.fsPath),{ignoreCase:!0})?!(o&&Cp(o,No(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(eP(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 e8o="multi-cell-notebook-diff-editor",Ppe=class a extends yw{static{this.ID="workbench.input.multiDiffNotebookInput"}static create(i,e,t,o,n,r){let s=ha.getOrCreate(i,n,void 0,r),l=ha.getOrCreate(i,e,void 0,r);return i.createInstance(a,t,o,s,l,r)}},NZ=class extends xu{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(`${e8o}:${new Date().getMilliseconds().toString()+Math.random().toString()}`);return t.createInstance(NZ,o,e)}canHandleUri(e){return e.toString()===this.multiDiffSource.toString()}async resolveDiffSource(e){return{resources:this.notebookDiffViewModel}}};NZ=I([m(2,Nt),m(3,Nn),m(4,F),m(5,Rz),m(6,Ho)],NZ);var dA=class extends C{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 P);this._memento=new Bl(dA.CUSTOM_EDITORS_STORAGE_ID,e);let p=this._memento.getMemento(0,1);this._editorResolverService.bufferChangeEvents(()=>{for(let h of p[dA.CUSTOM_EDITORS_ENTRY_ID]||[])this.add(new AZ(h),!1)}),this._register(t.onDidRegisterExtensions(()=>{this._handled||(this._clear(),p[dA.CUSTOM_EDITORS_ENTRY_ID]=[],this._memento.saveMemento())})),Tlo.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 AZ({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[dA.CUSTOM_EDITORS_ENTRY_ID]=Array.from(this._contributedEditors.values()),this._memento.saveMemento()}clearEditorCache(){let e=this._memento.getMemento(0,1);e[dA.CUSTOM_EDITORS_ENTRY_ID]=[],this._memento.saveMemento()}_convertPriority(e){return e?e==="default"?"default":"option":"default"}_registerContributionPoint(e){let t=new P;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(ft.textDiffEditorPreview)&&!this._accessibilityService.isScreenReaderOptimized(),canSupportResource:f=>f.scheme===Y.vscodeNotebookCellOutput?new URLSearchParams(f.query).get("openIn")==="notebook":f.scheme===Y.untitled||f.scheme===Y.vscodeNotebookCell||this._fileService.hasProvider(f)},l=async({resource:f,options:v})=>{let b;if(f.scheme===Y.vscodeNotebookCellOutput){let N=Zo.parseCellOutputUri(f);if(!N||!N.notebook||N.cellHandle===void 0)throw new Error("Invalid cell output uri");b={notebook:N.notebook,handle:N.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===Y.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(U=>U.object.notebook.cells.findIndex(G=>G.handle===b?.handle)).then(U=>U>=0?U: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:ha.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 H.once(b.object.notebook.onWillDispose)(()=>{b.dispose()}),{editor:ha.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:Ppe.create(this._instantiationService,b.resource,y,w,S.resource,e.id)}:{editor:yw.create(this._instantiationService,b.resource,y,w,S.resource,e.id)}},h={createEditorInput:l,createDiffEditorInput:u,createUntitledEditorInput:c,createMergeEditorInput:f=>({editor:this._instantiationService.createInstance(hb,f.base.resource,{uri:f.input1.resource,title:f.input1.label??Ye(f.input1.resource),description:f.input1.description??"",detail:f.input1.detail},{uri:f.input2.resource,title:f.input2.label??Ye(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(ft.textDiffEditorPreview)&&(!!this._configurationService.getValue(ft.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(ft.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(`${Y.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[dA.CUSTOM_EDITORS_ENTRY_ID]=Array.from(this._contributedEditors.values()),this._memento.saveMemento()}return this._register(Z(()=>{let n=this._memento.getMemento(0,1);n[dA.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===Y.untitled?Array.from(this._contributedEditors.values()):t}[Symbol.iterator](){return this._contributedEditors.values()}};dA=I([m(0,le),m(1,lt),m(2,ul),m(3,B),m(4,Bi),m(5,F),m(6,be),m(7,mh),m(8,dt)],dA);var ZJe=class{constructor(i){this.contributedRenderers=new Map;this.preferredMimetype=new co(()=>this.preferredMimetypeMemento.getMemento(1,1));this.preferredMimetypeMemento=new Bl("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||S9i.get(p)?.has(s)?512:c.isBuiltin?1024:768;return{ordered:{mimeType:e,rendererId:c.id,isTrusted:!0},score:h|u}}).filter(mo);return l.length===0?[{mimeType:e,rendererId:az,isTrusted:!0}]:l.sort((c,u)=>c.score-u.score).map(c=>c.ordered)}};ZJe=I([m(0,le)],ZJe);var Gyi=class{constructor(i,e){this.model=i;this._modelEventListeners=new P;this._modelEventListeners.add(i.onWillDispose(()=>e(i)))}get uri(){return this.model.uri}getCellIndex(i){return this.model.cells.findIndex(e=>Xe(e.uri,i))}dispose(){this._modelEventListeners.dispose()}},OZ=class extends C{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(ZJe),this._onDidChangeOutputRenderers=this._register(new E),this.onDidChangeOutputRenderers=this._onDidChangeOutputRenderers.event,this._notebookStaticPreloadInfoStore=new Set,this._models=new vt,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,_lo.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 BWt({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()}),Dlo.setHandler(c=>{this._notebookStaticPreloadInfoStore.clear();for(let u of c)if(Ea(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 HWt({type:h,extension:u.description,entrypoint:p.entrypoint,localResourceRoots:p.localResourceRoots??[]}))}});let l=()=>{this._displayOrder=new ukt(this._configurationService.getValue(ft.displayOrder)||[],this._accessibilityService.isScreenReaderOptimized()?b9i:jci)};l(),this._register(this._configurationService.onDidChangeConfiguration(c=>{c.affectsConfiguration(ft.displayOrder)&&l()})),this._register(this._accessibilityService.onDidChangeScreenReaderOptimized(()=>{l()})),this._memento=new Bl(OZ._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(dA))),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 AZ({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 YL(e,o,t))}async withNotebookDataProvider(e){let t=this.notebookProviderInfoStore.get(e);if(!t){let n=this.getViewTypeProvider(e),r=n?[pi({id:"workbench.notebook.action.installMissingViewType",label:d(12096,null,e),run:async()=>{await this._instantiationService.createInstance(sA,n).run()}})]:[];throw dU(`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(ft.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 YL))throw new Error("CANNOT open file notebook with this provider");let r=o?await Kv(o):Je.fromByteArray([]),s=await n.serializer.dataToNotebook(r),l=this._instantiationService.createInstance(PZ,n.viewType,t,s.cells,s.metadata,n.serializer.options),c=new Gyi(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 YL))throw new Error("CANNOT open file notebook with this provider");let s=r.serializer,l=this._configurationService.getValue(ft.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 ho;return WT(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 YL))throw new Error("CANNOT open file notebook with this provider");let s=r.serializer,l=await Kv(o),c=await r.serializer.dataToNotebook(l);return n.restoreSnapshot(c,s.options),n}getNotebookTextModel(e){return this._models.get(e)?.model}getNotebookTextModels(){return ht.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===az?1:0)-(l.rendererId===az?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}}};OZ=I([m(0,lt),m(1,B),m(2,Bi),m(3,F),m(4,le),m(5,Ij)],OZ);var UWt=(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))(UWt||{}),t8o=Object.keys(UWt).filter(a=>!isNaN(Number(a))).map(a=>Number(a)).sort((a,i)=>i-a);function i8o(a){for(let i of t8o)if(a>=i)return i;return-1}var $yi=class{constructor(){this.styleSheet=hr(),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(i8o(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};
`}),Vh(":root",i,this.styleSheet)}},o8o=new $yi;function Sk(a,i,e){return o8o.registerZIndex(a,i,e)}var qyi=Re("debug-console-view-icon",M.debugConsole,d(8982,null)),jyi=Re("run-view-icon",M.debugAlt,d(9002,null)),Llo=Re("variables-view-icon",M.debugAlt,d(9003,null)),Rlo=Re("watch-view-icon",M.debugAlt,d(9009,null)),Mlo=Re("callstack-view-icon",M.debugAlt,d(8956,null)),zWt=Re("breakpoints-view-icon",M.debugAlt,d(8955,null)),Plo=Re("loaded-scripts-view-icon",M.debugAlt,d(9001,null)),zF={regular:Re("debug-breakpoint",M.debugBreakpoint,d(8958,null)),disabled:Re("debug-breakpoint-disabled",M.debugBreakpointDisabled,d(8965,null)),unverified:Re("debug-breakpoint-unverified",M.debugBreakpointUnverified,d(8975,null)),pending:Re("debug-breakpoint-pending",M.debugBreakpointPending,d(8973,null))},Qyi={regular:Re("debug-breakpoint-function",M.debugBreakpointFunction,d(8966,null)),disabled:Re("debug-breakpoint-function-disabled",M.debugBreakpointFunctionDisabled,d(8967,null)),unverified:Re("debug-breakpoint-function-unverified",M.debugBreakpointFunctionUnverified,d(8968,null))},Yyi={regular:Re("debug-breakpoint-conditional",M.debugBreakpointConditional,d(8959,null)),disabled:Re("debug-breakpoint-conditional-disabled",M.debugBreakpointConditionalDisabled,d(8960,null)),unverified:Re("debug-breakpoint-conditional-unverified",M.debugBreakpointConditionalUnverified,d(8961,null))},Xyi={regular:Re("debug-breakpoint-data",M.debugBreakpointData,d(8962,null)),disabled:Re("debug-breakpoint-data-disabled",M.debugBreakpointDataDisabled,d(8963,null)),unverified:Re("debug-breakpoint-data-unverified",M.debugBreakpointDataUnverified,d(8964,null))},KWt={regular:Re("debug-breakpoint-log",M.debugBreakpointLog,d(8970,null)),disabled:Re("debug-breakpoint-log-disabled",M.debugBreakpointLogDisabled,d(8971,null)),unverified:Re("debug-breakpoint-log-unverified",M.debugBreakpointLogUnverified,d(8972,null))},eZe=Re("debug-hint",M.debugHint,d(8969,null)),GWt=Re("debug-breakpoint-unsupported",M.debugBreakpointUnsupported,d(8974,null)),$Wt=[zF,Qyi,Yyi,Xyi,KWt],Ape=Re("debug-stackframe",M.debugStackframe,d(8993,null)),Npe=Re("debug-stackframe-focused",M.debugStackframeFocused,d(8994,null)),Alo=Re("debug-gripper",M.gripper,d(8985,null)),tZe=Re("debug-restart-frame",M.debugRestartFrame,d(8990,null)),P4=Re("debug-stop",M.debugStop,d(9000,null)),KF=Re("debug-disconnect",M.debugDisconnect,d(8984,null)),Ope=Re("debug-restart",M.debugRestart,d(8989,null)),Fpe=Re("debug-step-over",M.debugStepOver,d(8999,null)),FZ=Re("debug-step-into",M.debugStepInto,d(8997,null)),WZ=Re("debug-step-out",M.debugStepOut,d(8998,null)),iZe=Re("debug-step-back",M.debugStepBack,d(8996,null)),Wpe=Re("debug-pause",M.debugPause,d(8987,null)),Vpe=Re("debug-continue",M.debugContinue,d(8983,null)),oZe=Re("debug-reverse-continue",M.debugReverseContinue,d(8991,null)),Nlo=Re("debug-run",M.run,d(8992,null)),qWt=Re("debug-start",M.debugStart,d(8995,null)),hRe=Re("debug-configure",M.gear,d(8977,null)),F1d=Re("debug-console",M.gear,d(8978,null)),Olo=Re("debug-remove-config",M.trash,d(8988,null)),W1d=Re("debug-collapse-all",M.collapseAll,d(8976,null)),Flo=Re("callstack-view-session",M.bug,d(8957,null)),Wlo=Re("debug-console-clear-all",M.clearAll,d(8979,null)),Vlo=Re("watch-expressions-remove-all",M.closeAll,d(9008,null)),Blo=Re("watch-expression-remove",M.removeClose,d(9004,null)),Hlo=Re("watch-expressions-add",M.add,d(9005,null)),Ulo=Re("watch-expressions-add-function-breakpoint",M.add,d(9007,null)),zlo=Re("watch-expressions-add-data-breakpoint",M.variableGroup,d(9006,null)),Klo=Re("breakpoints-remove-all",M.closeAll,d(8954,null)),Glo=Re("breakpoints-activate",M.activateBreakpoints,d(8953,null)),$lo=Re("debug-console-evaluation-input",M.arrowSmallRight,d(8980,null)),qlo=Re("debug-console-evaluation-prompt",M.chevronRight,d(8981,null)),jWt=Re("debug-inspect-memory",M.fileBinary,d(8986,null));var jlo=J("debugToolBar.background",{dark:"#333333",light:"#F3F3F3",hcDark:"#000000",hcLight:"#FFFFFF"},d(8877,null)),Qlo=J("debugToolBar.border",null,d(8878,null)),gRe=J("debugIcon.startForeground",{dark:"#89D185",light:"#388A34",hcDark:"#89D185",hcLight:"#388A34"},d(8871,null));function Ylo(){let a=J("debugTokenExpression.name",{dark:"#c586c0",light:"#9b46b0",hcDark:ko,hcLight:ko},"Foreground color for the token names shown in the debug views (ie. the Variables or Watch view)."),i=J("debugTokenExpression.type",{dark:"#4A90E2",light:"#4A90E2",hcDark:ko,hcLight:ko},"Foreground color for the token types shown in the debug views (ie. the Variables or Watch view)."),e=J("debugTokenExpression.value",{dark:"#cccccc99",light:"#6c6c6ccc",hcDark:ko,hcLight:ko},"Foreground color for the token values shown in the debug views (ie. the Variables or Watch view)."),t=J("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=J("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=J("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=J("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=J("debugView.exceptionLabelForeground",{dark:ko,light:"#FFF",hcDark:ko,hcLight:ko},"Foreground color for a label shown in the CALL STACK view when the debugger breaks on an exception."),l=J("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=J("debugView.stateLabelForeground",ko,"Foreground color for a label in the CALL STACK view showing the current session's or thread's state."),u=J("debugView.stateLabelBackground","#88888844","Background color for a label in the CALL STACK view showing the current session's or thread's state."),p=J("debugView.valueChangedHighlight","#569CD6","Color used to highlight value changes in the debug views (ie. in the Variables view)."),h=J("debugConsole.infoForeground",{dark:fm,light:fm,hcDark:ko,hcLight:ko},"Foreground color for info messages in debug REPL console."),g=J("debugConsole.warningForeground",{dark:Bh,light:Bh,hcDark:"#008000",hcLight:Bh},"Foreground color for warning messages in debug REPL console."),f=J("debugConsole.errorForeground",Rse,"Foreground color for error messages in debug REPL console."),v=J("debugConsole.sourceForeground",ko,"Foreground color for source filenames in debug REPL console."),b=J("debugConsoleInputIcon.foreground",ko,"Foreground color for debug console input marker icon."),S=J("debugIcon.pauseForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(8869,null)),y=J("debugIcon.stopForeground",{dark:"#F48771",light:"#A1260D",hcDark:"#F48771",hcLight:"#A1260D"},d(8876,null)),w=J("debugIcon.disconnectForeground",{dark:"#F48771",light:"#A1260D",hcDark:"#F48771",hcLight:"#A1260D"},d(8868,null)),k=J("debugIcon.restartForeground",{dark:"#89D185",light:"#388A34",hcDark:"#89D185",hcLight:"#388A34"},d(8870,null)),T=J("debugIcon.stepOverForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(8875,null)),N=J("debugIcon.stepIntoForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(8873,null)),O=J("debugIcon.stepOutForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(8874,null)),V=J("debugIcon.continueForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(8867,null)),U=J("debugIcon.stepBackForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(8872,null));is((G,$)=>{let te=G.getColor(rv),pe=G.getColor(Yw),de=G.getColor(hgt),se=G.getColor(s),Se=G.getColor(l),ke=G.getColor(c),Ee=G.getColor(u),He=G.getColor(p),Ve=G.getColor(Mse);$.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: ${de}
			}

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

			/* Line & column number "badge" for unselected call stack row (basically all other rows) */
			.debug-pane .line-number {
				background-color: ${te.transparent(.6)};
				color: ${pe.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: ${Ee};
				color: ${ke};
			}

			/* 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: ${Se};
				color: ${se};
			}

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

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

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

			.monaco-list-row .expression .lazy-button:hover {
				background-color: ${Ve}
			}
		`);let Fe=G.getColor(gi);Fe&&$.addRule(`
			.debug-pane .line-number {
				border: 1px solid ${Fe};
			}
			`),Ug(G.type)&&$.addRule(`
			.debug-pane .line-number {
				background-color: ${te};
				color: ${pe};
			}`);let Qt=G.getColor(a),Ze=G.getColor(i),Ti=G.getColor(e),ti=G.getColor(t),bo=G.getColor(o),Ro=G.getColor(r),_o=G.getColor(n);$.addRule(`
			.monaco-workbench .monaco-list-row .expression .name {
				color: ${Qt};
			}

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

			.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: ${ti};
			}

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

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

			.monaco-workbench .monaco-list-row .expression .value.number,
			.monaco-workbench .debug-hover-widget .value.number {
				color: ${_o};
			}
		`);let sr=G.getColor(Vy)||Oe.fromHex("#80808060"),ln=G.getColor(h),en=G.getColor(g),Ws=G.getColor(f),ba=G.getColor(v),Id=G.getColor(b);$.addRule(`
			.repl .repl-input-wrapper {
				border-top: 1px solid ${sr};
			}

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

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

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

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

			.monaco-workbench .repl .repl-tree .monaco-tl-contents .arrow {
				color: ${Id};
			}
		`),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 Dg=G.getColor(gRe);Dg&&$.addRule(`.monaco-workbench ${q.asCSSSelector(qWt)} { color: ${Dg}; }`);let yd=G.getColor(S);yd&&$.addRule(`.monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(Wpe)}, .monaco-workbench ${q.asCSSSelector(Wpe)} { color: ${yd}; }`);let uu=G.getColor(y);uu&&$.addRule(`.monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(P4)},.monaco-workbench ${q.asCSSSelector(P4)} { color: ${uu}; }`);let Jm=G.getColor(w);Jm&&$.addRule(`.monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(KF)},.monaco-workbench .debug-view-content ${q.asCSSSelector(KF)}, .monaco-workbench .debug-toolbar ${q.asCSSSelector(KF)}, .monaco-workbench .command-center-center ${q.asCSSSelector(KF)} { color: ${Jm}; }`);let Dh=G.getColor(k);Dh&&$.addRule(`.monaco-workbench ${q.asCSSSelector(Ope)}, .monaco-workbench ${q.asCSSSelector(tZe)}, .monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(Ope)}, .monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(tZe)} { color: ${Dh}; }`);let Rp=G.getColor(T);Rp&&$.addRule(`.monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(Fpe)}, .monaco-workbench ${q.asCSSSelector(Fpe)} { color: ${Rp}; }`);let Uv=G.getColor(N);Uv&&$.addRule(`.monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(FZ)}, .monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(FZ)}, .monaco-workbench ${q.asCSSSelector(FZ)} { color: ${Uv}; }`);let Cr=G.getColor(O);Cr&&$.addRule(`.monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(WZ)}, .monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(WZ)}, .monaco-workbench ${q.asCSSSelector(WZ)} { color: ${Cr}; }`);let sx=G.getColor(V);sx&&$.addRule(`.monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(Vpe)}, .monaco-workbench ${q.asCSSSelector(Vpe)}, .monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(oZe)}, .monaco-workbench ${q.asCSSSelector(oZe)} { color: ${sx}; }`);let Lg=G.getColor(U);Lg&&$.addRule(`.monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(iZe)}, .monaco-workbench ${q.asCSSSelector(iZe)} { color: ${Lg}; }`)})}var nZe=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 tm(a,i){nZe.INSTANCE.registerEditorContribution(a,i)}var A4;(e=>{function a(){return nZe.INSTANCE.getEditorContributions()}e.getEditorContributions=a;function i(t){return nZe.INSTANCE.getEditorContributions().filter(o=>t.indexOf(o.id)>=0)}e.getSomeEditorContributions=i})(A4||={});var Jyi=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)}},n8o=new Jyi;function Xlo(...a){n8o.debug(...a)}var rZe=class{constructor(i,e){this.source=i;this.value=e;this.type=1}},QWt=class{constructor(i){this.source=i;this.type=2}},YWt=class{constructor(i,e){this.source=i;this.cell=e;this.type=3}};var dp=class extends C{constructor(){super();this.cellDisposables=this._register(new P)}prepareRenderCell(e){}renderCell(e){this.currentCell=e,WR(()=>this.didRenderCell(e))}didRenderCell(e){}unrenderCell(e){this.currentCell=void 0,this.cellDisposables.clear()}prepareLayout(){}updateInternalLayoutNow(e){}updateState(e,t){}updateForExecutionState(e,t){}},sZe=class extends C{constructor(){super();this.cellDisposables=this._register(new P)}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 WR(a){try{return a()}catch(i){return mt(i),null}}var aZe=class a extends C{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)WR(()=>t.prepareRenderCell(e));for(let t of this.overlayParts)WR(()=>t.prepareRenderCell(e));for(let t of this.contentParts)WR(()=>t.renderCell(e));this._scheduledOverlayRendering.value=T6(this.targetWindow,()=>{for(let t of this.overlayParts)WR(()=>t.renderCell(e))})}unrenderCell(e){for(let t of this.contentParts)WR(()=>t.unrenderCell(e));this._scheduledOverlayRendering.value=void 0,this._scheduledOverlayUpdateState.value=void 0,this._scheduledOverlayUpdateExecutionState.value=void 0;for(let t of this.overlayParts)WR(()=>t.unrenderCell(e))}updateInternalLayoutNow(e){for(let t of this.contentParts)WR(()=>t.updateInternalLayoutNow(e));for(let t of this.overlayParts)WR(()=>t.updateInternalLayoutNow(e))}prepareLayout(){for(let e of this.contentParts)WR(()=>e.prepareLayout())}updateState(e,t){for(let o of this.contentParts)WR(()=>o.updateState(e,t));this._scheduledOverlayUpdateState.value=T6(this.targetWindow,()=>{for(let o of this.overlayParts)WR(()=>o.updateState(e,t))})}updateForExecutionState(e,t){for(let o of this.contentParts)WR(()=>o.updateForExecutionState(e,t));this._scheduledOverlayUpdateExecutionState.value=T6(this.targetWindow,()=>{for(let o of this.overlayParts)WR(()=>o.updateForExecutionState(e,t))})}};var r8o=0,VZ=class extends C{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=Le("outputVisible",!1);this.outputHandle=r8o++}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!==az&&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 fRe=class extends C{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"?Zn.markdown:Zn.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&&iA(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,Ue(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=SZ(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 Yt(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 Yt?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 Oy(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(),Ue(this._editorListeners),this._undoRedoService.getUriComparisonKey(this.uri)===this.uri.toString()&&this._undoRedoService.removeElements(this.uri),this._textModelRef?.dispose()}toJSON(){return{handle:this.handle}}};var Ik=ae("IInlineChatSessionService");var vRe=500,Qm=class extends fRe{constructor(e,t,o,n,r,s,l,c,u,p){super(e,t,_t(),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 Pm);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=Le("excecutionError",void 0);this._hasFindResult=this._register(new E);this.hasFindResult=this._hasFindResult.event;this._outputViewModels=this.model.outputs.map(g=>new VZ(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 VZ(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),Ue(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 N=this.estimateEditorHeight(e.font?.lineHeight??this._layoutInfo.fontInfo?.lineHeight);p=N.editorHeight,g=N.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 N=this.estimateEditorHeight(e.font?.lineHeight??this._layoutInfo.fontInfo?.lineHeight);p=N.editorHeight,g=N.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 KT(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,Ue(this._outputViewModels)}};Qm=I([m(4,B),m(5,un),m(6,Nt),m(7,Cl),m(8,Kt),m(9,Ik)],Qm);var kb=class extends fRe{constructor(e,t,o,n,r,s,l,c,u,p){super(e,t,_t(),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 YWt(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}};kb=I([m(5,B),m(6,Nt),m(7,Cl),m(8,Kt),m(9,Ik)],kb);var Upe=class extends dp{constructor(e,t){super();this.instantiationService=t;this.cellContextKeyManager=this._register(this.instantiationService.createInstance(zpe,e,void 0))}didRenderCell(e){this.cellContextKeyManager.updateForElement(e)}};Upe=I([m(1,F)],Upe);var zpe=class extends C{constructor(e,t,o,n){super();this.notebookEditor=e;this.element=t;this._contextKeyService=o;this._notebookExecutionStateService=n;this.elementDisposables=this._register(new P);this._contextKeyService.bufferChangeEvents(()=>{this.cellType=hS.bindTo(this._contextKeyService),this.cellEditable=bw.bindTo(this._contextKeyService),this.cellFocused=Cpe.bindTo(this._contextKeyService),this.cellEditorFocused=AR.bindTo(this._contextKeyService),this.markdownEditMode=wZ.bindTo(this._contextKeyService),this.cellRunState=xpe.bindTo(this._contextKeyService),this.cellExecuting=vWt.bindTo(this._contextKeyService),this.cellHasOutputs=gk.bindTo(this._contextKeyService),this.cellContentCollapsed=JLe.bindTo(this._contextKeyService),this.cellOutputCollapsed=HJe.bindTo(this._contextKeyService),this.cellLineNumbers=BJe.bindTo(this._contextKeyService),this.cellResource=Hao.bindTo(this._contextKeyService),this.cellHasErrorDiagnostics=kpe.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 Qm&&(this.elementDisposables.add(e.onDidChangeOutputs(()=>this.updateForOutputs())),this.elementDisposables.add(he(t=>{this.cellHasErrorDiagnostics.set(!!t.readObservable(e.executionErrorDiagnostic))}))),this.elementDisposables.add(this.notebookEditor.onDidChangeActiveCell(()=>this.updateForFocusState())),this.element instanceof kb?this.cellType.set("markup"):this.element instanceof Qm&&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 kb?(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 kb?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 Qm?this.cellHasOutputs.set(this.element.outputsViewModels.length>0):this.cellHasOutputs.set(!1)}};zpe=I([m(2,X),m(3,rs)],zpe);var l8o=_,Zlo="cell-dragging",Zyi="global-drag-active",lZe=class extends dp{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(Zlo,e.dragging)}},XWt=class extends C{constructor(e,t){super();this.notebookEditor=e;this.notebookListContainer=t;this.draggedCells=[];this.isScrolling=!1;this.listOnWillScrollListener=this._register(new me);this.listInsertionIndicator=R(t,l8o(".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 jo(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(Zyi)}onGlobalDragStart(){this.notebookEditor.getDomNode().classList.add(Zyi)}onGlobalDragEnd(){this.notebookEditor.getDomNode().classList.remove(Zyi)}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=wY(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&&!it||o.altKey&&it;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:Lf([v]).map(w=>jK(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 c8o(this.notebookEditor,e,t,n)}onCellDragLeave(e){(!e.browserEvent.relatedTarget||!gs(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(Zlo),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 c8o(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 N=s-b.start;u=w+N}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 JWt=class{constructor(i){this._items=[];this._whitespace=[];this._prefixSumComputer=new VSe([]);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}},ZWt=class extends Lye{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 JWt(e);return o.restoreWhitespace(t.getWhitespaces()),o}else return new JWt(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 eVt=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(ft.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 ewi=()=>{throw new Error("Invalid notebook view zone change accessor")},tVt=class extends C{constructor(e,t){super();this.listView=e;this.coordinator=t;this.domNode=or(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 d8o(e,o),o.addZone=ewi,o.removeZone=ewi,o.layoutZone=ewi,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:or(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 d8o(a,i){try{a(i)}catch(e){mt(e)}}var twi=class a extends K{static{this.viewZoneIds=[]}constructor(){super({id:"notebook.developer.addViewZones",title:L(12146,"Toggle Notebook View Zones"),category:We.Developer,precondition:Gq,f1:!0})}async run(i){let e=i.get(ee),t=qn(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(twi);var iVt=class extends C{constructor(e){super();this.listView=e;this._lastOverlayId=0;this._overlays=Object.create(null);this.domNode=or(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:or(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 iwi(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 Kpe=5e3;function p8o(a){let i=0-(parseInt(a.style.top,10)||0);return i>=0&&i<=Kpe*2}var bRe=class extends Rl{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 P;this._viewModelStore=new P;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;$u.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=tce.bindTo(s);g.set("none");let f=ice.bindTo(s);f.set("none");let v=this._localDisposableStore.add(new me),b=this._localDisposableStore.add(new me);this._notebookCellAnchor=new eVt(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=Kn(this.view.indexAt(w),0,this.view.length-1),N=this.view.element(T),O=this._viewModel.getCellIndex(N),V=Kn(this.view.indexAt(k),0,this.view.length-1),U=this.view.element(V),G=this._viewModel.getCellIndex(U);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&&$r(Me(t),()=>{y()}),y()})),this._localDisposableStore.add(this.view.onDidScroll(()=>{this._isInLayout&&$r(Me(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){E8e(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 ZWt(e,t,o,n);return this.viewZones=new tVt(r,this),this.cellOverlays=new iVt(r),r}_getView(){return this.view}attachWebview(e){e.style.top=`-${Kpe}px`,this.rowsContainer.insertAdjacentElement("afterbegin",e),this._webviewElement=new Bg(e)}elementAt(e){if(!this.view.length)return;let t=this.view.indexAt(e),o=Kn(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 CL(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=iwi(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=H3e(c,l,h=>u.has(h.uri.toString()));r.synchronous?this._updateElementsInWebview(p):this._viewModelStore.add($r(Me(this.rowsContainer),()=>{this._isDisposed||this._updateElementsInWebview(p)}))})),this._viewModelStore.add(e.onDidChangeSelection(r=>{if(r==="view")return;let s=Lf(e.getSelections()).map(c=>e.cellAt(c)).filter(c=>!!c).map(c=>this._getViewIndexUpperBound(c));this.setSelection(s,void 0,!0);let l=Lf([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=MO(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=MO(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 KT(r)}updateHiddenAreasInView(e,t){let o=iwi(this._viewModel.viewCells,e),n=new Set;o.forEach(l=>{n.add(l.uri.toString())});let r=iwi(this._viewModel.viewCells,t),s=H3e(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=ts(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}),MO(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=Kn(this.getViewScrollBottom()+this.renderHeight,0,this.scrollHeight),s=Kn(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 CL(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 CL(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 cZe(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)=>{H.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 cZe(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 cZe(c).then(()=>o(e,t))}else if(c.editorAttached)c.revealRangeInCenter(t);else return cZe(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 kb)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&&H.once(this.view.onWillScroll)(()=>{let u=parseInt(this._webviewElement.domNode.style.top,10);p8o(this._webviewElement.domNode)?this._webviewElement.setTop(u-c):this._webviewElement.setTop(-Kpe)}),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)||!it&&this.view.domNode.ownerDocument.activeElement&&Nh(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):cZe(o).then(()=>{o.setSelection(t)})}style(e){let t=this.view.domId;this.styleElement||(this.styleElement=hr(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=[]}};bRe=I([m(7,fo),m(8,B),m(9,F),m(10,rs)],bRe);var oVt=class extends C{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 cZe(a){return new Promise((i,e)=>{H.once(a.onDidChangeEditorAttachState)(()=>a.editorAttached?i():e())})}async function m8o(a){let e=navigator.userAgent.indexOf("Chrome")>=0,t=new TextEncoder,o=new TextDecoder;function n(){let Ke,ye;return{promise:new Promise((Tt,Ht)=>{Ke=Tt,ye=Ht}),resolve:Ke,reject:ye}}let r=a.options,s=a.isWorkspaceTrusted,l=a.renderOptions,c=sr(),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"?Ke=>{setTimeout(()=>{if(ye)return;let Be=Date.now()+15;Ke(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,Be-Date.now())}}))});let ye=!1;return{dispose(){ye||(ye=!0)}}}:(Ke,ye)=>{let Be=requestIdleCallback(Ke,typeof ye=="number"?{timeout:ye}:void 0),Tt=!1;return{dispose(){Tt||(Tt=!0,cancelIdleCallback(Be))}}};function f(Ke){for(let ye of Ke.composedPath())if(ye instanceof HTMLElement&&ye.classList.contains("output"))return{id:ye.id}}let v,b=Ke=>{let ye=Ke&&f(Ke);ye&&(v=void 0,setTimeout(()=>{v?.id!==ye.id&&wo("outputBlur",ye)},0))},S=(Ke,ye=document)=>{let Be=ye.activeElement;return!!(Be&&Ke.contains(Be)&&(Be.matches(":read-write")||Be.tagName.toLowerCase()==="select"||Be.shadowRoot&&S(Be.shadowRoot,Be.shadowRoot)))},y=Ke=>{v=f(Ke);let ye=window.document.activeElement;if(!ye)return;let Be=v?.id;Be&&S(ye,window.document)&&(wo("outputInputFocus",{inputFocused:!0,id:Be}),ye.addEventListener("blur",()=>{wo("outputInputFocus",{inputFocused:!1,id:Be})},{once:!0}))},w=Ke=>{if(!Ke||!Ke.view||!Ke.view.document)return;let ye=v=f(Ke);for(let Be of Ke.composedPath())if(Be instanceof HTMLAnchorElement&&Be.href){if(Be.href.startsWith("blob:"))ye&&wo("outputFocus",ye),G(Be.href,Be.download);else if(Be.href.startsWith("data:"))ye&&wo("outputFocus",ye),U(Be.href,Be.download);else if(Be.getAttribute("href")?.trim().startsWith("#")){if(!Be.hash){wo("scroll-to-reveal",{scrollTop:0});return}let Tt=Be.hash.substring(1),Ht=Ke.view.document.getElementById(Tt);if(!Ht){for(let Do of Ke.view.document.querySelectorAll(".preview"))if(Ht=Do.shadowRoot?.getElementById(Tt),Ht)break}if(Ht){let Do=Ht.getBoundingClientRect().top+Ke.view.scrollY;wo("scroll-to-reveal",{scrollTop:Do});return}}else{let Tt=Be.getAttribute("href");Tt&&(Tt.startsWith("command:")&&ye&&wo("outputFocus",ye),wo("clicked-link",{href:Tt}))}Ke.preventDefault(),Ke.stopPropagation();return}ye&&wo("outputFocus",ye)},k=()=>{let Ke=window.getSelection();Ke&&Ke.removeAllRanges()},T=Ke=>{let ye=window.getSelection();if(!ye)return;let Be=window.document.getElementById(Ke);if(!Be)return;ye.removeAllRanges();let Tt=document.createRange();Tt.selectNode(Be),ye.addRange(Tt)},N=Ke=>{if(!window.document.getElementById(Ke))return;let Be=window.document.activeElement;Be&&S(Be,window.document)&&Be.select()},O=Ke=>{if(!v?.id||!Ke.shiftKey)return;if(Ke.shiftKey&&(Ke.code==="ArrowUp"||Ke.code==="ArrowDown")){Ke.stopPropagation();return}if(!(Ke.code==="PageUp"||Ke.code==="PageDown")&&!(Ke.metaKey&&(Ke.code==="ArrowDown"||Ke.code==="ArrowUp")))return;let ye=window.document.getElementById(v.id),Be=window.getSelection();if(!ye||!Be?.anchorNode)return;let Tt=window.document.activeElement;if(Tt&&S(Tt,window.document))return;Ke.stopPropagation(),Ke.preventDefault();let{anchorNode:Ht,anchorOffset:Do}=Be,io=document.createRange();Ke.code==="PageDown"||Ke.code==="ArrowDown"?(io.setStart(Ht,Do),io.setEnd(ye,1)):(io.setStart(ye,0),io.setEnd(Ht,Do)),Be.removeAllRanges(),Be.addRange(io)},V=Ke=>{if(!v?.id)return;let ye=window.document.activeElement;if(!(ye&&S(ye,window.document))&&(Ke.key==="a"&&Ke.ctrlKey||Ke.metaKey&&Ke.key==="a")){Ke.preventDefault();return}},U=async(Ke,ye)=>{wo("clicked-data-url",{data:Ke,downloadName:ye})},G=async(Ke,ye)=>{try{let Tt=await(await fetch(Ke)).blob(),Ht=new FileReader;Ht.addEventListener("load",()=>{U(Ht.result,ye)}),Ht.readAsDataURL(Tt)}catch(Be){console.error(Be.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:Id.event,postKernelMessage:Ke=>wo("customKernelMessage",{message:Ke})})}async function te(Ke){try{return await pe(Ke)}catch(ye){throw console.error(ye),ye}}async function pe(Ke){let ye=await __import(Ke);if(!ye.activate){console.error(`Notebook preload '${Ke}' was expected to be a module but it does not export an 'activate' function`);return}return ye.activate($())}let de=new class{constructor(){this.pending=new Map}updateHeight(Ke,ye,Be){this.pending.size||setTimeout(()=>{this.updateImmediately()},0);let Tt=this.pending.get(Ke);Tt&&Tt.isOutput?this.pending.set(Ke,{id:Ke,height:ye,init:Tt.init,isOutput:Tt.isOutput}):this.pending.set(Ke,{id:Ke,height:ye,...Be})}updateImmediately(){this.pending.size&&(wo("dimension",{updates:Array.from(this.pending.values())}),this.pending.clear())}};function se(Ke){return Ke>2.1}let Se=new class{constructor(){this._observedElements=new WeakMap;this._observer=new ResizeObserver(Ke=>{for(let ye of Ke){if(!window.document.body.contains(ye.target))continue;let Be=this._observedElements.get(ye.target);if(!Be||(this.postResizeMessage(Be.cellId),ye.target.id!==Be.id)||!ye.contentRect)continue;if(!Be.output){this.updateHeight(Be,ye.target.offsetHeight);continue}let Tt=se(ye.contentRect.height);Tt&&Be.lastKnownPadding===0||!Tt&&Be.lastKnownPadding!==0?window.requestAnimationFrame(()=>{Tt?ye.target.style.padding=`${a.style.outputNodePadding}px ${a.style.outputNodePadding}px ${a.style.outputNodePadding}px ${a.style.outputNodeLeftPadding}px`:ye.target.style.padding="0px",this.updateHeight(Be,Tt?ye.target.offsetHeight:0)}):this.updateHeight(Be,Tt?ye.target.offsetHeight:0)}})}updateHeight(Ke,ye){Ke.lastKnownHeight!==ye&&(Ke.lastKnownHeight=ye,de.updateHeight(Ke.id,ye,{isOutput:Ke.output}))}observe(Ke,ye,Be,Tt){this._observedElements.has(Ke)||(this._observedElements.set(Ke,{id:ye,output:Be,lastKnownPadding:a.style.outputNodePadding,lastKnownHeight:-1,cellId:Tt}),this._observer.observe(Ke))}postResizeMessage(Ke){clearTimeout(this._outputResizeTimer),this._outputResizeTimer=setTimeout(()=>{wo("outputResized",{cellId:Ke})},250)}},ke,Ee,He,Ve;function Fe(Ke,ye){if(He=Ke,ye===void 0)return Ve=Date.now(),ke=void 0,Ke.setAttribute("recentlyScrolled","true"),clearTimeout(Ee),Ee=setTimeout(()=>{He?.removeAttribute("recentlyScrolled")},300),!0;if(Ke.hasAttribute("recentlyScrolled")){if(Ve&&Date.now()-Ve>400){if(ke&&ye<0&&ye<ke-8)return clearTimeout(Ee),He?.removeAttribute("recentlyScrolled"),!1;if(ke&&ye>0&&ye>ke+8)return clearTimeout(Ee),He?.removeAttribute("recentlyScrolled"),!1;clearTimeout(Ee),Ee=setTimeout(()=>{He?.removeAttribute("recentlyScrolled")},50)}else clearTimeout(Ee),Ee=setTimeout(()=>{He?.removeAttribute("recentlyScrolled")},300);return ke=ye,!0}return!1}function Qt(Ke){for(let ye=Ke.target;ye;ye=ye.parentNode){if(!(ye instanceof Element)||ye.id==="container"||ye.classList.contains("cell_container")||ye.classList.contains("markup")||ye.classList.contains("output_container"))return!1;if(Ke.deltaY<0&&ye.scrollTop>0)return Fe(ye),!0;if(Ke.deltaY>0&&ye.scrollTop+ye.clientHeight<ye.scrollHeight){if(ye.scrollHeight-ye.scrollTop-ye.clientHeight<2||window.getComputedStyle(ye).overflowY==="hidden"||window.getComputedStyle(ye).overflowY==="visible")continue;return Fe(ye),!0}if(Fe(ye,Ke.deltaY))return!0}return!1}let Ze=Ke=>{Ke.defaultPrevented||Qt(Ke)||wo("did-scroll-wheel",{payload:{deltaMode:Ke.deltaMode,deltaX:Ke.deltaX,deltaY:Ke.deltaY,deltaZ:Ke.deltaZ,wheelDelta:Ke.wheelDelta&&e?Ke.wheelDelta/window.devicePixelRatio:Ke.wheelDelta,wheelDeltaX:Ke.wheelDeltaX&&e?Ke.wheelDeltaX/window.devicePixelRatio:Ke.wheelDeltaX,wheelDeltaY:Ke.wheelDeltaY&&e?Ke.wheelDeltaY/window.devicePixelRatio:Ke.wheelDeltaY,detail:Ke.detail,shiftKey:Ke.shiftKey,type:Ke.type}})};function Ti(Ke,ye){let Be=window.document.getElementById(Ke)??(ye?window.document.getElementById(ye):void 0);if(Be){if(Be.contains(window.document.activeElement))return;let Tt=Be.querySelector('[tabindex="0"], [href], button, input, option, select, textarea');Tt||(Tt=Be,Tt.tabIndex=-1),v?.id!==Be.id&&(v=Be,wo("outputFocus",{id:Be.id})),Tt.focus()}}function ti(Ke,ye){let Be=document.createElement("div");return Be.id=`focus-sink-${Ke}`,Be.tabIndex=0,Be.addEventListener("focus",()=>{wo("focus-editor",{cellId:Ke,focusNext:ye})}),Be}function bo(Ke,ye="mark",Be={}){function Tt(_r){if(!_r.startContainer.ownerDocument)return[];if(_r.startContainer.nodeType===Node.TEXT_NODE&&_r.startOffset>0){let Ow=_r.startContainer,sre=_r.endOffset,GG=Ow.splitText(_r.startOffset);_r.endContainer===Ow&&_r.setEnd(GG,sre-_r.startOffset),_r.setStart(GG,0)}_r.endContainer.nodeType===Node.TEXT_NODE&&_r.endOffset<_r.endContainer.length&&_r.endContainer.splitText(_r.endOffset);let sl=_r.startContainer.ownerDocument.createTreeWalker(_r.commonAncestorContainer,NodeFilter.SHOW_TEXT,Ow=>_r.intersectsNode(Ow)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT);sl.currentNode=_r.startContainer;let Dd=[];for(sl.currentNode.nodeType===Node.TEXT_NODE&&Dd.push(sl.currentNode);sl.nextNode()&&_r.comparePoint(sl.currentNode,0)!==1;)sl.currentNode.nodeType===Node.TEXT_NODE&&Dd.push(sl.currentNode);return Dd}function Ht(_r,sl,Dd){let Ow=_r.ownerDocument.createElement(sl);Object.keys(Dd).forEach(GG=>{Ow.setAttribute(GG,Dd[GG])});let sre=_r.ownerDocument.createRange();return sre.selectNode(_r),sre.surroundContents(Ow),Ow}if(Ke.collapsed)return{remove:()=>{},update:()=>{}};let Do=Tt(Ke),io=[];for(let _r in Do){let sl=Ht(Do[_r],ye,Be);io.push(sl)}function xr(_r){if(_r.childNodes.length===1)_r.replaceWith(_r.firstChild);else{for(;_r.firstChild;)_r.parentNode?.insertBefore(_r.firstChild,_r);_r.remove()}}function oo(){for(let _r in io)xr(io[_r])}function Gr(_r,sl={}){Object.keys(sl).forEach(Dd=>{_r.setAttribute(Dd,sl[Dd])})}function Sa(_r){for(let sl in io)Gr(io[sl],_r)}return{remove:oo,update:Sa}}function Ro(Ke){let ye=window.getSelection();if(ye)try{ye.removeAllRanges();let Be=document.createRange();Be.setStart(Ke.startContainer,Ke.startOffset),Be.setEnd(Ke.endContainer,Ke.endOffset),ye.addRange(Be)}catch(Be){console.log(Be)}}function _o(Ke,ye,Be="mark",Tt={}){if(ye){let Ht=bo(Ke,Be,Tt);return{range:Ke,dispose:Ht.remove,update:(Do,io)=>{io===void 0?Ht.update({style:`background-color: ${Do}`}):Ht.update({class:io})}}}else{window.document.execCommand("hiliteColor",!1,yd);let Ht=window.getSelection().getRangeAt(0).cloneRange(),Do={collapsed:Ht.collapsed,commonAncestorContainer:Ht.commonAncestorContainer,endContainer:Ht.endContainer,endOffset:Ht.endOffset,startContainer:Ht.startContainer,startOffset:Ht.startOffset};return{range:Do,dispose:()=>{Ro(Do);try{document.designMode="On",window.document.execCommand("removeFormat",!1,void 0),document.designMode="Off",window.getSelection()?.removeAllRanges()}catch(io){console.log(io)}},update:(io,xr)=>{Ro(Do);try{document.designMode="On",window.document.execCommand("removeFormat",!1,void 0),window.document.execCommand("hiliteColor",!1,io),document.designMode="Off",window.getSelection()?.removeAllRanges()}catch(oo){console.log(oo)}}}}}function sr(Ke=()=>{}){let ye=new Set;return{fire(Be){for(let Tt of[...ye])Tt.fn.call(Tt.thisArg,Be)},event(Be,Tt,Ht){let Do={fn:Be,thisArg:Tt},io={dispose:()=>{ye.delete(Do),Ke(ye)}};return ye.add(Do),Ke(ye),Ht instanceof Array?Ht.push(io):Ht&&Ht.add(io),io}}}function ln(Ke,ye,Be){ye.innerText=Ke;let Tt=document.createElement("ul");for(let Ht of Be){console.error(Ht);let Do=document.createElement("li");Do.innerText=Ht.message,Tt.appendChild(Do)}ye.appendChild(Tt)}let en=new class{constructor(){this._requestPool=0;this._requests=new Map}getOutputItem(Ke,ye){let Be=this._requestPool++,{promise:Tt,resolve:Ht}=n();return this._requests.set(Be,{resolve:Ht}),wo("getOutputItem",{requestId:Be,outputId:Ke,mime:ye}),Tt}resolveOutputItem(Ke,ye){let Be=this._requests.get(Ke);Be&&(this._requests.delete(Ke),Be.resolve(ye))}},Ws=!1;function ba(Ke,ye,Be,Tt,Ht,Do){function io(Sa,_r,sl,Dd,Ow){return Object.freeze({id:Sa,mime:_r,metadata:sl,appendedText(){if(Ow)return o.decode(Ow.valueBytes)},data(){return Dd},text(){return o.decode(Dd)},json(){return JSON.parse(this.text())},blob(){return new Blob([Dd],{type:this.mime})},get _allOutputItems(){return Ws||(Ws=!0,console.warn("'_allOutputItems' is proposed API. DO NOT ship an extension that depends on it!")),oo}})}let xr=new Map,oo=Object.freeze(Ht.map(Sa=>{let _r=Sa.mime;return Object.freeze({mime:_r,getItem(){let sl=xr.get(_r);if(sl)return sl;let Dd=en.getOutputItem(Ke,_r).then(Ow=>Ow?io(Ke,Ow.mime,Be,Ow.valueBytes):void 0);return xr.set(_r,Dd),Dd}})})),Gr=io(Ke,ye,Be,Tt,Do);return xr.set(ye,Promise.resolve(Gr)),Gr}let Id=sr(),Dg=window.trustedTypes?.createPolicy("notebookRenderer",{createHTML:Ke=>Ke,createScript:Ke=>Ke});window.addEventListener("wheel",Ze);let yd=window.getComputedStyle(window.document.getElementById("_defaultColorPalatte")).color,uu=window.getComputedStyle(window.document.getElementById("_defaultColorPalatte")).backgroundColor;class Jm{constructor(){this._activeHighlightInfo=new Map}addHighlights(ye,Be){for(let Ht=ye.length-1;Ht>=0;Ht--){let Do=ye[Ht],io=_o(Do.originalRange,!0,"mark",Do.isShadow?{style:"background-color: "+yd+";"}:{class:"find-match"});Do.highlightResult=io}let Tt={matches:ye,currentMatchIndex:-1};this._activeHighlightInfo.set(Be,Tt)}removeHighlights(ye){this._activeHighlightInfo.get(ye)?.matches.forEach(Be=>{Be.highlightResult?.dispose()}),this._activeHighlightInfo.delete(ye)}highlightCurrentMatch(ye,Be){let Tt=this._activeHighlightInfo.get(Be);if(!Tt){console.error("Modified current highlight match before adding highlight list.");return}let Ht=Tt.matches[Tt.currentMatchIndex];Ht?.highlightResult?.update(yd,Ht.isShadow?void 0:"find-match");let Do=Tt.matches[ye];Tt.currentMatchIndex=ye;let io=window.getSelection();if(Do&&io&&Do.highlightResult){let xr=0;try{let oo=window.document.getElementById(Do.id).getBoundingClientRect().top,Gr=document.createRange();Gr.selectNode(Do.highlightResult.range.startContainer),Do.highlightResult.range.startContainer.parentElement?.scrollIntoView({behavior:"auto",block:"end",inline:"nearest"});let Sa=Gr.getBoundingClientRect().top;Gr.detach(),xr=Sa-oo}catch(oo){console.error(oo)}Do.highlightResult?.update(uu,Do.isShadow?void 0:"current-find-match"),window.document.getSelection()?.removeAllRanges(),wo("didFindHighlightCurrent",{offset:xr})}}unHighlightCurrentMatch(ye,Be){let Tt=this._activeHighlightInfo.get(Be);if(!Tt)return;let Ht=Tt.matches[ye];Ht&&Ht.highlightResult&&Ht.highlightResult.update(yd,Ht.isShadow?void 0:"find-match")}dispose(){window.document.getSelection()?.removeAllRanges(),this._activeHighlightInfo.forEach(ye=>{ye.matches.forEach(Be=>{Be.highlightResult?.dispose()})})}}class Dh{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(ye=!0){ye&&this._matchesHighlight.clear(),this._currentMatchesHighlight.clear(),this._activeHighlightInfo.forEach(Be=>{if(ye)for(let Tt=0;Tt<Be.matches.length;Tt++)this._matchesHighlight.add(Be.matches[Tt].originalRange);Be.currentMatchIndex<Be.matches.length&&Be.currentMatchIndex>=0&&this._currentMatchesHighlight.add(Be.matches[Be.currentMatchIndex].originalRange)})}addHighlights(ye,Be){for(let Ht=0;Ht<ye.length;Ht++)this._matchesHighlight.add(ye[Ht].originalRange);let Tt={matches:ye,currentMatchIndex:-1};this._activeHighlightInfo.set(Be,Tt)}highlightCurrentMatch(ye,Be){let Tt=this._activeHighlightInfo.get(Be);if(!Tt){console.error("Modified current highlight match before adding highlight list.");return}Tt.currentMatchIndex=ye;let Ht=Tt.matches[ye];if(Ht){let Do=0;try{let io=window.document.getElementById(Ht.id).getBoundingClientRect().top;Ht.originalRange.startContainer.parentElement?.scrollIntoView({behavior:"auto",block:"end",inline:"nearest"}),Do=Ht.originalRange.getBoundingClientRect().top-io,wo("didFindHighlightCurrent",{offset:Do})}catch(io){console.error(io)}}this._refreshRegistry(!1)}unHighlightCurrentMatch(ye,Be){let Tt=this._activeHighlightInfo.get(Be);Tt&&(Tt.currentMatchIndex=-1)}removeHighlights(ye){this._activeHighlightInfo.delete(ye),this._refreshRegistry()}dispose(){window.document.getSelection()?.removeAllRanges(),this._currentMatchesHighlight.clear(),this._matchesHighlight.clear()}}let Rp=CSS.highlights?new Dh:new Jm;function Uv(Ke){let Be=Ke.getRangeAt(0).cloneRange(),Tt=Ke.toString().length;Ke.collapseToStart(),Ke.modify("move","backward","lineboundary"),Ke.modify("extend","forward","lineboundary");let Ht=Ke.toString(),Do=Cr(Ke.getRangeAt(0),Be),io={start:Do,end:Do+Tt};return Ke.removeAllRanges(),Ke.addRange(Be),{line:Ht,range:io}}function Cr(Ke,ye){let Be=sx(Ke.startContainer,ye.startContainer),Tt=Nw(Be,Ke.startContainer)+Ke.startOffset;return Nw(Be,ye.startContainer)+ye.startOffset-Tt}function sx(Ke,ye){let Be=new Range;return Be.setStart(Ke,0),Be.setEnd(ye,0),Be.commonAncestorContainer}function Lg(Ke){let ye=0;if(Ke.nodeType===Node.TEXT_NODE)ye+=Ke.textContent?.length||0;else for(let Be of Ke.childNodes)ye+=Lg(Be);return ye}function Nw(Ke,ye){if(!ye)return 0;let Be=0;if(ye===Ke||!Ke.contains(ye))return Be;let Tt=ye.previousSibling;for(;Tt;)Be+=Lg(Tt),Tt=Tt.previousSibling;return Be+Nw(Ke,ye.parentNode)}let gp=(Ke,ye)=>{let Be=!0,Tt=[],Ht=document.createRange();Ht.selectNodeContents(window.document.getElementById("findStart"));let Do=window.getSelection();Do?.removeAllRanges(),Do?.addRange(Ht),_i.toggleDragDropEnabled(!1);try{for(document.designMode="On";Be&&Tt.length<500;)if(Be=window.find(Ke,!!ye.caseSensitive,!1,!1,!!ye.wholeWord,!0,!1),Be){let io=window.getSelection();if(!io){console.log("no selection");break}if(ye.includeMarkup&&io.rangeCount>0&&io.getRangeAt(0).startContainer.nodeType===1&&io.getRangeAt(0).startContainer.classList.contains("markup")){let oo=io.anchorNode?.firstChild,Gr=oo.shadowRoot,Sa=Gr?.getSelection?Gr?.getSelection():null;Sa&&Sa.anchorNode&&Tt.push({type:"preview",id:oo.id,cellId:oo.id,container:oo,isShadow:!0,originalRange:Sa.getRangeAt(0),searchPreviewInfo:ye.shouldGetSearchPreviewInfo?Uv(Sa):void 0})}if(ye.includeOutput&&io.rangeCount>0&&io.getRangeAt(0).startContainer.nodeType===1&&io.getRangeAt(0).startContainer.classList.contains("output_container")){let oo=io.getRangeAt(0).startContainer.parentElement.id,Gr=io.anchorNode?.firstChild,Sa=Gr.shadowRoot,_r=Sa?.getSelection?Sa?.getSelection():null;_r&&_r.anchorNode&&Tt.push({type:"output",id:Gr.id,cellId:oo,container:Gr,isShadow:!0,originalRange:_r.getRangeAt(0),searchPreviewInfo:ye.shouldGetSearchPreviewInfo?Uv(_r):void 0})}let xr=io.anchorNode?.parentElement;if(xr){let oo=Tt.length?Tt[Tt.length-1]:null;if(oo&&oo.container.contains(xr)&&ye.includeOutput)Tt.push({type:oo.type,id:oo.id,cellId:oo.cellId,container:oo.container,isShadow:!1,originalRange:io.getRangeAt(0),searchPreviewInfo:ye.shouldGetSearchPreviewInfo?Uv(io):void 0});else for(let Gr=xr;Gr&&Gr instanceof Element;Gr=Gr.parentElement){if(Gr.classList.contains("output")&&ye.includeOutput){let Sa=Gr.parentElement?.parentElement?.id;Sa&&Tt.push({type:"output",id:Gr.id,cellId:Sa,container:Gr,isShadow:!1,originalRange:io.getRangeAt(0),searchPreviewInfo:ye.shouldGetSearchPreviewInfo?Uv(io):void 0});break}if(Gr.id==="container"||Gr===window.document.body)break}}else break}}catch(io){console.log(io)}Tt=Tt.filter(io=>ye.findIds.length?ye.findIds.includes(io.cellId):!0),Rp.addHighlights(Tt,ye.ownerID),window.document.getSelection()?.removeAllRanges(),_i.toggleDragDropEnabled(r.dragAndDropEnabled),document.designMode="Off",wo("didFind",{matches:Tt.map((io,xr)=>({type:io.type,id:io.id,cellId:io.cellId,index:xr,searchPreviewInfo:io.searchPreviewInfo}))})},uf=async(Ke,ye,Be,Tt=5)=>{if(!window.document.hasFocus()&&Tt>0){setTimeout(()=>{uf(Ke,ye,Be,Tt-1)},50);return}try{let Ht=window.document.getElementById(Ke)??window.document.getElementById(ye),Do=Ht?.querySelector("img");if(!Do){let io=Ht?.querySelector("svg.output-image")??Ht?.querySelector("div.svgContainerStyle > svg");io&&(Do=new Image,Do.src="data:image/svg+xml,"+encodeURIComponent(io.outerHTML))}if(Do){let xr=await(Gr=>new Promise((Sa,_r)=>{Gr.complete&&Gr.naturalWidth>0?Sa(Gr):(Gr.onload=()=>Sa(Gr),Gr.onerror=()=>_r(new Error("Failed to load image")),setTimeout(()=>_r(new Error("Image load timeout")),5e3))}))(Do),oo={"image/png":new Promise(Gr=>{let Sa=document.createElement("canvas");Sa.width=xr.naturalWidth,Sa.height=xr.naturalHeight,Sa.getContext("2d").drawImage(xr,0,0),Sa.toBlob(sl=>{sl?Gr(sl):console.error("No blob data to write to clipboard"),Sa.remove()},"image/png")})};if(Be)for(let Gr of Be)oo[Gr.mimeType]=Gr.content;await navigator.clipboard.write([new ClipboardItem(oo)])}else console.error("Could not find image element to copy for output with id",Ke)}catch(Ht){console.error("Could not copy image:",Ht)}};window.addEventListener("message",async Ke=>{let ye=Ke;switch(ye.data.type){case"initializeMarkup":{try{await Promise.all(ye.data.cells.map(Be=>_i.ensureMarkupCell(Be)))}finally{de.updateImmediately(),wo("initializedMarkup",{requestId:ye.data.requestId})}break}case"createMarkupCell":_i.ensureMarkupCell(ye.data.cell);break;case"showMarkupCell":_i.showMarkupCell(ye.data.id,ye.data.top,ye.data.content,ye.data.metadata);break;case"hideMarkupCells":for(let Be of ye.data.ids)_i.hideMarkupCell(Be);break;case"unhideMarkupCells":for(let Be of ye.data.ids)_i.unhideMarkupCell(Be);break;case"deleteMarkupCell":for(let Be of ye.data.ids)_i.deleteMarkupCell(Be);break;case"updateSelectedMarkupCells":_i.updateSelectedCells(ye.data.selectedCellIds);break;case"html":{let Be=ye.data;Be.createOnIdle?II.enqueueIdle(Be.outputId,Tt=>_i.renderOutputCell(Be,Tt)):II.enqueue(Be.outputId,Tt=>_i.renderOutputCell(Be,Tt));break}case"view-scroll":{ye.data.widgets.forEach(Be=>{II.enqueue(Be.outputId,()=>{_i.updateOutputsScroll([Be])})}),_i.updateMarkupScrolls(ye.data.markupCells);break}case"clear":Ut.clearAll(),_i.clearAll(),window.document.getElementById("container").innerText="";break;case"clearOutput":{let{cellId:Be,rendererId:Tt,outputId:Ht}=ye.data;II.cancelOutput(Ht),_i.clearOutput(Be,Ht,Tt);break}case"hideOutput":{let{cellId:Be,outputId:Tt}=ye.data;II.enqueue(Tt,()=>{_i.hideOutput(Be)});break}case"showOutput":{let{outputId:Be,cellTop:Tt,cellId:Ht,content:Do}=ye.data;II.enqueue(Be,()=>{_i.showOutput(Ht,Be,Tt),Do&&_i.updateAndRerender(Ht,Be,Do)});break}case"copyImage":{await uf(ye.data.outputId,ye.data.altOutputId,ye.data.textAlternates);break}case"ack-dimension":{for(let{cellId:Be,outputId:Tt,height:Ht}of ye.data.updates)_i.updateOutputHeight(Be,Tt,Ht);break}case"preload":{let Be=ye.data.resources;for(let{uri:Tt}of Be)ax.load(Tt);break}case"updateRenderers":{let{rendererData:Be}=ye.data;Ut.updateRendererData(Be);break}case"focus-output":Ti(ye.data.cellOrOutputId,ye.data.alternateId);break;case"blur-output":k();break;case"select-output-contents":T(ye.data.cellOrOutputId);break;case"select-input-contents":N(ye.data.cellOrOutputId);break;case"decorations":{let Be=window.document.getElementById(ye.data.cellId);Be||(_i.ensureOutputCell(ye.data.cellId,-1e5,!0),Be=window.document.getElementById(ye.data.cellId)),Be?.classList.add(...ye.data.addedClassNames),Be?.classList.remove(...ye.data.removedClassNames);break}case"markupDecorations":{let Be=window.document.getElementById(ye.data.cellId);Be&&(Be?.classList.add(...ye.data.addedClassNames),Be?.classList.remove(...ye.data.removedClassNames));break}case"customKernelMessage":Id.fire(ye.data.message);break;case"customRendererMessage":Ut.getRenderer(ye.data.rendererId)?.receiveMessage(ye.data.message);break;case"notebookStyles":{let Be=window.document.documentElement.style;for(let Tt=Be.length-1;Tt>=0;Tt--){let Ht=Be[Tt];Ht&&Ht.startsWith("--notebook-")&&Be.removeProperty(Ht)}for(let[Tt,Ht]of Object.entries(ye.data.styles))Be.setProperty(`--${Tt}`,Ht);break}case"notebookOptions":r=ye.data.options,_i.toggleDragDropEnabled(r.dragAndDropEnabled),l=ye.data.renderOptions,c.fire(l);break;case"tokenizedCodeBlock":{let{codeBlockId:Be,html:Tt}=ye.data;eo.highlightCodeBlock(Be,Tt);break}case"tokenizedStylesChanged":{h.replaceSync(ye.data.css);break}case"find":{Rp.removeHighlights(ye.data.options.ownerID),gp(ye.data.query,ye.data.options);break}case"findHighlightCurrent":{Rp?.highlightCurrentMatch(ye.data.index,ye.data.ownerID);break}case"findUnHighlightCurrent":{Rp?.unHighlightCurrentMatch(ye.data.index,ye.data.ownerID);break}case"findStop":{Rp.removeHighlights(ye.data.ownerID);break}case"returnOutputItem":en.resolveOutputItem(ye.data.requestId,ye.data.output)}});let KG="vscode.fallbackToNextRenderer";class e6{constructor(ye){this.data=ye;this._onMessageEvent=sr()}receiveMessage(ye){this._onMessageEvent.fire(ye)}async renderOutputItem(ye,Be,Tt){try{await this.load()}catch(Ht){Tt.aborted||ln(`Error loading renderer '${this.data.id}'`,Be,Ht instanceof Error?[Ht]:[]);return}if(!this._api){Tt.aborted||ln(`Renderer '${this.data.id}' does not implement renderOutputItem`,Be,[]);return}try{let Ht=performance.now();await this._api.renderOutputItem(ye,Be,Tt),this.postDebugMessage("Rendered output item",{id:ye.id,duration:`${performance.now()-Ht}ms`})}catch(Ht){if(Tt.aborted)return;if(Ht instanceof Error&&Ht.name===KG)throw Ht;ln(`Error rendering output item using '${this.data.id}'`,Be,Ht instanceof Error?[Ht]:[]),this.postDebugMessage("Rendering output item failed",{id:ye.id,error:Ht+""})}}disposeOutputItem(ye){this._api?.disposeOutputItem?.(ye)}createRendererContext(){let{id:ye,messaging:Be}=this.data,Tt={setState:Ht=>p.setState({...p.getState(),[ye]:Ht}),getState:()=>{let Ht=p.getState();return typeof Ht=="object"&&Ht?Ht[ye]:void 0},getRenderer:async Ht=>{let Do=Ut.getRenderer(Ht);if(Do)return Do._api?Do._api:Do.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 Be&&(Tt.onDidReceiveMessage=this._onMessageEvent.event,Tt.postMessage=Ht=>wo("customRendererMessage",{rendererId:ye,message:Ht})),Object.freeze(Tt)}load(){return this._loadPromise??=this._load(),this._loadPromise}async _load(){this.postDebugMessage("Start loading renderer");try{await ax.waitForAllCurrent();let ye=performance.now(),Be=await __import(this.data.entrypoint.path);if(this.postDebugMessage("Imported renderer",{duration:`${performance.now()-ye}ms`}),!Be)return;this._api=await Be.activate(this.createRendererContext()),this.postDebugMessage("Activated renderer",{duration:`${performance.now()-ye}ms`});let Tt=a.rendererData.filter(Ht=>Ht.entrypoint.extends===this.data.id);return Tt.length&&this.postDebugMessage("Activating dependant renderers",{dependents:Tt.map(Ht=>Ht.id).join(", ")}),await Promise.all(Tt.map(async Ht=>{let Do=Ut.getRenderer(Ht.id);if(!Do)throw new Error(`Could not find extending renderer: ${Ht.id}`);try{return await Do.load()}catch(io){console.error(io),this.postDebugMessage("Activating dependant renderer failed",{dependent:Ht.id,error:io+""});return}})),this._api}catch(ye){throw this.postDebugMessage("Loading renderer failed"),ye}}postDebugMessage(ye,Be){wo("logRendererDebugMessage",{message:`[renderer ${this.data.id}] - ${ye}`,data:Be})}}let ax=new class{constructor(){this.preloads=new Map}waitFor(Ke){return this.preloads.get(Ke)||Promise.resolve(new Error(`Preload not ready: ${Ke}`))}load(Ke){let ye=Promise.all([te(Ke),this.waitForAllCurrent()]);return this.preloads.set(Ke,ye),ye}waitForAllCurrent(){return Promise.all([...this.preloads.values()].map(Ke=>Ke.catch(ye=>ye)))}},II=new class{constructor(){this.outputs=new Map;this.pendingOutputCreationRequest=new Map}enqueue(Ke,ye){this.pendingOutputCreationRequest.get(Ke)?.dispose(),this.pendingOutputCreationRequest.delete(Ke);let Be=this.outputs.get(Ke);if(Be)Be.queue=Be.queue.then(async Tt=>{Be.abort.signal.aborted||await ye(Be.abort.signal)});else{let Tt=new AbortController;this.outputs.set(Ke,{abort:Tt,queue:new Promise(Ht=>Ht(ye(Tt.signal)))})}}enqueueIdle(Ke,ye){this.pendingOutputCreationRequest.get(Ke)?.dispose(),II.pendingOutputCreationRequest.set(Ke,g(()=>{II.enqueue(Ke,ye),II.pendingOutputCreationRequest.delete(Ke)}))}cancelAll(){this.pendingOutputCreationRequest.forEach(Ke=>Ke.dispose()),this.pendingOutputCreationRequest.clear();for(let{abort:Ke}of this.outputs.values())Ke.abort();this.outputs.clear()}cancelOutput(Ke){this.pendingOutputCreationRequest.get(Ke)?.dispose(),this.pendingOutputCreationRequest.delete(Ke);let ye=this.outputs.get(Ke);ye&&(ye.abort.abort(),this.outputs.delete(Ke))}},Ut=new class{constructor(){this._renderers=new Map;for(let Ke of a.rendererData)this.addRenderer(Ke)}getRenderer(Ke){return this._renderers.get(Ke)}rendererEqual(Ke,ye){if(Ke.id!==ye.id||Ke.entrypoint.path!==ye.entrypoint.path||Ke.entrypoint.extends!==ye.entrypoint.extends||Ke.messaging!==ye.messaging||Ke.mimeTypes.length!==ye.mimeTypes.length)return!1;for(let Be=0;Be<Ke.mimeTypes.length;Be++)if(Ke.mimeTypes[Be]!==ye.mimeTypes[Be])return!1;return!0}updateRendererData(Ke){let ye=new Set(this._renderers.keys()),Be=new Set(Ke.map(Tt=>Tt.id));for(let Tt of Ke){let Ht=this._renderers.get(Tt.id);Ht&&this.rendererEqual(Ht.data,Tt)||this.addRenderer(Tt)}for(let Tt of ye)Be.has(Tt)||this._renderers.delete(Tt)}addRenderer(Ke){this._renderers.set(Ke.id,new e6(Ke))}clearAll(){II.cancelAll();for(let Ke of this._renderers.values())Ke.disposeOutputItem()}clearOutput(Ke,ye){II.cancelOutput(ye),this._renderers.get(Ke)?.disposeOutputItem(ye)}async render(Ke,ye,Be,Tt){let Ht=this.findRenderer(ye,Ke);if(!Ht){let io=(window.document.documentElement.style.getPropertyValue("--notebook-cell-renderer-not-found-error")||"").replace("$0",()=>Ke.mime);this.showRenderError(Ke,Be,io);return}if(!(await this._doRender(Ke,Be,Ht,Tt)).continue)return;for(let io of Ke._allOutputItems){if(io.mime===Ke.mime)continue;let xr=await io.getItem();if(Tt.aborted)return;if(xr){let oo=this.findRenderer(void 0,xr);if(oo&&!(await this._doRender(xr,Be,oo,Tt)).continue)return}}let Do=(window.document.documentElement.style.getPropertyValue("--notebook-cell-renderer-fallbacks-exhausted")||"").replace("$0",()=>Ke.mime);this.showRenderError(Ke,Be,Do)}async _doRender(Ke,ye,Be,Tt){try{return await Be.renderOutputItem(Ke,ye,Tt),{continue:!1}}catch(Ht){if(Tt.aborted)return{continue:!1};if(Ht instanceof Error&&Ht.name===KG)return{continue:!0};throw Ht}}findRenderer(Ke,ye){let Be;if(typeof Ke=="string")Be=Array.from(this._renderers.values()).find(Tt=>Tt.data.id===Ke);else{let Tt=Array.from(this._renderers.values()).filter(Ht=>Ht.data.mimeTypes.includes(ye.mime)&&!Ht.data.entrypoint.extends);Tt.length&&(Tt.sort((Ht,Do)=>+Ht.data.isBuiltin-+Do.data.isBuiltin),Be=Tt[0])}return Be}showRenderError(Ke,ye,Be){let Tt=document.createElement("div"),Ht=document.createElement("div");Ht.className="no-renderer-error",Ht.innerText=Be;let Do=document.createElement("div");Do.innerText=Ke.text(),Tt.appendChild(Ht),Tt.appendChild(Do),ye.innerText="",ye.appendChild(Tt)}},_i=new class{constructor(){this._markupCells=new Map;this._outputCells=new Map}clearAll(){for(let ye of this._markupCells.values())ye.dispose();this._markupCells.clear();for(let ye of this._outputCells.values())ye.dispose();this._outputCells.clear()}async createMarkupCell(ye,Be,Tt){let Ht=this._markupCells.get(ye.cellId);if(Ht)return console.error(`Trying to create markup that already exists: ${ye.cellId}`),Ht;let Do=new Ar(ye.cellId,ye.mime,ye.content,Be,ye.metadata);return Do.element.style.visibility=Tt?"":"hidden",this._markupCells.set(ye.cellId,Do),await Do.ready,Do}async ensureMarkupCell(ye){let Be=this._markupCells.get(ye.cellId);Be?(Be.element.style.visibility=ye.visible?"":"hidden",await Be.updateContentAndRender(ye.content,ye.metadata)):Be=await this.createMarkupCell(ye,ye.offset,ye.visible)}deleteMarkupCell(ye){let Be=this.getExpectedMarkupCell(ye);Be&&(Be.remove(),Be.dispose(),this._markupCells.delete(ye))}async updateMarkupContent(ye,Be,Tt){await this.getExpectedMarkupCell(ye)?.updateContentAndRender(Be,Tt)}showMarkupCell(ye,Be,Tt,Ht){this.getExpectedMarkupCell(ye)?.show(Be,Tt,Ht)}hideMarkupCell(ye){this.getExpectedMarkupCell(ye)?.hide()}unhideMarkupCell(ye){this.getExpectedMarkupCell(ye)?.unhide()}getExpectedMarkupCell(ye){let Be=this._markupCells.get(ye);if(!Be){console.log(`Could not find markup cell '${ye}'`);return}return Be}updateSelectedCells(ye){let Be=new Set(ye);for(let Tt of this._markupCells.values())Tt.setSelected(Be.has(Tt.id))}toggleDragDropEnabled(ye){for(let Be of this._markupCells.values())Be.toggleDragDropEnabled(ye)}updateMarkupScrolls(ye){for(let{id:Be,top:Tt}of ye){let Ht=this._markupCells.get(Be);Ht&&(Ht.element.style.top=`${Tt}px`)}}async renderOutputCell(ye,Be){let Tt=await Promise.all(ye.requiredPreloads.map(Do=>ax.waitFor(Do.uri).then(()=>{},io=>io)));return Be.aborted?void 0:this.ensureOutputCell(ye.cellId,ye.cellTop,!1).renderOutputElement(ye,Tt,Be)}ensureOutputCell(ye,Be,Tt){let Ht=this._outputCells.get(ye),Do=!!Ht;return Ht||(Ht=new na(ye),this._outputCells.set(ye,Ht)),Do&&Tt||(Ht.element.style.top=Be+"px"),Ht}clearOutput(ye,Be,Tt){this._outputCells.get(ye)?.clearOutput(Be,Tt)}showOutput(ye,Be,Tt){this._outputCells.get(ye)?.show(Be,Tt)}updateAndRerender(ye,Be,Tt){this._outputCells.get(ye)?.updateContentAndRerender(Be,Tt)}hideOutput(ye){this._outputCells.get(ye)?.hide()}updateOutputHeight(ye,Be,Tt){this._outputCells.get(ye)?.updateOutputHeight(Be,Tt)}updateOutputsScroll(ye){for(let Be of ye)this._outputCells.get(Be.cellId)?.updateScroll(Be)}};class eo{static{this.pendingCodeBlocksToHighlight=new Map}static highlightCodeBlock(ye,Be){let Tt=eo.pendingCodeBlocksToHighlight.get(ye);if(!Tt)return;let Ht=Dg?.createHTML(Be)??Be;Tt.innerHTML=Ht;let Do=Tt.getRootNode();Do instanceof ShadowRoot&&(Do.adoptedStyleSheets.includes(h)||Do.adoptedStyleSheets.push(h))}static requestHighlightCodeBlock(ye){let Be=[],Tt=0;for(let Ht of ye.querySelectorAll(".vscode-code-block")){let Do=Ht.getAttribute("data-vscode-code-block-lang");if(Ht.textContent&&Do){let io=`${Date.now()}-${Tt++}`;Be.push({value:Ht.textContent,lang:Do,id:io}),eo.pendingCodeBlocksToHighlight.set(io,Ht)}}return Be}}class Ar{constructor(ye,Be,Tt,Ht,Do){this._isDisposed=!1;let io=this;this.id=ye,this._content={value:Tt,version:0,metadata:Do};let{promise:xr,resolve:oo,reject:Gr}=n();this.ready=xr;let Sa;this.outputItem=Object.freeze({id:ye,mime:Be,get metadata(){return io._content.metadata},text:()=>this._content.value,json:()=>{},data:()=>{if(Sa?.version===this._content.version)return Sa.value;let Dd=t.encode(this._content.value);return Sa={version:this._content.version,value:Dd},Dd},blob(){return new Blob([this.data()],{type:this.mime})},_allOutputItems:[{mime:Be,getItem:async()=>this.outputItem}]});let _r=window.document.getElementById("container"),sl=document.createElement("div");sl.className="markup",sl.style.position="absolute",sl.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=Ht+"px",this.toggleDragDropEnabled(r.dragAndDropEnabled),sl.appendChild(this.element),_r.appendChild(sl),this.addEventListeners(),this.updateContentAndRender(this._content.value,this._content.metadata).then(()=>{this._isDisposed||Se.observe(this.element,this.id,!1,this.id),oo()},()=>Gr())}dispose(){this._isDisposed=!0,this.renderTaskAbort?.abort(),this.renderTaskAbort=void 0}addEventListeners(){this.element.addEventListener("dblclick",()=>{wo("toggleMarkupPreview",{cellId:this.id})}),this.element.addEventListener("click",ye=>{wo("clickMarkupCell",{cellId:this.id,altKey:ye.altKey,ctrlKey:ye.ctrlKey,metaKey:ye.metaKey,shiftKey:ye.shiftKey})}),this.element.addEventListener("contextmenu",ye=>{wo("contextMenuMarkupCell",{cellId:this.id,clientX:ye.clientX,clientY:ye.clientY})}),this.element.addEventListener("mouseenter",()=>{wo("mouseEnterMarkupCell",{cellId:this.id})}),this.element.addEventListener("mouseleave",()=>{wo("mouseLeaveMarkupCell",{cellId:this.id})}),this.element.addEventListener("dragstart",ye=>{Pt.startDrag(ye,this.id)}),this.element.addEventListener("drag",ye=>{Pt.updateDrag(ye,this.id)}),this.element.addEventListener("dragend",ye=>{Pt.endDrag(ye,this.id)})}async updateContentAndRender(ye,Be){this._content={value:ye,version:this._content.version+1,metadata:Be},this.renderTaskAbort?.abort();let Tt=new AbortController;this.renderTaskAbort=Tt;try{await Ut.render(this.outputItem,void 0,this.element,this.renderTaskAbort.signal)}finally{this.renderTaskAbort===Tt&&(this.renderTaskAbort=void 0)}let Ht=this.element.shadowRoot??this.element,Do=[];for(let xr of Ht.children)switch(xr.tagName){case"LINK":case"SCRIPT":case"STYLE":break;default:Do.push(xr.outerHTML);break}let io=eo.requestHighlightCodeBlock(Ht);wo("renderedMarkup",{cellId:this.id,html:Do.join(""),codeBlocks:io}),de.updateHeight(this.id,this.element.offsetHeight,{isOutput:!1})}show(ye,Be,Tt){this.element.style.visibility="",this.element.style.top=`${ye}px`,typeof Be=="string"||Tt?this.updateContentAndRender(Be??this._content.value,Tt??this._content.metadata):this.updateMarkupDimensions()}hide(){this.element.style.visibility="hidden"}unhide(){this.element.style.visibility="",this.updateMarkupDimensions()}remove(){this.element.remove()}async updateMarkupDimensions(){de.updateHeight(this.id,this.element.offsetHeight,{isOutput:!1})}setSelected(ye){this.element.classList.toggle("selected",ye)}toggleDragDropEnabled(ye){ye?(this.element.classList.add("draggable"),this.element.setAttribute("draggable","true")):(this.element.classList.remove("draggable"),this.element.removeAttribute("draggable"))}}class na{constructor(ye){this.outputElements=new Map;let Be=window.document.getElementById("container"),Tt=ti(ye);Be.appendChild(Tt),this.element=document.createElement("div"),this.element.style.position="absolute",this.element.style.outline="0",this.element.id=ye,this.element.classList.add("cell_container"),Be.appendChild(this.element),this.element=this.element;let Ht=ti(ye,!0);Be.appendChild(Ht)}dispose(){for(let ye of this.outputElements.values())ye.dispose();this.outputElements.clear()}createOutputElement(ye){let Be=this.outputElements.get(ye.outputId);return Be||(Be=new Rg(ye.outputId),this.element.appendChild(Be.element),this.outputElements.set(ye.outputId,Be)),Be.createOutputElement(ye.outputId,ye.outputOffset,ye.left,ye.cellId)}async renderOutputElement(ye,Be,Tt){let Ht=Date.now(),Do=this.createOutputElement(ye);if(await Do.render(ye.content,ye.rendererId,Be,Tt),Do.element.style.visibility=ye.initiallyHidden?"hidden":"",ye.executionId&&ye.rendererId){let io;ye.content.type===1&&(io=ye.content.output.valueBytes.length),io!==void 0&&io>0&&io<100*1024&&wo("notebookPerformanceMessage",{cellId:ye.cellId,executionId:ye.executionId,duration:Date.now()-Ht,rendererId:ye.rendererId,outputSize:io})}}clearOutput(ye,Be){let Tt=this.outputElements.get(ye);Tt?.clear(Be),Tt?.dispose(),this.outputElements.delete(ye)}show(ye,Be){this.outputElements.get(ye)&&(this.element.style.visibility="",this.element.style.top=`${Be}px`)}hide(){this.element.style.visibility="hidden"}updateContentAndRerender(ye,Be){this.outputElements.get(ye)?.updateContentAndRender(Be)}updateOutputHeight(ye,Be){this.outputElements.get(ye)?.updateHeight(Be)}updateScroll(ye){this.element.style.top=`${ye.cellTop}px`;let Be=this.outputElements.get(ye.outputId);Be&&(Be.updateScroll(ye.outputOffset),ye.forceDisplay&&Be.outputNode&&(Be.outputNode.element.style.visibility="")),ye.forceDisplay&&(this.element.style.visibility="")}}class Rg{constructor(ye){this.outputId=ye;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(ye){ye&&Ut.clearOutput(ye,this.outputId),this.element.remove()}updateHeight(ye){this.element.style.maxHeight=`${ye}px`,this.element.style.height=`${ye}px`}updateScroll(ye){this.element.style.top=`${ye}px`}createOutputElement(ye,Be,Tt,Ht){return this.element.innerText="",this.element.style.maxHeight="0px",this.element.style.top=`${Be}px`,this._outputNode?.dispose(),this._outputNode=new tn(ye,Tt,Ht),this.element.appendChild(this._outputNode.element),this._outputNode}updateContentAndRender(ye){this._outputNode?.updateAndRerender(ye)}}p.postMessage({__vscode_notebook_message:!0,type:"initialized"});for(let Ke of a.staticPreloadsData)ax.load(Ke.entrypoint);function wo(Ke,ye){p.postMessage({__vscode_notebook_message:!0,type:Ke,...ye})}class tn{constructor(ye,Be,Tt){this.outputId=ye;this.cellId=Tt;this.hasResizeObserver=!1;this.isImageOutput=!1;this.element=document.createElement("div"),this.element.id=ye,this.element.classList.add("output"),this.element.style.position="absolute",this.element.style.top="0px",this.element.style.left=Be+"px",this.element.style.padding=`${a.style.outputNodePadding}px ${a.style.outputNodePadding}px ${a.style.outputNodePadding}px ${a.style.outputNodeLeftPadding}`,this.element.addEventListener("mouseenter",()=>{wo("mouseenter",{id:ye})}),this.element.addEventListener("mouseleave",()=>{wo("mouseleave",{id:ye})}),this.element.addEventListener("dragstart",Ht=>{if(!Ht.dataTransfer)return;let Do={outputId:this.outputId};Ht.dataTransfer.setData("notebook-cell-output",JSON.stringify(Do))}),window.addEventListener("keydown",Ht=>{Ht.altKey&&(this.element.draggable=!0)}),window.addEventListener("keyup",Ht=>{Ht.altKey||(this.element.draggable=this.isImageOutput)}),window.addEventListener("blur",()=>{this.element.draggable=this.isImageOutput})}dispose(){this.renderTaskAbort?.abort(),this.renderTaskAbort=void 0}async render(ye,Be,Tt,Ht){if(this.renderTaskAbort?.abort(),this.renderTaskAbort=void 0,this._content={preferredRendererId:Be,preloadErrors:Tt},ye.type===0){let _r=Dg?.createHTML(ye.htmlContent)??ye.htmlContent;this.element.innerHTML=_r}else if(Tt.some(_r=>_r instanceof Error)){let _r=Tt.filter(sl=>sl instanceof Error);ln("Error loading preloads",this.element,_r)}else{let _r=["image/png","image/jpeg","image/svg"];this.isImageOutput=_r.includes(ye.output.mime),this.element.draggable=this.isImageOutput;let sl=ba(this.outputId,ye.output.mime,ye.metadata,ye.output.valueBytes,ye.allOutputs,ye.output.appended),Dd=new AbortController;this.renderTaskAbort=Dd,Ht?.addEventListener("abort",()=>Dd.abort());try{await Ut.render(sl,Be,this.element,Dd.signal)}finally{this.renderTaskAbort===Dd&&(this.renderTaskAbort=void 0)}}this.hasResizeObserver||(this.hasResizeObserver=!0,Se.observe(this.element,this.outputId,!0,this.cellId));let Do=this.element.offsetHeight,io=document.defaultView.getComputedStyle(this.element),xr=parseFloat(io.paddingTop)+parseFloat(io.paddingBottom),oo=Do-xr;se(oo)&&io.padding==="0px"?(de.updateHeight(this.outputId,Do+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}`):se(oo)?(de.updateHeight(this.outputId,this.element.offsetHeight,{isOutput:!0,init:!0}),this.element.style.padding=`0 ${a.style.outputNodePadding}px 0 ${a.style.outputNodeLeftPadding}`):de.updateHeight(this.outputId,0,{isOutput:!0,init:!0});let Gr=this.element.shadowRoot??this.element,Sa=eo.requestHighlightCodeBlock(Gr);Sa.length>0&&wo("renderedCellOutput",{codeBlocks:Sa})}updateAndRerender(ye){this._content&&this.render(ye,this._content.preferredRendererId,this._content.preloadErrors)}}let Pt=new class{constructor(){window.document.addEventListener("dragover",ye=>{ye.preventDefault()}),window.document.addEventListener("drop",ye=>{ye.preventDefault();let Be=this.currentDrag;Be&&(this.currentDrag=void 0,wo("cell-drop",{cellId:Be.cellId,ctrlKey:ye.ctrlKey,altKey:ye.altKey,dragOffsetY:ye.clientY}))})}startDrag(ye,Be){if(!ye.dataTransfer||!r.dragAndDropEnabled)return;this.currentDrag={cellId:Be,clientY:ye.clientY};let Tt=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=`${Tt}`,this.dragOverlay.style.width="100%",this.dragOverlay.style.height="100%",this.dragOverlay.style.background="transparent",window.document.body.appendChild(this.dragOverlay)),ye.target.style.zIndex=`${Tt+1}`,ye.target.classList.add("dragging"),wo("cell-drag-start",{cellId:Be,dragOffsetY:ye.clientY});let Ht=()=>{this.currentDrag?.cellId===Be&&(wo("cell-drag",{cellId:Be,dragOffsetY:this.currentDrag.clientY}),window.requestAnimationFrame(Ht))};window.requestAnimationFrame(Ht)}updateDrag(ye,Be){Be!==this.currentDrag?.cellId?this.currentDrag=void 0:this.currentDrag={cellId:Be,clientY:ye.clientY}}endDrag(ye,Be){this.currentDrag=void 0,ye.target.classList.remove("dragging"),wo("cell-drag-end",{cellId:Be}),this.dragOverlay&&(this.dragOverlay.remove(),this.dragOverlay=void 0),ye.target.style.zIndex=""}}}function tco(a,i,e,t,o,n,r){return`
		const __import = (x) => import(x);
		(${m8o})(
			JSON.parse(decodeURIComponent("${encodeURIComponent(JSON.stringify({style:a,options:i,renderOptions:e,rendererData:t,staticPreloadsData:o,isWorkspaceTrusted:n,nonce:r}))}"))
		)
//# sourceURL=notebookWebviewPreloads.js
`}var h8o=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"]]),g8o={"theme-input-border-width":"1px","theme-button-primary-hover-shadow":"none","theme-button-secondary-hover-shadow":"none","theme-input-border-color":"transparent"},ico=a=>{let i={...a,...g8o};for(let[e,t]of h8o)i[e]=a[t];return i};var oco="vscode-cdn.net",owi=`vscode-resource.${oco}`,Gpe=`'self' https://*.${oco}`;function SRe(a,i){return a.scheme===Y.http||a.scheme===Y.https?a:(i&&i.authority&&i.isRemote&&a.scheme===Y.file&&(a=A.from({scheme:Y.vscodeRemote,authority:i.authority,path:a.path})),A.from({scheme:Y.https,authority:`${a.scheme}+${f8o(a.authority)}.${owi}`,path:a.path,fragment:a.fragment,query:a.query}))}function f8o(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 nco(a){return a.replace(/-([0-9a-f]{4})/g,(i,e)=>String.fromCharCode(parseInt(e,16)))}function yRe(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(oL(u)){let{text:g,count:f}=nVt(r);h=g,f>1&&(n+=f-1)}else h=rVt(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 nVt(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=>oL(s.mime));if(!r)break;i=i+rco.decode(r.data.buffer),t=t+1,o++}return{text:i.trim(),count:o}}var rco=new TextDecoder;function rVt(a,i,e=!1){let t=`${a}`,o=1e5;if(t=rco.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 sco(a,i,e,t){let o=i.model,n=a&&IRe.includes(a)?o.outputs.find(s=>s.mime===a):o.outputs.find(s=>IRe.includes(s.mime));if(a=n?.mime,!a||!n)return;let r=oL(a)?nVt(i).text:rVt(a,n);try{await e.writeText(r)}catch(s){t.error(`Failed to copy content: ${s}`)}}var IRe=["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 v8o=/:([\d]+)(?::([\d]+))?$/,b8o=/line=(\d+)$/,S8o=/^(.*)#([^#]*)$/,uA=class extends Jd{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N,O,V,U,G){super(U);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=N;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=_t();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=($,te)=>!this.webview||this._disposed?Promise.resolve(!1):(this._sendMessageToWebview({__vscode_notebook_message:!0,type:"customRendererMessage",rendererId:$,message:te}),Promise.resolve(!0))),this._register(S.onDidChangeTrust($=>{let te=this.asWebviewUri(this.getNotebookBaseUri(),void 0),pe=this.generateContent(te.toString());this.webview?.setHtml(pe)})),this._register(kc.onDidChange(()=>{this._sendMessageToWebview({type:"tokenizedStylesChanged",css:lco()})}))}static getOriginStore(e){return this._originStore??=new $j("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(12124,null),"notebook-cell-renderer-not-found-error":d(12126,null),"notebook-cell-renderer-fallbacks-exhausted":d(12125,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=tco({...this.options,tokenizationCss:lco()},{dragAndDropEnabled:this.options.dragAndDropEnabled},n,t,o,this.workspaceTrustManagementService.isWorkspaceTrusted(),this.nonce),s=this.configurationService.getValue("notebook.experimental.enableCsp"),l=this.getColor(Pse),c=this.getColor(Kb);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 ${Gpe} 'unsafe-inline' 'unsafe-eval';
					style-src ${Gpe} 'unsafe-inline';
					img-src ${Gpe} https: http: data:;
					font-src ${Gpe} 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 SRe(e,t?.scheme===Y.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===Y.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")?Gt?[]:[ci(gn.asFileUri("vs/nls.js"))]:[]}_initialize(e,t){if(!Me(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 iX(t,()=>this.webview));let o=new Go;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-Kpe);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(jd(r.href,Y.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($0(r.href,Y.http,Y.https,Y.mailto))this.openerService.open(r.href,{fromUserGesture:!0,fromWorkspace:!0});else if(jd(r.href,Y.vscodeNotebookCell)){let s=A.parse(r.href);await this._handleNotebookCellResource(s)}else/^[\w\-]+:/.test(r.href)?Xl(r.href)?this._openUri(A.file(r.href)):this._openUri(A.parse(r.href)):await this._handleResourceOpening(I8o(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||(it?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 kb&&(s.cellIsHovered=!0);break}case"mouseLeaveMarkupCell":{let s=this.notebookEditor.getCellById(r.cellId);s instanceof kb&&(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 kb&&(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=S8o.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===Y.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=v8o.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=b8o.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&&Xe(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&&bW(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=ms(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&&K6(u);r=p?`download${p}`:"download"}let s=je(n,r),l=await this.fileDialogService.showSaveDialog({defaultUri:s});if(!l)return;let c=Sl(o);await this.fileService.writeFile(l,c),await this.openerService.open(l)}_createInset(e,t){this.localResourceRootsCache=this._getResourceRootsCache();let o=e.createWebviewElement({origin:uA.getOriginStore(this.storageService).getOrigin(this.notebookViewType,void 0),title:d(12127,null),options:{purpose:"notebookRenderer",enableFindWidget:!1,transformCssVariables:ico},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=si(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=uo(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=_t();this.initializeMarkupPromise={p:new Go,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,aN(()=>{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=aco(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:_t(),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=aco(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(IRe.includes(n.mime)){let r=oL(n.mime)?nVt(e).text:rVt(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()}};uA=I([m(6,wm),m(7,Qe),m(8,un),m(9,Pe),m(10,Vt),m(11,dn),m(12,be),m(13,ze),m(14,X),m(15,ns),m(16,B),m(17,kt),m(18,Pe),m(19,Et),m(20,le),m(21,wn),m(22,_v),m(23,De),m(24,Te)],uA);function aco(a,i){if(a.byteLength===a.buffer.byteLength)return a;{let e=new Uint8Array(a);return i.push(e.buffer),e}}function lco(){let a=kc.getColorMap();return a?KN(a):""}function I8o(a){try{return decodeURIComponent(a)}catch{return a}}var uZe=class extends dp{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 $pe=class extends dp{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 jt),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 P,n=this.instantiationService.createInstance(zX,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()?si(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`)}};$pe=I([m(2,X),m(3,De),m(4,km),m(5,F)],$pe);var pZe=class extends dp{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 nwi=class a{static{this._ttPolicy=Kg("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+=Ebt(h,p.inflate(),t,g,f,l,ri)}return a._ttPolicy?.createHTML(c)??c}getDefaultColorMap(){let i=kc.getColorMap(),e=["#000000"];if(i)for(let t=1,o=i.length;t<o;t++)e[t]=Oe.Format.CSS.formatHex(i[t]);return e}},sVt=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 nwi().getRichText(e,new z(1,1,1,1e3));return r?(Fi(n,r),o):null}};var $F=class extends dp{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()}};oe.as(ii.Configuration).registerConfiguration({id:"notebook",order:100,type:"object",properties:{"notebook.lineNumbers":{type:"string",enum:["off","on"],default:"off",markdownDescription:d(12098,null)}}});W(class extends K{constructor(){super({id:"notebook.toggleLineNumbers",title:L(12100,"Toggle Notebook Line Numbers"),shortTitle:L(12101,"Line Numbers"),precondition:rr,menu:[{id:D.NotebookToolbar,group:"notebookLayout",order:2,when:x.equals("config.notebook.globalToolbar",!0)}],category:jm,f1:!0,toggled:{condition:x.notEquals("config.notebook.lineNumbers","off"),title:d(12099,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 xg{constructor(){super({id:"notebook.cell.toggleLineNumbers",title:d(12097,null),precondition:fr.isEqualTo(qL),menu:[{id:D.NotebookCellTitle,group:"View",order:1}],toggled:x.or(BJe.isEqualTo("on"),x.and(BJe.isEqualTo("inherit"),x.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 y8o=200,wRe=class extends dp{constructor(e,t,o){super();this._notebookEditor=e;this._executionOrderLabel=t;this._notebookExecutionStateService=o;this.kernelDisposables=this._register(new P);this._executionOrderLabel.classList.add("cell-execution-order"),this._executionOrderContent=R(this._executionOrderLabel,_("div")),this._register(this._notebookExecutionStateService.onDidChangeExecution(n=>{this.currentCell&&Wo(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;nn(()=>{this.currentCell===n&&(this.updateExecutionOrder(this.currentCell.internalMetadata,!0),this._updatePosition())},y8o,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){xo(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}bn(this._executionOrderLabel);let o=this.currentCell.layoutInfo.editorHeight-22+this.currentCell.layoutInfo.statusBarHeight;if(this.currentCell instanceof Qm){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=Kn(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(Sw,"spin");R(this._executionOrderContent,...Bn(`$(${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`}};wRe=I([m(2,rs)],wRe);var mZe=class extends dp{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 hZe=class extends dp{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 Bg(R(this.left.domNode,_(".codeOutput-focus-indicator-container",void 0,_(".codeOutput-focus-indicator.code-focus-indicator")))),this.outputFocusIndicator=new Bg(R(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 CRe=class extends dp{constructor(e,t,o){super();this._notebookExecutionStateService=o;this._progressBar=this._register(new fb(e,kx)),this._progressBar.hide(),this._collapsedProgressBar=this._register(new fb(t,kx)),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)?w8o(n):n.hide()}};CRe=I([m(2,rs)],CRe);function w8o(a){a.infinite().show(500)}var xRe=_,qpe=class extends dp{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=R(o,xRe(".cell-statusbar-container")),this.statusBarContainer.tabIndex=-1;let u=R(this.statusBarContainer,xRe(".cell-status-left")),p=R(this.statusBarContainer,xRe(".cell-status-right"));this.leftItemsContainer=R(u,xRe(".cell-contributed-items.cell-contributed-items-left")),this.rightItemsContainer=R(p,xRe(".cell-contributed-items.cell-contributed-items-right")),this.itemsDisposable=this._register(new P),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&&Ao(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 Qm&&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(gZe,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(),Ue(this.leftItems),Ue(this.rightItems)}};qpe=I([m(4,F),m(5,tt),m(6,B),m(7,De)],qpe);var gZe=class extends C{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=xRe(".cell-status-item");this._itemDisposables=this._register(new P);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 BC(this.container)).text=e.text.replace(/\n/g," "));let o=s=>xSe(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?fu(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 Ii(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(In(n))}}};gZe=I([m(5,Te),m(6,ge),m(7,Ne),m(8,De),m(9,tt)],gZe);var VR=class extends ml{updateLabel(){this.options.label&&this.label&&Fi(this.label,...Bn(this._commandAction.label??""))}},kRe=class extends ml{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)}},N4=class extends mE{constructor(e,t,o,n,r,s,l,c,u){super(e,{...t,hoverDelegate:t?.hoverDelegate??Ni("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??Ni("element"),this._actionLabel,"")),this.updateLabel();for(let t of[re.CLICK,re.MOUSE_DOWN,Gn.Tap])this._register(j(e,t,o=>this.onClick(o,!0)))}onClick(e,t=!1){$t.stop(e,!0);let o=Jn(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 Eo){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))}}};N4=I([m(5,_e),m(6,ze),m(7,De),m(8,tt)],N4);function aVt(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?Kn(n,u,p):n;e.style.top=`${h}px`}};r();let s=[];return s.push(a.onDidScroll(()=>r()),a.onDidChangeLayout(()=>r())),hn(...s)}var jpe=class extends sZe{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 Ju(this._bottomCellToolbarContainer,this.contextMenuService,{actionViewItemProvider:(n,r)=>{if(n instanceof Eo)return this._notebookEditor.notebookOptions.getDisplayOptions().insertToolbarAlignment==="center"?this.instantiationService.createInstance(VR,n,{hoverDelegate:r.hoverDelegate}):this.instantiationService.createInstance(ml,n,{hoverDelegate:r.hoverDelegate})}}));this._betweenCellToolbar=e;let t=this._register(this.menuService.createMenu(this._notebookEditor.creationOptions.menuIds.cellInsertToolbar,this.contextKeyService)),o=()=>{let n=fZe(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)`}};jpe=I([m(3,F),m(4,ze),m(5,X),m(6,qt)],jpe);var Qpe=class extends sZe{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=fZe(e),n=fZe(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(Gg()),n=this._register(this.instantiationService.createInstance(Ol,this.toolbarContainer,{actionViewItemProvider:(s,l)=>Ca(this.instantiationService,s,l),renderDropdownAsChildElement:!0,hoverDelegate:o})),r=this._register(this.instantiationService.invokeFunction(s=>C8o(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(aVt(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=fZe(t);r=()=>this.updateActions(e,l);return}let s=fZe(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&&(nn(()=>{r?.()},0,this._store),r=void 0)}))}updateActions(e,t){let o=ts(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())}};Qpe=I([m(5,X),m(6,qt),m(7,F)],Qpe);function fZe(a){return hl(a.getActions({shouldForwardArgs:!0}),i=>/^inline/.test(i))}function C8o(a,i,e,t){let o=a.get(ze),n=a.get(_e),r=a.get(F),s=new Ju(i,o,{getKeyBinding:l=>n.lookupKeybinding(l.id),actionViewItemProvider:(l,c)=>Ca(r,l,c),renderDropdownAsChildElement:!0,hoverDelegate:e});return t&&s.getElement().classList.add(t),s}var vZe=Kg("collapsedCellPreview",{createHTML:a=>a});var rwi="notebook.cellOutput.copy";W(class extends K{constructor(){super({id:"notebook.cellOuput.showEmptyOutputs",title:d(11755,null),menu:{id:D.NotebookOutputToolbar,when:x.and(gk,SWt)},f1:!1,category:jm})}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:rwi,title:d(11751,null),menu:{id:D.NotebookOutputToolbar,when:gk},category:jm,icon:zJe})}async run(i,e){let t=i.get(ee),o=i.get(Wi),n=i.get(ne),r=lVt(t,e);if(!r)return;let s=cVt(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 sco(l,s,o,n)}});function bZe(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 lVt(a,i){return i&&"notebookEditor"in i?i.notebookEditor:qn(a.activeEditorPane)}function cVt(a,i){let e;if(a&&"outputId"in a&&typeof a.outputId=="string"?e=bZe(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 x8o="notebook.cellOutput.openInTextEditor";W(class extends K{constructor(){super({id:x8o,title:d(11752,null),f1:!1,category:jm,icon:zJe})}async run(i,e){let t=i.get(ee),o=i.get(mh),n=i.get(Qe),r=lVt(t,e);if(!r)return;let s=cVt(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 k8o="notebook.cellOutput.saveImage";W(class extends K{constructor(){super({id:k8o,title:d(11754,null),menu:{id:D.NotebookOutputToolbar,when:x.regex(XLe.key,/^image\//)},f1:!1,category:jm,icon:nlo})}async run(i,e){let t=i.get(ee),o=i.get(dn),n=i.get(be),r=i.get(ne),s=lVt(t,e);if(!s)return;let l=cVt(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(11750,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 E8o="notebook.cellOutput.openInOutputPreview";W(class extends K{constructor(){super({id:E8o,title:d(11753,null),menu:{id:D.NotebookOutputToolbar,when:x.and(gk,x.equals("config.notebook.output.openInPreviewEditor.enabled",!0))},f1:!1,category:jm})}async run(i,e){let t=i.get(ee),o=i.get(Qe),n=lVt(t,e);if(!n)return;let r=cVt(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 O4=class extends C{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 P);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(he(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=R(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(12103,null));if(!t){let n=e.model.outputs.map(r=>r.mime).join(", ");return this._renderMessage(e,d(12105,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=>IRe.indexOf(t.mimeType)||t.mimeType.startsWith("image/")))return!1;if(oL(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!oL(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 st("notebook.output.pickMimetype",d(12106,null),q.asClassName(_Wt),void 0,async w=>this._pickActiveMimeTypeRenderer(e,t,o,this.output))),g=this.toolbarDisposables.add(this.contextKeyService.createScoped(e)),f=SWt.bindTo(g),v=bWt.bindTo(g),b=XLe.bindTo(g);v.set(n===0),b.set(r.mimeType),this.toolbarDisposables.add(he(w=>{f.set(this.cellOutputContainer.hasHiddenOutputs.read(w))}));let S=this.toolbarDisposables.add(this.menuService.createMenu(D.NotebookOutputToolbar,g)),y=()=>{let{secondary:w}=hl(S.getActions({shouldForwardArgs:!0}),()=>!1);c||(w=w.filter(k=>k.id!==rwi)),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===az?c:l).push({label:S.mimeType,id:S.mimeType,index:y,picked:y===s,detail:this._generateRendererInfo(S.rendererId),description:y===s?d(12102,null):void 0})}),c.some(S=>T8o.includes(S.id))&&c.push({label:d(12104,null),id:"installRenderers",index:r.length});let u=new P,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(12108,null):d(12107,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:${Gxe}`)}_generateRendererInfo(e){let t=this.notebookService.getRendererInfo(e);return t?`${t.displayName!==""?t.displayName:t.id} (${t.extensionId.value})`:d(12109,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()}};O4=I([m(5,un),m(6,Ge),m(7,X),m(8,qt),m(9,zi),m(10,F)],O4);var Ype=class{constructor(i,e){this.model=i;this.element=e}};var ERe=class extends dp{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=Le("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),bn(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(O4,this.notebookEditor,this.viewCell,this,this.templateData.outputContainer,t);this._outputEntries.push(new Ype(t,o)),o.render(void 0)}this.viewCell.outputsViewModels.length>this.options.limit&&(bn(this.templateData.outputShowMoreContainer.domNode),this.viewCell.updateOutputShowMoreContainerHeight(46)),this._validateFinalOutputHeight(!1)}else xo(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)):(xo(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?bn(this.templateData.outputContainer.domNode):xo(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 Ype(c,this.instantiationService.createInstance(O4,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 Ype(p,this.instantiationService.createInstance(O4,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 Ype(p,this.instantiationService.createInstance(O4,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 Ype(h,this.instantiationService.createInstance(O4,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?(bn(this.templateData.outputShowMoreContainer.domNode),this.templateData.outputShowMoreContainer.domNode.hasChildNodes()||this.templateData.outputShowMoreContainer.domNode.appendChild(this._generateShowMoreElement(this.templateData.templateDisposables)),this.viewCell.updateOutputShowMoreContainerHeight(46)):xo(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(nb(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()}};ERe=I([m(4,Qe),m(5,rs),m(6,F)],ERe);var T8o=["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 TRe=class extends C{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="",Fi(this._element,...Bn(t.text)),this._element.title=t.tooltip??""):(this._element.style.display="none",Fi(this._element))}_getItemForState(e,t){let o=e?.state,{lastRunSuccess:n}=t;if(!o&&n)return{text:`$(${xWt.id})`,tooltip:d(12115,null)};if(!o&&n===!1)return{text:`$(${oRe.id})`,tooltip:d(12113,null)};if(o===2||o===1)return{text:`$(${kWt.id})`,tooltip:d(12114,null)};if(o===3)return{text:`$(${q.modify(Sw,"spin").id})`,tooltip:d(12112,null)}}};TRe=I([m(3,rs)],TRe);var _Re=class extends C{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 $F(this.notebookEditor.getBaseCellEditorOptions(t.language),this.notebookEditor.notebookOptions,this.configurationService)),this._outputContainerRenderer=this.instantiationService.createInstance(ERe,e,t,o,{limit:vRe}),this.cellParts=this._register(o.cellParts.concatContentPart([this._cellEditorOptions,this._outputContainerRenderer],Me(e.getDomNode())));let v={height:this.calculateInitEditorHeight(),width:this.viewCell.layoutInfo.editorWidth};this._cellLayout=new swi(this._useNewApproachForEditorLayout,e,t,o,{debug:f},v),this.initializeEditor(v),this._renderedInputCollapseState=!1,this.registerNotebookEditorListeners(),this.registerViewCellLayoutChange(),this.registerCellEditorEventListeners(),this.registerMouseListener(),this._register(H.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=R(this.templateData.cellInputCollapsedContainer,_(".collapsed-execution-icon"));this._register(Z(()=>{b.remove()})),this._collapsedExecutionIcon=this._register(this.instantiationService.createInstance(TRe,this.notebookEditor,this.viewCell,b)),this.updateForCollapseState(),this._register(H.runAndSubscribe(t.onDidChangeOutputs,this.updateForOutputs.bind(this))),this._register(H.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 $e;this._register({dispose(){t.dispose(!0)}}),wa(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=T6(Me(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 $e;this._register({dispose(){t.dispose(!0)}}),wa(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(){mm(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?Kn(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(()=>{Zu.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=vZe?.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=Me(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(Ah(Me(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(){xo(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=vZe?.createHTML(e)??e,this._inputCollapseElement=t,this.templateData.cellInputCollapsedContainer.appendChild(t),this._attachInputExpandButton(t),bn(this.templateData.cellInputCollapsedContainer)}_attachInputExpandButton(e){let t=_("span.expandInputIcon"),o=this.keybindingService.lookupKeybinding(Kxe);o&&(e.title=d(12111,null,o.getLabel()),t.title=d(12110,null,o.getLabel())),t.classList.add(...q.asClassNameArray(M.more)),e.appendChild(t)}_showInput(){this._collapsedExecutionIcon.setVisibility(!1),bn(this.templateData.editorPart),xo(this.templateData.cellInputCollapsedContainer)}_getRichText(e,t){return kbt(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}">${ur(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")&&mm(!e,t[o])}_collapseOutput(){this.templateData.container.classList.toggle("output-collapsed",!0),bn(this.templateData.cellOutputCollapsedContainer),this._updateOutputInnerContainer(!0),this._outputContainerRenderer.viewUpdateHideOuputs()}_showOutput(e){this.templateData.container.classList.toggle("output-collapsed",!1),xo(this.templateData.cellOutputCollapsedContainer),this._updateOutputInnerContainer(!1),this._outputContainerRenderer.viewUpdateShowOutputs(e)}initialViewUpdateExpanded(){this.templateData.container.classList.toggle("input-collapsed",!1),bn(this.templateData.editorPart),xo(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()}};_Re=I([m(4,F),m(5,_e),m(6,kt),m(7,B),m(8,rs),m(9,_v)],_Re);var swi=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 N=Math.max(0,p-h-o-n),O=u-N;O<t&&(N=N-(t-O)-n);let V=v,U=0;if(p<=h+o){let G=t+this.notebookEditor.notebookOptions.getLayoutConfiguration().editorTopPadding;y>=S?(V=Kn(v,G,v),this._editorVisibility="Full"):(V=Kn(y-(h+o)-r,G,v)+2*n,this._editorVisibility="Bottom Clipped",U=0)}else if(w<=v&&y<=S){let G=t+this.notebookEditor.notebookOptions.getLayoutConfiguration().editorTopPadding;V=Kn(w-r,G,v-r)+2*n,this._editorVisibility="Full (Small Viewport)",U=N}else{let G=t;V=Kn(v-(p-(h+o)),G,v),p>S?this._editorVisibility="Invisible":this._editorVisibility="Top Clipped",U=v-V}this._logService.debug(`${i} (${this._editorVisibility}, ${this._initialized})`),this._logService.debug(`=> Editor Top = ${N}px (editHeight = ${u}, editContentHeight: ${v})`),this._logService.debug(`=> eleTop = ${h}, eleBottom = ${g}, eleHeight = ${f}`),this._logService.debug(`=> scrollTop = ${p}, top = ${N}`),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 = ${U}px, StatusbarHeight = ${r}, lineHeight = ${this.notebookEditor.getLayoutInfo().fontInfo.lineHeight}`);try{this._isUpdatingLayout=!0,e.style.top=`${N}px`,s.layout({width:this._initialized?c:this._initialEditorDimension.width,height:V},!0),!this._pointerDown&&U>=0&&(this._lastChangedEditorScrolltop=U,s.setScrollTop(U))}finally{this._initialized=!0,this._isUpdatingLayout=!1,this._logService.debug("Updated Editor Layout")}}};var dI=class extends oc{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 ml(e,{hoverDelegate:r?.hoverDelegate},l,c,u,p,s,h),r?.actionRunner&&(this._primaryAction.actionRunner=r.actionRunner),this._dropdown=new wp(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(R(this._container,t)),this._dropdownContainer=_(".dropdown-action-container"),this._dropdown.render(R(this._container,this._dropdownContainer)),this._register(j(t,re.KEY_DOWN,o=>{if(!this.action.enabled)return;let n=new Ii(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 Ii(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 wp(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()}};dI=I([m(5,ze),m(6,_e),m(7,Ne),m(8,X),m(9,De),m(10,Bi)],dI);var DRe=class extends dp{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(aVt(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 hl(e.getActions({shouldForwardArgs:!0}),t=>/^inline/.test(t))}createRunCellToolbar(e,t,o){let n=this._register(new P),r=this._register(new st("notebook.moreRunActions",d(12116,null),"codicon-chevron-down",!0)),s=c=>this.keybindingService.lookupKeybinding(c.id,l),l=this._register(_8o(o));this.toolbar=this._register(new Ju(e,this.contextMenuService,{getKeyBinding:s,actionViewItemProvider:(c,u)=>{n.clear();let p=this.getCellToolbarActions(this.primaryMenu).primary[0];if(!(p instanceof Eo))return;let h=this.getCellToolbarActions(this.secondaryMenu).secondary;if(!h.length)return;let g=this.instantiationService.createInstance(dI,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}))}};DRe=I([m(6,qt),m(7,_e),m(8,ze),m(9,F)],DRe);function _8o(a){let i=a.createScoped(document.createElement("div"));return $h.bindTo(i).set(!0),ue.editorTextFocus.bindTo(i).set(!0),ue.focus.bindTo(i).set(!0),ue.textInputFocus.bindTo(i).set(!0),xpe.bindTo(i).set("idle"),$u.bindTo(i).set(!0),rr.bindTo(i).set(!0),hS.bindTo(i).set("code"),i}var SZe=class extends dp{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 cco=_,LRe=class extends dp{constructor(e,t,o){super();this.notebookEditor=e;let n=R(t,cco("span.expandOutputPlaceholder"));n.textContent=d(12119,null);let r=R(t,cco("span.expandOutputIcon"));r.classList.add(...q.asClassNameArray(M.more));let s=o.lookupKeybinding(NEt);s&&(n.title=d(12118,null,s.getLabel()),t.title=d(12117,null,s.getLabel())),xo(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)}};LRe=I([m(2,_e)],LRe);var D8o={limit:5e3,update:()=>{}},dVt=class{constructor(){this._viewModel=null;this._viewModelStore=new P;this._onDidFoldingRegionChanges=new E;this.onDidFoldingRegionChanged=this._onDidFoldingRegionChanges.event;this._foldingRangeDecorationIds=[];this._regions=new jI(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=Lf(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(awi(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=yri(o,D8o),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*awi(a){for(let i of Yc.lexer(a,{gfm:!0}))i.type==="heading"&&(yield{depth:i.depth,text:qa({value:i.raw}).trim()})}var BR=class extends C{constructor(e){super();this._notebookEditor=e;this._foldingModel=null;this._localStore=this._register(new P);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 dVt,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()}};tm(BR.id,BR);var L8o=d(11813,null),dco=L(11815,"Unfold Cell"),uco={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(11814,"Fold Cell"),category:jm,keybinding:{when:x.and(rr,x.not(Uu)),primary:3164,mac:{primary:2652,secondary:[15]},secondary:[15],weight:200},metadata:{description:L8o,args:uco.args},precondition:Ua,f1:!0})}async run(a,i){let e=a.get(ee),t=qn(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(BR.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:dco,category:jm,keybinding:{when:x.and(rr,x.not(Uu)),primary:3166,mac:{primary:2654,secondary:[17]},secondary:[17],weight:200},metadata:{description:dco,args:uco.args},precondition:Ua,f1:!0})}async run(a,i){let e=a.get(ee),t=qn(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(BR.id);r!==void 0&&(n==="up"?s.setFoldingStateUp(r,1,o):s.setFoldingStateDown(r,1,o))}});var RRe=class extends dp{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(),xo(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?Fi(this._container,n,this.getHiddenCellsLabel(o),this.getHiddenCellHintButton(e)):Fi(this._container,this.getHiddenCellsLabel(o),this.getHiddenCellHintButton(e)),bn(this._container);let r=e.layoutInfo.previewHeight;this._container.style.top=`${r}px`}else this._cellExecutionListener.clear(),this._runButtonListener.clear(),xo(this._container)}getHiddenCellsLabel(e){let t=e===1?d(12120,null):d(12121,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(M.more)),this._register(j(t,re.CLICK,()=>{let o=this._notebookEditor.getContribution(BR.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(Sw,"spin"):M.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(Sw,"spin"):M.play;t.className="",t.classList.add("folded-cell-run-section-button",...q.asClassNameArray(c))}),t}updateInternalLayoutNow(e){this.update(e)}};RRe=I([m(2,rs)],RRe);var MRe=class extends C{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 P);this.focusSwitchDisposable=this._register(new me);this.editorDisposables=this._register(new P);this._isDisposed=!1;this.constructDOM(),this.editorPart=o.editorPart,this.cellEditorOptions=this._register(new $F(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 $e;this._register({dispose(){e.dispose(!0)}}),wa(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(){bn(this.templateData.cellInputCollapsedContainer),xo(this.editorPart),this.templateData.cellInputCollapsedContainer.innerText="",R(this.templateData.cellInputCollapsedContainer,_("span")).classList.add(...q.asClassNameArray(M.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=vZe?.createHTML(o)??o,this.templateData.cellInputCollapsedContainer.appendChild(t);let n=R(t,_("span.expandInputIcon"));n.classList.add(...q.asClassNameArray(M.more));let r=this.keybindingService.lookupKeybinding(Kxe);r&&(t.title=d(12123,null,r.getLabel()),n.title=d(12122,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 kbt(this.languageService,e.getLineContent(1),t)}viewUpdateEditing(){let e;if(bn(this.editorPart),this.markdownAccessibilityContainer.ariaHidden="true",xo(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);ue.inCompositeEditor.bindTo(s).set(!0);let l=this.editorDisposables.add(this.instantiationService.createChild(new Io([X,s])));this.editorDisposables.add(s),this.editor=this.editorDisposables.add(l.createInstance(jr,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&&Xb.get(this.editor)?.stopHighlighting()})),this.editorDisposables.add(this.editor.onDidFocusEditorWidget(()=>{this.editor&&Xb.get(this.editor)?.restoreViewState(!0)}));let c=new $e;this.editorDisposables.add({dispose(){c.dispose(!0)}}),wa(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(),xo(this.editorPart),xo(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()?Iq(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="",Fi(this.templateData.foldingIndicator,Qo(EWt));break;case 1:this.templateData.foldingIndicator.style.display="",Fi(this.templateData.foldingIndicator,Qo(TWt));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=nn(()=>t(),300):t()})),t()}onCellEditorHeightChange(e,t){let o=e.getLayoutInfo();this.viewCell.editorHeight=t,e.layout({width:o.width,height:t})}};MRe=I([m(4,Bi),m(5,X),m(6,F),m(7,kt),m(8,B),m(9,_e)],MRe);var Ym=_,PRe=class extends C{constructor(e,t){super();this.configurationService=t;let o=this.configurationService.getValue("editor");this.lineHeight=LS(o,Xd.getInstance(e).value).lineHeight}getHeight(e){return e.getHeight(this.lineHeight)}getDynamicHeight(e){return e.getDynamicHeight()}getTemplateId(e){return e.cellKind===1?F4.TEMPLATE_ID:W4.TEMPLATE_ID}};PRe=I([m(1,B)],PRe);var uVt=class extends C{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 $F(this.notebookEditor.getBaseCellEditorOptions(u),this.notebookEditor.notebookOptions,r))}dispose(){super.dispose(),this.dndController=void 0}},F4=class extends uVt{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 F4.TEMPLATE_ID}renderTemplate(e){e.classList.add("markdown-cell-row");let t=R(e,_(".cell-inner-container")),o=new P,n=o.add(this.contextKeyServiceProvider(t)),r=R(e,Ym(".cell-decoration")),s=R(t,Ym(".cell-title-toolbar")),l=new Bg(R(t,Ym(".cell-focus-indicator.cell-focus-indicator-top"))),c=new Bg(R(t,_(".cell-focus-indicator.cell-focus-indicator-side.cell-focus-indicator-left"))),u=R(c.domNode,_(".notebook-folding-indicator")),p=new Bg(R(t,_(".cell-focus-indicator.cell-focus-indicator-side.cell-focus-indicator-right"))),h=R(t,Ym(".cell.code")),g=R(h,Ym(".cell-editor-part")),f=R(g,Ym(".cell-chat-part")),v=R(h,Ym(".input-collapse-container"));v.style.display="none";let b=R(g,Ym(".cell-editor-container"));g.style.display="none";let S=R(t,Ym(".cell-comment-container")),y=R(t,Ym(".cell.markdown")),w=R(t,Ym(".cell-bottom-toolbar-container")),k=o.add(this.instantiationService.createChild(new Io([X,n]))),T={toggle:(G,$)=>t.classList.toggle(G,$)},N=o.add(k.createInstance(Qpe,s,T,this.notebookEditor.creationOptions.menuIds.cellTitleToolbar,this.notebookEditor.creationOptions.menuIds.cellDeleteToolbar,this.notebookEditor)),O=new Bg(R(t,Ym(".cell-focus-indicator.cell-focus-indicator-bottom"))),V=new aZe(Me(e),[o.add(k.createInstance(uZe,this.notebookEditor,f)),o.add(k.createInstance(qpe,this.notebookEditor,t,g,void 0)),o.add(new hZe(this.notebookEditor,N,l,c,p,O)),o.add(new RRe(this.notebookEditor,R(t,Ym(".notebook-folded-hint")),this._notebookExecutionStateService)),o.add(new pZe(this.notebookEditor,e,r)),o.add(k.createInstance($pe,this.notebookEditor,S)),o.add(new SZe(this.notebookEditor,v)),o.add(new mZe(t,void 0,this.notebookEditor)),o.add(new lZe(t)),o.add(k.createInstance(Upe,this.notebookEditor))],[N,o.add(k.createInstance(jpe,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 P),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(MRe,this.notebookEditor,e,o,this.renderedEditors))}disposeTemplate(e){e.templateDisposables.dispose()}disposeElement(e,t,o){o.elementDisposables.clear()}};F4=I([m(4,B),m(5,F),m(6,ze),m(7,qt),m(8,_e),m(9,Ne),m(10,rs)],F4);var W4=class extends uVt{constructor(e,t,o,n,r,s,l,c,u,p,h){super(u,e,l,c,s,p,h,r,Fr,n);this.renderedEditors=t;this.editorPool=o}static{this.TEMPLATE_ID="code_cell"}get templateId(){return W4.TEMPLATE_ID}renderTemplate(e){e.classList.add("code-cell-row");let t=R(e,_(".cell-inner-container")),o=new P,n=o.add(this.contextKeyServiceProvider(t)),r=R(e,Ym(".cell-decoration")),s=new Bg(R(t,Ym(".cell-focus-indicator.cell-focus-indicator-top"))),l=R(t,Ym(".cell-title-toolbar")),c=new Bg(R(t,_(".cell-focus-indicator.cell-focus-indicator-side.cell-focus-indicator-left"))),u=R(t,Ym(".cell-chat-part")),p=R(t,Ym(".cell.code")),h=R(p,Ym(".run-button-container")),g=R(p,Ym(".input-collapse-container"));g.style.display="none";let f=R(c.domNode,Ym("div.execution-count-label"));f.title=d(12128,null);let v=R(p,Ym(".cell-editor-part")),b=R(v,Ym(".cell-editor-container")),S=R(t,Ym(".cell-comment-container")),y=o.add(this.contextKeyServiceProvider(v)),w=o.add(this.instantiationService.createChild(new Io([X,y])));ue.inCompositeEditor.bindTo(y).set(!0);let k=w.createInstance(jr,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 Bg(R(t,Ym(".output"))),N=R(T.domNode,Ym(".output-collapse-container")),O=new Bg(R(t,Ym(".output-show-more-container"))),V=new Bg(R(t,_(".cell-focus-indicator.cell-focus-indicator-side.cell-focus-indicator-right"))),U=R(t,Ym(".cell-editor-focus-sink"));U.setAttribute("tabindex","0");let G=R(t,Ym(".cell-bottom-toolbar-container")),$=new Bg(R(t,Ym(".cell-focus-indicator.cell-focus-indicator-bottom"))),te=o.add(this.instantiationService.createChild(new Io([X,n]))),pe={toggle:(Qt,Ze)=>t.classList.toggle(Qt,Ze)},de=o.add(te.createInstance(Qpe,l,pe,this.notebookEditor.creationOptions.menuIds.cellTitleToolbar,this.notebookEditor.creationOptions.menuIds.cellDeleteToolbar,this.notebookEditor)),se=o.add(new hZe(this.notebookEditor,de,s,c,V,$)),Se=[se,o.add(te.createInstance(uZe,this.notebookEditor,u)),o.add(te.createInstance(qpe,this.notebookEditor,t,v,k)),o.add(te.createInstance(CRe,v,g)),o.add(new pZe(this.notebookEditor,e,r)),o.add(te.createInstance($pe,this.notebookEditor,S)),o.add(te.createInstance(wRe,this.notebookEditor,f)),o.add(te.createInstance(LRe,this.notebookEditor,N)),o.add(new SZe(this.notebookEditor,g)),o.add(new mZe(t,U,this.notebookEditor)),o.add(new lZe(t)),o.add(te.createInstance(Upe,this.notebookEditor))],{cellExecutePrimary:ke,cellExecuteToolbar:Ee}=this.notebookEditor.creationOptions.menuIds;ke&&Ee&&Se.push(o.add(te.createInstance(DRe,this.notebookEditor,n,t,h,ke,Ee)));let He=new aZe(Me(e),Se,[de,o.add(te.createInstance(jpe,this.notebookEditor,l,G))]);o.add(He);let Ve={rootContainer:e,editorPart:v,cellInputCollapsedContainer:g,cellOutputCollapsedContainer:N,instantiationService:te,container:t,cellContainer:p,focusSinkElement:U,outputContainer:T,outputShowMoreContainer:O,editor:k,templateDisposables:o,elementDisposables:o.add(new P),cellParts:He,toJSON:()=>({})},Fe=[c.domNode,se.codeFocusIndicator.domNode,se.outputFocusIndicator.domNode];return this.dndController?.registerDragHandle(Ve,e,Fe,()=>new sVt().getDragImage(Ve,Ve.editor,"code")),Ve}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(_Re,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)}};W4=I([m(5,B),m(6,ze),m(7,qt),m(8,F),m(9,_e),m(10,Ne)],W4);var ARe=class extends C{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 NRe=class extends C{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=Vq._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:XSe,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:XSe,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=Vq._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:MN,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 V4=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]}},FRe=class extends C{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 P);this._throttledDelayer=this._register(new jo(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 NRe(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),Wo(e,{index:!0})&&(this._currentMatch=e.index);else{let o=this._findMatchesStarts.getTotalSum();if(Wo(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=xn(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=xy(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=xy(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=xy(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=xy(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 KT(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()}};FRe=I([m(2,B)],FRe);var pVt=class extends C{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=!E8e([r],[this._primary])||!E8e(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 R8o=()=>{throw new Error("Invalid change accessor")},cwi=class{constructor(){this._decorationsTree=new L9}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)}},pco=[po.register({description:"notebook-view-model-tracked-range-always-grows-when-typing-at-edges",stickiness:0}),po.register({description:"notebook-view-model-tracked-range-never-grows-when-typing-at-edges",stickiness:1}),po.register({description:"notebook-view-model-tracked-range-grows-only-when-typing-before",stickiness:2}),po.register({description:"notebook-view-model-tracked-range-grows-only-when-typing-after",stickiness:3})];function M8o(a){return a instanceof po?a:po.createDynamic(a)}var lwi=0,BZ=class extends C{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 P);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 pVt);this._decorationsTree=new cwi;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;lwi++,this.id="$notebookViewModel"+lwi,this._instanceId=_be(lwi);let h=(f,v)=>{let b=f.map(k=>[k[0],k[1],k[2].map(T=>mco(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(N=>{this._handleToViewCellMapping.delete(N.handle),N.dispose()}),k[2].forEach(N=>{this._handleToViewCellMapping.set(N.handle,N),this._localStore.add(N)})});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 N=0;for(let O=0;O<b.length;O++){let V=b[0];if(V[0]+V[1]<=T){N+=V[2].length-V[1];continue}if(V[0]>T){y=[k];break}if(V[0]+V[1]>T){y=[this._viewCells[V[0]+N].handle];break}}}let w=y.map(k=>this._viewCells.findIndex(T=>T.handle===k));this._selectionCollection.setState(fce([w[0]])[0],fce(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 QWt(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 Qm&&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(mco(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 Lf(this._selectionCollection.selections).map(o=>o<this.length?this.cellAt(o):void 0).forEach(o=>{o&&!e.has(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(fce(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=Kn(e.start,0,this.length),o=Kn(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=fce(e.selections.map(s=>this.getCellIndexByHandle(s))).map(s=>this.validateRange(s)).filter(s=>s!==null);this._selectionCollection.setState(n,MO(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,MO(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(pco[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:pco[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 rae(b,0,0),this._decorations[b]=p}let h=o[c],g=h.range,f=M8o(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(K7i(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=wI(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 Qm&&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 Qm&&(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=R8o,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=Lf(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 V4(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 ja(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 IL||t instanceof vW?(await this._withElement(t,async()=>{await this._undoService.undo(this.uri)}),t instanceof IL?[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 IL||t instanceof vW?(await this._withElement(t,async()=>{await this._undoService.redo(this.uri)}),t instanceof IL?[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()}};BZ=I([m(5,F),m(6,ma),m(7,Cl),m(8,Nt),m(9,rs)],BZ);function mco(a,i,e,t){return e.cellKind===2?a.createInstance(Qm,i.viewType,e,i.layoutInfo,t):a.createInstance(kb,i.viewType,e,i.layoutInfo,i,t)}var WRe=class{constructor(i,e,t){this.notebookOptions=i;this.eventDispatcher=e;this.getBaseCellEditorOptions=t}};var dwi=21,P8o=21,B4=8,uwi=class{constructor(i,e,t,o){this.notebookEditor=i;this.editorToolbar=e;this.goToMenu=t;this.instantiationService=o}actionProvider(i,e){if(i.id===tT)return this.instantiationService.createInstance(gB,i,this.notebookEditor,e);if(i instanceof Eo)return this.instantiationService.createInstance(kRe,i,{hoverDelegate:e.hoverDelegate});if(i instanceof Cc&&i.item.submenu.id===D.NotebookCellExecuteGoTo.id)return this.instantiationService.createInstance(N4,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=hco(e,t,i);return{primaryActions:o.primaryActions.map(n=>n.action),secondaryActions:o.secondaryActions}}},pwi=class{constructor(i,e,t,o){this.notebookEditor=i;this.editorToolbar=e;this.goToMenu=t;this.instantiationService=o}actionProvider(i,e){if(i.id===tT)return this.instantiationService.createInstance(gB,i,this.notebookEditor,e);if(i instanceof Eo)return this.instantiationService.createInstance(ml,i,{hoverDelegate:e.hoverDelegate});if(i instanceof Cc)return i.item.submenu.id===D.NotebookCellExecuteGoTo.id?this.instantiationService.createInstance(N4,i,{hoverDelegate:e.hoverDelegate},!1,{getActions:()=>this.goToMenu.getActions().find(([t])=>t==="navigation/execute")?.[1]??[]},this.actionProvider.bind(this)):this.instantiationService.createInstance(mE,i,{hoverDelegate:e.hoverDelegate})}calculateActions(i){let e=this.editorToolbar.primaryActions,t=this.editorToolbar.secondaryActions,o=hco(e,t,i);return{primaryActions:o.primaryActions.map(n=>n.action),secondaryActions:o.secondaryActions}}},mwi=class{constructor(i,e,t,o){this.notebookEditor=i;this.editorToolbar=e;this.goToMenu=t;this.instantiationService=o}actionProvider(i,e){if(i.id===tT)return this.instantiationService.createInstance(gB,i,this.notebookEditor,e);let t=this.editorToolbar.primaryActions.find(o=>o.action.id===i.id);return!t||t.renderLabel?i instanceof Eo?this.instantiationService.createInstance(kRe,i,{hoverDelegate:e.hoverDelegate}):i instanceof Cc&&i.item.submenu.id===D.NotebookCellExecuteGoTo.id?this.instantiationService.createInstance(N4,i,{hoverDelegate:e.hoverDelegate},!0,{getActions:()=>this.goToMenu.getActions().find(([o])=>o==="navigation/execute")?.[1]??[]},this.actionProvider.bind(this)):void 0:i instanceof Eo?this.instantiationService.createInstance(ml,i,{hoverDelegate:e.hoverDelegate}):i instanceof Cc?i.item.submenu.id===D.NotebookCellExecuteGoTo.id?this.instantiationService.createInstance(N4,i,{hoverDelegate:e.hoverDelegate},!1,{getActions:()=>this.goToMenu.getActions().find(([o])=>o==="navigation/execute")?.[1]??[]},this.actionProvider.bind(this)):this.instantiationService.createInstance(mE,i,{hoverDelegate:e.hoverDelegate}):void 0}calculateActions(i){let e=this.editorToolbar.primaryActions,t=this.editorToolbar.secondaryActions,o=A8o(e,t,i);return{primaryActions:o.primaryActions.map(n=>n.action),secondaryActions:o.secondaryActions}}},VRe=class extends C{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(H.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 yn(Me(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 Pa(this._notebookTopLeftToolbarContainer,{vertical:2,horizontal:3,horizontalScrollbarSize:3,useShadows:!1,scrollYToX:!0}),this._register(this._leftToolbarScrollable),R(this.domNode,this._leftToolbarScrollable.getDomNode()),this._notebookTopRightToolbarContainer=document.createElement("div"),this._notebookTopRightToolbarContainer.classList.add("notebook-toolbar-right"),R(this.domNode,this._notebookTopRightToolbarContainer)}_updatePerEditorChange(){if(this.editorService.activeEditorPane?.getId()===qL&&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(ft.globalToolbarShowLabel)),this._updateStrategy();let e={ui:!0,notebookEditor:this.notebookEditor,source:"notebookToolbar"},t=(l,c)=>{if(l.id===tT)return this.instantiationService.createInstance(gB,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 Eo?this.instantiationService.createInstance(kRe,l,{hoverDelegate:c.hoverDelegate}):void 0:l instanceof Eo?this.instantiationService.createInstance(ml,l,{hoverDelegate:c.hoverDelegate}):void 0}else return l instanceof Eo?this.instantiationService.createInstance(ml,l,{hoverDelegate:c.hoverDelegate}):void 0},o=this._register(this.instantiationService.createInstance(mv,"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 Ju(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(ft.globalToolbarShowLabel)){this._renderLabel=this._convertConfiguration(this.configurationService.getValue(ft.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 uwi(this.notebookEditor,this,this._executeGoToActionsMenu,this.instantiationService);break;case 1:this._strategy=new pwi(this.notebookEditor,this,this._executeGoToActionsMenu,this.instantiationService);break;case 2:this._strategy=new mwi(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=nn(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 li)});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 li?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)+B4,n=this._dimension.width-o-(B4+P8o)-B4-B4,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()}};VRe=I([m(4,F),m(5,B),m(6,ze),m(7,qt),m(8,ee),m(9,_e)],VRe);function hco(a,i,e){return mVt(a,i,e,!1)}function A8o(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)*B4<=e)return a.forEach(s=>{s.renderLabel=!0}),mVt(a,i,e,!1);if(t*dwi+(t-1)*B4>e)return a.forEach(s=>{s.renderLabel=!1}),mVt(a,i,e,!0);let n=0,r=-1;for(let s=0;s<a.length;s++)if(n+=a[s].size+B4,a[s].action instanceof li){let l=a.slice(s+1).filter(u=>u.size!==0);n+(l.length===0?0:l.length*dwi+(l.length-1)*B4)<=e&&(r=s)}else continue;return r<0?(a.forEach(s=>{s.renderLabel=!1}),mVt(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 mVt(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:dwi:u.size;if(!(u.action instanceof li&&o.length>0&&o[o.length-1].action instanceof li)&&!(u.action instanceof li&&!s))if(r+p<=e&&!l)r+=B4+p,o.push(u),p!==0&&(s=!0),u.action instanceof li&&(s=!1);else if(l=!0,p===0)o.push(u);else{if(u.action instanceof li)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 li&&o.splice(c,1);break}}if(o.length&&o[o.length-1].action instanceof li&&o.pop(),n.length!==0&&n.push(new li),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 BRe=class{constructor(i,e,t,o,n){this._editor=i;this._notebookKernelService=e;this._extensionService=o;this._notebookExecutionStateService=n;this._disposables=new P;this._viewModelDisposables=new P;this._cellOutputsListeners=[];this._selectedKernelDisposables=new P;this._notebookKernel=ZLe.bindTo(t),this._notebookKernelCount=CZ.bindTo(t),this._notebookKernelSelected=Uao.bindTo(t),this._interruptibleKernel=hB.bindTo(t),this._hasVariableProvider=tRe.bindTo(t),this._someCellRunning=x4.bindTo(t),this._kernelRunning=mB.bindTo(t),this._useConsolidatedOutputButton=WJe.bindTo(t),this._hasOutputs=yWt.bindTo(t),this._viewType=Bao.bindTo(t),this._missingKernelExtension=IWt.bindTo(t),this._notebookKernelSourceCount=eRe.bindTo(t),this._cellToolbarLocation=Vao.bindTo(t),this._lastCellFailed=YLe.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(),Ue(this._cellOutputsListeners),this._cellOutputsListeners.length=0}_handleDidChangeModel(){if(this._updateKernelContext(),this._updateForNotebookOptions(),this._viewModelDisposables.clear(),Ue(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 P),t=o=>o.model.onDidChangeOutputs(()=>{e.clear(),e.add($r(Me(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));Ue(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=z7i.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))}};BRe=I([m(1,Tl),m(2,X),m(3,lt),m(4,rs)],BRe);var HRe=class extends Jd{constructor(e,t,o){super(o);this.notebookEditor=e;this._lanes=3;this._domNode=or(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(Xd.getInstance(Me(this._domNode.domNode)).onDidChange(()=>{this.layout()}))}layout(){let t=this.notebookEditor.getLayoutInfo(),o=t.scrollHeight,n=t.height,r=Xd.getInstance(Me(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,U)=>((V.length===0||V[V.length-1]!==U)&&V.push(U),V),[]),N=0;switch(y.position){case 1:N=0;break;case 2:N=c;break;case 4:N=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(N,u+G,O,k)}if(y.includeOutput){e.fillStyle=w;let V=g.layoutInfo.editorHeight/n*r*o,U=l.lineHeight/n*r*o;e.fillRect(c,u+V,c,U)}}),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)}}}};HRe=I([m(2,De)],HRe);var URe=class extends C{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 P);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 P,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(Ln,this.topCellToolbar,this.notebookEditor.creationOptions.menuIds.cellTopInsertToolbar,{actionViewItemProvider:(s,l)=>{if(s instanceof Eo)return this.instantiationService.createInstance(VR,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")}};URe=I([m(2,F),m(3,ze),m(4,qt)],URe);var gco=18,hwi=4,fco=Object.freeze({codeCellLeftMargin:28,cellRunGutter:32,markdownCellTopMargin:8,markdownCellBottomMargin:8,markdownCellLeftMargin:0,markdownCellGutter:32,focusIndicatorLeftMargin:4}),vco=Object.freeze({codeCellLeftMargin:8,cellRunGutter:36,markdownCellTopMargin:6,markdownCellBottomMargin:6,markdownCellLeftMargin:8,markdownCellGutter:36,focusIndicatorLeftMargin:4}),nT=class extends C{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=Le("previousModelToCompare",void 0);let l=this.configurationService.getValue(ft.showCellStatusBar),c=o?.globalToolbar??this.configurationService.getValue(ft.globalToolbar)??!0,u=o?.stickyScrollEnabled??this.configurationService.getValue(ft.stickyScrollEnabled)??!1,p=this._computeStickyScrollModeOption(),h=this.configurationService.getValue(ft.consolidatedOutputButton)??!0,g=this.configurationService.getValue(ft.consolidatedRunButton)??!1,f=o?.dragAndDropEnabled??this.configurationService.getValue(ft.dragAndDropEnabled)??!0,v=this.configurationService.getValue(ft.cellToolbarLocation)??{default:"right"},b=o?.cellToolbarInteraction??this.configurationService.getValue(ft.cellToolbarVisibility),S=this.configurationService.getValue(ft.compactView)??!0,y=this._computeFocusIndicatorOption(),w=this._computeInsertToolbarPositionOption(this.isReadonly),k=this._computeInsertToolbarAlignmentOption(),T=this._computeShowFoldingControlsOption(),N=this.configurationService.getValue("editor.fontSize"),O=this.configurationService.getValue(ft.markupFontSize),V=this.configurationService.getValue(ft.markdownLineHeight),U=this.configurationService.getValue(ft.cellEditorOptionsCustomizations)??{};U=yi(U)?U:{};let G=this.configurationService.getValue(ft.interactiveWindowCollapseCodeCells),$,te=this.configurationService.getValue(ft.outputLineHeightDeprecated);te!==void 0?(this._migrateDeprecatedSetting(ft.outputLineHeightDeprecated,ft.outputLineHeight),$=te):$=this.configurationService.getValue(ft.outputLineHeight);let pe,de=this.configurationService.getValue(ft.outputFontSizeDeprecated);de!==void 0?(this._migrateDeprecatedSetting(ft.outputFontSizeDeprecated,ft.outputFontSize),pe=de):pe=this.configurationService.getValue(ft.outputFontSize)||N;let se,Se=this.configurationService.getValue(ft.outputFontFamilyDeprecated);Se!==void 0?(this._migrateDeprecatedSetting(ft.outputFontFamilyDeprecated,ft.outputFontFamily),se=Se):se=this.configurationService.getValue(ft.outputFontFamily);let ke,Ee=this.configurationService.getValue(ft.outputScrollingDeprecated);Ee!==void 0?(this._migrateDeprecatedSetting(ft.outputScrollingDeprecated,ft.outputScrolling),ke=Ee):ke=this.configurationService.getValue(ft.outputScrolling);let He=this._computeOutputLineHeight($,pe),Ve=this.configurationService.getValue(ft.outputWordWrap),Fe=this.configurationService.getValue(ft.textOutputLineLimit)??30,Qt=this.configurationService.getValue(ft.LinkifyOutputFilePaths)??!0,Ze=this.configurationService.getValue(ft.minimalErrorRendering),Ti=this.configurationService.getValue(ft.markupFontFamily),ti=this._computeEditorTopPadding();this._layoutConfiguration={...S?vco:fco,cellTopMargin:6,cellBottomMargin:6,cellRightMargin:16,cellStatusBarHeight:22,cellOutputPadding:8,markdownPreviewPadding:8,editorToolbarHeight:0,editorTopPadding:ti,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:N,outputFontSize:pe,outputFontFamily:se,outputLineHeight:He,markupFontSize:O,markdownLineHeight:V,editorOptionsCustomizations:U,focusIndicatorGap:3,interactiveWindowCollapseCodeCells:G,markdownFoldHintHeight:22,outputScrolling:ke,outputWordWrap:Ve,outputLineLimit:Fe,outputLinkifyFilePaths:Qt,outputMinimalError:Ze,markupFontFamily:Ti,disableRulers:o?.disableRulers},this._register(this.configurationService.onDidChangeConfiguration(bo=>{this._updateConfiguration(bo)}))}updateOptions(e){this.isReadonly!==e&&(this.isReadonly=e,this._updateConfiguration({affectsConfiguration(t){return t===ft.insertToolbarLocation},source:7,affectedKeys:new Set([ft.insertToolbarLocation]),change:{keys:[ft.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(LS(u,Xd.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=Fy.readFontInfo(this.targetWindow,LS(n,Xd.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(ft.showCellStatusBar),o=e.affectsConfiguration(ft.cellToolbarLocation),n=e.affectsConfiguration(ft.cellToolbarVisibility),r=e.affectsConfiguration(ft.compactView),s=e.affectsConfiguration(ft.focusIndicator),l=e.affectsConfiguration(ft.insertToolbarLocation),c=e.affectsConfiguration(ft.experimentalInsertToolbarAlignment),u=e.affectsConfiguration(ft.globalToolbar),p=e.affectsConfiguration(ft.stickyScrollEnabled),h=e.affectsConfiguration(ft.stickyScrollMode),g=e.affectsConfiguration(ft.consolidatedOutputButton),f=e.affectsConfiguration(ft.consolidatedRunButton),v=e.affectsConfiguration(ft.showFoldingControls),b=e.affectsConfiguration(ft.dragAndDropEnabled),S=e.affectsConfiguration("editor.fontSize"),y=e.affectsConfiguration(ft.outputFontSize),w=e.affectsConfiguration(ft.markupFontSize),k=e.affectsConfiguration(ft.markdownLineHeight),T=e.affectsConfiguration("editor.fontFamily"),N=e.affectsConfiguration(ft.outputFontFamily),O=e.affectsConfiguration(ft.cellEditorOptionsCustomizations),V=e.affectsConfiguration(ft.interactiveWindowCollapseCodeCells),U=e.affectsConfiguration(ft.outputLineHeight),G=e.affectsConfiguration(ft.outputScrolling),$=e.affectsConfiguration(ft.outputWordWrap),te=e.affectsConfiguration(ft.LinkifyOutputFilePaths),pe=e.affectsConfiguration(ft.minimalErrorRendering),de=e.affectsConfiguration(ft.markupFontFamily);if(!t&&!o&&!n&&!r&&!s&&!l&&!c&&!u&&!p&&!h&&!g&&!f&&!v&&!b&&!S&&!y&&!w&&!k&&!T&&!N&&!O&&!V&&!U&&!G&&!$&&!te&&!pe&&!de)return;let se=Object.assign({},this._layoutConfiguration);if(t&&(se.showCellStatusBar=this.configurationService.getValue(ft.showCellStatusBar)),o&&(se.cellToolbarLocation=this.configurationService.getValue(ft.cellToolbarLocation)??{default:"right"}),n&&!this.overrides?.cellToolbarInteraction&&(se.cellToolbarInteraction=this.configurationService.getValue(ft.cellToolbarVisibility)),s&&(se.focusIndicator=this._computeFocusIndicatorOption()),r){let Se=this.configurationService.getValue(ft.compactView)??!0;se=Object.assign(se,{...Se?vco:fco}),se.compactView=Se}if(c&&(se.insertToolbarAlignment=this._computeInsertToolbarAlignmentOption()),l&&(se.insertToolbarPosition=this._computeInsertToolbarPositionOption(this.isReadonly)),u&&this.overrides?.globalToolbar===void 0&&(se.globalToolbar=this.configurationService.getValue(ft.globalToolbar)??!0),p&&this.overrides?.stickyScrollEnabled===void 0&&(se.stickyScrollEnabled=this.configurationService.getValue(ft.stickyScrollEnabled)??!1),h&&(se.stickyScrollMode=this.configurationService.getValue(ft.stickyScrollMode)??"flat"),g&&(se.consolidatedOutputButton=this.configurationService.getValue(ft.consolidatedOutputButton)??!0),f&&(se.consolidatedRunButton=this.configurationService.getValue(ft.consolidatedRunButton)??!0),v&&(se.showFoldingControls=this._computeShowFoldingControlsOption()),b&&(se.dragAndDropEnabled=this.configurationService.getValue(ft.dragAndDropEnabled)??!0),S&&(se.fontSize=this.configurationService.getValue("editor.fontSize")),(y||S)&&(se.outputFontSize=this.configurationService.getValue(ft.outputFontSize)||se.fontSize),w&&(se.markupFontSize=this.configurationService.getValue(ft.markupFontSize)),k&&(se.markdownLineHeight=this.configurationService.getValue(ft.markdownLineHeight)),N&&(se.outputFontFamily=this.configurationService.getValue(ft.outputFontFamily)),O&&(se.editorOptionsCustomizations=this.configurationService.getValue(ft.cellEditorOptionsCustomizations)),V&&(se.interactiveWindowCollapseCodeCells=this.configurationService.getValue(ft.interactiveWindowCollapseCodeCells)),U||S||y){let Se=this.configurationService.getValue(ft.outputLineHeight);se.outputLineHeight=this._computeOutputLineHeight(Se,se.outputFontSize)}$&&(se.outputWordWrap=this.configurationService.getValue(ft.outputWordWrap)),G&&(se.outputScrolling=this.configurationService.getValue(ft.outputScrolling)),te&&(se.outputLinkifyFilePaths=this.configurationService.getValue(ft.LinkifyOutputFilePaths)),pe&&(se.outputMinimalError=this.configurationService.getValue(ft.minimalErrorRendering)),de&&(se.markupFontFamily=this.configurationService.getValue(ft.markupFontFamily)),this._layoutConfiguration=Object.freeze(se),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:N,editorOptionsCustomizations:O,interactiveWindowCollapseCodeCells:V,outputLineHeight:U,outputScrolling:G,outputWordWrap:$,outputLinkifyFilePaths:te,minimalError:pe,markupFontFamily:de})}_computeInsertToolbarPositionOption(e){return e?"hidden":this.configurationService.getValue(ft.insertToolbarLocation)??"both"}_computeInsertToolbarAlignmentOption(){return this.configurationService.getValue(ft.experimentalInsertToolbarAlignment)??"center"}_computeShowFoldingControlsOption(){return this.configurationService.getValue(ft.showFoldingControls)??"mouseover"}_computeFocusIndicatorOption(){return this.configurationService.getValue(ft.focusIndicator)??"gutter"}_computeStickyScrollModeOption(){return this.configurationService.getValue(ft.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 gco;let t=this.computeCellToolbarLocation(e);return t==="left"||t==="right"?gco: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}}};nT=I([m(3,B),m(4,rs),m(5,Kt)],nT);var hVt=class a extends C{constructor(e,t,o,n){super();this.notebookEditor=e;this.notebookOptions=t;this.configurationService=o;this.language=n;this._localDisposableStore=this._register(new P);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=Xi(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 Xpe=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?sh.toIcon(this.symbolKind):this.isExecuting&&this.isPaused?Sw:this.isExecuting?q.modify(Sw,"spin"):this.cell.cellKind===1?M.markdown:M.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 N8o(a){let i=Array.from(awi(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 gVt=ae("INotebookOutlineEntryFactory"),zRe=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=O8o(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(N8o(s));this.cachedMarkdownOutlineEntries.set(i,{alternativeId:i.getAlternativeId(),headers:c});for(let{depth:u,text:p}of c)r=!0,t.push(new Xpe(e++,u,i,p,!1,!1));r||(n=qa({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 Xpe(e++,7,i,l,!!s,s?s.isPaused:!1)),c.forEach(u=>{t.push(new Xpe(e++,u.level,i,u.name,!1,!1,u.range,u.kind))}))}t.length===0&&(l.length===0&&(l=d(12129,null)),t.push(new Xpe(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=bco(n.getTopLevelSymbols(),8);this.cellOutlineEntryCache[i.id]=r}finally{t.dispose()}}};zRe=I([m(0,rs),m(1,f_),m(2,Nt)],zRe);function bco(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(...bco(t.children,i+1))}),e}function O8o(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 KRe=class{constructor(i,e,t,o){this._editor=i;this._markerService=e;this._configurationService=t;this._outlineEntryFactory=o;this._disposables=new P;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=>Xe(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()}};KRe=I([m(1,Ns),m(2,B),m(3,gVt)],KRe);var yZe=class extends Ww{constructor(e){super();this.instantiationService=e}createReferencedObject(e,t){return this.instantiationService.createInstance(KRe,t)}destroyReferencedObject(e,t){t.dispose()}};yZe=I([m(0,F)],yZe);var $Re=ae("INotebookCellOutlineDataSourceFactory"),GRe=class{constructor(i){this._data=i.createInstance(yZe)}getOrCreate(i){return this._data.acquire(i.getId(),i)}};GRe=I([m(0,F)],GRe);var vVt=class a extends C{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||Gn.Tap,()=>{this.focusCell()})),this._register(j(this.foldingIcon.domNode,re.CLICK||Gn.Tap,()=>{if(this.entry.cell.cellKind===1){let s=this.entry.cell.foldingState;this.toggleFoldRange(s)}}))}toggleFoldRange(e){let t=this.notebookEditor.getContribution(BR.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}},gwi=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?ule:dle)}setVisible(i){this.domNode.style.cursor=i?"pointer":"default",this.domNode.style.opacity=i?"1":"0"}},hy=class extends C{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 P;this.currentStickyLines=new Map;this._onDidChangeNotebookStickyScroll=this._register(new E);this.onDidChangeNotebookStickyScroll=this._onDidChangeNotebookStickyScroll.event;this._layoutDisposableStore=this._register(new P);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 yn(Me(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(wZe(this.notebookEditor,this.notebookCellList,this.notebookCellOutlineReference?.object?.entries,this.getCurrentStickyHeight()))}async init(){let{object:e}=this.notebookCellOutlineReference=this.instantiationService.invokeFunction(o=>o.get($Re).getOrCreate(this.notebookEditor));this._register(this.notebookCellOutlineReference),await e.computeFullSymbols(ve.None);let t=wZe(this.notebookEditor,this.notebookCellList,e.entries,this.getCurrentStickyHeight());this.updateContent(t),this._disposables.add(e.onDidChange(()=>{let o=wZe(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(ve.None);let o=wZe(this.notebookEditor,this.notebookCellList,e.entries,this.getCurrentStickyHeight());this.updateContent(o)})),this._disposables.add(this.notebookEditor.onDidScroll(()=>{let o=new jo(100);o.trigger(()=>{o.dispose();let n=wZe(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($r(Me(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=hy.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=vVt.getParentCount(e)*10+"px");let r=!1;e.cell.cellKind===1&&(r=e.cell.foldingState===2);let s=new gwi(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 vVt(o,s,l,e,t)}disposeCurrentStickyLines(){this.currentStickyLines.forEach(e=>{e.line.dispose()})}dispose(){this._disposables.dispose(),this.disposeCurrentStickyLines(),this.notebookCellOutlineReference?.dispose(),super.dispose()}};hy=I([m(4,ze),m(5,F)],hy);function wZe(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=hy.getVisibleOutlineEntry(0,e);if(h&&g&&h.cellKind===1&&g.level<7&&a.scrollTop>22)return hy.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=hy.getVisibleOutlineEntry(h,e),!s)continue;let g=a.cellAt(h+1);if(!g){let v=a.getLayoutInfo().scrollHeight,b=Math.floor(v/22);return hy.checkCollapsedStickyLines(s,b,a)}let f=hy.getVisibleOutlineEntry(h+1,e);if(f&&g.cellKind===1&&f.level<7){let v=i.getCellViewScrollTop(g),b=hy.computeStickyHeight(s),S=hy.computeStickyHeight(f);if(o+b<v){let y=Math.floor((v-o)/22);return hy.checkCollapsedStickyLines(s,y,a)}else{if(S>=b)return hy.checkCollapsedStickyLines(f,100,a);if(S<b){let y=v-o;if(y>=S){let w=Math.floor(y/22);return hy.checkCollapsedStickyLines(s,w,a)}else return hy.checkCollapsedStickyLines(f,100,a)}}}}let c=a.getLayoutInfo().scrollHeight,u=Math.floor((c-o)/22);return hy.checkCollapsedStickyLines(s,u,a)}var bVt=class{constructor(){this.priority=105;this.name="webview-find";this.type="help";this.when=bz}getProvider(i){return new fwi}},fwi=class extends C{constructor(){super(...arguments);this.id="webviewFindHelp";this.verbositySettingKey="accessibility.verbosity.find";this.options={type:"help"}}onClose(){}provideContent(){let e=[];return e.push(d(15858,null)),e.push(d(15853,null)),e.push(""),e.push(d(15880,null)),e.push(d(15879,null)),e.push(""),e.push(d(15867,null)),e.push(d(15866,null)),e.push(""),e.push(d(15863,null)),e.push(d(15862,null)),e.push(d(15859,null)),e.push(d(15860,null)),e.push(d(15861,null)),e.push(""),e.push(d(15857,null)),e.push(d(15854,null)),e.push(d(15855,null)),e.push(d(15856,null)),e.push(""),e.push(d(15868,null)),e.push(""),e.push(d(15870,null)),e.push(d(15869,null)),e.push(d(15871,null)),e.push(""),e.push(d(15874,null)),e.push(d(15872,null)),e.push(d(15875,null)),e.push(d(15873,null)),e.push(""),e.push(d(15865,null)),e.push(d(15864,null)),e.push(""),e.push(d(15877,null,"<keybinding:workbench.action.openSettings>")),e.push(d(15876,null)),e.push(d(15878,null)),e.push(""),e.push(d(15852,null)),e.push(d(15851,null)),e.join(`
`)}};var F8o=100;function qRe(a,i){a?.addImplementation(F8o,"webview",e=>{let o=e.get(wm).activeWebview;if(o?.isFocused)return i(o),!0;if(Pn()?.classList.contains("action-menu-item")){let n=e.get(ee);if(n.activeEditor instanceof wu)return i(n.activeEditor.webview),!0}return!1})}qRe(BT,a=>a.undo());qRe(HT,a=>a.redo());qRe(ymt,a=>a.selectAll());qRe($M,a=>a.copy());qRe(GM,a=>a.paste());qRe(EW,a=>a.cut());var CZe="preventDefaultContextMenuItems";EW&&fe.appendMenuItem(D.WebviewContext,{command:{id:EW.id,title:d(15848,null)},group:"5_cutcopypaste",order:1,when:x.not(CZe)});$M&&fe.appendMenuItem(D.WebviewContext,{command:{id:$M.id,title:d(15847,null)},group:"5_cutcopypaste",order:2,when:x.not(CZe)});GM&&fe.appendMenuItem(D.WebviewContext,{command:{id:GM.id,title:d(15849,null)},group:"5_cutcopypaste",order:3,when:x.not(CZe)});xa.register(new bVt);var jRe=class extends C{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(H.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=yRe(c.notebookDocument,p,!0);Jo(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=H.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(11993,null):d(11990,null)}getWidgetAriaLabel(){let e=this.keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getLabel();return this.configurationService.getValue(this.verbositySettingId)?e?d(11991,null,this.widgetAriaLabelName,e):d(11992,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}};jRe=I([m(2,rs),m(3,_e),m(4,B),m(5,Bi)],jRe);var SVt=class extends C{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(!it&&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=Me(o),g={deltaMode:o.deltaMode,deltaX:n,deltaY:0,deltaZ:0,wheelDelta:c&&XH?c/h.devicePixelRatio:c,wheelDeltaX:s&&XH?s/h.devicePixelRatio:s,wheelDeltaY:0,detail:o.detail,shiftKey:o.shiftKey,type:o.type,defaultPrevented:!1,preventDefault:()=>{},stopPropagation:()=>{}};p[1].delegateScrollFromMouseWheelEvent(g)}))}};var QRe=class extends C{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=Sf(this._focusedEditorDOM,_(".cell-editor-container")),o=this._register(this._instantiationService.createChild(new Io([X,this._editorContextKeyService])));ue.inCompositeEditor.bindTo(this._editorContextKeyService).set(!0);let n=new $F(this.notebookEditor.getBaseCellEditorOptions(e.language),this.notebookEditor.notebookOptions,this._configurationService);this._editor=this._register(o.createInstance(jr,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=xn(async t=>{let o=await this.textModelService.createModelReference(e.uri);if(this._isDisposed||t.isCancellationRequested){o.dispose();return}let n=new P;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()}};QRe=I([m(2,Nt),m(3,B),m(4,F)],QRe);var IVt=class extends C{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 Go,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=$r(Me(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 V8o=_;function UZ(){let a=["editor.contrib.review",aZ.ID,QW.ID,"editor.contrib.dirtydiff","editor.contrib.testingOutputPeek","editor.contrib.testingDecorations","store.contrib.stickyScrollController","editor.contrib.findController","editor.contrib.emptyTextEditorHint"],i=aa.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 XK=class extends C{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 P);this._localCellStateListeners=[];this._shadowElementViewInfo=null;this._contributions=new Map;this._insetModifyQueueByOutputId=new NT;this._cellContextKeyManager=null;this._uuid=_t();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 Io([X,this.scopedContextKeyService]))),this._notebookOptions=e.options??this.instantiationService.createInstance(nT,this.creationOptions?.codeWindow??It,this._readOnly,void 0),this._register(this._notebookOptions);let y=this._register(new ARe);this._viewContext=new WRe(this._notebookOptions,y,N=>this.getBaseCellEditorOptions(N)),this._register(this._viewContext.eventDispatcher.onDidChangeLayout(()=>{this._onDidChangeLayout.fire()})),this._register(this._viewContext.eventDispatcher.onDidChangeCellState(N=>{this._onDidChangeCellState.fire(N)})),this._register(c.onDidChangeOutputRenderers(()=>{this._updateOutputRenderers()})),this._register(this.instantiationService.createInstance(BRe,this)),this._register(l.onDidChangeSelectedNotebooks(N=>{Xe(N.notebook,this.viewModel?.uri)&&(this._loadKernelPreloads(),this._onDidChangeActiveKernel.fire())})),this._scrollBeyondLastLine=this.configurationService.getValue("editor.scrollBeyondLastLine"),this._register(this.configurationService.onDidChangeConfiguration(N=>{N.affectsConfiguration("editor.scrollBeyondLastLine")&&(this._scrollBeyondLastLine=this.configurationService.getValue("editor.scrollBeyondLastLine"),this._dimension&&this._isVisible&&this.layout(this._dimension))})),this._register(this._notebookOptions.onDidChangeOptions(N=>{(N.cellStatusBarVisibility||N.cellToolbarLocation||N.cellToolbarInteraction)&&this._updateForNotebookConfiguration(),N.fontFamily&&this._generateFontInfo(),(N.compactView||N.focusIndicator||N.insertToolbarPosition||N.cellToolbarLocation||N.dragAndDropEnabled||N.fontSize||N.markupFontSize||N.markdownLineHeight||N.fontFamily||N.insertToolbarAlignment||N.outputFontSize||N.outputLineHeight||N.outputFontFamily||N.outputWordWrap||N.outputScrolling||N.outputLinkifyFilePaths||N.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(N=>{!this._shadowElement||!this._isVisible||(this.updateShadowElement(this._shadowElement,this._dimension),this.layoutContainerOverShadowElement(this._dimension,this._position))})),this.notebookEditorService.addNotebookEditor(this);let k=_t();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=rr.bindTo(this.scopedContextKeyService),this._outputFocus=PR.bindTo(this.scopedContextKeyService),this._outputInputFocus=yZ.bindTo(this.scopedContextKeyService),this._editorEditable=Kl.bindTo(this.scopedContextKeyService),this._cursorNavMode=VJe.bindTo(this.scopedContextKeyService),new Q(CZe,!1).bindTo(this.scopedContextKeyService).set(!0),this._editorEditable.set(!e.isReadOnly);let T;Array.isArray(this.creationOptions.contributions)?T=this.creationOptions.contributions:T=A4.getEditorContributions();for(let N of T){let O;try{O=this.instantiationService.createInstance(N.ctor,this)}catch(V){mt(V)}if(O)if(!this._contributions.has(N.id))this._contributions.set(N.id,O);else throw O.dispose(),new Error(`DUPLICATE notebook editor contribution: '${N.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&&Xlo(...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 hVt(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=Me(this.getDomNode());this._fontInfo=Fy.readFontInfo(t,LS(e,Xd.getInstance(t).value))}_createBody(e){this._notebookTopToolbarContainer=document.createElement("div"),this._notebookTopToolbarContainer.classList.add("notebook-toolbar-container"),this._notebookTopToolbarContainer.style.display="none",R(e,this._notebookTopToolbarContainer),this._notebookStickyScrollContainer=document.createElement("div"),this._notebookStickyScrollContainer.classList.add("notebook-sticky-scroll-container"),R(e,this._notebookStickyScrollContainer),this._body=document.createElement("div"),R(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(SVt,this,this._list.scrollableElement)),this._overflowContainer=document.createElement("div"),this._overflowContainer.classList.add("notebook-overflow-widget-container","monaco-editor"),R(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=hr(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:N}=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: ${N}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: ${N}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: ${hwi}px 8px;
		}
		.monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .output-collapse-container {
			padding: ${hwi}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 XWt(this,this._body));let e=n=>this._list.contextKeyService.createScoped(n);this._editorPool=this._register(this.instantiationService.createInstance(QRe,this,e));let t=[this.instantiationService.createInstance(W4,this,this._renderedEditors,this._editorPool,this._dndController,e),this.instantiationService.createInstance(F4,this,this._dndController,this._renderedEditors,e)];t.forEach(n=>{this._register(n)}),this._listDelegate=this.instantiationService.createInstance(PRe,Me(this.getDomNode())),this._register(this._listDelegate);let o=this.instantiationService.createInstance(jRe,()=>this.viewModel,this.isReplHistory);this._register(o),this._list=this.instantiationService.createInstance(bRe,"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:HZ,listActiveSelectionBackground:HZ,listActiveSelectionForeground:ko,listFocusAndSelectionBackground:HZ,listFocusAndSelectionForeground:ko,listFocusBackground:HZ,listFocusForeground:ko,listHoverForeground:ko,listHoverBackground:HZ,listHoverOutline:Ad,listFocusOutline:Ad,listInactiveSelectionBackground:HZ,listInactiveSelectionForeground:ko,listInactiveFocusBackground:HZ,listInactiveFocusOutline:HZ},accessibilityProvider:o}),this._cellLayoutManager=new IVt(this,this._list,this.logService),this._dndController.setList(this._list),this._register(this._list),this._listViewInfoAccessor=new oVt(this._list),this._register(this._listViewInfoAccessor),this._register(hn(...t)),this._listTopCellToolbar=this._register(this.instantiationService.createInstance(URe,this,this.notebookOptions)),this._webviewTransparentCover=R(this._list.rowsContainer,V8o(".webview-cover")),this._webviewTransparentCover.style.display="none",this._register(Gbe(this._overlayContainer,n=>{n.target.classList.contains("slider")&&this._webviewTransparentCover&&(this._webviewTransparentCover.style.display="block")})),this._register(Qpt(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(Vn(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(HRe,this,this._notebookOverviewRulerContainer))}_registerNotebookActionsToolbar(){this._notebookTopToolbar=this._register(this.instantiationService.createInstance(VRe,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(hy,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===az&&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:ms(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,jv(Me(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?Vw(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(zpe,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(),Ue(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??It),!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(uA,{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(BZ,t,e,this._viewContext,this.getLayoutInfo(),{isReadOnly:this._readOnly}),this._viewContext.eventDispatcher.emit([new rZe({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=$r(Me(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)));Ue(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 P;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===Y.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(Me(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;fN(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 rZe({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&&(El.get(e)?.cancelSuggestWidget(),lh.get(e)?.clearWidgets(),ou.get(e)?.clearWidgets())}),this._renderedEditors.forEach((e,t)=>{Rc.get(e)?.model.get()?.inlineEditState.get()&&e.render(!0)})}editorHasDomFocus(){return ts(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=Me(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,vRe)){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(H.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=Lf(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 V4(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 V4(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+Kpe*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 Qm)||(this.viewModel?.viewCells.find(v=>v.handle===l.cellInfo.cellHandle),this._list.getViewIndex(u)===void 0))return;u.outputsViewModels.indexOf(c)<0&&r.push(c);let h=this._list.getCellViewScrollTop(u),g=u.outputsViewModels.indexOf(c),f=u.getOutputOffset(g);n.push({cell:u,output:c,cellTop:h+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 Qm){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&&$r(Me(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 kb){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 kb&&(this.revealInView(o),o.updateEditState(t,"setMarkdownCellEditState"))}_didStartDragMarkupCell(e,t){let o=this._getCellById(e);if(o instanceof kb){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 kb){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 kb){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 kb&&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),Ue(this._contributions.values()),this._contributions.clear(),this._localStore.clear(),Ue(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}}};XK=I([m(2,F),m(3,Et),m(4,fTe),m(5,Zc),m(6,Tl),m(7,un),m(8,B),m(9,X),m(10,nc),m(11,ze),m(12,Te),m(13,AY),m(14,rd),m(15,_v)],XK);Sk(0,5,"notebook-progress-bar");Sk(0,10,"notebook-list-insertion-indicator");Sk(0,20,"notebook-cell-editor-outline");Sk(0,25,"notebook-scrollbar");Sk(0,26,"notebook-cell-status");Sk(0,26,"notebook-folding-indicator");Sk(0,27,"notebook-output");Sk(0,28,"notebook-cell-bottom-toolbar-container");Sk(0,29,"notebook-run-button-container");Sk(0,29,"notebook-input-collapse-condicon");Sk(0,30,"notebook-cell-output-toolbar");Sk(35,1,"notebook-cell-expand-part-button");Sk(35,2,"notebook-cell-toolbar");Sk(35,3,"notebook-cell-toolbar-dropdown-active");var vwi=J("notebook.cellBorderColor",{dark:ei(xf,1),light:ei(xf,1),hcDark:cb,hcLight:cb},d(12003,null)),_eu=J("notebook.focusedEditorBorder",Ad,d(12011,null)),Ico=J("notebookStatusSuccessIcon.foreground",gRe,d(12024,null)),yco=J("notebookEditorOverviewRuler.runningCellForeground",gRe,d(12018,null)),wco=J("notebookStatusErrorIcon.foreground",Rse,d(12022,null)),Deu=J("notebookStatusRunningIcon.foreground",ko,d(12023,null)),Leu=J("notebook.outputContainerBorderColor",null,d(12015,null)),Reu=J("notebook.outputContainerBackgroundColor",null,d(12014,null)),Meu=J("notebook.cellToolbarSeparator",{dark:Oe.fromHex("#808080").transparent(.35),light:Oe.fromHex("#808080").transparent(.35),hcDark:gi,hcLight:gi},d(12008,null)),Sco=J("notebook.focusedCellBackground",null,d(12002,null)),Peu=J("notebook.selectedCellBackground",{dark:xf,light:xf,hcDark:null,hcLight:null},d(12025,null)),Aeu=J("notebook.cellHoverBackground",{dark:ei(Sco,.5),light:ei(Sco,.7),hcDark:null,hcLight:null},d(12005,null)),Neu=J("notebook.selectedCellBorder",{dark:vwi,light:vwi,hcDark:gi,hcLight:gi},d(12016,null)),Oeu=J("notebook.inactiveSelectedCellBorder",{dark:null,light:null,hcDark:Ad,hcLight:Ad},d(12013,null)),Feu=J("notebook.focusedCellBorder",Ad,d(12010,null)),Weu=J("notebook.inactiveFocusedCellBorder",vwi,d(12012,null)),Veu=J("notebook.cellStatusBarItemHoverBackground",{light:new Oe(new Bt(0,0,0,.08)),dark:new Oe(new Bt(255,255,255,.15)),hcDark:new Oe(new Bt(255,255,255,.15)),hcLight:new Oe(new Bt(0,0,0,.08))},d(12007,null)),Beu=J("notebook.cellInsertionIndicator",Ad,d(12006,null)),Heu=J("notebookScrollbarSlider.background",o9,d(12020,null)),Ueu=J("notebookScrollbarSlider.hoverBackground",AU,d(12021,null)),zeu=J("notebookScrollbarSlider.activeBackground",NU,d(12019,null)),Keu=J("notebook.symbolHighlightBackground",{dark:Oe.fromHex("#ffffff0b"),light:Oe.fromHex("#fdff0033"),hcDark:null,hcLight:null},d(12017,null)),Geu=J("notebook.cellEditorBackground",{light:op,dark:op,hcDark:null,hcLight:null},d(12004,null)),HZ=J("notebook.editorBackground",{light:g8e,dark:g8e,hcDark:null,hcLight:null},d(12009,null));var B8o={top:24,bottom:24},Cco={top:12,bottom:12};function pA(a){return a===1?B8o:Cco}var YRe={padding:Cco,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},XRe={...YRe,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 Jpe=class extends C{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=_t(),this._outputViewModels=this.textModel.outputs.map(o=>new VZ(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 VZ(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 KT(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()})}};Jpe=I([m(1,un)],Jpe);var yVt=class{constructor(i,e){this.source=i;this.value=e;this.type=1}};var JRe=class extends C{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 pD=16,Zpe=new Q("notebook.diffEditor.cell.inputChanged",!1),xZe=new Q("notebook.diffEditor.metadataChanged",!1),bwi="notebook.diffEditor.cell.ignoreWhitespace",xco=new Q(bwi,!1),eme=new Q("notebook.diffEditor.cell.property.changed",!1),wVt=new Q("notebook.diffEditor.cell.property.expanded",!1),kco=new Q("notebook.diffEditor.allCollapsed",void 0,d(11903,null)),tme=new Q("notebook.diffEditor.hasUnchangedCells",void 0,d(11904,null)),kZe=new Q("notebook.diffEditor.unchangedCellsAreHidden",void 0,d(11907,null)),H4=new Q("notebook.diffEditor.item.kind",void 0,d(11905,null)),U4=new Q("notebook.diffEditor.item.state",void 0,d(11906,null));function CVt(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 rF(e,{})}var EZe=class extends C{constructor(e){super();this.notebookModel=e;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._textBufferHash=null;this.uri=B3e.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=CVt(this.notebookModel.transientOptions.transientDocumentMetadata,this.metadata);return this._textBuffer=this._register(n1(e,1).textBuffer),this._register(this._textBuffer.onDidChangeContent(()=>{this._onDidChange.fire()})),this._textBuffer}getHash(){if(this._textBufferHash!==null)return this._textBufferHash;let e=new Ly,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 xVt=25,Eco=24,Tco=17;var DZe=1440,TZe=class extends C{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})))}},kVt=class extends TZe{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*pD}getHeight(e){return this.totalHeight}layoutChange(){}showHiddenCells(){this._unfoldHiddenCells.fire()}},ZRe=class extends TZe{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=xVt;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 EZe(e)),this.modifiedMetadata=this._register(new EZe(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*pD+(t?Hu.ENTIRE_DIFF_OVERVIEW_WIDTH:0)-2:(e.width-2*pD+(t?Hu.ENTIRE_DIFF_OVERVIEW_WIDTH:0))/2-18-2}getSourceEditorViewState(){return this._sourceEditorViewState}saveSpirceEditorViewState(e){this._sourceEditorViewState=e}},EVt=class extends TZe{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 Jpe(t,l)):void 0,this.modified=o?this._register(new Jpe(o,l)):void 0;let h=this._estimateEditorHeight(s.fontInfo),g=xVt;this._layoutInfo={width:0,editorHeight:h,editorMargin:0,metadataHeight:0,cellStatusHeight:g,metadataStatusHeight:this.ignoreMetadata?0:xVt,rawOutputHeight:0,outputTotalHeight:0,outputStatusHeight:this.ignoreOutputs?0:xVt,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(DZe,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+pA(o).top+pA(o).bottom}case"delete":case"modified":{let o=this.original.textModel.textBuffer.getLineCount();return o*t+pA(o).top+pA(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*pD+(t?Hu.ENTIRE_DIFF_OVERVIEW_WIDTH:0)-2:(e.width-2*pD+(t?Hu.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}},GC=class extends EVt{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=H8o(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:Ir(QK(this.mainDocumentTextModel.transientOptions.transientCellMetadata,this.original?.metadata||{},this.original?.language))!==Ir(QK(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,Y.vscodeNotebookCellMetadata),t=Zo.generateCellPropertyUri(this.modifiedDocument.uri,this.modified.handle,Y.vscodeNotebookCellMetadata);this._layoutInfo.metadataHeight=await this.diffEditorHeightCalculator.diffAndComputeHeight(e,t)}}async computeEditorHeights(){this.type!=="unchanged"&&await Promise.all([this.computeModifiedInputEditorHeight(),this.computeModifiedMetadataEditorHeight()])}},_Ze=class extends EVt{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 _co(a,i){if(Ir(a.metadata)===Ir(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 H8o(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(Ir(o.metadata)!==Ir(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 Iwi(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 zZ(a){if(a.length===1){let i=Iwi(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 ywi=class extends C{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 P)}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(_Wt)),u.tabIndex=0,u.title=d(11878,null,r.map(p=>p.mimeType).join(", ")),o.appendChild(u),this.resizeListener.add(Vo(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 Ii(p);(h.equals(3)||h.equals(10))&&(p.preventDefault(),p.stopPropagation(),await this.pickActiveMimeTypeRenderer(this._notebookTextModel,this.output))}))}let c=_(".output-inner-container");if(R(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 GC?this._diffSide:this._diffElementViewModel.type==="insert"?1:0))}_renderMissingRenderer(e,t){if(!e.model.outputs.length)return this._renderMessage(e,d(11877,null));if(!t){let n=e.model.outputs.map(r=>r.mime).join(", ");return this._renderMessage(e,d(11879,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(11876,null):void 0})),s=new P,l=s.add(this._quickInputService.createQuickPick());l.items=r,l.activeItems=r.filter(u=>!!u.picked),l.placeholder=r.length!==o.length?d(11881,null):d(11880,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(11875,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)}},z4=class extends C{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 ywi(this._editor,this._notebookTextModel,this._notebookService,this._quickInputService,this._diffElementViewModel,this._diffSide,this._nestedCellViewModel,this._outputContainer,e)),this._outputEntries.get(e).render(t,o)}};z4=I([m(6,un),m(7,Ge)],z4);function TVt(a){return U8o(a)}function U8o(a){let i=new P,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 K4(){return{isSimpleWidget:!1,contributions:aa.getSomeEditorContributions([ry.ID,ly,Hm.ID,El.ID,Qr.ID,ay.ID])}}var _Vt=class extends C{constructor(i,e){super(),e.body.classList.remove("left","right","full");let t=i.hiddenCells.length===1?d(11871,null,i.hiddenCells.length):d(11872,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()}},vB=class extends C{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=R(this.propertyHeaderContainer,_(".property-folding-indicator")),this._foldingIndicator.classList.add(this.accessor.prefix);let e=R(this.propertyHeaderContainer,_("div.property-status"));this._statusSpan=R(e,_("span")),this._description=R(e,_("span.property-description"));let t=R(this.propertyHeaderContainer,_("div.property-toolbar"));this._toolbar=this._register(new Ol(t,{actionViewItemProvider:(n,r)=>{if(n instanceof Eo)return new VR(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=eme.bindTo(o),this._propertyExpanded=wVt.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=Vm(this._menu.getActions({shouldForwardArgs:!0}));this._toolbar.setActions(t)}else this._toolbar.setActions([])}_updateFoldingIcon(){this.accessor.getFoldingState()===1?(Fi(this._foldingIndicator,Qo(EWt)),this._propertyExpanded?.set(!1)):(Fi(this._foldingIndicator,Qo(TWt)),this._propertyExpanded?.set(!0))}};vB=I([m(4,ze),m(5,_e),m(6,ge),m(7,Ne),m(8,qt),m(9,X),m(10,De),m(11,Te),m(12,Bi)],vB);var eMe=class extends C{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 ZRe&&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:pA(l)},u=this._register(TVt(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*pD,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(vB,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=xZe.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=Vm(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){$r(Me(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()}};eMe=I([m(3,F),m(4,Nt),m(5,qt),m(6,X),m(7,Nn),m(8,B)],eMe);var DVt=class extends C{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 P);this._outputLocalDisposable=this._register(new P);this._ignoreMetadata=!1;this._ignoreOutputs=!1;this._isDisposed=!1,this._metadataEditorDisposeStore=this._register(new P),this._outputEditorDisposeStore=this._register(new P),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=R(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=R(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 GC){this._metadataEditor=this.instantiationService.createInstance(Hu,this._metadataEditorContainer,{...XRe,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:K4(),modifiedEditor:K4()});let e=this._register(TVt(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,Y.vscodeNotebookCellMetadata)),this.textModelService.createModelReference(Zo.generateCellPropertyUri(this.cell.modifiedDocument.uri,this.cell.modified.handle,Y.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=QK(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(jr,this._metadataEditorContainer,{...YRe,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=QK(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,Y.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=zZ(this.cell.original?.outputs||[]),r=zZ(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(Hu,this._outputEditorContainer,{...XRe,overflowWidgetsDomNode:this.notebookEditor.getOverflowContainerDomNode(),readOnly:!0,ignoreTrimWhitespace:!1,automaticLayout:!1,dimension:{height:Math.min(DZe,this.cell.layoutInfo.rawOutputHeight||u*p),width:this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!0)},accessibilityVerbose:this.configurationService.getValue("accessibility.verbosity.diffEditor")??!1},{originalEditor:K4(),modifiedEditor:K4()}),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=zZ(this.cell.modified?.outputs||[]);c.setValue(h),this._outputHeader.refresh()}));return}}this._outputEditor=this.instantiationService.createInstance(jr,this._outputEditorContainer,{...YRe,dimension:{width:Math.min(DZe,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=zZ(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()}},LVt=class extends DVt{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*pD)/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(vB,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(vB,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(vB,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}},tMe=class extends LVt{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){$r(Me(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=R(this._outputInfoContainer,_(".output-view-container")),this._outputEmptyElement=R(this._outputViewContainer,_(".output-empty-view"));let i=R(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(z4,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()}};tMe=I([m(3,kt),m(4,Ct),m(5,Nt),m(6,F),m(7,ze),m(8,_e),m(9,Ne),m(10,qt),m(11,X),m(12,B),m(13,Nn)],tMe);var iMe=class extends LVt{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=R(this._outputInfoContainer,_(".output-view-container")),this._outputEmptyElement=R(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(z4,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){$r(Me(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()}};iMe=I([m(3,F),m(4,kt),m(5,Ct),m(6,Nt),m(7,ze),m(8,_e),m(9,Ne),m(10,qt),m(11,X),m(12,B),m(13,Nn)],iMe);var ime=class extends DVt{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(vB,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(vB,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=R(this._outputInfoContainer,_(".output-view-container")),this._outputEmptyElement=R(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=R(this._outputViewContainer,_(".output-view-container-left")),this._outputRightContainer=R(this._outputViewContainer,_(".output-view-container-right")),this._outputMetadataContainer=R(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&&_co(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(z4,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(z4,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(Hu,this._outputMetadataContainer,{...XRe,overflowWidgetsDomNode:this.notebookEditor.getOverflowContainerDomNode(),readOnly:!0,ignoreTrimWhitespace:!1,automaticLayout:!1,dimension:{height:DZe,width:this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!0)}},{originalEditor:K4(),modifiedEditor:K4()}),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:pA(l)},h=this._register(TVt(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*pD,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(vB,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=Zpe.bindTo(t);o.set(this.cell.modified.textModel.getTextBufferHash()!==this.cell.original.textModel.getTextBufferHash());let n=xco.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=Vm(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){$r(Me(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()}};ime=I([m(3,F),m(4,kt),m(5,Ct),m(6,Nt),m(7,ze),m(8,_e),m(9,Ne),m(10,qt),m(11,X),m(12,B),m(13,Nn)],ime);var RVt=class extends C{constructor(e){super();this.container=e;this._nodes=bt("div.diff-hidden-cells",[bt("div.center@content",{style:{display:"flex"}},[_("a",{title:d(11874,null),role:"button",onclick:()=>{this._action.fire()}},...Bn("$(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),Fi(this._nodes.root),super.dispose()}},LZe=class extends C{constructor(e){super();this.container=e;this._nodes=bt("div.diff-hidden-cells",[bt("div.center@content",{style:{display:"flex"}},[_("a",{title:d(11873,null),role:"button",onclick:()=>{this._action.fire()}},...Bn("$(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),Fi(this._nodes.root),super.dispose()}};var oMe=class{constructor(i,e){this.configurationService=e;let t=this.configurationService.getValue("editor");this.lineHeight=LS(t,Xd.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 q4.TEMPLATE_ID;case"modified":case"unchanged":return j4.TEMPLATE_ID;case"placeholder":return G4.TEMPLATE_ID;case"modifiedMetadata":case"unchangedMetadata":return $4.TEMPLATE_ID}}};oMe=I([m(1,B)],oMe);var G4=class{constructor(i,e){this.notebookEditor=i;this.instantiationService=e}static{this.TEMPLATE_ID="cell_diff_placeholder"}get templateId(){return G4.TEMPLATE_ID}renderTemplate(i){let e=_(".cell-placeholder-body");R(i,e);let t=new P,o=new RVt(e),n=R(e,_(".contents")),r=R(n,_("span.text",{title:d(11908,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(_Vt,i,t))}disposeTemplate(i){i.container.innerText=""}disposeElement(i,e,t){t.elementDisposables.clear()}};G4=I([m(1,F)],G4);var $4=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 $4.TEMPLATE_ID}renderTemplate(i){let e=_(".cell-body");R(i,e);let t=_(".cell-diff-editor-container");R(e,t);let o=R(t,_(".input-header-container")),n=R(t,_(".source-container")),{editor:r,editorContainer:s}=this._buildSourceEditor(n),l=R(n,_(".editor-input-toolbar-container")),c=R(l,_("div.property-toolbar")),u=this.instantiationService.createInstance(Ol,c,{actionViewItemProvider:(y,w)=>{if(y instanceof Eo)return new VR(y,{hoverDelegate:w.hoverDelegate},this.keybindingService,this.notificationService,this.contextKeyService,this.themeService,this.contextMenuService,this.accessibilityService)},highlightToggledItems:!0}),p=R(e,_(".border-container")),h=R(p,_(".left-border")),g=R(p,_(".right-border")),f=R(p,_(".top-border")),v=R(p,_(".bottom-border")),b=new LZe(e),S=new P;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 Dco(this.instantiationService,this.notebookEditor,i,{readOnly:!0})}renderElement(i,e,t){t.body.classList.remove("full"),t.elementDisposables.add(this.instantiationService.createInstance(eMe,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()}};$4=I([m(1,F),m(2,ze),m(3,_e),m(4,qt),m(5,X),m(6,Ne),m(7,De),m(8,Bi)],$4);var q4=class{constructor(i,e){this.notebookEditor=i;this.instantiationService=e}static{this.TEMPLATE_ID="cell_diff_single"}get templateId(){return q4.TEMPLATE_ID}renderTemplate(i){let e=_(".cell-body");R(i,e);let t=_(".cell-diff-editor-container");R(e,t);let o=R(e,_(".diagonal-fill")),n=R(t,_(".input-header-container")),r=R(t,_(".source-container")),{editor:s,editorContainer:l}=this._buildSourceEditor(r),c=R(t,_(".metadata-header-container")),u=R(t,_(".metadata-info-container")),p=R(t,_(".output-header-container")),h=R(t,_(".output-info-container")),g=R(e,_(".border-container")),f=R(g,_(".left-border")),v=R(g,_(".right-border")),b=R(g,_(".top-border")),S=R(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 P}}_buildSourceEditor(i){return z8o(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(tMe,this.notebookEditor,i,t));return;case"insert":t.elementDisposables.add(this.instantiationService.createInstance(iMe,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()}};q4=I([m(1,F)],q4);var j4=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 j4.TEMPLATE_ID}renderTemplate(i){let e=_(".cell-body");R(i,e);let t=_(".cell-diff-editor-container");R(e,t);let o=R(t,_(".input-header-container")),n=R(t,_(".source-container")),{editor:r,editorContainer:s}=this._buildSourceEditor(n),l=R(n,_(".editor-input-toolbar-container")),c=R(l,_("div.property-toolbar")),u=this.instantiationService.createInstance(Ol,c,{actionViewItemProvider:(N,O)=>{if(N instanceof Eo)return new VR(N,{hoverDelegate:O.hoverDelegate},this.keybindingService,this.notificationService,this.contextKeyService,this.themeService,this.contextMenuService,this.accessibilityService)},highlightToggledItems:!0}),p=R(t,_(".metadata-header-container")),h=R(t,_(".metadata-info-container")),g=R(t,_(".output-header-container")),f=R(t,_(".output-info-container")),v=R(e,_(".border-container")),b=R(v,_(".left-border")),S=R(v,_(".right-border")),y=R(v,_(".top-border")),w=R(v,_(".bottom-border")),k=new LZe(e),T=new P;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 Dco(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(ime,this.notebookEditor,i,t));return;case"modified":t.elementDisposables.add(this.instantiationService.createInstance(ime,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()}};j4=I([m(1,F),m(2,ze),m(3,_e),m(4,qt),m(5,X),m(6,Ne),m(7,De),m(8,Bi)],j4);var wwi=class extends gae{onViewPointer(i){if(G9(i.browserEvent.target)){let e=typeof i.index>"u"?[]:[i.index];this.list.setFocus(e,i.browserEvent)}else super.onViewPointer(i)}},nMe=class extends Rl{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 wwi(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=hr(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)}};nMe=I([m(6,fo),m(7,B),m(8,F)],nMe);function Dco(a,i,e,t={}){let o=R(e,_(".editor-container"));return{editor:a.createInstance(Hu,o,{...XRe,overflowWidgetsDomNode:i.getOverflowContainerDomNode(),originalEditable:!1,ignoreTrimWhitespace:!1,automaticLayout:!1,dimension:{height:0,width:0},renderSideBySide:!0,useInlineViewWhenSpaceIsLimited:!1,...t},{originalEditor:K4(),modifiedEditor:K4()}),editorContainer:o}}function z8o(a,i,e,t={}){let o=R(e,_(".editor-container")),n=["editor.contrib.emptyTextEditorHint"];return{editor:a.createInstance(jr,o,{...YRe,glyphMargin:!1,dimension:{width:(i.getLayoutInfo().width-2*pD)/2-18,height:0},automaticLayout:!1,overflowWidgetsDomNode:i.getOverflowContainerDomNode(),allowVariableLineHeights:!1,readOnly:!0},{contributions:aa.getEditorContributions().filter(s=>n.indexOf(s.id)===-1)}),editorContainer:o}}var K8o="notebookEditorWorkerService",JK=ae(K8o);var G8o=20,rMe=class extends Jd{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 P),this._renderAnimationFrame=null,this._domNode=or(document.createElement("canvas")),this._domNode.setPosition("relative"),this._domNode.setLayerHinting(!0),this._domNode.setContain("strict"),o.appendChild(this._domNode.domNode),this._overviewViewportDomElement=or(document.createElement("div")),this._overviewViewportDomElement.setClassName("diffViewport"),this._overviewViewportDomElement.setPosition("absolute"),this._overviewViewportDomElement.setWidth(t),o.appendChild(this._overviewViewportDomElement.domNode),this._register(Xd.getInstance(Me(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(Vo(o,re.POINTER_DOWN,r=>{this.notebookEditor.delegateVerticalScrollbarPointerDown(r)}))}applyColors(e){let t=e.getColor(sgt)||(e.getColor(Hg)||$Se).transparent(2),o=e.getColor(agt)||(e.getColor(Cf)||qSe).transparent(2),n=!t.equals(this._insertColor)||!o.equals(this._removeColor);return this._insertColor=t,this._removeColor=o,this._insertColor&&(this._insertColorHex=Oe.Format.CSS.formatHexA(this._insertColor)),this._removeColor&&(this._removeColorHex=Oe.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=Ah(Me(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=Xd.getInstance(Me(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(G8o,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()}};rMe=I([m(3,De)],rMe);function sMe(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=$8o(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 $8o(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 aMe=class extends C{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 P);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 ome||e instanceof KZ||e instanceof GZ?!(e.type==="unchanged"&&e.containerType==="unchanged"):!0).filter(e=>e instanceof GZ?!this.hideOutput:!0).filter(e=>e instanceof KZ?!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(),Ue(Array.from(this.placeholderAndRelatedCells.keys())),this.placeholderAndRelatedCells.clear(),Ue(this.originalCellViewModels),this.originalCellViewModels=[],Ue(this._items),this._items.splice(0,this._items.length)}async computeDiff(e){let t=await wa(this.notebookEditorWorkerService.computeDiff(this.model.original.resource,this.model.modified.resource),e);if(!t||e.isCancellationRequested)return;q8o(this.model.original.notebook,this.model.modified.notebook,t.cellsDiff);let{cellDiffInfo:o,firstChangeIndex:n}=sMe(this.model.original.notebook,this.model.modified.notebook,t);if(!j8o(o,this.originalCellViewModels,this.model)){if(await wa(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 ome(o.original.uri,void 0,o.type,o.type));let n=Zo.generateCellPropertyUri(e,o.original.handle,Y.vscodeNotebookCellMetadata);this.diffEditorItems.push(new KZ(n,void 0,o.type,o.type));let r=Zo.generateCellPropertyUri(e,o.original.handle,Y.vscodeNotebookCellOutput);this.diffEditorItems.push(new GZ(r,void 0,o.type,o.type));break}case"insert":{this.diffEditorItems.push(new ome(void 0,o.modified.uri,o.type,o.type));let n=Zo.generateCellPropertyUri(t,o.modified.handle,Y.vscodeNotebookCellMetadata);this.diffEditorItems.push(new KZ(void 0,n,o.type,o.type));let r=Zo.generateCellPropertyUri(t,o.modified.handle,Y.vscodeNotebookCellOutput);this.diffEditorItems.push(new GZ(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 ome(o.original.uri,o.modified.uri,n,r));let s=Zo.generateCellPropertyUri(e,o.original.handle,Y.vscodeNotebookCellMetadata),l=Zo.generateCellPropertyUri(t,o.modified.handle,Y.vscodeNotebookCellMetadata);this.diffEditorItems.push(new KZ(s,l,o.checkMetadataIfModified()?o.type:"unchanged",r));let c=Zo.generateCellPropertyUri(e,o.original.handle,Y.vscodeNotebookCellOutput),u=Zo.generateCellPropertyUri(t,o.modified.handle,Y.vscodeNotebookCellOutput);this.diffEditorItems.push(new GZ(c,u,o.checkIfOutputsModified()?o.type:"unchanged",r));break}case"unchanged":{this._hasUnchangedCells=!0,this.diffEditorItems.push(new ome(o.original.uri,o.modified.uri,o.type,o.type));let n=Zo.generateCellPropertyUri(e,o.original.handle,Y.vscodeNotebookCellMetadata),r=Zo.generateCellPropertyUri(t,o.modified.handle,Y.vscodeNotebookCellMetadata);this.diffEditorItems.push(new KZ(n,r,o.type,o.type));let s=Zo.generateCellPropertyUri(e,o.original.handle,Y.vscodeNotebookCellOutput),l=Zo.generateCellPropertyUri(t,o.modified.handle,Y.vscodeNotebookCellOutput);this.diffEditorItems.push(new GZ(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 kVt(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 ZRe(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 _Ze(o,n,o.cells[c.originalCellIndex],void 0,"delete",this.eventDispatcher,r,this.notebookService,this.configurationService,this.diffEditorHeightCalculator,c.originalCellIndex);case"insert":return new _Ze(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 GC(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 GC(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 q8o(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 j8o(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 RZe=class extends ik{constructor(e,t,o,n,r,s,l){super(e,t,o,void 0,l);this.type=n;this.containerType=r;this.kind=s}},ome=class extends RZe{constructor(i,e,t,o){super(i,e,e||i,t,o,"Cell",{[H4.key]:"Cell",[U4.key]:t})}},KZ=class extends RZe{constructor(i,e,t,o){super(i,e,e||i,t,o,"Metadata",{[H4.key]:"Metadata",[U4.key]:t})}},GZ=class extends RZe{constructor(i,e,t,o){super(i,e,e||i,t,o,"Output",{[H4.key]:"Output",[U4.key]:t})}};var $Z=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?X9.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*Eco,S=g+h-f;return S*this.lineHeight+pA(S).top+pA(S).bottom+b}finally{t.dispose(),o.dispose()}}computeHeightFromLines(i){return i*this.lineHeight+pA(i).top+pA(i).bottom}};$Z=I([m(1,Nt),m(2,$s),m(3,B)],$Z);var MVt=ae("INotebookOriginalCellModelFactory"),MZe=class extends Ww{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()}};MZe=I([m(0,Ct),m(1,kt)],MZe);var lMe=class{constructor(i){this._data=i.createInstance(MZe)}getOrCreate(i,e,t,o){return this._data.acquire(i.toString(),i,e,t,o)}};lMe=I([m(0,F)],lMe);var cMe=class extends P{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 P);let l=ui(e.onDidChangeVisibleRanges,()=>e.visibleRanges),c=Ce(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(Ga((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(Q8o(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=po.createDynamic({...Eae,stickiness:1}),l=po.createDynamic({...zye,stickiness:1}),c=(g,f)=>po.createDynamic({description:"chat-editing-decoration",overviewRuler:{color:If(g),position:1},minimap:{color:If(f),position:2}}),u=c(jY,Pke),p=c(QY,Ake),h=c(YY,Nke);e.changeViewZones(g=>{for(let w of this._viewZones)g.removeZone(w);this._viewZones=[];let f=[],v=t.mightContainNonBasicASCII(),b=t.mightContainRTL(),S=uE.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 dE(k.mapToLineArray(G=>t.tokenization.getLineTokens(G)),[],v,b),N=[];for(let G of w.innerChanges||[])N.push(new Zk(G.originalRange.delta(-(w.original.startLineNumber-1)),Cq.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=N.length===1&&N[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 U=EL(T,S,N,V);if(!O){let G={afterLineNumber:w.modified.startLineNumber-1,heightInLines:U.heightInLines,domNode:V,ordinal:50002};this._viewZones.push(g.addZone(G))}}r.set(f)})}};cMe=I([m(4,$s),m(5,MVt)],cMe);function Q8o(a,i){return a&&i?!(a.changes.length!==i.changes.length||a.moves.length!==i.moves.length||!Lco(a.changes,i.changes)||!a.moves.some((e,t)=>{let o=i.moves[t];return!Lco(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 Lco(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 Y8o=Kg("notebookRenderer",{createHTML:a=>a}),qZ=class extends C{constructor(e,t,o,n){super();this._notebookEditor=e;this.toolbar=t;this.languageService=o;this.instantiationService=n;this.zoneRemover=this._register(new P);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 PZe(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:YY,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),Ue(n)}),this._notebookEditor.deltaCellDecorations(p,[]))}))})}};qZ=I([m(2,kt),m(3,F)],qZ);var PZe=class extends C{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=R(r,document.createElement("div")),this._register(Z(()=>{r.removeChild(this.container)}))}async render(){let e=this.code,t=this.language,o=await bW(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 Io([X,this._notebookEditor.scopedContextKeyService]))).createInstance(Ln,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=R(h,_(".cell-inner-container"));g.style.position="relative";let f=R(g,_(".cell-focus-indicator.cell-focus-indicator-side.cell-focus-indicator-left")),v=R(g,_(".cell.code"));R(f,_("div.execution-count-label"));let b=R(v,_(".cell-editor-part")),S=R(b,_(".cell-editor-container"));return S=R(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=Y8o?.createHTML(o)||o,mc(e).length*(n.lineHeight||Tco)+12+12+16+16}};PZe=I([m(6,kt),m(7,F)],PZe);var dMe=class extends C{constructor(e){super();this.notebookEditor=e;this.decorators=this._register(new P)}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:QY,modelRanges:[],includeOutput:!0,position:7}}})));this.clear(),this.decorators.add(Z(()=>{this.notebookEditor.isDisposed||this.notebookEditor.deltaCellDecorations(n,[])}))}clear(){this.decorators.clear()}};var Rco=ae("INotebookOriginalModelReferenceFactory"),AZe=class extends Ww{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=Je.fromString(s.object.textEditorModel.getValue()),c=WT(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)}})()}};AZe=I([m(0,un),m(1,Nt)],AZe);var uMe=class{constructor(i){this.instantiationService=i;this._resourceModelCollection=void 0;this._asyncModelCollection=void 0}get resourceModelCollection(){return this._resourceModelCollection||(this._resourceModelCollection=this.instantiationService.createInstance(AZe)),this._resourceModelCollection}get asyncModelCollection(){return this._asyncModelCollection||(this._asyncModelCollection=new tbe(this.resourceModelCollection)),this._asyncModelCollection}getOrCreate(i,e){return this.asyncModelCollection.acquire(i.originalURI.toString(),i,e)}};uMe=I([m(0,F)],uMe);var jZ=class extends C{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(he(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(H.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(dMe,this.notebookEditor),this.deletedCellDecorator=this.instantiationService.createInstance(qZ,this.notebookEditor,void 0),this._update();let e=H.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=H.debounce(this.notebookEditor.textModel.onDidChangeContent,(n,r)=>r,100,void 0,void 0,void 0,this._store),o=H.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=sMe(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(cMe,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))})}};jZ=I([m(1,JK),m(2,F),m(3,_v)],jZ);tm(jZ.ID,jZ);we(Rco,uMe,1);we(MVt,lMe,1);var pMe=class extends C{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=A4.getSomeEditorContributions([jZ.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=aa.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||""),vN(this.widget.value.getDomNode(),this.rootElement))}dispose(){super.dispose(),this.widget.value&&this.widget.value.dispose()}};pMe=I([m(5,F),m(6,Zc)],pMe);var X8o=_,Cwi=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:fce(this.selections)};return Object.assign(e,i),e}},Xm=class extends pa{constructor(e,t,o,n,r,s,l,c,u,p){super(Xm.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=UZ();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 P);this._insetModifyQueueByOutputId=new NT;this._onDidDynamicOutputRendered=this._register(new E);this.onDidDynamicOutputRendered=this._onDidDynamicOutputRendered.event;this._localStore=this._register(new P);this._onDidChangeSelection=this._register(new E);this.onDidChangeSelection=this._onDidChangeSelection.event;this._isDisposed=!1;this._currentChangedIndex=Le(this,-1);this.currentChangedIndex=this._currentChangedIndex;this.pendingLayouts=new WeakMap;this.diffEditorCalcuator=this.instantiationService.createInstance($Z,this.fontInfo.lineHeight),this._notebookOptions=t.createInstance(nT,this.window,!1,void 0),this._register(this._notebookOptions),this._revealFirst=!0}static{this.ENTIRE_DIFF_OVERVIEW_WIDTH=30}static{this.ID=lY}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 Fy.readFontInfo(this.window,LS(e,Xd.getInstance(this.window).value))}isOverviewRulerEnabled(){return this.configurationService.getValue(ft.diffOverviewRuler)??!1}getSelection(){let e=this._list.getFocus();return new Cwi(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 GC){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 $e,this.updateLayout(this._layoutCancellationTokenSource.token))}createEditor(e){this._rootElement=R(e,_(".notebook-text-diff-editor")),this._overflowContainer=document.createElement("div"),this._overflowContainer.classList.add("notebook-overflow-widget-container","monaco-editor"),R(e,this._overflowContainer);let t=[this.instantiationService.createInstance(q4,this),this.instantiationService.createInstance(j4,this),this.instantiationService.createInstance(G4,this),this.instantiationService.createInstance($4,this)];this._listViewContainer=R(this._rootElement,_(".notebook-diff-list-view")),this._list=this.instantiationService.createInstance(nMe,"NotebookTextDiff",this._listViewContainer,this.instantiationService.createInstance(oMe,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:qo,listActiveSelectionBackground:qo,listActiveSelectionForeground:ko,listFocusAndSelectionBackground:qo,listFocusAndSelectionForeground:ko,listFocusBackground:qo,listFocusForeground:ko,listHoverForeground:ko,listHoverBackground:qo,listHoverOutline:Ad,listFocusOutline:Ad,listInactiveSelectionBackground:qo,listInactiveSelectionForeground:ko,listInactiveFocusBackground:qo,listInactiveFocusOutline:qo},accessibilityProvider:{getAriaLabel(){return null},getWidgetAriaLabel(){return d(11902,null)}}}),this.inlineDiffWidget=this._register(this.instantiationService.createInstance(pMe,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=R(this._list.rowsContainer,X8o(".webview-cover")),this._webviewTransparentCover.style.display="none",this._register(Gbe(this._overflowContainer,o=>{o.target.classList.contains("slider")&&this._webviewTransparentCover&&(this._webviewTransparentCover.style.display="block")})),this._register(Qpt(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(rMe,this,Xm.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 $e,this._modifiedResourceDisposableStore.add(H.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 $e,this.updateLayout(this._layoutCancellationTokenSource.token))})),await this._createOriginalWebview(_t(),this._model.original.viewType,this._model.original.resource),this._originalWebview&&this._modifiedResourceDisposableStore.add(this._originalWebview),await this._createModifiedWebview(_t(),this._model.modified.viewType,this._model.modified.resource),this._modifiedWebview&&this._modifiedResourceDisposableStore.add(this._modifiedWebview),await this.updateLayout(this._layoutCancellationTokenSource.token,t?.cellSelections?Lf(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 JRe;let t=()=>{$r(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 aMe(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(uA,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(uA,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?Lf(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 GC){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;$r(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=$r(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?Xm.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 yVt({width:!0,fontInfo:!0},this.getLayoutInfo())])}dispose(){this._isDisposed=!0,this._layoutCancellationTokenSource?.dispose(),this._detachModel(),super.dispose()}};Xm=I([m(1,F),m(2,De),m(3,X),m(4,JK),m(5,B),m(6,Te),m(7,le),m(8,un),m(9,ee)],Xm);Sk(0,10,"notebook-diff-view-viewport-slider");is((a,i)=>{let e=a.getColor(hGi);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: ${pD}px; }`),i.addRule(`.notebook-text-diff-editor .cell-placeholder-body { margin: ${pD}px 0; }`)});var mMe=class extends C{constructor(i,e,t){super(),this._workerManager=this._register(new xwi(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))}};mMe=I([m(0,un),m(1,Ct),m(2,Ay)],mMe);var xwi=class extends C{constructor(e,t,o){super();this._notebookService=e;this._modelService=t;this._webWorkerService=o;this._editorWorkerClient=null}withWorker(){return this._editorWorkerClient||(this._editorWorkerClient=new Ewi(this._notebookService,this._modelService,this._webWorkerService),this._register(this._editorWorkerClient)),Promise.resolve(this._editorWorkerClient)}},kwi=class extends C{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 P,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!==Y.vscodeNotebookCell||!(c instanceof Bu))return;let u=Zo.parse(c.uri);if(!u||!Xe(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],Ue(t)}},Ewi=class extends C{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 kwi(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 gx({esmModuleLocation:gn.asBrowserUri("vs/workbench/contrib/notebook/common/services/notebookWebWorkerMain.js"),label:"NotebookEditorWorker"})))}catch(e){throw e}return this._worker}};var PVt=class extends C{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 ss(l),{items:[]}}}))}};var hMe=class{constructor(i,e,t,o){this.editorGroupService=i;this.instantiationService=o;this._tokenPool=1;this._disposables=new P;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 ha||u.editor instanceof yw?[u.editor]:Nj(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=>{k8e(u.editor)&&this._allowWidgetMove(u.editor,u.groupId,u.target),Nj(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=C4.bindTo(t);let r=fWt.bindTo(t);this._disposables.add(e.onDidEditorsChange(s=>{s.event.kind===5&&!r.get()?e.editors.find(l=>Nj(l))&&r.set(!0):s.event.kind===6&&r.get()&&(e.editors.find(l=>Nj(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 vt,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(rd),u=new P,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 vt,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 Io([X,i],[rd,t]))),l=o??UZ();return s.createInstance(XK,{...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)}};hMe=I([m(0,Et),m(1,ee),m(2,X),m(3,F)],hMe);var QZ=class extends C{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 vt;this.mapResourceToDisposeListener=new vt}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&&(Ue(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(),Ue(this.mapResourceToDisposeListener.values()),this.mapResourceToDisposeListener.clear()}async destroy(){try{await fn.settled(this.workingCopies.map(async e=>{e.isDirty()&&await this.saveWithFallback(e)}))}catch(e){this.logService.error(e)}Ue(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})}}};QZ=I([m(0,be),m(1,ne),m(2,Gm)],QZ);var gMe=class extends QZ{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 vt;this.mapResourceToPendingWorkingCopyResolve=new vt;this.workingCopyResolveQueue=this._register(new sU);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))),Gt?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(17610,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 fn.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=je(n,l.path.substr(o.path.length+1)),t.push({source:l,target:c,snapshot:s.isDirty()?await s.model?.snapshot(1,ve.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 fn.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 _5(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 P;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&&(Ue(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 H.toPromise(e.onDidChangeDirty),this.canDispose(e)):!0}dispose(){super.dispose(),this.mapResourceToPendingWorkingCopyResolve.clear(),Ue(this.mapResourceToWorkingCopyListeners.values()),this.mapResourceToWorkingCopyListeners.clear()}};gMe=I([m(2,be),m(3,ao),m(4,ot),m(5,ne),m(6,kp),m(7,Gm),m(8,dt),m(9,lr),m(10,Wa),m(11,Ne),m(12,Vf),m(13,ee),m(14,aF),m(15,Bo)],gMe);var ZK=class extends C{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=O1i()),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,ve.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 wa(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)}};ZK=I([m(8,Wa),m(9,Gm),m(10,ne)],ZK);var fMe=class extends QZ{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 vt}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:Y.untitled,authority:e.associatedResource.authority,fragment:e.associatedResource.fragment,path:e.associatedResource.path,query:e.associatedResource.query}),t.associatedResource=e.associatedResource):(e.untitledResource?.scheme===Y.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:Y.untitled,path:e.isScratchpad?`Scratchpad-${n}`:`Untitled-${n}`,query:this.workingCopyTypeId?`typeId=${this.workingCopyTypeId}`:void 0}),n++;while(this.has(t))}let o=new ZK(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 P;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&&(Ue(o),this.mapResourceToWorkingCopyListeners.delete(e)),t}dispose(){super.dispose(),Ue(this.mapResourceToWorkingCopyListeners.values()),this.mapResourceToWorkingCopyListeners.clear()}notifyDidSave(e,t){this._onDidSave.fire({source:e,target:t})}};fMe=I([m(3,be),m(4,ot),m(5,ne),m(6,Gm),m(7,Wa)],fMe);var Q4=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N,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=N;this.stored=this._register(new gMe(this.workingCopyTypeId,this.storedWorkingCopyModelFactory,n,r,s,l,c,u,p,g,f,v,b,S,y,O)),this.untitled=this._register(new fMe(this.workingCopyTypeId,this.untitledWorkingCopyModelFactory,async(V,U)=>!!await this.saveAs(V.resource,void 0,U),n,s,l,u,f)),this.onDidCreate=H.any(this.stored.onDidCreate,this.untitled.onDidCreate),this.provideDecorations()}static{this.FILE_WORKING_COPY_SAVE_CREATE_SOURCE=ph.registerSource("fileWorkingCopyCreate.source",d(17585,null))}static{this.FILE_WORKING_COPY_SAVE_REPLACE_SOURCE=ph.registerSource("fileWorkingCopyReplace.source",d(17587,null))}provideDecorations(){let e=this._register(new class extends C{constructor(o){super();this.stored=o;this.label=d(17586,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:uL,letter:M.lockSmall,strikethrough:!0,tooltip:d(17591,null)};if(r)return{letter:M.lockSmall,tooltip:d(17590,null)};if(s)return{color:uL,strikethrough:!0,tooltip:d(17584,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===Y.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 ZK&&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)&&Xe(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}}],ve.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,ve.None):n=(await this.fileService.readFileStream(e)).value;let{targetFileExists:s,targetStoredFileWorkingCopy:l}=await this.doResolveSaveTarget(e,t);if(!(r instanceof ZK&&r.hasAssociatedFilePath&&s&&this.uriIdentityService.extUri.isEqual(t,Og(r.resource,this.environmentService.remoteAuthority,this.pathService.defaultUriScheme))&&!await this.confirmOverwrite(t)||(await l.model?.update(n,ve.None),o?.source||(o={...o,source:s?Q4.FILE_WORKING_COPY_SAVE_REPLACE_SOURCE:Q4.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===Y.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}],ve.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(17583,null,Ye(e)),detail:d(17589,null,Ye(e),Ye(ci(e))),primaryButton:d(17592,null)});return t}async confirmMakeWriteable(e){let{confirmed:t}=await this.dialogService.confirm({type:"warning",message:d(17581,null,Ye(e)),detail:d(17582,null),primaryButton:d(17588,null)});return t}async suggestSavePath(e){if(this.fileService.hasProvider(e))return e;let t=this.get(e);if(t instanceof ZK&&t.hasAssociatedFilePath)return Og(e,this.environmentService.remoteAuthority,this.pathService.defaultUriScheme);let o=await this.fileDialogService.defaultFilePath();if(t){let n=je(o,t.name);if(await this.pathService.hasValidBasename(n,t.name))return n}return je(o,Ye(e))}async destroy(){await fn.settled([this.stored.destroy(),this.untitled.destroy()])}};Q4=I([m(3,be),m(4,ao),m(5,ot),m(6,ne),m(7,kp),m(8,Gm),m(9,dt),m(10,dn),m(11,lr),m(12,Wa),m(13,Ne),m(14,Vf),m(15,ee),m(16,aF),m(17,wn),m(18,Vt),m(19,ct),m(20,Cv),m(21,Bo)],Q4);var NZe=class extends Ww{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 P;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 vt;this.modelsToDispose=new Set}dispose(){this._disposables.dispose(),this._onDidSaveNotebook.dispose(),this._onDidChangeDirty.dispose(),Ue(this._modelListener.values()),Ue(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=_O.create(t,s),u=this._workingCopyManagers.get(c);if(!u){let v=new bTe(t,this._notebookService,this._configurationService,this._telemetryService,this._notebookLoggingService);u=this._instantiationService.createInstance(Q4,c,v,v),this._workingCopyManagers.set(c,u)}let p=r||t==="interactive"&&this._configurationService.getValue(ft.InteractiveWindowPromptToSave)!==!0,g=await this._instantiationService.createInstance(lF,l,o,t,u,p).load({limits:n}),f;return this._modelListener.set(g,hn(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 lF&&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)}})()}};NZe=I([m(0,F),m(1,un),m(2,B),m(3,Te),m(4,_v)],NZe);var vMe=class{constructor(i,e,t,o){this._notebookService=e;this._extensionService=t;this._uriIdentService=o;this._onWillFailWithConflict=new JH;this.onWillFailWithConflict=this._onWillFailWithConflict.event;this._data=i.createInstance(NZe),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(Oi(i));if(!e)throw new Error("UNKNOWN notebook type: "+i);let t=AZ.possibleFileEnding(e.selectors)??"";for(let o=1;;o++){let n=A.from({scheme:Y.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=dxe(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},ve.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===Y.untitled?o=i.untitledResource:(o=i.untitledResource.with({scheme:Y.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}}};vMe=I([m(0,F),m(1,un),m(2,lt),m(3,dt)],vMe);var Twi=class a{constructor(i){this.notebookPriorities=new vt;this.kernel=i,this.score=-1,this.time=a._logicClock++}static{this._logicClock=0}},e2=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))}}},_wi=class extends C{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}`)}}},bB=class extends C{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 il(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=e2.str(r);this._notebookBindings.get(s)&&r.uri.scheme===Y.untitled&&this.selectKernelForNotebook(void 0,r),this._kernelSourceActionsUpdates.get(s)?.dispose(),this._kernelSourceActionsUpdates.delete(s)}));try{let r=JSON.parse(this._storageService.get(bB._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=jv(Ki(),()=>{this._storageService.store(bB._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(e2.str(e));if(!o)return;let n=this._kernels.get(o);!n||!bB._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 Twi(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:e2.obj(t).uri,oldKernel:e.id,newKernel:void 0})})}getMatchingKernel(e){let t=[];for(let c of this._kernels.values()){let u=bB._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(e2.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=e2.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=e2.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=e2.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=e2.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 _wi(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),[]))}};bB=I([m(0,un),m(1,le),m(2,qt),m(3,X)],bB);var bMe=class extends C{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)}};bMe=I([m(0,lt)],bMe);async function SMe(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]??Fr),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]??Fr),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 Pco(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 Dwi(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=wY(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=PEt(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=PEt(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 Lwi(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=wY(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:Lf([o]).map(s=>jK(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=Lf([o]).map(h=>jK(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:Lf([o]).map(h=>jK(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 Aco(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(11748,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 Iv(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 Iv(t.textModel.uri,{editType:1,index:p.start,count:p.end-p.start,cells:[]}));o.length&&await a.apply(o,{quotableLabel:d(11749,null)})}async function Mco(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 ja(r.uri,{range:new z(l,c+1,l,c+1),text:s}),new Iv(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 ja(s.uri,{range:new z(u,p+1,u,p+1),text:c}),new Iv(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 Rwi(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 Mco(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=PEt(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 Mco(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 J8o(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 Ie(s.lineNumber+1,1)),Z8o(e,s);if(e.length===0)return null;let n=new Ie(1,1),r=new Ie(t,o(t)+1);return[n,...e,r]}function Z8o(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 Nco(a,i){let e=J8o(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 SB(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]||Fr;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 eQo(l,u?o==="above"?e:p:e,n,h,t,void 0,[],!0,!0)}function eQo(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 tQo="notebook.cell.insertCodeCellAbove",AVt="notebook.cell.insertCodeCellBelow",iQo="notebook.cell.insertCodeCellAboveAndFocusContainer",oQo="notebook.cell.insertCodeCellBelowAndFocusContainer",Mwi="notebook.cell.insertCodeCellAtTop",nQo="notebook.cell.insertMarkdownCellAbove",Pwi="notebook.cell.insertMarkdownCellBelow",Oco="notebook.cell.insertMarkdownCellAtTop";function Awi(a,i,e,t,o){let n=null;i.ui&&i.notebookEditor.focus();let r=a.get(kt),s=a.get(mR);if(i.cell){let l=i.notebookEditor.getCellIndex(i.cell);n=SB(r,i.notebookEditor,l,e,t,void 0,!0,s)}else{let l=i.notebookEditor.getFocus(),c=Math.max(l.end-1,0);n=SB(r,i.notebookEditor,c,e,t,void 0,!0,s)}return n}var YZ=class extends qu{constructor(e,t,o,n){super(e);this.kind=t;this.direction=o;this.focusEditor=n}async runWithContext(e,t){let o=await Awi(e,t,this.kind,this.direction,this.focusEditor);o&&await t.notebookEditor.focusNotebookCell(o,this.focusEditor?"editor":"container")}};W(class extends YZ{constructor(){super({id:tQo,title:d(11816,null),keybinding:{primary:3075,when:x.and($u,$h.toNegated()),weight:200},menu:{id:D.NotebookCellInsert,order:0}},2,"above",!0)}});W(class extends YZ{constructor(){super({id:iQo,title:d(11817,null)},2,"above",!1)}});W(class extends YZ{constructor(){super({id:AVt,title:d(11819,null),keybinding:{primary:2051,when:x.and($u,$h.toNegated()),weight:200},menu:{id:D.NotebookCellInsert,order:1}},2,"below",!0)}});W(class extends YZ{constructor(){super({id:oQo,title:d(11820,null)},2,"below",!1)}});W(class extends YZ{constructor(){super({id:nQo,title:d(11821,null),menu:{id:D.NotebookCellInsert,order:2}},1,"above",!0)}});W(class extends YZ{constructor(){super({id:Pwi,title:d(11823,null),menu:{id:D.NotebookCellInsert,order:3}},1,"below",!0)}});W(class extends qu{constructor(){super({id:Mwi,title:d(11818,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(kt),o=i.get(mR),n=SB(t,e.notebookEditor,0,2,"above",void 0,!0,o);n&&await e.notebookEditor.focusNotebookCell(n,"editor")}});W(class extends qu{constructor(){super({id:Oco,title:d(11822,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(kt),o=i.get(mR),n=SB(t,e.notebookEditor,0,1,"above",void 0,!0,o);n&&await e.notebookEditor.focusNotebookCell(n,"editor")}});fe.appendMenuItem(D.NotebookCellBetween,{command:{id:AVt,title:"$(add) "+d(11824,null),tooltip:d(11828,null)},order:0,group:"inline",when:x.and(Kl.isEqualTo(!0),x.notEquals("config.notebook.experimental.insertToolbarAlignment","left"))});fe.appendMenuItem(D.NotebookCellBetween,{command:{id:AVt,title:d(11826,null),icon:M.add,tooltip:d(11828,null)},order:0,group:"inline",when:x.and(Kl.isEqualTo(!0),x.equals("config.notebook.experimental.insertToolbarAlignment","left"))});fe.appendMenuItem(D.NotebookToolbar,{command:{id:AVt,icon:M.add,title:d(11827,null),tooltip:d(11828,null)},order:-5,group:"navigation/add",when:x.and(Kl.isEqualTo(!0),x.notEquals("config.notebook.insertToolbarLocation","betweenCells"),x.notEquals("config.notebook.insertToolbarLocation","hidden"))});fe.appendMenuItem(D.NotebookCellListTop,{command:{id:Mwi,title:"$(add) "+d(11824,null),tooltip:d(11828,null)},order:0,group:"inline",when:x.and(Kl.isEqualTo(!0),x.notEquals("config.notebook.experimental.insertToolbarAlignment","left"))});fe.appendMenuItem(D.NotebookCellListTop,{command:{id:Mwi,title:d(11825,null),icon:M.add,tooltip:d(11828,null)},order:0,group:"inline",when:x.and(Kl.isEqualTo(!0),x.equals("config.notebook.experimental.insertToolbarAlignment","left"))});fe.appendMenuItem(D.NotebookCellBetween,{command:{id:Pwi,title:"$(add) "+d(11829,null),tooltip:d(11831,null)},order:1,group:"inline",when:x.and(Kl.isEqualTo(!0),x.notEquals("config.notebook.experimental.insertToolbarAlignment","left"))});fe.appendMenuItem(D.NotebookToolbar,{command:{id:Pwi,icon:M.add,title:d(11830,null),tooltip:d(11831,null)},order:-5,group:"navigation/add",when:x.and(Kl.isEqualTo(!0),x.notEquals("config.notebook.insertToolbarLocation","betweenCells"),x.notEquals("config.notebook.insertToolbarLocation","hidden"),x.notEquals(`config.${ft.globalToolbarShowLabel}`,!1),x.notEquals(`config.${ft.globalToolbarShowLabel}`,"never"))});fe.appendMenuItem(D.NotebookCellListTop,{command:{id:Oco,title:"$(add) "+d(11829,null),tooltip:d(11831,null)},order:1,group:"inline",when:x.and(Kl.isEqualTo(!0),x.notEquals("config.notebook.experimental.insertToolbarAlignment","left"))});oe.as(ii.Configuration).registerConfiguration({id:"editor",properties:{"inlineChat.finishOnType":{description:d(10623,null),default:!1,type:"boolean"},"inlineChat.enableV2":{description:d(10622,null),default:!1,type:"boolean",tags:["preview"],experiment:{mode:"auto"}},"inlineChat.notebookAgent":{markdownDescription:d(10657,null),default:!1,type:"boolean",tags:["experimental"],experiment:{mode:"startup"}},"inlineChat.affordance":{description:d(10615,null),default:"off",type:"string",enum:["off","gutter","editor"],enumDescriptions:[d(10618,null),d(10617,null),d(10616,null)],experiment:{mode:"auto"},tags:["experimental"]},"inlineChat.renderMode":{description:d(10658,null),default:"zone",type:"string",enum:["zone","hover"],enumDescriptions:[d(10660,null),d(10659,null)],experiment:{mode:"auto"},tags:["experimental"]},"inlineChat.fixDiagnostics":{description:d(10624,null),default:!0,type:"boolean",experiment:{mode:"auto"},tags:["experimental"]}}});var NVt="interactiveEditor";var Fco=new Q("inlineChatPossible",!1,d(10641,null)),rQo=new Q("inlineChatHasEditsAgent",!1,d(10638,null)),sQo=new Q("inlineChatHasNotebookInline",!1,d(10640,null)),aQo=new Q("inlineChatHasNotebookAgent",!1,d(10639,null)),OZe=new Q("inlineChatVisible",!1,d(10656,null)),Y4=new Q("inlineChatFocused",!1,d(10637,null)),Vpu=new Q("inlineChatEditing",!0,d(10634,null)),Wco=new Q("inlineChatResponseFocused",!1,d(10654,null)),Bpu=new Q("inlineChatEmpty",!1,d(10635,null)),Nwi=new Q("inlineChatInputHasText",!1,d(10649,null)),Owi=new Q("inlineChatInputWidgetFocused",!1,d(10650,null)),Hpu=new Q("inlineChatInnerCursorFirst",!1,d(10643,null)),Upu=new Q("inlineChatInnerCursorLast",!1,d(10644,null)),Fwi=new Q("inlineChatOuterCursorPosition","",d(10651,null)),zpu=new Q("inlineChatHasStashedSession",!1,d(10642,null)),Kpu=new Q("inlineChatChangeHasDiff",!1,d(10630,null)),Gpu=new Q("inlineChatChangeShowsDiff",!1,d(10631,null)),Vco=new Q("inlineChatRequestInProgress",!1,d(10653,null)),Bco=new Q("inlineChatResponseType","none",d(10655,null)),OVt=new Q("inlineChatFileBelongsToChat",!1,d(10636,null)),Wwi=new Q("inlineChatPendingConfirmation",!1,d(10652,null)),Vwi=new Q("inlineChatAffordanceVisible",!1,d(10629,null)),Hco=x.or(x.and(Ua,sQo)),nme=x.or(rQo,x.and(Ua,aQo)),FZe=x.equals("config.inlineChat.renderMode","hover"),lQo=x.equals("config.inlineChat.fixDiagnostics",!0),XZ="inlineChat.start",Bwi="inlineChat.askInChat",Uco="inlineChat.acceptChanges";var zco="inlineChat.regenerate";var Kco="inlineChat.toggleDiff",Gco="inlineChat.reportIssue",FVt=D.for("inlineChatWidget.status"),IB=D.for("inlineChatWidget.secondary"),$pu=D.for("inlineChatWidget.changesZone"),$co=D.for("inlineChatWidget.side"),qco=J("inlineChat.foreground",dL,d(10627,null)),Hwi=J("inlineChat.background",gm,d(10625,null)),qpu=J("inlineChat.border",DN,d(10626,null)),jpu=J("inlineChat.shadow",RN,d(10628,null)),Qpu=J("inlineChatInput.border",DN,d(10646,null)),Ypu=J("inlineChatInput.focusBorder",Ad,d(10647,null)),Xpu=J("inlineChatInput.placeholderForeground",u9,d(10648,null)),Jpu=J("inlineChatInput.background",Gb,d(10645,null)),Zpu=J("inlineChatDiff.inserted",ei(Hg,.5),d(10632,null)),emu=J("editorOverviewRuler.inlineChatInserted",{dark:ei(Hg,.6),light:ei(Hg,.8),hcDark:ei(Hg,.6),hcLight:ei(Hg,.8)},d(10620,null)),tmu=J("editorMinimap.inlineChatInserted",{dark:ei(Hg,.6),light:ei(Hg,.8),hcDark:ei(Hg,.6),hcLight:ei(Hg,.8)},d(10619,null)),imu=J("inlineChatDiff.removed",ei(Cf,.5),d(10633,null)),omu=J("editorOverviewRuler.inlineChatRemoved",{dark:ei(Cf,.6),light:ei(Cf,.8),hcDark:ei(Cf,.6),hcLight:ei(Cf,.8)},d(10621,null));var cQo="notebook.execute",dQo="notebook.cancelExecution",uQo="notebook.interruptExecution",pQo="notebook.cell.cancelExecution",mQo="notebook.cell.executeAndFocusContainer",jco="notebook.cell.executeAndSelectBelow",Qco="notebook.cell.executeAndInsertBelow",hQo="notebook.cell.executeCellAndBelow",gQo="notebook.cell.executeCellsAbove",fQo="notebook.renderAllMarkdownCells",vQo="notebook.revealRunningCell",bQo="notebook.revealLastFailedCell",rme=x.and(hS.isEqualTo("code"),x.or(x.greater(CZ.key,0),x.greater(eRe.key,0),IWt)),WZe=x.and(rme,vWt.toNegated()),Jco=x.and(hS.isEqualTo("markup"));function Zco(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 VVt(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&&Yco(i.cell,i.notebookEditor),await i.notebookEditor.executeNotebookCells(ht.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&&Yco(r,i.notebookEditor),await i.notebookEditor.executeNotebookCells(n)}let o;for(let[,n]of i.notebookEditor.codeEditors)if(Xe(n.getModel()?.uri,(i.cell??i.selectedCells?.[0])?.uri)){o=n;break}}var SQo=20,IQo=60;function Yco(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 Qm))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-SQo)},g=v=>{i.setScrollTop(v)},f=v=>{i.setScrollTop(v+IQo)};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 qu{constructor(){super({id:fQo,title:d(11808,null)})}async runWithContext(i,e){Zco(e)}});W(class extends qu{constructor(){super({id:cQo,title:d(11806,null),icon:Qao,metadata:{description:d(11806,null),args:[{name:"uri",description:"The document uri"}]},menu:[{id:D.EditorTitle,order:-1,group:"navigation",when:x.and(Ua,x.or(hB.toNegated(),mB.toNegated()),x.notEquals("config.notebook.globalToolbar",!0))},{id:D.NotebookToolbar,order:-1,group:"navigation/execute",when:x.and(x.or(hB.toNegated(),mB.toNegated()),x.and(mB,hB.toNegated())?.negate(),x.equals("config.notebook.globalToolbar",!0))}]})}getEditorContextFromArgsOrActive(i,e){return wWt(i,e)??Epe(i.get(ee))}async runWithContext(i,e){Zco(e);let o=i.get(ee).findEditors({resource:e.notebookEditor.textModel.uri,typeId:ha.ID,editorId:e.notebookEditor.textModel.viewType}).at(0),n=i.get(Et);return o&&n.getGroup(o.groupId)?.pinEditor(o.editor),e.notebookEditor.executeNotebookCells()}});W(class extends xg{constructor(){super({id:U7i,precondition:WZe,title:d(11800,null),keybinding:{when:$u,primary:259,win:{primary:2563},weight:rf},menu:{id:D.NotebookCellExecutePrimary,when:WZe,group:"inline"},metadata:{description:d(11800,null),args:UJe},icon:HK})}parseArgs(i,...e){return BK(i,...e)}async runWithContext(i,e){let t=i.get(Et),o=i.get(ee);e.ui&&await e.notebookEditor.focusNotebookCell(e.cell,"container",{skipReveal:!0}),await VVt(t,e,o)}});W(class extends xg{constructor(){super({id:gQo,precondition:rme,title:d(11801,null),menu:[{id:D.NotebookCellExecute,when:x.and(rme,x.equals(`config.${ft.consolidatedRunButton}`,!0))},{id:D.NotebookCellTitle,order:2,group:VF,when:x.and(rme,x.equals(`config.${ft.consolidatedRunButton}`,!1))}],icon:$ao})}parseArgs(i,...e){return BK(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 xg{constructor(){super({id:hQo,precondition:rme,title:d(11805,null),menu:[{id:D.NotebookCellExecute,when:x.and(rme,x.equals(`config.${ft.consolidatedRunButton}`,!0))},{id:D.NotebookCellTitle,order:3,group:VF,when:x.and(rme,x.equals(`config.${ft.consolidatedRunButton}`,!1))}],icon:qao})}parseArgs(i,...e){return BK(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 xg{constructor(){super({id:mQo,precondition:WZe,title:d(11802,null),metadata:{description:d(11802,null),args:UJe},icon:HK})}parseArgs(i,...e){return BK(i,...e)}async runWithContext(i,e){let t=i.get(Et),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 VVt(t,e,o)}});var Xco=x.or(x.equals(xpe.key,"executing"),x.equals(xpe.key,"pending"));W(class extends xg{constructor(){super({id:pQo,precondition:Xco,title:d(11798,null),icon:CWt,menu:{id:D.NotebookCellExecutePrimary,when:Xco,group:"inline"},metadata:{description:d(11798,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 BK(i,...e)}async runWithContext(i,e){return e.ui?(await e.notebookEditor.focusNotebookCell(e.cell,"container",{skipReveal:!0}),e.notebookEditor.cancelNotebookCells(ht.single(e.cell))):e.notebookEditor.cancelNotebookCells(e.selectedCells)}});W(class extends gd{constructor(){super({id:jco,precondition:x.or(WZe,hS.isEqualTo("markup")),title:d(11804,null),keybinding:{when:x.and($u,Y4.negate()),primary:1027,weight:rf}})}async runWithContext(i,e){let t=i.get(Et),o=i.get(ee),n=e.notebookEditor.getCellIndex(e.cell);if(typeof n!="number")return;let r=i.get(kt),l=i.get(B).getValue(ft.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,jco),u)await e.notebookEditor.focusNotebookCell(u,"container",c);else{let p=SB(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=SB(r,e.notebookEditor,n,2,"below");p&&await e.notebookEditor.focusNotebookCell(p,"editor",c)}return VVt(t,e,o)}}});W(class extends gd{constructor(){super({id:Qco,precondition:x.or(WZe,hS.isEqualTo("markup")),title:d(11803,null),keybinding:{when:$u,primary:515,weight:rf}})}async runWithContext(i,e){let t=i.get(Et),o=i.get(ee),n=e.notebookEditor.getCellIndex(e.cell),r=i.get(kt),s=e.cell.focusMode===1?"editor":"container",l=SB(r,e.notebookEditor,n,e.cell.cellKind,"below");l&&await e.notebookEditor.focusNotebookCell(l,s),e.cell.cellKind===1?e.cell.updateEditState(0,Qco):VVt(t,e,o)}});var WVt=class extends qu{getEditorContextFromArgsOrActive(i,e){return wWt(i,e)??Epe(i.get(ee))}async runWithContext(i,e){return e.notebookEditor.cancelNotebookCells()}};W(class extends WVt{constructor(){super({id:dQo,title:L(11799,"Stop Execution"),icon:CWt,menu:[{id:D.EditorTitle,order:-1,group:"navigation",when:x.and(Ua,mB,hB.toNegated(),x.notEquals("config.notebook.globalToolbar",!0))},{id:D.NotebookToolbar,order:-1,group:"navigation/execute",when:x.and(mB,hB.toNegated(),x.equals("config.notebook.globalToolbar",!0))}]})}});W(class extends WVt{constructor(){super({id:uQo,title:L(11807,"Interrupt"),precondition:x.and(mB,hB),icon:CWt,menu:[{id:D.EditorTitle,order:-1,group:"navigation",when:x.and(Ua,mB,hB,x.notEquals("config.notebook.globalToolbar",!0))},{id:D.NotebookToolbar,order:-1,group:"navigation/execute",when:x.and(mB,hB,x.equals("config.notebook.globalToolbar",!0))},{id:D.InteractiveToolbar,group:"navigation/execute"}]})}});fe.appendMenuItem(D.NotebookToolbar,{title:d(11812,null),submenu:D.NotebookCellExecuteGoTo,group:"navigation/execute",order:20,icon:q.modify(Sw,"spin")});W(class extends qu{constructor(){super({id:vQo,title:d(11811,null),tooltip:d(11811,null),shortTitle:d(11811,null),precondition:x4,menu:[{id:D.EditorTitle,when:x.and(Ua,x4,x.notEquals("config.notebook.globalToolbar",!0)),group:"navigation",order:0},{id:D.NotebookCellExecuteGoTo,when:x.and(Ua,x4,x.equals("config.notebook.globalToolbar",!0)),group:"navigation/execute",order:20},{id:D.InteractiveToolbar,when:x.and(x4,x.equals("activeEditor","workbench.editor.interactive")),group:"navigation",order:10}],icon:q.modify(Sw,"spin")})}async runWithContext(i,e){let t=i.get(rs),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(Li);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 qu{constructor(){super({id:bQo,title:d(11809,null),tooltip:d(11809,null),shortTitle:d(11810,null),precondition:YLe,menu:[{id:D.EditorTitle,when:x.and(Ua,YLe,x4.toNegated(),x.notEquals("config.notebook.globalToolbar",!0)),group:"navigation",order:0},{id:D.NotebookCellExecuteGoTo,when:x.and(Ua,YLe,x4.toNegated(),x.equals("config.notebook.globalToolbar",!0)),group:"navigation/execute",order:20}],icon:oRe})}async runWithContext(i,e){let t=i.get(rs),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 gy;(i=>i.Id="outline")(gy||={});var BVt=new Q("outlineFollowsCursor",!1),HVt=new Q("outlineFiltersOnType",!1),IMe=new Q("outlineSortMode",0),VZe=new Q("outlineAllCollapsed",!1),edo=new Q("outlineFocused",!0);var GZe=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"}},BZe=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=GZe.templateId}renderTemplate(i){let e=new P;i.classList.add("notebook-outline-element","show-file-icons");let t=document.createElement("div");i.append(t);let o=new Lc(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 GZe(i,t,o,n,r,e)}renderElement(i,e,t){let o=[],n={matches:ua(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(...Y1(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?uL:d9);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));$f.CellKind.bindTo(h).set(r?2:1),$f.CellHasChildren.bindTo(h).set(p>0),$f.CellHasHeader.bindTo(h).set(i.element.level!==7),$f.OutlineElementTarget.bindTo(h).set(this._target),this.setupFolding(r,c,h,t,l);let g=t.elementDisposables.add(new Ju(t.actionMenu,this._contextMenuService,{actionViewItemProvider:b=>{if(b instanceof Eo)return this._instantiationService.createInstance(ml,b,void 0)}})),f=t.elementDisposables.add(this._menuService.createMenu(D.NotebookOutlineActionMenu,h)),v=zwi(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=$f.CellFoldingState.bindTo(t);s.set(r),i||o.elementDisposables.add(e.onDidFoldingStateChanged(()=>{let l=n.foldingState;$f.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=zwi(t,{notebookEditor:i,outlineEntry:n});l=()=>e.setActions(u.primary,u.secondary);return}let c=zwi(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&&(nn(()=>{l?.()},0,r.elementDisposables),l=void 0)}))}};BZe=I([m(2,De),m(3,B),m(4,ze),m(5,X),m(6,qt),m(7,F)],BZe);function zwi(a,i){return hl(a.getActions({shouldForwardArgs:!0,arg:i}),e=>/^inline/.test(e))}var Kwi=class{getAriaLabel(i){return i.label}getWidgetAriaLabel(){return""}},Gwi=class{getKeyboardNavigationLabel(i){return i.label}},$wi=class{getHeight(i){return 22}getTemplateId(i){return GZe.templateId}},HZe=class{constructor(i,e,t){this.notebookCellOutlineDataSourceRef=i;this._configurationService=e;this._themeService=t;this._disposables=new P;this.gotoShowCodeCellSymbols=this._configurationService.getValue(ft.gotoSymbolsAllSymbols),this._disposables.add(this._configurationService.onDidChangeConfiguration(o=>{o.affectsConfiguration(ft.gotoSymbolsAllSymbols)&&(this.gotoShowCodeCellSymbols=this._configurationService.getValue(ft.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?Y1(s.cell.language??""):void 0})}return e}dispose(){this._disposables.dispose()}};HZe=I([m(1,B),m(2,De)],HZe);function qwi(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 UZe=class{constructor(i,e){this.outlineDataSourceRef=i;this._configurationService=e;this._disposables=new P;this.showCodeCells=this._configurationService.getValue(ft.outlineShowCodeCells),this.showCodeCellSymbols=this._configurationService.getValue(ft.outlineShowCodeCellSymbols),this.showMarkdownHeadersOnly=this._configurationService.getValue(ft.outlineShowMarkdownHeadersOnly),this._disposables.add(this._configurationService.onDidChangeConfiguration(t=>{t.affectsConfiguration(ft.outlineShowCodeCells)&&(this.showCodeCells=this._configurationService.getValue(ft.outlineShowCodeCells)),t.affectsConfiguration(ft.outlineShowCodeCellSymbols)&&(this.showCodeCellSymbols=this._configurationService.getValue(ft.outlineShowCodeCellSymbols)),t.affectsConfiguration(ft.outlineShowMarkdownHeadersOnly)&&(this.showMarkdownHeadersOnly=this._configurationService.getValue(ft.outlineShowMarkdownHeadersOnly))}))}getActiveEntry(){let i=this.outlineDataSourceRef?.object?.activeElement;if(!i)return;if(!qwi(i,this.showMarkdownHeadersOnly,this.showCodeCells,this.showCodeCellSymbols))return i;let e=i.parent;for(;e;)if(qwi(e,this.showMarkdownHeadersOnly,this.showCodeCells,this.showCodeCellSymbols))e=e.parent;else return e}*getChildren(i){let t=i instanceof yMe?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()}};UZe=I([m(1,B)],UZe);var zZe=class{constructor(i,e){this.outlineDataSourceRef=i;this._configurationService=e;this._disposables=new P;this.showCodeCells=this._configurationService.getValue(ft.breadcrumbsShowCodeCells),this._disposables.add(this._configurationService.onDidChangeConfiguration(t=>{t.affectsConfiguration(ft.breadcrumbsShowCodeCells)&&(this.showCodeCells=this._configurationService.getValue(ft.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()}};zZe=I([m(1,B)],zZe);var jwi=class{constructor(){this._collator=Wu.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)}},yMe=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 P;this._modelDisposables=new P;this._dataSourceDisposables=new P;this._onDidChange=new E;this.onDidChange=this._onDidChange.event;this.delayerRecomputeState=this._disposables.add(new jo(300));this.delayerRecomputeActive=this._disposables.add(new jo(200));this.delayerRecomputeSymbols=this._disposables.add(new jo(2e3));this.outlineShowCodeCells=this._configurationService.getValue(ft.outlineShowCodeCells),this.outlineShowCodeCellSymbols=this._configurationService.getValue(ft.outlineShowCodeCellSymbols),this.outlineShowMarkdownHeadersOnly=this._configurationService.getValue(ft.outlineShowMarkdownHeadersOnly),this.initializeOutline();let c=new $wi,u=[this._instantiationService.createInstance(BZe,this._editor.getControl(),this._target)],p=new jwi,h={collapseByDefault:this._target===2||this._target===1&&this._configurationService.getValue("outline.collapseItems")==="alwaysCollapse",expandOnlyOnTwistieClick:!0,multipleSelectionSupport:!1,accessibilityProvider:new Kwi,identityProvider:{getId:g=>g.cell.uri.toString()},keyboardNavigationLabelProvider:new Gwi};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=>!qwi(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(ft.outlineShowMarkdownHeadersOnly)||i.affectsConfiguration(ft.outlineShowCodeCells)||i.affectsConfiguration(ft.outlineShowCodeCellSymbols)||i.affectsConfiguration(ft.breadcrumbsShowCodeCells))&&(this.outlineShowCodeCells=this._configurationService.getValue(ft.outlineShowCodeCells),this.outlineShowCodeCellSymbols=this._configurationService.getValue(ft.outlineShowCodeCellSymbols),this.outlineShowMarkdownHeadersOnly=this._configurationService.getValue(ft.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(ft.outlineShowCodeCellSymbols)&&(this.outlineShowCodeCellSymbols=this._configurationService.getValue(ft.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($Re).getOrCreate(i))),this._dataSourceDisposables.add(this._outlineDataSourceReference.object.onDidChange(()=>{this._onDidChange.fire({})}))):this._outlineDataSourceReference=void 0,this._treeDataSource=this._dataSourceDisposables.add(this._instantiationService.createInstance(UZe,this._outlineDataSourceReference)),this._quickPickDataSource=this._dataSourceDisposables.add(this._instantiationService.createInstance(HZe,this._outlineDataSourceReference)),this._breadcrumbsDataSource=this._dataSourceDisposables.add(this._instantiationService.createInstance(zZe,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=ve.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?vn:void 0)}preview(i){let e=this._editor.getControl();if(!e)return C.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()}};yMe=I([m(2,De),m(3,ee),m(4,F),m(5,B),m(6,zt),m(7,rs)],yMe);var KZe=class{constructor(i,e){this._instantiationService=e;let t=i.registerOutlineCreator(this);this.dispose=()=>t.dispose()}matches(i){return i.getId()===uD.ID}async createOutline(i,e,t){let o=this._instantiationService.createInstance(yMe,i,e);return e===4&&await o.doComputeSymbols(t),o}};KZe=I([m(0,kR),m(1,F)],KZe);var $f={CellKind:new Q("notebookCellKind",void 0),CellHasChildren:new Q("notebookCellHasChildren",!1),CellHasHeader:new Q("notebookCellHasHeader",!1),CellFoldingState:new Q("notebookCellFoldingState",0),OutlineElementTarget:new Q("notebookOutlineElementTarget",void 0)};oe.as(Qi.Workbench).registerWorkbenchContribution(KZe,4);oe.as(ii.Configuration).registerConfiguration({id:"notebook",order:100,type:"object",properties:{[ft.outlineShowMarkdownHeadersOnly]:{type:"boolean",default:!0,markdownDescription:d(11730,null)},[ft.outlineShowCodeCells]:{type:"boolean",default:!1,markdownDescription:d(11728,null)},[ft.outlineShowCodeCellSymbols]:{type:"boolean",default:!0,markdownDescription:d(11729,null)},[ft.breadcrumbsShowCodeCells]:{type:"boolean",default:!0,markdownDescription:d(11725,null)},[ft.gotoSymbolsAllSymbols]:{type:"boolean",default:!0,markdownDescription:d(11727,null)}}});fe.appendMenuItem(D.ViewTitle,{submenu:D.NotebookOutlineFilter,title:d(11726,null),icon:M.filter,group:"navigation",order:-1,when:x.and(x.equals("view",gy.Id),Ua)});W(class extends K{constructor(){super({id:"notebook.outline.toggleShowMarkdownHeadersOnly",title:d(11733,null),f1:!1,toggled:{condition:x.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(ft.outlineShowMarkdownHeadersOnly);t.updateValue(ft.outlineShowMarkdownHeadersOnly,!o)}});W(class extends K{constructor(){super({id:"notebook.outline.toggleCodeCells",title:d(11731,null),f1:!1,toggled:{condition:x.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(ft.outlineShowCodeCells);t.updateValue(ft.outlineShowCodeCells,!o)}});W(class extends K{constructor(){super({id:"notebook.outline.toggleCodeCellSymbols",title:d(11732,null),f1:!1,toggled:{condition:x.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(ft.outlineShowCodeCellSymbols);t.updateValue(ft.outlineShowCodeCellSymbols,!o)}});var Qwi=class extends K{constructor(){super({id:"notebook.section.runSingleCell",title:{...L(11866,"Run Cell"),mnemonicTitle:d(11864,null)},shortTitle:d(11867,null),icon:HK,menu:[{id:D.NotebookOutlineActionMenu,group:"inline",order:1,when:x.and($f.CellKind.isEqualTo(2),$f.OutlineElementTarget.isEqualTo(1),$f.CellHasChildren.toNegated(),$f.CellHasHeader.toNegated())}]})}async run(i,e){UVt(e)&&e.notebookEditor.executeNotebookCells([e.outlineEntry.cell])}},Ywi=class extends K{constructor(){super({id:"notebook.section.runCells",title:{...L(11868,"Run Cells In Section"),mnemonicTitle:d(11865,null)},shortTitle:d(11869,null),icon:HK,menu:[{id:D.NotebookStickyScrollContext,group:"notebookExecution",order:1},{id:D.NotebookOutlineActionMenu,group:"inline",order:1,when:x.and($f.CellKind.isEqualTo(1),$f.OutlineElementTarget.isEqualTo(1),$f.CellHasChildren,$f.CellHasHeader)},{id:D.NotebookCellTitle,order:0,group:VF,when:Jco}]})}async run(i,e){let t;if(UVt(e))t=e.outlineEntry.cell;else if(wQo(e))t=e.cell;else return;t.getEditState()===1&&e.notebookEditor.getContribution(BR.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)}},Xwi=class extends K{constructor(){super({id:"notebook.section.foldSection",title:{...L(11860,"Fold Section"),mnemonicTitle:d(11863,null)},shortTitle:d(11861,null),menu:[{id:D.NotebookOutlineActionMenu,group:"notebookFolding",order:2,when:x.and($f.CellKind.isEqualTo(1),$f.OutlineElementTarget.isEqualTo(1),$f.CellHasChildren,$f.CellHasHeader,$f.CellFoldingState.isEqualTo(1))}]})}async run(i,e){UVt(e)&&this.toggleFoldRange(e.outlineEntry,e.notebookEditor)}toggleFoldRange(i,e){let t=e.getContribution(BR.id),o=i.index,n=i.level,r=2;t.setFoldingStateDown(o,r,n)}},Jwi=class extends K{constructor(){super({id:"notebook.section.expandSection",title:{...L(11858,"Expand Section"),mnemonicTitle:d(11862,null)},shortTitle:d(11859,null),menu:[{id:D.NotebookOutlineActionMenu,group:"notebookFolding",order:2,when:x.and($f.CellKind.isEqualTo(1),$f.OutlineElementTarget.isEqualTo(1),$f.CellHasChildren,$f.CellHasHeader,$f.CellFoldingState.isEqualTo(2))}]})}async run(i,e){UVt(e)&&this.toggleFoldRange(e.outlineEntry,e.notebookEditor)}toggleFoldRange(i,e){let t=e.getContribution(BR.id),o=i.index,n=i.level,r=1;t.setFoldingStateDown(o,r,n)}};function UVt(a){return!!(a&&a.notebookEditor&&a.outlineEntry)}function wQo(a){return!!(a&&a.notebookEditor&&a.cell)}W(Qwi);W(Ywi);W(Xwi);W(Jwi);W(class extends K{constructor(){super({id:"workbench.notebook.layout.select",title:L(11849,"Select between Notebook Layouts"),f1:!0,precondition:x.equals(`config.${ft.openGettingStarted}`,!0),category:jm,menu:[{id:D.EditorTitle,group:"notebookLayout",when:x.and(Ua,x.notEquals("config.notebook.globalToolbar",!0),x.equals(`config.${ft.openGettingStarted}`,!0)),order:0},{id:D.NotebookToolbar,group:"notebookLayout",when:x.and(x.equals("config.notebook.globalToolbar",!0),x.equals(`config.${ft.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(11848,"Customize Notebook Layout"),f1:!0,category:jm,menu:[{id:D.NotebookToolbar,group:"notebookLayout",when:x.equals("config.notebook.globalToolbar",!0),order:1}]})}run(i){i.get(Po).openSettings({jsonEditor:!1,query:"@tag:notebookLayout"})}});W(class extends K{constructor(){super({id:"workbench.notebook.layout.configure.editorTitle",title:L(11848,"Customize Notebook Layout"),f1:!1,category:jm,menu:[{id:D.NotebookEditorLayoutConfigure,group:"notebookLayout",when:Ua,order:1}]})}run(i){i.get(Po).openSettings({jsonEditor:!1,query:"@tag:notebookLayout"})}});fe.appendMenuItem(D.EditorTitle,{submenu:D.NotebookEditorLayoutConfigure,title:L(11833,"Customize Notebook..."),icon:M.gear,group:"navigation",order:-1,when:Ua});W(class extends K{constructor(){super({id:"notebook.toggleLineNumbersFromEditorTitle",title:L(11841,"Toggle Notebook Line Numbers"),shortTitle:L(11842,"Line Numbers"),precondition:rr,menu:[{id:D.NotebookEditorLayoutConfigure,group:"notebookLayoutDetails",order:1,when:Ua}],category:jm,f1:!0,toggled:{condition:x.notEquals("config.notebook.lineNumbers","off"),title:d(11837,null)}})}async run(i){return i.get(ge).executeCommand("notebook.toggleLineNumbers")}});W(class extends K{constructor(){super({id:"notebook.toggleCellToolbarPositionFromEditorTitle",title:L(11840,"Toggle Cell Toolbar Position"),menu:[{id:D.NotebookEditorLayoutConfigure,group:"notebookLayoutDetails",order:3}],category:jm,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(11838,"Toggle Breadcrumbs"),shortTitle:L(11839,"Breadcrumbs"),toggled:{condition:x.equals("config.breadcrumbs.enabled",!0),title:d(11832,null)},menu:[{id:D.NotebookEditorLayoutConfigure,group:"notebookLayoutDetails",order:2}],category:jm,f1:!1})}async run(i){return i.get(ge).executeCommand("breadcrumbs.toggle")}});W(class extends K{constructor(){super({id:"notebook.saveMimeTypeOrder",title:L(11836,"Save Mimetype Display Order"),f1:!0,category:jm,precondition:Ua})}run(i){let e=i.get(un),t=new P,o=t.add(i.get(Ge).createQuickPick());o.placeholder=d(11835,null),o.items=[{target:2,label:d(11844,null)},{target:5,label:d(11845,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(11850,"Reset Notebook Webview"),f1:!1,category:jm})}run(i,e){let t=i.get(ee);if(e){let o=A.revive(e),r=i.get(Zc).listNotebookEditors().filter(s=>s.hasModel()&&s.textModel.uri.toString()===o.toString());for(let s of r)s.hasModel()&&s.getInnerWebview()?.reload()}else{let o=qn(t.activeEditorPane);if(!o)return;o.getInnerWebview()?.reload()}}});W(class extends K{constructor(){super({id:"notebook.action.toggleNotebookStickyScroll",title:{...L(11846,"Toggle Notebook Sticky Scroll"),mnemonicTitle:d(11834,null)},shortTitle:L(11847,"Sticky Scroll"),category:We.View,toggled:{condition:x.equals("config.notebook.stickyScroll.enabled",!0),title:d(11843,null),mnemonicTitle:d(11834,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 wMe=ae("IWebContentExtractorService"),t2=ae("ISharedWebContentExtractorService");var $Ze=["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 zVt(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(Ra(r));return{value:p,id:p.toString(),name:d(11653,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 JZ=class a{constructor(i,e,t,o,n,r={},s){this.toolCallId=t;this.kind="toolInvocation";this._progress=Le(this,{progress:0});this._partialInput=Le(this,void 0);this._streamingMessage=Le(this,void 0);let l="";r.startInStreaming?l=d(7628,null,e.displayName):r.startInCancelled&&(l=r.cancelReasonMessage??d(7627,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.source=e.source,this.subAgentInvocationId=o,this.parameters=n,this.chatRequestId=s,r.startInCancelled?this._state=Le(this,{type:lo.StateKind.Cancelled,reason:r.cancelReason??0,reasonMessage:r.cancelReasonMessage,parameters:this.parameters,confirmationMessages:this.confirmationMessages}):r.startInStreaming?this._state=Le(this,{type:lo.StateKind.Streaming,partialInput:this._partialInput,streamingMessage:this._streamingMessage}):this.confirmationMessages?.title?this._state=Le(this,{type:lo.StateKind.WaitingForConfirmation,parameters:this.parameters,confirmationMessages:this.confirmationMessages,confirm:c=>{c.type===0||c.type===5?this._state.set({type:lo.StateKind.Cancelled,reason:c.type,parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0):this._state.set({type:lo.StateKind.Executing,confirmed:c,progress:this._progress,parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0)}}):this._state=Le(this,{type:lo.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===lo.StateKind.Streaming&&this._partialInput.set(i,void 0)}updateStreamingMessage(i){this._state.get().type===lo.StateKind.Streaming&&this._streamingMessage.set(i,void 0)}cancelFromStreaming(i,e){return this._state.get().type!==lo.StateKind.Streaming?!1:(this._state.set({type:lo.StateKind.Cancelled,reason:i,reasonMessage:e,parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0),!0)}transitionFromStreaming(i,e,t){if(this._state.get().type!==lo.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:lo.StateKind.Cancelled,reason:s.type,parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0):this._state.set({type:lo.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:lo.StateKind.WaitingForConfirmation,parameters:this.parameters,confirmationMessages:this.confirmationMessages,confirm:r},void 0):this._state.set({type:lo.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:lo.StateKind.Cancelled,reason:e.type,parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0);return}this._state.set({type:lo.StateKind.Completed,confirmed:lo.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:lo.StateKind.WaitingForPostApproval,confirmed:lo.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===lo.StateKind.WaitingForPostApproval,e=i?void 0:lo.resultDetails(this);return{kind:"toolInvocationSerialized",presentation:this.presentation,invocationMessage:this.invocationMessage,pastTenseMessage:this.pastTenseMessage,originMessage:this.originMessage,isConfirmed:i?{type:5}:lo.executionConfirmedOrDenied(this),isComplete:!0,source:this.source,resultDetails:zj(e)?{output:{type:"data",mimeType:e.output.mimeType,base64Data:Qd(e.output.value)}}:e,toolSpecificData:this.toolSpecificData,toolCallId:this.toolCallId,toolId:this.toolId,subAgentInvocationId:this.subAgentInvocationId,generatedTitle:this.generatedTitle}}};var $Vt={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp"};function X4(a){return Object.entries($Vt).find(([i,e])=>e===a)?.[0]}var tdo;(i=>{function a(e){return{variables:e.variables.map(uV.toExport)}}i.toExport=a})(tdo||={});function CQo(a){let i=a;return!!i&&!!i.edit&&!!i.uri&&A.isUri(i.uri)}function xMe(a){return a.some(CQo)}var xQo=new Set(["toolInvocation","toolInvocationSerialized","undoStop"]);function kQo(a){return!xQo.has(a.kind)}function ido(a){return a.filter(kQo)}var qF={reason:"other"},yB=class{constructor(i){this._shouldBeBlocked=Le(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_"+_t(),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}},KVt=class{constructor(i){this._responseRepr="";this._markdownContent="";this._responseParts=i,this._updateRepr()}get value(){return this._responseParts}toString(){return this._responseRepr}getMarkdown(){return this._markdownContent}_updateRepr(){this._responseRepr=this.partsToRepr(this._responseParts),this._markdownContent=this._responseParts.map(i=>i.kind==="inlineReference"?this.inlineRefToRepr(i):i.kind==="markdownContent"||i.kind==="markdownVuln"?i.content.value:"").filter(i=>i.length>0).join("")}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 xe){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(7623,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=fR(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"&&lo.isComplete(i)){let n=lo.resultDetails(i);if(n&&"input"in n){let r=i.kind==="toolInvocationSerialized"||lo.isComplete(i)?"Completed":"Errored";o+=`
${r} with input: ${n.input}`}}return{text:o,isBlock:!0}}uriToRepr(i){return i.scheme===Y.http||i.scheme===Y.https?i.toString(!1):Ye(i)}},Zwi=class extends KVt{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}},eCi=class extends KVt{constructor(e){super(Yl(e).map(t=>"kind"in t?t:Mr(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._updateRepr(!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 xe(e)}),this._updateRepr(!0)}updateContent(e,t){if(e.kind==="clearToPreviousToolInvocation"){e.reason===2?this.clearToPreviousToolInvocation(d(7622,null)):e.reason===1?this.clearToPreviousToolInvocation(d(7624,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"||!GVt(o.content,e.content))this._responseParts.push(e);else{let n=this._responseParts.indexOf(o);this._responseParts[n]={...o,content:ZZ(o.content,e.content)}}this._updateRepr(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)||!GVt(new xe(n),new xe(r)))this._responseParts.push(e);else{let l=this._responseParts.indexOf(o);this._responseParts[l]={...o,value:ZZ(new xe(n),new xe(r)).value}}this._updateRepr(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._updateRepr(t)}else if(e.kind==="progressTask"){let o=this._responseParts.push(e)-1;this._updateRepr(t);let n=e.onDidAddProgress(()=>{this._updateRepr(!1)});e.task?.().then(r=>{n.dispose(),typeof r=="string"&&(this._responseParts[o].content=new xe(r)),this._updateRepr(!1)})}else e.kind==="toolInvocation"?(ux(o=>{e.state.read(o),this._updateRepr(!1),lo.isComplete(e,o)&&o.dispose()}),this._responseParts.push(e),this._updateRepr(t)):e.kind==="externalToolInvocationUpdate"?(this._handleExternalToolInvocationUpdate(e),this._updateRepr(t)):(this._responseParts.push(e),this._updateRepr(t))}addCitation(e){this._citations.push(e),this._updateRepr()}_mergeOrPushTextEditGroup(e,t,o,n){for(let r of this._responseParts)if(r.kind==="textEditGroup"&&!r.done&&Xe(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&&Xe(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.isComplete&&t.didExecuteTool({content:[],toolResultMessage:e.pastTenseMessage,toolResultError:e.errorMessage}),e.toolSpecificData!==void 0&&(t.toolSpecificData=e.toolSpecificData);return}let o={id:e.toolName,source:Rn.External,displayName:e.toolName,modelDescription:e.toolName},n=new JZ({invocationMessage:e.invocationMessage,pastTenseMessage:e.pastTenseMessage,toolSpecificData:e.toolSpecificData},o,e.toolCallId,e.subagentInvocationId,void 0,{},void 0);e.isComplete&&(n.didExecuteTool({content:[],toolResultMessage:e.pastTenseMessage,toolResultError:e.errorMessage}),e.toolSpecificData!==void 0&&(n.toolSpecificData=e.toolSpecificData)),this._responseParts.push(n)}_updateRepr(e){super._updateRepr(),this._onDidChangeValue&&(this._responseRepr+=this._citations.length?`

`+nCi(this._citations):"",e||this._onDidChangeValue.fire())}},CMe=class extends C{constructor(e){super();this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._modelState=Le(this,{value:0});this._shouldBeBlocked=Le(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._voteDownReason=e.voteDownReason,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||Mr(e.responseContent)&&e.responseContent.value.length!==0),this._response=this._register(new eCi(e.responseContent)),this._codeBlockInfos=e.codeBlockInfos?[...e.codeBlockInfos]:void 0;let t=Nr(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===lo.StateKind.WaitingForConfirmation){let p=u.confirmationMessages?.title;return p?Mr(p)?p.value:p:void 0}if(u.type===lo.StateKind.WaitingForPostApproval)return d(7626,null)}if(c.kind==="confirmation"&&!c.isUsed)return c.title;if(c.kind==="questionCarousel"&&!c.isUsed)return d(7625,null);if(c.kind==="elicitation2"&&c.state.read(l)==="pending"){let u=c.title;return Mr(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(qF))),this.id=e.restoredId??"response_"+_t();let r;this.confirmationAdjustedTimestamp=Ce(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(qF))}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 voteDownReason(){return this._voteDownReason}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 Zwi(this._response,e)),this._responseView):this._finalizedResponse||this._response}get codeBlockInfos(){return this._codeBlockInfos}initializeCodeBlockInfos(e){if(this._codeBlockInfos)throw new ni("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(qF))}applyCodeCitation(e){this._codeCitations.push(e),this._response.addCitation(e),this._onDidChange.fire(qF)}setAgent(e,t){this._agent=e,this._slashCommand=t,this._agentOrSlashCommandDetected=!e.isDefault||!!t,this._onDidChange.fire(qF)}setResult(e){this._result=e,this._onDidChange.fire(qF)}setUsage(e){this._usage=e,this._onDidChange.fire(qF)}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(qF)}setVote(e){this._vote=e,this._onDidChange.fire(qF)}setVoteDownReason(e){this._voteDownReason=e,this._onDidChange.fire(qF)}setEditApplied(e,t){return!this.response.value.includes(e)||!e.state?!1:(e.state.applied=t,this._onDidChange.fire(qF),!0)}adoptTo(e){this._session=e,this._onDidChange.fire(qF)}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,voteDownReason:this.voteDownReason,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 qVt(a){return EQo(a),"version"in a?a.version===2?{...a,version:3,customTitle:a.computedTitle}:a:{version:3,...a,customTitle:void 0}}function EQo(a){a.sessionId||(a.sessionId=_t()),a.creationDate||(a.creationDate=TQo()),a.initialLocation==="editing-session"&&(a.initialLocation="panel")}function TQo(){let a=new Date;return a.setFullYear(a.getFullYear()-1),a.getTime()}function jVt(a){return!!a&&Array.isArray(a.requests)&&typeof a.responderUsername=="string"}function _Qo(a){let i=a;return jVt(a)&&typeof i.creationDate=="number"&&typeof i.sessionId=="string"&&a.requests.every(e=>!e.usedContext||MYi(e.usedContext))}var tCi=class{constructor(i){this._state=rg({debugName:"inputModelState",equalsFn:uo},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=>!(MY(t)||CYi(t)&&qx(t.value)));return{contrib:i.contrib,attachments:e,mode:i.mode,selectedModel:i.selectedModel?{identifier:i.selectedModel.identifier,metadata:i.selectedModel.metadata}:void 0,inputText:i.inputText,selections:i.selections}}},Eb=class extends C{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 vt;this._checkpoint=void 0;let l=e?.value,c=jVt(l),u=c&&_Qo(l);l&&!c&&this.logService.warn(`ChatModel#constructor: Loaded malformed session data: ${JSON.stringify(l)}`),this._isImported=!!l&&c&&!u,t.resource?(this._sessionId=P_(t.resource),this._sessionResource=t.resource):u?(this._sessionId=l.sessionId,this._sessionResource=cs.forSession(l.sessionId)):(this._sessionId=_t(),this._sessionResource=cs.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 tCi(p&&{attachments:p.attachments,mode:p.mode,selectedModel:p.selectedModel&&{identifier:p.selectedModel.identifier,metadata:p.selectedModel.metadata},contrib:p.contrib,inputText:p.inputText,selections:p.selections}),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(he(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(he(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||Eb.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(he(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(he(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=Wo(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):EYi(e.message),o=this.reviveVariableData(e.variableData),n=new yB({session:this,message:t,variableData:o,timestamp:e.timestamp??-1,restoredId:e.requestId,confirmation:e.confirmation,editedFileEvents:e.editedFileEvents,modelId:e.modelId});if(n.shouldBeRemovedOnSend=e.isHidden?{requestId:e.requestId}:e.shouldBeRemovedOnSend,e.response||e.result||e.responseErrorDetails){let r=e.agent&&"metadata"in e.agent?pTt(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)Wo(c,{kind:!0})&&c.kind==="questionCarousel"&&(c.isUsed=!0);n.response=new CMe({responseContent:e.response??[new xe(e.response)],session:this,agent:r,slashCommand:e.slashCommand,requestId:n.id,modelState:l,vote:e.vote,timestamp:e.timestamp,voteDownReason:e.voteDownReason,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(Xn(e.usedContext)),e.contentReferences?.forEach(c=>n.response.applyReference(Xn(c))),e.codeCitations?.forEach(c=>n.response.applyCodeCitation(Xn(c)))}return n}reviveVariableData(e){let t=e&&Array.isArray(e.variables)?e:{variables:[]};return t.variables=t.variables.map(uV.fromExport),t}getParsedRequestFromString(e){let t=[new pb(new di(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?Oo(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 yB({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 CMe({responseContent:[],session:this,agent:r,slashCommand:s,requestId:b.id,isCompleteAddedRequest:p,codeBlockInfos:void 0}),this._requests.push(b),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 CMe({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??_t(),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 CMe({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:tdo.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,...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()}};Eb=I([m(2,ne),m(3,br),m(4,dl),m(5,Si)],Eb);function oCi(a,i){return{variables:a.variables.map(e=>({...e,range:e.range&&{start:e.range.start-i,endExclusive:e.range.endExclusive-i}}))}}function GVt(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 uo(a.isTrusted,i.isTrusted)&&a.supportHtml===i.supportHtml&&a.supportThemeIcons===i.supportThemeIcons}function ZZ(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 nCi(a){if(a.length===0)return"";let i=a.reduce((t,o)=>t.add(o.license),new Set);return i.size===1?d(7620,null,i.size):d(7621,null,i.size)}function odo(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 wB;(t=>{t.scheme="vscode-chat-response-resource";function i(o,n,r,s){return A.from({scheme:t.scheme,authority:b$(Je.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<5)return;let[,r,s,l]=n;if(r!=="tool")return;let c;try{c=A.parse(Fbe(o.authority).toString())}catch(u){if(u instanceof SyntaxError)c=cs.forSession(o.authority);else throw u}return{sessionResource:c,toolCallId:s,index:Number(l)}}t.parseUri=e})(wB||={});var QVt="application/vnd.code.additional-editor-data",qZe=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 Is("chat.attach.image");this.providedPasteEditKinds=[this.kind];this.copyMimeTypes=[];this.pasteMimeTypes=["image/*"];this.imagesFolder=je(this.environmentService.workspaceStorageHome,"vscode-chat-images"),VEt(this.fileService,this.logService,this.imagesFolder)}async provideDocumentPasteEdits(i,e,t,o,n){if(!this.extensionService.extensions.some(w=>Ea(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(7446,null),g=h;for(let w=2;p.some(k=>k.name===g);w++)g=`${h} ${w}`;let f=await WEt(this.fileService,this.imagesFolder,c,s);if(n.isCancellationRequested||!f)return;let v=await k_(c);if(n.isCancellationRequested||!v)return;let b=await DQo(v,s,n,g,f);if(n.isCancellationRequested||!b||u.attachmentModel.getAttachmentIDs().has(b.id))return;let y=ndo(i,[b],s,this.kind,d(7445,null),this.chatWidgetService);return sCi(y)}};qZe=I([m(2,be),m(3,Co),m(4,ne)],qZe);async function DQo(a,i,e,t,o){let n=await eee(a);if(!e.isCancellationRequested)return{kind:"image",value:a,id:n,name:t,icon:M.fileMedia,mimeType:i,isPasted:!0,references:[{reference:o,kind:"reference"}]}}async function eee(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 jZe(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 YVt=class{constructor(){this.providedPasteEditKinds=[];this.copyMimeTypes=[QVt];this.pasteMimeTypes=[]}async prepareDocumentPaste(i,e,t,o){if(i.uri.scheme===Y.vscodeChatInput)return;let n=new bx,r={range:e[0],uri:i.uri.toJSON()};return n.append(QVt,NN(JSON.stringify(r))),n}},CB=class{constructor(i){this.chatWidgetService=i;this.kind=new Is("chat.attach.attachments");this.providedPasteEditKinds=[this.kind];this.copyMimeTypes=[CB.ATTACHMENT_MIME_TYPE];this.pasteMimeTypes=[CB.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=WO(n);if(r.length===0&&s.length===0)return;let l=new bx;return l.append(CB.ATTACHMENT_MIME_TYPE,NN(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(JS.ID);if(!s)return;let l=t.get(Zn.text),u=await t.get(CB.ATTACHMENT_MIME_TYPE)?.asString(),p=await l?.asString();if(p===void 0||u===void 0||n.isCancellationRequested)return;let h;try{h=Xn(JSON.parse(u))}catch{}if(!Array.isArray(h?.attachments)&&!Array.isArray(h?.dynamicVariables))return;let g={insertText:p,title:d(7443,null),kind:this.kind,handledMimeType:CB.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()}}),sCi(g)}};CB=I([m(0,At)],CB);var rCi=class{constructor(i,e){this.chatWidgetService=i;this.modelService=e;this.kind=new Is("chat.attach.text");this.providedPasteEditKinds=[this.kind];this.copyMimeTypes=[];this.pasteMimeTypes=[QVt]}async provideDocumentPasteEdits(i,e,t,o,n){if(i.uri.scheme!==Y.vscodeChatInput)return;let r=t.get(Zn.text),s=t.get("vscode-editor-data"),l=t.get(QVt);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=LQo(c,A.revive(p.uri),u.mode,p.range);if(n.isCancellationRequested||!v||h.attachmentModel.getAttachmentIDs().has(v.id))return;let S=ndo(i,[v],Zn.text,this.kind,d(7444,null),this.chatWidgetService);return S.yieldTo=[{kind:Is.Empty.append("text","plain")}],sCi(S)}};function LQo(a,i,e,t){let o=Ye(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(7442,null):d(7441,null,r+1-n);return{kind:"paste",value:s,id:`${o}${n}${r}${t.startColumn}${t.endColumn}`,name:`${o} ${l}`,icon:M.code,pastedLines:l,language:e,fileName:i.toString(),copiedFrom:{uri:i,range:t},code:a,references:[{reference:i,kind:"reference"}]}}function ndo(a,i,e,t,o,n){let r=i.length===1?i[0].name:d(7440,null,i[0].name,i.length-1),s={resource:a.uri,variable:i,undo:()=>{let l=n.getWidgetByInputUri(a.uri);if(!l)throw new Error("No widget found for undo");l.attachmentModel.delete(...i.map(c=>c.id))},redo:()=>{let l=n.getWidgetByInputUri(a.uri);if(!l)throw new Error("No widget found for redo");l.attachmentModel.addContext(...i)},metadata:{needsConfirmation:!1,label:r}};return{insertText:"",title:o,kind:t,handledMimeType:e,additionalEdit:{edits:[s]}}}function sCi(a){return{edits:[a],dispose:()=>{}}}var kMe=class extends C{constructor(i,e,t,o,n,r,s,l){super(),this._register(e.documentPasteEditProvider.register({scheme:Y.vscodeChatInput,pattern:"*",hasAccessToAllModels:!0},i.createInstance(CB))),this._register(e.documentPasteEditProvider.register({scheme:Y.vscodeChatInput,pattern:"*",hasAccessToAllModels:!0},new qZe(t,o,n,s,l))),this._register(e.documentPasteEditProvider.register({scheme:Y.vscodeChatInput,pattern:"*",hasAccessToAllModels:!0},new rCi(t,r))),this._register(e.documentPasteEditProvider.register("*",new YVt)),this._register(e.documentPasteEditProvider.register("*",new YVt))}};kMe=I([m(0,F),m(1,zt),m(2,At),m(3,lt),m(4,be),m(5,Ct),m(6,Co),m(7,ne)],kMe);var jF=ae("IChatAttachmentResolveService"),EMe=class{constructor(i,e,t,o,n){this.fileService=i;this.editorService=e;this.textModelService=t;this.extensionService=o;this.dialogService=n}async resolveEditorAttachContext(i){if(Hxe(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=>Ea(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 qm);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;if(!e){let o;try{let n=await this.textModelService.createModelReference(i);o=n.object.getLanguageId(),n.dispose()}catch{t=2}if(/\.(svg)$/i.test(i.path)&&(t=2),o){let n=Mf(o);if(n==="prompt")return mP(i,"vscode.prompt.file");if(n==="instructions")return mP(i,"vscode.prompt.instructions.root")}}return{kind:e?"directory":"file",value:i,id:i.toString(),name:Ye(i),omittedState:t}}async resolveImageEditorAttachContext(i,e,t){if(!i)return;if(t){if(!X4(t))return}else{let l=rdo.exec(i.path);if(!l)return;t=MQo(l)}let o=Ye(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(5987,null),d(5988,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:M.fileMedia,resource:i,mimeType:t,omittedState:r?1:0}]))[0]}resolveImageAttachContext(i){return Promise.all(i.map(async e=>({id:e.id||await eee(e.data),name:e.name,fullName:e.resource?e.resource.path:void 0,value:await k_(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=uP.fromMarker(e):t={filterUri:A.revive(e.uri),filterSeverity:4},uP.toEntry(t)})}resolveSymbolsAttachContext(i){return i.map(e=>{let t=A.file(e.fsPath);return{kind:"symbol",id:RQo(t,e.range),value:{uri:t,range:e.range},symbolKind:e.kind,icon:sh.toIcon(e.kind),fullName:e.name,name:e.name}})}resolveNotebookOutputAttachContext(i){let e=qn(this.editorService.activeEditorPane);if(!e)return[];let t=bZe(i.outputId,e);if(!t)return[];let o=t.pickedMimeType?.mimeType;if(o&&$Ze.includes(o)){let n=zVt(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&&rdo.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"}))}};EMe=I([m(0,be),m(1,ee),m(2,Nt),m(3,lt),m(4,ct)],EMe);function RQo(a,i){let e="";return i&&(e=`:${i.startLineNumber}`,i.startLineNumber!==i.endLineNumber&&(e+=`-${i.endLineNumber}`)),a.fsPath+e}var rdo=new RegExp(`\\.(${Object.keys($Vt).join("|")})$`,"i");function MQo(a){let i=a[1].toLowerCase();return $Vt[i]}var{basename:tee,dirname:lCi}=Lo,YZe=".prompt.md",XZe=".instructions.md",o2=".chatmode.md",iee=".agent.md",J4="SKILL.md",sdo="AGENTS.md",JVt="CLAUDE.md",ado="CLAUDE.local.md",cCi=".claude",ZVt="copilot-instructions.md",JZe=".github/prompts",dCi=".github/instructions",eBt=".github/chatmodes",n2=".github/agents",i2=".claude/agents",tBt="~/.copilot/agents",aCi=".claude/rules",ldo=".github/hooks";var ZZe=[{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"}],iBt=[{path:dCi,source:"github-workspace",storage:"local"},{path:aCi,source:"claude-workspace",storage:"local"},{path:"~/.copilot/instructions",source:"copilot-personal",storage:"user"},{path:"~/"+aCi,source:"claude-personal",storage:"user"}],PQo=[{path:JZe,source:"github-workspace",storage:"local"}],AQo=[{path:n2,source:"github-workspace",storage:"local"},{path:i2,source:"claude-workspace",storage:"local"},{path:"~/"+i2,source:"claude-personal",storage:"user"},{path:tBt,source:"copilot-personal",storage:"user"}],eet=[{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:"~/.claude/settings.json",source:"claude-personal",storage:"user"}];function cdo(a){let i=lCi(a.path);return i.endsWith("/"+n2)||i.endsWith("/"+i2)||NQo(a)}function oBt(a){return lCi(a.path).endsWith("/"+i2)}function NQo(a){return lCi(a.path).endsWith(tBt.substring(1))}function oee(a){return a.path.includes("/"+aCi+"/")}function TMe(a){let i=tee(a.path);if(i.endsWith(YZe))return"prompt";if(i.endsWith(XZe)||i===ZVt)return"instructions";if(i.endsWith(o2)||i.endsWith(iee))return"agent";if(i.toLowerCase()===J4.toLowerCase())return"skill";if(i.endsWith(".md")&&i!=="README.md"&&cdo(a))return"agent";if(i.endsWith(".md")&&i!=="README.md"&&oee(a))return"instructions";if(i.toLowerCase().endsWith(".json"))return"hook"}function uCi(a){return TMe(a)!==void 0}function nBt(a){switch(a){case"instructions":return XZe;case"prompt":return YZe;case"agent":return iee;case"skill":return J4;case"hook":return".json";default:throw new Error("Unknown prompt type")}}function lme(a){switch(a){case"instructions":return iBt;case"prompt":return PQo;case"agent":return AQo;case"skill":return ZZe;case"hook":return eet;default:throw new Error("Unknown prompt type")}}function Tb(a){let i=tee(a.path),e=[YZe,XZe,o2,iee];for(let t of e)if(i.endsWith(t))return tee(a.path,t);return i===ZVt||i.toLowerCase()===J4.toLowerCase()||i.endsWith(".md")&&i!=="README.md"&&cdo(a)||i.endsWith(".md")&&i!=="README.md"&&oee(a)?tee(a.path,".md"):tee(a.path)}function ddo(a,i=[],e={}){let o=new pCi(a).scan();return new mCi(o,a,i,e).parse()}function uI(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 pCi=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(uI(13,this.pos,this.pos)),this.tokens}scanLine(){if(this.seenBlockColon=!1,this.peekChar()===`
`){this.tokens.push(uI(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(uI(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(uI(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(uI(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(uI(11,this.pos,this.pos+3)),this.pos+=3,this.scanLineContent(),this.scanNewline();return}if(t==="."&&o==="."&&n==="."&&s){this.tokens.push(uI(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(uI(4,this.pos,this.pos+1)),this.pos++;else if(i==="}"&&this.flowDepth>0)this.flowDepth--,this.tokens.push(uI(5,this.pos,this.pos+1)),this.pos++;else if(i==="[")this.flowDepth++,this.tokens.push(uI(6,this.pos,this.pos+1)),this.pos++;else if(i==="]"&&this.flowDepth>0)this.flowDepth--,this.tokens.push(uI(7,this.pos,this.pos+1)),this.pos++;else if(i===","&&this.flowDepth>0)this.tokens.push(uI(3,this.pos,this.pos+1)),this.pos++;else if(i==="-"&&this.isBlockDash())this.tokens.push(uI(2,this.pos,this.pos+1)),this.pos++;else if(i===":"&&this.isBlockColon())this.tokens.push(uI(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(uI(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(uI(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(uI(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(uI(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(uI(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(uI(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(uI(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]}},mCi=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 tet=class{constructor(){}parse(i,e){let t=a1i(e);if(t.length===0)return new rBt(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 gCi(l,i,t)}if(r<t.length){let s=new z(r+1,1,t.length+1,1);n=new fCi(s,t,i)}return new rBt(i,o,n)}},rBt=class{constructor(i,e,t){this.uri=i;this.header=e;this.body=t}},Hi;(N=>(N.name="name",N.description="description",N.agent="agent",N.mode="mode",N.model="model",N.applyTo="applyTo",N.paths="paths",N.tools="tools",N.handOffs="handoffs",N.advancedOptions="advancedOptions",N.argumentHint="argument-hint",N.excludeAgent="excludeAgent",N.target="target",N.infer="infer",N.license="license",N.compatibility="compatibility",N.metadata="metadata",N.agents="agents",N.userInvokable="user-invokable",N.userInvocable="user-invocable",N.disableModelInvocation="disable-model-invocation",N.hooks="hooks"))(Hi||={});var gCi=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=ddo(e,i),o=new AM(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(Hi.name)}get description(){return this.getStringAttribute(Hi.description)}get agent(){return this.getStringAttribute(Hi.agent)??this.getStringAttribute(Hi.mode)}get model(){return this.getStringOrStringArrayAttribute(Hi.model)}get applyTo(){return this.getStringAttribute(Hi.applyTo)}get paths(){return this.getStringOrStringArrayAttribute(Hi.paths)}get argumentHint(){return this.getStringAttribute(Hi.argumentHint)}get target(){return this.getStringAttribute(Hi.target)}get infer(){return this.getBooleanAttribute(Hi.infer)}get tools(){let i=this._parsedHeader.attributes.find(t=>t.key===Hi.tools);if(!i)return;let e=i.value;if(e.type==="scalar"&&(e=xB(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===Hi.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=hCi(u.value):u.key.value==="showContinueOn"&&u.value.type==="scalar"?l=hCi(u.value):u.key.value==="model"&&u.value.type==="scalar"&&(c=u.value.value);if(o&&n&&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(Hi.agents)}get userInvocable(){return this.getBooleanAttribute(Hi.userInvocable)??this.getBooleanAttribute(Hi.userInvokable)}get disableModelInvocation(){return this.getBooleanAttribute(Hi.disableModelInvocation)}get hooksRaw(){let i=this._parsedHeader.attributes.find(e=>e.key===Hi.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 hCi(e.value)}};function hCi(a){if(a.value==="true")return!0;if(a.value==="false")return!1}var fCi=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=ht.reduce(ht.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(U=>z.areIntersectingOrTouching(U,k))||f(y.index))continue;let T=y.groups?.filePath||y.groups?.toolName;if(!T)continue;let N=y.index+w.length-T.length,O=y.index+w.length,V=new z(l+1,N+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 je(e,i)}}catch{return}}};function xB(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 Z4;(e=>(e.mcpServers="mcp-servers",e.github="github"))(Z4||={});var oet;(i=>i.disallowedTools="disallowedTools")(oet||={});function aBt(a){return a==="vscode"||a==="github-copilot"||a==="claude"||a==="undefined"}var cme=[{name:"true"},{name:"false"}],OQo=[{name:"vscode"},{name:"github-copilot"}],udo={[Hi.name]:{type:"scalar",description:d(7768,null)},[Hi.description]:{type:"scalar",description:d(7766,null)},[Hi.argumentHint]:{type:"scalar",description:d(7765,null)},[Hi.model]:{type:"scalar | sequence",description:d(7767,null)},[Hi.tools]:{type:"scalar | sequence",description:d(7769,null),defaults:["[]","['search', 'edit', 'web']"]},[Hi.agent]:{type:"scalar",description:d(7764,null)},[Hi.mode]:{type:"scalar",description:d(7764,null)}},pdo={[Hi.name]:{type:"scalar",description:d(7763,null)},[Hi.description]:{type:"scalar",description:d(7761,null)},[Hi.applyTo]:{type:"scalar",description:d(7760,null),defaults:["'**'","'**/*.ts, **/*.js'","'**/*.php'","'**/*.py'"]},[Hi.excludeAgent]:{type:"scalar | sequence",description:d(7762,null)}},mdo={[Hi.name]:{type:"scalar",description:d(7755,null)},[Hi.description]:{type:"scalar",description:d(7748,null)},[Hi.argumentHint]:{type:"scalar",description:d(7747,null)},[Hi.model]:{type:"scalar | sequence",description:d(7754,null)},[Hi.tools]:{type:"scalar | sequence",description:d(7757,null),defaults:["[]","[search, edit, web]"]},[Hi.handOffs]:{type:"sequence",description:d(7751,null)},[Hi.target]:{type:"scalar",description:d(7756,null),enums:OQo},[Hi.infer]:{type:"scalar",description:d(7753,null),enums:cme},[Hi.agents]:{type:"sequence",description:d(7746,null),defaults:['["*"]']},[Hi.userInvocable]:{type:"scalar",description:d(7758,null),enums:cme},[Hi.userInvokable]:{type:"scalar",description:d(7759,null),enums:cme},[Hi.disableModelInvocation]:{type:"scalar",description:d(7749,null),enums:cme},[Hi.advancedOptions]:{type:"map",description:d(7745,null)},[Z4.github]:{type:"map",description:d(7750,null)},[Hi.hooks]:{type:"map",description:d(7752,null)}},hdo={[Hi.name]:{type:"scalar",description:d(7776,null)},[Hi.description]:{type:"scalar",description:d(7772,null)},[Hi.argumentHint]:{type:"scalar",description:d(7770,null)},[Hi.userInvocable]:{type:"scalar",description:d(7777,null),enums:cme},[Hi.userInvokable]:{type:"scalar",description:d(7778,null),enums:cme},[Hi.disableModelInvocation]:{type:"scalar",description:d(7773,null),enums:cme},[Hi.license]:{type:"scalar | map",description:d(7774,null)},[Hi.compatibility]:{type:"scalar | map",description:d(7771,null)},[Hi.metadata]:{type:"map",description:d(7775,null)}},iet={prompt:Object.keys(udo),instructions:Object.keys(pdo),agent:Object.keys(mdo),skill:Object.keys(hdo),hook:[]},FQo=[Hi.name,Hi.description,Hi.tools,Hi.target,Z4.mcpServers,Z4.github,Hi.infer],WQo={prompt:iet.prompt.filter(a=>!sBt(a)),instructions:iet.instructions.filter(a=>!sBt(a)),agent:iet.agent.filter(a=>!sBt(a)),skill:iet.skill.filter(a=>!sBt(a)),hook:[]};function vCi(a,i,e){return e==="claude"?a==="instructions"?Object.keys(Sdo):Object.keys(bdo):e==="github-copilot"&&a==="agent"?FQo:i?iet[a]:WQo[a]}function sBt(a){return a===Hi.advancedOptions||a===Hi.excludeAgent||a===Hi.mode||a===Hi.infer||a===Hi.userInvokable}function _Me(a,i,e){switch(i){case"instructions":return e==="claude"?Sdo[a]:pdo[a];case"skill":return hdo[a];case"agent":return e==="claude"?bdo[a]:mdo[a];case"prompt":return udo[a];default:return}}var gdo=[{name:jp.execute,description:d(7742,null)},{name:jp.read,description:d(7743,null)},{name:jp.edit,description:d(7741,null)},{name:jp.search,description:d(7744,null)},{name:jp.agent,description:d(7740,null)}],nee=[{name:"Bash",description:d(7714,null),toolEquivalent:[jp.execute]},{name:"Edit",description:d(7715,null),toolEquivalent:["edit/editNotebook","edit/editFiles"]},{name:"Glob",description:d(7716,null),toolEquivalent:["search/fileSearch"]},{name:"Grep",description:d(7717,null),toolEquivalent:["search/textSearch"]},{name:"Read",description:d(7733,null),toolEquivalent:["read/readFile","read/getNotebookSummary"]},{name:"Write",description:d(7739,null),toolEquivalent:["edit/createDirectory","edit/createFile","edit/createJupyterNotebook"]},{name:"WebFetch",description:d(7737,null),toolEquivalent:[jp.web]},{name:"WebSearch",description:d(7738,null),toolEquivalent:[jp.web]},{name:"Task",description:d(7736,null),toolEquivalent:[jp.agent]},{name:"Skill",description:d(7734,null),toolEquivalent:[]},{name:"LSP",description:d(7720,null),toolEquivalent:[]},{name:"NotebookEdit",description:d(7725,null),toolEquivalent:["edit/editNotebook"]},{name:"AskUserQuestion",description:d(7713,null),toolEquivalent:["vscode/askQuestions"]},{name:"MCPSearch",description:d(7721,null),toolEquivalent:[]}],lBt=[{name:"sonnet",description:d(7735,null),modelEquivalent:"Claude Sonnet 4.5 (copilot)"},{name:"opus",description:d(7726,null),modelEquivalent:"Claude Opus 4.6 (copilot)"},{name:"haiku",description:d(7718,null),modelEquivalent:"Claude Haiku 4.5 (copilot)"},{name:"inherit",description:d(7719,null),modelEquivalent:void 0}];function fdo(a){let i=[];for(let e of a){let t=lBt.find(o=>o.name===e);t&&t.modelEquivalent&&i.push(t.modelEquivalent)}return i}function vdo(a){let i=[];for(let e of a){let t=nee.find(o=>o.name===e);t&&i.push(...t.toolEquivalent)}return i}var bdo={name:{type:"scalar",description:d(7707,null)},description:{type:"scalar",description:d(7701,null)},tools:{type:"sequence",description:d(7712,null),defaults:["Read, Edit, Bash"],items:nee},disallowedTools:{type:"sequence",description:d(7702,null),defaults:["Write, Edit, Bash"],items:nee},model:{type:"scalar",description:d(7706,null),defaults:["sonnet","opus","haiku","inherit"],enums:lBt},permissionMode:{type:"scalar",description:d(7708,null),defaults:["default","acceptEdits","dontAsk","bypassPermissions","plan"],enums:[{name:"default",description:d(7729,null)},{name:"acceptEdits",description:d(7727,null)},{name:"plan",description:d(7732,null)},{name:"delegate",description:d(7730,null)},{name:"dontAsk",description:d(7731,null)},{name:"bypassPermissions",description:d(7728,null)}]},skills:{type:"sequence",description:d(7711,null)},mcpServers:{type:"sequence",description:d(7704,null)},hooks:{type:"object",description:d(7703,null)},memory:{type:"scalar",description:d(7705,null),defaults:["user","project","local"],enums:[{name:"user",description:d(7724,null)},{name:"project",description:d(7723,null)},{name:"local",description:d(7722,null)}]}},Sdo={description:{type:"scalar",description:d(7709,null)},paths:{type:"sequence",description:d(7710,null)}};function ree(a){return a==="vscode"||a==="undefined"}function mD(a,i){let e=i instanceof A?i:i.uri;if(a==="agent"){if(ci(e).path.endsWith(`/${i2}`))return"claude";if(!(i instanceof A)){let o=i.target;if(o==="github-copilot"||o==="vscode")return o}return"undefined"}else if(a==="instructions"&&oee(e))return"claude";return"undefined"}var Pv=ae("chatModeService"),e3=class extends C{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(e3.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(BQo(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:Ae(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:zQo(t.source)??{storage:"local"}},s=new cBt(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(e3.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(ve.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 cBt(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=[Pl.Ask];return(this.chatAgentService.hasToolsAgent||this.isAgentModeDisabledByPolicy())&&e.unshift(Pl.Agent),e.push(Pl.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}};e3=I([m(0,nr),m(1,br),m(2,X),m(3,ne),m(4,le),m(5,B)],e3);function BQo(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||HQo(i.source))&&(i.target===void 0||aBt(i.target))&&(i.visibility===void 0||IYi(i.visibility))&&(i.agents===void 0||Array.isArray(i.agents))}var cBt=class{constructor(i){this.kind="agent";this.id=i.uri.toString(),this._nameObservable=Le("name",i.name),this._descriptionObservable=Le("description",i.description),this._customToolsObservable=Le("customTools",i.tools),this._modelObservable=Le("model",i.model),this._argumentHintObservable=Le("argumentHint",i.argumentHint),this._handoffsObservable=Le("handOffs",i.handOffs),this._targetObservable=Le("target",i.target),this._visibilityObservable=Le("visibility",i.visibility),this._agentsObservable=Le("agents",i.agents),this._modeInstructions=Le("_modeInstructions",i.agentInstructions),this._uriObservable=Le("uri",i.uri),this._source=i.source}get name(){return this._nameObservable}get description(){return this._descriptionObservable}get icon(){return Oo(void 0)}get isBuiltin(){return dBt(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){Ui(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:UQo(this._source),target:this.target.get(),visibility:this.visibility.get(),agents:this.agents.get()}}};function HQo(a){if(typeof a!="object"||a===null)return!1;let i=a;return i.storage==="extension"?typeof i.extensionId=="string":i.storage==="plugin"?oh(i.pluginUri):i.storage==="local"||i.storage==="user"}function UQo(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 zQo(a){if(a)return a.storage==="extension"?{storage:"extension",extensionId:new Ei(a.extensionId),type:a.type??"contribution"}:a.storage==="plugin"?{storage:"plugin",pluginUri:A.revive(a.pluginUri)}:{storage:a.storage}}var net=class{constructor(i,e,t,o){this.kind=i;this.name=Oo(i),this.label=Oo(e),this.description=Le("description",t),this.icon=Oo(o),this.target=Oo("undefined")}get isBuiltin(){return dBt(this)}get id(){return this.kind}toJSON(){return{id:this.id,name:this.name.get(),description:this.description.get(),kind:this.kind}}},Pl;(t=>(t.Ask=new net("ask","Ask",d(7590,null),M.question),t.Edit=new net("edit","Edit",d(7591,null),M.edit),t.Agent=new net("agent","Agent",d(7589,null),M.agent)))(Pl||={});function dBt(a){return a.id===Pl.Ask.id||a.id===Pl.Edit.id||a.id===Pl.Agent.id}function t3(a){let i=a.source?.storage;return i==="local"||i==="user"?String(Ir(a.name.get())):a.name.get()}var KQo=250,GQo=500,$Qo=250,qQo=1e3,bCi=10,jQo=2,DMe=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>bCi?qQo:$Qo,u=Math.min(t-this._data.lastUpdateTime,c),p=this._data.totalTime+u,h=n&&e>bCi?GQo:KQo,g=this._data.bootstrapActive;if(g){let w=r;typeof w=="number"&&l>=jQo&&e>=bCi?(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}`)}};DMe=I([m(0,ne)],DMe);var SCi=/(?<![a-zA-Z0-9])(?<dollars>\${1,2})(?!\.|\(["'])((?:\\.|[^\\\n])*?(?:\\.|[^\\\n\$]))\k<dollars>(?![a-zA-Z0-9])/,LMe="vscode-katex-container",ret="data-latex",QQo=new RegExp("^"+SCi.source),uBt;(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="${LMe}" ${ret}="${hpt(c.text)}">${p}</span>`}catch{u=c.raw}return u+(l?`
`:"")}}function t(r,s){let l=QQo;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}}})(uBt||={});var sT=String.raw,XQo=sT`(?<!\\)`+sT`(!?\[`+sT`(?:`+sT`[^\[\]\\]|`+sT`\\.|`+sT`\[[^\[\]]*\]`+sT`)*`+sT`\])`+sT`(\(\s*)`+sT`(`+sT`[^\s\(\)<](?:[^\s\(\)]|\([^\s\(\)]*?\))*|`+sT`<(?:\\[<>]|[^<>])+>`+sT`)`+sT`\s*(?:"[^"]*"|'[^']*'|\([^\(\)]*\))?\s*`+sT`\)`;function ICi(a,i){let t=new RegExp("(?:"+XQo+")|(?:"+SCi.source+sT`)|\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 Ido(a){return ICi(a,Number.MAX_SAFE_INTEGER).returnedWordCount}function Rr(a){return!!a&&typeof a=="object"&&"message"in a}function Vi(a){return!!a&&typeof a.setVote<"u"}function pBt(a){return!!a&&typeof a=="object"&&a.kind==="pendingDivider"}function hD(a){return Rr(a)||Vi(a)}function ydo(a){if(!Vi(a))throw new Error("Expected item to be IChatResponseViewModel")}var see=class extends C{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(RMe,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(RMe,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=>Rr(u)&&u.id===r.requestId);l>=0&&this._items.splice(l,1);let c=r.responseId&&this._items.findIndex(u=>Vi(u)&&u.id===r.responseId);if(typeof c=="number"&&c>=0){let p=this._items.splice(c,1)[0];p instanceof i3&&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(i3,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(RMe,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(RMe,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(),Ue(this._items.filter(e=>e instanceof i3))}};see=I([m(3,F)],see);var RMe=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 M.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 modelId(){return this._model.modelId}get timestamp(){return this._model.timestamp}get pendingKind(){return this._pendingKind}},i3=class extends C{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(DMe)),this._register(e.onDidChange(()=>{if(this.liveUpdateTracker){let r=Ido(e.entireResponse.getMarkdown());this.liveUpdateTracker.update({totalWordCount:r})}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:Hj(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 voteDownReason(){return this._model.voteDownReason}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)}setVoteDownReason(e){this._modelChangeCount++,this._model.setVoteDownReason(e)}setEditApplied(e,t){this._modelChangeCount++,this._model.setEditApplied(e,t)}};i3=I([m(2,F),m(3,mz)],i3);var set=class extends ml{constructor(e,t,o,n,r,s,l,c,u){let p=new class extends Eo{constructor(){super(e.item,e.alt?.item,{},e.hideActions,e.menuKeybinding,r,u);this.elementGetter=()=>{}}async run(...g){let f=Zu.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=Zu.get(this._editor);if(!e)return;let t=new P;this._lightBulbStore.value=t,t.add(he(o=>{let n=e.lightBulbState.read(o);if(this.label){let r=n?.icon??M.lightBulb,s=q.asClassNameArray(r);this.label.className="",this.label.classList.add("codicon","action-label",...s)}this._currentTitle=n?.title,this.updateTooltip()}))}};set=I([m(2,_e),m(3,Ne),m(4,X),m(5,De),m(6,ze),m(7,Bi),m(8,ge)],set);var aet=class extends ml{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&&Fi(this.label,this.action.label,...this._kbLabel?[_("span.inline-chat-keybinding",void 0,this._kbLabel)]:[])}};aet=I([m(1,_e),m(2,Ne),m(3,X),m(4,De),m(5,ze),m(6,Bi)],aet);var aee=class extends C{constructor(e,t,o){super();this._editor=e;this._id=`inline-chat-content-widget-${aee._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(Ln,this._domNode,D.InlineChatEditorAffordance,{telemetrySource:"inlineChatEditorAffordance",hiddenItemStrategy:0,menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:()=>!0,useSeparatorsInPrimaryActions:!0},actionViewItemProvider:r=>{if(r instanceof Eo&&r.id===w1)return o.createInstance(set,r,this._editor);if(r instanceof Eo&&(r.id===XZ||r.id===Bwi||r.id==="inlineChat.fixDiagnostics"))return o.createInstance(aet,r)}}));this._store.add(n.actionRunner.onDidRun(r=>{this._onDidRunAction.fire(r.action.id),this._hide()})),this._store.add(he(r=>{let s=t.read(r);s?this._show(s):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=eq(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]}}_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()}};aee=I([m(2,F)],aee);var MMe=class extends Z1{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=Zu.get(e.editor)?.lightBulbState,b=Ce(y=>{let w=t.read(y);if(!w)return;let k=[];for(let[,G]of g.read(y)){let $=[];for(let te of G)te instanceof Eo&&$.push({command:{id:te.item.id,title:te.label},icon:q.isThemeIcon(te.item.icon)?te.item.icon:void 0});$.length>0&&k.push($)}let T=w.getPosition(),N=new ro(T.lineNumber,T.lineNumber+1),O=new q7(void 0,"",k,void 0,void 0,void 0,!0),V=v?.read(y),U=V?V.icon:M.sparkle;return new $7(O,N,new j7(()=>{},()=>{}),void 0,{icon:U})}),S=Le({},!1);super(e,b,Oo("inactive"),Oo(0),Oo(!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)))}};MMe=I([m(2,_e),m(3,tt),m(4,F),m(5,Bi),m(6,De),m(7,eC),m(8,qt),m(9,X)],MMe);var PMe=class extends C{$d;$e;$f;$g=Le(this,void 0);$h=Le(this,void 0);constructor(i,e,t,o,n,r,s,l){super(),this.$d=i,this.$e=e,this.$f=t;let c=os(this.$d),u=pr("inlineChat.affordance","off",o),p=kM(c.cursorSelection,500),h=this.$h,g=Vwi.bindTo(l);this._store.add({dispose:()=>g.reset()});let f=!1,v;this._store.add(_s(c.selections,(w,k,T)=>{f=T.every(N=>N.reason===3),(!w||w.length!==1||w[0].isEmpty()||!f)&&h.set(void 0,void 0)})),this._store.add(he(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=_t();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(he(w=>{n.sentimentObs.read(w).hidden&&h.set(void 0,void 0)}));let b=Ce(w=>{Nr(this,r.onDidChangeSessions).read(w);let k=c.model.read(w);return k?r.getSessionByTextModel(k.uri)!==void 0:!1});this._store.add(he(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(he(w=>{c.isFocused.read(w)||h.set(void 0,void 0)})),this._store.add(he(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(MMe,c,Ce(w=>u.read(w)==="gutter"?h.read(w):void 0))),y=this.$f.createInstance(aee,this.$d,Ce(w=>u.read(w)==="editor"?h.read(w):void 0));this._store.add(y),this._store.add(H.any(y.onDidRunAction,S.onDidRunAction)(w=>{v&&s.publicLog2("inlineChatAffordance/selected",{mode:u.get(),id:v,commandId:w})})),this._store.add(he(w=>{let k=u.read(w),T=k==="editor"||k==="gutter",N=Zu.get(this.$d);N&&(N.onlyLightBulbWithEmptySelection=T)})),this._store.add(he(w=>{let k=this.$g.read(w);if(!k)return;this.$d.revealLineInCenterIfOutsideViewport(k.lineNumber,1);let N=this.$d.getDomNode().getBoundingClientRect(),O=k.rect.left-N.left;this.$e.show(k.lineNumber,O,k.above,k.placeholder)})),this._store.add(he(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){So(this.$d.hasModel());let e=this.$d.getSelection().getDirection(),t=this.$d.getPosition(),o=this.$d.getDomNode(),n=this.$d.getScrolledVisiblePosition(t),r=o.getBoundingClientRect(),s=r.left+n.left,l=r.top+n.top;this.$g.set({rect:new DOMRect(s,l,0,n.height),above:e===1,lineNumber:t.lineNumber,placeholder:i},void 0),await gf(this.$e.position,c=>c===null)}};PMe=I([m(2,F),m(3,B),m(4,vr),m(5,Ik),m(6,Te),m(7,X)],PMe);var Iwu=J("multiDiffEditor.headerBackground",{dark:"#262626",light:"tab.inactiveBackground",hcDark:"tab.inactiveBackground",hcLight:"tab.inactiveBackground"},d(254,null)),ywu=J("multiDiffEditor.background",qo,d(252,null)),wwu=J("multiDiffEditor.border",{dark:"sideBarSectionHeader.border",light:"#cccccc",hcDark:"sideBarSectionHeader.border",hcLight:"#cccccc"},d(253,null));var hBt=class{constructor(i,e){this.viewModel=i;this.deltaScrollVertical=e}getId(){return this.viewModel}},lee=class extends C{constructor(e,t,o,n,r){super();this._container=e;this._overflowWidgetsDomNode=t;this._workbenchUIElementFactory=o;this._instantiationService=n;this._viewModel=Le(this,void 0),this._collapsed=Ce(this,c=>this._viewModel.read(c)?.collapsed.read(c)),this._editorContentHeight=Le(this,500),this.contentHeight=Ce(this,c=>(this._collapsed.read(c)?0:this._editorContentHeight.read(c))+this._outerEditorHeight),this._modifiedContentWidth=Le(this,0),this._modifiedWidth=Le(this,0),this._originalContentWidth=Le(this,0),this._originalWidth=Le(this,0),this.maxScroll=Ce(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=bt("div.multiDiffEntry",[bt("div.header@header",[bt("div.header-content",[bt("div.collapse-button@collapseButton"),bt("div.file-path",[bt("div.title.modified.show-file-icons@primaryPath",[]),bt("div.status.deleted@status",["R"]),bt("div.title.original.show-file-icons@secondaryPath",[])]),bt("div.actions@actions")])]),bt("div.editorParent",[bt("div.editorContainer@editor")])]),this.editor=this._register(this._instantiationService.createInstance(Hu,this._elements.editor,{overflowWidgetsDomNode:this._overflowWidgetsDomNode,fixedOverflowWidgets:!0},{})),this.isModifedFocused=os(this.editor.getModifiedEditor()).isFocused,this.isOriginalFocused=os(this.editor.getOriginalEditor()).isFocused,this.isFocused=Ce(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 P),this._headerHeight=40,this._lastScrollTop=-1,this._isSettingScrollTop=!1;let s=new Mi(this._elements.collapseButton,{});this._register(he(c=>{s.element.className="",s.icon=this._collapsed.read(c)?M.chevronRight:M.chevronDown})),this._register(s.onDidClick(()=>{this._viewModel.get()?.collapsed.set(!this._collapsed.get(),void 0)})),this._register(he(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=>{x6(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(he(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 Io([X,this._contextKeyService])));this._register(l.createInstance(Ln,this._elements.actions,D.MultiDiffEditorFileToolbar,{actionRunner:this._register(new cwe(()=>this._viewModel.get()?.modifiedUri??this._viewModel.get()?.originalUri)),menuOptions:{shouldForwardArgs:!0},toolbarOptions:{primaryGroup:c=>c.startsWith("navigation")},actionViewItemProvider:(c,u)=>Ca(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){x6(n=>{this._viewModel.set(void 0,n),this.editor.setDiffModel(null,n),this._dataStore.clear()});return}let o=e.viewModel.documentDiffItem;if(x6(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)`,x6(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"}};lee=I([m(3,F),m(4,X)],lee);var gBt=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 AMe=class extends C{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=bt("div.scrollContent",[bt("div@content",{style:{overflow:"hidden"}}),bt("div.monaco-editor@overflowWidgetsDomNode",{})]),this._scrollable=this._register(new UT({forceIntegerValues:!1,scheduleAtNextAnimationFrame:u=>$r(Me(this._element),u),smoothScrollDuration:100})),this._scrollableElement=this._register(new AN(this._scrollableElements.root,{vertical:1,horizontal:1,useShadows:!1},this._scrollable)),this._elements=bt("div.monaco-component.multiDiffEditor",{},[bt("div",{},[this._scrollableElement.getDomNode()]),bt("div.placeholder@placeholder",{},[bt("div")])]),this._sizeObserver=this._register(new Fye(this._element,void 0)),this._objectPool=this._register(new gBt(u=>{let p=this._instantiationService.createInstance(lee,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=Ce(this,u=>{let p=this._viewModel.read(u);if(!p)return{items:[],getItem:v=>{throw new ni}};let h=p.items.read(u),g=new Map;return{items:h.map(v=>{let b=u.store.add(new yCi(v,this._objectPool,this.scrollLeft,y=>{this._scrollableElement.setScrollPosition({scrollTop:this._scrollableElement.getScrollPosition().scrollTop+y})})),S=this._lastDocStates?.[b.getKey()];return S&&Ui(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=Ce(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 Io([X,this._contextKeyService]))),this._contextKeyService.createKey(ue.inMultiDiffEditor.key,!0),this._lastDocStates={},this._register(Ga((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(ue.multiDiffEditorAllCollapsed.key,!1);this._register(he(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(he(u=>{let p=this._dimension.read(u);this._sizeObserver.observe(p)}));let c=Ce(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(he(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(he(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=Z2e(v,tl(S=>S.maxScroll.read(u).maxScroll,qd));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(he(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(he(u=>{x6(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 ni("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),JQo(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,Ui(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=di.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=di.ofStartAndLength(n,h),f=di.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=di.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)`}};AMe=I([m(4,X),m(5,F)],AMe);function JQo(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 yCi=class extends C{constructor(e,t,o,n){super();this.viewModel=e;this._objectPool=t;this._scrollLeft=o;this._deltaScrollVertical=n;this._templateRef=this._register(X0(this,void 0));this.contentHeight=Ce(this,e=>this._templateRef.read(e)?.object.contentHeight?.read(e)??this.viewModel.lastTemplateData.read(e).contentHeight);this.maxScroll=Ce(this,e=>this._templateRef.read(e)?.object.maxScroll.read(e)??{maxScroll:0,scrollWidth:0});this.template=Ce(this,e=>this._templateRef.read(e)?.object);this._isHidden=Le(this,!1);this._isFocused=Ce(this,e=>this.template.read(e)?.isFocused.read(e)??!1);this.viewModel.setIsFocused(this._isFocused,void 0),this._register(he(r=>{let s=this._scrollLeft.read(r);this._templateRef.read(r)?.object.setScrollLeft(s)})),this._register(he(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 Ui(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(Yt.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&&Ui(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 hBt(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 cee=class extends C{constructor(e,t,o){super();this._element=e;this._workbenchUIElementFactory=t;this._instantiationService=o;this._dimension=Le(this,void 0);this._viewModel=Le(this,void 0);this._widgetImpl=Ce(this,e=>(Cx(lee,e),e.store.add(this._instantiationService.createInstance(Cx(AMe,e),this._element,this._dimension,this._viewModel,this._workbenchUIElementFactory))));this._activeControl=Ce(this,e=>this._widgetImpl.read(e).activeControl.read(e));this.onDidChangeActiveControl=H.fromObservableLight(this._activeControl);this._register(EM(this._widgetImpl))}reveal(e,t){this._widgetImpl.get().reveal(e,t)}createViewModel(e){return new Jke(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()}};cee=I([m(2,F)],cee);var Eg=class extends zO{constructor(e,t,o,n,r,s,l,c,u){super(Eg.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(cee,e,this.instantiationService.createInstance(cet))),this._register(this._multiDiffEditorWidget.onDidChangeActiveControl(()=>{this._onDidChangeControl.fire()})),this._contentOverlay=this._register(new wCi(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 xu}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)}};Eg=I([m(1,F),m(2,Te),m(3,De),m(4,le),m(5,ee),m(6,Et),m(7,Nn),m(8,rd)],Eg);var wCi=class extends C{constructor(e,t,o){super();this.resourceObs=Le(this,void 0);let n=o.createInstance(Ble,D.MultiDiffEditorContent,t,this.resourceObs);n.element.classList.add("multi-diff-root-floating-menu"),this._register(n);let r=Ce(s=>{let l=this.resourceObs.read(s),c=n.hasActions.read(s);return l!==void 0&&c});this._register(he(s=>{r.read(s)&&(e.appendChild(n.element),s.store.add(Z(()=>{n.element.remove()})))}))}updateResource(e){this.resourceObs.set(e,void 0)}},cet=class{constructor(i){this._instantiationService=i}createResourceLabel(i){let e=this._instantiationService.createInstance(rk,i,{});return{setUri(t,o={}){t?e.element.setFile(t,{strikethrough:o.strikethrough}):e.element.clear()},dispose(){e.dispose()}}}};cet=I([m(0,F)],cet);var kB=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:kB._scheme,query:JSON.stringify({repositoryUri:i,groupId:e})})}static parseUri(i){if(i.scheme!==kB._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 kB.parseUri(i)!==void 0}async resolveDiffSource(i){let{repositoryUri:e,groupId:t}=kB.parseUri(i),o=await gf(ui(this,this._scmService.onDidAddRepository,()=>[...this._scmService.repositories].find(l=>l.provider.rootUri?.toString()===e.toString()))),n=await gf(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 PC));return await gf(s,l=>l),new CCi(n,o)}};kB=I([m(0,$c),m(1,zl)],kB);var $C=class{constructor(i){this._scmService=i}static{this.scheme="scm-history-item"}static getMultiDiffSourceUri(i,e,t,o){return A.from({scheme:$C.scheme,path:i.rootUri?.fsPath,query:JSON.stringify({repositoryId:i.id,historyItemId:e,historyItemParentId:t,historyItemDisplayId:o})},!0)}static parseUri(i){if(i.scheme!==$C.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 $C.parseUri(i)!==void 0}async resolveDiffSource(i){let{repositoryId:e,historyItemId:t,historyItemParentId:o,historyItemDisplayId:n}=$C.parseUri(i),l=await this._scmService.getRepository(e)?.provider.historyProvider.get()?.provideHistoryItemChanges(t,o)??[];return{resources:fbe.const(l.map(u=>{let p=u.modifiedUri?`${No(u.modifiedUri.fsPath)} (${n??t})`:void 0;return new ik(u.originalUri,u.modifiedUri,u.modifiedUri,p)}))}}};$C=I([m(0,$c)],$C);var CCi=class{constructor(i,e){this._group=i;this._repository=e;this._resources=ui(this._group.onDidChangeResources,()=>this._group.resources.map(t=>new ik(t.multiDiffEditorOriginalUri,t.multiDiffEditorModifiedUri,t.sourceUri))),this.resources=new pN(this._resources),this.contextKeys={scmResourceGroup:this._group.id,scmProvider:this._repository.provider.providerId}}},dme=class extends C{static{this.ID="workbench.contrib.scmMultiDiffSourceResolver"}constructor(i,e){super(),this._register(e.registerResolver(i.createInstance($C))),this._register(e.registerResolver(i.createInstance(kB)))}};dme=I([m(0,F),m(1,Rz)],dme);var NMe=class a extends K{static async openMultiFileDiffEditor(i,e,t,o,n){if(!t)return;let r=kB.getMultiDiffSourceUri(t.toString(),o);return await i.openEditor({label:e,multiDiffSource:r,options:n})}constructor(){super({id:"_workbench.openScmMultiDiffEditor",title:L(11616,"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 wdo(a){if(!a.dataTransfer?.types.includes(Ll.SCM_HISTORY_ITEM))return;let i=a.dataTransfer?.getData(Ll.SCM_HISTORY_ITEM);if(i)return JSON.parse(i)}var ume=class extends C{static{this.ID="workbench.contrib.chat.scmHistoryItemContextContribution"}constructor(i,e,t){super(),this._store.add(i.registerChatContextItem(e.createInstance(o3))),this._store.add(t.registerTextModelContentProvider($C.scheme,e.createInstance(det))),this._store.add(t.registerTextModelContentProvider(r2.scheme,e.createInstance(r2)))}};ume=I([m(0,uS),m(1,F),m(2,Nt)],ume);var o3=class{constructor(i){this._scmViewService=i;this.type="pickerPick";this.label=d(13074,null);this.icon=M.gitCommit;this._delayer=new ya(200)}static asAttachment(i,e){let t=e.parentIds.length>0?e.parentIds[0]:void 0,o=$C.getMultiDiffSourceUri(i,e.id,t,e.displayId),n=`$(${M.repo.id})\xA0${i.name}\xA0$(${M.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(13075,null),picks:Xde((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=si([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(13076,null)}`),c.timestamp&&u.push(Bs(c.timestamp,!0,!0)),{iconClass:q.asClassName(M.gitCommit),label:c.subject,detail:u.join(`$(${M.circleSmallFilled.id})`),asAttachment:()=>o3.asAttachment(n.repository.provider,c)}}):[]))})}}};o3=I([m(0,au)],o3);var det=class{constructor(i,e){this._modelService=i;this._scmService=e}async provideTextContent(i){let e=$C.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}};det=I([m(0,Ct),m(1,$c)],det);var r2=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!==r2.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}}};r2=I([m(0,Ct),m(1,$c)],r2);W(class extends K{constructor(){super({id:"workbench.scm.action.graph.addHistoryItemToChat",title:d(13072,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(At).revealWidget();!i||!e||!o||o.attachmentModel.addContext(o3.asAttachment(i,e))}});W(class extends K{constructor(){super({id:"workbench.scm.action.graph.summarizeHistoryItem",title:d(13073,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(At).revealWidget();!i||!e||!o||(o.attachmentModel.addContext(o3.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(13072,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(At).revealWidget();!i||!e.modifiedUri||!o||o.attachmentModel.addContext({id:e.uri.toString(),name:`${Ye(e.modifiedUri)}`,value:e.modifiedUri,historyItem:i,kind:"scmHistoryItemChange"})}});var uet=ae("IChatWidgetHistoryService"),ZQo=40,OMe=class extends C{constructor(e){super();this._onDidChangeHistory=this._register(new E);this.changed=!1;this.onDidChangeHistory=this._onDidChangeHistory.event;this.memento=new Bl("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(cc).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(cc).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"?ake:e}append(e,t){this.viewState.history??={};let o=this.getKey(e);this.viewState.history[o]=this.getHistory(e).concat(t).slice(-ZQo),this.changed=!0,this._onDidChangeHistory.fire({kind:"append",entry:t})}clearHistory(){this.viewState.history={},this.changed=!0,this._onDidChangeHistory.fire({kind:"clear"})}};OMe=I([m(0,le)],OMe);var dee=class extends C{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,e6o(this._history.at(-1),e)||this.chatWidgetHistoryService.append(this.location,e)}};dee=I([m(1,uet)],dee);function e6o(a,i){return!(!a||!i||a.inputText!==i.inputText||!$i(a.attachments,i.attachments,(e,t)=>e.id===t.id))}var Cdo=ae("ILanguageModelStatsService"),FMe=class extends C{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,fBt)}};FMe=I([m(0,YI),m(1,le)],FMe);var fBt="copilot";oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:fBt,label:d(7618,null),description:d(7619,null),icon:M.copilot,access:{canToggle:!1},accessDataLabel:d(7617,null)});var gD=ae("ILanguageModelToolsConfirmationService");var t6o="screenshot-focused-window";function vBt(a){return{id:t6o,name:d(6025,null),value:a.buffer,kind:"image"}}var vi=L(5374,"Chat"),im="workbench.action.chat.newChat",xdo="workbench.action.chat.newEditSession",bBt="workbench.action.openChat",qC="workbench.action.chat.open",pI="workbench.action.chat.triggerSetup",n3="workbench.action.chat.triggerSetupSupportAnonymousAction",i6o="workbench.action.chat.toggle",s2="workbench.action.chat.generateAgentInstructions",pet="workbench.action.chat.generateOnDemandInstructions",r3="workbench.action.chat.generatePrompt",s3="workbench.action.chat.generateSkill",a3="workbench.action.chat.generateAgent",kCi="workbench.action.chat.generateHook",met="workbench.action.chat.insertForkConversationCommand",SBt={manageSettingsUrl:to.defaultChatAgent?.manageSettingsUrl??"",provider:to.defaultChatAgent?.provider??{enterprise:{id:""}},completionsAdvancedSetting:to.defaultChatAgent?.completionsAdvancedSetting??"",completionsMenuCommand:to.defaultChatAgent?.completionsMenuCommand??""},fy=new D("workbench.chat.menu.config"),o6o="workbench.action.chat.openQuotaExceededDialog",IBt=class extends K{constructor(e,t){super({...e,icon:M.chatSparkle,f1:!0,category:vi,precondition:x.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(Si),n=e.get(At),r=e.get(jn),s=e.get(oi),l=e.get(br),c=e.get(F),u=e.get(ge),p=e.get(Pv),h=e.get(be),g=e.get(Wr),f=e.get($c),v=e.get(ne),b=e.get(B),S=n.lastFocusedWidget;if((!this.mode||!S||!ts(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 N=g.lookupLanguageModel(T);if(!N)throw new Error(`Language model not loaded: ${T}.`);S.input.setCurrentLanguageModel({metadata:N,identifier:T})}if(t?.toolsInclude||t?.toolsExclude){let k=S.input.selectedLanguageModel.get()?.metadata,T=Array.from(r.getTools(k)),N=Array.from(r.getToolSetsForModel(k)),O=s6o({allTools:T,allToolSets:N,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(vBt(k))}if(t?.attachFiles)for(let k of t.attachFiles){let T=k instanceof A?k:k.uri,N=k instanceof A?void 0:k.range;await h.exists(T)&&S.attachmentModel.addFile(T,N)}if(t?.attachHistoryItemChanges)for(let k of t.attachHistoryItemChanges){let N=f.getRepository(A.file(k.uri.path))?.provider.historyProvider.get();if(!N)continue;let O=await N.resolveHistoryItem(k.historyItemId);O&&S.attachmentModel.addContext({id:k.uri.toString(),name:`${Ye(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)),N=T?.provider.historyProvider.get();if(!T||!N)continue;let[O,V]=await Promise.all([N.resolveHistoryItem(k.start.historyItemId),N.resolveHistoryItem(k.end.historyItemId)]);if(!O||!V)continue;let U=k.end.uri.with({scheme:r2.scheme,query:JSON.stringify({repositoryId:T.id,start:O.id,end:k.end.historyItemId})});S.attachmentModel.addContext({id:U.toString(),name:`${Ye(U)}`,value:U,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.setInput(t.query):(S.viewModel||await H.toPromise(S.onDidChangeViewModel),await n6o(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 N=r6o(k);return N?{...k.result,...N}:{...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(get,r,e.kind,s.getRequests().length,s):{needToClearSession:!1};if(!l)return;t.input.setChatMode(e.id),l.needToClearSession&&await n.executeCommand(im)}}};async function n6o(a,i){a.getDefaultAgent("panel",i)||await Promise.race([H.toPromise(H.filter(a.onDidChangeAgents,()=>!!a.getDefaultAgent("panel",i))),Pi(6e4).then(()=>{throw new Error("Timed out waiting for default agent")})])}function r6o(a){for(let i of a.response.value){if(i.kind==="toolInvocation"){let e=i.state.get();if(e.type===lo.StateKind.WaitingForConfirmation)return{type:"confirmation",kind:"toolInvocation",toolId:i.toolId};if(e.type===lo.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 xCi=class extends IBt{constructor(){super({id:qC,title:L(5414,"Open Chat"),keybinding:{weight:200,primary:2599,mac:{primary:2343}},menu:[{id:D.ChatTitleBarMenu,group:"a_open",order:1}]})}};function ECi(a){return`workbench.action.chat.open${a.name.get()}`}var pme=class extends IBt{constructor(i,e){super({id:ECi(i),title:L(5417,"Open Chat ({0})",i.label.get()),keybinding:e},i)}};function Ldo(){W(xCi),W(class extends pme{constructor(){super(Pl.Ask)}}),W(class extends pme{constructor(){super(Pl.Agent,{when:x.has("config.chat.agent.enabled"),weight:200,primary:3111,linux:{primary:3623}})}}),W(class extends pme{constructor(){super(Pl.Edit)}}),W(class extends K{constructor(){super({id:i6o,title:L(5423,"Toggle Chat"),category:vi})}async run(e){let t=e.get(fi),o=e.get(Ft),n=e.get(Ri),r=e.get(At),s=n.getViewLocationById(Vr);o.isViewVisible(Vr)?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:bBt,title:L(5409,"New Chat Editor"),icon:M.plus,f1:!0,category:vi,precondition:ie.enabled,keybinding:{weight:200,primary:2092,when:x.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:x.and(fr.isEqualTo(Va.EditorID),ie.newChatButtonExperimentIcon.notEqualsTo("copilot"),ie.newChatButtonExperimentIcon.notEqualsTo("new-session"),ie.newChatButtonExperimentIcon.notEqualsTo("comment")),order:1}]})}async run(e){await e.get(At).openSession(cs.getNewSessionUri(),Un,{pinned:!0})}}),W(class extends K{constructor(){super({id:bBt+".copilotIcon",title:L(5409,"New Chat Editor"),icon:M.copilot,f1:!1,category:vi,precondition:ie.enabled,menu:[{id:D.EditorTitle,group:"navigation",when:x.and(fr.isEqualTo(Va.EditorID),ie.newChatButtonExperimentIcon.isEqualTo("copilot")),order:1}]})}async run(e){await e.get(At).openSession(cs.getNewSessionUri(),Un,{pinned:!0})}}),W(class extends K{constructor(){super({id:bBt+".newSessionIcon",title:L(5409,"New Chat Editor"),icon:M.newSession,f1:!1,category:vi,precondition:ie.enabled,menu:[{id:D.EditorTitle,group:"navigation",when:x.and(fr.isEqualTo(Va.EditorID),ie.newChatButtonExperimentIcon.isEqualTo("new-session")),order:1}]})}async run(e){await e.get(At).openSession(cs.getNewSessionUri(),Un,{pinned:!0})}}),W(class extends K{constructor(){super({id:bBt+".commentIcon",title:L(5409,"New Chat Editor"),icon:M.comment,f1:!1,category:vi,precondition:ie.enabled,menu:[{id:D.EditorTitle,group:"navigation",when:x.and(fr.isEqualTo(Va.EditorID),ie.newChatButtonExperimentIcon.isEqualTo("comment")),order:1}]})}async run(e){await e.get(At).openSession(cs.getNewSessionUri(),Un,{pinned:!0})}}),W(class extends K{constructor(){super({id:"workbench.action.openChatToSide",title:L(5410,"New Chat Editor to the Side"),f1:!0,category:vi,precondition:ie.enabled})}async run(e){await e.get(At).openSession(cs.getNewSessionUri(),vn,{pinned:!0})}}),W(class extends K{constructor(){super({id:"workbench.action.newChatWindow",title:L(5407,"New Chat Window"),f1:!0,category:vi,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(At).openSession(cs.getNewSessionUri(),hg,{pinned:!0,auxiliary:{compact:!0,bounds:{width:640,height:640}}})}}),W(class extends K{constructor(){super({id:"workbench.action.chat.clearInputHistory",title:L(5402,"Clear Input History"),precondition:ie.enabled,category:vi,f1:!0})}async run(e,...t){e.get(uet).clearHistory()}}),W(class extends wl{constructor(){super({id:"chat.action.focus",title:L(5369,"Focus Chat List"),precondition:x.and(ie.inChatInput),category:vi,keybinding:[{when:x.and(ie.inputCursorAtTop,ie.inQuickChat.negate()),primary:2064,weight:100},{when:x.and(x.or(Zy,Jae),ie.inQuickChat.negate()),primary:2064,weight:100},{when:x.and(ie.inChatSession,ie.inQuickChat),primary:2066,weight:200}]})}runEditorCommand(e,t){let o=t.getModel()?.uri;o&&e.get(At).getWidgetByInputUri(o)?.focusResponseItem()}}),W(class extends wl{constructor(){super({id:"workbench.chat.action.focusLastFocused",title:L(5370,"Focus Last Focused Chat List Item"),precondition:x.and(ie.inChatInput),category:vi,keybinding:[{when:x.and(ie.inputCursorAtTop,ie.inQuickChat.negate()),primary:3088,weight:101},{when:x.and(x.or(Zy,Jae),ie.inQuickChat.negate()),primary:3088,weight:101},{when:x.and(ie.inChatSession,ie.inQuickChat),primary:3090,weight:201}]})}runEditorCommand(e,t){let o=t.getModel()?.uri;o&&e.get(At).getWidgetByInputUri(o)?.focusResponseItem(!0)}}),W(class extends K{constructor(){super({id:"workbench.action.chat.focusInput",title:L(5403,"Focus Chat Input"),f1:!1,keybinding:[{primary:2066,weight:200,when:x.and(ie.inChatSession,ie.inChatInput.negate(),ie.inQuickChat.negate())},{when:x.and(ie.inChatSession,ie.inChatInput.negate(),ie.inQuickChat),primary:2064,weight:200}]})}run(e,...t){e.get(At).lastFocusedWidget?.focusInput()}}),W(class kdo extends K{static{this.ID="workbench.action.chat.focusTodosView"}constructor(){super({id:kdo.ID,title:L(5406,"Toggle Focus Between TODOs and Input"),category:vi,f1:!0,precondition:ie.chatModeKind.isEqualTo("agent"),keybinding:[{weight:201,primary:3122,when:x.or(x.and(ie.inChatInput,ie.chatModeKind.isEqualTo("agent")),x.and(ie.inChatTodoList,ie.chatModeKind.isEqualTo("agent")))}]})}run(e){let o=e.get(At).lastFocusedWidget;(!o||!o.toggleTodosViewFocus())&&Jo(d(5380,null))}}),W(class Edo extends K{static{this.ID="workbench.action.chat.focusQuestionCarousel"}constructor(){super({id:Edo.ID,title:L(5404,"Chat: Toggle Focus Between Question and Input"),category:vi,f1:!0,precondition:ie.inChatSession,keybinding:[{weight:200,primary:3103,when:x.and(ie.inChatSession,ie.Editing.hasQuestionCarousel)}]})}run(e){let o=e.get(At).lastFocusedWidget;(!o||!o.toggleQuestionCarouselFocus())&&Jo(d(5377,null))}}),W(class Tdo extends K{static{this.ID="workbench.action.chat.previousQuestion"}constructor(){super({id:Tdo.ID,title:L(5411,"Chat: Previous Question"),category:vi,f1:!0,precondition:x.and(ie.inChatSession,ie.Editing.hasQuestionCarousel),keybinding:[{weight:200,primary:558,when:x.and(ie.inChatQuestionCarousel,ie.Editing.hasQuestionCarousel)}]})}run(e){e.get(At).lastFocusedWidget?.navigateToPreviousQuestion()}}),W(class _do extends K{static{this.ID="workbench.action.chat.nextQuestion"}constructor(){super({id:_do.ID,title:L(5408,"Chat: Next Question"),category:vi,f1:!0,precondition:x.and(ie.inChatSession,ie.Editing.hasQuestionCarousel),keybinding:[{weight:200,primary:556,when:x.and(ie.inChatQuestionCarousel,ie.Editing.hasQuestionCarousel)}]})}run(e){e.get(At).lastFocusedWidget?.navigateToNextQuestion()}}),W(class Ddo extends K{static{this.ID="workbench.action.chat.focusTip"}constructor(){super({id:Ddo.ID,title:L(5405,"Chat: Toggle Focus Between Tip and Input"),category:vi,f1:!0,precondition:ie.inChatSession,keybinding:[{weight:200,primary:3162,when:x.or(ie.inChatSession,ie.inChatTip)}]})}run(e){let o=e.get(At).lastFocusedWidget;(!o||!o.toggleTipFocus())&&Jo(d(5379,null))}}),W(class extends K{constructor(){super({id:"workbench.action.chat.showContextUsage",title:L(5412,"Show Context Window Usage"),category:vi,f1:!0,precondition:ie.enabled})}async run(e){let t=e.get(At);(t.lastFocusedWidget??await t.revealWidget())?.input.showContextUsageDetails()}}),W(class extends K{constructor(){super({id:"workbench.action.chat.toggleShowContextUsage",title:L(5378,"Show Context Usage"),category:vi,toggled:x.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=x.and(ie.enabled,x.notEquals(`config.${SBt.completionsAdvancedSetting}.authProvider`,SBt.provider.enterprise.id));W(class extends K{constructor(){super({id:"workbench.action.chat.manageSettings",title:L(5413,"Manage Chat"),category:vi,f1:!0,precondition:x.and(x.or(ie.Entitlement.planFree,ie.Entitlement.planPro,ie.Entitlement.planProPlus),a),menu:{id:D.ChatTitleBarMenu,group:"y_manage",order:1,when:a}})}async run(i){i.get(Qe).open(A.parse(SBt.manageSettingsUrl))}}),W(class extends K{constructor(){super({id:"workbench.action.chat.showExtensionsUsingCopilot",title:L(5421,"Show Extensions using Copilot"),f1:!0,category:c5,precondition:ie.enabled})}async run(e){e.get(zi).openSearch(`@contribute:${fBt}`)}}),W(class extends K{constructor(){super({id:"workbench.action.chat.configureCodeCompletions",title:L(5386,"Configure Inline Suggestions..."),precondition:x.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(SBt.completionsMenuCommand)}}),W(class extends K{constructor(){super({id:o6o,title:d(5424,null)})}async run(e){let t=e.get(vr),o=e.get(ge),n=e.get(ct),r=e.get(Te),s,l=t.quotas.chat?.percentRemaining===0,c=t.quotas.completions?.percentRemaining===0;if(l&&!c?s=d(5383,null):c&&!l?s=d(5384,null):s=d(5382,null),t.quotas.resetDate){let h=t.quotas.resetDateHasTime?Wu.DateTimeFormat(Dr,{year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"numeric"}):Wu.DateTimeFormat(Dr,{year:"numeric",month:"long",day:"numeric"}),g=new Date(t.quotas.resetDate);s=[s,d(5418,null,h.value.format(g))].join(" ")}let u=t.entitlement===5,p=u?d(5427,null):void 0;await n.prompt({type:"none",message:d(5387,null),cancelButton:{label:d(5388,null),run:()=>{}},buttons:[{label:u?d(5426,null):d(5425,null),run:()=>{let h="workbench.action.chat.upgradePlan";r.publicLog2("workbenchActionExecuted",{id:h,from:"chat-dialog"}),o.executeCommand(h)}}],custom:{icon:M.copilotWarningLarge,markdownDetails:si([{markdown:new xe(s,!0)},p?{markdown:new xe(p,!0)}:void 0])}})}}),W(class extends K{constructor(){super({id:"workbench.action.chat.resetTrustedTools",title:L(5419,"Reset Tool Confirmations"),category:vi,f1:!0,precondition:ie.enabled})}run(e){e.get(gD).resetToolAutoConfirmation(),e.get(Ne).info(d(5420,null))}}),W(class extends K{constructor(){super({id:s2,title:L(5394,"Generate Agent Instructions"),category:vi,icon:M.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:pet,title:L(5395,"Generate On-Demand Instructions"),category:vi,icon:M.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:r3,title:L(5396,"Generate Prompt File"),shortTitle:L(5397,"Generate Prompt"),category:vi,icon:M.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:s3,title:L(5398,"Generate Skill"),shortTitle:L(5399,"Generate Skill"),category:vi,icon:M.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:a3,title:L(5389,"Generate Custom Agent"),shortTitle:L(5390,"Generate Agent"),category:vi,icon:M.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:kCi,title:L(5392,"Generate Hook"),shortTitle:L(5393,"Generate Hook"),category:vi,icon:M.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:met,title:L(5400,"Insert Fork Command"),shortTitle:L(5401,"Insert /fork"),category:vi,icon:M.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:"workbench.action.chat.openFeatureSettings",title:L(5415,"Chat Settings"),shortTitle:d(5416,null),category:vi,f1:!0,precondition:ie.enabled,menu:[{id:fy,when:x.and(ie.enabled,x.equals("view",Vr)),order:15,group:"3_configure"},{id:D.ChatWelcomeContext,group:"2_settings",order:1}]})}async run(e){e.get(Po).openSettings({query:"@feature:chat "})}}),fe.appendMenuItem(D.ViewTitle,{submenu:fy,title:L(5385,"Configure Chat"),group:"navigation",when:x.equals("view",Vr),icon:M.gear,order:6})}function TCi(a,i=!0){return Rr(a)?(i?`${a.username}: `:"")+a.messageText:(i?`${a.username}: `:"")+a.response.toString()}function s6o(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&&!Km(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 het(a,i,e){return FQe(a,e,{messageOverride:i})}async function get(a,i,e,t,o){if(!o?.editingSession||i===e)return{needToClearSession:!1};let n=a.get(ct);if((i==="edit"||e==="edit")&&t>0){let s=d(5422,null);return o.editingSession.entries.get().filter(u=>u.state.get()===0).length>0?await het(o,s,n)?{needToClearSession:!0}:!1:(await n.confirm({title:d(5371,null),message:d(5373,null),primaryButton:d(5372,null),type:"info"})).confirmed?{needToClearSession:!0}:!1}return{needToClearSession:!1}}async function yBt(a,i,e){let t=a.viewModel?.model.sessionResource,o=e??(t?fg(t):qp);if(XI(a.viewContext)&&o!==qp){let n=A.from({scheme:o,path:`/untitled-${_t()}`});await(await i.openView(Vr)).loadSession(n)}else await a.clear()}fe.appendMenuItem(D.EditorContext,{submenu:D.ChatTextEditorMenu,group:"1_chat",order:5,title:d(5391,null),when:x.and(ie.Setup.hidden.negate(),ie.Setup.disabled.negate())});W(class extends K{constructor(){super({id:"workbench.action.chat.toggleDefaultVisibility",title:L(5381,"Show View by Default"),toggled:x.equals("config.workbench.secondarySideBar.defaultVisibility","hidden").negate(),f1:!1,menu:{id:D.ViewTitle,when:x.and(x.equals("view",Vr),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(5376,"Manage Tool Approval"),metadata:{description:L(5375,"Edit/manage the tool approval and confirmation preferences for AI chat agents.")},precondition:ie.enabled,f1:!0,category:vi})}async run(i,e){let t=i.get(gD),o=i.get(jn);t.manageConfirmationPreferences([...o.getAllToolsIncludingDisabled()],e?{defaultScope:e}:void 0)}});var WMe=new Q("chatEdits.isGlobalEditingSession",void 0,d(6444,null)),mI=new Q("chatEdits.hasEditorModifications",void 0,d(6447,null)),uee=new Q("chatEdits.isCurrentlyBeingModified",void 0,d(6448,null)),pee=new Q("chatEdits.isReviewModeEnabled",!0,d(6446,null)),EB=new Q("chatEdits.isRequestInProgress",!1,d(6445,null)),a6o=new Q("chatEdits.requestCount",0,d(6449,null)),wBt=new Q("chatEdits.cursorInChangeRange",!1,d(6443,null)),mme=class{constructor(i,e){this._store=new P;let t=this._store.add(new jt),o=ui(this,H.any(e.onDidAddGroup,e.onDidRemoveGroup),()=>e.groups);this._store.add(he(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(fet,s));for(let s of r)t.deleteAndDispose(s)}))}static{this.ID="chat.edits.editorContextKeys"}dispose(){this._store.dispose()}};mme=I([m(0,F),m(1,Et)],mme);var fet=class{constructor(i,e,t,o){this._store=new P;this._ctxIsGlobalEditingSession=WMe.bindTo(i.scopedContextKeyService),this._ctxHasEditorModification=mI.bindTo(i.scopedContextKeyService),this._ctxIsCurrentlyBeingModified=uee.bindTo(i.scopedContextKeyService),this._ctxHasRequestInProgress=EB.bindTo(i.scopedContextKeyService),this._ctxReviewModeEnabled=pee.bindTo(i.scopedContextKeyService),this._ctxRequestCount=a6o.bindTo(i.scopedContextKeyService);let n=ui(this,i.onDidModelChange,()=>i.activeEditor),r=Ce(s=>{let l=n.read(s),c=no.getOriginalUri(l,{supportSideBySide:1});if(!c){this._reset();return}return new vet(c,t,e).value.read(s)});this._store.add(he(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):Oo(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()}};fet=I([m(1,Ik),m(2,dl),m(3,Si)],fet);var vet=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=Ce(r=>{let s=o.read(r);return s?{session:s.editingSession,entry:s.editingSession.readEntry(i,r),isInlineChat:!0}:n.read(r)})}};vet=I([m(1,dl),m(2,Ik)],vet);function l6o(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 c6o(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 _Ci=class a extends C{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 P);this._uri=o.modifiedModel.uri,this._rangeHighlightDecoration=this._editor.createDecorationsCollection(),this._explanations=this._changes.map(c=>{let{originalText:u,modifiedText:p}=l6o(c,o);return{startLineNumber:c.modified.startLineNumber,endLineNumber:c.modified.endLineNumberExclusive-1,explanation:d(6464,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(Qo(M.close)),this._dismissButton.title=d(6461,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(Qo(M.circle)),this._readIndicator.classList.add("read"),this._readIndicator.classList.remove("partial","unread"),this._readIndicator.title=d(6469,null)):t?(this._readIndicator.appendChild(Qo(M.circleFilled)),this._readIndicator.classList.remove("read","unread"),this._readIndicator.classList.add("partial"),this._readIndicator.title=d(6467,null)):(this._readIndicator.appendChild(Qo(M.circleFilled)),this._readIndicator.classList.remove("read","partial"),this._readIndicator.classList.add("unread"),this._readIndicator.title=d(6468,null))}_updateTitle(){let e=this._explanations.length;e===1?this._titleNode.textContent=d(6471,null):this._titleNode.textContent=d(6470,null,e)}_updateToggleButton(){Rt(this._toggleButton),this._isExpanded?(this._toggleButton.appendChild(Qo(M.chevronUp)),this._toggleButton.title=d(6460,null)):(this._toggleButton.appendChild(Qo(M.chevronDown)),this._toggleButton.title=d(6462,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(6465,null,t.startLineNumber):n.textContent=d(6466,null,t.startLineNumber,t.endLineNumber),o.appendChild(n);let r=_("span.chat-explanation-text");if(t.loading){let c=Qo(q.modify(M.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(Qo(M.arrowRight)),l.title=d(6463,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(Vr,!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:Ss(y9),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(Qo(M.circle)),e.classList.add("read"),e.classList.remove("unread")):(e.appendChild(Qo(M.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=yl(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())}},VMe=class extends C{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(he(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=c6o(e.changes,5);for(let n of o){let r=new _Ci(this._editor,n,e,this._chatWidgetService,this._viewsService,t);this._widgets.push(r),this._register(r),r.layout(n[0].modified.startLineNumber)}this._register(H.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 hme=ae("chatEditingExplanationModelManager");function d6o(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 bet=class extends C{constructor(e){super();this._languageModelsService=e;this._state=Le(this,new vt);this.state=this._state}_updateUriState(e,t){let o=this._state.get(),n=new vt(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 vt(o);r.set(e,{...n,...t}),this._state.set(r,void 0)}}_removeUris(e){let t=this._state.get(),o=new vt(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 $e(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=Ye(l),u=s.changes.map(p=>{let{originalText:h,modifiedText:g}=d6o(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(6459,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(6457,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(6458,null);for(let c of n)this._updateUriStatePartial(c.uri,{progress:"error",explanations:[],errorMessage:l})}}}};bet=I([m(0,Wr)],bet);we(hme,bet,1);var l3=class extends K{constructor(i){super({category:vi,...i})}async run(i,...e){let t=i.get(F),o=i.get(dl),n=i.get(ee),r=no.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)}},CBt=class extends l3{constructor(e){super({id:e?"chatEditor.action.navigateNext":"chatEditor.action.navigatePrevious",title:e?L(6438,"Go to Next Chat Edit"):L(6439,"Go to Previous Chat Edit"),icon:e?M.arrowDown:M.arrowUp,precondition:x.and(ie.enabled,mI),keybinding:{primary:e?575:1599,weight:200,when:x.and(mI,x.or(ue.focus,$u))},f1:!0,menu:{id:D.ChatEditingEditorContent,group:"navigate",order:e?3:2,when:x.and(pee,mI)}});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(OCi,t,o,this.next)||(this.next?n.next(!0):n.previous(!0))}};async function OCi(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}},Un);return l?(i.entries.get().includes(s)&&s.getEditorIntegration(l).reveal(t),!0):!1}var xBt=class extends l3{constructor(e,t){super({id:e,title:t?L(6422,"Keep Chat Edits"):L(6432,"Undo Chat Edits"),shortTitle:t?L(6423,"Keep"):L(6433,"Undo"),tooltip:t?L(6424,"Keep Chat Edits in this File"):L(6434,"Undo Chat Edits in this File"),precondition:x.and(mI,uee.negate()),icon:t?M.check:M.discard,f1:!0,keybinding:{when:x.or(ue.focus,rr),weight:210,primary:t?3127:3116},menu:{id:D.ChatEditingEditorContent,group:"a_resolve",order:t?0:1,when:x.and(t?void 0:pee,x.or(WMe,EB.negate()))}});this._keep=t}async runChatEditingCommand(e,t,o,n){let r=e.get(F);this._keep?t.accept(o.modifiedURI):t.reject(o.modifiedURI),await r.invokeFunction(OCi,t,o,!0)}},gme=class a extends xBt{static{this.ID="chatEditor.action.accept"}constructor(){super(a.ID,!0)}},Iet=class a extends xBt{static{this.ID="chatEditor.action.reject"}constructor(){super(a.ID,!1)}},Rdo="chatEditor.action.acceptHunk",Mdo="chatEditor.action.undoHunk",kBt=class extends l3{constructor(e){super({id:e?Rdo:Mdo,title:e?L(6428,"Keep this Change"):L(6441,"Undo this Change"),shortTitle:e?L(6429,"Keep"):L(6442,"Undo"),precondition:x.and(mI,uee.negate()),f1:!0,keybinding:{when:x.and(wBt,x.or(ue.focus,$u)),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);this._accept?await n.acceptNearestChange(r[0]):await n.rejectNearestChange(r[0]),o.changesCount.get()===0&&await s.invokeFunction(OCi,t,o,!0)}},DCi=class extends kBt{static{this.ID=Rdo}constructor(){super(!0)}},LCi=class extends kBt{static{this.ID=Mdo}constructor(){super(!1)}},RCi=class extends l3{constructor(){super({id:"chatEditor.action.toggleDiff",title:L(6431,"Toggle Diff Editor for Chat Edits"),category:vi,toggled:{condition:x.or(ue.inDiffEditor,fr.isEqualTo(SY)),icon:M.goToFile},precondition:x.and(mI),icon:M.diffSingle,keybinding:{when:ue.focus,weight:200,primary:1601},menu:[{id:D.ChatEditingEditorHunk,order:10},{id:D.ChatEditingEditorContent,group:"a_resolve",order:2,when:x.and(pee)},{id:D.ChatEditorInlineExecute,group:"a_resolve",order:2,when:x.and(pee,FZe)}]})}runChatEditingCommand(i,e,t,o,...n){o.toggleDiff(n[0])}},MCi=class extends l3{constructor(){super({id:"chatEditor.action.showAccessibleDiffView",title:L(6430,"Show Accessible Diff View for Chat Edits"),f1:!0,precondition:x.and(mI,uee.negate()),keybinding:{when:x.and(ue.focus,$a),weight:200,primary:65}})}runChatEditingCommand(i,e,t,o){o.enableAccessibleDiffView()}},PCi=class extends l3{constructor(){super({id:"chatEditor.action.reviewChanges",title:L(6440,"Review"),precondition:x.and(mI,uee.negate()),menu:[{id:D.ChatEditingEditorContent,group:"a_resolve",order:3,when:x.and(pee.negate(),uee.negate(),x.or(WMe,EB.negate()))}]})}runChatEditingCommand(i,e,t,o,...n){t.enableReviewModeUntilSettled()}},ACi=class a extends l3{static{this.ID="chatEditor.action.acceptAllEdits"}constructor(){super({id:a.ID,title:L(6426,"Keep All Chat Edits"),tooltip:L(6427,"Keep All Chat Edits in this Session"),precondition:x.and(mI,uee.negate()),icon:M.checkAll,f1:!0,keybinding:{when:x.or(ue.focus,rr),weight:210,primary:2615}})}async runChatEditingCommand(i,e,t,o,...n){await e.accept()}},EBt=class extends K{constructor(e){super({id:e?"chatEditing.multidiff.acceptAllFiles":"chatEditing.multidiff.discardAllFiles",title:e?d(6425,null):d(6435,null),icon:e?M.check:M.discard,menu:{when:x.equals("resourceScheme",_z),id:D.EditorTitle,order:e?0:1,group:"navigation"}});this.accept=e}async run(e,...t){let o=e.get(dl),n=e.get(ee),r=e.get(Et),s=e.get(fo),c=lp(t,n,r,s).groupedEditors[0];if(!c)return;let u=c.editors[0];if(!(u instanceof xu)||!u.resource)return;let{chatSessionResource:p}=EQe(u.resource),h=o.getEditingSession(p);h&&(this.accept?await h.accept():await h.reject(),n.closeEditor({editor:u,groupId:c.group.id}))}},u6o=[_z,"copilotcli-worktree-changes","copilotcloud-pr-changes"],NCi=class extends K{constructor(){super({id:"chatEditing.multidiff.explain",title:d(6436,null),menu:{when:x.and(x.or(...u6o.map(e=>x.equals("resourceScheme",e))),x.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(hme),r=e.get(At),s=e.get(Ft),l=e.get(dl),c=o.activeEditorPane;if(!c||!(c instanceof Eg)||!c.viewModel)return;let u=c.input;if(!u)return;this._widgetsByInput.get(u)?.dispose();let p=new P;this._widgetsByInput.set(u,p),H.once(u.onWillDispose)(()=>{p.dispose(),this._widgetsByInput.delete(u)});let g=c.viewModel.items.get(),f;if(u instanceof xu&&u.resource?.scheme===_z&&(f=EQe(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 N=y.toString(),O=v.get(N);O?O.changes.push(...T.mappings.map(V=>V.lineRangeMapping)):v.set(N,{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 VMe(S.editor,r,s,n,y.modifiedModel.uri);p.add(w)}b.length>0&&p.add(n.generateExplanations(b,f,ve.None))}};function Pdo(){W(class extends CBt{constructor(){super(!0)}}),W(class extends CBt{constructor(){super(!1)}}),W(PCi),W(gme),W(Iet),W(ACi),W(DCi),W(LCi),W(RCi),W(MCi),W(class extends EBt{constructor(){super(!0)}}),W(class extends EBt{constructor(){super(!1)}}),W(NCi),fe.appendMenuItem(D.ChatEditingEditorContent,{command:{id:FCi,title:d(6437,null),precondition:x.false()},group:"navigate",order:-1,when:x.and(pee,mI)})}var FCi="chatEditor.navigation.bearings";var Cet=class extends Lr{constructor(e,t,o,n,r,s=[gme.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===gme.ID){let t=this._store.add(new me);this._store.add(he(o=>{So(this.label),So(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=$be(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)}},yet=class extends C{constructor(e,t,o){super();this._editor=e;this._keybindingService=t;this._instaService=o;this._showStore=this._store.add(new P);this._session=Le(this,void 0);this._entry=Le(this,void 0);this._navigationBearings=Le(this,{changeCount:-1,activeIdx:-1,entriesCount:-1});this._domNode=document.createElement("div"),this._domNode.classList.add("chat-editor-overlay-widget"),this._isBusy=Ce(s=>this._entry.read(s)?.waitsForLastEdits.read(s));let n=document.createElement("div");n.classList.add("chat-editor-overlay-progress"),R(n,Qo(q.modify(M.loading,"spin")));let r=R(n,_("span.progress-message"));this._domNode.appendChild(n),this._store.add(he(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(),Ui(n=>{this._session.set(e,n),this._entry.set(t,n)}),this._showStore.add(he(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(Ln,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===FCi)return new class extends Lr{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(he(c=>{So(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(6451,null,h,u)}else this.label.innerText=d(6450,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(6452,null):l===1?u=d(6453,null,c):c===1?u=d(6455,null,l):u=d(6456,null,l,c),s._isBusy.get()?d(6454,null,u):u}};if(n.id===gme.ID||n.id===Iet.ID)return new Cet(n,r,s._entry,s._editor,s._keybindingService)}}))}hide(){Ui(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()}};yet=I([m(1,_e),m(2,F)],yet);var wet=class{constructor(i,e,t,o){this._store=new P;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(yet,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=Nr(this,H.any(e.onDidActiveEditorChange,e.onDidModelChange)),c=hs({equalsFn:Xe},p=>{l.read(p);let h=e.activeEditorPane;return no.getOriginalUri(h?.input,{supportSideBySide:1})}),u=Ce(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(he(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;So(v);let b=Ce(y=>f?f.getEditorIntegration(v).currentIndex.read(y):0),S=Ce(y=>f?g.entries.read(y).indexOf(f):0);n.show(g,f,{entryIndex:S,changeIndex:b}),r()}else s()}))}dispose(){this._store.dispose()}};wet=I([m(2,F),m(3,dl)],wet);var fme=class{constructor(i,e){this._store=new P;let t=ui(this,H.any(i.onDidAddGroup,i.onDidRemoveGroup),()=>i.groups),o=this._store.add(new jt);this._store.add(he(n=>{let r=new Set(o.keys()),s=t.read(n);for(let l of s)if(l instanceof Uf&&(r.delete(l),!o.has(l))){let c=e.createChild(new Io([X,l.scopedContextKeyService])),u=l.element,p=c.createInstance(wet,u,l);o.set(l,hn(p,c))}for(let l of r)o.deleteAndDispose(l)}))}static{this.ID="chat.edits.editorOverlay"}dispose(){this._store.dispose()}};fme=I([m(0,Et),m(1,F)],fme);var BMe=class extends C{constructor(e,t,o,n,r,s){super();this._editorObs=e;this._contextKeyService=t;this._menuService=o;this._position=Le(this,null);this.position=this._position;this._showStore=this._store.add(new P);this._anchorLineNumber=0;this._anchorLeft=0;this._anchorAbove=!1;this._domNode=_(".inline-chat-gutter-menu"),this._container=R(this._domNode,_(".inline-chat-gutter-container")),this._inputContainer=R(this._container,_(".input")),this._toolbarContainer=R(this._container,_(".toolbar"));let l=R(this._domNode,_(".inline-chat-gutter-actions")),c=this._store.add(new ji(l,{orientation:1,preventLoopNavigation:!0})),u=this._store.add(this._menuService.createMenu(D.ChatEditorInlineMenu,this._contextKeyService)),p=()=>{let V=Vm(u.getActions({shouldForwardArgs:!0}));c.clear(),c.push(V),mm(V.length>0,l)};this._store.add(u.onDidChange(p)),p();let h=Kf(s);h.wordWrap="off",h.wrappingStrategy="advanced",h.lineNumbers="off",h.glyphMargin=!1,h.lineDecorationsWidth=0,h.lineNumbersMinChars=0,h.folding=!1,h.minimap={enabled:!1},h.scrollbar={vertical:"hidden",horizontal:"hidden",alwaysConsumeMouseWheel:!0},h.renderLineHighlight="none",h.fontFamily=HN,h.fontSize=13,h.lineHeight=20,h.cursorWidth=1,h.padding={top:2,bottom:2};let g={isSimpleWidget:!0,contributions:aa.getSomeEditorContributions([GW.ID])};this._input=this._store.add(n.createInstance(jr,this._inputContainer,h,g));let f=this._store.add(r.createModel("",null,A.parse(`gutter-input:${Date.now()}`),!0));this._input.setModel(f);let v=this._store.add(n.createInstance(Ln,this._toolbarContainer,D.InlineChatInput,{telemetrySource:"inlineChatInput.toolbar",hiddenItemStrategy:-1,toolbarOptions:{primaryGroup:()=>!0},menuOptions:{shouldForwardArgs:!0}})),b=rb.get(this._editorObs.editor);this._stickyScrollHeight=b?ui(b.onDidChangeStickyScrollHeight,()=>b.stickyScrollWidgetHeight):Oo(0);let S=Le(this,0),y=new eL(()=>{S.set(yl(v.getElement()),void 0)});this._store.add(y),this._store.add(y.observe(v.getElement()));let w=ui(this,this._input.onDidChangeModelContent,()=>this._input.getContentWidth()),k=ui(this,this._input.onDidContentSizeChange,()=>this._input.getContentHeight());this._layoutData=Ce(V=>{let G=w.read(V)+6+S.read(V),$=220,te=600,pe=this._input.getOption(149)==="on"?te:Math.max($,Math.min(G,te)),de=this._input.getOption(75),se=Math.min(k.read(V),3*de);return G>pe&&this._input.updateOptions({wordWrap:"on"}),{editorPad:6,toolbarWidth:S.read(V),totalWidth:pe,height:se}}),this._store.add(he(V=>{let{editorPad:U,toolbarWidth:G,totalWidth:$,height:te}=this._layoutData.read(V),pe=$-G-U;this._container.style.width=`${$}px`,this._inputContainer.style.width=`${pe}px`,this._input.layout({width:pe,height:te})})),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(V=>{this._toolbarContainer.classList.toggle("fake-scroll-decoration",V.scrollTop>0)}));let T=Nwi.bindTo(this._contextKeyService);this._store.add(this._input.onDidChangeModelContent(()=>{T.set(this._input.getModel().getValue().trim().length>0)})),this._store.add(Z(()=>T.reset()));let N=Owi.bindTo(this._contextKeyService);this._store.add(this._input.onDidFocusEditorText(()=>N.set(!0))),this._store.add(this._input.onDidBlurEditorText(()=>N.set(!1))),this._store.add(Z(()=>N.reset())),this._store.add(this._input.onKeyDown(V=>{if(V.keyCode===18&&!c.isEmpty()){let U=this._input.getModel(),G=this._input.getPosition();G&&G.lineNumber===U.getLineCount()&&(V.preventDefault(),V.stopPropagation(),c.focus(0))}})),this._store.add(j(c.domNode,"keydown",V=>{let U=new Ii(V);if(U.keyCode===9)U.preventDefault(),U.stopPropagation(),this.hide();else if(U.keyCode===16){let G=c.viewItems[0];G?.element&&ts(G.element)&&(U.preventDefault(),U.stopPropagation(),this._input.focus())}},!0));let O=this._store.add(Vn(this._domNode));this._store.add(O.onDidBlur(()=>this.hide()))}get value(){return this._input.getModel().getValue().trim()}show(e,t,o,n){this._showStore.clear(),this._input.updateOptions({wordWrap:"off",placeholder:n}),this._input.getModel().setValue(""),this._anchorLineNumber=e,this._anchorLeft=t,this._anchorAbove=o,this._updatePosition(),this._showStore.add(this._editorObs.createOverlayWidget({domNode:this._domNode,position:this._position,minContentWidthInPx:Oo(0),allowEditorOverflow:!0})),o&&this._updatePosition(),this._showStore.add(this._editorObs.editor.onDidScrollChange(()=>{let s=this._editorObs.editor.getVisibleRanges().some(c=>this._anchorLineNumber>=c.startLineNumber&&this._anchorLineNumber<=c.endLineNumber),l=!!this._input.getModel().getValue();!s&&!l?this.hide():this._updatePosition()})),setTimeout(()=>this._input.focus(),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&&ts(e)&&this._editorObs.editor.focus(),this._position.set(null,void 0),this._input.getModel().setValue(""),this._showStore.clear()}};BMe=I([m(1,X),m(2,qt),m(3,F),m(4,Ct),m(5,B)],BMe);var HMe=class extends C{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 P);this._position=Le(this,null);this._minContentWidthInPx=Oo(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._statusNode=document.createElement("div"),this._statusNode.classList.add("status"),this._icon=R(this._statusNode,_("span")),this._message=R(this._statusNode,_("span.message")),this._container.appendChild(this._statusNode),this._toolbarNode=document.createElement("div"),this._toolbarNode.classList.add("toolbar");let r=rb.get(this._editorObs.editor);this._stickyScrollHeight=r?ui(r.onDidChangeStickyScrollHeight,()=>r.stickyScrollWidgetHeight):Oo(0)}show(e){So(this._editorObs.editor.hasModel()),this._showStore.clear();let t=Ce(c=>e.editingSession.readEntry(e.uri,c)),o=Ce(c=>{let u=e?.chatModel;if(!e||!u)return;let p=u.lastRequestObs.read(c)?.response;if(!p)return{message:d(10600,null),icon:q.modify(M.loading,"spin")};if(p.isComplete){if(p.result?.errorDetails)return{message:d(10598,null),icon:M.error};let v=t.read(c)?.changesCount.read(c)??0;return{message:v===0?d(10595,null):v===1?d(10596,null):d(10597,null,v),icon:M.check}}if(p.isPendingConfirmation.read(c))return{message:d(10599,null),icon:M.error};let g=ff({equalsFn:()=>!1},p.onDidChange,()=>p.response.value).read(c).filter(f=>f.kind==="progressMessage"||f.kind==="toolInvocation").at(-1);return g?.kind==="toolInvocation"?{message:g.invocationMessage,icon:q.modify(M.loading,"spin")}:g?.kind==="progressMessage"?{message:g.content,icon:q.modify(M.loading,"spin")}:{message:d(10600,null),icon:q.modify(M.loading,"spin")}});this._showStore.add(he(c=>{let u=o.read(c);u?(this._message.innerText=qa(u.message),this._icon.className="",this._icon.classList.add(...q.asClassNameArray(u.icon))):(this._message.innerText="",this._icon.className="")})),this._showStore.add(he(c=>{let p=e.chatModel.lastRequestObs.read(c)?.response?.isPendingConfirmation.read(c);p&&this._logService.info(`[InlineChat] UNEXPECTED approval needed: ${p.detail??"unknown"}`)})),this._container.appendChild(this._toolbarNode),this._showStore.add(Z(()=>this._toolbarNode.remove()));let n=this;this._showStore.add(this._instaService.createInstance(Ln,this._toolbarNode,D.ChatEditorInlineExecute,{telemetrySource:"inlineChatProgress.overlayToolbar",hiddenItemStrategy:0,toolbarOptions:{primaryGroup:()=>!0,useSeparatorsInPrimaryActions:!0},menuOptions:{renderShortTitle:!0},actionViewItemProvider:(c,u)=>{let p=["inlineChat2.cancel","inlineChat2.keep","inlineChat2.close"];if(p.concat(["inlineChat2.undo"]).includes(c.id))return new Cet(c,{...u,keybinding:void 0},t,void 0,n._keybindingService,p)}}));let r=this._editorObs.getOption(75),s=Le(this,0),l=new eL(()=>{s.set(this._domNode.offsetWidth,void 0)});this._showStore.add(l),this._showStore.add(l.observe(this._domNode)),this._showStore.add(he(c=>{let u=this._editorObs.layoutInfo.read(c),p=this._stickyScrollHeight.read(c),h=s.read(c),g=Math.round(r.read(c)*2/3),f=u.contentWidth-2*g;this._domNode.style.maxWidth=`${f}px`;let v=p+g,b=u.width-h-u.verticalScrollbarWidth-u.minimap.minimapWidth-g;this._position.set({preference:{top:v,left:b},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()}};HMe=I([m(1,F),m(2,_e),m(3,ne)],HMe);var xet=class extends _x{constructor(e,t,o,n,r,s){super(e);this._options=t;this._contextMenuService=o;this._keybindingService=n;this._hoverService=s;this._store=new P;this._updateStore=new P;this._onDidChange=new E;this.onDidChange=this._onDidChange.event;this._actionRunner=this._store.add(new as),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(Gg());for(let r=0;r<e.length;r++){let s=r>0,l=e[r],c,u,p=l.tooltip||l.label;if(l instanceof $l||(p=this._keybindingService.appendKeybinding(p,l.id)),l instanceof $l&&l.actions.length>0){let[v,...b]=l.actions;c=v,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,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 Eo&&q.isThemeIcon(c.item.icon))if(!h)u.icon=c.item.icon;else{let v=f??c.label;u.label=Mr(v)?new xe(`$(${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(1803,null),small:this._options?.small});r.icon=M.dropDownButton,r.element.classList.add("default-colors","monaco-text-button"),r.enabled=!0,this._updateStore.add(this._hoverService.setupManagedHover(n,r.element,d(1803,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)}};xet=I([m(2,ze),m(3,_e),m(4,Te),m(5,tt)],xet);var QF=class extends xet{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=hl(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")}};QF=I([m(3,qt),m(4,X),m(5,ze),m(6,_e),m(7,Te),m(8,tt)],QF);var Ado="workbench.action.chat.markHelpful",mee="workbench.action.chat.markUnhelpful",UMe="config.telemetry.feedback.enabled";function Ndo(){W(class extends K{constructor(){super({id:"workbench.action.chat.markHelpful",title:L(5565,"Helpful"),f1:!1,category:vi,icon:M.thumbsup,toggled:ie.responseVote.isEqualTo("up"),menu:[{id:D.ChatMessageFooter,group:"navigation",order:2,when:x.and(ie.extensionParticipantRegistered,ie.isResponse,ie.responseHasError.negate(),x.has(UMe))},{id:IB,group:"navigation",order:1,when:x.and(ie.extensionParticipantRegistered,ie.isResponse,ie.responseHasError.negate(),x.has(UMe))}]})}run(i,...e){let t=e[0];if(!Vi(t))return;i.get(Si).notifyUserAction({agentId:t.agent?.id,command:t.slashCommand?.name,sessionResource:t.session.sessionResource,requestId:t.requestId,result:t.result,action:{kind:"vote",direction:1,reason:void 0}}),t.setVote(1),t.setVoteDownReason(void 0)}}),W(class extends K{constructor(){super({id:mee,title:L(5568,"Unhelpful"),f1:!1,category:vi,icon:M.thumbsdown,toggled:ie.responseVote.isEqualTo("down"),menu:[{id:D.ChatMessageFooter,group:"navigation",order:3,when:x.and(ie.extensionParticipantRegistered,ie.isResponse,x.has(UMe))},{id:IB,group:"navigation",order:2,when:x.and(ie.extensionParticipantRegistered,ie.isResponse,ie.responseHasError.negate(),x.has(UMe))}]})}run(i,...e){let t=e[0];if(!Vi(t))return;let o=e[1];if(typeof o!="string")return;t.setVote(0),t.setVoteDownReason(o),i.get(Si).notifyUserAction({agentId:t.agent?.id,command:t.slashCommand?.name,sessionResource:t.session.sessionResource,requestId:t.requestId,result:t.result,action:{kind:"vote",direction:0,reason:t.voteDownReason}})}}),W(class extends K{constructor(){super({id:"workbench.action.chat.reportIssueForBug",title:L(5567,"Report Issue"),f1:!1,category:vi,icon:M.report,menu:[{id:D.ChatMessageFooter,group:"navigation",order:4,when:x.and(ie.responseSupportsIssueReporting,ie.isResponse,x.has(UMe))},{id:IB,group:"navigation",order:3,when:x.and(ie.responseSupportsIssueReporting,ie.isResponse,x.has(UMe))}]})}run(i,...e){let t=e[0];if(!Vi(t))return;i.get(Si).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(5562,"Retry"),f1:!1,category:vi,icon:M.refresh,menu:[{id:D.ChatMessageFooter,group:"navigation",when:x.and(ie.isResponse,x.in(ie.itemId.key,ie.lastItemId.key))},{id:D.ChatEditingWidgetToolbar,group:"navigation",when:Yj,order:0}]})}async run(i,...e){let t=i.get(At),o=i.get(NO),n=i.get(Si),r=i.get(B),s=i.get(ct),l=e[0];if(yXi(l)&&(l=t.getWidgetBySessionResource(l.sessionResource)?.viewModel?.getItems().at(-1)),!Vi(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(5564,null),message:S.length===1?d(5560,null,Ye(S[0].modifiedURI)):d(5563,null,S.length),primaryButton:d(5561,null),checkbox:{label:d(5559,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(5566,"Insert into Notebook"),f1:!1,category:vi,icon:M.insert,menu:{id:D.ChatMessageFooter,group:"navigation",isHiddenByDefault:!0,when:x.and(Ua,ie.isResponse,ie.responseIsFiltered.negate())}})}async run(i,...e){let t=e[0];if(!Vi(t))return;let o=i.get(ee);if(o.activeEditorPane?.getId()===qL){let n=o.activeEditorPane.getControl();if(!n.hasModel()||n.isReadOnly)return;let r=t.response.toString(),s=p6o(r),l=n.getFocus(),c=Math.max(l.end,0);await i.get(ma).apply([new Iv(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 p6o(a){let e=new Yc.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 _Bt="http://_vscodecontentref_";function VCi(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=Ye(t.inlineReference):nv(t.inlineReference)?r=Ye(t.inlineReference.uri):r=t.inlineReference.name);let s=n?.kind==="markdownContent"?n.content.value:"";if(g6o(s))if(n?.kind==="markdownContent"){let l=ZZ(n.content,new xe(r));e[o]={...n,content:l}}else e.push({content:new xe(r),kind:"markdownContent"});else{let l=i++,c=A.parse(_Bt).with({path:String(l)}),u=`[${r}](${c.toString()})`,p={[l]:t};if(n?.kind==="markdownContent"){let h=ZZ(n.content,new xe(u));e[o]={...n,content:h,inlineReferences:{...p,...n.inlineReferences||{}}}}else e.push({content:new xe(u),inlineReferences:p,kind:"markdownContent"})}}else if(t.kind==="markdownContent"&&n?.kind==="markdownContent")if(GVt(n.content,t.content)){let r=ZZ(n.content,t.content);e[o]={...n,content:r}}else n.inlineReferences&&h6o(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=ZZ(n.content,new xe(s));e[o]={...n,content:l}}else e.push({content:new xe(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=ZZ(n.content,new xe(l));e.splice(o,1),e.push({...n,content:c})}}else e.push(t)}return e}var m6o=new RegExp(`^(\\[.*?\\]\\(${_Bt}/\\d+\\))+$`);function h6o(a){return m6o.test(a)}function g6o(a){let i=a.split(`
`),e=!1,t="",o=0,n=[];for(let r of i){let s=r.trimStart();if(e){let c=TBt(s,t);c>=o&&s.substring(c).trim()===""&&(e=!1,n.length=0);continue}let l=s[0];if(l==="`"||l==="~"){let c=TBt(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||f6o(n.join(`
`))}function TBt(a,i){let e=0;for(;e<a.length&&a[e]===i;)e++;return e}function f6o(a){let i=0;for(;i<a.length;){if(a[i]!=="`"){i++;continue}let e=TBt(a.substring(i),"`");i+=e;let t=!1;for(;i<a.length;){if(a[i]!=="`"){i++;continue}let o=TBt(a.substring(i),"`");if(i+=o,o===e){t=!0;break}}if(!t)return!0}return!1}function zMe(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 Odo(a){let i=/<vscode_codeblock_uri[^>]* subAgentInvocationId="([^"]*)"/ms.exec(a);if(i)try{return decodeURIComponent(i[1])}catch{return i[1]}}function Fdo(a){return a.includes("<vscode_codeblock_uri isEdit")}function Wdo(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 a2=class{constructor(i,e,t,o,n){this.questions=i;this.allowSkip=e;this.resolveId=t;this.data=o;this.isUsed=n;this.kind="questionCarousel";this.completion=new Go}toJSON(){return{kind:this.kind,questions:this.questions,allowSkip:this.allowSkip,resolveId:this.resolveId,data:this.data,isUsed:this.isUsed}}};var YF=class extends C{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===Fr)&&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=ht.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=Wdo(e.text),l=v6o(s.newText,e.languageId);r&&(r.vulns=s.vulnerabilities);let c=zMe(l);return c&&(r&&(r.codemapperUri=c.uri,r.isEdit=c.isEdit,r.subAgentInvocationId=c.subAgentInvocationId),l=c.textWithoutResult),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=Qd(Je.wrap(new TextEncoder().encode(e.toString())),!1,!0);return A.from({scheme:Y.vscodeChatCodeBlock,authority:s,path:`/${t.id}/${r}`,fragment:n?JSON.stringify(n):void 0})}getUriMetaData(e){if(Vi(e))return{references:e.contentReferences.map(t=>{if(typeof t.reference=="string")return;let o=PYi(t.reference)?t.reference.value:t.reference;if(o)return A.isUri(o)?{uri:o.toJSON()}:{uri:o.uri.toJSON(),range:o.range}})}}};YF=I([m(1,kt),m(2,Nt)],YF);function v6o(a,i){return i==="php"&&!a.trim().startsWith("<?")?`<?php
${a}`:a}var DBt=Re("extension-default-icon",M.extensionsLarge,d(16886,null)),XF=Re("extensions-verified-publisher",M.verifiedFilled,d(16888,null)),ket=J("extensionIcon.verifiedForeground",WI,d(16887,null),!1);var l2=class extends C{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=bt(".chat-agent-hover@root",[bt(".chat-agent-hover-header",[bt(".chat-agent-hover-icon@icon"),bt(".chat-agent-hover-details",[bt(".chat-agent-hover-name@name"),bt(".chat-agent-hover-extension",[bt(".chat-agent-hover-extension-name@extensionName"),bt(".chat-agent-hover-separator@separator"),bt(".chat-agent-hover-publisher@publisher")])])]),bt(".chat-agent-hover-warning@warning"),bt("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,Qo(XF));this.publisherName=_("span.chat-agent-hover-publisher-name"),R(n.publisher,r,this.publisherName),n.warning.appendChild(Qo(M.warning)),n.warning.appendChild(_("span",void 0,d(7097,null)))}setAgent(e){let t=this.chatAgentService.getAgent(e);if(t.metadata.icon instanceof A){let r=_("img.icon");r.src=gn.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}`:Hj(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 $e);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())})}}};l2=I([m(0,br),m(1,zi),m(2,mz)],l2);function KMe(a,i){return{actions:[{commandId:mRe,label:d(7098,null),run:()=>{let e=a();e&&i.executeCommand(mRe,[e.extensionId.value])}}]}}var Eet=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"]),hee=class{constructor(i,e,t,o,n){this.hoverService=o;this.markdownRendererService=n}render(i,e,t){e={...e,sanitizerConfig:{replaceWithPlaintext:!0,allowedTags:{override:Eet},...e?.sanitizerConfig,allowedLinkSchemes:{augment:[to.urlProtocol]},remoteImageIsAllowed:r=>!1}};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 P;return i.element.querySelectorAll("a").forEach(t=>{if(t.title){let o=t.title;t.title="",e.add(this.hoverService.setupManagedHover(Ni("element"),t,o))}}),{element:i.element,dispose:()=>{i.dispose(),e.dispose()}}}};hee=I([m(0,kt),m(1,Qe),m(2,B),m(3,tt),m(4,Qn)],hee);var GMe=class extends C{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=_t(),r=document.createElement("span");this.domNode.appendChild(r),r.innerText=yu+e.name,this._store.add(this._hoverService.setupDelayedHover(r,{content:e.description,style:1},{groupId:n}));let s=d(7099,null,yu,e.name),l=new Mi(this.domNode,{ariaLabel:s});l.icon=M.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}};GMe=I([m(2,tt)],GMe);var $Me=class extends C{constructor(e,t,o,n){super();this.content=e;this.domNode=_(".chat-rate-limited-widget"),R(this.domNode,_("span")).classList.add(...q.asClassNameArray(M.info));let s=R(this.domNode,_(".chat-rate-limited-message")),l=R(s,_("div"));l.textContent=d(7100,null);let c=this._register(new Mi(s,{...Ko,supportIcons:!0}));c.label=d(7101,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)}};$Me=I([m(1,ge),m(2,Te),m(3,vr)],$Me);function qMe(a,i){let e=new P;return e.add(j(a,re.CLICK,t=>{t.detail!==2&&($t.stop(t,!0),i(BCi(new yn(Me(a),t))))})),e.add(j(a,re.DBLCLICK,t=>{$t.stop(t,!0),i(BCi(new yn(Me(a),t),!0))})),e.add(j(a,re.KEY_DOWN,t=>{let o=BCi(new Ii(t));o&&($t.stop(t,!0),i(o))})),e}function BCi(a,i){if(a instanceof Ii){let e;return a.equals(3)||it&&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 JF="revealInExplorer",jMe="workbench.action.files.revert",LBt="explorer.openToSide",RBt="explorer.openWith",MBt="selectForCompare",PBt="compareSelected",ABt="compareFiles",Tet="workbench.files.action.compareWithSaved",vme="copyFilePath",bme="copyRelativeFilePath",_et="workbench.action.files.saveAs",NBt=L(10327,"Save As..."),QMe="workbench.action.files.save",HCi=L(10325,"Save"),OBt="workbench.action.files.saveWithoutFormatting",Vdo=L(10328,"Save without Formatting"),YMe="saveAll",Bdo=L(10326,"Save All"),Sme="workbench.files.action.saveAllInGroup",FBt="workbench.action.files.saveFiles",c3=new Q("groupFocusedInOpenEditors",!1),XMe=new Q("dirtyEditorFocusedInOpenEditors",!1),Det=new Q("readonlyEditorFocusedInOpenEditors",!1),WBt=new Q("openEditorsSelectedFileOrUntitled",!0),Let=new Q("resourceSelectedForCompare",!1),VBt="removeRootFolder",Hdo=d(10324,null),Udo="previousCompressedFolder",zdo="nextCompressedFolder",Kdo="firstCompressedFolder",Gdo="lastCompressedFolder",ZF="workbench.action.files.newUntitledFile",BBt=L(10323,"New Untitled Text File"),$do="workbench.action.files.newFile";var HBt=class{constructor(i){this.root=new UBt;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 UBt;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}},UBt=class a{constructor(){this.value=new UCi;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(`
`)}},UCi=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 zBt(e));else if(i==="")this.epsilon.push(new zBt(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 qdo=/\$[({](capture|basename|dirname|extname)[)}]/g,zBt=class{constructor(i){this.tokens=[];qdo.lastIndex=0;let e,t=0;for(;e=qdo.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 KBt=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 Tg(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 si(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(),Ue(this._listener)}},gee=class gee{constructor(i,e,t,o,n,r,s,l,c,u=Ra(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 gee(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=>La(l,s.resource)),o.children))for(let l=0,c=o.children.length;l<c;l++){let u=gee.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 vt;e.children.forEach(n=>{o.set(n.resource,n)}),e.children.clear(),i.children.forEach(n=>{let r=o.get(n.resource);r?(gee.mergeLocalWithDisk(n,r),e.addChild(r),o.delete(n.resource)):e.addChild(n)}),o.forEach(n=>{n instanceof d3&&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=gee.create(this.fileService,this.configService,this.filesConfigService,n,this);gee.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=Oi(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 HBt(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=je(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&&mr(this.resource.authority,i.authority)&&(e?Uk(i.path,this.resource.path):i.path.startsWith(this.resource.path))?this.findByPath(ih(i.path,Lo.sep),this.resource.path.length,e):null}findByPath(i,e,t){if(b1i(ih(this.resource.path,Lo.sep),i,t))return this;if(this.isDirectory){for(;e<i.length&&i[e]===Lo.sep;)e++;let o=i.indexOf(Lo.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([mi],gee.prototype,"children",1);var Tg=gee,d3=class extends Tg{constructor(i,e,t,o,n){super(A.file(""),i,e,t,o,n),this._isDirectoryResolved=!0}};var za=ae("explorerService");function b6o(a){let i=a.lastFocusedList,e=i?.getHTMLElement();if(e&&sa(e)){let t;if(i instanceof hc){let o=i.getFocusedElements();o.length&&(t=o[0])}else if(i instanceof gv){let o=i.getFocus();o.length&&(t=o[0])}return t}}function Ime(a,i,e){if(A.isUri(a))return a;let t=b6o(e);return t instanceof Tg?t.resource:t instanceof wh?t.getResource():no.getOriginalUri(i.activeEditor,{supportSideBySide:1})}function e0(a,i,e,t,o){let n=i.lastFocusedList,r=n?.getHTMLElement();if(r&&sa(r)){if(n instanceof gv&&n.getFocus().every(u=>u instanceof Tg)){let u=o.getContext(!0,!0);if(u.length)return u.map(p=>p.resource)}if(n instanceof hc){let u=si(n.getSelectedElements().filter(v=>v instanceof wh).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 wh){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=>no.getOriginalUri(h)).filter(h=>!!h)}}let c=Ime(a,e,i);return c?[c]:[]}function zCi(a){let i=a.get(fo).lastFocusedList,e=i?.getHTMLElement();if(e&&sa(e)&&i instanceof hc){let t=si(i.getSelectedElements().filter(s=>s instanceof wh)),o=i.getFocusedElements(),n=o.length?o[0]:void 0,r;return n instanceof wh&&(r=n),t.some(s=>s===r)?t:r?[r]:void 0}}var TB=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 $e,o=this.progressService.withProgress({location:10,delay:800,cancellable:!0,title:d(10357,null)},async n=>this.doUpload(i,this.toTransfer(e),n,t.token),()=>t.dispose(!0));return this.progressService.withProgress({location:Cb,delay:500},()=>o),o}toTransfer(i){if(_zi(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 wM(p=>{t.report(p[p.length-1])},1e3),filesTotal:r.length,filesUploaded:0,totalBytesUploaded:0},c=new OT(TB.MAX_PARALLEL_UPLOADS);await fn.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(GCi(p.name));if(!g||(await this.explorerService.applyBulkEdit([new tu(je(i.resource,p.name),void 0,{recursive:!0,folder:i.getChild(p.name)?.isDirectory})],{undoLabel:d(10354,null,p.name),progressLabel:d(10355,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<ll.MB?n.filesTotal===1?g=`${i.name}`:g=d(10359,null,n.filesUploaded,n.filesTotal,ll.formatSize(h)):g=d(10358,null,i.name,ll.formatSize(s),ll.formatSize(u),ll.formatSize(h)),n.progressScheduler.work({message:g})};n.filesUploaded++,l(0,0);let c=je(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>ll.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 OT(TB.MAX_PARALLEL_UPLOADS);await fn.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=Obe({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=Je.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=Je.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)})}};TB=I([m(0,Bo),m(1,ct),m(2,za),m(3,ee),m(4,be)],TB);var JMe=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 $e,n=this.progressService.withProgress({location:10,delay:800,cancellable:!0,title:d(10339,null)},async()=>await this.doImport(i,e,t,o.token),()=>o.dispose(!0));return this.progressService.withProgress({location:Cb,delay:500},()=>n),n}async doImport(i,e,t,o){let n=si((await this.instantiationService.invokeFunction(c=>TIe(c,e))).map(c=>c.resource));await Promise.all(n.map(c=>this.fileService.activateProvider(c.scheme)));let r=si(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(10337,null):d(10335,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(10330,null):d(10329,null),run:()=>2}),p=l.length>1?d(10348,null):d(10347,null,Ye(l[0].uri))):p=l.length>1?d(10336,null):d(10334,null,Ye(l[0].uri));let{result:g}=await this.dialogService.prompt({type:St.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 Tg)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=si(await fn.settled(e.map(async h=>{if(!await this.fileService.exists(h)){s++;return}if(!(n.has(r?Ye(h):Ye(h).toLowerCase())&&!(await this.dialogService.confirm(GCi(Ye(h)))).confirmed))return h})));s>0&&this.notificationService.error(s>1?d(10350,null):d(10349,null));let c=l.map(h=>{let g=Ye(h),f=je(i.resource,g);return new tu(h,f,{overwrite:!0,copy:!0})}),u=this.configurationService.getValue().explorer.confirmUndo;if(await this.explorerService.applyBulkEdit(c,{undoLabel:l.length===1?d(10351,null,Ye(l[0])):d(10352,null,l.length),progressLabel:l.length===1?d(10338,null,Ye(l[0])):d(10340,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}})}}}};JMe=I([m(0,be),m(1,oi),m(2,Pe),m(3,B),m(4,ct),m(5,Of),m(6,za),m(7,ee),m(8,Bo),m(9,Ne),m(10,F)],JMe);var u3=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 $e,t=this.progressService.withProgress({location:10,delay:800,cancellable:Gt,title:d(10344,null)},async o=>this.doDownload(i,o,e),()=>e.dispose(!0));return this.progressService.withProgress({location:Cb,delay:500},()=>t),t}async doDownload(i,e,t){for(let o of i){if(t.token.isCancellationRequested)return;Gt?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*ll.MB,r=o.isDirectory||o.size>n,s=Ki();if(r&&Sx.supported(s))try{let l=await s.showDirectoryPicker(),c={startTime:Date.now(),progressScheduler:new wM(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=gn.uriToBrowserUri(o.resource)}t.token.isCancellationRequested||Nzi(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 P;c.add(Z(()=>e.close())),c.add(wd(o.onCancellationRequested)(()=>{c.dispose(),s(CI())})),j0(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>ll.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<ll.MB?o.filesTotal===1?r=i:r=d(10346,null,o.filesDownloaded,o.filesTotal,ll.formatSize(n)):r=d(10345,null,i,ll.formatSize(o.fileBytesDownloaded),ll.formatSize(e),ll.formatSize(n)),o.progressScheduler.work({message:r})}async doDownloadNative(i,e,t){e.report({message:i.name});let o,n=this.storageService.get(u3.LAST_USED_DOWNLOAD_PATH_STORAGE_KEY,-1);n?o=je(A.file(n),i.name):o=je(i.isDirectory?await this.fileDialogService.defaultFolderPath(Y.file):await this.fileDialogService.defaultFilePath(Y.file),i.name);let r=await this.fileDialogService.showSaveDialog({availableFileSystems:[Y.file],saveLabel:d(10342,null),title:d(10331,null),defaultUri:o});r?(this.storageService.store(u3.LAST_USED_DOWNLOAD_PATH_STORAGE_KEY,ci(r).fsPath,-1,1),await this.explorerService.applyBulkEdit([new tu(i.resource,r,{overwrite:!0,copy:!0})],{undoLabel:d(10341,null,i.name),progressLabel:d(10343,null,i.name),progressLocation:10})):t.cancel()}};u3=I([m(0,be),m(1,za),m(2,Bo),m(3,ne),m(4,dn),m(5,le)],u3);function GCi(a){return{message:d(10333,null,a),detail:d(10353,null),primaryButton:d(10356,null),type:"warning"}}function Qdo(a){return a.length>1?{message:d(10332,null,a.length),detail:Xw(a)+`
`+d(10353,null),primaryButton:d(10356,null),type:"warning"}:GCi(Ye(a[0]))}var wme="explorer.newFile",$Ci=L(10245,"New File..."),tPe="explorer.newFolder",qCi=L(10246,"New Folder..."),Xdo=d(10255,null),Jdo=d(10214,null),Zdo=d(10208,null),euo=d(10251,null),iHt=new Q("fileCopied",!1),jCi="explorer.download",tuo=d(10229,null),QCi="explorer.upload",iuo=d(10277,null),Ydo="explorer.confirmDelete",S6o=5e6;async function ouo(a,i){a&&(a.indexOf("/")>=0||a.indexOf("\\")>=0)&&await i.refresh()}async function YCi(a,i,e,t,o,n,r,s=!1,l=!1){let c;r?c=ri?d(10217,null):d(10218,null):c=d(10216,null);let u=fGe(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(10224,null):u[0].isDirectory?p.size===1?f=d(10226,null,u[0].name):f=d(10225,null,u[0].name,p.size):f=d(10223,null,u[0].name),(await e.confirm({type:"warning",message:f,detail:d(10227,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(10252,null):f[0].isDirectory?v=d(10254,null,u[0].name):v=d(10253,null,u[0].name),!(await e.confirm({type:"warning",message:v,detail:d(10206,null),primaryButton:d(10205,null)})).confirmed)return}}let h,g=u.some(f=>f.isDirectory)?d(10240,null):u.length>1?d(10261,null):d(10260,null);if(s||t.getValue(Ydo)===!1)h={confirmed:!0};else if(r){let{message:f,detail:v}=I6o(u);v+=v?`
`:"",ri?v+=u.length>1?d(10274,null):d(10273,null):v+=u.length>1?d(10276,null):d(10275,null),h=await e.confirm({message:f,detail:v,primaryButton:c,checkbox:{label:d(10228,null)}})}else{let{message:f,detail:v}=y6o(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(Ydo,!1),!!h.confirmed)try{let f=u.map(b=>new tu(b.resource,void 0,{recursive:!0,folder:b.isDirectory,ignoreIfNotExists:l,skipTrashBin:!r,maxSize:S6o})),v={undoLabel:u.length>1?d(10215,null,u.length):d(10219,null,u[0].name),progressLabel:u.length>1?d(10221,null,u.length):d(10222,null,u[0].name)};await a.applyBulkEdit(f,v)}catch(f){let v,b,S;if(r?(v=ri?d(10184,null):d(10272,null),b=g,S=d(10220,null)):(v=In(f,!1),S=d(10263,null)),(await e.confirm({type:"warning",message:v,detail:b,primaryButton:S})).confirmed)return r&&(r=!1),s=!0,l=!0,YCi(a,i,e,t,o,n,r,s,l)}}function I6o(a){return nuo(a)?{message:d(10198,null,a.length),detail:Xw(a.map(i=>i.resource))}:a.length>1?a[0].isDirectory?{message:d(10201,null,a.length),detail:Xw(a.map(i=>i.resource))}:{message:d(10200,null,a.length),detail:Xw(a.map(i=>i.resource))}:a[0].isDirectory&&!a[0].isSymbolicLink?{message:d(10199,null,a[0].name),detail:""}:{message:d(10197,null,a[0].name),detail:""}}function y6o(a){return nuo(a)?{message:d(10193,null,a.length),detail:Xw(a.map(i=>i.resource))}:a.length>1?a[0].isDirectory?{message:d(10196,null,a.length),detail:Xw(a.map(i=>i.resource))}:{message:d(10195,null,a.length),detail:Xw(a.map(i=>i.resource))}:a[0].isDirectory?{message:d(10194,null,a[0].name),detail:""}:{message:d(10192,null,a[0].name),detail:""}}function nuo(a){let i=a.find(t=>t.isDirectory),e=a.find(t=>!t.isDirectory);return!!i&&!!e}async function GBt(a,i,e,t,o,n){let r=typeof o.resource=="string"?o.resource:Ra(o.resource),s=je(t.resource,r);if(!(n==="disabled"&&!await C6o(i,e,s))){for(;!o.allowOverwrite&&a.findClosest(s);)n!=="disabled"&&(r=w6o(r,!!o.isDirectory,n)),s=je(t.resource,r);return s}}function w6o(a,i,e){if(e==="simple"){let p=a,h="";i||(h=Am(a),p=No(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 C6o(a,i,e){if(!await a.exists(e))return!0;let{confirmed:o}=await i.confirm({type:St.Warning,message:d(10203,null,No(e.path)),primaryButton:d(10258,null)});return o}var $Bt=class a extends K{static{this.ID="workbench.files.action.compareFileWith"}static{this.LABEL=L(10238,"Compare Active File With...")}constructor(){super({id:a.ID,title:a.LABEL,f1:!0,category:We.File,precondition:fr,metadata:{description:L(10187,"Opens a picker to select a file to diff with the active editor.")}})}async run(i){let e=i.get(ee),t=i.get(Nt),o=i.get(Ge),n=e.activeEditor,r=no.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}})}}}},Pet=class a extends K{static{this.ID="workbench.action.toggleAutoSave"}constructor(){super({id:a.ID,title:L(10270,"Toggle Auto Save"),f1:!0,category:We.File,metadata:{description:L(10271,"Toggle the ability to save files automatically after typing")}})}run(i){return i.get(lr).toggleAutoSave()}},Ret=class extends st{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(In(t,!1))}}};Ret=I([m(2,ge),m(3,Ne),m(4,Wa)],Ret);var ZMe=class extends Ret{static{this.ID="workbench.files.action.saveAllInGroup"}static{this.LABEL=d(10264,null)}get class(){return"explorer-action "+q.asClassName(M.saveAll)}doRun(i){return this.commandService.executeCommand(Sme,{},i)}},fee=class extends st{constructor(e,t,o){super(e,t,q.asClassName(M.closeAll));this.commandService=o}static{this.ID="workbench.files.action.closeGroup"}static{this.LABEL=d(10186,null)}run(e){return this.commandService.executeCommand(f7e,{},e)}};fee=I([m(2,ge)],fee);var qBt=class a extends K{static{this.ID="workbench.files.action.focusFilesExplorer"}static{this.LABEL=L(10236,"Focus on Files Explorer")}constructor(){super({id:a.ID,title:a.LABEL,f1:!0,category:We.File,metadata:{description:L(10237,"Moves focus to the file explorer view container.")}})}async run(i){await i.get(ds).openPaneComposite(Hf,0,!0)}},jBt=class a extends K{static{this.ID="workbench.files.action.showActiveFileInExplorer"}static{this.LABEL=L(10267,"Reveal Active File in Explorer View")}constructor(){super({id:a.ID,title:a.LABEL,f1:!0,category:We.File,metadata:{description:L(10268,"Reveals and selects the active file within the explorer view.")}})}async run(i){let e=i.get(ge),t=i.get(ee),o=no.getOriginalUri(t.activeEditor,{supportSideBySide:1});o&&e.executeCommand(JF,o)}},QBt=class a extends K{static{this.ID="workbench.action.files.showOpenedFileInNewWindow"}static{this.LABEL=L(10247,"Open Active Editor in New Empty Workspace")}constructor(){super({id:a.ID,title:a.LABEL,f1:!0,category:We.File,precondition:xY,metadata:{description:L(10248,"Opens the active editor in a new window with no folders open.")}})}async run(i){let e=i.get(ee),t=i.get(oi),o=i.get(ct),n=i.get(be),r=no.getOriginalUri(e.activeEditor,{supportSideBySide:1});r&&n.hasProvider(r)?t.openWindow([{fileUri:r}],{forceNewWindow:!0}):o.error(d(10249,null))}};function ruo(a,i,e,t){if(e=k6o(e),!e||e.length===0||/^\s+$/.test(e))return{content:d(10230,null),severity:St.Error};if(e[0]==="/"||e[0]==="\\")return{content:d(10234,null),severity:St.Error};let o=si(e.split(/[\\/]/)),n=i.parent;if(e!==i.name){let r=n?.getChild(e);if(r&&r!==i)return{content:d(10233,null,e),severity:St.Error}}if(o.some(r=>!a.hasValidBasename(i.resource,t,r))){let r=e.replace(/\*/g,"\\*");return{content:d(10239,null,x6o(r)),severity:St.Error}}return o.some(r=>/^\s|\s$/.test(r))?{content:d(10235,null),severity:St.Warning}:null}function x6o(a){return a?.length>255?`${a.substr(0,255)}...`:a}function k6o(a){return a&&(a=qD(a,"	"),a=ih(a,"/"),a=ih(a,"\\"),a)}var YBt=class a extends K{static{this.ID="workbench.files.action.compareNewUntitledTextFiles"}static{this.LABEL=L(10188,"Compare New Untitled Text Files")}constructor(){super({id:a.ID,title:a.LABEL,f1:!0,category:We.File,metadata:{description:L(10189,"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}})}},XBt=class a extends K{static{this.ID="workbench.files.action.compareWithClipboard"}static{this.LABEL=L(10190,"Compare Active File with Clipboard")}static{this.SCHEME_COUNTER=0}constructor(){super({id:a.ID,title:a.LABEL,f1:!0,category:We.File,keybinding:{primary:Ai(2089,33),weight:200},metadata:{description:L(10191,"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(Nt),n=i.get(be),r=no.getOriginalUri(e.activeEditor,{supportSideBySide:1}),s=`clipboardCompare${a.SCHEME_COUNTER++}`;if(r&&(n.hasProvider(r)||r.scheme===Y.untitled)){if(!this.registrationDisposal){let u=t.createInstance(Met);this.registrationDisposal=o.registerTextModelContentProvider(s,u)}let l=Ye(r),c=d(10185,null,l);await e.openEditor({original:{resource:r.with({scheme:s})},modified:{resource:r},label:c,options:{pinned:!0}}).finally(()=>{Ue(this.registrationDisposal),this.registrationDisposal=void 0})}}dispose(){Ue(this.registrationDisposal),this.registrationDisposal=void 0}},Met=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)}};Met=I([m(0,Wi),m(1,kt),m(2,Ct)],Met);function E6o(a,i,e){a.prompt(St.Error,In(i,!1),[{label:d(10262,null),run:()=>e()}])}async function suo(a,i){let e=a.get(za),t=a.get(be),o=a.get(B),n=a.get(lr),r=a.get(ee),s=a.get(Ft),l=a.get(Ne),c=a.get(yo),u=a.get(ge),p=a.get(wn),h=!s.isViewVisible(Cb),g=await s.openView(Cb,!0);if(h&&await Pi(500),!g){if(i)throw new Error("Open a folder or workspace first.");return u.executeCommand(ZF)}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 d3(t,o,n,b,i);b.addChild(S);let y=async k=>{try{let T=je(b.resource,k);k.endsWith("/")&&(i=!0),await e.applyBulkEdit([new tu(void 0,T,{folder:i})],{undoLabel:d(10212,null,k),progressLabel:d(10213,null,k),confirmBeforeUndo:!0}),await ouo(k,e),i?await e.select(T,!0):await r.openEditor({resource:T,options:{pinned:!0}})}catch(T){E6o(l,T,()=>y(k))}},w=(await c.getEnvironment())?.os??zo;await e.setEditable(S,{validationMessage:k=>ruo(p,S,k,w),onFinish:async(k,T)=>{b.removeChild(S),await e.setEditable(S,null),T&&y(k)}})}qe.registerCommand({id:wme,handler:async a=>{await suo(a,!1)}});qe.registerCommand({id:tPe,handler:async a=>{await suo(a,!0)}});var auo=async a=>{let i=a.get(za),e=a.get(Ne),t=a.get(yo),o=a.get(wn),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??zo;await i.setEditable(s,{validationMessage:c=>ruo(o,s,c,l),onFinish:async(c,u)=>{if(u){let p=s.parent.resource,h=je(p,c);if(s.resource.toString()!==h.toString())try{await i.applyBulkEdit([new tu(s.resource,h)],{confirmBeforeUndo:n.getValue().explorer.confirmUndo==="verbose",undoLabel:d(10256,null,s.name,c),progressLabel:d(10257,null,s.name,c)}),await ouo(c,i)}catch(g){e.error(g)}}await i.setEditable(s,null)}})},luo=async a=>{let e=a.get(za).getContext(!0).filter(t=>!t.isRoot);e.length&&await YCi(a.get(za),a.get(kp),a.get(ct),a.get(B),a.get(lr),e,!0)},XCi=async a=>{let e=a.get(za).getContext(!0).filter(t=>!t.isRoot);e.length&&await YCi(a.get(za),a.get(kp),a.get(ct),a.get(B),a.get(lr),e,!1)},yme=!1,cuo=async a=>{let i=a.get(za),e=i.getContext(!0);e.length>0&&(await i.setToCopy(e,!1),yme=!1)},duo=async a=>{let i=a.get(za),e=i.getContext(!0);e.length>0&&(await i.setToCopy(e,!0),yme=!0)},T6o=async a=>{let i=a.get(za),e=a.get(Ne),t=a.get(F),o=i.getContext(!0),n=o.length?o:i.roots,r=t.createInstance(u3);try{await r.download(n)}catch(s){throw e.error(s),s}};qe.registerCommand({id:jCi,handler:T6o});var _6o=async a=>{let i=a.get(za),e=a.get(Ne),t=a.get(F),o=i.getContext(!1),n=o.length?o[0]:i.roots[0];try{let r=await Ozi();r&&await t.createInstance(TB).upload(n,r)}catch(r){throw e.error(r),r}};qe.registerCommand({id:QCi,handler:_6o});var uuo=async(a,i)=>{let e=a.get(Wi),t=a.get(za),o=a.get(be),n=a.get(Ne),r=a.get(ee),s=a.get(B),l=a.get(dt),c=a.get(ct),u=a.get(oi),p=t.getContext(!1),g=i&&i.length>0&&s.getValue("explorer.confirmPasteNative"),f=await D6o(i,e,u);if(g&&f.files.length>=1){let w=f.files.length>1?d(10202,null,f.files.length):d(10204,null,No(f.type==="paths"?f.files[0].fsPath:f.files[0].name)),k=f.files.length>1?Xw(f.files.map(N=>{if(A.isUri(N))return N.fsPath;if(f.type==="paths"){let O=Ix(N);if(O)return O}return N.name})):void 0,T=await c.confirm({message:w,detail:k,checkbox:{label:d(10228,null)},primaryButton:d(10250,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=si(await Promise.all(f.files.map(async T=>{if(v.resource.toString()!==T.toString()&&La(v.resource,T))throw new Error(d(10232,null));let N=await o.stat(T),O;l.extUri.isEqual(v.resource,T)?O=v.parent:O=v.isDirectory?v:v.parent;let V=await GBt(t,o,c,O,{resource:T,isDirectory:N.isDirectory,allowOverwrite:yme||b==="disabled"},b);if(V)return{source:T,target:V}})));if(k.length>=1)if(yme){let T=k.map(O=>new tu(O.source,O.target,{overwrite:b==="disabled"})),N={confirmBeforeUndo:s.getValue().explorer.confirmUndo==="verbose",progressLabel:k.length>1?d(10243,null,k.length):d(10244,null,Ra(k[0].target)),undoLabel:k.length>1?d(10241,null,k.length):d(10242,null,Ra(k[0].target))};await t.applyBulkEdit(T,N)}else{let T=k.map(N=>new tu(N.source,N.target,{copy:!0,overwrite:b==="disabled"}));await y(k.map(N=>N.target),T)}w=k.map(T=>T.target)}else{let k=si(await Promise.all(f.files.map(async T=>{let N=v.isDirectory?v:v.parent,O=await GBt(t,o,c,N,{resource:T.name,isDirectory:!1,allowOverwrite:yme||b==="disabled"},b);if(O)return{target:O,edit:new tu(void 0,O,{overwrite:b==="disabled",contents:(async()=>Je.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(In(new Error(d(10231,null,Cn(w))),!1))}finally{yme&&(await t.setToCopy([],!1),yme=!1)}async function y(w,k){let T=s.getValue().explorer.confirmUndo,N={confirmBeforeUndo:T==="default"||T==="verbose",progressLabel:w.length>1?d(10210,null,w.length):d(10211,null,Ra(w[0])),undoLabel:w.length>1?d(10207,null,w.length):d(10209,null,Ra(w[0]))};await t.applyBulkEdit(k,N)}};async function D6o(a,i,e){if(a&&a.length>0){let t=[...a].map(o=>Ix(o)).filter(o=>!!o&&Xl(o)).map(o=>A.file(o));return t.length?{type:"paths",files:t}:{type:"data",files:[...a].filter(o=>!Ix(o))}}else return{type:"paths",files:fGe(await i.readResources(),t=>t)}}var puo=async a=>{let i=a.get(ee),t=a.get(za).getContext(!0);await i.openEditors(t.filter(o=>!o.isDirectory).map(o=>({resource:o.resource,options:{preserveFocus:!0}})))},ePe=class extends K{constructor(e,t,o){super({id:e,title:t,f1:!0,category:We.File,precondition:YEt});this.newReadonlyState=o}async run(e){let t=e.get(ee),o=e.get(lr),n=no.getOriginalUri(t.activeEditor,{supportSideBySide:1});n&&await o.updateReadonly(n,this.newReadonlyState)}},JBt=class a extends ePe{static{this.ID="workbench.action.files.setActiveEditorReadonlyInSession"}static{this.LABEL=L(10265,"Set Active Editor Read-only in Session")}constructor(){super(a.ID,a.LABEL,!0)}},ZBt=class a extends ePe{static{this.ID="workbench.action.files.setActiveEditorWriteableInSession"}static{this.LABEL=L(10266,"Set Active Editor Writeable in Session")}constructor(){super(a.ID,a.LABEL,!1)}},eHt=class a extends ePe{static{this.ID="workbench.action.files.toggleActiveEditorReadonlyInSession"}static{this.LABEL=L(10269,"Toggle Active Editor Read-only in Session")}constructor(){super(a.ID,a.LABEL,"toggle")}},tHt=class a extends ePe{static{this.ID="workbench.action.files.resetActiveEditorReadonlyInSession"}static{this.LABEL=L(10259,"Reset Active Editor Read-only in Session")}constructor(){super(a.ID,a.LABEL,"reset")}};var hI=class extends ek{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 P);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 pue}get editorId(){return Ys.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){Xe(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(H.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!==Y.vscodeUserData&&this.resource.scheme!==Y.file&&this.resource.scheme!==Y.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===UPt):e.find(t=>t.typeId===mF)}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"?lae(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(hK,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:Dj(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:Dj(this,e.preserveViewState,this.editorService)}),t}matches(e){return this===e?!0:e instanceof hI?Xe(e.resource,this.resource):QS(e)?super.matches(e):!1}dispose(){this.model=void 0,this.disposeModelReference(),super.dispose()}disposeModelReference(){Ue(this.cachedTextFileModelReference),this.cachedTextFileModelReference=void 0}};hI=I([m(7,F),m(8,Ho),m(9,Nt),m(10,ot),m(11,be),m(12,lr),m(13,ee),m(14,wn),m(15,Nn),m(16,Sv)],hI);var rxi="saveConflictResolutionContext",JCi="conflictResolution",sxi="learnMoreDirtyWriteError",muo=d(10170,null),Cme=class extends C{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 vt;this.activeConflictResolutionResource=void 0;this.conflictResolutionContext=new Q(rxi,!1,!0).bindTo(o);let c=this._register(s.createInstance(wR));this._register(r.registerTextModelContentProvider(JCi,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 Fa&&o.original.resource?.scheme===JCi&&(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&&Xe(this.activeConflictResolutionResource,t.resource)){if(this.storageService.getBoolean(sxi,-1))return;s=muo,l.push(this.instantiationService.createInstance(iPe)),c.push(this.instantiationService.createInstance(Aet))}else s=d(10169,null,Ye(r)),l.push(this.instantiationService.createInstance(Net,t)),l.push(this.instantiationService.createInstance(nxi,t,o)),c.push(this.instantiationService.createInstance(Fet));else{let h=n.fileOperationResult===5,g=h&&n.options?.unlock,f=n.fileOperationResult===6,v=r.scheme===Y.file;v&&(f||g)?l.push(this.instantiationService.createInstance(exi,t,o,!!g)):h?l.push(this.instantiationService.createInstance(oxi,t,o)):l.push(this.instantiationService.createInstance(txi,t,o)),l.push(this.instantiationService.createInstance(Oet,t)),l.push(this.instantiationService.createInstance(ixi,t)),h?g&&v?s=ri?d(10162,null,Ye(r)):d(10163,null,Ye(r)):s=d(10161,null,Ye(r)):v&&f?s=ri?d(10159,null,Ye(r)):d(10160,null,Ye(r)):s=d(10154,null,Ye(r),In(e,!1))}let u={primary:l,secondary:c},p=this.notificationService.notify({id:`${Ir(t.resource.toString())}`,severity:St.Error,message:s,actions:u});H.once(p.onDidClose)(()=>{Ue(l),Ue(c)}),this.messages.set(t.resource,p)}dispose(){super.dispose(),this.messages.clear()}};Cme=I([m(0,Ne),m(1,Ho),m(2,X),m(3,ee),m(4,Nt),m(5,F),m(6,le)],Cme);var ZCi=[];function L6o(){for(;ZCi.length>0;)ZCi.pop()?.close()}var iPe=class extends st{constructor(e){super("workbench.files.action.resolveConflictLearnMore",d(10155,null));this.openerService=e}async run(){await this.openerService.open(A.parse("https://go.microsoft.com/fwlink/?linkid=868264"))}};iPe=I([m(0,Qe)],iPe);var Aet=class extends st{constructor(e){super("workbench.files.action.resolveConflictLearnMoreDoNotShowAgain",d(10153,null));this.storageService=e}async run(e){this.storageService.store(sxi,!0,-1,0),e.dispose()}};Aet=I([m(0,le)],Aet);var Net=class extends st{constructor(e,t,o,n,r){super("workbench.files.action.resolveConflict",d(10151,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=Ye(e),o=d(10166,null,t,t,this.productService.nameLong);await wR.open(e,JCi,o,this.editorService,{pinned:!0});let n={primary:[this.instantiationService.createInstance(iPe)]},r=this.notificationService.notify({id:`${Ir(e.toString())}`,severity:St.Info,message:muo,actions:n,neverShowAgain:{id:sxi,isSecondary:!0}});H.once(r.onDidClose)(()=>Ue(n.primary)),ZCi.push(r)}}};Net=I([m(1,ee),m(2,Ne),m(3,F),m(4,nt)],Net);var exi=class extends st{constructor(e,t,o){super("workbench.files.action.saveModelElevated",o?ri?d(10157,null):d(10158,null):ri?d(10167,null):d(10168,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})}},txi=class extends st{constructor(e,t){super("workbench.files.action.saveModel",d(10164,null));this.model=e;this.options=t}async run(){this.model.isDisposed()||await this.model.save({...this.options,reason:1})}},ixi=class extends st{constructor(e){super("workbench.files.action.revertModel",d(10165,null));this.model=e}async run(){this.model.isDisposed()||await this.model.revert()}},Oet=class extends st{constructor(e,t){super("workbench.files.action.saveModelAs",NBt.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 hI){e=o;break}else e||(e=o);return e}};Oet=I([m(1,ee)],Oet);var oxi=class extends st{constructor(e,t){super("workbench.files.action.unlock",d(10156,null));this.model=e;this.options=t}async run(){this.model.isDisposed()||await this.model.save({...this.options,writeUnlock:!0,reason:1})}},nxi=class extends st{constructor(e,t){super("workbench.files.action.saveIgnoreModifiedSince",d(10156,null));this.model=e;this.options=t}async run(){this.model.isDisposed()||await this.model.save({...this.options,ignoreModifiedSince:!0,reason:1})}},Fet=class extends st{constructor(e){super("workbench.files.action.configureSaveConflict",d(10152,null));this.preferencesService=e}async run(){this.preferencesService.openSettings({query:"files.saveConflictResolution"})}};Fet=I([m(0,Po)],Fet);var huo=(a,i)=>fuo(a,i,!0),guo=(a,i)=>fuo(a,i,!1);async function fuo(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(L6o(),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 nHt=_,ww=class extends zr{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(10504,"Open Editors")}registerUpdateEvents(){let e=()=>{if(!this.isBodyVisible()||!this.list){this.needsRefresh=!0;return}this.listRefreshScheduler?.schedule(this.structuralRefreshDelay)},t=this._register(new jt),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 wh(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=R(e,nHt(".open-editors-dirty-count-container"));this.dirtyCountElement=R(t,nHt(".dirty-count.monaco-count-badge.long")),this.dirtyCountElement.style.backgroundColor=wt(rv),this.dirtyCountElement.style.color=wt(Yw),this.dirtyCountElement.style.border=`1px solid ${wt(gi)}`,this.updateDirtyIndicator()}renderBody(e){super.renderBody(e),e.classList.add("open-editors"),e.classList.add("show-file-icons");let t=new Wet;this.list&&this.list.dispose(),this.listLabels&&this.listLabels.clear(),this.dnd=new oHt(this.sortOrder,this.instantiationService,this.editorGroupService),this.listLabels=this.instantiationService.createInstance(Za,{onDidChangeVisibility:this.onDidChangeBodyVisibility}),this.list=this.instantiationService.createInstance(Rl,"OpenEditors",e,t,[new rHt(this.keybindingService,this.instantiationService),new sHt(this.listLabels,this.instantiationService,this.keybindingService,this.configurationService)],{identityProvider:{getId:r=>r instanceof wh?r.getId():r.id.toString()},dnd:this.dnd,overrideStyles:this.getLocationBasedColors().listOverrideStyles,accessibilityProvider:new lxi}),this._register(this.list),this._register(this.listLabels);let o=[];this.listRefreshScheduler=this._register(new Dt(()=>{if(!this.list)return;o=Ue(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 wh&&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 wh){if(zxe(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 wh){if(Vp(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;woo.bindTo(this.list.contextKeyService),C7e.bindTo(this.list.contextKeyService);let e=c3.bindTo(this.contextKeyService),t=XMe.bindTo(this.contextKeyService),o=Det.bindTo(this.contextKeyService),n=WBt.bindTo(this.contextKeyService),r=this.instantiationService.createInstance(Fo);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 wh){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 wh){let u=c.getResource();return u&&(u.scheme===Y.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 wh(o,e));this.sortOrder==="alphabetical"?t=t.sort((o,n)=>h7e(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 h7e(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!==Y.file&&c!==Y.file?dx.compare(r,s):l!==Y.file?-1:c!==Y.file?1:dx.compare(r,s)}})),this.elements.push(...t)}),this.elements}getIndex(e,t){return t?this.elements.findIndex(o=>o instanceof wh&&o.editor===t&&o.group.id===e.id):this.elements.findIndex(o=>!(o instanceof wh)&&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 wh?no.getOriginalUri(t.editor):{}},contextKeyService:this.list?.contextKeyService,getAnchor:()=>e.anchor,getActionsContext:()=>t instanceof wh?{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(10499,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=ww.DEFAULT_MIN_VISIBLE_OPEN_EDITORS),this.viewDescriptorService.getViewContainerModel(this.viewDescriptorService.getViewContainerByViewId(this.id)).visibleViewDescriptors.length<=1?Number.POSITIVE_INFINITY:Math.max(this.elementCount,e)*Wet.ITEM_HEIGHT}getMinExpandedBodySize(){let e=this.configurationService.getValue("explorer.openEditors.visible");return typeof e!="number"&&(e=ww.DEFAULT_VISIBLE_OPEN_EDITORS),this.computeMinExpandedBodySize(e)}computeMinExpandedBodySize(e=ww.DEFAULT_VISIBLE_OPEN_EDITORS){return Math.min(Math.max(e,1),this.elementCount)*Wet.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 jbe(e,t)}};ww=I([m(1,F),m(2,Ri),m(3,ze),m(4,Et),m(5,B),m(6,_e),m(7,X),m(8,De),m(9,Te),m(10,tt),m(11,Wa),m(12,lr),m(13,Qe),m(14,be)],ww);var axi=class extends as{async run(i){if(this.editor)return super.run(i,{groupId:this.editor.groupId,editorIndex:this.editor.group.getIndexOfEditor(this.editor.editor)})}},Wet=class a{static{this.ITEM_HEIGHT=22}getHeight(i){return a.ITEM_HEIGHT}getTemplateId(i){return i instanceof wh?sHt.ID:rHt.ID}},rHt=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=R(i,nHt(".editor-group")),e.name=R(e.root,nHt("span.name")),e.actionBar=new ji(i);let t=this.instantiationService.createInstance(ZMe,ZMe.ID,ZMe.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(fee,fee.ID,fee.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()}},sHt=class a{constructor(i,e,t,o){this.labels=i;this.instantiationService=e;this.keybindingService=t;this.configurationService=o;this.closeEditorAction=this.instantiationService.createInstance(SJ,SJ.ID,SJ.LABEL),this.unpinEditorAction=this.instantiationService.createInstance(gF,gF.ID,gF.LABEL)}static{this.ID="openeditor"}get templateId(){return a.ID}renderTemplate(i){let e=Object.create(null);return e.container=i,e.actionRunner=new axi,e.actionBar=new ji(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:no.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()}},oHt=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(sF,{allowWorkspaceOpen:!1})}getDragURI(i){if(i instanceof wh){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 wh?e.editor.getName():e.label}onDragStart(i,e){let t=i.elements,o=[];if(t)for(let n of t)n instanceof wh&&o.push(n);o.length&&this.instantiationService.invokeFunction(Ig,o,e)}onDragOver(i,e,t,o,n){if(i instanceof p1&&!gu(n,Aa.FILES,Ll.FILES))return!1;if(this._sortOrder!=="editorOrder")return i instanceof $y?!1:{accept:!0,effect:{type:1},feedback:[-1]};let r;switch(o){case 0:case 1:r=t===0&&e instanceof Uf?"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 wh?e.group:e||this.editorGroupService.groups[this.editorGroupService.count-1],s=e instanceof wh?e.group.getIndexOfEditor(e.editor):0;switch(o){case 0:case 1:e instanceof Uf&&r.index!==0&&(r=this.editorGroupService.groups[r.index-1],s=r.count);break;case 3:case 2:e instanceof wh&&s++;break}if(i instanceof $y){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,It,()=>r,()=>r.focus(),{index:s})}dispose(){}};I([mi],oHt.prototype,"dropHandler",1);var lxi=class{getWidgetAriaLabel(){return d(10505,null)}getAriaLabel(i){return i instanceof wh?`${i.editor.getName()}, ${i.editor.getDescription()}`:i.ariaLabel}},R6o="workbench.action.toggleEditorGroupLayout";W(class extends K{constructor(){super({id:"workbench.action.toggleEditorGroupLayout",title:L(10500,"Toggle Vertical/Horizontal Editor Layout"),f1:!0,keybinding:{primary:1557,mac:{primary:2581},weight:200},icon:M.editorLayout,menu:{id:D.ViewTitle,group:"navigation",when:x.and(x.equals("view",ww.ID),iS),order:10}})}async run(a){let i=a.get(Et),e=i.orientation===1?0:1;i.setGroupOrientation(e),i.activeGroup.focus()}});fe.appendMenuItem(D.MenubarLayoutMenu,{group:"5_flip",command:{id:R6o,title:{...L(10502,"Flip Layout"),mnemonicTitle:d(10501,null)}},order:1});W(class extends K{constructor(){super({id:"workbench.action.files.saveAll",title:Bdo,f1:!0,icon:M.saveAll,menu:{id:D.ViewTitle,group:"navigation",when:x.equals("view",ww.ID),order:20}})}async run(a){await a.get(ge).executeCommand(YMe)}});W(class extends K{constructor(){super({id:"openEditors.closeAll",title:vue.LABEL,f1:!1,icon:M.closeAll,menu:{id:D.ViewTitle,group:"navigation",when:x.equals("view",ww.ID),order:30}})}async run(a){let i=a.get(F),e=new vue;await i.invokeFunction(t=>e.run(t))}});W(class extends K{constructor(){super({id:"openEditors.newUntitledFile",title:L(10503,"New Untitled Text File"),f1:!1,icon:M.newFile,menu:{id:D.ViewTitle,group:"navigation",when:x.equals("view",ww.ID),order:5}})}async run(a){await a.get(ge).executeCommand(ZF)}});var buo=(a,i,e)=>{if(Array.isArray(i)){let t=a.get(oi),o=a.get(Co);i=i.map(n=>nwe(n)&&n.workspaceUri.scheme===Y.untitled?{workspaceUri:je(o.untitledWorkspacesHome,n.workspaceUri.path,y4i)}:n),t.openWindow(i,e)}},Suo=(a,i)=>{a.get(oi).openWindow(i)};yt.registerCommandAndKeybindingRule({weight:200,when:xoo,primary:2051,mac:{primary:259},id:LBt,handler:async(a,i)=>{let e=a.get(ee),t=a.get(be),o=a.get(za),n=e0(i,a.get(fo),e,a.get(Et),o);if(n.length){let r=n.filter(p=>p.scheme===Y.untitled),s=n.filter(p=>p.scheme!==Y.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,vn)}}});yt.registerCommandAndKeybindingRule({weight:210,when:x.and(WC,lu.toNegated()),primary:3,mac:{primary:2066},id:"explorer.openAndPassFocus",handler:async(a,i)=>{let e=a.get(ee),o=a.get(za).getContext(!0);o.length&&await e.openEditors(o.map(n=>({resource:n.resource,options:{preserveFocus:!1,pinned:!0}})))}});var cxi="showModifications",vee=[];yt.registerCommandAndKeybindingRule({id:Tet,when:void 0,weight:200,primary:Ai(2089,34),handler:async(a,i)=>{let e=a.get(F),t=a.get(Nt),o=a.get(ee),n=a.get(be),r=a.get(fo),s=!1;if(vee.length===0){s=!0;let c=e.createInstance(wR);vee.push(c),vee.push(t.registerTextModelContentProvider(cxi,c))}let l=Ime(i,o,r);if(l&&n.hasProvider(l)){let c=Ye(l),u=d(10318,null,c,c);try{await wR.open(l,cxi,u,o,{pinned:!0}),s&&vee.push(o.onDidVisibleEditorsChange(()=>{o.editors.some(p=>!!no.getCanonicalUri(p,{supportSideBySide:2,filterByScheme:cxi}))||(vee=Ue(vee))}))}catch{vee=Ue(vee)}}}});var uxi,dxi;qe.registerCommand({id:MBt,handler:(a,i)=>{uxi=Ime(i,a.get(ee),a.get(fo)),dxi||(dxi=Let.bindTo(a.get(X))),dxi.set(!0)}});qe.registerCommand({id:PBt,handler:async(a,i)=>{let e=a.get(ee),t=e0(i,a.get(fo),e,a.get(Et),a.get(za));return t.length===2?e.openEditor({original:{resource:t[0]},modified:{resource:t[1]},options:{pinned:!0}}):!0}});qe.registerCommand({id:ABt,handler:(a,i)=>{let e=a.get(ee),t=Ime(i,e,a.get(fo));uxi&&t&&e.openEditor({original:{resource:uxi},modified:{resource:t},options:{pinned:!0}})}});async function pxi(a,i,e,t,o){if(a.length){let n=ri?`\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 Iuo=async(a,i)=>{let e=e0(i,a.get(fo),a.get(ee),a.get(Et),a.get(za));await pxi(e,!1,a.get(Wi),a.get(ot),a.get(B))};yt.registerCommandAndKeybindingRule({weight:200,when:ue.focus.toNegated(),primary:2593,win:{primary:1569},id:vme,handler:Iuo});yt.registerCommandAndKeybindingRule({weight:200,when:ue.focus,primary:Ai(2089,2593),win:{primary:1569},id:vme,handler:Iuo});var yuo=async(a,i)=>{let e=e0(i,a.get(fo),a.get(ee),a.get(Et),a.get(za));await pxi(e,!0,a.get(Wi),a.get(ot),a.get(B))};yt.registerCommandAndKeybindingRule({weight:200,when:ue.focus.toNegated(),primary:3617,win:{primary:Ai(2089,3105)},id:bme,handler:yuo});yt.registerCommandAndKeybindingRule({weight:200,when:ue.focus,primary:Ai(2089,3617),win:{primary:Ai(2089,3105)},id:bme,handler:yuo});yt.registerCommandAndKeybindingRule({weight:200,when:void 0,primary:Ai(2089,46),id:"workbench.action.files.copyPathOfActiveFile",handler:async a=>{let e=a.get(ee).activeEditor,t=no.getOriginalUri(e,{supportSideBySide:1});await pxi(t?[t]:[],!1,a.get(Wi),a.get(ot),a.get(B))}});qe.registerCommand({id:JF,handler:async(a,i)=>{let e=a.get(Ft),t=a.get(Pe),o=a.get(za),n=a.get(ee),r=a.get(fo),s=Ime(i,n,r);if(s&&t.isInsideWorkspace(s)){let l=await e.openView(Cb,!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(ww.ID);l&&(l.setExpanded(!0),l.focus())}}});qe.registerCommand({id:RBt,handler:async(a,i)=>{let e=a.get(ee),t=a.get(fo),o=Ime(i,e,t);if(o)return e.openEditor({resource:o,options:{override:0,source:1}})}});async function mxi(a,i){let e=a.get(Et),t=a.get(Kt),o=a.get(Ho),n=zCi(a);if(!n){let s=e.activeGroup;s.activeEditor&&(n=[],s.activeEditor instanceof ga&&!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 hxi(a,n,i);let r=t.getFocusedCodeEditor();if(r instanceof zc&&!r.isSimpleWidget){let s=r.getModel()?.uri;s&&!n.some(({editor:l})=>Xe(no.getCanonicalUri(l,{supportSideBySide:1}),s))&&(o.files.get(s)?.isReadonly()||await o.save(s,i))}}function wuo(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 hxi(a,t,e)}async function hxi(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(!so(r)){let s=[pi({id:"workbench.action.files.saveEditors",label:d(10320,null),run:()=>n.invokeFunction(c=>hxi(c,i,e))})],l=i.filter(({editor:c})=>!c.hasCapability(4));l.length>0&&s.push(pi({id:"workbench.action.files.revertEditors",label:l.length>1?d(10322,null):d(10321,null),run:()=>t.revert(l)})),o.notify({id:i.map(({editor:c})=>Ir(c.resource?.toString())).join(),severity:St.Error,message:d(10317,null,i.map(({editor:c})=>c.getName()).join(", "),In(r,!1)),actions:{primary:s}})}}}yt.registerCommandAndKeybindingRule({when:void 0,weight:200,primary:2097,id:QMe,handler:a=>mxi(a,{reason:1,force:!0})});yt.registerCommandAndKeybindingRule({when:void 0,weight:200,primary:Ai(2089,49),win:{primary:Ai(2089,3121)},id:OBt,handler:a=>mxi(a,{reason:1,force:!0,skipSaveParticipants:!0})});yt.registerCommandAndKeybindingRule({id:_et,weight:200,when:void 0,primary:3121,handler:a=>mxi(a,{reason:1,saveAs:!0})});yt.registerCommandAndKeybindingRule({when:void 0,weight:200,primary:void 0,mac:{primary:2609},win:{primary:Ai(2089,49)},id:YMe,handler:a=>wuo(a,a.get(Et).getGroups(1),{reason:1})});qe.registerCommand({id:Sme,handler:(a,i,e)=>{let t=a.get(Et),o=lp([e],a.get(ee),t,a.get(fo)),n;return o.groupedEditors.length?n=o.groupedEditors.map(({group:r})=>r):n=t.getGroups(1),wuo(a,n,{reason:1})}});qe.registerCommand({id:FBt,handler:async a=>(await a.get(ee).saveAll({includeUntitled:!1,reason:1})).success});qe.registerCommand({id:jMe,handler:async a=>{let i=a.get(Et),e=a.get(ee),t=zCi(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(10316,null,t.map(({editor:r})=>r.getName()).join(", "),In(o,!1)))}}});qe.registerCommand({id:VBt,handler:(a,i)=>{let e=a.get(Pe),t=a.get(dt),o=e.getWorkspace(),n=e0(i,a.get(fo),a.get(ee),a.get(Et),a.get(za)).filter(s=>o.folders.some(l=>t.extUri.isEqual(l.uri,s)));return n.length===0?a.get(ge).executeCommand(d7e.ID):a.get(Of).removeFolders(n)}});yt.registerCommandAndKeybindingRule({weight:210,when:x.and(WC,uue,x7e.negate()),primary:15,id:Udo,handler:a=>{let e=a.get(ds).getActivePaneComposite(0);if(e?.getId()!==Hf)return;e.getViewPaneContainer().getExplorerView().previousCompressedStat()}});yt.registerCommandAndKeybindingRule({weight:210,when:x.and(WC,uue,k7e.negate()),primary:17,id:zdo,handler:a=>{let e=a.get(ds).getActivePaneComposite(0);if(e?.getId()!==Hf)return;e.getViewPaneContainer().getExplorerView().nextCompressedStat()}});yt.registerCommandAndKeybindingRule({weight:210,when:x.and(WC,uue,x7e.negate()),primary:14,id:Kdo,handler:a=>{let e=a.get(ds).getActivePaneComposite(0);if(e?.getId()!==Hf)return;e.getViewPaneContainer().getExplorerView().firstCompressedStat()}});yt.registerCommandAndKeybindingRule({weight:210,when:x.and(WC,uue,k7e.negate()),primary:13,id:Gdo,handler:a=>{let e=a.get(ds).getActivePaneComposite(0);if(e?.getId()!==Hf)return;e.getViewPaneContainer().getExplorerView().lastCompressedStat()}});yt.registerCommandAndKeybindingRule({weight:200,when:null,primary:Gt?ri?Ai(2089,44):2604:2092,secondary:Gt?[2092]:void 0,id:ZF,metadata:{description:BBt,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})}});qe.registerCommand({id:$do,handler:async(a,i)=>{let e=a.get(ee),t=a.get(dn),o=a.get(be),n=d(10319,null),r=je(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($Bt);W(qBt);W(jBt);W(XBt);W(YBt);W(Pet);W(QBt);W(JBt);W(ZBt);W(eHt);W(tHt);qe.registerCommand("_files.windowOpen",buo);qe.registerCommand("_files.newWindow",Suo);var p3=10,Cuo="renameFile";yt.registerCommandAndKeybindingRule({id:Cuo,weight:200+p3,when:x.and(WC,FC.toNegated(),pF),primary:60,mac:{primary:3},handler:auo});var xuo="moveFileToTrash";yt.registerCommandAndKeybindingRule({id:xuo,weight:200+p3,when:x.and(WC,due),primary:20,mac:{primary:2049,secondary:[20]},handler:luo});var aHt="deleteFile";yt.registerCommandAndKeybindingRule({id:aHt,weight:200+p3,when:WC,primary:1044,mac:{primary:2561},handler:XCi});yt.registerCommandAndKeybindingRule({id:aHt,weight:200+p3,when:x.and(WC,due.toNegated()),primary:20,mac:{primary:2049},handler:XCi});var kuo="filesExplorer.cut";yt.registerCommandAndKeybindingRule({id:kuo,weight:200+p3,when:x.and(WC,FC.toNegated(),pF),primary:2102,handler:duo});var Euo="filesExplorer.copy";yt.registerCommandAndKeybindingRule({id:Euo,weight:200+p3,when:x.and(WC,FC.toNegated()),primary:2081,handler:cuo});var gxi="filesExplorer.paste";qe.registerCommand(gxi,uuo);yt.registerKeybindingRule({id:`^${gxi}`,weight:200+p3,when:x.and(WC,pF),primary:2100});yt.registerCommandAndKeybindingRule({id:"filesExplorer.cancelCut",weight:200+p3,when:x.and(WC,BPt),primary:9,handler:async a=>{await a.get(za).setToCopy([],!0)}});yt.registerCommandAndKeybindingRule({id:"filesExplorer.openFilePreserveFocus",weight:200+p3,when:x.and(WC,lu.toNegated()),primary:10,handler:puo});var Vet={id:vme,title:d(10289,null)},Bet={id:bme,title:d(10291,null)},oPe={id:JF,title:d(10309,null)};Het(vme,Vet.title,Fo.IsFileSystemResource,"1_cutcopypaste",!0);Het(bme,Bet.title,Fo.IsFileSystemResource,"1_cutcopypaste",!0);Het(oPe.id,oPe.title,Fo.IsFileSystemResource,"2_files",!1,1);function Het(a,i,e,t,o,n){let r=o!==!0?Oj.negate():void 0;fe.appendMenuItem(D.EditorTitleContext,{command:{id:a,title:i,precondition:r},when:e,group:t,order:n})}Tuo("workbench.files.action.acceptLocalChanges",d(10278,null),M.check,-10,huo);Tuo("workbench.files.action.revertLocalChanges",d(10312,null),M.discard,-9,guo);function Tuo(a,i,e,t,o){qe.registerCommand(a,o),fe.appendMenuItem(D.EditorTitle,{command:{id:a,title:i,icon:e},when:x.equals(rxi,!0),group:"navigation",order:t})}function HR({id:a,title:i,category:e,metadata:t},o){fe.appendMenuItem(D.CommandPalette,{command:{id:a,title:i,category:e,metadata:t},when:o})}HR({id:vme,title:L(10290,"Copy Path of Active File"),category:We.File});HR({id:bme,title:L(10292,"Copy Relative Path of Active File"),category:We.File});HR({id:QMe,title:HCi,category:We.File});HR({id:OBt,title:Vdo,category:We.File});HR({id:Sme,title:L(10314,"Save All in Group"),category:We.File});HR({id:FBt,title:L(10315,"Save All Files"),category:We.File});HR({id:jMe,title:L(10310,"Revert File"),category:We.File});HR({id:Tet,title:L(10283,"Compare Active File with Saved"),category:We.File,metadata:{description:L(10284,"Opens a new diff editor to compare the active file with the version on disk.")}});HR({id:_et,title:NBt,category:We.File});HR({id:wme,title:$Ci,category:We.File},mC.notEqualsTo("0"));HR({id:tPe,title:qCi,category:We.File,metadata:{description:L(10305,"Create a new folder or directory")}},mC.notEqualsTo("0"));HR({id:ZF,title:BBt,category:We.File});var fxi=x.or(Fo.IsFileSystemResource,Fo.Scheme.isEqualTo(Y.untitled)),lHt={id:LBt,title:d(10307,null)};fe.appendMenuItem(D.OpenEditorsContext,{group:"navigation",order:10,command:lHt,when:fxi});fe.appendMenuItem(D.OpenEditorsContext,{group:"1_open",order:10,command:{id:f_e,title:d(10308,null)},when:x.and(AO,c3.toNegated())});fe.appendMenuItem(D.OpenEditorsContext,{group:"1_cutcopypaste",order:10,command:Vet,when:Fo.IsFileSystemResource});fe.appendMenuItem(D.OpenEditorsContext,{group:"1_cutcopypaste",order:20,command:Bet,when:Fo.IsFileSystemResource});fe.appendMenuItem(D.OpenEditorsContext,{group:"2_save",order:10,command:{id:QMe,title:HCi,precondition:XMe},when:x.or(Fo.Scheme.isEqualTo(Y.untitled),x.and(c3.toNegated(),Det.toNegated(),x8e.toNegated()))});fe.appendMenuItem(D.OpenEditorsContext,{group:"2_save",order:20,command:{id:jMe,title:d(10311,null),precondition:XMe},when:x.and(c3.toNegated(),Det.toNegated(),Fo.Scheme.notEqualsTo(Y.untitled),x8e.toNegated())});fe.appendMenuItem(D.OpenEditorsContext,{group:"2_save",order:30,command:{id:Sme,title:d(10313,null),precondition:R8e},when:c3});fe.appendMenuItem(D.OpenEditorsContext,{group:"3_compare",order:10,command:{id:Tet,title:d(10287,null),precondition:XMe},when:x.and(Fo.IsFileSystemResource,x8e.toNegated(),AW.toNegated())});var _uo={id:ABt,title:d(10288,null)};fe.appendMenuItem(D.OpenEditorsContext,{group:"3_compare",order:20,command:_uo,when:x.and(Fo.HasResource,Let,fxi,AW.toNegated())});var Duo={id:MBt,title:d(10286,null)};fe.appendMenuItem(D.OpenEditorsContext,{group:"3_compare",order:30,command:Duo,when:x.and(Fo.HasResource,fxi,AW.toNegated())});var vxi={id:PBt,title:d(10285,null)};fe.appendMenuItem(D.OpenEditorsContext,{group:"3_compare",order:30,command:vxi,when:x.and(Fo.HasResource,AW,WBt)});fe.appendMenuItem(D.EditorTitleContext,{group:"1_compare",order:30,command:vxi,when:x.and(Fo.HasResource,ZEt,eTt)});fe.appendMenuItem(D.OpenEditorsContext,{group:"4_close",order:10,command:{id:OC,title:d(10279,null)},when:c3.toNegated()});fe.appendMenuItem(D.OpenEditorsContext,{group:"4_close",order:20,command:{id:g_e,title:d(10281,null)},when:c3.toNegated()});fe.appendMenuItem(D.OpenEditorsContext,{group:"4_close",order:30,command:{id:cue,title:d(10282,null)}});fe.appendMenuItem(D.OpenEditorsContext,{group:"4_close",order:40,command:{id:B5,title:d(10280,null)}});fe.appendMenuItem(D.ExplorerContext,{group:"navigation",order:4,command:{id:wme,title:$Ci,precondition:pF},when:lu});fe.appendMenuItem(D.ExplorerContext,{group:"navigation",order:6,command:{id:tPe,title:qCi,precondition:pF},when:lu});fe.appendMenuItem(D.ExplorerContext,{group:"navigation",order:10,command:lHt,when:x.and(lu.toNegated(),Fo.HasResource)});fe.appendMenuItem(D.ExplorerContext,{group:"navigation",order:20,command:{id:RBt,title:d(10295,null)},when:x.and(lu.toNegated(),VPt)});fe.appendMenuItem(D.ExplorerContext,{group:"3_compare",order:20,command:_uo,when:x.and(lu.toNegated(),Fo.HasResource,Let,AW.toNegated())});fe.appendMenuItem(D.ExplorerContext,{group:"3_compare",order:30,command:Duo,when:x.and(lu.toNegated(),Fo.HasResource,AW.toNegated())});fe.appendMenuItem(D.ExplorerContext,{group:"3_compare",order:30,command:vxi,when:x.and(lu.toNegated(),Fo.HasResource,AW)});fe.appendMenuItem(D.ExplorerContext,{group:"5_cutcopypaste",order:8,command:{id:kuo,title:d(10293,null)},when:x.and(FC.toNegated(),pF)});fe.appendMenuItem(D.ExplorerContext,{group:"5_cutcopypaste",order:10,command:{id:Euo,title:Zdo},when:FC.toNegated()});fe.appendMenuItem(D.ExplorerContext,{group:"5_cutcopypaste",order:20,command:{id:gxi,title:euo,precondition:x.and(pF,iHt)},when:lu});fe.appendMenuItem(D.ExplorerContext,{group:"5b_importexport",order:10,command:{id:jCi,title:tuo},when:x.or(x.and(ep.toNegated(),Fo.Scheme.notEqualsTo(Y.file)),x.and(ep,lu.toNegated(),FC.toNegated()),x.and(ep,qEt))});fe.appendMenuItem(D.ExplorerContext,{group:"5b_importexport",order:20,command:{id:QCi,title:iuo},when:x.and(ep,lu,pF)});fe.appendMenuItem(D.ExplorerContext,{group:"6_copypath",order:10,command:Vet,when:Fo.IsFileSystemResource});fe.appendMenuItem(D.ExplorerContext,{group:"6_copypath",order:20,command:Bet,when:Fo.IsFileSystemResource});fe.appendMenuItem(D.ExplorerContext,{group:"2_workspace",order:10,command:{id:e_e,title:sPt},when:x.and(FC,x.or(T_,Qa.isEqualTo("workspace")))});fe.appendMenuItem(D.ExplorerContext,{group:"2_workspace",order:30,command:{id:VBt,title:Hdo},when:x.and(FC,lu,x.and(mC.notEqualsTo("0"),x.or(T_,Qa.isEqualTo("workspace"))))});fe.appendMenuItem(D.ExplorerContext,{group:"7_modification",order:10,command:{id:Cuo,title:Xdo,precondition:pF},when:FC.toNegated()});fe.appendMenuItem(D.ExplorerContext,{group:"7_modification",order:20,command:{id:xuo,title:Jdo},alt:{id:aHt,title:d(10294,null)},when:x.and(FC.toNegated(),due)});fe.appendMenuItem(D.ExplorerContext,{group:"7_modification",order:20,command:{id:aHt,title:d(10294,null)},when:x.and(FC.toNegated(),due.toNegated())});for(let a of[D.EmptyEditorGroupContext,D.EditorTabsBarContext])fe.appendMenuItem(a,{command:{id:ZF,title:d(10304,null)},group:"1_file",order:10}),fe.appendMenuItem(a,{command:{id:"workbench.action.quickOpen",title:d(10306,null)},group:"1_file",order:20});fe.appendMenuItem(D.MenubarFileMenu,{group:"1_new",command:{id:ZF,title:d(10299,null)},order:1});fe.appendMenuItem(D.MenubarFileMenu,{group:"4_save",command:{id:QMe,title:d(10301,null),precondition:x.or(fr,x.and($5,sV))},order:1});fe.appendMenuItem(D.MenubarFileMenu,{group:"4_save",command:{id:_et,title:d(10303,null),precondition:x.or(fr,x.and($5,sV))},order:2});fe.appendMenuItem(D.MenubarFileMenu,{group:"4_save",command:{id:YMe,title:d(10302,null),precondition:R8e},order:3});fe.appendMenuItem(D.MenubarFileMenu,{group:"5_autosave",command:{id:Pet.ID,title:d(10296,null),toggled:x.notEquals("config.files.autoSave","off")},order:1});fe.appendMenuItem(D.MenubarFileMenu,{group:"6_close",command:{id:jMe,title:d(10300,null),precondition:x.or(x.and(XEt),x.and(Fo.Scheme.notEqualsTo(Y.untitled),$5,sV))},order:1});fe.appendMenuItem(D.MenubarFileMenu,{group:"6_close",command:{id:OC,title:d(10297,null),precondition:x.or(fr,x.and($5,sV))},order:2});fe.appendMenuItem(D.MenubarGoMenu,{group:"3_global_nav",command:{id:"workbench.action.quickOpen",title:d(10298,null)},order:1});fe.appendMenuItem(D.ChatAttachmentsContext,{group:"navigation",order:10,command:lHt,when:x.and(Fo.IsFileSystemResource,lu.toNegated())});fe.appendMenuItem(D.ChatAttachmentsContext,{group:"navigation",order:20,command:oPe,when:Fo.IsFileSystemResource});fe.appendMenuItem(D.ChatAttachmentsContext,{group:"1_cutcopypaste",order:10,command:Vet,when:Fo.IsFileSystemResource});fe.appendMenuItem(D.ChatAttachmentsContext,{group:"1_cutcopypaste",order:20,command:Bet,when:Fo.IsFileSystemResource});for(let a of[D.ChatInlineResourceAnchorContext,D.ChatInputResourceAttachmentContext])fe.appendMenuItem(a,{group:"navigation",order:10,command:lHt,when:x.and(Fo.HasResource,lu.toNegated())}),fe.appendMenuItem(a,{group:"navigation",order:20,command:oPe,when:Fo.IsFileSystemResource}),fe.appendMenuItem(a,{group:"1_cutcopypaste",order:10,command:Vet,when:Fo.IsFileSystemResource}),fe.appendMenuItem(a,{group:"1_cutcopypaste",order:20,command:Bet,when:Fo.IsFileSystemResource});function zet(a){return Array.isArray(a.repositories)&&Array.isArray(a.visibleRepositories)}function fd(a){return!!a.provider&&!!a.input}function mA(a){return!!a.validateInput&&typeof a.value=="string"}function hA(a){return a.type==="actionButton"}function vy(a){return!!a.provider&&!!a.resources}function gA(a){return!!a.sourceUri&&vy(a.resourceGroup)}function m3(a){return Xp.isResourceNode(a)&&vy(a.context)}function fA(a){return a.type==="historyItemViewModel"}function nPe(a){return a.type==="historyItemLoadMore"}function h3(a){return a.type==="historyItemChangeViewModel"}function rPe(a){return Xp.isResourceNode(a)&&fA(a.context)}function _B(a){return a.type==="artifactGroup"}function g3(a){return Xp.isResourceNode(a)&&_B(a.context)}function UR(a){return a.type==="artifact"}var Luo=(a,i)=>a instanceof Eo&&i instanceof Eo?a.id===i.id&&a.enabled===i.enabled&&a.hideActions?.isHidden===i.hideActions?.isHidden:a.id===i.id&&a.enabled===i.enabled;function bee(a,i,e,t){let o=[],n=[],r=()=>{let{primary:s,secondary:l}=hl(a.getActions({arg:t,shouldForwardArgs:!0}),e);$i(o,s,Luo)&&$i(n,l,Luo)||(o=s,n=l,i(s,l))};return r(),a.onDidChange(r)}function f3(a,i){return Ef(a.getActions({arg:i,shouldForwardArgs:!0}),"inline").secondary}var Uet=class extends st{constructor(e,t){super(`statusbaraction{${e.id}}`,Sxi(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||[])}},bxi=class extends Lr{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=Bn(this._commandTitle??this.action.label).map(e=>{if(typeof e=="string"){let t=document.createElement("span");return t.textContent=e,t}return e});Fi(this.label,...i)}}};function See(a){return(i,e)=>i instanceof Uet?new bxi(i,e):Ca(a,i,e)}function v3(a){return`${a.providerId}:${a.label}${a.rootUri?`:${a.rootUri.toString()}`:""}`}function cHt(a){return a.groups.reduce((i,e)=>i+e.resources.length,0)}function dHt(a){return`${a.displayId??a.id} - ${a.subject}`}function uHt(a,i){return q.isThemeIcon(i.provider.iconPath)?a?.pinned===!0&&a?.repository.id===i.id&&i.provider.iconPath.id===M.repo.id?M.repoPinned:i.provider.iconPath:M.repo}function Sxi(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}var b3={style:1,position:{hoverPosition:2},trapFocus:!0},Pee={groupId:"chat-attachments"},Ruo=["display","position","margin","padding","font-size","font-family","color","background-color"],wk=class extends C{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.element=R(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 Muo(this.currentLanguageModel)}attachClearButton(){if(this.attachment.range||!this.options.supportsDeletion)return;let e=new Mi(this.element,{supportIcons:!0,hoverDelegate:Gg(),title:d(5990,null)});e.element.tabIndex=-1,e.icon=M.close,this._register(e),this._register(H.once(e.onDidClick)(t=>{this._onDidDelete.fire(t)})),this._register(Vo(this.element,re.KEY_DOWN,t=>{(t.keyCode===1||t.keyCode===20)&&this._onDidDelete.fire(t.browserEvent)}))}addResourceOpenHandlers(e,t){this.element.style.cursor="pointer",this._register(qMe(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(oPe.id,e);return}if(e.scheme===Y.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()}};wk=I([m(5,ge),m(6,Qe),m(7,B),m(8,Yo)],wk);function Muo(a){return a?.metadata.capabilities?.vision??!1}var Iee=class extends wk{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=No(e.path),y=wc(e.path),w=`${S} ${y}`,k=t?d(6002,null,w,t.startLineNumber,t.endLineNumber):d(6000,null,w);if(o.omittedState===2)k=d(6009,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:X$})}this.element.ariaLabel=k,this.instantiationService.invokeFunction(T=>{this._register(Ket(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(6001,null,this.currentLanguageModel?this.languageModelsService.lookupLanguageModel(this.currentLanguageModel.identifier)?.name:this.currentLanguageModel??"This model"),this._register(this.hoverService.setupDelayedHover(this.element,{...b3,content:r},Pee))}};Iee=I([m(8,ge),m(9,Qe),m(10,B),m(11,De),m(12,tt),m(13,Wr),m(14,F)],Iee);var yee=class extends wk{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(6015,null,e.command),g=()=>this.openResource(e.resource,{editorOptions:{preserveFocus:!0}},!1,void 0);this._register(M6o(this.element,e,h,this.hoverService,g)),this._register(j(this.element,re.KEY_DOWN,async f=>{let v=new Ii(f);(v.equals(3)||v.equals(10))&&($t.stop(f,!0),await g())}))}};yee=I([m(5,ge),m(6,Qe),m(7,B),m(8,tt),m(9,Yo)],yee);function M6o(a,i,e,t,o){let n=new P;a.ariaLabel=e,a.style.cursor="pointer";let r=_("span");r.classList.add(...q.asClassNameArray(M.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,()=>P6o(e,i),Pee)),n}function P6o(a,i){{let e=_("div.chat-attached-context-hover");e.setAttribute("aria-label",a);let t=_("div",{},typeof i.exitCode=="number"?d(6017,null,i.command,i.exitCode):d(6016,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(6018,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{...b3,content:e}}}var wee=class extends wk{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.labelService=f;this.chatEntitlementService=v;let b;t.omittedState===2?b=d(6010,null,t.name):t.omittedState===1?b=d(6012,null,t.name):b=d(6003,null,t.name);let S=t.references?.[0]?.reference;e=S&&A.isUri(S)?S:void 0;let y=async()=>{e&&await this.openResource(e,{editorOptions:{preserveFocus:!0}},!1,void 0)},w=this.currentLanguageModel?this.languageModelsService.lookupLanguageModel(this.currentLanguageModel.identifier)?.name??this.currentLanguageModel.identifier:"Current model",k=e?this.labelService.getUriLabel(e):t.fullName||t.name;this._register(Puo(e,t.name,k,this.element,t.value,this.hoverService,b,w,y,this.currentLanguageModel,t.omittedState,this.chatEntitlementService.previewFeaturesDisabled)),e&&(this.addResourceOpenHandlers(e,void 0),g.invokeFunction(T=>{this._register(Ket(T,this.element,e))}))}};wee=I([m(6,ge),m(7,Qe),m(8,B),m(9,tt),m(10,Wr),m(11,F),m(12,ot),m(13,vr)],wee);function Puo(a,i,e,t,o,n,r,s,l,c,u,p){let h=new P;u===1&&t.classList.add("partial-warning"),t.ariaLabel=r,t.style.position="relative",a&&(t.style.cursor="pointer",h.add(j(t,"click",l)));let g=Muo(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(6005,null),h.add(n.setupDelayedHover(t,{content:b,style:1}));else if(!g&&c||u===2)t.classList.add("warning"),b.textContent=d(6004,null,s??"This model"),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 N=_("img.chat-attached-context-image",{src:y,alt:""}),O=_("div.chat-attached-context-image-container",{},N);if(b.appendChild(O),a){let V=_("a.chat-attached-context-url",{},u===1?d(6006,null):e),U=_("div.chat-attached-context-url-separator");h.add(j(V,"click",()=>l())),b.append(U,V)}N.onload=()=>{URL.revokeObjectURL(y)},N.onerror=()=>{let V=_("div.chat-attached-context-pill",{},_("span.codicon.codicon-file-media")),U=_("div.chat-attached-context-pill",{},V),G=t.querySelector(".chat-attached-context-pill");G&&G.replaceWith(U)}}return h}var Cee=class extends wk{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(5989,null,e.name);this.element.ariaLabel=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=No(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 xe(`${b?this.instantiationService.invokeFunction(w=>w.get(ot).getUriLabel(b,{relative:!0})):e.fileName}

---

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

${e.code}
\`\`\``);this._register(this.hoverService.setupDelayedHover(this.element,{...b3,content:S},Pee));let y=e.copiedFrom?.uri;y&&(this._register(this.instantiationService.invokeFunction(Ket,this.element,y)),this.addResourceOpenHandlers(y,v))}};Cee=I([m(5,ge),m(6,Qe),m(7,B),m(8,tt),m(9,F)],Cee);var xee=class extends wk{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(MY(o)&&o.icon&&(q.isFile(o.icon)||q.isFolder(o.icon))&&o.resourceUri){let w=q.isFolder(o.icon)?1:0,k=js(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=d(5989,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(Ixi,this.element,this.contextKeyService,{...o,kind:o.symbolKind},D.ChatInputSymbolAttachmentContext)),MY(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(Q_)).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)}))),(MY(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}})}};xee=I([m(8,ge),m(9,Qe),m(10,B),m(11,X),m(12,F),m(13,tt),m(14,Ct),m(15,kt)],xee);var kee=class extends wk{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=R(this.element,_("span.prompt-type")),this.updateLabel(e),this.instantiationService.invokeFunction(h=>{this._register(Ket(h,this.element,e.value))}),this.addResourceOpenHandlers(e.value,void 0)}updateLabel(e){let t=e.value,o=No(t.path),n=wc(t.path),r=`${o} ${n}`,s=e.id.startsWith("vscode.prompt.file"),l=s?d(6014,null,r):d(6007,null,r),c=s?d(6021,null):d(6019,null),u=this.labelService.getUriLabel(t)+(e.originLabel?`
${e.originLabel}`:"");this.element.classList.remove("warning","error");let p=Tb(t);this.label.setFile(A.file(p),{fileKind:0,hidePath:!0,range:void 0,title:u,icon:q.fromId(M.bookmark.id),extraClasses:[]}),this.hintElement.innerText=c,this.element.ariaLabel=l}};kee=I([m(5,ge),m(6,Qe),m(7,B),m(8,ot),m(9,F)],kee);var Eee=class extends wk{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=>{$t.stop(h,!0),p()})),this._register(j(this.element,re.KEY_DOWN,async h=>{let g=new Ii(h);(g.equals(3)||g.equals(10))&&($t.stop(h,!0),p())}))}this.label.setLabel(d(6020,null),void 0,void 0),this._register(u.setupDelayedHover(this.element,{...b3,content:i.value},Pee))}};Eee=I([m(5,ge),m(6,Qe),m(7,B),m(8,Po),m(9,tt)],Eee);var Tee=class extends wk{constructor(i,e,t,o,n,r,s,l,c,u){super(i,t,o,n,e,s,l,c);let p=ht.find(r.getTools(e?.metadata),v=>v.id===i.id)??ht.find(r.getToolSetsForModel(e?.metadata),v=>v.id===i.id),h=i.name,g=i.icon??M.tools;Km(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=d(5989,null,h);let f;Km(p)?f=d(6024,null,p.description??p.referenceName,p.source.label):p&&(f=d(6023,null,p.userDescription??p.modelDescription,p.source.label)),f&&this._register(u.setupDelayedHover(this.element,{...b3,content:f},Pee))}};Tee=I([m(5,jn),m(6,ge),m(7,Qe),m(8,B),m(9,tt)],Tee);var _ee=class extends wk{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(Ket(b,this.element,e))}),this.addResourceOpenHandlers(e,void 0)}getAriaLabel(e){return d(6008,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.getAriaLabel(t)}renderGenericOutput(e,t){this.element.ariaLabel=this.getAriaLabel(t),this.label.setFile(e,{hidePath:!0,icon:q.fromId("output")})}renderImageOutput(e,t){let o;t.omittedState===2?o=d(6011,null,t.name):t.omittedState===1?o=d(6013,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(Puo(e,t.name,t.name,this.element,s,this.hoverService,o,r,n,this.currentLanguageModel,t.omittedState,this.chatEntitlementService.previewFeaturesDisabled))}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}};_ee=I([m(6,ge),m(7,Qe),m(8,B),m(9,tt),m(10,Wr),m(11,un),m(12,F),m(13,vr)],_ee);var Dee=class extends wk{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(5992,null,e.name);this.element.ariaLabel=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(5991,null,g)}),this._register(this.hoverService.setupDelayedHover(this.element,this.getHoverContent(e),Pee)),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(5995,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 Pa(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(5994,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(5999,null));this._register(j(h,re.CLICK,async g=>{$t.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(5996,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 Pa(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(5993,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(5998,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(5997,null));c.appendChild(u),c.appendChild(_("div.chat-element-hover-text",{},e.innerText)),o.appendChild(c)}let s=this._register(new Pa(o,{vertical:1,horizontal:2,consumeMouseWheelIfScrollbarIsNeeded:!0})),l=s.getDomNode();return l.classList.add("chat-element-hover-scrollable"),t.appendChild(l),{...b3,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 xe;return o.appendText(e.fullName??e.name),t.trim().length>0&&(o.appendMarkdown(`

`),o.appendCodeblock("text",t)),{...b3,content:o}}getComputedStyleEntriesForHover(e){if(!e)return[];let t=[];for(let o of Ruo){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,Ruo.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("")+">"}};Dee=I([m(5,ge),m(6,Qe),m(7,B),m(8,ee),m(9,tt)],Dee);var Lee=class extends wk{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=d(5989,null,i.name);let{content:h,disposables:g}=B6e(s,i.historyItem,!1);this._store.add(l.setupDelayedHover(this.element,{...b3,content:h},Pee)),this._store.add(g),this._store.add(j(this.element,re.CLICK,f=>{$t.stop(f,!0),this._openAttachment(i)})),this._store.add(j(this.element,re.KEY_DOWN,f=>{let v=new Ii(f);(v.equals(3)||v.equals(10))&&($t.stop(f,!0),this._openAttachment(i))}))}async _openAttachment(i){await this.commandService.executeCommand("_workbench.openMultiDiffEditor",{title:dHt(i.historyItem),multiDiffSourceUri:i.value})}};Lee=I([m(5,ge),m(6,Qn),m(7,tt),m(8,Qe),m(9,B),m(10,De)],Lee);var Ree=class extends wk{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$(${M.gitCommit.id})${e.historyItem.displayId??e.historyItem.id}`;this.label.setFile(e.value,{fileKind:0,hidePath:!0,nameSuffix:f}),this.element.ariaLabel=d(5989,null,e.name);let{content:v,disposables:b}=B6e(c,e.historyItem,!1);this._store.add(l.setupDelayedHover(this.element,{...b3,content:v},Pee)),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:`${No(e.path)} (${s.displayId??s.id})`,options:{...t.editorOptions}},t.openToSide?vn:void 0)}};Ree=I([m(5,ge),m(6,tt),m(7,Qn),m(8,Qe),m(9,B),m(10,De),m(11,ee)],Ree);var Mee=class extends wk{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$(${M.gitCommit.id})${p}..${h}`;this.label.setFile(e.value,{fileKind:0,hidePath:!0,nameSuffix:g}),this.element.ariaLabel=d(5989,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=`${No(s.uri.fsPath)} (${s.historyItem.displayId??s.historyItem.id})`,u=`${No(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?vn:void 0)}};Mee=I([m(5,ge),m(6,Qe),m(7,B),m(8,ee)],Mee);function Ket(a,i,e){let t=a.get(X),o=a.get(F),n=new P,r=n.add(t.createScoped(i));return Auo(a,r,e),i.draggable=!0,n.add(j(i,"dragstart",s=>{o.invokeFunction(l=>Ig(l,[e],s)),s.dataTransfer?.setDragImage(i,0,0)})),n.add(A6o(a,i,r,D.ChatInputResourceAttachmentContext,e)),n}function Ixi(a,i,e,t,o){let n=a.get(F),r=a.get(zt),s=a.get(Nt),l=a.get(ze),c=a.get(qt),u=new P;i.draggable=!0,u.add(j(i,"dragstart",v=>{n.invokeFunction(b=>Ig(b,[{resource:t.value.uri,selection:t.value.range}],v)),_Ie([{fsPath:t.value.uri.fsPath,range:t.value.range,name:t.name,kind:t.kind}],v),v.dataTransfer?.setDragImage(i,0,0)}));let p=u.add(e.createScoped(i));Get.bindTo(p).set(t.value.uri.toString()),Auo(a,p,t.value.uri);let h,g=()=>{h||(h=[[ue.hasDefinitionProvider.bindTo(p),r.definitionProvider],[ue.hasReferenceProvider.bindTo(p),r.referenceProvider],[ue.hasImplementationProvider.bindTo(p),r.implementationProvider],[ue.hasTypeDefinitionProvider.bindTo(p),r.typeDefinitionProvider]])},f=async()=>{g();let v=await s.createModelReference(t.value.uri);try{let b=v.object.textEditorModel;for(let[S,y]of h)S.set(y.has(b))}finally{v.dispose()}};return u.add(j(i,re.CONTEXT_MENU,async v=>{let b=new yn(Me(v),v);$t.stop(v,!0);try{await f()}catch(S){console.error(S)}l.showContextMenu({contextKeyService:p,getAnchor:()=>b,getActions:()=>{let S=c.getMenuActions(o,p,{arg:t.value});return Uc(S)}})})),u}function Auo(a,i,e){let t=a.get(be),o=a.get(kt),n=a.get(Ct);new CY(i,t,o,n).set(e)}function A6o(a,i,e,t,o,n){let r=a.get(ze),s=a.get(qt);return j(i,re.CONTEXT_MENU,async l=>{let c=new yn(Me(l),l);$t.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 Uc(u)}})})}var Get=new Q("chatAttachmentResource",void 0,{type:"URI",description:d(6022,null)});var Aee=ae("chatAttachmentWidgetRegistry"),pHt=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)}};var Nee=class extends C{constructor(e,t,o){super();this.instantiationService=t;this.chatAttachmentWidgetRegistry=o;this.attachedContextDisposables=this._register(new P);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(Za,{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;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)}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)&&No(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(Tee,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else if(STt(e))c=this.instantiationService.createInstance(Dee,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else if(pV(e))e.omittedState=l?2:e.omittedState,c=this.instantiationService.createInstance(wee,o,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else if(pP(e)){if(e.automaticallyAdded)return;c=this.instantiationService.createInstance(kee,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels)}else if(PY(e)){if(e.automaticallyAdded)return;c=this.instantiationService.createInstance(Eee,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels)}else if(o&&(e.kind==="file"||e.kind==="directory"))c=this.instantiationService.createInstance(Iee,o,n,e,r,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else if(xYi(e))c=this.instantiationService.createInstance(yee,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else if(fTt(e))c=this.instantiationService.createInstance(Cee,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else if(o&&bTt(e))c=this.instantiationService.createInstance(_ee,o,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else if(ITt(e))c=this.instantiationService.createInstance(Lee,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else if(yTt(e))c=this.instantiationService.createInstance(Ree,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else if(wTt(e))c=this.instantiationService.createInstance(Mee,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else{if(vTt(e))return;c=this.chatAttachmentWidgetRegistry.createWidget(e,{shouldFocusClearButton:!1,supportsDeletion:!1},t)??this.instantiationService.createInstance(xee,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)}};Nee=I([m(1,F),m(2,Aee)],Nee);var mHt=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 zm(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?Uk(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 yxi=class extends C{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})}},hHt=new yxi;oe.add("workbench.registry.explorer.fileContributions",hHt);var $et=class a{static{this.ITEM_HEIGHT=22}getHeight(i){return a.ITEM_HEIGHT}getTemplateId(i){return S3.ID}},gHt=new E,sPe=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 Tg&&i.isRoot&&!i.error&&e&&this.contextService.getWorkbenchState()!==2&&gHt.fire(i.resource),r),r=>{if(i instanceof Tg&&i.isRoot)if(this.contextService.getWorkbenchState()===2){let s=new Tg(i.resource,this.fileService,this.configService,this.filesConfigService,void 0,void 0,!1);return s.error=r,[s]}else gHt.fire(i.resource);else this.notificationService.error(r);return[]});return this.progressService.withProgress({location:1,delay:this.layoutService.isRestored()?800:1500},r=>n),n}};sPe=I([m(2,Bo),m(3,B),m(4,Ne),m(5,fi),m(6,be),m(7,za),m(8,Pe),m(9,lr)],sPe);var fHt=class extends Tg{},wxi=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=Fc(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=Fc(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()}},aPe=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 wxi;this.explorerFindActiveContextKey=HPt.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(10497,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 fHt||this.phantomParents.add(c),l[l.length-1].markItemAndParentsAsFiltered()}}createPhantomItems(i,e,t){let o=Fc(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 fHt(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(10497,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=F6o(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!==Y.file&&i!==Y.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?W6o(i):V6o(i),s=MP(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(!so(v))throw v}if(!c||!u||n.isCancellationRequested)return{explorerRoot:e,files:[],directories:[],hitMaxResults:!1};let p=c.results.map(v=>v.resource),h=O6o(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}}};aPe=I([m(2,Jp),m(3,be),m(4,B),m(5,lr),m(6,Bo),m(7,za),m(8,X)],aPe);function O6o(a,i,e){let t=new Mn;for(let n of a){let r=Fc(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||!Cp(e,s,{ignoreCase:!0})||o.push(n)}return o}function F6o(a,i){let e=Fc(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 W6o(a){return a?"*"+a.split("").join("*")+"*":"*"}function V6o(a){return a?"*"+a+"*":"*"}var vHt=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()}},S3=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 xI;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(10498,null)}get templateId(){return S3.ID}renderTemplate(i){let e=new P,t=e.add(this.labels.create(i,{supportHighlights:!0}));e.add(t.onDidRender(()=>{$r(Me(n.container),()=>{try{n.currentContext&&this.updateWidth(n.currentContext)}catch{}})}));let o=hHt.create(this.instantiationService,i,e);e.add(hHt.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 P),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_${vHt.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 vHt(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=bHt(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:ua(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 fv(n.label.element.lastElementChild,{},{...BS,badgeBackground:wt(WGi),badgeBorder:wt(VGi)});h.setCount(p),h.setTitleFormat(d(10490,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(je(p,h||" "),u),o.element.firstElementChild.style.display="none";let g=new Dc(o.element,this.contextViewService,{validationOptions:{validation:w=>{let k=t.validationMessage(w);return!k||k.severity!==St.Error?null:{content:k.content,formatContent:!0,type:3}}},ariaLabel:d(10491,null),inputBoxStyles:pl}),f=h.lastIndexOf("."),v="prefix";g.value=h,g.focus(),g.select({start:0,end:f>0&&!e.isDirectory?f:h.length});let b=wd((w,k)=>{o.element.style.display="none";let T=g.value;Ue(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===St.Info?1:w.severity===St.Warning?2:3}):g.hideMessage()}};S();let y=[g,g.onDidChange(w=>{o.setFile(je(p,w||" "),u)}),Vo(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)}),Vo(g.inputElement,re.KEY_UP,w=>{S()}),j(g.inputElement,re.BLUR,async()=>{for(;;){await Pi(0);let w=g.inputElement.ownerDocument;if(!w.hasFocus())break;if(sa(g.inputElement))return;if(Ao(w.activeElement)&&Qbe(w.activeElement,"context-view"))await H.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()}};S3=I([m(4,_n),m(5,De),m(6,B),m(7,za),m(8,ot),m(9,Pe),m(10,ze),m(11,F)],S3);var lPe=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 Mn),this.ignoreTreesPerRoot.set(t.uri.toString(),Yu.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||!uo(l.original,n)}let s=Xi(n);this.hiddenExpressionPerRoot.set(t.uri.toString(),{original:s,parsed:zm(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 mHt(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(SM(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(){Ue(this.toDispose)}};lPe=I([m(0,Pe),m(1,B),m(2,za),m(3,ee),m(4,dt),m(5,be)],lPe);var cPe=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=Uio,s=$io;break;case"lower":r=zio,s=qio;break;case"unicode":r=Kio,s=jio;break;default:r=h7e,s=Gio}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)}}};cPe=I([m(0,za),m(1,Pe)],cPe);var aT=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=C.None;this.disposables=new P;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=aT.getCompressedStatFromDragEvent(e,n);if(r){let s=bHt(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&&!it||n.altKey&&it),s=i instanceof p1,c={type:s||r?0:1,position:"drop-target"};if(s){if(!gu(n,Aa.FILES,Ll.FILES,Aa.RESOURCES))return!1}else{if(i instanceof Zqe)return!1;{let u=aT.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?aT.getCompressedStatFromDragEvent(i[0],e).name:String(i.length)}onDragStart(i,e){let t=aT.getStatsFromDragAndDropData(i,e);if(t.length&&e.dataTransfer){this.instantiationService.invokeFunction(n=>Ig(n,t,e));let o=t.filter(n=>n.resource.scheme===Y.file).map(n=>n.resource.fsPath);o.length&&e.dataTransfer.setData(Ll.FILES,JSON.stringify(o))}}async drop(i,e,t,o,n){if(this.compressedDropTargetDisposable.dispose(),e){let s=aT.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 p1?!Gt||xx(this.contextService.getWorkspace())&&Sx.supported(It)?await this.instantiationService.createInstance(JMe).import(r,n,It):await this.instantiationService.createInstance(TB).upload(e,n):await this.handleExplorerDrop(i,r,t,o,n)}catch(s){this.dialogService.error(In(s))}}async handleExplorerDrop(i,e,t,o,n){let r=aT.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=fGe([...s.keys()],h=>h.resource),c=n.ctrlKey&&!it||n.altKey&&it;if(!c&&this.configurationService.getValue(aT.CONFIRM_DND_SETTING_KEY)){let h=l.length>1&&l.every(v=>v.isRoot)?d(10486,null):l.length>1?d(10484,null,l.length,e.name):l[0].isRoot?d(10485,null,l[0].name):d(10483,null,l[0].name,e.name),g=l.length>1&&!l.every(v=>v.isRoot)?Xw(l.map(v=>v.resource)):void 0,f=await this.dialogService.confirm({message:h,detail:g,checkbox:{label:d(10489,null)},primaryButton:d(10493,null)});if(!f.confirmed)return;f.checkboxChecked===!0&&await this.configurationService.updateValue(aT.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 Tg&&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 GBt(this.explorerService,this.fileService,this.dialogService,e,{resource:s,isDirectory:l,allowOverwrite:c},t.incrementalNaming);if(!u)continue;let p=new tu(s,u,{copy:!0,overwrite:c});o.push(p)}let n=Nuo(i);await this.explorerService.applyBulkEdit(o,{confirmBeforeUndo:t.confirmUndo==="default"||t.confirmUndo==="verbose",undoLabel:d(10487,null,n),progressLabel:d(10488,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 tu(r.resource,je(e.resource,r.name))),o=Nuo(i),n={confirmBeforeUndo:this.configurationService.getValue().explorer.confirmUndo==="verbose",undoLabel:d(10492,null,o),progressLabel:d(10494,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=Qdo(s),{confirmed:c}=await this.dialogService.confirm(l);c&&await this.explorerService.applyBulkEdit(t.map(u=>new tu(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=[aT.getCompressedStatFromDragEvent(i.elements[0],e)],i.context):i.elements}static getCompressedStatFromDragEvent(i,e){let t=Me(e).document.elementFromPoint(e.clientX,e.clientY),o=bHt(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()}};aT=I([m(1,za),m(2,ee),m(3,ct),m(4,Pe),m(5,be),m(6,B),m(7,F),m(8,Of),m(9,dt)],aT);function bHt(a){if(!Ao(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(Xo(e)&&Xo(t))return{element:i,count:e,index:t}}i=i.parentElement}return null}function Ouo(a){return!!bHt(a)}var SHt=class{isIncompressible(i){return i.isRoot||!i.isDirectory||i instanceof d3||!i.parent||i.parent.isRoot}};function Nuo(a){return a.length===1?a[0].name:a.every(i=>i.isDirectory)?d(10496,null,a.length):a.every(i=>!i.isDirectory)?d(10495,null,a.length):`${a.length} files and folders`}function B6o(a){if(a.isRoot&&a.error)return{tooltip:d(10472,null,In(a.error)),letter:"!",color:PGi};if(a.isSymbolicLink)return{tooltip:d(10474,null),letter:"\u2937"};if(a.isUnknown)return{tooltip:d(10475,null),letter:"?"};if(a.isExcluded)return{color:hgt}}var dPe=class{constructor(i,e){this.explorerService=i;this.label=d(10473,null);this._onDidChange=new E;this.toDispose=new P;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(gHt.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 B6o(e)}dispose(){this.toDispose.dispose()}};dPe=I([m(0,za),m(1,Pe)],dPe);function H6o(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 U6o(a,i){for(let e of i)if(a.hasNode(e)&&!a.isCollapsed(e))return!0;return!1}var z6o={getId:a=>a instanceof d3?`new:${a.getId()}`:a.getId()};function K6o(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 zR=class extends zr{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N,O,V,U,G){super(e,p,t,g,h,o,n,U,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=N;this.uriIdentityService=O;this.commandService=V;this.accessibilityService=G;this._autoReveal=!1;this.delegate=e.delegate,this.resourceContext=n.createInstance(Fo),this._register(this.resourceContext),this.parentReadonlyContext=ivi.bindTo(h),this.folderContext=lu.bindTo(h),this.readonlyContext=tvi.bindTo(h),this.availableEditorIdsContext=VPt.bindTo(h),this.rootContext=FC.bindTo(h),this.resourceMoveableToTrash=due.bindTo(h),this.compressedFocusContext=uue.bindTo(h),this.compressedFocusFirstContext=x7e.bindTo(h),this.compressedFocusLastContext=k7e.bindTo(h),this.viewHasSomeCollapsibleRootItem=Coo.bindTo(h),this.viewVisibleContextKey=$5.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 iHt.bindTo(this.contextKeyService)}get resourceCutContextKey(){return BPt.bindTo(this.contextKeyService)}renderHeader(e){super.renderHeader(e),this.dragHandler=new IIe(e,()=>this.setExpanded(!0));let t=e.querySelector(".title"),o=()=>{t.textContent=this.name,this.updateTitle(this.name),this.ariaHeaderLabel=d(10480,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=R(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(Me(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 ts(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 K6o(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=no.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(lPe),this._register(this.filter),this._register(this.filter.onDidChange(()=>this.refresh(!0)));let t=this.instantiationService.createInstance(Za,{onDidChangeVisibility:this.onDidChangeBodyVisibility});this._register(t),this.findProvider=this.instantiationService.createInstance(aPe,this.filter,()=>this.tree);let o=l=>this.tree.updateWidth(l);this.renderer=this.instantiationService.createInstance(S3,e,t,this.findProvider.highlightTree,o),this._register(this.renderer),this._register(DB(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(qI,"FileExplorer",e,new $et,new SHt,[this.renderer],this.instantiationService.createInstance(sPe,this.filter,this.findProvider),{compressionEnabled:n(),accessibilityProvider:this.renderer,identityProvider:z6o,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(cPe),dnd:this.instantiationService.createInstance(aT,l=>this.isItemCollapsed(l)),collapseByDefault:l=>!(l instanceof Tg&&(l.hasNests&&r(l).expand||this.findProvider.isShowingFilterResults())),autoExpandSingleChildren:!0,expandOnlyOnTwistieClick:l=>{if(l instanceof Tg){if(l.hasNests)return!0;if(this.configurationService.getValue("workbench.tree.expandMode")==="doubleClick")return!0}return!1},paddingBottom:$et.ITEM_HEIGHT,overrideStyles:this.getLocationBasedColors().listOverrideStyles,findProvider:this.findProvider}),this._register(this.tree),this._register(this.themeService.onDidColorThemeChange(()=>this.tree.rerender()));let s=H.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()})})),ovi.bindTo(this.tree.contextKeyService),C7e.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(!(ag(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?vn:Un)}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(wme)})),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(zR.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(Oh(e.browserEvent.target))return;let t=e.element,o=e.anchor;if(Ao(o)&&t){let l=this.renderer.getCompressedNavigationController(t);l&&l.length>0&&(ag(e.browserEvent)||Ouo(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 Tg){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 Tg?[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 jbe(e,t)}async setTreeInput(){if(!this.isBodyVisible())return Promise.resolve(void 0);this.setTreeInputPromise&&await this.setTreeInputPromise;let e=!this.tree.getInput();e&&sn("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(zR.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 Tg)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 vt;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&&sn("code/didResolveExplorer")});this.progressService.withProgress({location:1,delay:this.layoutService.isRestored()?800:1500},l=>s),await s,this.decorationsProvider||(this.decorationsProvider=new dPe(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)&&H6o(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(U6o(this.tree,t)),this.storeTreeViewState()}hasPhantomElements(){return!!this.findProvider?.isShowingFilterResults()}dispose(){this.dragHandler?.dispose(),super.dispose()}};I([mi],zR.prototype,"fileCopiedContextKey",1),I([mi],zR.prototype,"resourceCutContextKey",1),zR=I([m(1,ze),m(2,Ri),m(3,F),m(4,Pe),m(5,Bo),m(6,ee),m(7,ul),m(8,fi),m(9,_e),m(10,X),m(11,B),m(12,Cv),m(13,ot),m(14,De),m(15,Te),m(16,tt),m(17,za),m(18,le),m(19,Wi),m(20,be),m(21,dt),m(22,ge),m(23,Qe),m(24,Bi)],zR);function DB(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 Fuo=x.or(x.and(lu,pF),x.and(lu.toNegated(),ivi.toNegated()));W(class extends K{constructor(){super({id:"workbench.files.action.createFileFromExplorer",title:d(10478,null),f1:!1,icon:M.newFile,precondition:Fuo,menu:{id:D.ViewTitle,group:"navigation",when:x.equals("view",Cb),order:10}})}run(a){a.get(ge).executeCommand(wme)}});W(class extends K{constructor(){super({id:"workbench.files.action.createFolderFromExplorer",title:d(10479,null),f1:!1,icon:M.newFolder,precondition:Fuo,menu:{id:D.ViewTitle,group:"navigation",when:x.equals("view",Cb),order:20}})}run(a){a.get(ge).executeCommand(tPe)}});W(class extends K{constructor(){super({id:"workbench.files.action.refreshFilesExplorer",title:L(10481,"Refresh Explorer"),f1:!0,icon:M.refresh,menu:{id:D.ViewTitle,group:"navigation",when:x.equals("view",Cb),order:30},metadata:{description:L(10482,"Forces a refresh of the Explorer.")},precondition:HPt.negate()})}async run(a){let i=a.get(Ft),e=a.get(za);await i.openView(Cb),await e.refresh()}});W(class extends K{constructor(){super({id:"workbench.files.action.collapseExplorerFolders",title:L(10476,"Collapse Folders in Explorer"),f1:!0,icon:M.collapseAll,menu:{id:D.ViewTitle,group:"navigation",when:x.equals("view",Cb),order:40},metadata:{description:L(10477,"Folds all folders in the Explorer.")}})}run(a){let e=a.get(Ft).getViewWithId(Cb);e!==null&&e.collapseAll()}});var LB=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 uPe=class extends C{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=>ht.find(o,n=>Xe(n.sessionResource,t))).map(o=>o?.editingSession?.getDiffsForFilesInRequest(e)).map((o,n)=>o?.read(n)||ht.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 oO(t,{});this._register(he(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?M.chevronRight:M.chevronDown,this.domNode.classList.toggle("chat-file-changes-collapsed",this.isCollapsed)};n();let r=new P;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(7102,"View All File Changes")}));return t.classList.add(...q.asClassNameArray(M.diffMultiple)),t.setAttribute("role","button"),t.tabIndex=0,hn(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(xu,s,"Checkpoint File Changes",r.map(c=>new ik(c.originalUri,c.modifiedUri,void 0)),!1);this.editorService.openEditor(l),$t.stop(n,!0)}))}renderFilesList(e){let t=new P;this.list=t.add(this.instantiationService.createInstance(qet)).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=>{$t.stop(n.browserEvent,!0)})),t.add(he(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)}};uPe=I([m(2,tt),m(3,Si),m(4,ee),m(5,F)],uPe);var qet=class extends C{constructor(e,t){super();this.instantiationService=e;this.themeService=t;this._resourcePool=this._register(new LB(()=>this.listFactory()))}listFactory(){let e=_(".chat-summary-list"),t=new P;t.add(DB(e,this.themeService));let o=t.add(this.instantiationService.createInstance(Za,{onDidChangeVisibility:()=>C.None}));return{list:t.add(this.instantiationService.createInstance(Rl,"ChatListRenderer",e,new Cxi,[this.instantiationService.createInstance(IHt,o)],{alwaysConsumeMouseWheel:!1})),dispose:()=>{t.dispose()}}}get(){return this._resourcePool.get().list}};qet=I([m(0,F),m(1,De)],qet);var Cxi=class{getHeight(i){return 22}getTemplateId(i){return IHt.TEMPLATE_ID}},IHt=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 pPe=class extends C{constructor(e,t,o,n){super();this.editorService=o;this.telemetryService=n;let r=nCi(e.citations),s=bt(".chat-code-citation-message@root",[bt("span.chat-code-citation-label@label"),bt(".chat-code-citation-button-container@button")]);s.label.textContent=r+" - ";let l=this._register(new Mi(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(7103,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"}};pPe=I([m(2,ee),m(3,Te)],pPe);var G6o=_,mPe=class extends C{constructor(e,t,o){super();this.commandService=o;this.domNode=G6o(".chat-command-button");let n=!Vi(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(7104,null),s=this._register(new Mi(e,{...Ko,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"}};mPe=I([m(2,ge)],mPe);var Av=ae("chatMarkdownAnchorService"),yHt=class extends C{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 sa(t)&&this.setLastFocusedList(e),hn(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 Wuo(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(eX(o,a))return e[o]}function Ck(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 h=new URLSearchParams(u.query).get("vscodeLinkType");h&&(l={vscodeLinkType:h,linkText:r},s=!0)}if(s&&u?.scheme){let p=i.createInstance(RB,n,{kind:"inlineReference",inlineReference:u},l);t.add(e.register(p)),t.add(p)}})}var RB=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super();this.element=e;this.inlineReference=t;this.metadata=o;this.configurationService=n;this.notebookDocumentService=S;this.openerService=y;this.data="uri"in t.inlineReference?t.inlineReference:"name"in t.inlineReference?{kind:"symbol",symbol:t.inlineReference}:{uri:t.inlineReference},e.classList.add(RB.className,"show-file-icons");let w,k,T;if(this.data.kind==="symbol"){let U=this.data.symbol;T=this.data.symbol.location,w=[this.data.symbol.name],k=["codicon",...js(f,h,void 0,void 0,sh.toIcon(U.kind))],this._store.add(u.invokeFunction(G=>Ixi(G,e,r,{value:U.location,name:U.name,kind:U.kind},D.ChatInlineSymbolAnchorContext)))}else{T=this.data;let U=this.metadata?.linkText??p.getUriBasenameLabel(T.uri);if(T.range&&this.data.kind!=="symbol"){let ke=T.range.startLineNumber===T.range.endLineNumber?`:${T.range.startLineNumber}`:`:${T.range.startLineNumber}-${T.range.endLineNumber}`;w=[U,_("span.label-suffix",void 0,ke)]}else T.uri.scheme==="vscode-notebook-cell"&&this.data.kind!=="symbol"?w=[`${U} \u2022 cell${this.getCellIndex(T.uri)}`]:w=[U];let G=T.uri.path.endsWith("/")?1:0,$=()=>js(f,h,T.uri,G,G===1&&!b.getFileIconTheme().hasFolderIcons?X$:void 0);k=$();let te=()=>{N.classList.remove(...k),k=$(),N.classList.add(...k)};this._register(b.onDidFileIconThemeChange(()=>{te()}));let pe=!1;l.stat(T.uri).then(ke=>{pe=ke.isDirectory,ke.isDirectory&&(G=1,te())}).catch(()=>{});let de=this._register(r.createScoped(e));Get.bindTo(de).set(T.uri.toString());let se=lu.bindTo(de),Se=!1;this._register(j(e,re.CONTEXT_MENU,async ke=>{let Ee=new yn(Me(ke),ke);$t.stop(ke,!0),Se||(Se=!0,new CY(de,l,h,f).set(T.uri)),se.set(pe),!this._store.isDisposed&&s.showContextMenu({contextKeyService:de,getAnchor:()=>Ee,getActions:()=>{let He=g.getMenuActions(D.ChatInlineResourceAnchorContext,de,{arg:T.uri});return Uc(He)}})})),T.range&&(T.range.startLineNumber===T.range.endLineNumber?e.setAttribute("aria-label",d(7119,null,U,T.range.startLineNumber)):e.setAttribute("aria-label",d(7120,null,U,T.range.startLineNumber,T.range.endLineNumber)))}let N=_("span.icon");N.classList.add(...k),e.replaceChildren(N,_("span.icon-label",{},...w));let O=T.range?`${T.range.startLineNumber},${T.range.startColumn}`:"";e.setAttribute("data-href",(O?T.uri.with({fragment:O}):T.uri).toString());let V=p.getUriLabel(T.uri,{relative:!0});this._register(c.setupManagedHover(Ni("element"),e,V)),this.updateAppearance(),this._register(this.configurationService.onDidChangeConfiguration(U=>{U.affectsConfiguration("chat.inlineReferences.style")&&this.updateAppearance()})),this.data.kind!=="symbol"&&(e.draggable=!0,this._register(j(e,"dragstart",U=>{let G={resource:T.uri,selection:T.range};u.invokeFunction($=>Ig($,[G],U)),U.dataTransfer?.setDragImage(e,0,0)}))),this._register(j(e,"click",async U=>{$t.stop(U,!0);let $={override:Wuo(T.uri,this.configurationService)};T.range&&($.selection=T.range),await this.openerService.open(T.uri,{fromUserGesture:!0,editorOptions:$})}))}static{this.className="chat-inline-anchor-widget"}getHTMLElement(){return this.element}updateAppearance(){let t=this.configurationService.getValue("chat.inlineReferences.style")==="link";this.element.classList.toggle("link-style",t)}getCellIndex(e){let o=this.notebookDocumentService.getNotebook(e)?.getCellIndex(e)??-1;return o>=0?` ${o+1}`:""}};RB=I([m(3,B),m(4,X),m(5,ze),m(6,be),m(7,tt),m(8,F),m(9,ot),m(10,kt),m(11,qt),m(12,Ct),m(13,Te),m(14,De),m(15,Ij),m(16,Qe)],RB);W(class Vuo extends K{static{this.id="chat.inlineResourceAnchor.addFileToChat"}constructor(){super({id:Vuo.id,title:L(7115,"Add File to Chat"),menu:[{id:D.ChatInlineResourceAnchorContext,group:"chat",order:1,when:lu.negate()}]})}async run(i,e){let o=i.get(At).lastFocusedWidget;o&&o.attachmentModel.addFile(e)}});W(class Buo extends K{static{this.id="chat.inlineResourceAnchor.copyResource"}constructor(){super({id:Buo.id,title:L(7116,"Copy"),f1:!1,precondition:Get,keybinding:{weight:200,primary:2081}})}async run(i){let e=i.get(Av),t=i.get(Wi),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 Huo extends K{static{this.id="chat.inlineResourceAnchor.openToSide"}constructor(){super({id:Huo.id,title:L(7118,"Open to the Side"),f1:!1,precondition:Get,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=Wuo(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],vn)}getTarget(i,e){let t=i.get(Av);if(e)return e;let o=t.lastFocusedAnchor;if(o)return o.data.kind==="symbol"?o.data.symbol.location:o.data.uri}});W(class Uuo extends K{static{this.id="chat.inlineSymbolAnchor.goToDefinition"}constructor(){super({id:Uuo.id,title:{...L(7117,"Go to Definition"),mnemonicTitle:d(7124,null)},menu:[D.ChatInlineSymbolAnchorContext,D.ChatInputSymbolAttachmentContext].map(i=>({id:i,group:"4_symbol_nav",order:1.1,when:ue.hasDefinitionProvider}))})}async run(i,e){let t=i.get(Kt),o=i.get(F);await zuo(t,e);let n=new NW({openToSide:!1,openInPeek:!1,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0});return o.invokeFunction(r=>n.run(r))}});async function zuo(a,i){await a.openCodeEditor({resource:i.uri,options:{selection:{startColumn:i.range.startColumn,startLineNumber:i.range.startLineNumber}}},null)}async function xxi(a,i,e){let t=a.get(Kt),o=a.get(ge);return await zuo(t,e),o.executeCommand(i)}W(class Kuo extends K{static{this.id="chat.inlineSymbolAnchor.goToTypeDefinitions"}constructor(){super({id:Kuo.id,title:{...L(7123,"Go to Type Definitions"),mnemonicTitle:d(7127,null)},menu:[D.ChatInlineSymbolAnchorContext,D.ChatInputSymbolAttachmentContext].map(i=>({id:i,group:"4_symbol_nav",order:1.1,when:ue.hasTypeDefinitionProvider}))})}async run(i,e){await xxi(i,"editor.action.goToTypeDefinition",e)}});W(class Guo extends K{static{this.id="chat.inlineSymbolAnchor.goToImplementations"}constructor(){super({id:Guo.id,title:{...L(7121,"Go to Implementations"),mnemonicTitle:d(7125,null)},menu:[D.ChatInlineSymbolAnchorContext,D.ChatInputSymbolAttachmentContext].map(i=>({id:i,group:"4_symbol_nav",order:1.2,when:ue.hasImplementationProvider}))})}async run(i,e){await xxi(i,"editor.action.goToImplementation",e)}});W(class $uo extends K{static{this.id="chat.inlineSymbolAnchor.goToReferences"}constructor(){super({id:$uo.id,title:{...L(7122,"Go to References"),mnemonicTitle:d(7126,null)},menu:[D.ChatInlineSymbolAnchorContext,D.ChatInputSymbolAttachmentContext].map(i=>({id:i,group:"4_symbol_nav",order:1.3,when:ue.hasReferenceProvider}))})}async run(i,e){await xxi(i,"editor.action.goToReferences",e)}});function quo(a,i){let e=new P;for(let t of a.querySelectorAll("table")){if(!Ao(t))continue;q6o(t);let o=t.parentElement,n=t.nextSibling,r=document.createElement("div");r.appendChild(t);let s=e.add(new Pa(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 $6o=3;function q6o(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,$6o)+"ch")}}var xme=class{static getSanitizerOptions(i){return{allowedTags:{override:[...i.allowedTags,...j6o]},allowedAttributes:{override:[...i.allowedAttributes,"stretchy","encoding","accent",ret,"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 bg("katex","dist/katex.min.js"),this._katex))}static getExtension(i,e={}){if(this._katex)return this.ensureKatexStyles(i),uBt.extension(this._katex,e)}static async loadExtension(i,e={}){let t=await this._katexPromise.value;return this.ensureKatexStyles(i),uBt.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=H_t("katex","dist/katex.min.css"),e.head.appendChild(t)}}},j6o=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 juo(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 kxi=class extends gg{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()}},kme=class extends C{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:Y.vscodeChatCodeBlock,path:`/chat-diff-original-${e.codeBlockIndex}-${_t()}`}),c=A.from({scheme:Y.vscodeChatCodeBlock,path:`/chat-diff-modified-${e.codeBlockIndex}-${_t()}`}),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 kxi(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 Q0(g.original.getValue())}))};this.comparePart.object.render(h,o,ve.None),this.element=this.comparePart.object.element}layout(e){this.comparePart.object.layout(e)}reset(){this.modelRef.clear()}};kme=I([m(3,Ct),m(4,Nt),m(5,kt)],kme);var QKu=J("agentStatusIndicator.background",{dark:Oe.white.transparent(.05),light:Oe.black.transparent(.05),hcDark:null,hcLight:null},d(8073,null)),YKu=J("chat.requestBorder",{dark:new Oe(new Bt(255,255,255,.1)),light:new Oe(new Bt(0,0,0,.1)),hcDark:gi,hcLight:gi},d(8080,null)),Quo=J("chat.requestBackground",{dark:ei(qo,.62),light:ei(qo,.62),hcDark:gm,hcLight:null},d(8079,null)),I3=J("chat.slashCommandBackground",{dark:"#26477866",light:"#adceff7a",hcDark:Oe.white,hcLight:rv},d(8084,null)),y3=J("chat.slashCommandForeground",{dark:"#85b6ff",light:"#26569e",hcDark:Oe.black,hcLight:Yw},d(8085,null)),XKu=J("chat.avatarBackground",{dark:"#1f1f1f",light:"#f2f2f2",hcDark:Oe.black,hcLight:Oe.white},d(8074,null)),JKu=J("chat.avatarForeground",ko,d(8075,null)),ZKu=J("chat.editedFileForeground",{light:"#895503",dark:"#E2C08D",hcDark:"#E2C08D",hcLight:"#895503"},d(8076,null)),e2u=J("chat.requestCodeBorder",{dark:"#004972B8",light:"#0e639c40",hcDark:null,hcLight:null},d(8083,null),!0),t2u=J("chat.requestBubbleBackground",{light:ei(sv,.3),dark:ei(sv,.3),hcDark:null,hcLight:null},d(8081,null),!0),i2u=J("chat.requestBubbleHoverBackground",{dark:ei(sv,.6),light:ei(sv,.6),hcDark:null,hcLight:null},d(8082,null),!0),o2u=J("chat.checkpointSeparator",{dark:"#585858",light:"#a9a9a9",hcDark:"#a9a9a9",hcLight:"#a5a5a5"},d(8087,null)),n2u=J("chat.linesAddedForeground",{dark:"#54B054",light:"#107C10",hcDark:"#54B054",hcLight:"#107C10"},d(8077,null),!0),r2u=J("chat.linesRemovedForeground",{dark:"#FC6A6A",light:"#BC2F32",hcDark:"#F48771",hcLight:"#B5200D"},d(8078,null),!0),s2u=J("chat.thinkingShimmer",{dark:"#ffffff",light:"#000000",hcDark:"#ffffff",hcLight:"#000000"},d(8086,null),!0);var Exi="http://_vscodedecoration_",wHt="http://_chatagent_",Yuo="http://_chatslash_";function Txi(a,i,e,t){let o=t.get(mz),n=t.get(br),r=o.getAgentNameRestriction(a),s=`${r?a.name:Hj(a)}`;r&&n.agentHasDupeName(a.id)&&(s+=` (${a.publisherDisplayName})`);let c={agentId:a.id,sessionResource:i,name:s,isClickable:e};return`[${a.name}](${wHt}?${encodeURIComponent(JSON.stringify(c))})`}function Xuo(a,i,e){let t=`${yu}${i.name}`,o={agentId:a.id,command:i.name,sessionResource:e};return`[${t}](${Yuo}?${encodeURIComponent(JSON.stringify(o))})`}var Oee=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 pb?t+=o.text:o instanceof zu?t+=this.instantiationService.invokeFunction(n=>Txi(o.agent,i,!1,n)):t+=this.genericDecorationToMarkdown(o);return t}genericDecorationToMarkdown(i){let e=i instanceof tR&&i.data instanceof A?i.data:void 0,o={title:e?this.labelService.getUriLabel(e,{relative:!0}):i instanceof jx?i.slashCommand.detail:i instanceof Pf?i.command.description:i instanceof Qx?i.name:i instanceof ZS?this.toolsService.getTool(i.toolId)?.userDescription:""};return`[${i.text}](${Exi}?${encodeURIComponent(JSON.stringify(o))})`}walkTreeAndAnnotateReferenceLinks(i,e){let t=new P;return e.querySelectorAll("a").forEach(o=>{let n=o.getAttribute("data-href");if(n)if(n.startsWith(wHt)){let r;try{r=JSON.parse(decodeURIComponent(n.slice(wHt.length+1)))}catch(s){this.logService.error("Invalid chat widget render data JSON",In(s))}r&&o.replaceWith(this.renderAgentWidget(r,t))}else if(n.startsWith(Yuo)){let r;try{r=JSON.parse(decodeURIComponent(n.slice(wHt.length+1)))}catch(s){this.logService.error("Invalid chat slash command render data JSON",In(s))}r&&o.replaceWith(this.renderSlashCommandWidget(o.textContent,r,t))}else if(n.startsWith(Exi)){let r;try{r=JSON.parse(decodeURIComponent(n.slice(Exi.length+1)))}catch{}o.replaceWith(this.renderResourceWidget(o.textContent,r,t))}else n.startsWith(_Bt)?this.renderFileWidget(i,n,o,t):n.startsWith("command:")&&this.injectKeybindingHint(o,n,this.keybindingService)}),t}renderAgentWidget(i,e){let t=`${vg}${i.name}`,o;if(i.isClickable){o=_("span.chat-agent-widget");let s=e.add(new Mi(o,{buttonBackground:wt(I3),buttonForeground:wt(y3),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(l2)));return e.add(this.hoverService.setupManagedHover(Ni("element"),o,()=>(r.value.setAgent(i.agentId),r.value.domNode),n&&KMe(()=>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 Mi(o,{buttonBackground:wt(I3),buttonForeground:wt(y3),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(RB,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(Ni("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))}};Oee=I([m(0,_e),m(1,ne),m(2,br),m(3,F),m(4,tt),m(5,Si),m(6,At),m(7,ge),m(8,ot),m(9,jn),m(10,Av)],Oee);function CHt(a,i,e=!0){for(let t=i.length-1;t>=0;t--){let o=i.slice(0,t),n=i[t],r=Q6o(a,n,o,e);if(r)return r}return null}function Q6o(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 _xi(u,r.settings);p.matches(i,e)&&p.isMoreSpecific(o)&&(o=p)}}return o}var _xi=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 Kr=_,t0=class extends C{static{this.ID="editor.contrib.inspectEditorTokens"}static get(i){return i.getContribution(t0.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!==Y.vscodeNotebookCell&&(this._widget=new Lxi(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()}};t0=I([m(1,f4),m(2,kt),m(3,Gp),m(4,Ne),m(5,B),m(6,zt)],t0);var Dxi=class extends xi{constructor(){super({id:"editor.action.inspectTMScopes",label:L(8307,"Developer: Inspect Editor Tokens and Scopes"),precondition:void 0})}run(i,e){t0.get(e)?.toggle()}};function Juo(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 Lxi=class a extends C{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 $e,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 i1?n:void 0;Rt(this._domNode),this._domNode.appendChild(document.createTextNode(d(8308,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(()=>{t0.get(this._editor)?.stop()})})}_isSemanticColoringEnabled(){let e=this._configurationService.getValue(Nle,{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){Fi(this._domNode,"No grammar or semantic tokens available.");return}let c=r?.metadata,u=s?.metadata,p=s&&Juo(this._model.getValueInRange(s.range)),h=r&&Juo(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(Fi(this._domNode,Kr("h2.tiw-token",void 0,v,Kr("span.tiw-token-length",void 0,`${b} ${b===1?"char":"chars"}`))),R(this._domNode,Kr("hr.tiw-metadata-separator",{style:"clear:both"})),R(this._domNode,Kr("table.tiw-metadata-table",void 0,Kr("tbody",void 0,Kr("tr",void 0,Kr("td.tiw-metadata-key",void 0,"language"),Kr("td.tiw-metadata-value",void 0,c?.languageId||"")),Kr("tr",void 0,Kr("td.tiw-metadata-key",void 0,"standard token type"),Kr("td.tiw-metadata-value",void 0,this._tokenTypeToString(c?.tokenType||0))),...this._formatMetadata(u,c)))),s){R(this._domNode,Kr("hr.tiw-metadata-separator"));let S=R(this._domNode,Kr("table.tiw-metadata-table",void 0)),y=R(S,Kr("tbody",void 0,Kr("tr",void 0,Kr("td.tiw-metadata-key",void 0,"semantic token type"),Kr("td.tiw-metadata-value",void 0,s.type))));if(s.modifiers.length&&R(y,Kr("tr",void 0,Kr("td.tiw-metadata-key",void 0,"modifiers"),Kr("td.tiw-metadata-value",void 0,s.modifiers.join(" ")))),s.metadata){let w=["foreground","bold","italic","underline","strikethrough"],k={},T=new Array;for(let N of w)if(s.metadata[N]!==void 0){let O=s.definitions[N],V=this._renderTokenStyleDefinition(O,N),U=V.map($=>Ao($)?$.outerHTML:$).join(),G=k[U];G||(k[U]=G=[],T.push([V,U])),G.push(N)}for(let[N,O]of T)R(y,Kr("tr",void 0,Kr("td.tiw-metadata-key",void 0,k[O].join(", ")),Kr("td.tiw-metadata-value",void 0,...N)))}}if(r){let S=this._themeService.getColorTheme();R(this._domNode,Kr("hr.tiw-metadata-separator"));let y=R(this._domNode,Kr("table.tiw-metadata-table")),w=R(y,Kr("tbody"));h&&h!==v&&R(w,Kr("tr",void 0,Kr("td.tiw-metadata-key",void 0,"textmate token"),Kr("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(Kr("br"));R(w,Kr("tr",void 0,Kr("td.tiw-metadata-key",void 0,"textmate scopes"),Kr("td.tiw-metadata-value.tiw-metadata-scopes",void 0,...k)));let T=CHt(S,r.token.scopes,!1),N=s?.metadata?.foreground;if(T){if(N!==r.metadata.foreground){let O=Kr("code.tiw-theme-selector",void 0,T.rawSelector,Kr("br"),JSON.stringify(T.settings,null,"	"));N&&(O=Kr("s",void 0,O)),R(w,Kr("tr",void 0,Kr("td.tiw-metadata-key",void 0,"foreground"),Kr("td.tiw-metadata-value",void 0,O)))}}else N||R(w,Kr("tr",void 0,Kr("td.tiw-metadata-key",void 0,"foreground"),Kr("td.tiw-metadata-value",void 0,"No theme selector")))}if(l){let S=l[l.length-1];R(this._domNode,Kr("hr.tiw-metadata-separator"));let y=R(this._domNode,Kr("table.tiw-metadata-table")),w=R(y,Kr("tbody"));R(w,Kr("tr",void 0,Kr("td.tiw-metadata-key",void 0,`tree-sitter token ${S.id}`),Kr("td.tiw-metadata-value",void 0,`${S.text}`)));let k=new Array,T=l.length-1,N=l[T];for(;N.parent||T>0;)k.push(N.type),N=N.parent??l[--T],N&&k.push(Kr("br"));R(w,Kr("tr",void 0,Kr("td.tiw-metadata-key",void 0,"tree-sitter tree"),Kr("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&&R(w,Kr("tr",void 0,Kr("td.tiw-metadata-key",void 0,"foreground"),Kr("td.tiw-metadata-value",void 0,V.map(U=>U.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(Kr("tr",void 0,Kr("td.tiw-metadata-key",void 0,u),Kr(`td.tiw-metadata-value.${h}`,void 0,p)))}return p}let r=n("foreground"),s=n("background");if(r&&s){let u=Oe.fromHex(s),p=Oe.fromHex(r);u.isOpaque()?o.push(Kr("tr",void 0,Kr("td.tiw-metadata-key",void 0,"contrast ratio"),Kr("td.tiw-metadata-value",void 0,u.getContrastRatio(p.makeOpaque(u)).toFixed(2)))):o.push(Kr("tr",void 0,Kr("td.tiw-metadata-key",void 0,"Contrast ratio cannot be precise for background colors that use transparency"),Kr("td.tiw-metadata-value")))}let l=new Array;function c(u){let p;e&&e[u]?p=Kr("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(Kr("tr",void 0,Kr("td.tiw-metadata-key",void 0,"font style"),Kr("td.tiw-metadata-value",void 0,...l))),o}_decodeMetadata(e){let t=this._themeService.getColorTheme().tokenColorMap,o=Qu.getLanguageId(e),n=Qu.getTokenType(e),r=Qu.getFontStyle(e),s=Qu.getForeground(e),l=Qu.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),N={},O=this._themeService.getColorTheme().tokenColorMap,U=this._themeService.getColorTheme().getTokenStyleMetadata(y,w,n,!0,N),G;return U&&(G={languageId:void 0,tokenType:0,bold:U?.bold,italic:U?.italic,underline:U?.underline,strikethrough:U?.strikethrough,foreground:O[U?.foreground||0],background:void 0}),{type:y,modifiers:w,range:T,metadata:G,definitions:N}}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=Kr("ul.tiw-metadata-values"),c=Array.isArray(s.scope)?s.scope:[String(s.scope)];for(let u of c)l.appendChild(Kr("li.tiw-metadata-value.tiw-metadata-scopes",void 0,u));return o.push(r.scope.join(" "),l,Kr("code.tiw-theme-selector",void 0,JSON.stringify(s.settings,null,"	"))),o}return o}else if(rxe.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?Oe.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]}}};go(t0.ID,t0,4);Jt(Dxi);var i0=_,Zuo="vscode-local-file";function epo(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 hPe=10,w3=class extends C{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=i0(".interactive-result-code-block"),this.resourceContextKey=s.createInstance(CY),this.contextKeyService=this._register(l.createScoped(this.element));let h=this._register(s.createChild(new Io([X,this.contextKeyService]))),g=R(this.element,i0(".interactive-result-editor"));this.editor=this.createEditor(h,g,{...Kf(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(7250,null),overflowWidgetsDomNode:n,tabFocusMode:!0,...this.getEditorOptionsFromConfig()});let f=R(this.element,i0(".interactive-result-code-block-toolbar")),v=this._register(this.editor.contextKeyService.createScoped(f)),b=this._register(h.createChild(new Io([X,v])));this.toolbar=this._register(b.createInstance(Ln,f,t,{menuOptions:{shouldForwardArgs:!0}}));let S=R(this.element,i0(".interactive-result-vulns")),y=R(S,i0(".interactive-result-vulns-header",void 0));this.vulnsButton=this._register(new Mi(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=R(S,i0("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"),Xb.get(this.editor)?.stopHighlighting(),this.clearWidgets()})),this._register(this.editor.onDidFocusEditorWidget(()=>{this.element.classList.add("focused"),Xb.get(this.editor)?.restoreViewState(!0)})),this._register(H.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??hPe}dispose(){this.isDisposed=!0,super.dispose()}get uri(){return this.editor.getModel()?.uri}createEditor(e,t,o){return this._register(e.createInstance(jr,t,o,{isSimpleWidget:this.isSimpleWidget,contributions:aa.getSomeEditorContributions([ry.ID,ly,Hm.ID,Xb.ID,$W.ID,I1.ID,wO.ID,kl.ID,Yg.ID,iu.ID,S_.ID,El.ID,Qr.ID,Xy.ID,Fx.ID,t0.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"?Yd.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:Rr(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(7251,null,e.codeBlockIndex+1)}),this.layout(t),this.toolbar.setAriaLabel(d(7252,null,e.codeBlockIndex+1)),e.renderOptions?.hideToolbar?xo(this.toolbar.getElement()):bn(this.toolbar.getElement()),e.vulns?.length&&Vi(e.element)?(Rt(this.vulnsListElement),this.element.classList.remove("no-vulns"),this.element.classList.toggle("chat-vulnerabilities-collapsed",!e.element.vulnerabilitiesListExpanded),R(this.vulnsListElement,...e.vulns.map(n=>i0("li",void 0,i0("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(){kl.get(this.editor)?.hideContentHover(),Yg.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(7261,null,this.currentCodeBlockData.vulns.length):d(7262,null,1)} $(${(o=>o.vulnerabilitiesListExpanded?M.chevronDown:M.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))}};w3=I([m(5,F),m(6,X),m(7,Ct),m(8,B),m(9,Bi)],w3);var gPe=class extends C{constructor(e,t){super();this._modelService=t;this._register(e.registerTextModelContentProvider(Y.vscodeChatCodeBlock,this))}async provideTextContent(e){let t=this._modelService.getModel(e);return t||this._modelService.createModel("",null,e)}};gPe=I([m(0,Nt),m(1,Ct)],gPe);var fPe=class extends C{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=i0(".interactive-result-code-block"),this.element.classList.add("compare"),this.messageElement=R(this.element,i0(".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 Io([X,this.contextKeyService],[rd,new class{show(w,k){return zbt}async showWhile(w,k){await w}}]))),v=this.editorHeader=R(this.element,i0(".interactive-result-header.show-file-icons")),b=R(this.element,i0(".interactive-result-editor"));this.diffEditor=this.createDiffEditor(f,b,{...Kf(this.configurationService),lineNumbers:"on",selectOnLineNumbers:!0,scrollBeyondLastLine:!1,lineDecorationsWidth:12,dragAndDrop:!1,padding:{top:hPe,bottom:hPe},mouseWheelZoom:!1,scrollbar:{vertical:"hidden",alwaysConsumeMouseWheel:!1},definitionLinkOpensInPeek:!1,gotoLocation:{multiple:"goto",multipleDeclarations:"goto",multipleDefinitions:"goto",multipleImplementations:"goto"},ariaLabel:d(7250,null),overflowWidgetsDomNode:n,...this.getEditorOptionsFromConfig()}),this.resourceLabel=this._register(f.createInstance(rk,v,{supportIcons:!0}));let S=this._register(this.diffEditor.getModifiedEditor().contextKeyService.createScoped(v)),y=this._register(f.createChild(new Io([X,S])));this.toolbar=this._register(y.createInstance(Ln,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"),Xb.get(this.diffEditor.getModifiedEditor())?.stopHighlighting(),this.clearWidgets()})),this._register(this.diffEditor.getModifiedEditor().onDidFocusEditorWidget(()=>{this.element.classList.add("focused"),Xb.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:aa.getSomeEditorContributions([ry.ID,ly,Hm.ID,Xb.ID,$W.ID,I1.ID,wO.ID,kl.ID,Yg.ID,S_.ID])};return this._register(e.createInstance(Hu,t,{scrollbar:{useShadows:!1,alwaysConsumeMouseWheel:!1,ignoreHorizontalScrollbarInContentHeight:!0},renderMarginRevertIcon:!1,diffCodeLens:!1,scrollBeyondLastLine:!1,stickyScroll:{enabled:!1},originalAriaLabel:d(7260,null),modifiedAriaLabel:d(7259,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(hPe-t,2):hPe;this.diffEditor.updateOptions({padding:{top:hPe,bottom:o}})}_configureForScreenReader(){let e=this.toolbar.getElement();e.style.display="block",this.accessibilityService.isScreenReaderOptimized()&&(e.ariaLabel=d(7249,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"?Yd.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=nh(this.editorHeader),n=this.diffEditor.getModel()?this.diffEditor.getContentHeight():nh(this.messageElement),r=new ai(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(7253,null),readOnly:!!e.isReadOnly}),this.resourceLabel.element.setFile(e.edit.uri,{fileKind:0,fileDecorations:{colors:!0,badges:!1}})}reset(){this.clearWidgets()}clearWidgets(){kl.get(this.diffEditor.getOriginalEditor())?.hideContentHover(),kl.get(this.diffEditor.getModifiedEditor())?.hideContentHover(),Yg.get(this.diffEditor.getOriginalEditor())?.hideGlyphHover(),Yg.get(this.diffEditor.getModifiedEditor())?.hideGlyphHover()}async updateEditor(e,t){if(!Vi(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){So(e.edit.state?.applied);let r=this.labelService.getUriLabel(e.edit.uri,{relative:!0,noPrefix:!0}),s;e.edit.state.applied===1?s=d(7254,null,r):e.edit.state.applied<0?s=d(7256,null,r):s=d(7255,null,e.edit.state.applied,r);let l=RL(s,{renderCodeSegments:!0,actionHandler:{callback:()=>{this.openerService.open(e.edit.uri,{fromUserGesture:!0,allowCommands:!1})},disposables:this._store}});Fi(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=H.any(n.original.onWillDispose,n.modified.onWillDispose)(()=>{this.diffEditor.setModel(null)});this.diffEditor.setModel(r),this._lastDiffEditorViewModel.value=hn(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(ue.diffEditorInlineMode.key);this.diffEditor.updateOptions({renderSideBySide:s,compactMode:!s,useInlineViewWhenSpaceIsLimited:!1}),this.layout()}}}};fPe=I([m(5,F),m(6,X),m(7,Ct),m(8,B),m(9,Bi),m(10,ot),m(11,Qe)],fPe);var vPe=class{constructor(i,e,t){this.modelService=i;this.editorService=e;this.dialogService=t;this._sha1=new Wue}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||!Xe(r.original.uri,e.uri)||r.modified.uri.scheme!==Y.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 _L(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(Qk.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(7257,null),detail:d(7258,null)})).confirmed)}discard(i,e){i.response.value.includes(e)&&(e.state?.applied||i.setEditApplied(e,-1))}};vPe=I([m(0,Nt),m(1,Kt),m(2,ct)],vPe);var gI=class extends C{constructor(){super(...arguments);this._extension=null}get extension(){return this._extension}set extension(e){this._extension=e,this.update()}update(){this.render()}};function o0(a,i){let e=new P;return e.add(j(a,re.CLICK,Ybe(i))),e.add(j(a,re.KEY_UP,t=>{let o=new Ii(t);(o.equals(10)||o.equals(3))&&(t.preventDefault(),t.stopPropagation(),i())})),e}var c2=class extends gI{constructor(e){super();this.iconLoadingDisposable=this._register(new me);this.iconErrorDisposable=this._register(new me);this.element=R(e,_(".extension-icon")),this.iconElement=R(this.element,_("img.icon",{alt:""})),this.iconElement.style.display="none",this.defaultIconElement=R(this.element,_(q.asCSSSelector(DBt))),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())}},MB=class extends gI{constructor(e,t,o){super();this.container=e;this.small=t;this.hoverService=o;this.disposables=this._register(new P);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=MB.getInstallLabel(this.extension,this.small);if(!e)return;let t=this.small?this.container:R(this.container,_("span.install",{tabIndex:0}));R(t,_("span"+q.asCSSSelector(Lyi)));let o=R(t,_("span.count"));o.textContent=e,this.small||this.disposables.add(this.hoverService.setupManagedHover(Ni("mouse"),this.container,d(9967,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(Dr),n}};MB=I([m(2,tt)],MB);var Fee=class extends gI{constructor(e,t,o,n){super();this.container=e;this.small=t;this.hoverService=o;this.openerService=n;this.disposables=this._register(new P);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){R(this.container,_("span"+q.asCSSSelector(qJe)));let t=R(this.container,_("span.count"));t.textContent=String(e)}else{let t=R(this.container,_("span.rating.clickable",{tabIndex:0}));for(let o=1;o<=5;o++)e>=o?R(t,_("span"+q.asCSSSelector(qJe))):e>=o-.5?R(t,_("span"+q.asCSSSelector(Ilo))):R(t,_("span"+q.asCSSSelector(PWt)));if(this.extension.ratingCount){let o=R(t,_("span",void 0,` (${this.extension.ratingCount})`));o.style.paddingLeft="1px"}this.containerHover=this._register(this.hoverService.setupManagedHover(Ni("mouse"),t,"")),this.containerHover.update(d(9974,null,e)),t.setAttribute("role","link"),this.extension.ratingUrl&&this.disposables.add(o0(t,()=>this.openerService.open(A.parse(this.extension.ratingUrl))))}}};Fee=I([m(2,tt),m(3,Qe)],Fee);var Wee=class extends gI{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 P);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=R(this.container,_(".publisher"));let e=_(".publisher-name.ellipsis");e.textContent=this.extension.publisherDisplayName;let t=_(".verified-publisher");if(R(t,_("span.extension-verified-publisher.clickable"),Qo(XF)),this.small)this.extension.publisherDomain?.verified&&R(this.element,t),R(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(Ni("mouse"),this.element,d(9972,null,this.extension.publisherDisplayName))),R(this.element,e),this.extension.publisherDomain?.verified){R(this.element,t);let o=A.parse(this.extension.publisherDomain.link);t.tabIndex=0,t.setAttribute("role","button"),this.containerHover.update(d(9986,null,this.extension.publisherDomain.link)),t.setAttribute("role","link"),R(t,_("span.extension-verified-publisher-domain",void 0,o.authority.startsWith("www.")?o.authority.substring(4):o.authority)),this.disposables.add(o0(t,()=>this.openerService.open(o)))}this.extension.url&&this.disposables.add(o0(this.element,()=>this.extensionsWorkbenchService.openSearch(`publisher:"${this.extension?.publisherDisplayName}"`)))}}};Wee=I([m(2,zi),m(3,tt),m(4,Qe)],Wee);var bPe=class extends gI{constructor(e,t,o){super();this.container=e;this.hoverService=t;this.openerService=o;this.disposables=this._register(new P);this.render()}render(){if(Fi(this.container),this.disposables.clear(),!this.extension?.publisherSponsorLink)return;let e=R(this.container,_("span.sponsor.clickable",{tabIndex:0}));this.disposables.add(this.hoverService.setupManagedHover(Ni("mouse"),e,this.extension?.publisherSponsorLink.toString()??"")),e.setAttribute("role","link");let t=Qo($Je),o=_("span",void 0,d(9979,null));R(e,t,o),this.disposables.add(o0(e,()=>{this.openerService.open(this.extension.publisherSponsorLink)}))}};bPe=I([m(1,tt),m(2,Qe)],bPe);var SPe=class extends gI{constructor(e,t){super();this.parent=e;this.extensionRecommendationsService=t;this.disposables=this._register(new P);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=R(this.parent,_("div.extension-bookmark"));let t=R(this.element,_(".recommendation"));R(t,_("span"+q.asCSSSelector(Slo)))}}};SPe=I([m(1,nD)],SPe);var xHt=class extends gI{constructor(e){super();this.parent=e;this.disposables=this._register(new P);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=R(this.parent,_("div.extension-bookmark"));let e=R(this.element,_(".pre-release"));R(e,_("span"+q.asCSSSelector(Myi)))}}},Vee=class extends gI{constructor(e,t,o,n){super();this.tooltip=t;this.extensionManagementServerService=o;this.instantiationService=n;this.remoteBadge=this._register(new me);this.element=R(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(9976,null,this.extensionManagementServerService.remoteExtensionManagementServer.label)),this.remoteBadge.value=this.instantiationService.createInstance(Eme,blo,e),R(this.element,this.remoteBadge.value.element)}};Vee=I([m(2,Gc),m(3,F)],Vee);var Eme=class extends C{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(Ni("mouse"),this.element,"")),this.render()}render(){R(this.element,_("span"+q.asCSSSelector(this.icon)));let e=()=>{if(!this.element)return;let t=this.themeService.getColorTheme().getColor(m7i),o=this.themeService.getColorTheme().getColor(h7i);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()}}};Eme=I([m(2,tt),m(3,ot),m(4,De)],Eme);var kHt=class extends gI{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=R(this.parent,_(".extension-badge.extension-pack-badge")),this.countBadge=new fv(this.element,{},BS),this.countBadge.setCount(this.extension.extensionPack.length))}},Bee=class extends gI{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 P);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=R(this.container,_(".extension-kind-indicator")),(!this.small||this.extensionGalleryManifest?.capabilities.extensions?.includePublicExtensions&&this.extensionGalleryManifest?.capabilities.extensions?.includePrivateExtensions)&&R(this.element,_("span"+q.asCSSSelector(Ryi))),this.small||R(this.element,_("span.private-extension-label",void 0,d(9971,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=R(this.container,_(".extension-kind-indicator"));let t=this.contextService.getWorkspaceFolder(e);t&&this.extension.isWorkspaceScoped?(this.element.textContent=d(9987,null),this.element.classList.add("clickable"),this.element.setAttribute("role","button"),this.disposables.add(this.hoverService.setupManagedHover(Ni("mouse"),this.element,this.uriIdentityService.extUri.relativePath(t.uri,e))),this.disposables.add(o0(this.element,()=>{this.viewsService.openView(Cb,!0).then(()=>this.explorerService.select(e,!0))}))):(this.disposables.add(this.hoverService.setupManagedHover(Ni("mouse"),this.element,e.path)),this.element.textContent=d(9968,null))}};Bee=I([m(2,tt),m(3,Pe),m(4,dt),m(5,za),m(6,Ft),m(7,vv)],Bee);var IPe=class extends gI{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 P);this._register(H.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=R(this.container,_("span.extension-sync-ignored"+q.asCSSSelector(GJe)));this.disposables.add(this.hoverService.setupManagedHover(Ni("mouse"),e,d(9981,null))),e.classList.add(...q.asClassNameArray(GJe))}}};IPe=I([m(1,B),m(2,zi),m(3,tt),m(4,_l)],IPe);var yPe=class extends gI{constructor(e,t){super();this.container=e;this.hoverService=t;this.disposables=this._register(new P)}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=R(this.container,_("span.extension-restart-required"+q.asCSSSelector(wlo)));R(this.container,_("span.extension-restart-required-label",void 0,d(9977,null))),this.disposables.add(this.hoverService.setupManagedHover(Ni("mouse"),o,t))}}};yPe=I([m(1,tt)],yPe);var wPe=class extends gI{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=>Ot({id:l.value},this.extension.identifier))&&this.update()})),this._register(n.onDidChangeAccessData(s=>{this.extension&&Ei.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 Ei(this.extension.identifier.id)).get(this.extensionViewState.filters.featureId),o=oe.as(Ds.ExtensionFeaturesRegistry).getExtensionFeature(this.extensionViewState.filters.featureId);if(o?.icon&&t){let n=R(this.container,_("span.activationTime"));n.textContent=d(9964,null,t.accessTimes.length);let r=R(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;R(this.container,_("span"+q.asCSSSelector(ylo)));let o=R(this.container,_("span.activationTime"));o.textContent=`${t}ms`}}};wPe=I([m(2,lt),m(3,YI),m(4,zi)],wPe);var Hee=class extends gI{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 xe("",{isTrusted:!0,supportThemeIcons:!0});e.appendMarkdown(`**${this.extension.displayName}**`),vke(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(`$(${Ryi.id}) ${d(9971,null)}`),t=!0),this.extension.state===1){let p=MB.getInstallLabel(this.extension,!0);if(p&&(t&&e.appendText("  |  "),e.appendMarkdown(`$(${Lyi.id}) ${p}`),t=!0),this.extension.rating){t&&e.appendText("  |  ");let h=Math.round(this.extension.rating*2)/2;e.appendMarkdown(`$(${qJe.id}) [${h}](${this.extension.url}&ssr=false#review-details)`),t=!0}this.extension.publisherSponsorLink&&(t&&e.appendText("  |  "),e.appendMarkdown(`$(${$Je.id}) [${d(9979,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(9987,null)):e.appendMarkdown(d(9968,null)),e.appendText(`
`)),this.extension.description&&(e.appendMarkdown(`${this.extension.description}`),e.appendText(`
`)),this.extension.publisherDomain?.verified){let p=this.themeService.getColorTheme().getColor(ket),h=d(9973,null,`[${A.parse(this.extension.publisherDomain.link).authority}](${this.extension.publisherDomain.link})`);e.appendMarkdown(`<span style="color:${p?Oe.Format.CSS.formatHex(p):"#ffffff"};">$(${XF.id})</span>&nbsp;${h}`),e.appendText(`
`)}this.extension.outdated&&(e.appendMarkdown(d(9985,null)),e.appendMarkdown(`&nbsp;<span style="background-color:#8080802B;">**&nbsp;_v${this.extension.latestVersion}_**&nbsp;</span>`),e.appendText(`
`));let n=Hee.getPreReleaseMessage(this.extension),r=this.extensionsWorkbenchService.getExtensionRuntimeStatus(this.extension),s=this.extensionFeaturesManagementService.getAllAccessDataForExtension(new Ei(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(9959,null)}${r.activationTimes.activationReason.startup?` (${d(9980,null)})`:""}: \`${p}ms\``),e.appendText(`
`)}if(r.runtimeErrors.length||r.messages.length){let p=r.runtimeErrors.length||r.messages.some(v=>v.type===gt.Error),h=r.messages.some(v=>v.type===gt.Warning),g=r.runtimeErrors.length?`[${r.runtimeErrors.length===1?d(9983,null):d(9984,null,r.runtimeErrors.length)}](${ic("extension.open",this.extension.identifier.id,"features")})`:void 0,f=r.messages.length?`[${r.messages.length===1?d(9969,null):d(9970,null,r.messages.length)}](${ic("extension.open",this.extension.identifier.id,"features")})`:void 0;e.appendMarkdown(`$(${p?gS.id:h?_u.id:kg.id}) This extension has reported `),g&&f?e.appendMarkdown(`${g} and ${f}`):e.appendMarkdown(`${g||f}`),e.appendText(`
`)}}if(s.size){let p=oe.as(Ds.ExtensionFeaturesRegistry);for(let[h,g]of s)if(g?.accessTimes.length){let f=p.getExtensionFeature(h);f&&(e.appendMarkdown(d(9965,null,f.label)),e.appendMarkdown(`: [${d(9982,null,g.accessTimes.length,f.accessDataLabel??f.label)}](${ic("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(`$(${kg.id})&nbsp;`),e.appendMarkdown(`${c.reason}`),e.appendText(`
`)),n){let p=this.themeService.getColorTheme().getColor(X6o);e.appendMarkdown(`<span style="color:${p?Oe.Format.CSS.formatHex(p):"#ffffff"};">$(${Myi.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(xlo);return`<span style="color:${o?Oe.Format.CSS.formatHex(o):"#ffffff"};">$(${PWt.id})</span>&nbsp;${t.reasonText}`}static getPreReleaseMessage(e){if(!e.hasPreReleaseVersion||e.isBuiltin||e.isPreReleaseVersion||e.preRelease)return;let t=`[${d(9978,null)}](${ic("workbench.extensions.action.showPreReleaseVersion",e.identifier.id)})`;return d(9966,null,t)}};Hee=I([m(2,zi),m(3,YI),m(4,tt),m(5,B),m(6,nD),m(7,De),m(8,Pe)],Hee);var CPe=class extends gI{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(){Fi(this.container),this.renderDisposables.value=void 0;let e=new P;this.renderDisposables.value=e;let t=this.extensionStatusAction.status;if(t.length){let o=new xe("",{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));R(this.container,n.element)}this._onDidRender.fire()}};CPe=I([m(2,Qn)],CPe);var xPe=class extends gI{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(){Fi(this.container);let e=this.getRecommendationStatus();e&&(e.icon&&R(this.container,_(`div${q.asCSSSelector(e.icon)}`)),R(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:PWt,message:t}}else if(this.extensionIgnoredRecommendationsService.globalIgnoredRecommendations.indexOf(this.extension.identifier.id.toLowerCase())!==-1)return{icon:void 0,message:d(9975,null)}}};xPe=I([m(1,nD),m(2,uk)],xPe);var Y6o=J("extensionIcon.starForeground",{light:"#DF6100",dark:"#FF8E00",hcDark:"#FF8E00",hcLight:WI},d(9962,null),!1),X6o=J("extensionIcon.preReleaseForeground",{dark:"#1d9271",light:"#1d9271",hcDark:"#1d9271",hcLight:WI},d(9963,null),!1),Uqu=J("extensionIcon.sponsorForeground",{light:"#B51E78",dark:"#D758B3",hcDark:null,hcLight:"#B51E78"},d(9961,null),!1),J6o=J("extensionIcon.privateForeground",{dark:"#ffffff60",light:"#00000060",hcDark:"#ffffff60",hcLight:"#00000060"},d(9960,null));is((a,i)=>{let e=a.getColor(Y6o);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(qJe)} { color: ${e}; }`));let t=a.getColor(ket);t&&i.addRule(`${q.asCSSSelector(XF)} { color: ${t}; }`),i.addRule(`.monaco-hover.extension-hover .markdown-hover .hover-contents ${q.asCSSSelector($Je)} { color: var(--vscode-extensionIcon-sponsorForeground); }`),i.addRule(`.extension-editor > .header > .details > .subtitle .sponsor ${q.asCSSSelector($Je)} { color: var(--vscode-extensionIcon-sponsorForeground); }`);let o=a.getColor(J6o);o&&i.addRule(`.extension-private-badge { color: ${o}; }`)});var Z6o=72,kPe=class{getHeight(){return Z6o}getTemplateId(){return"extension"}},Tme=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(SPe,R(i,_(".extension-bookmark-container"))),t=this.instantiationService.createInstance(xHt,R(i,_(".extension-bookmark-container"))),o=R(i,_(".extension-list-item")),n=R(o,_(".icon-container")),r=this.instantiationService.createInstance(c2,n),s=this.instantiationService.createInstance(Vee,n,!1),l=this.instantiationService.createInstance(kHt,n),c=R(o,_(".details")),u=R(c,_(".header-container")),p=R(u,_(".header")),h=R(p,_("span.name")),g=R(p,_("span.restart-required")),f=R(p,_("span.install-count")),v=R(p,_("span.ratings")),b=R(p,_("span.sync-ignored")),S=R(p,_("span")),y=R(p,_("span.activation-status")),w=R(c,_(".description.ellipsis")),k=R(c,_(".footer")),T=this.instantiationService.createInstance(Wee,R(k,_(".publisher-container")),!0),N=new ji(k,{actionViewItemProvider:(de,se)=>{if(de instanceof qK)return new dRe(de,{...se,icon:!0,label:!0,menuActionsOrProvider:{getActions:()=>de.menuActions},menuActionClassNames:de.menuActionClassNames},this.contextMenuService);if(de instanceof fB)return de.createActionViewItem(se)},focusOnlyEnabledItems:!0});N.setFocusable(!1);let O=N.onDidRun(({error:de})=>de&&this.notificationService.error(de)),V=this.instantiationService.createInstance(cD),U=[this.instantiationService.createInstance(UF),this.instantiationService.createInstance(HF,!0),this.instantiationService.createInstance(nA,!1),this.instantiationService.createInstance(TZ),this.instantiationService.createInstance(uRe),this.instantiationService.createInstance(FR),this.instantiationService.createInstance(KC),this.instantiationService.createInstance(T4,!1),this.instantiationService.createInstance(_Z),this.instantiationService.createInstance(DZ),V,this.instantiationService.createInstance(rA)],G=this.instantiationService.createInstance(Hee,{target:i,position:this.options.hoverOptions.position},V),$=[r,e,t,s,l,T,G,this.instantiationService.createInstance(IPe,b),this.instantiationService.createInstance(yPe,g),this.instantiationService.createInstance(wPe,this.extensionViewState,y),this.instantiationService.createInstance(MB,f,!0),this.instantiationService.createInstance(Fee,v,!0),this.instantiationService.createInstance(Bee,S,!0)],te=this.instantiationService.createInstance(dX,[...U,...$]);N.push(U,{icon:!0,label:!0});let pe=hn(...U,...$,N,O,te);return{root:i,element:o,name:h,installCount:f,ratings:v,description:w,disposables:[pe],actionbar:N,extensionDisposables:[],set extension(de){te.extension=de}}}renderPlaceholder(i,e){e.element.classList.add("loading"),e.root.removeAttribute("aria-label"),e.root.removeAttribute("data-extension-id"),e.extensionDisposables=Ue(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&&Ot(n.identifier,i.identifier))[0]||i),t.extensionDisposables=Ue(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=>{Ot(i.identifier,n.identifier)&&t.actionbar.setFocusable(!0)},this,t.extensionDisposables),this.extensionViewState.onBlur(n=>{Ot(i.identifier,n.identifier)&&t.actionbar.setFocusable(!1)},this,t.extensionDisposables)}disposeElement(i,e,t){t.extensionDisposables=Ue(t.extensionDisposables)}disposeTemplate(i){i.extensionDisposables=Ue(i.extensionDisposables),i.disposables=Ue(i.disposables)}};Tme=I([m(2,F),m(3,Ne),m(4,lt),m(5,zi),m(6,Os),m(7,ze)],Tme);is((a,i)=>{let e=a.getColor(ket);if(e){let t=e.transparent(.5).makeOpaque(DO(a));i.addRule(`.extensions-list .monaco-list .monaco-list-row.disabled:not(.selected) .author .verified-publisher ${q.asCSSSelector(XF)} { color: ${t}; }`)}});function tpo(a){return{isResolved:!!a,promise:null,cts:null,promiseIndexes:new Set,elements:a||[]}}function Rxi(a){return{firstPage:a,total:a.length,pageSize:a.length,getPage:(i,e)=>Promise.resolve(a)}}var Tm=class{constructor(i){this.pages=[];this.onDidIncrementLength=H.None;this.pager=Array.isArray(i)?Rxi(i):i;let e=Math.ceil(this.pager.total/this.pager.pageSize);this.pages=[tpo(this.pager.firstPage.slice()),...ig(e-1).map(()=>tpo())]}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 ho);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 $e,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())}},C3=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 ho);let n=setTimeout(()=>{if(e.isCancellationRequested)return o(new ho);r.dispose(),this.model.resolve(i,e).then(t,o)},this.timeout),r=e.onCancellationRequested(()=>{clearTimeout(n),r.dispose(),o(new ho)})})}};var EHt=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 ho);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 ipo(a){if(!a)return"";let i=a.publisherDomain?.verified?d(9902,null,a.publisherDisplayName):d(9900,null,a.publisherDisplayName),e=a?.deprecationInfo?d(9899,null):"",t=a?.rating?d(9901,null,a.rating.toFixed(2),a.ratingCount):"";return`${a.displayName}, ${e?`${e}, `:""}${a.version}, ${i}, ${a.description} ${t?`, ${t}`:""}`}var Uee=class extends C{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 as);this.modalNavigationDisposable=this._register(new me);this._register(this.contextMenuActionRunner.onDidRun(({error:b})=>b&&c.error(b)));let f=new kPe,v=h.createInstance(Tme,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(F1,`${t}-Extensions`,e,f,[v],{multipleSelectionSupport:!1,setRowLineHeight:!1,horizontalScrolling:!1,accessibilityProvider:{getAriaLabel(b){return ipo(b)},getWidgetAriaLabel(){return d(9903,null)}},overrideStyles:qz(s.getViewLocationById(t)).listOverrideStyles,openOnSingleClick:!0,...o}),this._register(this.list.onContextMenu(b=>this.onContextMenu(b),this)),this._register(this.list),this._register(H.debounce(H.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 C3(e)}layout(e,t){this.list.layout(e,t)}openExtension(e,t){e=this.extensionsWorkbenchService.local.filter(o=>Ot(o.identifier,e.identifier))[0]||e,this.extensionsWorkbenchService.open(e,{...t,modal:t.sideByside?void 0:Axi(e,()=>this.list.model,(o,n)=>Ot(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 P,o=t.add(this.instantiationService.createInstance(rA)),n=e.element&&this.extensionsWorkbenchService.local.find(l=>Ot(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 Nyi(n,this.contextKeyService,this.instantiationService),r.forEach(l=>l.forEach(c=>{c instanceof oa&&(c.extension=n)})));let s=[];for(let l of r){for(let c of l)s.push(c),Ac(c)&&t.add(c);s.push(new li)}s.pop(),this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>s,actionRunner:this.contextMenuActionRunner,onHide:()=>t.dispose()})}}};Uee=I([m(4,zi),m(5,Ri),m(6,fi),m(7,Ne),m(8,ze),m(9,X),m(10,F),m(11,ne)],Uee);var EPe=class extends C{constructor(e,t,o){super();this.instantiationService=o;this.element=R(e,_(".extensions-grid-view")),this.renderer=this.instantiationService.createInstance(Tme,{onFocus:H.None,onBlur:H.None,filters:{}},{hoverOptions:{position(){return 2}}}),this.delegate=t,this.disposableStore=this._register(new P)}setExtensions(e){this.disposableStore.clear(),e.forEach((t,o)=>this.renderExtension(t,o))}renderExtension(e,t){let o=R(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(TPe);r.extension=e,n.name.setAttribute("tabindex","0");let s=l=>{l instanceof Ii&&l.keyCode!==3||(r.run(l.ctrlKey||l.metaKey),l.stopPropagation(),l.preventDefault())};this.disposableStore.add(j(n.name,re.CLICK,l=>s(new yn(Me(n.name),l)))),this.disposableStore.add(j(n.name,re.KEY_DOWN,l=>s(new Ii(l)))),this.disposableStore.add(j(o,re.KEY_DOWN,l=>s(new Ii(l)))),this.renderer.renderElement(e,t,n)}};EPe=I([m(2,F)],EPe);var Mxi=class{hasChildren({hasChildren:i}){return i}getChildren(i){return i.getChildren()}},Pxi=class{getHeight(i){return 62}getTemplateId({extension:i}){return i?zee.TEMPLATE_ID:THt.TEMPLATE_ID}},zee=class{constructor(i){this.instantiationService=i}static{this.TEMPLATE_ID="extension-template"}get templateId(){return zee.TEMPLATE_ID}renderTemplate(i){i.classList.add("extension");let e=this.instantiationService.createInstance(c2,i),t=R(i,_(".details")),o=R(t,_(".header")),n=R(o,_("span.name")),r=this.instantiationService.createInstance(TPe),s=[j(n,"click",p=>{r.run(p.ctrlKey||p.metaKey),p.stopPropagation(),p.preventDefault()}),e,r],l=R(o,_("span.identifier")),c=R(t,_(".footer")),u=R(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=Ue(i.extensionDisposables)}};zee=I([m(0,F)],zee);var THt=class a{static{this.TEMPLATE_ID="unknown-extension-template"}get templateId(){return a.TEMPLATE_ID}renderTemplate(i){let e=R(i,_("div.unknown-extension"));return R(e,_("span.error-marker")).textContent=d(9898,null),R(e,_("span.message")).textContent=d(9904,null),{identifier:R(e,_("span.message"))}}renderElement(i,e,t){t.identifier.textContent=i.element.extension.identifier.id}disposeTemplate(i){}},TPe=class extends st{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()}};TPe=I([m(0,zi)],TPe);var _Pe=class extends nu{constructor(i,e,t,o,n,r,s,l){let c=new Pxi,u=new Mxi,p=[r.createInstance(zee),r.createInstance(THt)],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 ipo(g.extension)},getWidgetAriaLabel(){return d(9903,null)}}},r,o,n,s),this.setInput(i),this.disposables.add(this.onDidChangeSelection(g=>{ag(g.browserEvent)&&l.open(g.elements[0].extension,{sideByside:!1})}))}};_Pe=I([m(3,X),m(4,fo),m(5,F),m(6,B),m(7,zi)],_Pe);var _Ht=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 dr(this.childrenExtensionIds)}async getChildren(){return this.hasChildren?(await jet(this.childrenExtensionIds,this.extensionsWorkbenchService)).map(e=>new a(e,this,this.getChildrenExtensionIds,this.extensionsWorkbenchService)):null}};async function jet(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})),ve.None);t.push(...n)}return t}function Axi(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 $e;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=>{so(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(c9);e&&i.addRule(`.extensions-grid-view .extension-container:focus { background-color: ${e}; outline: none; }`);let t=a.getColor(ZSe);t&&i.addRule(`.extensions-grid-view .extension-container:focus { color: ${t}; }`);let o=a.getColor(ko),n=a.getColor(qo);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 d2=class extends C{constructor(e,t,o){super();this.extensionsContent=e;this.domNode=_(".chat-extensions-content-part");let n=R(this.domNode,_(".loading-extensions-element"));R(n,_(q.asCSSSelector(q.modify(M.loading,"spin"))),_("span.loading-message",void 0,d(7110,null)));let r=R(this.domNode,_(".extensions-list")),s=this._register(o.createInstance(Uee,r,Vr,{alwaysConsumeMouseWheel:!1},{onFocus:H.None,onBlur:H.None,filters:{}}));jet(e.extensions,t).then(l=>{n.remove(),!this._store.isDisposed&&(s.setModel(new Tm(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)}};d2=I([m(1,zi),m(2,F)],d2);var LPe=_,lT=class extends C{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(++lT.ID_POOL);this._onDidChangeHeight=this._register(new E);this.onDidChangeHeight=this._onDidChangeHeight.event;this.allRefs=[];this._codeblocks=[];this.mathLayoutParticipants=new Set;let S=t.element,y=ju(t.content,V=>V.kind==="undoStop",t.contentIndex)?.id,w=r,k=0;this.domNode=LPe("div.chat-markdown-part"),this.rendererOptions.accessibilityOptions?.statusMessage&&(this.domNode.ariaLabel=this.rendererOptions.accessibilityOptions.statusMessage,g.getValue("accessibility.verboseChatProgressUpdates")&&Or(this.rendererOptions.accessibilityOptions.statusMessage));let T=g.getValue("chat.math.enabled"),N=this._register(new me),O=()=>{if(this._store.isDisposed)return;let V=new P;N.value=V,Rt(this.domNode),this.allRefs.length=0,this._codeblocks.length=0,this.mathLayoutParticipants.clear(),w=r,k=0;let U=[],G=T?si([xme.getExtension(Me(t.container),{throwOnError:!1})]):[],$={gfm:!0,breaks:!0},te=V.add(s.render(e.content,{sanitizerConfig:xme.getSanitizerOptions({allowedTags:Eet,allowedAttributes:Sje}),fillInIncompleteTokens:n,codeBlockRendererSync:(se,Se,ke)=>{let Ee=!Vi(t.element)||t.element.isComplete||!ke||Nxi(ke);if((!Se||Se.startsWith("<vscode_codeblock_uri")&&!Se.includes(`
`))&&!Ee){let _o=LPe("div");return _o.style.display="none",_o}if(se==="diff"&&ke&&this.rendererOptions.allowInlineDiffs){let _o=ke.match(/^```diff:(\w+)/);if(_o&&Vi(t.element)){let sr=_o[1],ln=zMe(Se),{before:en,after:Ws}=juo(ln?.textWithoutResult??Se),ba={element:t.element,codeBlockIndex:w++,languageId:sr,beforeContent:en,afterContent:Ws,codeBlockResource:ln?.uri,isReadOnly:!0,horizontalPadding:this.rendererOptions.horizontalPadding},Id=this.instantiationService.createInstance(kme,ba,t.diffEditorPool,t.currentWidth.get()),Dg={object:Id,isStale:()=>!1,dispose:()=>Id.dispose()};return this.allRefs.push(Dg),U.push(Dg),Id.element}}if(se==="vscode-extensions")return V.add(v.createInstance(d2,{kind:"extensions",extensions:Se.split(",")})).domNode;let He=w++,Ve=k++,Fe,Qt,Ze,Ti;if(mr(se,Zuo))try{let _o=epo(Se);Qt=_o.range&&z.lift(_o.range),Fe=this.textModelService.createModelReference(_o.uri).then(ln=>(V.isDisposed||V.add(ln),ln.object.textEditorModel))}catch{return LPe("div")}else if(Vi(S)||Rr(S)){let _o=this.codeBlockModelCollection.getOrCreate(S.sessionResource,S,He),sr=this.codeBlockModelCollection.updateSync(S.sessionResource,S,He,{text:Se,languageId:se,isComplete:Ee});Ze=_o.vulns,Ti=sr,Fe=_o.model}else Fe=void 0;let ti=Vi(S)&&S.errorDetails?.responseIsFiltered,bo={...this.rendererOptions.codeBlockRenderOptions};ti!==void 0&&(bo.hideToolbar=ti);let Ro={languageId:se,textModel:Fe,codeBlockIndex:He,codeBlockPartIndex:Ve,element:S,range:Qt,parentContextKeyService:h,vulns:Ze,codemapperUri:Ti?.codemapperUri,renderOptions:bo,chatSessionResource:S.sessionResource};if(S.isCompleteAddedRequest||!Ti?.codemapperUri||!Ti.isEdit){let _o=this.renderCodeBlock(Ro,Se,Ee,c);this.allRefs.push(_o);let sr=this.codeblocksPartId,ln=new class{constructor(){this.ownerMarkdownPartId=sr;this.codeBlockIndex=He;this.elementId=S.id;this.chatSessionResource=S.sessionResource;this.languageId=se;this.isStreamingEdit=!1;this.editDeltaInfo=zy.fromText(Se);this.codemapperUri=void 0;this.uriPromise=Fe?.then(en=>en.uri)??Promise.resolve(void 0)}get uri(){return _o.object.uri}focus(){_o.object.focus()}};return this._codeblocks.push(ln),U.push(_o),_o.object.element}else{let _o=Rr(S)?S.id:S.requestId,sr=this.renderCodeBlockPill(S.sessionResource,_o,y,Ro.codemapperUri);Vi(Ro.element)&&this.codeBlockModelCollection.update(Ro.element.sessionResource,Ro.element,Ro.codeBlockIndex,{text:Se,languageId:Ro.languageId,isComplete:Ee}).then(Ws=>{this._codeblocks[Ro.codeBlockPartIndex].codemapperUri=Ws.codemapperUri}),this.allRefs.push(sr);let ln=this.codeblocksPartId,en=new class{constructor(){this.ownerMarkdownPartId=ln;this.codeBlockIndex=He;this.elementId=S.id;this.codemapperUri=Ti?.codemapperUri;this.chatSessionResource=S.sessionResource;this.isStreamingEdit=!Ee;this.uriPromise=Promise.resolve(void 0);this.languageId=se;this.editDeltaInfo=zy.fromText(Se)}get uri(){}focus(){return sr.object.element.focus()}};return this._codeblocks.push(en),U.push(sr),sr.object.element}},markedOptions:$,markedExtensions:G,...l},this.domNode));Vi(S)&&!S.model.codeBlockInfos&&S.model.isComplete&&S.model.initializeCodeBlockInfos(this._codeblocks.map(se=>({suggestionId:this.aiEditTelemetryService.createSuggestionId({presentation:"codeBlock",feature:"sideBarChat",editDeltaInfo:se.editDeltaInfo,languageId:se.languageId,modeId:S.model.request?.modeInfo?.modeId,modelId:S.model.request?.modelId,applyCodeBlockSuggestionId:void 0,source:void 0})})));let pe=v.createInstance(Oee);V.add(pe.walkTreeAndAnnotateReferenceLinks(e,te.element));let de=new co(()=>{let se=new ResizeObserver(()=>this.mathLayoutParticipants.forEach(Se=>Se()));return se.observe(this.domNode),V.add(Z(()=>se.disconnect())),this.mathLayoutParticipants});for(let se of this.domNode.querySelectorAll(".katex-display")){if(!Ao(se))continue;let Se=new Pa(se.cloneNode(!0),{vertical:2,horizontal:1});U.push(Se),se.replaceWith(Se.getDomNode()),de.value.add(()=>{Se.scanDomNode()}),Se.scanDomNode()}U.push(quo(this.domNode,de)),U.reverse().forEach(se=>V.add(se))};O(),T&&!xme.getExtension(Me(t.container))&&xme.loadExtension(Me(t.container)).then(()=>{O()}).catch(V=>{console.error("Failed to load MarkedKatexSupport extension:",V)})}static{this.ID_POOL=0}get codeblocks(){return this._codeblocks}renderCodeBlockPill(e,t,o,n){let r=this.instantiationService.createInstance(DPe,e,t,o);return n&&r.render(n),{object:r,isStale:()=>!1,dispose:()=>r.dispose()}}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&&Rr(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 w3)t.object.layout(e);else if(t.object instanceof kme)t.object.layout(e);else if(t.object instanceof DPe){let n=this._codeblocks[o];n.codemapperUri&&t.object.uri?.toString()!==n.codemapperUri.toString()&&t.object.render(n.codemapperUri)}}),this.mathLayoutParticipants.forEach(t=>t())}onDidRemount(){for(let e of this.allRefs)e.object instanceof w3&&e.object.onDidRemount()}addDisposable(e){this._register(e)}};lT=I([m(10,X),m(11,B),m(12,Nt),m(13,F),m(14,rS)],lT);function Nxi(a){return a=a.trim(),!!a.match(/\n```+$/)}var DPe=class extends C{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.progressStore=this._store.add(new P);this.element=LPe("div.chat-codeblock-pill-container"),this.statusIndicatorContainer=LPe("div.status-indicator-container"),this.pillElement=LPe(".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);let v=()=>this.element.classList.toggle("show-checkmarks",!!this.configurationService.getValue("accessibility.chat.showCheckmarks"));v(),this._register(this.configurationService.onDidChangeConfiguration(b=>{b.affectsConfiguration("accessibility.chat.showCheckmarks")&&v()})),this.registerListeners()}get uri(){return this._uri}registerListeners(){this._register(qMe(this.pillElement,e=>this.showDiff(e))),this._register(j(this.pillElement,re.CONTEXT_MENU,e=>{let t=new yn(Me(e),e);$t.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 Uc(o)}})}))}showDiff({editorOptions:e,openToSide:t}){this.currentDiff?this.editorService.openEditor({original:{resource:this.currentDiff.originalURI},modified:{resource:this.currentDiff.modifiedURI},options:e},t?vn:void 0):this.uri&&this.editorService.openEditor({resource:this.uri,options:e},t?vn: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=Ce(S=>{let y=h.readEntry(e,S);return y&&h.getEntryDiffBetweenStops(y.modifiedURI,this.requestId,this.inUndoStop)}).map((S,y)=>S?.read(y)),f=Ce(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(he(S=>{if(n.classList.remove(...v),s.classList.remove(...b),f.read(S)){let y=q.modify(M.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(7128,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(7133,null):d(7129,null,k))}else{let y=M.check;v=q.asClassNameArray(y),n.classList.add(...v),r.textContent=d(7132,null);let w=e.path.endsWith("/")?1:0;b=js(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(ux(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,w.textContent=`+${y.added}`,k.textContent=`-${y.removed}`;let T=y.added===1?d(7135,null):d(7134,null,y.added),N=y.removed===1?d(7131,null):d(7130,null,y.removed),O=d(7136,null,o,T,N);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}})))}};DPe=I([m(3,ot),m(4,ee),m(5,Ct),m(6,kt),m(7,ze),m(8,X),m(9,qt),m(10,tt),m(11,Si),m(12,B)],DPe);var u2=class extends C{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 xe("",{supportThemeIcons:!0}).appendText(e):new xe(e.value,{supportThemeIcons:!0,isTrusted:e.isTrusted})}};u2=I([m(3,Qn)],u2);var Qet=class extends C{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=bt(".chat-confirmation-widget-container@container",[bt(".chat-confirmation-widget@root",[bt(".chat-confirmation-widget-title@title"),bt(".chat-confirmation-widget-message-container",[bt(".chat-confirmation-widget-message@message"),bt(".chat-buttons-container@buttonsContainer",[bt(".chat-buttons@buttons"),bt(".chat-toolbar@toolbar")])])])]);if(opo(h.container,l,u),this._domNode=h.root,this._register(o.createInstance(u2,h.title,l,c)),this.messageElement=h.message,p.forEach(g=>{let f={...Ko,small:!0,secondary:g.isSecondary,title:g.tooltip,disabled:g.disabled},v;g.moreActions?v=new $I(h.buttons,{...f,contextMenuProvider:r,addPrimaryActionToDropdown:!1,actions:g.moreActions.map(b=>b instanceof li?b:this._register(new st(b.label,b.label,void 0,!b.disabled,()=>(this._onDidClick.fire(b),Promise.resolve()))))}):v=new Mi(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 Io([X,g])));this._register(f.createInstance(Ln,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)}};Qet=I([m(2,F),m(3,Qn),m(4,ze),m(5,X)],Qet);var RPe=class extends Qet{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 xe(i):i));this.renderMessage(e.element),this._renderedMessage=e.element}};RPe=I([m(2,F),m(3,Qn),m(4,ze),m(5,X)],RPe);var MPe=class extends C{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=bt(".chat-confirmation-widget-container@container",[bt(".chat-confirmation-widget2@root",[bt(".chat-confirmation-widget-title",[bt(".chat-title@title"),bt(".chat-toolbar-container@buttonsContainer",[bt(".chat-toolbar@toolbar")])]),bt(".chat-confirmation-widget-message@message"),bt(".chat-confirmation-widget-buttons",[bt(".chat-buttons@buttons")])])]);if(opo(f.container,c,p),this._domNode=f.root,this._buttonsDomNode=f.buttons,this._register(o.createInstance(u2,f.title,new xe(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 Io([X,v])));this._register(b.createInstance(Ln,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={...Ko,small:!0,secondary:t.isSecondary,title:t.tooltip,disabled:t.disabled},n;t.moreActions?n=new $I(this._buttonsDomNode,{...o,contextMenuProvider:this.contextMenuService,addPrimaryActionToDropdown:!1,actions:t.moreActions.map(r=>r instanceof li?r:this._register(new st(r.label,r.label,void 0,!r.disabled,()=>(this._onDidClick.fire(r),Promise.resolve()))))}):n=new Mi(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(),!Ao(e)){let t=this._register(this.instantiationService.createInstance(lT,{kind:"markdownContent",content:typeof e=="string"?new xe().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}));Ck(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)}};MPe=I([m(2,F),m(3,Qn),m(4,ze),m(5,X),m(6,Av)],MPe);var Kee=class extends MPe{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 xe(i):i));this.renderMessage(e.element),this._renderedMessage=e.element}};Kee=I([m(2,F),m(3,Qn),m(4,ze),m(5,X),m(6,Av)],Kee);var Gee=class extends MPe{constructor(i,e,t,o,n,r,s){super(i,e,t,o,n,r,s),this.renderMessage(e.message)}};Gee=I([m(2,F),m(3,Qn),m(4,ze),m(5,X),m(6,Av)],Gee);function opo(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(7107,null,t,o)),a.classList.add("chat-confirmation-widget-container")}var PPe=class extends C{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(7105,null),data:e.data},{label:d(7106,null),data:e.data,isSecondary:!0}],c=this._register(this.instantiationService.createInstance(RPe,t,{title:e.title,buttons:l,message:e.message}));c.setShowButtons(!e.isUsed),this._register(c.onDidClick(async u=>{if(Vi(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);Gj.isSent(f)&&(e.isUsed=!0,c.setShowButtons(!1))}})),this.domNode=c.domNode}hasSameContent(e){return e.kind==="confirmation"}addDisposable(e){this._register(e)}};PPe=I([m(2,F),m(3,Si),m(4,At)],PPe);var _me=class extends C{constructor(e,t,o,n=!1,r){super();this.isSimpleWidget=n;this._pool=this._register(new LB(()=>r.createInstance(w3,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:()=>{e.reset(),t=!0,this._pool.release(e)}}}clear(){this._pool.clear()}};_me=I([m(4,F)],_me);var APe=class extends C{constructor(e,t,o,n=!1,r){super();this.isSimpleWidget=n;this._pool=this._register(new LB(()=>r.createInstance(fPe,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:()=>{e.reset(),t=!0,this._pool.release(e)}}}clear(){this._pool.clear()}};APe=I([m(4,F)],APe);var NPe=class extends C{constructor(i){super(),this._collection=new Oxi(i)}acquire(i,e,t,o){return this._collection.acquire(i.toString(),i,e,t,o)}};NPe=I([m(0,Ct)],NPe);var Oxi=class extends Ww{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 Wxi="workbench.action.chat.acceptElicitation",Fxi=class extends K{constructor(){super({id:Wxi,title:L(5471,"Accept Request"),f1:!1,category:vi,keybinding:{when:x.and(ie.inChatSession,ie.Editing.hasElicitationRequest),primary:2051,weight:201}})}async run(i){let t=i.get(At).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(Vi(r)){for(let s of r.response.value)if(s.kind==="elicitation2"&&s.state.get()==="pending"){await s.accept(!0),t.focusInput();return}}}}};function npo(){W(Fxi)}var OPe=class extends C{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,Wxi);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(he(g=>{e.isHidden?.read(g)&&this.domNode.remove()}));let h=ie.Editing.hasElicitationRequest.bindTo(this.contextKeyService);this._register(he(g=>{h.set(e.state.read(g)==="pending")})),this._register(Z(()=>h.reset())),this.chatAccessibilityService.acceptElicitation(e)}let c=this._register(this.instantiationService.createInstance(Kee,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=Mr(e.message)?xe.lift(e.message):new xe(e.message);return t.appendCodeblock("json",JSON.stringify(e.acceptedResult,null,2)),t}hasSameContent(e){return e===this.elicitation}addDisposable(e){this._register(e)}};OPe=I([m(2,F),m(3,NO),m(4,X),m(5,_e)],OPe);var rpo=_,FPe=class extends C{constructor(e,t,o,n){super();this.errorDetails=o;this.domNode=this._register(new Dme(e,t,n)).domNode}hasSameContent(e){return e.kind===this.errorDetails.kind}},Dme=class extends C{constructor(i,e,t){super(),this.domNode=rpo(".chat-notification-widget"),this.domNode.tabIndex=0;let o,n;switch(i){case 1:o=M.warning,n=".chat-warning-codicon";break;case 2:o=M.error,n=".chat-error-codicon";break;case 0:o=M.info,n=".chat-info-codicon";break}this.domNode.appendChild(rpo(n,void 0,Qo(o)));let r=this._register(t.render(e));this.domNode.appendChild(r.element)}};var apo=_,WPe=class extends C{constructor(e,t,o,n,r,s,l,c,u,p){super();this.errorDetails=o;this.chatAccessibilityService=p;let h=s.element;ydo(h),this.domNode=apo(".chat-error-confirmation"),this.domNode.append(this._register(new Dme(e,t,r)).domNode);let g={...Ko},f=R(this.domNode,apo(".chat-buttons-container"));n.forEach(v=>{let b=this._register(new Mi(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)}};WPe=I([m(6,F),m(7,At),m(8,Si),m(9,NO)],WPe);var e9o="workbench.action.chat.previousQuestion",t9o="workbench.action.chat.nextQuestion",k3=class extends C{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._isSkipped=!1;this._textInputBoxes=new Map;this._singleSelectItems=new Map;this._multiSelectCheckboxes=new Map;this._freeformTextareas=new Map;this._inputBoxes=this._register(new P);this._questionRenderStore=this._register(new me);this._interactiveUIStore=this._register(new me);this.domNode=_(".chat-question-carousel-container"),this._inChatQuestionCarouselContextKey=ie.inChatQuestionCarousel.bindTo(this._contextKeyService);let u=this._register(Vn(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(7160,null)),this._updateAriaLabel(),e instanceof a2&&(typeof e.draftCurrentIndex=="number"&&(this._currentIndex=Math.max(0,Math.min(e.draftCurrentIndex,e.questions.length-1))),e.draftAnswers))for(let[g,f]of Object.entries(e.draftAnswers))this._answers.set(g,f);if(e.data)for(let[g,f]of Object.entries(e.data))this._answers.set(g,f);let p=Vi(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 P;if(this._interactiveUIStore.value=h,this._questionContainer=_(".chat-question-carousel-content"),this.domNode.append(this._questionContainer),e.allowSkip){this._closeButtonContainer=_(".chat-question-close-container");let g=d(7162,null),f=h.add(new Mi(this._closeButtonContainer,{...Ko,secondary:!0,supportIcons:!0}));f.label=`$(${M.close.id})`,f.element.classList.add("chat-question-close"),f.element.setAttribute("aria-label",g),h.add(this._hoverService.setupDelayedHover(f.element,{content:g})),this._skipAllButton=f}this._skipAllButton&&h.add(this._skipAllButton.onDidClick(()=>this.ignore())),h.add(j(this.domNode,re.KEY_DOWN,g=>{let f=new Ii(g);if(f.keyCode===9&&this.carousel.allowSkip)g.preventDefault(),g.stopPropagation(),this.ignore();else if(f.keyCode===3&&(f.metaKey||f.ctrlKey))g.preventDefault(),g.stopPropagation(),this.submit();else if(f.keyCode===3&&!f.shiftKey){let v=g.target,b=v.tagName==="INPUT"&&v.type==="text",S=v.tagName==="TEXTAREA"&&v.classList.contains("chat-question-freeform-textarea");(b||S)&&(g.preventDefault(),g.stopPropagation(),this.handleNextOrSubmit())}else(f.ctrlKey||f.metaKey)&&(f.keyCode===1||f.keyCode===20)&&g.stopPropagation()})),this.renderCurrentQuestion()}saveCurrentAnswer(){let e=this.carousel.questions[this._currentIndex],t=this.getCurrentAnswer();t!==void 0?this._answers.set(e.id,t):this._answers.delete(e.id),this.persistDraftState()}persistDraftState(){this.carousel.isUsed||!(this.carousel instanceof a2)||(this.carousel.draftAnswers=Object.fromEntries(this._answers.entries()),this.carousel.draftCurrentIndex=this._currentIndex)}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(){this.saveCurrentAnswer(),this._currentIndex<this.carousel.questions.length-1?(this._currentIndex++,this.persistDraftState(),this.renderCurrentQuestion(!0)):(this._options.onSubmit(this._answers),this.hideAndShowSummary())}submit(){this.saveCurrentAnswer(),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(7159,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._closeButtonContainer=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(!Ao(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=Me(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 e.defaultValue;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 e.defaultValue}}_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(7152,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(7161,null,o)):this.domNode.setAttribute("aria-label",d(7155,null,this._currentIndex+1,n,o))}focus(){this.domNode.focus()}hasFocus(){return ts(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 P;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"),s=o.message??o.title;if(s){let b=_(".chat-question-title"),S=this.getQuestionText(s);b.setAttribute("aria-label",S);let y=Mr(s)?xe.lift(s):new xe(s),w=t.add(this._markdownRendererService.render(y));b.appendChild(w.element),r.appendChild(b)}n.appendChild(r),this._closeButtonContainer&&r.appendChild(this._closeButtonContainer),this._questionContainer.appendChild(n);let l=_(".chat-question-input-container");this.renderInput(l,o);let c=t.add(new Pa(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.carousel.questions.length===1?this.renderSingleQuestionFooter():this.renderFooter();let h=!1,g=t.add(new me),f=()=>{h||(h=!0,g.value=Ah(Me(this.domNode),()=>{h=!1,this.layoutInputScrollable(c)}))},v=t.add(new eL(()=>f()));t.add(v.observe(u)),t.add(v.observe(l)),f(),t.add(Ah(Me(this.domNode),()=>{l.scrollTop=0,l.scrollLeft=0,c.setScrollPosition({scrollTop:0,scrollLeft:0}),c.scanDomNode()})),this._updateAriaLabel(),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(7156,null));let o=_(".chat-question-nav-arrows"),n=this.getLabelWithKeybinding(d(7170,null),e9o),r=e.add(new Mi(o,{...Ko,secondary:!0,supportIcons:!0}));r.element.classList.add("chat-question-nav-arrow","chat-question-nav-prev"),r.label=`$(${M.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(7169,null),t9o),l=e.add(new Mi(o,{...Ko,secondary:!0,supportIcons:!0}));l.element.classList.add("chat-question-nav-arrow","chat-question-nav-next"),l.label=`$(${M.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=it?d(7165,null):d(7166,null),c.appendChild(u),this._submitHint=u;let p=e.add(new Mi(c,{...Ko}));p.element.classList.add("chat-question-submit-button"),p.label=d(7171,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&&(this._nextButton.enabled=this._currentIndex<this.carousel.questions.length-1),this._stepIndicator&&(this._stepIndicator.textContent=d(7164,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(7156,null)),this._footerRow.appendChild(t);let o=_(".chat-question-footer-right"),n=_("span.chat-question-submit-hint");n.textContent=it?d(7165,null):d(7166,null),o.appendChild(n),this._submitHint=n;let r=e.add(new Mi(o,{...Ko}));r.element.classList.add("chat-question-submit-button"),r.label=d(7171,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(7153,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 Dc(e,void 0,{placeholder:d(7151,null),inputBoxStyles:pl}));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(Ah(Me(o.element),()=>o.focus()))}renderSingleSelect(e,t){let o=t.options||[],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&&Wo(r,{freeformValue:!0})?r.freeformValue:void 0,l=typeof r=="object"&&r!==null&&Wo(r,{selectedValue:!0})?r.selectedValue:r,c=typeof t.defaultValue=="string"?t.defaultValue:void 0,u=-1;o.forEach((y,w)=>{(l!==void 0&&y.value===l||u===-1&&!s&&c!==void 0&&y.id===c)&&(u=w)});let p=[],h=[],g=y=>{p.forEach((k,T)=>{let N=T===y;k.classList.toggle("selected",N),k.setAttribute("aria-selected",String(N));let O=h[T];O.classList.toggle("codicon",N),O.classList.toggle("codicon-check",N)}),y>=0&&y<p.length&&n.setAttribute("aria-activedescendant",p[y].id);let w=this._singleSelectItems.get(t.id);w&&(w.selectedIndex=y),this.saveCurrentAnswer()};o.forEach((y,w)=>{let k=w===u,T=_(".chat-question-list-item");T.setAttribute("role","option"),T.setAttribute("aria-selected",String(k)),T.setAttribute("aria-label",d(7158,null,w+1,y.label)),T.id=`option-${t.id}-${w}`,T.tabIndex=-1;let N=_(".chat-question-list-number");N.textContent=`${w+1}`,T.appendChild(N);let O=_(".chat-question-list-indicator");k&&O.classList.add("codicon","codicon-check"),h.push(O);let V=_(".chat-question-list-label"),U=y.label.indexOf(" - ");if(U!==-1){T.classList.add("has-description");let G=_("span.chat-question-list-label-title");G.textContent=y.label.substring(0,U),V.appendChild(G);let $=_("span.chat-question-list-label-desc");$.textContent=y.label.substring(U+3),V.appendChild($)}else V.textContent=y.label;T.appendChild(V),T.appendChild(O),k&&T.classList.add("selected"),this._inputBoxes.add(j(T,re.CLICK,G=>{G.preventDefault(),G.stopPropagation(),g(w);let $=this._freeformTextareas.get(t.id);$&&($.value=""),this.handleNextOrSubmit()})),this._inputBoxes.add(this._hoverService.setupDelayedHover(T,{content:y.label,position:{hoverPosition:2},appearance:{showPointer:!0}})),n.appendChild(T),p.push(T)}),this._singleSelectItems.set(t.id,{items:p,selectedIndex:u}),u>=0&&u<p.length&&n.setAttribute("aria-activedescendant",p[u].id);let f=_(".chat-question-freeform"),v=_(".chat-question-freeform-number");v.textContent=`${o.length+1}`,f.appendChild(v);let b=_("textarea.chat-question-freeform-textarea");b.placeholder=d(7150,null),b.rows=1,s!==void 0&&(b.value=s);let S=this.setupTextareaAutoResize(b);if(this._inputBoxes.add(j(b,re.INPUT,()=>{b.value.length>0?g(-1):this.saveCurrentAnswer()})),f.appendChild(b),e.appendChild(f),this._freeformTextareas.set(t.id,b),this._inputBoxes.add(j(n,re.KEY_DOWN,y=>{let w=new Ii(y),k=this._singleSelectItems.get(t.id);if(!k||!p.length)return;let T=k.selectedIndex;if(w.keyCode===18)y.preventDefault(),T=Math.min(k.selectedIndex+1,p.length-1);else if(w.keyCode===16)y.preventDefault(),T=Math.max(k.selectedIndex-1,0);else if((w.keyCode===3||w.keyCode===10)&&!w.metaKey&&!w.ctrlKey){y.preventDefault(),y.stopPropagation(),this.handleNextOrSubmit();return}else if(w.keyCode>=22&&w.keyCode<=30){let N=w.keyCode-22;N<p.length?(y.preventDefault(),g(N)):N===p.length&&(y.preventDefault(),g(-1),b.focus());return}T!==k.selectedIndex&&T>=0&&g(T)})),s!==void 0&&this._inputBoxes.add(Ah(Me(b),()=>S())),this._shouldAutoFocus()){if(s)this._inputBoxes.add(Ah(Me(b),()=>{b.focus()}));else if(p.length>0){let y=u>=0?u:0;u<0&&g(0),this._inputBoxes.add(Ah(Me(n),()=>{p[y]?.focus()}))}}}renderMultiSelect(e,t){let o=t.options||[],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&&Wo(r,{freeformValue:!0})?r.freeformValue:void 0,l=typeof r=="object"&&r!==null&&Wo(r,{selectedValues:!0})?r.selectedValues:Array.isArray(r)?r:[],c=Array.isArray(t.defaultValue)?t.defaultValue:typeof t.defaultValue=="string"?[t.defaultValue]:[],u=[],p=[],h=0,g=-1;o.forEach((y,w)=>{let k=!1;l&&l.length>0?k=l.includes(y.value):!s&&c.includes(y.id)&&(k=!0);let T=_(".chat-question-list-item.multi-select");T.setAttribute("role","option"),T.setAttribute("aria-selected",String(k)),T.setAttribute("aria-label",d(7158,null,w+1,y.label)),T.id=`option-${t.id}-${w}`,T.tabIndex=-1;let N=_(".chat-question-list-number");N.textContent=`${w+1}`,T.appendChild(N);let O=this._inputBoxes.add(new hv(y.label,k,kf));O.domNode.classList.add("chat-question-list-checkbox"),O.domNode.tabIndex=-1,T.appendChild(O.domNode);let V=_(".chat-question-list-label"),U=y.label.indexOf(" - ");if(U!==-1){T.classList.add("has-description");let G=_("span.chat-question-list-label-title");G.textContent=y.label.substring(0,U),V.appendChild(G);let $=_("span.chat-question-list-label-desc");$.textContent=y.label.substring(U+3),V.appendChild($)}else V.textContent=y.label;T.appendChild(V),k&&(T.classList.add("checked"),g===-1&&(g=w)),this._inputBoxes.add(O.onChange(()=>{T.classList.toggle("checked",O.checked),T.setAttribute("aria-selected",String(O.checked)),this.saveCurrentAnswer()})),this._inputBoxes.add(j(T,re.CLICK,G=>{h=w,G.target!==O.domNode&&!O.domNode.contains(G.target)&&O.domNode.click()})),this._inputBoxes.add(this._hoverService.setupDelayedHover(T,{content:y.label,position:{hoverPosition:2},appearance:{showPointer:!0}})),n.appendChild(T),u.push(O),p.push(T)}),this._multiSelectCheckboxes.set(t.id,u);let f=_(".chat-question-freeform"),v=_(".chat-question-freeform-number");v.textContent=`${o.length+1}`,f.appendChild(v);let b=_("textarea.chat-question-freeform-textarea");b.placeholder=d(7150,null),b.rows=1,s!==void 0&&(b.value=s);let S=this.setupTextareaAutoResize(b);if(this._inputBoxes.add(j(b,re.INPUT,()=>this.saveCurrentAnswer())),f.appendChild(b),e.appendChild(f),this._freeformTextareas.set(t.id,b),this._inputBoxes.add(j(n,re.KEY_DOWN,y=>{let w=new Ii(y);if(p.length){if(w.keyCode===18)y.preventDefault(),h=Math.min(h+1,p.length-1),p[h].focus();else if(w.keyCode===16)y.preventDefault(),h=Math.max(h-1,0),p[h].focus();else if(w.keyCode===3&&!w.metaKey&&!w.ctrlKey)y.preventDefault(),y.stopPropagation(),this.handleNextOrSubmit();else if(w.keyCode===10)y.preventDefault(),h>=0&&h<u.length&&u[h].domNode.click();else if(w.keyCode>=22&&w.keyCode<=30){let k=w.keyCode-22;k<u.length?(y.preventDefault(),u[k].domNode.click()):k===u.length&&(y.preventDefault(),b.focus())}}})),s!==void 0&&this._inputBoxes.add(Ah(Me(b),()=>S())),this._shouldAutoFocus()){if(s)this._inputBoxes.add(Ah(Me(b),()=>{b.focus()}));else if(p.length>0){let y=g>=0?g:0;h=y,this._inputBoxes.add(Ah(Me(n),()=>{p[y]?.focus()}))}}}getCurrentAnswer(){let e=this.carousel.questions[this._currentIndex];if(e)switch(e.type){case"text":return this._textInputBoxes.get(e.id)?.value??e.defaultValue;case"singleSelect":{let t=this._singleSelectItems.get(e.id),o;t&&t.selectedIndex>=0&&(o=e.options?.[t.selectedIndex]?.value),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.forEach((s,l)=>{if(s.checked){let c=e.options?.[l]?.value;c!==void 0&&o.push(c)}});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 e.defaultValue}}renderSkippedMessage(){let e=_(".chat-question-carousel-summary"),t=_(".chat-question-summary-skipped");t.textContent=d(7163,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(7168,null,l),n.appendChild(r),o!==void 0){let c=this.formatAnswerForSummary(t,o),u=_("div.chat-question-summary-answer-title");u.textContent=d(7167,null,c),n.appendChild(u)}else{let c=_("div.chat-question-summary-unanswered");c.textContent=d(7157,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"&&t!==null&&Wo(t,{selectedValue:!0})){let{selectedValue:n,freeformValue:r}=t,s=e.options?.find(l=>l.value===n)?.label;return r||(s??String(n??""))}return typeof t=="object"&&t!==null&&Wo(t,{freeformValue:!0})?t.freeformValue??"":e.options?.find(n=>n.value===t)?.label??String(t)}case"multiSelect":{if(typeof t=="object"&&t!==null&&Wo(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(7154,null))}return Array.isArray(t)?t.map(o=>e.options?.find(n=>n.value===o)?.label??String(o)).join(d(7154,null)):String(t)}default:return String(t)}}getQuestionText(e){let t=typeof e=="string"?new xe(e):e;return qa(t)}hasSameContent(e,t,o){return!this._isSkipped&&!this.carousel.isUsed&&Vi(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()}};k3=I([m(3,Qn),m(4,tt),m(5,Bi),m(6,X),m(7,_e)],k3);function DHt(a,i,e=5e3){return new Promise((t,o)=>{let n=new P;n.add(he(r=>{let l=a.servers.read(r).find(i);l&&(l.start({promptType:"all-untrusted"}).then(c=>{c.state===ir.Kind.Error&&l.showOutput()}),t(),n.dispose())})),n.add(nn(()=>{n.dispose(),o(new ho)},e))})}async function n0(a,i,e){let t=await a.start(i),o=new P,n=await new Promise(r=>{if(e?.isCancellationRequested||t.state===ir.Kind.Error||t.state===ir.Kind.Stopped)return r(!1);e&&o.add(e.onCancellationRequested(()=>{r(!1)})),o.add(he(s=>{let l=a.connectionState.read(s).state;(l===ir.Kind.Error||l===ir.Kind.Stopped)&&r(!1),a.cacheState.read(s)===5&&r(!0)}))});return o.dispose(),n&&await Pi(0),n}function BPe(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 lpo(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 cpo(a){return a.task!==void 0}function dpo(a,i,e){return new Promise(t=>{ux(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 LHt(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}}function $ee(a){let i=lo.executionConfirmedOrDenied(a);if(!(!i||typeof i=="boolean"))return i9o(i)}function i9o(a){let i;switch(a.type){case 2:i=d(7317,null,qy({title:"`"+a.id+"`",id:"workbench.action.openSettings",arguments:[a.id]},!1));break;case 3:i=a.scope==="session"?d(7315,null):a.scope==="workspace"?d(7316,null):d(7314,null),i+=" ("+qy({title:d(7318,null),id:"workbench.action.chat.editToolApproval",arguments:[a.scope]})+")";break;case 1:return a.reason?typeof a.reason=="string"?new xe(a.reason,{isTrusted:!0}):a.reason:void 0;case 4:case 0:default:return}return new xe(i,{isTrusted:!0})}var fD=class extends C{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 P);this.currentContent=e.content;let g=o.content.slice(o.contentIndex+1);if(this.showSpinner=n??upo(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")&&Jo(fu(qa(e.content)));let f=s&&q.isEqual(s,q.modify(M.loading,"spin")),v=(c??(!s||f))&&this.showSpinner,b=v?M.check:s??(this.showSpinner?q.modify(M.loading,"spin"):M.check),S=this.chatContentMarkdownRenderer.render(e.content);S.element.classList.add("progress-step"),Ck(S.element,this.instantiationService,this.chatMarkdownAnchorService,this._fileWidgetStore);let y=this.createApprovalMessage(),w=this._register(u.createInstance(vA,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(),Ck(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=upo(t,o);return e.kind==="progressMessage"&&e.content.value!==this.currentContent.value?!1:e.kind==="progressMessage"&&this.showSpinner===n}createApprovalMessage(){return this.toolInvocation&&$ee(this.toolInvocation)}};fD=I([m(8,F),m(9,Av),m(10,B)],fD);function upo(a,i){return Vi(i)&&!i.isComplete&&a.length===0}var vA=class extends C{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}))),R(this.domNode,n),i.classList.add("progress-step"),R(this.domNode,i)}};vA=I([m(3,tt)],vA);var Lme=class extends fD{constructor(i,e,t,o,n,r,s){let l={kind:"progressMessage",content:new xe().appendText(d(7149,null))};super(l,e,t,void 0,void 0,void 0,void 0,!0,o,n,r),this._register(s.onDidPrepareToolCallBecomeUnresponsive(c=>{Xe(t.element.sessionResource,c.sessionResource)&&this.updateMessage(new xe(d(7148,null,c.toolData.displayName)))}))}hasSameContent(i,e,t){return i.kind==="working"}};Lme=I([m(3,F),m(4,Av),m(5,B),m(6,jn)],Lme);var HPe=class extends C{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(()=>Vi(this.context.element)?this.context.element.session.getItems().filter((e,t)=>Vi(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(he(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=>qy({title:"`"+BM(t.label)+"`",id:"workbench.mcp.serverOptions",arguments:[t.id]},!1)).join(", ")}updateDetailedProgress(e){let t=qy({title:d(7137,null),id:"workbench.mcp.skipAutostart"}),o;if(e.starting.length===0)o=new xe(void 0,{isTrusted:!0}).appendText(d(7142,null)+" ").appendMarkdown(t);else{let n=this.createServerCommandLinks(e.starting);o=new xe(void 0,{isTrusted:!0}).appendMarkdown(d(7141,null,n)+" ").appendMarkdown(t)}this.workingProgressPart?this.workingProgressPart.updateMessage(o):(this.workingProgressPart=this._register(this.instantiationService.createInstance(fD,{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(M.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(7139,null,o,"#start"):d(7138,null,o,"#start"),r=new xe(n,{isTrusted:!0}),s=this.interactionMd.value=this._markdownRendererService.render(r,{actionHandler:c=>c.startsWith("command:")?zM(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(7140,null,r.label);let s=this.mcpService.servers.get().find(l=>l.definition.id===r.id);s&&(await n0(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)}};HPe=I([m(2,es),m(3,F),m(4,Qe),m(5,Qn)],HPe);var Ts;(T=>{T.PROMPT_LOCATIONS_KEY="chat.promptFilesLocations",T.INSTRUCTIONS_LOCATION_KEY="chat.instructionsFilesLocations",T.MODE_LOCATION_KEY="chat.modeFilesLocations",T.AGENTS_LOCATION_KEY="chat.agentFilesLocations",T.SKILLS_LOCATION_KEY="chat.agentSkillsLocations",T.HOOKS_LOCATION_KEY="chat.hookFilesLocations",T.PROMPT_FILES_SUGGEST_KEY="chat.promptFilesRecommendations",T.USE_COPILOT_INSTRUCTION_FILES="github.copilot.chat.codeGeneration.useInstructionFiles",T.USE_AGENT_MD="chat.useAgentsMdFile",T.USE_NESTED_AGENT_MD="chat.useNestedAgentsMdFiles",T.USE_CLAUDE_MD="chat.useClaudeMdFile",T.USE_AGENT_SKILLS="chat.useAgentSkills",T.USE_CHAT_HOOKS="chat.useHooks",T.USE_CLAUDE_HOOKS="chat.useClaudeHooks",T.USE_CUSTOM_AGENT_HOOKS="chat.useCustomAgentHooks",T.USE_SKILL_ADHERENCE_PROMPT="chat.experimental.useSkillAdherencePrompt",T.INCLUDE_APPLYING_INSTRUCTIONS="chat.includeApplyingInstructions",T.INCLUDE_REFERENCED_INSTRUCTIONS="chat.includeReferencedInstructions";function y(N,O){let V=Bxi(O),U=N.getValue(V);if(!(U==null||Array.isArray(U))&&typeof U=="object"){let G={};for(let[$,te]of Object.entries(U)){let pe=$.trim(),de=ppo(te);de!==void 0&&pe&&(G[pe]=de)}return G}}T.getLocationsValue=y;function w(N,O){let V=y(N,O),U=lme(O);if(V&&typeof V=="object"){let G=[],$=new Set(U.map(te=>te.path));for(let te of U)V[te.path]!==!1&&G.push(te);for(let[te,pe]of Object.entries(V)){if(pe===!1||$.has(te))continue;let de=RHt(te)?"user":"local";G.push({path:te,source:de==="local"?"config-personal":"config-workspace",storage:de})}return G}return[]}T.promptSourceFolders=w;function k(N,O){let V=N.getValue(T.PROMPT_FILES_SUGGEST_KEY,{resource:O});if(!V||typeof V!="object"||Array.isArray(V))return;let U={};for(let[G,$]of Object.entries(V)){let te=G.trim();if(!te)continue;if(typeof $=="boolean"){U[te]=$;continue}if(typeof $=="string"){let de=$.trim();de&&(U[te]=de);continue}let pe=ppo($);pe!==void 0&&(U[te]=pe)}return Object.keys(U).length>0?U:void 0}T.getPromptFilesRecommendationsValue=k})(Ts||={});function Bxi(a){switch(a){case"instructions":return Ts.INSTRUCTIONS_LOCATION_KEY;case"prompt":return Ts.PROMPT_LOCATIONS_KEY;case"agent":return Ts.AGENTS_LOCATION_KEY;case"skill":return Ts.SKILLS_LOCATION_KEY;case"hook":return Ts.HOOKS_LOCATION_KEY;default:throw new Error("Unknown prompt type")}}function ppo(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 RHt(a){return a.startsWith("~/")}var UPe=class extends C{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(M.info));let s=qy({title:d(7108,null),id:"workbench.action.openSettings",arguments:[Ts.USE_CLAUDE_HOOKS]}),l=d(7109,null,s),c=new xe(l,{isTrusted:!0}),u=this._register(this._markdownRendererService.render(c,{actionHandler:p=>zM(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)}};UPe=I([m(1,Qe),m(2,Qn)],UPe);var E3=_,o9o=22,n9o=6,zPe=class extends C{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=uN(this.content.multiDiffData)?this.content.multiDiffData.map(c=>c):Oo(this.content.multiDiffData);let l=E3(".checkpoint-file-changes-summary-header");this.domNode=E3(".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(E3(".chat-file-changes-label")),o=new oO(t,{});this._register(he(s=>{let l=this.diffData.read(s).resources.length;o.label=l===1?d(7145,null):d(7144,null,l)}));let n=()=>{o.icon=this.isCollapsed?M.chevronRight:M.chevronDown,this.domNode.classList.toggle("chat-file-changes-collapsed",this.isCollapsed)};n();let r=new P;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(E3(".chat-view-changes-icon"));return t.classList.add(...q.asClassNameArray(M.diffMultiple)),t.title=d(7146,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(xu,n,r||"Multi-Diff",s.map(u=>new ik(u.originalUri,u.modifiedUri,u.goToFileUri)),!1),c=o.altKey;this.editorService.openEditor(l,c?vn:Un),$t.stop(o,!0)})}renderContributedButtons(e){let t=e.appendChild(E3(".chat-multidiff-contributed-buttons")),o=new P,n=fg(this._element.sessionResource),r=this.contextKeyService.createOverlay([[ie.agentSessionType.key,n]]),s=o.add(this.instantiationService.createChild(new Io([X,r]))),l={...this._element.sessionResource,$mid:1};return o.add(s.createInstance(Ln,t,D.ChatMultiDiffContext,{menuOptions:{arg:l,shouldForwardArgs:!0},toolbarOptions:{primaryGroup:()=>!0}})),o}renderFilesList(e){let t=new P,o=e.appendChild(E3(".chat-summary-list"));t.add(DB(o,this.themeService));let n=t.add(this.instantiationService.createInstance(Za,{onDidChangeVisibility:H.None}));return this.list=t.add(this.instantiationService.createInstance(Rl,"ChatMultiDiffList",o,new Hxi,[this.instantiationService.createInstance(Uxi,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(7147,null)}})),this._register(he(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,n9o)*o9o;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===(uN(e.multiDiffData)?e.multiDiffData.get().resources.length:e.multiDiffData.resources.length)}addDisposable(e){this._register(e)}};zPe=I([m(2,F),m(3,ee),m(4,De),m(5,X)],zPe);var Hxi=class{getHeight(){return 22}getTemplateId(){return"chatMultiDiffItem"}},Uxi=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(E3(`.${a.CHANGES_SUMMARY_CLASS_NAME}`)),r=n.appendChild(E3(".insertions"));r.textContent=`+${i.diff.added}`;let s=n.appendChild(E3(".deletions"));s.textContent=`-${i.diff.removed}`,n.setAttribute("aria-label",d(7143,null,i.diff.added,i.diff.removed)),t.changesElement=n}}disposeTemplate(i){i.dispose()}};var KPe=class extends C{constructor(e,t){super();this.pullRequestContent=e;this.commandService=t;this.domNode=_(".chat-pull-request-content-part");let o=R(this.domNode,_(".container")),n=R(o,_(".content-container")),r=R(n,_(".title-container"));R(r,_(".icon")).classList.add(...q.asClassNameArray(M.gitPullRequest));let l=R(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)}};KPe=I([m(1,ge)],KPe);var MHt=_,mpo=!1,hpo=!1,GPe=class extends C{constructor(e,t,o,n,r,s,l){super();this.content=t;let c=e.errorDetails;So(!!c,"errorDetails"),this.domNode=MHt(".chat-quota-error-widget"),R(this.domNode,MHt("span")).classList.add(...q.asClassNameArray(M.warning));let p=R(this.domNode,MHt(".chat-quota-error-message")),h=this._register(o.render(new xe(c.message)));R(p,h.element);let g;switch(l.entitlement){case 6:case 7:g=d(7173,null);break;case 5:g=d(7174,null);break}let f=!1,v=()=>{!hpo||f||(f=!0,R(p,MHt(".chat-quota-wait-warning",void 0,d(7175,null))))},b=!1,S=()=>{if(!mpo||b)return;b=!0;let y=this._register(new Mi(p,{buttonBackground:void 0,buttonForeground:wt(WI)}));y.element.classList.add("chat-quota-error-secondary-button"),y.label=d(7172,null),this._register(y.onDidClick(()=>{let w=n.getWidgetBySessionResource(e.sessionResource);w&&(w.rerunLastRequest(),hpo=!0,v())}))};if(g){let y=this._register(new Mi(p,{...Ko,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),mpo=!0,S()}))}S(),v()}hasSameContent(e){return e.kind===this.content.kind&&!!e.errorDetails.isQuotaExceeded}addDisposable(e){this._register(e)}};GPe=I([m(3,At),m(4,ge),m(5,Te),m(6,vr)],GPe);var cT=class extends C{constructor(e,t,o,n,r){super();this.title=e;this.hoverMessage=o;this.hoverService=n;this._renderedTitleWithWidgets=this._register(new me);this._isExpanded=Le(this,!1);this._overrideIcon=Le(this,void 0);this._contentInitialized=!1;this.element=t.element,this.hasFollowingContent=t.contentIndex+1<t.content.length,this._showCheckmarks=pr("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 oO(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(he(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"),Ck(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}};cT=I([m(3,tt),m(4,B)],cT);var zxi=_,T3=class extends cT{constructor(e,t,o,n,r,s,l,c,u,p,h){super(t??(e.length>1?d(7181,null,e.length):d(7182,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=M.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=>{$t.stop(l.browserEvent,!0);let c=l.element&&Yet(l.element);c&&this.contextMenuService.showContextMenu({getAnchor:()=>l.anchor,getActions:()=>{let u=this.menuService.getMenuActions(D.ChatAttachmentsContext,t.contextKeyService,{shouldForwardArgs:!0,arg:c});return Uc(u)}})}));let o=this._register(this.instantiationService.createInstance(Fo));this._register(t.onDidChangeFocus(l=>{o.reset();let c=l.elements.length?l.elements[0]:void 0,u=c&&Yet(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}};T3=I([m(5,Qe),m(6,qt),m(7,F),m(8,ze),m(9,tt),m(10,B)],T3);var $Pe=class extends T3{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&&xo(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()}};$Pe=I([m(5,Qe),m(6,qt),m(7,F),m(8,ze),m(9,tt),m(10,B)],$Pe);var qee=class extends C{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 LB(()=>this.listFactory()))}get inUse(){return this._pool.inUse}listFactory(){let e=new P,t=e.add(this.instantiationService.createInstance(Za,{onDidChangeVisibility:this._onDidChangeVisibility})),o=zxi(".chat-used-context-list");return e.add(DB(o,this.themeService)),{list:this.instantiationService.createInstance(Rl,"ChatListRenderer",o,new Kxi,[this.instantiationService.createInstance(jee,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)?No(s.path):No(s.uri.path)},getWidgetAriaLabel:()=>d(7177,null)},dnd:{getDragURI:r=>Yet(r)?.toString()??null,getDragLabel:(r,s)=>{let l=si(r.map(Yet));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=si(l.map(Yet));this.instantiationService.invokeFunction(u=>Ig(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()}};qee=I([m(3,F),m(4,De),m(5,ot)],qee);var Kxi=class{getHeight(i){return 22}getTemplateId(i){return jee.TEMPLATE_ID}},jee=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=jee.TEMPLATE_ID}static{this.TEMPLATE_ID="chatCollapsibleListRenderer"}renderTemplate(i){let e=new P,t=e.add(this.labels.create(i,{supportHighlights:!0,supportIcons:!0})),o=zxi(".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=zxi(".chat-collapsible-list-action-bar"),c=e.add(this.contextKeyService.createScoped(l));let u=e.add(this.instantiationService.createChild(new Io([X,c])));s=e.add(u.createInstance(Ln,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:Ip(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:M.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:Ra(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"&&S6(s.authority,"github.com")&&s.path.includes("/tree/"))t.label.setResource(r9o(s),{icon:M.github,title:i.title,strikethrough:i.excluded,extraClasses:l});else if(s.scheme===this.productService.urlProtocol&&S6(s.authority,AEe)){let c=s.path.substring(1);t.label.setResource({resource:s,name:c},{icon:M.settingsGear,title:d(7180,null,c),strikethrough:i.excluded,extraClasses:l})}else $0(s,Y.mailto,Y.http,Y.https)?t.label.setResource({resource:s,name:s.toString(!0)},{icon:n??M.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){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(7178,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&&sR.bindTo(t.contextKeyService).set(i.state)}}disposeTemplate(i){i.templateDisposables.dispose()}};jee=I([m(2,De),m(3,nt),m(4,F),m(5,X)],jee);function r9o(a){let i=a.path.split("/").slice(1,3).join("/"),e=a.path.split("/").slice(5),t=e.at(-1),o=s9o(a);return{resource:a,name:t??e.join("/"),description:[i,...e.slice(0,-1)].join("/"),range:o}}function s9o(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 Yet(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 gpo extends K{static{this.id="workbench.action.chat.addToChatAction"}constructor(){super({id:gpo.id,title:{...L(7176,"Add File to Chat")},f1:!1,menu:[{id:D.ChatAttachmentsContext,group:"chat",order:1,when:x.and(Fo.IsFileSystemResource,lu.negate())}]})}async run(i,e){let t=i.get(At);if(!e)return;let o=t.lastFocusedWidget;o&&o.attachmentModel.addFile(e)}});W(class fpo extends K{static{this.id="workbench.action.chat.copyLink"}constructor(){super({id:fpo.id,title:{...L(7179,"Copy Link")},f1:!1,menu:[{id:D.ChatAttachmentsContext,group:"chat",order:0,when:x.or(Fo.Scheme.isEqualTo(Y.http),Fo.Scheme.isEqualTo(Y.https))}]})}async run(i,e){await i.get(Wi).writeResources([e])}});var qPe=class extends C{constructor(e,t,o,n,r){super();this.task=e;if(e.progress.length){this.isSettled=!0;let s=this._register(r.createInstance(T3,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(fD,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)}};qPe=I([m(4,F)],qPe);var vpo=_,bpo=ae("ICodeCompareModelService"),jPe=class extends C{constructor(e,t,o,n,r,s){super();this.codeCompareModelService=s;let l=t.element;if(So(Vi(l)),o.renderTextEditsAsSummary?.(e.uri))l.response.value.every(c=>c.kind==="textEditGroup")?this.domNode=vpo(".interactive-edits-summary",void 0,l.isComplete?l.isCanceled?d(7201,null):d(7202,null):""):this.domNode=vpo("div");else{let c=new $e,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)}};jPe=I([m(5,bpo)],jPe);var Xet=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(i_(t.object.textEditorModel.createSnapshot()),{languageId:t.object.textEditorModel.getLanguageId(),onDidChange:H.None},A.from({scheme:Y.vscodeChatCodeBlock,path:e.uri.path,query:_t()}),!1).uri),n=new qH(Z(()=>{t.dispose(),o.dispose()})),r="";if(e.state)r=e.state.sha1;else{let c=new Wue;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||!Xe(u.uri,e.uri)))for(let p of u.edits){let h=p.map(Qk.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()}}}};Xet=I([m(0,Nt),m(1,Ct),m(2,Si)],Xet);we(bpo,Xet,1);function Spo(a){return(Array.isArray(a.value)?a.value.join(""):a.value||"").trim()}function Gxi(a){let i=a.toLowerCase();return i.includes("search")||i.includes("grep")||i.includes("find")||i.includes("list")||i.includes("semantic")||i.includes("changes")||i.includes("codebase")?M.search:i.includes("read")||i.includes("get_file")||i.includes("problems")?M.book:i.includes("edit")||i.includes("create")||i.includes("replace")?M.pencil:i.includes("terminal")?M.terminal:M.tools}function _3(a){let i=_("span.chat-thinking-icon");return i.classList.add(...q.asClassNameArray(a)),i}function Ipo(a){let i=a.match(/^\*\*([^*]+)\*\*/);return i?i[1]:void 0}var Jet=200;var l9o=[d(7212,null),d(7213,null),d(7214,null),d(7215,null),d(7216,null)],c9o=[d(7209,null),d(7210,null),d(7211,null)],d9o=[d(7217,null),d(7218,null),d(7219,null),d(7220,null),d(7221,null)],vD=class extends cT{constructor(e,t,o,n,r,s,l,c,u){let p=Spo(e),h=Ipo(p)??"Working";super(h,t,void 0,u,s);this.chatContentMarkdownRenderer=o;this.streamingCompleted=n;this.instantiationService=r;this.configurationService=s;this.chatMarkdownAnchorService=l;this.languageModelsService=c;this._onDidChangeHeight=this._register(new E);this.defaultTitle=d(7207,null);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.toolDisposables=this._register(new jt);this.pendingRemovals=[];this.isUpdatingDimensions=!1;this.id=e.id,this.content=e,this.allThinkingParts.push(e);let g=this.configurationService.getValue("chat.agent.thinkingStyle")??"collapsed";this.fixedScrollingMode=g==="fixedScrolling",this.currentTitle=h,h!==this.defaultTitle&&(this.lastExtractedTitle=h),this.currentThinkingValue=p,p.trim()&&this.appendedItemCount++,this.configurationService.getValue("accessibility.verboseChatProgressUpdates")&&Jo(d(7208,null)),g==="collapsed"?this.setExpanded(!1):g==="collapsedPreview"?this.setExpanded(!this.streamingCompleted&&!this.element.isComplete):this.setExpanded(!1);let f=this.domNode;if(f.classList.add("chat-thinking-box"),!this.streamingCompleted&&!this.element.isComplete&&(this.fixedScrollingMode||f.classList.add("chat-thinking-active")),!this.fixedScrollingMode&&!this.streamingCompleted&&!this.element.isComplete&&this._collapseButton){let b=this._collapseButton.labelElement;b.textContent="",this.titleShimmerSpan=_("span.chat-thinking-title-shimmer"),this.titleShimmerSpan.textContent=h,b.appendChild(this.titleShimmerSpan)}this.fixedScrollingMode&&(f.classList.add("chat-thinking-fixed-mode"),this.currentTitle=this.defaultTitle),this._register(he(b=>{let S=this.expanded.read(b);this._collapseButton&&(this.streamingCompleted||this.element.isComplete?this._collapseButton.icon=M.check:this.fixedScrollingMode||(S?this._collapseButton.icon=M.chevronDown:this._collapseButton.icon=M.circleFilled))})),this._register(he(b=>{let S=this._isExpanded.read(b);if(S&&!this.hasExpandedOnce&&this.lazyItems.length>0){this.hasExpandedOnce=!0;for(let y of this.lazyItems)this.materializeLazyItem(y)}if(S&&!this.shouldAllowExpansion()){this.setExpanded(!1);return}this._onDidChangeHeight.fire()}));let v=this.lastExtractedTitle??"";!this.fixedScrollingMode&&!this._isExpanded.get()&&this.setTitle(v),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)}))}getRandomWorkingMessage(e="tool"){let t=this.availableMessagesByCategory.get(e);if(!t||t.length===0){let n;switch(e){case"thinking":n=[...l9o];break;case"terminal":n=[...c9o];break;default:n=[...d9o];break}let r=this.configurationService.getValue("chat.agent.thinking.phrases"),s=Array.isArray(r?.phrases)?r.phrases.filter(c=>typeof c=="string").map(c=>c.trim()).filter(c=>c.length>0):[],l=r?.mode==="replace"?"replace":"append";s.length>0?l==="replace"?t=[...s]:t=[...n,...s]:t=n,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=_3(M.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 Pa(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.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;let t=this.scrollableElement.getScrollDimensions(),o=t.scrollHeight-t.height;o<=0||e>=o-10?this.autoScrollEnabled=!0:this.autoScrollEnabled=!1}syncDimensionsAndScheduleScroll(){if(this.autoScrollEnabled&&this.scrollableElement){this.isUpdatingDimensions=!0;try{this.updateScrollDimensions(),this.scrollToBottom()}finally{this.isUpdatingDimensions=!1}return}this.pendingScrollDisposable||(this.pendingScrollDisposable=$r(Me(this.domNode),()=>{if(this.pendingScrollDisposable=void 0,!this._store.isDisposed){this.isUpdatingDimensions=!0;try{this.updateScrollDimensions()}finally{this.isUpdatingDimensions=!1}}}))}updateScrollDimensions(){if(!this.scrollableElement||!this.domNode.classList.contains("chat-used-context-collapsed"))return;let t=this.wrapper.scrollHeight,o=Math.min(t,Jet);this.scrollableElement.setScrollDimensions({width:this.scrollableElement.getDomNode().clientWidth,scrollWidth:this.wrapper.scrollWidth,height:o,scrollHeight:t}),this.updateDropdownClickability(t)}scrollToBottom(){if(!this.scrollableElement)return;let e=this.wrapper.scrollHeight,t=Math.min(e,Jet);e>t&&this.scrollableElement.setScrollPosition({scrollTop:e-t})}updateScrollDimensionsForCompletion(){if(!this.scrollableElement||!this.fixedScrollingMode)return;let e=this.wrapper.scrollHeight,t=Math.min(e,Jet);this.scrollableElement.setScrollDimensions({width:this.scrollableElement.getDomNode().clientWidth,scrollWidth:this.wrapper.scrollWidth,height:t,scrollHeight:e}),e<=Jet&&this.scrollableElement.setScrollPosition({scrollTop:0})}renderMarkdown(e,t){if(this._store.isDisposed)return;let o=e.trim();if(!o){this.markdownResult&&(this.markdownResult.dispose(),this.markdownResult=void 0),this.textContainer&&Rt(this.textContainer);return}let n=o;o.startsWith("**")&&o.endsWith("**")&&(n=o.slice(2,-2));let r=t?this.markdownResult?.element:void 0;this.markdownResult&&(this.markdownResult.dispose(),this.markdownResult=void 0);let s=this._register(this.chatContentMarkdownRenderer.render(new xe(n),{fillInIncompleteTokens:!0,asyncRenderCallback:()=>this._onDidChangeHeight.fire(),codeBlockRendererSync:(l,c,u)=>{let p=_("code");return p.textContent=c,p}},r));this.markdownResult=s,r||this.textContainer&&(Rt(this.textContainer),this.textContainer.appendChild(_3(M.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)}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)<=Jet&&(t=!1),!t&&this.isExpanded()&&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=Spo(e),o=t;if(o===this.currentThinkingValue)return;let n=this.currentThinkingValue,r=!!(this.markdownResult&&o.startsWith(n)&&o.length>n.length);this.currentThinkingValue=o,this.renderMarkdown(o,r),this.fixedScrollingMode&&this.scrollableElement&&this.syncDimensionsAndScheduleScroll();let s=Ipo(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}markAsInactive(){this.isActive=!1,this.domNode.classList.remove("chat-thinking-active"),this.processPendingRemovals(),this.workingSpinnerElement&&(this.workingSpinnerElement.remove(),this.workingSpinnerElement=void 0,this.workingSpinnerLabel=void 0)}finalizeTitleIfDefault(){if(this.processPendingRemovals(),this.wrapper&&this.wrapper.classList.remove("chat-thinking-streaming"),this.domNode.classList.remove("chat-thinking-active"),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=M.check),this.updateScrollDimensionsForCompletion(),this.updateDropdownClickability(),this.content.generatedTitle){this.currentTitle=this.content.generatedTitle,this.setFinalizedTitle(this.content.generatedTitle);return}let e=this.toolInvocations.find(o=>o.generatedTitle)?.generatedTitle??this.allThinkingParts.find(o=>o.generatedTitle)?.generatedTitle;if(e){this.currentTitle=e,this.content.generatedTitle=e,this.setGeneratedTitleOnAllParts(e),this.setFinalizedTitle(e);return}if(this.appendedItemCount===1&&this.currentThinkingValue.trim()===""){if(!this.singleItemInfo){let o=this.lazyItems.find(n=>n.kind==="tool"&&n.originalParent);if(o&&o.kind==="tool"){let n=o.lazy.value;this.singleItemInfo={element:n.domNode,originalParent:o.originalParent,originalNextSibling:this.domNode},n.disposable&&this._register(n.disposable)}}if(this.singleItemInfo&&this.restoreSingleItemToOriginalPosition())return}if(this.extractedTitles.length===1&&this.toolInvocationCount===0){let o=this.extractedTitles[0];this.currentTitle=o,this.content.generatedTitle=o,this.setGeneratedTitleOnAllParts(o),this.setFinalizedTitle(o);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}async generateTitleViaLLM(){let e=new $e,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){this.currentTitle=l,this.setFinalizedTitle(l),this.content.generatedTitle=l,this.setGeneratedTitleOnAllParts(l);return}}catch{}finally{clearTimeout(t),e.dispose()}this.setFallbackTitle()}restoreSingleItemToOriginalPosition(){if(!this.singleItemInfo)return!1;let{element:e,originalParent:t,originalNextSibling:o}=this.singleItemInfo;return e.childElementCount>1?(this.singleItemInfo=void 0,!1):(o&&o.parentNode===t?t.insertBefore(e,o):t.appendChild(e),xo(this.domNode),this.singleItemInfo=void 0,!0)}setFallbackTitle(){let e=this.appendedItemCount>0?d(7206,null,this.appendedItemCount,this.appendedItemCount===1?"":"s"):d(7205,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=M.check,this.setFinalizedTitle(e)),this.updateDropdownClickability()}appendItem(e,t,o,n){if(this.processPendingRemovals(),this.trackToolMetadata(t,o),this.appendedItemCount++,this.workingSpinnerLabel){let s=o&&(o.kind==="toolInvocation"||o.kind==="toolInvocationSerialized")&&o.toolSpecificData?.kind==="terminal"?"terminal":"tool";this.workingSpinnerLabel.textContent=this.getRandomWorkingMessage(s)}if(this.isExpanded()||this.hasExpandedOnce||this.fixedScrollingMode&&!this.streamingCompleted){let r=e();if(this.appendItemToDOM(r.domNode,t,o,n),r.disposable){let s=o&&(o.kind==="toolInvocation"||o.kind==="toolInvocationSerialized")?o.toolCallId:void 0;s?this.toolDisposables.get(s)?.add(r.disposable):this._register(r.disposable)}}else{let r={kind:"tool",lazy:new co(e),toolInvocationId:t,toolInvocationOrMarkdown:o,originalParent:n,isHook:!o&&!!t};this.lazyItems.push(r)}this.updateDropdownClickability()}removeLazyItem(e){let t=this.lazyItems.findIndex(r=>r.kind==="tool"&&r.toolInvocationId===e);if(t===-1)return!1;let o=this.lazyItems[t];this.lazyItems.splice(t,1),this.appendedItemCount--,o.kind==="tool"&&o.isHook?this.hookCount=Math.max(0,this.hookCount-1):this.toolInvocationCount--;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=$r(Me(this.domNode),()=>{this.pendingRemovalFlushDisposable=void 0,!this._store.isDisposed&&this.processPendingRemovals()}))}removeStreamingToolEntry(e,t){this.toolDisposables.deleteAndDispose(e);let o=this.toolWrappersByCallId.get(e);o&&(o.remove(),this.toolWrappersByCallId.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);n!==-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.updateDropdownClickability(),this._onDidChangeHeight.fire()}trackToolMetadata(e,t){if(!e)return;!t?this.hookCount++:this.toolInvocationCount++;let n;if(t&&(t.kind==="toolInvocation"||t.kind==="toolInvocationSerialized")&&t.invocationMessage){if(n=typeof t.invocationMessage=="string"?t.invocationMessage:t.invocationMessage.value,this.toolInvocations.push(t),t.kind==="toolInvocation"){let l=n,c=!1,u=lo.isStreaming(t),p=new P;this.toolDisposables.set(t.toolCallId,p);let h=f=>{if(f&&f!==l){let v=this.extractedTitles.indexOf(l),b=this.extractedTitles.indexOf(f);v!==-1?b!==-1&&b!==v?this.extractedTitles.splice(v,1):this.extractedTitles[v]=f:b===-1&&this.extractedTitles.push(f),l=f,this.lastExtractedTitle=f,!this.fixedScrollingMode&&!this._isExpanded.read(void 0)&&this.setTitle(f)}},g=he(f=>{if(c)return;let v=t.state.read(f);if(u&&v.type!==lo.StateKind.Streaming&&(u=!1,t.presentation==="hidden")){this.pendingRemovals.push({toolCallId:t.toolCallId,toolLabel:l}),this.schedulePendingRemovalsFlush(),c=!0;return}if(v.type===lo.StateKind.Completed||v.type===lo.StateKind.Cancelled){c=!0;return}if(v.type===lo.StateKind.Streaming){u=!0;let S=v.streamingMessage.read(f);if(S){let y=typeof S=="string"?S:S.value;h(y)}return}if(v.type===lo.StateKind.Executing){let S=v.progress.read(f);if(S.message){let y=typeof S.message=="string"?S.message:S.message.value;h(y)}else{let y=t.invocationMessage;if(y){let w=typeof y=="string"?y:y.value;h(w)}}return}let b=t.invocationMessage;if(b){let S=typeof b=="string"?b:b.value;h(S)}});p.add(g)}}else if(t?.kind==="markdownContent"){let s=zMe(t.content.value);if(s?.uri){let l=Ye(s.uri);n=d(7203,null,l)}else n=d(7204,null)}else n=e;this.extractedTitles.includes(n)||this.extractedTitles.push(n),this.lastExtractedTitle=n,!this.fixedScrollingMode&&!this._isExpanded.get()&&this.setTitle(n)}appendItemToDOM(e,t,o,n){if(!e.hasChildNodes()||e.textContent?.trim()==="")return;this.appendedItemCount===1&&n?this.singleItemInfo={element:e,originalParent:n,originalNextSibling:this.domNode}: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;if(s)c=M.pencil;else if(l){let g=o.toolSpecificData?.terminalCommandState?.exitCode;c=g!==void 0&&g!==0?M.error:M.terminal}else e.classList.contains("chat-hook-outcome-blocked")?c=M.error:e.classList.contains("chat-hook-outcome-warning")?c=M.warning:c=t?Gxi(t):M.tools;let u=_3(c);r.appendChild(u),r.appendChild(e),o&&(o.kind==="toolInvocation"||o.kind==="toolInvocationSerialized")&&o.toolCallId&&this.toolWrappersByCallId.set(o.toolCallId,r),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)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.toolDisposables.get(o)?.add(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&&(this.titleDetailRendered.dispose(),this.titleDetailRendered=void 0),this.currentTitle=e;return}this.lastExtractedTitle=e;let o=`Working: ${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="Working: ",this.titleDetailRendered&&(this.titleDetailRendered.dispose(),this.titleDetailRendered=void 0);let r=this.chatContentMarkdownRenderer.render(new xe(e));r.element.classList.add("collapsible-title-content","chat-thinking-title-detail"),Ck(r.element,this.instantiationService,this.chatMarkdownAnchorService,this._store),this.titleDetailRendered=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 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.markdownResult&&(this.markdownResult.dispose(),this.markdownResult=void 0),this.titleDetailRendered&&(this.titleDetailRendered.dispose(),this.titleDetailRendered=void 0),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()}};vD=I([m(4,F),m(5,B),m(6,Av),m(7,Wr),m(8,tt)],vD);var Rme=class extends cT{constructor(e,t,o,n,r,s){super(e,o,void 0,r,s);this.markdownContent=t;this.chatContentMarkdownRenderer=n;this.icon=M.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 xe(this.markdownContent)));this.contentElement.appendChild(t.element),e.appendChild(this.contentElement)}return e}hasSameContent(e,t,o){return!1}};Rme=I([m(4,tt),m(5,B)],Rme);function Mme(a){return!!a&&A.isUri(a.sessionResource)&&a.$mid===19}var bA=class extends K{constructor(i){super({category:vi,...i})}run(i,...e){let t=Nme(i,e);if(!(!t||!t.editingSession))return this.runEditingSessionAction(i,t.editingSession,t.chatWidget,...e)}};function Nme(a,i){let e=i.at(0),t=Mme(e)?e:void 0,o=a.get(At),n=a.get(dl),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 Zet=class extends bA{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 Zet{constructor(){super({id:"chatEditing.openFileInDiff",title:L(6419,"Open Changes in Diff Editor"),icon:M.diffSingle,menu:[{id:D.ChatEditingWidgetModifiedFilesToolbar,when:x.equals(sR.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 Zet{constructor(){super({id:"chatEditing.acceptFile",title:L(6387,"Keep"),icon:M.check,menu:[{when:x.and(x.equals("resourceScheme",_z),x.notIn(Oke.key,kQe.key)),id:D.MultiDiffEditorFileToolbar,order:0,group:"navigation"},{id:D.ChatEditingWidgetModifiedFilesToolbar,when:x.equals(sR.key,0),order:0,group:"navigation"}]})}async runWorkingSetAction(i,e,t,...o){await e.accept(...o)}});W(class extends Zet{constructor(){super({id:"chatEditing.discardFile",title:L(6416,"Undo"),icon:M.discard,menu:[{when:x.and(x.equals("resourceScheme",_z),x.notIn(Oke.key,kQe.key)),id:D.MultiDiffEditorFileToolbar,order:2,group:"navigation"},{id:D.ChatEditingWidgetModifiedFilesToolbar,when:x.equals(sR.key,0),order:1,group:"navigation"}]})}async runWorkingSetAction(i,e,t,...o){await e.reject(...o)}});var $xi=class extends bA{constructor(){super({id:"chatEditing.acceptAllFiles",title:d(6386,null),icon:M.check,tooltip:d(6388,null),precondition:Zx,keybinding:{primary:2051,when:x.and(Zx,ie.inChatInput),weight:200},menu:[{id:D.ChatEditingWidgetToolbar,group:"navigation",order:0,when:x.and(Yj.negate(),x.and(Zx))}]})}async runEditingSessionAction(i,e,t,...o){await e.accept()}};W($xi);var qxi=class extends bA{constructor(){super({id:"chatEditing.discardAllFiles",title:d(6415,null),icon:M.discard,tooltip:d(6417,null),precondition:Zx,menu:[{id:D.ChatEditingWidgetToolbar,group:"navigation",order:1,when:x.and(Yj.negate(),Zx)}],keybinding:{when:x.and(Zx,ie.inChatInput,ie.inputHasText.negate()),weight:200,primary:2049}})}async runEditingSessionAction(i,e,t,...o){await u9o(i,e)}};W(qxi);var jxi=class a extends bA{static{this.ID="chatEditing.toggleExplanationWidget"}constructor(){super({id:a.ID,title:d(6418,null),tooltip:d(6420,null),precondition:Zx,menu:[{id:D.ChatEditingWidgetToolbar,group:"navigation",order:2,when:x.and(Zx,x.has("config.chat.editing.explainChanges.enabled"))}]})}async runEditingSessionAction(i,e,t,...o){e.hasExplanations()?e.clearExplanations():await e.triggerExplanationGeneration()}};W(jxi);async function u9o(a,i){let e=a.get(ct),t=i.entries.get().filter(o=>o.state.get()===0);return t.length>0&&!(await e.confirm({title:d(6393,null),message:t.length===1?d(6391,null,Ye(t[0].modifiedURI)):d(6390,null,t.length),primaryButton:d(6392,null),type:"info"})).confirmed?!1:(await i.reject(),!0)}var Pme=class a extends bA{static{this.ID="chatEditing.viewChanges"}static{this.LABEL=d(6413,null)}constructor(){super({id:a.ID,title:{value:a.LABEL,original:a.LABEL},tooltip:a.LABEL,f1:!0,icon:M.diffMultiple,precondition:Zx,menu:[{id:D.ChatEditingWidgetToolbar,group:"navigation",order:4,when:x.and(Yj.negate(),x.and(zce,Zx))}]})}async runEditingSessionAction(i,e,t,...o){await e.show()}};W(Pme);var ett=class a extends K{static{this.ID="chatEditing.viewAllSessionChanges"}constructor(){super({id:a.ID,title:L(6412,"View All Changes"),icon:M.diffMultiple,category:vi,precondition:ie.hasAgentSessionChanges,menu:[{id:D.ChatEditingSessionChangesToolbar,group:"navigation",order:10,when:ie.hasAgentSessionChanges},{id:D.AgentSessionItemToolbar,group:"navigation",order:0,when:x.and(ie.hasAgentSessionChanges,$p.negate())}]})}async run(i,e){let t=i.get(ia),o=i.get(ge),n=i.get(dl);if(!A.isUri(e)&&!gR(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(6410,null),resources:u}),s?.setRead(!0);return}await n.getEditingSession(r)?.show(),s?.setRead(!0)}};W(ett);async function ypo(a,i,e){let t=a.get(B),o=a.get(ct),r=a.get(At).getWidgetBySessionResource(i),l=a.get(Si).getSession(i);if(!l)return;let c=l.editingSession;if(!c)return;let u=l.getRequests(),p=u.findIndex(k=>k.id===e);if(p===-1)return;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(6402,null,Ye(v[0].modifiedURI)):S=d(6403,null,v.length):v.length===1?S=d(6398,null,Ye(v[0].modifiedURI)):S=d(6399,null,v.length);let y=b?await o.confirm({title:h===1?d(6404,null):d(6401,null,h),message:S,primaryButton:d(6400,null),checkbox:{label:d(6397,null),checked:!1},type:"info"}):{confirmed:!0};if(!y.confirmed){r?.viewModel?.model.setCheckpoint(void 0);return}y.checkboxChecked&&await t.updateValue("chat.editing.confirmEditRequestRemoval",!1);let w=u[p].id;await c.restoreSnapshot(w,void 0)}async function wpo(a,i){let e=Rr(i)?i.id:Vi(i)?i.requestId:void 0;e&&await ypo(a,i.sessionResource,e)}W(class extends K{constructor(){super({id:"workbench.action.chat.undoEdits",title:L(6409,"Undo Requests"),f1:!1,category:vi,icon:M.discard,keybinding:{primary:20,mac:{primary:2049},when:x.and(ie.inChatSession,ue.textInputFocus.negate(),ie.inChatQuestionCarousel.negate()),weight:200},menu:[{id:D.ChatMessageTitle,group:"navigation",order:2,when:x.and(x.equals("config.chat.editRequests","input").negate(),x.equals("config.chat.checkpoints.enabled",!1),ie.lockedToCodingAgent.negate())}]})}async run(i,...e){let t=e[0],o=i.get(At),n=i.get(B),r=hD(t)&&o.getWidgetBySessionResource(t.sessionResource)||o.lastFocusedWidget;!Vi(t)&&!Rr(t)&&(t=r?.getFocus()),t&&(await wpo(i,t),Rr(t)&&n.getValue("chat.undoRequests.restoreInput")&&(r?.focusInput(),r?.input.setValue(t.messageText,!1)))}});W(class extends K{constructor(){super({id:"workbench.action.chat.restoreCheckpoint",title:L(6405,"Restore Checkpoint"),tooltip:L(6407,"Restores workspace and chat to this point"),f1:!1,category:vi,keybinding:{primary:20,mac:{primary:2049},when:x.and(ie.inChatSession,ue.textInputFocus.negate(),ie.inChatQuestionCarousel.negate()),weight:200},menu:[{id:D.ChatMessageCheckpoint,group:"navigation",order:2,when:x.and(ie.isRequest,ie.lockedToCodingAgent.negate())}]})}async run(i,...e){let t=e[0],o=i.get(At),n=hD(t)&&o.getWidgetBySessionResource(t.sessionResource)||o.lastFocusedWidget;!Vi(t)&&!Rr(t)&&(t=n?.getFocus()),t&&(Rr(t)&&(n?.focusInput(),n?.input.setValue(t.messageText,!1)),n?.viewModel?.model.setCheckpoint(t.id),await wpo(i,t))}});W(class extends K{constructor(){super({id:"workbench.action.chat.restoreLastCheckpoint",title:L(6408,"Restore to Last Checkpoint"),f1:!0,category:vi,icon:M.discard,precondition:x.and(ie.inChatSession,x.equals("config.chat.checkpoints.enabled",!0),ie.lockedToCodingAgent.negate())})}async run(i,...e){let t=e[0],o=i.get(At),n=i.get(Si),r=hD(t)&&o.getWidgetBySessionResource(t.sessionResource)||o.lastFocusedWidget;!Vi(t)&&!Rr(t)&&(t=r?.getFocus());let s=r?.viewModel?.sessionResource??(hD(t)?t.sessionResource:void 0);if(!s)return;let l=n.getSession(s);if(!l?.editingSession)return;let c=l.checkpoint;if(!c){Jo(d(6406,null));return}r?.viewModel?.model.setCheckpoint(c.id),r?.focusInput(),r?.input.setValue(c.message.text,!1),await ypo(i,s,c.id)}});W(class extends K{constructor(){super({id:"workbench.action.chat.editRequests",title:L(6394,"Edit Request"),f1:!1,category:vi,icon:M.edit,keybinding:{primary:3,when:x.and(ie.inChatSession,ue.textInputFocus.negate()),weight:200},menu:[{id:D.ChatMessageTitle,group:"navigation",order:2,when:x.and(x.or(x.equals("config.chat.editRequests","hover"),x.equals("config.chat.editRequests","input")))}]})}async run(i,...e){let t=e[0],o=i.get(At),n=hD(t)&&o.getWidgetBySessionResource(t.sessionResource)||o.lastFocusedWidget;!Vi(t)&&!Rr(t)&&(t=n?.getFocus()),t&&Rr(t)&&n?.startEditing(t.id)}});W(class Cpo extends K{static{this.id="chat.openFileUpdatedBySnapshot"}constructor(){super({id:Cpo.id,title:d(6395,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 xpo extends K{static{this.id="chat.openFileSnapshot"}constructor(){super({id:xpo.id,title:d(6396,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(Si),n=i.get(dl),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(6411,null,Ye(t.uri)),options:{activation:1}});pn(c)&&c.updateOptions({readOnly:!0})}}});W(class extends bA{constructor(){super({id:"workbench.action.edits.addFilesFromReferences",title:L(6389,"Add Files From References"),f1:!1,category:vi,menu:{id:D.ChatInputSymbolAttachmentContext,group:"navigation",order:1,when:x.and(ie.chatModeKind.isEqualTo("ask"),ue.hasReferenceProvider)}})}async runEditingSessionAction(i,e,t,...o){if(o.length===0||!nv(o[0]))return;let n=i.get(Nt),r=i.get(zt),s=o[0],c=(await n.createModelReference(s.uri)).object.textEditorModel;if(!c)return;let u=new Ie(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)}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},ve.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,ve.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,ve.None)??[]))).flat()}});var Ame=class a extends bA{static{this.Id="chatEditing.viewPreviousEdits"}static{this.Label=d(6414,null)}constructor(){super({id:a.Id,title:{value:a.Label,original:a.Label},tooltip:a.Label,f1:!0,icon:M.diffMultiple,precondition:x.and(ie.enabled,Zx.negate()),menu:[{id:D.ChatEditingWidgetToolbar,group:"navigation",order:4,when:x.and(Yj.negate(),x.and(zce,Zx.negate()))}]})}async runEditingSessionAction(i,e,t,...o){await e.show(!0)}};W(Ame);qe.registerCommand("_chat.editSessions.accept",async(a,i)=>{if(i.length===0)return;let e=i.map(o=>A.revive(o)),t=a.get(dl);for(let o of t.editingSessionsObs.get())await o.accept(...e)});var QPe=class extends Oje{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?M.check.id:M.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=Pn(),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(),Ao(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(M.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})}};QPe=I([m(2,nl),m(3,_e),m(4,Te)],QPe);var r0=class extends oc{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=R(o,_("a.action-label")),this.renderLabel(this.element));this.actionWidgetDropdown=this._register(new QPe(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(yp().setupManagedHover(this.options.hoverDelegate??Ni("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)}};r0=I([m(2,nl),m(3,_e),m(4,X),m(5,Te)],r0);function AHt(a){let i=a.match(/(?:github\.com)[/:](?<owner>[^/]+)\/(?<repo>[^/.]+)/);if(i?.groups)return`${i.groups.owner}/${i.groups.repo}`}async function kpo(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 AHt(s[1].trim())}catch{}}var Qxi=class a extends K{static{this.ID="workbench.action.chat.continueChatInSession"}constructor(){super({id:a.ID,title:L(5459,"Continue Chat in..."),tooltip:d(5460,null),precondition:x.and(ie.enabled,ie.requestInProgress.negate(),ie.remoteJobCreating.negate(),ie.hasCanDelegateProviders),menu:[{id:D.ChatExecute,group:"navigation",order:3.4,when:x.and(ie.lockedToCodingAgent.negate(),ie.hasCanDelegateProviders)},{id:D.EditorContent,group:"continueIn",when:x.and(x.equals(Fo.Scheme.key,Y.untitled),x.equals(Fo.LangId.key,PE),x.notEquals(sR.key,0),mI.negate(),ie.hasCanDelegateProviders)}]})}async run(){}},Qee=class extends r0{constructor(e,t,o,n,r,s,l,c,u){super(e,{actionProvider:Qee.actionProvider(s,l,t),actionBarActions:Qee.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(5458,null),tooltip:d(5458,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:A_(e),class:void 0,description:`@${t.name}`,label:XS(e),tooltip:d(5463,null,XS(e)),category:{label:d(5461,null),order:0,showHeader:!0},run:()=>o.invokeFunction(r=>n==="editor"?new Xxi().run(r,t):new ttt().run(r,t))}}static toSetupAction(e,t){return{id:e,enabled:!0,icon:A_(e),class:void 0,label:XS(e),tooltip:d(5463,null,XS(e)),category:{label:d(5461,null),order:0,showHeader:!0},run:()=>t.invokeFunction(o=>o.get(ge).executeCommand(pI))}}renderLabel(e){if(this.location==="editor"){let t=bt("span.action-widget-delegate-label",[bt("span",{className:q.asClassName(M.forward)}),bt("span",[d(5462,null)])]);return e.appendChild(t.root),null}else{let t=this.contextKeyService.contextMatchesRules(ie.remoteJobCreating)?M.sync:M.forward;return e.classList.add(...q.asClassNameArray(t)),super.renderLabel(e)}}};Qee=I([m(2,nl),m(3,X),m(4,_e),m(5,Ls),m(6,F),m(7,Qe),m(8,Te)],Qee);var Yxi="workbench.action.chat.openNewSessionEditor",ttt=class{constructor(){}openUntitledEditor(i,e){i.executeCommand(`${Yxi}.${e.type}`)}async extractRepoNwoFromSession(i,e,t,o,n){let r=n.repoData;if(r?.remoteUrl){let l=AHt(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=AHt(h);if(f)return f}let g=l.workingDirectoryPath??l.repositoryPath??l.worktreePath;if(g){let f=await kpo(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=AHt(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(Xl(u)){let g=await kpo(u,t);if(g)return g}}}}}async run(i,e,t){let o=i.get(X),n=i.get(ge),r=i.get(At),s=i.get(br),l=i.get(Si),c=i.get(ee),u=i.get(ia),p=i.get(Ls),h=i.get(be),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 pe=c.activeTextEditorControl;if(pe){let de=pe.getModel(),se;de&&U6(de)&&(se=de.uri);let Se=pe.getSelection();se&&Se&&w.add({kind:"file",id:"vscode.implicit.selection",name:Ye(se),value:{uri:se,range:Se}})}}let k=e.type,T=$p.getValue(o),N=Rf(b);if(T&&N&&N!==k){let de=XI(f.viewContext)?`workbench.action.chat.openNewSessionSidebar.${k}`:`${Yxi}.${k}`,se=2e4,Se=S.map(Ve=>{let Fe=`User: ${Ve.message.text}`,Qt=Ve.response?.response?`Assistant: ${Ve.response.response.getMarkdown()}`:"";return Qt?`${Fe}
${Qt}`:Fe}).join(`

`);Se.length>se&&(Se=Se.substring(Se.length-se));let ke=Se?`The following is the conversation history from a previous ${XS(N)} session. Continue working on it.

${Se}

User: ${y}`:y,Ee=[],He=await this.extractRepoNwoFromSession(u,p,h,b,v);He&&Ee.push({optionId:"repositories",value:He}),await n.executeCommand(de,{prompt:ke,attachedContext:w.asArray(),initialSessionOptions:Ee.length>0?Ee:void 0});return}let O=s.getDefaultAgent("panel"),G=i.get(F).createInstance(AE).parseChatRequestWithReferences(WO(f),gz(f),y,"panel"),$=v.addRequest(G,{variables:w.asArray()},0,void 0,O);await l.removeRequest(b,$.id);let te=await l.sendRequest(b,y,{agentIdSilent:k,attachedContext:w.asArray(),userSelectedModelId:f.input.currentLanguageModel,...f.getModeRequestOptions()});Gj.isSent(te)&&await f.handleDelegationExitIfNeeded(O,te.data.agent)}catch(f){throw console.error("[Delegation] Error creating remote coding agent job",f),f}finally{g.set(!1)}}},Xxi=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||!U6(r))return;let s=r.uri,l=[mP(s,"vscode.prompt.file",void 0,!1,[])],c=`Follow instructions in [${Ye(s)}](${s.toString()}).`;await n.executeCommand(`${Yxi}.${e.type}`,{prompt:c,attachedContext:l})}catch(t){throw console.error("Error creating remote agent job from editor",t),t}}},PHt=class extends C{static{this.ID="chat.continueChatInSessionActionRendering"}constructor(i,e){super();let t=i.register(D.EditorContent,Qxi.ID,(o,n,r)=>{if(o instanceof Eo)return e.createInstance(Qee,o,"editor")});Mp(t)}};PHt=I([m(0,Yy),m(1,F)],PHt);var NHt=class extends K{async run(i,...e){let t=e[0],o=i.get(Te),n=i.get(At),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(ct),p=i.get(Si).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(5479,null,Ye(w[0].modifiedURI)):T=d(5480,null,w.length):w.length===1?T=d(5475,null,Ye(w[0].modifiedURI)):T=d(5476,null,w.length);let N=k?await c.confirm({title:b===1?d(5481,null):d(5478,null,b),message:T,primaryButton:d(5477,null),checkbox:{label:d(5474,null),checked:!1},type:"info"}):{confirmed:!0};if(N.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}N.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(Ls).getAllChatSessionContributions().find(s=>Rf(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 ttt().run(i,r,e)}},p9o=x.or(ie.requestInProgress,ie.Editing.hasToolConfirmation,ie.Editing.hasQuestionCarousel),m9o=x.and(ie.requestInProgress,ie.inputHasText.negate()),h9o=x.or(ie.Editing.hasToolConfirmation,x.and(ie.Editing.hasQuestionCarousel,ie.inputHasText.negate())),Epo=x.or(ie.Editing.hasQuestionCarousel.negate(),ie.inputHasText),YPe=ie.requestInProgress.negate(),SA=class a extends NHt{static{this.ID="workbench.action.chat.submit"}constructor(){let i=ie.chatModeKind.isEqualTo("ask"),e=x.and(ie.inputHasText,YPe,ie.chatSessionOptionsValid);super({id:a.ID,title:L(5494,"Send"),f1:!1,category:vi,icon:M.arrowUp,precondition:e,toggled:{condition:ie.lockedToCodingAgent,icon:M.arrowUp,tooltip:d(5499,null)},keybinding:{when:x.and(ie.inChatInput,ie.withinEditSessionDiff.negate()),primary:3,weight:100},menu:[{id:D.ChatExecute,order:4,when:x.and(YPe,i,ie.withinEditSessionDiff.negate(),Epo),group:"navigation",alt:{id:"workbench.action.chat.sendToNewChat",title:L(5473,"Send to New Chat"),icon:M.plus}},{id:D.ChatEditorInlineExecute,group:"navigation",order:4,when:x.and(x.or(mI.negate(),ie.inputHasText),YPe,ie.requestInProgress.negate(),i)}]})}},aki="workbench.action.chat.toggleAgentMode",Jxi=class a extends K{static{this.ID=aki}constructor(){super({id:a.ID,title:L(5497,"Switch to Next Agent"),f1:!0,category:vi,precondition:x.and(ie.enabled,ie.requestInProgress.negate())})}async run(i,...e){let t=i.get(ge),o=i.get(F),n=i.get(Pv),r=i.get(Te),s=i.get(At),l=e.at(0),c;if(l?.sessionResource?c=s.getWidgetBySessionResource(l.sessionResource):c=Nme(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(get,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?oBt(w):void 0;r.publicLog2("chat.modeChange",{fromMode:t3(g),mode:t3(h),requestCount:p,storage:v,extensionId:b,toolsCount:S,handoffsCount:y,isClaudeAgent:k}),c.input.setChatMode(h.id),f.needToClearSession&&await t.executeCommand(im)}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]}},Zxi=class a extends K{static{this.ID="workbench.action.chat.switchToNextModel"}constructor(){super({id:a.ID,title:L(5496,"Switch to Next Model"),category:vi,f1:!0,precondition:ie.enabled})}run(i,...e){i.get(At).lastFocusedWidget?.input.switchToNextModel()}},Ome=class a extends K{static{this.ID="workbench.action.chat.openModelPicker"}constructor(){super({id:a.ID,title:L(5489,"Open Model Picker"),category:vi,f1:!1,keybinding:{primary:2649,weight:200,when:ie.inChatInput},precondition:ie.enabled,menu:{id:D.ChatInput,order:3,group:"navigation",when:x.and(x.or(ie.lockedToCodingAgent.negate(),ie.chatSessionHasTargetedModels),x.or(x.equals(ie.location.key,"panel"),x.equals(ie.location.key,"editor"),x.equals(ie.location.key,"notebook"),x.equals(ie.location.key,"terminal")),x.or(ie.inAgentSessionsWelcome.negate(),ie.chatSessionHasTargetedModels,ie.agentSessionType.isEqualTo("local")))}})}async run(i,...e){let t=i.get(At),o=t.lastFocusedWidget;o&&(await t.reveal(o),o.input.openModelPicker())}},itt=class a extends K{static{this.ID="workbench.action.chat.openPermissionPicker"}constructor(){super({id:a.ID,title:L(5491,"Open Permission Picker"),tooltip:d(5501,null),category:vi,f1:!1,precondition:ie.enabled,menu:{id:D.ChatInputSecondary,order:10,group:"navigation",when:x.and(ie.enabled,ie.location.isEqualTo("panel"),ie.chatModeKind.notEqualsTo("ask"),ie.inQuickChat.negate(),ie.lockedToCodingAgent.negate(),$p.negate())}})}async run(i){let t=i.get(At).lastFocusedWidget;t&&t.input.openPermissionPicker()}},Fme=class a extends K{static{this.ID="workbench.action.chat.openModePicker"}constructor(){super({id:a.ID,title:L(5490,"Open Agent Picker"),tooltip:d(5500,null),category:vi,f1:!1,precondition:ie.enabled,keybinding:{when:x.and(ie.inChatInput,ie.location.isEqualTo("panel")),primary:2137,weight:100},menu:[{id:D.ChatInput,order:1,when:x.and(ie.enabled,ie.location.isEqualTo("panel"),ie.inQuickChat.negate(),x.or(ie.lockedToCodingAgent.negate(),ie.chatSessionHasCustomAgentTarget),x.or(ie.inAgentSessionsWelcome.negate(),ie.chatSessionHasCustomAgentTarget,ie.agentSessionType.isEqualTo("local"))),group:"navigation"}]})}async run(i,...e){let o=i.get(At).lastFocusedWidget;o&&o.input.openModePicker()}},Yee=class a extends K{static{this.ID="workbench.action.chat.openSessionTargetPicker"}constructor(){super({id:a.ID,title:L(5492,"Open Session Target Picker"),tooltip:d(5502,null),category:vi,f1:!1,precondition:x.and(ie.enabled,x.or(ie.chatSessionIsEmpty,ie.inAgentSessionsWelcome),ie.currentlyEditingInput.negate(),ie.currentlyEditing.negate()),menu:[{id:D.ChatInput,order:0,when:x.and(ie.enabled,ie.location.isEqualTo("panel"),ie.inQuickChat.negate(),ie.chatSessionIsEmpty,$p),group:"navigation"},{id:D.ChatInputSecondary,order:0,when:x.and(ie.enabled,ie.location.isEqualTo("panel"),ie.inQuickChat.negate(),$p.negate(),ie.chatSessionIsEmpty),group:"navigation"}]})}async run(i,...e){let o=i.get(At).lastFocusedWidget;o&&o.input.openSessionTargetPicker()}},XPe=class a extends K{static{this.ID="workbench.action.chat.openDelegationPicker"}constructor(){super({id:a.ID,title:L(5488,"Open Delegation Picker"),tooltip:d(5482,null),category:vi,f1:!1,precondition:x.and(ie.enabled,ie.chatSessionIsEmpty.negate(),ie.currentlyEditingInput.negate(),ie.currentlyEditing.negate()),menu:[{id:D.ChatInput,order:.5,when:x.and(ie.enabled,ie.location.isEqualTo("panel"),ie.inQuickChat.negate(),ie.chatSessionIsEmpty.negate(),$p),group:"navigation"},{id:D.ChatInputSecondary,order:.5,when:x.and(ie.enabled,ie.location.isEqualTo("panel"),ie.inQuickChat.negate(),ie.chatSessionIsEmpty.negate(),$p.negate()),group:"navigation"}]})}async run(i,...e){let o=i.get(At).lastFocusedWidget;o&&o.input.openDelegationPicker()}},JPe=class a extends K{static{this.ID="workbench.action.chat.openWorkspacePicker"}constructor(){super({id:a.ID,title:L(5493,"Open Workspace Picker"),tooltip:d(5498,null),category:vi,f1:!1,precondition:x.and(ie.enabled,ie.inAgentSessionsWelcome),menu:[{id:D.ChatInput,order:.6,when:x.and(ie.inAgentSessionsWelcome,ie.chatSessionType.isEqualTo("local"),$p),group:"navigation"},{id:D.ChatInputSecondary,order:.6,when:x.and(ie.inAgentSessionsWelcome,ie.chatSessionType.isEqualTo("local"),$p.negate()),group:"navigation"}]})}async run(i,...e){}},ott=class a extends K{static{this.ID="workbench.action.chat.chatSessionPrimaryPicker"}constructor(){super({id:a.ID,title:L(5487,"Open Primary Session Picker"),category:vi,f1:!1,precondition:ie.enabled,menu:{id:D.ChatInput,order:4,group:"navigation",when:x.and(ie.chatSessionHasModels,x.or(ie.lockedToCodingAgent,x.and(ie.inAgentSessionsWelcome,ie.chatSessionType.notEqualsTo("local"))))}})}async run(i,...e){let o=i.get(At).lastFocusedWidget;o&&o.input.openChatSessionPicker()}},g9o="workbench.action.chat.changeModel",eki=class a extends K{static{this.ID=g9o}constructor(){super({id:a.ID,title:L(5486,"Change Model"),category:vi,f1:!1,precondition:ie.enabled})}run(i,...e){let t=e[0];So(typeof t.vendor=="string"&&typeof t.id=="string"&&typeof t.family=="string");let n=i.get(At).getAllWidgets();for(let r of n)r.input.switchModel(t)}},tki=class a extends NHt{static{this.ID="workbench.action.edits.submit"}constructor(){let i=x.and(x.or(YPe,ie.editingRequestType.isEqualTo(ie.EditingRequestType.Sent)),ie.editingRequestType.notEqualsTo(ie.EditingRequestType.QueueOrSteer)),e=ie.chatModeKind.notEqualsTo("ask"),t=x.and(ie.inputHasText,i,ie.chatSessionOptionsValid);super({id:a.ID,title:L(5483,"Send"),f1:!1,category:vi,icon:M.arrowUp,precondition:t,menu:[{id:D.ChatExecute,order:4,when:x.and(i,e,Epo),group:"navigation",alt:{id:"workbench.action.chat.sendToNewChat",title:L(5473,"Send to New Chat"),icon:M.plus}}]})}},iki=class a extends K{static{this.ID="workbench.action.chat.submitWithoutDispatching"}constructor(){let i=x.and(ie.inputHasText,YPe,ie.chatModeKind.isEqualTo("ask"));super({id:a.ID,title:L(5495,"Send"),f1:!1,category:vi,precondition:i,keybinding:{when:ie.inChatInput,primary:1539,weight:100}})}run(i,...e){let t=e[0],o=i.get(At);(t?.widget??o.lastFocusedWidget)?.acceptInput(t?.inputValue,{noCommandDetection:!0})}},oki=class a extends K{static{this.ID="workbench.action.chat.submitWithCodebase"}constructor(){let i=x.and(ie.inputHasText,YPe);super({id:a.ID,title:L(5472,"Send with {0}",`${su}codebase`),precondition:i,keybinding:{when:ie.inChatInput,primary:2051,weight:100}})}run(i,...e){let t=e[0],o=i.get(At),n=t?.widget??o.lastFocusedWidget;if(!n)return;let s=i.get(jn).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())}},nki=class extends K{constructor(){let i=ie.inputHasText;super({id:"workbench.action.chat.sendToNewChat",title:L(5473,"Send to New Chat"),precondition:i,category:vi,f1:!1,keybinding:{weight:200,primary:3075,when:ie.inChatInput}})}async run(i,...e){let t=e[0],o=i.get(At),n=i.get(Ft),r=i.get(ct),s=i.get(Si),l=t?.widget??o.lastFocusedWidget;if(!l)return;let c=l.getInput();l.viewModel&&s.cancelCurrentRequestForSession(l.viewModel.sessionResource,"newSessionAction"),!(l.viewModel?.model&&!await het(l.viewModel.model,void 0,r))&&(l.setInput(""),await yBt(l,n),l.acceptInput(c,{storeToHistory:!0}))}},ntt="workbench.action.chat.cancel",rki=class a extends K{static{this.ID=ntt}constructor(){super({id:a.ID,title:L(5484,"Cancel"),f1:!1,category:vi,icon:M.stopCircle,menu:[{id:D.ChatExecute,when:x.and(x.or(m9o,h9o),ie.remoteJobCreating.negate(),ie.currentlyEditing.negate()),order:4,group:"navigation"},{id:D.ChatEditorInlineExecute,when:x.and(WMe.negate(),EB,FZe.negate()),order:4,group:"navigation"}],keybinding:{weight:200,primary:2057,when:x.and(p9o,ie.remoteJobCreating.negate()),win:{primary:513}}})}run(i,...e){let t=e[0],o=i.get(At),n=i.get(ne),r=i.get(Te),s=t?.widget??o.lastFocusedWidget;if(!s){r.publicLog2(j8e,{source:"cancelAction",reason:"noWidget",requestInProgress:"unknown",pendingRequests:0}),n.info("ChatCancelAction#run: No focused chat widget was found");return}let l=i.get(Si);s.viewModel?l.cancelCurrentRequestForSession(s.viewModel.sessionResource,"cancelAction"):(r.publicLog2(j8e,{source:"cancelAction",reason:"noViewModel",requestInProgress:"unknown",pendingRequests:0}),n.info("ChatCancelAction#run: Canceled chat widget has no view model"))}},f9o="workbench.edit.chat.cancel",ski=class a extends K{static{this.ID=f9o}constructor(){super({id:a.ID,title:L(5485,"Cancel Edit"),f1:!1,category:vi,icon:M.x,menu:[{id:D.ChatMessageTitle,group:"navigation",order:1,when:x.and(ie.isRequest,ie.currentlyEditing,x.equals("config.chat.editRequests","input"))}],keybinding:{primary:9,when:x.and(ie.inChatInput,ue.hoverVisible.toNegated(),ue.hasNonEmptySelection.toNegated(),ue.hasMultipleSelections.toNegated(),x.or(ie.currentlyEditing,ie.currentlyEditingInput)),weight:95}})}run(i,...e){let t=e[0],o=i.get(At),n=t?.widget??o.lastFocusedWidget;n&&n.finishedEditing()}};function Tpo(){W(SA),W(tki),W(iki),W(rki),W(nki),W(oki),W(Jxi),W(Zxi),W(Ome),W(itt),W(Fme),W(Yee),W(XPe),W(JPe),W(ott),W(eki),W(ski)}function PB(a){return(i,e,t)=>new rtt(a,i,e,t)}var rtt=class extends CM{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 Pu(void 0,`storage/${e.key}`,void 0),s,hf,Il.ofCaller());this.opts=e;this.storageScope=t;this.storageTarget=o;this.storageService=n;this._store=new P;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()}};rtt=I([m(3,le)],rtt);var _po=/^[\w\/\.-]+$/;function OHt(a,i){switch(i){case"'":return`'${a}'`;case'"':return`"${a}"`}return _po.test(a)?a:`'${a}'`}function Dpo(a,i){let e=a.items.find(o=>o.type==="scalar"&&_po.test(o.value)),t=e?i.getValueInRange(e.range).charAt(0):void 0;return t==="'"||t==='"'?t:""}var p2=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(Hi.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=>OHt(l)).join(", "),s=o?r:`[${r}]`;this.rewriteAttribute(i,s,t)}rewriteAttribute(i,e,t){i.pushStackElement(),i.pushEditOperations(null,[An.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(Hi.name);s&&(s.value.type==="scalar"&&s.value.value===e||(o.setSelection(s.range),this.rewriteAttribute(n,e,s.value.range)))}};p2=I([m(0,Kt),m(1,nr),m(2,jn)],p2);var Wme;(n=>{function a(r){let s=new Map,l=new Map;for(let[c,u]of r.entries())Km(c)?s.set(c.id,u):l.set(c.id,u);return{toolSets:s,tools:l}}n.fromMap=a;function i(r){return yi(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 yi(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})(Wme||={});var ZPe=class extends C{constructor(e,t,o,n,r){super();this._mode=e;this.languageModel=t;this._toolsService=o;this._instantiationService=r;this._sessionStates=new w$;this.entriesMap=Ce(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=Wme.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=Ce(e=>{let t={},o=this.entriesMap.read(e);for(let[n,r]of o)Km(n)||(t[n.id]=r);return t});let s=PB({key:"chat/selectedTools",defaultValue:{toolSets:new Map,tools:new Map},fromStorage:Wme.fromStorage,toStorage:Wme.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,Wme.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,Wme.fromMap(e));return}this._globalState.set(Wme.fromMap(e),void 0)}async updateCustomModeTools(e,t){await this._instantiationService.createInstance(p2).openAndRewriteTools(e,t,ve.None)}};ZPe=I([m(2,jn),m(3,le),m(4,F)],ZPe);var v9o=/("[^"\\]*(?:\\.[^"\\]*)*")|('[^'\\]*(?:\\.[^'\\]*)*')|(\/\*[^\/\*]*(?:(?:\*|\/)[^\/\*]*)*?\*\/)|(\/{2,}.*?(?:(?:\r?\n)|$))|(,\s*[}\]])/g;function b9o(a){return a.replace(v9o,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 xk(a){let i=b9o(a);try{return JSON.parse(i)}catch{let t=i.replace(/,\s*([}\]])/g,"$1");return JSON.parse(t)}}var lki=[],cki=[],Lpo="vscode://schemas/toolsets",S9o={id:Lpo,allowComments:!0,allowTrailingCommas:!0,defaultSnippets:[{label:d(7080,null),body:{"${1:toolSetName}":{tools:["${2:someTool}","${3:anotherTool}"],description:"${4:description}",icon:"${5:tools}"}}}],type:"object",description:d(7085,null),additionalProperties:{type:"object",required:["tools"],additionalProperties:!1,properties:{tools:{description:d(7083,null),type:"array",minItems:1,items:{type:"string",enum:lki,enumDescriptions:cki}},icon:{description:d(7082,null),type:"string",enum:Array.from(k$(),a=>a.id),markdownEnumDescriptions:Array.from(k$(),a=>`$(${a.id})`)},description:{description:d(7081,null),type:"string"}}}},I9o=oe.as(ea.JSONContribution),stt=class a{static{this.suffix=".toolsets.jsonc"}static isToolSetFileName(i){return Ye(i).endsWith(a.suffix)}static from(i,e){if(!yi(i))throw new Error("Invalid tool set data");let t=new Map;for(let[o,n]of Object.entries(i))Jl(o)&&e.error("Tool set name cannot be empty"),JA(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))}},Vme=class extends C{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 P);this._store.add(he(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:Rn.classify(f.source).label,sourceOrdinal:Rn.classify(f.source).ordinal,description:f.userDescription??f.modelDescription});for(let f of h)g.push({name:f.referenceName,sourceLabel:Rn.classify(f.source).label,sourceOrdinal:Rn.classify(f.source).ordinal,description:f.description});lki.length=0,cki.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)lki.push(f.name),cki.push(d(7084,null,f.sourceLabel,f.name,f.description));c.clear(),I9o.registerSchema(Lpo,S9o,c)}))}static{this.ID="chat.userToolSets"}_initToolSets(){let e=ui(this,this._userDataProfileService.onDidChangeCurrentProfile,()=>this._userDataProfileService.currentProfile.promptsHome),t=Nr(this,this._languageModelToolsService.onDidChangeTools),o=Nr(this,H.filter(this._fileService.onDidFilesChange,s=>s.affects(e.get()))),n=this._store.add(new P),r=async s=>{try{return(await this._fileService.resolve(s)).children??[]}catch{return[]}};this._store.add(he(async s=>{n.clear(),t.read(s),o.read(s);let l=e.read(s),c=new $e;n.add(Z(()=>c.dispose(!0)));let u=await r(l);if(!c.token.isCancellationRequested)for(let p of u){if(!p.isFile||!stt.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=xk(g.value.toString());h=stt.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:Ye(p.resource)},`user/${p.resource.toString()}/${g}`,g,{icon:f.icon?q.fromId(f.icon):void 0,description:f.description});Ui(y=>{n.add(S),v.forEach(w=>n.add(S.addTool(w,y))),b.forEach(w=>n.add(S.addToolSet(w,y)))})}}}))}};Vme=I([m(0,lt),m(1,ao),m(2,jn),m(3,mn),m(4,be),m(5,ne)],Vme);var eAe=class a extends K{static{this.ID="chat.configureToolSets"}constructor(){super({id:a.ID,title:L(7075,"Configure Tool Sets..."),shortTitle:d(7078,null),category:vi,f1:!0,precondition:x.and(ie.enabled,ie.Tools.toolsCount.greater(0)),menu:{id:fy,when:x.equals("view",Vr),order:11,group:"2_level"}})}async run(i){let e=i.get(jn),t=i.get(Ge),o=i.get(ee),n=i.get(mn),r=i.get(be),s=i.get(Ho),l=[];l.push({label:d(7076,null),alwaysShow:!0,iconClass:q.asClassName(M.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(7077,null)});if(!c)return;let u;if(c.toolset)So(c.toolset.source.type==="user"),u=c.toolset.source.file;else{let p=await t.input({placeHolder:d(7079,null),validateInput:async h=>{if(!h)return d(7073,null);if(!nU(h))return d(7074,null,h)}});if(Jl(p))return;u=je(n.currentProfile.promptsHome,`${p}${stt.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 w9o(a){return a.itemType==="bucket"}function FHt(a){return a.itemType==="toolset"}function att(a){return a.itemType==="tool"}function C9o(a){return a.itemType==="callback"}function Mpo(a,i=!1){return a?q.isThemeIcon(a)?{iconClass:q.asClassName(a)}:{iconPath:a}:i?{iconClass:q.asClassName(M.tools)}:{}}function Rpo(a,i){let e=Mpo(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 x9o(a,i,e){let t=Mpo(a.icon),o=[];if(a.source.type==="user"){let n=a.source.file;o.push({iconClass:q.asClassName(M.edit),tooltip:d(5586,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 WHt(a,i,e,t,o,n,r){let s=a.get(Ge),l=a.get(es),c=a.get(md),u=a.get(ge),p=a.get(zi),h=a.get(ee),g=a.get(Nf),f=a.get(jn),v=a.get(gD),b=a.get(Te),S=new Map;for(let te of l.servers.get())for(let pe of te.tools.get())S.set(pe.id,te);function y(te){let pe=o?new Map([...o()].map(([Fe,Qt])=>[Fe.id,Qt])):void 0;if(!pe){let Fe=new Map;for(let Qt of f.getTools(n))Qt.canBeReferencedInPrompt&&Fe.set(Qt,!1);for(let Qt of f.getToolSetsForModel(n))Fe.set(Qt,!1);pe=Fe}te?.forEach((Fe,Qt)=>{pe.set(Qt.id,Fe)});let de=[],se=new Map,Se=Fe=>{switch(Fe.type){case"mcp":case"extension":return Rn.toKey(Fe);case"internal":return 1 .toString();case"user":return 0 .toString();case"external":throw new Error("should not be reachable");default:Hr(Fe)}},ke=new Map(l.servers.get().map(Fe=>[Fe.definition.id,{server:Fe,seen:!1}])),Ee=(Fe,Qt)=>{if(Fe.type==="mcp"){let Ze=ke.get(Fe.definitionId);if(!Ze)return;Ze.seen=!0;let Ti=Ze.server,ti=[],bo=c.collections.get().find(Ws=>Ws.id===Ti.collection.id);bo?.source?ti.push({iconClass:q.asClassName(M.settingsGear),tooltip:d(5582,null,bo.label),action:()=>bo.source?bo.source instanceof Ei?p.open(bo.source.value,{tab:"features",feature:"mcp"}):g.open(bo.source,{tab:"configuration"}):void 0}):bo?.presentation?.origin&&ti.push({iconClass:q.asClassName(M.settingsGear),tooltip:d(5582,null,bo.label),action:()=>h.openEditor({resource:bo.presentation.origin})}),Ti.connectionState.get().state===ir.Kind.Error&&ti.push({iconClass:q.asClassName(M.warning),tooltip:d(5588,null),action:()=>Ti.showOutput()});let Ro=Ti.cacheState.get(),_o=[],sr=!0;(Ro===0||Ro===2)&&(sr=!1,_o.push({itemType:"callback",iconClass:q.asClassName(M.sync),label:d(5589,null),pickable:!1,run:()=>(k.busy=!0,(async()=>{if(!await n0(Ti,{promptType:"all-untrusted"})){Ti.showOutput(),k.hide();return}k.busy=!1,y(T())})(),!1)}));let ln={itemType:"bucket",ordinal:2,id:Qt,label:Fe.label,checked:void 0,collapsed:sr,children:_o,buttons:ti,sortOrder:2},en=Ti.serverMetadata.get()?.icons.getUrl(22);return en?ln.iconPath=en:ln.iconClass=q.asClassName(M.mcp),ln}else return Fe.type==="extension"?{itemType:"bucket",ordinal:3,id:Qt,label:Fe.label,checked:void 0,children:[],buttons:[],collapsed:!0,iconClass:q.asClassName(M.extensions),sortOrder:3}:Fe.type==="internal"?{itemType:"bucket",ordinal:1,id:Qt,label:d(5585,null),checked:void 0,children:[],buttons:[],collapsed:!1,sortOrder:1}:{itemType:"bucket",ordinal:0,id:Qt,label:d(5591,null),checked:void 0,children:[],buttons:[],collapsed:!0,sortOrder:4}},He=Fe=>{let Qt=Se(Fe),Ze=se.get(Qt);return Ze||(Ze=Ee(Fe,Qt),Ze&&se.set(Qt,Ze)),Ze};for(let Fe of f.getToolSetsForModel(n)){if(!pe.has(Fe.id))continue;let Qt=He(Fe.source);if(!Qt)continue;let Ze=pe.get(Fe.id)===!0;if(Fe.source.type==="mcp")Qt.toolset=Fe,Ze&&(Qt.checked=Ze);else{let Ti=x9o(Fe,Ze,h);Qt.children.push(Ti);let ti=[];for(let bo of Fe.getTools()){let Ro=Ze||pe.get(bo.id)===!0,_o=Rpo(bo,Ro);ti.push(_o)}ti.length>0&&(Ti.children=ti)}}for(let Fe of f.getAllToolsIncludingDisabled()){if(!Fe.canBeReferencedInPrompt||!pe.has(Fe.id))continue;let Qt=He(Fe.source);if(!Qt)continue;let Ze=Qt.checked===!0||pe.get(Fe.id)===!0,Ti=Rpo(Fe,Ze);Qt.children.push(Ti)}for(let{server:Fe,seen:Qt}of ke.values()){let Ze=Fe.cacheState.get();!Qt&&(Ze===0||Ze===2)&&He({type:"mcp",definitionId:Fe.definition.id,label:Fe.definition.label,instructions:"",serverLabel:"",collectionId:Fe.collection.id})}let Ve=Array.from(se.values()).sort((Fe,Qt)=>Fe.sortOrder!==Qt.sortOrder?Fe.sortOrder-Qt.sortOrder:Fe.label.localeCompare(Qt.label));for(let Fe of Ve){de.push(Fe),Fe.children.sort((Qt,Ze)=>Qt.label.localeCompare(Ze.label));for(let Qt of Fe.children)FHt(Qt)&&Qt.children&&Qt.children.sort((Ze,Ti)=>Ze.label.localeCompare(Ti.label))}for(let Fe of Ve){let Qt=Fe.ordinal===2,Ze=Ti=>{if(!v.toolCanManageConfirmation(Ti.tool))return;let ti=Ti.tool,bo=Qt?Fe.children.flatMap(_o=>att(_o)?[_o.tool]:FHt(_o)&&_o.children?_o.children.filter(att).map(sr=>sr.tool):[]):[ti],Ro=Ti.buttons?[...Ti.buttons]:[];Ro.push({iconClass:q.asClassName(M.pass),tooltip:d(5587,null),keepOpen:!0,action:()=>v.manageConfirmationPreferences(bo,{focusToolId:ti.id})}),Ti.buttons=Ro};for(let Ti of Fe.children)if(att(Ti))Ze(Ti);else if(FHt(Ti)&&Ti.children)for(let ti of Ti.children)att(ti)&&Ze(ti)}de.length===0?k.placeholder=d(5590,null):k.placeholder=i,k.setItemTree(de)}let w=new P,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(te=>{te.button&&typeof te.button.action=="function"&&(te.button.action(),w.dispose())}));let T=()=>{let te=new Map,pe=de=>{for(let se of de)if(w9o(se)){if(se.toolset){let Se=se.checked===!0;te.set(se.toolset,Se)}pe(se.children)}else FHt(se)?(te.set(se.toolset,se.checked===!0),se.children&&pe(se.children)):att(se)&&te.set(se.tool,se.checked||te.get(se.tool)===!0)};return pe(k.itemTree),te},N=!1,O=w.add(new E);w.add(k.onDidAccept(()=>{let pe=k.activeItems.find(C9o);if(!pe){N=!0,k.hide();return}pe.run()!==!1&&O.fire()}));let V={iconClass:q.asClassName(M.mcp),tooltip:d(5581,null)},U={iconClass:q.asClassName(M.extensions),tooltip:d(5580,null)},G={iconClass:q.asClassName(M.gear),tooltip:d(5583,null)};k.title=d(5584,null),k.buttons=[V,U,G],w.add(k.onDidTriggerButton(te=>{te===V?u.executeCommand("workbench.mcp.addConfiguration"):te===U?p.openSearch("@tag:language-model-tools"):te===G&&u.executeCommand(eAe.ID),k.hide()})),r&&w.add(r.onCancellationRequested(()=>{k.hide()}));let $=T();return k.show(),await Promise.race([H.toPromise(H.any(k.onDidHide,O.event),w)]),T9o(e,b,$,T(),c),w.dispose(),N?T():void 0}function k9o(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 Ei?{category:"extension-mcp",extensionId:t.source.value}:{category:"user-mcp"}}case"user":return{category:"user-toolset"};case"external":return{category:"user-toolset"};default:Hr(e)}}function E9o(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=k9o(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 T9o(a,i,e,t,o){let n=E9o(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 D3="workbench.action.chat.acceptTool",ctt="workbench.action.chat.skipTool",Ppo="workbench.action.chat.acceptToolPostExecution",Apo="workbench.action.chat.skipToolPostExecution",VHt=class extends K{run(i,e){let t=i.get(At),o=e?.sessionResource?t.getWidgetBySessionResource(e.sessionResource):t.lastFocusedWidget,n=o?.viewModel?.getItems().at(-1);if(Vi(n)){for(let r of n.model.response.value){let s=r.kind==="toolInvocation"?r.state.get():void 0;if(s?.type===lo.StateKind.WaitingForConfirmation||s?.type===lo.StateKind.WaitingForPostApproval){s.confirm(this.getReason());break}}o?.focusInput()}}},dki=class extends VHt{constructor(){super({id:D3,title:L(5569,"Accept"),f1:!1,category:vi,keybinding:{when:x.and(ie.inChatSession,ie.Editing.hasToolConfirmation),primary:2051,weight:201}})}getReason(){return{type:4}}},uki=class extends VHt{constructor(){super({id:ctt,title:L(5570,"Skip"),f1:!1,category:vi,keybinding:{when:x.and(ie.inChatSession,ie.Editing.hasToolConfirmation),primary:2563,weight:201}})}getReason(){return{type:5}}},ltt=class a extends K{static{this.ID="workbench.action.chat.configureTools"}constructor(){super({id:a.ID,title:d(5579,null),icon:M.settings,f1:!1,category:vi,precondition:ie.chatModeKind.isEqualTo("agent"),menu:[{when:x.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(At),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(5578,null),c=d(5574,null);break;case 2:l=d(5575,null),c=d(5571,null,r.input.currentModeObs.get().label.get());break;case 3:l=d(5577,null),c=d(5573,null,r.input.currentModeObs.get().label.get());break;case 0:l=d(5576,null),c=d(5572,null);break}let h=new $e,g=r.input.currentModeObs.get(),f=he(b=>{g.id!==r.input.currentModeObs.read(b).id&&h.cancel()});try{let b=await t.invokeFunction(WHt,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:ht.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 Npo(){W(dki),W(uki),W(ltt)}var Nv=class a extends C{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=lo.executionConfirmedOrDenied(e);return t?.type===5?M.circleSlash:t?.type===0?M.error:lo.isComplete(e)?M.check:q.modify(M.loading,"spin")}};var Bme=class extends Nv{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(d2,l));R(this.domNode,c.domNode);let u=i.state.get();if(u.type===lo.StateKind.WaitingForConfirmation){let p=d(7264,null),h=t.appendKeybinding(p,D3),g=d(7265,null),f=t.appendKeybinding(g,ntt),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(Kee,e,{title:u.confirmationMessages?.title??d(7266,null),message:u.confirmationMessages?.message??d(7267,null),buttons:b}));this._confirmWidget=S,R(this.domNode,S.domNode),this._register(S.onDidClick(k=>{lo.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=>Ot({id:T},k.identifier))&&(w.dispose(),v.fire(!1))}))}}};Bme=I([m(2,_e),m(3,X),m(4,At),m(5,ls),m(6,F)],Bme);var _9o=100,Xee=class extends C{constructor(e,t,o,n){super();this._instantiationService=t;this._contextMenuService=o;this._fileService=n;let r=bt(".chat-collapsible-io-resource-group",[bt(".chat-collapsible-io-resource-items@items"),bt(".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&&X4(u.mimeType))if(u.base64Value)n.push({kind:"file",id:_t(),name:Ye(u.uri),fullName:u.uri.path,value:u.uri}),r.push({index:c,part:u});else if(u.value)n.push({kind:"image",id:_t(),name:Ye(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:_t(),name:Ye(u.uri),value:p,mimeType:u.mimeType,isURL:!1,references:[{kind:"reference",reference:u.uri}]}):n.push({kind:"file",id:_t(),name:Ye(u.uri),fullName:u.uri.path,value:u.uri})}else n.push({kind:"file",id:_t(),name:Ye(u.uri),fullName:u.uri.path,value:u.uri})}if(this._store.isDisposed)return;let s=this._register(this._instantiationService.createInstance(Nee,{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);let l=this._register(this._instantiationService.createInstance(Ln,o,D.ChatToolOutputResourceToolbar,{menuOptions:{shouldForwardArgs:!0}}));l.context={parts:e},r.length>0&&this._register(nn(()=>{for(let{index:c,part:u}of r)try{let p=Sl(u.base64Value).buffer;n[c]={kind:"image",id:_t(),name:Ye(u.uri),value:p,mimeType:u.mimeType,isURL:!1,references:[{kind:"reference",reference:u.uri}]}}catch{}s.updateVariables(n)},_9o))}};Xee=I([m(1,F),m(2,ze),m(3,be)],Xee);var pki=class a extends K{static{this.ID="chat.toolOutput.save"}constructor(){super({id:a.ID,title:L(7183,"Save..."),icon:M.cloudDownload,menu:[{id:D.ChatToolOutputResourceToolbar,group:"navigation",order:1},{id:D.ChatToolOutputResourceContext}]})}async run(i,e){let t=i.get(dn),o=i.get(be),n=i.get(Ne),r=i.get(Bo),s=i.get(Pe),l=i.get(ge),c=i.get(ot),u=await t.defaultFilePath(),p=async(g,f,v)=>{let b=f?je(v,Ye(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(7184,null,Ye(g.uri),S))}},h=async(g,f)=>{await r.withProgress({location:15,delay:5e3,title:d(7185,null)},async v=>{for(let b of f)await b(),v.report({increment:1,total:f.length})}),s.isInsideWorkspace(g)?l.executeCommand(JF,g):n.info(d(7186,null,c.getUriLabel(g)))};if(e.parts.length===1){let g=e.parts[0],f=await t.pickFileToSave(je(u,Ye(g.uri)));if(!f)return;await h(f,[()=>p(g,!1,f)])}else{let g=await t.showOpenDialog({title:d(7187,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(pki);var L3=class extends C{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 xe("").appendText(e):new xe(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(Xee,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))}};L3=I([m(2,F),m(3,X),m(4,Qn),m(5,Ct),m(6,kt)],L3);var Jee=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super();this.context=n;this.input=r;this.output=s;this.contextKeyService=u;this._instantiationService=p;this.modelService=g;this.languageService=f;this.chatMarkdownAnchorService=v;this.configurationService=b;this._editorReferences=[];this._contentInitialized=!1;let S=bt(".chat-confirmation-widget-container"),y=bt(".chat-confirmation-widget-title-inner"),w=bt(".chat-confirmation-widget");this.domNode=S.root,S.root.appendChild(w.root),this._titlePart=this._register(p.createInstance(u2,y.root,e,t)),Ck(y.root,this._instantiationService,this.chatMarkdownAnchorService,this._store);let k=document.createElement("span");k.style.flexGrow="1";let T=this._register(new oO(w.root,{}));T.element.classList.add("chat-confirmation-widget-title","monaco-text-button"),T.labelElement.append(y.root);let N=_("span.chat-collapsible-hover-chevron.codicon.codicon-chevron-right");N.setAttribute("aria-hidden","true"),T.element.appendChild(N);let O=pr("accessibility.chat.showCheckmarks",!1,this.configurationService),V=this._expanded=Le(this,c);this._register(he($=>{let te=V.read($),pe=O.read($);if(w.root.classList.toggle("collapsed",!te),l?T.icon=M.error:T.icon=s?M.check:q.modify(M.loading,"spin"),S.root.classList.toggle("show-checkmarks",pe),N.classList.toggle("codicon-chevron-right",!te),N.classList.toggle("codicon-chevron-down",te),te&&!this._contentInitialized){this._contentInitialized=!0;let de=bt(".chat-confirmation-widget-message");de.root.appendChild(this.createMessageContents()),w.root.appendChild(de.root)}}));let U=$=>{if(!$.defaultPrevented){let te=V.get();V.set(!te,void 0),$.preventDefault()}};this._register(T.onDidClick(U));let G=this.output?.parts.filter($=>$.kind==="data").filter($=>!$.audience||$.audience.includes(1));if(G?.length){let te=this._register(this._instantiationService.createInstance(L3,this.context,G)).domNode;te.classList.add("chat-collapsible-top-level-resource-group"),S.root.appendChild(te),this._register(he(pe=>{te.style.display=V.read(pe)?"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=bt("div",[bt("h3@inputTitle"),bt("div@input"),bt("h3@outputTitle"),bt("div@output")]),{input:t,output:o}=this;if(e.inputTitle.textContent=d(7243,null),this.addCodeBlock(t,e.input),!o)e.output.remove(),e.outputTitle.remove();else{e.outputTitle.textContent=d(7244,null);let n=this._register(this._instantiationService.createInstance(L3,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)}};Jee=I([m(8,X),m(9,F),m(10,tt),m(11,Ct),m(12,kt),m(13,Av),m(14,B)],Jee);var m2=class extends Nv{static{this._expandedByDefault=new WeakMap}get codeblocks(){return this.collapsibleListPart.codeblocks}constructor(i,e,t,o,n,r,s,l,c,u,p,h){super(i);let g=t,f=w=>({kind:"code",data:w,languageId:"json",codeBlockIndex:g++,ownerMarkdownPartId:this.codeblocksPartId,options:{hideToolbar:!0,reserveWidth:19,maxHeightInLines:13,verticalPadding:5,editorOptions:{wordWrap:"on"}}}),v=s;typeof s=="string"&&(v=[{type:"embed",value:s,isText:!0}]);let b=this.collapsibleListPart=this._register(c.createInstance(Jee,o,n,this.getAutoApproveMessageContent(),e,f(r),v&&v.length>0?{parts:v.map((w,k)=>{let T=w.type==="ref"||w.uri?Ye(w.uri):w.mimeType&&K6(w.mimeType)?`file${K6(w.mimeType)}`:"file"+(w.isText?".txt":".bin");if(w.type==="ref")return{kind:"data",uri:w.uri,mimeType:w.mimeType};if(w.isText&&!w.asResource)return f(w.value);{let N=wB.createUri(e.element.sessionResource,i.toolCallId,k,T);return w.isText?{kind:"data",value:new TextEncoder().encode(w.value),mimeType:w.mimeType,uri:N,audience:w.audience}:{kind:"data",base64Value:w.value,mimeType:w.mimeType,uri:N,audience:w.audience}}})}:void 0,l,l&&h.getValue("chat.tools.autoExpandFailures")||(m2._expandedByDefault.get(i)??!1)));this._register(Z(()=>m2._expandedByDefault.set(i,b.expanded)));let S=i.kind==="toolInvocation"?i.state.map((w,k)=>w.type===lo.StateKind.Executing?w.progress.read(k):void 0):void 0,y=new co(()=>this._register(new fb(b.domNode)));S&&this._register(he(w=>{let k=S?.read(w);k?.message&&(b.title=k.message),k?.progress&&!lo.isComplete(i,w)&&y.value.setWorked(k.progress*100)})),this.domNode=b.domNode}getAutoApproveMessageContent(){return $ee(this.toolInvocation)}};m2=I([m(8,F),m(9,Ct),m(10,kt),m(11,B)],m2);var dtt=ae("chatResponseResourceFileSystemProvider"),tAe=class extends C{constructor(e,t){super();this.chatService=e;this._fileService=t;this.onDidChangeCapabilities=H.None;this.onDidChangeFile=H.None;this.capabilities=19474;this._associated=new vt;this._sessionAssociations=new vt;this._register(this.chatService.onDidDisposeSession(o=>{for(let n of o.sessionResource){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=_t(),r=A.from({scheme:wB.scheme,path:`/assoc/${n}`+(o?`/${o}`:"")});this._associated.set(r,t);let s=this._sessionAssociations.get(e);return s||(s=new Mn,this._sessionAssociations.set(e,s)),s.add(r),r}readFile(e){return Promise.resolve(this.lookupURI(e))}readFileStream(e){let t=_I(o=>Je.concat(o.map(n=>Je.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 Jr("fs is readonly","NoPermissions")}watch(){return C.None}mkdir(){throw Jr("fs is readonly","NoPermissions")}readdir(){return Promise.resolve([])}rename(){throw Jr("fs is readonly","NoPermissions")}writeFile(){throw Jr("fs is readonly","NoPermissions")}findMatchingInvocation(e){let t=wB.parseUri(e);if(!t)throw Jr("File not found","EntryNotFound");let{sessionResource:o,toolCallId:n,index:r}=t,s=this.chatService.getSession(o);if(!s)throw Jr("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 Jr("File not found","EntryNotFound")}lookupURI(e){let t=this._associated.get(e);if(t){if(t instanceof Uint8Array)return t;let l=Sl(t.base64).buffer;return this._associated.set(e,l),l}let{result:o,index:n}=this.findMatchingInvocation(e),r=lo.resultDetails(o);if(!mV(r))throw Jr("Tool does not have I/O","EntryNotFound");let s=r.output.at(n);if(!s)throw Jr("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):Sl(s.value).buffer}};tAe=I([m(0,Si),m(1,be)],tAe);var Hme=class extends C{static{this.ID="chatResponseResourceWorkbenchContribution"}constructor(i,e){super(),this._register(e.registerProvider(wB.scheme,i))}};Hme=I([m(0,dtt),m(1,be)],Hme);function L9o(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 Opo(a){return new CFt(L9o(a))}var iAe=class extends C{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(he(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(Mre(c,({lastValue:h,newValue:g})=>{g&&!uo(h,g)&&s()}));let u=hs({equalsFn:$i},h=>{let f=i.readDefinitions().read(h).server?.devMode?.watch;return typeof f=="string"?[f]:f}),p=this._register(new um);this._register(he(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=>zm({base:f.fsPath,pattern:k},{ignoreCase:S})),w=b.map(k=>zm({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 N of T)if(y.some(O=>O(N.fsPath))&&!w.some(O=>O(N.fsPath))){p.queue(s);break}}))}))}};iAe=I([m(2,md),m(3,be),m(4,Pe)],iAe);var oAe=ae("mcpDevModeDebugging"),BHt="127.0.0.1",Zee=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(11393,null,e.command));return this._debugService.startDebugging(void 0,{type:"pwa-node",request:"attach",name:o,port:t,host:BHt,timeout:3e4,continueOnAttach:!0,...r},n),{...e,args:[`--inspect-brk=${BHt}:${t}`,...e.args]}}case"debugpy":{if(!/python[0-9.]*$/.test(e.command))throw new Error(d(11394,null,e.command));let s,l=["--wait-for-client","--connect",`${BHt}:${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:BHt,port:t},...r},n),this.ensureListeningOnPort(t)]),{...e,command:s,args:l}}default:Hr(i.devMode.debug,`Unknown debug type ${JSON.stringify(i.devMode.debug)}`)}}ensureListeningOnPort(i){return Promise.resolve()}getDebugPort(){return Promise.resolve(9230)}};Zee=I([m(0,Li),m(1,ge)],Zee);var Fpo=["image/webp","image/png","image/jpeg","image/jpg","image/gif"];function R9o(a,i,e){let t=a.mimeType?.toLowerCase()||i$e(a.src);if(!t||!Fpo.includes(t)){e.debug(`Ignoring icon with unsupported mime type: ${a.src} (${t}), allowed: ${Fpo.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 Wpo(a,i,e){let t=[];for(let o of a.icons||[]){let n=R9o(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 h2=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 rAe=ae("mcpSandboxService"),nAe=class extends C{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._sandboxConfigPerConfigurationTarget=new Map;this._pathJoin=(e,...t)=>(e===1?Ms:Lo).join(...t);this._getPathDelimiter=async e=>await this._getOperatingSystem(e)===1?Ms.delimiter:Lo.delimiter;this._sandboxSettingsId=_t(),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._getSandboxCommandArgs(t.command,t.args,r.sandboxConfigPath),l=await this._getSandboxEnvVariables(t.env,r.tempDir,r.rgPath,o);if(r.srtPath)return r.execPath?{...t,command:r.execPath,args:[r.srtPath,...s],env:l,type:1}:{...t,command:r.srtPath,args:s,env:l,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(11424,null,u))}if(r.length){let u=r.map(p=>`"${p}"`).join(", ");l.push(d(11425,null,u))}let c={};return s.length&&(c.network={allowedDomains:[...s]}),r.length&&(c.filesystem={allowWrite:[...r]}),{message:d(11426,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"}),o&&(r={...r,PATH:r.PATH?`${r.PATH}${await this._getPathDelimiter(n)}${wc(o)}`:wc(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(e,...t),n}async _getRemoteEnv(e){return e?this._remoteEnvDetailsPromise:null}async _getOperatingSystem(e){let t=await this._getRemoteEnv(e);return t?t.os:zo}async _getAppRoot(e){let t=await this._getRemoteEnv(e);return t?t.appRoot.path:wc(gn.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=ise(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,Je.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){let t=["~/.npm"];for(let o of e??[]){let n=o.trim();n&&t.push(n)}return t}};nAe=I([m(0,be),m(1,Co),m(2,ne),m(3,MJ),m(4,yo)],nAe);var HHt=class extends C{constructor(){super(...arguments);this._serverTasks=this._register(new jt);this._clientTasks=this._register(new jt);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=_t(),n=new Date().toISOString(),r=Date.now(),s={taskId:o,status:"working",createdAt:n,ttl:e,lastUpdatedAt:new Date().toISOString(),pollInterval:1e3},l=new P,c=new $e;l.add(Z(()=>c.dispose(!0)));let u=this._executeTask(o,t,c.token);return e?l.add(nn(()=>this._serverTasks.deleteAndDispose(o),e)):u.finally(()=>{let p=this._register(nn(()=>{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 ho?this._updateTaskStatus(e,"cancelled","Task was cancelled by the client"):n instanceof gb?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:Tv.INTERNAL_ERROR,message:n.message}):this._updateTaskStatus(e,"failed","Unknown error",void 0,{code:Tv.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 gb(Tv.INVALID_PARAMS,`Task not found: ${e}`);return{...t.task}}async getTaskResult(e){let t=this._serverTasks.get(e);if(!t)throw new gb(Tv.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 gb(Tv.INVALID_PARAMS,`Task not found: ${e}`);if(o.error)throw new gb(o.error.code,o.error.message,o.error.data);if(!o.result)throw new gb(Tv.INTERNAL_ERROR,"Task completed but no result available");return o.result}cancelTask(e){let t=this._serverTasks.get(e);if(!t)throw new gb(Tv.INVALID_PARAMS,`Task not found: ${e}`);if(t.task.status==="completed"||t.task.status==="failed"||t.task.status==="cancelled")throw new gb(Tv.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 UHt=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 N in S)if(Object.prototype.hasOwnProperty.call(S,N)){let O=String(S[N]);g||p||h||c?T.push(N+"="+O):u?T.push("/"+N+"="+a._encode(O,s)):T.push(N+"="+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 N=T.join(",");c?n.push(N):g||p||h?n.push(b.name+"="+N):n.push(N)}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):M9o(i)}static _formPair(i,e,t){return t?i+"="+encodeURIComponent(String(e)):encodeURIComponent(String(e))}};function M9o(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 N9o={serverName:void 0,serverIcons:[],serverInstructions:void 0,trustedAtNonce:void 0,nonce:void 0,tools:[],prompts:void 0,capabilities:void 0},Vpo=/[^a-z0-9_-]/gi,Ume=class extends C{constructor(e,t){super();this.didChange=!1;this.cache=new il(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)||N9o;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}};Ume=I([m(1,le)],Ume);var sAe=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=Le(this,void 0);this.fromServer=Ce(i=>this.fromServerPromise.read(i)?.promiseResult.read(i)?.data);this.value=Ce(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)}},Ov=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N){super();this.definition=t;this._requiresExtensionActivation=n;this._primitiveCache=r;this._mcpRegistry=l;this._extensionService=u;this._loggerService=p;this._outputService=h;this._telemetryService=g;this._commandService=f;this._instantiationService=v;this._dialogService=b;this._notificationService=S;this._openerService=y;this._samplingService=w;this._elicitationService=k;this._mcpSandboxService=T;this._taskManager=this._register(new HHt);this._connectionSequencer=new Nm;this._connection=this._register(X0(this,void 0));this.connection=this._connection;this.connectionState=Ce(e=>this._connection.read(e)?.state.read(e)??{state:ir.Kind.Stopped});this.cacheState=Ce(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(ir.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._loggerId=`mcpServer.${t.id}`,this._logger=this._register(p.createLogger(this._loggerId,{hidden:!0,name:`MCP: ${t.label}`}));let O=this;this._register(this._instantiationService.createInstance(iAe,this,{get lastModeDebugged(){return O._lastModeDebugged}})),this._register(Z(()=>p.deregisterLogger(this._loggerId)));let V=o?Le(this,o.map($=>({uri:$,name:Ye($)}))):ui(this,c.onDidChangeWorkspaceFolders,()=>c.getWorkspace().folders),U=N.remoteAuthority?Opo(N.remoteAuthority):void 0;this._register(he($=>{let te=this._connection.read($)?.handler.read($);te&&(te.roots=V.read($).filter(pe=>pe.uri.authority===(e.remoteAuthority||"")).map(pe=>{let de=A.from(U?.transformIncoming(pe.uri)??pe.uri);return de.scheme===Y.file&&(de=A.file(Hp(de.fsPath,!0))),{name:pe.name,uri:de.toString()}}))})),this._register(he($=>{let te=this._connection.read($),pe=te?.handler.read($);pe?this._populateLiveData(pe,te?.definition.cacheNonce,$.store):this._tools&&this.resetLiveData()})),this._register(he($=>{let te=this._connection.read($);this._potentialSandboxBlockListener.value=te?.onPotentialSandboxBlock(pe=>this.recordPotentialSandboxBlock(pe))}));let G=Ce($=>{let te=this._fullDefinitions.read($).server;return te&&te.cacheNonce!==this._tools.fromCache?.nonce?te.staticMetadata:void 0});this._tools=new sAe(this.definition.id,this._primitiveCache,G.map($=>{let te=$?.tools?.filter(pe=>pe.availability===0).map(pe=>pe.definition);return te?.length?new Au(this._getValidatedTools(te)):void 0}).map(($,te)=>$?.promiseResult.read(te)?.data),$=>$.tools,$=>$.map(te=>this._instantiationService.createInstance(utt,this,s,te)).sort((te,pe)=>te.compare(pe)),[]),this._prompts=new sAe(this.definition.id,this._primitiveCache,void 0,$=>$.prompts||[],$=>$.map(te=>new mki(this,te)),[]),this._serverMetadata=new sAe(this.definition.id,this._primitiveCache,G.map($=>$?this._toStoredMetadata($?.serverInfo,$?.instructions):void 0),$=>({serverName:$.serverName,serverInstructions:$.serverInstructions,serverIcons:$.serverIcons}),$=>({serverName:$?.serverName,serverInstructions:$?.serverInstructions,icons:h2.fromStored($?.serverIcons)}),void 0),this._capabilities=new sAe(this.definition.id,this._primitiveCache,G.map($=>$?.capabilities!==void 0?Bpo($.capabilities):void 0),$=>$.capabilities,$=>$,void 0)}static async callOn(e,t,o=ve.None){await e.start({promptType:"all-untrusted"});let n=!1,r,s=new Promise((l,c)=>{r=he(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===ir.Kind.Error){c(new u6e(`MCP server could not be started: ${g.message}`));return}else if(g.state===ir.Kind.Stopped){c(new u6e("MCP server has stopped"));return}else return}l(t(h,p)),n=!0})});return pm(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 $e(e);return new Fp(async o=>{await Ov.callOn(this,async n=>{for await(let r of n.listResourcesIterable({},t.token))if(o.emitOne(r.map(s=>new hki(this,s,h2.fromParsed(this._parseIcons(s))))),t.token.isCancellationRequested)return})},()=>t.dispose(!0))}resourceTemplates(e){return Ov.callOn(this,async t=>(await t.listResourceTemplates({},e)).map(n=>new gki(this,n,h2.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=bJe(this.collection.id.slice(YJi.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:ir.Kind.Stopped};let l=this._connection.get();if(this._isQuietStart=!!r,l&&ir.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:ir.Kind.Stopped};if(this._store.isDisposed)return l.dispose(),{state:ir.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,ht.first(this.runningToolCalls),p,h||ve.None);return f.dispose(),f.value}});if(this._telemetryService.publicLog2("mcp/serverBootState",{state:ir.toKindString(u.state),time:Date.now()-c}),r&&u.state===ir.Kind.Running){let p;u=await new Promise((h,g)=>{p=he(f=>{l.handler.read(f)&&h(u);let b=l.state.read(f);b.state===ir.Kind.Stopped&&b.reason==="needs-user-interaction"&&g(new dw("auth")),ir.isRunning(b)||h(b)})}).finally(()=>p.dispose())}if(u.state===ir.Kind.Error){let p;u=await new Promise((h,g)=>{p=he(f=>{let v=this._connection.read(f),b=v?.state.read(f);v&&b?.state===ir.Kind.Error&&(this._isQuietStart?g(new dw("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(11438,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(11427,null),run:()=>this.showOutput()}];if(e.definition.devMode?.debug?.type==="debugpy"&&o){this._notificationService.prompt(St.Error,d(11431,null,e.launchDefinition.command,e.definition.label),[...r,{label:d(11441,null),run:()=>this._openerService.open(A.parse("https://aka.ms/vscode-mcp-install/debugpy"))}]);return}n&&r.push({label:d(11439,null,e.launchDefinition.command),run:()=>this._openerService.open(A.parse(n))}),this._notificationService.prompt(St.Error,d(11440,null,e.launchDefinition.command,e.definition.label),r)}else this._notificationService.warn(d(11438,null,e.definition.label,t.message))}showSandboxConfigSuggestionFromPotentialBlocks(e,t){if(!e.definition.sandboxEnabled||!t.length||this._isSandboxSuggestionDialogVisible)return!1;if(this._isQuietStart)throw new dw("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(11435,null,e.definition.label),detail:o.message,primaryButton:d(11437,null),cancelButton:d(11436,null)}).then(async s=>{if(s.confirmed){if(!n||r===void 0){this._notificationService.warn(d(11434,null,e.definition.label));return}try{await this._mcpSandboxService.applySandboxConfigSuggestion(e.definition,n,r,t,o.sandboxConfig)&&(this._removePotentialSandboxBlocks(t),this._notificationService.info(d(11433,null,e.definition.label)))}catch(l){this._notificationService.error(d(11432,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===ir.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=>{ux(t=>{this._tools.fromServerPromise.read(t)?.promiseResult.read(t)&&e()})})}resetLiveData(){Ui(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>"),Vpo.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(Vpo,"_")),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=zL(s);return{error:r.map(u=>{let p=Bci(l,u.range[0].character),h=p&&`/${Vci(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(11430,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`),O9o(this._instantiationService,this.definition.label,t)),n}_parseIcons(e){let t=this._connection.get();return t?Wpo(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 Au(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 Au(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(Au.resolved({nonce:e,data:s}),r);let l=Bpo(n);this._capabilities.fromServerPromise.set(Au.resolved({data:l,nonce:e}),r),this._primitiveCache.store(this.definition.id,{...s,nonce:e,capabilities:l})}_populateLiveData(e,t,o){let n=new $e;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)})),Ui(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})})})}};Ov=I([m(6,md),m(7,Pe),m(8,lt),m(9,ol),m(10,Ml),m(11,Te),m(12,ge),m(13,F),m(14,ct),m(15,Ne),m(16,Qe),m(17,h5),m(18,m6e),m(19,rAe),m(20,Vt)],Ov);var mki=class{constructor(i,e){this._server=i;this._definition=e;this.id=ppi(this._server.definition.label+"."+e.name),this.name=e.name,this.title=e.title,this.description=e.description,this.arguments=e.arguments||[],this.icons=h2.fromStored(this._definition._icons)}async resolve(i,e){return(await Ov.callOn(this._server,o=>o.getPrompt({name:this._definition.name,arguments:i},e),e)).messages}async complete(i,e,t,o){return(await Ov.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 Bpo(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 utt=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=h2.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=ve.None,n=!0){let r=this._definition.serverToolName??this._definition.name,s=e?_t():void 0,l=new P;return Ov.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"]=P_(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 gX&&f.code===Tv.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===ir.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)}};utt=I([m(3,m6e)],utt);function O9o(a,i,e){a.invokeFunction(t=>{let o=t.get(Ne),n=t.get(ee);o.notify({severity:St.Warning,message:d(11428,null,i),actions:{primary:[{class:void 0,enabled:!0,id:"mcpBadSchema.show",tooltip:"",label:d(11429,null),run:()=>{n.openEditor({resource:void 0,contents:e})}}]}})})}var hki=class{constructor(i,e,t){this.icons=t;this.mcpUri=e.uri,this.title=e.title,this.uri=uw.fromServer(i.definition,e.uri),this.name=e.name,this.description=e.description,this.mimeType=e.mimeType,this.sizeInBytes=e.size}},gki=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=UHt.parse(e.uriTemplate)}resolveURI(i){let e=this.template.resolve(i);return uw.fromServer(this._server.definition,e)}async complete(i,e,t,o){return(await Ov.callOn(this._server,r=>r.complete({ref:{type:"ref/resource",uri:this._definition.uriTemplate},argument:{name:i,value:e},context:{arguments:iSe(t,s=>Array.isArray(s)?s.join("/"):s)}},o),o)).completion.values}};var lAe=class extends C{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=Ce(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:abe,platform:Gt?"web":sbe?"mobile":"desktop",deviceCapabilities:{touch:ws.isTouchDevice(),hover:ws.isHoverDevice()}}))}get uiData(){return this._uiData}async log(e){let t=await this._getServer(ve.None);t&&LHt(t.logger,e,"[App UI]")}async _getServer(e){return dpo(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 Ov.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(Wo(n,{text:!0}))r=n.text;else if(Wo(n,{blob:!0}))r=Sl(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 n0(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 Ov.callOn(o,n=>n.readResource({uri:e},t),t)}};lAe=I([m(1,es),m(2,De)],lAe);var zHt;(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"))(zHt||={});var F9o="chatMcpApp.origins",R3=class extends C{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 $e);this._announcedCapabilities=!1;this._latestCsp=void 0;this._loadState=Le(this,{status:"loading"});this.loadState=this._loadState;this._onDidChangeHeight=this._register(new E);this.onDidChangeHeight=this._onDidChangeHeight.event;this._downloadParts=Le(this,[]);this.downloadParts=this._downloadParts;this._originStore=new $j(F9o,u),this._webviewOrigin=this._originStore.getOrigin("mcpApp",t.serverDefinitionId),this._mcpToolCallUI=this._register(this._instantiationService.createInstance(lAe,t)),this._height=R3.heightCache.get(this.toolInvocation)??300,this._webview=this._register(this._webviewService.createWebviewElement({origin:this._webviewOrigin,title:d(7268,null),options:{purpose:"chatOutputItem",enableFindWidget:!1,disableServiceWorker:!0,retainContextWhenHidden:!0},contentOptions:{allowMultipleAPIAcquire:!0,allowScripts:!0,allowForms:!0},extension:void 0}));let v=Me(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(he(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}}Wo(t,{id:!0})&&await this._sendResponse(t.id,n)}catch(n){if(this._logService.error(`[MCP App] Error handling ${t.method}:`,n),Wo(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(nn(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(ux(r=>{let s=n.state.read(r);s.type===lo.StateKind.Completed&&(this._sendToolResult(s.resultDetails),r.dispose())}))}}));return{protocolVersion:zHt.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){mV(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?Jl(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:Sl(o.data).buffer,id:r,name:"Image"};if(o.type==="resource_link"){let s=uw.fromServer({id:this.renderData.serverDefinitionId,label:""},o.uri);return{kind:"file",value:s,id:r,name:Ye(s)}}else return}).filter(mo)),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-${Ir(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:Sl(c.data).buffer,id:u,name:"Image",mimeType:c.mimeType});else if(c.type==="resource_link"){let p=uw.fromServer({id:this.renderData.serverDefinitionId,label:""},c.uri);s.push({kind:"file",value:p,id:u,name:Ye(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 xe().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 xe().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,R3.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=Wo(r,{text:!0})?new TextEncoder().encode(r.text):{base64:r.blob},c=this._chatResponseResourceFsProvider.associate(this.renderData.sessionResource,l,Ye(s));t.push({kind:"data",mimeType:r.mimeType,uri:c})}else if(n.type==="resource_link"){let r=uw.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()}};R3=I([m(5,F),m(6,At),m(7,wm),m(8,le),m(9,dtt),m(10,ne),m(11,nt),m(12,Qe)],R3);var Hpo=.75,cAe=class extends Nv{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=`${Hpo*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=Me(this.domNode),c=()=>Hpo*l.innerHeight,u=Le("mcpAppMaxHeight",c());j(l,"resize",()=>u.set(c(),void 0)),this._model=this._register(this._instantiationService.createInstance(R3,e,this._renderData,this._webviewContainer,u,o.currentWidth)),this._updateContainerHeight(),this._register(he(p=>{let h=this._model.loadState.read(p);this._handleLoadStateChange(this._webviewContainer,h)})),this._register(this._model.onDidChangeHeight(()=>{this._updateContainerHeight()})),this._register(he(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(Xee,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(7269,null);let n=this._instantiationService.createInstance(vA,o,q.modify(M.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 xe;n.appendText(d(7270,null,t.message||String(t)));let r=this._register(new Dme(2,n,this._markdownRendererService));o.appendChild(r.domNode);let s=R(o,_(".chat-buttons-container")),l=this._register(new Mi(s,Ko));l.label=d(7271,null),this._register(l.onDidClick(()=>{this._model.retry()})),e.appendChild(o),this._errorNode=o}};cAe=I([m(4,F),m(5,Qn)],cAe);var zme=class extends Nv{constructor(e,t,o,n,r,s){super(e);this.codeblocks=[];let l=this._register(s.createInstance(T3,n.map(c=>({kind:"reference",reference:c})),o,t,r,$ee(e)));l.icon=M.check,this.domNode=l.domNode}};zme=I([m(5,F)],zme);var M3=class extends Nv{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(Jee,o,n,this.getAutoApprovalMessageContent(),e,f,v?{parts:v}:void 0,s,s&&p.getValue("chat.tools.autoExpandFailures")||(M3._expandedByDefault.get(i)??!1)));this._register(Z(()=>M3._expandedByDefault.set(i,b.expanded)));let S=i.kind==="toolInvocation"?i.state.map((w,k)=>w.type===lo.StateKind.Executing?w.progress.read(k):void 0):void 0,y=new co(()=>this._register(new fb(b.domNode)));S&&this._register(he(w=>{let k=S?.read(w);k?.message&&(b.title=k.message),k?.progress&&!lo.isComplete(i,w)&&y.value.setWorked(k.progress*100)})),this.domNode=b.domNode}getAutoApprovalMessageContent(){return $ee(this.toolInvocation)}};M3=I([m(7,F),m(8,Ct),m(9,kt),m(10,B)],M3);var Kme=class extends Nv{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N){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!==lo.StateKind.WaitingForConfirmation||!O.confirmationMessages?.title)throw new Error("Confirmation messages are missing");t=fR(t);let{title:V,message:U,disclaimer:G,terminalCustomActions:$}=O.confirmationMessages,te=t.presentationOverrides?.commandLine??t.confirmation?.commandLine??(t.commandLine.toolEdited??t.commandLine.original).trimStart(),pe=t.confirmation?.cdPrefix??"",de=!!t.presentationOverrides,se=this.configurationService.getValue(ty.EnableAutoApprove)===!0,Se=this.storageService.getBoolean("chat.tools.terminal.autoApprove.warningAccepted",-1,!1),ke;if(se){if(ke=[],!Se&&(ke.push({label:d(7273,null),data:{type:"enable"}}),ke.push(new li),$))for(let ti of $)ti instanceof li||(ti.disabled=!0);$&&ke.push(...$),ke.length===0&&(ke=void 0)}let Ee={hideToolbar:!0,reserveWidth:19,verticalPadding:5,editorOptions:{wordWrap:"on",readOnly:de,tabFocusMode:!0,ariaLabel:typeof V=="string"?V:V.value}},He=this.languageService.getLanguageIdByLanguageName(t.presentationOverrides?.language??t.language??"sh")??"shellscript",Ve=this._register(this.modelService.createModel(te,this.languageService.createById(He),this._getUniqueCodeBlockUri(),!0));jut(T.createModelReference(Ve.uri),this._store);let Fe=this._register(this.editorPool.get());Fe.object.render({codeBlockIndex:this.codeBlockStartIndex,codeBlockPartIndex:0,element:this.context.element,languageId:He,renderOptions:Ee,textModel:Promise.resolve(Ve),chatSessionResource:this.context.element.sessionResource},this.currentWidthDelegate()),this.codeblocks.push({codeBlockIndex:this.codeBlockStartIndex,codemapperUri:void 0,elementId:this.context.element.id,focus:()=>Fe.object.focus(),ownerMarkdownPartId:this.codeblocksPartId,uri:Ve.uri,uriPromise:Promise.resolve(Ve.uri),chatSessionResource:this.context.element.sessionResource}),this._register(Ve.onDidChangeContent(ti=>{let bo=Ve.getValue();bo!==te?t.commandLine.userEdited=pe+bo:t.commandLine.userEdited=void 0}));let Qt=bt(".chat-confirmation-message-terminal",[bt(".chat-confirmation-message-terminal-editor@editor"),bt(".chat-confirmation-message-terminal-disclaimer@disclaimer")]);R(Qt.editor,Fe.object.element),this._register(N.setupDelayedHover(Qt.editor,{content:U||"",style:1,position:{hoverPosition:0}}));let Ze=this._register(this.instantiationService.createInstance(Gee,this.context,{title:V,icon:M.terminal,message:Qt.root,buttons:this._createButtons(ke)}));G&&this._appendMarkdownPart(Qt.disclaimer,G,Ee);let Ti=ie.Editing.hasToolConfirmation.bindTo(this.contextKeyService);Ti.set(!0),this._register(Z(()=>Ti.reset())),this._register(Ze.onDidClick(async ti=>{let bo=!0,Ro=ti.data,_o=0;if(typeof Ro=="boolean")Ro&&(_o=4,t.autoApproveInfo&&(t.autoApproveInfo=void 0));else if(typeof Ro!="boolean")switch(Ro.type){case"enable":{if(await this._showAutoApproveWarning()){if(this.storageService.store("chat.tools.terminal.autoApprove.warningAccepted",!0,-1,0),t.autoApproveInfo)_o=4;else if($){for(let ln of $)ln instanceof li||(ln.disabled=!1);Ze.updateButtons(this._createButtons($)),bo=!1}}else bo=!1;break}case"skip":{_o=5;break}case"newRule":{let Id=function(uu,Jm){return uu.map(Dh=>{if(Jm==="session")return`\`${Dh.key}\``;let Rp=Jm==="workspace"?5:2,Uv=ic(lw.OpenTerminalSettingsLink,Rp);return`[\`${Dh.key}\`](${Uv.toString()} "${d(7283,null)}")`}).join(", ")},sr=Yl(Ro.rule),ln=sr.filter(uu=>uu.scope==="session"),en=sr.filter(uu=>uu.scope==="workspace"),Ws=sr.filter(uu=>uu.scope==="user"),ba=this.context.element.sessionResource;for(let uu of ln)this.terminalChatService.addSessionAutoApproveRule(ba,uu.key,uu.value);if(en.length>0){let Jm=this.configurationService.inspect(ty.AutoApprove).workspaceValue??{};if(yi(Jm)){let Dh={...Jm};for(let Rp of en)Dh[Rp.key]=Rp.value;await this.configurationService.updateValue(ty.AutoApprove,Dh,5)}else throw this.preferencesService.openSettings({jsonEditor:!0,target:5,revealSetting:{key:ty.AutoApprove}}),new Zs("Cannot add new rule, existing workspace setting is unexpected format")}if(Ws.length>0){let Jm=this.configurationService.inspect(ty.AutoApprove).userValue??{};if(yi(Jm)){let Dh={...Jm};for(let Rp of Ws)Dh[Rp.key]=Rp.value;await this.configurationService.updateValue(ty.AutoApprove,Dh,2)}else throw this.preferencesService.openSettings({jsonEditor:!0,target:2,revealSetting:{key:ty.AutoApprove}}),new Zs("Cannot add new rule, existing setting is unexpected format")}let Dg={isTrusted:{enabledCommands:[lw.OpenTerminalSettingsLink]}},yd=[];ln.length>0&&yd.push(ln.length===1?d(7277,null,Id(ln,"session")):d(7278,null,Id(ln,"session"))),en.length>0&&yd.push(en.length===1?d(7281,null,Id(en,"workspace")):d(7282,null,Id(en,"workspace"))),Ws.length>0&&yd.push(Ws.length===1?d(7279,null,Id(Ws,"user")):d(7280,null,Id(Ws,"user"))),yd.length>0&&(t.autoApproveInfo=new xe(yd.join(", "),Dg)),_o=4;break}case"configure":{this.preferencesService.openSettings({target:2,query:`@id:${ty.AutoApprove}`}),bo=!1;break}case"sessionApproval":{let sr=this.context.element.sessionResource;this.terminalChatService.setChatSessionAutoApproval(sr,!0);let ln=ic(lw.DisableSessionAutoApproval,sr),en={isTrusted:{enabledCommands:[lw.DisableSessionAutoApproval]}};t.autoApproveInfo=new xe(`${d(7284,null)} ([${d(7285,null)}](${ln.toString()}))`,en),_o=4;break}}bo&&(lo.confirmWith(e,{type:_o}),this.chatWidgetService.getWidgetBySessionResource(this.context.element.sessionResource)?.focusInput())})),this.domNode=Ze.domNode}_createButtons(e){let t=(o,n,r=o)=>{let s=this.keybindingService.appendKeybinding(r,n);return{label:o,tooltip:s}};return[{...t(d(7287,null),D3),data:!0,moreActions:e},{...t(d(7288,null),ctt,d(7286,null)),data:{type:"skip"},isSecondary:!0}]}async _showAutoApproveWarning(){return(await this.dialogService.prompt({type:gt.Info,message:d(7276,null),buttons:[{label:d(7272,null),run:()=>!0}],cancelButton:!0,custom:{icon:M.shield,markdownDetails:[{markdown:new xe(d(7274,null))},{markdown:new xe(`[${d(7275,null)}](https://code.visualstudio.com/docs/copilot/security#_security-considerations)`)}]}})).result===!0}_getUniqueCodeBlockUri(){return A.from({scheme:Y.vscodeChatCodeBlock,path:_t()})}_appendMarkdownPart(e,t,o){let n=this._register(this.instantiationService.createInstance(lT,{kind:"markdownContent",content:typeof t=="string"?new xe().appendMarkdown(t):t},this.context,this.editorPool,!1,this.codeBlockStartIndex,this.renderer,void 0,this.currentWidthDelegate(),this.codeBlockModelCollection,{codeBlockRenderOptions:o}));R(e,n.domNode)}};Kme=I([m(8,F),m(9,ct),m(10,_e),m(11,Ct),m(12,kt),m(13,B),m(14,X),m(15,At),m(16,Po),m(17,le),m(18,kv),m(19,Nt),m(20,tt)],Kme);var KHt=class extends C{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 P),t=this._options.commandDetection;e.add(t.onCommandExecuted(()=>{this._options.shouldAutoExpand()&&!this._noDataTimeout&&(this._noDataTimeout=nn(()=>{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=nn(()=>{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 vki=Re("terminal-view-icon",M.terminal,d(14136,null)),Upo=Re("terminal-rename",M.edit,d(14127,null)),GHt=Re("terminal-kill",M.trash,d(14125,null)),zpo=Re("terminal-new",M.add,d(14126,null)),Kpo=Re("terminal-configure-profile",M.gear,d(14124,null)),Gpo=Re("terminal-decoration-mark",M.circleSmallFilled,d(14134,null)),bki=Re("terminal-decoration-incomplete",M.circle,d(14133,null)),$po=Re("terminal-decoration-error",M.errorSmall,d(14132,null)),qpo=Re("terminal-decoration-success",M.circleFilled,d(14135,null)),jpo=Re("terminal-command-history-remove",M.close,d(14131,null)),Qpo=Re("terminal-command-history-output",M.output,d(14130,null)),Ypo=Re("terminal-command-history-fuzzy-search",M.searchFuzzy,d(14128,null)),Xpo=Re("terminal-command-history-open-file",M.symbolReference,d(14129,null));function Iki(a,i,e){let t=e?`${d(14262,null)}

---

`:"";if(a)if(a.markProperties||i)if(a.markProperties?.hoverMessage||i)t=a.markProperties?.hoverMessage||i||"";else return"";else if(Xo(a.duration)){let o=z6(a.duration);a.exitCode?a.exitCode===-1?t+=d(14256,null,Bs(a.timestamp,!0),o):t+=d(14258,null,Bs(a.timestamp,!0),o,a.exitCode):t+=d(14261,null,Bs(a.timestamp,!0),o)}else a.exitCode?a.exitCode===-1?t+=d(14255,null,Bs(a.timestamp,!0)):t+=d(14257,null,Bs(a.timestamp,!0),a.exitCode):t+=d(14259,null);else if(i)t=i;else return"";return t}var Ski=d(14254,null),Jpo=d(14253,null);function $Ht(a,i){if(a)return Iki(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=Bs(e,!0);if(typeof o=="number"){let s=z6(Math.max(o,0));t?t===-1?n+=d(14256,null,r,s):n+=d(14258,null,r,s,t):n+=d(14261,null,r,s)}else t?t===-1?n+=d(14255,null,r):n+=d(14257,null,r,t):n+=d(14260,null,r);return n}function qHt(a,i,e=Date.now()){let t="unknown",o=a?.exitCode??i?.exitCode,n=Ski,r=a?.timestamp??i?.timestamp,s=Ski,l,c=Ski;typeof r=="number"&&(s=new Date(r).toLocaleString()),a?a.exitCode===void 0?(t="running",n=Jpo,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=Jpo,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=z6(Math.max(l,0)));let u=[],p=bki;switch(t){case"running":case"unknown":u.push("default-color","default"),p=bki;break;case"error":u.push("error"),p=$po;break;case"success":u.push("success"),p=qpo;break}let h=$Ht(a,i);return{status:t,icon:p,classNames:u,exitCode:o,exitCodeText:n,startTimestamp:r,startText:s,duration:l,durationText:c,hoverMessage:h}}function dAe(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(Xo(e)&&Xo(t)&&Xo(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 jC=class extends C{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 H.map(H.any(this._onDidAddCapability.event,this._onDidRemoveCapability.event),()=>{},this._store)}get onDidAddCommandDetectionCapability(){return H.map(H.filter(this.onDidAddCapability,e=>e.id===2,this._store),e=>e.capability,this._store)}get onDidRemoveCommandDetectionCapability(){return H.map(H.filter(this.onDidRemoveCapability,e=>e.id===2,this._store),()=>{},this._store)}get onDidAddCwdDetectionCapability(){return H.map(H.filter(this.onDidAddCapability,e=>e.id===0,this._store),e=>e.capability,this._store)}get onDidRemoveCwdDetectionCapability(){return H.map(H.filter(this.onDidRemoveCapability,e=>e.id===0,this._store),()=>{},this._store)}get items(){return this._map.keys()}createOnDidRemoveCapabilityOfTypeEvent(e){return H.map(H.filter(this.onDidRemoveCapability,t=>t.id===e),t=>t.capability)}createOnDidAddCapabilityOfTypeEvent(e){return H.map(H.filter(this.onDidAddCapability,t=>t.id===e),t=>t.capability)}add(e,t){this._map.set(e,t),this._onDidAddCapability.fire(yki(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(yki(e,t)))}has(e){return this._map.has(e)}};I([mi],jC.prototype,"onDidChangeCapabilities",1),I([mi],jC.prototype,"onDidAddCommandDetectionCapability",1),I([mi],jC.prototype,"onDidRemoveCommandDetectionCapability",1),I([mi],jC.prototype,"onDidAddCwdDetectionCapability",1),I([mi],jC.prototype,"onDidRemoveCwdDetectionCapability",1);var P3=class extends C{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 H.map(H.any(this._onDidAddCapability.event,this._onDidRemoveCapability.event),()=>{},this._store)}get onDidAddCommandDetectionCapability(){return H.map(H.filter(this.onDidAddCapability,e=>e.id===2,this._store),e=>e.capability,this._store)}get onDidRemoveCommandDetectionCapability(){return H.map(H.filter(this.onDidRemoveCapability,e=>e.id===2,this._store),()=>{},this._store)}get onDidAddCwdDetectionCapability(){return H.map(H.filter(this.onDidAddCapability,e=>e.id===0,this._store),e=>e.capability,this._store)}get onDidRemoveCwdDetectionCapability(){return H.map(H.filter(this.onDidRemoveCapability,e=>e.id===0,this._store),()=>{},this._store)}get items(){return this._items()}createOnDidRemoveCapabilityOfTypeEvent(e){return H.map(H.filter(this.onDidRemoveCapability,t=>t.id===e),t=>t.capability)}createOnDidAddCapabilityOfTypeEvent(e){return H.map(H.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(yki(t,e.get(t)));this._register(e.onDidAddCapability(t=>this._onDidAddCapability.fire(t))),this._register(e.onDidRemoveCapability(t=>this._onDidRemoveCapability.fire(t)))}};I([mi],P3.prototype,"onDidChangeCapabilities",1),I([mi],P3.prototype,"onDidAddCommandDetectionCapability",1),I([mi],P3.prototype,"onDidRemoveCommandDetectionCapability",1),I([mi],P3.prototype,"onDidAddCwdDetectionCapability",1),I([mi],P3.prototype,"onDidRemoveCwdDetectionCapability",1);function yki(a,i){return{id:a,capability:i}}function up(a,i,e=!1){ptt.INSTANCE.registerTerminalContribution({id:a,ctor:i,canRunInDetachedTerminals:e})}var mtt;(i=>{function a(){return ptt.INSTANCE.getTerminalContributions()}i.getTerminalContributions=a})(mtt||={});var ptt=class a{constructor(){this._terminalContributions=[]}static{this.INSTANCE=new a}registerTerminalContribution(i){this._terminalContributions.push(i)}getTerminalContributions(){return this._terminalContributions.slice(0)}};oe.add("terminal.contributions",ptt.INSTANCE);var uAe=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 pAe=class extends C{constructor(e,t,o){super();this._xterm=e;this._widgets=this._register(new uAe);this._contributions=new Map;this._attachDisposables=this._register(new me);this.onData=this._xterm.raw.onData;let n=t.capabilities??new jC;this._register(n),this.capabilities=n,this._register(e);let r=mtt.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 jo(QD)).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 P,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)}};pAe=I([m(2,F)],pAe);var Gme=class extends C{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 jC)}};function emo(a,i,e){if(e){let n=Oe.fromHex(e);if(n)return n}let t=a.getColor(lX);if(t)return t;let o=ie.inChatEditor.getValue(i);return a.getColor(o?qo:jS)}function tmo(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 W9o(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 jHt(a,i){return Math.max(i-a,0)}async function imo(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=jHt(g,v);return{text:f,lineCount:b}}let n=t.line,r=o.line,s=jHt(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 mAe=class extends C{constructor(e,t,o,n){super();this._xtermTerminal=e;this._command=t;this._terminalService=o;this._contextKeyService=n;this._streamingDisposables=this._register(new P);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 ho)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 ho)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 jHt(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 jHt(t.line,n)}return this._lineCount}_computeMaxColumnWidth(){let e=this._detachedTerminal;return e?tmo(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 ho;let e=(async()=>{let t={getBackgroundColor:r=>emo(r,this._contextKeyService)},o=new Gme({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 ho;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(H.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 ho)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 W9o(e,this._lastVT,t)}};mAe=I([m(2,Yo),m(3,X)],mAe);var hAe=class extends C{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 Gme({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 emo(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 tmo(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)}};hAe=I([m(2,Yo),m(3,X)],hAe);var omo=1,V9o=10,nmo=50,B9o=10,H9o=100,U9o=2,wki=new WeakMap,htt=class extends C{constructor(e,t){super();this._options=e;this._hoverService=t;let o=bt("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 $Ht(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=qHt(t,n),s=$Ht(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)}};htt=I([m(1,tt)],htt);var gAe=class extends Nv{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=fR(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=bt(".chat-terminal-content-part@container",[bt(".chat-terminal-content-title@title",[bt(".chat-terminal-command-block@commandBlock")]),bt(".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(htt,{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(u2,S.commandBlock,new xe([`\`\`\`${k}`,`${w.replaceAll("```","\\`\\`\\`")}`,"```"].join(`
`),{supportThemeIcons:!0}),void 0));this._register(T.onDidChangeHeight(()=>{this._decoration.update()})),this._outputView=this._register(this._instantiationService.createInstance(gtt,()=>this._ensureTerminalInstance(),()=>this._getResolvedCommand(),()=>this._terminalData.terminalCommandOutput,()=>this._commandText,()=>this._terminalData.terminalTheme)),S.container.append(this._outputView.domNode),this._register(this._outputView.onDidFocus(()=>this._handleOutputFocus())),this._register(this._outputView.onDidBlur(ke=>this._handleOutputBlur(ke))),this._register(Z(()=>this._handleDispose())),this._register(this._keybindingService.onDidUpdateKeybindings(()=>{this._focusAction.value?.refreshKeybindingTooltip(),this._showOutputAction.value?.refreshKeybindingTooltip()}));let N=bt(".chat-terminal-action-bar@actionBar");S.title.append(N.root),this._actionBar=this._register(new ji(N.actionBar,{})),this._initializeTerminalActions(),this._terminalService.whenConnected.then(()=>this._initializeTerminalActions());let O;e.pastTenseMessage&&(O=`${typeof e.pastTenseMessage=="string"?e.pastTenseMessage:e.pastTenseMessage.value}`);let U={kind:"markdownContent",content:new xe(O,{supportThemeIcons:!0,isTrusted:Mr(e.pastTenseMessage)?e.pastTenseMessage.isTrusted:!1})},$={codeBlockRenderOptions:{hideToolbar:!0,reserveWidth:19,verticalPadding:5,editorOptions:{wordWrap:"on"}},accessibilityOptions:O?{statusMessage:d(7304,null,fu(O))}:void 0};this.markdownPart=this._register(u.createInstance(lT,U,o,r,!1,l,n,{},s(),c,$)),S.message.append(this.markdownPart.domNode);let te=this._register(u.createInstance(vA,S.container,this.getIcon(),t.autoApproveInfo));this._decoration.update();let pe=this._configurationService.getValue("chat.agent.thinking.terminalTools"),de=this._configurationService.getValue("chat.tools.terminal.simpleCollapsible"),se=e.kind==="toolInvocation"&&lo.getConfirmationMessages(e);if(this._isInThinkingContainer=pe&&!se,this._usesCollapsibleWrapper=this._isInThinkingContainer||de,this._usesCollapsibleWrapper)this.domNode=this._createCollapsibleWrapper(te.domNode,w,e,o);else{this.domNode=te.domNode;let ke=()=>this.domNode.classList.toggle("show-checkmarks",!!this._configurationService.getValue("accessibility.chat.showCheckmarks"));ke(),this._register(this._configurationService.onDidChangeConfiguration(Ee=>{Ee.affectsConfiguration("accessibility.chat.showCheckmarks")&&ke()}))}let Se=!!t.terminalCommandOutput;(wki.get(e)||this._isInThinkingContainer&&lo.isComplete(e)&&Se)&&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}_createCollapsibleWrapper(e,t,o,n){let r=t.length>nmo?t.substring(0,nmo)+"...":t,s=lo.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(Stt,r,e,n,u,s));this._thinkingCollapsibleWrapper=p;let h=!0;return this._register(he(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(vtt,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(btt,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(ftt,()=>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&&!wki.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 P,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>U9o:!1},p=l.add(new KHt({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&&wki.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}};gAe=I([m(8,F),m(9,kv),m(10,Yo),m(11,X),m(12,At),m(13,_e),m(14,B)],gAe);var gtt=class extends C{constructor(e,t,o,n,r,s,l,c,u,p){super();this._ensureTerminalInstance=e;this._resolveCommand=t;this._getTerminalCommandOutput=o;this._getCommandText=n;this._getStoredTheme=r;this._accessibleViewService=s;this._instantiationService=l;this._terminalConfigurationService=c;this._themeService=u;this._contextKeyService=p;this._isAtBottom=!0;this._isProgrammaticScroll=!1;this._onDidFocusEmitter=this._register(new E);this._onDidBlurEmitter=this._register(new E);let h=bt(".chat-terminal-output-container@container",[bt(".chat-terminal-output-body@body",[bt(".chat-terminal-output-content@content",[bt(".chat-terminal-output-terminal@terminal"),bt(".chat-terminal-output-empty@empty")])])]);this.domNode=h.container,this.domNode.classList.add("collapsed"),this._outputBody=h.body,this._contentContainer=h.content,this._terminalContainer=h.terminal,this._emptyElement=h.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,f=>this._onDidBlurEmitter.fire(f)));let g=new ResizeObserver(()=>this._handleResize());g.observe(this.domNode),this._register(Z(()=>g.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(7295,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(7294,null,t);if(e){let l=e.getOutput();if(!l||l.trim().length===0)return`${o}
${d(7292,null)}`;let c=l.split(`
`);return`${o}
${c.join(`
`).trimEnd()}`}let n=this._getTerminalCommandOutput();if(!n)return`${o}
${d(7297,null)}`;let r=CS(n.text??"");if(!r.trim().length)return`${o}
${d(7292,null)}`;let s=r.trimEnd();return n.truncated&&(s+=`
${d(7296,null)}`),`${o}
${s}`}_setExpanded(e){this.domNode.classList.toggle("expanded",e),this.domNode.classList.toggle("collapsed",!e)}async _createScrollableContainer(){this._scrollableContainer=this._register(new Pa(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._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(mAe,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<B9o&&!s;l++){if(await Pi(H9o),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(7292,null)),this._layoutOutput(n?.lineCount??0),!0}async _renderSnapshotOutput(e){if(this._snapshotMirror){this._layoutOutput(e.lineCount??0);return}if(this._store.isDisposed)return;Rt(this._terminalContainer),this._snapshotMirror=this._register(this._instantiationService.createInstance(hAe,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(7292,null));let n=t?.lineCount??e.lineCount??0;this._layoutOutput(n)}_renderUnavailableMessage(e){Rt(this._terminalContainer),this._lastRenderedLineCount=void 0,e?this._showEmptyMessage(d(7291,null)):this._showEmptyMessage(d(7293,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*omo+n,s=o*V9o+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,omo)+1)*t+o}_getOutputPadding(){let e=cU(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=Xo(t.charHeight)&&t.charHeight>0,n=Xo(t.fontSize)&&t.fontSize>0,r=Xo(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?qo:jS);o&&(this.domNode.style.backgroundColor=o.toString())}};gtt=I([m(5,Wd),m(6,F),m(7,ku),m(8,De),m(9,X)],gtt);var ftt=class extends st{constructor(e,t,o){super(lw.ToggleChatTerminalOutput,d(7303,null),q.asClassName(M.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(7300,null),this.class=q.asClassName(M.chevronDown)):(this.label=d(7303,null),this.class=q.asClassName(M.chevronRight))}_updateTooltip(){this.tooltip=this._keybindingService.appendKeybinding(this.label,lw.FocusMostRecentChatTerminalOutput)}};ftt=I([m(1,_e),m(2,Te)],ftt);var vtt=class extends st{constructor(e,t,o,n,r,s,l,c,u,p){super(lw.FocusChatInstanceAction,r?d(7302,null):d(7299,null),q.asClassName(M.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(7301,null):d(7299,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,lw.FocusMostRecentChatTerminal)}};vtt=I([m(5,Yo),m(6,xv),m(7,jl),m(8,_e),m(9,Te)],vtt);var btt=class extends st{constructor(e,t){super(lw.ContinueInBackground,d(7298,null),q.asClassName(M.debugContinue),!0);this._terminalToolSessionId=e;this._terminalChatService=t}async run(){this._terminalChatService.continueInBackground(this._terminalToolSessionId)}};btt=I([m(1,kv)],btt);var Stt=class extends cT{constructor(i,e,t,o,n,r,s){let l=n?`Ran \`${i}\``:`Running \`${i}\``;super(l,t,void 0,r,s),this._terminalContentElement=e,this._commandText=i,this._isComplete=n,this.domNode.classList.add("chat-terminal-thinking-collapsible"),n&&(this.icon=M.check),this._setCodeFormattedTitle(),this.setExpanded(o)}_setCodeFormattedTitle(){if(!this._collapseButton)return;let i=this._collapseButton.labelElement;i.textContent="";let e=this._isComplete?d(7289,null):d(7290,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=M.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}};Stt=I([m(5,tt),m(6,B)],Stt);var ete=class extends Nv{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===lo.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=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(7263,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(Gee,this.context,{title:this.getTitle(),icon:u?.icon&&"id"in u.icon?u.icon:M.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){lo.confirmWith(e,t)}additionalPrimaryActions(){return[]}};ete=I([m(2,F),m(3,_e),m(4,X),m(5,At),m(6,jn)],ete);var z9o=45,$me=class extends ete{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!==lo.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:D3,skipActionId:ctt,allowLabel:w.confirmationMessages.confirmResults?d(7306,null):d(7305,null),skipLabel:d(7311,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!==lo.StateKind.WaitingForConfirmation)return e;if(t.confirmationMessages?.allowAutoConfirm!==!1){let o=this.confirmationService.getPreConfirmActions({toolId:this.toolInvocation.toolId,source:this.toolInvocation.source,parameters:t.parameters,chatSessionResource:this.context.element.sessionResource});for(let n of o)n.divider&&e.push(new li),e.push({label:n.label,tooltip:n.detail,scope:n.scope,data:async()=>{await n.select()&&this.confirmWith(this.toolInvocation,{type:4})}})}return t.confirmationMessages?.confirmResults&&e.unshift({label:d(7307,null),data:()=>{t.confirmationMessages.confirmResults=void 0,this.confirmWith(this.toolInvocation,{type:4})}},new li),e}createContentElement(){let e=this.toolInvocation.state.get();if(e.type!==lo.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=bt("div",[bt(".message@messageContainer",[bt(".message-wrapper@message"),bt(".see-more@showMore",[bt("a",[d(7310,null)])])]),bt(".editor@editor"),bt(".disclaimer@disclaimer")]);if(n.toolSpecificData?.kind==="input"&&n.toolSpecificData.rawInput&&!mf(n.toolSpecificData.rawInput)){let p=document.createElement("h3");p.textContent=d(7308,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=IM(v,`
`)>2,y=this._register(this.context.inlineTextModels.acquire(RYi(n.toolCallId),v.replace(/\n */g," "),this.languageService.createById(f),!0)).object,w=_t(),k=q8e(n.toolId),T=new Dt(async()=>{let O=[],V=await this.commandService.executeCommand("json.validate",k,y.getValue());for(let U of V??[])U.range&&U.message&&O.push({severity:U.severity==="Error"?8:4,message:U.message,startLineNumber:U.range[0].line+1,startColumn:U.range[0].character+1,endLineNumber:U.range[1].line+1,endColumn:U.range[1].character+1,code:U.code?String(U.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 N=this._register(this.editorPool.get());if(N.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:()=>N.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(N.object.element),b){let O=bt("div.see-more",[bt("a@link")]);O.link.textContent=d(7309,null),this._register(C$(O.link,()=>{try{let V=JSON.parse(y.getValue());y.setValue(JSON.stringify(V,null,2)),N.object.editor.updateOptions({tabFocusMode:!1}),N.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 t9(l.domNode,void 0)),u=()=>{let p=c.getHeight()>z9o;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!==lo.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(lT,{kind:"markdownContent",content:typeof t=="string"?new xe().appendMarkdown(t):t},this.context,this.editorPool,!1,this.codeBlockStartIndex,this.renderer,void 0,this.currentWidthDelegate(),this.codeBlockModelCollection,{codeBlockRenderOptions:o}));return Ck(n.domNode,this.instantiationService,this.chatMarkdownAnchorService,this._store),e.append(n.domNode),n}};$me=I([m(7,F),m(8,_e),m(9,kt),m(10,X),m(11,At),m(12,ge),m(13,Ns),m(14,jn),m(15,Av),m(16,gD)],$me);var Cki=ae("IChatToolOutputStateCache"),smo="chat/toolOutputStateCache",K9o=100,Itt=class{constructor(i){this._cache=new il(K9o,.75);let e=i.get(smo,1,"{}");this._deserialize(e);let t=H.filter(i.onWillSaveState,o=>o.reason===1);H.once(t)(()=>{i.store(smo,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{}}};Itt=I([m(0,le)],Itt);we(Cki,Itt,1);var fAe=class extends Nv{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 $e);let c=e.kind==="toolInvocation"?lo.resultDetails(e):{output:{type:"data",mimeType:e.resultDetails.output.mimeType,value:Sl(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(nb(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:_t()};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(7313,null);let s=this._register(this.instantiationService.createInstance(vA,r,q.modify(M.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(so(l))return;console.error("Error rendering tool output:",l);let c=_(".output-error"),u=_(".output-error-header");R(c,u);let p=_("div");p.classList.add(...q.asClassNameArray(M.error)),u.append(p);let h=_(".output-error-title");h.textContent=d(7312,null),u.append(h);let g=_(".output-error-details");g.textContent=l?.message||String(l),c.append(g),s.domNode.replaceWith(c)}),o}};fAe=I([m(3,UEe),m(4,At),m(5,F),m(6,Cki)],fAe);var qme=class extends ete{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:Ppo,skipActionId:Apo,allowLabel:d(7319,null),skipLabel:d(7323,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!==lo.StateKind.WaitingForPostApproval)throw new Error("Tool invocation is not waiting for post-approval");return this.createResultsDisplay(this.toolInvocation,e.contentForModel)}getTitle(){return d(7320,null)}additionalPrimaryActions(){let e=super.additionalPrimaryActions(),t=this.toolInvocation.state.get();if(t.type!==lo.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 li),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(7322,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=$8e(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=K6(l)?`image${K6(l)}`:"image.bin",p=wB.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(L3,this.context,n));return this._codeblocks.push(...r.codeblocks),r.domNode.classList.add("tool-postconfirm-display"),r.domNode}return o.textContent=d(7321,null),o}};qme=I([m(2,F),m(3,_e),m(4,X),m(5,At),m(6,jn),m(7,gD)],qme);var vAe=class extends Nv{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();let l=()=>this.domNode.classList.toggle("show-checkmarks",!!this.configurationService.getValue("accessibility.chat.showCheckmarks"));l(),this._register(this.configurationService.onDidChangeConfiguration(c=>{c.affectsConfiguration("accessibility.chat.showCheckmarks")&&l()}))}createProgressPart(){if(lo.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(he(o=>{let n,r=this.getAnnouncementKey("progress");if(this.toolInvocation.kind==="toolInvocation"){let c=this.toolInvocation.state.read(o);c.type===lo.StateKind.Cancelled&&c.reasonMessage?n=c.reasonMessage:c.type===lo.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));Fi(t,l.domNode)})),t}}get toolIsConfirmed(){let e=lo.executionConfirmedOrDenied(this.toolInvocation);return!!e&&e.type!==0}renderProgressContent(e,t){typeof e=="string"&&(e=new xe().appendText(e));let o={kind:"progressMessage",content:e};t&&this.provideScreenReaderStatus(e);let n=this.toolInvocation.toolId==="copilot_askQuestions"||this.toolInvocation.toolId==="vscode_askQuestions";return this.instantiationService.createInstance(fD,o,this.renderer,this.context,void 0,!0,this.getIcon(),this.toolInvocation,n?void 0:!1)}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:fu(qa(e,{useLinkFormatter:!0}));Or(t)}hasMeaningfulContent(e){return e?(typeof e=="string"?e:e.value).trim().length>0:!1}};vAe=I([m(4,F),m(5,B)],vAe);var bAe=class extends Nv{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!==lo.StateKind.Streaming||this._register(he(n=>{let r=t.state.read(n);if(r.type!==lo.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 xe().appendText(l):l},h=n.store.add(this.instantiationService.createInstance(fD,p,this.renderer,this.context,void 0,!0,this.getIcon(),t,!1));Fi(e,h.domNode)})),e}};bAe=I([m(3,F)],bAe);var tte=class extends C{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(he(y=>{e.state.read(y).type!==S&&v()}))}let g=this._register(new P),f=document.createElement("div");this.domNode.appendChild(f);let v=()=>{if(g.clear(),e.presentation==="hiddenAfterComplete"&&lo.isComplete(e)){xo(this.domNode);return}bn(this.domNode),this.subPart=g.add(this.createToolInvocationSubPart()),f.replaceWith(this.subPart.domNode),f=this.subPart.domNode;let S=this.subPart instanceof $me||this.subPart instanceof Kme||this.subPart instanceof Bme||this.subPart instanceof qme;this.domNode.classList.toggle("has-confirmation",S),g.add(this.subPart.onNeedsRerender(v))},b=this.getMcpAppRenderData();if(b){let S=Ce(w=>{let k=lo.executionConfirmedOrDenied(e,w);return!!k&&k.type!==0&&k.type!==5}),y=document.createElement("div");this.domNode.appendChild(y),this._register(he(w=>{S.read(w)?(this.mcpAppPart=w.store.add(this.instantiationService.createInstance(cAe,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(Bme,this.toolInvocation,this.context);let t=this.toolInvocation.state.get();if(t.type===lo.StateKind.Streaming)return this.instantiationService.createInstance(bAe,this.toolInvocation,this.context,this.renderer);if(t.type===lo.StateKind.WaitingForConfirmation)return this.toolInvocation.toolSpecificData?.kind==="terminal"?this.instantiationService.createInstance(Kme,this.toolInvocation,this.toolInvocation.toolSpecificData,this.context,this.renderer,this.editorPool,this.currentWidthDelegate,this.codeBlockModelCollection,this.codeBlockStartIndex):this.instantiationService.createInstance($me,this.toolInvocation,this.context,this.renderer,this.editorPool,this.currentWidthDelegate,this.codeBlockModelCollection,this.codeBlockStartIndex);if(t.type===lo.StateKind.WaitingForPostApproval)return this.instantiationService.createInstance(qme,this.toolInvocation,this.context)}if(this.toolInvocation.toolSpecificData?.kind==="terminal")return this.instantiationService.createInstance(gAe,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(zme,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(M3,this.toolInvocation,this.context,this.codeBlockStartIndex,this.toolInvocation.pastTenseMessage??this.toolInvocation.invocationMessage,this.toolInvocation.originMessage,this.toolInvocation.toolSpecificData,!1);let e=lo.resultDetails(this.toolInvocation);return Array.isArray(e)&&e.length?this.instantiationService.createInstance(zme,this.toolInvocation,this.context,this.toolInvocation.pastTenseMessage??this.toolInvocation.invocationMessage,e,this.listPool):zj(e)?this.instantiationService.createInstance(fAe,this.toolInvocation,this.context,this._onDidRemount.event):mV(e)?this.instantiationService.createInstance(m2,this.toolInvocation,this.context,this.codeBlockStartIndex,this.toolInvocation.pastTenseMessage??this.toolInvocation.invocationMessage,this.toolInvocation.originMessage,e.input,e.output,!!e.isError):this.toolInvocation.kind==="toolInvocation"&&this.toolInvocation.toolSpecificData?.kind==="input"&&!lo.isComplete(this.toolInvocation)?this.instantiationService.createInstance(m2,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,!1):this.instantiationService.createInstance(vAe,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)}};tte=I([m(9,F),m(10,dF)],tte);var QHt=100,KR=class extends cT{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){let{description:v,agentName:b,prompt:S,modelName:y}=KR.extractSubagentInfo(t),k=`${b||d(7190,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.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 N=this._collapseButton.labelElement;N.textContent="",this.titleShimmerSpan=_("span.chat-thinking-title-shimmer"),this.titleShimmerSpan.textContent=k,N.appendChild(this.titleShimmerSpan)}this._collapseButton&&!this.element.isComplete&&(this._collapseButton.icon=M.circleFilled),this._register(he(N=>{this.expanded.read(N),this._collapseButton&&(!this.element.isComplete&&this.isActive?this._collapseButton.icon=M.circleFilled:this._collapseButton.icon=M.check)})),this._register(he(N=>{this._isExpanded.read(N)&&!this.hasExpandedOnce&&(this.hasExpandedOnce=!0,this.materializePendingContent())})),this.setExpanded(!1),this._register(he(N=>{this._isExpanded.read(N)?this.autoExpandedForConfirmation||(this.userManuallyExpanded=!0):(this.autoExpandedForConfirmation&&(this.autoExpandedForConfirmation=!1),this.userManuallyExpanded&&(this.userManuallyExpanded=!1))})),this.layoutScheduler=this._register(new jpt(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(7188,null);if(!KR.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!==lo.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 eL(()=>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(7191,null),o=e.slice(1).join(`
`).trim(),n=s9t(t,QHt),s=t.length>QHt?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(Rme,s,c,this.context,this.chatContentMarkdownRenderer));this.promptContainer=_(".chat-thinking-tool-wrapper.chat-subagent-section");let p=_3(M.comment);this.promptContainer.appendChild(p),this.promptContainer.appendChild(u.domNode),this.wrapper&&(this.wrapper.firstChild?this.wrapper.insertBefore(this.promptContainer,this.wrapper.firstChild):R(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=M.check),this.finalizeTitle(),this.setExpanded(!1)}finalizeTitle(){this.updateTitle(),this._collapseButton&&(this._collapseButton.icon=M.check)}updateTitle(){let e=this.agentName||d(7190,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&&(this.titleDetailRendered.dispose(),this.titleDetailRendered=void 0),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&&(this.titleDetailRendered.dispose(),this.titleDetailRendered=void 0),!o)this.titleDetailContainer&&(this.titleDetailContainer.remove(),this.titleDetailContainer=void 0);else{let s=this.chatContentMarkdownRenderer.render(new xe(o));s.element.classList.add("collapsible-title-content","chat-thinking-title-detail"),Ck(s.element,this.instantiationService,this.chatMarkdownAnchorService,this._store),this.titleDetailRendered=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(7189,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(he(r=>{let s=e.state.read(r),l=s.type===lo.StateKind.WaitingForConfirmation||s.type===lo.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(KR.isParentSubagentTool(e))if(e.kind==="toolInvocation"){let t=e.state.get().type===lo.StateKind.Streaming;this._register(he(o=>{let n=e.state.read(o);if(n.type===lo.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!==lo.StateKind.Streaming){t=!1;let{description:r,agentName:s,prompt:l,modelName:c}=KR.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=s9t(o,QHt),l=o.length>QHt?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(Rme,l,u,this.context,this.chatContentMarkdownRenderer));this.resultContainer=_(".chat-thinking-tool-wrapper.chat-subagent-section");let h=_3(M.check);this.resultContainer.appendChild(h),this.resultContainer.appendChild(p.domNode),this.wrapper&&(R(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(7192,null,t.toolDisplayName):d(7193,null):t.toolDisplayName?d(7194,null,t.toolDisplayName):d(7195,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?M.error:M.warning,r=_3(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=_3(M.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(tte,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=Gxi(t.toolId),s=_3(r);n.appendChild(o),t.kind==="toolInvocation"?this._register(he(l=>{let c=t.state.read(l);c.type===lo.StateKind.WaitingForConfirmation||c.type===lo.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||KR.isParentSubagentTool(e))){let n=e.subAgentInvocationId??e.toolCallId;return this.subAgentInvocationId&&n?this.subAgentInvocationId===n:!this.subAgentInvocationId&&!n}return!1}};KR=I([m(9,F),m(10,Av),m(11,tt),m(12,B)],KR);var G9o=_,ite=class extends C{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)}};ite=I([m(2,Qe)],ite);var SAe=class extends C{constructor(e,t,o,n){super();this._onDidChangeVisibility=e;this.instantiationService=t;this.configService=o;this.themeService=n;this._pool=this._register(new LB(()=>this.treeFactory()))}get inUse(){return this._pool.inUse}treeFactory(){let e=new P,t=e.add(this.instantiationService.createInstance(Za,{onDidChangeVisibility:this._onDidChangeVisibility})),o=G9o(".interactive-response-progress-tree");return e.add(DB(o,this.themeService)),{tree:this.instantiationService.createInstance(qI,"ChatListRenderer",o,new xki,new kki,[new Eki(t,this.configService.getValue("explorer.decorations"))],new Tki,{collapseByDefault:()=>!1,expandOnlyOnTwistieClick:()=>!1,identityProvider:{getId:r=>r.uri.toString()},accessibilityProvider:{getAriaLabel:r=>r.label,getWidgetAriaLabel:()=>d(7245,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()}};SAe=I([m(1,F),m(2,B),m(3,De)],SAe);var xki=class a{static{this.ITEM_HEIGHT=22}getHeight(i){return a.ITEM_HEIGHT}getTemplateId(i){return"chatListTreeTemplate"}},kki=class{isIncompressible(i){return!i.children}},Eki=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 P,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()}},Tki=class{hasChildren(i){return!!i.children}async getChildren(i){return i.children??[]}};var IAe=class extends C{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 xe(c,{isTrusted:!0})));p.element.classList.add("progress-step"),Ck(p.element,this.instantiationService,this.chatMarkdownAnchorService,this._store);let h=this._register(this.instantiationService.createInstance(vA,p.element,u,void 0));R(this.domNode,h.domNode)};for(let c of e.edits)c.oldResource&&!c.newResource?l(d(7247,null,this.labelService.getUriBasenameLabel(c.oldResource)),M.trash):!c.oldResource&&c.newResource?l(d(7246,null,c.newResource.toString()),M.newFile):c.oldResource&&c.newResource&&l(d(7248,null,this.labelService.getUriBasenameLabel(c.oldResource),c.newResource.toString()),M.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}};IAe=I([m(3,F),m(4,Av),m(5,ot)],IAe);function $9o(a){return CC[a]?.label??a}var ote=class extends cT{constructor(e,t,o,n){let r=$9o(e.hookType),s=!!e.stopReason,l=!!e.systemMessage,c=e.toolDisplayName,u=s?c?d(7112,null,c,r):d(7111,null,r):c?d(7114,null,c,r):d(7113,null,r);super(u,t,void 0,o,n);this.hookPart=e;this.icon=s?M.error:l?M.warning:M.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}};ote=I([m(2,tt),m(3,B)],ote);var yAe=class extends C{constructor(e,t,o,n,r){super();this.configService=e;this.dialogService=t;this.logService=o;this.storageService=n;this.languageModelsService=r;this._register(H.runAndSubscribe(this.configService.onDidChangeConfiguration,s=>{(!s||s.affectsConfiguration("chat.autoReply"))&&this.configService.getValue("chat.autoReply")!==!0&&this.storageService.remove("chat.autoReply.optIn",-1)}))}async shouldAutoReply(){return this.configService.getValue("chat.autoReply")?this.checkOptIn():!1}async autoReply(e,t,o,n,r){if(r.isCancellationRequested||e.isUsed||e.questions.length===0)return;let s=this.buildFallbackCarouselAnswers(e,n),l=s,c=await this.getModelId(o);if(c&&!r.isCancellationRequested)try{let u=await this.requestAnswers(c,e,n,r);u.size>0&&(l=this.mergeAnswers(e,u,s))}catch(u){this.logService.debug("#ChatQuestionCarousel: Failed to resolve auto reply",In(u))}r.isCancellationRequested||e.isUsed||await t(l)}async checkOptIn(){return this.storageService.getBoolean("chat.autoReply.optIn",-1,!1)?!0:(await this.dialogService.prompt({type:gt.Warning,message:d(7366,null),buttons:[{label:d(7364,null),run:()=>!0},{label:d(7363,null),run:()=>!1}],custom:{icon:M.warning,disableCloseAction:!0,markdownDetails:[{markdown:new xe(d(7365,null))}]}})).result!==!0?(await this.configService.updateValue("chat.autoReply",!1),!1):(this.storageService.store("chat.autoReply.optIn",!0,-1,0),!0)}async getModelId(e){if(!e)return;let t=await this.languageModelsService.selectLanguageModels({id:e});if(t.length>0)return t[0];if(e.startsWith("copilot/"))return t=await this.languageModelsService.selectLanguageModels({vendor:"copilot",family:e.replace(/^copilot\//,"")}),t[0]}buildPrompt(e,t,o){let n=e.questions.map(s=>({id:s.id,type:s.type,title:s.title,message:typeof s.message=="string"?s.message:s.message?.value,options:s.options?.map(l=>({id:l.id,label:l.label}))??[],allowFreeformInput:s.allowFreeformInput??!1})),r=[];return t&&r.push(`Original user request: ${JSON.stringify(t)}`),["Choose default answers for the following questions.","Return a JSON object keyed by question id.","For text questions, the value should be a string.",'For singleSelect questions, the value should be { "selectedId": string } or { "freeform": string }.','For multiSelect questions, the value should be { "selectedIds": string[] } and may include { "freeform": string }.',"If a question allows freeform input and has no options, return a freeform answer based on the user request when possible.","Use option ids from the provided options.",...r,"Questions:",JSON.stringify(n),o?"Return ONLY valid JSON. Do not include markdown or explanations.":void 0].filter(Boolean).join(`
`)}async requestAnswers(e,t,o,n){let r=this.buildPrompt(t,o,!1),s=await this.languageModelsService.sendChatRequest(e,void 0,[{role:1,content:[{type:"text",value:r}]}],{},n),l=await Tce(s),c=this.parseAnswers(l,t);if(c.size>0||n.isCancellationRequested)return c;let u=this.buildPrompt(t,o,!0),p=await this.languageModelsService.sendChatRequest(e,void 0,[{role:1,content:[{type:"text",value:u}]}],{},n),h=await Tce(p);return this.parseAnswers(h,t)}parseAnswers(e,t){let o=this.tryParseJsonObject(e);if(!o)return new Map;let n=new Map;for(let r of t.questions){let s=o[r.id],l=this.resolveAnswerFromRaw(r,s);l!==void 0&&n.set(r.id,l)}return n}mergeAnswers(e,t,o){let n=new Map;for(let r of e.questions){let s=o.get(r.id);if(this.hasDefaultValue(r)&&s!==void 0){n.set(r.id,s);continue}if(t.has(r.id)){n.set(r.id,t.get(r.id));continue}s!==void 0&&n.set(r.id,s)}return n}hasDefaultValue(e){switch(e.type){case"text":return e.defaultValue!==void 0;case"singleSelect":return typeof e.defaultValue=="string";case"multiSelect":return Array.isArray(e.defaultValue)?e.defaultValue.length>0:typeof e.defaultValue=="string"}}resolveAnswerFromRaw(e,t){switch(e.type){case"text":{if(typeof t=="string"){let o=t.trim();return o.length>0?o:void 0}if(t&&typeof t=="object"&&Wo(t,{value:!0})&&typeof t.value=="string"){let o=t.value.trim();return o.length>0?o:void 0}return}case"singleSelect":{let o,n;if(typeof t=="string"?o=t:t&&typeof t=="object"&&(Wo(t,{selectedId:!0})&&typeof t.selectedId=="string"?o=t.selectedId:Wo(t,{selectedLabel:!0})&&typeof t.selectedLabel=="string"&&(o=t.selectedLabel),Wo(t,{freeform:!0})&&typeof t.freeform=="string"&&(n=t.freeform)),n&&n.trim().length>0)return{selectedValue:void 0,freeformValue:n.trim()};let r=o?this.matchQuestionOption(e,o):void 0;return r?{selectedValue:r.value,freeformValue:void 0}:void 0}case"multiSelect":{let o=[],n;if(Array.isArray(t))o=t.filter(l=>typeof l=="string");else if(typeof t=="string")o=t.split(",").map(l=>l.trim()).filter(l=>l.length>0);else if(t&&typeof t=="object"){if(Wo(t,{selectedIds:!0})){let l=t.selectedIds;Array.isArray(l)&&(o=l.filter(c=>typeof c=="string"))}Wo(t,{freeform:!0})&&typeof t.freeform=="string"&&(n=t.freeform)}let r=o.map(l=>this.matchQuestionOption(e,l)?.value).filter(l=>l!==void 0),s=n?.trim();return r.length>0||s&&s.length>0?{selectedValues:r,freeformValue:s}:void 0}}}matchQuestionOption(e,t){let o=e.options??[];if(!o.length)return;let n=t.trim().toLowerCase(),r=Number.parseInt(n,10);if(!Number.isNaN(r)&&r>0&&r<=o.length){let u=o[r-1];return{id:u.id,value:u.value}}let s=o.find(u=>u.id.toLowerCase()===n);if(s)return{id:s.id,value:s.value};let l=o.find(u=>u.label.toLowerCase()===n);if(l)return{id:l.id,value:l.value};let c=o.find(u=>u.label.toLowerCase().includes(n));if(c)return{id:c.id,value:c.value}}buildFallbackCarouselAnswers(e,t){let o=new Map;for(let n of e.questions){let r=this.getFallbackAnswerForQuestion(n,t);r!==void 0&&o.set(n.id,r)}return o}getFallbackAnswerForQuestion(e,t){let o=t?.trim()||d(7367,null);switch(e.type){case"text":return e.defaultValue??o;case"singleSelect":{let n=typeof e.defaultValue=="string"?e.defaultValue:void 0,r=n?e.options?.find(s=>s.id===n):void 0;return r?{selectedValue:r.value,freeformValue:void 0}:e.options&&e.options.length>0?{selectedValue:e.options[0].value,freeformValue:void 0}:e.allowFreeformInput?{selectedValue:void 0,freeformValue:o}:void 0}case"multiSelect":{let n=Array.isArray(e.defaultValue)?e.defaultValue:typeof e.defaultValue=="string"?[e.defaultValue]:[],r=e.options?.filter(s=>n.includes(s.id)).map(s=>s.value).filter(s=>s!==void 0)??[];return r.length>0?{selectedValues:r,freeformValue:void 0}:e.options&&e.options.length>0?{selectedValues:[e.options[0].value],freeformValue:void 0}:e.allowFreeformInput?{selectedValues:[],freeformValue:o}:void 0}}}tryParseJsonObject(e){let t=e.trim();if(!t)return;let o=t.indexOf("{"),n=t.lastIndexOf("}"),r=o>=0&&n>o?t.slice(o,n+1):t;try{let s=JSON.parse(r);if(s&&typeof s=="object"&&!Array.isArray(s))return s}catch{return}}};yAe=I([m(0,B),m(1,ct),m(2,ne),m(3,le),m(4,Wr)],yAe);var sf=_,amo="GitHub Copilot",q9o=!1,j9o="chat-most-recent-response";function Q9o(a){switch(a){case"confetti":return 1;case"floatingThumbs":return 2;case"pulseWave":return 3;case"radiantLines":return 4;default:return}}var A3=class extends C{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 vt;this.fileTreesByResponseId=new Map;this.focusedFileTreesByResponseId=new Map;this.templateDataByRequestId=new Map;this.responseTemplateDataByRequestId=new Map;this.pendingQuestionCarousels=new vt;this._autoRepliedQuestionCarousels=new Set;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=Le(this,0);this._isVisible=!0;this._onDidChangeVisibility=this._register(new E);this._announcedToolProgressKeys=new Set;this.chatContentMarkdownRenderer=this.instantiationService.createInstance(hee),this.markdownDecorationsRenderer=this.instantiationService.createInstance(Oee),this._editorPool=this._register(this.instantiationService.createInstance(_me,e,o,r,!1)),this._toolEditorPool=this._register(this.instantiationService.createInstance(_me,e,o,r,!0)),this._diffEditorPool=this._register(this.instantiationService.createInstance(APe,e,o,r,!1)),this._treePool=this._register(this.instantiationService.createInstance(SAe,this._onDidChangeVisibility.event)),this._contentReferencesListPool=this._register(this.instantiationService.createInstance(qee,this._onDidChangeVisibility.event,void 0,void 0)),this._register(this.instantiationService.createInstance(gPe)),this._inlineTextModels=this._register(this.instantiationService.createInstance(NPe)),this._toolInvocationCodeBlockCollection=this._register(this.instantiationService.createInstance(YF,"tools")),this._autoReply=this._register(this.instantiationService.createInstance(yAe)),this._register(this.chatService.onDidSubmitRequest(T=>{let N=this.pendingQuestionCarousels.get(T.chatSessionResource);if(N){for(let O of N)O.skip();N.clear()}}))}static{this.ID="item"}set pendingDragController(e){this._pendingDragController=e}updateOptions(e){this.rendererOptions={...this.rendererOptions,...e}}get templateId(){return A3.ID}editorsInUse(){return ht.concat(this._editorPool.inUse(),this._toolEditorPool.inUse())}traceLayout(e,t){q9o?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"?Kn(n,80,2e3):80:typeof n=="number"?Kn(n,40,2e3):8}getCodeBlockInfosForResponse(e){return this.codeBlocksByResponseId.get(e.id)??[]}updateViewModel(e){this.viewModel=e,this._announcedToolProgressKeys.clear(),this._autoRepliedQuestionCarousels.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 P,o=R(e,sf(".chat-row-disabled-overlay")),n=R(e,sf(".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 Ve=R(n,sf(".column.left")),Fe=R(n,sf(".column.right"));r=Ve,l=Fe,s=Fe}let c=R(r,sf(".header")),u=t.add(this.contextKeyService.createScoped(n)),p=t.add(this.instantiationService.createChild(new Io([X,u]))),h=R(n,sf(".request-hover")),g;this.rendererOptions.noHeader?c.classList.add("hidden"):g=t.add(p.createInstance(Ln,h,D.ChatMessageTitle,{menuOptions:{shouldForwardArgs:!0},toolbarOptions:{shouldInlineSubmenu:Ve=>Ve.actions.length<=1}})),this.hoverHidden(h);let f=R(n,sf(".checkpoint-container"));R(f,sf(".checkpoint-line-left"));let v=t.add(p.createInstance(Ln,f,D.ChatMessageCheckpoint,{actionViewItemProvider:(Ve,Fe)=>{if(Ve instanceof Eo)return this.instantiationService.createInstance(VR,Ve,{hoverDelegate:Fe.hoverDelegate})},renderDropdownAsChildElement:!0,menuOptions:{shouldForwardArgs:!0},toolbarOptions:{shouldInlineSubmenu:Ve=>Ve.actions.length<=1}}));R(f,sf(".checkpoint-line-right"));let b=R(c,sf(".user")),S=R(b,sf(".avatar-container")),y=R(b,sf("h3.username"));y.tabIndex=0;let w=R(l??b,sf("span.detail-container")),k=R(w,sf("span.detail"));R(w,sf("span.chat-animated-ellipsis"));let T=R(s,sf(".value")),N=t.add(new P),O=R(n,sf(".chat-footer-toolbar"));this.rendererOptions.noFooter&&O.classList.add("hidden");let V=t.add(p.createInstance(Ln,O,D.ChatMessageFooter,{menuOptions:{shouldForwardArgs:!0,renderShortTitle:!0},toolbarOptions:{shouldInlineSubmenu:Ve=>Ve.actions.length<=1},actionViewItemProvider:(Ve,Fe)=>{if(Ve instanceof Eo&&Ve.item.id===mee)return p.createInstance(jme,Ve,Fe);if(Ve instanceof Eo&&Ve.item.id===Ado){let Qt=Q9o(this.configService.getValue("chat.upvoteAnimation"));return p.createInstance(ml,Ve,{...Fe,onClickAnimation:Qt})}return Ca(p,Ve,Fe)}})),U=R(V.getElement(),sf(".chat-footer-details"));U.tabIndex=0;let G=R(n,sf(".checkpoint-restore-container"));R(G,sf(".checkpoint-line-left"));let $=R(G,sf("span.checkpoint-label-text"));$.textContent=d(7340,null);let te=R(G,sf("span.checkpoint-dot-separator"));te.textContent="\xB7",te.setAttribute("aria-hidden","true");let pe=t.add(p.createInstance(Ln,G,D.ChatMessageRestoreCheckpoint,{actionViewItemProvider:(Ve,Fe)=>{if(Ve instanceof Eo)return this.instantiationService.createInstance(VR,Ve,{hoverDelegate:Fe.hoverDelegate})},renderDropdownAsChildElement:!0,menuOptions:{shouldForwardArgs:!0},toolbarOptions:{shouldInlineSubmenu:Ve=>Ve.actions.length<=1}}));R(G,sf(".checkpoint-line-right"));let de=t.add(this.instantiationService.createInstance(l2)),se=()=>{if(Vi(Ee.currentElement)&&Ee.currentElement.agent&&!Ee.currentElement.agent.isDefault)return de.setAgent(Ee.currentElement.agent.id),de.domNode},Se=KMe(()=>Vi(Ee.currentElement)?Ee.currentElement.agent:void 0,this.commandService);t.add(this.hoverService.setupManagedHover(Ni("element"),b,se,Se)),t.add(j(b,re.KEY_DOWN,Ve=>{let Fe=new Ii(Ve);if(Fe.equals(10)||Fe.equals(3)){let Qt=se();Qt&&this.hoverService.showInstantHover({content:Qt,target:b,trapFocus:!0,actions:Se.actions},!0)}else Fe.equals(9)&&this.hoverService.hideHover()}));let ke=document.createElement("connection-observer");R(e,ke);let Ee={header:c,avatarContainer:S,requestHover:h,username:y,detail:k,value:T,rowContainer:n,elementDisposables:N,templateDisposables:t,contextKeyService:u,instantiationService:p,agentHover:de,titleToolbar:g,footerToolbar:V,footerDetailsContainer:U,disabledOverlay:o,checkpointToolbar:v,checkpointRestoreToolbar:pe,checkpointContainer:f,checkpointRestoreContainer:G};ke.onDidDisconnect=()=>{Ee.renderedPartsMounted=!1},t.add(this._onDidUpdateViewModel.event(()=>{(!Ee.currentElement||!this.viewModel?.sessionResource||!Xe(Ee.currentElement.sessionResource,this.viewModel.sessionResource))&&this.clearRenderedParts(Ee)})),t.add(j(o,re.CLICK,Ve=>{if(!this.viewModel?.editing)return;let Fe=Ee.currentElement;!Fe||Fe.id===this.viewModel.editing.id||o.classList.contains("disabled")&&(Ve.preventDefault(),Ve.stopPropagation(),this._onDidFocusOutside.fire())}));let He=t.add(new eL(Ve=>{let Fe=Ve[0];Fe&&this.fireItemHeightChange(Ee,Fe.borderBoxSize.at(0)?.blockSize)}));return t.add(He.observe(n)),Ee}renderElement(e,t,o){this._elementBeingRendered=e.element;try{this.renderChatTreeItem(e.element,t,o)}finally{this._elementBeingRendered=void 0}}clearRenderedParts(e){e.renderedParts&&(Ue(si(e.renderedParts)),e.renderedParts=void 0,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 b=this.templateDataByRequestId.get(o.currentElement.id);b&&b.currentElement?.id!==o.currentElement.id&&this.templateDataByRequestId.delete(o.currentElement.id),this.clearRenderedParts(o)}if(o.currentElement=e,this.templateDataByRequestId.set(e.id,o),pBt(e)){this.renderPendingDivider(e,o);return}let n=Rr(e)?"request":Vi(e)?"response":pBt(e)?"pendingDivider":"welcome";this.traceLayout("renderElement",`${n}, index=${t}`),ie.isResponse.bindTo(o.contextKeyService).set(Vi(e)),ie.itemId.bindTo(o.contextKeyService).set(e.id),ie.isRequest.bindTo(o.contextKeyService).set(Rr(e)),ie.isPendingRequest.bindTo(o.contextKeyService).set(Rr(e)&&!!e.pendingKind),ie.responseDetectedAgentCommand.bindTo(o.contextKeyService).set(Vi(e)&&e.agentOrSlashCommandDetected),Vi(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,Vi(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(Vi(e)&&!!e.errorDetails);let r=!!(Vi(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",Rr(e)),o.rowContainer.classList.toggle("interactive-response",Vi(e)),o.rowContainer.classList.remove("pending-item","pending-divider","pending-request"),o.dragHandle?.remove(),o.dragHandle=void 0,delete o.rowContainer.dataset.pendingRequestId,delete o.rowContainer.dataset.pendingKind;let l=ZX(this.delegate.currentChatMode(),this.rendererOptions.progressMessageAtBottomOfResponse);o.rowContainer.classList.toggle("show-detail-progress",Vi(e)&&!e.isComplete&&!e.progressMessages.length&&!l),this.rendererOptions.noHeader||this.renderAvatar(e,o),o.username.textContent=e.username,o.username.classList.toggle("hidden",e.username===amo||this.environmentService.isSessionsWindow),o.avatarContainer.classList.toggle("hidden",e.username===amo||this.environmentService.isSessionsWindow),this.hoverHidden(o.requestHover),Rt(o.detail),Vi(e)&&this.renderDetail(e,o),o.checkpointToolbar.context=e;let c=this.configService.getValue("chat.checkpoints.enabled")&&(this.rendererOptions.restorable??!0),u=Rr(e)&&!!e.pendingKind;if(o.checkpointContainer.classList.toggle("hidden",Vi(e)||u||!c),o.footerToolbar.refresh(),o.checkpointToolbar.refresh(),o.checkpointRestoreToolbar.refresh(),Vi(e)&&(this.responseTemplateDataByRequestId.set(e.requestId,o),o.elementDisposables.add(Z(()=>this.responseTemplateDataByRequestId.delete(e.requestId)))),!u){let b=S=>{let y=Rr(e)?e.id:Vi(e)?e.requestId:void 0;if(!y)return;let w=this.templateDataByRequestId.get(y),k=this.responseTemplateDataByRequestId.get(y);w?.checkpointContainer.classList.toggle("group-hovered",S),k?.rowContainer.classList.toggle("group-hovered",S)};o.elementDisposables.add(j(o.rowContainer,re.MOUSE_ENTER,()=>b(!0))),o.elementDisposables.add(j(o.rowContainer,re.MOUSE_LEAVE,()=>b(!1))),o.elementDisposables.add(Z(()=>b(!1)))}let p=this.viewModel?.model.checkpoint&&!this.viewModel?.editing&&t===this.delegate.getListLength()-1&&!u;o.checkpointRestoreContainer.classList.toggle("hidden",!(p&&c));let h=e.id===this.viewModel?.editing?.id,g=this.configService.getValue("chat.editRequests")==="input";o.elementDisposables.add(he(b=>{let S=e.shouldBeBlocked.read(b);o.disabledOverlay.classList.toggle("disabled",S&&!h&&this.viewModel?.editing!==void 0)})),o.rowContainer.classList.toggle("editing",h&&!g),o.rowContainer.classList.toggle("editing-input",h&&g),o.requestHover.classList.toggle("editing",h&&g),o.requestHover.classList.toggle("hidden",!!this.viewModel?.editing&&!h||Vi(e)||!this.rendererOptions.editable),o.requestHover.classList.toggle("expanded",this.configService.getValue("chat.editRequests")==="hover"),o.requestHover.classList.toggle("checkpoints-enabled",c),o.elementDisposables.add(Vo(o.rowContainer,re.CLICK,b=>{let S=o.currentElement;S&&this.viewModel?.editing&&S.id!==this.viewModel.editing.id&&(b.stopPropagation(),b.preventDefault(),this._onDidFocusOutside.fire())}));let f=o.rowContainer.parentElement?.parentElement?.parentElement;f?.classList.toggle("request",Rr(e)),f?.classList.toggle("response",Vi(e)),o.rowContainer.classList.toggle(j9o,t===this.delegate.getListLength()-1),o.rowContainer.classList.toggle("confirmation-message",Rr(e)&&!!e.confirmation);let v=Vi(e)&&!this.rendererOptions.noHeader;if(o.header?.classList.toggle("header-disabled",!v),Rr(e)&&e.confirmation&&this.renderConfirmationAction(e,o),Vi(e)&&t===this.delegate.getListLength()-1&&(!e.isComplete||e.renderData)){this.traceLayout("renderElement",`start progressive render, index=${t}`);let b=o.elementDisposables.add(new ZD),S=y=>{try{this.doNextProgressiveRender(e,t,o,!!y)&&b.cancel()}catch(w){b.cancel(),this.logService.error(w)}};b.cancelAndSet(S,50,Me(o.rowContainer)),S(!0)}else Vi(e)?this.renderChatResponseBasic(e,t,o):Rr(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=R(o,_("span.pending-divider-label"));e.dividerKind==="steering"?(n.textContent=d(7358,null),n.title=d(7359,null)):(n.textContent=d(7352,null),n.title=d(7353,null)),t.value.appendChild(o)}renderDetail(e,t){if(Rt(t.detail),e.agentOrSlashCommandDetected){let o=e.slashCommand?d(7361,null,`${yu}${e.slashCommand.name}`):d(7360,null);Fi(t.detail,RL(o,{actionHandler:{disposables:t.elementDisposables,callback:n=>{this._onDidClickRerunWithAgentOrCommandDetection.fire(e)}}},sf("span.agentOrSlashCommandDetected")))}else this.rendererOptions.renderStyle!=="minimal"&&!e.isComplete&&!ZX(this.delegate.currentChatMode(),this.rendererOptions.progressMessageAtBottomOfResponse)&&(t.detail.textContent=d(7362,null))}renderConfirmationAction(e,t){if(Rt(t.detail),e.confirmation){R(t.detail,sf("span.codicon.codicon-check",{"aria-hidden":"true"})),R(t.detail,sf("span.confirmation-text",void 0,d(7339,null,e.confirmation))),t.header?.classList.remove("header-disabled"),t.header?.classList.add("partially-disabled");let o=()=>t.detail.classList.toggle("show-checkmarks",!!this.configService.getValue("accessibility.chat.showCheckmarks"));o(),t.elementDisposables.add(this.configService.onDidChangeConfiguration(n=>{n.affectsConfiguration("accessibility.chat.showCheckmarks")&&o()}))}}renderAvatar(e,t){if(pBt(e))return;let o;if(Vi(e)?o=this.getAgentIcon(e.agent?.metadata):Rr(e)?o=e.avatarIcon??M.account:o=M.account,o instanceof A){let n=_("img.icon");n.src=gn.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&&Ip(this.themeService.getColorTheme().type)?e.iconDark:e?.icon?e.icon:M.chatSparkle}renderChatResponseBasic(e,t,o){if(o.rowContainer.classList.toggle("chat-response-loading",Vi(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(...VCi(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!==t6&&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){if(e.agentOrSlashCommandDetected||this.rendererOptions.renderStyle==="minimal"||e.isComplete||!ZX(this.delegate.currentChatMode(),this.rendererOptions.progressMessageAtBottomOfResponse)||t.some(u=>u.kind==="toolInvocation"&&lo.isStreaming(u)))return!1;let n=ju(t,u=>u.kind!=="markdownContent"||u.content.value.trim().length>0);if(t.some(u=>u.kind==="thinking")||this.getLastThinkingPart(o.renderedParts)||this.configService.getValue("chat.agent.thinking.collapsedTools")!=="off"&&t.some(u=>(u.kind==="toolInvocation"||u.kind==="toolInvocationSerialized")&&this.shouldPinPart(u,e)))return!1;let l=(o.renderedParts??[]).some(u=>u instanceof vD),c=t.some(u=>u.kind==="markdownContent"&&this.hasEditCodeblockUri(u));return l&&c||this.getSubagentPart(o.renderedParts)?!1:!!(!n||n.kind==="references"||(n.kind==="toolInvocation"||n.kind==="toolInvocationSerialized")&&(lo.isComplete(n)||n.presentation==="hidden")||(n.kind==="textEditGroup"||n.kind==="notebookEditGroup")&&n.done&&!t.some(u=>u.kind==="toolInvocation"&&!lo.isComplete(u))||n.kind==="progressTask"&&n.deferred.isSettled||n.kind==="mcpServersStarting"||n.kind==="disabledClaudeHooks"||n.kind==="hook")}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(c=>c.kind===e.pendingKind).length>1)){let c=_(".chat-pending-drag-handle"+q.asCSSSelector(M.gripper));o.rowContainer.prepend(c),o.dragHandle=c,this._pendingDragController.attachDragHandle(e,c,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,l=>{let c=new Ii(l);(c.equals(10)||c.equals(3))&&this.viewModel?.editing?.id!==e.id&&(c.preventDefault(),c.stopPropagation(),this._onDidClickRequest.fire(o))}));let n=[];if(!e.confirmation){let l=AYi(e.message)?e.message.message:this.markdownDecorationsRenderer.convertParsedRequestToMarkdown(e.sessionResource,e.message);n=[{content:new xe(l),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 xe("<span></span>",{supportHtml:!0}),kind:"markdownContent"})):o.value.classList.remove("inline-progress")}Rt(o.value);let r=[],s=!1;if(n.forEach((l,c)=>{let u={element:e,elementIndex:t,contentIndex:c,content:n,container:o.rowContainer,editorPool:this._editorPool,diffEditorPool:this._diffEditorPool,codeBlockModelCollection:this.codeBlockModelCollection,currentWidth:this._currentLayoutWidth,onDidChangeVisibility:this._onDidChangeVisibility.event,inlineTextModels:this._inlineTextModels,get codeBlockStartIndex(){return r.reduce((h,g)=>h+(g.codeblocks?.length??0),0)},get treeStartIndex(){return r.filter(h=>h instanceof ite).length}},p=this.renderChatContentPart(l,o,u);if(p){if(this.rendererOptions.renderDetectedCommandsWithRequest&&!s&&e.agentOrSlashCommandDetected&&e.slashCommand&&l.kind==="markdownContent"){p.domNode&&(p.domNode.style.display="inline-flex");let h=this.instantiationService.createInstance(GMe,e.slashCommand,()=>this._onDidClickRerunWithAgentOrCommandDetection.fire({sessionResource:e.sessionResource,requestId:e.id}));o.value.appendChild(h.domNode),r.push(h),s=!0}p.domNode&&o.value.appendChild(p.domNode),r.push(p)}}),o.renderedParts&&Ue(o.renderedParts),o.renderedParts=r,e.variables.length){let l=this.renderAttachments(e.variables,e.contentReferences,o);l.domNode&&o.value.appendChild(l.domNode),o.elementDisposables.add(l)}}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=e.findLastIndex(c=>c?.kind==="markdownContent");e.forEach((c,u)=>{let p=r.renderedParts?.[u],h=c?.kind==="markdownContent"&&u===l&&o.isComplete;if(!c){r.renderedPartsMounted||p?.onDidRemount?.();return}if(p){if(c.kind==="thinking"&&p instanceof vD){Array.isArray(c.value)||p.updateThinking(c),s[u]=p;return}else if(p instanceof vD&&this.shouldPinPart(c,o)&&!h){s[u]=p;return}if(p.dispose(),p.domNode){let S=Nh(p.domNode,"chat-thinking-tool-wrapper");S&&S.replaceWith(p.domNode)}}let g=s.slice(0,u),f={element:o,elementIndex:n,content:t,contentIndex:u,container:r.rowContainer,editorPool:this._editorPool,diffEditorPool:this._diffEditorPool,codeBlockModelCollection:this.codeBlockModelCollection,currentWidth:this._currentLayoutWidth,onDidChangeVisibility:this._onDidChangeVisibility.event,inlineTextModels:this._inlineTextModels,get codeBlockStartIndex(){return g.reduce((S,y)=>S+(y.codeblocks?.length??0),0)},get treeStartIndex(){return g.filter(S=>S instanceof ite).length}};if(this.getLastThinkingPart(s)&&(c.kind==="toolInvocation"||c.kind==="toolInvocationSerialized"||c.kind==="markdownContent"||c.kind==="textEditGroup"||c.kind==="hook")&&this.shouldPinPart(c,o)&&!h){let S=this.renderChatContentPart(c,r,f);S&&(s[u]=S,p instanceof Lme&&p?.domNode&&p.domNode.remove());return}let b=this.renderChatContentPart(c,r,f);if(b){s[u]=b;try{p?.domNode?b.domNode?p.domNode.replaceWith(b.domNode):p.domNode.remove():b.domNode&&!b.domNode.parentElement&&r.value.appendChild(b.domNode)}catch(S){this.logService.error("ChatListItemRenderer#renderChatContentDiff: error replacing part",S)}}else p?.domNode?.remove()});for(let c=e.length;c<s.length;c++){let u=s[c];u&&(u.dispose(),u.domNode?.remove(),delete s[c])}}getNextProgressiveRenderContent(e,t){let o=this.getDataForProgressiveRender(e),n=this.configService.getValue("chat.experimental.renderMarkdownImmediately")===!0,r=VCi(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=ICi(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 xe(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,t)&&l.push({kind:"working"});let g=this.getChatFileChangesSummaryPart(e);return g&&l.push(g),{content:l,moreContentAvailable:c}}shouldShowFileChangesSummary(e){let t=fg(e.sessionResource)===qp;return e.isComplete&&t&&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=[],r=Vi(o)&&o.isComplete,s=t.findLastIndex(l=>l.kind==="markdownContent");for(let l=0;l<t.length;l++){let c=t[l],u=e[l];if(c.kind==="markdownContent"&&l===s&&r&&this.isRenderedPartInsideThinking(u)){n.push(c);continue}!u||!u.hasSameContent(c,t.slice(l+1),o)?n.push(c):n.push(null)}return n}isRenderedPartInsideThinking(e){return e?.domNode?!!Nh(e.domNode,"chat-thinking-box"):!1}hasEditCodeblockUri(e){return e.kind!=="markdownContent"?!1:Fdo(e.content.value)}isCodeblockComplete(e,t){return e.kind!=="markdownContent"?!0:!Vi(t)||t.isComplete||Nxi(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")&&e.source?.type==="mcp"||(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")&&cmo(e))return!1;let l=(e.kind==="toolInvocation"||e.kind==="toolInvocationSerialized")&&e.toolSpecificData?.kind==="terminal",c=t&&t.sessionResource.scheme!==Y.vscodeChatInput&&t.sessionResource.scheme!==Y.vscodeLocalChatSession&&e.kind==="toolInvocationSerialized"&&e.toolSpecificData?.kind==="terminal";if(l&&!c)return e.kind==="toolInvocation"&&lo.getConfirmationMessages(e)?!1:!!this.configService.getValue("chat.agent.thinking.terminalTools");if(e.kind==="toolInvocation"){if(lo.isStreaming(e))return!0;let u=e.state.get();return u.type===lo.StateKind.WaitingForConfirmation||u.type===lo.StateKind.WaitingForPostApproval?!1:!lo.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 vD&&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 KR&&(t&&n.subAgentInvocationId===t||!t&&n.getIsActive()))return n}}finalizeAllSubagentParts(e){if(e.renderedParts)for(let t of e.renderedParts)t instanceof KR&&t.getIsActive()&&t.markAsInactive()}handleSubagentToolGrouping(e,t,o,n,r){this.finalizeCurrentThinkingPart(o,n);let s=this.getSubagentPart(n.renderedParts,t);if(s)return _ki(e)||s.appendToolInvocation(e,r),s;let l=this.instantiationService.createInstance(KR,t,e,o,this.chatContentMarkdownRenderer,this._contentReferencesListPool,this._toolEditorPool,()=>this._currentLayoutWidth.get(),this._toolInvocationCodeBlockCollection,this._announcedToolProgressKeys);return _ki(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=Vi(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")&&cmo(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(fD,e,this.chatContentMarkdownRenderer,o,void 0,void 0,void 0,void 0,e.shimmer):e.kind==="working"?this.instantiationService.createInstance(Lme,e,this.chatContentMarkdownRenderer,o):e.kind==="progressTask"||e.kind==="progressTaskSerialized"?this.renderProgressTask(e,t,o):e.kind==="command"?this.instantiationService.createInstance(mPe,e,o):e.kind==="textEditGroup"?this.renderTextEdit(o,e,t):e.kind==="confirmation"?this.renderConfirmation(o,e,t):e.kind==="warning"?this.instantiationService.createInstance(FPe,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"?Vi(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(IAe,e,o,this.chatContentMarkdownRenderer):this.renderNoContent(l=>e.kind===l.kind)}catch(n){Jo(`Chat error: ${In(n,!1)}`),this.logService.error("ChatListItemRenderer#renderChatContentPart: error rendering content",In(n,!0));let r=this.instantiationService.createInstance(FPe,2,new xe(d(7355,null)+`: ${In(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(!Vi(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(GPe,e.element,t,this.chatContentMarkdownRenderer);if(t.errorDetails.isRateLimited&&this.chatEntitlementService.anonymous)return this.instantiationService.createInstance($Me,t);if(t.errorDetails.confirmationButtons&&n){let r=t.errorDetails.level??2;return this.instantiationService.createInstance(WPe,r,new xe(t.errorDetails.message),t,t.errorDetails.confirmationButtons,this.chatContentMarkdownRenderer,e)}else{let r=t.errorDetails.level??2;return this.instantiationService.createInstance(FPe,r,new xe(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(ite,n,this._treePool);if(Vi(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,Uo(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(zPe,e,o.element)}renderContentReferencesListData(e,t,o,n){return this.instantiationService.createInstance($Pe,e.references,t,o,this._contentReferencesListPool,{expandedWhenEmptyResponse:ZX(this.delegate.currentChatMode(),this.rendererOptions.referencesExpandedWhenEmptyResponse)})}renderCodeCitations(e,t,o){return this.instantiationService.createInstance(pPe,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(nbe(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(tte,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,part:r}),l=this.configService.getValue("chat.agent.thinking.collapsedTools");if(Vi(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 vD&&(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 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=dmo(e);if(c&&Vi(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(g?.domNode){let f=g.domNode.parentElement;f?.classList.contains("chat-thinking-tool-wrapper")&&f.remove(),s.value.appendChild(g.domNode)}else{t.removeLazyItem(e.toolId);let{domNode:f}=n();s.value.appendChild(f)}this.finalizeCurrentThinkingPart(r,s)},c=e.state.get();if(c.type===lo.StateKind.WaitingForConfirmation||c.type===lo.StateKind.WaitingForPostApproval){l();return}if(!(g=>g===lo.StateKind.Streaming||g===lo.StateKind.Executing)(c.type))return;let p=!1,h=he(g=>{let f=e.state.read(g);if(f.type===lo.StateKind.WaitingForConfirmation||f.type===lo.StateKind.WaitingForPostApproval){if(p)return;p=!0,h.dispose(),l()}});t.addDisposable(h)}renderExtensionsContent(e,t,o){return this.instantiationService.createInstance(d2,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(ote,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(7342,null,e.toolDisplayName):d(7343,null):e.toolDisplayName?d(7344,null,e.toolDisplayName):d(7345,null),l=this.getLastThinkingPart(o.renderedParts);if(!l){let c=this.renderThinkingPart({kind:"thinking"},t,o);c instanceof vD&&(l=c)}if(l)return l.appendItem(()=>{let c=this.instantiationService.createInstance(ote,e,t);return{domNode:c.domNode,disposable:c}},s,void 0,o.value),l}return this.instantiationService.createInstance(ote,e,t)}renderPullRequestContent(e,t,o){return this.instantiationService.createInstance(KPe,e)}renderProgressTask(e,t,o){return Vi(o.element)?this.instantiationService.createInstance(qPe,e,this._contentReferencesListPool,this.chatContentMarkdownRenderer,o):void 0}renderConfirmation(e,t,o){return this.instantiationService.createInstance(PPe,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(OPe,t,e))}renderQuestionCarousel(e,t,o){this.finalizeCurrentThinkingPart(e,o),this._notifyOnQuestionCarousel(e,t);let n=Vi(e.element)?this.chatWidgetService.getWidgetBySessionResource(e.element.sessionResource):void 0,r=n?n.getInput()==="":!0,s=n?.input.currentLanguageModel,l=Vi(e.element)?e.element.requestId:void 0,c=Vi(e.element)?this.getRequestMessageText(e.element):void 0,u=async(v,b)=>{let S=v?Object.fromEntries(v):void 0;t.data=S??{},t.isUsed=!0,t instanceof a2&&(t.draftAnswers=void 0,t.draftCurrentIndex=void 0,t.completion.complete({answers:S})),Vi(e.element)&&t.resolveId&&this.chatService.notifyQuestionCarouselAnswer(e.element.requestId,t.resolveId,S),this.removeCarouselFromTracking(e,b);let y=t.resolveId??`${l}_${e.contentIndex}`;n?.input.clearQuestionCarousel(void 0,y)},p=Vi(e.element)&&e.element.isComplete,h=n?.input.questionCarousel!==void 0;if(t.isUsed||p){p&&!t.isUsed&&Vi(e.element)&&t.resolveId&&(t.data={},t.isUsed=!0,t instanceof a2&&(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()),p&&h&&l&&n?.input.clearQuestionCarousel(l);let v=this.instantiationService.createInstance(k3,t,e,{shouldAutoFocus:!1,onSubmit:async b=>u(b,v)});return v}let f=!!this.viewModel?.editing?void 0:n?.input.renderQuestionCarousel(t,e,{shouldAutoFocus:r,onSubmit:async v=>u(v,f)});if(!f){let v=this.instantiationService.createInstance(k3,t,e,{shouldAutoFocus:r,onSubmit:async b=>u(b,v)});return this.maybeAutoReplyToQuestionCarousel(e,t,v,b=>u(b,v),s,c),v}if(this.maybeAutoReplyToQuestionCarousel(e,t,f,v=>u(v,f),s,c),Vi(e.element)&&t.allowSkip&&!t.isUsed){let v=this.pendingQuestionCarousels.get(e.element.sessionResource);v||(v=new Set,this.pendingQuestionCarousels.set(e.element.sessionResource,v)),v.has(f)||(v.add(f),f.addDisposable({dispose:()=>this.removeCarouselFromTracking(e,f)}))}return this.renderNoContent((v,b,S)=>{if(t.isUsed||Vi(S)&&S.isComplete)return!1;if(v.kind==="questionCarousel"){let y=v;return t.resolveId&&y.resolveId?t.resolveId===y.resolveId:v===t}return!1})}_getCarouselStableKey(e,t){let o=Vi(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(7336,null),s=typeof r=="string"?r:r.value,l=n===1?d(7335,null,s):d(7334,null,n,s);this.accessibilityService.alert(l),o&&this._notifiedQuestionCarousels.add(o);let c=n===1?d(7338,null):d(7337,null,n);this.accessibilitySignalService.playSignal($o.chatUserActionRequired,{allowManyInParallel:!0,customAlertMessage:c})}maybeAutoReplyToQuestionCarousel(e,t,o,n,r,s){if(t.isUsed)return;let l=this._getCarouselStableKey(e,t);if(l){if(this._autoRepliedQuestionCarousels.has(l))return;this._autoRepliedQuestionCarousels.add(l)}this._autoReply.shouldAutoReply().then(c=>{let u=this._isAutopilotForContext(e);if(!c&&!u){l&&this._autoRepliedQuestionCarousels.delete(l);return}let p=new $e;o.addDisposable(Z(()=>{p.cancel(),p.dispose()})),this._autoReply.autoReply(t,n,r,s,p.token).catch(h=>{this.logService.debug("#ChatQuestionCarousel: Auto reply failed",In(h))})})}getRequestMessageText(e){let t=e.requestId;return e.session.getItems().find(r=>Rr(r)&&r.id===t)?.messageText}_isAutopilotForContext(e){return!!(Vi(e.element)&&e.element.model.request?.modeInfo?.permissionLevel==="autopilot"||Vi(e.element)&&(this.chatWidgetService.getWidgetBySessionResource(e.element.sessionResource)??this.chatWidgetService.lastFocusedWidget)?.input.currentModeInfo.permissionLevel==="autopilot")}removeCarouselFromTracking(e,t){if(Vi(e.element)){let o=this.pendingQuestionCarousels.get(e.element.sessionResource);o&&o.delete(t)}}renderChangesSummary(e,t,o){return this.instantiationService.createInstance(uPe,e,t)}renderAttachments(e,t,o){return this.instantiationService.createInstance(Nee,{variables:e,contentReferences:t,domNode:void 0})}renderTextEdit(e,t,o){return this.instantiationService.createInstance(jPe,t,e,this.rendererOptions,this._diffEditorPool,this._currentLayoutWidth.get())}renderMarkdown(e,t,o){let n=o.element,r=Vi(n)&&n.isComplete&&!n.renderData,s=r?o.content.findLastIndex(g=>g.kind==="thinking"||g.kind==="toolInvocation"||g.kind==="toolInvocationSerialized"):-1,l=r&&o.contentIndex>s;(!this.hasEditCodeblockUri(e)||l)&&this.finalizeCurrentThinkingPart(o,t);let c=Vi(n)&&(!n.isComplete||n.isCanceled||n.errorDetails?.responseIsFiltered||n.errorDetails?.responseIsIncomplete||!!n.renderData),u=o.codeBlockStartIndex,p=t.instantiationService.createInstance(lT,e,o,this._editorPool,c,u,this.chatContentMarkdownRenderer,void 0,this._currentLayoutWidth.get(),this.codeBlockModelCollection,{});p.addDisposable(p.onDidChangeHeight(()=>this.fireItemHeightChange(t))),Rr(n)&&(p.domNode.tabIndex=0,this.configService.getValue("chat.editRequests")==="inline"&&this.rendererOptions.editable&&(p.domNode.classList.add("clickable"),p.addDisposable(j(p.domNode,re.CLICK,g=>{if(this.viewModel?.editing?.id===n.id)return;let f=g.target;if(f.tagName==="A")return;let v=Me(t.rowContainer).getSelection();if(v&&!v.isCollapsed&&v.toString().length>0)return;let b=Nh(f,"monaco-editor");b&&Array.from(this.editorsInUse()).find(y=>y.element.contains(b))?.editor.getSelection()?.isEmpty()===!1||(g.preventDefault(),g.stopPropagation(),this._onDidClickRequest.fire(t))})),p.addDisposable(this.hoverService.setupManagedHover(Ni("element"),p.domNode,d(7357,null),{trapFocus:!0}))),p.addDisposable(j(p.domNode,re.FOCUS,()=>{this.hoverVisible(t.requestHover)})),p.addDisposable(j(p.domNode,re.BLUR,()=>{this.hoverHidden(t.requestHover)}))),this.handleRenderedCodeblocks(n,p,u);let h=this.configService.getValue("chat.agent.thinking.collapsedTools");if(Vi(o.element)&&h!=="off"&&!l){let g=this.isCodeblockComplete(e,o.element),f=Odo(e.content.value);if(f){let b=this.getSubagentPart(t.renderedParts,f);if(b&&p?.domNode&&g)return b.appendMarkdownItem(()=>({domNode:p.domNode,disposable:p}),p.codeblocksPartId,e,t.value),b}let v=this.getLastThinkingPart(t.renderedParts);if(!v&&p?.domNode&&this.shouldPinPart(e,o.element)&&h==="always"&&g){let b=this.renderThinkingPart({kind:"thinking"},o,t);return b instanceof vD&&b.appendItem(()=>({domNode:p.domNode,disposable:p}),p.codeblocksPartId,e,t.value),b}this.shouldPinPart(e,o.element)&&g?v&&p?.domNode&&v.appendItem(()=>({domNode:p.domNode,disposable:p}),p.codeblocksPartId,e,t.value):this.shouldPinPart(e,o.element)||this.finalizeCurrentThinkingPart(o,t)}return p}renderThinkingPart(e,t,o){e.id||(e.id=Date.now().toString());let n=Vi(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 vD&&s.getIsActive()?s:void 0;if(c)c.setupThinkingContainer({...e,value:l});else{let u={...e,value:l};s=o.instantiationService.createInstance(vD,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(vD,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),Rr(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(HPe,e,t)}renderDisabledClaudeHooks(e,t){return this.instantiationService.createInstance(UPe,t)}disposeTemplate(e){this.clearRenderedParts(e),e.templateDisposables.dispose()}hoverVisible(e){e.style.opacity="1"}hoverHidden(e){e.style.opacity="0"}};A3=I([m(6,F),m(7,B),m(8,ne),m(9,X),m(10,De),m(11,ge),m(12,tt),m(13,At),m(14,vr),m(15,Si),m(16,tr),m(17,Bi),m(18,Vt)],A3);var YHt=class extends d1{constructor(e){super();this.defaultElementHeight=e}estimateHeight(e){return e.currentRenderedHeight??this.defaultElementHeight}getTemplateId(e){return A3.ID}hasDynamicHeight(e){return!0}},lmo={incorrectCode:d(7347,null),didNotFollowInstructions:d(7341,null),missingContext:d(7348,null),offensiveOrUnsafe:d(7349,null),poorlyWrittenOrFormatted:d(7351,null),refusedAValidRequest:d(7354,null),incompleteCode:d(7346,null),willReportIssue:d(7356,null),other:d(7350,null)},jme=class extends wp{constructor(e,t,o,n,r,s){super(e,{getActions:()=>this.getActions()},s,{...t,classNames:q.asClassNameArray(M.thumbsdown)});this.commandService=o;this.issueService=n;this.logService=r}getActions(){return[this.getVoteDownDetailAction("incorrectCode"),this.getVoteDownDetailAction("didNotFollowInstructions"),this.getVoteDownDetailAction("incompleteCode"),this.getVoteDownDetailAction("missingContext"),this.getVoteDownDetailAction("poorlyWrittenOrFormatted"),this.getVoteDownDetailAction("refusedAValidRequest"),this.getVoteDownDetailAction("offensiveOrUnsafe"),this.getVoteDownDetailAction("other"),{id:"reportIssue",label:lmo.willReportIssue,tooltip:"",enabled:!0,class:void 0,run:async e=>{if(!Vi(e)){this.logService.error("ChatVoteDownButton#run: invalid context");return}await this.commandService.executeCommand(mee,e,"willReportIssue"),await this.issueService.openReporter({extensionId:e.agent?.extensionId.value})}}]}render(e){super.render(e),this.element?.classList.toggle("checked",this.action.checked)}getVoteDownDetailAction(e){let t=lmo[e];return{id:mee,label:t,tooltip:"",enabled:!0,checked:this._context.voteDownReason===e,class:void 0,run:async o=>{if(!Vi(o)){this.logService.error("ChatVoteDownButton#getVoteDownDetailAction: invalid context");return}await this.commandService.executeCommand(mee,o,e)}}}};jme=I([m(2,ge),m(3,UC),m(4,ne),m(5,ze)],jme);function _ki(a){return a.toolSpecificData?.kind==="subagent"&&!a.subAgentInvocationId}function dmo(a){return _ki(a)?a.toolCallId:a.subAgentInvocationId}function cmo(a){return!!dmo(a)}var XHt=ae("chatLayoutService");function Y9o(){return{applyingInstructionsCount:0,referencedInstructionsCount:0,agentInstructionsCount:0,listedInstructionsCount:0,totalInstructionsCount:0,claudeRulesCount:0,claudeMdCount:0,claudeAgentsCount:0}}var nte=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g){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._workspaceService=c;this._fileService=u;this._remoteAgentService=p;this._telemetryService=h;this._languageModelToolsService=g;this._parseResults=new vt}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=Y9o(),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._getInstructionsWithPatternsList(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 addApplyingInstructions(i,e,t,o,n){if(!this._configurationService.getValue(Ts.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=oee(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(7657,null,h,this._labelService.getUriLabel(g.file,{relative:!0})):d(7655,null);t.add(mP(s,"vscode.prompt.instructions.root",f,!0)),o.applyingInstructionsCount++,p&&o.claudeRulesCount++}else this._logService.trace(`[InstructionsContextComputer] No match for ${s} with ${h}`)}}_getContext(i){let e=new Mn,t=new Mn;for(let o of i.asArray())if(pP(o))t.add(o.value);else{let n=uV.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 Uj,s=new Uj;for(let{uri:l,type:c}of n){let u=mP(l,"vscode.prompt.instructions.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)}_getApplyToPattern(i,e){if(i)return i;if(e&&e.length>0)return e.join(", ")}_matches(i,e){let t=HL(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(Cp(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 _getInstructionsWithPatternsList(i,e,t,o){let n=this._getTool("readFile"),r=this._getTool(Kj.runSubagent),l=(await this._remoteAgentService.getEnvironment())?.os,c=f=>X9o(f,l),u=[];if(n){let v=this._configurationService.getValue(Ts.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:k}of i){let T=await this._parseInstructionsFile(k,o);if(T){if(u.push("<instruction>"),T.header){let{description:N,applyTo:O,paths:V}=T.header;N&&u.push(`<description>${N}</description>`),u.push(`<file>${c(k)}</file>`);let U=this._getApplyToPattern(O,V);U&&u.push(`<applyTo>${U}</applyTo>`)}else u.push(`<file>${c(k)}</file>`);u.push("</instruction>"),b=!0}}let S=await v;for(let{uri:k}of S){let T=this._labelService.getUriLabel(ci(k),{relative:!0}),N=T.trim().length===0?d(7654,null):d(7653,null,T);u.push("<instruction>"),u.push(`<description>${N}</description>`),u.push(`<file>${c(k)}</file>`),u.push("</instruction>"),b=!0}b?u.push("</instructions>","",""):u.length=0;let w=(await this._promptsService.findAgentSkills(o,this._sessionResource))?.filter(k=>!k.disableModelInvocation);if(w&&w.length>0){let k=this._configurationService.getValue(Ts.USE_SKILL_ADHERENCE_PROMPT);u.push("<skills>"),k?(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 T of w)u.push("<skill>"),u.push(`<name>${T.name}</name>`),T.description&&u.push(`<description>${T.description}</description>`),u.push(`<file>${c(T.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>"),oBt(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(Dce(f.tool,new di(v,v+f.variable.length))),v=p.indexOf(f.variable,v+1)}};return g(n),g(r),kYi(p,!0,h)}async _addReferencedInstructions(i,e,t){if(!this._configurationService.getValue(Ts.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 Mn,r=[];for(let l of i.asArray())pP(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)&&(uCi(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){uCi(g)&&r.push(g);let f=d(7656,null,Ye(s));i.add(mP(g,"vscode.prompt.instructions",f,!0)),e.referencedInstructionsCount++,this._logService.trace(`[InstructionsContextComputer] ${g.toString()} added, referenced by ${s.toString()}`)}}}}s=r.pop()}}};nte=I([m(4,nr),m(5,ne),m(6,ot),m(7,B),m(8,Pe),m(9,be),m(10,yo),m(11,Te),m(12,jn)],nte);function X9o(a,i){if(a.scheme===Y.file||a.scheme===Y.vscodeRemote){let e=a.fsPath;return i!==void 0?i===1?e.replace(/\//g,"\\"):e.replace(/\\/g,"/"):e}return a.toString()}var wAe=class extends C{constructor(e,t){super();this.contextMenuService=e;this.chatSessionsService=t;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=R(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(7196,null);this.titleElement.textContent=d(7197,null,o);let n=[];for(let r=1;r<this.promptsContainer.children.length;r++)n.push(this.promptsContainer.children[r]);for(let r of n){let s=this.buttonDisposables.get(r);s&&(s.dispose(),this.buttonDisposables.delete(r)),this.promptsContainer.removeChild(r)}for(let r of t){let s=this.createPromptButton(r);this.promptsContainer.appendChild(s)}this.domNode.style.display="flex",this._onDidChangeHeight.fire()}createPromptButton(e){let t=new P,o=e.label,n=()=>this._currentMode?.handOffs?.get()?.find(h=>h.label===o)??e,r=_(".chat-welcome-view-suggested-prompt");r.setAttribute("tabindex","0"),r.setAttribute("role","button"),r.setAttribute("aria-label",d(7198,null,e.label));let s=R(r,_(".chat-welcome-view-suggested-prompt-title"));s.textContent=e.label;let l=e.showContinueOn??!0,u=this.chatSessionsService.getAllChatSessionContributions().filter(p=>{if(!p.canDelegate)return!1;let h=Rf(p.type);return h!==void 0&&uTt(h)});if(l&&u.length>0){r.classList.add("chat-suggest-next-has-dropdown");let p=R(r,_(".chat-suggest-next-dropdown"));p.setAttribute("tabindex","0"),p.setAttribute("role","button"),p.setAttribute("aria-label",d(7199,null,e.label)),p.setAttribute("aria-haspopup","true"),R(p,_(".chat-suggest-next-separator")).setAttribute("aria-hidden","true"),R(p,_(".codicon.codicon-chevron-down.dropdown-chevron")).setAttribute("aria-hidden","true");let f=(v,b)=>{v.preventDefault(),v.stopPropagation();let S=u.map(y=>{let w=Rf(y.type),k=A_(w),T=XS(w);return new st(y.type,d(7200,null,T),q.isThemeIcon(k)?q.asClassName(k):void 0,!0,()=>{let N=n();N&&this._onDidSelectPrompt.fire({handoff:N,agentId:y.name})})});this.contextMenuService.showContextMenu({getAnchor:()=>b||p,getActions:()=>S,autoSelectFirstItem:!0})};t.add(j(p,"click",v=>{f(v,p)})),t.add(j(p,"keydown",v=>{(v.key==="Enter"||v.key===" ")&&f(v,p)})),t.add(j(r,"click",v=>{if(Ao(v.target)&&v.target.closest(".chat-suggest-next-dropdown"))return;let b=n();b&&this._onDidSelectPrompt.fire({handoff:b})}))}else t.add(j(r,"click",()=>{let p=n();p&&this._onDidSelectPrompt.fire({handoff:p})}));return t.add(j(r,"keydown",p=>{if(p.key==="Enter"||p.key===" "){p.preventDefault();let h=n();h&&this._onDidSelectPrompt.fire({handoff:h})}})),this.buttonDisposables.set(r,t),r}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()}};wAe=I([m(0,ze),m(1,Ls)],wAe);function umo(a,i,e,t,o){return i&&i!=="local"&&JHt(a,i)?a.filter(n=>n.metadata?.targetChatSessionType===i&&n.metadata?.isUserSelectable):a.filter(n=>!n.metadata?.targetChatSessionType&&n.metadata?.isUserSelectable&&Lki(n,e)&&Rki(n,t,o))}function Lki(a,i){return i==="agent"?R_.suitableForAgentMode(a.metadata):!0}function Rki(a,i,e){return i!=="editor"||!e?!0:!!a.metadata.capabilities?.toolCalling}function JHt(a,i){return i?a.some(e=>e.metadata.targetChatSessionType===i):!1}function ZHt(a,i,e){return JHt(i,e)?a.metadata.targetChatSessionType===e:!a.metadata.targetChatSessionType}function pmo(a,i){return a.find(e=>e.metadata.isDefaultForLocation[i])||a[0]}function Mki(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 mmo(a,i,e,t){return!a||!i.some(o=>o.identifier===a.identifier)||!Lki(a,e.currentModeKind)||!Rki(a,e.location,e.isInlineChatV2Enabled)||!ZHt(a,t,e.sessionType)}function hmo(a,i,e,t,o){if(i&&i.identifier===a.identifier)return{action:"keep"};if(!ZHt(a,e,t))return{action:"default"};if(o){if(!Lki(a,o.currentModeKind))return{action:"default"};if(!Rki(a,o.location,o.isInlineChatV2Enabled))return{action:"default"}}return{action:"apply"}}function gmo(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 fmo(a,i){return a?!i.some(e=>e.identifier===a):!0}function vmo(a,i,e,t){return e.metadata.isUserSelectable?Mki(a,i,[e],t).shouldRestore:!1}var CAe=class extends C{constructor(e,t,o){super();this.fileService=e;this.webContentExtractorService=t;this.chatAttachmentResolveService=o;this._attachments=new Map;this._fileWatchers=this._register(new jt);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:Ye(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&&!pP(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(ht.empty(),e)}clearAndSetContext(...e){this.updateContext(Array.from(this._attachments.keys()),e)}delete(...e){this.updateContext(e,ht.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?uo(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=uV.toUri(e);if(!t||t.scheme!==Y.file)return;let o=this.fileService.createWatcher(t,{recursive:!1,excludes:[]}),n=o.onDidChange(r=>{r.contains(t,2)&&this.updateContext([e.id],ht.empty())});this._fileWatchers.set(e.id,hn(n,o))}asFileVariableEntry(e,t){return{kind:"file",value:t?{uri:e,range:t}:e,id:e.toString()+(t?.toString()??""),name:Ye(e)}}async asImageVariableEntry(e){if(e.scheme===Y.file&&await this.fileService.canHandleResource(e))return await this.chatAttachmentResolveService.resolveImageEditorAttachContext(e);if(e.scheme===Y.http||e.scheme===Y.https){let t=await this.webContentExtractorService.readImage(e,ve.None);if(t)return await this.chatAttachmentResolveService.resolveImageEditorAttachContext(e,t)}}};CAe=I([m(0,be),m(1,t2),m(2,jF)],CAe);var Qme=class extends C{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 P);this._register(H.runAndSubscribe(t.onDidActiveEditorChange,(()=>{u.clear();let p=this.findActiveCodeEditor();p&&u.add(H.debounce(H.any(p.onDidChangeModel,p.onDidChangeModelLanguage,p.onDidChangeCursorSelection,p.onDidScrollChange),()=>{},500)(()=>this.updateImplicitContext()));let h=this.findActiveNotebookEditor();if(h){let f=u.add(new P);u.add(h.onDidChangeActiveCell(()=>{f.clear();let v=this.codeEditorService.getActiveCodeEditor();v&&v.getModel()?.uri.scheme===Y.vscodeNotebookCell&&f.add(H.debounce(H.any(v.onDidChangeModel,v.onDidChangeCursorSelection,v.onDidScrollChange),()=>{},500)(()=>this.updateImplicitContext()))})),u.add(H.debounce(H.any(h.onDidChangeModel,h.onDidChangeActiveCell),()=>{},500)(()=>this.updateImplicitContext()))}let g=this.findActiveWebviewEditor();g&&u.add(H.debounce(g.input.webview.onMessage,()=>{},500)(()=>{this.updateImplicitContext()})),this.updateImplicitContext()}))),this._register(he(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===Y.vscodeNotebookCell)return;if(t)return e}for(let t of this.editorService.getVisibleTextEditorControls(0)){let o=ca(t);if(!o)continue;if(o.getModel())return o}}findActiveWebviewEditor(){let e=this.editorService.activeEditorPane;if(e?.input instanceof wu)return e}findActiveNotebookEditor(){return qn(this.editorService.activeEditorPane)}async updateImplicitContext(e){let t=this._currentCancelTokenSource.value=new $e,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 b=o?.getVisibleRanges();if(b&&b.length>0){let S=b[0];b.slice(1).forEach(y=>{S=S.plusRange(y)}),s={uri:n.uri,range:S}}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 b=p.getActiveCell();if(b){let S=this.codeEditorService.getActiveCodeEditor(),y=S?.getSelection(),w=S?.getVisibleRanges()||[];s=b.uri;let k=S?.getModel();if(k&&Xe(k.uri,b.uri)){if(y&&!y.isEmpty())s={uri:b.uri,range:y},l=!0;else if(w.length>0&&!J9o(k,w)){let T=w[0];w.slice(1).forEach(N=>{T=T.plusRange(N)}),s={uri:b.uri,range:T}}}}else s=p.textModel?.uri}let h=this.findActiveWebviewEditor();if(h?.input?.resource){let b=await this.chatContextService.contextForResource(h.input.resource);b&&(s=b)}let g=s instanceof A?s:qx(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=c&&Mf(c)!==void 0,v=e?[e]:[...this.chatWidgetService.getWidgetsByLocations("panel"),...this.chatWidgetService.getWidgetsByLocations("editor")];for(let b of v){if(!b.input.implicitContext)continue;let S=this._implicitContextEnablement[b.location],y=b.viewModel?.getItems().length===0;if((S==="always"||S==="first"&&y)&&!f){let w=!!this.editorService.activeEditor;(s!==void 0||!b.input.implicitContext.hasValue||!w)&&b.input.implicitContext.setValues([{value:s,isSelection:l},{value:u,isSelection:!1}])}else b.input.implicitContext.setValues([])}}};Qme=I([m(0,Kt),m(1,ee),m(2,At),m(3,Si),m(4,dl),m(5,B),m(6,jxe),m(7,Q_)],Qme);function J9o(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 eUt=class extends C{constructor(){super(...arguments);this._onDidChangeValue=this._register(new E);this.onDidChangeValue=this._onDidChangeValue.event;this._values=this._register(new jt);this._valuesDisposables=this._register(new P);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 Pki;n.setValue(o.value,o.isSelection),n.enabled=this._enabled;let r=new P;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=>nv(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&&!qx(e.value))}enabledBaseEntries(e){return this.values.flatMap(t=>t.enabled||e&&nv(t.value)?t.toBaseEntries():[])}},Pki=class extends C{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":qx(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:${Ye(this.value)}`;if(nv(this.value))return`file:${Ye(this.value.uri)}`;if(qx(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??Ye(this.value.resourceUri)}return"implicit"}get modelDescription(){if(A.isUri(this.value))return"User's active file";if(qx(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??Ye(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 qx(this.value)?this.value.uri:this._uri}get icon(){if(qx(this.value))return this.value.icon}setValue(e,t){qx(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?qx(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 xAe=class extends C{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 P);this.renderedCount=0;this.render()}render(){this.renderDisposables.clear(),this.renderedCount=0;for(let e of this.attachment.values){let t=e.uri,o=nv(e.value)?e.value.range:void 0,n=qx(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===Y.vscodeNotebookCell?d(6026,null):d(6032,null);if(this.configService.getValue("chat.implicitContext.suggestedContext")){if(t){let g=d(6035,null),f=this.renderDisposables.add(new Mi(o,{supportIcons:!0,title:g}));f.icon=M.pinned,this.renderDisposables.add(f.onDidClick(async v=>{v.stopPropagation(),v.preventDefault(),await this.pinSelection()}))}else{let g=e.enabled?d(6029,null,r):"",f=this.renderDisposables.add(new Mi(o,{supportIcons:!0,title:g}));f.icon=e.enabled?M.x:M.plus,this.renderDisposables.add(f.onDidClick(async v=>{v.stopPropagation(),v.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 g=>{!e.enabled&&!t&&await this.convertToRegularAttachment(e)})),this.renderDisposables.add(j(o,re.KEY_DOWN,async g=>{let f=new Ii(g);(f.equals(3)||f.equals(10))&&!e.enabled&&!t&&(g.preventDefault(),g.stopPropagation(),await this.convertToRegularAttachment(e))}))}else{let g=e.enabled?d(6029,null,r):d(6030,null,r),f=this.renderDisposables.add(new Mi(o,{supportIcons:!0,title:g}));f.icon=e.enabled?M.eye:M.eyeClosed,this.renderDisposables.add(f.onDidClick(v=>{v.stopPropagation(),e.enabled=!e.enabled}))}let l=this.resourceLabels.create(o,{supportIcons:!0}),c,u;qx(e.value)?(u=e.value.tooltip,c=this.renderString(l,e.name,e.icon,e.value.resourceUri,u,d(6034,null))):c=this.renderResource(e.value,e.isSelection,e.enabled,l,o),(u||c)&&this.renderDisposables.add(this.hoverService.setupDelayedHover(o,{content:u??c,appearance:{showPointer:!0}}));let p=this.renderDisposables.add(this.contextKeyService.createScoped(o));this.renderDisposables.add(new Fo(p,this.fileService,this.languageService,this.modelService)).set(n),this.renderDisposables.add(j(o,re.CONTEXT_MENU,async g=>{let f=new yn(Me(g),g);$t.stop(g,!0),this.contextMenuService.showContextMenu({contextKeyService:p,getAnchor:()=>f,getActions:()=>{let v=this.menuService.getMenuActions(D.ChatInputResourceAttachmentContext,p,{arg:n});return Uc(v)}})}))}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=js(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===Y.vscodeNotebookCell?d(6026,null):d(6032,null),u=Ye(s),p=ci(s),h=`${u} ${p}`,g=l?d(6028,null,c,h,l.startLineNumber,l.endLineNumber):d(6027,null,c,h),f=this.labelService.getUriLabel(s,{relative:!0}),v=d(6033,null,c),b=d(6031,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(qx(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===Y.vscodeNotebookCell&&nv(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)&&!qx(e.value)){let t=e.value;this.attachmentModel.addFile(t.uri,t.range)}this.widgetRef()?.focusInput()}};xAe=I([m(6,X),m(7,ze),m(8,ot),m(9,qt),m(10,be),m(11,kt),m(12,Ct),m(13,tt),m(14,B),m(15,Q_)],xAe);var g2=class extends r0{constructor(e,t,o,n,r,s,l,c){let{group:u,item:p}=t,h={...e,label:p?.name||u.name,tooltip:p?.description??u.description??u.name,run:()=>{}},g={actionProvider:{getActions:()=>this.getDropdownActions()},actionBarActionProvider:void 0,reporter:{id:u.id,name:`ChatSession:${u.name}`,includeOptions:!1}};super(h,g,n,s,r,c);this.delegate=o;this.commandService=l;this.currentOption=p,this._register(this.delegate.onDidChangeOption(f=>{this.currentOption=f,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:()=>{}}}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(Qo(this.currentOption.icon)),n||t.push(_("span.chat-session-option-label",void 0,this.currentOption?.name??o?.description??d(6612,null))),t.push(...Bn("$(chevron-down)")),Fi(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)}};g2=I([m(3,nl),m(4,X),m(5,_e),m(6,ge),m(7,Te)],g2);function Z9o(a){return!!a&&typeof a.optionItem=="object"}var f2=class extends g2{constructor(e,t,o,n,r,s,l,c,u,p){super(e,t,o,n,r,s,u,p);this.quickInputService=l;this.logService=c}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:f2.SEE_MORE_ID,enabled:!0,checked:!1,class:"searchable-picker-see-more",description:void 0,tooltip:d(6660,null),label:d(6659,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(Qo(o.icon));let n=this.currentOption?.name??o?.name??d(6661,null);return t.push(_("span.chat-session-option-label",void 0,n)),t.push(...Bn("$(chevron-down)")),Fi(e,...t),this.setAriaLabelAttributes(e),null}getContainerClass(){return"chat-searchable-option-picker-item"}async showSearchableQuickPick(e){if(e.onSearch){let t=new P,o=this.quickInputService.createQuickPick();t.add(o),o.placeholder=e.description??d(6662,null,e.name),o.matchOnDescription=!0,o.matchOnDetail=!0,o.ignoreFocusOut=!0,o.busy=!0,o.show();let n,r=t.add(new jo(300)),s=async l=>{n?.cancel(),n?.dispose(),n=new $e;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(Z9o(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)}};f2=I([m(3,nl),m(4,X),m(5,_e),m(6,Ge),m(7,ne),m(8,ge),m(9,Te)],f2);var Aki=class{getHeight(i){return 22}getTemplateId(i){return tUt.TEMPLATE_ID}},tUt=class a{constructor(){this.templateId=a.TEMPLATE_ID}static{this.TEMPLATE_ID="todoListRenderer"}renderTemplate(i){let e=new P,t=R(i,_("li.todo-item"));t.setAttribute("role","listitem");let o=R(t,_(".todo-status-icon.codicon"));o.setAttribute("aria-hidden","true");let n=R(t,_(".todo-content")),r=e.add(new Lc(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(7236,null,i.title,s);o.setAttribute("aria-label",l)}disposeTemplate(i){i.templateDisposables.dispose()}getStatusText(i){switch(i){case"completed":return d(7237,null);case"in-progress":return d(7238,null);default:return d(7239,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)"}}},kAe=class extends C{constructor(e,t,o){super();this.chatTodoListService=e;this.instantiationService=t;this.contextKeyService=o;this._isExpanded=!1;this._userManuallyExpanded=!1;this._inChatTodoListContextKey=ie.inChatTodoList.bindTo(o),this.domNode=this.createChatTodoWidget();let n=this._register(Vn(this.domNode));this._register(n.onDidFocus(()=>this._inChatTodoListContextKey.set(!0))),this._register(n.onDidBlur(()=>this._inChatTodoListContextKey.set(!1))),this._register(this.contextKeyService.onDidChangeContext(r=>{r.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 Mi(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(7240,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 Mi(this.clearButtonContainer,{supportIcons:!0,ariaLabel:d(7231,null)}),this.clearButton.element.tabIndex=0,this.clearButton.icon=M.clearAll,this._register(this.clearButton),this._register(this.clearButton.onDidClick(()=>{this.clearAllTodos()}))}render(e){if(!e){this.hideWidget();return}Xe(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 ts(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(Rl,"ChatTodoListRenderer",this.todoListContainer,new Aki,[new tUt],{alwaysConsumeMouseWheel:!1,accessibilityProvider:{getAriaLabel:c=>{let u=this.getStatusText(c.status);return d(7236,null,c.title,u)},getWidgetAriaLabel:()=>d(7242,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(){if(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",this._currentSessionResource){let e=this.chatTodoListService.getTodos(this._currentSessionResource);this.updateTitleElement(this.titleElement,e)}}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(7232,null)):this.clearButton.setTitle(d(7231,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(7233,null):d(7235,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(7241,null,u,n):d(7240,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(7234,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(7241,null,n,n),g.style.verticalAlign="middle",e.appendChild(g)}}}getStatusText(e){switch(e){case"completed":return d(7237,null);case"in-progress":return d(7238,null);default:return d(7239,null)}}};kAe=I([m(0,dF),m(1,F),m(2,X)],kAe);var e7o=/^data:image\/[a-z]+;base64,/,t7o=/^https?:\/\/.+/,EAe=class extends Jd{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 Om(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(gu(e,Ll.NOTEBOOK_CELL_OUTPUT))return 7;if(gu(e,Ll.SCM_HISTORY_ITEM))return 8;if(i7o(e))return this.extensionService.extensions.some(t=>Ea(t,"chatReferenceBinaryData"))?3:void 0;if(gu(e,"text/html"))return 5;if(gu(e,Ll.SYMBOLS))return 4;if(gu(e,Ll.MARKERS))return 6;if(gu(e,Aa.FILES))return 1;if(gu(e,Ll.EDITORS))return 0;if(gu(e,Zn.uriList,Ll.FILES,Aa.RESOURCES,Aa.INTERNAL_URI_LIST))return 2}isDragEventSupported(e){return this.guessDropType(e)!==void 0}getDropTypeName(e){switch(e){case 0:return d(7326,null);case 1:return d(7326,null);case 2:return d(7327,null);case 3:return d(7328,null);case 4:return d(7332,null);case 6:return d(7330,null);case 5:return d(7333,null);case 7:return d(7329,null);case 8:return d(7331,null)}}async resolveAttachmentsFromDragEvent(e){if(!this.isDragEventSupported(e))return[];if(gu(e,Ll.NOTEBOOK_CELL_OUTPUT)){let r=B$i(e);if(r)return this.chatAttachmentResolveService.resolveNotebookOutputAttachContext(r)}if(gu(e,Ll.SCM_HISTORY_ITEM)){let r=wdo(e);if(r)return this.chatAttachmentResolveService.resolveSourceControlHistoryItemAttachContext(r)}let t=W$i(e);if(t)return this.chatAttachmentResolveService.resolveMarkerAttachContext(t);if(gu(e,Ll.SYMBOLS)){let r=F$i(e);return this.chatAttachmentResolveService.resolveSymbolsAttachContext(r)}let o=iqe(e);if(o.length>0)return si(await Promise.all(o.map(r=>this.chatAttachmentResolveService.resolveEditorAttachContext(r))));let n=e.dataTransfer?.getData(Aa.INTERNAL_URI_LIST);if(n){let r=Uy.parse(n);if(r.length)return si(await Promise.all(r.map(s=>this.chatAttachmentResolveService.resolveEditorAttachContext({resource:A.parse(s)}))))}return!gu(e,Aa.INTERNAL_URI_LIST)&&gu(e,Zn.uriList)&&(gu(e,Zn.html)||gu(e,Zn.text))?this.resolveHTMLAttachContext(e):[]}async downloadImageAsUint8Array(e){try{let n=await this.webContentExtractorService.readImage(A.parse(e),ve.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(7325,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(e7o.test(u))return{data:mdi(u),name:o(),resource:p};if(t7o.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=n7o(e);if(l.length){let u=await Promise.all(l.map(p=>r(p)));s.push(...u.filter(p=>!!p))}let c=o7o(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=Bn(`$(${M.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(7324,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)||""}};EAe=I([m(3,De),m(4,lt),m(5,t2),m(6,ne),m(7,jF)],EAe);function i7o(a){if(gu(a,"image"))return!0;if(gu(a,Aa.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 o7o(a,i){let e=a.dataTransfer?.getData("text/uri-list");if(e)try{let t=Uy.parse(e);if(t.length>0)return t}catch(t){return i?.error("Error parsing URI list:",t),[]}return[]}function n7o(a){let i=a.dataTransfer?.files;return i?Array.from(i).filter(e=>e.type.startsWith("image/")):[]}var r7o=_,TAe=class extends C{constructor(e,t,o,n,r,s){super();this.location=o;this.options=n;this.clickHandler=r;this.chatAgentService=s;let l=R(e,r7o(".interactive-session-followups"));t.forEach(c=>this.renderFollowup(l,c))}renderFollowup(e,t){if(!this.chatAgentService.getDefaultAgent(this.location))return;let o=ETt(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 Mi(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(7383,null,n),l.label=new xe(n),this._register(l.onDidClick(()=>this.clickHandler(t)))}};TAe=I([m(5,br)],TAe);var ytt=new class{constructor(){this.widgets=[]}register(a,i,e){this.widgets.push({id:a,ctor:i,when:e})}getWidgets(){return this.widgets}},_Ae=class extends C{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 ytt.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 ytt.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 ytt.getWidgets())if(e.has(t.id)&&!this.renderedWidgets.has(t.id)){let o=new P,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()}};_Ae=I([m(1,X),m(2,F)],_Ae);var s0=class extends r0{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(he(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))}};s0=I([m(3,nl),m(4,_e),m(5,X),m(6,Te)],s0);var s7o={label:d(7478,null),order:1},a7o={label:d(7479,null),order:2},N3=class extends s0{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:A_(y.type),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(7477,null),tooltip:e,class:void 0,enabled:!0,run:async()=>{await this.openerService.open(A.parse(e))}}}_updateAgentSessionItems(){let t=[{type:"local",label:XS("local"),hoverDescription:kdi("local"),commandId:"workbench.action.chat.openNewChatSessionInPlace.local"}],o=this.chatSessionsService.getAllChatSessionContributions();for(let n of o){let r=Rf(n.type);r&&t.push({type:r,label:XS(r),hoverDescription:kdi(r),commandId:n.canDelegate?`workbench.action.chat.openNewChatSessionInPlace.${n.type}`:`workbench.action.chat.openNewChatSessionExternal.${n.type}`})}this._sessionTypeItems=t}_isVisible(e){return!0}_isSessionTypeEnabled(e){return e==="local"?!0:!!this.chatSessionsService.getChatSessionContribution(e)}_getSessionCategory(e){return dTt(e.type)?s7o:a7o}_getSessionDescription(e){}render(e){super.render(e),e.classList.add("chat-session-target-picker-item")}renderLabel(e){this.setAriaLabelAttributes(e);let t=this._getSelectedSessionType(),o=XS(t??"local"),n=A_(t??"local"),r=[];return r.push(...Bn(`$(${n.id})`)),r.push(_("span.chat-input-picker-label",void 0,o)),r.push(...Bn("$(chevron-down)")),Fi(e,...r),null}};N3=I([m(4,nl),m(5,_e),m(6,X),m(7,Ls),m(8,ge),m(9,Qe),m(10,Te)],N3);var Yme=class extends N3{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._isSessionsWindow=$p.getValue(s)===!0}_run(i){this.delegate.setPendingDelegationTarget&&this.delegate.setPendingDelegationTarget(i.type),this.element&&this.renderLabel(this.element)}_getSelectedSessionType(){let i=this.delegate.getPendingDelegationTarget?this.delegate.getPendingDelegationTarget():void 0;return i||this.delegate.getActiveSessionProvider()}_isSessionTypeEnabled(i){let t=this.chatSessionsService.getAllChatSessionContributions().find(n=>Rf(n.type)===i),o=this.delegate.getActiveSessionProvider();return!this._isSessionsWindow&&o!=="local"||this._isSessionsWindow&&o!=="copilotcli"||t&&!t.canDelegate&&o!==i?!1:this._getSelectedSessionType()!==i}_isVisible(i){return this._isSessionsWindow&&i==="local"?!1:this.delegate.getActiveSessionProvider()===i?!0:uTt(i)}_getSessionCategory(i){return dTt(i.type)?{label:d(7429,null),order:1,showHeader:!0}:{label:d(7430,null),order:2,showHeader:!1}}_getLearnMore(){let i="https://aka.ms/vscode-continue-chat-in";return{id:"workbench.action.chat.agentOverview.learnMoreHandOff",label:d(7426,null),tooltip:i,class:void 0,enabled:!0,run:async()=>{await this.openerService.open(A.parse(i))}}}_getAdditionalActions(){return this._isSessionsWindow?[]:[{id:"newChatSession",class:void 0,label:d(7427,null),tooltip:"",hover:{content:"",position:this.pickerOptions.hoverPosition},checked:!1,icon:M.plus,enabled:!0,category:{label:d(7428,null),order:0,showHeader:!1},description:this.keybindingService.lookupKeybinding(im)?.getLabel()||void 0,run:async()=>{this.commandService.executeCommand(im,this.chatSessionPosition)}}]}};Yme=I([m(4,nl),m(5,_e),m(6,X),m(7,Ls),m(8,ge),m(9,Qe),m(10,Te)],Yme);function wtt(a,i,e){let t=e.defaultChatAgent?.chatExtensionId;if(!t)return!1;let o=Ei.equals(i,t),n=a.path.includes("/github/");return o&&n}function bmo(a,i,e){if(a.storage!=="extension")return!1;let t=e.defaultChatAgent?.chatExtensionId;return!t||!Ei.equals(a.extensionId,t)?!1:!wtt(i,a.extensionId,e)}var Smo=a=>{switch(a.name.get().toLowerCase()){case"ask":return M.ask;case"edit":return M.edit;case"plan":return M.tasklist;default:return}},DAe=class extends s0{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){let S=Le("modePickerAssignments",{showOldAskMode:!1}),y=t.customAgentTarget?.()??"undefined",w={label:d(7448,null),order:0},k={label:d(7449,null),order:1},T={label:d(7451,null),order:999,showHeader:!0},N=l.inspect("chat.agent.enabled").policyValue===!1,O=(te,pe)=>{let de=te.kind==="agent"&&N,se=r.getDefaultAgent("panel",te.kind)?.description??e.tooltip,Se=[];if(te.kind==="agent"&&!de&&te.uri){let ke,Ee,He;te.source?.storage==="extension"?(Ee=M.eye,He=`viewAgent:${te.id}`,ke=d(7452,null,te.label.get())):(Ee=M.edit,He=`editAgent:${te.id}`,ke=d(7450,null,te.label.get()));let Ve=te.uri;Se.push({id:He,label:ke,tooltip:ke,class:q.asClassName(Ee),enabled:!0,run:async()=>{v.open(Ve.get())}})}return{...e,id:ECi(te),label:te.label.get(),icon:de?q.fromId(M.lock.id):te.icon.get(),class:de?"disabled-by-policy":void 0,enabled:!de,checked:!de&&pe.id===te.id,tooltip:"",hover:{content:se,position:this.pickerOptions.hoverPosition},toolbarActions:Se,run:async()=>{if(de)return;let ke=await h.executeCommand(aki,{modeId:te.id,sessionResource:this.delegate.sessionResource()});return this.element&&this.renderLabel(this.element),ke},category:de?T:w}},V=(te,pe)=>({...O(te,pe),tooltip:"",hover:{content:te.description.get()??r.getDefaultAgent("panel",te.kind)?.description??e.tooltip,position:this.pickerOptions.hoverPosition},icon:te.icon.get()??(Ctt(te,this._productService)?Smo(te):void 0),category:N?T:k}),U={getActions:()=>{let te=u.getModes(),pe=t.currentMode.get(),de=te.custom.filter(Ve=>{let Fe=Ve.target.get();return Fe===y||Fe==="undefined"}),se=wI(de,Ve=>Ctt(Ve,this._productService)?"builtin":"custom"),Se=pe.id===Pl.Agent.id,ke={...O(Pl.Agent,Pl.Agent),checked:Se};ke.category=w;let Ee=se.builtin?.map(Ve=>{let Fe=V(Ve,pe);return Fe.category=w,Fe})??[],He=se.custom?.map(Ve=>V(Ve,pe))??[];return[ke,...Ee,...He]}},G={getActions:()=>{let te=u.getModes(),pe=t.currentMode.get(),de=te.builtin.find(Fe=>Fe.id===Pl.Agent.id),se=te.builtin.filter(Fe=>Fe.id!==Pl.Agent.id&&Imo(Fe,S.get(),N)),Se=te.custom.filter(Fe=>Ctt(Fe,this._productService)?Imo(Fe,S.get(),N):!0),ke=wI(Se,Fe=>Ctt(Fe,this._productService)?"builtin":"custom"),Ee=ke.builtin?.map(Fe=>{let Qt=V(Fe,pe);return Qt.category=N?T:w,Qt})??[];Ee.sort((Fe,Qt)=>Fe.label.localeCompare(Qt.label));let He=ke.custom?.map(Fe=>V(Fe,pe))??[];return He.sort((Fe,Qt)=>Fe.label.localeCompare(Qt.label)),si([de&&O(de,pe),...se.map(Fe=>Fe&&O(Fe,pe)),...Ee,...He])}},$={actionProvider:y!=="undefined"?U: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(he(te=>{this.delegate.currentMode.read(te).label.read(te),this.element&&this.renderLabel(this.element)})),b.getTreatment("chat.showOldAskMode").then(te=>{S.set({showOldAskMode:te==="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=Vm(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&&Ctt(t,this._productService)&&(n=Smo(t));let r=[],s=this.pickerOptions.hideChevrons.get();return n&&r.push(...Bn(`$(${n.id})`)),(!s||!n)&&r.push(_("span.chat-input-picker-label",void 0,o)),s||r.push(...Bn("$(chevron-down)")),Fi(e,...r),null}};DAe=I([m(3,nl),m(4,br),m(5,_e),m(6,B),m(7,X),m(8,Pv),m(9,qt),m(10,ge),m(11,nt),m(12,Te),m(13,Qe),m(14,kC)],DAe);function Ctt(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?!wtt(t,a.source.extensionId,i):!0}function Imo(a,i,e){return a.id===Pl.Edit.id||a.name.get().toLowerCase()==="edit"?a.id===Pl.Edit.id?e:!e:a.id===Pl.Ask.id||a.name.get().toLowerCase()==="ask"?a.id===Pl.Ask.id?i.showOldAskMode||e:!(i.showOldAskMode||e):!0}var iUt=new Set;function ymo(a){return!!(iUt.has(a)||a==="autoApprove"&&iUt.has("autopilot"))}var LAe=class extends s0{constructor(e,t,o,n,r,s,l,c,u){let p=()=>c.inspect("chat.tools.global.autoApprove").policyValue===!1,h=()=>c.getValue("chat.autopilot.enabled")!==!1;super(e,{actionProvider:{getActions:()=>{let f=t.currentPermissionLevel.get(),v=p(),b=[{...e,id:"chat.permissions.default",label:d(7473,null),description:d(7476,null),icon:q.fromId(M.shield.id),checked:f==="default",tooltip:"",hover:{content:d(7474,null),position:o.hoverPosition},run:async()=>{t.setPermissionLevel("default"),this.element&&this.renderLabel(this.element)}},{...e,id:"chat.permissions.autoApprove",label:d(7453,null),description:d(7458,null),icon:q.fromId(M.warning.id),checked:f==="autoApprove",enabled:!v,tooltip:v?d(7457,null):"",hover:{content:v?d(7456,null):d(7454,null),position:o.hoverPosition},run:async()=>{if(!ymo("autoApprove")){if((await this.dialogService.prompt({type:gt.Warning,message:d(7462,null),buttons:[{label:d(7460,null),run:()=>!0},{label:d(7459,null),run:()=>!1}],custom:{icon:M.warning,markdownDetails:[{markdown:new xe(d(7461,null))}]}})).result!==!0)return;iUt.add("autoApprove")}t.setPermissionLevel("autoApprove"),this.element&&this.renderLabel(this.element)}}];return h()&&b.push({...e,id:"chat.permissions.autopilot",label:d(7463,null),description:d(7468,null),icon:q.fromId(M.rocket.id),checked:f==="autopilot",enabled:!v,tooltip:v?d(7467,null):"",hover:{content:v?d(7466,null):d(7464,null),position:o.hoverPosition},run:async()=>{if(!ymo("autopilot")){if((await this.dialogService.prompt({type:gt.Warning,message:d(7472,null),buttons:[{label:d(7470,null),run:()=>!0},{label:d(7469,null),run:()=>!1}],custom:{icon:M.rocket,markdownDetails:[{markdown:new xe(d(7471,null))}]}})).result!==!0)return;iUt.add("autopilot")}t.setPermissionLevel("autopilot"),this.element&&this.renderLabel(this.element)}}),b}},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=M.rocket,n=d(7465,null);break;case"autoApprove":o=M.warning,n=d(7455,null);break;default:o=M.shield,n=d(7475,null);break}let r=[];return r.push(...Bn(`$(${o.id})`)),r.push(_("span.chat-input-picker-label",void 0,n)),r.push(...Bn("$(chevron-down)")),Fi(e,...r),e.classList.toggle("warning",t==="autopilot"),e.classList.toggle("info",t==="autoApprove"),null}refresh(){this.element&&this.renderLabel(this.element)}};LAe=I([m(3,nl),m(4,_e),m(5,X),m(6,Te),m(7,B),m(8,ct)],LAe);var Xme=class extends s0{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(7480,null),checked:!1,enabled:!0,tooltip:d(7481,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||Ye(t.uri);o.push(...Bn("$(folder)")),o.push(_("span.chat-input-picker-label",void 0,n))}else o.push(...Bn("$(folder)")),o.push(_("span.chat-input-picker-label",void 0,d(7482,null)));return this.pickerOptions.hideChevrons.get()||o.push(...Bn("$(chevron-down)")),Fi(e,...o),null}};Xme=I([m(3,nl),m(4,_e),m(5,X),m(6,ge),m(7,Te)],Xme);var kk=_,RAe=class extends C{constructor(e,t,o){super();this.instantiationService=e;this.menuService=t;this.contextKeyService=o;this.domNode=kk(".chat-context-usage-details"),this.quotaItem=this.domNode.appendChild(kk(".quota-indicator"));let n=this.domNode.insertBefore(kk("div.header"),this.quotaItem);n.textContent=d(7494,null);let r=this.quotaItem.appendChild(kk(".quota-label"));this.tokenCountLabel=r.appendChild(kk("span")),this.percentageLabel=r.appendChild(kk("span.quota-value"));let s=this.quotaItem.appendChild(kk(".quota-bar"));this.progressFill=s.appendChild(kk(".quota-bit")),this.tokenDetailsContainer=this.domNode.appendChild(kk(".token-details-container")),this.warningMessage=this.domNode.appendChild(kk("div.description")),this.warningMessage.textContent=d(7496,null),this.warningMessage.style.display="none",this.actionsSection=this.domNode.appendChild(kk(".actions-section"));let l=this.actionsSection.appendChild(kk(".button-bar-container"));this._register(this.instantiationService.createInstance(QF,l,D.ChatContextUsageActions,{toolbarOptions:{primaryGroup:()=>!0},buttonConfigProvider:()=>({isSecondary:!0})}));let c=this._register(this.menuService.createMenu(D.ChatContextUsageActions,this.contextKeyService)),u=()=>{let p=c.getActions(),h=p.length>0&&p.some(([,g])=>g.length>0);this.actionsSection.style.display=h?"":"none"};this._register(c.onDidChange(u)),u()}update(e){let{percentage:t,usedTokens:o,totalContextWindow:n,promptTokenDetails:r}=e;this.tokenCountLabel.textContent=d(7498,null,this.formatTokenCount(o,1),this.formatTokenCount(n,0)),this.percentageLabel.textContent=d(7497,null,t.toFixed(0)),this.progressFill.style.width=`${Math.min(100,t)}%`,this.quotaItem.classList.remove("warning","error"),t>=90?this.quotaItem.classList.add("error"):t>=75&&this.quotaItem.classList.add("warning"),this.renderTokenDetails(r,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(7499,null),[{label:d(7495,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(kk(".token-category")),u=c.appendChild(kk(".token-category-header"));u.textContent=r;for(let p of l){let h=c.appendChild(kk(".token-detail-item")),g=h.appendChild(kk(".token-detail-label"));g.textContent=p.label;let f=p.percentageOfPrompt/100*t,v=h.appendChild(kk(".token-detail-value"));v.textContent=`${f.toFixed(1)}%`}}}focus(){this.domNode.focus()}};RAe=I([m(0,F),m(1,qt),m(2,X)],RAe);var Nki=_,Oki=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))}},v2=class extends C{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=Le(this,!1);this._lastRequestDisposable=this._register(new me);this._hoverDisposable=this._register(new me);this._contextUsageDetails=this._register(new me);this._hoverOptions={id:v2._HOVER_ID,appearance:{showPointer:!0,compact:!0},persistence:{hideOnHover:!1},trapFocus:!0};this.domNode=Nki(".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(7500,null));let l=this.domNode.appendChild(Nki(".icon-container"));this.progressIndicator=new Oki,l.appendChild(this.progressIndicator.domNode),this.percentageLabel=this.domNode.appendChild(Nki(".percentage-label")),this._contextUsageOpenedKey=ie.contextUsageHasBeenOpened.bindTo(this.contextKeyService),this.storageService.getBoolean(v2._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(RAe)),this._contextUsageDetails.value.update(this.currentData),this._contextUsageDetails.value}_markOpened(){this._contextUsageOpenedKey.set(!0),this.storageService.store(v2._OPENED_STORAGE_KEY,!0,1,1)}setupHover(){this._hoverDisposable.clear();let e=new P;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 Ii(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.promptTokenDetails,u=r+s,p=l+s,h=Math.min(100,p/u*100);this.render(h,p,u,c),this.show()}render(e,t,o,n){this.currentData={usedTokens:t,totalContextWindow:o,percentage:e,promptTokenDetails:n},this.progressIndicator.setProgress(e);let r=Math.round(e);this.percentageLabel.textContent=`${r}%`,this.domNode.setAttribute("aria-label",d(7501,null,r)),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())}};v2=I([m(0,tt),m(1,F),m(2,Wr),m(3,X),m(4,le),m(5,B)],v2);function MAe(a,i){let e=zYi(a);return e?BTt(e,i):!1}function l7o(a){let i=new xe("",{isTrusted:!0,supportThemeIcons:!0});switch(a){case"available for download":i.appendMarkdown(d(7404,null));break;case"downloaded":case"ready":i.appendMarkdown(d(7406,null));break;default:i.appendMarkdown(d(7403,null));break}return i}var AAe={Other:"other"};function PAe(a,i){return{item:a,kind:"action",label:a.label,description:a.description,group:{title:"",icon:a.icon??q.fromId(a.checked?M.check.id:M.blank.id)},hideIcon:!1,section:a.section,hover:i?{content:u7o(i)}:void 0}}function xtt(a,i,e,t){return{id:a.identifier,enabled:!0,icon:a.metadata.statusIcon,checked:a.identifier===i,class:void 0,description:a.metadata.multiplier??a.metadata.detail,tooltip:a.metadata.name,label:a.metadata.name,section:t,run:()=>e(a)}}function c7o(a,i,e,t,o,n,r,s,l,c,u){let p=[];if(a.length===0&&p.push(PAe({id:"auto",enabled:!0,checked:!0,class:void 0,tooltip:d(7402,null),label:d(7402,null),run:()=>{}})),!l){let f=a.find(b=>b.metadata.id==="auto"&&b.metadata.vendor==="copilot");f&&p.push(PAe(xtt(f,i,r),f));let v=a.filter(b=>b!==f).sort((b,S)=>{let y=b.metadata.vendor.localeCompare(S.metadata.vendor);return y!==0?y:b.metadata.name.localeCompare(S.metadata.name)});for(let b of v)p.push(PAe(xtt(b,i,r),b));return p}let h=dP(u.entitlement),g=[];if(a.length){let f=new Map,v=new Map;for(let O of a)f.set(O.identifier,O),v.set(O.metadata.id,O);let b=new Set,S=(O,V)=>{b.add(O),V&&b.add(V)},y=O=>f.get(O)??v.get(O),w=O=>h?O.minVSCodeVersion&&!MAe(o,O.minVSCodeVersion)?"update":"admin":"upgrade",k=a.find(O=>O.metadata.id==="auto"&&O.metadata.vendor==="copilot");k&&(S(k.identifier,k.metadata.id),p.push(PAe(xtt(k,i,r),k)));let T=[],N=O=>{if(b.has(O))return!1;let V=y(O);if(V&&!b.has(V.identifier)){S(V.identifier,V.metadata.id);let U=t[V.metadata.id];return U?.minVSCodeVersion&&!MAe(o,U.minVSCodeVersion)?T.push({kind:"unavailable",id:V.metadata.id,entry:U,reason:"update"}):T.push({kind:"available",model:V}),!0}if(!V){let U=t[O];if(U&&!U.exists)return S(O),T.push({kind:"unavailable",id:O,entry:U,reason:w(U)}),!0}return!1};i&&i!==k?.identifier&&N(i);for(let O of e)N(O);for(let[O,V]of Object.entries(t)){if(!V.featured||b.has(O))continue;let U=y(O);U&&!b.has(U.identifier)?(S(U.identifier,U.metadata.id),V.minVSCodeVersion&&!MAe(o,V.minVSCodeVersion)?T.push({kind:"unavailable",id:O,entry:V,reason:"update"}):T.push({kind:"available",model:U})):!U&&!V.exists&&(S(O),T.push({kind:"unavailable",id:O,entry:V,reason:w(V)}))}if(T.length>0){T.sort((O,V)=>{let U=O.kind==="available"?0:1,G=V.kind==="available"?0:1;if(U!==G)return U-G;let $=O.kind==="available"?O.model.metadata.name:O.entry.label,te=V.kind==="available"?V.model.metadata.name:V.entry.label;return $.localeCompare(te)});for(let O of T)O.kind==="available"?p.push(PAe(xtt(O.model,i,r),O.model)):p.push(wmo(O.id,O.entry,O.reason,s,n))}if(g=a.filter(O=>!b.has(O.identifier)&&!b.has(O.metadata.id)).sort((O,V)=>{let U=t[O.metadata.id]??t[O.identifier],G=t[V.metadata.id]??t[V.identifier],$=U?.minVSCodeVersion&&!MAe(o,U.minVSCodeVersion)?1:0,te=G?.minVSCodeVersion&&!MAe(o,G.minVSCodeVersion)?1:0;if($!==te)return $-te;let pe=O.metadata.vendor==="copilot"?0:1,de=V.metadata.vendor==="copilot"?0:1;if(pe!==de)return pe-de;let se=O.metadata.vendor.localeCompare(V.metadata.vendor);return se!==0?se:O.metadata.name.localeCompare(V.metadata.name)}),g.length>0){p.length>0&&p.push({kind:"separator"}),p.push({item:{id:"otherModels",enabled:!0,checked:!1,class:void 0,tooltip:d(7405,null),label:d(7405,null),run:()=>{}},kind:"action",label:d(7405,null),group:{title:"",icon:M.chevronDown},hideIcon:!1,section:AAe.Other,isSectionToggle:!0});for(let O of g){let V=t[O.metadata.id]??t[O.identifier];V?.minVSCodeVersion&&!MAe(o,V.minVSCodeVersion)?p.push(wmo(O.metadata.id,V,"update",s,n,AAe.Other)):p.push(PAe(xtt(O,i,r,AAe.Other),O))}}}return(u.entitlement===5||u.entitlement===6||u.entitlement===7||u.entitlement===8||u.entitlement===9||u.isInternal)&&(p.push({kind:"separator",section:g.length?AAe.Other:void 0}),p.push({item:{id:"manageModels",enabled:!0,checked:!1,class:void 0,tooltip:d(7397,null),label:d(7396,null),run:()=>{c.executeCommand(V8e)}},kind:"action",label:d(7396,null),group:{title:"",icon:M.blank},hideIcon:!1,section:g.length?AAe.Other:void 0,showAlways:!0})),p}function d7o(){return{isChecked(a){return a.kind==="action"?!!a?.item?.checked:void 0},getRole:a=>{switch(a.kind){case"action":return"menuitemradio";case"separator":return"separator";default:return"separator"}},getWidgetRole:()=>"menu"}}function wmo(a,i,e,t,o,n){let r;e==="upgrade"?r=new xe(d(7410,null),{isTrusted:!0}):e==="update"?r=d(7408,null):r=t?new xe(d(7400,null,t),{isTrusted:!0}):d(7398,null);let s;return e==="upgrade"?(s=new xe("",{isTrusted:!0,supportThemeIcons:!0}),s.appendMarkdown(d(7409,null))):e==="update"?s=l7o(o):(s=new xe("",{isTrusted:!0,supportThemeIcons:!0}),s.appendMarkdown(d(7399,null))),{item:{id:a,enabled:!1,checked:!1,class:void 0,tooltip:i.label,label:i.label,description:typeof r=="string"?r:void 0,run:()=>{}},kind:"action",label:i.label,description:r,group:{title:"",icon:q.fromId(M.blank.id)},disabled:!0,hideIcon:!1,className:"chat-model-picker-unavailable",section:n,hover:{content:s}}}var NAe=class extends C{constructor(e,t,o,n,r,s,l,c){super();this._delegate=e;this._actionWidgetService=t;this._commandService=o;this._telemetryService=n;this._languageModelsService=r;this._productService=s;this._entitlementService=l;this._updateService=c;this._onDidChangeSelection=this._register(new E);this.onDidChangeSelection=this._onDidChangeSelection.event}get selectedModel(){return this._selectedModel}get domNode(){return this._domNode}setHideChevrons(e){this._hideChevrons=e,this._register(he(t=>{let o=e.read(t);this._domNode&&this._domNode.classList.toggle("hide-chevrons",o),this._renderLabel()}))}setSelectedModel(e){this._selectedModel=e,this._renderLabel()}setBadge(e){this._badge=e,this._updateBadge()}render(e){this._domNode=R(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=R(this._domNode,_("span.model-picker-badge")),this._updateBadge(),this._renderLabel(),this._register(j(this._domNode,re.MOUSE_DOWN,t=>{t.button===0&&($t.stop(t,!0),this.show())})),this._register(j(this._domNode,re.KEY_DOWN,t=>{let o=new Ii(t);(o.equals(3)||o.equals(10))&&($t.stop(t,!0),this.show())}))}show(e){let t=e??this._domNode;if(!t)return;let o=this._selectedModel,n=v=>{this._telemetryService.publicLog2("chat.modelChange",{fromModel:o?.metadata.vendor==="copilot"?new Im(o.identifier):"unknown",toModel:v.metadata.vendor==="copilot"?new Im(v.identifier):"unknown"}),this._selectedModel=v,this._renderLabel(),this._onDidChangeSelection.fire(v)},r=this._delegate.getModels(),s=dP(this._entitlementService.entitlement),l=this._languageModelsService.getModelsControlManifest(),c=s?l.paid:l.free,u=c7o(r,this._selectedModel?.identifier,this._languageModelsService.getRecentlyUsedModelIds(),c,this._productService.version,this._updateService.state.type,n,this._productService.defaultChatAgent?.manageSettingsUrl,this._delegate.canManageModels(),this._commandService,this._entitlementService),p={showFilter:r.length>=10,filterPlaceholder:d(7407,null),focusFilterOnOpen:!0,collapsedByDefault:new Set([AAe.Other]),minWidth:200},h=Pn(),g={onSelect:v=>{this._actionWidgetService.hide(),v.run()},onHide:()=>{this._domNode?.setAttribute("aria-expanded","false"),Ao(h)&&h.focus()}};this._domNode?.setAttribute("aria-expanded","true"),this._actionWidgetService.show("ChatModelPicker",!1,u,g,t,void 0,[],d7o(),p);let f=Pn();Wre(f)&&f.classList.contains("action-list-filter-input")&&f.classList.add("chat-model-picker-filter-input")}_updateBadge(){if(this._badgeIcon)if(this._badge){let e=this._badge==="info"?M.info:M.warning;Fi(this._badgeIcon,Qo(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 r=Qo(t);o.push(r)}o.push(_("span.chat-input-picker-label",void 0,e??d(7402,null))),this._badgeIcon&&o.push(this._badgeIcon),o.push(...Bn("$(chevron-down)")),Fi(this._domNode,...o);let n=this._selectedModel?.metadata.name??d(7402,null);this._domNode.ariaLabel=d(7401,null,n)}};NAe=I([m(1,nl),m(2,ge),m(3,Te),m(4,Wr),m(5,nt),m(6,vr),m(7,zd)],NAe);function u7o(a){let i=a.metadata.id==="auto"&&a.metadata.vendor==="copilot",e=new xe("",{isTrusted:!0,supportThemeIcons:!0});if(e.appendMarkdown(`**${a.metadata.name}**`),e.appendText(`
`),a.metadata.statusIcon&&a.metadata.tooltip&&(a.metadata.statusIcon&&e.appendMarkdown(`$(${a.metadata.statusIcon.id})&nbsp;`),e.appendMarkdown(`${a.metadata.tooltip}`),e.appendText(`
`)),a.metadata.multiplier&&(e.appendMarkdown(`${d(7412,null,a.metadata.multiplier)}`),e.appendText(`
`)),!i&&(a.metadata.maxInputTokens||a.metadata.maxOutputTokens)){let t=(a.metadata.maxInputTokens??0)+(a.metadata.maxOutputTokens??0);e.appendMarkdown(`${d(7411,null)}: `),e.appendMarkdown(`${p7o(t)}`),e.appendText(`
`)}return e}function p7o(a){return a>=1e6?`${(a/1e6).toFixed(1)}M`:a>=1e3?`${(a/1e3).toFixed(0)}K`:a.toString()}var rte=class extends oc{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(NAe,t)),this._pickerWidget.setSelectedModel(t.currentModel.get()),this._pickerWidget.setHideChevrons(o.hideChevrons),this._register(he(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()}_showPicker(){this._pickerWidget.show(this._getAnchorElement())}_updateTooltip(){if(!this.element)return;let e=this._getHoverContents();typeof e=="string"&&e?this._managedHover.value=yp().setupManagedHover(Ni("mouse"),this.element,e):this._managedHover.clear()}_getHoverContents(){let e=d(7447,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}};rte=I([m(3,F),m(4,X),m(5,_e)],rte);var OAe=_,Cmo=250,xmo=20,oUt={compact:{top:2,bottom:2},default:{top:12,bottom:12}},kmo="chat.cachedLanguageModels.v2",m7o=320;var h7o=PB({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};Nu(i.selectedModel.metadata,{isDefaultForLocation:t}),delete i.selectedModel.metadata.isDefault}return i}}),F3=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N,O,V,U,G,$,te,pe,de,se,Se){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=N;this.chatModeService=O;this.toolService=V;this.chatService=U;this.chatSessionsService=G;this.chatContextService=$;this.agentSessionsService=te;this.workspaceContextService=pe;this.layoutService=de;this.viewDescriptorService=se;this._chatAttachmentWidgetRegistry=Se;this._workingSetCollapsed=Le("chatInputPart.workingSetCollapsed",!0);this._stableInputPartWidth=Le("chatInputPart.stableInputPartWidth",0);this._chatInputTodoListWidget=this._register(new me);this._chatQuestionCarouselWidgets=this._register(new jt);this._questionCarouselResponseIds=new Map;this._questionCarouselSessionResources=new Map;this._chatEditingTodosDisposables=this._register(new P);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 P);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=Le(this,0);this._modelSyncDisposables=this._register(new P);this._isSyncingToOrFromInputModel=!1;this.chatSessionPickerWidgets=new Map;this._waitForPersistedLanguageModel=this._register(new me);this._chatSessionOptionEmitters=new Map;this._optionContextKeys=new Map;this._currentLanguageModel=Le("_currentLanguageModel",void 0);this._onDidChangeCurrentChatMode=this._register(new E);this.onDidChangeCurrentChatMode=this._onDidChangeCurrentChatMode.event;this.inputUri=A.parse(`${Y.vscodeChatInput}:input-${F3._counter++}`);this._workingSetLinesAddedSpan=new co(()=>_(".working-set-lines-added"));this._workingSetLinesRemovedSpan=new co(()=>_(".working-set-lines-removed"));this._chatEditsActionsDisposables=this._register(new P);this._chatEditsDisposables=this._register(new P);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(h7o(1,0,this.storageService)),this._contextResourceLabels=this._register(this.instantiationService.createInstance(Za,{onDidChangeVisibility:this._onDidChangeVisibility.event})),this._currentModeObservable=Le("currentMode",this.options.defaultMode??Pl.Agent),this._currentPermissionLevel=Le("permissionLevel","default"),this._register(this.editorService.onDidActiveEditorChange(()=>{this._indexOfLastOpenedContext=-1,this.refreshChatSessionPickers()})),this._register(this.chatSessionsService.onDidChangeSessionOptions(Ee=>{let He=this._widget?.viewModel?.model.sessionResource;He&&Xe(He,Ee)&&this.refreshChatSessionPickers()})),this._register(this.chatSessionsService.onDidChangeOptionGroups(Ee=>{let He=this._widget?.viewModel?.model.sessionResource;if(He){let Ve=this.chatService.getChatSessionFromInternalUri(He),Fe=this.options.sessionTypePickerDelegate?.getActiveSessionProvider?.();(Ve?.chatSessionType===Ee||Fe===Ee)&&this.refreshChatSessionPickers()}})),this.options.sessionTypePickerDelegate?.onDidChangeActiveSessionProvider&&this._register(this.options.sessionTypePickerDelegate.onDidChangeActiveSessionProvider(async Ee=>{this.computeVisibleOptionGroups(),this.agentSessionTypeKey.set(Ee),this.updateWidgetLockStateFromSessionType(Ee),this.refreshChatSessionPickers()})),this._attachmentModel=this._register(this.instantiationService.createInstance(CAe)),this._register(this._attachmentModel.onDidChange(()=>this._syncInputStateToModel())),this.selectedToolsModel=this._register(this.instantiationService.createInstance(ZPe,this.currentModeObs,this._currentLanguageModel)),this.dnd=this._register(this.instantiationService.createInstance(EAe,()=>this._widget,this._attachmentModel,o)),this.inputEditorMaxHeight=this.options.renderStyle==="compact"?Cmo/3:Cmo;let ke=this.options.renderStyle==="compact"?oUt.compact:oUt.default;if(this.inputEditorMinHeight=this.options.inputEditorMinLines?this.options.inputEditorMinLines*xmo+ke.top+ke.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.options.sessionTypePickerDelegate?.getActiveSessionProvider){let Ee=this.options.sessionTypePickerDelegate.getActiveSessionProvider();Ee&&this.agentSessionTypeKey.set(Ee)}this.chatSessionHasCustomAgentTarget=ie.chatSessionHasCustomAgentTarget.bindTo(l),this.chatSessionHasTargetedModels=ie.chatSessionHasTargetedModels.bindTo(l),this.history=this._register(this.instantiationService.createInstance(dee,this.location)),this._register(this.configurationService.onDidChangeConfiguration(Ee=>{let He={};Ee.affectsConfiguration("accessibility.verbosity.panelChat")&&(He.ariaLabel=this._getAriaLabel()),Ee.affectsConfiguration("editor.wordSegmenterLocales")&&(He.wordSegmenterLocales=this.configurationService.getValue("editor.wordSegmenterLocales")),Ee.affectsConfiguration("editor.autoClosingBrackets")&&(He.autoClosingBrackets=this.configurationService.getValue("editor.autoClosingBrackets")),Ee.affectsConfiguration("editor.autoClosingQuotes")&&(He.autoClosingQuotes=this.configurationService.getValue("editor.autoClosingQuotes")),Ee.affectsConfiguration("editor.autoSurround")&&(He.autoSurround=this.configurationService.getValue("editor.autoSurround")),this.inputEditor.updateOptions(He)})),this._chatEditsListPool=this._register(this.instantiationService.createInstance(qee,this._onDidChangeVisibility.event,D.ChatEditingWidgetModifiedFilesToolbar,{verticalScrollMode:3})),this._hasFileAttachmentContextKey=ie.hasFileAttachments.bindTo(l),this.initSelectedModel(),this._register(this.languageModelsService.onDidChangeLanguageModels(()=>{fmo(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(he(Ee=>{let He=this._currentLanguageModel.read(Ee);this.chatModelIdKey.set(He?.metadata.id.toLowerCase()??""),He?.metadata.name&&this.accessibilityService.alert(He.metadata.name),this._inputEditor?.updateOptions({ariaLabel:this._getAriaLabel()})})),this._register(this.chatModeService.onDidChangeChatModes(()=>this.validateCurrentChatMode())),this._register(he(Ee=>{let He=this._currentModeObservable.read(Ee);this.chatModeKindKey.set(He.kind),this.chatModeNameKey.set(He.name.read(Ee));let Ve=He.model?.read(Ee);Ve&&this.switchModelByQualifiedName(Ve)})),this._register(he(Ee=>{let He=this._currentModeObservable.read(Ee),Ve=He.name.read(Ee),Fe=this._widget?.viewModel?.model.sessionResource;if(Fe){let Qt=this.chatService.getChatSessionFromInternalUri(Fe);if(Qt){let Ze=!0,Ti=this.chatSessionsService.getSessionOption(Qt.chatSessionResource,aTt);if(typeof Ti<"u"){let ti=(typeof Ti=="string"?Ti:Ti.id)||Pl.Agent.id;Ze=ti===Pl.Agent.id?He.id!==Pl.Agent.id:He.label.read(void 0)!==ti}Ze&&this.chatSessionsService.notifySessionOptionsChange(Qt.chatSessionResource,[{optionId:aTt,value:He.isBuiltin?"":Ve}]).catch(ti=>this.logService.error("Failed to notify extension of agent change:",ti))}}})),this.validateCurrentChatMode()}static{this._counter=0}get attachmentModel(){return this._attachmentModel}getAttachedContext(){let e=new Uj;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:t3(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=Mki(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};vmo(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=>R_.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()}openSessionTargetPicker(){this.sessionTargetWidget?.show()}openDelegationPicker(){this.delegationWidget?.show()}openChatSessionPicker(){this.chatSessionPickerWidgets?.values()?.next().value?.show()}createChatSessionPickerWidgets(e){this._lastSessionPickerAction=e;let t=this.computeVisibleOptionGroups();if(!t)return[];let{visibleGroupIds:o,optionGroups:n,effectiveSessionType:r}=t;this.disposeSessionPickerWidgets();let s=[];for(let l of n){if(!o.has(l.id))continue;let c=this.getCurrentOptionForGroup(l.id),u={group:l,item:c},p={getCurrentOption:()=>this.getCurrentOptionForGroup(l.id),onDidChangeOption:this.getOrCreateOptionEmitter(l.id).event,setOption:g=>{this.updateOptionContextKey(l.id,g.id),this.getOrCreateOptionEmitter(l.id).fire(g);let f=this._widget?.viewModel?.model.sessionResource,v=f?this.chatService.getChatSessionFromInternalUri(f):void 0;v&&this.chatSessionsService.notifySessionOptionsChange(v.chatSessionResource,[{optionId:l.id,value:g}]).catch(b=>this.logService.error(`Failed to notify extension of ${l.id} change:`,b)),this.refreshChatSessionPickers()},getOptionGroup:()=>this.chatSessionsService.getOptionGroupsForSessionType(r)?.find(f=>f.id===l.id),getSessionResource:()=>this._widget?.viewModel?.model.sessionResource},h=this.instantiationService.createInstance(l.searchable?f2:g2,e,u,p);this.chatSessionPickerWidgets.set(l.id,h),s.push(h)}return s}setInputModel(e,t){this._inputModel=e,this._modelSyncDisposables.clear(),this.selectedToolsModel.resetSessionEnablementState(),this._chatSessionIsEmpty=t,t&&!this.configurationService.getValue("chat.tools.global.autoApprove")&&!pz(this._currentPermissionLevel.get())&&(this._currentPermissionLevel.set("default",void 0),this.permissionLevelKey.set("default"),this.permissionWidget?.refresh()),t&&this._setEmptyModelState(),this._modelSyncDisposables.add(he(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=dYi(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=hmo(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;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)),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}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();mmo(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")??Pl.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(kmo,-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=gmo(t,e,o);return t.length>0&&this.storageService.store(kmo,n,-1,1),n}getModels(){let e=this.getAllMergedModels();return e.sort((t,o)=>t.metadata.name.localeCompare(o.metadata.name)),umo(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;return(t?this.chatService.getChatSessionFromInternalUri(t):void 0)?.chatSessionType}hasModelsTargetingSessionType(){return JHt(this.getAllMergedModels(),this.getCurrentSessionType())}isModelValidForCurrentSession(e){return ZHt(e,this.getAllMergedModels(),this.getCurrentSessionType())}checkModelInSessionPool(){let e=this._currentLanguageModel.get();e&&!this.isModelValidForCurrentSession(e)&&this.setCurrentLanguageModelToDefault()}preselectModelFromSessionHistory(){let e=this._widget?.viewModel?.model.sessionResource,t=e?this.chatService.getChatSessionFromInternalUri(e):void 0;if(!(t&&this.chatSessionsService.requiresCustomModelsForSessionType(t.chatSessionType)))return;let n=this._widget?.viewModel?.model.getRequests();if(!n||n.length===0)return;let r;for(let c=n.length-1;c>=0;c--)if(n[c].modelId){r=n[c].modelId;break}if(!r)return;let s=()=>{let c=this.getModels(),u=c.find(p=>p.identifier===r);return u||(u=c.find(p=>p.metadata.id===r)),u},l=s();if(l){this.setCurrentLanguageModel(l);return}this._waitForPersistedLanguageModel.value=this.languageModelsService.onDidChangeLanguageModels(()=>{let c=s();c&&(this._waitForPersistedLanguageModel.clear(),this.setCurrentLanguageModel(c))})}setCurrentLanguageModelToDefault(){let e=this.getModels(),t=pmo(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()||[],contrib:{}};for(let o of this._widget?.contribs||ht.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(7395,null,n):"",s="";if(o.isBuiltin)switch(this.currentModeKind){case"agent":s=d(7391,null);break;case"edit":s=d(7394,null);break;case"ask":default:s=d(7392,null);break}else{let l=this.currentModeObs.get();s=d(7393,null,l.label.get(),l.description.get())}return e?t?d(7384,null,s,r,t):d(7390,null,s,r):d(7389,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 Go},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 navigateHistory(e){let t=e?this.history.previous():this.history.next(),o=t?.attachments??[];o.length>0&&(o=(await Promise.all(o.map(async l=>{if(pV(l)&&l.references?.length&&A.isUri(l.references[0].reference)){let c=l.references[0].reference;try{let u=c.toString(!0).startsWith("http")?await this.sharedWebExtracterService.readImage(c,ve.None):(await this.fileService.readFile(c)).value;if(!u)return;let p={...l};return p.value=pV(l)&&l.isPasted?u.buffer:await k_(u.buffer),p}catch(u){this.logService.error("Failed to fetch and reference.",u);return}}return l}))).filter(l=>l!==void 0)),this._attachmentModel.clearAndSetContext(...o);let n=t?.inputText??"",r=t?.contrib??{};Or(n),this.setValue(n,!0),this._widget?.contribs.forEach(l=>{l.setInputState?.(r)}),this._onDidLoadInputState.fire();let s=this._inputEditor.getModel();s&&(e?this._inputEditor.setPosition({lineNumber:1,column:1}):this._inputEditor.setPosition(Fki(s)))}setValue(e,t){this.inputEditor.setValue(e);let o=this.inputEditor.getModel();o&&this.inputEditor.setPosition(Fki(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._chatSessionIsEmpty&&(this._chatSessionIsEmpty=!1,this._emptyInputState.set(void 0,void 0)),this.attachmentModel.clear(),this._onDidLoadInputState.fire(),this.accessibilityService.isScreenReaderOptimized()&&it?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(pV(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=this._register(new E),this._chatSessionOptionEmitters.set(e,t)),t}getOrCreateOptionContextKey(e){if(!this._scopedContextKeyService)return;let t=this._optionContextKeys.get(e);return t||(t=new Q(`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=x.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(o.chatSessionType);this.chatSessionHasCustomAgentTarget.set(n!=="undefined");let r=o&&this.chatSessionsService.requiresCustomModelsForSessionType(o.chatSessionType);if(this.chatSessionHasTargetedModels.set(!!r),n){let h=this.chatSessionsService.getSessionOption(o.chatSessionResource,aTt);if(typeof h<"u"){let g=(typeof h=="string"?h:h.id)||Pl.Agent.id,f=this._currentModeObservable.get();(g===Pl.Agent.id?f.id!==Pl.Agent.id:f.label.get()!==g)&&this.setChatMode(g)}}let l=this.options.sessionTypePickerDelegate?.getActiveSessionProvider?.()??o?.chatSessionType;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);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.entries()){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")}disposeSessionPickerWidgets(){for(let e of this.chatSessionPickerWidgets.values())e.dispose();this.chatSessionPickerWidgets.clear()}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?.chatSessionType||""}updateAgentSessionTypeContextKey(){let e=this._widget?.viewModel?.model.sessionResource,t=this.options.sessionTypePickerDelegate,n=t?.setActiveSessionProvider&&t?.getActiveSessionProvider?.()||(e?fg(e):"");this.agentSessionTypeKey.set(n)}updateWidgetLockStateFromSessionType(e){if(e===qp){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||fg(e))===qp)){this._widgetController.clear();return}this._widgetController.value||(this._widgetController.value=this.instantiationService.createInstance(_Ae,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 P;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 V=n.getActiveSessionProvider();V&&this.updateWidgetLockStateFromSessionType(V)}this._register(o.onDidChangeViewModel(V=>{this._pendingDelegationTarget=void 0,this.updateAgentSessionTypeContextKey(),this.refreshChatSessionPickers(),this.tryUpdateWidgetController(),this.updateContextUsageWidget();let U=!1;if(V.currentSessionResource){for(let $ of this._questionCarouselSessionResources.values())if(Xe($,V.currentSessionResource)){U=!0;break}}this._questionCarouselSessionResources.size>0&&(!V.currentSessionResource||!U)&&this.clearQuestionCarousel();let G=this.getCurrentSessionType();V.currentSessionResource&&G!==this._currentSessionType&&(this._currentSessionType=G,this.initSelectedModel(),this.checkModelInSessionPool()),this.preselectModelFromSessionHistory()}));let r;this.options.renderStyle==="compact"?r=bt(".interactive-input-part",[bt(".interactive-input-and-edit-session",[bt(".chat-question-carousel-widget-container@chatQuestionCarouselContainer"),bt(".chat-input-widgets-container@chatInputWidgetsContainer"),bt(".chat-todo-list-widget-container@chatInputTodoListWidgetContainer"),bt(".chat-editing-session@chatEditingSessionWidgetContainer"),bt(".chat-getting-started-tip-container@chatGettingStartedTipContainer"),bt(".interactive-input-and-side-toolbar@inputAndSideToolbar",[bt(".chat-input-container@inputContainer",[bt(".chat-editor-container@editorContainer"),bt(".chat-input-toolbars@inputToolbars")])]),bt(".chat-secondary-toolbar@secondaryToolbar",[bt(".chat-context-usage-container@contextUsageWidgetContainer")]),bt(".chat-attachments-container@attachmentsContainer",[bt(".chat-attached-context@attachedContextContainer")]),bt(".interactive-input-followups@followupsContainer")])]):r=bt(".interactive-input-part",[bt(".chat-question-carousel-widget-container@chatQuestionCarouselContainer"),bt(".interactive-input-followups@followupsContainer"),bt(".chat-input-widgets-container@chatInputWidgetsContainer"),bt(".chat-todo-list-widget-container@chatInputTodoListWidgetContainer"),bt(".chat-editing-session@chatEditingSessionWidgetContainer"),bt(".chat-getting-started-tip-container@chatGettingStartedTipContainer"),bt(".interactive-input-and-side-toolbar@inputAndSideToolbar",[bt(".chat-input-container@inputContainer",[bt(".chat-attachments-container@attachmentsContainer",[bt(".chat-attached-context@attachedContextContainer")]),bt(".chat-editor-container@editorContainer"),bt(".chat-input-toolbars@inputToolbars")])]),bt(".chat-secondary-toolbar@secondaryToolbar",[bt(".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.isSessionsWindow||this.options.renderStyle==="compact")&&(this.secondaryToolbarContainer.style.display="none"),this.chatEditingSessionWidgetContainer=r.chatEditingSessionWidgetContainer,this.chatInputTodoListWidgetContainer=r.chatInputTodoListWidgetContainer,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(v2)),this.contextUsageWidgetContainer.appendChild(this.contextUsageWidget.domNode),this.options.enableImplicitContext&&!this._implicitContext?(this._implicitContext=this._register(this.instantiationService.createInstance(eUt)),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(V=>{V.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 Io([X,p]))),{historyNavigationBackwardsEnablement:g,historyNavigationForwardsEnablement:f}=this._register(qM(p,this));this.historyNavigationBackwardsEnablement=g,this.historyNavigationForewardsEnablement=f;let v=Kf(this.configurationService);v.overflowWidgetsDomNode=this.options.editorOverflowWidgetsDomNode,v.pasteAs=zb.pasteAs.defaultValue,v.readOnly=!1,v.ariaLabel=this._getAriaLabel(),v.fontFamily=HN,v.fontSize=13,v.lineHeight=xmo,v.padding=this.options.renderStyle==="compact"?oUt.compact:oUt.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=R(c,OAe(Emo));let b=xLe();b.contributions?.push(...aa.getSomeEditorContributions([kl.ID,Yg.ID,lh.ID,ou.ID,Fx.ID])),this._inputEditor=this._register(h.createInstance(jr,this._inputEditorElement,v,b)),El.get(this._inputEditor)?.forceRenderingAbove(),v.overflowWidgetsDomNode?.classList.add("hideSuggestTextIcons"),this._inputEditorElement.classList.add("hideSuggestTextIcons"),this._register(this._inputEditor.onKeyDown(V=>{if(V.keyCode===3&&!spt(V))for(let U of this.keybindingService.lookupKeybindings(SA.ID)){let G=U.getDispatchChords();if(G.length===1&&G[0]==="[Enter]"){V.preventDefault();break}}})),this._register(this._inputEditor.onDidChangeModelContent(()=>{let V=Math.min(this._inputEditor.getContentHeight(),this.inputEditorMaxHeight);V!==this.inputEditorHeight&&(this.inputEditorHeight=V,this.cachedWidth&&this._layout(this.cachedWidth));let U=this._inputEditor.getModel(),G=!!U&&U.getValue().trim().length>0;this.inputEditorHasText.set(G),this._syncTextDebounced.schedule()})),this._register(this._inputEditor.onDidContentSizeChange(V=>{V.contentHeightChanged&&(this.inputEditorHeight=this.inline?this.inputEditorHeight:V.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(()=>{ou.get(this._inputEditor)?.clearWidgets(),lh.get(this._inputEditor)?.clearWidgets()}));let S=this._register(Gg()),{location:y,isMaximized:w}=this.getWidgetLocationInfo(o),k={getOverflowAnchor:()=>this.inputActionsToolbar.getElement(),actionContext:{widget:o},hideChevrons:Ce(V=>this._stableInputPartWidth.read(V)<m7o),hoverPosition:{forcePosition:!0,hoverPosition:y==="sidebarRight"&&!w?0:1}};if(this._register(Vo(u,re.CLICK,V=>this.inputEditor.focus())),this._register(Vo(this.attachmentsContainer,re.CLICK,V=>this.inputEditor.focus())),this.inputActionsToolbar=this._register(this.instantiationService.createInstance(Ln,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:22},actionViewItemProvider:(V,U)=>{if(V.id===Ome.ID&&V instanceof Eo){this._currentLanguageModel||this.setCurrentLanguageModelToDefault();let G={currentModel:this._currentLanguageModel,setModel:$=>{this._waitForPersistedLanguageModel.clear(),this.setCurrentLanguageModel($),this.renderAttachedContext()},getModels:()=>this.getModels(),canManageModels:()=>{let $=this.getCurrentSessionType();return!$||$===qp}};return this.modelWidget=this.instantiationService.createInstance(rte,V,G,k)}else if(V.id===Fme.ID&&V instanceof Eo){let G={currentMode:this._currentModeObservable,sessionResource:()=>this._widget?.viewModel?.sessionResource,customAgentTarget:()=>{let $=this._widget?.viewModel?.model.sessionResource,te=$&&this.chatService.getChatSessionFromInternalUri($);return(te&&this.chatSessionsService.getCustomAgentTargetForSessionType(te.chatSessionType))??"undefined"}};return this.modeWidget=this.instantiationService.createInstance(DAe,V,G,k)}else if((V.id===Yee.ID||V.id===XPe.ID)&&V instanceof Eo){let G=()=>{let de=this._widget?.viewModel?.sessionResource;return de?Rf(de):void 0},$=this.options.sessionTypePickerDelegate??{getActiveSessionProvider:()=>G(),getPendingDelegationTarget:()=>this._pendingDelegationTarget,setPendingDelegationTarget:de=>{let se=G()===de;this._pendingDelegationTarget=se?void 0:de,this.updateWidgetLockStateFromSessionType(de),this.updateAgentSessionTypeContextKey(),this.refreshChatSessionPickers()}},te=!!this.options.sessionTypePickerDelegate?.setActiveSessionProvider,pe=V.id===Yee.ID||te?N3:Yme;return this.sessionTargetWidget=this.instantiationService.createInstance(pe,V,y==="editor"?"editor":"sidebar",$,k)}else{if(V.id===JPe.ID&&V instanceof Eo)return this.workspaceContextService.getWorkbenchState()===1&&this.options.workspacePickerDelegate?this.instantiationService.createInstance(Xme,V,this.options.workspacePickerDelegate,k):new nUt(V);if(V.id===ott.ID&&V instanceof Eo){let G=this.createChatSessionPickerWidgets(V);return G.length===0?new nUt(V):this.instantiationService.createInstance(Wki,V,G)}}}})),this.inputActionsToolbar.getElement().classList.add("chat-input-toolbar"),this.inputActionsToolbar.context={widget:o},this._register(this.inputActionsToolbar.onDidChangeMenuItems(()=>{let U=this.inputActionsToolbar.getElement().querySelector(".chat-sessionPicker-container");this.chatSessionPickerContainer=U,this.cachedWidth&&typeof this.cachedInputToolbarWidth=="number"&&this.cachedInputToolbarWidth!==this.inputActionsToolbar.getItemsWidth()&&this._toolbarRelayoutScheduler.schedule()})),this.executeToolbar=this._register(this.instantiationService.createInstance(Ln,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 V=this._register(this.instantiationService.createInstance(Ln,s,this.options.menus.inputSideToolbar,{telemetrySource:this.options.menus.telemetrySource,menuOptions:{shouldForwardArgs:!0},hoverDelegate:S}));this.inputSideToolbarContainer=V.getElement(),V.getElement().classList.add("chat-side-toolbar"),V.context={widget:o}}this.secondaryToolbar=this._register(this.instantiationService.createInstance(Ln,this.secondaryToolbarContainer,D.ChatInputSecondary,{telemetrySource:this.options.menus.telemetrySource,menuOptions:{shouldForwardArgs:!0},hiddenItemStrategy:-1,hoverDelegate:S,actionViewItemProvider:(V,U)=>{if((V.id===Yee.ID||V.id===XPe.ID)&&V instanceof Eo){let G=()=>{let de=this._widget?.viewModel?.sessionResource;return de?Rf(de):void 0},$=this.options.sessionTypePickerDelegate??{getActiveSessionProvider:()=>G(),getPendingDelegationTarget:()=>this._pendingDelegationTarget,setPendingDelegationTarget:de=>{let se=G()===de;this._pendingDelegationTarget=se?void 0:de,this.updateWidgetLockStateFromSessionType(de),this.updateAgentSessionTypeContextKey(),this.refreshChatSessionPickers()}},te=!!this.options.sessionTypePickerDelegate?.setActiveSessionProvider,pe=V.id===Yee.ID||te?N3:Yme;return this.sessionTargetWidget=this.instantiationService.createInstance(pe,V,y==="editor"?"editor":"sidebar",$,k)}else if(V.id===JPe.ID&&V instanceof Eo){if(this.workspaceContextService.getWorkbenchState()===1&&this.options.workspacePickerDelegate)return this.instantiationService.createInstance(Xme,V,this.options.workspacePickerDelegate,k);{let G=new oc(void 0,V);return G.element&&(G.element.style.display="none"),G}}else if(V.id===itt.ID&&V instanceof Eo){let G={currentPermissionLevel:this._currentPermissionLevel,setPermissionLevel:$=>{this._currentPermissionLevel.set($,void 0),this.permissionLevelKey.set($)}};return this.permissionWidget=this.instantiationService.createInstance(LAe,V,G,k)}}})),this.secondaryToolbar.getElement().classList.add("chat-secondary-input-toolbar"),this.secondaryToolbar.context={widget:o};let T=this.modelService.getModel(this.inputUri);if(T||(T=this.modelService.createModel("",null,this.inputUri,!0)),this.textModelResolverService.createModelReference(this.inputUri).then(V=>{if(this._store.isDisposed){V.dispose();return}this._register(V)}),this.inputModel=T,this.inputModel.updateOptions({bracketColorizationOptions:{enabled:!1,independentColorPoolPerBracketType:!1}}),this._inputEditor.setModel(this.inputModel),t){this.inputModel.setValue(t);let V=this.inputModel.getLineCount();this._inputEditor.setPosition({lineNumber:V,column:this.inputModel.getLineMaxColumn(V)})}let N=()=>{let V=this._inputEditor.getModel();if(!V)return;let U=this._inputEditor.getPosition();if(!U)return;let G=U.lineNumber===1&&U.column===1;this.chatCursorAtTop.set(G),this.historyNavigationBackwardsEnablement.set(G),this.historyNavigationForewardsEnablement.set(U.equals(Fki(V))),this._syncInputStateToModel()};this._register(this._inputEditor.onDidChangeCursorPosition(V=>N())),N(),this._register(this.themeService.onDidFileIconThemeChange(()=>{this.renderAttachedContext()})),this.renderAttachedContext();let O=this._register(new eL(()=>{let V=this.container.offsetHeight;this.height.set(V,void 0)}));if(this._register(O.observe(this.container)),this.options.renderStyle==="compact"){let V=this._register(new eL(()=>{this.cachedWidth&&this.layout(this.cachedWidth)}));this._register(V.observe(u))}}toggleChatInputOverlay(e){this.chatInputOverlay.classList.toggle("disabled",e),e?this.overlayClickListener.value=Vo(this.chatInputOverlay,re.CLICK,t=>{t.preventDefault(),t.stopPropagation(),this._onDidClickOverlay.fire()}):this.overlayClickListener.clear()}renderAttachedContext(){let e=this.attachedContextContainer,t=new P;this.attachedContextDisposables.value=t,Rt(e),t.add(Vo(this.attachmentsContainer,re.KEY_DOWN,c=>{this.handleAttachmentNavigation(c)}));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(c=>c.enabled||c.isSelection)??!1;if(this._implicitContext&&l){let c=(p,h,g)=>this._attachmentModel.attachments.some(f=>{let v=A.isUri(f.value)?f.value:nv(f.value)?f.value.uri:void 0,b=nv(f.value)?f.value.range:void 0;return g!==void 0&&MY(f)&&f.handle===g?!0:p&&v&&Xe(p,v)?h&&b?z.equalsRange(h,b):!h&&!b:!1}),u=this.instantiationService.createInstance(xAe,()=>this._widget,c,this._implicitContext,this._contextResourceLabels,this._attachmentModel,e);t.add(u),r=u.hasRenderedContexts}mm(!!(this.options.renderInputToolbarBelowInput||n||r),this.attachmentsContainer),mm(n||r,this.attachedContextContainer),o.length||(this._indexOfLastAttachedContextDeletedWithKeyboard=-1,this._indexOfLastOpenedContext=-1);for(let[c,u]of o){let p=A.isUri(u.value)?u.value:nv(u.value)?u.value.uri:void 0,h=nv(u.value)?u.value.range:void 0,g=c===Math.min(this._indexOfLastAttachedContextDeletedWithKeyboard,this.attachmentModel.size-1)&&this._indexOfLastAttachedContextDeletedWithKeyboard>-1,f,v={shouldFocusClearButton:g,supportsDeletion:!0},b=this._currentLanguageModel.get();u.kind==="tool"||u.kind==="toolset"?f=this.instantiationService.createInstance(Tee,u,b,v,e,this._contextResourceLabels):p&&bTt(u)?f=this.instantiationService.createInstance(_ee,p,u,b,v,e,this._contextResourceLabels):pP(u)?f=this.instantiationService.createInstance(kee,u,b,v,e,this._contextResourceLabels):PY(u)?f=this.instantiationService.createInstance(Eee,u,void 0,v,e,this._contextResourceLabels):p&&(u.kind==="file"||u.kind==="directory")?f=this.instantiationService.createInstance(Iee,p,h,u,void 0,b,v,e,this._contextResourceLabels):u.kind==="terminalCommand"?f=this.instantiationService.createInstance(yee,u,b,v,e,this._contextResourceLabels):pV(u)?f=this.instantiationService.createInstance(wee,p,u,b,v,e,this._contextResourceLabels):STt(u)?f=this.instantiationService.createInstance(Dee,u,b,v,e,this._contextResourceLabels):fTt(u)?f=this.instantiationService.createInstance(Cee,u,b,v,e,this._contextResourceLabels):ITt(u)?f=this.instantiationService.createInstance(Lee,u,b,v,e,this._contextResourceLabels):yTt(u)?f=this.instantiationService.createInstance(Ree,u,b,v,e,this._contextResourceLabels):wTt(u)?f=this.instantiationService.createInstance(Mee,u,b,v,e,this._contextResourceLabels):f=this._chatAttachmentWidgetRegistry.createWidget(u,v,e)??this.instantiationService.createInstance(xee,p,h,u,void 0,b,v,e,this._contextResourceLabels),g&&f.element.focus(),c===Math.min(this._indexOfLastOpenedContext,this.attachmentModel.size-1)&&f.element.focus(),t.add(f),t.add(f.onDidDelete(S=>{this.handleAttachmentDeletion(S,c,u)})),t.add(f.onDidOpen(S=>{this.handleAttachmentOpen(c,u)}))}this._indexOfLastOpenedContext=-1}handleAttachmentDeletion(e,t,o){if(ag(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)&&Xe(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=Me(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(kAe));this._chatInputTodoListWidget.value=o,Rt(this.chatInputTodoListWidgetContainer),R(this.chatInputTodoListWidgetContainer,o.domNode)}this._chatInputTodoListWidget.value.render(e)}}clearTodoListWidget(e,t){this._chatInputTodoListWidget.value?.clear(e,t)}renderQuestionCarousel(e,t,o){let n=e.resolveId??`${Vi(t.element)?t.element.requestId:""}_${t.contentIndex}`,r=this._chatQuestionCarouselWidgets.get(n);if(r)return r;Vi(t.element)&&(this._questionCarouselResponseIds.set(n,t.element.requestId),this._questionCarouselSessionResources.set(n,t.element.sessionResource));let s=this.instantiationService.createInstance(k3,e,t,o);return this._chatQuestionCarouselWidgets.set(n,s),this._hasQuestionCarouselContextKey?.set(!0),R(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){mm(!!e,this.chatEditingSessionWidgetContainer),e&&(Xe(e.chatSessionResource,this._lastEditingSessionResource)||this._workingSetCollapsed.set(!0,void 0),this._lastEditingSessionResource=e.chatSessionResource);let t=hs({equalsFn:$i},l=>{let c=e?.chatSessionResource??this._widget?.viewModel?.model.sessionResource;return c&&fg(c)==="copilotcli"?[]:e?.entries.read(l).filter(u=>u.state.read(l)===0)||[]}),o=Ce(l=>{let c=new Mn,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 ht.empty();let c=this.agentSessionsService.getSession(l);return c?.changes instanceof Array?c.changes:ht.empty()}),r=Ce(l=>n.read(l).map(c=>({reference:ike(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=Ce(l=>o.read(l).length>0||r.read(l).length>0);this._renderingChatEdits.value=he(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")??R(this.chatEditingSessionWidgetContainer,OAe(".chat-editing-session-container.show-file-icons")),s=r.querySelector(".chat-editing-session-overview")??R(r,OAe(".chat-editing-session-overview")),l=s.querySelector(".working-set-title")??R(s,OAe(".working-set-title"));this._chatEditsActionsDisposables.clear();let c=s.querySelector(".chat-editing-session-actions")??R(s,OAe(".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,fg(u)),this._chatEditsActionsDisposables.add(tc(ie.hasAgentSessionChanges,p,w=>!!n.read(w)?.length));let h=this._chatEditsActionsDisposables.add(this.instantiationService.createChild(new Io([X,p]))),g=r.querySelector(".chat-editing-session-list")??R(r,OAe(".chat-editing-session-list")),f=this._chatEditsActionsDisposables.add(new oO(l,{supportIcons:!0,secondary:!0,ariaLabel:d(7388,null)})),v=Ce(w=>{let k=o.read(w),T=n.read(w),N=0,O=0;if(k.length>0)for(let $ of k)$.kind==="reference"&&$.options?.diffMeta&&(N+=$.options.diffMeta.added,O+=$.options.diffMeta.removed);else for(let $ of T)$.kind==="reference"&&$.options?.diffMeta&&(N+=$.options.diffMeta.added,O+=$.options.diffMeta.removed);let V=k.length>0?k.length:T.length,U=k.length===0&&T.length>0,G=k.length>0||T.length>0;return{files:V,added:N,removed:O,shouldShowEditingSession:G,topLevelIsSessionMenu:U}}),b=v.map(w=>w.topLevelIsSessionMenu);e.add(he(w=>{let k=b.read(w);w.store.add(h.createInstance(QF,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===Pme.ID||T.id===Ame.Id||T.id===ett.ID)return{showIcon:!0,showLabel:!1,isSecondary:!0}}}))})),e.add(he(w=>{let{files:k,added:T,removed:N,shouldShowEditingSession:O}=v.read(w),V=k===1?d(7387,null):d(7386,null,k);f.label=V,f.element.setAttribute("aria-label",d(7385,null,V,T,N)),this._workingSetLinesAddedSpan.value.textContent=`+${T}`,this._workingSetLinesRemovedSpan.value.textContent=`-${N}`,mm(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(he(w=>{let k=this._workingSetCollapsed.read(w);f.icon=k?M.chevronRight:M.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,N=k.element.options?.originalUri;if(k.element.options?.isDeletion&&N){await this.editorService.openEditor({resource:N,options:k.editorOptions},k.sideBySide?vn:Un);return}if(N){await this.editorService.openEditor({original:{resource:N},modified:{resource:T},options:k.editorOptions},k.sideBySide?vn:Un);return}let O=t?.getEntry(T),V=await this.editorService.openEditor({resource:T,options:k.editorOptions},k.sideBySide?vn:Un);V&&O?.getEditorIntegration(V).reveal(!0,k.editorOptions.preserveFocus)}})),this._chatEditsDisposables.add(j(w.getHTMLElement(),"click",k=>{this.hasFocus()||this._onDidFocus.fire()},!0)),R(g,w.getHTMLElement()),R(r,g)}e.add(he(w=>{let k=o.read(w),T=n.read(w),N=k.concat(T),U=Math.min(N.length,6)*22,G=this._chatEditList.object;G.layout(U),G.getHTMLElement().style.height=`${U}px`,G.splice(0,G.length,N)}))}async renderFollowups(e,t){this.options.renderFollowups&&(this.followupsDisposables.clear(),Rt(this.followupsContainer),e&&e.length>0&&this.followupsDisposables.add(this.instantiationService.createInstance(TAe,this.followupsContainer,e,this.location,void 0,o=>this._onDidAcceptFollowup.fire({followup:o,response:t}))))}layout(e){return this.cachedWidth=e,this._stableInputPartWidth.set(e,void 0),this._layout(e)}_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.inputEditorMinHeight?Math.max(this.inputEditorMinHeight,Math.min(this._inputEditor.getContentHeight(),this.inputEditorMaxHeight)):Math.min(this._inputEditor.getContentHeight(),this.inputEditorMaxHeight),c={width:s,height:l};if((!this.previousInputEditorDimension||this.previousInputEditorDimension.width!==c.width||this.previousInputEditorDimension.height!==c.height)&&(this._inputEditor.layout(c),this.previousInputEditorDimension=c),t&&r<10)return this._layout(e,!1)}getLayoutData(){let e=this.inputSideToolbarContainer?yl(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=yl(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(_ce(e.viewContext))return{location:"editor",isMaximized:!1};if(XI(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}}};F3=I([m(4,Ct),m(5,F),m(6,X),m(7,B),m(8,_e),m(9,Bi),m(10,Wr),m(11,ne),m(12,be),m(13,ee),m(14,De),m(15,Nt),m(16,le),m(17,br),m(18,t2),m(19,kC),m(20,vr),m(21,Pv),m(22,jn),m(23,Si),m(24,Ls),m(25,Q_),m(26,ia),m(27,Pe),m(28,fi),m(29,Ri),m(30,Aee)],F3);function Fki(a){return{lineNumber:a.getLineCount(),column:a.getLineLength(a.getLineCount())+1}}var Emo=".interactive-input-editor";kLe(Emo);var Wki=class extends Lr{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()}},nUt=class extends oc{constructor(i){super(void 0,i)}render(i){super.render(i),i.style.display="none"}};var Vki=(a,i)=>{let e=a.get(_e),t=a.get(X),o=e.lookupKeybinding(D3,t)?.getAriaLabel(),n=e.lookupKeybinding(ntt,t)?.getAriaLabel(),r=i.map(l=>{let c=l.state.get();if(c.type===lo.StateKind.WaitingForPostApproval){let g=mV(c.resultDetails)?c.resultDetails.input:zj(c.resultDetails)?void 0:DTt(c.contentForModel);return{title:d(5284,null),detail:g}}if(!(c.type===lo.StateKind.WaitingForConfirmation&&c.confirmationMessages?.message))return;let u="";if(l.toolSpecificData)if(l.toolSpecificData.kind==="terminal"){let g=fR(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));let p=c.confirmationMessages?.title;return{title:((typeof p=="string"?p:p?.value||"")+(u?": "+u:"")).trim(),detail:void 0}}).filter(mo),s=o&&n?d(5283,null,r.map(l=>l.title).join(", "),o,n):d(5281,null,r.map(l=>l.title).join(", "));return r.some(l=>l.detail)&&(s+=" "+d(5282,null,r.map(l=>l.detail?l.detail:"").join(" "))),s},FAe=class{constructor(i,e){this._accessibleViewService=i;this._instantiationService=e}getWidgetRole(){return"list"}getRole(i){return"listitem"}getWidgetAriaLabel(){return d(5270,null)}getAriaLabel(i){return Rr(i)?i.messageText:Vi(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===lo.StateKind.WaitingForConfirmation||v===lo.StateKind.WaitingForPostApproval}).length&&(n=this._instantiationService.invokeFunction(Vki,o));let r=Yc.lexer(i.response.toString()).filter(g=>g.type==="table")?.length??0,s="";switch(r){case 0:break;case 1:s=d(5280,null);break;default:s=d(5274,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(5279,null);break;default:c=d(5273,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=Yc.lexer(i.response.toString()).filter(g=>g.type==="code")?.length??0;switch(h){case 0:t=e?d(5276,null,n,c,p,s,i.response.toString(),e):d(5275,null,c,p,s,i.response.toString());break;case 1:t=e?d(5278,null,n,c,p,s,i.response.toString(),e):d(5277,null,c,p,s,i.response.toString());break;default:t=e?d(5272,null,n,c,p,s,h,i.response.toString(),e):d(5271,null,c,p,h,s,i.response.toString());break}return t}};FAe=I([m(0,Wd),m(1,F)],FAe);var AB=class extends C{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=>{AB.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:AB.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()}};AB=I([m(4,B),m(5,De),m(6,Ri)],AB);var Tmo="data-pending-request-id",g7o="data-pending-kind",_mo="chat-pending-dragging",WAe=class extends C{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 Om(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(_mo),r.dataTransfer.setDragImage(o,0,0),r.dataTransfer.effectAllowed="move")})),n.add(j(t,re.DRAG_END,()=>{o.classList.remove(_mo),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?.(`[${Tmo}]`);if(!t)return;let o=t.getAttribute(Tmo);if(!(t.getAttribute(g7o)!==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)}};WAe=I([m(2,Si)],WAe);var ste=class extends C{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(YF,"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=this._register(this.instantiationService.createChild(new Io([X,this.contextKeyService])));this._renderStyle=t.renderStyle;let h=t.overflowWidgetsDomNode??document.createElement("div");t.overflowWidgetsDomNode||(h.classList.add("chat-overflow-widget-container","monaco-editor"),this._container.append(h),this._register(Z(()=>h.remove())));let g=t.editorOptions??this._register(p.createInstance(AB,t.viewId,"foreground",t.inputEditorBackground??"chat.requestEditor.background",t.resultEditorBackground??"chat.responseEditor.background")),f=p.createInstance(YHt,t.defaultElementHeight??200),v={getListLength:()=>this._tree.getNode(null).visibleChildrenCount,onDidScroll:this.onDidScroll,container:this._container,currentChatMode:t.currentChatMode??(()=>"ask")};this._renderer=this._register(p.createInstance(A3,g,t.rendererOptions??{},v,this._codeBlockModelCollection,h,this._viewModel)),this._register(this._renderer.onDidClickFollowup(S=>{this._onDidClickFollowup.fire(S)})),this._register(this._renderer.onDidChangeItemHeight(S=>{this._updateElementHeight(S.element,S.height);let y=this._viewModel?.getItems().at(-2);S.element.id===y?.id&&this.updateLastItemMinHeight(),this._onDidChangeItemHeight.fire(S)})),this._register(this._renderer.onDidClickRerunWithAgentOrCommandDetection(S=>{let y=this.chatService.getSession(S.sessionResource)?.getRequests().find(w=>w.id===S.requestId);if(y){let w={noCommandDetection:!0,attempt:y.attempt+1,location:this._location,userSelectedModelId:this._getCurrentLanguageModelId?.(),modeInfo:this._getCurrentModeInfo?.()};this.chatAccessibilityService.acceptRequest(S.sessionResource),this.chatService.resendRequest(y,w).catch(k=>this.logService.error("FAILED to rerun request",k))}})),this._renderer.pendingDragController=this._register(p.createInstance(WAe,this._container,()=>this._viewModel));let b=t.styles??{};this._tree=this._register(p.createInstance(mg,"ChatList",this._container,f,[this._renderer],{identityProvider:{getId:S=>S.id},horizontalScrolling:!1,alwaysConsumeMouseWheel:!1,supportDynamicHeights:!0,hideTwistiesOfChildlessElements:!0,accessibilityProvider:this.instantiationService.createInstance(FAe),keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:S=>Rr(S)?S.message:Vi(S)?S.response.value:""},setRowLineHeight:!1,scrollToActiveElement:!0,filter:t.filter,overrideStyles:{listFocusBackground:b.listBackground,listInactiveFocusBackground:b.listBackground,listActiveSelectionBackground:b.listBackground,listFocusAndSelectionBackground:b.listBackground,listInactiveSelectionBackground:b.listBackground,listHoverBackground:b.listBackground,listBackground:b.listBackground,listFocusForeground:b.listForeground,listHoverForeground:b.listForeground,listInactiveFocusForeground:b.listForeground,listInactiveSelectionForeground:b.listForeground,listActiveSelectionForeground:b.listForeground,listFocusAndSelectionForeground:b.listForeground,listActiveSelectionIconForeground:void 0,listInactiveSelectionIconForeground:void 0}})),this._scrollDownButton=this._register(new Mi(this._container,{buttonBackground:wt(H$),buttonForeground:wt(Fse),buttonHoverBackground:wt(Wse),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=`$(${M.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 S=this.getFocus();if(S&&S.length>0){let y=S[0],k=this.getItems().findIndex(T=>T===y);k!==-1&&(this._mostRecentlyFocusedItemIndex=k)}})),this._register(this._tree.onDidScroll(S=>{this._onDidScroll.fire(S),this.updateScrollDownButtonVisibility()})),this._register(this._tree.onContextMenu(S=>{this.handleContextMenu(S)})),this._register(this.configurationService.onDidChangeConfiguration(S=>{(S.affectsConfiguration("chat.editRequests")||S.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(`.${LMe}`)!==null,r=this.contextKeyService.createOverlay([[ie.responseIsFiltered.key,Vi(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=Rr(n)||Vi(n)?n.dataId:n.id,s=Rr(n)||Vi(n)?n.shouldBeRemovedOnSend:void 0,l=Rr(n)&&o?.id===n.id,c=Rr(n)||Vi(n)?n.shouldBeBlocked.get():!1;return r+`${Vi(n)&&n.renderData?`_${this._visibleChangeCount}`:""}`+(Vi(n)?`_${n.contentReferences.length}`:"")+`_${s?`${s.afterUndoStop||"1"}`:"0"}_${l?"edit":""}_${c?"blocked":""}`+(Rr(n)?`_${o?"1":"0"}`:"")+`_setting${this._settingChangeCounter}`+(Rr(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 ai(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(Rr(t)||Vi(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)}}}};ste=I([m(2,F),m(3,X),m(4,Si),m(5,ze),m(6,ne),m(7,B),m(8,NO)],ste);var Bki=class extends C{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}},NB=new Bki;oe.add("workbench.registry.chat.viewsWelcome",NB);var ktt=_,VAe=class extends C{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 P);this.renderDisposables=this._register(new P);this._isShowingWelcome=Le(this,!1);this.element=R(this.container,_(".chat-view-welcome")),this._register(H.runAndSubscribe(t.onDidChangeViewWelcomeState,()=>this.update())),this._register(NB.onDidChange(()=>this.update(!0)))}get isShowingWelcome(){return this._isShowingWelcome}getMatchingWelcomeView(){return NB.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=NB.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(Jme,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)}};VAe=I([m(3,X),m(4,F)],VAe);var Jme=class extends C{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=R(this.element,ktt(".chat-welcome-view-icon"));if(e.useLargeIcon&&s.classList.add("large-icon"),e.icon){if(q.isThemeIcon(e.icon)){let p=Qo(e.icon);s.appendChild(p)}else if(A.isUri(e.icon)){let p=Na(e.icon),h=new Ly;h.update(p);let g=`chat-welcome-icon-${h.digest()}`,f=`.chat-welcome-view-icon.${g}`;Vh(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=R(this.element,ktt(".chat-welcome-view-title"));l.textContent=e.title;let c=R(this.element,ktt(".chat-welcome-view-message")),u=this.renderMarkdownMessageContent(e.message,t);if(R(c,u.element),e.additionalMessage){let p=R(this.element,ktt(".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=R(this.element,ktt(".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 Mi(n.parentElement,Ko));s.label=n.textContent??"",r&&this._register(s.onDidClick(()=>{this.openerService.open(r,{allowCommands:!0})})),n.replaceWith(s.element)}return o}};Jme=I([m(2,Qe),m(3,ne),m(4,Qn)],Jme);var rUt=class a extends C{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===jx.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 IA={DismissedTips:"chat.tip.dismissed",LastTipId:"chat.tip.lastTipId",ThinkingPhrasesEverModified:"chat.tip.thinkingPhrasesEverModified"},Zme={ExecutedCommands:"chat.tips.executedCommands",UsedModes:"chat.tips.usedModes",InvokedTools:"chat.tips.invokedTools"},bD={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 ehe=class extends C{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(Zme.ExecutedCommands);this._executedCommands=new Set(l?JSON.parse(l):[]);let c=this._readApplicationWithProfileFallback(Zme.UsedModes);this._usedModes=new Set(c?JSON.parse(c):[]);let u=this._readApplicationWithProfileFallback(Zme.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(Zme.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(Zme.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(Zme.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,ve.None),t.agentFileType?this._promptsService.listAgentInstructions(ve.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}};ehe=I([m(1,ge),m(2,le),m(3,nr),m(4,jn),m(5,ne)],ehe);function BAe(a,i){let e=a.keybindingService.lookupKeybinding(i);return e?` (${e.getLabel()})`:""}function Hki(a){let i=/\[.*?\]\(command:([^?\s)]+)/g,e=new Set,t;for(;(t=i.exec(a))!==null;)e.add(t[1]);return[...e]}var a0=[{id:"tip.switchToAuto",tier:"foundational",priority:0,buildMessage(a){return new xe(d(6832,null))},onlyWhenModelIds:["gpt-4.1"]},{id:"tip.init",tier:"foundational",priority:50,buildMessage(a){let i=BAe(a,s2);return new xe(d(6827,null,"/init",s2,i))},when:ie.chatSessionType.isEqualTo(qp),excludeWhenCommandsExecuted:[s2,bD.CreateAgentInstructionsUsed]},{id:"tip.createPrompt",tier:"foundational",buildMessage(a){let i=BAe(a,r3);return new xe(d(6824,null,"/create-prompt",r3,i))},when:ie.chatSessionType.isEqualTo(qp),excludeWhenCommandsExecuted:[r3,bD.CreatePromptUsed]},{id:"tip.createAgent",tier:"foundational",priority:30,buildMessage(a){let i=BAe(a,a3);return new xe(d(6823,null,"/create-agent",a3,i))},when:ie.chatSessionType.isEqualTo(qp),excludeWhenCommandsExecuted:[a3,bD.CreateAgentUsed]},{id:"tip.createSkill",tier:"foundational",priority:40,buildMessage(a){let i=BAe(a,s3);return new xe(d(6825,null,"/create-skill",s3,i))},when:ie.chatSessionType.isEqualTo(qp),excludeWhenCommandsExecuted:[s3,bD.CreateSkillUsed]},{id:"tip.planMode",tier:"foundational",priority:20,buildMessage(a){let i=BAe(a,"workbench.action.chat.openPlan");return new xe(d(6830,null,"Plan agent",i))},when:ie.chatModeName.notEqualsTo("Plan"),excludeWhenCommandsExecuted:["workbench.action.chat.openPlan"],excludeWhenModesUsed:["Plan"]},{id:"tip.attachFiles",tier:"qol",buildMessage(){return new xe(d(6821,null))},excludeWhenCommandsExecuted:["workbench.action.chat.attachContext","workbench.action.chat.attachFile","workbench.action.chat.attachFolder","workbench.action.chat.attachSelection",bD.AttachFilesReferenceUsed]},{id:"tip.codeActions",tier:"qol",buildMessage(){return new xe(d(6822,null))},excludeWhenCommandsExecuted:["inlineChat.start"]},{id:"tip.undoChanges",tier:"qol",buildMessage(){return new xe(d(6834,null))},when:x.and(ie.chatSessionType.isEqualTo(qp),x.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 xe(d(6829,null))},when:ie.chatModeKind.isEqualTo("agent"),excludeWhenCommandsExecuted:["workbench.action.chat.queueMessage","workbench.action.chat.steerWithMessage"]},{id:"tip.forkConversation",tier:"qol",buildMessage(a){let i=BAe(a,met);return new xe(d(6826,null,"/fork",met,i))},excludeWhenCommandsExecuted:[met,"workbench.action.chat.forkConversation",bD.ForkConversationUsed]},{id:"tip.agenticBrowser",tier:"qol",buildMessage(){return new xe(d(6820,null,"agentic browser integration"))},when:x.and(ie.chatModeKind.isEqualTo("agent"),x.notEquals("config.workbench.browser.enableChatTools",!0)),excludeWhenSettingsChanged:["workbench.browser.enableChatTools"],dismissWhenCommandsClicked:["workbench.action.openSettings"]},{id:"tip.mermaid",tier:"qol",buildMessage(){return new xe(d(6828,null))},when:ie.chatModeKind.isEqualTo("agent"),excludeWhenToolsInvoked:["renderMermaidDiagram"]},{id:"tip.subagents",tier:"qol",buildMessage(){return new xe(d(6831,null))},when:ie.chatModeKind.isEqualTo("agent"),excludeWhenToolsInvoked:["runSubagent"]},{id:"tip.thinkingPhrases",tier:"qol",buildMessage(){return new xe(d(6833,null,"thinking phrases","chat.agent.thinking.phrases"))},when:ie.chatModeKind.isEqualTo("agent"),excludeWhenSettingsChanged:["chat.agent.thinking.phrases"],dismissWhenCommandsClicked:["workbench.action.openSettings"]}];var ZRp=bD.AttachFilesReferenceUsed,f7o=bD.CreateAgentInstructionsUsed,v7o=bD.CreatePromptUsed,b7o=bD.CreateAgentUsed,S7o=bD.CreateSkillUsed,I7o=bD.ForkConversationUsed,l0=ae("chatTipService"),HAe=class extends C{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(ehe,a0)),this._createSlashCommandsUsageTracker=this._register(new rUt(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(bD.AttachFilesReferenceUsed);let f=this._getSlashCommandTrackingId(g);f&&this._tracker.recordCommandExecuted(f),this._hideShownTipIfNowIneligible()})),this._thinkingPhrasesEverModified=this._storageService.getBoolean(IA.ThinkingPhrasesEverModified,-1,!1),!this._thinkingPhrasesEverModified&&this._isSettingModified("chat.agent.thinking.phrases")&&(this._thinkingPhrasesEverModified=!0,this._storageService.store(IA.ThinkingPhrasesEverModified,!0,-1,1)),this._thinkingPhrasesEverModified||this._register(this._configurationService.onDidChangeConfiguration(h=>{h.affectsConfiguration("chat.agent.thinking.phrases")&&(this._thinkingPhrasesEverModified=!0,this._storageService.store(IA.ThinkingPhrasesEverModified,!0,-1,1))}))}_hasFileOrFolderReference(e){return e.parts.some(t=>{if(t.kind!==tR.Kind)return!1;let o=t;return o.isFile===!0||o.isDirectory===!0})}_getSlashCommandTrackingId(e){for(let n of e.parts){if(n.kind===jx.Kind){let r=n.slashCommand.command;return this._toSlashCommandTrackingId(r)}if(n.kind===Pf.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 f7o;case"create-prompt":return v7o;case"create-agent":return b7o;case"create-skill":return S7o;case"fork":return I7o;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(IA.DismissedTips,JSON.stringify([...e]),-1,1)}this._tipRequestId=void 0,this._onDidDismissTip.fire()}dismissTipForSession(){this.dismissTip(),this.hideTipsForSession()}clearDismissedTips(){this._storageService.remove(IA.DismissedTips,-1),this._storageService.remove(IA.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(IA.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(a0.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=a0.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(IA.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(IA.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=a0.findIndex(r=>r.id===e);if(o===-1)return;let n=new Set(this._getDismissedTipIds());for(let r=1;r<a0.length;r++){let s=(o+r)%a0.length,l=a0[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=a0.filter(s=>!o.has(s.id)&&this._isEligible(s,t)),r=this._selectTipByTier(n);if(r)return this._storageService.store(IA.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(IA.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(IA.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=a0.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=a0.findIndex(c=>c.id===t.id),l=a0.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(6835,null,o.value),r=Hki(n),s=new xe(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=Hki(o.value);if(!n.length)return;let r=new Set(n),s=new Set(e.dismissWhenCommandsClicked);this._tipCommandListener.value=this._commandService.onDidExecuteCommand(l=>{r.has(l.commandId)&&this._shownTip?.id===e.id&&(this._logTipTelemetry(e.id,"commandClicked",l.commandId),s.has(l.commandId)&&this.dismissTip(),this.hideTipsForSession())})}_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}};HAe=I([m(0,nt),m(1,B),m(2,le),m(3,Si),m(4,F),m(5,ne),m(6,vr),m(7,ge),m(8,Te),m(9,_e)],HAe);var Dmo=_,UAe=class extends C{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=Dmo(".chat-tip-widget"),this.domNode.tabIndex=0,this.domNode.setAttribute("role","region"),this.domNode.setAttribute("aria-roledescription",d(7229,null)),this._inChatTipContextKey=ie.inChatTip.bindTo(this._contextKeyService),this._multipleChatTipsContextKey=ie.multipleChatTips.bindTo(this._contextKeyService);let h=this._register(Vn(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),Ah(Me(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=>{$t.stop(g,!0);let f=new yn(Me(this.domNode),g);this._contextMenuService.showContextMenu({getAnchor:()=>f,getActions:()=>{let v=this._menuService.getMenuActions(D.ChatTipContext,this._contextKeyService);return Uc(v)}})}))}hasFocus(){return ts(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=Dmo(".chat-tip-toolbar");this._toolbar.value=this._instantiationService.createInstance(Ln,o,D.ChatTipToolbar,{menuOptions:{shouldForwardArgs:!0}}),this.domNode.appendChild(o);let n=t.element.textContent??d(7222,null),s=/\[.*?\]\(.*?\)/.test(e.content.value)?d(7230,null,n):n;this.domNode.setAttribute("aria-label",s)}async _handleTipAction(e,t){e.startsWith("command:")&&this._shouldTriggerSetup()&&!await this._commandService.executeCommand(pI)||await zM(this._openerService,e,t.isTrusted)}_shouldTriggerSetup(){return this._chatEntitlementService.sentiment?.installed?this._chatEntitlementService.entitlement===1:!0}};UAe=I([m(2,l0),m(3,ze),m(4,qt),m(5,X),m(6,F),m(7,Qe),m(8,ge),m(9,vr)],UAe);W(class extends K{constructor(){super({id:"workbench.action.chat.previousTip",title:L(7227,"Previous tip"),icon:M.chevronLeft,precondition:ie.multipleChatTips,f1:!1,menu:[{id:D.ChatTipToolbar,group:"navigation",order:1}]})}async run(i){i.get(l0).navigateToPreviousTip()}});W(class extends K{constructor(){super({id:"workbench.action.chat.nextTip",title:L(7226,"Next tip"),icon:M.chevronRight,precondition:ie.multipleChatTips,f1:!1,menu:[{id:D.ChatTipToolbar,group:"navigation",order:2}]})}async run(i){i.get(l0).navigateToNextTip()}});W(class extends K{constructor(){super({id:"workbench.action.chat.dismissTipToolbar",title:L(7225,"Dismiss tip"),icon:M.check,f1:!1,menu:[{id:D.ChatTipToolbar,group:"navigation",order:3}]})}async run(i){i.get(l0).dismissTipForSession()}});W(class extends K{constructor(){super({id:"workbench.action.chat.dismissTip",title:L(7224,"Dismiss this tip"),f1:!1,menu:[{id:D.ChatTipContext,group:"chatTip",order:1}]})}async run(i){i.get(l0).dismissTipForSession()}});W(class extends K{constructor(){super({id:"workbench.action.chat.disableTips",title:L(7223,"Disable tips"),icon:M.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(l0),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(7228,"Reset Dismissed Tips"),f1:!0,precondition:ie.enabled})}async run(i){i.get(l0).clearDismissedTips()}});var sUt=_;function aUt(a){return _ce(a.viewContext)&&!!a.viewContext.isQuickChat}function y7o(a){return _ce(a.viewContext)&&!!a.viewContext.isInlineChat}var Lmo={supportsFileAttachments:!0,supportsToolAttachments:!0,supportsMCPAttachments:!0,supportsImageAttachments:!0,supportsSearchResultAttachments:!0,supportsInstructionAttachments:!0,supportsSourceControlAttachments:!0,supportsProblemAttachments:!0,supportsSymbolAttachments:!0,supportsTerminalAttachments:!0,supportsPromptAttachments:!0,supportsHandOffs:!0},Uki=d(7376,null),Cw=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N,O,V,U,G,$,te,pe,de,se){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=N;this.chatLayoutService=O;this.chatEntitlementService=V;this.chatSessionsService=U;this.agentSessionsService=G;this.chatTodoListService=$;this.lifecycleService=te;this.chatAttachmentResolveService=pe;this.chatTipService=de;this.chatDebugService=se;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=Lmo;this.viewModelDisposables=this._register(new P);this._editingSession=Le(this,void 0);this._viewModelObs=ui(this,this.onDidChangeViewModel,()=>this.viewModel);this._lockedToCodingAgentContextKey=ie.lockedToCodingAgent.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(ke=>{let Ee=this.viewModel?.sessionResource;Ee&&ke.sessionResource.toString()===Ee.toString()&&this._sessionHasDebugDataContextKey.set(!0)})),this.viewContext=t??{};let Se=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(aUt(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(ke=>{if(ke.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 Ee=this.inputPart.gettingStartedTipContainerElement;Rt(Ee),mm(!1,Ee)}}})),this._register(tc(kQe,c,ke=>{let Ee=this._editingSession.read(ke);return Ee?Ee.entries.read(ke).filter(Fe=>Fe.state.read(ke)!==0).map(Fe=>Fe.entryId):void 0})),this._register(tc(Zx,c,ke=>(this._editingSession.read(ke)?.entries.read(ke)??[]).filter(Fe=>Fe.state.read(ke)===0).length>0)),this._register(tc(zce,c,ke=>{let Ee=this._editingSession.read(ke);return Ee?Ee.entries.read(ke).length>0:!1})),this._register(tc(T_t,c,ke=>this._editingSession.read(ke)!==null)),this._register(tc(ie.chatEditingCanUndo,c,ke=>this._editingSession.read(ke)?.canUndo.read(ke)||!1)),this._register(tc(ie.chatEditingCanRedo,c,ke=>this._editingSession.read(ke)?.canRedo.read(ke)||!1)),this._register(tc(Yj,c,ke=>{let Ee=Se.read(ke)?.model;if(!this._editingSession.read(ke)||!Ee)return!1;let Ve=ui(this,Ee.onDidChange,()=>Ee.getRequests().at(-1)?.response).read(ke);return Ve?.result?.errorDetails&&!Ve?.result?.errorDetails.responseIsIncomplete})),this._codeBlockModelCollection=this._register(u.createInstance(YF,void 0)),this.chatSuggestNextWidget=this._register(this.instantiationService.createInstance(wAe)),this._register(he(ke=>{let Ee=Se.read(ke),Ve=y.editingSessionsObs.read(ke).find(Qt=>Xe(Qt.chatSessionResource,Ee?.sessionResource));if(this._editingSession.set(void 0,void 0),this.renderChatEditingSessionState(),!Ve)return;let Fe=Ve.entries.read(ke);for(let Qt of Fe)Qt.state.read(ke);this._editingSession.set(Ve,void 0),ke.store.add(Ve.onDidDispose(()=>{this._editingSession.set(void 0,void 0),this.renderChatEditingSessionState()})),ke.store.add(this.inputEditor.onDidChangeModelContent(()=>{this.getInput()===""&&this.refreshParsedInput()})),this.renderChatEditingSessionState()})),this._register(this.codeEditorService.registerCodeEditorOpenHandler(async(ke,Ee,He)=>{let Ve=ke.resource;if(Ve.scheme!==Y.vscodeChatCodeBlock)return null;let Fe=Ve.path.split("/").at(1);if(!Fe)return null;let Qt=this.viewModel?.getItems().find(Ze=>Ze.id===Fe);if(!Qt)return null;this.reveal(Qt),await Pi(0);for(let Ze of this.listWidget.editorsInUse())if(ar.isEqual(Ze.uri,Ve,!0)){let Ti=Ze.editor,ti=0,bo=Ti.getDomNode();if(bo){let Ro=Nh(bo,"monaco-list-row");Ro&&(ti=gN(bo).top-gN(Ro).top)}if(ke.options?.selection){let Ro=Ti.getTopForPosition(ke.options.selection.startLineNumber,ke.options.selection.startColumn);ti+=Ro,Ti.focus(),Ti.setSelection({startLineNumber:ke.options.selection.startLineNumber,startColumn:ke.options.selection.startColumn,endLineNumber:ke.options.selection.endLineNumber??ke.options.selection.startLineNumber,endColumn:ke.options.selection.endColumn??ke.options.selection.startColumn})}return this.reveal(Qt,ti),Ti}return null})),this._register(this.onDidChangeParsedInput(()=>this.updateChatInputContext())),this._register(this.chatTodoListService.onDidUpdateTodos(ke=>{Xe(this.viewModel?.sessionResource,ke)&&this.inputPart.renderChatTodoListWidget(ke)}))}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(AE).parseChatRequestWithReferences(WO(this),gz(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??Lmo;let o=Object.keys(DM(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=XI(this.viewContext)?this.viewContext.viewId:void 0;this.editorOptions=this._register(this.instantiationService.createInstance(AB,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=R(e,sUt(".interactive-session")),this.welcomeMessageContainer=R(this.container,sUt(".chat-welcome-view-container",{style:"display: none"})),this._register(Vo(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})=>{this.handleNextPromptSelection(c,u)})),o?(this.createInput(this.container,{renderFollowups:n,renderStyle:r,renderInputToolbarBelowInput:s}),this.listContainer=R(this.container,sUt(".interactive-list"))):(this.listContainer=R(this.container,sUt(".interactive-list")),R(this.container,this.chatSuggestNextWidget.domNode),this.createInput(this.container,{renderFollowups:n,renderStyle:r,renderInputToolbarBelowInput:s})),this.renderWelcomeViewContentIfNeeded(),this.createList(this.listContainer,{editable:!y7o(this)&&!aUt(this),...this.viewOptions.rendererOptions,renderStyle:r}),this._register(j(e,re.MOUSE_WHEEL,c=>{c.defaultPrevented||gs(c.target,this.container)||this.listWidget.delegateScrollFromMouseWheelEvent(c)})),this._register(he(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(H.runAndSubscribe(this.editorOptions.onDidChange,()=>this.onDidStyleChange())),this.viewModel&&(this.onDidChangeItems(),this.listWidget.scrollToEnd()),this.contribs=Cw.CONTRIBS.map(c=>{try{return this._register(this.instantiationService.createInstance(c,this))}catch(u){this.logService.error("Failed to instantiate chat widget contrib",In(u));return}}).filter(mo),this._register(this.chatWidgetService.register(this));let l=ui(this.onDidChangeParsedInput,()=>this.parsedInput);this._register(he(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 ZS||g instanceof OO||g instanceof tR){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(AE).parseChatRequestWithReferences(WO(this),gz(this),this.getInput(),this.location,{selectedAgent:this._lastSelectedAgent,mode:this.input.currentModeKind,attachmentCapabilities:this.attachmentCapabilities}),(!e||!Ddi.equals(e,this.parsedChatRequest))&&this._onDidChangeParsedInput.fire()}getSibling(e,t){if(!Vi(e))return;let o=this.viewModel?.getItems();if(!o)return;let n=o.filter(l=>Vi(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.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(mm(t===0,this.welcomeMessageContainer),mm(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),mm(!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=to.defaultChatAgent.provider;o=new xe(d(7382,null,r.default.name,r.default.name,to.defaultChatAgent.termsStatementUrl,to.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(Jme,n,{location:this.location,isWidgetAgentWelcomeViewContent:this.input?.currentModeKind==="agent"}),R(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)),mm(!1,e);return}if(this._gettingStartedTipPart.value){mm(!0,e);return}let o=new P,n=this.instantiationService.createInstance(hee),r=o.add(this.instantiationService.createInstance(UAe,t,n));e.appendChild(r.domNode),this._gettingStartedTipPartRef=r,o.add(r.onDidHide(()=>{r.domNode.remove(),this._gettingStartedTipPartRef=void 0,this._gettingStartedTipPart.clear(),mm(!1,e),this.focusInput()})),this._gettingStartedTipPart.value=o,mm(!0,e)}_getGenerateInstructionsMessage(){return this._instructionFilesCheckPromise||(this._instructionFilesCheckPromise=this._checkForAgentInstructionFiles(),this._register(nbe(this._instructionFilesCheckPromise,e=>{this._instructionFilesExist=e,(this.viewModel?.getItems().length??0)===0&&this.renderWelcomeViewContentIfNeeded()}))),this._instructionFilesExist===!0?new xe(""):this._instructionFilesExist===!1?new xe(d(7377,null,`command:${s2}`),{isTrusted:{enabledCommands:[s2]}}):new xe("")}async _checkForAgentInstructionFiles(){try{return(await this.promptsService.listAgentInstructions(ve.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.getIconForSessionType(this._lockedAgent.id):void 0,n=this._lockedAgent?this.chatSessionsService.getWelcomeTitleForSessionType(this._lockedAgent.id):void 0,r=this._lockedAgent?this.chatSessionsService.getWelcomeMessageForSessionType(this._lockedAgent.id):void 0,s=r?new xe(r):this._lockedAgent?.prefix==="@copilot "?new xe(d(7379,null,this._lockedAgent.prefix,"https://aka.ms/coding-agent-docs")+Uki,{isTrusted:!0}):new xe(d(7381,null,this._lockedAgent?.prefix)+Uki);return{title:n??d(7378,null,this._lockedAgent?.prefix),message:s,icon:o??M.sendToRemoteAgent,additionalMessage:e,useLargeIcon:!!o}}let t;return this.input.currentModeKind==="ask"?t=d(7375,null):this.input.currentModeKind==="edit"?t=d(7380,null):t=d(7368,null),{title:t,message:new xe(Uki),icon:M.chatSparkle,additionalMessage:e}}async renderChatEditingSessionState(){this.input&&this.input.renderChatEditingSessionState(this._editingSession.get()??null)}async renderFollowups(){let e=this.listWidget.lastItem;e&&Vi(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&&Vi(t)&&t.isComplete))return;let n=this.input.currentModeObs.get(),r=n?.handOffs?.get();if(n&&r&&r.length>0){let l=this.chatSuggestNextWidget.domNode.style.display==="none";this.chatSuggestNextWidget.render(n),l&&this.telemetryService.publicLog2("chat.handoffWidgetShown",{agent:t3(n),handoffCount:r.length})}else this.chatSuggestNextWidget.hide();this.bodyDimension&&this.layout(this.bodyDimension.height,this.bodyDimension.width)}handleNextPromptSelection(e,t){this.chatSuggestNextWidget.hide();let o=e.prompt,n=this.input.currentModeObs.get(),r=e.agent?this.chatModeService.findModeByName(e.agent):void 0;this.telemetryService.publicLog2("chat.handoffClicked",{fromAgent:t3(n),toAgent:t||(r?t3(r):""),hasPrompt:!!o,autoSend:!!e.send}),t?(this.input.setValue(`@${t} ${o}`,!1),this.input.focus(),this.acceptInput().catch(s=>this.logService.error("Failed to handle handoff continueOn",s))):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(!XI(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&&Vi(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!==Y.vscodeLocalChatSession&&!$p.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=nn(()=>{this._visible&&this.onDidChangeItems(!0)},0),this.visibilityAnimationFrameDisposable.value=$r(Me(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(ste,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=>{Rr(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(Rr(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)||vTt(h)||(pP(h)||PY(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:ie.EditingRequestType.QueueOrSteer,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(JS.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?XI(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 Io([X,s?.contextKeyService])));this.inlineInputPartDisposable.value=l.createInstance(F3,this.location,o,this.styles,!0)}else this.inputPartDisposable.value=this.instantiationService.createInstance(F3,this.location,o,this.styles,!1),this._register(he(s=>{this.inputPart.height.read(s),this.listWidget&&(this.bodyDimension&&this.layout(this.bodyDimension.height,this.bodyDimension.width),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=`${vg}${c.name} `,s.followup.subCommand&&(l+=`${yu}${s.followup.subCommand} `)}else!s.followup.agentId&&s.followup.subCommand&&this.chatSlashCommandService.hasCommand(s.followup.subCommand)&&(l=`${yu}${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(he(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(he(s=>{let l=new Set,c=new Set;for(let[p,h]of this.input.selectedToolsModel.entriesMap.read(s))h&&(Km(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,ht.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(Xe(e.sessionResource,this.viewModel?.sessionResource))return;this.viewModel?.editing&&this.finishedEditing(),this.inputPart.clearTodoListWidget(e.sessionResource,!1),this.chatSuggestNextWidget.hide(),this.chatTipService.resetSession(),this._gettingStartedTipPartRef=void 0,this._gettingStartedTipPart.clear();let t=this.inputPart.gettingStartedTipContainerElement;if(Rt(t),mm(!1,t),this._codeBlockModelCollection.clear(),this.inputPart.setInputModel(e.inputModel,e.getRequests().length===0),this.viewModel=this.instantiationService.createInstance(see,e,this._codeBlockModelCollection,void 0),this.listWidget.setViewModel(this.viewModel),this._lockedAgent){let l=this.chatSessionsService.getInputPlaceholderForSessionType(this._lockedAgent.id);l||(l=d(7369,null,this._lockedAgent.id)),this.viewModel.setInputPlaceholder(l),this.inputEditor.updateOptions({placeholder:l})}else this.viewModel.inputPlaceholder&&this.inputEditor.updateOptions({placeholder:this.viewModel.inputPlaceholder});let n=this.configurationService.getValue("chat.experimental.renderMarkdownImmediately")?QD:0;this.viewModelDisposables.add(H.runAndSubscribe(H.accumulate(this.viewModel.onDidChange,n),(l=>{!this.viewModel||this._store.isDisposed||(this.requestInProgress.set(this.viewModel.model.requestInProgress.get()),l?.some(c=>c?.kind==="changePlaceholder")&&this.inputEditor.updateOptions({placeholder:this.viewModel.inputPlaceholder}),this.onDidChangeItems(),l?.some(c=>c?.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),this._sessionHasDebugDataContextKey.set(this.chatDebugService.getEvents(e.sessionResource).length>0);let r=0,s=l=>{let c=e.getPendingRequests(),u=c.length;this._hasPendingRequestsContextKey.set(u>0);let p=c.filter(h=>h.kind==="steering").length;l&&p>0&&r===0&&Or(d(7374,null)),r=p};s(!1),this.viewModelDisposables.add(e.onDidChangePendingRequests(()=>s(!0))),this.refreshParsedInput(),this.viewModelDisposables.add(e.onDidChange(l=>{l.kind==="setAgent"&&(this._onDidChangeAgent.fire({agent:l.agent,slashCommand:l.command}),this._updateAgentCapabilitiesContextKeys(l.agent)),l.kind==="addRequest"&&(this.inputPart.clearTodoListWidget(this.viewModel?.sessionResource,!1),this._sessionIsEmptyContextKey.set(!1)),l.kind==="removeRequest"&&(this.inputPart.clearTodoListWidget(this.viewModel?.sessionResource,!0),this.chatSuggestNextWidget.hide(),this._sessionIsEmptyContextKey.set((this.viewModel?.model.getRequests().length??0)===0)),l.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.updateChatInputContext(),this.input.renderChatTodoListWidget(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.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._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._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};return await this.chatService.resendRequest(t,o)}async _applyPromptFileIfSet(e){let t=this.parsedInput.parts.find(p=>p instanceof Qx);if(!t)return;this.chatTipService.recordSlashCommandUsage(t.name);let o=await this.promptsService.resolvePromptSlashCommand(t.name,ve.None);if(!o)return;let n=o.parsedPromptFile,r=n.body?.variableReferences.map(({name:p,offset:h})=>({name:p,range:new di(h,h+p.length+1)}))??[],s=this.toolsService.toToolReferences(r);e.attachedContext.insertFirst(mP(n.uri,"vscode.prompt.file",void 0,!0,s)),e.input=this.parsedInput.parts.filter(p=>!(p instanceof Qx)).map(p=>p.text).join("").trim();let l=o.promptPath,c={storage:l.storage};l.storage==="extension"?(c.extensionId=l.extension.identifier.value,c.promptName=o.name):c.promptNameHash=Ir(o.name).toString(16),this.telemetryService.publicLog2("chat.promptRun",c);let u=e.input.trim();e.input=`Follow instructions in [${Ye(n.uri)}](${n.uri.toString()}).`,u&&(e.input+=`
${u}`),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 H.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||!!ZX(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 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(t.alwaysQueue&&(t.queue??="queued"),l.requestNeedsInput.get()&&!l.getPendingRequests().length&&(this.chatService.cancelCurrentRequestForSession(this.viewModel.sessionResource,"acceptInput-needsInput"),t.queue??="queued"),c&&(t.queue??="queued"),!t.alwaysQueue&&!c&&!s&&!await this.confirmPendingRequestsBeforeSend(l,t))return;if(await this._applyPromptFileIfSet(n),await this._autoAttachInstructions(n),this.viewOptions.enableWorkingSet!==void 0&&this.input.currentModeKind==="edit"){let f=new Mn,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,pauseQueue:t?.alwaysQueue});if(Gj.isRejected(h))return;this.updateChatViewVisibility(),this.input.acceptInput(t?.storeToHistory??r);let g=Gj.isQueued(h)?await h.deferred:h;if(Gj.isSent(g))return this._onDidSubmitAgent.fire({agent:g.data.agent,slashCommand:g.data.slashCommand}),this.handleDelegationExitIfNeeded(this._lockedAgent,g.data.agent),g.data.responseCreatedPromise.then(()=>{this.chatAccessibilityService.acceptRequest(p),g.data.responseCompletePromise.then(()=>{let f=this.viewModel?.getItems().filter(Vi),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=ETt(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(7372,null),detail:d(7370,null),buttons:[{label:d(7371,null),run:()=>"keep"},{label:d(7373,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.selectedToolsModel.userSelectedTools,o=t.get(),n=Ce(r=>{let s=this._viewModelObs.read(r)?.sessionResource;if(Xe(s,e)){let l=t.read(r);return o=l,l}return o});return{modeInfo:this.input.currentModeInfo,userSelectedTools:n}}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)}layout(e,t){t=Math.min(t,this.viewOptions.renderStyle==="minimal"?t:950),this.bodyDimension=new ai(t,e),this.viewModel?.editing&&this.inlineInputPart?.layout(t),this.inputPart.layout(t);let o=this.inputPart.height.get(),n=this.chatSuggestNextWidget.height,r=this.listWidget.isScrolledToBottom,s=this.listWidget.lastItem,l=Math.max(0,e-o-n);this.listWidget.layout(l,t),this.welcomeMessageContainer.style.height=`${l}px`;let c=Vi(s)&&s.renderData;r&&(!c||ZX(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=$r(Me(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 zu);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(get,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=Pl.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}){this.logService.debug("ChatWidget#_autoAttachInstructions: prompt files are always enabled");let t=this.input.currentModeKind==="agent"?this.input.selectedToolsModel.userSelectedTools.get():void 0,o=this.input.currentModeKind==="agent"?this.input.currentModeObs.get().agents?.get():void 0,n=this._viewModel?.model.sessionResource;await this.instantiationService.createInstance(nte,this.input.currentModeKind,t,o,n).collect(e,ve.None)}delegateScrollFromMouseWheelEvent(e){this.listWidget.delegateScrollFromMouseWheelEvent(e)}};Cw=I([m(4,Kt),m(5,B),m(6,ct),m(7,X),m(8,F),m(9,Si),m(10,br),m(11,At),m(12,NO),m(13,ne),m(14,De),m(15,FO),m(16,dl),m(17,Te),m(18,nr),m(19,jn),m(20,Pv),m(21,XHt),m(22,vr),m(23,Ls),m(24,ia),m(25,dF),m(26,ao),m(27,jF),m(28,l0),m(29,em)],Cw);var the=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=bt("div.inline-chat@root",[bt("div.chat-widget@chatWidget"),bt("div.accessibleViewer@accessibleViewer"),bt("div.status@status",[bt("div.label.info.hidden@infoLabel"),bt("div.actions.hidden@toolbar1"),bt("div.label.status.hidden@statusLabel"),bt("div.actions.secondary.hidden@toolbar2"),bt("div.label.disclaimer.hidden@disclaimerLabel")])]);this._store=new P;this._onDidChangeHeight=this._store.add(new E);this.onDidChangeHeight=H.filter(this._onDidChangeHeight.event,i=>!this._isLayouting);this._requestInProgress=Le(this,!1);this.requestInProgress=this._requestInProgress;this._isLayouting=!1;this.scopedContextKeyService=this._store.add(o.createScoped(this._elements.chatWidget));let f=t.createChild(new Io([X,this.scopedContextKeyService]),this._store);this._chatWidget=f.createInstance(Cw,i,{isInlineChat:!0},{autoScroll:!0,defaultElementHeight:32,renderStyle:"minimal",renderInputOnTop:!1,renderFollowups:!0,supportsFileReferences:!0,filter:G=>!Vi(G)||G.errorDetails?!0:!(G.response.value.length===0||G.response.value.every(te=>te.kind==="textEditGroup"&&e.chatWidgetViewOptions?.rendererOptions?.renderTextEditsAsSummary?.(te.uri))),dndContainer:this._elements.root,defaultMode:Pl.Ask,...e.chatWidgetViewOptions},{listForeground:qco,listBackground:Hwi,overlayBackground:_E,inputEditorBackground:Gb,resultEditorBackground:qo}),this._elements.root.classList.toggle("in-zone-widget",!!e.inZoneWidget),this._chatWidget.render(this._elements.chatWidget),this._elements.chatWidget.style.setProperty(TN(Quo),wt(Hwi)),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 P);this._store.add(this._chatWidget.onDidChangeViewModel(()=>{k.clear();let G=this._chatWidget.viewModel;G&&(k.add(Z(()=>{U.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);U.context=$,v.set(Vi($)),b.set(Vi($)?$.vote===0?"down":$.vote===1?"up":"":""),y.set(Vi($)&&$.errorDetails!==void 0),w.set(!!(Vi($)&&$.errorDetails?.responseIsFiltered)),S.set(Vi($)&&($.agent?.metadata.supportIssueReporting??!1)),this._onDidChangeHeight.fire()})),this._onDidChangeHeight.fire())})),this._store.add(this.chatWidget.onDidChangeContentHeight(()=>{this._onDidChangeHeight.fire()})),this._ctxResponseFocused=Wco.bindTo(this._contextKeyService);let T=this._store.add(Vn(this.domNode));this._store.add(T.onDidBlur(()=>this._ctxResponseFocused.set(!1))),this._store.add(T.onDidFocus(()=>this._ctxResponseFocused.set(!0))),this._ctxInputEditorFocused=Y4.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 N=e.statusMenuId instanceof D?e.statusMenuId:e.statusMenuId.menu,O=e.statusMenuId instanceof D?void 0:e.statusMenuId.options,V=f.createInstance(QF,this._elements.toolbar1,N,{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 U=f.createInstance(Ln,this._elements.toolbar2,e.secondaryMenuId??D.for(""),{telemetrySource:e.chatWidgetViewOptions?.menus?.telemetrySource,menuOptions:{renderShortTitle:!0,shouldForwardArgs:!0},actionViewItemProvider:(G,$)=>G instanceof Eo&&G.item.id===mee?f.createInstance(jme,G,$):Ca(f,G,$)});this._store.add(U.onDidChangeMenuItems(()=>this._onDidChangeHeight.fire())),this._store.add(U),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(Ni("element"),this._elements.statusLabel,()=>this._elements.statusLabel.dataset.title)),this._store.add(this._chatService.onDidPerformUserAction(G=>{Xe(G.sessionResource,this._chatWidget.viewModel?.model.sessionResource)&&G.action.kind==="vote"&&this.updateStatus(d(10610,null),{resetAfter:1250})}))}_updateAriaLabel(){if(this._elements.root.ariaLabel=this._accessibleViewService.getOpenAriaHint("accessibility.verbosity.inlineChat"),this._accessibilityService.isScreenReaderOptimized()){let i=w7o;if(this._configurationService.getValue("accessibility.verbosity.inlineChat")){let e=this._keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getLabel();i=e?d(10611,null,e):d(10612,null)}this._chatWidget.inputEditor.updateOptions({ariaLabel:i})}}_setupDisclaimer(){let i=this._store.add(new P);this._store.add(he(e=>{i.clear(),Fi(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 xe(d(10613,null,to.defaultChatAgent?.provider?.default?.name??"",to.defaultChatAgent?.provider?.default?.name??"",to.defaultChatAgent?.termsStatementUrl??"",to.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=nh(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:nh(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(Vi(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 Yt(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=>Vi(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 S5i(q9(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=Bn(i);Fi(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=Bn(i);Fi(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(),Fi(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(Pn())}};the=I([m(2,F),m(3,X),m(4,_e),m(5,Bi),m(6,B),m(7,Wd),m(8,Nt),m(9,Si),m(10,tt),m(11,vr),m(12,Qn)],the);var w7o=d(10609,null),zAe=class extends the{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v){let b=g.getContainer(Me(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()}};zAe=I([m(3,X),m(4,_e),m(5,F),m(6,Bi),m(7,B),m(8,Wd),m(9,Nt),m(10,Si),m(11,tt),m(12,nc),m(13,vr),m(14,Qn)],zAe);var ate=class extends aO{constructor(e,t,o,n,r,s,l){super(o.editor,ate._options);this._instaService=r;this._logService=s;this.notebookEditor=o.notebookEditor,this._ctxCursorPosition=Fwi.bindTo(l),this._disposables.add(Z(()=>{this._ctxCursorPosition.reset()})),this.widget=this._instaService.createInstance(zAe,e,this.editor,{statusMenuId:{menu:FVt,options:{buttonConfigProvider:(p,h)=>{let g=h>0;return new Set([zco,Kco,Gco]).has(p.id)?{isSecondary:g,showIcon:!0,showLabel:!1}:{isSecondary:g}}}},secondaryMenuId:IB,inZoneWidget:!0,chatWidgetViewOptions:{menus:{telemetrySource:"interactiveEditorWidget-toolbar",inputSideToolbar:$co},clear:n,...t,rendererOptions:{renderTextEditsAsSummary:p=>Xe(p,o.editor.getModel()?.uri),renderDetectedCommandsWithRequest:!0,...t?.rendererOptions},defaultMode:Pl.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(he(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 ai(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){So(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(){So(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=jqe.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=jqe.capture(this.editor);this._ctxCursorPosition.reset(),this.widget.chatWidget.setVisible(!1),super.hide(),Or(d(10614,null)),e.restore(this.editor)}};ate=I([m(4,F),m(5,ne),m(6,X)],ate);var lUt=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"&&!Yt.isISelection(e)||typeof r<"u"&&!Ie.isIPosition(r)||typeof s<"u"&&(!Array.isArray(s)||!s.every(p=>p instanceof A))||typeof l<"u"&&!hYi(l)||typeof c<"u"&&typeof c!="boolean"||typeof u<"u"&&typeof u!="boolean")}};function C7o(a,i){return`${a.getId()},${i.id}`}var _m=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 P;this._isActiveController=Le(this,!1);let S=os(i),y=OZe.bindTo(r),w=OVt.bindTo(r),k=Wwi.bindTo(r),T=pr("inlineChat.notebookAgent",!1,this._configurationService);this._renderMode=pr("inlineChat.renderMode","zone",this._configurationService),this._store.add(he(de=>{let se=S.model.read(de);if(!se){w.set(!1);return}let Se=this._chatEditingService.editingSessionsObs.read(de),ke=!1;for(let Ee of Se){let He=Ee.entries.read(de);for(let Ve of He)if(Xe(Ve.modifiedURI,se.uri)){ke=!0;break}if(ke)break}w.set(ke)}));let N=this._inputWidget=this._store.add(this._instaService.createInstance(BMe,S)),O=this._store.add(this._instaService.createInstance(HMe,S));this.inputOverlayWidget=this._store.add(this._instaService.createInstance(PMe,this._editor,N)),this._zone=new co(()=>{So(this._editor.hasModel(),"[Illegal State] widget should only be created when the editor has a model");let de={location:"editor",resolveData:()=>{So(this._editor.hasModel());let ke=this._editor.getSelection(),Ee=this._editor.getModel().uri;return{type:"editor",id:C7o(this._editor,this._editor.getModel()),selection:this._editor.getSelection(),document:Ee,wholeRange:ke}}},se=this._notebookEditorService.getNotebookForPossibleCell(this._editor);se&&(de.location="notebook",T.get()&&(de.resolveData=()=>(So(this._editor.hasModel()),{type:"notebook",sessionInputUri:this._editor.getModel().uri})));let Se=this._instaService.createInstance(ate,de,{enableWorkingSet:"implicit",enableImplicitContext:!1,renderInputOnTop:!1,renderInputToolbarBelowInput:!0,filter:ke=>Vi(ke)?!!ke.model.isPendingConfirmation.get():!1,menus:{telemetrySource:"inlineChatWidget",executeToolbar:D.ChatEditorInlineExecute,inputSideToolbar:D.ChatEditorInlineInputSide},defaultMode:Pl.Ask},{editor:this._editor,notebookEditor:se},()=>Promise.resolve());return this._store.add(Se),Se.domNode.classList.add("inline-chat-2"),Se});let V=Nr(this,o.onDidChangeSessions);this._currentSession=Ce(de=>{V.read(de);let se=S.model.read(de);return(se&&o.getSessionByTextModel(se.uri))??void 0});let U;this._store.add(he(de=>{let se=this._currentSession.read(de);if(!se){if(this._isActiveController.set(!1,void 0),U&&!U.chatModel.hasRequests){let ke=U.chatModel.inputModel.state.read(void 0);(!ke||!ke.inputText&&ke.attachments.length===0)&&(U.dispose(),U=void 0)}return}U=se;let Se=!1;for(let ke of n.listCodeEditors())if(_m.get(ke)?._isActiveController.read(void 0)){Se=!0;break}!Se&&S.isFocused.read(de)&&this._isActiveController.set(!0,void 0)}));let G=Le(this,void 0);this._store.add(he(de=>{let se=S.model.read(de),Se=this._currentSession.read(de),ke=this._isActiveController.read(de);!Se||!ke||!se?G.set(void 0,void 0):G.set(Se,void 0)}));let $=G.map((de,se)=>de?.initialSelection.isEmpty()?d(10591,null):d(10592,null));this._store.add(he(de=>{let se=G.read(de),Se=this._renderMode.read(de);se?Se==="hover"?(this._zone.value.widget.chatWidget.setModel(se.chatModel),this._zone.rawValue?.hide(),y.set(!0)):(y.set(!0),this._zone.value.widget.chatWidget.setModel(se.chatModel),this._zone.value.position||(this._zone.value.widget.chatWidget.setInputPlaceholder($.read(de)),this._zone.value.widget.chatWidget.input.renderAttachedContext(),this._zone.value.show(se.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(he(de=>{let se=G.read(de),Se=this._renderMode.read(de);if(!se||Se!=="hover"){k.set(!1),O.hide();return}let ke=se.chatModel.lastRequestObs.read(de),Ee=ke?.response?.isInProgress.read(de),He=!!ke?.response?.isPendingConfirmation.read(de),Ve=!!ke?.response?.result?.errorDetails;k.set(He);let Fe=se.editingSession.readEntry(se.uri,de),Qt=Fe?Fe.state.read(de)===0:!1;Ee||Qt||He||Ve?O.show(se):O.hide()})),this._store.add(he(de=>{let se=G.read(de);if(se){let Se=se.editingSession.entries.read(de),ke=Zo.parse(se.uri),Ee=Se.filter(He=>!(Xe(He.modifiedURI,se.uri)||ke&&Xe(ke.notebook,He.modifiedURI)));for(let He of Ee)this._editorService.openEditor({resource:He.modifiedURI},vn).catch(mt)}}));let te=G.map((de,se)=>de?ui(this,de.chatModel.onDidChange,()=>de.chatModel.getRequests().at(-1)).read(se)?.response:void 0),pe=te.map((de,se)=>{if(de)return ui(this,de.onDidChange,()=>de.response.value.findLast(Se=>Se.kind==="progressMessage")).read(se)});this._store.add(he(de=>{let se=te.read(de);if(this._zone.rawValue?.widget.updateInfo(""),!se?.isInProgress.read(de))se?.result?.errorDetails&&(this._zone.rawValue?.widget.updateInfo(`$(error) ${se.result.errorDetails.message}`),Jo(se.result.errorDetails.message)),this._zone.rawValue?.widget.domNode.classList.toggle("request-in-progress",!1),this._zone.rawValue?.widget.chatWidget.setInputPlaceholder($.read(de));else{this._zone.rawValue?.widget.domNode.classList.toggle("request-in-progress",!0);let Se=se.request?.message.text,ke=pe.read(de);ke&&(Se=qa(ke.content)),this._zone.rawValue?.widget.chatWidget.setInputPlaceholder(Se||d(10590,null))}})),this._store.add(he(de=>{let se=G.read(de);if(!se)return;let Se=se.editingSession.readEntry(se.uri,de);Se?.state.read(de)===0&&Se?.enableReviewModeUntilSettled()})),this._store.add(he(de=>{let se=G.read(de),Se=se?.editingSession.readEntry(se.uri,de),ke=this._editorService.visibleEditorPanes.find(Ee=>Ee.getControl()===this._editor||klo(Ee,this._editor));if(ke&&Se&&Se?.getEditorIntegration(ke),Se?.diffInfo&&this._zone.value.position){let{position:Ee}=this._zone.value,He=Se.diffInfo.read(de);for(let Ve of He.changes)if(Ve.modified.contains(Ee.lineNumber)){this._zone.value.updatePositionAndHeight(new Ie(Ve.modified.startLineNumber-1,1));break}}}))}static{this.ID="editor.contrib.inlineChatController"}static get(i){return i.getContribution(_m.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){So(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 P;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=uP.fromMarker(l);r.push(uP.toEntry(c))}if(r.length>0){this._zone.value.widget.chatWidget.attachmentModel.addContext(...r);let s=r.length>1?d(10589,null):d(10588,null);this._zone.value.widget.chatWidget.input.setValue(s,!0),i.message=s,this._zone.value.widget.chatWidget.inputEditor.setSelection(new Yt(1,1,Number.MAX_SAFE_INTEGER,1))}}if(i&&lUt.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=Ce(s=>{let l=o.editingSession.readEntry(e,s);return l?.state.read(s)===0&&!l?.isCurrentlyBeingModifiedBy.read(s)});return await gf(r,s=>s===!0),!0}else return await H.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&&(this._chatService.cancelCurrentRequestForSession(i.chatModel.sessionResource,"inlineChatReject"),await i.editingSession.reject(),i.dispose())}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=_m._userSelectedModel,o=this._configurationService.getValue("inlineChat.defaultModel"),n=!1;t&&(n=this._zone.value.widget.chatWidget.input.switchModelByQualifiedName([t]),n||(_m._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(he(s=>{let l=this._zone.value.widget.chatWidget.input.selectedLanguageModel.read(s);if(l){if(!r){r=l.identifier;return}r!==l.identifier&&(_m._userSelectedModel=R_.asQualifiedName(l.metadata),r=l.identifier)}}))}async createImageAttachment(i){if(this._currentSession.get()){if(i.scheme===Y.file){if(await this._fileService.canHandleResource(i))return await this._chatAttachmentResolveService.resolveImageEditorAttachContext(i)}else if(i.scheme===Y.http||i.scheme===Y.https){let t=await this._webContentExtractorService.readImage(i,ve.None);if(t)return await this._chatAttachmentResolveService.resolveImageEditorAttachContext(i,t)}}}};_m=I([m(1,F),m(2,Zc),m(3,Ik),m(4,Kt),m(5,X),m(6,B),m(7,t2),m(8,be),m(9,jF),m(10,ee),m(11,RU),m(12,Wr),m(13,ne),m(14,dl),m(15,Si)],_m);async function cUt(a,i,e,t,o){if(!i.hasModel())return!1;let n=a.get(Si),r=i.getModel().uri,s=n.startNewLocalSession("editor"),l=s.object;l.startEditingSession(!0);let c=new P;c.add(s);let u=l?.addRequest({text:"",parts:[]},{variables:[]},0,{kind:void 0,modeId:"applyCodeBlock",modeInstructions:void 0,isBuiltin:!0,applyCodeBlockSuggestionId:o});So(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=Ce(g=>{let f=l.editingSession?.readEntry(r,g);if(!f)return!1;let v=f.state.read(g);return v===1||v===2}),h=gf(p,Boolean);return await wa(h,t),c.dispose(),!0}async function Rmo(a,i,e,t){let o=a.get(Si),r=a.get(un).hasSupportedNotebooks(i),s=o.startNewLocalSession("editor"),l=s.object;l.startEditingSession(!0);let c=new P;c.add(s);let u=l?.addRequest({text:"",parts:[]},{variables:[]},0);So(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(x7o)?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=Ce(g=>{let f=l.editingSession?.readEntry(i,g);if(!f)return!1;let v=f.state.read(g);return v===1||v===2}),h=gf(p,Boolean);return await wa(h,t),c.dispose(),!0}function x7o(a){return!(A.isUri(a)||Array.isArray(a))}var Ett=class a extends K{static{this.ID="notebook.action.indentUsingTabs"}constructor(){super({id:a.ID,title:d(11856,null),precondition:void 0})}run(i,...e){zki(i,!1,!1)}},Ttt=class a extends K{static{this.ID="notebook.action.indentUsingSpaces"}constructor(){super({id:a.ID,title:d(11855,null),precondition:void 0})}run(i,...e){zki(i,!0,!1)}},_tt=class a extends K{static{this.ID="notebook.action.changeTabDisplaySize"}constructor(){super({id:a.ID,title:d(11851,null),precondition:void 0})}run(i,...e){zki(i,!0,!0)}},Dtt=class a extends K{static{this.ID="notebook.action.convertIndentationToSpaces"}constructor(){super({id:a.ID,title:d(11853,null),precondition:void 0})}run(i,...e){Mmo(i,!0)}},Ltt=class a extends K{static{this.ID="notebook.action.convertIndentationToTabs"}constructor(){super({id:a.ID,title:d(11854,null),precondition:void 0})}run(i,...e){Mmo(i,!1)}};function zki(a,i,e){let t=a.get(ee),o=a.get(B),n=a.get(Zc),r=a.get(Ge),s=t.activeEditorPane?.input;if(!k8e(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(ft.cellEditorOptionsCustomizations),h=p["editor.insertSpaces"];delete p["editor.indentSize"],delete p["editor.tabSize"],delete p["editor.insertSpaces"],setTimeout(()=>{r.pick(u,{placeHolder:d(11857,null)}).then(g=>{if(g){let f=parseInt(g.label,10);e?o.updateValue(ft.cellEditorOptionsCustomizations,{...p,"editor.tabSize":f,"editor.indentSize":f,"editor.insertSpaces":h}):o.updateValue(ft.cellEditorOptionsCustomizations,{...p,"editor.tabSize":f,"editor.indentSize":f,"editor.insertSpaces":i})}})},50)}function Mmo(a,i){let e=a.get(ee),t=a.get(B),o=a.get(ne),n=a.get(Nt),r=a.get(Zc),s=a.get(ma),l=e.activeEditorPane?.input;if(!k8e(l))return;let u=r.retrieveExistingWidgetFromURI(l.resource)?.value?.textModel;if(!u)return;let p=new P;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=k7o(f,v.tabSize,i);s.apply(b,{label:d(11852,null),code:"undoredo.convertIndentation"})})).then(()=>{let h=t.getValue(ft.cellEditorOptionsCustomizations),g=h["editor.indentSize"],f=h["editor.tabSize"];delete h["editor.indentSize"],delete h["editor.tabSize"],delete h["editor.insertSpaces"],t.updateValue(ft.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 k7o(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 ja(a.uri,{range:c,text:p}))}return n}W(Ttt);W(Ett);W(_tt);W(Dtt);W(Ltt);var lte=_;function cte(a){let i=lte(".");return i.classList.add("debug-view-content","file-icon-themable-tree"),a.appendChild(i),i}var Pmo=(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}},dUt={getKeyboardNavigationLabel(a){let i=a.getSession()?.rememberedCapabilities?.supportsANSIStyling;return`${a.name}: ${i?CS(a.value):a.value}`}},b2=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}))}};b2=I([m(0,Li),m(1,qY)],b2);var OB=class{constructor(i,e,t){this.debugService=i;this.contextViewService=e;this.hoverService=t}renderTemplate(i){let e=new P,t=R(i,lte(".expression")),o=R(t,lte("span.name")),n=R(t,lte("span.lazy-button"));n.classList.add(...q.asClassNameArray(M.eye)),e.add(this.hoverService.setupManagedHover(Ni("mouse"),n,d(8586,null)));let r=R(t,lte("span.type")),s=R(t,lte("span.value")),l=e.add(new Oa(o)),c=R(t,lte(".inputBoxContainer")),u;this.renderActionBar&&(R(t,lte(".span.actionbar-spacer")),u=e.add(new ji(t)));let p={expression:t,name:o,type:r,value:s,label:l,inputBoxContainer:c,actionBar:u,elementDisposable:new P,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,ua(e.filterData)),t.actionBar&&this.renderActionBar(t.actionBar,i,t);let o=this.debugService.getViewModel().getSelectedExpression();if(i===o?.expression||i instanceof Hl&&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 Dc(t,this.contextViewService,{...o,inputBoxStyles:pl});n.value=o.initialValue,n.focus(),n.select();let r=wd((l,c)=>{i.style.display="",e.style.display="",t.style.display="none";let u=n.value;Ue(s),c&&(this.debugService.getViewModel().setSelectedExpression(void 0,!1),o.onFinish(u,l))}),s=[n,Vo(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()}};OB=I([m(0,Li),m(1,_n),m(2,tt)],OB);var E7o=0,Rtt=()=>`topReplElement:${E7o++}`,xw=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}},ohe=class{constructor(i,e,t,o){this.session=i;this.expression=e;this.severity=t;this.sourceData=o;this.id=_t();this.hasChildren=e.hasChildren}getSession(){return this.session}getChildren(){return this.expression.getChildren()}toString(){return this.expression.toString()}getId(){return this.id}},uUt=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}]`:yi(this.valueObj)?"Object":Ae(this.valueObj)?`"${this.valueObj}"`:String(this.valueObj)||""}get hasChildren(){return Array.isArray(this.valueObj)&&this.valueObj.length>0||yi(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)):yi(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}`}},dte=class{constructor(i){this.value=i;this.id=_t()}toString(){return this.value}getId(){return this.id}},yA=class extends vP{constructor(e){super(void 0,void 0,0,_t());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}`}},S2=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 ihe(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 pUt=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 dte(t));let o=new yA(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(9347,null),sev:gt.Ignore}),e=e.substring(s+r.length)),t){this.addReplElement(e?new xw(i,Rtt(),e,o,n,t):new ohe(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 xw&&r.severity===t&&ihe(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 xw(i,Rtt(),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 xw&&r.severity===t&&ihe(r.sourceData,o)&&r.value===e&&n.console.collapseIdenticalLines){r.count++;return}let s=new xw(i,Rtt(),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 xw&&o instanceof xw&&t.severity===i&&o.severity===i&&ihe(t.sourceData,e)&&ihe(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 xw&&s.severity===t&&ihe(s.sourceData,o)&&s.value===r)s.count++;else{let l=new xw(i,Rtt(),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 xw)||o.severity!==e||!ihe(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 xw&&s.severity===e&&ihe(s.sourceData,t)&&s.value===r)s.count++;else{let l=new xw(i,Rtt(),r,e,t);this.addReplElement(l)}}this._onDidChangeElements.fire(void 0)}}startGroup(i,e,t,o){let n=new S2(i,e,t,o);this.addReplElement(n)}endGroup(){let i=this.replElements[this.replElements.length-1];i instanceof S2&&i.end()}addReplElement(i){let e=this.replElements.length?this.replElements[this.replElements.length-1]:void 0;if(e instanceof S2&&!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 Kki(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 N=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,Amo(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(U=>U!=="").map(U=>parseInt(U,10));if(V[0]===38||V[0]===48||V[0]===58){let U=V[0]===38?"foreground":V[0]===48?"background":"underline";V[1]===5?w(V,U):V[1]===2&&y(V,U)}else S(V)}}else h=N}T===!1&&(f+=a.charAt(h),h++)}return f&&Amo(n,f,s,i,e,l,c,u,t,h-f.length,o),n;function v(T,N){T==="foreground"?l=N:T==="background"?c=N:T==="underline"&&(u=N),s=s.filter(O=>O!==`code-${T}-colored`),N!==void 0&&s.push(`code-${T}-colored`)}function b(){let T=l;v("foreground",c),v("background",T)}function S(T){for(let N of T)switch(N){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-${N-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(N);break}}}function y(T,N){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 Bt(T[2],T[3],T[4]);v(N,O)}}function w(T,N){let O=T[2],V=T7o(O);if(V)v(N,V);else if(O>=0&&O<=15){if(N==="underline"){let U=nS[O];v(N,`--vscode-debug-ansi-${U}`);return}O+=30,O>=38&&(O+=52),N==="background"&&(O+=10),k(O)}}function k(T){let N,O;if(T>=30&&T<=37?(O=T-30,N="foreground"):T>=90&&T<=97?(O=T-90+8,N="foreground"):T>=40&&T<=47?(O=T-40,N="background"):T>=100&&T<=107&&(O=T-100+8,N="background"),O!==void 0&&N){let V=nS[O];v(N,`--vscode-debug-ansi-${V.replaceAll(".","-")}`)}}}function Amo(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})`:Oe.Format.CSS.formatRGB(new Oe(n))),r&&(p.style.backgroundColor=typeof r=="string"?`var(${r})`:Oe.Format.CSS.formatRGB(new Oe(r))),s&&(p.style.textDecorationColor=typeof s=="string"?`var(${s})`:Oe.Format.CSS.formatRGB(new Oe(s))),a.appendChild(p)}function T7o(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 Bt(t,e,i)}else if(a>=232&&a<=255){a-=232;let i=Math.round(a/23*255);return new Bt(i,i,i)}else return}is((a,i)=>{let e=[{selector:".monaco-workbench .sidebar, .monaco-workbench .auxiliarybar",bg:a.getColor(op)},{selector:".monaco-workbench .panel",bg:a.getColor(jS)},{selector:".monaco-workbench .monaco-list-row.selected",bg:a.getColor(xf)},{selector:".monaco-workbench .monaco-list-row.focused",bg:a.getColor(pgt)},{selector:".monaco-workbench .monaco-list:focus .monaco-list-row.focused",bg:a.getColor(c9)},{selector:".monaco-workbench .monaco-list:focus .monaco-list-row.selected",bg:a.getColor(Wy)},{selector:".debug-hover-widget",bg:a.getColor(qT)}];for(let{selector:t,bg:o}of e){let n=nS.map(r=>{let s=a.getColor(r);if(s)return`--vscode-debug-ansi-${r.replaceAll(".","-")}:${o?o.ensureConstrast(s,4):s}`}).filter(mo);i.addRule(`${t} { ${n.join(";")} }`)}});var SD=ae("extensionHostDebugService");async function Omo(a){let i=a.get(Ge),e=a.get(Li),t=a.get(ee),o=e.getModel().getSessions(!1),n=a.get(Ct),r=a.get(kt),s=a.get(ot),l=new P,c=i.createQuickPick({useSeparators:!0});l.add(c),c.matchOnLabel=c.matchOnDescription=c.matchOnDetail=c.sortByLabel=!1,c.placeholder=d(9346,null),c.items=await Nmo(c.value,o,t,n,r,s),l.add(c.onDidChangeValue(async()=>{c.items=await Nmo(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 _7o(a,i,e,t,o,n){let r=[];return r.push({type:"separator",label:a.name}),(await a.getLoadedSources()).forEach(l=>{let c=D7o(l,i,e,t,o,n);c&&r.push(c)}),r}async function Nmo(a,i,e,t,o,n){let r=[],s=await Promise.all(i.map(l=>_7o(l,a,e,t,o,n)));for(let l of s)for(let c of l)r.push(c);return r}function D7o(a,i,e,t,o,n){let r=n.getUriBasenameLabel(a.uri),s=n.getUriLabel(ci(a.uri)),l=Up(i,r,!0),c=Up(i,s,!0);if(l||c)return{label:r,description:s==="."?void 0:s,highlights:{label:l??void 0,description:c??void 0},iconClasses:js(t,o,a.uri),accept:()=>{a.available&&a.openInEditor(e,{startLineNumber:0,startColumn:0,endLineNumber:0,endColumn:0})}}}var vd=_;function fte(a){let i=new hv("",!1,kf);return i.domNode.tabIndex=-1,a.add(i),i}var R7o=9;var FB=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 Fmo(a){return a instanceof wv?"source":a instanceof iI?"instruction":"exception"}var KAe=class extends zr{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=O_.bindTo(h),this.breakpointIsDataBytes=Gdi.bindTo(h),this.breakpointHasMultipleModes=$di.bindTo(h),this.breakpointSupportsCondition=t_t.bindTo(h),this.breakpointInputFocused=ZTt.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(PL,"BreakpointsView",e,new Gki(this),[this.instantiationService.createInstance(ute),this.instantiationService.createInstance(pte,this.menu,this.breakpointHasMultipleModes,this.breakpointSupportsCondition,this.breakpointItemType),new mUt(this.menu,this.breakpointHasMultipleModes,this.breakpointSupportsCondition,this.breakpointItemType,this.debugService,this.hoverService),new fUt(this,this.debugService,this.contextViewService),this.instantiationService.createInstance(mte,this.menu,this.breakpointSupportsCondition,this.breakpointItemType),new hUt(this,this.debugService,this.contextViewService,this.hoverService,this.labelService),this.instantiationService.createInstance(hte,this.menu,this.breakpointHasMultipleModes,this.breakpointSupportsCondition,this.breakpointItemType,this.breakpointIsDataBytes),new gUt(this,this.debugService,this.contextViewService,this.hoverService,this.labelService),this.instantiationService.createInstance(gte)],{compressionEnabled:this.getPresentation()==="tree",hideTwistiesOfChildlessElements:!0,identityProvider:{getId:o=>o.getId()},keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:o=>o instanceof FB?Ra(o.uri):o instanceof wv?`${Ra(o.uri)}:${o.lineNumber}`:o instanceof tI?o.name:o instanceof ZI?o.description:o instanceof SP?o.label||o.filter:o instanceof iI?`0x${o.address.toString(16)}`:"",getCompressedNodeKeyboardNavigationLabel:o=>o.map(n=>n instanceof FB?Ra(n.uri):"").join("/")},accessibilityProvider:new $ki(this.debugService,this.labelService),multipleSelectionSupport:!1,overrideStyles:this.getLocationBasedColors().listOverrideStyles}),this._register(this.tree),Cke.bindTo(this.tree.contextKeyService),this._register(this.tree.onContextMenu(this.onTreeContextMenu,this)),this._register(this.tree.onMouseMiddleClick(async({element:o})=>{o instanceof wv?await this.debugService.removeBreakpoints(o.getId()):o instanceof tI?await this.debugService.removeFunctionBreakpoints(o.getId()):o instanceof ZI?await this.debugService.removeDataBreakpoints(o.getId()):o instanceof iI?await this.debugService.removeInstructionBreakpoints(o.instructionReference,o.offset):o instanceof FB&&await this.debugService.removeBreakpoints(o.breakpoints.map(n=>n.getId()))})),this._register(this.tree.onDidOpen(async o=>{let n=o.element;n&&(Vp(o.browserEvent)&&o.browserEvent.button===1||(n instanceof wv&&GAe(n,o.sideBySide,o.editorOptions.preserveFocus||!1,o.editorOptions.pinned||!o.editorOptions.preserveFocus,this.debugService,this.editorService),n instanceof iI&&(await this.editorService.openEditor(nR.instance)).goToInstructionAndOffset(n.instructionReference,n.offset,Vp(o.browserEvent)&&o.browserEvent.detail===2),Vp(o.browserEvent)&&o.browserEvent.detail===2&&n instanceof tI&&n!==this.inputBoxData?.breakpoint&&this.renderInputBox({breakpoint:n,type:"name"})))})),this._register(this.tree.onDidChangeCollapseState(o=>{let n=o.node.element;n instanceof FB&&(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=R(e,vd("span.breakpoint-warning"));this.hintContainer=this._register(new Lc(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")}})),xo(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 FB){this.breakpointItemType.set("breakpointFolder");let{secondary:l}=Ef(this.menu.getActions({arg:t,shouldForwardArgs:!1}),"inline");this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>l,getActionsContext:()=>t});return}let o=t instanceof wv?"breakpoint":t instanceof SP?"exceptionBreakpoint":t instanceof tI?"functionBreakpoint":t instanceof ZI?"dataBreakpoint":t instanceof iI?"instructionBreakpoint":void 0;this.breakpointItemType.set(o);let n=this.debugService.getViewModel().focusedSession,r=t instanceof SP?t.supportsCondition:!n||!!n.capabilities.supportsConditionalBreakpoints;this.breakpointSupportsCondition.set(r),this.breakpointIsDataBytes.set(t instanceof ZI&&t.src.type===1),this.breakpointHasMultipleModes.set(this.debugService.getModel().getBreakpointModes(Fmo(t)).length>1);let{secondary:s}=Ef(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(R7o*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 xe(void 0,{isTrusted:!0}).appendMarkdown(n);this.hintContainer.setLabel("$(warning)",void 0,{title:{markdown:s,markdownNotSupportedFallback:n}}),bn(this.hintContainer.element)}else this.hintDelayer.schedule();else xo(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 FB(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())}};KAe=I([m(1,ze),m(2,Li),m(3,_e),m(4,F),m(5,De),m(6,ee),m(7,_n),m(8,B),m(9,Ri),m(10,X),m(11,Qe),m(12,ot),m(13,qt),m(14,tt),m(15,kt)],KAe);var Gki=class{constructor(i){this.view=i}getHeight(i){return 22}getTemplateId(i){if(i instanceof FB)return ute.ID;if(i instanceof wv)return pte.ID;if(i instanceof tI){let e=this.view.inputBoxData?.breakpoint;return!i.name||e&&e.getId()===i.getId()?hUt.ID:mte.ID}if(i instanceof SP){let e=this.view.inputBoxData?.breakpoint;return e&&e.getId()===i.getId()?fUt.ID:mUt.ID}if(i instanceof ZI){let e=this.view.inputBoxData?.breakpoint;return e&&e.getId()===i.getId()?gUt.ID:hte.ID}return i instanceof iI?gte.ID:""}},Mtt=new Map,ute=class{constructor(i,e,t){this.debugService=i;this.labelService=e;this.hoverService=t}static{this.ID="breakpointFolder"}get templateId(){return ute.ID}renderTemplate(i){let e=Object.create(null);return e.elementDisposables=new P,e.templateDisposables=new P,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 v7("",!1,kf),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)})),R(e.container,e.checkbox.domNode),e.name=R(e.container,vd("span.name")),R(e.container,vd("span.file-path")),e.actionBar=new ji(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(Ni("mouse"),t.container,n)),o.indeterminate?t.checkbox.checked="mixed":t.checkbox.checked=o.enabled,t.actionBar.clear();let r=t.elementDisposables.add(new st("debug.removeBreakpointsInFile",d(8687,null),q.asClassName(M.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=>Ra(c.uri));t.name.textContent=r.join("/");let s=this.labelService.getUriLabel(n.uri,{relative:!0});t.elementDisposables.add(this.hoverService.setupManagedHover(Ni("mouse"),t.container,s)),n.indeterminate?t.checkbox.checked="mixed":t.checkbox.checked=n.enabled,t.actionBar.clear();let l=t.elementDisposables.add(new st("debug.removeBreakpointsInFile",d(8687,null),q.asClassName(M.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()}};ute=I([m(0,Li),m(1,ot),m(2,tt)],ute);var pte=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 pte.ID}renderTemplate(i){let e=Object.create(null);e.elementDisposables=new P,e.templateDisposables=new P,e.templateDisposables.add(e.elementDisposables),e.breakpoint=i,i.classList.add("breakpoint"),e.templateDisposables.add(Z(()=>{i.classList.remove("breakpoint")})),e.icon=vd(".icon"),e.checkbox=fte(e.templateDisposables),e.templateDisposables.add(e.checkbox.onChange(()=>{this.debugService.enableOrDisableBreakpoints(!e.context.enabled,e.context)})),R(e.breakpoint,e.icon),R(e.breakpoint,e.checkbox.domNode),e.name=R(e.breakpoint,vd("span.name")),e.filePath=R(e.breakpoint,vd("span.file-path")),e.actionBar=new ji(e.breakpoint),e.templateDisposables.add(e.actionBar);let t=R(e.breakpoint,vd(".badge-container"));return e.badge=R(t,vd("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}=I2(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(Ni("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}=hl(this.menu.getActions({arg:i,shouldForwardArgs:!0}),"inline");e.actionBar.clear(),e.actionBar.push(l,{icon:!0,label:!1}),Mtt.set(i.getId(),e.actionBar.domNode)}renderBreakpointFileLabel(i,e){e.name.textContent=Ra(i.uri),e.filePath.textContent=this.labelService.getUriLabel(ci(i.uri),{relative:!0})}renderBreakpointLineLabel(i,e){e.name.textContent=d(8676,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(8655,null)}else e.name.textContent=d(8675,null)}).catch(()=>{e.context===i&&(e.name.textContent=d(8631,null))})}disposeElement(i,e,t){t.elementDisposables.clear()}disposeCompressedElements(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.templateDisposables.dispose()}};pte=I([m(4,Li),m(5,tt),m(6,ot),m(7,Nt)],pte);var mUt=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 P,e.templateDisposables=new P,e.templateDisposables.add(e.elementDisposables),e.breakpoint=R(i,vd(".breakpoint")),e.checkbox=fte(e.templateDisposables),e.templateDisposables.add(e.checkbox.onChange(()=>{this.debugService.enableOrDisableBreakpoints(!e.context.enabled,e.context)})),R(e.breakpoint,e.checkbox.domNode),e.name=R(e.breakpoint,vd("span.name")),e.condition=R(e.breakpoint,vd("span.condition")),e.breakpoint.classList.add("exception"),e.actionBar=new ji(e.breakpoint),e.templateDisposables.add(e.actionBar);let t=R(e.breakpoint,vd(".badge-container"));return e.badge=R(t,vd("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(8692,null);e.elementDisposables.add(this.hoverService.setupManagedHover(Ni("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(Ni("mouse"),e.condition,d(8661,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}=hl(this.menu.getActions({arg:i,shouldForwardArgs:!0}),"inline");e.actionBar.clear(),e.actionBar.push(o,{icon:!0,label:!1}),Mtt.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()}},mte=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 mte.ID}renderTemplate(i){let e=Object.create(null);e.elementDisposables=new P,e.templateDisposables=new P,e.templateDisposables.add(e.elementDisposables),e.breakpoint=R(i,vd(".breakpoint")),e.icon=vd(".icon"),e.checkbox=fte(e.templateDisposables),e.templateDisposables.add(e.checkbox.onChange(()=>{this.debugService.enableOrDisableBreakpoints(!e.context.enabled,e.context)})),R(e.breakpoint,e.icon),R(e.breakpoint,e.checkbox.domNode),e.name=R(e.breakpoint,vd("span.name")),e.condition=R(e.breakpoint,vd("span.condition")),e.actionBar=new ji(e.breakpoint),e.templateDisposables.add(e.actionBar);let t=R(e.breakpoint,vd(".badge-container"));return e.badge=R(t,vd("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}=I2(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(Ni("mouse"),e.icon,o||"")),e.checkbox.checked=i.enabled,e.elementDisposables.add(this.hoverService.setupManagedHover(Ni("mouse"),e.breakpoint,o||"")),i.condition&&i.hitCondition?e.condition.textContent=d(8660,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(Ni("mouse"),e.breakpoint,d(8669,null))),this.breakpointSupportsCondition.set(!n||!!n.capabilities.supportsConditionalBreakpoints),this.breakpointItemType.set("functionBreakpoint");let{primary:r}=hl(this.menu.getActions({arg:i,shouldForwardArgs:!0}),"inline");e.actionBar.clear(),e.actionBar.push(r,{icon:!0,label:!1}),Mtt.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()}};mte=I([m(3,Li),m(4,tt),m(5,ot)],mte);var hte=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 hte.ID}renderTemplate(i){let e=Object.create(null);e.breakpoint=R(i,vd(".breakpoint")),e.elementDisposables=new P,e.templateDisposables=new P,e.templateDisposables.add(e.elementDisposables),e.icon=vd(".icon"),e.checkbox=fte(e.templateDisposables),e.templateDisposables.add(e.checkbox.onChange(()=>{this.debugService.enableOrDisableBreakpoints(!e.context.enabled,e.context)})),R(e.breakpoint,e.icon),R(e.breakpoint,e.checkbox.domNode),e.name=R(e.breakpoint,vd("span.name")),e.accessType=R(e.breakpoint,vd("span.access-type")),e.condition=R(e.breakpoint,vd("span.condition")),e.actionBar=new ji(e.breakpoint),e.templateDisposables.add(e.actionBar);let t=R(e.breakpoint,vd(".badge-container"));return e.badge=R(t,vd("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}=I2(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(Ni("mouse"),e.icon,o||"")),e.checkbox.checked=i.enabled,e.elementDisposables.add(this.hoverService.setupManagedHover(Ni("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(Ni("mouse"),e.breakpoint,d(8644,null))),i.accessType){let s=i.accessType==="read"?d(8683,null):i.accessType==="write"?d(8694,null):d(8623,null);e.accessType.textContent=s}else e.accessType.textContent="";i.condition&&i.hitCondition?e.condition.textContent=d(8660,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}=hl(this.menu.getActions({arg:i,shouldForwardArgs:!0}),"inline");e.actionBar.clear(),e.actionBar.push(r,{icon:!0,label:!1}),Mtt.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()}};hte=I([m(5,Li),m(6,tt),m(7,ot)],hte);var gte=class{constructor(i,e,t){this.debugService=i;this.hoverService=e;this.labelService=t}static{this.ID="instructionBreakpoints"}get templateId(){return gte.ID}renderTemplate(i){let e=Object.create(null);e.elementDisposables=new P,e.templateDisposables=new P,e.templateDisposables.add(e.elementDisposables),e.breakpoint=R(i,vd(".breakpoint")),e.icon=vd(".icon"),e.checkbox=fte(e.templateDisposables),e.templateDisposables.add(e.checkbox.onChange(()=>{this.debugService.enableOrDisableBreakpoints(!e.context.enabled,e.context)})),R(e.breakpoint,e.icon),R(e.breakpoint,e.checkbox.domNode),e.name=R(e.breakpoint,vd("span.name")),e.address=R(e.breakpoint,vd("span.file-path")),e.actionBar=new ji(e.breakpoint),e.templateDisposables.add(e.actionBar);let t=R(e.breakpoint,vd(".badge-container"));return e.badge=R(t,vd("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(Ni("mouse"),e.name,d(8646,null,i.address.toString()))),e.checkbox.checked=i.enabled;let{message:t,icon:o}=I2(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(Ni("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()}};gte=I([m(0,Li),m(1,tt),m(2,ot)],gte);var hUt=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 P,o=R(i,vd(".breakpoint"));e.icon=vd(".icon"),e.checkbox=fte(t),R(o,e.icon),R(o,e.checkbox.domNode),this.view.breakpointInputFocused.set(!0);let n=R(o,vd(".inputBoxContainer")),r=new Dc(n,this.contextViewService,{inputBoxStyles:pl});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(Vo(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 P,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}=I2(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(Ni("mouse"),t.icon,r||"")),t.checkbox.checked=o.enabled,t.checkbox.disable(),t.inputBox.value=o.name||"";let s=d(8668,null),l=d(8667,null);t.type==="condition"?(t.inputBox.value=o.condition||"",s=d(8664,null),l=d(8663,null)):t.type==="hitCount"&&(t.inputBox.value=o.hitCondition||"",s=d(8666,null),l=d(8665,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()}},gUt=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 P,o=R(i,vd(".breakpoint"));e.icon=vd(".icon"),e.checkbox=fte(t),R(o,e.icon),R(o,e.checkbox.domNode),this.view.breakpointInputFocused.set(!0);let n=R(o,vd(".inputBoxContainer")),r=new Dc(n,this.contextViewService,{inputBoxStyles:pl});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(Vo(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 P,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}=I2(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(Ni("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(8639,null),l=d(8638,null)):t.type==="hitCount"&&(t.inputBox.value=o.hitCondition||"",s=d(8641,null),l=d(8640,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()}},fUt=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 P,t=R(i,vd(".breakpoint"));t.classList.add("exception");let o=fte(e);R(t,o.domNode),this.view.breakpointInputFocused.set(!0);let n=R(t,vd(".inputBoxContainer")),r=new Dc(n,this.contextViewService,{ariaLabel:d(8657,null),inputBoxStyles:pl});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(Vo(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 P;e.add(l);let c={inputBox:r,checkbox:o,templateDisposables:e,elementDisposables:new P};return c}renderElement(i,e,t){let o=i.element,n=o.conditionDescription||d(8658,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()}},$ki=class{constructor(i,e){this.debugService=i;this.labelService=e}getWidgetAriaLabel(){return d(8629,null)}getRole(){return"checkbox"}isChecked(i){return i instanceof FB,i.enabled}getAriaLabel(i){if(i instanceof FB)return d(8628,null,Ra(i.uri),i.breakpoints.length);if(i instanceof SP)return i.toString();let{message:e}=I2(this.debugService.state,this.debugService.getModel().areBreakpointsActivated(),i,this.labelService,this.debugService.getModel()),t=i.toString();return e?`${t}, ${e}`:t}};function GAe(a,i,e,t,o,n){if(a.uri.scheme===vC&&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?vn:Un)}function I2(a,i,e,t,o){let n=a===3||a===2,r=e instanceof ZI?Xyi:e instanceof tI?Qyi:e.logMessage?KWt:zF;if(!e.enabled||!i)return{icon:r.disabled,message:e.logMessage?d(8649,null):d(8648,null)};let s=u=>e.message?u.concat(", "+e.message):u;if(n&&e instanceof wv&&e.pending)return{icon:zF.pending};if(n&&!e.verified)return{icon:r.unverified,message:e.message?e.message:e.logMessage?d(8693,null):d(8691,null),showAdapterUnverifiedMessage:!0};if(e instanceof ZI)return e.supported?{icon:r.regular,message:e.message||d(8632,null)}:{icon:r.unverified,message:d(8645,null)};if(e instanceof tI){if(!e.supported)return{icon:r.unverified,message:d(8670,null)};let u=[];return u.push(e.message||d(8662,null)),e.condition&&u.push(d(8659,null,e.condition)),e.hitCondition&&u.push(d(8671,null,e.hitCondition)),{icon:r.regular,message:s(u.join(`
`))}}if(e instanceof iI){if(!e.supported)return{icon:r.unverified,message:d(8674,null)};let u=[];return e.message?u.push(e.message):e.instructionReference?u.push(d(8673,null,e.instructionReference)):u.push(d(8672,null)),e.hitCondition&&u.push(d(8671,null,e.hitCondition)),{icon:r.regular,message:s(u.join(`
`))}}let l;if(e instanceof wv&&e.triggeredBy&&(l=o.getBreakpoints().find(u=>u.getId()===e.triggeredBy)),e.logMessage||e.condition||e.hitCondition||l){let u=[],p=e.logMessage?KWt.regular:Yyi.regular;return e.supported||(p=GWt,u.push(d(8630,null))),e.logMessage&&u.push(d(8677,null,e.logMessage)),e.condition&&u.push(d(8659,null,e.condition)),e.hitCondition&&u.push(d(8671,null,e.hitCondition)),l&&u.push(d(8690,null,`${t.getUriLabel(l.uri,{relative:!0})}: ${l.lineNumber}`)),{icon:p,message:s(u.join(`
`))}}let c=e.message?e.message:e instanceof wv&&t?t.getUriLabel(e.uri):d(8627,null);return{icon:r.regular,message:c}}W(class extends K{constructor(){super({id:"workbench.debug.viewlet.action.addFunctionBreakpointAction",title:{...L(8626,"Add Function Breakpoint"),mnemonicTitle:d(8681,null)},f1:!0,icon:Ulo,menu:[{id:D.ViewTitle,group:"navigation",order:10,when:x.equals("view",Xx)},{id:D.MenubarNewBreakpointMenu,group:"1_breakpoints",order:3,when:fa}]})}async run(a){let i=a.get(Li);await a.get(Ft).openView(Xx),i.addFunctionBreakpoint()}});var vUt=class extends K{async run(i,e){let t=i.get(Li),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(Ge),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(8637,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(8633,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 P,n=o.add(i.createInputBox());n.prompt=d(8643,null),n.placeholder=d(8642,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);Wo(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(8634,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(8636,null,p)};if(!e)return;let l=BigInt(n),c=BigInt(s),u=`0x${l.toString(16)}`;return r==="-"?l>c?{error:d(8635,null,n,s)}:{address:u,bytes:Number(c-l)}:{address:u,bytes:Number(c)}}};W(class extends vUt{constructor(){super({id:"workbench.debug.viewlet.action.addDataBreakpointOnAddress",title:{...L(8625,"Add Data Breakpoint at Address"),mnemonicTitle:d(8678,null)},f1:!0,icon:zlo,menu:[{id:D.ViewTitle,group:"navigation",order:11,when:x.and(xke,x.equals("view",Xx))},{id:D.MenubarNewBreakpointMenu,group:"1_breakpoints",order:4,when:xke}]})}});W(class extends vUt{constructor(){super({id:"workbench.debug.viewlet.action.editDataBreakpointOnAddress",title:L(8652,"Edit Address..."),menu:[{id:D.DebugBreakpointsContext,when:x.and(xke,Gdi),group:"navigation",order:15}]})}});W(class extends K{constructor(){super({id:"workbench.debug.viewlet.action.toggleBreakpointsActivatedAction",title:L(8624,"Toggle Activate Breakpoints"),f1:!0,icon:Glo,menu:{id:D.ViewTitle,group:"navigation",order:20,when:x.equals("view",Xx)}})}run(a){let i=a.get(Li);i.setBreakpointsActivated(!i.getModel().areBreakpointsActivated())}});W(class extends K{constructor(){super({id:"workbench.debug.viewlet.action.removeBreakpoint",title:d(8686,null),icon:M.removeClose,menu:[{id:D.DebugBreakpointsContext,group:"3_modification",order:10,when:O_.notEqualsTo("exceptionBreakpoint")},{id:D.DebugBreakpointsContext,group:"inline",order:20,when:O_.notEqualsTo("exceptionBreakpoint")}]})}async run(a,i){let e=a.get(Li);i instanceof wv?await e.removeBreakpoints(i.getId()):i instanceof tI?await e.removeFunctionBreakpoints(i.getId()):i instanceof ZI?await e.removeDataBreakpoints(i.getId()):i instanceof iI&&await e.removeInstructionBreakpoints(i.instructionReference,i.offset)}});W(class extends K{constructor(){super({id:"workbench.debug.viewlet.action.removeAllBreakpoints",title:{...L(8685,"Remove All Breakpoints"),mnemonicTitle:d(8682,null)},f1:!0,icon:Klo,menu:[{id:D.ViewTitle,group:"navigation",order:30,when:x.equals("view",Xx)},{id:D.DebugBreakpointsContext,group:"3_modification",order:20,when:x.and(jj,O_.notEqualsTo("exceptionBreakpoint"))},{id:D.MenubarDebugMenu,group:"5_breakpoints",order:3,when:fa}]})}run(a){let i=a.get(Li);i.removeBreakpoints(),i.removeFunctionBreakpoints(),i.removeDataBreakpoints(),i.removeInstructionBreakpoints()}});W(class extends K{constructor(){super({id:"workbench.debug.viewlet.action.enableAllBreakpoints",title:{...L(8656,"Enable All Breakpoints"),mnemonicTitle:d(8680,null)},f1:!0,precondition:fa,menu:[{id:D.DebugBreakpointsContext,group:"z_commands",order:10,when:x.and(jj,O_.notEqualsTo("exceptionBreakpoint"))},{id:D.MenubarDebugMenu,group:"5_breakpoints",order:1,when:fa}]})}async run(a){await a.get(Li).enableOrDisableBreakpoints(!0)}});W(class extends K{constructor(){super({id:"workbench.debug.viewlet.action.disableAllBreakpoints",title:{...L(8647,"Disable All Breakpoints"),mnemonicTitle:d(8679,null)},f1:!0,precondition:fa,menu:[{id:D.DebugBreakpointsContext,group:"z_commands",order:20,when:x.and(jj,O_.notEqualsTo("exceptionBreakpoint"))},{id:D.MenubarDebugMenu,group:"5_breakpoints",order:2,when:fa}]})}async run(a){await a.get(Li).enableOrDisableBreakpoints(!1)}});W(class extends K{constructor(){super({id:"workbench.debug.viewlet.action.reapplyBreakpointsAction",title:L(8684,"Reapply All Breakpoints"),f1:!0,precondition:Xa,menu:[{id:D.DebugBreakpointsContext,group:"z_commands",order:30,when:x.and(jj,O_.notEqualsTo("exceptionBreakpoint"))}]})}async run(a){await a.get(Li).setBreakpointsActivated(!0)}});W(class extends K{constructor(){super({id:"workbench.debug.viewlet.action.toggleBreakpointsPresentation",title:L(8689,"Toggle Breakpoints View Presentation"),f1:!0,icon:zWt,menu:{id:D.ViewTitle,group:"navigation",order:10,when:x.equals("view",Xx)}})}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 Fn{constructor(){super({id:"debug.editBreakpoint",viewId:Xx,title:d(8651,null),icon:M.edit,precondition:t_t,menu:[{id:D.DebugBreakpointsContext,when:O_.notEqualsTo("functionBreakpoint"),group:"navigation",order:10},{id:D.DebugBreakpointsContext,group:"inline",order:10}]})}async runInView(a,i,e){let t=a.get(Li),o=a.get(ee);if(e instanceof wv){let n=await GAe(e,!1,!1,!0,t,o);if(n){let r=n.getControl();pn(r)&&r.getContribution(fP)?.showBreakpointWidget(e.lineNumber,e.column)}}else if(e instanceof tI){let n=a.get(ze),r=[new st("breakpoint.editCondition",d(8651,null),void 0,!0,async()=>i.renderInputBox({breakpoint:e,type:"condition"})),new st("breakpoint.editCondition",d(8653,null),void 0,!0,async()=>i.renderInputBox({breakpoint:e,type:"hitCount"}))],s=Mtt.get(e.getId());s&&n.showContextMenu({getActions:()=>r,getAnchor:()=>s,onHide:()=>Ue(r)})}else i.renderInputBox({breakpoint:e,type:"condition"})}});W(class extends Fn{constructor(){super({id:"debug.editFunctionBreakpoint",viewId:Xx,title:d(8650,null),menu:[{id:D.DebugBreakpointsContext,group:"navigation",order:10,when:O_.isEqualTo("functionBreakpoint")}]})}runInView(a,i,e){i.renderInputBox({breakpoint:e,type:"name"})}});W(class extends Fn{constructor(){super({id:"debug.editFunctionBreakpointHitCount",viewId:Xx,title:d(8653,null),precondition:t_t,menu:[{id:D.DebugBreakpointsContext,group:"navigation",order:20,when:x.or(O_.isEqualTo("functionBreakpoint"),O_.isEqualTo("dataBreakpoint"))}]})}runInView(a,i,e){i.renderInputBox({breakpoint:e,type:"hitCount"})}});W(class extends Fn{constructor(){super({id:"debug.editBreakpointMode",viewId:Xx,title:d(8654,null),menu:[{id:D.DebugBreakpointsContext,group:"navigation",order:20,when:x.and($di,x.or(O_.isEqualTo("breakpoint"),O_.isEqualTo("exceptionBreakpoint"),O_.isEqualTo("instructionBreakpoint")))}]})}async runInView(a,i,e){let t=a.get(Li),o=Fmo(e),n=t.getModel().getBreakpointModes(o),r=await a.get(Ge).pick(n.map(s=>({label:s.label,description:s.description,mode:s.mode})),{placeHolder:d(8688,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 iI?(t.removeInstructionBreakpoints(e.instructionReference,e.offset),t.addInstructionBreakpoint({...e.toJSON(),mode:r.mode,modeLabel:r.label})):e instanceof SP&&(e.mode=r.mode,e.modeLabel=r.label,t.setExceptionBreakpointCondition(e,e.condition))}});async function Vmo(a,i){let e=a.get(Ge),t=a.get(Li),o=a.get(Ft),n=a.get(ge),r=new P,s=e.createQuickPick({useSeparators:!0});r.add(s),s.matchOnLabel=s.matchOnDescription=s.matchOnDetail=s.sortByLabel=!1,s.placeholder=d(9047,null);let l=Wmo(s.value,i,t,o,n);s.items=l.picks,s.activeItems=l.activeItems,r.add(s.onDidChangeValue(async()=>{s.items=Wmo(s.value,i,t,o,n).picks})),r.add(s.onDidAccept(()=>{s.selectedItems[0].accept(),s.hide(),r.dispose()})),s.show()}function Wmo(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=P7o(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(9049,null);return n.push({label:`$(plus) ${u}`,ariaLabel:u,accept:()=>o.executeCommand(i)}),{picks:n,activeItems:c}}function M7o(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(9048,null,i,e),t=e),{label:i,description:t,ariaLabel:o}}function P7o(a,i,e,t,o){let n=M7o(a),r=Up(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(ld)||t.openView(ld,!0)}}}var nhe="debug.addConfiguration",bUt="editor.debug.action.copyAddress",SUt="editor.debug.action.toggleBreakpoint",Ptt="editor.debug.action.toggleInlineBreakpoint",jki="debug.copyStackTrace",Qki="workbench.action.debug.reverseContinue",Yki="workbench.action.debug.stepBack",y2="workbench.action.debug.restart",IUt="workbench.action.debug.terminateThread",w2="workbench.action.debug.stepOver",C2="workbench.action.debug.stepInto",Xki="workbench.action.debug.stepIntoTarget",x2="workbench.action.debug.stepOut",W3="workbench.action.debug.pause",GR="workbench.action.debug.disconnect",$Ae="workbench.action.debug.disconnectAndSuspend",uT="workbench.action.debug.stop",Jki="workbench.action.debug.restartFrame",k2="workbench.action.debug.continue",Bmo="workbench.debug.action.focusRepl",Att="debug.jumpToCursor",qAe="workbench.action.debug.focusProcess",V3="workbench.action.debug.selectandstart",yUt="workbench.action.debug.selectDebugConsole",Zki="workbench.action.debug.selectDebugSession",E2="workbench.action.debug.configure",d0="workbench.action.debug.start",Ntt="workbench.action.debug.run",eEi="debug.renameWatchExpression",Hmo="debug.copyWatchExpression",tEi="debug.setWatchExpression",iEi="debug.removeWatchExpression",oEi="workbench.action.debug.nextConsole",nEi="workbench.action.debug.prevConsole",rEi="workbench.action.debug.showLoadedScripts",sEi="workbench.action.debug.callStackTop",aEi="workbench.action.debug.callStackBottom",lEi="workbench.action.debug.callStackUp",cEi="workbench.action.debug.callStackDown",Ott="debug.addToWatchExpressions",vte="debug.copyEvaluatePath",B3="workbench.debug.viewlet.action.copyValue",Ftt="debug.breakWhenValueChanges",Wtt="debug.breakWhenValueIsAccessed",Vtt="debug.breakWhenValueIsRead",A7o="debug.toggleExceptionBreakpoints",N7o="debug.attachToCurrentCodeRenderer",bte=L(8892,"Debug"),Ste=L(8904,"Restart"),Ite=L(8914,"Step Over"),yte=L(8911,"Step Into"),Umo=L(8912,"Step Into Target"),wte=L(8913,"Step Out"),Cte=L(8902,"Pause"),H3=L(8893,"Disconnect"),Btt=L(8894,"Disconnect and Suspend"),T2=L(8915,"Stop"),xte=L(8888,"Continue"),zmo=L(8896,"Focus Session"),Kmo=L(8905,"Select and Start Debugging"),jAe=d(8900,null,"launch.json"),Htt=L(8909,"Start Debugging"),dEi=L(8910,"Start Without Debugging"),Gmo=L(8898,"Focus Next Debug Console"),$mo=L(8903,"Focus Previous Debug Console"),qmo=L(8901,"Open Loaded Script..."),jmo=L(8885,"Navigate to Top of Call Stack"),Qmo=L(8883,"Navigate to Bottom of Call Stack"),Ymo=L(8886,"Navigate Up Call Stack"),Xmo=L(8884,"Navigate Down Call Stack"),QAe=L(8890,"Copy as Expression"),Utt=L(8891,"Copy Value"),wUt=L(8889,"Copy Address"),ztt=L(8881,"Add to Watch"),Jmo=L(8906,"Select Debug Console"),Zmo=L(8907,"Select Debug Session"),Ktt="debug ",Gtt="debug consoles ",dT;function CUt(a){dT=a}function O7o(a){return a&&typeof a.sessionId=="string"&&typeof a.threadId=="string"}async function c0(a,i,e){let t=a.get(Li),o;if(O7o(i)){let n=t.getModel().getSession(i.sessionId);n&&(o=n.getAllThreads().find(r=>r.getId()===i.threadId))}else if(uEi(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 F7o(a){return a&&typeof a.sessionId=="string"&&typeof a.threadId=="string"&&typeof a.frameId=="string"}function eho(a,i){if(F7o(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 uEi(a){return a&&typeof a.sessionId=="string"}async function tho(a,i){let e=a.get(Li),t=a.get(Ft),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(ld)||await t.openView(ld,!0)}async function iho(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){nho(a);return}else await a.getModel().fetchCallstack(e.thread,20),t=e.thread.getCallStack(),o=t.findIndex(r=>r.frameId===e.frameId);n=qki(!0,t,o)}else{if(o<=0){oho(a);return}n=qki(!1,t,o)}n&&a.focusStackFrame(n,void 0,void 0,{preserveFocus:!1})}}async function oho(a){let i=a.getViewModel().focusedThread;if(i){await a.getModel().fetchCallstack(i);let e=i.getCallStack();if(e.length>0){let t=qki(!1,e,0);t&&a.focusStackFrame(t,void 0,void 0,{preserveFocus:!1})}}}function nho(a){let i=a.getViewModel().focusedThread;i&&a.focusStackFrame(i.getTopStackFrame(),void 0,void 0,{preserveFocus:!1})}function qki(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],!kz(o))return o;while(t!==e)}qe.registerCommand({id:jki,handler:async(a,i,e)=>{let t=a.get(sL),o=a.get(Wi),n=a.get(Li),r=eho(n,e);if(r){let s=t.getEOL(r.source.uri);await o.writeText(r.thread.getCallStack().map(l=>l.toString()).join(s))}}});qe.registerCommand({id:Qki,handler:async(a,i,e)=>{await c0(a,e,t=>t.reverseContinue())}});qe.registerCommand({id:Yki,handler:async(a,i,e)=>{let t=a.get(X);xz.getValue(t)?await c0(a,e,o=>o.stepBack("instruction")):await c0(a,e,o=>o.stepBack())}});qe.registerCommand({id:IUt,handler:async(a,i,e)=>{await c0(a,e,t=>t.terminate())}});qe.registerCommand({id:Att,handler:async a=>{let e=a.get(Li).getViewModel().focusedStackFrame,o=a.get(ee).activeTextEditorControl,n=a.get(Ne),r=a.get(Ge);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(8887,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(8899,null))}});qe.registerCommand({id:sEi,handler:async(a,i,e)=>{let t=a.get(Li);nho(t)}});qe.registerCommand({id:aEi,handler:async(a,i,e)=>{let t=a.get(Li);await oho(t)}});qe.registerCommand({id:lEi,handler:async(a,i,e)=>{let t=a.get(Li);iho(t,!1)}});qe.registerCommand({id:cEi,handler:async(a,i,e)=>{let t=a.get(Li);iho(t,!0)}});fe.appendMenuItem(D.EditorContext,{command:{id:Att,title:d(8897,null),category:bte},when:x.and(Nce,ue.editorTextFocus),group:"debug",order:3});yt.registerCommandAndKeybindingRule({id:oEi,weight:201,when:BO,primary:2060,mac:{primary:3166},handler:async(a,i,e)=>{tho(a,!0)}});yt.registerCommandAndKeybindingRule({id:nEi,weight:201,when:BO,primary:2059,mac:{primary:3164},handler:async(a,i,e)=>{tho(a,!1)}});yt.registerCommandAndKeybindingRule({id:y2,weight:200,primary:3135,when:Xa,handler:async(a,i,e)=>{let t=a.get(Li),o=a.get(B),n;if(uEi(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})}}});yt.registerCommandAndKeybindingRule({id:w2,weight:200,primary:68,when:Fs.isEqualTo("stopped"),handler:async(a,i,e)=>{let t=a.get(X);xz.getValue(t)?await c0(a,e,o=>o.next("instruction")):await c0(a,e,o=>o.next())}});var rho=Gt&&ri?581:69;yt.registerCommandAndKeybindingRule({id:C2,weight:210,primary:rho,when:Fs.notEqualsTo("inactive"),handler:async(a,i,e)=>{let t=a.get(X);xz.getValue(t)?await c0(a,e,o=>o.stepIn("instruction")):await c0(a,e,o=>o.stepIn())}});yt.registerCommandAndKeybindingRule({id:x2,weight:200,primary:1093,when:Fs.isEqualTo("stopped"),handler:async(a,i,e)=>{let t=a.get(X);xz.getValue(t)?await c0(a,e,o=>o.stepOut("instruction")):await c0(a,e,o=>o.stepOut())}});yt.registerCommandAndKeybindingRule({id:W3,weight:202,primary:64,when:Fs.isEqualTo("running"),handler:async(a,i,e)=>{await c0(a,e,t=>t.pause())}});yt.registerCommandAndKeybindingRule({id:Xki,primary:rho|2048,when:x.and(BY,Xa,Fs.isEqualTo("stopped")),weight:200,handler:async(a,i,e)=>{let t=a.get(Ge),o=a.get(Li),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 P,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(8895,null)})}});async function pEi(a,i,e,t,o){let n=a.get(Li),r;uEi(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)}yt.registerCommandAndKeybindingRule({id:GR,weight:200,primary:1087,when:x.and(fC,Xa),handler:(a,i,e)=>pEi(a,i,e,!0)});qe.registerCommand({id:$Ae,handler:(a,i,e)=>pEi(a,i,e,!0,!0)});yt.registerCommandAndKeybindingRule({id:uT,weight:200,primary:1087,when:x.and(fC.toNegated(),Xa),handler:(a,i,e)=>pEi(a,i,e,!1)});qe.registerCommand({id:Jki,handler:async(a,i,e)=>{let t=a.get(Li),o=a.get(Ne),n=eho(t,e);if(n)try{await n.restart()}catch(r){o.error(r)}}});yt.registerCommandAndKeybindingRule({id:k2,weight:210,primary:63,when:Fs.isEqualTo("stopped"),handler:async(a,i,e)=>{await c0(a,e,t=>t.continue())}});qe.registerCommand({id:rEi,handler:async a=>{await Omo(a)}});qe.registerCommand({id:"debug.startFromConfig",handler:async(a,i)=>{await a.get(Li).startDebugging(void 0,i)}});qe.registerCommand({id:qAe,handler:async(a,i)=>{let e=a.get(Li),t=a.get(ee);i=h_t(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)}});qe.registerCommand({id:V3,handler:async(a,i,e)=>{let t=a.get(Ge),o=a.get(Li);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(Ktt)}});qe.registerCommand({id:yUt,handler:async a=>{a.get(Ge).quickAccess.show(Gtt)}});qe.registerCommand({id:Zki,handler:async a=>{Vmo(a,V3)}});yt.registerCommandAndKeybindingRule({id:d0,weight:200,primary:63,when:x.and(fa,Fs.isEqualTo("inactive")),handler:async(a,i)=>{let e=a.get(Li);await mQe(a.get(B),a.get(ee));let{launch:t,name:o,getConfig:n}=e.getConfigurationManager().selectedConfiguration,r=await n(),s=r?Object.assign(Xi(r),i?.config):o;await e.startDebugging(t,s,{noDebug:i?.noDebug,startedByUser:!0},!1)}});yt.registerCommandAndKeybindingRule({id:Ntt,weight:200,primary:2111,mac:{primary:319},when:x.and(fa,Fs.notEqualsTo(oR(1))),handler:async a=>{await a.get(ge).executeCommand(d0,{noDebug:!0})}});yt.registerCommandAndKeybindingRule({id:"debug.toggleBreakpoint",weight:205,when:x.and(Cke,$h.toNegated()),primary:10,handler:a=>{let i=a.get(fo),e=a.get(Li),t=i.lastFocusedList;if(t instanceof hc){let o=t.getFocusedElements();o&&o.length&&e.enableOrDisableBreakpoints(!o[0].enabled,o[0])}}});yt.registerCommandAndKeybindingRule({id:"debug.enableOrDisableBreakpoint",weight:200,primary:void 0,when:ue.editorTextFocus,handler:a=>{let i=a.get(Li),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])}}}}});yt.registerCommandAndKeybindingRule({id:eEi,weight:205,when:rQe,primary:60,mac:{primary:3},handler:(a,i)=>{let e=a.get(Li);if(!(i instanceof Jc)){let o=a.get(fo).lastFocusedList;if(o){let n=o.getFocus();Array.isArray(n)&&n[0]instanceof Jc&&(i=n[0])}}i instanceof Jc&&e.getViewModel().setSelectedExpression(i,!1)}});qe.registerCommand({id:tEi,handler:async(a,i)=>{let e=a.get(Li);(i instanceof Jc||i instanceof Hl)&&e.getViewModel().setSelectedExpression(i,!0)}});yt.registerCommandAndKeybindingRule({id:"debug.setVariable",weight:205,when:JTt,primary:60,mac:{primary:3},handler:a=>{let i=a.get(fo),e=a.get(Li),t=i.lastFocusedList;if(t){let o=t.getFocus();Array.isArray(o)&&o[0]instanceof Hl&&e.getViewModel().setSelectedExpression(o[0],!1)}}});yt.registerCommandAndKeybindingRule({id:iEi,weight:200,when:x.and(rQe,FY.toNegated()),primary:20,mac:{primary:2049},handler:(a,i)=>{let e=a.get(Li);if(i instanceof Jc){e.removeWatchExpressions(i.getId());return}let o=a.get(fo).lastFocusedList;if(o){let n=o.getFocus();if(Array.isArray(n)&&n[0]instanceof Jc){let r=o.getSelection();r&&r.indexOf(n[0])>=0&&(n=r),n.forEach(s=>e.removeWatchExpressions(s.getId()))}}}});qe.registerCommand({id:Ftt,handler:async a=>{let i=a.get(Li);dT&&await i.addDataBreakpoint({description:dT.description,src:{type:0,dataId:dT.dataId},canPersist:!!dT.canPersist,accessTypes:dT.accessTypes,accessType:"write"})}});qe.registerCommand({id:Wtt,handler:async a=>{let i=a.get(Li);dT&&await i.addDataBreakpoint({description:dT.description,src:{type:0,dataId:dT.dataId},canPersist:!!dT.canPersist,accessTypes:dT.accessTypes,accessType:"readWrite"})}});qe.registerCommand({id:Vtt,handler:async a=>{let i=a.get(Li);dT&&await i.addDataBreakpoint({description:dT.description,src:{type:0,dataId:dT.dataId},canPersist:!!dT.canPersist,accessTypes:dT.accessTypes,accessType:"read"})}});yt.registerCommandAndKeybindingRule({id:"debug.removeBreakpoint",weight:200,when:x.and(Cke,ZTt.toNegated()),primary:20,mac:{primary:2049},handler:a=>{let i=a.get(fo),e=a.get(Li),t=i.lastFocusedList;if(t instanceof hc){let o=t.getFocusedElements(),n=o.length?o[0]:void 0;n instanceof wv?e.removeBreakpoints(n.getId()):n instanceof tI?e.removeFunctionBreakpoints(n.getId()):n instanceof ZI&&e.removeDataBreakpoints(n.getId())}}});yt.registerCommandAndKeybindingRule({id:"debug.installAdditionalDebuggers",weight:200,when:void 0,primary:void 0,handler:async(a,i)=>{let e=a.get(zi),t="@category:debuggers";return typeof i=="string"&&(t+=` ${i}`),e.openSearch(t)}});W(class extends K{constructor(){super({id:nhe,title:L(8879,"Add Configuration..."),category:bte,f1:!0,menu:{id:D.EditorContent,when:x.and(x.regex(Fo.Path.key,/\.vscode[/\\]launch\.json$/),fr.isEqualTo(mF))}})}async run(i,e){let t=i.get(Li).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(gV)?.addLaunchConfiguration()}}}});var W7o=a=>{let i=a.get(Li),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}])}}};yt.registerCommandAndKeybindingRule({weight:200,primary:1091,when:ue.editorTextFocus,id:Ptt,handler:W7o});fe.appendMenuItem(D.EditorContext,{command:{id:Ptt,title:d(8880,null),category:bte},when:x.and(Xa,kce.toNegated(),ue.editorTextFocus,ie.inChatSession.toNegated()),group:"debug",order:1});yt.registerCommandAndKeybindingRule({id:"debug.openBreakpointToSide",weight:200,when:Cke,primary:2051,secondary:[515],handler:a=>{let e=a.get(fo).lastFocusedList;if(e instanceof hc){let t=e.getFocusedElements();if(t.length&&t[0]instanceof wv)return GAe(t[0],!0,!1,!0,a.get(Li),a.get(ee))}}});W(class extends K{constructor(){super({id:A7o,title:L(8916,"Toggle Exception Breakpoints"),category:bte,f1:!0,precondition:fa})}async run(i){let e=i.get(Li),t=i.get(Ge),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 P,l=s.add(t.createQuickPick());l.placeholder=d(8908,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()}});yt.registerCommandAndKeybindingRule({id:"debug.openView",weight:200,when:fa.toNegated(),primary:63,secondary:[2111],handler:async a=>{await a.get(ds).openPaneComposite(jh,0,!0)}});W(class extends K{constructor(){super({id:N7o,title:L(8882,"Attach to Current Code Renderer")})}async run(a){let i=a.get(Co);if(!i.isExtensionDevelopment&&!i.extensionTestsLocationURI)throw new Error("Refusing to attach to renderer outside of development context");let e=sg(It);return await a.get(SD).attachToCurrentWindowRenderer(e)}});var sho="\\u0000-\\u0020\\u007f-\\u009f",V7o=new RegExp("(?:[a-zA-Z][a-zA-Z0-9+.-]{2,}:\\/\\/|data:|www\\.)[^\\s"+sho+'"]{2,}[^\\s'+sho+`"')}\\],:;.!?]`,"ug"),B7o=/(?:[a-zA-Z]:(?:(?:\\|\/)[\w\s\.@\-\(\)\[\]{}!#$%^&'`~+=]+)+)/,H7o=/(?:(?:\~|\.+)(?:(?:\\|\/)[\w\s\.@\-\(\)\[\]{}!#$%^&'`~+=]+)+)/,U7o=new RegExp(`(${B7o.source}|${H7o.source})`),z7o=/((?:\~|\.+)?(?:\/[\w\s\.@\-\(\)\[\]{}!#$%^&'`~+=]+)+)/,K7o=/(?::(?:line\s+)?([\d]+))?(?::([\d]+))?/,G7o=new RegExp(`${ri?U7o.source:z7o.source}${K7o.source}`,"g"),$7o=/:(?:line\s+)?([\d]+)(?::([\d]+))?$/,q7o=2e3;var kte=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?ht.single(i):(r<s&&n.push(i.textContent.substring(r-e)),Ao(i)?(Fi(i,...n),ht.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=$7o.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===Y.file){let s=n.fsPath,l=await this.pathService.path,c=th(l.sep===Lo.sep&&ri?s.replace(/\\/g,Lo.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=Ld(p.fsPath,t.substring(1)))}let c=this.createLink(e);c.tabIndex=0;let u=A.file(th(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(9093,null):d(9094,null),s=i.ariaLabel=t?it?d(9092,null,r,t):d(9091,null,r,t):it?d(9090,null,r):d(9089,null,r);o.type===0?o.store.add(this.hoverService.setupManagedHover(Ni("element"),i,s)):o.type!==2&&(i.title=s),o.store.add(j(i,"mousemove",l=>{i.classList.toggle("pointer",it?l.metaKey:l.ctrlKey)})),o.store.add(j(i,"mouseleave",()=>{i.classList.remove("pointer")})),o.store.add(j(i,"click",l=>{let c=Me(i).getSelection();!c||c.type==="Range"||(it?l.metaKey:l.ctrlKey)&&(l.preventDefault(),l.stopImmediatePropagation(),n(!1))})),o.store.add(j(i,"keydown",l=>{let c=new Ii(l);(c.keyCode===3||c.keyCode===10)&&(c.preventDefault(),c.stopPropagation(),n(c.keyCode===10))}))}detectLinks(i){if(i.length>q7o)return[{kind:"text",value:i,captures:[],index:0}];let e=[V7o,G7o],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}};kte=I([m(0,ee),m(1,be),m(2,Qe),m(3,wn),m(4,ap),m(5,Vt),m(6,B),m(7,tt)],kte);var Q7o=1024,Y7o=/^(true|false)$/i,X7o=/^(['"]).*\1$/;var J7o=Object.keys({value:0,unavailable:0,error:0,changed:0,boolean:0,string:0,number:0}),$R=class{constructor(i,e,t,o){this.commandService=i;this.hoverService=o;this.linkDetector=t.createInstance(kte),this.displayType=pr("debug.showVariableTypes",!1,e)}renderVariable(i,e,t={}){let o=this.displayType.get(),n=Pmo(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:B3,args:[e,[e]]}];return e.evaluateName&&r.push({id:vte,args:[{variable:e}]}),this.renderValue(i.value,e,{showChanged:t.showChanged,maxValueLength:Q7o,hover:{commands:r},highlights:n.value,colorize:!0,session:e.getSession()})}renderValue(i,e,t={}){let o=new P,n=t.session?.rememberedCapabilities?.supportsANSIStyling??t.wasANSI??!1,r=typeof e=="string"?e:e.value;for(let p of J7o)i.classList.remove(p);i.classList.add("value"),r===null||(e instanceof Jc||e instanceof Hl||e instanceof yA)&&!e.available?(i.classList.add("unavailable"),r!==Jc.DEFAULT_VALUE&&i.classList.add("error")):(typeof e!="string"&&t.showChanged&&e.valueChanged&&r!==Jc.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)?Y7o.test(r)?i.classList.add("boolean"):X7o.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 vP?e.getSession():void 0),l=t.hover===!1?{type:0,store:o}:{type:2,store:o};Rt(i);let c=t.locationReference??(e instanceof vP&&e.valueLocationReference),u=this.linkDetector;if(c&&s&&(u=this.linkDetector.makeReferencedLinkDetector(c,s)),n?i.appendChild(Kki(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(Ni("mouse"),i,()=>{let h=_("div"),g=_("div.hover-row"),f=R(g,_("div.hover-contents")),v=R(f,_("pre.debug-var-hover-pre"));return n?v.appendChild(Kki(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=qe.getCommand(h)?.metadata?.description;return{label:typeof f=="string"?f:f?f.value:h,commandId:h,run:()=>this.commandService.executeCommand(h,...g)}})}))}return o}};$R=I([m(0,ge),m(1,B),m(2,F),m(3,tt)],$R);var mEi=_,xUt=!0,kUt,YAe=class extends zr{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=cte(e),o=this.instantiationService.createInstance($R);this.tree=this.instantiationService.createInstance(nu,"VariablesView",t,new gEi,[this.instantiationService.createInstance(qR,o),this.instantiationService.createInstance(Ek,o),new TUt,new _Ut],this.instantiationService.createInstance(hEi),{accessibilityProvider:new fEi,identityProvider:{getId:r=>r.getId()},keyboardNavigationLabelProvider:dUt,overrideStyles:this.getLocationBasedColors().listOverrideStyles}),this._register(Ek.rendererOnVisualizationRange(this.debugService.getViewModel(),this.tree)),this.tree.setInput(this.debugService.getViewModel().focusedStackFrame??null),JTt.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&&xUt&&r.forgetScopes(),xUt=!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 Hl&&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 rR?!!e.treeItem.canEdit:!t.capabilities?.supportsSetVariable&&!t.capabilities?.supportsSetExpression?!1:e instanceof Hl&&!e.presentationHint?.attributes?.includes("readOnly")&&!e.presentationHint?.lazy:!1}async onContextMenu(e){let t=e.element;if(t instanceof Tz)return this.openContextMenuForScope(e,t);if(!(!(t instanceof Hl)||!t.value))return vEi(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}=Ef(n,"inline");this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>r})}};YAe=I([m(1,ze),m(2,Li),m(3,_e),m(4,B),m(5,F),m(6,Ri),m(7,X),m(8,Qe),m(9,De),m(10,tt),m(11,qt)],YAe);async function vEi(a,i,e,t,o){let n=o.element;if(!(n instanceof Hl)||!n.value)return;let r=await Z7o(a,n),s=bEi(n),l=i.getMenuActions(t,r,{arg:s,shouldForwardArgs:!1}),{secondary:c}=Ef(l,"inline");e.showContextMenu({getAnchor:()=>o.anchor,getActions:()=>c})}var bEi=a=>({sessionId:a.getSession()?.getId(),container:a.parent instanceof Jc?{expression:a.parent.name}:a.parent.toDebugProtocolObject(),variable:a.toDebugProtocolObject()});async function Z7o(a,i){let e=i.getSession();if(!e||!e.capabilities.supportsDataBreakpoints)return EUt(a,i);let t=[],o=await e.dataBreakpointInfo(i.name,i.parent.reference),n=o?.dataId,r=o?.accessTypes;if(CUt(o),!r)t.push([Cz.key,!!n]);else for(let s of r)switch(s){case"read":t.push([UY.key,!!n]);break;case"write":t.push([Cz.key,!!n]);break;case"readWrite":t.push([HY.key,!!n]);break}return EUt(a,i,t)}function EUt(a,i,e=[]){return kUt=i,g_t(a,i,e)}function aho(a){return a instanceof NE}var hEi=class extends b2{hasChildren(i){return i?aho(i)?!0:i.hasChildren:!1}doGetChildren(i){return aho(i)?i.getScopes():i.getChildren()}},gEi=class{getHeight(i){return 22}getTemplateId(i){return i instanceof vQe?_Ut.ID:i instanceof Tz?TUt.ID:i instanceof rR?Ek.ID:qR.ID}},TUt=class a{static{this.ID="scope"}get templateId(){return a.ID}renderTemplate(i){let e=R(i,mEi(".scope")),t=new Oa(e);return{name:e,label:t}}renderElement(i,e,t){t.label.set(i.element.name,ua(i.filterData))}disposeTemplate(i){i.label.dispose()}},_Ut=class a{static{this.ID="scopeError"}get templateId(){return a.ID}renderTemplate(i){let e=R(i,mEi(".scope"));return{error:R(e,mEi(".error"))}}renderElement(i,e,t){t.error.innerText=i.element.name}disposeTemplate(){}},Ek=class extends OB{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 Ek.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(9192,null),validationOptions:{validation:()=>t.errorMessage?{content:t.errorMessage}:null},onFinish:(o,n)=>{t.errorMessage=void 0,n&&t.edit(o).then(()=>{xUt=!1,this.debugService.getViewModel().updateViews()})}}}renderActionBar(e,t,o){let n=t,r=n.original?EUt(this.contextKeyService,n.original):this.contextKeyService,s=n.original?bEi(n.original):void 0,l=this.menuService.getMenuActions(D.DebugVariablesContext,r,{arg:s,shouldForwardArgs:!1}),{primary:c}=Ef(l,"inline");if(n.original){let u=pi({id:"debugViz",label:d(9187,null),class:q.asClassName(M.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})}};Ek=I([m(1,Li),m(2,_n),m(3,tt),m(4,qt),m(5,X)],Ek);var qR=class extends OB{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 qR.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(9192,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(()=>{xUt=!1,this.debugService.getViewModel().updateViews()})}}}renderActionBar(e,t,o){let n=t,r=EUt(this.contextKeyService,n),s=bEi(n),l=this.menuService.getMenuActions(D.DebugVariablesContext,r,{arg:s,shouldForwardArgs:!1}),{primary:c}=Ef(l,"inline");e.clear(),e.context=s,e.push(c,{icon:!0,label:!1});let u=new $e;o.elementDisposable.add(Z(()=>u.dispose(!0))),this.visualization.getApplicableFor(t,u.token).then(p=>{o.elementDisposable.add(p);let h=t instanceof rR&&t.original||t,g=p.object.map(f=>pi({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(pi({id:"debugViz",label:d(9188,null),class:q.asClassName(M.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)}}}};qR=I([m(1,qt),m(2,X),m(3,qY),m(4,ze),m(5,Li),m(6,_n),m(7,tt)],qR);var fEi=class{getWidgetAriaLabel(){return d(9190,null)}getAriaLabel(i){return i instanceof Tz?d(9191,null,i.name):i instanceof Hl?d(9189,null,i.name,i.value):null}},SEi="debug.setVariable";qe.registerCommand({id:SEi,handler:a=>{a.get(Li).getViewModel().setSelectedExpression(kUt,!1)}});qe.registerCommand({metadata:{description:Utt},id:B3,handler:async(a,i,e)=>{let t=a.get(Li),o=a.get(Wi),n="",r;if(i)i instanceof Hl||i instanceof Jc?(n="watch",r=[i]):(n="variables",r=kUt?[kUt]:[]);else{let p=a.get(Ft),h=p.getFocusedView(),g;if(h?.id===Yx?(g=p.getActiveViewWithId(Yx),n="watch"):h?.id===Iz&&(g=p.getActiveViewWithId(Iz),n="variables"),!g)return;r=g.treeSelection.filter(f=>f instanceof Jc||f instanceof Hl)}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 Hl?p.evaluateName||p.value:p.name);try{let p=await Promise.all(u.map(g=>l.evaluate(g,s.frameId,c))),h=si(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 $tt="workbench.debug.viewlet.action.viewMemory",lho="ms-vscode.hexeditor",eYo="hexEditor.hexedit";qe.registerCommand({id:$tt,handler:async(a,i,e)=>{let t=a.get(Li),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(zi),s=a.get(ee),l=a.get(Ne),c=a.get(lt),u=a.get(Te);(await c.getExtension(lho)||await tYo(r,l))&&(u.publicLog("debug/didViewMemory",{debugType:t.getModel().getSession(o)?.configuration.type}),await s.openEditor({resource:hXi(o,n),options:{revealIfOpened:!0,override:eYo}},vn))}});async function tYo(a,i){try{return await a.install(lho,{justification:d(9193,null),enable:!0},15),!0}catch(e){return i.error(e),!1}}qe.registerCommand({metadata:{description:QAe},id:vte,handler:async(a,i)=>{let e=a.get(Wi);i instanceof Hl?await e.writeText(i.evaluateName):await e.writeText(i.variable.evaluateName)}});qe.registerCommand({metadata:{description:ztt},id:Ott,handler:async(a,i)=>{a.get(Li).addWatchExpression(i.variable.evaluateName)}});W(class extends Fn{constructor(){super({id:"variables.collapse",viewId:Iz,title:d(9186,null),f1:!1,icon:M.collapseAll,menu:{id:D.ViewTitle,group:"navigation",when:x.equals("view",Iz)}})}runInView(a,i){i.collapseAll()}});var XAe=_;async function cho(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]:cho(t[0],i.slice(1))}async function iYo(a,i){let t=(await a.getScopes()).filter(n=>!n.expensive),o=si(await Promise.all(t.map(n=>cho(n,i))));return o.length>0&&o.every(n=>n.value===o[0].value)?o[0]:void 0}var WB=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(qtt,this.editor),this.expressionRenderer=this.instantiationService.createInstance($R)}static{this.ID="debug.hoverWidget"}get isShowingComplexValue(){return this.complexValueContainer?.hidden===!1}create(){this.domNode=XAe(".debug-hover-widget"),this.complexValueContainer=R(this.domNode,XAe(".complex-value")),this.complexValueTitle=R(this.complexValueContainer,XAe(".title")),this.treeContainer=R(this.complexValueContainer,XAe(".debug-hover-tree")),this.treeContainer.setAttribute("role","tree");let i=R(this.complexValueContainer,XAe(".tip"));i.textContent=d(8950,null,it?"Option":"Alt");let e=this.instantiationService.createInstance(yEi);this.tree=this.instantiationService.createInstance(nu,"DebugHover",this.treeContainer,new wEi,[this.instantiationService.createInstance(qR,this.expressionRenderer),this.instantiationService.createInstance(Ek,this.expressionRenderer)],e,{accessibilityProvider:new IEi,mouseSupport:!1,horizontalScrolling:!0,useShadows:!1,keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:t=>t.name},overrideStyles:{listBackground:qT}}),this.toDispose.push(Ek.rendererOnVisualizationRange(this.debugService.getViewModel(),this.tree)),this.toDispose.push(this.tree),this.valueContainer=XAe(".value"),this.valueContainer.tabIndex=0,this.valueContainer.setAttribute("role","tooltip"),this.scrollbar=new Pa(this.valueContainer,{horizontal:2}),this.domNode.appendChild(this.scrollbar.getDomNode()),this.toDispose.push(this.scrollbar),this.editor.applyFontInfo(this.domNode),this.domNode.style.backgroundColor=wt(qT),this.domNode.style.border=`1px solid ${wt(OU)}`,this.domNode.style.color=wt(s9),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 Hl)||!e.value))return vEi(this.contextKeyService,this.menuService,this.contextMenuService,D.DebugHoverContext,i)}registerListeners(){this.toDispose.push(Vo(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 Hl&&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 WB.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 $e,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 Jc&&!s.available?(this.hide(),1):(this.highlightDecorations.set([{range:r.range,options:WB._HOVER_HIGHLIGHT_DECORATION_OPTIONS}]),this.doShow(n,r.range.getStartPosition(),s,e,t))}static{this._HOVER_HIGHLIGHT_DECORATION_OPTIONS=po.register({description:"bdebug-hover-highlight",className:"hoverHighlight"})}async doShow(i,e,t,o,n){this.domNode||this.create(),this.showAtPosition=e;let r=new P;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 RGe(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 RGe(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=Kn(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&&(ts(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=Ue(this.toDispose)}};WB=I([m(1,Li),m(2,F),m(3,qt),m(4,X),m(5,ze)],WB);var IEi=class{getWidgetAriaLabel(){return d(8951,null)}getAriaLabel(i){return d(8952,null,i.name,i.value)}},yEi=class extends b2{hasChildren(i){return i.hasChildren}doGetChildren(i){return i.getChildren()}},wEi=class{getHeight(i){return 18}getTemplateId(i){return i instanceof rR?Ek.ID:qR.ID}},qtt=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 m_t(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 Jc(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 iYo(o,si(this._current.expression.split(".").map(n=>n.trim())))}}};qtt=I([m(1,Li),m(2,zt),m(3,ne)],qtt);var jtt=_,oYo=J("debugExceptionWidget.border","#a31515",d(9086,null)),nYo=J("debugExceptionWidget.background",{dark:"#420b0d",light:"#f1dfde",hcDark:"#420b0d",hcLight:"#f1dfde"},d(9085,null)),Ete=class extends aO{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(nYo);let t=e.getColor(oYo);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=jtt(".title"),n=jtt(".label");R(o,n);let r=jtt(".actions");R(o,r),n.textContent=this.exceptionInfo.id?d(9088,null,this.exceptionInfo.id):d(9087,null);let s=n.textContent;if(this._disposables.add(new ji(r)).push(new st("editor.closeExceptionWidget",d(9084,null),q.asClassName(lE),!0,async()=>{this.editor.getContribution(gV)?.closeExceptionWidget()}),{label:!1,icon:!0}),R(e,o),this.exceptionInfo.description){let c=jtt(".description");c.textContent=this.exceptionInfo.description,s+=", "+this.exceptionInfo.description,R(e,c)}if(this.exceptionInfo.details&&this.exceptionInfo.details.stackTrace){let c=jtt(".stack-trace"),u=this.instantiationService.createInstance(kte),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),R(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?ts(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}};Ete=I([m(4,De),m(5,F)],Ete);var rYo=100,sYo=150,aYo=500,dho=200,V1p=J("editor.inlineValuesForeground",{dark:"#ffffff80",light:"#00000080",hcDark:"#ffffff80",hcLight:"#00000080"},d(8949,null)),B1p=J("editor.inlineValuesBackground","#ffc80033",d(8948,null)),CEi=class{constructor(i,e){this.column=i;this.text=e}};function lYo(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 xe().appendCodeblock("",t.join(`,
`))}return new xe().appendCodeblock("",a)}function rhe(a,i,e,t=1073741824,o=sYo){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:rN,cursorStops:3},showIfCollapsed:!0}},{range:{startLineNumber:a,endLineNumber:a,startColumn:t,endColumn:t},options:{description:`${e}-inline-value-decoration`,after:{content:cYo(i),inlineClassName:`${e}-inline-value`,inlineClassNameAffectsLetterSpacing:!0,cursorStops:3},showIfCollapsed:!0,hoverMessage:lYo(n)}}]}function cYo(a){return a.replace(/[ \t\n]/g,rN)}function dYo(a,i,e,t){let o=new Map;for(let r of a)if(o.set(r.name,r.value),o.size>=rYo)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 uYo(a,i,e){if(a.getLineLength(i)>aYo)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){F6.lastIndex=0;let c=n.getStartOffset(r),u=n.getEndOffset(r),p=o.substring(c,u),h=F6.exec(p);if(h){let g=h[0];e.has(g)||e.set(g,[]),e.get(g).push(i)}}}var U3=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 P;this.allowScrollToExceptionWidget=!0;this.shouldScrollToExceptionWidget=()=>this.allowScrollToExceptionWidget;this.defaultHoverLockout=new me;this.oldDecorations=this.editor.createDecorationsCollection(),this.debounceInfo=u.for(c.inlineValuesProvider,"InlineValues",{min:dho}),this.hoverWidget=this.instantiationService.createInstance(WB,this.editor),this.toDispose=[this.defaultHoverLockout,this.altListener,this.displayedStore],this.registerListeners(),this.exceptionWidgetVisible=s_t.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 Ii(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 On(t,"keyup"),l=H.any(this.hostService.onDidChangeFocus,s.event)(c=>{let u;ag(c)&&(u=new Ii(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(kl.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(kl.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=Kn(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===WB.ID)&&this.hideHoverWidget()}onEditorMouseMove(i){if(this.debugService.state!==2)return;let e=i.target,t=it?"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===WB.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&&!Ie.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=it?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(Ete,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(Ete,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(Ete,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;Wx(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=No(i.uri.fsPath)==="launch.json"?Sb(i.getValue(),["configurations"],[],{tabSize:r,insertSpaces:s,eol:l})[0]:Sb(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,[An.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=>{rL.LineBreakInsert.runEditorCommand(s,this.editor,null)})),this.editor.setPosition(r),this.commandService.executeCommand(yle.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):dho)}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 $e;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 N=k.variableName;N||(N=o.getLineContent(k.range.startLineNumber).substring(k.range.startColumn-1,k.range.endColumn-1));let O=await p(N,k.caseSensitiveLookup);O&&(T=id(e,N,O));break}case"expression":{let N=k.expression;if(N||(N=o.getLineContent(k.range.startLineNumber).substring(k.range.startColumn-1,k.range.endColumn-1)),N){let O=new Jc(N);await O.evaluate(i.thread.session,i,"watch",!0),O.available&&(T=id(e,N,O.value))}break}}if(T){let N=k.range.startLineNumber,O=f.get(N);O||(O=[],f.set(N,O)),O.some(V=>V.text===T)||O.push(new CEi(k.range.startColumn,T))}}},w=>{ss(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),N=Math.floor((k-50)/T.typicalHalfwidthCharacterWidth);l.push(...rhe(y,w,"debug",void 0,N))}})}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(mo);this._wordToLineNumbersMap??=new xEi(o);for(let w of S)this._wordToLineNumbersMap.ensureRangePopulated(w);let y=dYo(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:N,value:O}of k)T.has(N)||T.set(N,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 rhe(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=Ue(this.toDispose)}};I([mi],U3.prototype,"showHoverScheduler",1),I([mi],U3.prototype,"removeInlineValuesScheduler",1),I([mi],U3.prototype,"updateInlineValuesScheduler",1),U3=I([m(1,Li),m(2,F),m(3,ge),m(4,B),m(5,oi),m(6,dt),m(7,X),m(8,zt),m(9,jg),m(10,ee)],U3);var xEi=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||(uYo(this.model,e,this.value),this.intervals[t]|=o)}}};qe.registerCommand("_executeInlineValueProvider",async(a,i,e,t)=>{if(So(A.isUri(i)),So(z.isIRange(e)),!t||typeof t.frameId!="number"||!z.isIRange(t.stoppedLocation))throw Br("context");let o=a.get(Ct).getModel(i);if(!o)throw Br("uri");let n=z.lift(e),{inlineValuesProvider:r}=a.get(zt),s=r.ordered(o);return(await Promise.all(s.map(c=>c.provideInlineValues(o,n,t,ve.None)))).flat().filter(mo)});var DUt=class{constructor(i,e){this.column=i;this.text=e}},u0=class extends C{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 vt;this.currentCancellationTokenSources=new vt;this._register(this.notebookExecutionStateService.onDidChangeExecution(async l=>{this.configurationService.getValue(ft.notebookInlineValues)!=="off"&&l.type===0&&await this.updateInlineVariables(l)})),this._register(H.runAndSubscribe(this.configurationService.onDidChangeConfiguration,l=>{(!l||l.affectsConfiguration(ft.notebookInlineValues))&&this.configurationService.getValue(ft.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 $e);let n=this.currentCancellationTokenSources.get(t.uri).token;if(this.debugService.state!==0){this._clearNotebookInlineDecorations();return}if(!this.notebookEditor.textModel?.uri||!Xe(this.notebookEditor.textModel.uri,e.notebook))return;let r=await t.resolveTextModel();if(!r)return;let s=this.configurationService.getValue(ft.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(N=>N.type==="variable")){if(!this.notebookEditor.hasModel())return;let N=k.selected?.provideVariables(e.notebook,void 0,"named",0,n);if(N)for await(let O of N)T.push(O)}for(let N of y){let O;switch(N.type){case"text":O=N.text;break;case"variable":{let V=N.variableName;if(!V)continue;let U=T.find(G=>G.name===V)?.value;if(!U)continue;O=id("{0} = {1}",V,U);break}case"expression":continue}if(O){let V=N.range.startLineNumber,U=f.get(V);U||(U=[],f.set(V,U)),U.some(G=>G.text===O)||U.push(new DUt(N.range.startColumn,O))}}},y=>{ss(y)}));await Promise.all(b),f.forEach((S,y)=>{if(S.length>0){S.sort((N,O)=>N.column-O.column);let w=S.map(N=>N.text).join(", "),k=t.layoutInfo.editorWidth,T=t.layoutInfo.fontInfo;if(T&&t.textModel){let N=Math.floor((k-50)/T.typicalHalfwidthCharacterWidth),O=t.textModel.getLineLength(y),V=Math.max(0,N-O);c.push(...rhe(y,w,"nb",void 0,V))}else c.push(...rhe(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()>u0.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"),N=null,O=!1,V=f.getValue().split(`
`);for(let U=V.length-1;U>=0;U--){let G=V[U],$;for(;($=T.exec(G))!==null;){let te=$.index,pe=new Ie(U+1,te+1);if(!this.isPositionInRanges(pe,y)){N={line:U+1,column:te+1},O=!0;break}}if(O)break}if(N){let U=k+" = "+h.find($=>$.name===k)?.value,G=w.get(N.line);G||(G=[],w.set(N.line,G)),G.some($=>$.text===U)||G.push(new DUt(N.column,U))}v.add(k)}w.forEach((k,T)=>{if(k.length>0){k.sort((U,G)=>U.column-G.column);let N=k.map(U=>U.text).join(", "),O=t.layoutInfo.editorWidth,V=t.layoutInfo.fontInfo;if(V&&t.textModel){let U=Math.floor((O-50)/V.typicalHalfwidthCharacterWidth),G=t.textModel.getLineLength(T),$=Math.max(0,U-G);c.push(...rhe(T,N,"nb",void 0,$))}else c.push(...rhe(T,N,"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>u0.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()}};u0=I([m(1,Tl),m(2,rs),m(3,zt),m(4,B),m(5,Li)],u0);tm(u0.id,u0);W(class extends qu{constructor(){super({id:"notebook.clearAllInlineValues",title:d(11717,null)})}runWithContext(i,e){return e.notebookEditor.getContribution(u0.id).clearNotebookInlineDecorations(),Promise.resolve()}});var pYo="notebook.clearAllCellsOutputs",mYo="notebook.cell.edit",hYo="notebook.cell.delete",uho="notebook.quitEditAllCells",gYo="notebook.cell.clearOutputs",kEi="notebook.selectIndentation",fYo="notebook.commentSelectedCells";W(class extends gd{constructor(){super({id:mYo,title:d(11791,null),keybinding:{when:x.and($u,x.not(Uu),ue.hoverFocused.toNegated(),yZ.toNegated()),primary:3,weight:200},menu:{id:D.NotebookCellTitle,when:x.and(Kl.isEqualTo(!0),hS.isEqualTo("markup"),wZ.toNegated(),bw),order:1,group:VF},icon:Yao})}async runWithContext(i,e){if(!e.notebookEditor.hasModel())return;await e.notebookEditor.focusNotebookCell(e.cell,"editor");let t=e.cell?xZ(e,e.cell):void 0;t&&t.hasTextFocus()&&_m.get(t)?.getWidgetPosition()?.lineNumber===t.getPosition()?.lineNumber&&_m.get(t)?.focus()}});var pho=x.and(rr,$h,Y4.toNegated());W(class extends gd{constructor(){super({id:udi,title:d(11792,null),menu:{id:D.NotebookCellTitle,when:x.and(hS.isEqualTo("markup"),wZ,bw),order:4,group:VF},icon:Xao,keybinding:[{when:x.and(pho,ue.hoverVisible.toNegated(),ue.hasNonEmptySelection.toNegated(),ue.hasMultipleSelections.toNegated()),primary:9,weight:rf-5},{when:x.and(rr,PR),primary:9,weight:205},{when:x.and(pho,hS.isEqualTo("markup")),primary:259,win:{primary:2563},weight:rf-5}]})}async runWithContext(i,e){e.cell.cellKind===1&&e.cell.updateEditState(0,udi),await e.notebookEditor.focusNotebookCell(e.cell,"container",{skipReveal:!0})}});W(class extends qu{constructor(){super({id:uho,title:d(11793,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,uho)}),o&&await e.notebookEditor.focusNotebookCell(o,"container",{skipReveal:!0})}});W(class extends gd{constructor(){super({id:hYo,title:d(11790,null),keybinding:{primary:20,mac:{primary:2049},when:x.and(rr,x.not(Uu),yZ.toNegated()),weight:200},menu:[{id:D.NotebookCellDelete,when:Kl,group:VF},{id:D.InteractiveCellDelete,group:VF}],icon:jao})}async runWithContext(i,e){if(!e.notebookEditor.hasModel())return;let t,n=i.get(rs).getCellExecution(e.cell.uri)?.state,r=i.get(B);if(n===3&&r.getValue(ft.confirmDeleteRunningCell)){let s=i.get(ct),l=d(11779,null);t=await s.confirm({type:"question",message:d(11780,null),primaryButton:l,checkbox:{label:d(11782,null)}})}else t={confirmed:!0};t.confirmed&&(t.checkboxChecked===!0&&await r.updateValue(ft.confirmDeleteRunningCell,!1),Pco(e.notebookEditor,e.cell))}});W(class extends gd{constructor(){super({id:gYo,title:d(11777,null),menu:[{id:D.NotebookCellTitle,when:x.and(hS.isEqualTo("code"),wyi,gk,Kl,bw,WJe.toNegated()),order:6,group:zao},{id:D.NotebookOutputToolbar,when:x.and(gk,Kl,bw,bWt,WJe)}],keybinding:{when:x.and(rr,x.not(Uu),gk,Kl,bw),primary:532,weight:200},icon:xyi})}async runWithContext(i,e){let t=i.get(rs),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 qu{constructor(){super({id:pYo,title:d(11776,null),precondition:yWt,menu:[{id:D.EditorTitle,when:x.and(Ua,x.notEquals("config.notebook.globalToolbar",!0)),group:"navigation",order:0},{id:D.NotebookToolbar,when:x.and(wyi,x.equals("config.notebook.globalToolbar",!0)),group:"navigation/execute",order:10}],icon:xyi})}async runWithContext(i,e){let t=i.get(rs),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(u0.id).clearNotebookInlineDecorations()}});W(class extends gd{constructor(){super({id:AEt,title:d(11775,null),keybinding:{weight:200,primary:Ai(2089,43),when:x.and(rr,Kl,bw)},metadata:{description:d(11775,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(kt),r=i.get(Ct),s=i.get(Ge),l=i.get(eS),c=i.get(Tl),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(11785,null,b):S=d(11786,null,b);let y=n.getLanguageName(b);if(!y)return;let w={label:y,iconClasses:js(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(11774,null)},g=[h,{type:"separator",label:d(11787,null)},...t,{type:"separator"},...o],f=await s.pick(g,{placeHolder:d(11796,null)}),v=f===h?await l.detectLanguage(e.cell.uri):f?.languageId;v&&await this.setLanguage(e,v)}async setLanguage(i,e){await mho(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 gd{constructor(){super({id:T8e,title:L(11781,"Accept Detected Language for Cell"),f1:!0,precondition:x.and(Kl,bw),keybinding:{primary:1570,weight:200}})}async runWithContext(i,e){let t=i.get(eS),o=i.get(Ne),s=[...i.get(Tl).getSelectedOrSuggestedKernel(e.notebookEditor.textModel)?.supportedLanguages??[]];s.push("markdown");let l=await t.detectLanguage(e.cell.uri,s);l?mho(l,e):o.warn(d(11788,null))}});async function mho(a,i){if(a==="markdown"&&i.cell?.language!=="markdown"){let e=i.notebookEditor.getCellIndex(i.cell);await SMe(1,{cell:i.cell,notebookEditor:i.notebookEditor,ui:!0},"markdown",Zn.markdown);let t=i.notebookEditor.cellAt(e);t&&await i.notebookEditor.focusNotebookCell(t,"editor")}else if(a!=="markdown"&&i.cell?.cellKind===1)await SMe(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 qu{constructor(){super({id:kEi,title:L(11797,"Select Indentation"),f1:!0,precondition:x.and(Ua,Kl,bw)})}async runWithContext(i,e){await this.showNotebookIndentationPicker(i,e)}async showNotebookIndentationPicker(i,e){let t=i.get(Ge),o=i.get(ee),n=i.get(F),r=qn(o.activeEditorPane);if(!r||r.isDisposed)return t.pick([{label:d(11789,null)}]);if(r.isReadOnly)return t.pick([{label:d(11794,null)}]);let s=[new Ett,new Ttt,new _tt,new Ltt,new Dtt].map(c=>({id:c.desc.id,label:c.desc.title.toString(),run:()=>{n.invokeFunction(c.run)}}));s.splice(3,0,{type:"separator",label:d(11783,null)}),s.unshift({type:"separator",label:d(11784,null)});let l=await t.pick(s,{placeHolder:d(11795,null),matchOnDetail:!0});l&&(l.run(),e.notebookEditor.focus())}});W(class extends xg{constructor(){super({id:fYo,title:d(11778,null),keybinding:{when:x.and(rr,Kl,x.not(Uu)),primary:2138,weight:200}})}async runWithContext(i,e){let t=i.get(bs);e.selectedCells.forEach(async o=>{let n=await o.resolveTextModel(),r=o.commentOptions,s=new oCe(t,new Yt(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));V9.executeCommands(n,l,[s]);let u=c.map(p=>n._getTrackedRange(p)).filter(p=>!!p).map(p=>new Yt(p.startLineNumber,p.startColumn,p.endLineNumber,p.endColumn));o.setSelections(u??[])})}});qe.registerCommand("_resolveNotebookContentProvider",a=>a.get(un).getContributedNotebookTypes().map(t=>{let o=t.selectors.map(n=>typeof n=="string"||eP(n)?n:pkt(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}}}));qe.registerCommand("_resolveNotebookKernels",async(a,i)=>{let e=a.get(Tl),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}))});var vYo=5e3,bYo=1e3,SYo=200,JAe=class extends C{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(11248,null)})`,t.title=d(11246,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):Hr(u)}}return t.value="",t.placeholder=d(11234,null),t.busy=!0,n}async _getArg(e,t,o,n){let{quickPick:r}=this,s=new P,l=Le(this,r.value),c=[{name:d(11245,null),observer:this._promptCompletions(e,l,o)},{name:d(11236,null),observer:this._activeFileCompletions()},{name:d(11240,null),observer:this._fileCompletions(l)}];s.add(he(u=>{if(t){l.read(u);return}let p=[];p.push({id:"insert-text",label:d(11239,null),iconClass:q.asClassName(M.textSize),action:"text",alwaysShow:!0}),p.push({id:"run-command",label:d(11237,null),description:d(11238,null),iconClass:q.asClassName(M.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(11241,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 $e;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:Hr(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(aS);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:Ye(l.resource),description:this._labelService.getUriLabel(l.resource),iconClasses:js(this._modelService,this._languageService,l.resource),uri:l.resource,action:"file"}))})}_activeFileCompletions(){let e=Nr(this,this._editorService.onDidActiveEditorChange),t=Ce(r=>(e.read(r),this._codeEditorService.getActiveCodeEditor())),o=t.map(r=>r?Nr(this,r.onDidChangeModel).map(()=>r.getModel()?.uri):void 0).map((r,s)=>r?.read(s)),n=t.map(r=>r?Nr(this,r.onDidChangeCursorSelection).map(()=>({range:r.getSelection(),model:r.getModel()})):void 0).map((r,s)=>r?.read(s));return Ce(r=>{let s=o.read(r);if(!s)return{busy:!1,picks:[]};let l=[];l.push({id:"active-file",label:d(11235,null),description:this._labelService.getUriLabel(s),iconClasses:js(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(11244,null,c.range.startLineNumber):d(11243,null,p);l.push({id:"selected-text",label:d(11242,null),description:h,selectedText:u,iconClass:q.asClassName(M.selection),uri:s,action:"selectedText"})}return{picks:l,busy:!1}})}_asyncCompletions(e,t){return Ce(n=>{let r=e.read(n),s=new $e;return n.store.add(Z(()=>s.dispose(!0))),new Au(Pi(SYo,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(11247,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 P;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(nn(()=>{r.dispose(),s(this._getTerminalOutputInner(o,e,void 0,t))},vYo))})}async _getTerminalOutputInner(e,t,o,n){let r=new P;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),bYo));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()})}};JAe=I([m(1,Ge),m(2,Yo),m(3,Jp),m(4,Pe),m(5,ot),m(6,be),m(7,Ct),m(8,kt),m(9,jl),m(10,F),m(11,Kt),m(12,ee)],JAe);var ZAe=class extends Ma{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(13156,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 D1(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:()=>ML(this.keybindingService),inputBoxStyles:e.inputBoxStyles},this.contextKeyService)),this._register(this.inputBox.onDidChange(()=>this._onSubmit.fire(!0))),this.inputFocusTracker=Vn(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}}};ZAe=I([m(3,X),m(4,B),m(5,_e)],ZAe);var Tte=class extends ZAe{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 Kh({icon:M.book,title:d(13157,null),isChecked:!1,...qg})),this._register(this.useSearchInEditorsBox.onChange(t=>{this._onChangeSearchInEditorsBoxEmitter.fire(),t||this.inputBox.focus()})),e.appendChild(this.useSearchInEditorsBox.domNode),super.renderSubcontrols(e)}};Tte=I([m(3,X),m(4,B),m(5,_e)],Tte);var _te=class extends ZAe{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 Kh({icon:M.exclude,actionClassName:"useExcludesAndIgnoreFiles",title:d(13158,null),isChecked:!0,...qg})),this._register(this.useExcludesAndIgnoreFilesBox.onChange(t=>{this._onChangeIgnoreBoxEmitter.fire(),t||this.inputBox.focus()})),e.appendChild(this.useExcludesAndIgnoreFilesBox.domNode),super.renderSubcontrols(e)}};_te=I([m(3,X),m(4,B),m(5,_e)],_te);var she=Re("search-details",M.ellipsis,d(13358,null)),hho=Re("search-see-more",M.goToSearch,d(13367,null)),gho=Re("search-show-context",M.listSelection,d(13370,null)),LUt=Re("search-hide-replace",M.chevronRight,d(13360,null)),EEi=Re("search-show-replace",M.chevronDown,d(13371,null)),fho=Re("search-replace-all",M.replaceAll,d(13365,null)),RUt=Re("search-replace",M.replace,d(13366,null)),vho=Re("search-remove",M.close,d(13364,null)),MUt=Re("search-refresh",M.refresh,d(13363,null)),bho=Re("search-collapse-results",M.collapseAll,d(13357,null)),Sho=Re("search-expand-results",M.expandAll,d(13359,null)),Iho=Re("search-tree",M.listTree,d(13369,null)),yho=Re("search-list",M.listFlat,d(13368,null)),who=Re("search-clear-results",M.clearAll,d(13356,null)),Cho=Re("search-stop",M.searchStop,d(13374,null)),TEi=Re("search-view-icon",M.searchLarge,d(13375,null)),xho=Re("search-new-editor",M.newFile,d(13361,null)),kho=Re("search-open-in-file",M.goToFile,d(13362,null)),C2p=Re("search-sparkle-filled",M.sparkleFilled,d(13373,null)),x2p=Re("search-sparkle-empty",M.sparkle,d(13372,null));var PUt=(a,i,e,t,o,n,r)=>{let s=_("div.providerMessage"),l=lS(a.text);R(s,_("."+Px.className(a.type===1?gt.Info:gt.Warning).split(" ").join(".")));for(let c of l.nodes)if(typeof c=="string")R(s,document.createTextNode(c));else{let u=i.createInstance(Xg,s,c,{opener:async p=>{if(!a.trusted)return;let h=A.parse(p,!0);h.scheme===Y.command&&a.trusted?(await o.executeCommand(h.path))?.triggerSearch&&r():h.scheme===Y.https?t.open(h):h.scheme===Y.command&&!a.trusted?e.error(d(13377,null,p)):e.error(d(13376,null,p))}});n.add(u)}return s};function z3(a,i){do if(i.includes(a))return!0;while(!wA(a.parent())&&(a=a.parent()));return!1}var Eho="plainTextSearch",Tho="aiTextSearch";function _Ei(a){let i=[],e=a;for(;!jf(e);)i.push(e),e=e.parent();return i}var _ho="SEARCH_MODEL_",DEi="SEARCH_RESULT_",eNe="TEXT_SEARCH_HEADING_",Qtt="FOLDER_MATCH_",Ytt="FILE_MATCH_",Xtt="MATCH_";function AUt(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 wA(a){return typeof a=="object"&&a!==null&&typeof a.id=="function"&&a.id().startsWith(DEi)}function jf(a){return typeof a=="object"&&a!==null&&typeof a.id=="function"&&a.id().startsWith(eNe)}function Dho(a){return jf(a)&&typeof a.replace=="function"&&typeof a.replaceAll=="function"}function bd(a){return typeof a=="object"&&a!==null&&typeof a.id=="function"&&a.id().startsWith(Qtt)}function K3(a){return bd(a)&&a.resource instanceof A}function _2(a){return K3(a)&&typeof a.createAndConfigureFileMatch=="function"}function p0(a){return bd(a)&&typeof a.createAndConfigureFileMatch=="function"}function fl(a){return typeof a=="object"&&a!==null&&typeof a.id=="function"&&a.id().startsWith(Ytt)}function Ka(a){return typeof a=="object"&&a!==null&&typeof a.id=="function"&&a.id().startsWith(Xtt)}function Lho(a){return typeof a=="object"&&a!==null&&typeof a.id=="function"&&a.id().startsWith(eNe)}function Jtt(a){let i=[],e=[];return a.forEach(t=>{fl(t)?e.push(t):i.push(t)}),e.concat(i.map(t=>t.allDownstreamFileMatches()).flat())}function Ztt(a){return a&&a.getFullRange&&a.getFullRange()instanceof z}var eit=class a{static{this.ITEM_HEIGHT=22}getHeight(i){return a.ITEM_HEIGHT}getTemplateId(i){if(bd(i))return $3.TEMPLATE_ID;if(fl(i))return q3.TEMPLATE_ID;if(Ka(i))return j3.TEMPLATE_ID;if(jf(i))return G3.TEMPLATE_ID;throw console.error("Invalid search tree element",i),new Error("Invalid search tree element")}},G3=class extends C{constructor(e,t,o,n){super();this.labels=e;this.contextService=t;this.instantiationService=o;this.contextKeyService=n;this.templateId=G3.TEMPLATE_ID}static{this.TEMPLATE_ID="textResultMatch"}renderTemplate(e){let t=new P,o=R(e,_(".textsearchresult")),n=this.labels.create(o,{supportDescriptionHighlights:!0,supportHighlights:!0,supportIcons:!0});t.add(n);let r=R(o,_(".actionBarContainer")),s=t.add(this.contextKeyService.createScoped(e)),l=t.add(this.instantiationService.createChild(new Io([X,s]))),c=t.add(l.createInstance(Ln,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(Dho(e.element))o.label.setLabel(d(13389,null)),Ci.AIResultsTitle.bindTo(o.contextKeyService).set(!1),Ci.MatchFocusKey.bindTo(o.contextKeyService).set(!1),Ci.FileFocusKey.bindTo(o.contextKeyService).set(!1),Ci.FolderFocusKey.bindTo(o.contextKeyService).set(!1);else{try{await e.element.parent().searchModel.getAITextResultProviderName()}catch{}let n=d(13387,null);o.label.setLabel(`$(${M.searchSparkle.id}) ${n}`),Ci.AIResultsTitle.bindTo(o.contextKeyService).set(!0),Ci.MatchFocusKey.bindTo(o.contextKeyService).set(!1),Ci.FileFocusKey.bindTo(o.contextKeyService).set(!1),Ci.FolderFocusKey.bindTo(o.contextKeyService).set(!1)}}disposeTemplate(e){e.disposables.dispose()}renderCompressedElements(e,t,o){}};G3=I([m(1,Pe),m(2,F),m(3,X)],G3);var $3=class extends C{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=$3.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=_2(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(13388,null));this.renderFolderDetails(r,o)}renderTemplate(e){let t=new P,o=R(e,_(".foldermatch")),n=this.labels.create(o,{supportDescriptionHighlights:!0,supportHighlights:!0});t.add(n);let r=new fv(R(o,_(".badge")),{},BS);t.add(r);let s=R(o,_(".actionBarContainer")),l=new P;t.add(l);let c=t.add(this.contextKeyService.createScoped(e));Ci.AIResultsTitle.bindTo(c).set(!1),Ci.MatchFocusKey.bindTo(c).set(!1),Ci.FileFocusKey.bindTo(c).set(!1),Ci.FolderFocusKey.bindTo(c).set(!0);let u=t.add(this.instantiationService.createChild(new Io([X,c]))),p=t.add(u.createInstance(Ln,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&&Xe(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(13388,null));Ci.IsEditableItemKey.bindTo(o.contextKeyService).set(!n.hasOnlyReadOnlyMatches()),o.elementDisposables.add(n.onChange(()=>{Ci.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(13386,null,o):d(13385,null,o)),t.actions.context={viewer:this.searchView.getControl(),element:e}}};$3=I([m(2,Pe),m(3,ot),m(4,F),m(5,X)],$3);var q3=class extends C{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=q3.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 P,o=new P;t.add(o);let n=R(e,_(".filematch")),r=this.labels.create(n);t.add(r);let s=new fv(R(n,_(".badge")),{},BS);t.add(s);let l=R(n,_(".actionBarContainer")),c=t.add(this.contextKeyService.createScoped(e));Ci.AIResultsTitle.bindTo(c).set(!1),Ci.MatchFocusKey.bindTo(c).set(!1),Ci.FileFocusKey.bindTo(c).set(!0),Ci.FolderFocusKey.bindTo(c).set(!1);let u=t.add(this.instantiationService.createChild(new Io([X,c]))),p=t.add(u.createInstance(Ln,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:Ztt(n)?n.getFullRange():void 0,hidePath:this.searchView.isTreeLayoutViewVisible&&!p0(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(13391,null,s):d(13390,null,s)),o.actions.context={viewer:this.searchView.getControl(),element:n},Ci.IsEditableItemKey.bindTo(o.contextKeyService).set(!n.hasOnlyReadOnlyMatches()),o.elementDisposables.add(n.onChange(()=>{Ci.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()}};q3=I([m(2,Pe),m(3,B),m(4,F),m(5,X)],q3);var j3=class extends C{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=j3.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=R(e,_("span.matchLineNum")),o=R(e,_("a.plain.match")),n=R(o,_("span")),r=R(o,_("span.findInFileMatch")),s=R(o,_("span.replaceMatch")),l=R(o,_("span")),c=R(e,_("span.actionBarContainer")),u=new P,p=u.add(this.contextKeyService.createScoped(e));Ci.AIResultsTitle.bindTo(p).set(!1),Ci.MatchFocusKey.bindTo(p).set(!0),Ci.FileFocusKey.bindTo(p).set(!1),Ci.FolderFocusKey.bindTo(p).set(!1);let h=u.add(this.instantiationService.createChild(new Io([X,p]))),g=u.add(h.createInstance(Ln,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(Ni("mouse"),o.parent,l)),Ci.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(Ni("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(13380,null,o,n)+" ":"",s=n>0?"+ "+d(13381,null,n):"";return r+s}};j3=I([m(1,Pe),m(2,B),m(3,F),m(4,X),m(5,tt)],j3);var tNe=class{constructor(i,e){this.searchView=i;this.labelService=e}getWidgetAriaLabel(){return d(13384,null)}getAriaLabel(i){if(bd(i)){let e=i.allDownstreamFileMatches().reduce((t,o)=>t+o.count(),0);return i.resource?d(13379,null,e,i.name()):d(13382,null,e)}if(fl(i)){let e=this.labelService.getUriLabel(i.resource,{relative:!0})||i.resource.fsPath;return d(13378,null,i.count(),i.name(),wc(e))}if(Ka(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(13383,null,s,r.startColumn,n,e.replaceString):d(13392,null,s,r.startColumn,n)}return null}};tNe=I([m(1,ot)],tNe);function Dte(a){return a&&typeof a.bindNotebookEditorWidget=="function"&&typeof a.updateMatchesForEditorWidget=="function"&&typeof a.unbindNotebookEditorWidget=="function"&&typeof a.updateNotebookHighlights=="function"&&fl(a)}function VB(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 LEi=-1,REi=-1;function CA(a,i,e="default"){if(fl(a)&&bd(i))return 1;if(fl(i)&&bd(a))return-1;if(bd(a)&&bd(i)){if(LEi=a.index(),REi=i.index(),LEi!==-1&&REi!==-1)return LEi-REi;if(Ztt(a)&&Ztt(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 kfi(a.name(),i.name());case"fileNames":return jE(a.name(),i.name());default:return!a.resource||!i.resource?0:lJ(a.resource.fsPath,i.resource.fsPath)||jE(a.name(),i.name())}}if(fl(a)&&fl(i))switch(e){case"countDescending":return i.count()-a.count();case"countAscending":return a.count()-i.count();case"type":return kfi(a.name(),i.name());case"fileNames":return jE(a.name(),i.name());case"modified":{let t=a.fileStat,o=i.fileStat;if(t&&o)return o.mtime-t.mtime}default:return lJ(a.resource.fsPath,i.resource.fsPath)||jE(a.name(),i.name())}return VB(a)&&VB(i)?IYo(a,i):Ka(a)&&Ka(i)?z.compareRangesUsingStarts(a.range(),i.range()):0}function IYo(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 NUt(a,i,e="default"){let t=_Ei(a),o=_Ei(i),n=t.length-1,r=o.length-1;for(;n>=0&&r>=0;){if(t[n].id()!==o[r].id())return CA(t[n],o[r],e);n--,r--}let s=n===0,l=r===0;return s&&!l?1:!s&&l?-1:0}var vl=L(13300,"Search");function Rho(a){let i=Pc(a);return!!(i&&ts(i.getContainer()))}function Pc(a){return a.getActiveViewWithId(ny)}function tit(a,i,e){let t=a.getSelection().filter(o=>o!==null).sort((o,n)=>NUt(o,n,e.sortOrder));return i&&!(t.length>1&&t.includes(i))&&(t=[i]),t}function Mho(a,i){return i?!i||a.includes(i)||yYo(a,i):!1}function yYo(a,i){for(let e of a)if(fl(e)&&Ka(i)&&e.matches().includes(i)||bd(e)&&(fl(i)&&e.getDownstreamFileMatch(i.resource)||Ka(i)&&e.getDownstreamFileMatch(i.parent().resource)))return!0;return!1}function Q3(a,i){return a.openView(ny,i).then(e=>e??void 0)}var _b=new Q("inSearchEditor",!1),iNe="search-editor",OUt="search/editor",PEi="searchEditorFindMatch",iit="workbench.editor.searchEditor",Pho="search.action.openNewEditor",ahe="search.action.openEditor",FUt="toggleSearchEditorContextLines",oit="workbench.editorinputs.searchEditorInput";var oNe=class extends C{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 wYo=d(11675,null),CYo=d(11688,null),xYo=d(11677,null),kYo=d(11676,null),EYo=d(11682,null),TYo=d(11674,null),_Yo=d(11681,null),DYo=d(11678,null),LYo=d(11689,null),RYo=d(11680,null),MYo=d(11679,null),_$p=Re("find-filter",M.filter,d(11673,null)),PYo=d(11683,null),AYo=d(11686,null),NYo=d(11687,null),OYo=d(11684,null),FYo=d(11685,null),nNe=419,Aho=4,nit=class extends wp{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:AYo,run:async()=>{this.filters.markupInput=!this.filters.markupInput},tooltip:""},t={checked:this.filters.markupPreview,class:void 0,enabled:!0,id:"findInMarkdownInput",label:NYo,run:async()=>{this.filters.markupPreview=!this.filters.markupPreview},tooltip:""},o={checked:this.filters.codeInput,class:void 0,enabled:!0,id:"findInCodeInput",label:OYo,run:async()=>{this.filters.codeInput=!this.filters.codeInput},tooltip:""},n={checked:this.filters.codeOutput,class:void 0,enabled:!0,id:"findInCodeOutput",label:FYo,run:async()=>{this.filters.codeOutput=!this.filters.codeOutput},tooltip:"",dispose:()=>null};return cbe?[e,o]:[e,t,new li,o,n]}updateChecked(){this.element.classList.toggle("checked",this._action.checked)}};nit=I([m(4,ze)],nit);var rit=class extends C{constructor(e,t,o,n,r=PYo){super();this.filters=e;this.contextMenuService=t;this.instantiationService=o;this._actionbar=null;this._toggleStyles=n.toggleStyles,this._filtersAction=this._register(new st("notebookFindFilterAction",r,"notebook-filters "+q.asClassName(MWt))),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 ji(e,{actionViewItemProvider:(t,o)=>{if(t.id===this._filtersAction.id)return this.instantiationService.createInstance(nit,this.filters,t,o,this._register(new as))}})),this._actionbar.push(this._filtersAction,{icon:!0,label:!1})}},NEi=class extends _1{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(qM(t,this.inputBox)),this._findFilter=this._register(new rit(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 hl(e.getActions({shouldForwardArgs:!0}),t=>/^inline/.test(t))}},rNe=class extends Ma{constructor(e,t,o,n,r,s,l=new G1,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=nNe;this._isVisible=!1;this._isReplaceVisible=!1;this.foundMatch=!1;this.cellSelectionDecorationIds=[];this.textSelectionDecorationIds=[];this._register(this._state);let h=this._configurationService.getValue(ft.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 oNe(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(H.runAndSubscribe(this._configurationService.onDidChangeConfiguration,w=>{(!w||w.affectsConfiguration(ft.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 fb(v,kx)),this._domNode.appendChild(v);let b=t.getContextKeyValue("notebookType")==="interactive",S={groupId:"simple-find-widget"};this._toggleReplaceBtn=this._register(new KS({label:_Yo,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 NEi(this._filters,this._scopedContextKeyService,this.contextMenuService,this.instantiationService,null,this._contextViewService,{label:wYo,placeholder:CYo,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:pl,toggleStyles:qg,history:g==="workspace"?this._findWidgetSearchHistory:new Set([])})),this._updateFindHistoryDelayer=new jo(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 KS({label:xYo,icon:k5e,hoverLifecycleOptions:S,onTrigger:()=>{this.find(!0)}},s)),this.nextBtn=this._register(new KS({label:kYo,icon:E5e,hoverLifecycleOptions:S,onTrigger:()=>{this.find(!1)}},s)),this.inSelectionToggle=this._register(new Kh({icon:Soi,title:EYo,isChecked:!1,hoverLifecycleOptions:S,inputActiveOptionBackground:wt(dW),inputActiveOptionBorder:wt(cW),inputActiveOptionForeground:wt(V$)})),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(N=>N.end-N.start>1)?(this._filters.findScope={findScopeType:"cells",selectedCellRanges:k},this.setCellSelectionDecorations()):T.length>1||T.some(N=>N.endLineNumber-N.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 KS({label:TYo,icon:lE,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(Vn(this._domNode)),this._register(this._focusTracker.onDidFocus(this.onFocusTrackerFocus.bind(this))),this._register(this._focusTracker.onDidBlur(this.onFocusTrackerBlur.bind(this))),this._findInputFocusTracker=this._register(Vn(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 R1(null,void 0,{label:DYo,placeholder:LYo,history:f==="workspace"?this._replaceWidgetHistory:new Set([]),inputBoxStyles:pl,toggleStyles:qg,hoverLifecycleOptions:S},t,!1)),this._innerReplaceDomNode.appendChild(this._replaceInput.domNode),this._replaceInputFocusTracker=this._register(Vn(this._replaceInput.domNode)),this._register(this._replaceInputFocusTracker.onDidFocus(this.onReplaceInputFocusTrackerFocus.bind(this))),this._register(this._replaceInputFocusTracker.onDidBlur(this.onReplaceInputFocusTrackerBlur.bind(this))),this._updateReplaceHistoryDelayer=new jo(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 KS({label:RYo,icon:Ioi,hoverLifecycleOptions:S,onTrigger:()=>{this.replaceOne()}},s)),this._replaceAllBtn=this._register(new KS({label:MYo,icon:yoi,hoverLifecycleOptions:S,onTrigger:()=>{this.replaceAll()}},s)),this._innerReplaceDomNode.appendChild(this._replaceBtn.domNode),this._innerReplaceDomNode.appendChild(this._replaceAllBtn.domNode),this._resizeSash=this._register(new pv(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<nNe&&(k=nNe);let T=this._getMaxWidth();k>T&&(k=T),this._domNode.style.width=`${k}px`,this._isReplaceVisible&&(this._replaceInput.width=yl(this._findInput.domNode)),this._findInput.inputBox.layout()})),this._register(this._resizeSash.onDidReset(()=>{let w=this._getDomWidth(),k=nNe;w<=nNe&&(k=this._getMaxWidth()),this._domNode.style.width=`${k}px`,this._isReplaceVisible&&(this._replaceInput.width=yl(this._findInput.domNode)),this._findInput.inputBox.layout()}))}_getMaxWidth(){return this._notebookEditor.getLayoutInfo().width-64}_getDomWidth(){return yl(this._domNode)-Aho*2}getCellToolbarActions(e){return hl(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?VIt(this.replaceValue):S7.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=yl(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)}};rNe=I([m(0,_n),m(1,X),m(2,B),m(3,ze),m(4,F),m(5,tt)],rNe);is((a,i)=>{i.addRule(`
	.notebook-editor {
		--notebook-find-width: ${nNe}px;
		--notebook-find-horizontal-padding: ${Aho}px;
	}
	`)});var WUt=class extends L1{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 rit(l,r,s,o,d(13355,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 Who=26,sNe=class a extends st{constructor(e){super(a.ID,"",q.asClassName(fho),!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()}},OEi={groupId:"search-widget"},Nho=it?256:2048;function Oho(a,i,e){let t=!!i.match(/\n/);if(e&&(t||e.clientHeight>Who)&&e.selectionStart>0){a.stopPropagation();return}}function Fho(a,i,e){let t=!!i.match(/\n/);if(e&&(t||e.clientHeight>Who)&&e.selectionEnd<e.value.length){a.stopPropagation();return}}var jR=class extends Ma{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=Ci.ReplaceActiveKey.bindTo(this.contextKeyService),this.searchInputBoxFocused=Ci.SearchInputBoxFocusedKey.bindTo(this.contextKeyService),this.replaceInputBoxFocused=Ci.ReplaceInputBoxFocusedKey.bindTo(this.contextKeyService);let g=t.notebookOptions??{isInNotebookMarkdownInput:!0,isInNotebookMarkdownPreview:!0,isInNotebookCellInput:!0,isInNotebookCellOutput:!0};this._notebookFilters=this._register(new oNe(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 ha&&(f.event.kind===5||f.event.kind===6)&&(this.searchInput.filterVisible=this._hasNotebookOpen())})),this._replaceHistoryDelayer=new jo(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(13453,null)}static{this.REPLACE_ALL_ENABLED_LABEL=e=>e.appendKeybinding(d(13454,null),sNe.ID)}_hasNotebookOpen(){return this.editorService.editors.some(t=>t instanceof ha)}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(13452,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(13450,null,o),this._accessibilityHelpHintAnnounced=!0,this._labelResetTimeout?.dispose(),this._labelResetTimeout=nn(()=>{this.searchInput&&this.searchInput.inputBox.setAriaLabel(d(13452,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=R(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(13457,null),hoverDelegate:Ni("element")};this.toggleReplaceButton=this._register(new Mi(e,t)),this.toggleReplaceButton.element.setAttribute("aria-expanded","false"),this.toggleReplaceButton.element.classList.add("toggle-replace-button"),this.toggleReplaceButton.icon=LUt,this._toggleReplaceButtonListener.value=this.toggleReplaceButton.onDidClick(()=>this.onToggleReplaceButton())}renderSearchInput(e,t){let o=t.searchHistory||[],n={label:d(13452,null),validation:s=>this.validateSearchInput(s),placeholder:d(13455,null),appendCaseSensitiveLabel:this.keybindingService.appendKeybinding("","toggleSearchCaseSensitive"),appendWholeWordsLabel:this.keybindingService.appendKeybinding("","toggleSearchWholeWord"),appendRegexLabel:this.keybindingService.appendKeybinding("","toggleSearchRegex"),history:new Set(o),showHistoryHint:()=>ML(this.keybindingService),flexibleHeight:!0,flexibleMaxHeight:jR.INPUT_MAX_HEIGHT,showCommonFindToggles:!0,inputBoxStyles:t.inputBoxStyles,toggleStyles:t.toggleStyles,hoverLifecycleOptions:OEi},r=R(e,_(".search-container.input-box"));this.searchInput=this._register(new WUt(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(Vn(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 Kh({isChecked:!1,title:this.keybindingService.appendKeybinding(d(13458,null),FUt),icon:gho,hoverLifecycleOptions:OEi,...qg}),this._register(this.showContextToggle.onChange(()=>this.onContextLinesChanged())),t.showContextToggle&&(this.contextLinesInput=new Dc(r,this.contextViewService,{type:"number",inputBoxStyles:pl}),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()})),R(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=R(e,_(".replace-container.disabled"));let o=R(this.replaceContainer,_(".replace-input"));this.replaceInput=this._register(new R1(o,this.contextViewService,{label:d(13451,null),placeholder:d(13456,null),appendPreserveCaseLabel:this.keybindingService.appendKeybinding("","toggleSearchPreserveCase"),history:new Set(t.replaceHistory),showHistoryHint:()=>ML(this.keybindingService),flexibleHeight:!0,flexibleMaxHeight:jR.INPUT_MAX_HEIGHT,inputBoxStyles:t.inputBoxStyles,toggleStyles:t.toggleStyles,hoverLifecycleOptions:OEi},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 sNe(this),this.replaceAllAction.label=jR.REPLACE_ALL_DISABLED_LABEL,this.replaceActionBar=this._register(new ji(this.replaceContainer)),this.replaceActionBar.push([this.replaceAllAction],{icon:!0,label:!1}),this.onkeydown(this.replaceActionBar.domNode,n=>this.onReplaceActionbarKeyDown(n)),this.replaceInputFocusTracker=this._register(Vn(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(LUt)),this.toggleReplaceButton?.element.classList.add(...q.asClassNameArray(EEi))):(this.toggleReplaceButton?.element.classList.remove(...q.asClassNameArray(EEi)),this.toggleReplaceButton?.element.classList.add(...q.asClassNameArray(LUt))),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?jR.REPLACE_ALL_ENABLED_LABEL(this.keybindingService):jR.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(Nho|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))Oho(e,this.searchInput?.getValue()??"",this.searchInput?.domNode.querySelector("textarea")??null);else if(e.equals(18))Fho(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(Nho|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)?Oho(e,this.replaceInput?.getValue()??"",this.replaceInput?.domNode.querySelector("textarea")??null):e.equals(18)&&Fho(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")}};jR=I([m(2,_n),m(3,X),m(4,_e),m(5,Wi),m(6,B),m(7,Bi),m(8,ze),m(9,F),m(10,ee)],jR);function Vho(){yt.registerCommandAndKeybindingRule({id:sNe.ID,weight:200,when:x.and(Ci.SearchViewVisibleKey,Ci.ReplaceActiveKey,L3i),primary:2563,handler:a=>{let i=a.get(Ft);if(Rho(i)){let e=Pc(i);e&&new sNe(e.searchAndReplaceWidget).run()}}})}var fI=ae("replaceService");var aNe=ae("searchHistoryService"),xA=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(xA.SEARCH_HISTORY_KEY,1),this._onDidClearHistory.fire()}load(){let i,e=this.storageService.get(xA.SEARCH_HISTORY_KEY,1);if(e)try{i=JSON.parse(e)}catch{}return i||{}}save(i){mf(i)?this.storageService.remove(xA.SEARCH_HISTORY_KEY,1):this.storageService.store(xA.SEARCH_HISTORY_KEY,JSON.stringify(i),1,0)}};xA=I([m(0,le)],xA);var Bho=`
`,FEi=a=>i=>new z(i.startLineNumber+a,i.startColumn,i.endLineNumber+a,i.endColumn),WYo=(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 VYo(a,i){let e=a.textMatches().length>0?Hho(a.resource,a.textMatches().sort(CA),a.context,i):void 0,t=Dte(a)?a.cellMatches().sort((o,n)=>o.cellIndex-n.cellIndex).sort().filter(o=>o.contentMatches.length>0).map((o,n)=>BYo(o,i,n===0)):[];return[e,...t].filter(o=>!!o)}function Hho(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=>{WYo(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(FEi(l[g.lineNumber])))})});c.length;){let{line:h,lineNumber:g}=c.shift();r.push(`  ${g}  ${h}`)}return{text:r,matchRanges:s}}function BYo(a,i,e){return Hho(a.cell?.uri??a.parent.resource,a.contentMatches.sort(CA),a.context,i,e)}var HYo=(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}}),Uho=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: ${si([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(Bho);var WEi=()=>({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}}),UYo=a=>{let i=WEi(),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(13494,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},VUt=(a,i,e,t,o,n,r)=>{if(!a.query)throw Error("Internal Error: Expected query, got null");let s=HYo(a.query,i,e,t),l=a.fileCount()>1?d(13496,null,a.fileCount()):d(13498,null),c=a.count()>1?d(13497,null,a.count()):d(13499,null),u=[a.count()?`${c} - ${l}`:d(13495,null)];r&&u.push(d(13500,null)),u.push("");let p=(g,f)=>CA(g,f,n),h=zYo(a.folderMatches().sort(p).map(g=>g.allDownstreamFileMatches().sort(p).flatMap(f=>VYo(f,o))).flat());return{matchRanges:h.matchRanges.map(FEi(u.length)),text:u.concat(h.text).join(Bho),config:s}},zYo=a=>{let i=[],e=[];return a.forEach(t=>{t.matchRanges.map(FEi(i.length)).forEach(o=>e.push(o)),t.text.forEach(o=>i.push(o)),i.push("")}),{text:i,matchRanges:e}},BUt=async(a,i)=>{let t=(await a.get(Ho).read(i)).value;return VEi(t)},VEi=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:UYo(i),text:e.join(`
`)}};var lNe=class{constructor(i){this.config=i;this._onConfigDidUpdate=new E;this.onConfigDidUpdate=this._onConfigDidUpdate.event}updateConfig(i){this.config=i,this._onConfigDidUpdate.fire(i)}},HUt=class{constructor(i){this.resource=i}async resolve(){return Oi(cNe.models.get(this.resource)).resolve()}},BEi=class{constructor(){this.models=new vt}initializeModelFromExistingModel(i,e,t){if(this.models.has(e))throw Error("Unable to contruct model for resource that already exists");let o=i.get(kt),n=i.get(Ct),r=i.get(F),s=i.get(Gm),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(Vz),e),configurationModel:new lNe(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(kt),r=i.get(Ct),s=i.get(F),l=i.get(Gm),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(Vz),e),configurationModel:new lNe(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(kt),n=i.get(Ct),r=i.get(F),s=i.get(Gm),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(BUt,t);return{resultsModel:n.createModel(u??"",o.createById(Vz),e),configurationModel:new lNe(p)}})()),l)})}async tryFetchModelFromBackupService(i,e,t,o,n){let r=await o.resolve({resource:i,typeId:OUt}),s=t.getModel(i);if(!s&&r){let l=await W9(r.value);s=t.createModel(l,e.createById(Vz),i)}if(s){let l=s.getValue(),{text:c,config:u}=VEi(l);return t.destroyModel(i),{resultsModel:t.createModel(c??"",e.createById(Vz),i),configurationModel:new lNe(u)}}else return}},cNe=new BEi;var dNe=".code-search",KYo=Re("search-editor-label-icon",M.search,d(13491,null)),pp=class extends Us{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(HUt,e),this.modelUri.scheme!==iNe)throw Error("SearchEditorInput must be invoked with a SearchEditorScheme uri");this.memento=new Bl(pp.ID,p),this._register(p.onWillSaveState(()=>this.memento.saveMemento()));let h=this,g=new class{constructor(){this.typeId=OUt;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=oit}get typeId(){return pp.ID}get editorId(){return this.typeId}getIcon(){return KYo}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 Uho(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),!Xe(o,this.modelUri)){let r=this.instantiationService.invokeFunction(kA,{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=no.getOriginalUri(this);return d(13493,null,No((n??this.backingUri).path,dNe))}let o=this._cachedConfigurationModel?.config?.query?.trim();return o?d(13493,null,t(o)):d(13492,null)}setDirty(e){let t=this.dirty;this.dirty=e,t!==e&&this._onDidChangeDirty.fire()}isDirty(){return this.dirty}async rename(e,t){if(ms(t)===dNe)return{editor:this.instantiationService.invokeFunction(kA,{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&&Xe(e.backingUri,this.backingUri)):!1}getMatchRanges(){return(this._cachedResultsModel?.getAllDecorations()??[]).filter(e=>e.options.className===PEi).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:PEi,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(BUt,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:Nbe(Je.fromString(t))}}async suggestFileName(){let t=((await this.resolveModels()).configurationModel.config.query.replace(/[^\w \-_]+/g,"_")||"Search")+dNe;return je(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:iNe,fragment:`${Math.random()}`}),t=this._cachedConfigurationModel?.config??{},o=this._cachedResultsModel?.getValue()??"";return this.instantiationService.invokeFunction(kA,{from:"rawData",config:t,resultsContents:o,modelUri:e})}};pp=I([m(2,Ct),m(3,Ho),m(4,dn),m(5,F),m(6,Wa),m(7,Te),m(8,wn),m(9,le)],pp);var kA=(a,i)=>{let e=a.get(le),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:iNe,fragment:`${Math.random()}`}),!cNe.models.has(n))if(i.from==="existingFile")o.invokeFunction(r=>cNe.initializeModelFromExistingFile(r,n,i.fileUri));else{let r=t.getValue("search").searchEditor,s=r.reusePriorSearchConfiguration,l=r.defaultNumberOfContextLines,c=s?new Bl(pp.ID,e).getMemento(1,1).searchConfig??{}:{},p={...WEi(),...c,...i.config};l!=null&&(p.contextLines=i?.config?.contextLines??l),i.from==="rawData"?(i.resultsContents&&(p.contextLines=0),o.invokeFunction(h=>cNe.initializeModelFromRawData(h,n,p,i.resultsContents))):o.invokeFunction(h=>cNe.initializeModelFromExistingModel(h,n,p))}return o.createInstance(pp,n,i.from==="existingFile"?i.fileUri:i.from==="model"?i.backupOf:void 0)};var zho=a=>{let i=a.get(ee);i.activeEditor instanceof pp&&i.activeEditorPane.toggleCaseSensitive()},Kho=a=>{let i=a.get(ee);i.activeEditor instanceof pp&&i.activeEditorPane.toggleWholeWords()},Gho=a=>{let i=a.get(ee);i.activeEditor instanceof pp&&i.activeEditorPane.toggleRegex()},$ho=a=>{let i=a.get(ee);i.activeEditor instanceof pp&&i.activeEditorPane.toggleContextLines()},HEi=(a,i)=>{let e=a.get(ee);e.activeEditor instanceof pp&&e.activeEditorPane.modifyContextLines(i)},qho=a=>{let i=a.get(ee);i.activeEditor instanceof pp&&i.activeEditorPane.focusAllResults()};async function jho(a){let i=a.get(Ft),e=a.get(F),t=Pc(i);t?await e.invokeFunction(uNe,{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(uNe)}var uNe=async(a,i={},e=!1)=>{let t=a.get(ee),o=a.get(Et),n=a.get(Te),r=a.get(F),s=a.get(B),l=a.get(sp),c=a.get(Pe),p=a.get(zs).getLastActiveWorkspaceRoot(Y.file),h=p?c.getWorkspaceFolder(p)??void 0:void 0,g=t.activeTextEditorControl,f,v="";if(g){Ec(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 N=f.getModel()?.getWordAtPosition(T.getStartPosition());N&&(v=N.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 N=T[0],O=T[1];O!==void 0&&(S[N]=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 N=y.editor;w=await T.openEditor(N),v?w.setQuery(v):w.selectQuery(),w.setSearchConfig(S)}else{let T=r.invokeFunction(kA,{config:S,resultsContents:"",from:"rawData"});w=await t.openEditor(T,{pinned:!0},e?vn:Un)}let k=s.getValue("search").searchOnType;(S.triggerSearch===!0||S.triggerSearch!==!1&&k&&S.query)&&w.triggerSearch({focusResults:S.focusResults}),S.focusResults||w.focusSearchInput()},UUt=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(ot),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}=VUt(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(kA,{resultsContents:h,config:f,from:"rawData"});await n.openEditor(b,{pinned:!0}),b.setMatchRanges(g)}else{let b=s.invokeFunction(kA,{from:"rawData",resultsContents:"",config:{...f,contextLines:v}});(await n.openEditor(b,{pinned:!0})).triggerSearch()}};var Lte=ae("searchViewModelWorkbenchService");function GYo(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 LX(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 zUt(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=>GYo(r,i,e))}function pNe(a,i,e){let t=[],o=-1;for(let n=0;n<a.length;n++){let{start:r,end:s}=Qho(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?Qho(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 Qho(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 X3(a,i,e){let t=a.previewText.split(`
`);return a.rangeLocations.map(o=>{let n=o.preview;return new sit(i,t,n,o.source,e)})}var KUt=class KUt{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 U6e(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=Xtt+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=c1i(i,26,"\u2026"),t=this.getMatchString(),o=this._oneLinePreviewText.substring(this._rangeInPreviewText.endColumn-1),n=KUt.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([mi],KUt.prototype,"preview",1);var sit=KUt;var m0=class extends C{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=po.register({description:"search-current-find-match",stickiness:1,zIndex:13,className:"currentFindMatch",inlineClassName:"currentFindMatchInline",overviewRuler:{color:If(MN),position:2},minimap:{color:If(a9),position:1}})}static{this._FIND_MATCH=po.register({description:"search-find-match",stickiness:1,className:"findMatch",inlineClassName:"findMatchInline",overviewRuler:{color:If(MN),position:2},minimap:{color:If(a9),position:1}})}static getDecorationOption(e){return e?m0._CURRENT_FIND_MATCH:m0._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(ZO).forEach(t=>{X3(t,this,!1).forEach(o=>this.add(o))})}bindModel(e){this._model=e,this._modelListener=new P,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??y5);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??y5);this.updateMatches(s,t,this._model,!1)}updateMatches(e,t,o,n){let r=zUt(e,o,this._previewOptions);r.forEach(s=>{X3(s,this,n).forEach(l=>{this._removedTextMatches.has(l.id())||(this.add(l),this.isMatchSelected(l)&&(this._selectedMatch=l))})}),this.addContext(pNe(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:m0.getDecorationOption(this.isMatchSelected(o))})):[];this._modelDecorations=e.deltaDecorations(this._modelDecorations,t)})}id(){return Ytt+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=>!ZO(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)}};m0=I([m(6,Ct),m(7,fI),m(8,ot)],m0);var Rte=class{constructor(i){this._modelService=i;this._decorationId=null;this._model=null;this._modelDisposables=new P}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,Rte._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=po.register({description:"search-range-highlight",stickiness:1,className:"rangeHighlight",isWholeLine:!0})}};Rte=I([m(0,Ct)],Rte);function GUt(a){return"cellResults"in a}var ait="rawCell#";function Yho(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 LX(s.join(`
`)+`
`,r.map(u=>new z(u.range.startLineNumber-1,u.range.startColumn-1,u.range.endLineNumber-1,u.range.endColumn-1)))})}var $Ut=class extends C{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 cq;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 cq;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 Oy(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 Oy(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 Xho(a){return jUt(a)?a.cell.id:`${ait}${a.index}`}function qUt(a){return"cellResults"in a&&a.cellResults instanceof Array&&a.cellResults.every(jUt)}function jUt(a){return"cell"in a}function QUt(a,i){return Yho(a,i.textBuffer)}function YUt(a){return a.map(i=>i.searchPreviewInfo?new LX(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 Mte=class extends sit{constructor(e,t,o,n,r){super(e.parent,t,o,n,!1);this._cellParent=e;this._id=Xtt+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}},XUt=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 $Ut)}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){Jho(i,this).forEach(t=>{this._contentMatches.set(t.id(),t)}),this.addContext(i)}addContext(i){this.cell&&this.cell.resolveTextModel().then(e=>{pNe(i,e,this.parent.parent().query).filter((n=>!ZO(n))).map(n=>({...n,lineNumber:n.lineNumber+1})).forEach(n=>{this._context.set(n.lineNumber,n.text)})})}addWebviewMatches(i){Jho(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??`${ait}${this.cellIndex}`}get cellIndex(){return this._cellIndex}get cell(){return this._cell}},lhe=class extends m0{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 XUt(this,jUt(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 NRe(this._notebookEditorWidget,this.searchInstanceID),this._selectedMatch instanceof Mte&&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(`${ait}${l}`);c&&(c.setCellModel(n.cell),c.clearAllMatches(),r=c)}r?.clearAllMatches();let s=r??new XUt(this,n.cell,n.index);s.addContentMatches(QUt(n.contentMatches,n.cell)),s.addWebviewMatches(YUt(n.webviewMatches)),this._cellMatches.set(s.id,s)}),this._findMatchDecorationModel?.setAllFindMatchesDecorations(e),this._selectedMatch instanceof Mte&&this.highlightCurrentFindMatchDecoration(this._selectedMatch),this._onChange.fire({forceUpdateModel:t})}setNotebookFindMatchDecorationsUsingCellMatches(e){if(!this._findMatchDecorationModel)return;let t=si(e.map(o=>{let n=si(o.webviewMatches.map(s=>{if(s.webviewIndex)return{index:s.webviewIndex}}));if(!o.cell)return;let r=o.contentMatches.map(s=>new vU(s.range(),[s.text()]));return new V4(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},ve.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 Mte?(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(ZO).forEach(o=>{X3(o,this,!1).forEach(n=>this.add(n))}),(qUt(this.rawMatch)||GUt(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)&&VB(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()}};lhe=I([m(7,Ct),m(8,fI),m(9,ot),m(10,Zc)],lhe);function Jho(a,i){let e=[];return a.forEach(t=>{let o=t.previewText.split(`
`);t.rangeLocations.map(n=>{let r=n.preview,s=new Mte(i,o,r,n.source,t.webviewIndex);e.push(s)})}),e}var Pte=class extends C{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 vt,this._folderMatches=new vt,this._folderMatchesMap=Yu.forUris(g=>this.uriIdentityService.extUri.ignorePathCasing(g)),this._unDisposedFileMatches=new vt,this._unDisposedFolderMatches=new vt,this._name=new co(()=>this.resource?p.getUriBasenameLabel(this.resource):""),this._id=Qtt+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(mNe,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=Jtt(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 Pte;){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=Jtt(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(Dte(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(ZO).forEach(u=>{X3(u,c,!1).forEach(p=>c.add(p))}),(qUt(l)||GUt(l))&&l.cellResults?.forEach(u=>{if(Dte(c)){let p=c.getCellMatch(Xho(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(_2(this)||p0(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(Dte(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()}};Pte=I([m(7,fI),m(8,F),m(9,ot),m(10,dt)],Pte);var mNe=class extends Pte{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}};mNe=I([m(7,fI),m(8,F),m(9,ot),m(10,dt)],mNe);var hNe=class extends mNe{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(lhe,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)}};hNe=I([m(5,fI),m(6,F),m(7,ot),m(8,dt)],hNe);var gNe=class extends Pte{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(lhe,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}};gNe=I([m(4,fI),m(5,F),m(6,ot),m(7,dt)],gNe);var che=class extends C{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=Yu.forUris(e=>this.uriIdentityService.extUri.ignorePathCasing(e));this.resource=null;this.hidden=!1;this._rangeHighlightDecorations=this.instantiationService.createInstance(Rte),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=>{bd(s)&&s.clear()});let o=e.filter(s=>fl(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 vt,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=Yu.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=Yu.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(),Dte(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()}};che=I([m(2,F),m(3,dt)],che);var fNe=class extends che{constructor(e,t,o,n){super(!0,e,t,o);this.replaceService=n}id(){return eNe+Eho}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(hNe,e,t,o,n,this)}createNoRootWorkspaceImpl(e,t,o){return this._register(this.instantiationService.createInstance(gNe,e,t,o,this))}};fNe=I([m(1,F),m(2,dt),m(3,fI)],fNe);var J3=class extends che{constructor(i,e,t){super(!1,i,e,t),this.hidden=!0}name(){return"AI"}id(){return eNe+Tho}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 Mn;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(dhe,i,e,t,o,this)}};J3=I([m(1,F),m(2,dt)],J3);var dhe=class extends C{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=Qtt+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(lit,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=Jtt(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()}};dhe=I([m(5,F),m(6,ot)],dhe);var lit=class extends m0{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 Ytt+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(ZO).forEach(e=>{X3(e,this,!0).forEach(t=>this.add(t))})}};lit=I([m(8,Ct),m(9,fI),m(10,ot)],lit);W(class extends K{constructor(){super({id:"search.action.clearHistory",title:L(13342,"Clear Search History"),category:vl,f1:!0})}async run(i){qYo(i)}});W(class extends K{constructor(){super({id:"search.action.cancel",title:L(13341,"Cancel Search"),icon:Cho,category:vl,f1:!0,precondition:pEe.isEqualTo(0).negate(),keybinding:{weight:200,when:x.and(Ci.SearchViewVisibleKey,rc),primary:9},menu:[{id:D.ViewTitle,group:"navigation",order:0,when:x.and(x.equals("view",ny),pEe.isEqualTo(2))}]})}run(i){return YYo(i)}});W(class extends K{constructor(){super({id:"search.action.refreshSearchResults",title:L(13346,"Refresh"),icon:MUt,precondition:Ci.ViewHasSearchPatternKey,category:vl,f1:!0,menu:[{id:D.ViewTitle,group:"navigation",order:0,when:x.and(x.equals("view",ny),pEe.isEqualTo(2).negate())}]})}run(i,...e){return XYo(i)}});W(class extends K{constructor(){super({id:"search.action.collapseSearchResults",title:L(13344,"Collapse All"),category:vl,icon:bho,f1:!0,precondition:x.and(Ci.HasSearchResults,Ci.ViewHasSomeCollapsibleKey),menu:[{id:D.ViewTitle,group:"navigation",order:4,when:x.and(x.equals("view",ny),x.or(Ci.HasSearchResults.negate(),Ci.ViewHasSomeCollapsibleKey))}]})}run(i,...e){return JYo(i)}});W(class extends K{constructor(){super({id:"search.action.expandSearchResults",title:L(13345,"Expand All"),category:vl,icon:Sho,f1:!0,precondition:x.and(Ci.HasSearchResults,Ci.ViewHasSomeCollapsibleKey.toNegated()),menu:[{id:D.ViewTitle,group:"navigation",order:4,when:x.and(x.equals("view",ny),Ci.HasSearchResults,Ci.ViewHasSomeCollapsibleKey.toNegated())}]})}async run(i,...e){return jYo(i)}});W(class extends K{constructor(){super({id:"search.action.clearSearchResults",title:L(13343,"Clear Search Results"),category:vl,icon:who,f1:!0,precondition:x.or(Ci.HasSearchResults,Ci.ViewHasSearchPatternKey,Ci.ViewHasReplacePatternKey,Ci.ViewHasFilePatternKey),menu:[{id:D.ViewTitle,group:"navigation",order:1,when:x.equals("view",ny)}]})}run(i,...e){return QYo(i)}});W(class extends K{constructor(){super({id:"search.action.viewAsTree",title:L(13349,"View as Tree"),category:vl,icon:yho,f1:!0,precondition:x.and(Ci.HasSearchResults,Ci.InTreeViewKey.toNegated()),menu:[{id:D.ViewTitle,group:"navigation",order:2,when:x.and(x.equals("view",ny),Ci.InTreeViewKey.toNegated())}]})}async run(i,...e){let t=Pc(i.get(Ft));t&&await t.setTreeView(!0)}});W(class extends K{constructor(){super({id:"search.action.viewAsList",title:L(13348,"View as List"),category:vl,icon:Iho,f1:!0,precondition:x.and(Ci.HasSearchResults,Ci.InTreeViewKey),menu:[{id:D.ViewTitle,group:"navigation",order:2,when:x.and(x.equals("view",ny),Ci.InTreeViewKey)}]})}async run(i,...e){let t=Pc(i.get(Ft));t&&await t.setTreeView(!1)}});W(class extends K{constructor(){super({id:"search.action.searchWithAI",title:L(13347,"Search with AI"),category:vl,f1:!0,precondition:Ci.hasAIResultProvider,keybinding:{weight:200,when:x.and(Ci.hasAIResultProvider,Ci.SearchViewFocusedKey),primary:2087}})}async run(i,...e){let t=Pc(i.get(Ft));t&&t.requestAIResults()}});var qYo=a=>{a.get(aNe).clearHistory()};async function jYo(a){let i=a.get(Ft),e=Pc(i);if(e){let t=e.getControl();await vNe(t,void 0)}}async function vNe(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(wA(t.element))throw Error("SearchResult should not be a child of a RenderableMatch");vNe(a,t.element)}}function QYo(a){let i=a.get(Ft);Pc(i)?.clearSearchResults()}function YYo(a){let i=a.get(Ft);Pc(i)?.cancelSearch()}function XYo(a){let i=a.get(Ft),e=Pc(i);e?.triggerQueryChange({preserveFocus:!1,shouldUpdateAISearch:!e.model.searchResult.aiTextSearchResult.hidden})}function JYo(a){let i=a.get(Ft),e=Pc(i);if(e){let t=e.getControl(),o=t.navigate(),n=o.first(),r=!1,s=!1;do n=o.next();while(jf(n));if(_2(n)||e.isTreeLayoutViewVisible){for(;n=o.next();)if(!jf(n)){if(Ka(n)){r=!0;break}if(e.isTreeLayoutViewVisible&&!s){let c=n;if(bd(n)){let p=t.getCompressedTreeNode(n)?.elements[0].element;c=p&&!Ka(p)&&!jf(p)&&!wA(p)?p:n}let u=c.parent();jf(u)||_2(u)||p0(u)||wA(u)||(s=!0)}}}if(r){n=o.first();do fl(n)&&t.collapse(n);while(n=o.next())}else if(s){if(n=o.first(),n)do{let c=n;if(bd(n)){let p=t.getCompressedTreeNode(n)?.elements[0].element;c=p&&!Ka(p)&&!wA(p)?p:n}let u=c.parent();(_2(u)||p0(u))&&(t.hasNode(n)?t.collapse(n,!0):t.collapseAll())}while(n=o.next())}else if(jf(o.first())){n=o.first();do{if(!n)break;jf(t.getParentElement(n))&&t.collapse(n)}while(n=o.next())}else t.collapseAll();let l=t.getFocus()[0]?.parent();l&&(bd(l)||fl(l))&&t.hasNode(l)&&t.isCollapsed(l)&&(t.domFocus(),t.focusFirst(),t.setSelection(t.getFocus()))}}var ID=_;var Zho=d(13440,null),ego=75,D2=class extends zr{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N,O,V,U,G,$,te,pe,de,se){super(e,V,N,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=U;this.notebookService=te;this.logService=pe;this.accessibilitySignalService=de;this.telemetryService=se;this.isDisposed=!1;this.lastFocusState="input";this.messageDisposables=new P;this.currentEditorCursorListener=this._register(new me);this.currentSearchQ=Promise.resolve();this.pauseSearching=!1;this._visibleMatches=0;this._cachedKeywords=[];this.container=_(".search-view"),this.viewletVisible=Ci.SearchViewVisibleKey.bindTo(this.contextKeyService),this.firstMatchFocused=Ci.FirstMatchFocusKey.bindTo(this.contextKeyService),this.fileMatchOrMatchFocused=Ci.FileMatchOrMatchFocusKey.bindTo(this.contextKeyService),this.fileMatchOrFolderMatchFocus=Ci.FileMatchOrFolderMatchFocusKey.bindTo(this.contextKeyService),this.fileMatchOrFolderMatchWithResourceFocus=Ci.FileMatchOrFolderMatchWithResourceFocusKey.bindTo(this.contextKeyService),this.fileMatchFocused=Ci.FileFocusKey.bindTo(this.contextKeyService),this.folderMatchFocused=Ci.FolderFocusKey.bindTo(this.contextKeyService),this.folderMatchWithResourceFocused=Ci.ResourceFolderFocusKey.bindTo(this.contextKeyService),this.searchResultHeaderFocused=Ci.SearchResultHeaderFocused.bindTo(this.contextKeyService),this.hasSearchResultsKey=Ci.HasSearchResults.bindTo(this.contextKeyService),this.matchFocused=Ci.MatchFocusKey.bindTo(this.contextKeyService),this.searchStateKey=pEe.bindTo(this.contextKeyService),this.hasSearchPatternKey=Ci.ViewHasSearchPatternKey.bindTo(this.contextKeyService),this.hasReplacePatternKey=Ci.ViewHasReplacePatternKey.bindTo(this.contextKeyService),this.hasFilePatternKey=Ci.ViewHasFilePatternKey.bindTo(this.contextKeyService),this.hasSomeCollapsibleResultKey=Ci.ViewHasSomeCollapsibleKey.bindTo(this.contextKeyService),this.treeViewKey=Ci.InTreeViewKey.bindTo(this.contextKeyService),this.refreshTreeController=this._register(this.instantiationService.createInstance(dit,this,()=>this.searchConfig)),this._register(this.contextKeyService.onDidChangeContext(Se=>{let ke=Ci.hasAIResultProvider.keys();Se.affectsSome(new Set(ke))&&this.refreshHasAISetting()})),this.contextKeyService=this._register(this.contextKeyService.createScoped(this.container)),Ci.SearchViewFocusedKey.bindTo(this.contextKeyService).set(!0),this.inputBoxFocused=Ci.InputBoxFocusedKey.bindTo(this.contextKeyService),this.inputPatternIncludesFocused=Ci.PatternIncludesFocusedKey.bindTo(this.contextKeyService),this.inputPatternExclusionsFocused=Ci.PatternExcludesFocusedKey.bindTo(this.contextKeyService),this.isEditableItem=Ci.IsEditableItemKey.bindTo(this.contextKeyService),this.instantiationService=this._register(this.instantiationService.createChild(new Io([X,this.contextKeyService]))),this._register(this.configurationService.onDidChangeConfiguration(async Se=>{Se.affectsConfiguration("search.sortOrder")&&(this.searchConfig.sortOrder==="modified"&&this.removeFileStats(),await this.refreshTreeController.queue())})),this.viewModel=this.searchViewModelWorkbenchService.searchModel,this.queryBuilder=this.instantiationService.createInstance(aS),this.memento=new Bl(this.id,U),this.viewletState=this.memento.getMemento(1,1),this._register(this.fileService.onDidFilesChange(Se=>this.onFilesChanged(Se))),this._register(this.textFileService.untitled.onWillDispose(Se=>this.onUntitledDidDispose(Se.resource))),this._register(this.contextService.onDidChangeWorkbenchState(()=>this.onDidChangeWorkbenchState())),this._register(this.searchHistoryService.onDidClearHistory(()=>this.clearHistory())),this._register(this.configurationService.onDidChangeConfiguration(Se=>this.onConfigurationUpdated(Se))),this.delayedRefresh=this._register(new jo(250)),this.addToSearchHistoryDelayer=this._register(new jo(2e3)),this.toggleCollapseStateDelayer=this._register(new jo(100)),this.triggerQueryDelayer=this._register(new jo(0)),this.treeAccessibilityProvider=this.instantiationService.createInstance(tNe,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,xA.SEARCH_HISTORY_KEY,this._store)(()=>{let Se=this.searchHistoryService.load();Se.include&&this.inputPatternIncludes.prependHistory(Se.include),Se.exclude&&this.inputPatternExcludes.prependHistory(Se.exclude),Se.search&&this.searchWidget.prependSearchHistory(Se.search),Se.replace&&this.searchWidget.prependReplaceHistory(Se.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&&xo(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=R(e,_(".search-view")),this.searchWidgetsContainerElement=R(this.container,ID(".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=R(this.searchWidgetsContainerElement,ID(".query-details"));let h=d(13399,null);this.toggleQueryDetailsButton=R(this.queryDetails,ID(".more"+q.asCSSSelector(she),{tabindex:0,role:"button","aria-label":h})),this._register(this.hoverService.setupManagedHover(Ni("element"),this.toggleQueryDetailsButton,h)),this._register(j(this.toggleQueryDetailsButton,re.CLICK,w=>{$t.stop(w),this.toggleQueryDetails(!this.accessibilityService.isScreenReaderOptimized())})),this._register(j(this.toggleQueryDetailsButton,re.KEY_UP,w=>{let k=new Ii(w);(k.equals(3)||k.equals(10))&&($t.stop(w),this.toggleQueryDetails(!1))})),this._register(j(this.toggleQueryDetailsButton,re.KEY_DOWN,w=>{new Ii(w).equals(1026)&&(this.searchWidget.isReplaceActive()?this.searchWidget.focusReplaceAllAction():this.searchWidget.isReplaceShown()?this.searchWidget.replaceInput?.focusOnPreserve():this.searchWidget.focusRegexAction(),$t.stop(w))}));let g=R(this.queryDetails,ID(".file-types.includes")),f=d(13444,null);R(g,ID("h4",void 0,f)),this.inputPatternIncludes=this._register(this.instantiationService.createInstance(Tte,g,this.contextViewService,{ariaLabel:f,placeholder:d(13415,null),showPlaceholderOnFocus:!0,history:l,inputBoxStyles:pl})),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=R(this.queryDetails,ID(".file-types.excludes")),b=d(13443,null);R(v,ID("h4",void 0,b)),this.inputPatternExcludes=this._register(this.instantiationService.createInstance(_te,v,this.contextViewService,{ariaLabel:b,placeholder:d(13414,null),showPlaceholderOnFocus:!0,history:r,inputBoxStyles:pl})),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=R(this.container,ID(".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(jR,e,{value:t,replaceValue:o,isRegex:n,isCaseSensitive:s,isWholeWords:r,searchHistory:c,replaceHistory:u,preserveCase:h,inputBoxStyles:pl,toggleStyles:qg,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!!Ci.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"||!Ka(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(13425,null),message:this.buildReplaceAllConfirmationMessage(e,t,o),primaryButton:d(13424,null)};this.dialogService.confirm(l).then(c=>{c.confirmed?(this.searchWidget.setReplaceAllActionState(!1),this.viewModel.searchResult.replaceAll(s).then(()=>{r();let u=this.clearMessage();R(u,n),this.reLayout()},u=>{r(),so(u),this.notificationService.error(u)})):r()})}buildAfterReplaceAllMessage(e,t,o){return e===1?t===1?o?d(13427,null,e,t,o):d(13417,null,e,t):o?d(13429,null,e,t,o):d(13419,null,e,t):t===1?o?d(13431,null,e,t,o):d(13421,null,e,t):o?d(13433,null,e,t,o):d(13423,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(13416,null,e,t,r):d(13426,null,e,t):r?d(13418,null,e,t,r):d(13428,null,e,t):t===1?r?d(13420,null,e,t,r):d(13430,null,e,t):r?d(13422,null,e,t,r):d(13432,null,e,t)}clearMessage(){this.searchWithoutFolderMessageElement=void 0;let e=this.messagesElement.style.display==="none";Rt(this.messagesElement),bn(this.messagesElement),this.messageDisposables.clear();let t=R(this.messagesElement,ID(".message"));return e&&this.reLayout(),t}createSearchResultsView(e){this.resultsElement=R(e,ID(".results.show-file-icons.file-icon-themable-tree"));let t=this.instantiationService.createInstance(eit),o={getId(r){return r.id()}};this.searchDataSource=this.instantiationService.createInstance(cit,this),this.treeLabels=this._register(this.instantiationService.createInstance(Za,{onDidChangeVisibility:this.onDidChangeBodyVisibility})),this.tree=this._register(this.instantiationService.createInstance(qI,"SearchView",this.resultsElement,t,{isIncompressible:r=>!(bd(r)&&!jf(r.parent())&&!_2(r.parent())&&!p0(r.parent()))},[this._register(this.instantiationService.createInstance($3,this,this.treeLabels)),this._register(this.instantiationService.createInstance(q3,this,this.treeLabels)),this._register(this.instantiationService.createInstance(G3,this.treeLabels)),this._register(this.instantiationService.createInstance(j3,this))],this.searchDataSource,{identityProvider:o,accessibilityProvider:this.treeAccessibilityProvider,dnd:this.instantiationService.createInstance(k5,r=>fl(r)?r.resource:Ka(r)?fL(r.parent().resource,r.range()):null),multipleSelectionSupport:!0,selectionNavigation:!0,overrideStyles:this.getLocationBasedColors().listOverrideStyles,paddingBottom:eit.ITEM_HEIGHT,collapseByDefault:r=>jf(r)?r.isAIContributed:bd(r)&&r.matches().length===1&&bd(r.matches()[0])?!1:this.shouldCollapseAccordingToConfig(r)})),Ci.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(H.debounce(this.tree.onDidOpen,(r,s)=>s,ego,!0)(r=>{if(Ka(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(H.debounce(this.tree.onDidChangeFocus,(r,s)=>s,ego,!0)(()=>{let r=this.tree.getSelection(),s=this.tree.getFocus()[0];r.length>1&&Ka(s)&&this.onFocus(s,!0)})),this._register(H.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(fl(r)),this.folderMatchFocused.set(bd(r)),this.matchFocused.set(Ka(r)),this.fileMatchOrFolderMatchFocus.set(fl(r)||bd(r)),this.fileMatchOrFolderMatchWithResourceFocus.set(fl(r)||K3(r)),this.folderMatchWithResourceFocused.set(K3(r)),this.searchResultHeaderFocused.set(Lho(r)),this.lastFocusState="tree"}let s=!1;Ka(r)?s=!r.isReadonly:(fl(r)||bd(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=ca(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||!jf(o)))return!0;while(o=t.next());return!1}async selectNextMatch(){if(!this.hasSearchResults())return;let[e]=this.tree.getSelection();e&&!Ka(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&&!Ka(o);)this.tree.isCollapsed(o)&&await this.tree.expand(o),o=t.next();if(o){o===e&&this.tree.setFocus([]);let n=IE(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&&Or(r)}}async selectPreviousMatch(){if(!this.hasSearchResults())return;let[e]=this.tree.getSelection(),t=this.tree.navigate(e),o=t.previous();for(;!o||!Ka(o)&&!this.tree.isCollapsed(o);){let n=o?t.previous():t.last();if(!o&&!n)return;o=n}for(;o&&!Ka(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=IE(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&&Or(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=Tf.get(o);if(n&&n.isFindInputFocused())return this.updateTextFromFindWidget(n,{allowSearchOnType:t});o=this.codeEditorService.listCodeEditors().find(s=>s instanceof zc&&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=Yr(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(D2.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=nh(this.searchWidgetsContainerElement),o=nh(this.messagesElement);this.tree.layout(this.size.height-t-o,this.size.width-28)}layoutBody(e,t){super.layoutBody(e,t),this.size=new ai(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(13395,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=IE();this.tree.focusNext(void 0,void 0,t),this.tree.setSelection(this.tree.getFocus(),t)}}getSearchTextFromEditor(e,t){if(ts(this.getContainer())||(t=t??this.editorService.activeTextEditorControl,!t))return null;let o=this.searchConfig.seedWithNearestWord&&e;return zEi(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,N={_reason:"searchView",extraFileResources:this.instantiationService.invokeFunction(SX),maxResults:this.searchConfig.maxResults??void 0,disregardIgnoreFiles:!b||void 0,disregardExcludeSettings:!b||void 0,ignoreGlobCase:!Wn||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()},U;try{U=this.queryBuilder.text(y,O.map(G=>G.uri),N)}catch(G){V(G);return}this.validateQuery(U).then(()=>{!o&&n&&this.tree.hasNode(this.searchResult.aiTextSearchResult)&&this.tree.collapse(this.searchResult.aiTextSearchResult),this.onQueryTriggered(U,N,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(13442,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(13447,null),"search.action.searchWithAI"),o=d(13445,null),n=this.messageDisposables.add(new h0(o,()=>{this.commandService.executeCommand("search.action.searchWithAI")},this.hoverService,t));R(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(Ci.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()),Or(d(13393,null,this.viewModel.searchResult.count(),this.viewModel.searchResult.fileCount()));else{let u=!!t,p=!!o,h;n?this.inputPatternIncludes.onlySearchInOpenEditors()?p&&u?h=d(13403,null,o,t):p?h=d(13402,null,o):u?h=d(13400,null,t):h=d(13401,null):p&&u?h=d(13407,null,o,t):p?h=d(13406,null,o):u?h=d(13404,null,t):h=d(13405,null):h=Zho,Or(h);let g=this.clearMessage();if(R(g,h),this.shouldShowAIResults()&&(this.appendSearchWithAIButton(g),R(g,ID("span",void 0," - "))),n)if(p||u){let f=this.messageDisposables.add(new h0(d(13435,null),this.onSearchAgain.bind(this),this.hoverService));R(g,f.element)}else{let f=this.messageDisposables.add(new h0(d(13413,null),this.onOpenSettings.bind(this),this.hoverService));R(g,f.element)}else{let f=this.messageDisposables.add(new h0(d(13434,null),()=>this.triggerQueryChange({preserveFocus:!1}),this.hoverService));R(g,f.element)}this.contextService.getWorkbenchState()===1&&this.showSearchWithoutFolderMessage(),this.reLayout()}if(n&&n.limitHit&&n.messages.push({type:2,text:d(13441,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,so(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 vNe(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){$t.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(13397,null,this.searchResult.query?.contentPattern.pattern??""),R(l,c),n>0){if(e){let h=" - "+d(13449,null)+" ",g=this.messageDisposables.add(new h0(d(13396,null),this.onEnableExcludes.bind(this),this.hoverService,d(13448,null)));R(l,ID("span",void 0,h,"(",g.element,")"))}if(t){let h=" - "+d(13408,null)+" ",g=this.messageDisposables.add(new h0(d(13409,null),this.onDisableSearchInOpenEditors.bind(this),this.hoverService,d(13394,null)));R(l,ID("span",void 0,h,"(",g.element,")"))}R(l," - ");let u=this.keybindingService.appendKeybinding(d(13412,null),"search.action.openInEditor"),p=this.messageDisposables.add(new h0(d(13411,null),()=>this.instantiationService.invokeFunction(UUt,this.searchResult,this.searchIncludePattern.getValue(),this.searchExcludePattern.getValue(),this.searchIncludePattern.onlySearchInOpenEditors()),this.hoverService,u));R(l,p.element),this.shouldShowAIResults()&&(R(l," - "),this.appendSearchWithAIButton(l)),this.reLayout()}else s||xo(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;R(t,", ");let o=this._cachedKeywords.length,n=this.messageDisposables.add(new h0(e.keyword,()=>this.handleKeywordClick(e.keyword,o),this.hoverService));R(t,n.element)}else{let o=this.clearMessage();o.classList.add("ai-keywords");let n=d(13398,null);R(o,n);let r=this.messageDisposables.add(new h0(e.keyword,()=>this.handleKeywordClick(e.keyword,0),this.hoverService));R(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&&DLt(t)){this.updateKeywordSuggestionUI(t);return}this._pendingSemanticSearchPromise===e&&(this._pendingSemanticSearchPromise=void 0)})),this._cachedResults=await e}addMessage(e){let t=this.messagesElement.firstChild;t&&R(t,PUt(e,this.instantiationService,this.notificationService,this.openerService,this.commandService,this.messageDisposables,()=>this.triggerQueryChange()))}buildResultCountMessage(e,t){return e===1&&t===1?d(13436,null,e,t):e===1?d(13438,null,e,t):t===1?d(13437,null,e,t):d(13439,null,e,t)}showSearchWithoutFolderMessage(){this.searchWithoutFolderMessageElement=this.clearMessage();let e=R(this.searchWithoutFolderMessageElement,ID("p",void 0,d(13446,null))),t=this.messageDisposables.add(new h0(d(13410,null),()=>{this.commandService.executeCommand(nK.ID).catch(o=>mt(o))},this.hoverService));R(e,t.element)}showEmptyStage(e=!1){((this.messagesElement.firstChild?.textContent?.indexOf(Zho)??-1)>-1||e||!this.configurationService.getValue().search.searchOnType)&&xo(this.messagesElement),bn(this.resultsElement),this.currentSelectedFileMatch=void 0}shouldOpenInNotebookEditor(e,t){return VB(e)||t.scheme!==Y.untitled&&this.notebookService.getContributedNotebookTypes(t).length>0}onFocus(e,t,o,n){let r=this.configurationService.getValue().search.useReplacePreview,s=Ka(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=UEi(e,this.viewModel),l=Ka(e)?e.parent().matches():[],c=r??(Ka(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?vn:Un);let h=u?.getControl();Ka(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 uD){let h=e.parent();if(Ka(e))if(VB(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];VB(b)&&(h.showMatch(b),(!this.tree.getFocus().includes(b)||!this.tree.getSelection().includes(b))&&(this.tree.setSelection([b],IE()),this.tree.setFocus([b])))}}}}openEditorWithMultiCursor(e){let t=Ka(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(fl(e)?n=e:Ka(e)&&(n=e.parent()),n){let r=n.matches().map(l=>new Yt(l.range().startLineNumber,l.range().startColumn,l.range().endLineNumber,l.range().endColumn)),s=ca(o.getControl());s&&Z7.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()}};D2=I([m(1,be),m(2,ee),m(3,Kt),m(4,Bo),m(5,Ne),m(6,ct),m(7,ge),m(8,_n),m(9,F),m(10,Ri),m(11,B),m(12,Pe),m(13,Lte),m(14,X),m(15,fI),m(16,Ho),m(17,Po),m(18,De),m(19,aNe),m(20,ze),m(21,Bi),m(22,_e),m(23,le),m(24,Qe),m(25,tt),m(26,un),m(27,ne),m(28,tr),m(29,Te)],D2);var h0=class extends C{constructor(i,e,t,o){super(),this.element=ID("a.pointer",{tabindex:0},i),this._register(t.setupManagedHover(Ni("mouse"),this.element,o)),this.addEventHandlers(e)}addEventHandlers(i){let e=t=>{$t.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 Ii(t);(o.equals(10)||o.equals(3))&&(e(t),o.preventDefault(),o.stopPropagation())}))}};function UEi(a,i){let e=null;if(Ka(a)&&(e=a),fl(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 zEi(a,i){let e=i;if(Ec(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 cit=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(CA);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 dhe||(t=e.sort((o,n)=>CA(o,n,this.searchConfig.sortOrder))),t}createFileIterator(i){return i.matches().sort(CA)}hasChildren(i){return Ka(i)?!1:jf(i)&&i.isAIContributed?!0:i.hasChildren}getChildren(i){return wA(i)?this.createSearchResultIterator(i):jf(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):bd(i)?this.createFolderIterator(i):fl(i)?this.createFileIterator(i):[]}getParent(i){let e=i.parent();if(wA(e))throw new Error("Invalid element passed to getParent");return e}};cit=I([m(1,B)],cit);var dit=class extends C{constructor(e,t,o){super();this.searchView=e;this.geSearchConfig=t;this.fileService=o;this.queuedIChangeEvents=[];this.refreshTreeThrottler=this._register(new um)}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)}};dit=I([m(2,be)],dit);var Tk=class extends yh{constructor(e,t,o,n,r){super(Tk.PREFIX,{canAcceptInBackground:!0,noResultsPick:{label:d(13459,null)}});this.labelService=e;this.openerService=t;this.editorService=o;this.configurationService=n;this.codeEditorService=r;this.delayer=this._register(new ya(Tk.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 R7(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(uF(e),t,o),t?.delay)}async doGetSymbolPicks(e,t,o){let n,r;e.values&&e.values.length>1?(n=m_e(e.values[0]),r=m_e(e.values.slice(1))):n=e;let s=await VDt(n.original,o);if(o.isCancellationRequested)return[];let l=[],c=this.configuration.openSideBySideDirection;for(let{symbol:u,provider:p}of s){if(t?.skipLocal&&!Tk.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]=dJ(h,{...e,values:void 0},0,0),typeof g=="number"&&(v=!0)),typeof g!="number"&&([g,f]=dJ(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]=dJ(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(sh.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(M.splitHorizontal):q.asClassName(M.splitVertical),tooltip:c==="right"?d(13461,null):d(13460,null)}],trigger:(T,N)=>(this.openSymbol(p,u,o,{keyMods:N,forceOpenSideBySide:!0}),1),accept:async(T,N)=>this.openSymbol(p,u,o,{keyMods:T,preserveFocus:N.inBackground,forcePinned:N.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===Y.http||r.location.uri.scheme===Y.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?vn:Un))}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=sh.toIcon(e.symbol.kind).id,n=sh.toIcon(t.symbol.kind).id;return o.localeCompare(n)}return 0}};Tk=I([m(0,ot),m(1,Qe),m(2,ee),m(3,B),m(4,Kt)],Tk);var uhe=class extends C{static{this.ID="workbench.contributions.searchChatContextContribution"}constructor(i,e){super(),this._store.add(e.registerChatContextItem(i.createInstance(uit))),this._store.add(e.registerChatContextItem(i.createInstance(mit))),this._store.add(e.registerChatContextItem(this._store.add(i.createInstance(pit))))}};uhe=I([m(0,F),m(1,uS)],uhe);var uit=class{constructor(i,e,t){this._contextKeyService=i;this._viewsService=e;this._labelService=t;this.type="valuePick";this.label=d(13352,null);this.icon=M.search;this.ordinal=500}isEnabled(i){return!!Ci.HasSearchResults.getValue(this._contextKeyService)&&!!i.attachmentCapabilities.supportsSearchResultAttachments}async asAttachment(){let i=this._viewsService.getViewWithId(ny);return i instanceof D2?i.model.searchResult.matches().map(e=>({kind:"file",id:e.resource.toString(),value:e.resource,name:this._labelService.getUriBasenameLabel(e.resource)})):[]}};uit=I([m(0,X),m(1,Ft),m(2,ot)],uit);var pit=class{constructor(i){this._instantiationService=i;this.type="pickerPick";this.label=d(13354,null);this.icon=M.symbolField;this.ordinal=-200}dispose(){this._provider?.dispose()}isEnabled(i){return!!i.attachmentCapabilities.supportsSymbolAttachments}asPicker(){return{placeholder:d(13353,null),picks:Xde((i,e)=>(this._provider??=this._instantiationService.createInstance(Tk),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:sh.toIcon(n.symbol.kind),fullName:n.label,name:n.symbol.name};o.push({label:n.symbol.name,iconClass:q.asClassName(sh.toIcon(n.symbol.kind)),asAttachment(){return r}})}return o})))}}};pit=I([m(0,F)],pit);var mit=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(13351,null);this.icon=M.folder;this.ordinal=600}asPicker(){return{placeholder:d(13350,null),picks:Xde(async(i,e)=>{let t=this._workspaceService.getWorkspace().folders.map(r=>r.uri),o=[];if((await rXo(t,this._fileService)).forEach(r=>o.push(this._createPickItem(r,1))),this._historyService.getHistory().filter(r=>r.resource&&this._instantiationService.invokeFunction(s=>oke(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 KEi(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)=>Al(r.label,s.label)),n})}}_createPickItem(i,e){return{label:Ye(i),description:this._labelService.getUriLabel(ci(i),{relative:!0}),iconClasses:js(this._modelService,this._languageService,i,e),asAttachment:()=>({kind:e===0?"file":"directory",id:i.toString(),value:i,name:Ye(i)})}}};mit=I([m(0,Jp),m(1,ot),m(2,Ct),m(3,kt),m(4,B),m(5,Pe),m(6,be),m(7,zs),m(8,F)],mit);async function KEi(a,i,e,t,o,n,r){let s=e?iXo(i):oXo(i),l=MP(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(!so(g))throw g}if(!u||t?.isCancellationRequested)return{files:[],folders:[]};let p=u.results.map(g=>g.resource);return{folders:nXo(p,a,s),files:p}}function iXo(a){return a?"*"+a.split("").join("*")+"*":"*"}function oXo(a){return a?"*"+a+"*":"*"}function nXo(a,i,e){let t=new Mn;for(let n of a){let r=Fc(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||!Cp(e,s,{ignoreCase:!0})||o.push(n)}return o}async function rXo(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=je(t,r);s===2&&e.push(l)}}return e}var sXo={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 aXo(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(`
`)}async function bNe(a,i){i.markDebugDataAttached(a),i.hasInvokedProviders(a)||await i.invokeProviders(a);let e=i.getEvents(a),t=e.length>0?aXo(e):d(6241,null);return{id:"chatDebugEvents",name:d(6240,null),icon:M.output,kind:"debugEvents",snapshotTime:Date.now(),sessionResource:a,value:t,modelDescription:`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(sXo).join(`
`)}}var $Ei=/\/[\p{L}0-9_.:-]*/gu,GEi=/(@|\/)[\p{L}0-9_.:-]*/gu,hit=class extends C{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:Y.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:"globalSlashCommands",triggerCharacters:[yu],provideCompletionItems:async(c,u,p,h)=>{let g=this.chatWidgetService.getWidgetByInputUri(c.uri);if(!g||!g.viewModel)return null;let f;if(g.lockedAgentId){if(!g.attachmentCapabilities.supportsPromptAttachments)return null;let w=g.viewModel.model.sessionResource,k=w&&r.getChatSessionFromInternalUri(w);f=(k?s.getCustomAgentTargetForSessionType(k.chatSessionType):void 0)??"undefined"}let v=TA(c,u,$Ei);if(!v)return null;if(!phe(c,v)||g.parsedInput.parts.find(w=>w instanceof zu))return;let y=this.chatSlashCommandService.getCommands(g.location,g.input.currentModeKind);return y?{suggestions:y.filter(w=>g.lockedAgentId?!(w.modes&&w.modes.length&&!w.modes.includes("agent")||w.target&&f&&w.target!==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:SA.ID,title:T,arguments:[{widget:g,inputValue:`${T} `}]}:void 0}})}:null}})),this._register(this.languageFeaturesService.completionProvider.register({scheme:Y.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:"globalSlashCommandsAt",triggerCharacters:[vg],provideCompletionItems:async(c,u,p,h)=>{let g=this.chatWidgetService.getWidgetByInputUri(c.uri);if(!g||!g.viewModel)return null;let f=TA(c,u,/@\w*/g);if(!f)return null;if(!phe(c,f))return;let v=this.chatSlashCommandService.getCommands(g.location,g.input.currentModeKind);return!v||g.lockedAgentId?null:{suggestions:v.map((b,S)=>{let y=`${yu}${b.command}`;return{label:{label:y,description:b.detail},insertText:b.executeImmediately?"":`${y} `,documentation:b.detail,range:f,filterText:`${vg}${b.command}`,sortText:b.sortText??"z".repeat(S+1),kind:18,command:b.executeImmediately?{id:SA.ID,title:y,arguments:[{widget:g,inputValue:`${y} `}]}:void 0}})}}})),this._register(this.languageFeaturesService.completionProvider.register({scheme:Y.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:"promptSlashCommands",triggerCharacters:[yu],provideCompletionItems:async(c,u,p,h)=>{let g=this.chatWidgetService.getWidgetByInputUri(c.uri);if(!g||!g.viewModel)return null;let f=TA(c,u,$Ei);if(!f)return null;if(!phe(c,f)||g.parsedInput.parts.find(w=>w instanceof zu))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){if(w.promptPath.extension)return!1;try{let k=TMe(w.promptPath.uri);if(k&&k==="hook")return!1}catch{}}return!0}).filter(w=>w.parsedPromptFile?.header?.userInvocable!==!1);return y.length===0?null:{suggestions:y.map((w,k)=>{let T=`/${w.name}`,N=w.description;return{label:{label:T,description:N},insertText:`${T} `,documentation:w.description,range:f,sortText:"a".repeat(k+1),kind:18}})}}})),this._register(this.languageFeaturesService.completionProvider.register({scheme:Y.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:"mcpPromptSlashCommands",triggerCharacters:[yu],provideCompletionItems:async(c,u,p,h)=>{let g=this.chatWidgetService.getWidgetByInputUri(c.uri);if(!g||!g.viewModel)return null;let f=TA(c,u,/\/[\p{L}0-9_.-]*/gu);if(!f)return null;if(phe(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:JUt.ID,title:b.name,arguments:[c,v,b,`${S} `]},insertText:`${S} `,range:f,kind:18}}))}}}))}};hit=I([m(0,zt),m(1,At),m(2,FO),m(3,nr),m(4,Si),m(5,Ls),m(6,es)],hit);oe.as(Qi.Workbench).registerWorkbenchContribution(hit,4);var git=class extends C{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:[yu],provideCompletionItems:async(l,c,u,p)=>{let h=this.chatWidgetService.getWidgetByInputUri(l.uri);if(!h||!h.viewModel)return;let g=TA(l,c,$Ei);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:Y.vscodeChatInput,hasAccessToAllModels:!0},s)),this._register(this.languageFeaturesService.completionProvider.register({scheme:Y.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:"chatAgentAndSubcommand",triggerCharacters:[vg],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=TA(l,c,GEi);if(!f)return null;if(!phe(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,N)=>{let O=T.id==="github.copilot.terminalPanel"?"0000":"";return`${vg}${O}${T.name}.${N}`};return{suggestions:v.filter(T=>!T.isDefault).filter(T=>!S.has(T.id)).map(T=>{let{label:N,isDupe:O}=this.getAgentCompletionDetails(T),V=T.description;return{label:O?{label:N,description:T.description,detail:` (${T.publisherDisplayName})`}:N,documentation:V,filterText:`${vg}${T.name}`,insertText:`${N} `,range:f,kind:18,sortText:`${vg}${T.name}`,command:{id:Z3.ID,title:Z3.ID,arguments:[{agent:T,widget:h}]}}}).concat(si(y.flatMap(T=>T.slashCommands.map((N,O)=>{if(T.isDefault&&this.chatAgentService.getDefaultAgent(h.location,h.input.currentModeKind)?.id!==T.id)return;let{label:V,isDupe:U}=this.getAgentCompletionDetails(T),G=`${V} ${yu}${N.name}`,$={label:U?{label:G,description:N.description,detail:U?` (${T.publisherDisplayName})`:void 0}:G,documentation:N.description,filterText:w(T,N.name),commitCharacters:[" "],insertText:G+" ",range:f,kind:18,sortText:`x${vg}${T.name}${N.name}`,command:{id:Z3.ID,title:Z3.ID,arguments:[{agent:T,widget:h}]}};if(T.isDefault){let te=`${yu}${N.name}`;$.label=te,$.insertText=`${te} `,$.documentation=N.description}return $}))))}}})),this._register(this.languageFeaturesService.completionProvider.register({scheme:Y.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:"chatAgentAndSubcommand",triggerCharacters:[yu],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=TA(l,c,GEi);if(!f)return null;if(!phe(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:si(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=`${yu}${S.name}`,N=b.id==="github.copilot.terminalPanel"?"z":"",O=`${yu}${N}${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:Z3.ID,title:Z3.ID,arguments:[{agent:b,widget:h}]}};if(b.isDefault){let U=`${yu}${S.name}`;V.label=U,V.insertText=`${U} `,V.documentation=S.description}return V})))}}})),this._register(this.languageFeaturesService.completionProvider.register({scheme:Y.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:"installChatExtensions",triggerCharacters:[vg],provideCompletionItems:async(l,c,u,p)=>{if(!l.getLineContent(1).startsWith(vg))return;let h=this.chatWidgetService.getWidgetByInputUri(l.uri);if(h?.location!=="panel"||h.input.currentModeKind!=="ask")return;if(h.lockedAgentId)return null;let g=TA(l,c,GEi);if(!g||!phe(l,g))return;let f=d(7434,null);return{suggestions:[{label:f,insertText:"",range:g,kind:18,command:{id:"workbench.extensions.search",title:"",arguments:["@tag:chat-participant"]},filterText:vg+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 zu);if(o<0)return;let n=t[o],r=t.find(s=>s instanceof Pf||s instanceof Qx);if(r)return{agent:n.agent,command:r instanceof Pf?r.command.name:void 0};for(let s of t.slice(o+1))if(!(s instanceof pb)||!s.text.trim().match(/^(\/[\p{L}0-9_.:-]*)?$/u))return;return{agent:n.agent}}getAgentCompletionDetails(e){let t=this.chatAgentNameService.getAgentNameRestriction(e),o=`${vg}${t?e.name:Hj(e)}`,n=t&&this.chatAgentService.agentHasDupeName(e.id);return{label:o,isDupe:n}}};git=I([m(0,zt),m(1,At),m(2,br),m(3,mz),m(4,Ls)],git);oe.as(Qi.Workbench).registerWorkbenchContribution(git,4);var Z3=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(Z3);var JUt=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(At),c=i.get(be),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 P,v=f.add(new $e);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(M.loading,"spin"))+" chat-prompt-spinner"}});f.add(Z(()=>{e.changeDecorations(w=>w.removeDecoration(y))}))});let b=f.add(r.createInstance(JAe,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(7435,null,String(O))),g("");return}let w=[],k=async(O,V,U,G=!1)=>{let $;if(U)for(let te of[A.parse(U),uw.fromServer(t.definition,U)])try{$||=await c.exists(te)?te:void 0}catch{}if(G)$?w.push({id:_t(),kind:"file",value:$,name:Ye($)}):w.push({id:_t(),kind:"generic",value:V,name:d(7437,null)});else if(O&&X4(O)){let te=await k_(V).catch(()=>Sl(V).buffer);u.attachmentModel.addContext({id:_t(),name:d(7436,null),fullName:d(7436,null),value:te,kind:"image",references:$&&[{reference:$,kind:"reference"}]})}else $&&w.push({id:_t(),kind:"file",value:$,name:Ye($)})},T=y.some(O=>O.role!==y[0].role),N="";for(let O of y)switch(O.content.type){case"text":N&&(N+=`

`),T&&(N+=`--${O.role.toUpperCase()}
`),N+=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(N)}finally{f.dispose()}}};W(JUt);var SNe=class{constructor(i,e){this.widget=i;this.variable=e}},EA=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){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;let v=new RegExp(`${su}[^\\s]*`,"g");this.registerVariableCompletions("fileAndFolder",async({widget:b,range:S},y)=>{if(!b.supportsFileReferences)return;let w={suggestions:[]};if(b.lockedAgentId){let k=this.chatAgentService.getAgent(b.lockedAgentId);if(k&&!k.capabilities?.supportsFileAttachments)return w}return await this.addFileAndFolderEntries(b,w,S,y),w},v),this.registerVariableCompletions("selection",({widget:b,range:S},y)=>{if(!b.supportsFileReferences||b.location==="editor")return;let w=this.findActiveCodeEditor();if(!pn(w))return;let k=w.getModel()?.uri,T=w.getSelection();if(!T||!k||T.isEmpty())return;let N=this.labelService.getUriBasenameLabel(k),O=`${su}file:${N}:${T.startLineNumber}-${T.endLineNumber}`,V=`:${T.startLineNumber}:${T.startColumn}-${T.endLineNumber}:${T.endColumn}`,U=this.labelService.getUriLabel(k,{relative:!0})+V,G={suggestions:[]};return G.suggestions.push({label:{label:`${su}selection`,description:U},filterText:`${su}selection`,insertText:S.varWord?.endColumn===S.replace.endColumn?`${O} `:O,range:S,kind:18,sortText:"z",command:{id:EA.addReferenceCommand,title:"",arguments:[new SNe(b,{id:"vscode.selection",isFile:!0,range:{startLineNumber:S.replace.startLineNumber,startColumn:S.replace.startColumn,endLineNumber:S.replace.endLineNumber,endColumn:S.replace.startColumn+O.length},data:{range:T,uri:k}})]}}),G}),this.registerVariableCompletions("symbol",({widget:b,range:S,position:y,model:w},k)=>{if(!b.supportsFileReferences)return null;let T={suggestions:[]},N=TA(w,y,new RegExp(`${su}[^\\s]*`,"g"),!0);return N&&this.addSymbolEntries(b,T,N,k),T}),this.registerVariableCompletions("debugEventsSnapshot",({widget:b,range:S})=>{if(b.location!=="panel")return;let y=b.viewModel?.sessionResource;if(!y||this.chatDebugService.getEvents(y).length===0)return;let w=`${su}debugEventsSnapshot`,k={suggestions:[]};return k.suggestions.push({label:{label:w,description:d(7432,null)},filterText:w,insertText:"",range:S,kind:18,sortText:"z",command:{id:EA.addDebugEventsSnapshotCommand,title:"",arguments:[b]}}),k}),this._register(qe.registerCommand(EA.addReferenceCommand,(b,S)=>(So(S instanceof SNe),this.cmdAddReference(S)))),this._register(qe.registerCommand(EA.addDebugEventsSnapshotCommand,async(b,S)=>{let y=S.viewModel?.sessionResource;if(!y)return;let w=await bNe(y,this.chatDebugService);S.attachmentModel.addContext(w)}))}static{this.addReferenceCommand="_addReferenceCmd"}static{this.addDebugEventsSnapshotCommand="_addDebugEventsSnapshotCmd"}static{this.VariableNameDef=new RegExp(`${su}[\\w:-]*`,"g")}findActiveCodeEditor(){let e=this.codeEditorService.getActiveCodeEditor();if(e){let t=e.getModel();if(t?.uri.scheme===Y.vscodeNotebookCell)return;if(t)return e}for(let t of this.editorService.getVisibleTextEditorControls(0)){let o=ca(t);if(!o)continue;if(o.getModel())return o}}registerVariableCompletions(e,t,o=EA.VariableNameDef){this._register(this.languageFeaturesService.completionProvider.register({scheme:Y.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:`chatVarCompletions-${e}`,triggerCharacters:[su],provideCompletionItems:async(n,r,s,l)=>{let c=this.chatWidgetService.getWidgetByInputUri(n.uri);if(!c)return;let u=TA(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=(u,p,h,g)=>{let f=this.labelService.getUriBasenameLabel(u),v=`${su}file:${f}`,b=this.labelService.getUriLabel(u,{relative:!0}),S=h?d(7433,null,b,h):b,y=g?" ":"!";return{label:{label:f,description:S},filterText:`${su}${f}`,insertText:o.varWord?.endColumn===o.replace.endColumn?`${v} `:v,range:o,kind:p===0?20:23,sortText:y,command:{id:EA.addReferenceCommand,title:"",arguments:[new SNe(e,{id:u.toString(),isFile:p===0,isDirectory:p===1,range:{startLineNumber:o.replace.startLineNumber,startColumn:o.replace.startColumn,endLineNumber:o.replace.endLineNumber,endColumn:o.replace.startColumn+v.length},data:u})]}}},s;o.varWord?.word&&o.varWord.word.startsWith(su)&&(s=o.varWord.word.toLowerCase().slice(1));let l=new Mn,c=t.suggestions.length;for(let[u,p]of this.historyService.getHistory().entries()){let h=Lj(p)?p.modified.resource:p.resource;if(!h||l.has(h)||!this.instantiationService.invokeFunction(f=>oke(f,h.scheme)))continue;if(s){let f=this.labelService.getUriBasenameLabel(h).toLowerCase();if(!Jqe(s,0,s.length,f,0,f.length))continue}if(l.add(h),t.suggestions.push(r(h,0,u===0?d(7431,null):void 0,u===0))-c>=5)break}if(s){let u=this.updateCacheKey(),p=this.workspaceContextService.getWorkspace().folders.map(h=>h.uri);for(let h of p){let{folders:g,files:f}=await KEi(h,s,!0,n,u.key,this.configurationService,this.searchService);for(let v of f)l.has(v)||(t.suggestions.push(r(v,0)),l.add(v));for(let v of g)l.has(v)||(t.suggestions.push(r(v,1)),l.add(v))}}t.incomplete=!0}addSymbolEntries(e,t,o,n){let s=new En,l=(h,g)=>{let f=`${su}sym:${h.name}`,v=h.location.uri,b=this.labelService.getUriLabel(v,{relative:!0}),S=g?"{":"|";return{label:{label:h.name,description:b},filterText:`${su}${h.name}`,insertText:o.varWord?.endColumn===o.replace.endColumn?`${f} `:f,range:o,kind:sh.toCompletionKind(h.kind),sortText:S,command:{id:EA.addReferenceCommand,title:"",arguments:[new SNe(e,{id:`vscode.symbol/${JSON.stringify(h.location)}`,fullName:h.name,range:{startLineNumber:o.replace.startLineNumber,startColumn:o.replace.startColumn,endLineNumber:o.replace.endLineNumber,endColumn:o.replace.startColumn+f.length},data:h.location,icon:sh.toIcon(h.kind)})]}}},c;o.varWord?.word&&o.varWord.word.startsWith(su)&&(c=o.varWord.word.toLowerCase().slice(1));let u=[];for(let h of this.outlineService.getCachedModels()){let g=h.asListOfDocumentSymbols();for(let f of g)u.push({symbol:f,uri:h.uri})}let p=!1;for(let h of u){if(s.elapsed()>100||n.isCancellationRequested){p=!0;break}t.suggestions.push(l({...h.symbol,location:{uri:h.uri,range:h.symbol.range}},c??""))}t.incomplete=!!c||p}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:_t(),time:Date.now()}),this.cacheKey.time=Date.now(),this.cacheKey}cmdAddReference(e){e.widget.getContrib(JS.ID)?.addReference(e.variable)}};EA=I([m(0,zs),m(1,Pe),m(2,Jp),m(3,ot),m(4,zt),m(5,At),m(6,f_),m(7,ee),m(8,B),m(9,Kt),m(10,br),m(11,F),m(12,em)],EA);oe.as(Qi.Workbench).registerWorkbenchContribution(EA,4);function TA(a,i,e,t=!1){let o=My(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 phe(a,i){let e=new z(1,1,i.replace.startLineNumber,i.replace.startColumn);return!!a.getValueInRange(e).match(/^\s*$/)}var mhe=class extends C{constructor(e,t,o){super();this.languageFeaturesService=e;this.chatWidgetService=t;this.chatAgentService=o;this._register(this.languageFeaturesService.completionProvider.register({scheme:Y.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:"chatVariables",triggerCharacters:[su],provideCompletionItems:async(n,r,s,l)=>{let c=this.chatWidgetService.getWidgetByInputUri(n.uri);if(!c)return null;if(c.lockedAgentId){let f=this.chatAgentService.getAgent(c.lockedAgentId);if(f&&!f.capabilities?.supportsToolAttachments)return null}let u=TA(n,r,mhe.VariableNameDef,!0);if(!u)return null;let p=new Set;for(let f of c.parsedInput.parts)f instanceof ZS?p.add(f.toolName):f instanceof OO&&p.add(f.name);let h=[],g=c.input.selectedToolsModel.entriesMap.get();for(let[f,v]of g){if(!v)continue;let b,S,y;if(Km(f))b=f.description,y=f.referenceName;else{let k=f.source;b=d(7438,null,k.label,f.displayName),y=f.toolReferenceName??f.displayName,S=f.userDescription??f.modelDescription}if(p.has(y))continue;let w=`${su}${y}`;h.push({label:w,range:u,detail:b,documentation:S,insertText:w+" ",kind:27})}return{suggestions:h}}}))}static{this.VariableNameDef=new RegExp(`(?<=^|\\s)${su}\\w*`,"g")}};mhe=I([m(0,zt),m(1,At),m(2,br)],mhe);oe.as(Qi.Workbench).registerWorkbenchContribution(mhe,4);var hhe=new Q("notebookChatAgentRegistered",!1,d(11769,null));async function igo(a,i,e,t,o,n){let r=a.get(B),s=a.get(ge);if(r.getValue(ft.cellGenerate)||r.getValue(ft.cellChat)){let l=i.notebookEditor.getActiveCell(),c=l?.getTextLength()===0&&n!=="insertToolbar"?l:await Awi(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 qu{constructor(){super({id:"notebook.cell.chat.start",title:{value:"$(sparkle) "+d(11761,null),original:"$(sparkle) Generate"},tooltip:d(11762,null),metadata:{description:d(11762,null),args:[{name:"args",schema:{type:"object",required:["index"],properties:{index:{type:"number"},input:{type:"string"},autoSend:{type:"boolean"}}}}]},f1:!1,keybinding:{when:x.and(rr,Kl.isEqualTo(!0),x.not(Uu),hhe,x.or(x.equals(`config.${ft.cellChat}`,!0),x.equals(`config.${ft.cellGenerate}`,!0))),weight:200,primary:2087,secondary:[Ai(2089,39)]},menu:[{id:D.NotebookCellBetween,group:"inline",order:-1,when:x.and(Kl.isEqualTo(!0),hhe,x.or(x.equals(`config.${ft.cellChat}`,!0),x.equals(`config.${ft.cellGenerate}`,!0)))}]})}getEditorContextFromArgsOrActive(a,...i){let[e]=i;if(!e){let n=iRe(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=iRe(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 igo(a,i,e,i.input,i.autoSend,i.source)}});W(class extends qu{constructor(){super({id:"notebook.cell.chat.startAtTop",title:{value:"$(sparkle) "+d(11761,null),original:"$(sparkle) Generate"},tooltip:d(11762,null),f1:!1,menu:[{id:D.NotebookCellListTop,group:"inline",order:-1,when:x.and(Kl.isEqualTo(!0),hhe,x.or(x.equals(`config.${ft.cellChat}`,!0),x.equals(`config.${ft.cellGenerate}`,!0)))}]})}async runWithContext(a,i){await igo(a,i,0,"",!1)}});fe.appendMenuItem(D.NotebookToolbar,{command:{id:"notebook.cell.chat.start",icon:M.sparkle,title:d(11759,null),tooltip:d(11760,null)},order:-10,group:"navigation/add",when:x.and(Kl.isEqualTo(!0),x.notEquals("config.notebook.insertToolbarLocation","betweenCells"),x.notEquals("config.notebook.insertToolbarLocation","hidden"),hhe,x.or(x.equals(`config.${ft.cellChat}`,!0),x.equals(`config.${ft.cellGenerate}`,!0)))});var qEi=class extends wl{constructor(){super({id:"notebook.inlineChat.acceptChangesAndRun",title:L(11756,"Accept and Run"),shortTitle:d(11757,null),tooltip:d(11758,null),icon:M.check,f1:!0,precondition:x.and(Kl.isEqualTo(!0),OZe),keybinding:void 0,menu:[{id:FVt,group:"0_main",order:2,when:x.and(Kl.isEqualTo(!0),ie.inputHasText.toNegated(),Vco.toNegated(),Bco.isEqualTo("messagesAndEdits"))}]})}runEditorCommand(i,e){let t=Epe(i.get(ee)),o=_m.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(ht.single(r))}};W(qEi);var ZUt="kernelVariable",INe=class extends C{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 fit(this.editorService,this.notebookKernelService))),this._ctxHasProvider=hhe.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:Y.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:"chatKernelDynamicCompletions",triggerCharacters:[su],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(`${su}\\w*`,"g"),b=TA(u,p,v,!0);if(!b)return null;let S={suggestions:[]},y=new z(p.lineNumber,b.replace.startColumn,p.lineNumber,b.replace.startColumn+`${su}${ZUt}:`.length);return S.suggestions.push({label:`${su}${ZUt}`,insertText:`${su}${ZUt}:`,detail:d(11767,null),range:b,kind:18,command:{id:ghe.ID,title:ghe.ID,arguments:[{widget:f,range:y}]},sortText:"z"}),await this.addKernelVariableCompletion(f,S,b,g),S}})),yyi.bindTo(e).set($Ze)}static{this.ID="workbench.contrib.notebookChatContribution"}async addKernelVariableCompletion(e,t,o,n){let r;o.varWord?.word&&o.varWord.word.startsWith(su)&&(r=o.varWord.word.toLowerCase().slice(1));let s=qn(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,ve.None);for await(let p of u)r&&!p.name.toLowerCase().includes(r)||t.suggestions.push({label:{label:p.name,description:p.type},insertText:`${su}${ZUt}:${p.name} `,filterText:`${su}${p.name}`,range:o,kind:4,sortText:"z",command:{id:ghe.ID,title:ghe.ID,arguments:[{widget:e,range:o.insert,variable:p.name}]},detail:p.type,documentation:p.value})}};INe=I([m(0,X),m(1,br),m(2,ee),m(3,At),m(4,Tl),m(5,zt),m(6,uS)],INe);var ghe=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(Tl),n=i.get(Ge),r=qn(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,ve.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(11768,null):d(11765,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(JS.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:R6.variable})}else i.attachmentModel.addContext({id:"vscode.notebook.variable",name:e,value:e,icon:R6.variable,kind:"generic"})}},fit=class{constructor(i,e){this.editorService=i;this.notebookKernelService=e;this.type="pickerPick";this.label=d(11763,null);this.icon=M.serverEnvironment}isEnabled(i){return i.location==="notebook"&&!!qn(this.editorService.activeEditorPane)?.getViewModel()?.notebookDocument}asPicker(){let i=(async()=>{let e=qn(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,ve.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:R6.variable})});return r})();return{placeholder:d(11764,null),picks:i}}};fit=I([m(0,ee),m(1,Tl)],fit);W(class extends K{constructor(){super({id:"notebook.cellOutput.addToChat",title:d(11766,null),menu:{id:D.NotebookOutputToolbar,when:x.and(gk,x.in(XLe.key,yyi.key)),order:10,group:"notebook_chat_actions"},category:jm,icon:zJe,precondition:ie.enabled})}getNoteboookEditor(i,e){return e&&"notebookEditor"in e?e.notebookEditor:qn(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=bZe(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(At),s=await r.revealWidget();if(s&&n&&$Ze.includes(n)){let l=zVt(o,n,t);if(!l)return;s.attachmentModel.addContext(l),(await r.revealWidget())?.focusInput()}}});W(ghe);pt(INe.ID,INe,ut.BlockRestore);var fhe=new Q("notebookVariableViewEnabled",!1);var lXo="notebook.openVariablesView";W(class extends qu{constructor(){super({id:lXo,title:L(11870,"Variables"),icon:DWt,menu:[{id:D.InteractiveToolbar,group:"navigation",when:x.and(tRe,x.notEquals("jupyter.kernel.isjupyter",!0),fhe)},{id:D.EditorTitle,order:-1,group:"navigation",when:x.and(tRe,x.notEquals("jupyter.kernel.isjupyter",!0),x.notEquals("config.notebook.globalToolbar",!0),fhe)},{id:D.NotebookToolbar,order:-1,group:"navigation",when:x.and(tRe,x.notEquals("jupyter.kernel.isjupyter",!0),x.equals("config.notebook.globalToolbar",!0),fhe)}]})}async runWithContext(i,e){i.get(Ft).openView("workbench.notebook.variables",!0)}});var jEi="workbench.editor.empty.hint",Ate=class extends C{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(jEi)&&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(jEi)==="hidden"||this.editor.getOption(104))return!1;let t=this.editor.getModel(),o=t?.getLanguageId();if(!t||o===bEe||o===SEe||o===Vz||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===Y.untitled&&o===Fr;return r||s}update(){let e=this.shouldRenderHint();e&&!this.textHintContentWidget?this.textHintContentWidget=this.instantiationService.createInstance(vhe,this.editor):!e&&this.textHintContentWidget&&(this.textHintContentWidget.dispose(),this.textHintContentWidget=void 0)}dispose(){super.dispose(),this.textHintContentWidget?.dispose()}};Ate=I([m(1,B),m(2,Ik),m(3,br),m(4,F)],Ate);var vhe=class extends C{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=H.debounce(this.editor.onDidFocusEditorText,()=>{},500);this._register(c(()=>{this.editor.hasTextFocus()&&this.isVisible&&this.ariaLabel&&this.configurationService.getValue("accessibility.verbosity.emptyEditorHint")&&Or(this.ariaLabel)})),this.editor.addContentWidget(this)}static{this.ID="editor.widget.emptyHint"}getId(){return vhe.ID}disableHint(e){let t=()=>{this.configurationService.updateValue(jEi,"hidden"),this.dispose(),this.editor.focus()};if(!e){t();return}this.contextMenuService.showContextMenu({getAnchor:()=>new yn(Ki(),e),getActions:()=>[{id:"workench.action.disableEmptyEditorHint",label:d(8292,null),tooltip:d(8292,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:bJ.ID,from:"hint"}),await this.commandService.executeCommand(bJ.ID),this.editor.focus()},l=[o,bJ.ID].map(h=>this.keybindingService.lookupKeybinding(h)?.getLabel()),c=(e?d(8294,null,l.at(0)??"",l.at(1)??""):d(8295,null,l.at(1)??"")).replaceAll(" ()",""),u=RL(c,{actionHandler:t,renderCodeSegments:!1});u.style.fontStyle="italic";let p=e?d(8290,null,...l):d(8291,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(8293,null,"accessibility.verbosity.emptyEditorHint")),this._register(j(this.domNode,"click",()=>{this.editor.focus()})),this.editor.applyFontInfo(this.domNode);let o=this.editor.getLineHeightForPosition(new Ie(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)}};vhe=I([m(1,ge),m(2,B),m(3,_e),m(4,br),m(5,Te),m(6,ze)],vhe);go(Ate.ID,Ate,0);var yNe=class extends Ate{constructor(e,t,o,n,r,s){super(e,o,n,r,s);this._editorService=t;let l=qn(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===Y.vscodeNotebookCell))return!1;let o=qn(this._editorService.activeEditorPane);return!(!o||!o.isDisposed||!super.shouldRenderHint()||o.getActiveCell()?.uri.fragment!==e.uri.fragment)}};yNe=I([m(1,ee),m(2,B),m(3,Ik),m(4,br),m(5,F)],yNe);go(yNe.CONTRIB_ID,yNe,0);var e1t=!1;function dXo(){e1t=!e1t}function e8(a,i){e1t&&a.info(`[NotebookClipboard]: ${i}`)}function ogo(a){let i=a.get(ne),e=a.get(ee),t=qn(e.activeEditorPane);if(!t){e8(i,"[Revive Webview] No notebook editor found for active editor pane, bypass");return}if(!t.hasEditorFocus()){e8(i,"[Revive Webview] Notebook editor is not focused, bypass");return}if(!t.hasWebviewFocus()){e8(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 uXo(a){let i=ogo(a);if(!i)return;let e=i.editor.getInnerWebview();return e8(i.loggerService,"[Revive Webview] Notebook editor backlayer webview is focused"),e}function vit(a,i){let e=uXo(a);return e?(i(e),!0):!1}function pXo(a,i){let e=ogo(a);return e?i(e.editor):!1}var bit=105;BT.addImplementation(bit,"notebook-webview",a=>vit(a,i=>i.undo()));HT.addImplementation(bit,"notebook-webview",a=>vit(a,i=>i.redo()));$M?.addImplementation(bit,"notebook-webview",a=>vit(a,i=>i.copy()));GM?.addImplementation(bit,"notebook-webview",a=>vit(a,i=>i.paste()));EW?.addImplementation(bit,"notebook-webview",a=>vit(a,i=>i.cut()));function ngo(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=>jK(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=>jK(n))}],!0,o,()=>({kind:1,focus:{start:0,end:1},selections:[{start:1,end:e.items.length+1}]}),void 0,!0)}return!0}function rgo(a,i,e){if(!i.hasModel())return!1;if(i.hasOutputTextSelection())return Me(i.getDomNode()).document.execCommand("copy"),!0;let t=a.get(Wi),o=a.get(un),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=wY(i,i.getSelections()),s=_8e(i,r);return s.length?(t.writeText(s.map(l=>l.getText()).join(`
`)),o.setToCopy(s.map(l=>l.model),!0),!0):!1}function sgo(a,i,e){if(!i.hasModel()||i.isReadOnly)return!1;let t=i.textModel,o=a.get(Wi),n=a.get(un),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=wY(i,i.getSelections()),u=_8e(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 wNe=class extends C{constructor(e){super();this._editorService=e;let t=105;$M&&this._register($M.addImplementation(t,"notebook-clipboard",o=>this.runCopyAction(o))),GM&&this._register(GM.addImplementation(t,"notebook-clipboard",o=>this.runPasteAction(o))),EW&&this._register(EW.addImplementation(t,"notebook-clipboard",o=>this.runCutAction(o)))}static{this.ID="workbench.contrib.notebookClipboard"}_getContext(){let e=qn(this._editorService.activeEditorPane),t=e?.getActiveCell();return{editor:e,activeCell:t}}_focusInsideEmebedMonaco(e){let t=Me(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(ne),o=Pn();if(Ao(o)&&Oh(o))return e8(t,"[NotebookEditor] focus is on input or textarea element, bypass"),!1;let{editor:n}=this._getContext();return n?n.hasEditorFocus()?this._focusInsideEmebedMonaco(n)?(e8(t,"[NotebookEditor] focus is on embed monaco editor, bypass"),!1):(e8(t,"[NotebookEditor] run copy actions on notebook model"),rgo(e,n,void 0)):(e8(t,"[NotebookEditor] focus is outside of the notebook editor, bypass"),!1):(e8(t,"[NotebookEditor] no active notebook editor, bypass"),!1)}runPasteAction(e){let t=Pn();if(t&&Oh(t))return!1;let{editor:o,activeCell:n}=this._getContext();if(!o||!o.hasEditorFocus()||this._focusInsideEmebedMonaco(o))return!1;let s=e.get(un).getToCopy();return s?ngo(o,n,s):!1}runCutAction(e){let t=Pn();if(t&&Oh(t))return!1;let{editor:o}=this._getContext();return!o||!o.hasEditorFocus()||this._focusInsideEmebedMonaco(o)?!1:sgo(e,o,void 0)}};wNe=I([m(0,ee)],wNe);pt(wNe.ID,wNe,ut.BlockRestore);var mXo="notebook.cell.copy",hXo="notebook.cell.cut",gXo="notebook.cell.paste",fXo="notebook.cell.pasteAbove";W(class extends gd{constructor(){super({id:mXo,title:d(11655,null),menu:{id:D.NotebookCellTitle,when:rr,group:"1_copy",order:2},keybinding:kr?void 0:{primary:2081,win:{primary:2081,secondary:[2067]},when:x.and(rr,x.not(Uu)),weight:200}})}async runWithContext(a,i){rgo(a,i.notebookEditor,i.cell)}});W(class extends gd{constructor(){super({id:hXo,title:d(11656,null),menu:{id:D.NotebookCellTitle,when:x.and(rr,Kl,bw),group:"1_copy",order:1},keybinding:kr?void 0:{when:x.and(rr,x.not(Uu)),primary:2102,win:{primary:2102,secondary:[1044]},weight:200}})}async runWithContext(a,i){sgo(a,i.notebookEditor,i.cell)}});W(class extends qu{constructor(){super({id:gXo,title:d(11657,null),menu:{id:D.NotebookCellTitle,when:x.and(rr,Kl),group:"1_copy",order:3},keybinding:kr?void 0:{when:x.and(rr,x.not(Uu)),primary:2100,win:{primary:2100,secondary:[1043]},linux:{primary:2100,secondary:[1043]},weight:100}})}async runWithContext(a,i){let t=a.get(un).getToCopy();!i.notebookEditor.hasModel()||i.notebookEditor.isReadOnly||t&&ngo(i.notebookEditor,i.cell,t)}});W(class extends gd{constructor(){super({id:fXo,title:d(11658,null),keybinding:{when:x.and(rr,x.not(Uu)),primary:3124,weight:rf}})}async runWithContext(a,i){let t=a.get(un).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=>jK(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(11659,"Toggle Notebook Clipboard Troubleshooting"),category:We.Developer,f1:!0})}run(a){dXo(),e1t&&a.get(ge).executeCommand(iK)}});W(class extends gd{constructor(){super({id:"notebook.cell.output.selectAll",title:d(11654,null),keybinding:{primary:2079,when:x.and(rr,PR),weight:Kao}})}async runWithContext(a,i){pXo(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 Sit="find-hide-transition",CNe="find-show-transition",QEi=69,YEi=200,kw=class extends C{constructor(e,t){super();this.notebookEditor=e;this.instantiationService=t;this._widget=new co(()=>this._register(this.instantiationService.createInstance(Iit,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()}};kw=I([m(1,F)],kw);var Iit=class extends rNe{constructor(e,t,o,n,r,s,l,c){let u=h_.getOrCreate(c),p=g_.getOrCreate(c);super(t,o,n,r,l,s,new G1,e,u,p);this._isFocused=!1;this._showTimeout=null;this._hideTimeout=null;this._findModel=new FRe(this._notebookEditor,this._state,this._configurationService),R(this._notebookEditor.getDomNode(),this.getDomNode()),this._findWidgetFocused=gWt.bindTo(o),this._findWidgetVisible=fE.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(YEi):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=Ao(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(YEi);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(YEi);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&&(Me(this.getDomNode()).clearTimeout(this._hideTimeout),this._hideTimeout=null,this._notebookEditor.removeClassName(Sit)),this._notebookEditor.addClassName(CNe),this._showTimeout=Me(this.getDomNode()).setTimeout(()=>{this._notebookEditor.removeClassName(CNe),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&&(Me(this.getDomNode()).clearTimeout(this._hideTimeout),this._hideTimeout=null,this._notebookEditor.removeClassName(Sit)),this._notebookEditor.addClassName(CNe),this._showTimeout=Me(this.getDomNode()).setTimeout(()=>{this._notebookEditor.removeClassName(CNe),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&&(Me(this.getDomNode()).clearTimeout(this._showTimeout),this._showTimeout=null,this._notebookEditor.removeClassName(CNe)),this._notebookEditor.addClassName(Sit),this._hideTimeout=Me(this.getDomNode()).setTimeout(()=>{this._notebookEditor.removeClassName(Sit)},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=QEi+"px",this._matchesCount.title="",this._matchesCount.firstChild?.remove();let e;if(this._state.matchesCount>0){let t=String(this._state.matchesCount);this._state.matchesCount>=rO&&(t+="+");let o=this._findModel.currentMatch<0?"?":String(this._findModel.currentMatch+1);e=id(T5e,o,t)}else e=w7;this._matchesCount.appendChild(document.createTextNode(e)),Jo(this._getAriaLabel(e,this._state.currentMatch,this._state.searchString)),QEi=Math.max(QEi,this._matchesCount.clientWidth)}_getAriaLabel(e,t,o){return e===w7?o===""?d(11691,null,e):d(11690,null,e,o):d(11692,null,e,o)}dispose(){this._notebookEditor?.removeClassName(CNe),this._notebookEditor?.removeClassName(Sit),this._findModel.dispose(),super.dispose()}};Iit=I([m(1,_n),m(2,X),m(3,B),m(4,ze),m(5,tt),m(6,F),m(7,le)],Iit);tm(kw.id,kw);W(class extends K{constructor(){super({id:"notebook.hideFind",title:L(11672,"Hide Find in Notebook"),keybinding:{when:x.and(rr,fE),primary:9,weight:105}})}async run(a){let i=a.get(ee),e=qn(i.activeEditorPane);if(!e)return;e.getContribution(kw.id).hide(),e.focus()}});W(class extends xg{constructor(){super({id:"notebook.find",title:L(11671,"Find in Notebook"),keybinding:{when:x.and(rr,x.or(Ua,FJe),ue.focus.toNegated()),primary:2084,weight:200}})}async runWithContext(a,i){let e=a.get(ee),t=qn(e.activeEditorPane);if(!t)return;t.getContribution(kw.id).show(void 0,{findScope:{findScopeType:"none"}})}});function vXo(a,i){if(i.uri.scheme===Y.vscodeNotebookCell){let e=Zo.parse(i.uri);if(e&&Xe(e.notebook,a))return!0}return!1}function ago(a,i){if(i.seedSearchStringFromSelection==="single"){let e=R7(a,i.seedSearchStringFromSelection,i.seedSearchStringFromNonEmptySelection);if(e)return{searchString:e,selection:a.getSelection()}}else if(i.seedSearchStringFromSelection==="multiple"&&!i.updateSearchScope){let e=R7(a,i.seedSearchStringFromSelection);if(e)return{searchString:e,selection:a.getSelection()}}}function lgo(a,i,e){if(!i||!e.hasModel())return!1;if(!i.hasEditorFocus()&&!i.hasWebviewFocus()){let t=a.get(Kt),o=t.getFocusedCodeEditor()||t.getActiveCodeEditor();return!!(i.hasModel()&&o&&o.hasModel()&&vXo(i.textModel.uri,o.getModel()))}return!0}function cgo(a,i,e,t=!0){if(!i||!e||!a||!e.hasModel())return!1;let o=ago(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 dgo(a,i,e){let t=a.get(ee),o=qn(t.activeEditorPane);if(!lgo(a,o,i))return!1;let n=o?.getContribution(kw.id);return n?n.isVisible()?(e?n.findNext():n.findPrevious(),!0):cgo(n,o,i,!1):!1}async function ugo(a,i){let e=a.get(ee),t=qn(e.activeEditorPane);if(!t)return;let o=t.getContribution(kw.id);o&&o.isVisible()&&(i?o.findNext():o.findPrevious())}uri.addImplementation(100,(a,i,e)=>{let t=a.get(ee),o=qn(t.activeEditorPane);if(!lgo(a,o,i))return!1;let n=o?.getContribution(kw.id);return cgo(n,o,i,!0)});hri.addImplementation(100,(a,i,e)=>{let t=a.get(ee),o=qn(t.activeEditorPane);if(!o||!i.hasModel())return!1;let n=o.getContribution(kw.id),r=ago(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});pri.addImplementation(100,(a,i,e)=>dgo(a,i,!0));mri.addImplementation(100,(a,i,e)=>dgo(a,i,!1));W(class extends K{constructor(){super({id:"notebook.findNext.fromWidget",title:L(11669,"Find Next"),keybinding:{when:x.and(rr,fE),primary:61,mac:{primary:2085,secondary:[61]},weight:201}})}async run(a){return ugo(a,!0)}});W(class extends K{constructor(){super({id:"notebook.findPrevious.fromWidget",title:L(11670,"Find Previous"),keybinding:{when:x.and(rr,fE),primary:1085,mac:{primary:3109,secondary:[1085]},weight:201}})}async run(a){return ugo(a,!1)}});var bXo="notebook.addFindMatchToSelection",SXo="notebook.selectAllFindMatches";var QC={IsNotebookMultiCursor:new Q("isNotebookMultiSelect",!1),NotebookMultiSelectCursorState:new Q("notebookMultiSelectCursorState",0)},yD=class extends C{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 P),this.cursorsDisposables=this._register(new P),this.cursorsControllers=new vt,this.state=0,this._nbIsMultiSelectSession=QC.IsNotebookMultiCursor.bindTo(this.contextKeyService),this._nbMultiSelectState=QC.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 VM;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 VM,"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 Yt.createWithDirection(u,c,h,p,o)});r.setSelections(new VM,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 VM,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 wye(o,n,r,new rW(o.getLanguageId(),o.getOptions(),s,this.languageConfigurationService)));return l.setSelections(new VM,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 yye(e.textBuffer.getLineContent(t))+1}}}handleEditorOperationEvent(e){this.trackedCells.forEach(t=>{if(t.cellViewModel.handle===this.anchorCell?.[0].handle)return;let o=new VM,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 vt,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,tW);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 Ie(o.startLineNumber,n.startColumn)};let l=new Yt(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 jr))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,tW,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(),Yt.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,[Yt.fromRange(r.match.range,0)]);if(s.setSelections(l.matchSelections),this.anchorCell=this.notebookEditor.activeCellAndCodeEditor,!this.anchorCell||!(this.anchorCell[1]instanceof jr))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=>Yt.fromRange(o.range,0))),this.anchorCell&&t.cell.handle===this.anchorCell[0].handle&&t.cell.setSelections(t.contentMatches.map(o=>Yt.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 Ie(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 jr))throw new Error("Active cell is not an instance of CodeEditorWidget");let l=e.findMatches(this.word,!1,!0,tW);this.trackedCells=[];for(let c of l)if(await this.updateTrackedCell(c.cell,c.matches.map(u=>Yt.fromRange(u.range,0))),c.cell.handle===t.handle){let u=this.notebookEditor.getCellByHandle(c.cell.handle);u&&u.setSelections(c.matches.map(p=>Yt.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,tW);for(let n of o)await this.updateTrackedCell(n.cell,n.matches.map(r=>Yt.fromRange(r.range,0)))}}async updateTrackedCell(e,t){let o=e instanceof M4?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:kmt(c.cursorStyle),cursorBlinking:gYt(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]=wN.deleteLeft(t.getPrevEditOperationType(),t.context.cursorConfig,t.context.model,t.getSelections(),t.getAutoClosedCharacters()),n=V9.executeCommands(t.context.model,t.getSelections(),o);n&&t.setSelections(new VM,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]=wN.deleteRight(t.getPrevEditOperationType(),t.context.cursorConfig,t.context.model,t.getSelections());if(e.cellViewModel.handle!==this.anchorCell?.[0].handle){let n=V9.executeCommands(t.context.model,t.getSelections(),o);if(!n)return;t.setSelections(new VM,void 0,n,3)}else t.setSelections(new VM,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 $F(this.notebookEditor.getBaseCellEditorOptions(e.language),this.notebookEditor.notebookOptions,this.configurationService),o=t.getUpdatedValue(e.internalMetadata,e.uri);return t.dispose(),new i9(!1,D.EditorContent,o,null,this.accessibilityService)}initializeMultiSelectDecorations(e){if(!e)return;let t=[];e.matchSelections.forEach(o=>{t.push({range:Yt.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:Yt.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=[]}};yD=I([m(1,X),m(2,Nt),m(3,bs),m(4,Bi),m(5,B),m(6,Cl)],yD);var XEi=class extends qu{constructor(){super({id:SXo,title:d(11703,null),precondition:x.and(x.equals("config.notebook.multiCursor.enabled",!0)),keybinding:{when:x.or(x.and(x.equals("config.notebook.multiCursor.enabled",!0),Ua,AR),x.and(x.equals("config.notebook.multiCursor.enabled",!0),gWt)),primary:3114,weight:200}})}async runWithContext(i,e){let t=i.get(ee),o=qn(t.activeEditorPane);if(!o||!e.cell)return;let n=o.getContribution(yD.id),r=o.getContribution(kw.id);if(r.widget.isFocused){let s=r.widget.findModel;n.selectAllMatches(e.cell,s.findMatches)}else n.selectAllMatches(e.cell)}},JEi=class extends qu{constructor(){super({id:bXo,title:d(11699,null),precondition:x.and(x.equals("config.notebook.multiCursor.enabled",!0),Ua,AR),keybinding:{when:x.and(x.equals("config.notebook.multiCursor.enabled",!0),Ua,AR),primary:2082,weight:200}})}async runWithContext(i,e){let t=i.get(ee),o=qn(t.activeEditorPane);if(!o||!e.cell)return;o.getContribution(yD.id).findAndTrackNextSelection(e.cell)}},ZEi=class extends qu{constructor(){super({id:"noteMultiCursor.exit",title:d(11702,null),precondition:x.and(x.equals("config.notebook.multiCursor.enabled",!0),Ua,QC.IsNotebookMultiCursor),keybinding:{when:x.and(x.equals("config.notebook.multiCursor.enabled",!0),Ua,QC.IsNotebookMultiCursor),primary:9,weight:200}})}async runWithContext(i,e){let t=i.get(ee),o=qn(t.activeEditorPane);if(!o)return;o.getContribution(yD.id).resetToIdleState()}},eTi=class extends qu{constructor(){super({id:"noteMultiCursor.deleteLeft",title:d(11700,null),precondition:x.and(x.equals("config.notebook.multiCursor.enabled",!0),Ua,QC.IsNotebookMultiCursor,x.or(QC.NotebookMultiSelectCursorState.isEqualTo(1),QC.NotebookMultiSelectCursorState.isEqualTo(2))),keybinding:{when:x.and(x.equals("config.notebook.multiCursor.enabled",!0),Ua,QC.IsNotebookMultiCursor,x.or(QC.NotebookMultiSelectCursorState.isEqualTo(1),QC.NotebookMultiSelectCursorState.isEqualTo(2))),primary:1,weight:200}})}async runWithContext(i,e){let t=i.get(ee),o=qn(t.activeEditorPane);if(!o)return;o.getContribution(yD.id).deleteLeft()}},tTi=class extends qu{constructor(){super({id:"noteMultiCursor.deleteRight",title:d(11701,null),precondition:x.and(x.equals("config.notebook.multiCursor.enabled",!0),Ua,QC.IsNotebookMultiCursor,x.or(QC.NotebookMultiSelectCursorState.isEqualTo(1),QC.NotebookMultiSelectCursorState.isEqualTo(2))),keybinding:{when:x.and(x.equals("config.notebook.multiCursor.enabled",!0),Ua,QC.IsNotebookMultiCursor,x.or(QC.NotebookMultiSelectCursorState.isEqualTo(1),QC.NotebookMultiSelectCursorState.isEqualTo(2))),primary:20,weight:200}})}async runWithContext(i,e){let t=i.get(ee),o=qn(t.activeEditorPane);if(!o)return;let n=o.activeCodeEditor;if(!n)return;rL.DeleteRight.runEditorCommand(i,n,null),o.getContribution(yD.id).deleteRight()}},xNe=class extends C{constructor(e,t){super();this._editorService=e;this.configurationService=t;if(!this.configurationService.getValue("notebook.multiCursor.enabled"))return;let o=10005;this._register(BT.addImplementation(o,"notebook-multicursor-undo-redo",()=>{let n=qn(this._editorService.activeEditorPane);return!n||!n.hasModel()?!1:n.getContribution(yD.id).undo()},x.and(x.equals("config.notebook.multiCursor.enabled",!0),Ua,QC.IsNotebookMultiCursor))),this._register(HT.addImplementation(o,"notebook-multicursor-undo-redo",()=>{let n=qn(this._editorService.activeEditorPane);return!n||!n.hasModel()?!1:n.getContribution(yD.id).redo()},x.and(x.equals("config.notebook.multiCursor.enabled",!0),Ua,QC.IsNotebookMultiCursor)))}static{this.ID="workbench.contrib.notebook.multiCursorUndoRedo"}};xNe=I([m(0,ee),m(1,B)],xNe);tm(yD.id,yD);pt(xNe.ID,xNe,ut.BlockRestore);W(XEi);W(JEi);W(ZEi);W(eTi);W(tTi);var Tit=class{constructor(i){this._editorService=i}canParticipate(){let e=qn(this._editorService.activeEditorPane)?.getContribution(yD.id);return e?e.getState()!==2:!0}},yit=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 AV)||e.reason===2||!this.configurationService.getValue(ft.formatOnSave))return;t.report({message:d(11739,null)});let r=i.model.notebookModel,s=await this.instantiationService.invokeFunction(bhe.checkAndRunFormatCodeAction,r,t,o),l=new P;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 u4e(this.editorWorkerService,this.languageFeaturesService,h,2,o),f=[];return g?(f.push(...g.map(v=>new ja(h.uri,v,h.getVersionId()))),f):[]}));await this.bulkEditService.apply(c.flat(),{label:d(11737,null),code:"undoredo.formatNotebook"})}}finally{t.report({increment:100}),l.dispose()}}};yit=I([m(0,$s),m(1,zt),m(2,F),m(3,Nt),m(4,ma),m(5,B)],yit);var wit=class extends Tit{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 AV))return;let r=new P,s=e.model.notebookModel,l=iTi(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=Qr.get(l)?.getSessionEnclosingRange();if(y)for(let w=y.startLineNumber;w<=y.endLineNumber;w++)c.push(new Ie(w,v.getLineMaxColumn(w)))}let S=b4e(v,c,o);return S.length?S.map(y=>new ja(v.uri,{...y,text:y.text||""},v.getVersionId())):[]}))).flat().filter(g=>g!==void 0);await this.bulkEditService.apply(h,{label:d(11744,null),code:"undoredo.notebookTrimTrailingWhitespace"})}finally{n.report({increment:100}),r.dispose()}}};wit=I([m(0,B),m(1,ee),m(2,Nt),m(3,ma)],wit);var Cit=class extends Tit{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 AV))return;let n=new P,r=e.model.notebookModel,s=iTi(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 ja(u.uri,{range:b,text:""},u.textModel?.getVersionId())}))).flat().filter(u=>u!==void 0);await this.bulkEditService.apply(c,{label:d(11743,null),code:"undoredo.trimFinalNewLines"})}finally{o.report({increment:100}),n.dispose()}}};Cit=I([m(0,B),m(1,ee),m(2,ma)],Cit);var xit=class extends Tit{constructor(e,t,o){super(o);this.configurationService=e;this.bulkEditService=t;this.editorService=o}async participate(e,t,o,n){this.configurationService.getValue(ft.insertFinalNewline)&&this.canParticipate()&&await this.doInsertFinalNewLine(e,t.reason===2,o)}async doInsertFinalNewLine(e,t,o){if(!e.model||!(e.model instanceof AV))return;let n=new P,r=e.model.notebookModel,s=iTi(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 ja(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(11738,null),code:"undoredo.insertFinalNewLine"}),s&&l&&s.setSelections(l)}finally{o.report({increment:100}),n.dispose()}}};xit=I([m(0,B),m(1,ma),m(2,ee)],xit);var kit=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 AV))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(ft.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=>!gr.Notebook.contains(v)),f=h.filter(v=>gr.Notebook.contains(v));if(f.length){let v=new P;t.report({message:d(11742,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(bhe.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)=>gr.SourceFixAll.contains(b)?gr.SourceFixAll.contains(S)?0:-1:gr.SourceFixAll.contains(S)?1:0);let v=new P;t.report({message:d(11740,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(bhe.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 Is(t));return e.filter(t=>e.every(o=>o.equals(t)||!o.contains(t)))}};kit=I([m(0,B),m(1,ne),m(2,ns),m(3,Nt),m(4,F)],kit);var bhe=class a{static async checkAndRunFormatCodeAction(i,e,t,o){let n=i.get(F),r=i.get(Nt),s=i.get(ne),l=i.get(B),c=new P,u=!1;t.report({message:d(11741,null)});try{let p=e.cells[0],h=await r.createModelReference(p.uri);c.add(h);let g=h.object.textEditorModel,f=l.getValue(ft.defaultFormatter);u=await n.invokeFunction(a.applyOnSaveFormatCodeAction,g,new Is("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(zt),c=i.get(ne),u=new class{constructor(){this._names=new Set}_report(){n.report({message:d(11736,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&&Xe(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(11735,null,g.action.title)}),await s.invokeFunction(Nq,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(zt),u=i.get(ne),p=new class{constructor(){this._names=new Set}_report(){r.report({message:d(11736,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(11735,null,g.action.title)}),await l.invokeFunction(Nq,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 DL(o.codeActionProvider,i,i.getFullModelRange(),{type:1,triggerAction:"save participants",filter:{include:e,excludes:t,includeSourceActions:!0}},n,r)}};function iTi(a){let i=a.activeEditorPane;return qn(i)?.activeCodeEditor}var Eit=class extends C{constructor(e,t){super();this.instantiationService=e;this.workingCopyFileService=t;this.registerSaveParticipants()}registerSaveParticipants(){this._register(this.workingCopyFileService.addSaveParticipant(this.instantiationService.createInstance(wit))),this._register(this.workingCopyFileService.addSaveParticipant(this.instantiationService.createInstance(kit))),this._register(this.workingCopyFileService.addSaveParticipant(this.instantiationService.createInstance(yit))),this._register(this.workingCopyFileService.addSaveParticipant(this.instantiationService.createInstance(xit))),this._register(this.workingCopyFileService.addSaveParticipant(this.instantiationService.createInstance(Cit)))}};Eit=I([m(0,F),m(1,kp)],Eit);var IXo=oe.as(Qi.Workbench);IXo.registerWorkbenchContribution(Eit,3);W(class extends K{constructor(){super({id:"notebook.format",title:L(11693,"Format Notebook"),category:jm,precondition:x.and(Ua,Kl),keybinding:{when:ue.editorTextFocus.toNegated(),primary:1572,linux:{primary:3111},weight:200},f1:!0,menu:{id:D.EditorContext,when:x.and(ue.inCompositeEditor,ue.hasDocumentFormattingProvider),group:"1_modification",order:1.3}})}async run(a){let i=a.get(ee),e=a.get(Nt),t=a.get($s),o=a.get(zt),n=a.get(ma),r=a.get(F),s=qn(i.activeEditorPane);if(!s||!s.hasModel())return;let l=s.textModel,c=await r.invokeFunction(bhe.checkAndRunFormatCodeAction,l,bm.None,ve.None),u=new P;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 u4e(t,o,f,1,ve.None),b=[];if(v){for(let S of v)b.push(new ja(f.uri,S,f.getVersionId()));return b}return[]}));await n.apply(p.flat(),{label:d(11696,null),code:"undoredo.formatNotebook"})}}finally{u.dispose()}}});Jt(class extends xi{constructor(){super({id:"notebook.formatCell",label:L(11694,"Format Cell"),precondition:x.and(Ua,Kl,ue.inCompositeEditor,ue.writable,ue.hasDocumentFormattingProvider),kbOpts:{kbExpr:x.and(ue.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(vle,e,1,bm.None,ve.None,!0)}});var _it=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(ft.formatOnCellExecution))return;let t=new P;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 u4e(this.editorWorkerService,this.languageFeaturesService,c,2,ve.None),p=[];return u?(p.push(...u.map(h=>new ja(c.uri,h,c.getVersionId()))),p):[]}));await this.bulkEditService.apply(o.flat(),{label:d(11695,null),code:"undoredo.notebooks.onWillExecuteFormat"})}finally{t.dispose()}}};_it=I([m(0,ma),m(1,zt),m(2,Nt),m(3,$s),m(4,B),m(5,un)],_it);var Dit=class extends C{constructor(e,t){super();this.instantiationService=e;this.notebookExecutionService=t;this.registerKernelExecutionParticipants()}registerKernelExecutionParticipants(){this._register(this.notebookExecutionService.registerExecutionParticipant(this.instantiationService.createInstance(_it)))}};Dit=I([m(0,F),m(1,AY)],Dit);var yXo=oe.as(Qi.Workbench);yXo.registerWorkbenchContribution(Dit,3);var t1t="hasOpenedNotebook",pgo="hasShownNotebookGettingStarted",Lit=class extends C{constructor(i,e,t,o,n){super();let r=Fao.bindTo(t),s=new Bl("notebookGettingStarted2",e),l=s.getMemento(0,0);l[t1t]&&r.set(!0);let c=n.getValue(ft.openGettingStarted)&&!l[pgo];if(!l[t1t]||c){let u=()=>{r.set(!0),l[t1t]=!0,c&&(o.executeCommand("workbench.action.openWalkthrough",{category:"notebooks",step:"notebookProfile"},!0),l[pgo]=!0),s.saveMemento()};if(i.activeEditor?.typeId===ha.ID){u();return}let p=this._register(i.onDidActiveEditorChange(()=>{i.activeEditor?.typeId===ha.ID&&(p.dispose(),u())}))}}};Lit=I([m(0,ee),m(1,le),m(2,X),m(3,ge),m(4,B)],Lit);oe.as(Qi.Workbench).registerWorkbenchContribution(Lit,3);W(class extends K{constructor(){super({id:"workbench.notebook.layout.gettingStarted",title:L(11697,"Reset notebook getting started"),f1:!0,precondition:x.equals(`config.${ft.openGettingStarted}`,!0),category:We.Developer})}run(i){let e=i.get(le),t=new Bl("notebookGettingStarted",e),o=t.getMemento(0,0);o[t1t]=void 0,t.saveMemento()}});var wXo="notebook.toggleCellToolbarPosition",oTi=class extends K{constructor(){super({id:wXo,title:L(11698,"Toggle Cell Toolbar Position"),menu:[{id:D.NotebookCellTitle,group:"View",order:1}],category:jm,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(ft.cellToolbarLocation),s=this.togglePosition(o,r);await n.updateValue(ft.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(oTi);var kNe=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 rle(t=>Zo.parse(t)?.notebook.toString()===e.notebook.toString(),this._markerService,this._configService)}};kNe=I([m(0,Ns),m(1,X5e),m(2,B)],kNe);var She=class extends C{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=>Xe(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?av:Bh,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([OM(100)],She.prototype,"_update",1),She=I([m(1,Ns)],She);pt(kNe.ID,kNe,ut.BlockRestore);tm(She.id,She);var CXo="notebook.focusTop",xXo="notebook.focusBottom",kXo="notebook.focusPreviousEditor",EXo="notebook.focusNextEditor",TXo="notebook.cell.focusInOutput",_Xo="notebook.cell.focusOutOutput",nTi="notebook.centerActiveCell",DXo="notebook.cell.cursorPageUp",LXo="notebook.cell.cursorPageUpSelect",RXo="notebook.cell.cursorPageDown",MXo="notebook.cell.cursorPageDownSelect";W(class extends K{constructor(){super({id:"notebook.cell.nullAction",title:d(11714,null),keybinding:[{when:yZ,primary:18,weight:201},{when:yZ,primary:16,weight:201}],f1:!1})}run(){}});W(class extends gd{constructor(){super({id:EXo,title:d(11704,null),keybinding:[{when:x.and(rr,$a.negate(),x.equals("config.notebook.navigation.allowNavigateToSurroundingCells",!0),x.and(x.has(Uu),ue.editorTextFocus,tce.notEqualsTo("top"),tce.notEqualsTo("none"),x.or(ice.isEqualTo("end"),ice.isEqualTo("both"))),ue.isEmbeddedDiffEditor.negate()),primary:18,weight:rf},{when:x.and(rr,$a.negate(),x.equals("config.notebook.navigation.allowNavigateToSurroundingCells",!0),x.and(hS.isEqualTo("markup"),wZ.isEqualTo(!1),VJe),ue.isEmbeddedDiffEditor.negate()),primary:18,weight:200},{when:x.and(rr,PR),primary:2066,mac:{primary:2322},weight:200},{when:x.and(AR,$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?xZ(e,s):void 0;if(l&&l.hasTextFocus()&&_m.get(l)?.getWidgetPosition()?.lineNumber===r)_m.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 gd{constructor(){super({id:kXo,title:d(11705,null),keybinding:[{when:x.and(rr,$a.negate(),x.equals("config.notebook.navigation.allowNavigateToSurroundingCells",!0),x.and(x.has(Uu),ue.editorTextFocus,tce.notEqualsTo("bottom"),tce.notEqualsTo("none"),x.or(ice.isEqualTo("start"),ice.isEqualTo("both"))),ue.isEmbeddedDiffEditor.negate()),primary:16,weight:rf},{when:x.and(rr,$a.negate(),x.equals("config.notebook.navigation.allowNavigateToSurroundingCells",!0),x.and(hS.isEqualTo("markup"),wZ.isEqualTo(!1),VJe),ue.isEmbeddedDiffEditor.negate()),primary:16,weight:200},{when:x.and(AR,$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=xZ(e,r);c&&_m.get(c)?.getWidgetPosition()?.lineNumber===l&&_m.get(c)?.focus()}});W(class extends qu{constructor(){super({id:CXo,title:d(11710,null),keybinding:[{when:x.and(rr,x.not(Uu)),primary:2062,weight:200},{when:x.and(rr,x.not(Uu)),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 qu{constructor(){super({id:xXo,title:d(11711,null),keybinding:[{when:x.and(rr,x.not(Uu)),primary:2061,mac:void 0,weight:200},{when:x.and(rr,x.not(Uu)),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 gd{constructor(){super({id:TXo,title:L(11712,"Focus In Active Cell Output"),f1:!0,keybinding:[{when:x.and(mS.negate(),Zy,gk),primary:2066,weight:200},{primary:3090,mac:{primary:2322},weight:200}],precondition:Wao})}async runWithContext(a,i){let e=i.notebookEditor,t=i.cell;return Pi(0).then(()=>e.focusNotebookCell(t,"output"))}});W(class extends gd{constructor(){super({id:_Xo,title:d(11713,null),keybinding:{primary:3088,mac:{primary:2320},weight:200},precondition:x.and(rr,PR)})}async runWithContext(a,i){let e=i.notebookEditor,t=i.cell;await e.focusNotebookCell(t,"editor")}});W(class extends gd{constructor(){super({id:nTi,title:d(11716,null),keybinding:{when:rr,primary:2090,mac:{primary:298},weight:200}})}async runWithContext(i,e){return e.notebookEditor.revealInCenter(e.cell)}});W(class extends gd{constructor(){super({id:DXo,title:d(11708,null),keybinding:[{when:x.and(rr,x.has(Uu),ue.editorTextFocus),primary:11,weight:rf}]})}async runWithContext(a,i){aa.getEditorCommand("cursorPageUp").runCommand(a,{pageSize:i1t(i)})}});W(class extends gd{constructor(){super({id:LXo,title:d(11709,null),keybinding:[{when:x.and(rr,x.has(Uu),ue.editorTextFocus,PR.negate()),primary:1035,weight:rf}]})}async runWithContext(a,i){aa.getEditorCommand("cursorPageUpSelect").runCommand(a,{pageSize:i1t(i)})}});W(class extends gd{constructor(){super({id:RXo,title:d(11706,null),keybinding:[{when:x.and(rr,x.has(Uu),ue.editorTextFocus),primary:12,weight:rf}]})}async runWithContext(a,i){aa.getEditorCommand("cursorPageDown").runCommand(a,{pageSize:i1t(i)})}});W(class extends gd{constructor(){super({id:MXo,title:d(11707,null),keybinding:[{when:x.and(rr,x.has(Uu),ue.editorTextFocus,PR.negate()),primary:1036,weight:rf}]})}async runWithContext(a,i){aa.getEditorCommand("cursorPageDownSelect").runCommand(a,{pageSize:i1t(i)})}});function i1t(a){let e=a.notebookEditor.getViewModel().layoutInfo,t=e?.fontInfo.lineHeight||17;return Math.max(1,Math.floor((e?.height||0)/t)-2)}oe.as(ii.Configuration).registerConfiguration({id:"notebook",order:100,type:"object",properties:{"notebook.navigation.allowNavigateToSurroundingCells":{type:"boolean",default:!0,markdownDescription:d(11715,null)}}});var PXo={default:{[ft.focusIndicator]:"gutter",[ft.insertToolbarLocation]:"both",[ft.globalToolbar]:!0,[ft.cellToolbarLocation]:{default:"right"},[ft.compactView]:!0,[ft.showCellStatusBar]:"visible",[ft.consolidatedRunButton]:!0,[ft.undoRedoPerCell]:!1},jupyter:{[ft.focusIndicator]:"gutter",[ft.insertToolbarLocation]:"notebookToolbar",[ft.globalToolbar]:!0,[ft.cellToolbarLocation]:{default:"left"},[ft.compactView]:!0,[ft.showCellStatusBar]:"visible",[ft.consolidatedRunButton]:!1,[ft.undoRedoPerCell]:!0},colab:{[ft.focusIndicator]:"border",[ft.insertToolbarLocation]:"betweenCells",[ft.globalToolbar]:!1,[ft.cellToolbarLocation]:{default:"right"},[ft.compactView]:!1,[ft.showCellStatusBar]:"hidden",[ft.consolidatedRunButton]:!0,[ft.undoRedoPerCell]:!1}};async function AXo(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(11734,null)})}async run(a,i){if(!NXo(i))return;let e=a.get(B);return AXo(e,PXo[i.profile])}});function NXo(a){let i=a;return i.profile==="colab"||i.profile==="default"||i.profile==="jupyter"}var Rit=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(11652,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:AEt,tooltip:d(11651,null),alignment:2,priority:-Number.MAX_SAFE_INTEGER}),{items:r}}};Rit=I([m(0,un),m(1,kt)],Rit);var Mit=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 vt}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(11650,null,g),T8e);h.push({text:"$(lightbulb-autofix)",command:T8e,tooltip:f,alignment:2,priority:-Number.MAX_SAFE_INTEGER+1})}return{items:h}}};Mit=I([m(0,un),m(1,Tl),m(2,kt),m(3,B),m(4,eS),m(5,_e)],Mit);var Pit=class extends C{constructor(i,e){super(),[Rit,Mit].forEach(o=>{this._register(e.registerCellStatusBarItemProvider(i.createInstance(o)))})}};Pit=I([m(0,F),m(1,qX)],Pit);oe.as(Qi.Workbench).registerWorkbenchContribution(Pit,3);var ENe=class extends C{constructor(e){super();this._notebookEditor=e;this._onDidChangeVisibleCells=this._register(new E);this.onDidChangeVisibleCells=this._onDidChangeVisibleCells.event;this._viewModelDisposables=this._register(new P);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=Lf(this._notebookEditor.visibleRanges).map(l=>this._notebookEditor.cellAt(l)).filter(mo),t=new Set(e.map(l=>l.handle)),o=new Set(this._visibleCells.map(l=>l.handle)),n=HH(o,t),r=n.added.map(l=>this._notebookEditor.getCellByHandle(l)).filter(mo),s=n.removed.map(l=>this._notebookEditor.getCellByHandle(l)).filter(mo);this._visibleCells=e,this._onDidChangeVisibleCells.fire({added:r,removed:s})}};var TNe=class extends C{constructor(e,t){super();this._notebookEditor=e;this._notebookCellStatusBarService=t;this._visibleCells=new Map;this._observer=this._register(new ENe(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 rTi(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()}};TNe=I([m(1,qX)],TNe);var rTi=class extends C{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 um);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 $e,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())}};tm(TNe.id,TNe);function Ihe(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 _Ne=class extends C{constructor(e,t){super();this._notebookEditor=e;this._itemFactory=t;this._visibleCells=new Map;this._observer=this._register(new ENe(this._notebookEditor)),this._register(this._observer.onDidChangeVisibleCells(this._updateVisibleCells,this)),this._updateEverything()}_updateEverything(){this._visibleCells.forEach(Ue),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(Ue),this._visibleCells.clear()}},L2=class extends C{static{this.id="workbench.notebook.statusBar.execState"}constructor(i,e){super(),this._register(new _Ne(i,(t,o)=>e.createInstance(yhe,t,o)))}};L2=I([m(1,F)],L2);tm(L2.id,L2);var yhe=class extends C{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=yhe.MIN_SPINNER_TIME-(Date.now()-this._showedExecutingStateTime);if(o>0){this._clearExecutingStateTimer.value||(this._clearExecutingStateTimer.value=nn(()=>{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:`$(${xWt.id})`,color:Ss(Ico),tooltip:d(11646,null),alignment:1,priority:Number.MAX_SAFE_INTEGER}]:!o&&n===!1?[{text:`$(${oRe.id})`,color:Ss(wco),tooltip:d(11644,null),alignment:1,priority:Number.MAX_SAFE_INTEGER}]:o===2||o===1?[{text:`$(${kWt.id})`,tooltip:d(11645,null),alignment:1,priority:Number.MAX_SAFE_INTEGER}]:o===3?[{text:`$(${(e?.didPause?Sw:q.modify(Sw,"spin")).id})`,tooltip:d(11643,null),alignment:1,priority:Number.MAX_SAFE_INTEGER}]:[]}dispose(){super.dispose(),this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds,[{handle:this._cell.handle,items:[]}])}};yhe=I([m(2,rs)],yhe);var R2=class extends C{static{this.id="workbench.notebook.statusBar.execTimer"}constructor(i,e){super(),this._register(new _Ne(i,(t,o)=>e.createInstance(whe,t,o)))}};R2=I([m(1,F)],R2);tm(R2.id,R2);var OXo=200,whe=class extends C{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(ft.cellExecutionTimeVerbosity)==="verbose",this._scheduler=this._register(new Dt(()=>this._update(),whe.UPDATE_INTERVAL)),this._update(),this._register(this._cell.model.onDidChangeInternalMetadata(()=>this._update())),this._register(this._configurationService.onDidChangeConfiguration(s=>{s.affectsConfiguration(ft.cellExecutionTimeVerbosity)&&(this._isVerbose=this._configurationService.getValue(ft.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=nn(()=>{this._deferredUpdate=void 0,this._currentItemIds=this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds,[{handle:this._cell.handle,items:l}])},OXo,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(Dr);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: ${Ihe(p)}
Renderer Duration: ${Ihe(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} ${Ihe(u[f])}
`}g+=`
*${d(11648,null)}*
`,s={value:d(11647,null,l,Ihe(p),Ihe(h-p),g),isTrusted:!0}}return{text:this._isVerbose?d(11649,null,l,Ihe(r,!1)):Ihe(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:[]}])}};whe=I([m(2,rs),m(3,un),m(4,B)],whe);var Ait=class{constructor(i,e,t,o,n){let r=new P;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:Y.vscodeNotebookCell,pattern:i.uri.path},{provideHover(){n.trace("IMPLICIT kernel selection because of hover"),s()}}))}};Ait=I([m(2,Tl),m(3,zt),m(4,ne)],Ait);var Nit=class extends C{constructor(e,t,o,n){super();this._editorService=e;this._statusbarService=t;this._notebookKernelService=o;this._instantiationService=n;this._editorDisposables=this._register(new P);this._kernelInfoElement=this._register(new P);this._register(this._editorService.onDidActiveEditorChange(()=>this._updateStatusbar())),this._updateStatusbar()}_updateStatusbar(){this._editorDisposables.clear();let e=qn(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(Ait,e,l)));let c=l.description??l.detail??l.label;this._kernelInfoElement.add(this._statusbarService.addEntry({name:d(11663,null),text:`$(notebook-kernel-select) ${l.label}`,ariaLabel:l.label,tooltip:s?d(11668,null,c):c,command:tT},tT,1,10)),this._kernelInfoElement.add(l.onDidChange(()=>this._showKernelStatus(e)))}else this._kernelInfoElement.add(this._statusbarService.addEntry({name:d(11665,null),text:d(11660,null),ariaLabel:d(11660,null),command:tT,kind:"prominent"},tT,1,10))}};Nit=I([m(0,ee),m(1,Tr),m(2,Tl),m(3,F)],Nit);var Oit=class extends C{constructor(e,t){super();this._editorService=e;this._statusbarService=t;this._itemDisposables=this._register(new P);this._accessor=this._register(new me);this._register(this._editorService.onDidActiveEditorChange(()=>this._update())),this._update()}_update(){this._itemDisposables.clear();let e=qn(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(11661,null),text:t,ariaLabel:t,command:nTi};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(11664,null,o,n):d(11666,null,o,r)}};Oit=I([m(0,ee),m(1,Tr)],Oit);var Fit=class extends C{constructor(e,t,o){super();this._editorService=e;this._statusbarService=t;this._configurationService=o;this._itemDisposables=this._register(new P);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=qn(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(11662,null),text:u,ariaLabel:u,tooltip:d(11667,null),command:kEi};this._accessor.value?this._accessor.value.update(p):this._accessor.value=this._statusbarService.addEntry(p,"notebook.status.indentation",1,100.4)}};Fit=I([m(0,ee),m(1,Tr),m(2,B)],Fit);var DNe=class extends C{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 P;H.once(e.onWillDispose)(()=>t.dispose());let o=this.editorGroupService.getScopedInstantiationService(e);t.add(o.createInstance(Nit)),t.add(o.createInstance(Oit)),t.add(o.createInstance(Fit))}};DNe=I([m(0,Et)],DNe);pt(DNe.ID,DNe,ut.AfterRestored);var LNe=class extends C{constructor(e){super();this._editorService=e;let t=105;this._register(BT.addImplementation(t,"notebook-undo-redo",()=>{let o=qn(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(HT.addImplementation(t,"notebook-undo-redo",()=>{let o=qn(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"}};LNe=I([m(0,ee)],LNe);pt(LNe.ID,LNe,ut.BlockRestore);var FXo="notebook.cell.moveUp",WXo="notebook.cell.moveDown",VXo="notebook.cell.copyUp",BXo="notebook.cell.copyDown";W(class extends gd{constructor(){super({id:FXo,title:L(11633,"Move Cell Up"),icon:Jao,keybinding:{primary:528,when:x.and(rr,$h.toNegated()),weight:200},menu:{id:D.NotebookCellTitle,when:x.equals("config.notebook.dragAndDropEnabled",!1),group:"3_edit",order:14}})}async runWithContext(a,i){return Dwi(i,"up")}});W(class extends gd{constructor(){super({id:WXo,title:L(11632,"Move Cell Down"),icon:Zao,keybinding:{primary:530,when:x.and(rr,$h.toNegated()),weight:200},menu:{id:D.NotebookCellTitle,when:x.equals("config.notebook.dragAndDropEnabled",!1),group:"3_edit",order:14}})}async runWithContext(a,i){return Dwi(i,"down")}});W(class extends gd{constructor(){super({id:VXo,title:L(11624,"Copy Cell Up"),keybinding:{primary:1552,when:x.and(rr,$h.toNegated()),weight:200}})}async runWithContext(a,i){return Lwi(i,"up")}});W(class extends gd{constructor(){super({id:BXo,title:L(11623,"Copy Cell Down"),keybinding:{primary:1554,when:x.and(rr,$h.toNegated()),weight:200},menu:{id:D.NotebookCellTitle,when:x.and(rr,Kl,bw),group:"3_edit",order:13}})}async runWithContext(a,i){return Lwi(i,"down")}});var HXo="notebook.cell.split",UXo="notebook.cell.joinSelected",zXo="notebook.cell.joinAbove",KXo="notebook.cell.joinBelow";W(class extends gd{constructor(){super({id:HXo,title:L(11634,"Split Cell"),menu:{id:D.NotebookCellTitle,when:x.and(Kl,bw,JLe.toNegated()),order:5,group:VF},icon:elo,keybinding:{when:x.and(rr,Kl,bw,ue.editorTextFocus),primary:Ai(2089,3165),weight:200}})}async runWithContext(a,i){if(i.notebookEditor.isReadOnly)return;let e=a.get(ma),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=Nco(t,n);if(r){let s=t.language,l=t.cellKind,c=t.mime,u=await t.resolveTextModel();await e.apply([new ja(t.uri,{range:u.getFullModelRange(),text:r[0]}),new Iv(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 gd{constructor(){super({id:zXo,title:L(11629,"Join With Previous Cell"),keybinding:{when:rr,primary:1832,weight:200},menu:{id:D.NotebookCellTitle,when:x.and(rr,Kl),group:"3_edit",order:10}})}async runWithContext(a,i){let e=a.get(ma);return Rwi(e,i,"above")}});W(class extends gd{constructor(){super({id:KXo,title:L(11630,"Join With Next Cell"),keybinding:{when:rr,primary:808,weight:200},menu:{id:D.NotebookCellTitle,when:x.and(rr,Kl),group:"3_edit",order:11}})}async runWithContext(a,i){let e=a.get(ma);return Rwi(e,i,"below")}});W(class extends gd{constructor(){super({id:UXo,title:L(11631,"Join Selected Cells"),menu:{id:D.NotebookCellTitle,when:x.and(rr,Kl),group:"3_edit",order:12}})}async runWithContext(a,i){let e=a.get(ma),t=a.get(Ne);return Aco(e,t,i)}});var GXo="notebook.cell.changeToCode",$Xo="notebook.cell.changeToMarkdown";W(class extends xg{constructor(){super({id:GXo,title:L(11617,"Change Cell to Code"),keybinding:{when:x.and(rr,x.not(Uu),PR.toNegated()),primary:55,weight:200},precondition:x.and(Ua,hS.isEqualTo("markup")),menu:{id:D.NotebookCellTitle,when:x.and(rr,Kl,bw,hS.isEqualTo("markup")),group:"3_edit"}})}async runWithContext(i,e){await SMe(2,e)}});W(class extends xg{constructor(){super({id:$Xo,title:L(11618,"Change Cell to Markdown"),keybinding:{when:x.and(rr,x.not(Uu),PR.toNegated()),primary:43,weight:200},precondition:x.and(Ua,hS.isEqualTo("code")),menu:{id:D.NotebookCellTitle,when:x.and(rr,Kl,bw,hS.isEqualTo("code")),group:"3_edit"}})}async runWithContext(i,e){await SMe(1,e,"markdown",Zn.markdown)}});var qXo="notebook.cell.collapseCellInput",jXo="notebook.cell.collapseCellOutput",QXo="notebook.cell.collapseAllCellInputs",YXo="notebook.cell.expandAllCellInputs",XXo="notebook.cell.collapseAllCellOutputs",JXo="notebook.cell.expandAllCellOutputs",ZXo="notebook.cell.toggleOutputs",eJo="notebook.cell.toggleOutputScrolling";W(class extends xg{constructor(){super({id:qXo,title:L(11621,"Collapse Cell Input"),keybinding:{when:x.and($u,JLe.toNegated(),$h.toNegated()),primary:Ai(2089,2081),weight:200}})}parseArgs(i,...e){return BK(i,...e)}async runWithContext(i,e){e.ui?e.cell.isInputCollapsed=!0:e.selectedCells.forEach(t=>t.isInputCollapsed=!0)}});W(class extends xg{constructor(){super({id:Kxe,title:L(11627,"Expand Cell Input"),keybinding:{when:x.and($u,JLe),primary:Ai(2089,2081),weight:200}})}parseArgs(i,...e){return BK(i,...e)}async runWithContext(i,e){e.ui?e.cell.isInputCollapsed=!1:e.selectedCells.forEach(t=>t.isInputCollapsed=!1)}});W(class extends xg{constructor(){super({id:jXo,title:L(11622,"Collapse Cell Output"),keybinding:{when:x.and($u,HJe.toNegated(),$h.toNegated(),gk),primary:Ai(2089,50),weight:200}})}async runWithContext(i,e){e.ui?e.cell.isOutputCollapsed=!0:e.selectedCells.forEach(t=>t.isOutputCollapsed=!0)}});W(class extends xg{constructor(){super({id:NEt,title:L(11628,"Expand Cell Output"),keybinding:{when:x.and($u,HJe),primary:Ai(2089,50),weight:200}})}async runWithContext(i,e){e.ui?e.cell.isOutputCollapsed=!1:e.selectedCells.forEach(t=>t.isOutputCollapsed=!1)}});W(class extends xg{constructor(){super({id:ZXo,precondition:$u,title:L(11635,"Toggle Outputs"),metadata:{description:d(11636,null),args:UJe}})}parseArgs(a,...i){return BK(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 xg{constructor(){super({id:QXo,title:L(11619,"Collapse All Cell Inputs"),f1:!0})}async runWithContext(i,e){o1t(e.notebookEditor,t=>t.isInputCollapsed=!0)}});W(class extends xg{constructor(){super({id:YXo,title:L(11625,"Expand All Cell Inputs"),f1:!0})}async runWithContext(i,e){o1t(e.notebookEditor,t=>t.isInputCollapsed=!1)}});W(class extends xg{constructor(){super({id:XXo,title:L(11620,"Collapse All Cell Outputs"),f1:!0})}async runWithContext(i,e){o1t(e.notebookEditor,t=>t.isOutputCollapsed=!0)}});W(class extends xg{constructor(){super({id:JXo,title:L(11626,"Expand All Cell Outputs"),f1:!0})}async runWithContext(i,e){o1t(e.notebookEditor,t=>t.isOutputCollapsed=!1)}});W(class extends xg{constructor(){super({id:eJo,title:L(11637,"Toggle Scroll Cell Output"),keybinding:{when:x.and($u,$h.toNegated(),gk),primary:Ai(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(ft.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 o1t(a,i){for(let e=0;e<a.getLength();e++){let t=a.cellAt(e);i(t,e)}}var RNe=class extends C{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();Lf(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,vRe)){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)}}};RNe=I([m(1,un),m(2,Bi)],RNe);tm(RNe.id,RNe);var Wit=class extends C{constructor(e){super();this._notebookEditor=e;this._localStore=this._register(new P);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=Mo.div({style:{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",pointerEvents:"none",zIndex:"1000"}},[Mo.div({style:{position:"absolute",top:`${e}px`,left:"0",width:"100%",height:"2px",backgroundColor:"rgba(0, 0, 255, 0.7)"}}),Mo.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 P;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 P;return h.add(p.onDidChangeLayout(g=>{this._log(p,g)})),h}));Ue(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(){Ue(this._cellDisposables),this._removeNotebookOverlay(),this._localStore.clear(),super.dispose()}};tm(Wit.id,Wit);W(class extends K{constructor(){super({id:"notebook.toggleLayoutTroubleshoot",title:L(11747,"Toggle Notebook Layout Troubleshoot"),category:We.Developer,f1:!0})}async run(a){let i=a.get(ee),e=qn(i.activeEditorPane);if(!e)return;e.getContribution(Wit.id)?.toggle()}});W(class extends K{constructor(){super({id:"notebook.inspectLayout",title:L(11746,"Inspect Notebook Layout"),category:We.Developer,f1:!0})}async run(a){let i=a.get(ee),e=qn(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(11745,"Clear Notebook Editor Type Cache"),category:We.Developer,f1:!0})}async run(a){a.get(un).clearEditorCache()}});var Vit=class extends C{constructor(e,t,o){super();this._debugService=e;this._editorService=o;let n=new vt;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=>Wo(l,{uri:!0})&&l.uri.scheme===Y.vscodeNotebookCell);if(s){let l=Zo.parse(s.uri);if(!l)return;let c=qn(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 vt;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);Xe(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}]))})}};Vit=I([m(0,Li),m(1,un),m(2,ee)],Vit);oe.as(Qi.Workbench).registerWorkbenchContribution(Vit,3);var Bit=class extends C{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}])}}};Bit=I([m(0,Li),m(1,rs)],Bit);oe.as(Qi.Workbench).registerWorkbenchContribution(Bit,3);var sTi=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())}};oe.add("gutterActionsRegistry",new sTi);var Hit=oe.as("gutterActionsRegistry"),Nte=class extends C{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&&!(it&&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 Hit.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:()=>li.join(...l.map(p=>p[1])),onHide:()=>s.dispose()})})}};Nte=I([m(1,ze),m(2,qt),m(3,X),m(4,F)],Nte);go(Nte.ID,Nte,1);var MNe=_,aTi=ae("privateBreakpointWidgetService"),mgo="breakpointwidgetdecoration";function tJo(a){return a.getModel().bracketPairs.getBracketPairsInRange(z.fromPositions(a.getPosition())).some(t=>t.openingBracketInfo.bracketText==="{")}function iJo(a,i){let e=a.getColor(od)?.transparent(.4);return[{range:{startLineNumber:0,endLineNumber:0,startColumn:0,endColumn:1},renderOptions:{after:{contentText:i,color:e?e.toString():void 0}}}]}var PNe=class extends aO{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 P;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",mgo,{})),this.create()}get placeholder(){let e=this.keybindingService.lookupKeybinding(n1t.ID)?.getLabel()||"Enter",t=this.keybindingService.lookupKeybinding(r1t.ID)?.getLabel()||"Escape";switch(this.context){case 2:return d(8699,null,e,t);case 1:return d(8698,null,e,t);default:return d(8697,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?Fr: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 aE([{text:d(8700,null)},{text:d(8701,null)},{text:d(8702,null)},{text:d(8708,null)}],this.context,this.contextViewService,pE,{ariaLabel:d(8696,null),useCustomDrawn:!HS(this._configurationService)}));this.selectContainer=MNe(".breakpoint-select-container"),t.render(R(e,this.selectContainer)),this.store.add(t.onDidSelect(o=>{this.rememberInput(),this.context=o.index,this.updateContextInput()})),this.createModesInput(e),this.inputContainer=MNe(".inputContainer"),this.store.add(this.hoverService.setupManagedHover(Ni("mouse"),this.inputContainer,this.placeholder)),this.createBreakpointInput(R(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 aE([{text:d(8695,null),isDisabled:!0},...t.map(s=>({text:s.label,description:s.description}))],t.findIndex(s=>s.mode===this.breakpoint?.mode)+1,this.contextViewService,pE,{useCustomDrawn:!HS(this._configurationService)});this.store.add(o),this.store.add(o.onDidSelect(s=>{this.modeInput=t[s.index-1]}));let n=MNe(".select-mode-container"),r=MNe(".select-box-container");R(n,r),o.render(r),R(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 aE(t,o+1,this.contextViewService,pE,{ariaLabel:d(8706,null),useCustomDrawn:!HS(this._configurationService)}));this.store.add(n.onDidSelect(l=>{l.index===0?this.triggeredByBreakpointInput=void 0:this.triggeredByBreakpointInput=this.availableBreakpoints[l.index-1]})),this.selectBreakpointContainer=MNe(".select-breakpoint-container"),this.store.add(j(this.selectBreakpointContainer,re.KEY_DOWN,l=>{new Ii(l).equals(9)&&this.close(!1)}));let r=MNe(".select-box-container");R(this.selectBreakpointContainer,r),n.render(r),R(e,this.selectBreakpointContainer);let s=new Mi(this.selectBreakpointContainer,Ko);s.label=d(8705,null),this.store.add(s.onDidClick(()=>this.close(!0))),this.store.add(s)}buildBreakpointOptions(){let e=[{text:d(8704,null),isDisabled:!0},...this.availableBreakpoints.map(t=>({text:`${this.labelService.getUriLabel(t.uri,{relative:!0})}: ${t.lineNumber}`,description:d(8707,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(8703,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 Io([aTi,this]));this.store.add(t);let o=this.createEditorOptions(),n=xLe();this.input=t.createInstance(jr,e,o,n),zdi.bindTo(this.input.contextKeyService).set(!0);let r=this.modelService.createModel("",null,A.parse(`${vC}:${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()?[]:iJo(this.themeService.getColorTheme(),this.placeholder);this.input.setDecorationsByType("breakpoint-widget",mgo,c)};this.store.add(this.input.getModel().onDidChangeContent(()=>s())),this.store.add(this.themeService.onDidColorThemeChange(()=>s())),this.store.add(this.languageFeaturesService.completionProvider.register({scheme:vC,hasAccessToAllModels:!0},{_debugDisplayName:"breakpointWidget",provideCompletionItems:(l,c,u,p)=>{let h,g=this.editor.getModel();return g&&(this.context===0||this.context===2&&tJo(this.input))?h=Sle(this.languageFeaturesService.completionProvider,g,new Ie(this.lineNumber,1),new Jq(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=Kf(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(),Ue(this.store),setTimeout(()=>this.editor.focus(),0)}};PNe=I([m(4,_n),m(5,Li),m(6,De),m(7,F),m(8,Ct),m(9,Kt),m(10,B),m(11,zt),m(12,_e),m(13,ot),m(14,Nt),m(15,tt)],PNe);var n1t=class a extends xc{static{this.ID="breakpointWidget.action.acceptInput"}constructor(){super({id:a.ID,precondition:nQe,kbOpts:{kbExpr:zdi,primary:3,weight:100}})}runEditorCommand(i,e){i.get(aTi).close(!0)}},r1t=class a extends xc{static{this.ID="closeBreakpointWidget"}constructor(){super({id:a.ID,precondition:nQe,kbOpts:{kbExpr:ue.textInputFocus,primary:9,secondary:[1033],weight:100}})}runEditorCommand(i,e,t){let o=e.getContribution(fP);if(o)return o.closeBreakpointWidget();i.get(aTi).close(!1)}};qi(new n1t);qi(new r1t);var oJo=_,nJo={description:"breakpoint-helper-decoration",glyphMarginClassName:q.asClassName(eZe),glyphMargin:{position:3},glyphMarginHoverMessage:new xe().appendText(d(8594,null)),stickiness:1};function rJo(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:sJo(a,i,s,t,o,n,l),range:u})}),r}function sJo(a,i,e,t,o,n,r){let s=a.get(Li),l=a.get(kt),c=a.get(ot),{icon:u,message:p,showAdapterUnverifiedMessage:h}=I2(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 xe(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 xe(void 0,{isTrusted:!0,supportThemeIcons:!0}).appendMarkdown(f));let v=null;n&&(v={color:Ss(s1t),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:rN,inlineClassName:"debug-breakpoint-placeholder",inlineClassNameAffectsLetterSpacing:!0}:void 0,overviewRuler:v,zIndex:9999}}async function aJo(a,i,e){return e.capabilities.supportsBreakpointLocationsRequest?await Promise.all(Uo(i,t=>t).map(async t=>{try{return{lineNumber:t,positions:await e.breakpointsLocations(a.uri,t)}}catch{return{lineNumber:t,positions:[]}}})):[]}function lJo(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:rN,inlineClassName:"debug-breakpoint-placeholder",inlineClassNameAffectsLetterSpacing:!0}},breakpoint:u?u.breakpoint:void 0})})}return t}var ANe=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=nQe.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||it&&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(!Wn&&r.some(c=>!!c.condition||!!c.logMessage||!!c.hitCondition||!!c.triggeredBy)){let c=r.every(g=>!!g.logMessage),u=c?d(8615,null):d(8591,null),p=d(8592,null,u.toLowerCase(),c?d(8616,null):d(8595,null)),h=d(8593,null,u.toLowerCase(),c?d(8616,null):d(8595,null));await this.dialogService.prompt({type:gt.Info,message:l?h:p,buttons:[{label:d(8621,null,u),run:()=>r.forEach(g=>this.debugService.removeBreakpoints(g.getId()))},{label:d(8605,null,l?d(8601,null):d(8610,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}])}})),og.pointerEvents&&Vb||(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(8615,null):d(8591,null);n.push(pi({id:"debug.removeBreakpoint",label:d(8617,null,r),enabled:!0,run:async()=>{await this.debugService.removeBreakpoints(i[0].getId())}})),n.push(pi({id:"workbench.debug.action.editBreakpointAction",label:d(8606,null,r),enabled:!0,run:()=>Promise.resolve(this.showBreakpointWidget(i[0].lineNumber,i[0].column))})),n.push(pi({id:"workbench.debug.viewlet.action.toggleBreakpoint",label:i[0].enabled?d(8602,null,r):d(8611,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 $l("debug.removeBreakpoints",d(8618,null),r.map(s=>pi({id:"removeInlineBreakpoint",label:s.column?d(8619,null,s.column):d(8620,null),enabled:!0,run:()=>this.debugService.removeBreakpoints(s.getId())})))),n.push(new $l("debug.editBreakpoints",d(8607,null),r.map(s=>pi({id:"editBreakpoint",label:s.column?d(8608,null,s.column):d(8609,null),enabled:!0,run:()=>Promise.resolve(this.showBreakpointWidget(s.lineNumber,s.column))})))),n.push(new $l("debug.enableDisableBreakpoints",d(8614,null),r.map(s=>pi({id:s.enabled?"disableColumnBreakpoint":"enableColumnBreakpoint",label:s.enabled?s.column?d(8604,null,s.column):d(8603,null):s.column?d(8613,null,s.column):d(8612,null),enabled:!0,run:()=>this.debugService.enableOrDisableBreakpoints(!s.enabled,s)}))))}else n.push(pi({id:"addBreakpoint",label:d(8587,null),enabled:!0,run:()=>this.debugService.addBreakpoints(e,[{lineNumber:t,column:o}])})),n.push(pi({id:"addConditionalBreakpoint",label:d(8588,null),enabled:!0,run:()=>Promise.resolve(this.showBreakpointWidget(t,o,0))})),n.push(pi({id:"addLogPoint",label:d(8589,null),enabled:!0,run:()=>Promise.resolve(this.showBreakpointWidget(t,o,2))})),n.push(pi({id:"addTriggeredBreakpoint",label:d(8590,null),enabled:!0,run:()=>Promise.resolve(this.showBreakpointWidget(t,o,3))}));return this.debugService.state===2&&(n.push(new li),n.push(pi({id:"runToLine",label:d(8622,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},nJo))})}async setDecorations(){if(!this.editor.hasModel())return;let i=(u,p)=>{let h=lJo(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?I2(this.debugService.state,this.debugService.getModel().areBreakpointsActivated(),b.breakpoint,this.labelService,this.debugService.getModel()).icon:zF.disabled,y=()=>this.getContextMenuActions(b.breakpoint?[b.breakpoint]:[],e.getModel().uri,b.range.startLineNumber,b.range.startColumn),w=new Uit(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=>rJo(u,t,o,this.debugService.state,this.debugService.getModel().areBreakpointsActivated(),n.showBreakpointsInOverviewRuler)),s=this.debugService.getViewModel().focusedSession,l=n.showInlineBreakpointCandidates&&s?aJo(this.editor.getModel(),r.map(u=>u.range.startLineNumber),s):Promise.resolve([]),c=await Promise.race([l,Pi(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 Uit(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(PNe,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)),Ue(this.toDispose)}};ANe=I([m(1,Li),m(2,ze),m(3,F),m(4,X),m(5,ct),m(6,B),m(7,ot)],ANe);Hit.registerGutterActionsGenerator(({lineNumber:a,editor:i,accessor:e},t)=>{let o=i.getModel(),n=e.get(Li);if(!o||!n.getAdapterManager().hasEnabledDebuggers()||!n.canSetBreakpointsIn(o))return;let r=i.getContribution(fP);if(!r)return;let s=r.getContextMenuActionsAtPosition(a,o);for(let l of s)t.push(l,"2_debug")});var Uit=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=oJo(".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 yn(Me(this.domNode),e),o=this.getContextMenuActions();this.contextMenuService.showContextMenu({getAnchor:()=>t,getActions:()=>o,getActionsContext:()=>this.breakpoint,onHide:()=>jH(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 _t()}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),Ue(this.toDispose)}};I([mi],Uit.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(s1t);t&&(i.addRule(`${e} {
			${$Wt.map(l=>`${q.asCSSSelector(l.regular)}`).join(`,
		`)},
			${q.asCSSSelector(GWt)},
			${q.asCSSSelector(eZe)}:not([class*='codicon-debug-breakpoint']):not([class*='codicon-debug-stackframe']),
			${q.asCSSSelector(zF.regular)}${q.asCSSSelector(Npe)}::after,
			${q.asCSSSelector(zF.regular)}${q.asCSSSelector(Ape)}::after {
				color: ${t} !important;
			}
		}`),i.addRule(`${e} {
			${q.asCSSSelector(zF.pending)} {
				color: ${t} !important;
				font-size: 12px !important;
			}
		}`));let o=a.getColor(cJo);o&&i.addRule(`${e} {
			${$Wt.map(l=>q.asCSSSelector(l.disabled)).join(`,
		`)} {
				color: ${o};
			}
		}`);let n=a.getColor(dJo);n&&i.addRule(`${e} {
			${$Wt.map(l=>q.asCSSSelector(l.unverified)).join(`,
		`)} {
				color: ${n};
			}
		}`);let r=a.getColor(uJo);r&&i.addRule(`
		.monaco-editor .debug-top-stack-frame-column {
			color: ${r} !important;
		}
		${e} {
			${q.asCSSSelector(Ape)} {
				color: ${r} !important;
			}
		}
		`);let s=a.getColor(pJo);s&&i.addRule(`${e} {
			${q.asCSSSelector(Npe)} {
				color: ${s} !important;
			}
		}`)});var s1t=J("debugIcon.breakpointForeground","#E51400",d(8598,null)),cJo=J("debugIcon.breakpointDisabledForeground","#848484",d(8597,null)),dJo=J("debugIcon.breakpointUnverifiedForeground","#848484",d(8600,null)),uJo=J("debugIcon.breakpointCurrentStackframeForeground",{dark:"#FFCC00",light:"#BE8700",hcDark:"#FFCC00",hcLight:"#BE8700"},d(8596,null)),pJo=J("debugIcon.breakpointStackframeForeground","#89D185",d(8599,null));var ONe=J("editor.stackFrameHighlightBackground",{dark:"#ffff0033",light:"#ffff6673",hcDark:"#ffff0033",hcLight:"#ffff6673"},d(8710,null)),FNe=J("editor.focusedStackFrameHighlightBackground",{dark:"#7abd7a4d",light:"#cee7ce73",hcDark:"#7abd7a4d",hcLight:"#cee7ce73"},d(8709,null)),a1t=1,mJo={description:"top-stack-frame-margin",glyphMarginClassName:q.asClassName(Ape),glyphMargin:{position:3},zIndex:9999,stickiness:a1t,overviewRuler:{position:7,color:Ss(ONe)}},hJo={description:"focused-stack-frame-margin",glyphMarginClassName:q.asClassName(Npe),glyphMargin:{position:3},zIndex:9999,stickiness:a1t,overviewRuler:{position:7,color:Ss(FNe)}},lTi={description:"top-stack-frame-decoration",isWholeLine:!0,className:"debug-top-stack-frame-line",stickiness:a1t},gJo={description:"focused-stack-frame-decoration",isWholeLine:!0,className:"debug-focused-stack-frame-line",stickiness:a1t},cTi=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 fJo(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:mJo,range:n}),t.push({options:lTi,range:o}),a.range.startColumn>1&&t.push({options:cTi(e),range:o})):(i&&t.push({options:hJo,range:n}),t.push({options:gJo,range:o})),t}var NNe=class extends C{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(H.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(...fJo(u,r,p))}})}})}),Uo(o,n=>`${n.options.className} ${n.options.glyphMarginClassName} ${n.range.startLineNumber} ${n.range.startColumn}`)}dispose(){super.dispose(),this.decorations.clear()}};NNe=I([m(1,Li),m(2,dt),m(3,ne)],NNe);var WNe=class extends C{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 jo(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:ONe,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:FNe,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:yco,includeOutput:!1,modelRanges:[new z(0,0,0,0)],position:1}};return{handle:o,options:n}});this._executingCellDecorations=this._notebookEditor.deltaCellDecorations(this._executingCellDecorations,t)}};WNe=I([m(1,Li),m(2,rs)],WNe);tm(WNe.id,WNe);var VNe=class extends C{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:s1t,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)}};VNe=I([m(1,Li),m(2,B)],VNe);tm(VNe.id,VNe);var Che=class extends C{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([OM(100)],Che.prototype,"_update",1),Che=I([m(1,rs),m(2,Cde)],Che);tm(Che.id,Che);var zit=class extends C{constructor(e,t,o){super();this._notebookKernelService=e;this._extensionService=t;this._notebookLoggingService=o;this._detectionMap=new Map;this._localDisposableStore=this._register(new P);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)}})}};zit=I([m(0,Tl),m(1,lt),m(2,_v)],zit);oe.as(Qi.Workbench).registerWorkbenchContribution(zit,3);var t8=class extends C{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(ft.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(ft.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(H.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 Qm&&!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(t8.ID,t.uri,[s]),n.push(Z(()=>this.markerService.changeOne(t8.ID,t.uri,[]))),t.executionErrorDiagnostic.set(o.error,void 0),n.push(Z(()=>t.executionErrorDiagnostic.set(void 0,void 0))),n.push(he(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()}};t8=I([m(1,rs),m(2,Ns),m(3,br),m(4,B)],t8);tm(t8.ID,t8);var l1t="notebook.cell.openFailureActions",vJo="notebook.cell.chat.fixError",bJo="notebook.cell.chat.explainError";W(class extends gd{constructor(){super({id:l1t,title:L(11639,"Show Cell Failure Actions"),precondition:x.and(Cpe,kpe,AR.toNegated()),f1:!0,keybinding:{when:x.and(Cpe,kpe,AR.toNegated()),primary:2137,weight:200}})}async runWithContext(a,i){if(i.cell instanceof Qm){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=xZ(i,i.cell);o&&Zu.get(o)?.manualTriggerAtCurrentPosition(d(11638,null),"other (default)",{include:gr.QuickFix})}}}});W(class extends gd{constructor(){super({id:vJo,title:L(11641,"Fix Cell Error"),precondition:x.and(Cpe,kpe,AR.toNegated()),f1:!0})}async runWithContext(a,i){if(i.cell instanceof Qm){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=xZ(i,i.cell);if(o){let n=_m.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 gd{constructor(){super({id:bJo,title:L(11640,"Explain Cell Error"),precondition:x.and(Cpe,kpe,AR.toNegated()),f1:!0})}async runWithContext(a,i){if(i.cell instanceof Qm){let e=i.cell.executionErrorDiagnostic.get();if(e?.message){let o=await a.get(At).revealWidget(),n=e.name?`${e.name}: ${e.message}`:e.message;o?.acceptInput("@workspace /explain "+n)}}}});var BNe=class extends C{static{this.id="workbench.notebook.statusBar.diagtnostic"}constructor(i,e){super(),this._register(new _Ne(i,(t,o)=>o instanceof Qm?e.createInstance(Kit,t,o):C.None))}};BNe=I([m(1,F)],BNe);tm(BNe.id,BNe);var Kit=class extends C{constructor(e,t,o,n){super();this._notebookViewModel=e;this.cell=t;this.keybindingService=o;this.chatAgentService=n;this._currentItemIds=[];this._register(he(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(11642,null),l1t),alignment:1,command:l1t,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:[]}])}};Kit=I([m(2,_e),m(3,br)],Kit);var HNe=class extends C{constructor(e,t){super();this.notebookEditor=e;this.configurationService=t;this.isEnabled=!1;this.cellDecorationIds=new Map;this.anchorDisposables=new P;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 H.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=>Yt.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()}};HNe=I([m(1,B)],HNe);tm(HNe.id,HNe);var om=class extends pa{constructor(e,t,o,n,r,s,l,c,u){super(om.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 P),this.ctxAllCollapsed=this._parentContextKeyService.createKey(kco.key,!1),this.ctxHasUnchangedCells=this._parentContextKeyService.createKey(tme.key,!1),this.ctxHiddenUnchangedCells=this._parentContextKeyService.createKey(kZe.key,!0),this._notebookOptions=t.createInstance(nT,this.window,!1,void 0),this._register(this._notebookOptions)}static{this.ID=f9i}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 Fy.readFontInfo(this.window,LS(e,Xd.getInstance(this.window).value))}createEditor(e){this._multiDiffEditorWidget=this._register(this.instantiationService.createInstance(cee,e,this.instantiationService.createInstance(Git))),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 JRe),l=this.instantiationService.createInstance($Z,this.fontInfo.lineHeight);this.viewModel=this.modelSpecificResources.add(new aMe(r,this.notebookEditorWorkerService,this.configurationService,s,this.notebookService,l,void 0,!0)),await this.viewModel.computeDiff(this.modelSpecificResources.add(new $e).token),this.ctxHasUnchangedCells.set(this.viewModel.hasUnchangedCells),this.ctxHasUnchangedCells.set(this.viewModel.hasUnchangedCells);let c=this.modelSpecificResources.add(NZ.createInput(this.viewModel,this.instantiationService));this.widgetViewModel=this.modelSpecificResources.add(await c.getViewModel());let u=new WeakSet;this.modelSpecificResources.add(he(p=>{if(!this.widgetViewModel||!this.viewModel)return;let h=this.widgetViewModel.items.read(p),g=this.viewModel.value;h.length===g.length&&Ui(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===Y.vscodeNotebookCellOutput||e.scheme===Y.vscodeNotebookCellOutputDiff||e.scheme===Y.vscodeNotebookCellMetadata||e.scheme===Y.vscodeNotebookCellMetadataDiff){let t=Zo.parseCellPropertyUri(e,e.scheme);t&&(e=Zo.generate(t.notebook,t.handle))}return e.scheme===Y.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}})}};om=I([m(1,F),m(2,De),m(3,X),m(4,JK),m(5,B),m(6,Te),m(7,le),m(8,un)],om);var Git=class{constructor(i,e,t){this._instantiationService=i;this.notebookDocumentService=e;this.notebookService=t}createResourceLabel(i){let e=this._instantiationService.createInstance(rk,i,{}),t=this;return{setUri(o,n={}){if(!o)e.element.clear();else{let r="",s="",l;if(o.scheme===Y.vscodeNotebookCell){let c=o.scheme===Y.vscodeNotebookCell?t.notebookDocumentService.getNotebook(o):void 0,u=Y.vscodeNotebookCell?t.notebookDocumentService.getNotebook(o)?.getCellIndex(o):void 0;if(c&&u!==void 0){r=d(11909,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?Y1(h):void 0}}else o.scheme===Y.vscodeNotebookCellMetadata||o.scheme===Y.vscodeNotebookCellMetadataDiff?s=d(11910,null):(o.scheme===Y.vscodeNotebookCellOutput||o.scheme===Y.vscodeNotebookCellOutputDiff)&&(s=d(11911,null));e.element.setResource({name:r,description:s},{strikethrough:n.strikethrough,forceLabel:!0,hideIcon:!l,extraClasses:l})}},dispose(){e.dispose()}}}};Git=I([m(0,F),m(1,Ij),m(2,un)],Git);W(class extends K{constructor(){super({id:"notebook.diff.openFile",icon:M.goToFile,title:L(11895,"Open File"),precondition:x.or(fr.isEqualTo(Xm.ID),fr.isEqualTo(om.ID)),menu:[{id:D.EditorTitle,group:"navigation",when:x.or(fr.isEqualTo(Xm.ID),fr.isEqualTo(om.ID))}]})}async run(a){let i=a.get(ee),e=i.activeEditorPane;if(e&&(e instanceof Xm||e instanceof om)){let o=e.input.modified.resource;await i.openEditor({resource:o})}}});W(class extends K{constructor(){super({id:"notebook.diff.cell.toggleCollapseUnchangedRegions",title:L(11891,"Toggle Collapse Unchanged Regions"),icon:M.map,toggled:x.has("config.diffEditor.hideUnchangedRegions.enabled"),precondition:fr.isEqualTo(Xm.ID),menu:{id:D.EditorTitle,group:"navigation",when:fr.isEqualTo(Xm.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:tlo,title:L(11899,"Open Text Diff Editor"),precondition:x.or(fr.isEqualTo(Xm.ID),fr.isEqualTo(om.ID)),menu:[{id:D.EditorTitle,group:"navigation",when:x.or(fr.isEqualTo(Xm.ID),fr.isEqualTo(om.ID))}]})}async run(a){let i=a.get(ee),e=i.activeEditorPane;if(e&&(e instanceof Xm||e instanceof om)){let t=e.input;await i.openEditor({original:{resource:t.original.resource},modified:{resource:t.resource},label:t.getName(),options:{preserveFocus:!1,override:Ys.id}})}}});W(class extends K{constructor(){super({id:"notebook.diffEditor.showUnchangedCells",title:L(11901,"Show Unchanged Cells"),icon:M.unfold,precondition:x.and(fr.isEqualTo(om.ID),x.has(tme.key)),menu:{when:x.and(fr.isEqualTo(om.ID),x.has(tme.key),x.equals(kZe.key,!0)),id:D.EditorTitle,order:22,group:"navigation"}})}run(a,...i){let e=a.get(ee).activeEditorPane;e&&e instanceof om&&e.showUnchanged()}});W(class extends K{constructor(){super({id:"notebook.diffEditor.hideUnchangedCells",title:L(11883,"Hide Unchanged Cells"),icon:M.fold,precondition:x.and(fr.isEqualTo(om.ID),x.has(tme.key)),menu:{when:x.and(fr.isEqualTo(om.ID),x.has(tme.key),x.equals(kZe.key,!1)),id:D.EditorTitle,order:22,group:"navigation"}})}run(a,...i){let e=a.get(ee).activeEditorPane;e&&e instanceof om&&e.hideUnchanged()}});W(class extends K{constructor(){super({id:"notebook.diffEditor.2.goToCell",title:L(11882,"Go To Cell"),icon:M.goToFile,menu:{when:x.and(fr.isEqualTo(om.ID),x.equals(H4.key,"Cell"),x.notEquals(U4.key,"delete")),id:D.MultiDiffEditorFileToolbar,order:0,group:"navigation"}})}async run(i,...e){let t=e[0],o=i.get(ee);o.activeEditorPane instanceof om&&await o.openEditor({resource:t,options:{selectionRevealType:1}})}});W(class extends K{constructor(){super({id:"notebook.diff.revertMetadata",title:d(11896,null),icon:kZ,f1:!1,menu:{id:D.NotebookDiffDocumentMetadata,when:xZe},precondition:xZe})}run(a,i){!i||!(a.get(ee).activeEditorPane instanceof Xm)||i.modifiedDocumentTextModel.applyEdits([{editType:5,metadata:i.originalMetadata.metadata}],!0,void 0,()=>{},void 0,!0)}});var ggo=d(11887,null);W(class extends K{constructor(){super({id:"notebook.diffEditor.2.cell.revertInput",title:ggo,icon:kZ,menu:{when:x.and(fr.isEqualTo(om.ID),x.equals(H4.key,"Cell"),x.equals(U4.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 om))return;let n=o.getDiffElementViewModel(e);if(n&&n instanceof GC){let r=n.modified,s=n.original;if(!s||!r)return;await a.get(ma).apply([new ja(r.uri,{range:r.textModel.getFullModelRange(),text:s.textModel.getValue()})],{quotableLabel:"Revert Notebook Cell Content Change"})}}});var SJo=d(11889,null);W(class extends K{constructor(){super({id:"notebook.diffEditor.2.cell.revertOutputs",title:SJo,icon:kZ,f1:!1,menu:{when:x.and(fr.isEqualTo(om.ID),x.equals(H4.key,"Output"),x.equals(U4.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 om))return;let n=o.getDiffElementViewModel(e);if(n&&n instanceof GC){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 fgo=d(11888,null);W(class extends K{constructor(){super({id:"notebook.diffEditor.2.cell.revertMetadata",title:fgo,icon:kZ,f1:!1,menu:{when:x.and(fr.isEqualTo(om.ID),x.equals(H4.key,"Metadata"),x.equals(U4.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 om))return;let n=o.getDiffElementViewModel(e);if(n&&n instanceof GC){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:fgo,icon:kZ,f1:!1,menu:{id:D.NotebookDiffCellMetadataTitle,when:eme},precondition:eme})}run(a,i){if(!i||!(i instanceof GC))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(11890,null),icon:olo,f1:!1,menu:{id:D.NotebookDiffCellOutputsTitle,when:wVt}})}run(a,i){i&&(i.renderOutput=!i.renderOutput)}});W(class extends K{constructor(){super({id:"notebook.diff.cell.revertOutputs",title:d(11889,null),icon:kZ,f1:!1,menu:{id:D.NotebookDiffCellOutputsTitle,when:eme},precondition:eme})}run(a,i){if(!i||!(i instanceof GC))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(11884,null),icon:ilo,f1:!1,menu:{id:D.NotebookDiffCellInputTitle,when:Zpe,order:1},precondition:Zpe,toggled:x.equals(bwi,!1)})}run(a,i){let e=i;if(!e?.modified)return;let t=e.modified.uri,o=a.get(Nn),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:ggo,icon:kZ,f1:!1,menu:{id:D.NotebookDiffCellInputTitle,when:Zpe,order:2},precondition:Zpe})}run(a,i){if(!i)return;let e=i.original,t=i.modified;return!e||!t?void 0:a.get(ma).apply([new ja(t.uri,{range:t.textModel.getFullModelRange(),text:e.textModel.getValue()})],{quotableLabel:"Revert Notebook Cell Content Change"})}});var c1t=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 c1t{constructor(){super("notebook.diff.showOutputs",L(11898,"Show Outputs Differences"),x.or(fr.isEqualTo(Xm.ID),fr.isEqualTo(om.ID)),x.notEquals("config.notebook.diff.ignoreOutputs",!0),2,!0,void 0)}});W(class extends c1t{constructor(){super("notebook.diff.showMetadata",L(11897,"Show Metadata Differences"),x.or(fr.isEqualTo(Xm.ID),fr.isEqualTo(om.ID)),x.notEquals("config.notebook.diff.ignoreMetadata",!0),1,void 0,!0)}});W(class extends K{constructor(){super({id:"notebook.diff.action.previous",title:d(11886,null),icon:rlo,f1:!1,keybinding:{primary:1597,weight:200,when:fr.isEqualTo(Xm.ID)},menu:{id:D.EditorTitle,group:"navigation",when:fr.isEqualTo(Xm.ID)}})}run(a){let i=a.get(ee);if(i.activeEditorPane?.getId()!==lY)return;i.activeEditorPane.getControl()?.previousChange()}});W(class extends K{constructor(){super({id:"notebook.diff.action.next",title:d(11885,null),icon:slo,f1:!1,keybinding:{primary:573,weight:200,when:fr.isEqualTo(Xm.ID)},menu:{id:D.EditorTitle,group:"navigation",when:fr.isEqualTo(Xm.ID)}})}run(a){let i=a.get(ee);if(i.activeEditorPane?.getId()!==lY)return;i.activeEditorPane.getControl()?.nextChange()}});W(class extends K{constructor(){super({id:"notebook.diff.inline.toggle",title:d(11894,null),menu:{id:D.EditorTitle,group:"1_diff",order:10,when:x.and(fr.isEqualTo(Xm.ID),x.equals("config.notebook.diff.experimental.toggleInline",!0),mI.negate(),EB.negate())}})}run(a){let i=a.get(ee);if(i.activeEditorPane?.getId()!==lY)return;i.activeEditorPane.getControl()?.toggleInlineView()}});oe.as(ii.Configuration).registerConfiguration({id:"notebook",order:100,type:"object",properties:{"notebook.diff.ignoreMetadata":{type:"boolean",default:!1,markdownDescription:d(11892,null)},"notebook.diff.ignoreOutputs":{type:"boolean",default:!1,markdownDescription:d(11893,null)},"notebook.diff.experimental.toggleInline":{type:"boolean",default:typeof to.quality=="string"&&to.quality!=="stable",markdownDescription:d(11900,null)}}});var UNe=class extends C{constructor(e,t,o,n){super();this._instantiationService=e;this._logService=t;this._notebookService=o;this._accessibilitySignalService=n;this._executions=new vt;this._notebookExecutions=new vt;this._notebookListeners=new vt;this._cellListeners=new vt;this._lastFailedCells=new vt;this._lastCompletedCellHandles=new vt;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 jit(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 jit(e,t))}_onExecutionDidChange(e,t){this._onDidChangeExecution.fire(new Qit(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 Qit(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(zNe,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 jit(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(zNe,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 Qit(e,o[0]))),o[0]}_createNotebookCellExecution(e,t){let o=e.uri,n=this._instantiationService.createInstance($it,t,e),r=hn(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(qit,e),n=hn(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())}};UNe=I([m(0,F),m(1,ne),m(2,un),m(3,tr)],UNe);var jit=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&&Xe(this.notebook,e.notebook)&&this.cellHandle===e.handle}affectsNotebook(i){return Xe(this.notebook,i)}},Qit=class{constructor(i,e){this.notebook=i;this.changed=e;this.type=1}affectsNotebook(i){return Xe(this.notebook,i)}},zNe=class extends C{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)}}}};zNe=I([m(1,un),m(2,Tl),m(3,AY),m(4,rs),m(5,ne)],zNe);function IJo(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 $it=class extends C{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:_t(),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=>Q8e[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=>IJo(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)}};$it=I([m(2,ne)],$it);var qit=class extends C{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()}};qit=I([m(1,ne)],qit);var KNe=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(12090,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 E4.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)}};KNe=I([m(0,ge),m(1,Tl),m(2,mR),m(3,Vd),m(4,_v),m(5,rs)],KNe);var vgo=ae("notebookKeymapService");var GNe=class extends C{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(yJo)((s=>{Promise.all(s.map(l=>this.checkForOtherKeymaps(l))).then(void 0,mt)})))}checkForOtherKeymaps(e){return this.instantiationService.invokeFunction(dTi).then(t=>{let o=t.filter(r=>wJo(this.tipsService,r)),n=o.find(r=>Ot(r.identifier,e));if(n&&n.globallyEnabled){let r=o.filter(s=>!Ot(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(St.Info,d(10077,null,t.map(n=>`'${n.local.manifest.displayName}'`).join(", ")),[{label:d(10079,null),run:()=>o(!0)},{label:d(10078,null),run:()=>o(!1)}])}};GNe=I([m(0,F),m(1,Os),m(2,nD),m(3,ao),m(4,Ne)],GNe);function yJo(a){let i=a.get(ls),e=a.get(Os),t=H.chain(i.onDidInstallExtensions,o=>o.filter(n=>n.some(({operation:r})=>r===2)).map(n=>n.map(({identifier:r})=>r)));return H.debounce(H.any(H.any(t,H.map(i.onDidUninstallExtension,o=>[o.identifier])),H.map(e.onEnablementChanged,o=>o.map(n=>n.identifier))),(o,n)=>{o=o||[];for(let r of n)o.some(s=>!Ot(s,r))&&o.push(r);return o})}async function dTi(a){let i=a.get(ls),e=a.get(Os);return(await i.getInstalled()).map(o=>({identifier:o.identifier,local:o,globallyEnabled:e.isEnabled(o)}))}function wJo(a,i){let e=i.local.manifest.categories;return e&&e.indexOf("Keymaps")!==-1||a.getKeymapRecommendations().some(t=>Ot({id:t},i.local.identifier))}function CJo(a){let i=a.get(ls),e=a.get(Os),t=H.chain(i.onDidInstallExtensions,o=>o.filter(n=>n.some(({operation:r})=>r===2)).map(n=>n.map(({identifier:r})=>r)));return H.debounce(H.any(H.any(t,H.map(i.onDidUninstallExtension,o=>[o.identifier])),H.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=>!Ot(s,r))&&o.push(r);return o})}var xJo="hasRecommendedKeymap",$Ne=class extends C{constructor(e,t,o,n,r){super();this.instantiationService=e;this.extensionEnablementService=t;this.notificationService=o;this.notebookKeymapMemento=new Bl("notebookKeymap",n),this.notebookKeymap=this.notebookKeymapMemento.getMemento(0,0),this._register(r.onDidShutdown(()=>this.dispose())),this._register(this.instantiationService.invokeFunction(CJo)((s=>{Promise.all(s.map(l=>this.checkForOtherKeymaps(l))).then(void 0,mt)})))}checkForOtherKeymaps(e){return this.instantiationService.invokeFunction(dTi).then(t=>{let o=t.filter(r=>kJo(r)),n=o.find(r=>Ot(r.identifier,e));if(n&&n.globallyEnabled){this.notebookKeymap[xJo]=!0,this.notebookKeymapMemento.saveMemento();let r=o.filter(s=>!Ot(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(St.Info,d(12092,null,Uo(t.map(n=>n.local.manifest.displayName)).map(n=>`'${n}'`).join(", ")),[{label:d(12094,null),run:()=>o(!0)},{label:d(12093,null),run:()=>o(!1)}])}};$Ne=I([m(0,F),m(1,Os),m(2,Ne),m(3,le),m(4,ao)],$Ne);function kJo(a){if(a.local.manifest.extensionPack)return!1;let i=a.local.manifest.keywords;return i?i.indexOf("notebook-keymap")!==-1:!1}var bgo=5,BB=class extends C{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,BB.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 zH;if(n.set(t,t,1),n.size>bgo){let r=[...n.entries()].slice(0,bgo);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(BB.STORAGE_KEY,JSON.stringify(t),1,0)}else this._storageService.remove(BB.STORAGE_KEY,1)}_loadState(){let e=this._storageService.get(BB.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 zH,r=[];for(let s of o.entries)r.push([s,s]);n.fromJSON(r),this._mostRecentKernelsMap[t]=n}}_clear(){this._mostRecentKernelsMap={},this._saveState()}};BB=I([m(0,le),m(1,Tl),m(2,_v)],BB);W(class extends K{constructor(){super({id:"notebook.clearNotebookKernelsMRUCache",title:L(12091,"Clear Notebook Kernels MRU Cache"),category:We.Developer,f1:!0})}async run(a){a.get(mR)._clear()}});var EJo="notebook.rendering",qNe=class extends C{static{this.ID="notebook"}constructor(i){super(),this._logger=this._register(i.createLogger(EJo,{name:d(12095,null),group:vR}))}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}`)}};qNe=I([m(0,ol)],qNe);var d1t=class{constructor(i){this.notebookKernelService=i;this.cancellationTokenSource=new $e}hasChildren(i){return i.kind==="root"||i.hasNamedChildren||i.indexedChildrenCount>0}cancel(){this.cancellationTokenSource.cancel(),this.cancellationTokenSource.dispose(),this.cancellationTokenSource=new $e}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>NRt){let o=Math.floor(Math.max(i.indexedChildrenCount/NRt,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(11721,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>=NRt)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 uTi=_,TJo=1024,m1t=L(11722,"Notebook Variables"),pTi=L(11723,"REPL Variables");var u1t=class{getHeight(i){return 22}getTemplateId(i){return i8.ID}},i8=class{static{this.ID="variableElement"}get templateId(){return i8.ID}constructor(i){this.expressionRenderer=i.createInstance($R)}renderTemplate(i){let e=R(i,uTi(".expression")),t=R(e,uTi("span.name")),o=R(e,uTi("span.value"));return{expression:e,name:t,value:o,elementDisposables:new P}}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:TJo,session:void 0}))}disposeElement(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.elementDisposables.dispose()}};i8=I([m(0,F)],i8);var p1t=class{constructor(){this._widgetAriaLabel=Le("widgetAriaLabel",m1t.value)}getWidgetAriaLabel(){return this._widgetAriaLabel}updateWidgetAriaLabel(i){this._widgetAriaLabel.set(i,void 0)}getAriaLabel(i){return d(11724,null,i.name,i.value)}};var jNe=class extends zr{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 p1t,this.handleActiveEditorChange(!1),this.dataSource=new d1t(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(nu,"notebookVariablesTree",e,new u1t,[this.instantiationService.createInstance(i8)],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([[r_t.key,t.name],[kke.key,t.value],[KY.key,t.type],[eXi.key,t.interfaces],[tXi.key,t.language],[iXi.key,t.extensionId]]),r=this.menuService.getMenuActions(D.NotebookVariablesContext,n,{arg:o,shouldForwardArgs:!0}),s=Uc(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,Nj(t.input)?(this.updateTitle(pTi.value),this.accessibilityProvider.updateWidgetAriaLabel(pTi.value)):(this.updateTitle(m1t.value),this.accessibilityProvider.updateWidgetAriaLabel(m1t.value)),o&&(this.tree?.setInput({kind:"root",notebook:e}),this.updateScheduler.schedule())}getActiveNotebook(){let e=this.editorService.activeEditorPane,t=qn(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=qn(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=qn(t)?.textModel;o&&o.uri.toString()===e.toString()&&this.setActiveNotebook(o,t)})}};jNe=I([m(1,ee),m(2,Tl),m(3,rs),m(4,_e),m(5,ze),m(6,X),m(7,B),m(8,F),m(9,Ri),m(10,Qe),m(11,Ge),m(12,ge),m(13,De),m(14,tt),m(15,qt)],jNe);var QNe=class extends C{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=fhe.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(ft.notebookVariablesView)&&this.handleInitEvent()}handleInitEvent(e){(this.editorService.activeEditorPane?.getId()==="workbench.editor.repl"||this.configurationService.getValue(ft.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):qn(this.editorService.activeEditorPane)?.getViewModel()?.notebookDocument;return t&&this.notebookKernelService.getMatchingKernel(t).selected?.hasVariableProvider}initializeView(){let e=this.viewDescriptorService.getViewContainerById(jh);if(e){let t=oe.as(on.ViewsRegistry),o={id:"workbench.notebook.variables",name:L(11720,"Notebook Variables"),containerIcon:DWt,ctorDescriptor:new Mt(jNe),order:50,weight:5,canToggleVisibility:!0,canMoveView:!0,collapsed:!1,when:fhe};return t.registerViews([o],e),!0}return!1}dispose(){super.dispose(),this.listeners.forEach(e=>e.dispose()),this.configListener.dispose()}};QNe=I([m(0,X),m(1,B),m(2,ee),m(3,rs),m(4,Tl),m(5,un),m(6,Ri)],QNe);var h1t=class{constructor(){this.priority=105;this.name="notebook";this.when=x.and(rr,mS.negate());this.type="help"}getProvider(i){let e=i.get(Kt).getActiveCodeEditor()||i.get(Kt).getFocusedCodeEditor()||i.get(ee).activeEditorPane;if(e)return DJo(i,e)}};function _Jo(){return[d(11989,null),d(11980,null,"<keybinding:notebook.cell.edit>"),d(11984,null,"<keybinding:notebook.cell.quitEdit>"),d(11982,null,"<keybinding:notebook.cell.focusInOutput>"),d(11987,null,"<keybinding:notebook.focusNextEditor>"),d(11988,null,"<keybinding:notebook.focusPreviousEditor>"),d(11985,null),d(11981,null,"<keybinding:notebook.cell.executeAndFocusContainer>"),d(11983,null,"<keybinding:notebook.cell.insertCodeCellAbove>","<keybinding:notebook.cell.insertCodeCellBelow>"),d(11986,null)].join(`
`)}function DJo(a,i){let e=_Jo();return new tp("notebook",{type:"help"},()=>e,()=>i.focus(),"accessibility.verbosity.notebook")}var g1t=class{constructor(){this.priority=100;this.name="notebook";this.type="view";this.when=x.and($u,$h.toNegated())}getProvider(i){let e=i.get(ee);return LJo(e)}};function LJo(a){let i=a.activeEditorPane,e=qn(i),t=e?.getViewModel(),o=t?.getSelections(),n=t?.notebookDocument;if(!o||!n||!e?.textModel)return;let r=t.viewCells[o[0].start],s=yRe(n,r);if(s)return new tp("notebook",{type:"view"},()=>s,()=>{e?.setFocus(o[0]),e.focus()},"accessibility.verbosity.notebook")}var Dm=class extends C{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 P);this._store.add(this._extensionService.onDidChangeExtensions(this._updateConfigValues,this)),this._store.add(gle.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(Dm.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(Ei.toKey(r.extensionId));for(let r of o)r.extensionId&&n.add(Ei.toKey(r.extensionId));e=e.sort((r,s)=>{let l=n.has(Ei.toKey(r.identifier)),c=n.has(Ei.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)}),Dm.extensionIds.length=0,Dm.extensionItemLabels.length=0,Dm.extensionDescriptions.length=0,Dm.extensionIds.push(null),Dm.extensionItemLabels.push(d(10551,null)),Dm.extensionDescriptions.push(d(10552,null));for(let r of e)(r.main||r.browser)&&(Dm.extensionIds.push(r.identifier.value),Dm.extensionItemLabels.push(r.displayName??""),Dm.extensionDescriptions.push(r.description??""))}static _maybeQuotes(e){return e.match(/\s/)?`'${e}'`:e}async _analyzeFormatter(e,t,o){let n=this._configService.getValue(Dm.configName,{resource:o.uri,overrideIdentifier:o.getLanguageId()});if(n){let l=t.find(u=>Ei.equals(u.extensionId,n));if(l)return l;let c=await this._extensionService.getExtension(n);if(c&&this._extensionEnablementService.isEnabled(kE(c))){let u=this._languageService.getLanguageName(o.getLanguageId())||o.getLanguageId();return e===1?d(10549,null,c.displayName||c.name,u):d(10550,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(10537,null,n):d(10538,null,Dm._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(10548,null),detail:r,primaryButton:d(10540,null)});if(s)return this._pickAndPersistDefaultFormatter(e,t)}else this._notificationService.prompt(St.Info,r,[{label:d(10542,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(10553,null,Dm._maybeQuotes(n))});if(!(!r||!e[r.index].extensionId))return this._configService.updateValue(Dm.configName,e[r.index].extensionId.value,{resource:t.uri,overrideIdentifier:t.getLanguageId()}),e[r.index]}_updateStatus(){this._languageStatusStore.clear();let e=ca(this._editorService.activeTextEditorControl);if(!e||!e.hasModel())return;let t=e.getModel(),o=cCe(this._languageFeaturesService.documentFormattingEditProvider,this._languageFeaturesService.documentRangeFormattingEditProvider,t);if(o.length===0)return;let n=new $e;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/${_t()}`,title:d(10541,null)};this._languageStatusStore.add(qe.registerCommand(s.id,()=>this._pickAndPersistDefaultFormatter(o,t))),this._languageStatusStore.add(this._languageStatusService.addStatus({id:"formatter.conflict",name:d(10554,null),selector:{language:t.getLanguageId(),pattern:t.uri.fsPath},severity:St.Error,label:d(10546,null),detail:r,busy:!1,source:"",command:s,accessibilityInfo:void 0}))})}};Dm=I([m(0,lt),m(1,Os),m(2,B),m(3,Ne),m(4,ct),m(5,Ge),m(6,kt),m(7,zt),m(8,kV),m(9,ee)],Dm);oe.as(Qi.Workbench).registerWorkbenchContribution(Dm,3);oe.as(ii.Configuration).registerConfiguration({...nC,properties:{[Dm.configName]:{description:d(10547,null),type:["string","null"],default:null,enum:Dm.extensionIds,enumItemLabels:Dm.extensionItemLabels,markdownEnumDescriptions:Dm.extensionDescriptions}}});async function Sgo(a,i,e){let t=a.get(Ge),o=a.get(B),n=a.get(kt),r={resource:i.uri,overrideIdentifier:i.getLanguageId()},s=o.getValue(Dm.configName,r),l,c=e.map((h,g)=>{let f=Ei.equals(h.extensionId,s),v={index:g,label:h.displayName||"",description:f?d(10539,null):void 0};return f&&(l=v),v}),u={label:d(10536,null)},p=await t.pick([...c,{type:"separator"},u],{placeHolder:d(10543,null),activeItem:l});if(p)if(p===u){let h=n.getLanguageName(i.getLanguageId())||i.getLanguageId(),g=await t.pick(c,{placeHolder:d(10553,null,Dm._maybeQuotes(h))});g&&e[g.index].extensionId&&o.updateValue(Dm.configName,e[g.index].extensionId.value,r);return}else return p.index;else return}Jt(class extends xi{constructor(){super({id:"editor.action.formatDocument.multiple",label:d(10544,null),alias:"Format Document...",precondition:x.and(ue.writable,ue.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(zt),r=e.getModel(),s=cCe(n.documentFormattingEditProvider,n.documentRangeFormattingEditProvider,r),l=await o.invokeFunction(Sgo,r,s);typeof l=="number"&&await o.invokeFunction($ri,s[l],e,1,ve.None)}});Jt(class extends xi{constructor(){super({id:"editor.action.formatSelection.multiple",label:d(10545,null),alias:"Format Code...",precondition:x.and(x.and(ue.writable),ue.hasMultipleDocumentSelectionFormattingProvider),contextMenuOpts:{when:x.and(ue.hasNonEmptySelection),group:"1_modification",order:1.31}})}async run(i,e){if(!e.hasModel())return;let t=i.get(F),o=i.get(zt),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(Sgo,n,s);typeof l=="number"&&await t.invokeFunction(Gri,s[l],e,r,ve.None,!0)}});var mTi=class{constructor(i,e,t,o){this.resolvedNotebookEditorModel=i;this.notebookUri=e;this.cell=t;this.outputId=o}dispose(){this.resolvedNotebookEditorModel.dispose()}},QR=class extends Us{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 QR.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 mTi(this._notebookRef.object,this._notebookUri,e,t)}getSerializedData(){if(!this._notebookRef)return;let e=this._notebookRef.object.notebook.cells.findIndex(n=>Xe(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(12089,null)}get editorId(){return"notebookOutputEditor"}get resource(){}get capabilities(){return 2}dispose(){super.dispose()}};QR=I([m(4,mh)],QR);var hTi=class a extends C{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}},o8=class extends pa{constructor(e,t,o,n,r,s,l){super(o8.ID,e,n,o,r);this.instantiationService=t;this.configurationService=s;this.notebookService=l;this.creationOptions=UZ();this._outputWebview=null;this._isDisposed=!1;this._notebookOptions=this.instantiationService.createInstance(nT,this.window,!1,void 0),this._register(this._notebookOptions)}static{this.ID=v9i}get isDisposed(){return this._isDisposed}createEditor(e){this._rootElement=R(e,_(".notebook-output-editor"))}get fontInfo(){return this._fontInfo||(this._fontInfo=this.createFontInfo()),this._fontInfo}createFontInfo(){let e=this.configurationService.getValue("editor");return Fy.readFontInfo(this.window,LS(e,Xd.getInstance(this.window).value))}async _createOriginalWebview(e,t,o){this._outputWebview?.dispose(),this._outputWebview=this.instantiationService.createInstance(uA,this,e,t,o,{...this._notebookOptions.computeDiffWebviewOptions(),fontFamily:this._generateFontFamily()},void 0),R(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(12088,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(_t(),s.viewType,A.from({scheme:Y.vscodeNotebookCellOutput,path:"",query:"openIn=notebookOutputEditor"}));let l=s.notebook,c=this._register(new ARe),u=this._register(new hTi),p=new WRe(this._notebookOptions,c,w=>u);this._notebookViewModel=this.instantiationService.createInstance(BZ,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(12086,null));if(!t){let n=e.model.outputs.map(r=>r.mime).join(", ");return this._renderMessage(e,d(12087,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){$r(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()}};o8=I([m(1,F),m(2,De),m(3,Te),m(4,le),m(5,B),m(6,un)],o8);var YNe=class{constructor(i,e,t){this.instantiationService=e;this.uriIdentityService=t;i.registerEditor(`${Y.vscodeNotebookCellOutput}:/**`,{id:"notebookOutputEditor",label:"Notebook Output Editor",priority:"default"},{canSupportResource:o=>o.scheme===Y.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(QR,s,l,c,u),options:n}}})}static{this.ID="workbench.contribution.notebookOutputEditorContribution"}};YNe=I([m(0,ul),m(1,F),m(2,dt)],YNe);pt(YNe.ID,YNe,ut.BlockRestore);oe.as(rn.EditorPane).registerEditorPane(ys.create(uD,uD.ID,"Notebook Editor"),[new Mt(ha)]);oe.as(rn.EditorPane).registerEditorPane(ys.create(Xm,Xm.ID,"Notebook Diff Editor"),[new Mt(yw)]);oe.as(rn.EditorPane).registerEditorPane(ys.create(o8,o8.ID,"Notebook Output Editor"),[new Mt(QR)]);oe.as(rn.EditorPane).registerEditorPane(ys.create(om,om.ID,"Notebook Diff Editor"),[new Mt(Ppe)]);var Yit=class{constructor(i){this._configurationService=i}canSerialize(){return!0}serialize(i){return So(i instanceof yw),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=zg(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")?Ppe.create(i,o,r,void 0,n,s):yw.create(i,o,r,void 0,n,s)}static canResolveBackup(i,e){return!1}};Yit=I([m(0,B)],Yit);var gTi=class{canSerialize(i){return i.typeId===ha.ID}serialize(i){So(i instanceof ha);let e={resource:i.resource,preferredResource:i.preferredResource,viewType:i.viewType,options:i.options};return JSON.stringify(e)}deserialize(i,e){let t=zg(e);if(!t)return;let{resource:o,preferredResource:n,viewType:r,options:s}=t;return!t||!A.isUri(o)||typeof r!="string"?void 0:ha.getOrCreate(i,o,n,r,s)}},fTi=class{canSerialize(i){return i.typeId===QR.ID}serialize(i){So(i instanceof QR);let e=i.getSerializedData();if(e)return JSON.stringify(e)}deserialize(i,e){let t=zg(e);return t?i.createInstance(QR,t.notebookUri,t.cellIndex,void 0,t.outputIndex):void 0}};oe.as(rn.EditorFactory).registerEditorSerializer(ha.ID,gTi);oe.as(rn.EditorFactory).registerEditorSerializer(yw.ID,Yit);oe.as(rn.EditorFactory).registerEditorSerializer(QR.ID,fTi);var Ote=class extends C{constructor(e,t,o){super();this.codeEditorService=o;this.updateCellUndoRedoComparisonKey(t,e),this._register(t.onDidChangeConfiguration(n=>{n.affectsConfiguration(ft.undoRedoPerCell)&&this.updateCellUndoRedoComparisonKey(t,e)})),this._register(this.codeEditorService.registerDecorationType("comment-controller",IRt,{}))}static{this.ID="workbench.contrib.notebook"}updateCellUndoRedoComparisonKey(e,t){let o=e.getValue(ft.undoRedoPerCell);o?(this._uriComparisonKeyComputer?.dispose(),this._uriComparisonKeyComputer=void 0):this._uriComparisonKeyComputer||(this._uriComparisonKeyComputer=t.registerUriComparisonKeyComputer(Zo.scheme,{getComparisonKey:n=>o?n.toString():Ote._getCellUndoRedoComparisonKey(n)}))}static _getCellUndoRedoComparisonKey(e){let t=Zo.parse(e);return t?t.notebook.toString():e.toString()}dispose(){super.dispose(),this._uriComparisonKeyComputer?.dispose()}};Ote=I([m(0,Cl),m(1,B),m(2,Kt)],Ote);var XNe=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:C.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=H.any(n.onWillDispose,o.object.notebook.onWillDispose)(()=>{r.dispose(),o.dispose()});return n}};XNe=I([m(0,Nt),m(1,Ct),m(2,kt),m(3,mh)],XNe);var JNe=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(Y.vscodeNotebookCellMetadata,{provideTextContent:this.provideMetadataTextContent.bind(this)})),this._disposables.push(i.registerTextModelContentProvider(Y.vscodeNotebookCellOutput,{provideTextContent:this.provideOutputTextContent.bind(this)})),this._disposables.push(this._labelService.registerFormatter({scheme:Y.vscodeNotebookCellMetadata,formatting:{label:"${path} (metadata)",separator:"/"}})),this._disposables.push(this._labelService.registerFormatter({scheme:Y.vscodeNotebookCellOutput,formatting:{label:"${path} (output)",separator:"/"}}))}static{this.ID="workbench.contrib.cellInfoContentProvider"}dispose(){Ue(this._disposables)}async provideMetadataTextContent(i){let e=this._modelService.getModel(i);if(e)return e;let t=Zo.parseCellPropertyUri(i,Y.vscodeNotebookCellMetadata);if(!t)return null;let o=await this._notebookModelResolverService.resolve(t.notebook),n=null,r=this._languageService.createById("json"),s=new P;for(let c of o.object.notebook.cells)if(c.handle===t.handle){let u=o.object.notebook.cells.indexOf(c),p=QK(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=QK(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=Iwi(i.outputs);if(e)return{content:e,mode:this._languageService.createById(Fr)}}_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:rF(s,{}),mode:o},t}async provideOutputsTextContent(i){let e=this._modelService.getModel(i);if(e)return e;let t=Zo.parseCellPropertyUri(i,Y.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(zZ(n.outputs||[]),r,i,!0),l=H.any(n.onDidChangeOutputs??H.None,n.onDidChangeOutputItems??H.None)(()=>{s.setValue(zZ(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=H.any(n.onDidChangeOutputs??H.None,n.onDidChangeOutputItems??H.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}};JNe=I([m(0,Nt),m(1,Ct),m(2,kt),m(3,ot),m(4,mh)],JNe);var ZNe=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(Y.vscodeNotebookMetadata,{provideTextContent:this.provideMetadataTextContent.bind(this)})),this._disposables.push(this._labelService.registerFormatter({scheme:Y.vscodeNotebookMetadata,formatting:{label:"${path} (metadata)",separator:"/"}}))}static{this.ID="workbench.contrib.notebookMetadataContentProvider"}dispose(){Ue(this._disposables)}async provideMetadataTextContent(i){let e=this._modelService.getModel(i);if(e)return e;let t=B3e.parse(i);if(!t)return null;let o=await this._notebookModelResolverService.resolve(t),n=null,r=this._languageService.createById("json"),s=new P,l=CVt(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=CVt(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}};ZNe=I([m(0,Nt),m(1,Ct),m(2,kt),m(3,ot),m(4,mh)],ZNe);var f1t=class extends C{static{this.ID="workbench.contrib.registerCellSchemas"}constructor(){super(),this.registerMetadataSchemas()}registerMetadataSchemas(){let i=oe.as(ea.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)}},eOe=class{constructor(i,e,t){this._editorService=i;this._notebookEditorModelService=e;this._disposables=new P;this._disposables.add(H.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 ha&&l.viewType!==o.viewType&&Xe(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:ha.ID,editorId:t.viewType})&&ms(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)}};eOe=I([m(0,ee),m(1,mh),m(2,Et)],eOe);var tOe=class extends C{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 ha&&t.viewType===this._getViewType(e)&&Xe(e.resource,t.resource):!1}createEditor(e){return ha.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=_O.parse(e.typeId);if(t&&t.viewType===t.notebookType)return t?.viewType}};tOe=I([m(0,F),m(1,Vf),m(2,lt),m(3,un)],tOe);var iOe=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}}};iOe=I([m(0,un),m(1,zt)],iOe);var RJo=oe.as(Qi.Workbench);pt(Ote.ID,Ote,ut.BlockStartup);pt(XNe.ID,XNe,ut.BlockStartup);pt(JNe.ID,JNe,ut.BlockStartup);pt(ZNe.ID,ZNe,ut.BlockStartup);pt(f1t.ID,f1t,ut.BlockStartup);pt(eOe.ID,eOe,ut.BlockRestore);pt(iOe.ID,iOe,ut.BlockRestore);pt(tOe.ID,tOe,ut.BlockRestore);RJo.registerWorkbenchContribution(QNe,4);xa.register(new g1t);xa.register(new h1t);we(un,OZ,1);we(JK,mMe,1);we(mh,vMe,1);we(qX,PVt,1);we(Zc,hMe,1);we(Tl,bB,1);we(mR,BB,1);we(AY,KNe,1);we(rs,UNe,1);we(fTe,bMe,1);we(vgo,$Ne,1);we(_v,qNe,1);we($Re,GRe,1);we(gVt,zRe,1);var vTi={};function MJo(a){return typeof a.type<"u"||typeof a.anyOf<"u"}for(let a of hU){let i=a.schema;if(i)if(MJo(i))vTi[`editor.${a.name}`]=i;else for(let e in i)Object.hasOwnProperty.call(i,e)&&(vTi[e]=i[e])}var PJo={description:d(11934,null),default:{},allOf:[{properties:vTi}],tags:["notebookLayout"]},AJo=oe.as(ii.Configuration);AJo.registerConfiguration({id:"notebook",order:100,title:d(11975,null),type:"object",properties:{[ft.displayOrder]:{description:d(11932,null),type:"array",items:{type:"string"},default:[]},[ft.cellToolbarLocation]:{description:d(11922,null),type:"object",additionalProperties:{markdownDescription:d(11923,null),type:"string",enum:["left","right","hidden"]},default:{default:"right"},tags:["notebookLayout"]},[ft.showCellStatusBar]:{description:d(11963,null),type:"string",enum:["hidden","visible","visibleAfterExecute"],enumDescriptions:[d(11964,null),d(11965,null),d(11966,null)],default:"visible",tags:["notebookLayout"]},[ft.cellExecutionTimeVerbosity]:{description:d(11918,null),type:"string",enum:["default","verbose"],enumDescriptions:[d(11917,null),d(11919,null)],default:"default",tags:["notebookLayout"]},[ft.textDiffEditorPreview]:{description:d(11930,null),type:"boolean",default:!0,tags:["notebookLayout"]},[ft.diffOverviewRuler]:{description:d(11929,null),type:"boolean",default:!1,tags:["notebookLayout"]},[ft.cellToolbarVisibility]:{markdownDescription:d(11924,null),type:"string",enum:["hover","click"],default:"click",tags:["notebookLayout"]},[ft.undoRedoPerCell]:{description:d(11973,null),type:"boolean",default:!0,tags:["notebookLayout"]},[ft.compactView]:{description:d(11925,null),type:"boolean",default:!0,tags:["notebookLayout"]},[ft.focusIndicator]:{description:d(11936,null),type:"string",enum:["border","gutter"],default:"gutter",tags:["notebookLayout"]},[ft.insertToolbarLocation]:{description:d(11946,null),type:"string",enum:["betweenCells","notebookToolbar","both","hidden"],enumDescriptions:[d(11912,null),d(11915,null),d(11913,null),d(11914,null)],default:"both",tags:["notebookLayout"]},[ft.globalToolbar]:{description:d(11939,null),type:"boolean",default:!0,tags:["notebookLayout"]},[ft.stickyScrollEnabled]:{description:d(11968,null),type:"boolean",default:!1,tags:["notebookLayout"]},[ft.stickyScrollMode]:{description:d(11969,null),type:"string",enum:["flat","indented"],enumDescriptions:[d(11970,null),d(11971,null)],default:"indented",tags:["notebookLayout"]},[ft.consolidatedOutputButton]:{description:d(11927,null),type:"boolean",default:!0,tags:["notebookLayout"]},[ft.showFoldingControls]:{description:d(11967,null),type:"string",enum:["always","never","mouseover"],enumDescriptions:[d(11977,null),d(11979,null),d(11978,null)],default:"mouseover",tags:["notebookLayout"]},[ft.dragAndDropEnabled]:{description:d(11933,null),type:"boolean",default:!0,tags:["notebookLayout"]},[ft.consolidatedRunButton]:{description:d(11928,null),type:"boolean",default:!1,tags:["notebookLayout"]},[ft.globalToolbarShowLabel]:{description:d(11940,null),type:"string",enum:["always","never","dynamic"],default:"always",tags:["notebookLayout"]},[ft.textOutputLineLimit]:{markdownDescription:d(11972,null,"`#notebook.output.scrolling#`"),type:"number",default:30,tags:["notebookLayout","notebookOutputLayout"],minimum:1},[ft.LinkifyOutputFilePaths]:{description:d(11931,null),type:"boolean",default:!0,tags:["notebookOutputLayout"]},[ft.minimalErrorRendering]:{description:d(11951,null),type:"boolean",default:!1,tags:["notebookOutputLayout"]},[ft.markupFontSize]:{markdownDescription:d(11950,null,"`0`","`#editor.fontSize#`"),type:"number",default:0,tags:["notebookLayout"]},[ft.markdownLineHeight]:{markdownDescription:d(11948,null,"`0`","`normal`"),type:"number",default:0,tags:["notebookLayout"]},[ft.cellEditorOptionsCustomizations]:PJo,[ft.interactiveWindowCollapseCodeCells]:{markdownDescription:d(11947,null),type:"string",enum:["always","never","fromEditor"],default:"fromEditor"},[ft.outputLineHeight]:{markdownDescription:d(11955,null),type:"number",default:0,tags:["notebookLayout","notebookOutputLayout"]},[ft.outputFontSize]:{markdownDescription:d(11954,null,"`#editor.fontSize#`"),type:"number",default:0,tags:["notebookLayout","notebookOutputLayout"]},[ft.outputFontFamily]:{markdownDescription:d(11953,null,"`#editor.fontFamily#`"),type:"string",tags:["notebookLayout","notebookOutputLayout"]},[ft.outputScrolling]:{markdownDescription:d(11956,null),type:"boolean",tags:["notebookLayout","notebookOutputLayout"],default:typeof to.quality=="string"&&to.quality!=="stable"},[ft.outputWordWrap]:{markdownDescription:d(11957,null),type:"boolean",tags:["notebookLayout","notebookOutputLayout"],default:!1},[ft.defaultFormatter]:{description:d(11976,null),type:["string","null"],default:null,enum:Dm.extensionIds,enumItemLabels:Dm.extensionItemLabels,markdownEnumDescriptions:Dm.extensionDescriptions},[ft.formatOnSave]:{markdownDescription:d(11938,null,"`#files.autoSave#`"),type:"boolean",tags:["notebookLayout"],default:!1},[ft.insertFinalNewline]:{markdownDescription:d(11945,null),type:"boolean",tags:["notebookLayout"],default:!1},[ft.formatOnCellExecution]:{markdownDescription:d(11937,null),type:"boolean",default:!1},[ft.confirmDeleteRunningCell]:{markdownDescription:d(11926,null),type:"boolean",default:!0},[ft.findFilters]:{markdownDescription:d(11935,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"]},[ft.remoteSaving]:{markdownDescription:d(11958,null),type:"boolean",default:typeof to.quality=="string"&&to.quality!=="stable",tags:["experimental"]},[ft.scrollToRevealCell]:{markdownDescription:d(11959,null,"notebook.cell.executeAndSelectBelow"),type:"string",enum:["fullCell","firstLine","none"],markdownEnumDescriptions:[d(11961,null),d(11960,null),d(11962,null)],default:"fullCell"},[ft.cellGenerate]:{markdownDescription:d(11921,null),type:"boolean",default:!0},[ft.notebookVariablesView]:{markdownDescription:d(11974,null),type:"boolean",default:!1},[ft.notebookInlineValues]:{markdownDescription:d(11942,null),type:"string",enum:["on","auto","off"],enumDescriptions:[d(11944,null),d(11941,null),d(11943,null)],default:"off"},[ft.cellFailureDiagnostics]:{markdownDescription:d(11920,null),type:"boolean",default:!0},[ft.outputBackupSizeLimit]:{markdownDescription:d(11916,null),type:"number",default:1e4},[ft.multiCursor]:{markdownDescription:d(11952,null),type:"boolean",default:!1},[ft.markupFontFamily]:{markdownDescription:d(11949,null),type:"string",default:"",tags:["notebookLayout"]}}});var OJo=Tn.registerExtensionPoint({extensionPoint:"speechProviders",jsonSchema:{description:d(13571,null),type:"array",items:{additionalProperties:!1,type:"object",defaultSnippets:[{body:{name:"",description:""}}],required:["name"],properties:{name:{description:d(13570,null),type:"string"},description:{description:d(13569,null),type:"string"}}}}}),oOe=class extends C{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=TV.bindTo(t),this.textToSpeechInProgress=SLt.bindTo(t),this.speechToTextInProgress=TX.bindTo(t),this.handleAndRegisterSpeechExtensions()}get hasSpeechProvider(){return this.providerDescriptors.size>0||this.providers.size>0}handleAndRegisterSpeechExtensions(){OJo.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=ILt(this.configurationService.getValue(umi)),r=o.createSpeechToTextSession(e,typeof n=="string"?{language:n}:void 0),s=Date.now(),l=!1,c=!1,u=0,p=new P,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=ILt(this.configurationService.getValue(umi)),r=o.createTextToSpeechSession(e,typeof n=="string"?{language:n}:void 0),s=Date.now(),l=!1,c=new P,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 Go,o=new P;o.add(e.onCancellationRequested(()=>{o.dispose(),t.complete(3)}));let n=o.add(new P),r,s=()=>{n.clear();let c=new $e(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 P,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 H.toPromise(o.onDidChange)).status}finally{r()}}};oOe=I([m(0,ne),m(1,X),m(2,oi),m(3,Te),m(4,B),m(5,lt)],oOe);we(EC,oOe,0);var nOe=class extends C{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}}};nOe=I([m(0,ne)],nOe);var xhe=class extends nOe{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?uo(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:Ae(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}}};xhe=I([m(2,PK),m(3,be),m(4,dt),m(5,ne),m(6,MJ)],xhe);var Xit=class extends xhe{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,Je.fromString(JSON.stringify(n))),i.readmeUrl||i.readme){let r=i.readme?i.readme:await this.mcpGalleryService.getReadme(i,ve.None);await this.fileService.writeFile(this.uriIdentityService.extUri.joinPath(t,"README.md"),Je.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,Je.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")}};Xit=I([m(1,PK),m(2,be),m(3,dt),m(4,ne),m(5,MJ),m(6,Co)],Xit);var M2=class extends nOe{constructor(e,t){super(t);this.allowedMcpServersService=e}canInstall(e){let t=this.allowedMcpServersService.isAllowed(e);return t!==!0?new xe(d(2157,null,t.value)):!0}};M2=I([m(0,MR),m(1,ne)],M2);var v1t=class extends M2{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 vt}getMcpResourceManagementService(e){let t=this.mcpResourceManagementServices.get(e);if(!t){let o=new P,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(Xit,e)}};v1t=I([m(0,MR),m(1,ne),m(2,an),m(3,F)],v1t);function Jit(a,i){return a?A.revive(i?i.transformIncoming(a):a):void 0}function rOe(a,i){i=i||xFt;let e=a.manifest;return{...kFt({...a,manifest:void 0},i),manifest:e}}var Fte=class extends M2{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:Jit(n.mcpResource,null)}))),this._register(this.channel.listen("onDidInstallMcpServers")(n=>this._onDidInstallMcpServers.fire(n.map(r=>({...r,local:r.local?rOe(r.local,null):r.local,mcpResource:Jit(r.mcpResource,null)}))))),this._register(this.channel.listen("onDidUpdateMcpServers")(n=>this._onDidUpdateMcpServers.fire(n.map(r=>({...r,local:r.local?rOe(r.local,null):r.local,mcpResource:Jit(r.mcpResource,null)}))))),this._register(this.channel.listen("onUninstallMcpServer")(n=>this._onUninstallMcpServer.fire({...n,mcpResource:Jit(n.mcpResource,null)}))),this._register(this.channel.listen("onDidUninstallMcpServer")(n=>this._onDidUninstallMcpServer.fire({...n,mcpResource:Jit(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=>rOe(o,null))}installFromGallery(e,t){return Promise.resolve(this.channel.call("installFromGallery",[e,t])).then(o=>rOe(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=>rOe(o,null)))}updateMetadata(e,t,o){return Promise.resolve(this.channel.call("updateMetadata",[e,t,o])).then(n=>rOe(n,null))}};Fte=I([m(1,MR),m(2,ne)],Fte);var bTi="usrlocal",STi="usrremote",ITi="workspace",yTi="ws";var n8=rso,sOe=class extends M2{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(eot));let h=l.getConnection();h&&(this.remoteMcpManagementService=this._register(p.createInstance(Fte,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 bTi;if(t==="remoteUser")return STi;if(t==="workspace"){let o=this.workspaceContextService.getWorkspace();if(o.configuration&&this.uriIdentityService.extUri.isEqual(o.configuration,e.mcpResource))return ITi;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,X_[Dv]),e.mcpResource))return`${yTi}${r}`}}return"unknown"}async install(e,t){if(t=t??{},t.target===5||oC(t.target)){let n=t.target===5?this.workspaceContextService.getWorkspace().configuration:t.target.toResource(X_[Dv]);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||oC(t.target)){let n=t.target===5?this.workspaceContextService.getWorkspace().configuration:t.target.toResource(X_[Dv]);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}};sOe=I([m(1,MR),m(2,ne),m(3,mn),m(4,dt),m(5,Pe),m(6,yo),m(7,an),m(8,ZP),m(9,F)],sOe);var Zit=class extends xhe{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")}};Zit=I([m(2,PK),m(3,be),m(4,dt),m(5,ne),m(6,MJ)],Zit);var eot=class extends M2{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 vt;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(X_[Dv]))))}catch(t){this.logService.error(t)}try{await Promise.allSettled(e.added.map(t=>this.addWorkspaceService(t.toResource(X_[Dv]),6)))}catch(t){this.logService.error(t)}}async addWorkspaceService(e,t){if(this.workspaceMcpManagementServices.has(e))return;let o=new P,n=o.add(this.instantiationService.createInstance(Zit,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()}};eot=I([m(0,MR),m(1,dt),m(2,ne),m(3,Pe),m(4,F)],eot);var tot={2:{title:d(11153,null),placeholder:d(11152,null),pickLabel:d(11170,null),pickDescription:d(11171,null),enabledConfigKey:null},3:{title:d(11157,null),placeholder:d(11156,null),pickLabel:d(11174,null),pickDescription:d(11175,null),enabledConfigKey:null},4:{title:d(11155,null),placeholder:d(11154,null),pickLabel:d(11172,null),pickDescription:d(11173,null),enabledConfigKey:"chat.mcp.assisted.nuget.enabled"},5:{title:d(11137,null),placeholder:d(11136,null),pickLabel:d(11165,null),pickDescription:d(11166,null),enabledConfigKey:null}};var aOe=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(11162,null),description:d(11163,null)},{kind:1,label:d(11167,null),description:d(11168,null)}],e;try{e=await this._commandService.executeCommand("github.copilot.chat.mcp.setup.check")}catch{}if(e){i.unshift({type:"separator",label:d(11169,null)});let n=Object.entries(tot).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(11164,null)},...n)}i.push({type:"separator"});let t=this._configurationService.getValue(lZ);t&&typeof t=="object"&&RLe.some(n=>!t[n])&&i.push({kind:"discovery",label:d(11161,null)}),i.push({kind:"browse",label:d(11160,null)});let o=await this._quickInputService.pick(i,{placeHolder:d(11176,null)});if(o?.kind==="browse"){this._commandService.executeCommand("workbench.mcp.browseServers");return}if(o?.kind==="discovery"){this._commandService.executeCommand("workbench.action.openSettings",lZ);return}return o?.kind}async getStdioConfig(){let i=await this._quickInputService.input({title:d(11134,null),placeHolder:d(11133,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(11187,null),placeHolder:d(11186,null),ignoreFocusLost:!0});if(i)return this._telemetryService.publicLog2("mcp.addserver",{packageType:"sse"}),{url:i,type:"http"}}async getServerId(i=`my-mcp-server-${_t().split("-")[0]}`){return await this._quickInputService.input({title:d(11159,null),placeHolder:d(11158,null),value:i,ignoreFocusLost:!0})}async getConfigurationTarget(){let i=[{target:3,label:d(11181,null),description:d(11182,null)}],e=this._environmentService.remoteAuthority&&this._label.getHostLabel(Y.vscodeRemote,this._environmentService.remoteAuthority);e&&i.push({target:4,label:d(11179,null),description:d(11177,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(11183,null),description:d(11185,null,e)}):i.push({target:n,label:d(11183,null),description:d(11184,null)})}return i.length===1?i[0].target:(await this._quickInputService.pick(i,{title:d(11180,null),placeHolder:d(11178,null)}))?.target}async getAssistedConfig(i){let e=await this._quickInputService.input({ignoreFocusLost:!0,title:tot[i].title,placeHolder:tot[i].placeholder});if(!e)return;let t;(g=>(g.Retry="retry",g.Cancel="cancel",g.Allow="allow",g.OpenUri="openUri"))(t||={});let o=new P,n=o.add(this._quickInputService.createQuickPick());n.title=d(11151,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:{...IJe,properties:{...IJe.properties,name:{type:"string",description:"Suggested name of the server, alphanumeric and hyphen only"}},required:[...IJe.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(11138,null),helpUri:A.parse(c.helpUri)}),u.push({id:"retry",label:d(11139,null)},{id:"cancel",label:d(11126,null)}),n.items=u}else n.title=d(11135,null,c.name??e,c.version?`@${c.version}`:"",c.publisher),n.items=[{id:"allow",label:d(11125,null)},{id:"cancel",label:d(11126,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;Hr(l?.type)}showOnceDiscovered(i){let e=new P;e.add(he(t=>{let o=this._mcpRegistry.collections.read(t),n=this._mcpService.servers.read(t),r=DT(o,l=>DT(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===ir.Kind.Error&&s.showOutput()}),e.dispose())})),e.add(nn(()=>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:Hr(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,(oC(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(Ye(i)).replace(/\.json$/,""),o=d(11132,null,t),n=[{id:"install",label:d(11131,null)},{id:"show",label:d(11130,null,t)},{id:"rename",label:d(11129,null,t)},{id:"cancel",label:d(11126,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}=xk(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(11127,null,t,l.message)),await this._editorService.openEditor({resource:i})}break;case"rename":{let l=await this._quickInputService.input({placeHolder:d(11128,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}}};aOe=I([m(1,Ge),m(2,n8),m(3,Pe),m(4,Vt),m(5,ge),m(6,md),m(7,Qe),m(8,ee),m(9,be),m(10,Ne),m(11,Te),m(12,es),m(13,ot),m(14,B)],aOe);var lOe=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(11150,null),filters:[{name:d(11140,null),extensions:["json"]}],canSelectFiles:!0,canSelectMany:!1,openLabel:d(11144,null)});if(!i?.[0])return;let e=i[0],t;try{let c=await this._fileService.readFile(e);t=xk(c.value.toString())}catch(c){this._notificationService.error(d(11146,null,c.message));return}if(!t||typeof t!="object"){this._notificationService.error(d(11142,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(11143,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(11145,null,c.message));return}let l=o.name;if(!(!l&&(l=await this._quickInputService.input({title:d(11148,null),placeHolder:d(11147,null),value:Ye(e).replace(/\.json$/i,""),ignoreFocusLost:!0}),!l)))try{await this._mcpManagementService.install({name:l,config:r,inputs:s}),this._notificationService.info(d(11149,null,l))}catch(c){this._notificationService.error(d(11141,null,c.message))}}};lOe=I([m(0,dn),m(1,be),m(2,Ge),m(3,Ne),m(4,n8),m(5,ne)],lOe);var cOe=class extends C{constructor(e,t){super();this.delegate=e;this.logService=t;this._models=new w$;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 Ww{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())}};cOe=I([m(1,ne)],cOe);var dOe=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,reason:i.action.reason}):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})}};dOe=I([m(0,Te)],dOe);function WJo(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 uOe=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:P_(this.opts.sessionResource),enableCommandDetection:this.opts.enableCommandDetection,isParticipantDetected:!!r,location:this.opts.location,citations:n.response?.codeCitations.length??0,numCodeBlocks:WJo(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":pV(e)?"image":e.kind==="directory"?"directory":e.kind==="tool"?"tool":e.kind==="toolset"?"toolset":A.isUri(e.value)?"file":nv(e.value)?"location":"otherAttachment")}resolveModelId(i){return i&&this.languageModelsService.lookupLanguageModel(i)?.id}};uOe=I([m(1,Te),m(2,Wr)],uOe);function Igo(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 ygo(a,i){if(a instanceof Error){let e=typeof i=="number"?`[${i}]`:`.${i}`,t=!a.message.startsWith("[")&&!a.message.startsWith(".");Igo(a,e+(t?": ":""))}throw a}function wTi(a){return{kind:0,extract:i=>i,equals:a??((i,e)=>i===e)}}function S1t(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 pOe(a){return{kind:2,itemSchema:a,extract:i=>i?.map((e,t)=>{try{return a.extract(e)}catch(o){ygo(o,t)}})}}function Wte(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(Jn(t))return t;let o=Object.create(null);for(let[n,r]of e)try{o[n]=r.extract(t)}catch(s){ygo(s,n)}return o}}}function _A(a,i){return{...i,extract:e=>i.extract(a(e))}}function Sd(a,i){let e=S1t(i);return{...e,extract:t=>e.extract(a(t))}}var VJo=Je.fromString(`
`),b1t=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 Je.fromString(JSON.stringify(e)+`
`)}read(i){let e,t=0,o=0,n=i.byteLength;for(;o<n;){let r=i.indexOf(VJo,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:Hr(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:Je.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>";Igo(r,`error diffing at ${s}: `)}throw r}if(t.length===0)return{op:"append",data:Je.fromString("")};this._entryCount+=t.length,this._previous=e;let n="";for(let r of t)n+=JSON.stringify(r)+`
`;return{op:"append",data:Je.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(Jn(t)||Jn(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 HJo=a=>{let i=a;return i&&typeof i.toJSON=="function"?i.toJSON():a},UJo=Sd(a=>a.kind==="markdownContent"?a.content:HJo(a),(a,i)=>{if(Mr(a)&&Mr(i))return a.value===i.value;if(Wo(a,{kind:!0})&&Wo(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":return uo(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"thinking":case"undoStop":case"warning":case"treeData":case"workspaceEdit":case"disabledClaudeHooks":return a.kind===i.kind;default:Hr(a)}}return!1}),zJo=(a,i)=>Xe(A.from(a),A.from(i)),KJo=Wte({text:Sd(a=>a.text),parts:Sd(a=>a.parts,(a,i)=>a.length===i.length&&a.every((e,t)=>e.text===i[t].text))}),GJo=Wte({uri:Sd(a=>a.uri,zJo),eventKind:Sd(a=>a.eventKind)}),$Jo=Wte({variables:_A(a=>a.variables,pOe(S1t((a,i)=>a.name===i.name)))}),wgo=Wte({requestId:_A(a=>a.id,wTi()),timestamp:Sd(a=>a.timestamp),confirmation:Sd(a=>a.confirmation),message:_A(a=>a.message,KJo),shouldBeRemovedOnSend:Sd(a=>a.shouldBeRemovedOnSend,uo),agent:Sd(a=>a.response?.agent,(a,i)=>a?.id===i?.id),modelId:Sd(a=>a.modelId),editedFileEvents:_A(a=>a.editedFileEvents,pOe(GJo)),variableData:_A(a=>a.variableData,$Jo),isHidden:Sd(()=>{}),isCanceled:Sd(()=>{}),response:_A(a=>a.response?.entireResponse.value,pOe(UJo)),responseId:Sd(a=>a.response?.id),result:Sd(a=>a.response?.result,uo),responseMarkdownInfo:Sd(a=>a.response?.codeBlockInfos?.map(i=>({suggestionId:i.suggestionId})),uo),followups:Sd(a=>a.response?.followups,uo),modelState:Sd(a=>a.response?.stateT,uo),vote:Sd(a=>a.response?.vote),voteDownReason:Sd(a=>a.response?.voteDownReason),slashCommand:_A(a=>a.response?.slashCommand,S1t((a,i)=>a?.name===i?.name)),usedContext:Sd(a=>a.response?.usedContext,uo),contentReferences:Sd(a=>a.response?.contentReferences,uo),codeCitations:Sd(a=>a.response?.codeCitations,uo),timeSpentWaiting:Sd(a=>a.response?.timestamp)},{sealed:a=>a.modelState?.value===2||a.modelState?.value===3||a.modelState?.value===1}),qJo=Wte({attachments:Sd(a=>a.attachments,uo),mode:Sd(a=>a.mode,(a,i)=>a.id===i.id),selectedModel:Sd(a=>a.selectedModel,(a,i)=>a?.identifier===i?.identifier),inputText:Sd(a=>a.inputText),selections:Sd(a=>a.selections,uo),contrib:Sd(a=>a.contrib,uo)}),jJo=Wte({id:_A(a=>a.request.id,wTi()),request:_A(a=>a.request,wgo),kind:Sd(a=>a.kind),sendOptions:Sd(a=>odo(a.sendOptions),uo)}),QJo=Wte({version:Sd(()=>3),creationDate:Sd(a=>a.timestamp),customTitle:Sd(a=>a.hasCustomTitle?a.title:void 0),initialLocation:Sd(a=>a.initialLocation),inputState:_A(a=>a.inputModel.toJSON(),qJo),responderUsername:Sd(a=>a.responderUsername),sessionId:Sd(a=>a.sessionId),requests:_A(a=>a.getRequests(),pOe(wgo)),hasPendingEdits:Sd(a=>a.editingSession?.entries.get().some(i=>i.state.get()===0)),repoData:Sd(a=>a.repoData,uo),pendingRequests:_A(a=>a.getPendingRequests(),pOe(jJo))}),Vte=class extends b1t{constructor(){super(QJo,1024)}};var Cgo=50,I1t="chat.ChatSessionStore.index",CTi="ChatSessionStore.transferIndex",Bte=class extends C{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 Nm;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?je(this.userDataProfilesService.defaultProfile.globalStorageHome,"emptyWindowChatSessions"):je(this.environmentService.workspaceStorageHome,b,"chatSessions"),this.previousEmptyWindowStorageRoot=v?je(this.environmentService.workspaceStorageHome,"no-workspace","chatSessions"):void 0,this.transferredSessionStorageRoot=je(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(7631,null)})}))}async handleWorkspaceTransition(e,t){let o=Eq(e),n=Eq(t),r=e.id,s=t.id;this.logService.info(`ChatSessionStore: Workspace transition from ${r} to ${s}`);let l=o?je(this.userDataProfilesService.defaultProfile.globalStorageHome,"emptyWindowChatSessions"):je(this.environmentService.workspaceStorageHome,r,"chatSessions"),c=n?je(this.userDataProfilesService.defaultProfile.globalStorageHome,"emptyWindowChatSessions"):je(this.environmentService.workspaceStorageHome,s,"chatSessions");if(l.toString()===c.toString()){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=je(this.storageRoot,l.name);try{await this.fileService.copy(c,u,!1),s++}catch(p){hu(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&&cs.parseLocalSessionId(s)){let l=this.getTransferredSessionStorageLocation(s);await this.fileService.del(l)}}catch(s){hu(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,Je.fromString(s))}catch(s){this.reportError("sessionWrite","Error writing chat session",s);return}o[n]=e;try{this.storageService.store(CTi,o,0,1)}catch(s){this.reportError("storeTransferSession","Error storing chat transfer session",s)}}getTransferredSessionIndex(){try{return this.storageService.getObject(CTi,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=Xn(n);if(Date.now()-n.timestampInMilliseconds>Bte.TRANSFER_EXPIRATION_MS){this.logService.info("ChatSessionStore: Transferred session has expired"),this.cleanupTransferredSession(r.sessionResource);return}return!!cs.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=cs.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(CTi,t,0,1)}let n=this.getTransferredSessionStorageLocation(e);await this.fileService.del(n)}catch(t){hu(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 Eb){e.dataSerializer||(e.dataSerializer=new Vte);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(7629,null),message:d(7630,null,l.stack||In(l)),buttons:[{label:d(7633,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 Vte().createInitialFromSerialized(e);await this.fileService.writeFile(o.log,r)}else await this.fileService.writeFile(o.flat,Je.fromString(JSON.stringify(e)));let n=await xgo(e);t.entries[e.sessionId]=n}catch(t){this.reportError("sessionWrite","Error writing chat session",t)}}async writeSessionMetadataOnly(e){if(!cs.parseLocalSessionId(e.sessionResource))try{let t=this.internalGetIndex(),o=e.sessionResource.toString();t.entries[o]=await xgo(e)}catch(t){this.reportError("sessionMetadataWrite","Error writing chat session metadata",t)}}async flushIndex(){let e=this.internalGetIndex();try{this.storageService.store(I1t,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>Cgo){let o=t.slice(Cgo);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){hu(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&&hu(o);n===1?this.logService.trace("ChatSessionStore: "+t,In(o)):this.logService.error("ChatSessionStore: "+t,In(o)),this.telemetryService.publicLog2("chatSessionStoreError",{reason:e,fileOperationReason:n??-1})}internalGetIndex(){if(this.indexCache)return this.indexCache;let e=this.storageService.get(I1t,this.getIndexStorageScope(),void 0);if(!e)return this.indexCache={version:1,entries:{}},this.indexCache;try{let t=JSON.parse(e);XJo(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 cs.parseLocalSessionId(e)??e.toString()}logIndex(){let e=this.storageService.get(I1t,this.getIndexStorageScope(),void 0);this.logService.info("ChatSessionStore index: ",e)}async migrateDataIfNeeded(e){await this.storeQueue.queue(async()=>{if(!this.storageService.get(I1t,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),hu(s)===1&&this.previousEmptyWindowStorageRoot&&(r=await this.readSessionFromPreviousLocation(o))}if(r)try{let s,l=new Vte;n===t?s=Xn(l.read(r)):s=Xn(JSON.parse(r.toString()));for(let c of s.requests)Array.isArray(c.response)?c.response=c.response.map(u=>typeof u=="string"?new xe(u):u):typeof c.response=="string"&&(c.response=[new xe(c.response)]);return{value:qVt(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=je(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:je(this.storageRoot,`${e}.json`),log:this.configurationService.getValue("chat.useLogSessionStorage")!==!1?je(this.storageRoot,`${e}.jsonl`):void 0}}getTransferredSessionStorageLocation(e){let t=cs.parseLocalSessionId(e);return je(this.transferredSessionStorageRoot,`${t}.json`)}getChatStorageFolder(){return this.storageRoot}};Bte=I([m(0,be),m(1,Co),m(2,ne),m(3,Pe),m(4,Te),m(5,le),m(6,ao),m(7,an),m(8,B),m(9,Of),m(10,ct),m(11,Qe)],Bte);function YJo(a){return!!a&&typeof a=="object"&&typeof a.sessionId=="string"&&typeof a.title=="string"&&typeof a.lastMessageDate=="number"}function XJo(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(!YJo(i.entries[e]))return!1;return!0}async function xgo(a){let i=a.customTitle||(a instanceof Eb?a.title:void 0),e;a instanceof Eb&&(e=await HTe(a));let t=a instanceof Eb?a.lastMessageDate:a.requests.at(-1)?.timestamp??a.creationDate,o=a instanceof Eb?a.timing:{created:a.creationDate,lastRequestStarted:a.requests.at(-1)?.timestamp,lastRequestEnded:t},n=a instanceof Eb?a.lastRequest?.response?.state??1:1;return(n===0||n===4)&&(n=2),{sessionId:a.sessionId,title:i||d(7632,null),lastMessageDate:t,timing:o,initialLocation:a.initialLocation,hasPendingEdits:a instanceof Eb?a.editingSession?.entries.get().some(r=>r.state.get()===0):!1,isEmpty:a instanceof Eb?a.getRequests().length===0:a.requests.length===0,stats:e,isExternal:a instanceof Eb&&!cs.parseLocalSessionId(a.sessionResource),lastResponseState:n}}async function kgo(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 hOe=ae("chatTransferService"),iot="chat.transferedWorkspaces",mOe=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(iot,0,[]).filter(o=>o!==i.toString());this.storageService.store(iot,t,0,1)}addWorkspaceToTransferred(i){let e=this.storageService.getObject(iot,0,[]);e.push(i.toString()),this.storageService.store(iot,e,0,1)}async checkAndSetTransferredWorkspaceTrust(){let i=this.workspaceService.getWorkspace(),e=i.folders[0]?.uri;e&&this.isChatTransferredWorkspace(e,this.storageService)&&await kgo(i,this.fileService)&&(await this.workspaceTrustManagementService.setWorkspaceTrust(!0),this.deleteWorkspaceFromTransferredList(e))}isChatTransferredWorkspace(i,e){return i?e.getObject(iot,0,[]).some(o=>o.toString()===i.toString()):!1}};mOe=I([m(0,Pe),m(1,le),m(2,be),m(3,ns)],mOe);var JJo="interactive.sessions",khe=class{constructor(i,e,t){this.cancellationTokenSource=i;this.requestId=e;this.toolsService=t;this._yieldRequested=Le(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)}};khe=I([m(2,jn)],khe);var gOe=class extends C{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 UD);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 UD);this._sessionModels=this._register(r.createInstance(cOe,{createModel:w=>this._startSession(w),willDisposeModel:async w=>{let k=cs.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=>{this.chatDebugService.endSession(w.sessionResource),this._onDidDisposeSession.fire({sessionResource:[w.sessionResource],reason:"cleared"})})),this._chatServiceTelemetry=this.instantiationService.createInstance(dOe),this._chatSessionStore=this._register(this.instantiationService.createInstance(Bte)),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=Ce(this,w=>[...this._sessionModels.observable.read(w).values()]),this.requestInProgressObs=Ce(w=>{let k=this._sessionModels.observable.read(w).values();return ht.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(mo)}isEnabled(e){return this.chatAgentService.getContributedDefaultAgent(e)!==void 0}migrateData(){let e=this.storageService.get(JJo,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=>!cs.parseLocalSessionId(o.sessionResource));this._chatSessionStore.storeSessionsMetadataOnly(t)}shouldStoreSession(e){return cs.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=cs.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=Xn(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 xe(l):l):typeof s.response=="string"&&(s.response=[new xe(s.response)]);return n[r.sessionId]=qVt(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??=cs.forSession(t.sessionId);let n=await this.acquireOrLoadSession(o,"panel",ve.None);n?.object.editingSession&&(await Qj(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(async e=>{let t=e.title||d(7593,null);return{sessionResource:e.sessionResource,title:t,lastMessageDate:e.lastMessageDate,timing:e.timing,isActive:!0,stats:await HTe(e),lastResponseState:e.lastRequest?.response?.state??0}}))}async getHistorySessionItems(){let e=await this._chatSessionStore.getIndex();return Object.values(e).filter(t=>!t.isExternal).filter(t=>!this._sessionModels.has(cs.forSession(t.sessionId))&&t.initialLocation==="panel"&&!t.isEmpty).map(t=>{let o=cs.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&&!!cs.parseLocalSessionId(e.sessionResource)&&e.initialLocation==="panel"}async removeHistoryEntry(e){await this._chatSessionStore.deleteSession(this.toLocalSessionId(e)),this._onDidDisposeSession.fire({sessionResource:[e],reason:"cleared"})}async clearAllHistoryEntries(){await this._chatSessionStore.clearAllSessions()}startNewLocalSession(e,t){this.trace("startNewLocalSession");let o=cs.forSession(_t());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(Eb,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 Zs("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 Zs("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(Xe(this.transferredSessionResource,e))this._transferredSessionResource=void 0,o=await this._chatSessionStore.readTransferredSession(e);else{let r=cs.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(cs.parseLocalSessionId(e))return this._sessionModels.get(e)?.title??this._chatSessionStore.getMetadataForSessionSync(e)?.title}loadSessionFromData(e){let t=e.sessionId??_t(),o=cs.forSession(t);return this._sessionModels.acquireOrCreate({initialData:{value:e,serializer:new Vte},location:e.initialLocation??"panel",sessionResource:o,canUseTools:!0})}async acquireOrLoadSession(e,t,o){return e.scheme===Y.vscodeLocalChatSession?this.acquireOrRestoreLocalSession(e):this.loadRemoteSession(e,t,o)}async loadRemoteSession(e,t,o){await this.chatSessionService.canResolveChatSession(e.scheme);{let p=this.acquireExistingSession(e);if(p)return p}let n=await this.chatSessionService.getOrCreateChatSession(e,o);{let p=this.acquireExistingSession(e);if(p)return n.dispose(),p}let r=e.scheme,s=this._sessionModels.acquireOrCreate({initialData:void 0,location:t,sessionResource:e,canUseTools:!1,transferEditingSession:n.transferredState?.editingSession,inputState:n.transferredState?.inputState});s.object.setContributedChatSession({chatSessionResource:e,chatSessionType:r,isUntitled:e.path.startsWith("/untitled-")}),n.title&&s.object.setCustomTitle(n.title);let l=s.object,c=new P;c.add(s.object.onDidDispose(()=>{c.dispose(),n.dispose()}));let u;for(let p of n.history)if(p.type==="request"){u&&u.response?.complete();let h=p.prompt,g={text:h,parts:[new pb(new di(0,h.length),{startLineNumber:1,startColumn:1,endLineNumber:1,endColumn:h.length+1},h)]},f=p.participant?this.chatAgentService.getAgent(p.participant):this.chatAgentService.getAgent(r);u=l.addRequest(g,p.variableData??{variables:[]},0,void 0,f,void 0,void 0,void 0,void 0,!1,p.modelId,void 0,p.id)}else if(u)for(let h of p.parts)l.acceptResponseProgress(u,h);if(n.isCompleteObs?.get()&&u?.response?.complete(),n.progressObs&&u&&n.interruptActiveResponseCallback){let p=this.instantiationService.createInstance(khe,new $e,void 0);this._pendingRequests.set(l.sessionResource,p),this.telemetryService.publicLog2(fz,{action:"add",source:"remoteSession"});let h=c.add(new me),g=v=>v.onCancellationRequested(()=>{n.interruptActiveResponseCallback?.().then(b=>{if(!b){let S=this.instantiationService.createInstance(khe,new $e,void 0);this._pendingRequests.set(l.sessionResource,S),this.telemetryService.publicLog2(fz,{action:"add",source:"remoteSession"}),h.value=g(S.cancellationTokenSource.token)}})});h.value=g(p.cancellationTokenSource.token);let f=0;c.add(he(v=>{let b=n.progressObs?.read(v)??[],S=n.isCompleteObs?.read(v)??!1;if(b.length>f){let y=b.slice(f);for(let w of y)l?.acceptResponseProgress(u,w);f=b.length}S&&(u.response?.complete(),h.clear())}))}else this.telemetryService.publicLog2(fz,{action:"notCancelable",source:"remoteSession"}),u&&l.editingSession&&(await Qj(l.editingSession),u.response?.complete());return s}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 yB({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 Go;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=this._pendingRequests.has(e);if(o?.queue){let v=this.queuePendingRequest(n,e,t,o);return o.pauseQueue||this.processPendingRequests(e),v}else if(r)return this.trace("sendRequest",`Session ${e} already has a pending request`),{kind:"rejected",reason:"Request already in progress"};let s=n.getRequests();for(let v=s.length-1;v>=0;v-=1){let b=s[v];b.shouldBeRemovedOnSend&&(b.shouldBeRemovedOnSend.afterUndoStop?b.response?.finalizeUndoState():await this.removeRequest(e,b.id))}let l=o?.location??n.initialLocation,c=o?.attempt??0,u=this.chatAgentService.getDefaultAgent(l,o?.modeInfo?.kind),p=this.parseChatRequest(e,t,l,o),h=o?.agentIdSilent?this.chatAgentService.getAgent(o.agentIdSilent):void 0,g=h??p.parts.find(v=>v instanceof zu)?.agent??u,f=p.parts.find(v=>v instanceof Pf);return{kind:"sent",data:{...this._sendRequestAsync(n,e,p,c,!o?.noCommandDetection,h??u,l,o),agent:g,slashCommand:f?.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?` ${yu}${n.slashCommand}`:"";t=`${vg}${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(AE).parseChatRequest(e,t,o,r)}refreshFollowupsCancellationToken(e){this._sessionFollowupCancelTokens.get(e)?.cancel();let t=new $e;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(pe=>pe instanceof zu),g=o.parts.find(pe=>pe instanceof Pf),f=o.parts.find(pe=>pe instanceof jx),v=[...e.getRequests()],b=this.instantiationService.createInstance(uOe,{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 Go,k=!1;function T(){!k&&p?.response&&(w.complete(p.response),k=!0)}let N=new P,O=N.add(new $e),V=O.token,U=async()=>{let pe=Ve=>{if(!V.isCancellationRequested){S=!0;for(let Fe=0;Fe<Ve.length;Fe++){let Qt=Fe===Ve.length-1,Ze=Ve[Fe];Ze.kind==="markdownContent"?this.trace("sendRequest",`Provider returned progress for session ${e.sessionResource}, ${Ze.content.value.length} chars`):this.trace("sendRequest",`Provider returned progress: ${JSON.stringify(Ze)}`),p&&e.acceptResponseProgress(p,Ze,!Qt)}T()}},de,se,Se,ke=!1;try{let Ve=await this.promptsService.getHooks(V,e.sessionResource);Ve&&(Se=Ve.hooks,ke=Ve.hasDisabledClaudeHooks)}catch(Ve){this.logService.warn("[ChatService] Failed to collect hooks:",Ve)}let Ee=c?.modeInfo?.modeInstructions?.name;if(Ee)try{let Fe=(await this.promptsService.getCustomAgents(V,e.sessionResource)).find(Qt=>Qt.name===Ee);Fe?.hooks&&(Se=xDt(Se,Fe.hooks))}catch(Ve){this.logService.warn("[ChatService] Failed to collect agent hooks:",Ve)}let He=new En(!1);N.add(V.onCancellationRequested(()=>{this.trace("sendRequest",`Request for session ${e.sessionResource} was cancelled`),p&&(b.complete({timeToFirstProgress:void 0,result:"cancelled",totalTime:He.elapsed(),requestType:y,detectedAgent:de,request:p}),e.cancelRequest(p))}));try{let Ve,Fe;if(h||s&&!f){let Qt=(ln,en,Ws,ba,Id)=>{let Dg={variables:[]};p=ba??e.addRequest(o,Dg,n,c?.modeInfo,ln,en,c?.confirmation,c?.locationData,c?.attachedContext,void 0,c?.userSelectedModelId,c?.userSelectedTools?.get());let yd,uu;if(ba)yd=ba.variableData,uu=kTt(p.message).message;else{yd={variables:this.prepareContext(p.attachedContext)},e.updateRequest(p,yd),c?.resolvedVariables?.length&&(yd={variables:[...yd.variables,...c.resolvedVariables]});let Rp=kTt(p.message);yd=oCi(yd,Rp.diff),uu=Rp.message}let Jm={sessionResource:e.sessionResource,requestId:p.id,agentId:ln.id,message:uu,command:en?.name,variables:yd,enableCommandDetection:Ws,isParticipantDetected:Id,attempt:n,location:l,locationData:p.locationData,acceptedConfirmationData:c?.acceptedConfirmationData,rejectedConfirmationData:c?.rejectedConfirmationData,userSelectedModelId:c?.userSelectedModelId,userSelectedTools:c?.userSelectedTools?.get(),modeInstructions:c?.modeInfo?.modeInstructions,permissionLevel:c?.modeInfo?.permissionLevel,editedFileEvents:p.editedFileEvents,hooks:Se,hasHooksEnabled:!!Se&&Object.values(Se).some(Rp=>Rp.length>0)},Dh=!0;return N.add(he(Rp=>{let Uv=c?.userSelectedTools?.read(Rp);if(Dh){Dh=!1;return}Uv&&p&&(this.chatAgentService.setRequestTools(ln.id,p.id,Uv),Jm.userSelectedTools=Uv)})),Jm};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 ln=this.getHistoryEntriesFromModel(v,l,s.id),en=Qt(s,void 0,r,void 0,!1),Ws=await this.chatAgentService.detectAgentOrCommand(en,ln,{location:l},V);Ws&&this.chatAgentService.getAgent(Ws.agent.id)?.locations?.includes(l)&&(p?.response?.setAgent(Ws.agent,Ws.command),de=Ws.agent,se=Ws.command)}let Ze=de??h?.agent??s,Ti=se??g?.command;await this.extensionService.activateByEvent(`onChatParticipant:${Ze.id}`);let ti=this.getHistoryEntriesFromModel(v,l,Ze.id),bo=Qt(Ze,Ti,r,p,!!de);this.generateInitialChatTitleIfNeeded(e,bo,s,V);let Ro=this._pendingRequests.get(t);Ro&&(N.add(he(ln=>{let en=Ro.yieldRequested.read(ln);p&&this.chatAgentService.setYieldRequested(Ze.id,p.id,en)})),Ro.requestId??=bo.requestId),T();let _o="chat.disabledClaudeHooks.notification";if(this.storageService.getBoolean(_o,1)||(this.storageService.store(_o,!0,1,0),ke&&pe([{kind:"disabledClaudeHooks"}])),e.canUseTools){let ln=new LTt(this.mcpService.autostart(V));ln.isEmpty||(pe([ln]),await ln.wait())}let sr=await this.chatAgentService.invokeAgent(Ze.id,bo,pe,ti,V);Ve=sr,Fe=this.chatAgentService.getFollowups(Ze.id,bo,sr,ti,u)}else if(f&&this.chatSlashCommandService.hasCommand(f.slashCommand.command)){f.slashCommand.silent!==!0&&(p=e.addRequest(o,{variables:[]},n,c?.modeInfo),T());let Qt=[];for(let ti of e.getRequests())ti.response&&(Qt.push({role:1,content:[{type:"text",value:ti.message.text}]}),Qt.push({role:2,content:[{type:"text",value:ti.response.response.toString()}]}));let Ze=o.text,Ti=await this.chatSlashCommandService.executeCommand(f.slashCommand.command,Ze.substring(f.slashCommand.command.length+1).trimStart(),new bm(ti=>{pe([ti])}),Qt,l,e.sessionResource,V,c);Fe=Promise.resolve(Ti?.followUp),Ve={}}else throw new Error("Cannot handle request");if(V.isCancellationRequested&&!Ve)return;if(p){Ve||(this.trace("sendRequest",`Provider returned no response for session ${e.sessionResource}`),Ve={errorDetails:{message:d(7592,null)}});let Qt=Ve.errorDetails?.responseIsFiltered?"filtered":Ve.errorDetails&&S?"errorWithOutput":Ve.errorDetails?"error":"success";b.complete({timeToFirstProgress:Ve.timings?.firstProgress,totalTime:Ve.timings?.totalElapsed,result:Qt,requestType:y,detectedAgent:de,request:p}),e.setResponse(p,Ve),T(),this.trace("sendRequest",`Provider returned response for session ${e.sessionResource}`),Ve.errorDetails?.isRateLimited&&this.chatEntitlementService.markAnonymousRateLimited(),G=!Ve.errorDetails&&!V.isCancellationRequested,p.response?.complete(),Fe&&Fe.then(Ze=>{e.setFollowups(p,Ze);let Ti=g?g.command.name:f?.slashCommand.command;this._chatServiceTelemetry.retrievedFollowups(h?.agent.id??"",Ti,Ze?.length??0)})}else{G=!V.isCancellationRequested;return}}catch(Ve){if(this.logService.error(`Error while handling chat request: ${In(Ve,!0)}`),p){b.complete({timeToFirstProgress:void 0,totalTime:void 0,result:"error",requestType:y,detectedAgent:de,request:p});let Fe={errorDetails:{message:Ve.message}};e.setResponse(p,Fe),T(),p.response?.complete()}}finally{N.dispose()}},G=!1,$=U(),te=this.instantiationService.createInstance(khe,O,void 0);return this._pendingRequests.set(e.sessionResource,te),this.telemetryService.publicLog2(fz,{action:"add",source:"sendRequest"}),$.finally(()=>{this._pendingRequests.get(e.sessionResource)===te&&(this._pendingRequests.deleteAndDispose(e.sessionResource),this.telemetryService.publicLog2(fz,{action:"remove",source:"sendRequestComplete"})),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)}processNextPendingRequest(e){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=In(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 zu)?.agent??u,f=p.parts.find(S=>S instanceof Pf),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=kTt(s.message),c={sessionResource:s.session.sessionResource,requestId:s.id,agentId:s.response.agent?.id??"",message:l.message,command:s.response.slashCommand?.name,variables:oCi(s.variableData,l.diff),location:"panel",editedFileEvents:s.editedFileEvents};n.push({request:c,response:ido(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(fz,{action:"remove",source:"removeRequest"})),o.removeRequest(t)}async adoptRequest(e,t){if(!(t instanceof yB))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(fz,{action:"remove",source:"adoptRequest"}),this.telemetryService.publicLog2(fz,{action:"add",source:"adoptRequest"}))}}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(AE).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 xe(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()}cancelCurrentRequestForSession(e,t){this.trace("cancelCurrentRequestForSession",`session: ${e}`);let o=this._pendingRequests.get(e);if(!o){let n=this._sessionModels.get(e),r=n?.requestInProgress.get(),s=n?.getPendingRequests().length??0,l=n?.lastRequest;this.telemetryService.publicLog2(j8e,{source:t??"chatService",reason:"noPendingRequest",requestInProgress:r===void 0?"unknown":r?"true":"false",pendingRequests:s,sessionScheme:e.scheme,lastRequestId:l?.id}),this.info("cancelCurrentRequestForSession",`No pending request was found for session ${e}. requestInProgress=${r??"unknown"}, pendingRequests=${s}`);return}o.cancel(),this._pendingRequests.deleteAndDispose(e),this.telemetryService.publicLog2(fz,{action:"remove",source:t??"cancelRequest"})}setYieldRequested(e){let t=this._pendingRequests.get(e);t&&t.setYieldRequested()}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(!cs.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 yB))throw new ni("Can only append progress to requests of type ChatRequestModel");o?.acceptResponseProgress(e,t)}toLocalSessionId(e){let t=cs.parseLocalSessionId(e);if(!t)throw new Error(`Invalid local chat session resource: ${e}`);return t}};gOe=I([m(0,le),m(1,ne),m(2,Te),m(3,lt),m(4,F),m(5,Pe),m(6,FO),m(7,br),m(8,B),m(9,hOe),m(10,Ls),m(11,es),m(12,nr),m(13,vr),m(14,Wr),m(15,em)],gOe);var Db=ae("agentPluginService");function Tgo(a,i){let e=Ye(a.uri),t=Ego(e),o=Ego(i);return o.startsWith(`${t}:`)?o:`${t}:${o}`}function Ego(a){return a.trim().toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9_.:-]/g,"-").replace(/-+/g,"-").replace(/^[-:.]+|[-:.]+$/g,"")}var xTi=class{constructor(){this._discovery=[]}register(i){this._discovery.push(i)}getAll(){return this._discovery}},oot=new xTi;function y1t(a){return Tn.registerExtensionPoint({extensionPoint:a,jsonSchema:{description:d(7642,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(7640,null):d(7639,null),type:"string"},name:{description:d(7637,null),deprecationMessage:d(7638,null),type:"string"},description:{description:d(7635,null),deprecationMessage:d(7636,null),type:"string"},when:{description:d(7641,null),type:"string"}}}}})}var ZJo=y1t("chatPromptFiles"),eZo=y1t("chatInstructions"),tZo=y1t("chatAgents"),iZo=y1t("chatSkills");function _go(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 Dgo(a,i,e){return`${a.value}/${i}/${e}`}var Ehe=class{constructor(i){this.promptsService=i;this.registrations=new jt;this.handle(ZJo,"chatPromptFiles"),this.handle(eZo,"chatInstructions"),this.handle(tZo,"chatAgents"),this.handle(iZo,"chatSkills")}static{this.ID="workbench.contrib.chatPromptFilesExtensionPointHandler"}handle(i,e){i.setHandler((t,o)=>{for(let n of o.added){let r=_go(e);for(let s of n.value){if(!s.path){n.collector.error(d(7651,null,n.description.identifier.value,e));continue}let l=je(n.description.extensionLocation,s.path);if(!La(l,n.description.extensionLocation)){n.collector.error(d(7649,null,n.description.identifier.value,e,s.path));continue}if(s.when&&!x.deserialize(s.when)){n.collector.error(d(7650,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(Dgo(n.description.identifier,r,s.path),c)}catch(c){let u=c instanceof Error?c.message:String(c);n.collector.error(d(7652,null,n.description.identifier.value,e,s.path,u))}}}for(let n of o.removed){let r=_go(e);for(let s of n.value)this.registrations.deleteAndDispose(Dgo(n.description.identifier,r,s.path))}})}};Ehe=I([m(0,nr)],Ehe);qe.registerCommand("_listExtensionPromptFiles",async a=>{let i=a.get(nr),[e,t,o,n,r]=await Promise.all([i.listPromptFiles("agent",ve.None),i.listPromptFiles("instructions",ve.None),i.listPromptFiles("prompt",ve.None),i.listPromptFiles("skill",ve.None),i.listPromptFiles("hook",ve.None)]),s=[];for(let l of[...e,...t,...o,...n,...r])l.storage==="extension"&&s.push({uri:l.uri.toJSON(),type:l.type});return s});var fOe=class extends C{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(7644,null),d(7643,null),d(7645,null)],n=t.map(r=>[r.name??"-",r.description??"-",r.path]);return{data:{headers:o,rows:n},dispose:()=>{}}}};oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:"chatPromptFiles",label:d(7647,null),access:{canToggle:!1},renderer:new Mt(fOe,["chatPromptFiles"])});oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:"chatInstructions",label:d(7646,null),access:{canToggle:!1},renderer:new Mt(fOe,["chatInstructions"])});oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:"chatAgents",label:d(7634,null),access:{canToggle:!1},renderer:new Mt(fOe,["chatAgents"])});oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:"chatSkills",label:d(7648,null),access:{canToggle:!1},renderer:new Mt(fOe,["chatSkills"])});var vOe=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}}};vOe=I([m(0,nr)],vOe);var bOe=class{constructor(i,e){this.fileService=i;this.languageModelToolsService=e;this._debugDisplayName="PromptBodyAutocompletion";this.triggerCharacters=[":",".","/","\\"]}async provideCompletionItems(i,e,t,o){let n=Mf(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(`${su}[^\\s#]*`,"g"),n=My(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"}})})}};bOe=I([m(0,be),m(1,jn)],bOe);var SOe=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=Mf(i.getLanguageId());if(!n)return;if(/^\s*$/.test(i.getValue()))return{suggestions:[{label:d(7779,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 Ie(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 Ie(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=mD(n,t),l=new Set(vCi(n,!1,s));this.configurationService.getValue(Ts.USE_CUSTOM_AGENT_HOOKS)||l.delete(Hi.hooks);for(let u of t.attributes)l.delete(u.key);let c=u=>{if(o)return u;if(u===Hi.hooks&&n==="agent"&&s!=="claude"){let h=Object.keys(Jh[s]??Jh.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:_Me(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=mD(n,t);if(!vCi(n,!0,u).includes(c.key))return;if(n==="prompt"||n==="agent"){if(c.key===Hi.model&&c.value.type==="sequence"){let f=async()=>u==="claude"?nee:this.getModelNames(n==="agent");return this.provideArrayCompletions(i,e,c.value,f)}if(c.key===Hi.tools||c.key===oet.disallowedTools){let f=c.value;if(f.type==="scalar"&&(f=xB(f)),f.type==="sequence"){let v=async()=>u==="github-copilot"||this.environmentService.isSessionsWindow?gdo:u==="claude"?nee:Array.from(this.languageModelToolsService.getFullReferenceNames()).map(b=>({name:b}));return this.provideArrayCompletions(i,e,f,v)}}}if(c.key===Hi.agents&&c.value.type==="sequence")return this.provideArrayCompletions(i,e,c.value,async()=>await this.promptsService.getCustomAgents(ve.None));if(c.key===Hi.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===Hi.handOffs){let f=["","  - label: Start Implementation","    agent: agent","    prompt: Implement the plan","    send: true"].join(`
`),v={label:d(7780,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===Hi.hooks&&n==="agent"){let f=["","  ${1|"+Object.keys(Jh[u]??Jh.undefined).join(",")+"|}:","    - type: command",'      command: "$2"'].join(`
`),v={label:d(7783,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(7781,null),documentation:d(7782,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=Jh[o]??Jh.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=CC[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=xC[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=_Me(e,i,t);if(o?.enums)return o.enums;if(o?.defaults)return o.defaults.map(n=>({name:n}));switch(e){case Hi.agent:case Hi.mode:if(i==="prompt"){let n=this.chatModeService.getModes(),r=[];for(let s of ht.concat(n.builtin,n.custom))r.push({name:s.name.get(),description:s.label.get()});return r}break;case Hi.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||R_.suitableForAgentMode(o))&&e.push({name:R_.asQualifiedName(o),description:o.tooltip})}return e}async provideArrayCompletions(i,e,t,o){let n=async(s,l)=>{let c=[],u=await o(),p=Dpo(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=OHt(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))}};SOe=I([m(0,nr),m(1,Wr),m(2,jn),m(3,Pv),m(4,Vt),m(5,B)],SOe);var IOe=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 xe(i)],range:e}}async provideHover(i,e,t,o){let n=Mf(i.getLanguageId());if(!n)return;let r=this.promptsService.getParsedPromptFile(i),s=mD(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=_Me(n.key,e,o)?.description;if(r)switch(n.key){case Hi.model:return this.getModelHover(n,i,r,o);case Hi.tools:case oet.disallowedTools:return this.getToolHover(n,i,r,o);case Hi.agent:case Hi.mode:return this.getAgentHover(n,i,r);case Hi.handOffs:return this.getHandsOffHover(n,i,o);case Hi.hooks:return this.configurationService.getValue(Ts.USE_CUSTOM_AGENT_HOOKS)?this.getHooksHover(n,i,r,o):void 0;case Hi.infer:return this.createHover(r+`

`+d(7790,null),n.range);default:return this.createHover(r,n.range)}}}getToolHover(i,e,t,o){let n=i.value;if(n.type==="scalar"&&(n=xB(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=nee.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 Km(o)?this.getToolsetHover(o,e):this.createHover(o.userDescription??o.modelDescription,e)}getToolsetHover(i,e){let t=[];t.push(d(7795,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(7789,null),i.range);let n=r=>{let s=[];if(s.push(t+`
`),o==="claude"){let c=lBt.find(u=>u.name===r);if(!c)return this.createHover(s.join(`
`),i.range);if(c.modelEquivalent)s.push(d(7784,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(7786,null,c.name)),s.push(d(7785,null,c.family)),s.push(d(7787,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()||(dBt(r)?d(7792,null):d(7794,null));o.push(`\`${r.name.get()}\`: ${s}`)}}else{let r=this.chatModeService.getModes();o.push(t),o.push(""),o.push(d(7791,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(7793,null));for(let s of r.custom){let l=s.description.get();o.push(`- \`${s.name.get()}\`: ${l||d(7794,null)}`)}}}return this.createHover(o.join(`
`),i.range)}getHooksHover(i,e,t,o){let n=i.value;if(n.type==="map"){let r=Jh[o]??Jh.undefined;for(let s of n.properties){if(s.key.range.containsPosition(e)){let l=r[s.key.value];if(l){let c=CC[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=xC[n.key.value];if(r)return this.createHover(r,n.key.range)}}}getHandsOffHover(i,e,t){let o=_Me(Hi.handOffs,"agent",t)?.description;return ree(t)?this.createHover(o,i.range):this.createHover(o+`

`+d(7788,null),i.range)}};IOe=I([m(0,nr),m(1,jn),m(2,Wr),m(3,Pv),m(4,B)],IOe);var yOe=class{constructor(i,e){this.promptsService=i;this.chatModeService=e;this._debugDisplayName="PromptHeaderDefinitionProvider"}async provideDefinition(i,e,t){if(!Mf(i.getLanguageId()))return;let r=this.promptsService.getParsedPromptFile(i).header;if(!r)return;let s=r.getAttribute(Hi.agent)??r.getAttribute(Hi.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)}}}};yOe=I([m(0,nr),m(1,Pv)],yOe);var x1t="prompts-diagnostics-provider",not=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(Dn(n.message,n.range,8)));let o=aZo(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.validateSkillFolderName(i,e,t)}async validateFileName(i,e,t){if(e==="agent"&&i.uri.path.endsWith(o2)){let o=this.promptsService.getAgentFileURIFromModeFile(i.uri);o&&await this.fileService.canCreateFile(o)?t(Dn(d(7886,null,o.toString()),new z(1,1,1,4),4)):t(Dn(d(7887,null,n2),new z(1,1,1,4),4))}}async validateSkillFolderName(i,e,t){if(e!=="skill")return;let o=i.header?.attributes.find(l=>l.key===Hi.name);if(!o||o.value.type!=="scalar")return;let n=o.value.value.trim();if(!n)return;let r=i.uri.path.split("/"),s=r.findIndex(l=>l==="SKILL.md");if(s>0){let l=r[s-1];l&&n!==l&&t(Dn(d(7944,null,n,l),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(Dn(d(7924,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(Dn(d(7901,null,r.content,l),r.range,4))})())}if(o.variableReferences.length&&Mgo(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(Dn(d(7894,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(Dn(d(7890,null,u.name,h),u.range,2))}else{let h=Array.from(p).sort((g,f)=>g.localeCompare(f)).join(", ");t(Dn(d(7891,null,u.name,h),u.range,2))}}else t(Dn(d(7965,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.validateUserInvokable(r,o),this.validateDisableModelInvocation(r,o),this.validateTools(r,"agent",t,o),this.configurationService.getValue(Ts.USE_CUSTOM_AGENT_HOOKS)&&this.validateHooks(r,t,o),Mgo(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.validateUserInvokable(r,o),this.validateDisableModelInvocation(r,o);break}}checkForInvalidArguments(i,e,t,o){let n=kTi(e,!0,t);this.configurationService.getValue(Ts.USE_CUSTOM_AGENT_HOOKS)||(n=n.filter(l=>l!==Hi.hooks));let r=this.configurationService.getValue(Ts.USE_CUSTOM_AGENT_HOOKS),s=new co(()=>new Set(kTi(e,!1,"github-copilot")));for(let l of i)if(!n.includes(l.key)){let c=new co(()=>{let u=kTi(e,!1,t);return r||(u=u.filter(p=>p!==Hi.hooks)),u.sort().join(", ")});switch(e){case"prompt":o(Dn(d(7955,null,l.key,c.value),l.range,4));break;case"agent":t==="github-copilot"?o(Dn(d(7953,null,l.key,c.value),l.range,4)):t==="claude"||(s.value.has(l.key)?o(Dn(d(7922,null,l.key),l.range,2)):o(Dn(d(7958,null,l.key,c.value),l.range,4)));break;case"instructions":t==="claude"?o(Dn(d(7956,null,l.key,c.value),l.range,4)):o(Dn(d(7954,null,l.key,c.value),l.range,4));break;case"skill":o(Dn(d(7957,null,l.key,c.value),l.range,4));break}}}validateName(i,e){let t=i.find(o=>o.key===Hi.name);if(t){if(t.value.type!=="scalar"){e(Dn(d(7936,null),t.range,8));return}if(t.value.value.trim().length===0){e(Dn(d(7937,null),t.value.range,8));return}}}validateDescription(i,e){let t=i.find(o=>o.key===Hi.description);if(t){if(t.value.type!=="scalar"){e(Dn(d(7892,null),t.range,8));return}if(t.value.value.trim().length===0){e(Dn(d(7893,null),t.value.range,8));return}}}validateArgumentHint(i,e){let t=i.find(o=>o.key===Hi.argumentHint);if(t){if(t.value.type!=="scalar"){e(Dn(d(7882,null),t.range,8));return}if(t.value.value.trim().length===0){e(Dn(d(7883,null),t.value.range,8));return}}}validateModel(i,e,t){let o=i.find(s=>s.key===Hi.model);if(!o)return;if(o.value.type!=="scalar"&&o.value.type!=="sequence"){t(Dn(d(7933,null),o.value.range,8));return}let n=[];if(o.value.type==="scalar"){let s=o.value.value.trim();if(s.length===0){t(Dn(d(7932,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(Dn(d(7931,null),o.value.range,8));return}for(let s of o.value.items){if(s.type!=="scalar"){t(Dn(d(7930,null),s.range,8));return}let l=s.value.trim();if(l.length===0){t(Dn(d(7929,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"&&!R_.suitableForAgentMode(c)&&t(Dn(d(7935,null,s),l,4)):t(Dn(d(7934,null,s),l,4))}}validateClaudeAttributes(i,e){for(let t in ETi){let n=ETi[t].enums;if(n){let r=i.find(s=>s.key===t);if(!r)continue;if(r.value.type!=="scalar"){e(Dn(d(7888,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(Dn(d(7889,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===Hi.agent),o=i.find(s=>s.key===Hi.mode);o&&e(t?Dn(d(7927,null),o.range,4):Dn(d(7928,null),o.range,8));let n=i.find(s=>s.key===Hi.agent)??o;if(!n)return;if(n.value.type!=="scalar"){e(Dn(d(7885,null,n.key),n.value.range,8));return}if(n.value.value.trim().length===0){e(Dn(d(7884,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 ht.concat(t.builtin,t.custom)){if(r.name.get()===i.value)return r;o.push(r.name.get())}let n=d(7877,null,i.value,o.join(", "));e(Dn(n,i.range,4))}validateTools(i,e,t,o){let n=i.find(s=>s.key===Hi.tools);if(!n)return;e!=="agent"&&o(Dn(d(7952,null),n.range,4));let r=n.value;if(r.type==="scalar"&&(r=xB(r)),r.type!=="sequence"){o(Dn(d(7951,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(Dn(d(7899,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(Dn(d(7948,null,n.value,s),n.range,2))}else{let s=Array.from(r).sort((l,c)=>l.localeCompare(c)).join(", ");e(Dn(d(7949,null,n.value,s),n.range,2))}else e(Dn(d(7950,null,n.value),n.range,4))}}}validateApplyTo(i,e){let t=i.find(n=>n.key===Hi.applyTo);if(!t)return;if(t.value.type!=="scalar"){e(Dn(d(7880,null),t.value.range,8));return}let o=t.value.value;try{let n=HL(o,",");if(n.length===0){e(Dn(d(7881,null),t.value.range,8));return}for(let r of n){let s=zm(r);if(Vli(s)){e(Dn(d(7881,null),t.value.range,8));return}}}catch{e(Dn(d(7881,null),t.value.range,8))}}validatePaths(i,e){let t=i.find(o=>o.key===Hi.paths);if(t){if(t.value.type!=="sequence"){e(Dn(d(7941,null),t.value.range,8));return}for(let o of t.value.items){if(o.type!=="scalar"){e(Dn(d(7898,null),o.range,8));continue}let n=o.value.trim();if(n.length===0){e(Dn(d(7939,null),o.range,8));continue}try{let r=zm(n);Vli(r)&&e(Dn(d(7940,null,n),o.range,8))}catch{e(Dn(d(7940,null,n),o.range,8))}}}}validateExcludeAgent(i,e){let t=i.find(o=>o.key===Hi.excludeAgent);if(t&&t.value.type!=="sequence"&&t.value.type!=="scalar"){e(Dn(d(7900,null),t.value.range,8));return}}validateHooks(i,e,t){let o=i.find(r=>r.key===Hi.hooks);if(!o)return;if(o.value.type!=="map"){t(Dn(d(7918,null),o.value.range,8));return}let n=new Set(Object.keys(Jh[e]??Jh.undefined));for(let r of o.value.properties){if(n.has(r.key.value)||t(Dn(d(7962,null,r.key.value,Array.from(n).join(", ")),r.key.range,4)),r.value.type!=="sequence"){t(Dn(d(7921,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(Dn(d(7911,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(Dn(d(7963,null,u.key.value),u.key.range,4));if(o.value.type!=="sequence"){t(Dn(d(7938,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(Dn(d(7961,null,p),u.key.range,4)),p==="type")l=!0,(u.value.type!=="scalar"||u.value.value!=="command")&&t(Dn(d(7920,null),u.value.range,8));else if(r.has(p))c=!0,(u.value.type!=="scalar"||u.value.value.trim().length===0)&&t(Dn(d(7910,null,p),u.value.range,8));else if(p==="cwd")u.value.type!=="scalar"&&t(Dn(d(7912,null),u.value.range,8));else if(p==="env")if(u.value.type!=="map")t(Dn(d(7913,null),u.value.range,8));else for(let h of u.value.properties)h.value.type!=="scalar"&&t(Dn(d(7914,null,h.key.value),h.value.range,8));else(p==="timeout"||p==="timeoutSec")&&(u.value.type!=="scalar"||isNaN(Number(u.value.value)))&&t(Dn(d(7919,null,p),u.value.range,8))}l||t(Dn(d(7917,null),i.range,8)),c||t(n?Dn(d(7916,null),i.range,8):Dn(d(7915,null),i.range,8))}validateHandoffs(i,e){let t=i.find(o=>o.key===Hi.handOffs);if(t){if(t.value.type!=="sequence"){e(Dn(d(7909,null),t.value.range,8));return}for(let o of t.value.items){if(o.type!=="map"){e(Dn(d(7897,null),o.range,8));continue}let n=new Set(["label","agent","prompt"]);for(let r of o.properties){switch(r.key.value){case"label":(r.value.type!=="scalar"||r.value.value.trim().length===0)&&e(Dn(d(7904,null),r.value.range,8));break;case"agent":r.value.type!=="scalar"||r.value.value.trim().length===0?e(Dn(d(7903,null),r.value.range,8)):this.validateAgentValue(r.value,e);break;case"prompt":r.value.type!=="scalar"&&e(Dn(d(7906,null),r.value.range,8));break;case"send":w1t(r.value)||e(Dn(d(7907,null),r.value.range,8));break;case"showContinueOn":w1t(r.value)||e(Dn(d(7908,null),r.value.range,8));break;case"model":r.value.type!=="scalar"&&e(Dn(d(7905,null),r.value.range,8));break;default:e(Dn(d(7960,null,r.key.value),r.value.range,4))}n.delete(r.key.value)}n.size>0&&e(Dn(d(7926,null,Array.from(n).map(r=>`'${r}'`).join(", ")),o.range,8))}}}validateInfer(i,e){let t=i.find(o=>o.key===Hi.infer);t&&e(Dn(d(7923,null),t.value.range,8))}validateTarget(i,e){let t=i.find(r=>r.key===Hi.target);if(!t)return;if(t.value.type!=="scalar"){e(Dn(d(7947,null),t.value.range,8));return}let o=t.value.value.trim();if(o.length===0){e(Dn(d(7946,null),t.value.range,8));return}let n=["github-copilot","vscode"];n.includes(o)||e(Dn(d(7945,null,n.join(", ")),t.value.range,8))}validateUserInvocable(i,e){let t=i.find(o=>o.key===Hi.userInvocable);if(t&&!w1t(t.value)){e(Dn(d(7966,null),t.value.range,8));return}}validateUserInvokable(i,e){let t=i.find(o=>o.key===Hi.userInvokable);t&&e(Dn(d(7967,null),t.range,4))}validateDisableModelInvocation(i,e){let t=i.find(o=>o.key===Hi.disableModelInvocation);if(t&&!w1t(t.value)){e(Dn(d(7895,null),t.value.range,8));return}}async validateAgentsAttribute(i,e,t){let o=i.find(l=>l.key===Hi.agents);if(!o)return;if(o.value.type!=="sequence"){t(Dn(d(7878,null),o.value.range,8));return}let n=await this.promptsService.getCustomAgents(ve.None),r=new Set(n.map(l=>l.name));r.add(Pl.Agent.name.get());let s=[];for(let l of o.value.items)l.type!=="scalar"?t(Dn(d(7896,null),l.range,8)):l.value&&(s.push(l.value),l.value!=="*"&&!r.has(l.value)&&t(Dn(d(7876,null,l.value,Array.from(r).join(", ")),l.range,4)));if(s.length>0){let l=e.tools;l&&!l.includes(jp.agent)&&t(Dn(d(7879,null),o.value.range,4))}}validateGithubPermissions(i,e){let t=i.find(o=>o.key===Z4.github);if(t){if(t.value.type!=="map"){e(Dn(d(7902,null),t.value.range,8));return}for(let o of t.value.properties){if(o.key.value!=="permissions"){e(Dn(d(7959,null,o.key.value),o.key.range,4));continue}if(o.value.type!=="map"){e(Dn(d(7942,null),o.value.range,8));continue}for(let n of o.value.properties){let r=n.key.value,s=Lgo[r];if(!s){let c=Object.keys(Lgo).sort().join(", ");e(Dn(d(7964,null,r,c),n.key.range,4));continue}if(n.value.type!=="scalar"){e(Dn(d(7943,null,r),n.value.range,8));continue}let l=n.value.value;s.allowedValues.includes(l)||e(Dn(d(7925,null,l,r,s.allowedValues.join(", ")),n.value.range,8))}}}}};not=I([m(0,Wr),m(1,jn),m(2,Pv),m(3,be),m(4,ot),m(5,nr),m(6,B)],not);var Lgo={actions:{allowedValues:["read","write","none"],description:d(7840,null)},checks:{allowedValues:["read","none"],description:d(7841,null)},contents:{allowedValues:["read","write","none"],description:d(7842,null)},discussions:{allowedValues:["read","write","none"],description:d(7843,null)},issues:{allowedValues:["read","write","none"],description:d(7844,null)},metadata:{allowedValues:["read"],description:d(7845,null)},"pull-requests":{allowedValues:["read","write","none"],description:d(7846,null)},"security-events":{allowedValues:["read","none"],description:d(7847,null)},workflows:{allowedValues:["write","none"],description:d(7848,null)}};function w1t(a){return a.type==="scalar"?(a.value==="true"||a.value==="false")&&a.format==="none":!1}var rot={prompt:[Hi.name,Hi.description,Hi.model,Hi.tools,Hi.mode,Hi.agent,Hi.argumentHint],instructions:[Hi.name,Hi.description,Hi.applyTo,Hi.excludeAgent],agent:[Hi.name,Hi.description,Hi.model,Hi.tools,Hi.advancedOptions,Hi.handOffs,Hi.argumentHint,Hi.target,Hi.infer,Hi.agents,Hi.hooks,Hi.userInvocable,Hi.userInvokable,Hi.disableModelInvocation,Z4.github],skill:[Hi.name,Hi.description,Hi.license,Hi.compatibility,Hi.metadata,Hi.argumentHint,Hi.userInvocable,Hi.userInvokable,Hi.disableModelInvocation],hook:[]},oZo=[Hi.name,Hi.description,Hi.tools,Hi.target,Z4.mcpServers,Z4.github,Hi.infer],nZo={prompt:rot.prompt.filter(a=>!C1t(a)),instructions:rot.instructions.filter(a=>!C1t(a)),agent:rot.agent.filter(a=>!C1t(a)),skill:rot.skill.filter(a=>!C1t(a)),hook:[]};function kTi(a,i,e){return e==="claude"?a==="instructions"?Object.keys(sZo):Object.keys(ETi):e==="github-copilot"&&a==="agent"?oZo:i?rot[a]:nZo[a]}function C1t(a){return a===Hi.advancedOptions||a===Hi.excludeAgent||a===Hi.mode||a===Hi.infer||a===Hi.userInvokable}var gRm=[{name:jp.execute,description:d(7837,null)},{name:jp.read,description:d(7838,null)},{name:jp.edit,description:d(7836,null)},{name:jp.search,description:d(7839,null)},{name:jp.agent,description:d(7835,null)}],Rgo=[{name:"Bash",description:d(7809,null),toolEquivalent:[jp.execute]},{name:"Edit",description:d(7810,null),toolEquivalent:["edit/editNotebook","edit/editFiles"]},{name:"Glob",description:d(7811,null),toolEquivalent:["search/fileSearch"]},{name:"Grep",description:d(7812,null),toolEquivalent:["search/textSearch"]},{name:"Read",description:d(7828,null),toolEquivalent:["read/readFile","read/getNotebookSummary"]},{name:"Write",description:d(7834,null),toolEquivalent:["edit/createDirectory","edit/createFile","edit/createJupyterNotebook"]},{name:"WebFetch",description:d(7832,null),toolEquivalent:[jp.web]},{name:"WebSearch",description:d(7833,null),toolEquivalent:[jp.web]},{name:"Task",description:d(7831,null),toolEquivalent:[jp.agent]},{name:"Skill",description:d(7829,null),toolEquivalent:[]},{name:"LSP",description:d(7815,null),toolEquivalent:[]},{name:"NotebookEdit",description:d(7820,null),toolEquivalent:["edit/editNotebook"]},{name:"AskUserQuestion",description:d(7808,null),toolEquivalent:["vscode/askQuestions"]},{name:"MCPSearch",description:d(7816,null),toolEquivalent:[]}],rZo=[{name:"sonnet",description:d(7830,null),modelEquivalent:"Claude Sonnet 4.5 (copilot)"},{name:"opus",description:d(7821,null),modelEquivalent:"Claude Opus 4.6 (copilot)"},{name:"haiku",description:d(7813,null),modelEquivalent:"Claude Haiku 4.5 (copilot)"},{name:"inherit",description:d(7814,null),modelEquivalent:void 0}];var ETi={name:{type:"scalar",description:d(7802,null)},description:{type:"scalar",description:d(7796,null)},tools:{type:"sequence",description:d(7807,null),defaults:["Read, Edit, Bash"],items:Rgo},disallowedTools:{type:"sequence",description:d(7797,null),defaults:["Write, Edit, Bash"],items:Rgo},model:{type:"scalar",description:d(7801,null),defaults:["sonnet","opus","haiku","inherit"],enums:rZo},permissionMode:{type:"scalar",description:d(7803,null),defaults:["default","acceptEdits","dontAsk","bypassPermissions","plan"],enums:[{name:"default",description:d(7824,null)},{name:"acceptEdits",description:d(7822,null)},{name:"plan",description:d(7827,null)},{name:"delegate",description:d(7825,null)},{name:"dontAsk",description:d(7826,null)},{name:"bypassPermissions",description:d(7823,null)}]},skills:{type:"sequence",description:d(7806,null)},mcpServers:{type:"sequence",description:d(7799,null)},hooks:{type:"object",description:d(7798,null)},memory:{type:"scalar",description:d(7800,null),defaults:["user","project","local"],enums:[{name:"user",description:d(7819,null)},{name:"project",description:d(7818,null)},{name:"local",description:d(7817,null)}]}},sZo={description:{type:"scalar",description:d(7804,null)},paths:{type:"sequence",description:d(7805,null)}};function Mgo(a){return a==="vscode"||a==="undefined"}function aZo(a,i){let e=i instanceof A?i:i.uri;if(a==="agent"){if(ci(e).path.endsWith(`/${i2}`))return"claude";if(!(i instanceof A)){let o=i.target;if(o==="github-copilot"||o==="vscode")return o}return"undefined"}else if(a==="instructions"&&oee(e))return"claude";return"undefined"}function Dn(a,i,e=8){return{severity:e,message:a,...i}}var wOe=class extends C{constructor(e,t,o,n,r,s,l){super();this.modelService=e;this.markerService=o;this.promptsService=n;this.languageModelsService=r;this.languageModelToolsService=s;this.chatModeService=l;this.localDisposables=this._register(new P);this.validator=t.createInstance(not),this.updateRegistration()}updateRegistration(){this.localDisposables.clear();let e=new vt;this.localDisposables.add(Z(()=>{e.forEach(o=>o.dispose()),e.clear()})),this.modelService.getModels().forEach(o=>{let n=Mf(o.getLanguageId());n&&e.set(o.uri,new The(o,n,this.validator,this.promptsService,this.markerService))}),this.localDisposables.add(this.modelService.onModelAdded(o=>{let n=Mf(o.getLanguageId());n&&!e.has(o.uri)&&e.set(o.uri,new The(o,n,this.validator,this.promptsService,this.markerService))})),this.localDisposables.add(this.modelService.onModelRemoved(o=>{let n=e.get(o.uri);n&&(n.dispose(),e.delete(o.uri))})),this.localDisposables.add(this.modelService.onModelLanguageChanged(o=>{let{model:n}=o,r=e.get(n.uri);r&&(r.dispose(),e.delete(n.uri));let s=Mf(n.getLanguageId());s&&e.set(n.uri,new The(n,s,this.validator,this.promptsService,this.markerService))}));let t=()=>e.forEach(o=>o.validate());this.localDisposables.add(this.languageModelToolsService.onDidChangeTools(()=>t())),this.localDisposables.add(this.chatModeService.onDidChangeChatModes(()=>t())),this.localDisposables.add(this.languageModelsService.onDidChangeLanguageModels(()=>t()))}};wOe=I([m(0,Ct),m(1,F),m(2,Ns),m(3,nr),m(4,Wr),m(5,jn),m(6,Pv)],wOe);var The=class extends C{constructor(e,t,o,n,r){super();this.textModel=e;this.promptType=t;this.validator=o;this.promptsService=n;this.markerService=r;this.delayer=this._register(new jo(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.markerService.changeOne(x1t,this.textModel.uri,e)})}dispose(){this.markerService.remove(x1t,[this.textModel.uri]),super.dispose()}};The=I([m(3,nr),m(4,Ns)],The);var COe=class{constructor(i){this.promptsService=i;this._debugDisplayName="PromptDocumentSemanticTokensProvider"}provideDocumentSemanticTokens(i,e,t){let o=Mf(i.getLanguageId());if(!o)return;let n=this.promptsService.getParsedPromptFile(i);if(!n.body)return;let r=mD(o,n.header??i.uri);if(!ree(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){}};COe=I([m(0,nr)],COe);var xOe=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=Mf(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:x1t}).filter(o=>e.containsRange(o))}createCodeAction(i,e,t,o){return{title:t,edit:{edits:o},ranges:[e],diagnostics:this.getMarkers(i,e),kind:gr.QuickFix.value}}getUpdateModeCodeActions(i,e,t,o){let n=i.header?.getAttribute(Hi.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(7698,null),[k1t(e,{range:r,text:"agent"})]))}async getMigrateModeFileCodeActions(i,e){if(i.uri.path.endsWith(o2)){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(7697,null),[o]))}}}getUpdateToolsCodeActions(i,e,t,o,n){if(!i.header)return;let r=i.header.getAttribute(Hi.tools);if(!r||!r.value.range.containsRange(o))return;let s=mD(e,i.header);if(!ree(s))return;let l=r.value;if(l.type==="scalar"&&(l=xB(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(7700,null,v),[k1t(t,S)]))}else{let v=Array.from(g).sort((T,N)=>T.localeCompare(N)),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(7696,null,g.size),[k1t(t,k)]))}}}(p.length&&n.length===0||p.length>1)&&n.push(this.createCodeAction(t,l.range,d(7699,null),p.map(h=>k1t(t,h))))}};xOe=I([m(0,nr),m(1,jn),m(2,be),m(3,Ns)],xOe);function k1t(a,i){return{versionId:a.getVersionId(),resource:a.uri,textEdit:i}}var _he=class extends C{static{this.ID="chat.promptLanguageFeatures"}constructor(i,e){super(),this._register(i.linkProvider.register(hz,e.createInstance(vOe))),this._register(i.completionProvider.register(hz,e.createInstance(bOe))),this._register(i.completionProvider.register(hz,e.createInstance(SOe))),this._register(i.hoverProvider.register(hz,e.createInstance(IOe))),this._register(i.definitionProvider.register(hz,e.createInstance(yOe))),this._register(i.documentSemanticTokensProvider.register(hz,e.createInstance(COe))),this._register(i.codeActionProvider.register(hz,e.createInstance(xOe))),this._register(e.createInstance(wOe))}};_he=I([m(0,zt),m(1,F)],_he);var lZo=5,Hte=class{constructor(i,e,t,o,n,r,s,l){this.fileService=i;this.configService=e;this.workspaceService=t;this.environmentService=o;this.searchService=n;this.userDataService=r;this.logService=s;this.pathService=l}getWorkspaceFolders(){return this.workspaceService.getWorkspace().folders}getWorkspaceFolder(i){return this.workspaceService.getWorkspaceFolder(i)??void 0}onDidChangeWorkspaceFolders(){return H.map(this.workspaceService.onDidChangeWorkspaceFolders,()=>{})}async listFiles(i,e,t){if(e==="local")return await this.listFilesInLocal(i,t);if(e==="user")return await this.listFilesInUserData(i,t);throw new Error(`Unsupported prompt file storage: ${e}`)}async listFilesInUserData(i,e){let t=await this.getUserStorageFolders(i),o=new Mn;for(let{uri:n}of t){let r=await this.resolveFilesAtLocation(n,i,e);for(let s of r)TMe(s)===i&&o.add(s);if(e.isCancellationRequested)return[]}return[...o]}async getUserStorageFolders(i){let e=await this.pathService.userHome(),t=Ts.promptSourceFolders(this.configService,i),n=this.toAbsoluteLocations(i,t,e).filter(r=>r.storage==="user");if(i==="agent"||i==="instructions"||i==="prompt"){let r=this.userDataService.currentProfile.promptsHome;return[...n,{uri:r,source:"copilot-personal",storage:"user",displayPath:d(7986,null),isDefault:!0}]}return n}getSourceFoldersSync(i,e){let t=[],o=this.getWorkspaceFolders(),n=lme(i),r=(s,l)=>s==="hook"&&l.path.toLowerCase().endsWith(".json")?ci(l):l;for(let s of n){let l;if(s.storage==="local")for(let c of o)l=je(c.uri,s.path),t.push(r(i,l));else if(s.storage==="user"){let c=RHt(s.path)?s.path.substring(2):s.path;l=je(e,c),t.push(r(i,l))}}return t}createFilesUpdatedEvent(i){let e=new P,t=e.add(new E),o=this.userDataService.currentProfile.promptsHome,n=Bxi(i),r=this.getLocalParentFolders(i),s=[],l=e.add(new P),c=()=>{l.clear();for(let u of r)if(!this.getWorkspaceFolder(u.parent)){let p=u.filePattern!==void 0;l.add(this.fileService.watch(u.parent,{recursive:p,excludes:[]}))}for(let u of s)this.getWorkspaceFolder(u)||l.add(this.fileService.watch(u,{recursive:!0,excludes:[]}))};return this.pathService.userHome().then(u=>{s=[...this.getSourceFoldersSync(i,u)],c()}),e.add(this.configService.onDidChangeConfiguration(u=>{u.affectsConfiguration(n)&&(r=this.getLocalParentFolders(i),c(),t.fire())})),e.add(this.onDidChangeWorkspaceFolders()(()=>{r=this.getLocalParentFolders(i),this.pathService.userHome().then(u=>{s=[...this.getSourceFoldersSync(i,u)],c()}),t.fire()})),e.add(this.fileService.onDidFilesChange(u=>{if(u.affects(o)){t.fire();return}if(r.some(p=>u.affects(p.parent))){t.fire();return}if(s.some(p=>u.affects(p))){t.fire();return}})),e.add(this.fileService.watch(o)),{event:t.event,dispose:()=>e.dispose()}}async getHookSourceFolders(){let i=await this.pathService.userHome(),t=Ts.promptSourceFolders(this.configService,"hook").filter(r=>!r.path.startsWith(".claude/")&&!r.path.includes("/.claude/")),o=new Mn,n=this.toAbsoluteLocations("hook",t,i);for(let r of n)r.uri.path.endsWith(".json")?o.add(ci(r.uri)):o.add(r.uri);return[...o]}async getConfigBasedSourceFolders(i){let e=await this.pathService.userHome(),t=Ts.promptSourceFolders(this.configService,i),o=this.toAbsoluteLocations(i,t,e).map(r=>r.uri);if(i!=="prompt"&&i!=="instructions")return o;let n=new Mn;for(let r of o){let s=Ye(r),l=["*.md",`*${nBt(i)}`];for(let c of l)if(s===c){r=ci(r);continue}s==="*"&&(r=ci(r)),Ago(r.path)!==!0&&n.add(r)}return[...n]}async getResolvedSourceFolders(i){let e=await this.getLocalStorageFolders(i),t=await this.getUserStorageFolders(i);return this.dedupeSourceFolders([...e,...t])}async getSourceFoldersInDiscoveryOrder(i){let e=await this.getUserStorageFolders(i),t=await this.getLocalStorageFolders(i);return this.dedupeSourceFolders([...e,...t])}async getLocalStorageFolders(i){let e=await this.pathService.userHome(),t=Ts.promptSourceFolders(this.configService,i),o=lme(i),n=[...o,...t.filter(r=>!o.some(s=>s.path===r.path))];return this.toAbsoluteLocations(i,n,e,o)}dedupeSourceFolders(i){let e=new Mn,t=[];for(let o of i)e.has(o.uri)||(e.add(o.uri),t.push(o));return t}async listFilesInLocal(i,e){let t=new Mn;for(let{parent:o,filePattern:n}of this.getLocalParentFolders(i)){let r=n===void 0?await this.resolveFilesAtLocation(o,i,e):await this.searchFilesInLocation(o,n,e);for(let s of r)TMe(s)===i&&t.add(s);if(e.isCancellationRequested)return[]}return[...t]}getLocalParentFolders(i){let e=Ts.promptSourceFolders(this.configService,i);return this.toAbsoluteLocations(i,e,void 0).map(o=>cZo(o.uri))}toAbsoluteLocations(i,e,t,o){let n=[],r=new Mn,s=this.getWorkspaceFolders(),l=new Set(o?.map(u=>u.path)),c=e.filter(u=>{if(i==="instructions"||i==="prompt"){let h=u.path;return Pgo(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 uZo(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(RHt(p)){if(t){let g=je(t,p.substring(2));r.has(g)||(r.add(g),n.push({uri:g,source:u.source,storage:u.storage,displayPath:p,isDefault:h}))}continue}if(Xl(p)){let g=A.file(p),f=this.environmentService.remoteAuthority;f&&(g=g.with({scheme:Y.vscodeRemote,authority:f})),r.has(g)||(r.add(g),n.push({uri:g,source:u.source,storage:u.storage,displayPath:p,isDefault:h}))}else for(let g of s){let f=je(g.uri,p);r.has(f)||(r.add(f),n.push({uri:f,source:u.source,storage:u.storage,displayPath:p,isDefault:h}))}}catch(g){this.logService.error(`Failed to resolve prompt file location: ${p}`,g)}}return n}async resolveFilesAtLocation(i,e,t,o=0){if(e==="skill")return this.findAgentSkillsInFolder(i,t);let n=o===0&&this.getWorkspaceFolders().some(s=>Xe(s.uri,i)),r=e==="instructions"&&!n&&!Pgo(i.path)&&o<lZo;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 As&&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=>MP(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(!so(l))throw l}return[]}async findCopilotInstructionsMDsInWorkspace(i){let e=[],t=this.getWorkspaceFolders();for(let o of t){let n=je(o.uri,".github/"+ZVt);try{let r=await this.fileService.stat(n);if(r.isFile){let s=r.isSymbolicLink?await this.fileService.realpath(n):void 0;e.push({uri:n,realPath:s,type:"copilotInstructionsMd"})}}catch(r){this.logService.trace(`[PromptFilesLocator] Skipping copilot-instructions.md at ${n.toString()}: ${r}`)}}return e}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=>MP(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(!so(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 findFilesInWorkspaceRoots(i,e,t,o,n=[]){let r=this.getWorkspaceFolders();return e?this.findFilesInRoots(r.map(s=>je(s.uri,e)),i,t,o,n):this.findFilesInRoots(r.map(s=>s.uri),i,t,o,n)}async findFilesInRoots(i,e,t,o,n=[]){let r=e.toLowerCase(),s=await this.fileService.resolveAll(i.map(l=>({resource:l})));if(o.isCancellationRequested)return n;for(let l of s)if(l.success&&l.stat?.children){let c=l.stat.children.find(u=>u.isFile&&u.name.toLowerCase()===r);if(c){let u=c.isSymbolicLink?await this.fileService.realpath(c.resource):void 0;n.push({uri:c.resource,realPath:u,type:t})}}return n}getAgentFileURIFromModeFile(i){if(i.path.endsWith(o2)){let e,t=this.getWorkspaceFolder(i);return t?e=je(t.uri,n2,Tb(i)+iee):La(i,this.userDataService.currentProfile.promptsHome)&&(e=je(this.userDataService.currentProfile.promptsHome,Tb(i)+iee)),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=je(n.resource,J4),s=await this.fileService.resolve(r);s.isFile&&t.push(s.resource)}}catch{}return t}catch(t){return so(t)||this.logService.trace(`[PromptFilesLocator] Error searching for skills in ${i.toString()}: ${t}`),[]}}async findAgentSkills(i){let e=await this.pathService.userHome(),t=Ts.promptSourceFolders(this.configService,"skill"),o=this.toAbsoluteLocations("skill",t,e),n=[];for(let{uri:r,source:s,storage:l}of o){if(i.isCancellationRequested)return[];let c=await this.findAgentSkillsInFolder(r,i);n.push(...c.map(u=>({fileUri:u,source:s,storage:l})))}return n}};Hte=I([m(0,be),m(1,B),m(2,Pe),m(3,Vt),m(4,Jp),m(5,mn),m(6,ne),m(7,wn)],Hte);function Pgo(a){return a.includes("*")}function Ago(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 cZo(a){let i=a.path.split("/"),e=0;for(;e<i.length&&Ago(i[e])===!1;)e++;if(e===i.length)return{parent:a};let t=a.with({path:i.slice(0,e).join("/")});return e===i.length-1&&i[e]==="*"||i[e]===""?{parent:t}:{parent:t,filePattern:i.slice(e).join("/")}}var Dhe="^(?![A-Za-z]:[\\\\/])(?!/)(?!~(?!/))(?!.*\\\\)(?!.*[*?\\[\\]{}]).*\\S.*$",dZo=new RegExp(Dhe);function uZo(a){return dZo.test(a)}var E1t;function pZo(){if(!E1t){E1t=new Map;for(let[a,i]of Object.entries(Jh.claude))E1t.set(i,a)}return E1t}function TTi(a){return Jh.claude[a]}function _Ti(a){return pZo().get(a)}function sot(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=TTi(s)??c6e(s);if(!l)continue;let c=r[s];if(!Array.isArray(c))continue;let u=[];for(let p of c){let h=d6e(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 Ngo=Jh["github-copilot"],T1t;function mZo(){if(!T1t){T1t=new Map;for(let[a,i]of Object.entries(Ngo))T1t.set(i,a)}return T1t}function aot(a){return Ngo[a]}function DTi(a){return mZo().get(a)}function Lhe(a){let i=No(a.path).toLowerCase(),e=wc(a.path);return(i==="settings.json"||i==="settings.local.json")&&e.endsWith(".claude")?"claude":"copilot"}function _1t(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=aot(s)??c6e(s);if(!l)continue;let c=r[s];if(!Array.isArray(c))continue;let u=[];for(let p of c){let h=d6e(p,i,e);u.push(...h)}u.length>0&&t.set(l,{hooks:u,originalId:s})}return t}function r8(a,i,e,t){let o=Lhe(a),n,r=!1;if(o==="claude"){let s=sot(i,e,t);n=s.hooks,r=s.disabledAllHooks}else n=_1t(i,e,t);return{format:o,hooks:n,disabledAllHooks:r}}function Ogo(a,i,e,t){let o=Lhe(a),n;switch(o){case"claude":{if(i&&typeof i=="object"){let{disableAllHooks:r,...s}=i;n=sot(s,e,t).hooks}else n=new Map;break}default:n=_1t(i,e,t);break}return{format:o,hooks:n,disabledAllHooks:!0}}function LTi(a){let i={type:"command",command:""};return a==="claude"?{matcher:"",hooks:[i]}:i}var RTi=class extends Error{constructor(e){super("Skill file must have a name attribute");this.uri=e}},MTi=class extends Error{constructor(e){super("Skill file must have a description attribute");this.uri=e}},PTi=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}},Ute=class extends C{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 vt;this._onDidLogDiscovery=this._register(new E);this.onDidLogDiscovery=this._onDidLogDiscovery.event;this.cachedFileLocations={};this.fileLocatorEvents={};this.contributedFiles={prompt:new vt,instructions:new vt,agent:new vt,skill:new vt,hook:new vt};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 ATi(this.modelService)).onDidPromptChange;this.cachedCustomAgents=this._register(new kOe(w=>this.computeCustomAgents(w),()=>H.any(this.getFileLocatorEvent("agent"),H.filter(y,w=>w.promptType==="agent"),this._onDidContributedWhenChange.event,H.filter(this.configurationService.onDidChangeConfiguration,w=>w.affectsConfiguration(Ts.USE_CUSTOM_AGENT_HOOKS))))),this.cachedSlashCommands=this._register(new kOe(w=>this.computePromptSlashCommands(w),()=>H.any(this.getFileLocatorEvent("prompt"),this.getFileLocatorEvent("skill"),H.filter(y,w=>w.promptType==="prompt"),H.filter(y,w=>w.promptType==="skill"),this._onDidContributedWhenChange.event,this._onDidPluginPromptFilesChange.event))),this.cachedSkills=this._register(new kOe(w=>this.computeAgentSkills(w),()=>H.any(this.getFileLocatorEvent("skill"),H.filter(y,w=>w.promptType==="skill"),this._onDidContributedWhenChange.event,this._onDidPluginPromptFilesChange.event))),this.cachedHooks=this._register(new kOe(w=>this.computeHooks(w),()=>H.any(this.getFileLocatorEvent("hook"),H.filter(this.configurationService.onDidChangeConfiguration,w=>w.affectsConfiguration(Ts.USE_CHAT_HOOKS)||w.affectsConfiguration(Ts.USE_CLAUDE_HOOKS)),this._onDidPluginHooksChange.event,this.workspaceTrustService.onDidChangeTrust))),this._register(this.cachedSkills.onDidChange(()=>{})),this._register(this.cachedHooks.onDidChange(()=>{})),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(he(w=>{let k=this.agentPluginService.plugins.read(w);for(let T of k)T.hooks.read(w);this._onDidPluginHooksChange.fire()}))}watchPluginPromptFilesForType(e,t){return he(o=>{let n=this.agentPluginService.plugins.read(o),r=[];for(let s of n)for(let l of t(s,o))r.push({uri:l.uri,storage:"plugin",type:e,name:Tgo(s,l.name),pluginUri:s.uri});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(Hte)}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 tet().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,t){let o=await this.fileLocator.getSourceFoldersInDiscoveryOrder(e),n=[];for(let r of o){let s=t.filter(u=>u.uri.path.startsWith(r.uri.path+"/")).length,l=s>0,c;if(!l)try{l=(await this.fileService.stat(r.uri)).isDirectory}catch(u){u instanceof As&&u.fileOperationResult===1?l=!1:(l=!1,c=u instanceof Error?u.message:String(u))}n.push({uri:r.uri,storage:r.storage,exists:l,fileCount:s,errorMessage:c})}return n}registerPromptFileProvider(e,t,o){let n={extension:e,type:t,...o};this.promptFileProviders.push(n);let r=new P;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:"provider",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=x.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 fYi;case"instructions":return vYi;case"prompt":return bYi;case"skill":return SYi;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.onDidChange}async getPromptSlashCommands(e,t){return await this.cachedSlashCommands.get(e)}async computePromptSlashCommands(e){let t=await this.listPromptFiles("prompt",e),n=this.configurationService.getValue(Ts.USE_AGENT_SKILLS)?await this.listPromptFiles("skill",e):[],r=[...t,...n],s=await Promise.all(r.map(async u=>{try{let p=await this.parseNew(u.uri,e);return this.asChatPromptSlashCommand(p,u)}catch(p){this.logger.error(`[computePromptSlashCommands] Failed to parse prompt file for slash command: ${u.uri}`,p instanceof Error?p.message:String(p));return}})),l=[],c=new Mn;for(let u of s)u&&(l.push(u),c.add(u.promptPath.uri));for(let u of this.modelService.getModels())if(u.getLanguageId()===PE&&u.uri.scheme===Y.untitled&&!c.has(u.uri)){let p=this.getParsedPromptFile(u);l.push(this.asChatPromptSlashCommand(p,{uri:u.uri,storage:"local",type:"prompt"}))}return l}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??Tb(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}}async getPromptSlashCommandName(e,t){let n=(await this.getPromptSlashCommands(t)).find(r=>Xe(r.promptPath.uri,e));return n?n.name:Tb(e)}get onDidChangeCustomAgents(){return this.cachedCustomAgents.onDidChange}get onDidChangeInstructions(){return H.any(this.getFileLocatorEvent("instructions"),this._onDidContributedWhenChange.event,this._onDidChangeInstructions.event)}async getCustomAgents(e,t){let o=En.create(),n=await this.cachedCustomAgents.get(e);if(t){let r=o.elapsed(),s=await this.getAgentDiscoveryInfo(e),l=n.length===1?d(7977,null,n.length,r.toFixed(1)):d(7978,null,n.length,r.toFixed(1));this._onDidLogDiscovery.fire({sessionResource:t,name:d(7973,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===Y.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 pe=h.header.getAttribute(Hi.advancedOptions);if(pe&&pe.value.type==="map"){g={};for(let[de,se]of Object.entries(pe.value))se.type==="scalar"&&(g[de]=se)}}let f=[];if(h.body){let pe=h.body.offset,de=h.body.variableReferences;for(let se=de.length-1;se>=0;se--){let{name:Se,offset:ke}=de[se],Ee=new di(ke-pe,ke-pe+Se.length+1);f.push({name:Se,range:Ee})}}let v={content:h.body?.getContent()??"",toolReferences:f,metadata:g},b=h.header?.name??u.name??Tb(p),S=mD("agent",h.header??p),y=Fgo.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=fdo(k));let{description:T,tools:N,handOffs:O,argumentHint:V,agents:U}=h.header;S==="claude"&&N&&(N=vdo(N));let G,$=this.configurationService.getValue(Ts.USE_CUSTOM_AGENT_HOOKS),te=h.header.hooksRaw;if($&&te){let de=(this.workspaceService.getWorkspaceFolder(p)??s)?.uri;G=QJi(te,de,r,S)}return{uri:p,name:b,description:T,model:k,tools:N,handOffs:O,argumentHint:V,target:S,visibility:w,agents:U,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 As&&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 ho;return new tet().parse(e,n.value.toString())}registerContributedFile(e,t,o,n,r,s){let l=this.contributedFiles[e];if(l.has(t))return C.None;let c=(async()=>{if(e==="skill")try{let p=await this.validateAndSanitizeSkillFile(t,ve.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:"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=x.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(7985,null);case"extension":return d(7968,null,e.extension.displayName??e.extension.id);case"plugin":return d(7969,null);default:Hr(e,"Unknown prompt storage type")}}async listNestedAgentMDs(e){return this.configurationService.getValue(Ts.USE_AGENT_MD)?this.configurationService.getValue(Ts.USE_NESTED_AGENT_MD)?await this.fileLocator.findAgentMDsInWorkspace(e):[]:[]}async listAgentMDs(e,t){return this.configurationService.getValue(Ts.USE_AGENT_MD)?await this.fileLocator.findFilesInWorkspaceRoots(sdo,void 0,"agentsMd",e):(t?.logInfo("Agent MD files are disabled via configuration."),[])}async listClaudeMDs(e,t){if(!this.configurationService.getValue(Ts.USE_CLAUDE_MD))return t?.logInfo("Claude MD files are disabled via configuration."),[];let n=[],r=await this.pathService.userHome(),s=je(r,cCi);return await Promise.all([this.fileLocator.findFilesInWorkspaceRoots(JVt,void 0,"claudeMd",e,n),this.fileLocator.findFilesInWorkspaceRoots(ado,void 0,"claudeMd",e,n),this.fileLocator.findFilesInWorkspaceRoots(JVt,cCi,"claudeMd",e,n),this.fileLocator.findFilesInRoots([s],JVt,"claudeMd",e,n)]),n.sort((l,c)=>l.uri.toString().localeCompare(c.uri.toString()))}async listCopilotInstructionsMDs(e,t){return this.configurationService.getValue(Ts.USE_COPILOT_INSTRUCTION_FILES)?await this.fileLocator.findCopilotInstructionsMDsInWorkspace(e):(t?.logInfo("Copilot instructions files are disabled via configuration."),[])}async listAgentInstructions(e,t){let[o,n,r]=await Promise.all([this.listAgentMDs(e,t),this.listClaudeMDs(e,t),this.listCopilotInstructionsMDs(e,t)]);if(e.isCancellationRequested)return[];let s=new Mn,l=[],c=[],u=p=>(p.realPath?l.push(p):(c.push(p),s.add(p.uri)),!0);o.forEach(u),n.forEach(u),r.forEach(u);for(let p of l)s.has(p.realPath)?t?.logInfo(`Skipping symlinked agent instructions file ${p.uri} as target already included: ${p.realPath}`):(c.push(p),s.add(p.realPath));return c}getAgentFileURIFromModeFile(e){return this.fileLocator.getAgentFileURIFromModeFile(e)}getDisabledPromptFiles(e){let t=this.disabledPromptsStorageKeyPrefix+e,o=this.storageService.get(t,0,"[]"),n=new Mn;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()}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 RTi(e);if(!o.header?.description)throw this.logger.error(`[validateAndSanitizeSkillFile] Agent skill file missing description attribute: ${e}`),new MTi(e);let s=this.truncateAgentSkillName(n,e),l=ci(e),c=Ye(l);if(s!==c)throw this.logger.error(`[validateAndSanitizeSkillFile] Agent skill name "${s}" does not match folder name "${c}": ${e}`),new PTi(e,s,c);let u=this.truncateAgentSkillDescription(o.header?.description,e);return{name:s,description:u}}truncateAgentSkillName(e,t){let n=this.sanitizeAgentSkillText(e);return n!==e&&this.logger.warn(`[findAgentSkills] Agent skill name contains XML tags, removed: ${t}`),n.length>64?(this.logger.warn(`[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.warn(`[findAgentSkills] Agent skill description contains XML tags, removed: ${t}`),n.length>o?(this.logger.warn(`[findAgentSkills] Agent skill description exceeds ${o} characters, truncated: ${t}`),n.substring(0,o)):n}get onDidChangeSkills(){return this.cachedSkills.onDidChange}async findAgentSkills(e,t){if(!this.configurationService.getValue(Ts.USE_AGENT_SKILLS))return;let n=En.create(),r=await this.cachedSkills.get(e);if(t){let s=n.elapsed(),l=await this.getSkillDiscoveryInfo(e),c=r.length===1?d(7983,null,r.length,s.toFixed(1)):d(7984,null,r.length,s.toFixed(1));this._onDidLogDiscovery.fire({sessionResource:t,name:d(7976,null),details:c,discoveryInfo:l,category:"discovery"})}return r}async computeAgentSkills(e){let{files:t,skillsBySource:o}=await this.computeSkillDiscoveryInfo(e),n=[];for(let p of t)if(p.status==="loaded"&&p.name){let h=this.truncateAgentSkillDescription(p.description,p.uri);n.push({uri:p.uri,storage:p.storage,name:p.name,description:h,disableModelInvocation:p.disableModelInvocation??!1,userInvocable:p.userInvocable??!0})}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:n.length,claudePersonal:o.get("claude-personal")??0,claudeWorkspace:o.get("claude-workspace")??0,copilotPersonal:o.get("copilot-personal")??0,githubWorkspace:o.get("github-workspace")??0,agentsPersonal:o.get("agents-personal")??0,agentsWorkspace:o.get("agents-workspace")??0,configWorkspace:o.get("config-workspace")??0,configPersonal:o.get("config-personal")??0,extensionContribution:o.get("extension-contribution")??0,extensionAPI:o.get("extension-api")??0,plugin:o.get("plugin")??0,skippedDuplicateName:l,skippedMissingName:r,skippedMissingDescription:s,skippedNameMismatch:u,skippedParseFailed:c}),n}async getHooks(e,t){let o=En.create(),n=await this.cachedHooks.get(e);if(t){let r=o.elapsed(),s=n?Object.values(n.hooks).reduce((u,p)=>u+p.length,0):0,l=await this.getHookDiscoveryInfo(e),c=s===1?d(7979,null,s,r.toFixed(1)):d(7980,null,s,r.toFixed(1));this._onDidLogDiscovery.fire({sessionResource:t,name:d(7974,null),details:c,discoveryInfo:l,category:"discovery"})}return n}async getInstructionFiles(e,t){let o=En.create(),n=await this.listPromptFiles("instructions",e);if(t){let r=o.elapsed(),s=await this.getInstructionsDiscoveryInfo(e),l=n.length===1?d(7981,null,n.length,r.toFixed(1)):d(7982,null,n.length,r.toFixed(1));this._onDidLogDiscovery.fire({sessionResource:t,name:d(7975,null),details:l,discoveryInfo:s,category:"discovery"})}return n}async computeHooks(e){if(!this.configurationService.getValue(Ts.USE_CHAT_HOOKS)||!this.workspaceTrustService.isWorkspaceTrusted())return;let o=this.configurationService.getValue(Ts.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===Y.file?r.fsPath:r.path,l=!1,c=new Map,u=this.workspaceService.getWorkspace().folders[0];for(let g of n)try{let f=await this.fileService.readFile(g.uri),v=Ur(f.value.toString()),S=(this.workspaceService.getWorkspaceFolder(g.uri)??u)?.uri,{format:y,hooks:w,disabledAllHooks:k}=r8(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:N})=>N.length>0)&&(l=!0),this.logger.trace(`[PromptsService] Skipping Claude hook file (disabled via setting): ${g.uri}`);continue}for(let[T,{hooks:N}]of w)for(let O of N){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)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 getPromptDiscoveryInfo(e,t,o){o&&this._onDidLogDiscovery.fire({sessionResource:o,name:d(7972,null,e),category:"discovery"});let n=[],r;e==="skill"?r=await this.getSkillDiscoveryInfo(t):e==="agent"?r=await this.getAgentDiscoveryInfo(t):e==="prompt"?r=await this.getPromptSlashCommandDiscoveryInfo(t):e==="instructions"?r=await this.getInstructionsDiscoveryInfo(t):e==="hook"?r=await this.getHookDiscoveryInfo(t):r={type:e,files:n};let s=r.files.filter(c=>c.status==="loaded").length,l=r.files.filter(c=>c.status==="skipped").length;if(!r.sourceFolders){let c=await this._collectSourceFolderDiagnostics(e,r.files.filter(u=>u.status==="loaded"));r={...r,sourceFolders:c}}if(o){let c=d(7971,null,s,l);this._onDidLogDiscovery.fire({sessionResource:o,name:d(7970,null,e),details:c,discoveryInfo:r,category:"discovery"})}return r}async getSkillDiscoveryInfo(e){if(!this.configurationService.getValue(Ts.USE_AGENT_SKILLS)){let s=(await this.listPromptFiles("skill",e)).map(c=>({uri:c.uri,storage:c.storage,status:"skipped",skipReason:"disabled",extensionId:c.extension?.identifier?.value})),l=await this._collectSourceFolderDiagnostics("skill",[]);return{type:"skill",files:s,sourceFolders:l}}let{files:o}=await this.computeSkillDiscoveryInfo(e),n=await this._collectSourceFolderDiagnostics("skill",o.filter(r=>r.status==="loaded"));return{type:"skill",files:o,sourceFolders:n}}async computeSkillDiscoveryInfo(e){let t=[],o=new Map,n=new Set,r=new Map,s=[],l=await this.fileLocator.findAgentSkills(e),c=await this.getExtensionPromptFiles("skill",e),u=this._pluginPromptFilesByType.get("skill")??[];s.push(...l,...c.map(g=>({fileUri:g.uri,storage:g.storage,source:g.source==="contribution"?"extension-contribution":"extension-api"})),...u.map(g=>({fileUri:g.uri,storage:g.storage,source:"plugin"})));let p=g=>g.storage==="local"?0:g.storage==="user"?1:g.storage==="plugin"?2:g.source==="extension-api"?3:g.source==="extension-contribution"?4:5;s.sort((g,f)=>p(g)-p(f));let h=new Map;for(let g of c)h.set(g.uri.toString(),g.extension.identifier.value);for(let g of s){let f=g.fileUri,v=g.storage,b=g.source,S=h.get(f.toString());try{let y=await this.parseNew(f,e),w=y.header?.name;if(!w){this.logger.error(`[computeSkillDiscoveryInfo] Agent skill file missing name attribute: ${f}`),t.push({uri:f,storage:v,status:"skipped",skipReason:"missing-name",extensionId:S,source:b});continue}let k=this.truncateAgentSkillName(w,f),T=ci(f),N=Ye(T);if(k!==N){this.logger.error(`[computeSkillDiscoveryInfo] Agent skill name "${k}" does not match folder name "${N}": ${f}`),t.push({uri:f,storage:v,status:"skipped",skipReason:"name-mismatch",name:k,extensionId:S,source:b});continue}if(n.has(k)){this.logger.warn(`[computeSkillDiscoveryInfo] Skipping duplicate agent skill name: ${k} at ${f}`),t.push({uri:f,storage:v,status:"skipped",skipReason:"duplicate-name",name:k,duplicateOf:r.get(k),extensionId:S,source:b});continue}let O=y.header?.description;if(!O){this.logger.error(`[computeSkillDiscoveryInfo] Agent skill file missing description attribute: ${f}`),t.push({uri:f,storage:v,status:"skipped",skipReason:"missing-description",name:k,extensionId:S,source:b});continue}n.add(k),r.set(k,f);let V=y.header?.disableModelInvocation===!0,U=y.header?.userInvocable!==!1;t.push({uri:f,storage:v,status:"loaded",name:k,description:O,extensionId:S,source:b,disableModelInvocation:V,userInvocable:U}),o.set(b,(o.get(b)||0)+1)}catch(y){let w=y instanceof Error?y.message:String(y);this.logger.error(`[computeSkillDiscoveryInfo] Failed to validate Agent skill file: ${f}`,w),t.push({uri:f,storage:v,status:"skipped",skipReason:"parse-error",errorMessage:w,extensionId:S,source:b})}}return{files:t,skillsBySource:o}}async getAgentDiscoveryInfo(e){let t=[],o=this.getDisabledPromptFiles("agent"),n=await this.listPromptFiles("agent",e);for(let s of n){let l=s.uri,c=s.storage,u=s.extension?.identifier?.value;if(o.has(l)){t.push({uri:l,storage:c,status:"skipped",skipReason:"disabled",extensionId:u});continue}try{let h=(await this.parseNew(l,e)).header?.name??s.name??Tb(l);t.push({uri:l,storage:c,status:"loaded",name:h,extensionId:u})}catch(p){t.push({uri:l,storage:c,status:"skipped",skipReason:"parse-error",errorMessage:p instanceof Error?p.message:String(p),extensionId:u})}}let r=await this._collectSourceFolderDiagnostics("agent",t.filter(s=>s.status==="loaded"));return{type:"agent",files:t,sourceFolders:r}}async getPromptSlashCommandDiscoveryInfo(e){let t=[],o=await this.listPromptFiles("prompt",e);for(let r of o){let s=r.uri,l=r.storage,c=r.extension?.identifier?.value;try{let p=(await this.parseNew(s,e))?.header?.name??r.name??Tb(s);t.push({uri:s,storage:l,status:"loaded",name:p,extensionId:c})}catch(u){t.push({uri:s,storage:l,status:"skipped",skipReason:"parse-error",errorMessage:u instanceof Error?u.message:String(u),extensionId:c})}}let n=await this._collectSourceFolderDiagnostics("prompt",t.filter(r=>r.status==="loaded"));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,l=r.storage,c=r.extension?.identifier?.value;try{let p=(await this.parseNew(s,e))?.header?.name??r.name??Tb(s);t.push({uri:s,storage:l,status:"loaded",name:p,extensionId:c})}catch(u){t.push({uri:s,storage:l,status:"skipped",skipReason:"parse-error",errorMessage:u instanceof Error?u.message:String(u),extensionId:c})}}let n=await this._collectSourceFolderDiagnostics("instructions",t.filter(r=>r.status==="loaded"));return{type:"instructions",files:t,sourceFolders:n}}async getHookDiscoveryInfo(e){let t=[],o=await this.pathService.userHome(),n=o.scheme===Y.file?o.fsPath:o.path,r=this.configurationService.getValue(Ts.USE_CLAUDE_HOOKS),s=await this.listPromptFiles("hook",e);for(let c of s){let u=c.uri,p=c.storage,h=c.extension?.identifier?.value,g=Ye(u);if(!this.workspaceTrustService.isWorkspaceTrusted()){t.push({uri:c.uri,storage:c.storage,status:"skipped",skipReason:"workspace-untrusted",name:Ye(c.uri),extensionId:c.extension?.identifier?.value});continue}if(Lhe(u)==="claude"&&r===!1){t.push({uri:u,storage:p,status:"skipped",skipReason:"claude-hooks-disabled",name:g,extensionId:h});continue}try{let f=await this.fileService.readFile(u),v=Ur(f.value.toString());if(!v||typeof v!="object"){t.push({uri:u,storage:p,status:"skipped",skipReason:"parse-error",errorMessage:"Invalid hooks file: must be a JSON object",name:g,extensionId:h});continue}let S=(this.workspaceService.getWorkspaceFolder(u)??this.workspaceService.getWorkspace().folders[0])?.uri,{disabledAllHooks:y}=r8(u,v,S,n);if(y){t.push({uri:u,storage:p,status:"skipped",skipReason:"all-hooks-disabled",name:g,extensionId:h});continue}t.push({uri:u,storage:p,status:"loaded",name:g,extensionId:h})}catch(f){t.push({uri:u,storage:p,status:"skipped",skipReason:"parse-error",errorMessage:f instanceof Error?f.message:String(f),name:g,extensionId:h})}}let l=await this._collectSourceFolderDiagnostics("hook",t.filter(c=>c.status==="loaded"));return{type:"hook",files:t,sourceFolders:l}}};Ute=I([m(0,ne),m(1,ot),m(2,Ct),m(3,F),m(4,mn),m(5,B),m(6,be),m(7,lr),m(8,le),m(9,lt),m(10,Te),m(11,Pe),m(12,wn),m(13,X),m(14,Db),m(15,ns)],Ute);var kOe=class extends C{constructor(e,t,o=0){super();this.computeFn=e;this.getEvent=t;this.delay=o;this.cachedPromise=void 0;this.onDidUpdatePromiseEmitter=void 0}get onDidChange(){if(!this.onDidUpdatePromiseEmitter){let e=this.onDidUpdatePromiseEmitter=this._register(new E),t=this._register(new jo(this.delay));this._register(this.getEvent()(()=>{this.cachedPromise=void 0,t.trigger(()=>e.fire())}))}return this.onDidUpdatePromiseEmitter.event}get(e){if(this.cachedPromise!==void 0)return this.cachedPromise;let t=this.computeFn(e);return this.onDidUpdatePromiseEmitter&&(this.cachedPromise=t,this.onDidUpdatePromiseEmitter.fire()),t}refresh(){this.cachedPromise=void 0,this.onDidUpdatePromiseEmitter?.fire()}},ATi=class extends C{constructor(e){super();this.listeners=new vt;this.onDidPromptModelChange=this._register(new E);let t=n=>{let r=Mf(n.getLanguageId());r!==void 0&&this.listeners.set(n.uri,n.onDidChangeContent(()=>this.onDidPromptModelChange.fire({uri:n.uri,promptType:r})))},o=(n,r)=>{let s=Mf(n);s!==void 0&&(this.listeners.get(r)?.dispose(),this.listeners.delete(r),this.onDidPromptModelChange.fire({uri:r,promptType:s}))};this._register(e.onModelAdded(n=>t(n))),this._register(e.onModelLanguageChanged(n=>{o(n.oldLanguageId,n.model.uri),t(n.model)})),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()}},Fgo;(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})(Fgo||={});var Wgo="The user is not available to respond and will review your work later. Work autonomously and make good decisions.",Vgo="vscode_askQuestions",Bgo={header:50,question:200},Hgo={header:75,question:300};function Ugo(a,i){if(a!==void 0)return a.length>i?a.slice(0,i-3)+"...":a}function gZo(){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:Bgo.header},question:{type:"string",description:"The question text to display to the user. Keep it concise, ideally one sentence.",maxLength:Bgo.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."},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:Vgo,toolReferenceName:"askQuestions",legacyToolReferenceFullNames:[Vgo,"vscode/askQuestions"],canBeReferencedInPrompt:!1,icon:q.fromId(M.question.id),displayName:d(7994,null),userDescription:d(7995,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, and set allowFreeformInput to let users supply their own answer.",source:Rn.Internal,inputSchema:i}}var NTi=gZo(),EOe=class extends C{constructor(e,t,o){super();this.chatService=e;this.telemetryService=t;this.logService=o}async invoke(e,t,o,n){let r=En.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(7992,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.logService.info("[AskQuestionsTool] Autopilot mode: auto-responding to questions");let{carousel:O,idToHeaderMap:V}=this.toQuestionCarousel(l);return O.data=this.buildAutopilotCarouselAnswers(l,O,V),O.isUsed=!0,this.chatService.appendProgress(p,O),this.createAutopilotResult(l)}let{carousel:g,idToHeaderMap:f}=this.toQuestionCarousel(l);this.chatService.appendProgress(p,g);let v=await wa(g.completion.p,n);if(n.isCancellationRequested)throw new ho;o.report({message:d(7993,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 N=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:N}]}}async prepareToolInvocation(e,t){let o=e.parameters,{questions:n}=o;if(!n||n.length===0)throw new Error(d(7992,null));for(let u of n){if(u.options&&u.options.length===1)throw new Error(d(7987,null,u.header));u.question=Ugo(u.question,Hgo.question)??u.question}let r=n.length,s=n.map(u=>u.header).join(", "),l=r===1?d(7990,null,s):d(7988,null,r,s),c=r===1?d(7991,null,s):d(7989,null,r,s);return{invocationMessage:new xe(l),pastTenseMessage:new xe(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 a2(o,!0,_t()),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=_t();t.set(r,e.header);let s=Ugo(e.header,Hgo.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??!1}}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"&&c!==null){let u=c,p=typeof u.freeformValue=="string"&&u.freeformValue?u.freeformValue:null,h=Array.isArray(u.selectedValues)?u.selectedValues.map(v=>String(v)):void 0,g=u.selectedValue,f=typeof u.label=="string"?u.label:void 0;h?n.answers[s.header]={selected:h,freeText:p,skipped:!1}:typeof g=="string"?s.options?.some(v=>v.label===g)?n.answers[s.header]={selected:[g],freeText:p,skipped:!1}:n.answers[s.header]={selected:[],freeText:p??g,skipped:!1}:Array.isArray(g)?n.answers[s.header]={selected:g.map(v=>String(v)),freeText:p,skipped:!1}:g==null?p?n.answers[s.header]={selected:[],freeText:p,skipped:!1}:n.answers[s.header]={selected:[],freeText:null,skipped:!0}:p?n.answers[s.header]={selected:[],freeText:p,skipped:!1}:f?n.answers[s.header]={selected:[f],freeText:null,skipped:!1}:(this.logService.warn(`[AskQuestionsTool] Unknown answer object format for "${s.header}": ${JSON.stringify(c)}`),n.answers[s.header]={selected:[],freeText:null,skipped:!0})}else this.logService.warn(`[AskQuestionsTool] Unknown answer format for "${s.header}": ${typeof 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:Wgo,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]=Wgo: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})}};EOe=I([m(0,Si),m(1,Te),m(2,ne)],EOe);var fZo="vscode_get_confirmation",vZo="vscode_get_confirmation_with_options",zgo={id:fZo,displayName:"Confirmation Tool",modelDescription:"A tool that demonstrates different types of confirmations. Takes a title, message, and confirmation type (basic or terminal).",source:Rn.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}},Kgo={id:vZo,displayName:"Confirmation Tool with Options",modelDescription:"A tool that demonstrates different types of confirmations. Takes a title, message, and buttons.",source:Rn.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}},D1t=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 xe(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"}]}}};var bZo="vscode_editFile_internal",Ggo={id:bZo,displayName:"",modelDescription:"",source:Rn.Internal},TOe=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 xe("\n````\n")}),l.acceptResponseProgress(c,{kind:"codeblockUri",uri:s,isEdit:!0}),l.acceptResponseProgress(c,{kind:"markdownContent",content:new xe("\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=he(v=>{let S=u.entries.read(v)?.find(y=>y.modifiedURI.toString()===s.toString());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"}}};TOe=I([m(0,Si),m(1,NY),m(2,un)],TOe);var OTi="manage_todo_list";function FTi(){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:OTi,toolReferenceName:"todo",legacyToolReferenceFullNames:["todos"],canBeReferencedInPrompt:!0,icon:q.fromId(M.checklist.id),displayName:d(8030,null),userDescription:d(8031,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:Rn.Internal,inputSchema:a}}var ENm=FTi(),_Oe=class extends C{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(8026,null):o.todoList&&(s=this.generatePastTenseMessage(r,o.todoList));let c=(o.todoList??r).map(u=>({id:u.id.toString(),title:u.title,status:u.status}));return{pastTenseMessage:new xe(s??d(8029,null)),toolSpecificData:{kind:"todoList",todoList:c}}}generatePastTenseMessage(e,t){if(e.length===0)return t.length===1?d(8025,null):d(8024,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(8027,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(8023,null,l.title,u,c)}let s=t.filter(l=>!o.has(l.id));return s.length>0?s.length===1?d(8022,null):d(8021,null,s.length):d(8028,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}};_Oe=I([m(0,dF),m(1,ne),m(2,Te)],_Oe);var SZo="vscode_resolveDebugEventDetails_internal",WTi={id:SZo,toolReferenceName:"resolveDebugEventDetails",displayName:d(8035,null),when:ie.chatSessionHasAttachedDebugData,canBeReferencedInPrompt:!1,modelDescription:"Resolves the full details for a specific chat debug event by its event ID. Use this tool to get detailed information about a debug event such as tool call input/output, model turn details, user message sections, or file lists. The event ID can be found in the debug event log summary provided in the conversation context.",source:Rn.Internal,inputSchema:{type:"object",properties:{eventId:{type:"string",description:"The ID of the debug event to resolve details for."}},required:["eventId"]}};function IZo(a){switch(a.kind){case"text":return a.value;case"fileList":{let i=[`File list (${a.discoveryType}):`];if(a.sourceFolders)for(let e of a.sourceFolders)i.push(`  Source folder: ${e.uri.toString()} (${e.storage}, ${e.fileCount} files${e.exists?"":", missing"})`);for(let e of a.files){let t=e.status==="loaded"?"loaded":`skipped${e.skipReason?`: ${e.skipReason}`:""}`;i.push(`  ${e.uri.toString()} [${t}]`)}return i.join(`
`)}case"message":{let i=[`${a.type==="user"?"User":"Agent"} message: ${a.message}`];for(let e of a.sections)i.push(`--- ${e.name} ---`),i.push(e.content);return i.join(`
`)}case"toolCall":{let i=[`Tool call: ${a.toolName}`];return a.result&&i.push(`Result: ${a.result}`),a.durationInMillis!==void 0&&i.push(`Duration: ${a.durationInMillis}ms`),a.input&&i.push(`Input:
${a.input}`),a.output&&i.push(`Output:
${a.output}`),i.join(`
`)}case"modelTurn":{let i=[`Model turn: ${a.requestName}`];if(a.model&&i.push(`Model: ${a.model}`),a.status&&i.push(`Status: ${a.status}`),a.durationInMillis!==void 0&&i.push(`Duration: ${a.durationInMillis}ms`),(a.inputTokens!==void 0||a.outputTokens!==void 0)&&i.push(`Tokens: input=${a.inputTokens??"?"}, output=${a.outputTokens??"?"}, cached=${a.cachedTokens??"?"}, total=${a.totalTokens??"?"}`),a.errorMessage&&i.push(`Error: ${a.errorMessage}`),a.sections)for(let e of a.sections)i.push(`--- ${e.name} ---`),i.push(e.content);return i.join(`
`)}default:return JSON.stringify(a)}}function $go(a,i=30){if(a.length<=i)return a;let e=a.lastIndexOf(" ",i),t=e>i/2?e:i;return a.substring(0,t)+"\u2026"}function yZo(a){switch(a.kind){case"generic":return a.name;case"toolCall":return a.toolName;case"modelTurn":return a.requestName??d(8033,null);case"userMessage":return d(8034,null,$go(a.message));case"agentResponse":return d(8032,null,$go(a.message));case"subagentInvocation":return a.agentName}}var DOe=class{constructor(i){this.chatDebugService=i}async prepareToolInvocation(i,e){let t=i.parameters?.eventId,o;if(typeof t=="string"&&i.chatSessionResource){let r=this.chatDebugService.getEvents(i.chatSessionResource).find(s=>s.id===t);r&&(o=yZo(r))}return o?{invocationMessage:d(8037,null,o),pastTenseMessage:d(8039,null,o)}:{invocationMessage:d(8036,null),pastTenseMessage:d(8038,null)}}async invoke(i,e,t,o){let n=i.parameters.eventId;if(typeof n!="string"||!n)return{content:[{kind:"text",value:"Error: eventId parameter is required."}]};let r=i.context?.sessionResource;if(!r)return{content:[{kind:"text",value:"Error: no chat session context available."}]};if(!this.chatDebugService.getEvents(r).some(c=>c.id===n))return{content:[{kind:"text",value:`No event with ID "${n}" found in the current session.`}]};let l=await this.chatDebugService.resolveEvent(n);return l?{content:[{kind:"text",value:IZo(l)}]}:{content:[{kind:"text",value:`No details found for event ID: ${n}`}]}}};DOe=I([m(0,em)],DOe);function HB(a){return{content:[{kind:"text",value:a}]}}var wZo=`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`,s8=class extends C{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.onDidUpdateToolData=H.filter(this.configurationService.onDidChangeConfiguration,h=>h.affectsConfiguration("chat.customAgentInSubagent.enabled"))}static{this.Id="runSubagent"}getToolData(){let e=wZo,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:s8.Id,toolReferenceName:Kj.runSubagent,icon:q.fromId(M.organization.id),displayName:d(8040,null),userDescription:d(8041,null),modelDescription:e,source:Rn.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 P;try{let u=this.chatAgentService.getDefaultAgent("panel","agent");if(!u)return HB("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 $=this._resolvedModels.get(e.callId);if($)this._resolvedModels.delete(e.callId),p=$.modeModelId,v=$.resolvedModelName;else{let de=this.resolveSubagentModel(f,e.modelId);p=de.modeModelId,v=de.resolvedModelName}let te=f.tools;if(te){let de=this.languageModelToolsService.toToolAndToolSetEnablementMap(te,void 0);h={};for(let[se,Se]of de)Km(se)||(h[se.id]=Se)}let pe=f.agentInstructions;g=pe&&{name:b,content:pe.content,toolReferences:this.toolsService.toToolReferences(pe.toolReferences),metadata:pe.metadata,isBuiltin:bmo(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 $=this._resolvedModels.get(e.callId);$?(this._resolvedModels.delete(e.callId),v=$.resolvedModelName):v=(p?this.languageModelsService.lookupLanguageModel(p):void 0)?.name}let S=[],y=e.callId??`subagent-${_t()}`,w=!1,k=$=>{for(let te of $)te.kind==="textEdit"||te.kind==="notebookEdit"||te.kind==="codeblockUri"?(te.kind==="codeblockUri"&&!w&&(w=!0,s.acceptResponseProgress(l,{kind:"markdownContent",content:new xe("```\n")})),te.kind==="codeblockUri"?s.acceptResponseProgress(l,{...te,subAgentInvocationId:y}):s.acceptResponseProgress(l,te)):te.kind==="hook"?s.acceptResponseProgress(l,{...te,subAgentInvocationId:y}):te.kind==="markdownContent"&&(w&&(s.acceptResponseProgress(l,{kind:"markdownContent",content:new xe("\n```\n\n")}),w=!1),S.push(te.content.value))};h&&(h[s8.Id]=!1,h[OTi]=!1,h.copilot_askQuestions=!1);let T=new Uj;await this.instantiationService.createInstance(nte,"agent",h,void 0,e.context.sessionResource).collect(T,n);let O;try{O=(await this.promptsService.getHooks(n,e.context.sessionResource))?.hooks}catch($){this.logService.warn("[ChatService] Failed to collect hooks:",$)}if(f?.hooks){let $={...f.hooks};if($.Stop){let te=$.Stop;$.SubagentStop=$.SubagentStop?[...$.SubagentStop,...te]:te,$.Stop=void 0}O=xDt(O,$)}let V={sessionResource:e.context.sessionResource,requestId:e.callId??`subagent-${Date.now()}`,agentId:u.id,message:r.prompt,variables:{variables:T.asArray()},location:"panel",subAgentInvocationId:e.callId,subAgentName:b,userSelectedModelId:p,userSelectedTools:h,modeInstructions:g,parentRequestId:e.chatRequestId,hooks:O,hasHooksEnabled:!!O&&Object.values(O).some($=>$.length>0)};c.add(this.languageModelToolsService.onDidInvokeTool($=>{$.subagentInvocationId===y&&(S.length=0)}));let U=await this.chatAgentService.invokeAgent(u.id,V,k,[],n);if(U.errorDetails)return HB(`Agent error: ${U.errorDetails.message}`);let G=S.join("").replace(/^\n*```\n+```\n*/g,"").trim()||"Agent completed with no output";return e.toolSpecificData?.kind==="subagent"&&(e.toolSpecificData.result=G,e.toolSpecificData.modelName=v),{content:[{kind:"text",value:G}],toolMetadata:{subAgentInvocationId:y,description:r.description,agentName:V.subAgentName,modelName:v}}}catch(u){let p=`Error invoking subagent: ${u instanceof Error?u.message:"Unknown error"}`;return this.logService.error(p,u),HB(p)}finally{c.dispose()}}async getSubAgentByName(e){return(await this.promptsService.getCustomAgents(ve.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}}}};s8=I([m(0,br),m(1,Si),m(2,jn),m(3,Wr),m(4,ne),m(5,jn),m(6,B),m(7,nr),m(8,F),m(9,nt)],s8);var CZo="task_complete";var qgo={id:CZo,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:Rn.Internal,inputSchema:{type:"object",properties:{summary:{type:"string",description:"Brief summary of what was accomplished. Omit for trivial interactions."}}}},L1t=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 Rhe=class extends C{static{this.ID="chat.builtinTools"}constructor(i,e){super();let t=e.createInstance(TOe);this._register(i.registerTool(Ggo,t));let o=this._register(e.createInstance(EOe));this._register(i.registerTool(NTi,o)),this._register(i.vscodeToolSet.addTool(NTi));let n=FTi(),r=this._register(e.createInstance(_Oe));this._register(i.registerTool(n,r));let s=e.createInstance(D1t);this._register(i.registerTool(zgo,s)),this._register(i.registerTool(Kgo,s));let l=e.createInstance(L1t);this._register(i.registerTool(qgo,l));let c=e.createInstance(DOe);this._register(i.registerTool(WTi,c)),this._register(i.readToolSet.addTool(WTi));let u=this._register(e.createInstance(s8)),p,h,g=()=>{p?.dispose(),h?.dispose(),i.flushToolUpdates();let f=u.getToolData();p=i.registerTool(f,u),h=i.agentToolSet.addTool(f)};g(),this._register(u.onDidUpdateToolData(g)),this._register({dispose:()=>{p?.dispose(),h?.dispose()}})}};Rhe=I([m(0,jn),m(1,F)],Rhe);var lot="vscode_fetchWebPage_internal";function R1t(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 M1t(a,i){let t=i.trim().split(/\s+/).map(Yr).join("\\s+"),o=a.findMatches(t,!1,!0,!1,null,!1,1);if(o.length!==0)return o[0].range.startLineNumber}function P1t(a,i){let t=new RegExp(`\\b${Yr(i)}\\b`).exec(a);if(t)return t.index+1}function g0(a){let i=HB(a);return i.toolResultMessage=new xe(a),i}var xZo="vscode_renameSymbol",kZo=`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.`,cot=class extends C{constructor(e,t,o,n,r){super();this._languageFeaturesService=e;this._textModelService=t;this._workspaceContextService=o;this._chatService=n;this._bulkEditService=r;this._onDidUpdateToolData=this._store.add(new E);this.onDidUpdateToolData=this._onDidUpdateToolData.event;this._store.add(H.debounce(this._languageFeaturesService.renameProvider.onDidChange,()=>{},2e3)((()=>this._onDidUpdateToolData.fire())))}getToolData(){let e=this._languageFeaturesService.renameProvider.registeredLanguageIds,t=kZo;if(e.has("*"))t+=`

Supported for all languages.`;else if(e.size>0){let o=[...e].sort();t+=`

Currently supported for: ${o.join(", ")}.`}else t+=`

No languages currently have rename providers registered.`;return{id:xZo,toolReferenceName:"rename",canBeReferencedInPrompt:!1,icon:q.fromId(M.rename.id),displayName:d(7068,null),userDescription:d(7072,null),modelDescription:t,source:Rn.Internal,when:x.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(7070,null,o.symbol,o.newName)}}async invoke(e,t,o,n){let r=e.parameters,s=R1t(r,this._workspaceContextService);if(!s)return g0('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 g0("No rename provider available for this file's language. The rename tool may not support this language.");let u=M1t(c,r.lineContent);if(u===void 0)return g0(`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=P1t(p,r.symbol);if(h===void 0)return g0(`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 Ie(u,h),f=await Ksi(this._languageFeaturesService.renameProvider,c,g,r.newName);if(f.rejectReason)return g0(`Rename rejected: ${f.rejectReason}`);if(f.edits.length===0)return g0("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 vt;for(let w of f.edits)if(ja.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 Mn(f.edits.filter(ja.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(7071,null,e.symbol,e.newName,t):d(7069,null,e.symbol,e.newName,o,t),r=HB(n);return r.toolResultMessage=new xe(n),r}};cot=I([m(0,zt),m(1,Nt),m(2,Pe),m(3,Si),m(4,ma)],cot);var Mhe=class extends C{static{this.ID="chat.renameTool"}constructor(i,e){super();let t=this._store.add(e.createInstance(cot)),o,n=()=>{o?.dispose(),i.flushToolUpdates();let r=t.getToolData();o=i.registerTool(r,t)};n(),this._store.add(t.onDidUpdateToolData(n)),this._store.add({dispose:()=>{o?.dispose()}})}};Mhe=I([m(0,jn),m(1,F)],Mhe);var EZo="vscode_listCodeUsages",TZo=`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.`,dot=class extends C{constructor(e,t,o,n,r){super();this._languageFeaturesService=e;this._modelService=t;this._searchService=o;this._textModelService=n;this._workspaceContextService=r;this._onDidUpdateToolData=this._store.add(new E);this.onDidUpdateToolData=this._onDidUpdateToolData.event;this._store.add(H.debounce(this._languageFeaturesService.referenceProvider.onDidChange,()=>{},2e3)((()=>this._onDidUpdateToolData.fire())))}getToolData(){let e=this._languageFeaturesService.referenceProvider.registeredLanguageIds,t=TZo;if(e.has("*"))t+=`

Supported for all languages.`;else if(e.size>0){let o=[...e].sort();t+=`

Currently supported for: ${o.join(", ")}.`}else t+=`

No languages currently have reference providers registered.`;return{id:EZo,toolReferenceName:"usages",canBeReferencedInPrompt:!1,icon:q.fromId(M.references.id),displayName:d(7086,null),userDescription:d(7091,null),modelDescription:t,source:Rn.Internal,when:x.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(7087,null,o.symbol)}}async invoke(e,t,o,n){let r=e.parameters,s=R1t(r,this._workspaceContextService);if(!s)return g0('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 g0("No reference provider available for this file's language. The usages tool may not support this language.");let u=M1t(c,r.lineContent);if(u===void 0)return g0(`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=P1t(p,r.symbol);if(h===void 0)return g0(`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 Ie(u,h),[f,v,b]=await Promise.all([U1(this._languageFeaturesService.definitionProvider,c,g,!1,n),T7(this._languageFeaturesService.referenceProvider,c,g,!1,!1,n),Xwe(this._languageFeaturesService.implementationProvider,c,g,!1,n)]);if(v.length===0){let T=HB(`No usages found for \`${r.symbol}\`.`);return T.toolResultMessage=new xe(d(7088,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 N=v[T],O=this._classifyReference(N,f,b),V=z.lift(N.range).startLineNumber,U=S[T];U?(y.push(`<usage type="${O}" uri="${N.uri.toString()}" line="${V}">`),y.push(`	${U}`),y.push("</usage>")):y.push(`<usage type="${O}" uri="${N.uri.toString()}" line="${V}" />`)}let w=y.join(`
`),k=HB(w);return k.toolResultMessage=v.length===1?new xe(d(7089,null,r.symbol)):new xe(d(7090,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 Mn;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=Fc(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:Yr(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(ZO(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 e.uri.toString()!==t.uri.toString()?!1:z.areIntersectingOrTouching(e.range,t.range)}};dot=I([m(0,zt),m(1,Ct),m(2,Jp),m(3,Nt),m(4,Pe)],dot);var Phe=class extends C{static{this.ID="chat.usagesTool"}constructor(i,e){super();let t=this._store.add(e.createInstance(dot)),o,n=()=>{o?.dispose(),i.flushToolUpdates();let r=t.getToolData();o=i.registerTool(r,t)};n(),this._store.add(t.onDidUpdateToolData(n)),this._store.add({dispose:()=>o?.dispose()})}};Phe=I([m(0,jn),m(1,F)],Phe);var A1t=ae("voiceChatService");var N1t=new Q("voiceChatInProgress",!1,{type:"boolean",description:d(8072,null)}),Fv=class extends C{constructor(e,t,o){super();this.speechService=e;this.chatAgentService=t;this.activeVoiceChatSessions=0;this.voiceChatInProgress=N1t.bindTo(o)}static{this.AGENT_PREFIX=vg}static{this.COMMAND_PREFIX=yu}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=`${Fv.PHRASES_LOWER[Fv.AGENT_PREFIX]} ${Fv.CHAT_AGENT_ALIAS.get(o.name)??o.name}`.toLowerCase();t.set(n,{agent:o.name});for(let r of o.slashCommands){let s=`${Fv.PHRASES_LOWER[Fv.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`${Fv.AGENT_PREFIX}${e.agent}`;case 2:return`${Fv.COMMAND_PREFIX}${e.command}`;case 3:return`${Fv.AGENT_PREFIX}${e.agent} ${Fv.COMMAND_PREFIX}${e.command}`}}async createVoiceChatSession(e,t){let o=new P,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(Fv.PHRASES_UPPER[Fv.AGENT_PREFIX])||p.text.startsWith(Fv.PHRASES_LOWER[Fv.AGENT_PREFIX]),f=p.text.startsWith(Fv.PHRASES_UPPER[Fv.COMMAND_PREFIX])||p.text.startsWith(Fv.PHRASES_LOWER[Fv.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=ih(e,"."),e=ih(e,","),e=ih(e,"?"),e.toLowerCase()}};Fv=I([m(0,EC),m(1,br),m(2,X)],Fv);var O1t=class{constructor(){this.priority=100;this.name="panelChat";this.type="view";this.when=ie.inChatSession}getProvider(i){let e=i.get(At),t=i.get(le),o=e.lastFocusedWidget;if(!o)return;let n=o.hasInputFocus();n&&o.focusResponseItem();let r=o,s=r.getFocus();if(!s||!Vi(s)){let c=r.viewModel?.getItems().filter(Vi)?.at(-1);c&&(s=c,r.focus(c))}if(!(!s||!Vi(s)))return new VTi(r,s,n,t)}},F1t="chat.accessibleView.includeThinking",_Zo=!0;function BTi(a){return a.getBoolean(F1t,0,_Zo)}function DZo(a){return typeof a=="object"&&a!==null&&"output"in a&&typeof a.output=="object"&&a.output?.type==="data"&&typeof a.output?.base64Data=="string"}function Qgo(a){if(!a)return"";if(RTt(a)||a.kind==="terminal"){let i=fR(a);return i.commandLine.userEdited??i.commandLine.toolEdited??i.commandLine.original}switch(a.kind){case"subagent":{let i=[];return a.agentName&&i.push(d(5296,null,a.agentName)),a.description&&i.push(a.description),a.prompt&&i.push(d(5297,null,a.prompt)),i.join(". ")||""}case"extensions":return a.extensions.length>0?d(5290,null,a.extensions.join(", ")):"";case"todoList":{let i=a.todoList;if(i.length===0)return"";let e=i.map(t=>d(5299,null,t.title,t.status));return d(5300,null,i.length,e.join("; "))}case"pullRequest":return d(5293,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(5294,null,e)}case"simpleToolInvocation":{let i=a.input,e=a.output;return d(5295,null,i,e)}default:return""}}function LZo(a){return a?Array.isArray(a)?{files:a.map(e=>A.isUri(e)?e.fsPath||e.path:e.uri.fsPath||e.uri.path)}:mV(a)?{input:a.input,isError:a.isError}:DZo(a)?{input:d(5288,null,a.output.mimeType)}:zj(a)?{input:d(5288,null,a.output.mimeType)}:{}:{}}function jgo(a,i,e,t,o){let n=[],r=o&&i?i:a;r&&n.push(r);let s=Qgo(e);if(s&&n.push(s),o&&t){let l=LZo(t);l.isError&&n.unshift(d(5289,null)),l.input&&!s&&n.push(d(5292,null,l.input)),l.files&&l.files.length>0&&n.push(d(5291,null,l.files.join(", ")))}return n.join(". ")}var VTi=class extends C{constructor(e,t,o,n){super();this._widget=e;this._wasOpenedFromInput=o;this._storageService=n;this._focusedItemDisposables=this._register(new P);this._storageDisposables=this._register(new P);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,F1t,this._storageDisposables)(()=>{this._onDidChangeContent.fire()})),this._setFocusedItem(t)}provideContent(){return this._getContent(this._focusedItem)}_setFocusedItem(e){this._focusedItem=e,this._focusedItemDisposables.clear(),Vi(e)&&this._focusedItemDisposables.add(e.model.onDidChange(()=>this._onDidChangeContent.fire()))}_renderMessageAsPlaintext(e){return typeof e=="string"?e:fu(qa(e,{useLinkFormatter:!0}))}_getContent(e){let t=[];if(!Vi(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(5298,null,r));break}case"markdownContent":{let n=qa(o.content,{includeCodeBlocksFences:!0,useLinkFormatter:!0});n.trim()&&t.push(n);break}case"elicitation2":case"elicitationSerialized":{let n=o.title,r="";typeof n=="string"?r+=`${n}
`:Mr(n)&&(r+=qa(n,{includeCodeBlocksFences:!0})+`
`);let s=o.message;Mr(s)?r+=qa(s,{includeCodeBlocksFences:!0}):r+=s,r.trim()&&t.push(r);break}case"toolInvocation":{let n=o.state.get();if(n.type===lo.StateKind.WaitingForConfirmation&&n.confirmationMessages?.title){let r=this._renderMessageAsPlaintext(n.confirmationMessages.title),s=n.confirmationMessages.message?this._renderMessageAsPlaintext(n.confirmationMessages.message):"",l=Qgo(o.toolSpecificData),c=r;l&&(c+=`: ${l}`),s&&(c+=`
${s}`),t.push(c)}else if(n.type===lo.StateKind.WaitingForPostApproval){let r=mV(n.resultDetails)?n.resultDetails.input:zj(n.resultDetails)?void 0:DTt(n.contentForModel);t.push(d(5301,null,o.toolId)+(r??""))}else{let r=lo.resultDetails(o),s=lo.isComplete(o),l=jgo(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=jgo(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 BTi(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 RZo="workbench.action.chat.focusConfirmation",MZo="workbench.action.chat.toggleThinkingContentAccessibleView",HTi=class extends K{constructor(){super({id:RZo,title:{value:d(5304,null),original:"Focus Chat Confirmation"},category:{value:d(5302,null),original:"Chat"},precondition:ie.enabled,f1:!0,keybinding:{weight:200,primary:3103,when:x.and($a,ie.Editing.hasQuestionCarousel.negate())}})}async run(i){let t=i.get(At).getAllWidgets().find(s=>s.viewModel?.model.requestNeedsInput.get());if(!t){Jo(d(5305,null));return}let o=t.viewModel;if(!o){Jo(d(5303,null));return}let n,r=o.getItems()[o.getItems().length-1];if(Vi(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():Jo(d(5306,null))}},UTi=class extends K{constructor(){super({id:MZo,title:{value:d(5309,null),original:"Toggle Thinking Content in Accessible View"},category:{value:d(5302,null),original:"Chat"},precondition:ie.enabled,f1:!0,keybinding:{primary:562,weight:200,when:x.and(ud,x.equals(Kd.key,"panelChat"))}})}async run(i){let e=i.get(le),o=!BTi(e);e.store(F1t,o,0,0),Jo(o?d(5308,null):d(5307,null))}};function Ygo(){W(HTi),W(UTi)}var zTi=class{constructor(){this.participants=new Set}registerParticipant(i){return this.participants.add(i),{dispose:()=>{this.participants.delete(i)}}}getParticipants(){return Array.from(this.participants)}},KTi=new zTi;async function UB(a,i,e){let t=a.get(F),o=a.get(ne);for(let n of KTi.getParticipants())try{if(await t.invokeFunction(s=>n.handleOpenSession(s,i,e)))return}catch(r){o.error(r)}return t.invokeFunction(n=>PZo(n,i,e))}async function PZo(a,i,e){let t=a.get(Ls),o=a.get(At),n=a.get(Ne);try{i.setRead(!0);let r;VTe(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=Un:l=$x,!(i.resource.scheme===Y.vscodeChatEditor||i.resource.scheme===Y.vscodeLocalChatSession)&&!await t.canResolveChatSession(i.resource.scheme)&&(l=e?.sideBySide?vn:Un,s={...s,revealIfOpened:!0}),await o.openSession(i.resource,l,s)}catch(r){n.error(d(5715,null,In(r)));return}}var AZo=60,GTi=240,$Ti=500,LOe=class extends C{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=`${$Ti}px`,this.domNode.style.height=`${AZo+GTi}px`,this.domNode.style.overflow="hidden",this.cts=new $e,this._register(Z(()=>this.cts.cancel())),this.buildHeader(),this.contentElement=R(this.domNode,_(".agent-session-hover-content")),this.loadingElement=R(this.contentElement,_(".agent-session-hover-loading")),R(this.loadingElement,Qo(q.modify(M.loading,"spin"))),this.renderScheduler=this._register(new Dt(()=>this.render(),200))}onRendered(){this.modelRef??=this.loadModel(),this.hasRendered?this.listWidget?.layout(GTi,$Ti):(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(YF,"agentSessionHover")),o=this._register(this.instantiationService.createInstance(see,e,t,{maxVisibleItems:2})),n=R(this.contentElement,_(".interactive-list")),r=this._register(this.instantiationService.createInstance(ste,n,{rendererOptions:{renderStyle:"compact",noHeader:!0,editable:!1},currentChatMode:()=>"ask"}));r.layout(GTi,$Ti),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=R(this.domNode,_(".agent-session-hover-header")),o=R(t,_(".agent-session-hover-title"));R(o,_("span",void 0,e.label));let n=R(t,_(".agent-session-hover-details")),s=Rf(e.providerType)??"local",l=A_(s);if(R(n,Qo(l)),R(n,_("span",void 0,XS(s))),R(n,_("span.separator",void 0,"\u2022")),e.timing.lastRequestEnded&&e.timing.lastRequestStarted){let u=this.toDuration(e.timing.lastRequestStarted,e.timing.lastRequestEnded,!0);u&&R(n,_("span",void 0,u))}else{let u=e.timing.lastRequestStarted??e.timing.created;R(n,_("span",void 0,Bs(u,!0,!0)))}let c=JX(e.changes);if(c&&FV(e.changes)){R(n,_("span.separator",void 0,"\u2022"));let u=R(n,_(".agent-session-hover-diff"));c.files>0&&R(u,_("span",void 0,c.files===1?d(5638,null):d(5639,null,c.files))),c.insertions>0&&R(u,_("span.insertions",void 0,`+${c.insertions}`)),c.deletions>0&&R(u,_("span.deletions",void 0,`-${c.deletions}`))}e.status!==1&&(R(n,_("span.separator",void 0,"\u2022")),R(n,_("span",void 0,this.toStatusLabel(e.status)))),e.isArchived()&&(R(n,_("span.separator",void 0,"\u2022")),R(n,Qo(M.archive)),R(n,_("span",void 0,d(5637,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=Rf(e.providerType)??"local",s=A_(r),l=XS(r),c;if(e.timing.lastRequestEnded&&e.timing.lastRequestStarted)c=this.toDuration(e.timing.lastRequestStarted,e.timing.lastRequestEnded,!0)??Bs(e.timing.lastRequestStarted,!0,!0);else{let p=e.timing.lastRequestStarted??e.timing.created;c=Bs(p,!0,!0)}o.push(`$(${s.id}) ${l} \u2022 ${c}`);let u=JX(e.changes);if(u&&FV(e.changes)){let p=[];u.files>0&&p.push(u.files===1?d(5638,null):d(5639,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(5637,null)}`),new xe(t.join(`

`),{supportThemeIcons:!0})}toDuration(e,t,o){let n=Math.round((t-e)/1e3)*1e3;if(!(n<1e3))return z6(n,o)}toStatusLabel(e){let t;switch(e){case 3:t=d(5636,null);break;case 2:t=d(5635,null);break;case 0:t=d(5634,null);break;default:t=d(5633,null)}return t}};LOe=I([m(1,Si),m(2,F),m(3,At)],LOe);var ROe=Object.freeze({providers:[],states:[],archived:!0,read:!1}),f0=class extends C{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.excludes=ROe;this.isStoringExcludes=!1;this.actionDisposables=this._register(new P);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={...ROe}}else this.excludes={...ROe}}this.updateFilterActions(),e&&this._onDidChange.fire()}storeExcludes(e){this.excludes=e,this.isStoringExcludes=!0;try{uo(this.excludes,ROe)?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=Rf(c);return u?XS(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)?x.false():x.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(5710,null)},{id:2,label:d(5712,null)},{id:3,label:d(5713,null)},{id:0,label:d(5711,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)?x.false():x.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(5707,null),menu:{id:t,group:"3_props",order:1e3},toggled:o.excludes.archived?x.false():x.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(5708,null),menu:{id:t,group:"3_props",order:0},toggled:o.excludes.read?x.false():x.true()})}run(){o.storeExcludes({...o.excludes,read:!o.excludes.read})}}))}registerResetAction(e,t){let o=this;e.add(W(class extends K{constructor(){super({id:`agentSessions.filter.resetExcludes.${t.id.toLowerCase()}`,title:d(5709,null),menu:{id:t,group:"4_reset",order:0}})}run(){o.reset()}}))}isDefault(){return uo(this.excludes,ROe)}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({...ROe})}};f0=I([m(1,Ls),m(2,le)],f0);var YR=class extends C{constructor(e,t,o,n,r,s,l){super();this.options=e;this._approvalModel=t;this.markdownRendererService=o;this.productService=n;this.hoverService=r;this.instantiationService=s;this.contextKeyService=l;this.templateId=YR.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,YR.APPROVAL_ROW_MAX_LINES)*YR._APPROVAL_ROW_LINE_HEIGHT+YR._APPROVAL_ROW_OVERHEAD}renderTemplate(e){let t=new P,o=t.add(new P),n=bt("div.agent-session-item@item",[bt("div.agent-session-icon-col",[bt("div.agent-session-icon@icon")]),bt("div.agent-session-main-col",[bt("div.agent-session-title-row",[bt("div.agent-session-title@title"),bt("div.agent-session-title-toolbar@titleToolbar")]),bt("div.agent-session-details-row",[bt("div.agent-session-diff-container@diffContainer",[bt("span.agent-session-diff-added@addedSpan"),bt("span.agent-session-diff-removed@removedSpan")]),bt("div.agent-session-description@description"),bt("div.agent-session-details-right",[bt("div.agent-session-badge@badge"),bt("span.agent-session-separator@separator"),bt("div.agent-session-status@statusContainer",[bt("span.agent-session-status-provider-icon@statusProviderIcon"),bt("span.agent-session-status-time@statusTime")])])]),bt("div.agent-session-approval-row@approvalRow",[bt("span.agent-session-approval-label@approvalLabel"),bt("div.agent-session-approval-button@approvalButtonContainer")])])]),r=t.add(this.contextKeyService.createScoped(n.item)),s=t.add(this.instantiationService.createChild(new Io([X,r]))),l=t.add(s.createInstance(Ln,n.titleToolbar,D.AgentSessionItemToolbar,{menuOptions:{shouldForwardArgs:!0}}));return e.appendChild(n.item),{element:n.item,icon:n.icon,title:t.add(new Lc(n.title,{supportHighlights:!0,supportIcons:!0})),titleToolbar:l,diffContainer:n.diffContainer,diffAddedSpan:n.addedSpan,diffRemovedSpan:n.removedSpan,badge:n.badge,separator:n.separator,description:n.description,statusContainer:n.statusContainer,statusProviderIcon:n.statusProviderIcon,statusTime:n.statusTime,approvalRow:n.approvalRow,approvalLabel:n.approvalLabel,approvalButtonContainer:n.approvalButtonContainer,contextKeyService:r,elementDisposable:o,disposables:t}}renderElement(e,t,o,n){o.elementDisposable.clear(),o.diffAddedSpan.textContent="",o.diffRemovedSpan.textContent="",o.badge.textContent="",o.description.textContent="",o.element.classList.toggle("archived",e.element.isArchived()),o.icon.className=`agent-session-icon ${q.asClassName(this.getIcon(e.element))}`;let r=new xe(e.element.label);o.title.setLabel(qa(r),void 0,{matches:ua(e.filterData)}),ie.isArchivedAgentSession.bindTo(o.contextKeyService).set(e.element.isArchived()),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=!1,{changes:l}=e.element;!L_(e.element.status)&&l&&FV(l)&&this.renderDiff(e,o)&&(s=!0),o.diffContainer.classList.toggle("has-diff",s);let c=!1;e.element.providerType==="copilotcli"||e.element.providerType==="copilot-cloud-agent"?c=Array.isArray(l)&&l.length>0:c=s,ie.hasAgentSessionChanges.bindTo(o.contextKeyService).set(c);let u=this.renderBadge(e,o);o.badge.classList.toggle("has-badge",u),s||this.renderDescription(e,o),o.separator.classList.toggle("has-separator",u),this.renderStatus(e,o),this.renderHover(e,o),this._approvalModel&&this.renderApprovalRow(e,o)}renderBadge(e,t){let o=e.element.badge;return o&&this.renderMarkdownOrText(o,t.badge,t.elementDisposable),!!o}renderMarkdownOrText(e,t,o){typeof e=="string"?t.textContent=e:o.add(this.markdownRendererService.render(e,{sanitizerConfig:{replaceWithPlaintext:!0,allowedTags:{override:Eet},allowedLinkSchemes:{augment:[this.productService.urlProtocol]}}},t))}renderDiff(e,t){let o=JX(e.element.changes);return o?(o.insertions>=0&&(t.diffAddedSpan.textContent=`+${o.insertions}`),o.deletions>=0&&(t.diffRemovedSpan.textContent=`-${o.deletions}`),!0):!1}getIcon(e){return e.status===2?M.sessionInProgress:e.status===3?M.report:e.status===0?M.error:!e.isRead()&&!e.isArchived()?M.circleFilled:M.circleSmallFilled}renderDescription(e,t){let o=e.element.description;if(o){this.renderMarkdownOrText(o,t.description,t.elementDisposable);return}if(e.element.status===2)t.description.textContent=d(5742,null);else if(e.element.status===3)t.description.textContent=d(5743,null);else if(e.element.timing.lastRequestEnded&&e.element.timing.lastRequestStarted&&e.element.timing.lastRequestEnded>e.element.timing.lastRequestStarted){let n=this.toDuration(e.element.timing.lastRequestStarted,e.element.timing.lastRequestEnded,!1,!0);t.description.textContent=e.element.status===0?d(5741,null,n):d(5739,null,n)}else t.description.textContent=e.element.status===0?d(5740,null):d(5738,null)}toDuration(e,t,o,n){let r=Math.max(Math.round((t-e)/1e3)*1e3,1e3);return!n&&r<6e4?d(5746,null):z6(r,o)}renderStatus(e,t){let o=s=>{let l;if(s.status===2&&s.timing.lastRequestStarted&&(l=this.toDuration(s.timing.lastRequestStarted,Date.now(),!1,!1)),!l){let c=Bj(s.timing);Math.round((new Date().getTime()-c)/1e3)<60?l=d(5746,null):l=qTi(c)}return l};if(e.element.providerType==="local")t.statusProviderIcon.className="";else if(this.options.showIsolationIcon&&e.element.providerType==="copilotcli"){let l=typeof e.element.metadata?.worktreePath=="string"?M.worktree:M.folder;t.statusProviderIcon.className=`agent-session-status-provider-icon ${q.asClassName(l)}`}else t.statusProviderIcon.className=`agent-session-status-provider-icon ${q.asClassName(e.element.icon)}`;t.statusTime.textContent=o(e.element),t.elementDisposable.add(new EI).cancelAndSet(()=>t.statusTime.textContent=o(e.element),e.element.status===2?1e3:60*1e3)}renderHover(e,t){if(this.options.disableHover||!L_(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(LOe,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 ni("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 P);t.elementDisposable.add(he(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=YR.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 xe;for(let y of g)v.appendCodeblock(f,y);this.renderMarkdownOrText(v,t.approvalLabel,s);let b=new xe().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=s.add(new Mi(t.approvalButtonContainer,{title:d(5737,null),...Ko}));S.label=d(5736,null),s.add(S.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()}};YR=I([m(2,Qn),m(3,nt),m(4,tt),m(5,F),m(6,X)],YR);function NZo(a){let i;switch(a){case 3:i=d(5726,null);break;case 2:i=d(5724,null);break;case 0:i=d(5723,null);break;default:i=d(5722,null)}return i}var a8=class{constructor(i,e){this.instantiationService=i;this.contextKeyService=e;this.templateId=a8.TEMPLATE_ID}static{this.TEMPLATE_ID="agent-session-section"}renderTemplate(i){let e=new P,t=bt("div.agent-session-section@container",[bt("span.agent-session-section-label@label"),bt("div.agent-session-section-toolbar@toolbar")]),o=e.add(this.contextKeyService.createScoped(t.container)),n=e.add(this.instantiationService.createChild(new Io([X,o]))),r=e.add(n.createInstance(Ln,t.toolbar,D.AgentSessionSectionToolbar,{menuOptions:{shouldForwardArgs:!0}}));return i.appendChild(t.container),{container:t.container,label:t.label,toolbar:r,contextKeyService:o,disposables:e}}renderElement(i,e,t,o){t.label.textContent=i.element.label,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()}};a8=I([m(0,F),m(1,X)],a8);var W1t=class a{constructor(i){this._approvalModel=i}static{this.ITEM_HEIGHT=54}static{this.SECTION_HEIGHT=26}getHeight(i){if(hw(i))return a.SECTION_HEIGHT;let e=a.ITEM_HEIGHT,t=this._approvalModel?.getApproval(i.resource).get();return t&&(e+=YR.getApprovalRowHeight(t.label)),e}hasDynamicHeight(i){return!!this._approvalModel&&gR(i)}getTemplateId(i){return hw(i)?a8.TEMPLATE_ID:YR.TEMPLATE_ID}},V1t=class{getWidgetRole(){return"list"}getRole(i){return"listitem"}getWidgetAriaLabel(){return d(5727,null)}getAriaLabel(i){return hw(i)?d(5735,null,i.label):d(5725,null,i.providerLabel,i.label,NZo(i.status),new Date(i.timing.created).toLocaleString())}},B1t=class a extends C{constructor(e,t){super();this.filter=e;this.sorter=t;this._onDidGetChildren=this._register(new E);this.onDidGetChildren=this._onDidGetChildren.event}static{this.CAPPED_SESSIONS_LIMIT=3}hasChildren(e){return OMt(e)?!0:hw(e)?e.sessions.length>0:!1}getChildren(e){if(OMt(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 return hw(e)?e.sessions:[]}groupSessionsIntoSections(e){let t=e.sort(this.sorter.compare.bind(this.sorter));return this.filter?.groupResults?.()==="capped"?this.filter?.getExcludes().read?t:this.groupSessionsCapped(t):this.groupSessionsByDate(t)}groupSessionsCapped(e){let t=[],o=e.findIndex(l=>l.isArchived()),n=o===-1?e.length:o,r=e.slice(0,Math.min(a.CAPPED_SESSIONS_LIMIT,n)),s=e.slice(r.length);return t.push(...r),s.length>0&&t.push({section:"more",label:MOe.more,sessions:s}),t}groupSessionsByDate(e){let t=[],o=uot(e);for(let{sessions:n,section:r,label:s}of o.values())n.length!==0&&t.push({section:r,label:s,sessions:n});return t}},MOe={today:d(5732,null),yesterday:d(5734,null),week:d(5733,null),older:d(5731,null),archived:d(5728,null),more:d(5730,null)},H1t=1440*60*1e3,OZo=7*H1t;function uot(a){let i=Date.now(),e=new Date(i).setHours(0,0,0,0),t=e-H1t,o=i-OZo,n=[],r=[],s=[],l=[],c=[];for(let u of a)if(u.isArchived())c.push(u);else{let p=Bj(u.timing);p>=e?n.push(u):p>=t?r.push(u):p>=o?s.push(u):l.push(u)}return new Map([["today",{section:"today",label:MOe.today,sessions:n}],["yesterday",{section:"yesterday",label:MOe.yesterday,sessions:r}],["week",{section:"week",label:MOe.week,sessions:s}],["older",{section:"older",label:MOe.older,sessions:l}],["archived",{section:"archived",label:MOe.archived,sessions:c}]])}function qTi(a){let i=Date.now(),e=new Date(i).setHours(0,0,0,0),t=e-H1t,o=t-H1t;return a<e&&a>=t?d(5745,null):a<t&&a>=o?d(5744,null):Bs(a,!1)}var U1t=class{getId(i){return hw(i)?`section-${i.section}`:gR(i)?i.resource.toString():"agent-sessions-id"}getGroupId(i){return hw(i)||OMt(i)?mae:1}},z1t=class{isIncompressible(i){return!0}},zte=class{constructor(i){this.options=i}compare(i,e){let t=i.status===3,o=e.status===3;if(t&&!o)return-1;if(!t&&o)return 1;let n=i.isArchived(),r=e.isArchived();if(!n&&r)return-1;if(n&&!r)return 1;let s=this.options?.overrideCompare?.(i,e);if(typeof s=="number")return s;let l=Bj(i.timing);return Bj(e.timing)-l}},K1t=class{getKeyboardNavigationLabel(i){return hw(i),i.label}getCompressedNodeKeyboardNavigationLabel(i){}},POe=class extends C{constructor(e){super();this.instantiationService=e}onDragStart(e,t){let o=e.getData().filter(r=>gR(r)),n=si(o.map(r=>r.resource));this.instantiationService.invokeFunction(r=>Ig(r,n,t))}getDragURI(e){return hw(e)?null:e.resource.toString()}getDragLabel(e,t){let o=e.filter(n=>gR(n));return o.length===1?o[0].label:d(5729,null,o.length)}onDragOver(e,t,o,n,r){return!1}drop(e,t,o,n,r){}};POe=I([m(0,F)],POe);var jTi={iconClass:q.asClassName(M.archive),tooltip:d(5716,null)},QTi={iconClass:q.asClassName(M.inbox),tooltip:d(5720,null)},G1t={iconClass:q.asClassName(M.edit),tooltip:d(5719,null)},$1t={iconClass:q.asClassName(M.trash),tooltip:d(5718,null)};function YTi(a){let i=typeof a.description=="string"?a.description:a.description?qa(a.description):void 0,e=qTi(Bj(a.timing));return[i,a.providerLabel,e].filter(o=>!!o).join(" \u2022 ")}function XTi(a){let i=[];return VTe(a)&&(i.push(G1t),i.push($1t)),i.push(a.isArchived()?QTi:jTi),i}var P2=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 zte}async pickAgentSession(){let i=new P,e=i.add(this.quickInputService.createQuickPick({useSeparators:!0})),t=i.add(this.instantiationService.createInstance(f0,{}));e.anchor=this.anchor,e.items=this.createPickerItems(t),e.canAcceptInBackground=!0,e.placeholder=d(5717,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(UB,n.session,r)}o.inBackground||e.hide()})),i.add(e.onDidTriggerItemButton(async o=>{let n=o.item.session,r=!1;if(o.button===G1t)r=!0,await this.commandService.executeCommand(lke,n);else if(o.button===$1t)r=!0,await this.commandService.executeCommand(cke,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=uot(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=YTi(i),t=XTi(i);return{id:i.resource.toString(),label:i.label,tooltip:i.tooltip,description:e,iconClass:q.asClassName(i.icon),buttons:t,session:i}}};P2=I([m(2,ia),m(3,Ge),m(4,F),m(5,ge)],P2);var Kte=L(5678,"Chat Agent Sessions"),q1t=class extends K{constructor(){super({id:"workbench.action.chat.toggleShowAgentSessions",title:L(5677,"Show Sessions"),toggled:x.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)}},ZTi=new D("chatAgentSessionsOrientationSubmenu");fe.appendMenuItem(D.ChatWelcomeContext,{submenu:ZTi,title:L(5674,"Sessions Orientation"),group:"0_sessions",order:1,when:ie.inChatEditor.negate()});var j1t=class extends K{constructor(){super({id:"workbench.action.chat.setAgentSessionsOrientationStacked",title:L(5676,"Stacked"),toggled:x.equals("config.chat.viewSessions.orientation","stacked"),precondition:x.equals("config.chat.viewSessions.enabled",!0),menu:{id:ZTi,group:"navigation",order:2}})}async run(i){await i.get(ge).executeCommand(A2.ID)}},Q1t=class extends K{constructor(){super({id:"workbench.action.chat.setAgentSessionsOrientationSideBySide",title:L(5675,"Side by Side"),toggled:x.notEquals("config.chat.viewSessions.orientation","stacked"),precondition:x.equals("config.chat.viewSessions.enabled",!0),menu:{id:ZTi,group:"navigation",order:1}})}async run(i){await i.get(ge).executeCommand(wD.ID)}},Y1t=class extends K{constructor(){super({id:"workbench.action.chat.history",title:L(5656,"Open Agent Session..."),menu:[{id:D.ViewTitle,when:x.and(x.equals("view",Vr),x.equals("config.chat.viewSessions.enabled",!1)),group:"navigation",order:2},{id:D.EditorTitle,when:fr.isEqualTo(Va.EditorID)}],category:Kte,icon:M.history,f1:!0,precondition:ie.enabled})}async run(i){await i.get(F).createInstance(P2,void 0,void 0).pickAgentSession()}},X1t=class extends K{constructor(){super({id:"workbench.action.chat.archiveAllAgentSessions",title:L(5658,"Archive All Workspace Agent Sessions"),precondition:ie.enabled,category:Kte,f1:!0})}async run(i){let e=i.get(ia),t=i.get(ct),o=e.model.sessions.filter(r=>!r.isArchived());if(!(o.length===0||!(await t.confirm({message:o.length===1?d(5661,null):d(5660,null,o.length),detail:d(5662,null),primaryButton:d(5659,null)})).confirmed))for(let r of o)r.setArchived(!0)}},J1t=class extends K{constructor(){super({id:"workbench.action.chat.markAllAgentSessionsRead",title:L(5691,"Mark All as Read"),precondition:ie.enabled,category:Kte,f1:!0,menu:{id:D.AgentSessionsContext,group:"0_read",order:2,when:ie.isArchivedAgentSession.negate()}})}async run(i){let t=i.get(ia).model.sessions.filter(o=>!o.isArchived()&&!o.isRead());if(t.length!==0)for(let o of t)o.setRead(!0)}},Z1t="chat.sessions.confirmArchive",ezt=class extends K{constructor(){super({id:"agentSessionSection.archive",title:L(5663,"Archive All"),icon:M.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||!hw(e))return;let t=i.get(ct),o=i.get(le);if(!o.getBoolean(Z1t,0,!1)){let r=await t.confirm({message:e.sessions.length===1?d(5666,null,e.label):d(5665,null,e.sessions.length,e.label),detail:d(5667,null),primaryButton:d(5664,null),checkbox:{label:d(5688,null)}});if(!r.confirmed)return;r.checkboxChecked&&o.store(Z1t,!0,0,0)}for(let r of e.sessions)r.setArchived(!0)}},tzt=class extends K{constructor(){super({id:"agentSessionSection.unarchive",title:L(5701,"Unarchive All"),icon:M.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||!hw(e))return;let t=i.get(ct),o=i.get(le);if(!o.getBoolean(Z1t,0,!1)){let r=await t.confirm({message:e.sessions.length===1?d(5703,null):d(5702,null,e.sessions.length),primaryButton:d(5704,null),checkbox:{label:d(5688,null)}});if(!r.confirmed)return;r.checkboxChecked&&o.store(Z1t,!0,0,0)}for(let r of e.sessions)r.setArchived(!1)}},izt=class extends K{constructor(){super({id:"agentSessionSection.markRead",title:L(5693,"Mark All as Read"),menu:[{id:D.AgentSessionSectionContext,group:"1_edit",order:1,when:ie.agentSessionSection.notEqualsTo("archived")}]})}async run(i,e){if(!(!e||!hw(e)))for(let t of e.sessions)t.setRead(!0)}},l8=class extends K{async run(i,e){let t=i.get(ia),o=i.get(Ft),n=[];if(FMt(e)?n=si((e.sessions??[e.session]).map(r=>t.getSession(r.resource))):e&&(n=[e]),n.length===0){let s=o.getActiveViewWithId(Vr)?.getFocusedSessions().at(0);s&&(n=[s])}n.length>0&&await this.runWithSessions(n,i)}},ozt=class extends l8{constructor(){super({id:"agentSession.markUnread",title:L(5694,"Mark as Unread"),menu:{id:D.AgentSessionsContext,group:"0_read",order:1,when:x.and(ie.isReadAgentSession,ie.isArchivedAgentSession.negate())}})}runWithSessions(i){for(let e of i)e.setRead(!1)}},nzt=class extends l8{constructor(){super({id:"agentSession.markRead",title:L(5692,"Mark as Read"),menu:{id:D.AgentSessionsContext,group:"0_read",order:1,when:x.and(ie.isReadAgentSession.negate(),ie.isArchivedAgentSession.negate())}})}runWithSessions(i){for(let e of i)e.setRead(!0)}},rzt=class extends l8{constructor(){super({id:"agentSession.archive",title:L(5657,"Archive"),icon:M.archive,keybinding:{primary:20,mac:{primary:2049},weight:201,when:x.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(Si),o=e.get(ct),n=e.get(Vt);for(let r of i){if(!n.isSessionsWindow){let s=t.getSession(r.resource);if(s&&!await FQe(s,o,{isArchiveAction:!0,titleOverride:d(5668,null),messageOverride:d(5669,null)}))return}r.setArchived(!0)}}},szt=class extends l8{constructor(){super({id:"agentSession.unarchive",title:L(5700,"Unarchive"),icon:M.unarchive,keybinding:{primary:1044,mac:{primary:3073},weight:201,when:x.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)}},azt=class extends l8{constructor(){super({id:lke,title:L(5697,"Rename..."),precondition:ie.hasMultipleAgentSessionsSelected.negate(),keybinding:{primary:60,mac:{primary:3},weight:201,when:x.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(Ge),n=e.get(Si),r=await o.input({prompt:d(5695,null),value:t.label});r&&n.setChatSessionTitle(t.resource,r)}},lzt=class extends l8{constructor(){super({id:cke,title:L(5679,"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(Si),o=e.get(ct),n=e.get(At);if((await o.confirm({message:i.length===1?d(5684,null):d(5687,null,i.length),detail:d(5686,null),primaryButton:d(5685,null)})).confirmed)for(let s of i)await n.getWidgetBySessionResource(s.resource)?.clear(),await t.removeHistoryEntry(s.resource)}},czt=class extends K{constructor(){super({id:"workbench.action.chat.clearHistory",title:L(5655,"Delete All Local Workspace Chat Sessions"),precondition:ie.enabled,category:Kte,f1:!0})}async run(i,...e){let t=i.get(Si),o=i.get(At),n=i.get(ct),s=i.get(ia).model.sessions.filter(c=>VTe(c)).length;s===0||!(await n.confirm({message:s===1?d(5682,null):d(5681,null,s),detail:d(5683,null),primaryButton:d(5680,null)})).confirmed||(await Promise.all(o.getAllWidgets().map(c=>c.clear())),await t.clearAllHistoryEntries())}},pot=class extends l8{async runWithSessions(i,e){let t=e.get(At),o=this.getTargetGroup();for(let n of i){let r=n.resource;await t.openSession(r,o,{...this.getOptions(),pinned:!0})}}},dzt=class a extends pot{static{this.id="workbench.action.chat.openSessionInEditorGroup"}constructor(){super({id:a.id,title:L(5671,"Open as Editor"),keybinding:{primary:2051,mac:{primary:259},weight:201,when:x.and(ie.agentSessionsViewerFocused,$p.negate())},menu:{id:D.AgentSessionsContext,when:$p.negate(),order:1,group:"navigation"}})}getTargetGroup(){return Un}getOptions(){return{}}},uzt=class a extends pot{static{this.id="workbench.action.chat.openSessionInNewEditorGroup"}constructor(){super({id:a.id,title:L(5672,"Open to the Side"),keybinding:{primary:2563,mac:{primary:771},weight:201,when:x.and(ie.agentSessionsViewerFocused,$p.negate())},menu:{id:D.AgentSessionsContext,when:$p.negate(),order:2,group:"navigation"}})}getTargetGroup(){return vn}getOptions(){return{}}},pzt=class a extends pot{static{this.id="workbench.action.chat.openSessionInNewWindow"}constructor(){super({id:a.id,title:L(5673,"Open in New Window"),menu:{id:D.AgentSessionsContext,order:3,group:"navigation"}})}getTargetGroup(){return hg}getOptions(){return{auxiliary:{compact:!0,bounds:{width:800,height:640}}}}},mzt=class extends K{constructor(){super({id:"agentSessionsViewer.refresh",title:L(5696,"Refresh Agent Sessions"),icon:M.refresh,menu:{id:D.AgentSessionsToolbar,group:"navigation",order:1}})}run(i,e){e.refresh()}},hzt=class extends K{constructor(){super({id:"agentSessionsViewer.find",title:L(5689,"Find Agent Session"),icon:M.search,menu:{id:D.AgentSessionsToolbar,group:"navigation",order:2}})}run(i,e){return e.openFind()}},gzt=class extends K{async run(i){let e=i.get(fi),t=i.get(Ri),o=i.get(B),n=i.get(Ft),r=i.get(ds),s=t.getViewLocationById(Vr);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(Vr);if(p||(p=await n.openView(Vr,!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 N=e.getSize(b);s===2&&f===2&&N.width<k&&e.setAuxiliaryBarMaximized(!0)}},wD=class a extends gzt{static{this.ID="agentSessions.showAgentSessionsSidebar"}static{this.TITLE=L(5698,"Show Agent Sessions Sidebar")}constructor(){super({id:a.ID,title:a.TITLE,precondition:x.and(ie.enabled,ie.agentSessionsViewerOrientation.isEqualTo(1)),f1:!0,category:Kte})}getOrientation(){return 2}},A2=class a extends gzt{static{this.ID="agentSessions.hideAgentSessionsSidebar"}static{this.TITLE=L(5690,"Hide Agent Sessions Sidebar")}constructor(){super({id:a.ID,title:a.TITLE,precondition:x.and(ie.enabled,ie.agentSessionsViewerOrientation.isEqualTo(2)),f1:!0,category:Kte})}getOrientation(){return 1}},fzt=class a extends K{static{this.ID="agentSessions.toggleAgentSessionsSidebar"}static{this.TITLE=L(5699,"Toggle Agent Sessions Sidebar")}constructor(){super({id:a.ID,title:a.TITLE,precondition:ie.enabled,f1:!0,category:Kte})}async run(i){let e=i.get(ge);i.get(Ft).getActiveViewWithId(Vr)?.getSessionsViewerOrientation()===2?await e.executeCommand(A2.ID):await e.executeCommand(wD.ID)}},N2=class a extends K{static{this.id="workbench.action.chat.focusAgentSessionsViewer"}constructor(){super({id:a.id,title:L(5670,"Focus Agent Sessions"),precondition:x.and(ie.enabled,x.equals("config.chat.viewSessions.enabled",!0)),category:Kte,f1:!0})}async run(i){let e=i.get(Ft),t=i.get(B),o=i.get(ge),n=await e.openView(Vr,!0);if(n?.focusSessions())return;t.getValue("chat.viewSessions.orientation")==="stacked"?await o.executeCommand(im):await o.executeCommand(wD.ID),n?.focusSessions()}};var vzt=class{constructor(){this.priority=107;this.name="panelChat";this.type="help";this.when=x.and(ie.location.isEqualTo("panel"),ie.inQuickChat.negate(),ie.chatModeKind.isEqualTo("ask"),x.or(ie.inChatSession,ie.isResponse,ie.isRequest))}getProvider(i){return yzt(i,void 0,"panelChat")}},bzt=class{constructor(){this.priority=107;this.name="quickChat";this.type="help";this.when=x.and(ie.inQuickChat,x.or(ie.inChatSession,ie.isResponse,ie.isRequest))}getProvider(i){return yzt(i,void 0,"quickChat")}},Szt=class{constructor(){this.priority=119;this.name="editsView";this.type="help";this.when=x.and(Idi.inEditingMode,ie.inChatInput)}getProvider(i){return yzt(i,void 0,"editsView")}},Izt=class{constructor(){this.priority=120;this.name="agentView";this.type="help";this.when=x.and(ie.chatModeKind.isEqualTo("agent"),ie.inChatInput)}getProvider(i){return yzt(i,void 0,"agentView")}};function FZo(a,i){let e=[];return(a==="panelChat"||a==="quickChat"||a==="agentView")&&(a==="quickChat"?(e.push(d(5321,null)),e.push(d(5313,null))):(e.push(d(5312,null)),e.push(d(5363,null,"<keybinding:workbench.action.chat.newChat>")),e.push(d(5362,null,"<keybinding:workbench.action.chat.history>")),e.push(d(5359,null,`<keybinding:${N2.id}>`))),e.push(d(5324,null)),e.push(d(5311,null)),e.push(d(5318,null,"<keybinding:editor.action.accessibleView>")),e.push(d(5319,null)),e.push(d(5358,null,e_i(i,a,"last"))),e.push(d(5361,null,e_i(i,a,"lastFocused"))),e.push(d(5360,null,e_i(i,a,"input"))),e.push(d(5323,null)),e.push(d(5310,null)),e.push(d(5364,null,"<keybinding:workbench.action.chat.nextCodeBlock>")),e.push(d(5365,null,"<keybinding:workbench.action.chat.nextUserPrompt>")),e.push(d(5366,null,"<keybinding:workbench.action.chat.previousUserPrompt>")),e.push(d(5356,null,"<keybinding:workbench.action.chat.focusConfirmation>")),e.push(d(5325,null,"<keybinding:workbench.action.terminal.chat.viewHiddenChatTerminals>")),e.push(d(5314,null,`<keybinding:${lw.FocusMostRecentChatTerminal}>`)),e.push(d(5315,null,`<keybinding:${lw.FocusMostRecentChatTerminalOutput}>`)),e.push(d(5316,null,"<keybinding:workbench.action.chat.focusQuestionCarousel>")),e.push(d(5322,null,"<keybinding:workbench.action.chat.previousQuestion>")),e.push(d(5320,null,"<keybinding:workbench.action.chat.nextQuestion>")),e.push(d(5317,null,"<keybinding:workbench.action.chat.focusTip>"))),a==="editsView"||a==="agentView"?(a==="agentView"?e.push(d(5331,null)):e.push(d(5342,null)),e.push(d(5339,null)),e.push(d(5338,null)),e.push(d(5344,null)),e.push(d(5346,null,"<keybinding:chatEditor.action.navigatePrevious>","<keybinding:chatEditor.action.navigateNext>")),e.push(d(5336,null,"<keybinding:chatEditor.action.acceptHunk>","<keybinding:chatEditor.action.undoHunk>","<keybinding:chatEditor.action.toggleDiff>")),e.push(d(5347,null)),a==="agentView"&&(e.push(d(5333,null)),e.push(d(5332,null,"<keybinding:workbench.action.chat.acceptTool>")),e.push(d(5328,null,"chat.tools.global.autoApprove","true")),e.push(d(5327,null,"<keybinding:workbench.action.chat.acceptTool>")),e.push(d(5330,null)),e.push(d(5329,null,"<keybinding:workbench.action.chat.focusTodosView>"))),e.push(d(5340,null)),e.push(d(5368,null,"<keybinding:workbench.action.chat.undoEdits>")),e.push(d(5367,null,"<keybinding:workbench.action.chat.restoreLastCheckpoint>")),e.push(d(5357,null,"<keybinding:workbench.action.chat.editing.attachFiles>")),e.push(d(5343,null,"<keybinding:chatEditing.removeFileFromWorkingSet>")),e.push(d(5335,null,"<keybinding:chatEditing.acceptFile>","<keybinding:chatEditing.discardFile>")),e.push(d(5345,null,"<keybinding:chatEditing.saveAllFiles>")),e.push(d(5334,null,"<keybinding:chatEditing.acceptAllFiles>")),e.push(d(5337,null,"<keybinding:chatEditing.discardAllFiles>")),e.push(d(5341,null,"<keybinding:chatEditing.openFileInDiff>")),e.push(`- ${Pme.LABEL}<keybinding:chatEditing.viewChanges>`),e.push(`- ${Ame.Label}<keybinding:chatEditing.viewPreviousEdits>`)):(e.push(d(5353,null)),e.push(d(5348,null,"<keybinding:inlineChat.start>")),e.push(d(5354,null,"<keybinding:history.showPrevious>","<keybinding:history.showNext>")),e.push(d(5352,null,"<keybinding:editor.action.accessibleView>")),e.push(d(5349,null)),e.push(d(5351,null)),e.push(d(5350,null,S1.id)),e.push(d(5355,null))),e.push(d(5326,null)),e.join(`
`)}function yzt(a,i,e){let t=a.get(At),o=a.get(_e),n=t.lastFocusedWidget?.inputEditor;if(!n||!(n.getDomNode()??void 0))return;let s=n.getPosition();n.getSupportedActions();let l=FZo(e,o);return new tp(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(NVt)?.focus()},e==="inlineChat"?"accessibility.verbosity.inlineChat":"accessibility.verbosity.panelChat")}function e_i(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 AOe=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=tfo(this.editorService);if(e)await this.handleTextEditor(e,i);else{let t=t_i(this.editorService);t?await this.handleNotebookEditor(t,i):this.notify(d(5602,null))}if(Vi(i.element)){let t=i.element.requestId,o=i.element.session.getItems().find(r=>r.id===t&&Rr(r));efo(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:zy.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(5604,null)),!1;let t=i.getFocus(),o=Math.max(t.end-1,0);return SB(this.languageService,i,o,2,"below",e.code,!0),!0}async handleTextEditor(i,e){let t=i.getModel();if(ifo(t,this.textFileService))return this.notify(d(5603,null)),!1;let o=i.getSelection()??new z(t.getLineCount(),1,t.getLineCount(),1),n=WZo(e.code,t,o.startLineNumber),r=[new ja(t.uri,{range:o,text:n})];return await this.bulkEditService.apply(r),this.codeEditorService.listCodeEditors().find(s=>s.getModel()?.uri.toString()===t.uri.toString())?.focus(),!0}notify(i){this.dialogService.info(i)}};AOe=I([m(0,ee),m(1,Ho),m(2,ma),m(3,Kt),m(4,Si),m(5,kt),m(6,ct),m(7,rS)],AOe);var NOe=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=tfo(this.editorService),t=await this.evaluateURIToUse(i.codemapperUri,e);if(!t)return;if(t&&!Xe(e?.getModel().uri,t)&&!this.notebookService.hasSupportedNotebooks(t))try{let r=await this.editorService.openEditor({resource:t}),s=ca(r?.getControl());if(s&&s.hasModel())this.tryToRevealCodeBlock(s,i.code),e=s;else{this.notify(d(5594,null,t.toString()));return}}catch(r){this.logService.info("[ApplyCodeBlockOperation] error opening code mapper file",t,r);return}let o;if(Vi(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=t_i(this.editorService);r?n=await this.handleNotebookEditor(r,i.chatSessionResource,i.code):this.notify(d(5596,null))}if(Vi(i.element)){let r=i.element.requestId,s=i.element.session.getItems().find(l=>l.id===r&&Rr(l));efo(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(5592,null,this.labelService.getUriLabel(e.getModel().uri,{relative:!0})),id:"activeEditor"}:void 0,o={label:d(5605,null),id:"newUntitledFile"},n=[];i?(n.push({label:d(5601,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(5606,null)}):n[0];if(r)switch(r.id){case"createFile":if(i)try{await this.fileService.writeFile(i,Je.fromString(""))}catch(s){return this.notify(d(5595,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(5600,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(5597,null));return}let s=!1,l=new $e;try{let c=await this.progressService.withProgress({location:15,delay:500,sticky:!0,cancellable:!0},async u=>{u.report({message:d(5598,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){so(c)||this.notify(d(5593,null,c.message))}finally{l.dispose()}return{editsProposed:s,codeMapper:r}}async handleTextEditor(i,e,t,o){let n=i.getModel();if(ifo(n,this.textFileService)){this.notify(d(5599,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(5597,null));return}let l=!1,c=new $e;try{let u=await this.progressService.withProgress({location:15,delay:500,sticky:!0,cancellable:!0},async p=>{p.report({message:d(5598,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){so(u)||this.notify(d(5593,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(cUt,e,i,t.token,o)}async applyNotebookEditsWithInlinePreview(i,e,t){return this.instantiationService.invokeFunction(Rmo,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)}};NOe=I([m(0,ee),m(1,Ho),m(2,Si),m(3,be),m(4,ct),m(5,ne),m(6,NY),m(7,Bo),m(8,Ge),m(9,ot),m(10,F),m(11,un)],NOe);function efo(a,i,e){Vi(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 t_i(a){let i=a.activeEditorPane;if(i?.getId()===qL){let e=i.getControl();if(e.hasModel())return e}}function tfo(a){let i=t_i(a)?.activeCodeEditor;if(i&&i.hasTextFocus()&&i.hasModel())return i;let e=ca(a.activeTextEditorControl);if(!e){for(let t of a.visibleTextEditorControls)if(e=ca(t),e)break}if(!(!e||!e.hasModel()))return e}function ifo(a,i){return!!(i.files.get(a.uri)??i.untitled.get(a.uri))?.isReadonly()}function WZo(a,i,e){let t=mc(a);if(t.length===0)return a;let o=i.getFormattingOptions(),n=Zgo(i.getLineContent(e),o.tabSize).level,r=t.map(c=>Zgo(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 Zgo(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 wzt=["fish","ps1","pwsh","powershell","sh","shellscript","zsh"];function Czt(a){return typeof a=="object"&&a!==null&&"code"in a&&"element"in a}function VZo(a){return typeof a=="object"&&a!==null&&"element"in a&&"diffEditor"in a&&"toggleDiffViewMode"in a}function i_i(a){return Vi(a.element)&&a.element.errorDetails?.responseIsFiltered}var OOe=class extends K{run(i,...e){let t=e[0];if(!Czt(t)){let o=i.get(Kt),n=o.getFocusedCodeEditor()||o.getActiveCodeEditor();if(!n||(t=rfo(n,i),!Czt(t)))return}return this.runWithContext(i,t)}},ofo="workbench.action.chat.applyInEditor",Ahe=class extends C{static{this.ID="chat.codeBlockActionRendering"}constructor(i,e,t){super();let o=i.register(D.ChatCodeBlock,ofo,(n,r)=>{if(n instanceof Eo)return e.createInstance(class extends ml{getTooltip(){let s=this._context;if(Czt(s)&&s.codemapperUri){let l=t.getUriLabel(s.codemapperUri,{relative:!0});return d(5430,null,l)}return super.getTooltip()}setActionContext(s){super.setActionContext(s),this.updateTooltip()}},n,void 0)});Mp(o)}};Ahe=I([m(0,Yy),m(1,F),m(2,ot)],Ahe);function nfo(){W(class extends K{constructor(){super({id:"workbench.action.chat.copyCodeBlock",title:L(5435,"Copy"),f1:!1,category:vi,icon:M.copy,menu:{id:D.ChatCodeBlock,group:"navigation",order:30}})}run(e,...t){let o=t[0];if(!Czt(o)||i_i(o))return;let n=e.get(Wi),r=e.get(rS);if(n.writeText(o.code),Vi(o.element)){let s=e.get(Si),l=o.element.requestId,c=o.element.session.getItems().find(p=>p.id===l&&Rr(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:zy.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})}}}),$M?.addImplementation(5e4,"chat-codeblock",i=>{let e=i.get(Kt).getFocusedCodeEditor();if(!e)return!1;let t=e.getModel();if(!t)return!1;let o=rfo(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(Si),c=i.get(rS),u=o.element;if(Vi(u)){let p=u.requestId,h=u.session.getItems().find(f=>f.id===p&&Rr(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:zy.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(Wi).writeText(o.code),!0):!1}),W(class extends OOe{constructor(){super({id:ofo,title:L(5429,"Apply in Editor"),precondition:ie.enabled,f1:!1,category:vi,icon:M.gitPullRequestGoToChanges,menu:[{id:D.ChatCodeBlock,group:"navigation",when:x.and(...wzt.map(e=>x.notEquals(ue.languageId.key,e))),order:10},{id:D.ChatCodeBlock,when:x.or(...wzt.map(e=>x.equals(ue.languageId.key,e)))}],keybinding:{when:x.or(x.and(ie.inChatSession,ie.inChatInput.negate()),lTe),primary:2051,mac:{primary:259},weight:401}})}runWithContext(e,t){return this.operation||(this.operation=e.get(F).createInstance(NOe)),this.operation.run(t)}}),W(class extends OOe{constructor(){super({id:"workbench.action.chat.insertCodeBlock",title:L(5436,"Insert At Cursor"),precondition:ie.enabled,f1:!0,category:vi,icon:M.insert,menu:[{id:D.ChatCodeBlock,group:"navigation",when:x.and(ie.inChatSession,ie.location.notEqualsTo("terminal")),order:20},{id:D.ChatCodeBlock,group:"navigation",when:x.and(ie.inChatSession,ie.location.isEqualTo("terminal")),isHiddenByDefault:!0,order:20}],keybinding:{when:x.or(x.and(ie.inChatSession,ie.inChatInput.negate()),lTe),primary:2051,mac:{primary:259},weight:401}})}runWithContext(e,t){return e.get(F).createInstance(AOe).run(t)}}),W(class extends OOe{constructor(){super({id:"workbench.action.chat.insertIntoNewFile",title:L(5437,"Insert into New File"),precondition:ie.enabled,f1:!0,category:vi,icon:M.newFile,menu:{id:D.ChatCodeBlock,group:"navigation",isHiddenByDefault:!0,order:40}})}async runWithContext(e,t){if(i_i(t))return;let o=e.get(ee),n=e.get(Si),r=e.get(rS);if(o.openEditor({contents:t.code,languageId:t.languageId,resource:void 0}),Vi(t.element)){let s=t.element.requestId,l=t.element.session.getItems().find(u=>u.id===s&&Rr(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:zy.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 OOe{constructor(){super({id:"workbench.action.chat.runInTerminal",title:L(5440,"Insert into Terminal"),precondition:ie.enabled,f1:!0,category:vi,icon:M.terminal,menu:[{id:D.ChatCodeBlock,group:"navigation",when:x.and(ie.inChatSession,x.or(...wzt.map(e=>x.equals(ue.languageId.key,e))))},{id:D.ChatCodeBlock,group:"navigation",isHiddenByDefault:!0,when:x.and(ie.inChatSession,...wzt.map(e=>x.notEquals(ue.languageId.key,e)))}],keybinding:[{primary:2563,mac:{primary:771},weight:100,when:x.or(ie.inChatSession,lTe)}]})}async runWithContext(e,t){if(i_i(t))return;let o=e.get(Si),n=e.get(Yo),r=e.get(ee),s=e.get(xv),l=e.get(jl),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),Vi(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(Kt),n=i.get(At).lastFocusedWidget;if(!n)return;let s=t.getFocusedCodeEditor()?.getModel()?.uri,l=s?n.getCodeBlockInfoForEditor(s):void 0,c=!n.inputEditor.hasWidgetFocus()&&n.getFocus(),u=Vi(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=>Vi(b));if(!g||!Vi(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(5438,"Next Code Block"),keybinding:{primary:2572,mac:{primary:2572},weight:200,when:ie.inChatSession},precondition:ie.enabled,f1:!0,category:vi})}run(e,...t){a(e)}}),W(class extends K{constructor(){super({id:"workbench.action.chat.previousCodeBlock",title:L(5439,"Previous Code Block"),keybinding:{primary:2571,mac:{primary:2571},weight:200,when:ie.inChatSession},precondition:ie.enabled,f1:!0,category:vi})}run(e,...t){a(e,!0)}})}function rfo(a,i){let e=i.get(At),t=i.get(LY),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 sfo(){class a extends K{run(e,...t){let o=t[0];if(VZo(o))return this.runWithContext(e,o)}}W(class extends a{constructor(){super({id:"workbench.action.chat.applyCompareEdits",title:L(5431,"Apply Edits"),f1:!1,category:vi,icon:M.gitPullRequestGoToChanges,precondition:x.and(ue.hasChanges,ie.editApplied.negate(),ue.readOnly.negate()),menu:{id:D.ChatCompareBlock,group:"navigation",order:10,when:ue.readOnly.negate()}})}async runWithContext(e,t){let o=e.get(F),n=e.get(Kt),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(cUt,u,c,ve.None,void 0),s.setEditApplied(r,1),!0):!1}}),W(class extends a{constructor(){super({id:"workbench.action.chat.discardCompareEdits",title:L(5432,"Discard Edits"),f1:!1,category:vi,icon:M.trash,precondition:x.and(ue.hasChanges,ie.editApplied.negate(),ue.readOnly.negate()),menu:{id:D.ChatCompareBlock,group:"navigation",order:11,when:ue.readOnly.negate()}})}async runWithContext(e,t){e.get(F).createInstance(vPe).discard(t.element,t.edit)}}),W(class extends a{constructor(){super({id:"workbench.action.chat.toggleCompareBlockDiffViewMode",title:L(5434,"Toggle Inline/Side-by-Side Diff"),f1:!1,category:vi,icon:M.diffSingle,toggled:{condition:ue.diffEditorInlineMode,icon:M.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(5433,"Open in Diff Editor"),f1:!1,category:vi,icon:M.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 Gte(a,i,e,t){let o=a.get(Ge),n=a.get(be),r=u=>{let p=u.trim();if(!p)return;let h=nBt(i);return p.endsWith(h)?p:`${p}${h}`},s=async u=>{let p=r(u);if(!p)return{content:d(6924,null),severity:gt.Warning};if(!nU(p))return{content:d(6926,null),severity:gt.Error};let h=A.joinPath(e,p);if(await n.exists(h))return{content:d(6925,null),severity:gt.Error}},l=t?HZo(i):BZo(i),c=await o.input({placeHolder:l,validateInput:s,value:t});if(c)return r(c)}function BZo(a){switch(a){case"instructions":return d(6923,null);case"prompt":return d(6927,null);case"agent":return d(6922,null);default:throw new Error("Unknown prompt type")}}function HZo(a){switch(a){case"instructions":return d(6929,null);case"prompt":return d(6930,null);case"agent":return d(6928,null);default:throw new Error("Unknown prompt type")}}async function c8(a,i,e,t=!1){let o=a.get(Ge),n=a.get(nr),r=a.get(ot),s=a.get(Pe),l=await n.getSourceFolders(i);if(l.length===0){await KZo(a,i);return}let c={placeHolder:e?zZo(i,t):UZo(i),canPickMany:!1,matchOnDescription:!0},u=l.map(h=>{let g=h.uri,f=e&&Xe(g,e)?d(6944,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(6941,null),detail:f,tooltip:r.getUriLabel(g),folder:h}}),p=await o.pick(u,c);if(p)return p.folder}function UZo(a){switch(a){case"instructions":return d(6953,null);case"prompt":return d(6954,null);case"agent":return d(6951,null);case"skill":return d(6955,null);case"hook":return d(6952,null);default:throw new Error("Unknown prompt type")}}function zZo(a,i){if(i)switch(a){case"instructions":return d(6946,null);case"prompt":return d(6948,null);case"agent":return d(6932,null);case"skill":return d(6950,null);case"hook":throw new Error("Hooks cannot be moved");default:throw new Error("Unknown prompt type")}switch(a){case"instructions":return d(6945,null);case"prompt":return d(6947,null);case"agent":return d(6931,null);case"skill":return d(6949,null);case"hook":throw new Error("Hooks cannot be copied");default:throw new Error("Unknown prompt type")}}async function KZo(a,i){let e=a.get(Ge),t=a.get(Qe),o={type:"item",label:GZo(i),description:RY,tooltip:RY,value:A.parse(RY)},n=await e.pick([o],{placeHolder:$Zo(i),canPickMany:!1});n&&await t.open(n.value)}function GZo(a){switch(a){case"prompt":return d(6939,null);case"instructions":return d(6937,null);case"agent":return d(6933,null);case"skill":return d(6942,null);case"hook":return d(6935,null);default:throw new Error("Unknown prompt type")}}function $Zo(a){switch(a){case"instructions":return d(6938,null);case"prompt":return d(6940,null);case"agent":return d(6934,null);case"skill":return d(6943,null);case"hook":return d(6936,null);default:throw new Error("Unknown prompt type")}}var mot=class extends K{constructor(e,t,o){super({id:e,title:t,f1:!1,precondition:ie.enabled,category:vi,keybinding:{weight:200},menu:{id:D.CommandPalette,when:ie.enabled}});this.type=o}async run(e,t){let o=e.get(ne),n=e.get(Qe),r=e.get(ge),s=e.get(Ne),l=e.get(_l),c=e.get(ee),u=e.get(be),p=e.get(F),h,g;if(t?.targetFolder)h=t.targetFolder,g=t.targetStorage??"local";else{let k=await p.invokeFunction(c8,this.type);if(!k)return;h=k.uri,g=k.storage}let f=await p.invokeFunction(Gte,this.type,h);if(!f)return;await u.createFolder(h);let v=A.joinPath(h,f);await u.createFile(v);let b=Tb(v),S;if(t?.openFile?S=await t.openFile(v):(await n.open(v),S=ca(c.activeTextEditorControl)),S&&S.hasModel()&&Xe(S.getModel().uri,v)&&Qr.get(S)?.apply([{range:S.getModel().getFullModelRange(),template:l_i(this.type,b,mD(this.type,v))}]),g!=="user")return;let y=l.isResourceEnablementConfigured("prompts"),w=l.isEnabled();y===!0||w===!1||s.prompt(St.Info,d(6921,null),[{label:d(6919,null),run:()=>{r.executeCommand(PXe).catch(k=>{o.error(`Failed to run '${PXe}' command: ${k}.`)})}},{label:d(6920,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 l_i(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 hot="workbench.command.new.prompt",got="workbench.command.new.instructions",fot="workbench.command.new.agent",vot="workbench.command.new.skill",o_i=class extends mot{constructor(){super(hot,d(6909,null),"prompt")}},n_i=class extends mot{constructor(){super(got,d(6908,null),"instructions")}},r_i=class extends mot{constructor(){super(fot,d(6907,null),"agent")}},s_i=class extends K{constructor(){super({id:vot,title:d(6910,null),f1:!1,precondition:ie.enabled,category:vi,keybinding:{weight:200},menu:{id:D.CommandPalette,when:ie.enabled}})}async run(i,e){let t=i.get(Qe),o=i.get(ee),n=i.get(be),r=i.get(F),s=i.get(Ge),l;if(e?.targetFolder)l=e.targetFolder;else{let f=await r.invokeFunction(c8,"skill");if(!f)return;l=f.uri}let c=await s.input({prompt:d(6915,null),placeHolder:d(6914,null),validateInput:async f=>{if(!f||!f.trim())return d(6916,null);let v=f.trim();if(v.length>64)return d(6917,null);if(!/^[a-z0-9-]+$/.test(v))return d(6913,null);if(v.startsWith("-")||v.endsWith("-"))return d(6912,null);if(v.includes("--"))return d(6911,null)}});if(!c)return;let u=c.trim(),p=A.joinPath(l,u);await n.createFolder(p);let h=A.joinPath(p,J4);await n.createFile(h);let g;e?.openFile?g=await e.openFile(h):(await t.open(h),g=ca(o.activeTextEditorControl)),g&&g.hasModel()&&Xe(g.getModel().uri,h)&&Qr.get(g)?.apply([{range:g.getModel().getFullModelRange(),template:l_i("skill",u,"undefined")}])}},a_i=class extends K{constructor(){super({id:"workbench.command.new.untitled.prompt",title:L(6918,"New Untitled Prompt File"),f1:!0,precondition:ie.enabled,category:vi,keybinding:{weight:200}})}async run(i){let e=i.get(ee),t=yYi("prompt"),o=await e.openEditor({resource:void 0,languageId:t,options:{pinned:!0}}),n="prompt",r=ca(e.activeTextEditorControl);return r&&r.hasModel()&&Qr.get(r)?.apply([{range:r.getModel().getFullModelRange(),template:l_i(n,void 0,"undefined")}]),o}};function afo(){W(o_i),W(n_i),W(r_i),W(s_i),W(a_i)}function d8(a){let i=q.asClassName(M.question);switch(a){case"prompt":return{tooltip:d(6971,null),helpURI:A.parse(RY),iconClass:i};case"instructions":return{tooltip:d(6970,null),helpURI:A.parse(mTt),iconClass:i};case"agent":return{tooltip:d(6968,null),helpURI:A.parse(U8e),iconClass:i};case"skill":return{tooltip:d(6972,null),helpURI:A.parse(hTt),iconClass:i};case"hook":return{tooltip:d(6969,null),helpURI:A.parse(gTt),iconClass:i}}}function qZo(a){return a.helpURI!==void 0}function lfo(a){return a.type==="item"&&!!a.promptFileUri}function jZo(a){return a.storage==="extension"&&!!a.extension}var QZo={type:"item",label:`$(plus) ${d(6963,null)}`,pickable:!1,alwaysShow:!0,buttons:[d8("prompt")],commandId:hot},YZo={type:"item",label:`$(plus) ${d(6962,null)}`,pickable:!1,alwaysShow:!0,buttons:[d8("instructions")],commandId:got},XZo={type:"item",label:`$(sparkle) ${d(6956,null)}`,pickable:!1,alwaysShow:!0,buttons:[d8("instructions")],commandId:s2},JZo={type:"item",label:`$(sparkle) ${d(6958,null)}`,pickable:!1,alwaysShow:!0,buttons:[d8("instructions")],commandId:pet},ZZo={type:"item",label:`$(plus) ${d(6961,null)}`,pickable:!1,alwaysShow:!0,buttons:[d8("agent")],commandId:fot},een={type:"item",label:`$(plus) ${d(6964,null)}`,pickable:!1,alwaysShow:!0,buttons:[d8("skill")],commandId:vot},ten={type:"item",label:`$(sparkle) ${d(6959,null)}`,pickable:!1,alwaysShow:!0,buttons:[d8("prompt")],commandId:r3},ien={type:"item",label:`$(sparkle) ${d(6960,null)}`,pickable:!1,alwaysShow:!0,buttons:[d8("skill")],commandId:s3},oen={type:"item",label:`$(sparkle) ${d(6957,null)}`,pickable:!1,alwaysShow:!0,buttons:[d8("agent")],commandId:a3},c_i={tooltip:d(6978,null),iconClass:q.asClassName(M.fileCode)},cfo={tooltip:d(6967,null),iconClass:q.asClassName(M.trash)},xzt={tooltip:d(6979,null),iconClass:q.asClassName(M.replace)},kzt={tooltip:d(6975,null),iconClass:q.asClassName(M.copy)},d_i={tooltip:d(6977,null),iconClass:q.asClassName(M.eyeClosed),alwaysVisible:!0},dfo={tooltip:d(6976,null),iconClass:q.asClassName(M.eye)},u_i={tooltip:d(6980,null),iconClass:q.asClassName(M.play)},DA=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 $e,t=this._quickInputService.createQuickPick({useSeparators:!0});t.busy=!0,t.placeholder=d(6981,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 P,r=!1,s=!1;n.add(t),n.add(e);let l=async()=>{let c=t.activeItems,u=await this._createPromptPickItems(i,ve.None);t.items=u,t.activeItems=c};n.add(t.onDidAccept(async()=>{let{selectedItems:c}=t,{keyMods:u}=t,p=c[0];if(lfo(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(u_i),i.optionEdit!==!1&&t.push(c_i),i.optionCopy!==!1&&t.push(kzt),i.optionRename!==!1&&t.push(xzt),i.optionDelete!==!1&&t.push(cfo);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(6986,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!==xzt);o.push({type:"separator",label:d(6987,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(jZo);if(c.length){let h=[];i.type==="prompt"&&i.optionRun!==!1&&h.push(u_i),i.optionEdit!==!1&&h.push(c_i),i.optionCopy!==!1&&h.push(kzt);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(6985,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(kzt),o.push({type:"separator",label:d(6984,null)}),o.push(...r(await Promise.all(p.map(g=>this._createPromptPickItem(g,h,n(g),e)))))}return o}_getExtensionGroupLabel(i){return wtt(i.uri,i.extension.identifier,this._productService)?d(6983,null):d(6982,null)}_getNewItems(i){switch(i){case"prompt":return[QZo,ten];case"instructions":return[YZo,JZo,XZo];case"agent":return[ZZo,oen];case"skill":return[een,ien];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??Tb(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:Hr(i)}let c;return t===!1?(e=(e??[]).concat(d_i),r=d(6974,null,r),l=d(6973,null)):t===!0&&(e=(e??[]).concat(dfo)),{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(!lfo(o)){if(qZo(n))return await this._openerService.open(n.helpURI),!1;throw new Error(`Unknown button '${JSON.stringify(n)}'.`)}let r=o.promptFileUri;if(n===u_i){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===c_i)return await this._openerService.open(r),!1;if(n===xzt||n===kzt)return await this.keepQuickPickOpen(i,async()=>{let s=ci(r),l=n===xzt&&i.keyMods.ctrlCmd,c=await this._instaService.invokeFunction(c8,t.type,s,l);if(!c)return!1;let u=await this._instaService.invokeFunction(Gte,t.type,c.uri,o.label);if(!u)return!1;let p=je(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(p2).openAndRewriteName(p,Tb(p),ve.None),!0});if(n===cfo)return await this.keepQuickPickOpen(i,async()=>{let s=t.type==="skill",l=s?Ye(ci(r)):o.label,c=s?d(6966,null,l):d(6965,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===d_i||n===dfo){let s=this._promptsService.getDisabledPromptFiles(t.type);return n===d_i?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 $e,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 P;s.add(o),s.add(t);let l=!1,c=!1,u=async()=>{let p=o.activeItems,h=await this._createPromptPickItems(n,ve.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()})}};DA=I([m(0,Ge),m(1,Qe),m(2,be),m(3,ct),m(4,ge),m(5,F),m(6,nr),m(7,ot),m(8,nt)],DA);var nen="workbench.action.chat.attach.instructions",Ezt="workbench.action.chat.configure.instructions",p_i=class extends K{constructor(){super({id:Ezt,title:L(6872,"Configure Instructions & Rules..."),shortTitle:L(6873,"Instructions & Rules"),icon:M.bookmark,f1:!0,precondition:ie.enabled,category:vi,menu:{id:fy,when:x.and(ie.enabled,x.equals("view",Vr)),order:10,group:"1_level"}})}async run(i){let e=i.get(Qe),o=i.get(F).createInstance(DA),n=d(6871,null),r=await o.selectPromptFile({placeholder:n,type:"instructions",optionEdit:!1});r!==void 0&&await e.open(r.promptFile)}};function ufo(){W(p_i)}var FOe=class{constructor(i){this.promptsService=i;this.type="pickerPick";this.label=d(6870,null);this.icon=M.bookmark;this.commandId=nen}isEnabled(i){return!!i.attachmentCapabilities.supportsInstructionAttachments}asPicker(){let i=this.promptsService.listPromptFiles("instructions",ve.None).then(e=>{let t=[];e=e.slice(0).sort((n,r)=>Al(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??Tb(n.uri),asAttachment:()=>mP(n.uri,"vscode.prompt.instructions.root")});return t});return{placeholder:d(6875,null),picks:i,configure:{label:d(6874,null),commandId:Ezt}}}};FOe=I([m(0,nr)],FOe);var Nhe=class extends C{static{this.ID="chat.contextContributions"}constructor(i,e,t,o,n,r){super();let s=ie.chatSessionHasAttachedDebugData.bindTo(o);this._store.add(r.onDidChangeFocusedSession(()=>{let l=r.lastFocusedWidget?.viewModel?.sessionResource;s.set(!!l&&t.hasAttachedDebugData(l)),n.flushToolUpdates()})),this._store.add(t.onDidAttachDebugData(l=>{let c=r.lastFocusedWidget?.viewModel?.sessionResource;c&&c.toString()===l.toString()&&(s.set(!0),n.flushToolUpdates())})),this._store.add(e.registerChatContextItem(i.createInstance(m_i))),this._store.add(e.registerChatContextItem(i.createInstance(FOe))),this._store.add(e.registerChatContextItem(i.createInstance(bot))),this._store.add(e.registerChatContextItem(i.createInstance(Sot))),this._store.add(e.registerChatContextItem(i.createInstance(Iot))),this._store.add(e.registerChatContextItem(i.createInstance(yot)))}};Nhe=I([m(0,F),m(1,uS),m(2,em),m(3,X),m(4,jn),m(5,At)],Nhe);var m_i=class{constructor(){this.type="pickerPick";this.label=d(5445,null);this.icon=M.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&&(Km(n)?e.push({toolInfo:Rn.classify(n.source),label:n.referenceName,description:n.description,asAttachment:()=>CTt(n)}):e.push({toolInfo:Rn.classify(n.source),label:n.toolReferenceName??n.displayName,description:n.userDescription??n.modelDescription,asAttachment:()=>Dce(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(5446,null),picks:Promise.resolve(o)}}},bot=class{constructor(i,e){this._editorService=i;this._labelService=e;this.type="valuePick";this.label=d(5444,null);this.icon=M.file;this.ordinal=800}isEnabled(){return this._editorService.editors.filter(i=>i instanceof hI||i instanceof Fa||i instanceof qm).length>0}async asAttachment(){let i=[];for(let e of this._editorService.editors){if(!(e instanceof hI||e instanceof Fa||e instanceof qm||e instanceof ha))continue;let t=no.getOriginalUri(e,{supportSideBySide:1});t&&i.push({kind:"file",id:t.toString(),value:t,name:this._labelService.getUriBasenameLabel(t)})}return i}};bot=I([m(0,ee),m(1,ot)],bot);var Sot=class{constructor(i){this._clipboardService=i;this.type="valuePick";this.label=d(5447,null);this.icon=M.fileMedia}async isEnabled(i){if(!i.attachmentCapabilities.supportsImageAttachments||!i.input.selectedLanguageModel.get()?.metadata.capabilities?.vision)return!1;let e=await this._clipboardService.readImage();return jZe(e)}async asAttachment(){let i=await this._clipboardService.readImage();return{id:await eee(i),name:d(5448,null),fullName:d(5448,null),value:i,kind:"image"}}};Sot=I([m(0,Wi)],Sot);var WOe=class{constructor(i,e){this._resource=i;this._terminalService=e;this.type="valuePick";this.icon=M.terminal;this.label=d(5449,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 P,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}};WOe=I([m(1,Yo)],WOe);var Iot=class{constructor(i){this._hostService=i;this.type="valuePick";this.icon=M.deviceCamera;this.label=Xut?d(5441,null):d(5442,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&&vBt(i)}};Iot=I([m(0,oi)],Iot);var yot=class{constructor(i){this._chatDebugService=i;this.type="valuePick";this.icon=M.output;this.label=d(5443,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 bNe(e,this._chatDebugService)}};yot=I([m(0,em)],yot);var VOe=class{constructor(i){this.options=i;this.rangeHighlightDecorationId=void 0}provide(i,e,t){let o=new P;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 P,n=this.activeTextEditorControl;if(n&&this.canProvideWithTextEditor(n)){let r={editor:n},s=ca(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(wd(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);Or(d(1493,null,e.range.startLineNumber,e.range.startColumn,o))}}getModel(i){return Ec(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:Ss(y9),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 CD=class extends VOe{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(1507,null)),C.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):C.None}doProvideWithoutEditorSymbols(e,t,o,n){let r=new P;return this.provideLabelPick(o,d(1508,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 Go,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 P;l.add(o.onDidAccept(h=>{let[g]=o.selectedItems;g&&g.range&&(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 $e,o.busy=!0;try{let g=uF(o.value.substr(CD.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=ju(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(1522,null)):this.provideLabelPick(o,d(1523,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(CD.SCOPE_PREFIX)===0,c=l?1:0,u,p;t.values&&t.values.length>1?(u=m_e(t.values[0]),p=m_e(t.values.slice(1))):u=t;let h,g=this.options?.openSideBySideDirection?.();g&&(h=[{iconClass:g==="right"?q.asClassName(M.splitHorizontal):q.asClassName(M.splitVertical),tooltip:g==="right"?d(1527,null):d(1526,null)}]);let f=[];for(let S=0;S<s.length;S++){let y=s[S],w=qD(y.name),k=`$(${sh.toIcon(y.kind).id}) ${w}`,T=k.length-w.length,N=y.containerName;o?.extraContainerLabel&&(N?N=`${o.extraContainerLabel} \u2022 ${N}`:N=o.extraContainerLabel);let O,V,U,G;if(t.original.length>c){let te=!1;if(u!==t&&([O,V]=dJ(k,{...t,values:void 0},c,T),typeof O=="number"&&(te=!0)),typeof O!="number"&&([O,V]=dJ(k,u,c,T),typeof O!="number"))continue;if(!te&&p){if(N&&p.original.length>0&&([U,G]=dJ(N,p)),typeof U!="number")continue;typeof O=="number"&&(O+=U)}}let $=y.tags&&y.tags.indexOf(1)>=0;f.push({index:S,kind:y.kind,score:O,label:k,ariaLabel:Oht(y.name,y.kind),description:N,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=id(g_i[S]||h_i,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(1533,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=g_i[e.kind]||h_i,n=g_i[t.kind]||h_i,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()}};CD=I([m(0,zt),m(1,f_)],CD);var h_i=d(1530,null),g_i={5:d(1519,null),11:d(1516,null),8:d(1504,null),12:d(1535,null),4:d(1509,null),22:d(1532,null),23:d(1513,null),24:d(1528,null),10:d(1517,null),2:d(1521,null),3:d(1529,null),25:d(1534,null),1:d(1520,null),6:d(1530,null),9:d(1511,null),21:d(1512,null),14:d(1531,null),0:d(1515,null),17:d(1505,null),15:d(1524,null),16:d(1506,null),18:d(1525,null),19:d(1518,null),7:d(1514,null),13:d(1510,null)};var Tzt=class{constructor(i,e,t,o){this.cacheQuery=i;this.loadFn=e;this.disposeFn=t;this.previousCacheState=o;if(this._cacheKey=fq.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});uo(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 _k=class extends CD{constructor(e,t,o,n,r){super(o,r,{openSideBySideDirection:()=>this.configuration.openSideBySideDirection});this.editorService=e;this.configurationService=t;this.outlineService=n;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(!MU(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,vn)}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),Pi(_k.SYMBOL_PICKS_TIMEOUT)])||r.isCancellationRequested?[]:this.doGetSymbolPicks(this.getDocumentSymbols(e,r),uF(t),o,r,e)}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 C.None;let o=new $e,n=new P;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(CD.PREFIX.length).trim(),v=IW(g.label),b=wL(f,f.toLowerCase(),0,v.text,v.text.toLowerCase(),0,{firstMatchCanBeWeak:!0,boostFullMatch:!0});return b?(g.score=b[1],g.highlights={label:gq(f,v)??void 0},!0):!1});if(h.length===0){let g=d(8324,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}};_k=I([m(0,ee),m(1,B),m(2,zt),m(3,kR),m(4,f_)],_k);var _zt=class a extends K{static{this.ID="workbench.action.gotoSymbol"}constructor(){super({id:a.ID,title:{...L(8325,"Go to Symbol in Editor..."),mnemonicTitle:d(8329,null)},f1:!0,keybinding:{when:x.and(ud.negate(),LC.negate()),weight:200,primary:3117},menu:[{id:D.MenubarGoMenu,group:"4_symbol_nav",order:1}]})}run(i){i.get(Ge).quickAccess.show(_k.PREFIX,{itemActivation:0})}};W(_zt);oe.as(Tu.Quickaccess).registerQuickAccessProvider({ctor:_k,prefix:CD.PREFIX,contextKey:"inFileSymbolsPicker",placeholder:d(8328,null),helpEntries:[{description:d(8327,null),prefix:CD.PREFIX,commandId:_zt.ID,commandCenterOrder:40},{description:d(8326,null),prefix:CD.PREFIX_BY_CATEGORY}]});var wot="workbench.action.quickchat.toggle";function pfo(){W(f_i),W(v_i),W(class extends K{constructor(){super({id:"workbench.action.quickchat.openInChatView",title:L(5553,"Open in Chat View"),f1:!1,category:vi,icon:M.chatSparkle,menu:{id:D.ChatInputSide,group:"navigation",order:10}})}run(i){i.get(M_).openInChatView()}}),W(class extends K{constructor(){super({id:"workbench.action.quickchat.close",title:L(5552,"Close Quick Chat"),f1:!1,category:vi,icon:M.close,menu:{id:D.ChatInputSide,group:"navigation",order:20}})}run(i){i.get(M_).close()}})}var f_i=class extends K{constructor(){super({id:wot,title:L(5555,"Open Quick Chat"),precondition:ie.enabled,icon:M.chatSparkle,f1:!1,category:vi,keybinding:{weight:200,primary:3626},menu:{id:D.ChatTitleBarMenu,group:"a_open",order:4},metadata:{description:d(5556,null),args:[{name:"args",schema:{anyOf:[{type:"object",required:["query"],properties:{query:{description:d(5558,null),type:"string"},isPartialQuery:{description:d(5557,null),type:"boolean"}}},{type:"string",description:d(5558,null)}]}}]}})}run(i,e){let t=i.get(M_),o;switch(typeof e){case"string":o={query:e};break;case"object":o=e;break}o?.query&&(o.selection=new Yt(1,o.query.length+1,1,o.query.length+1)),t.toggle(o)}},v_i=class extends K{constructor(){super({id:"workbench.action.openQuickChat",category:vi,title:L(5554,"Open Quick Chat"),precondition:ie.enabled,f1:!0})}run(i,e){i.get(M_).toggle(e?{query:e,selection:new Yt(1,e.length+1,1,e.length+1)}:void 0)}};function b_i(a){let i=a;return!!i?.range&&!!i.resource}var Ew=class extends yh{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N,O){super(Ew.PREFIX,{canAcceptInBackground:!0,noResultsPick:Ew.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=N;this.customEditorLabelService=O;this.labelOnlyEditorHistoryPickAccessor=new Yje({skipDescription:!0});this.fileQueryDelayer=this._register(new ya(Ew.TYPING_SEARCH_DELAY));this.lazyRegistry=new co(()=>oe.as(Tu.Quickaccess));this.pickState=this._register(new class extends C{constructor(U,G){super();this.provider=U;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(G.createInstance(oK))}set(U){this.picker=U,H.once(U.onDispose)(()=>{U===this.picker&&(this.picker=void 0)});let G=!!U.quickNavigate;G||(this.fileQueryCache=this.provider.createFileQueryCache(),this.scorerCache=Object.create(null)),this.isQuickNavigating=G,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(aS),this.workspaceSymbolsQuickAccess=this._register(e.createInstance(Tk)),this.editorSymbolsQuickAccess=this.instantiationService.createInstance(_k)}static{this.PREFIX=""}static{this.NO_RESULTS_PICK={label:d(13152,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 P;this.pickState.set(e);let r=n.add(new me);return n.add(e.onDidChangeActive(()=>{r.value=void 0;let[s]=e.activeItems;b_i(s)&&(r.value=this.decorateAndRevealSymbolRange(s))})),n.add(H.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 C.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))):C.None}_getPicks(e,t,o,n){let r=$Zi(e,[_k.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=b_i(u),h=u===Ew.NO_RESULTS_PICK&&s.indexOf(_k.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=uF(e);if(t.enableEditorSymbolSearch){let u=this.getEditorSymbolPicks(r,o,n);if(u)return u}let s=this.pickState.picker?.activeItems[0];if(b_i(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}=cJ(u,r,!0,r7,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(13155,null)}),c=l):(t.includeHelp&&c.push(...this.getHelpPicks(r,n,t)),l.length!==0&&(c.push({type:"separator",label:d(13155,null)}),c.push(...l))),{picks:t.filter?c.filter(u=>t.filter?.(u)):c,additionalPicks:(async()=>{let u=new vt(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(13148,null):d(13150,null)},...p]:[]})(),mergeDelay:Ew.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=aUi([...r,...s],(u,p)=>g7e(u,p,e,!0,r7,this.pickState.scorerCache),Ew.MAX_RESULTS),c=[];for(let u of l)if(u.highlights)c.push(u);else{let{score:p,labelMatch:h,descriptionMatch:g}=cJ(u,e,!0,r7,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?r7: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}=cJ(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)=>g7e(r,s,e,!1,o,this.pickState.scorerCache))}createFileQueryCache(){return new Tzt(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 vt(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 vt(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:Ew.MAX_RESULTS})),t).finally(()=>{this.logService.trace(`QuickAccess fileSearch ${Date.now()-o}ms`)})}getFileQueryOptions(e){return{_reason:"openFileHandler",extraFileResources:this.instantiationService.invokeFunction(SX),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=v9(e.original,o.scheme===Y.file?o.fsPath:o.path);if(t.isCancellationRequested)return;let r=(await this.pathService.path).isAbsolute(n);if(!t.isCancellationRequested&&r){let s=Og(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=Og(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===Ew.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(13151,null,c,s.description),accept:()=>{this.quickInputService.quickAccess.show(r.prefix,{preserveValue:!0,providerOptions:l})}}}));return this.quickChatService.enabled&&n.push({label:d(13146,null),commandCenterOrder:30,keybinding:this.keybindingService.lookupKeybinding(wot),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:Ew.TYPING_SEARCH_DELAY},o)}getEditorSymbolPicks(e,t,o){let n=e.original.split(_k.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!==Y.untitled||(s.label.includes(_k.PREFIX)||s.description?.includes(_k.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:fu(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(Ta(e))n=no.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||Ra(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(()=>js(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(M.splitHorizontal):q.asClassName(M.splitVertical),tooltip:f==="right"?d(13154,null):d(13153,null)}),o&&v.push({iconClass:l?"dirty-anything "+q.asClassName(M.circleFilled):q.asClassName(M.close),tooltip:d(13147,null),alwaysVisible:l}),v});return{resource:n,label:r,ariaLabel:l?d(13149,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})}}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?vn:Un;if(n===vn&&await this.pickState.editorViewState.restore(),Ta(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)}}};Ew=I([m(0,F),m(1,Jp),m(2,Pe),m(3,wn),m(4,Vt),m(5,be),m(6,ot),m(7,Ct),m(8,kt),m(9,Wa),m(10,B),m(11,ee),m(12,zs),m(13,lr),m(14,Nt),m(15,dt),m(16,Ge),m(17,_e),m(18,X),m(19,M_),m(20,ne),m(21,Sv)],Ew);var BOe=class extends K{async run(i){let e=i.get(F),t=i.get(Qe),o=e.createInstance(DA),n=d(6878,null),r=await o.selectPromptFile({placeholder:n,type:"agent",optionEdit:!1,optionVisibility:!0});r!==void 0&&await t.open(r.promptFile)}},mfo="workbench.action.chat.picker.customagents";function gfo(a){return{id:a?mfo+".disabled":mfo,title:L(6880,"Configure Custom Agents..."),tooltip:a?d(6879,null):void 0,icon:a?M.lock:void 0,category:vi,f1:!1,precondition:a?x.false():ie.Modes.agentModeDisabledByPolicy.negate(),menu:{id:D.ChatModePicker,when:a?ie.Modes.agentModeDisabledByPolicy:ie.Modes.agentModeDisabledByPolicy.negate()}}}var S_i=class extends BOe{constructor(){super(gfo(!1))}},I_i=class extends BOe{constructor(){super(gfo(!0))}},hfo="workbench.action.chat.configure.customagents";function ffo(a){let i={id:a?hfo+".disabled":hfo,title:L(6876,"Configure Custom Agents..."),shortTitle:d(6877,null),icon:a?M.lock:M.bookmark,f1:!a,precondition:a?x.false():x.and(ie.enabled,ie.Modes.agentModeDisabledByPolicy.negate()),category:vi,menu:[{id:fy,when:x.and(ie.enabled,x.equals("view",Vr),a?ie.Modes.agentModeDisabledByPolicy:ie.Modes.agentModeDisabledByPolicy.negate()),order:10,group:"0_level"}]};return a?{...i,tooltip:d(6879,null)}:i}var y_i=class extends BOe{constructor(){super(ffo(!1))}},w_i=class extends BOe{constructor(){super(ffo(!0))}};function vfo(){W(y_i),W(w_i),W(S_i),W(I_i)}var bfo=x.and(ie.enabled,Fo.HasResource,Fo.LangId.isEqualTo(PE)),T_i=858,Sfo="workbench.action.chat.run.prompt.current",ren="workbench.action.chat.run.prompt",__i="workbench.action.chat.configure.prompts",Dzt=class extends K{constructor(i){super({id:i.id,title:i.title,f1:!1,precondition:ie.enabled,category:vi,icon:i.icon,keybinding:{when:x.and(ue.editorTextFocus,bfo),weight:200,primary:i.keybinding},menu:[{id:D.EditorTitleRun,group:"navigation",order:i.alt?0:1,alt:i.alt,when:bfo}]})}async execute(i,e,t){let o=t.get(ge),n=t.get(nr),r=t.get(At);i||=sen(t),O6t(i,"Cannot find URI resource for an active text editor."),e===!0&&await o.executeCommand(im);let s=await r.revealWidget();return s&&(s.setInput(`/${await n.getPromptSlashCommandName(i,ve.None)}`),await s.acceptInput()),s}},Ifo=L(7005,"Run Prompt in Current Chat"),yfo=M.playCircle,C_i=class extends Dzt{constructor(){super({id:Sfo,title:Ifo,icon:yfo,keybinding:T_i})}async run(i,e){return await super.execute(e,!1,i)}},x_i=class extends K{constructor(){super({id:ren,title:L(7006,"Run Prompt..."),icon:M.bookmark,f1:!0,precondition:ie.enabled,keybinding:{when:ie.enabled,weight:200,primary:T_i},category:vi})}async run(i){let e=i.get(ge),t=i.get(F),o=i.get(nr),n=i.get(At),r=t.createInstance(DA),s=d(7001,null,YN.modifierLabels[zo].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(im);let p=await n.revealWidget();p&&(p.setInput(`/${await o.getPromptSlashCommandName(c,ve.None)}`),await p.acceptInput(),p.focusInput())}},k_i=class extends K{constructor(){super({id:__i,title:L(7002,"Configure Prompt Files..."),shortTitle:L(7003,"Prompt Files"),icon:M.bookmark,f1:!0,precondition:ie.enabled,category:vi,menu:{id:fy,when:x.and(ie.enabled,x.equals("view",Vr)),order:11,group:"0_level"}})}async run(i){let e=i.get(Qe),o=i.get(F).createInstance(DA),n=d(7000,null),r=await o.selectPromptFile({placeholder:n,type:"prompt",optionEdit:!1});r!==void 0&&await e.open(r.promptFile)}};function sen(a){let e=a.get(Kt).getActiveCodeEditor()?.getModel();if(e?.getLanguageId()===PE)return e.uri}var aen="workbench.action.chat.run-in-new-chat.prompt.current",len=L(7004,"Run Prompt In New Chat"),cen=M.play,E_i=class extends Dzt{constructor(){super({id:aen,title:len,icon:cen,keybinding:T_i|2048,alt:{id:Sfo,title:Ifo,icon:yfo}})}async run(i,e){return await super.execute(e,!0,i)}};function wfo(){W(E_i),W(C_i),W(x_i),W(k_i)}var L_i="workbench.action.chat.configure.skills",D_i=class extends K{constructor(){super({id:L_i,title:L(7014,"Configure Skills..."),shortTitle:L(7015,"Skills"),icon:M.lightbulb,f1:!0,precondition:ie.enabled,category:vi,menu:{id:fy,when:x.and(ie.enabled,x.equals("view",Vr)),order:9,group:"1_level"}})}async run(i){let e=i.get(Qe),o=i.get(F).createInstance(DA),n=d(7013,null),r=await o.selectPromptFile({placeholder:n,type:"skill",optionEdit:!1});r!==void 0&&await e.open(r.promptFile)}};function Cfo(){W(D_i)}function xfo(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 den(a,i,e,t){let o=lC(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=lC(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 lC(a,["hooks",i,r,"hooks",c,t]);n++}else{if(n===e)return lC(a,["hooks",i,r,t]);n++}}}function HOe(a,i,e,t){let o=zL(a);if(!o)return;let n=den(o,i,e,t);if(!n||n.type!=="string")return;let r=n.offset+1,s=n.offset+n.length-1,l=xfo(a,r),c=xfo(a,s);return{startLineNumber:l.line,startColumn:l.column,endLineNumber:c.line,endColumn:c.column}}function kfo(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 Efo(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=Ur(p.value.toString()),{hooks:g}=r8(u.uri,h,t,o);for(let[f,{hooks:v,originalId:b}]of g){let S=CC[f];if(S)for(let y=0;y<v.length;y++){let w=v[y],k=p5(w,n)||d(6906,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=Ur(p.value.toString()),{hooks:g}=Ogo(u,h,t,o);for(let[f,{hooks:v,originalId:b}]of g){let S=CC[f];if(S)for(let y=0;y<v.length;y++){let w=v[y],k=p5(w,n)||d(6906,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(TP)){let g=p.hooks[h];if(!g||g.length===0)continue;let f=CC[h];if(f)for(let v=0;v<g.length;v++){let b=g[v],S=p5(b,n)||d(6906,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 uen="workbench.action.chat.configure.hooks";function pen(a){for(let i of Object.keys(a))if(aot(i)!==void 0)return!0;return!1}function men(a,i){if(i){let e=DTi(a);if(e)return e}return a}async function Tfo(a,i,e,t,o,n,r){let s,l=await e.exists(a);if(l){let k=await e.readFile(a);try{s=xk(k.value.toString()),s.hooks||(s.hooks={})}catch{o.error(d(6898,null)),await t.openEditor({resource:a});return}}else s={hooks:{}};let c=Lhe(a),u=c==="claude",p=!u&&pen(s.hooks),h=u?_Ti(i)??i:men(i,p),g;for(let k of Object.keys(s.hooks))if((u?TTi(k):aot(k))===i||k===i){g=k;break}let f=g??h,v=LTi(c),b=s.hooks[f],S=Array.isArray(b)?b.length:0,y;if(l){let k=(await e.readFile(a)).value.toString(),N={tabSize:1,insertSpaces:!1,eol:k.includes(`\r
`)?`\r
`:`
`},O=Sb(k,["hooks",f,S],v,N);y=Nde(k,O)}else{let k={hooks:{[f]:[v]}};y=JSON.stringify(k,null,"	")}if(t.editors.find(k=>Xe(k.resource,a))){await t.openEditor({resource:a,options:{pinned:!1}});let k=ca(t.activeTextEditorControl);if(k&&k.hasModel()&&Xe(k.getModel().uri,a)){let T=k.getModel();T.pushEditOperations([],[{range:T.getFullModelRange(),text:y}],()=>null);let N=HOe(y,f,S,"command");N&&N.endLineNumber!==void 0&&N.endColumn!==void 0&&(k.setSelection({startLineNumber:N.startLineNumber,startColumn:N.startColumn,endLineNumber:N.endLineNumber,endColumn:N.endColumn}),k.revealLineInCenter(N.startLineNumber))}else{await n.apply([new ja(a,{range:new z(1,1,Number.MAX_SAFE_INTEGER,1),text:y})],{label:d(6881,null)});let T=HOe(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 ja(a,{range:new z(1,1,Number.MAX_SAFE_INTEGER,1),text:y})],{label:d(6881,null)})):await e.writeFile(a,Je.fromString(y));let k=HOe(y,f,S,"command");r?await r(a,{selection:k}):await t.openEditor({resource:a,options:{selection:k,pinned:!1}})}}function Lzt(a,i){return new Promise(e=>{let t=!1,o=r=>{t||(t=!0,n.dispose(),e(r))},n=new P;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 UOe(a,i){let e=a.get(nr),t=a.get(Ge),o=a.get(be),n=a.get(ot),r=a.get(ee),s=a.get(Pe),l=a.get(wn),c=a.get(Ne),u=a.get(ma),g=(await a.get(yo).getEnvironment())?.os??zo,v=s.getWorkspace().folders[0]?.uri,b=await l.userHome(),S=b.fsPath??b.path,y=await Efo(e,o,n,v,S,g,ve.None,{includeAgentHooks:!0}),w=new Map;for(let de of y)w.set(de.hookType,(w.get(de.hookType)??0)+1);let k=new P,T=k.add(t.createQuickPick({useSeparators:!0})),N=t.backButton;T.show();let O=1,V,U,G,$,te=[],pe=()=>te.pop();try{for(;;)switch(O){case 1:{let de=([ke,Ee])=>{let He=w.get(ke)??0,Ve=He>0?` (${He})`:"";return{label:`${Ee.label}${Ve}`,description:Ee.description,hookType:ke,hookTypeMeta:Ee}},se;if(i?.target){let ke=new Set(Object.values(Jh[i.target]));se=Object.entries(CC).filter(([Ee])=>ke.has(Ee)).map(de)}else{let ke=new Set(Object.values(Jh.vscode)),Ee=new Set(Object.values(Jh["github-copilot"])),He=Object.entries(CC),Ve=He.filter(([Ze])=>ke.has(Ze)&&Ee.has(Ze)),Fe=He.filter(([Ze])=>ke.has(Ze)&&!Ee.has(Ze)),Qt=He.filter(([Ze])=>!ke.has(Ze)&&Ee.has(Ze));se=[],Ve.length>0&&(se.push({type:"separator",label:d(6904,null)}),se.push(...Ve.map(de))),Fe.length>0&&(se.push({type:"separator",label:d(6905,null)}),se.push(...Fe.map(de))),Qt.length>0&&(se.push({type:"separator",label:d(6903,null)}),se.push(...Qt.map(de)))}T.items=se,T.value="",T.placeholder=d(6894,null),T.title=d(6897,null),T.buttons=[];let Se=await Lzt(T,N);if(!Se||Se==="back")return;V=Se,te.push(1),O=2;break}case 2:{let de=y.filter(Ee=>Ee.hookType===V.hookType),se=de.filter(Ee=>!Ee.agentName),Se=de.filter(Ee=>Ee.agentName),ke=[];if(ke.push({label:`$(plus) ${d(6883,null)}`,isAddNewHook:!0,alwaysShow:!0}),se.length>0){ke.push({type:"separator",label:d(6902,null)});for(let Ee of se){let He=n.getUriLabel(Ee.fileUri,{relative:!0});ke.push({label:Ee.commandLabel,description:He,hookEntry:Ee})}}if(Se.length>0){let Ee=[...new Set(Se.map(He=>He.agentName))];for(let He of Ee){ke.push({type:"separator",label:d(6882,null,He)});for(let Ve of Se.filter(Fe=>Fe.agentName===He)){let Fe=n.getUriLabel(Ve.fileUri,{relative:!0});ke.push({label:Ve.commandLabel,description:Fe,hookEntry:Ve})}}}if(de.length===0)U=ke[0];else{T.items=ke,T.value="",T.placeholder=d(6896,null),T.title=V.hookTypeMeta.label,T.buttons=[N];let Ee=await Lzt(T,N);if(Ee==="back"){O=pe()??1;break}if(!Ee)return;U=Ee,te.push(2)}if(U.hookEntry){let Ee=U.hookEntry,He;if(Ee.agentName)try{let Ve=await o.readFile(Ee.fileUri),Fe=p5(Ee.command,g);Fe&&(He=kfo(Ve.value.toString(),Fe))}catch{}else{let Ve=jJi(Ee.command,g);if(Ve)try{let Fe=await o.readFile(Ee.fileUri);He=HOe(Fe.value.toString(),Ee.originalHookTypeId,Ee.index,Ve)}catch{}}i?.openEditor?await i.openEditor(Ee.fileUri,{selection:He}):await r.openEditor({resource:Ee.fileUri,options:{selection:He,pinned:!1}});return}O=3;break}case 3:{let de=await e.listPromptFilesForStorage("hook","local",ve.None),se=[];if(se.push({label:`$(new-file) ${d(6884,null)}`,isCreateNewFile:!0,alwaysShow:!0}),de.length>0){se.push({type:"separator",label:d(6901,null)});for(let Se of de){let ke=n.getUriLabel(Se.uri,{relative:!0});se.push({label:ke,fileUri:Se.uri})}}if(de.length===0)G=se[0];else{T.items=se,T.value="",T.placeholder=d(6895,null),T.title=d(6893,null),T.buttons=[N];let Se=await Lzt(T,N);if(Se==="back"){O=pe()??2;break}if(!Se)return;G=Se,te.push(3)}if(G.fileUri){await Tfo(G.fileUri,V.hookType,o,r,c,u,i?.openEditor);return}O=4;break}case 4:{let se=(await e.getSourceFolders("hook")).filter(Se=>Se.storage==="local");if(se.length===0){c.error(d(6890,null));return}if($=se[0],se.length>1){let Se=se.map(Ee=>({label:n.getUriLabel(Ee.uri,{relative:!0}),folder:Ee}));T.items=Se,T.value="",T.placeholder=d(6891,null),T.title=d(6892,null),T.buttons=[N];let ke=await Lzt(T,N);if(ke==="back"){O=pe()??3;break}if(!ke)return;$=ke.folder,te.push(4)}O=5;break}case 5:{T.hide();let de=await new Promise(bo=>{let Ro=!1,_o=en=>{Ro||(Ro=!0,sr.dispose(),bo(en))},sr=new P,ln=sr.add(t.createInputBox());ln.prompt=d(6887,null),ln.placeholder=d(6886,null),ln.title=d(6889,null),ln.buttons=[N],ln.ignoreFocusOut=!0,sr.add(ln.onDidAccept(async()=>{let en=ln.value;if(!en||!en.trim()){ln.validationMessage=d(6888,null);return}let Ws=en.trim();if(/[/\\:*?"<>|]/.test(Ws)){ln.validationMessage=d(6885,null);return}_o(Ws)})),sr.add(ln.onDidChangeValue(()=>{ln.validationMessage=void 0})),sr.add(ln.onDidTriggerButton(en=>{en===N&&_o("back")})),sr.add(ln.onDidHide(()=>{_o(void 0)})),ln.show()});if(de==="back"){T.show(),O=pe()??4;break}if(!de)return;await o.createFolder($.uri);let se=de.endsWith(".json")?de:`${de}.json`,Se=A.joinPath($.uri,se);if(await o.exists(Se)){await Tfo(Se,V.hookType,o,r,c,u,i?.openEditor);return}let ke=Lhe(Se),Ee=ke==="claude",He=!Ee&&!new Set(Object.values(Jh.vscode)).has(V.hookType)&&new Set(Object.values(Jh["github-copilot"])).has(V.hookType),Ve=Ee?_Ti(V.hookType)??V.hookType:He?DTi(V.hookType)??V.hookType:V.hookType,Fe=He?{type:"command",[g===1?"powershell":"bash"]:""}:LTi(ke),Qt=He?g===1?"powershell":"bash":"command",Ze={...He?{version:1}:{},hooks:{[Ve]:[Fe]}},Ti=JSON.stringify(Ze,null,"	");await o.writeFile(Se,Je.fromString(Ti)),i?.onHookFileCreated?.(Se);let ti=HOe(Ti,Ve,0,Qt);i?.openEditor?await i.openEditor(Se,{selection:ti}):await r.openEditor({resource:Se,options:{selection:ti,pinned:!1}});return}}}finally{k.dispose()}}var R_i=class extends K{constructor(){super({id:uen,title:L(6899,"Configure Hooks..."),shortTitle:L(6900,"Hooks"),icon:M.zap,f1:!0,precondition:ie.enabled,category:vi,menu:{id:fy,when:x.and(ie.enabled,x.equals("view",Vr)),order:12,group:"1_level"}})}async run(i){return UOe(i)}};function _fo(){W(R_i)}var Cot=class extends K{constructor(e,t){super(e);this.promptType=t}async run(e,t){let o=e.get(F),n=e.get(Kt),r=e.get(Ho),s=e.get(be),l=n.getActiveCodeEditor();if(!l)return;let c=l.getModel();if(!c)return;let u=await o.invokeFunction(c8,this.promptType,void 0,!0);if(!u)return;let p=await o.invokeFunction(Gte,this.promptType,u.uri,Tb(c.uri));if(!p)return;let h=je(u.uri,p);c.uri.scheme===Y.untitled?await r.saveAs(c.uri,h,{from:c.uri}):await s.copy(c.uri,h),await n.openCodeEditor({resource:h},l)}};function M_i(a,i,e,t){return{id:a,title:i,metadata:{description:e},category:vi,f1:!1,menu:{id:D.EditorContent,when:x.and(x.equals(Fo.Scheme.key,Y.untitled),x.equals(Fo.LangId.key,t),x.notEquals(sR.key,0))}}}var hen="workbench.action.chat.save-as-prompt",Rzt=class extends Cot{constructor(){super(M_i(hen,L(7011,"Save As Prompt File"),L(7012,"Save as prompt file"),PE),"prompt")}},gen="workbench.action.chat.save-as-agent",Mzt=class extends Cot{constructor(){super(M_i(gen,L(7007,"Save As Agent File"),L(7008,"Save as agent file"),K8e),"agent")}},fen="workbench.action.chat.save-as-instructions",Pzt=class extends Cot{constructor(){super(M_i(fen,L(7009,"Save As Instructions File"),L(7010,"Save as instructions file"),z8e),"instructions")}};function Dfo(){wfo(),ufo(),Cfo(),_fo(),W(Rzt),W(Pzt),W(Mzt),vfo(),afo()}function Rfo(){W(W_i),W(P_i),W(A_i),W(O_i),W(F_i),W(N_i),Dfo()}async function Nzt(a){let i=a.get(At),e=i.lastFocusedWidget;return!e||e.location==="panel"?i.revealWidget():e}var Azt=class extends K{async run(i,...e){let t=i.get(F),o=await t.invokeFunction(Nzt);if(o)return t.invokeFunction(this.runWithWidget.bind(this),o,...e)}_getResources(i,...e){let t=i.get(ee),o=mce(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:fl(r)?s=r.resource:Ka(r)?s=r.parent().resource:!r&&t.activeTextEditorControl&&(s=no.getCanonicalUri(t.activeEditor,{supportSideBySide:1})),s&&[Y.file,Y.vscodeRemote,Y.untitled].includes(s.scheme)&&n.push(s)}return n}_getEditorResources(i,...e){return lp(e,i.get(ee),i.get(Et),i.get(fo)).groupedEditors.flatMap(o=>o.editors).map(o=>no.getCanonicalUri(o,{supportSideBySide:1})).filter(o=>o!==void 0)}},P_i=class a extends Azt{static{this.ID="workbench.action.chat.attachFile"}constructor(){super({id:a.ID,title:L(5454,"Add File to Chat"),category:vi,icon:M.attach,precondition:ie.enabled,f1:!0,menu:[{id:D.SearchContext,group:"z_chat",order:1,when:x.and(ie.enabled,Ci.FileMatchOrMatchFocusKey,Ci.SearchResultHeaderFocused.negate())},{id:D.ExplorerContext,group:"5_chat",order:1,when:x.and(ie.enabled,lu.negate(),x.or(Fo.Scheme.isEqualTo(Y.file),Fo.Scheme.isEqualTo(Y.vscodeRemote)))},{id:D.EditorTitleContext,group:"2_chat",order:1,when:x.and(ie.enabled,x.or(Fo.Scheme.isEqualTo(Y.file),Fo.Scheme.isEqualTo(Y.vscodeRemote)))},{id:D.EditorContext,group:"1_chat",order:2,when:x.and(ie.enabled,ue.hasNonEmptySelection.negate(),x.or(Fo.Scheme.isEqualTo(Y.file),Fo.Scheme.isEqualTo(Y.vscodeRemote),Fo.Scheme.isEqualTo(Y.untitled),Fo.Scheme.isEqualTo(Y.vscodeUserData)))},{id:D.InlineChatEditorAffordance,group:"0_chat",order:3,when:x.and(ie.enabled,ue.hasNonEmptySelection.negate())},{id:D.ChatEditorInlineMenu,group:"0_chat",order:3,when:x.and(ie.enabled,ue.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)}}},A_i=class a extends Azt{static{this.ID="workbench.action.chat.attachFolder"}constructor(){super({id:a.ID,title:L(5455,"Add Folder to Chat"),category:vi,f1:!1,menu:{id:D.ExplorerContext,group:"5_chat",order:1,when:x.and(ie.enabled,lu,x.or(Fo.Scheme.isEqualTo(Y.file),Fo.Scheme.isEqualTo(Y.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)}}},N_i=class a extends K{static{this.ID="workbench.action.chat.attachPinnedEditors"}constructor(){super({id:a.ID,title:L(5456,"Add Pinned Editors to Chat"),category:vi,precondition:ie.enabled,f1:!0})}async run(i){let e=i.get(Et),o=await i.get(F).invokeFunction(Nzt);if(!o)return;let n=[];for(let r of e.groups)for(let s of r.editors)if(r.isPinned(s)){let l=no.getCanonicalUri(s,{supportSideBySide:1});l&&[Y.file,Y.vscodeRemote,Y.untitled].includes(l.scheme)&&n.push(l)}if(n.length){o.focusInput();for(let r of n)o.attachmentModel.addFile(r)}}},O_i=class a extends K{static{this.ID="workbench.action.chat.attachSelection"}constructor(){super({id:a.ID,title:L(5457,"Add Selection to Chat"),category:vi,icon:M.attach,f1:!0,precondition:ie.enabled,menu:[{id:D.EditorContext,group:"1_chat",order:1,when:x.and(ie.enabled,ue.hasNonEmptySelection,x.or(Fo.Scheme.isEqualTo(Y.file),Fo.Scheme.isEqualTo(Y.vscodeRemote),Fo.Scheme.isEqualTo(Y.untitled),Fo.Scheme.isEqualTo(Y.vscodeUserData)))},{id:D.InlineChatEditorAffordance,group:"0_chat",order:2,when:x.and(ie.enabled,ue.hasNonEmptySelection)},{id:D.ChatEditorInlineMenu,group:"0_chat",order:2,when:x.and(ie.enabled,ue.hasNonEmptySelection)}]})}async run(i,...e){let t=i.get(ee),o=await i.get(F).invokeFunction(Nzt);if(!o)return;let[n,r]=e;if(r&&r.length>0){let s=new Map;for(let l of r)if(fl(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=no.getCanonicalUri(t.activeEditor,{supportSideBySide:1});if(s&&l&&[Y.file,Y.vscodeRemote,Y.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)}}}}},F_i=class a extends K{static{this.Name="searchResults"}constructor(){super({id:"workbench.action.chat.insertSearchResults",title:L(5450,"Add Search Results to Chat"),category:vi,f1:!1,menu:[{id:D.SearchContext,group:"z_chat",order:3,when:x.and(ie.enabled,Ci.SearchResultHeaderFocused)}]})}async run(i){let e=i.get(ne),t=await i.get(F).invokeFunction(Nzt);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 ven(a){return yi(a)&&typeof a.kind=="string"&&a.kind==="contextPick"}function ben(a){return yi(a)&&typeof a.symbolName=="string"&&!!a.uri&&!!a.range}function Lfo(a){return yi(a)&&A.isUri(a.resource)}var W_i=class extends K{constructor(){super({id:"workbench.action.chat.attachContext",title:L(5453,"Add Context..."),icon:M.add,category:vi,keybinding:{when:x.and(ie.inChatInput,ie.location.isEqualTo("panel")),primary:2138,weight:100},menu:[{when:x.and(ie.inQuickChat.negate(),ie.location.isEqualTo("panel"),x.or(ie.lockedToCodingAgent.negate(),ie.agentSupportsAttachments)),id:D.ChatInput,group:"navigation",order:-1},{when:x.and(ie.inQuickChat.negate(),ie.location.isEqualTo("editor"),nme,x.or(ie.lockedToCodingAgent.negate(),ie.agentSupportsAttachments)),id:D.ChatInput,group:"navigation",order:2},{when:x.and(ie.inQuickChat,x.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(At),n=i.get(X),r=i.get(_e),s=i.get(uS),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(Ge),r=i.get(M_),s=i.get(F),l=i.get(ge),c={filter:u=>Lfo(u)&&u.resource?s.invokeFunction(p=>oke(p,u.resource.scheme)):!0,additionPicks:t,handleAccept:async(u,p)=>{if(ven(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);aUt(e)&&r.open()}};n.quickAccess.show("",{enabledProviderPrefixes:[Ew.PREFIX,Tk.PREFIX,CD.PREFIX],placeholder:o??d(5451,null),providerOptions:c})}async _handleQPPick(i,e,t,o){let n=i.get(be),r=i.get(Nt),s=[];if(Lfo(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 k_(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 ben(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 P,s={label:d(5452,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 $e;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(),FT(n.picks)){let f=await n.picks.then(v=>[].concat(v,c));u.items=f,u.busy=!1}else{let f=Le("attachContext.query",u.value);r.add(u.onDidChangeValue(()=>f.set(u.value,void 0)));let v=n.picks(f,p.token);r.add(he(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 Go,g=[];r.add(u.onDidAccept(async f=>{let v="noop",[b]=u.selectedItems;if(iio(b)){let S=b.asAttachment();if(!S||S===v)return;FT(S)?g.push(S.then(y=>{y!==v&&o.attachmentModel.addContext(...Yl(y))})):o.attachmentModel.addContext(...Yl(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 Mfo(){W(class extends K{constructor(){super({id:"workbench.action.chat.copyAll",title:L(5465,"Copy All"),f1:!1,category:vi,menu:{id:D.ChatContext,when:ie.responseIsFiltered.negate(),group:"copy"}})}run(i,e){let t=i.get(Wi),o=i.get(At),n=(Rr(e)||Vi(e))&&o.getWidgetBySessionResource(e.sessionResource)||o.lastFocusedWidget;if(n){let s=n.viewModel?.getItems().filter(l=>Rr(l)||Vi(l)&&!l.errorDetails?.responseIsFiltered).map(l=>TCi(l)).join(`

`);s&&t.writeText(s)}}}),W(class extends K{constructor(){super({id:"workbench.action.chat.copyItem",title:L(5466,"Copy"),f1:!1,category:vi,icon:M.copy,menu:[{id:D.ChatContext,when:ie.responseIsFiltered.negate(),group:"copy"},{id:D.ChatMessageFooter,group:"navigation",order:1,when:x.and(ie.isResponse,ie.responseIsFiltered.negate())}]})}async run(i,...e){let t=i.get(At),o=i.get(Wi),n=t.lastFocusedWidget,r=e[0];if(!hD(r)&&(r=n?.getFocus(),!r))return;let l=Ki().getSelection()?.toString();if(n&&l&&l.length>0&&gs(Pn(),n.domNode)){await o.writeText(l);return}if(!Rr(r)&&!Vi(r))return;let c=TCi(r,!1);await o.writeText(c)}}),W(class extends K{constructor(){super({id:"workbench.action.chat.copyKatexMathSource",title:L(5464,"Copy Math Source"),f1:!1,category:vi,menu:{id:D.ChatContext,group:"copy",when:ie.isKatexMathElement}})}async run(i,...e){let t=i.get(At),o=i.get(Wi),n=t.lastFocusedWidget,r=e[0];if(!hD(r)&&(r=n?.getFocus(),!r))return;let s=null,l=Pn(),c=Ki().getSelection();n&&c&&c.rangeCount>0&&gs(l,n.domNode)&&(s=c.getRangeAt(0).commonAncestorContainer,s.nodeType===Node.TEXT_NODE&&(s=s.parentElement)),s||(s=l?.querySelector(`.${LMe}`)??null);let p=(Ao(s)?s.closest(`.${LMe}`):null)?.getAttribute(ret)||"";p&&await o.writeText(p)}})}function Pfo(a,i){return A.isUri(i)?i.toString():oh(i)?A.from(i).toString():i}function Afo(){W(V_i),W(B_i),W(H_i),W(U_i)}var V_i=class a extends K{static{this.ID="workbench.action.chat.logInputHistory"}constructor(){super({id:a.ID,title:L(5470,"Log Chat Input History"),icon:M.attach,category:We.Developer,f1:!0,precondition:ie.enabled})}async run(i,...e){i.get(At).lastFocusedWidget?.logInputHistory()}},B_i=class a extends K{static{this.ID="workbench.action.chat.logChatIndex"}constructor(){super({id:a.ID,title:L(5469,"Log Chat Index"),icon:M.attach,category:We.Developer,f1:!0,precondition:ie.enabled})}async run(i,...e){i.get(Si).logChatIndex()}},H_i=class a extends K{static{this.ID="workbench.action.chat.inspectChatModel"}constructor(){super({id:a.ID,title:L(5468,"Inspect Chat Model"),icon:M.inspect,category:We.Developer,f1:!0,precondition:ie.enabled})}async run(i,...e){let t=i.get(At),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,Pfo,2)+"\n```\n\n")}l+=`## Full Chat Model

`,l+="```json\n"+JSON.stringify(s,Pfo,2)+"\n```\n",await o.openEditor({resource:void 0,contents:l,languageId:"markdown",options:{pinned:!0}})}},U_i=class a extends K{static{this.ID="workbench.action.chat.clearRecentlyUsedLanguageModels"}constructor(){super({id:a.ID,title:L(5467,"Clear Recently Used Language Models"),category:We.Developer,f1:!0,precondition:ie.enabled})}run(i){i.get(Wr).clearRecentlyUsedList()}};function Ofo(){W(class extends K{constructor(){super({id:"workbench.action.chat.nextFileTree",title:L(5503,"Next File Tree"),keybinding:{primary:2115,weight:200,when:ie.inChatSession},precondition:ie.enabled,f1:!0,category:vi})}run(i,...e){Nfo(i,!1)}}),W(class extends K{constructor(){super({id:"workbench.action.chat.previousFileTree",title:L(5504,"Previous File Tree"),keybinding:{primary:3139,weight:200,when:ie.inChatSession},precondition:ie.enabled,f1:!0,category:vi})}run(i,...e){Nfo(i,!0)}})}function Nfo(a,i){let t=a.get(At).lastFocusedWidget;if(!t)return;let o=!t.inputEditor.hasWidgetFocus()&&t.getFocus(),r=(Vi(o)?o:void 0)??t.viewModel?.getItems().reverse().find(u=>Vi(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 O2=class extends C{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(O2.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(Ei.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(Ei.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(O2.hideWelcomeView,!0,-1,1),this.recentlyInstalled=!1}};O2=I([m(0,nt),m(1,lt),m(2,ls),m(3,le),m(4,At),m(5,B)],O2);function Ffo(){W(class extends K{constructor(){super({id:"workbench.action.chat.forkConversation",title:L(5505,"Fork Conversation"),tooltip:L(5506,"Fork conversation from this point"),f1:!1,category:vi,icon:M.repoForked,precondition:ie.enabled,menu:[{id:D.ChatMessageCheckpoint,group:"navigation",order:3,when:x.and(ie.isRequest,ie.lockedToCodingAgent.negate())}]})}async run(i,...e){let t=i.get(At),o=i.get(Si),n=d(5508,null);if(A.isUri(e[0])){let w=e[0],k=o.getSession(w);if(!k)return;let T=k.toJSON();if(T.requests.length===0)return;let N=Xn(JSON.parse(JSON.stringify(T)));N.sessionId=_t();let O=Date.now();N.creationDate=O,N.customTitle=k.title.startsWith(n)?k.title:d(5507,null,k.title);for(let[G,$]of N.requests.entries())$.shouldBeRemovedOnSend=void 0,$.isHidden=void 0,$.requestId=_t(),$.responseId=$.responseId?_t():void 0,$.timestamp=O+G,$.response&&($.modelState={value:1,completedAt:O+G});let V=o.loadSessionFromData(N),U=V.object.sessionResource;setTimeout(async()=>{try{await t.openSession(U,$x)}finally{V.dispose()}},0);return}let r=e[0],s=hD(r)?r:hD(r?.element)?r.element:hD(r?.context)?r.context:hD(r?.item)?r.item:void 0,l=s&&t.getWidgetBySessionResource(s.sessionResource)||t.lastFocusedWidget;if(!Vi(s)&&!Rr(s)&&(s=l?.getFocus()),!s)return;let c=l?.viewModel?.sessionResource??(hD(s)?s.sessionResource:void 0);if(!c)return;let u=o.getSession(c);if(!u)return;let p=Rr(s)?s.id:Vi(s)?s.requestId:void 0;if(!p)return;let h=u.toJSON(),g=Rr(s),f=-1;if(l?.viewModel){let w=-1;for(let k of l.viewModel.getItems())if(Rr(k)&&(w+=1),k.id===s?.id){f=Rr(k)?Math.max(0,w-1):w;break}}if(f<0){let w=u.getRequests().findIndex(k=>k.id===p);f=g?Math.max(0,w-1):w}if(f<0)return;let v=Xn(JSON.parse(JSON.stringify({...h,requests:h.requests.slice(0,f+1)})));v.sessionId=_t();let b=Date.now();v.creationDate=b,v.customTitle=u.title.startsWith(n)?u.title:d(5507,null,u.title);for(let[w,k]of v.requests.entries())k.shouldBeRemovedOnSend=void 0,k.isHidden=void 0,k.requestId=_t(),k.responseId=k.responseId?_t():void 0,k.timestamp=b+w,k.response&&(k.modelState={value:1,completedAt:b+w});let S=o.loadSessionFromData(v);if(!S)return;let y=S.object.sessionResource;await t.openSession(y,$x),S.dispose()}})}var Wfo="chat.json",Vfo=[{name:d(5510,null),extensions:["json"]}];function Bfo(){W(class extends K{constructor(){super({id:"workbench.action.chat.export",category:vi,title:L(5509,"Export Chat..."),precondition:ie.enabled,f1:!0})}async run(i,e){let t=i.get(At),o=i.get(dn),n=i.get(be),r=i.get(Si),s=t.lastFocusedWidget;if(!s||!s.viewModel)return;if(!e){let u=je(await o.defaultFilePath(),Wfo),p=await o.showSaveDialog({defaultUri:u,filters:Vfo});if(!p)return;e=p}let l=r.getSession(s.viewModel.sessionResource);if(!l)return;let c=Je.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(5511,"Import Chat..."),category:vi,precondition:ie.enabled,f1:!0})}async run(i,e){let t=i.get(be),o=i.get(At),n=i.get(Si),r=i.get(dn),s=e?.inputPath;if(!s){let c=je(await r.defaultFilePath(),Wfo),u=await r.showOpenDialog({defaultUri:c,canSelectFiles:!0,filters:Vfo});if(!u)return;s=u[0]}let l=await t.readFile(s);try{let c=Xn(JSON.parse(l.value.toString()));if(!jVt(c))throw new Error("Invalid chat session data");let u,p,h;e?.target==="chatViewPane"?(u=n.loadSessionFromData(c).object.sessionResource,p=$x,h={pinned:!0}):(u=Va.getNewEditorUri(),p=Un,h={target:{data:c},pinned:!0}),await o.openSession(u,p,h)}catch(c){throw c}}})}var z_i=class a extends K{static{this.ID="workbench.action.chat.manageLanguageModelAuthentication"}constructor(){super({id:a.ID,title:L(5517,"Manage Language Model Access..."),category:vi,precondition:ie.enabled,menu:[{id:D.AccountsContext,order:100}],f1:!0})}async run(i){let e=i.get(Ge),t=i.get(Wr),o=i.get(Gx),n=i.get(ct),r=i.get(lt),s=i.get(zi),l=i.get(nt),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=dV+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 N of T){let O=w.findIndex(U=>U.id===N);O!==-1&&w.splice(O,1);let V=await r.getExtension(N);V&&w.push({id:N,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(5520,null),detail:d(5521,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(5512,null,b.displayName||b.name),buttons:[{iconClass:q.asClassName(M.info),tooltip:d(5522,null)}]});let S=!1;if(v.length>0)for(let y of v)y.trusted&&!S&&(h.push({type:"separator",label:d(5523,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(M.info),tooltip:d(5522,null)}]});else h.push({label:d(5519,null),description:d(5518,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(5514,null),placeHolder:d(5513,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(dV+f,p.get(f)||"Language Models",v)}}},K_i=class extends K{constructor(){super({id:"lm.addLanguageModelsProviderGroup",title:d(5515,null)})}async run(i,e){let t=i.get(Wr);if(!e)throw new Error("Language model group is required");let{name:o,vendor:n,...r}=e;await t.addLanguageModelsProviderGroup(o,n,r)}},G_i=class extends K{constructor(){super({id:"lm.migrateLanguageModelsProviderGroup",title:d(5516,null)})}async run(i,e){let t=i.get(Wr);if(!e)throw new Error("Language model group is required");await t.migrateLanguageModelsProviderGroup(e)}};function Hfo(){W(z_i),W(K_i),W(G_i)}var xot=class a extends K{static{this.ID="workbench.action.chat.managePlugins"}constructor(){super({id:a.ID,title:L(5541,"Plugins"),category:vi,precondition:ie.enabled,menu:[{id:fy,group:"2_plugins"}],f1:!0})}async run(i){i.get(zi).openSearch("@agentPlugins ")}};function Ufo(){W(xot)}async function Ozt(a,i){let e=a.get(ee);if(!i){let t=e.activeEditor;i=t instanceof Va?t:void 0}if(i instanceof Va){let t=i.sessionResource&&i.sessionResource.scheme!==Y.vscodeLocalChatSession?i.sessionResource.with({path:`/untitled-${_t()}`}):Va.getNewEditorUri(),o=e.findEditors(i.resource)[0];await e.replaceEditors([{editor:i,replacement:{resource:t,options:{pinned:!0}}}],o.groupId)}}var LA=class extends zO{constructor(e,t,o,n,r,s,l,c,u,p,h){super(Va.EditorID,e,LA.VIEW_STATE_KEY,t,n,r,u,o,p,h);this.chatSessionsService=s;this.contextKeyService=l;this.chatService=c;this.dimension=new ai(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(Ozt,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 Io([X,this.scopedContextKeyService])));ie.inChatEditor.bindTo(this._scopedContextKeyService).set(!0),this._widget=this._register(t.createInstance(Cw,"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:od,listBackground:qo,overlayBackground:_E,inputEditorBackground:Gb,resultEditorBackground:qo})),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=R(this._editorContainer,_(".chat-loading-overlay")),this._loadingContainer.setAttribute("role","status"),this._loadingContainer.setAttribute("aria-live","polite"),this._loadingContainer.tabIndex=-1;let t=R(this._loadingContainer,_(".chat-loading-content")),o=Qo(q.modify(M.loading,"spin"));o.setAttribute("aria-hidden","true"),t.appendChild(o);let n=R(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!==qp){let l=d(7484,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!==qp)try{await pm(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 pm(e.resolve(),n);if(!l)throw new Error(`Failed to get model for chat editor. resource: ${e.sessionResource}`);s!==qp&&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 Va}toEditorViewStateResource(e){return e.sessionResource}layout(e,t){this.dimension=e,this.widget&&this.widget.layout(e.height,e.width)}};LA=I([m(1,Te),m(2,De),m(3,F),m(4,le),m(5,Ls),m(6,X),m(7,Si),m(8,Nn),m(9,ee),m(10,Et)],LA);function Kfo(){W(class extends K{constructor(){super({id:"workbench.action.chat.openInEditor",title:L(5524,"Move Chat into Editor Area"),category:vi,precondition:ie.enabled,f1:!0,menu:{id:D.ViewTitle,when:x.equals("view",Vr),order:0,group:"1_open"}})}async run(e,...t){let o=t[0];zfo(e,"Editor",Mme(o)?o.sessionResource:void 0)}}),W(class extends K{constructor(){super({id:"workbench.action.chat.openInNewWindow",title:L(5525,"Move Chat into New Window"),category:vi,precondition:ie.enabled,f1:!0,menu:{id:D.ViewTitle,when:x.equals("view",Vr),order:0,group:"1_open"}})}async run(e,...t){let o=t[0];zfo(e,"Window",Mme(o)?o.sessionResource:void 0)}}),W(class extends K{constructor(){super({id:"workbench.action.chat.openInSidebar",title:L(5529,"Move Chat into Side Bar"),category:vi,precondition:ie.enabled,f1:!0})}async run(e,...t){return Sen(e)}});function a(i,e,t,o){fe.appendMenuItem(i,{command:{id:"workbench.action.chat.openInSidebar",title:e,icon:t},when:x.and(fr.isEqualTo(Va.EditorID),o),group:i===D.CompactWindowEditorTitle?"navigation":void 0,order:0})}[D.EditorTitle,D.CompactWindowEditorTitle].forEach(i=>{a(i,d(5528,null),M.layoutSidebarRightDock,ie.panelLocation.isEqualTo(2)),a(i,d(5527,null),M.layoutSidebarLeftDock,ie.panelLocation.isEqualTo(0)),a(i,d(5526,null),M.layoutPanelDock,ie.panelLocation.isEqualTo(1))})}async function zfo(a,i,e){let t=a.get(At),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(Va.getNewEditorUri(),i==="Window"?hg:Un,{pinned:!0,auxiliary:o});return}let r=t.getWidgetBySessionResource(n.viewModel.sessionResource);if(!r){await t.openSession(Va.getNewEditorUri(),i==="Window"?hg:Un,{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"?hg:Un,c)}async function Sen(a){let i=a.get(Ft),e=a.get(ee),t=a.get(Et),o=e.activeEditorPane,n=o?.input,r;if(o instanceof LA&&n instanceof Va&&n.sessionResource){let s=o.widget.getViewState();await e.closeEditor({editor:o.input,groupId:t.activeGroup.id}),r=await i.openView(Vr);let l=await r.loadSession(n.sessionResource);s&&l&&!l.inputModel.state.get()&&l.inputModel.setState(s)}else r=await i.openView(Vr);r.focus()}function $_i(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 Gfo(){fe.appendMenuItem(D.ViewTitle,{submenu:D.ChatNewMenu,title:L(5532,"New Chat"),icon:M.plus,when:x.equals("view",Vr),group:"navigation",order:-1,isSplitButton:!0}),W(class extends K{constructor(){super({id:"workbench.action.chatEditor.newChat",title:L(5531,"New Chat"),icon:M.plus,f1:!1,precondition:ie.enabled})}async run(e,...t){await Ozt(e)}}),W(class extends K{constructor(){super({id:im,title:L(5532,"New Chat"),category:vi,icon:M.plus,precondition:x.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:x.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=$_i(t[0])?t[0]:void 0,n=Nme(e,t);await q_i(e,n,o)}});let a=[{idSuffix:".copilotIcon",iconValue:"copilot",icon:M.copilot},{idSuffix:".newSessionIcon",iconValue:"new-session",icon:M.newSession},{idSuffix:".commentIcon",iconValue:"comment",icon:M.comment}];for(let i of a)W(class extends K{constructor(){super({id:im+i.idSuffix,title:L(5532,"New Chat"),category:vi,icon:i.icon,precondition:x.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=$_i(t[0])?t[0]:void 0,n=Nme(e,t);await q_i(e,n,o)}});qe.registerCommandAlias(xdo,im),W(class extends K{constructor(){super({id:"workbench.action.chat.newLocalChat",title:L(5533,"New Local Chat"),category:vi,icon:M.plus,precondition:x.and(ie.enabled,ie.location.isEqualTo("panel")),f1:!1})}async run(e,...t){let o=$_i(t[0])?t[0]:void 0,n=Nme(e,t);await q_i(e,n,o,"local")}}),fe.appendMenuItem(D.ChatViewSessionTitleNavigationToolbar,{command:{id:im,title:L(5530,"Go Back"),icon:M.arrowLeft},when:ie.agentSessionsViewerOrientation.notEqualsTo(2),group:"navigation",order:1}),W(class extends bA{constructor(){super({id:"workbench.action.chat.undoEdit",title:L(5537,"Undo Last Edit"),category:vi,icon:M.discard,precondition:x.and(ie.chatEditingCanUndo,ie.enabled),f1:!0,menu:[{id:D.ViewTitle,when:x.equals("view",Vr),group:"navigation",order:-3,isHiddenByDefault:!0}]})}async runEditingSessionAction(e,t){await t.undoInteraction()}}),W(class extends bA{constructor(){super({id:"workbench.action.chat.redoEdit",title:L(5534,"Redo Last Edit"),category:vi,icon:M.redo,precondition:x.and(ie.chatEditingCanRedo,ie.enabled),f1:!0,menu:[{id:D.ViewTitle,when:x.equals("view",Vr),group:"navigation",order:-2,isHiddenByDefault:!0}]})}async runEditingSessionAction(e,t){let o=e.get(Si);await t.redoInteraction(),o.getSession(t.chatSessionResource)?.setCheckpoint(void 0)}}),W(class extends bA{constructor(){super({id:"workbench.action.chat.redoEdit2",title:L(5535,"Redo"),tooltip:L(5536,"Reapply discarded workspace changes and chat"),category:vi,precondition:x.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(At);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 q_i(a,i,e,t){let o=a.get(Bi),n=a.get(Ft),r=a.get(B),{editingSession:s,chatWidget:l}=i??{};if(!l)return;let c=a.get(ct),u=l.viewModel?.model;u&&!await het(u,void 0,c)||(await s?.stop(),await yBt(l,n,t),l.attachmentModel.clear(!0),l.focusInput(),o.alert(d(5538,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 qfo(){W(class extends K{constructor(){super({id:"workbench.action.chat.nextUserPrompt",title:L(5542,"Next User Prompt"),keybinding:{primary:2578,weight:200,when:ie.inChatSession},precondition:ie.enabled,f1:!0,category:vi})}run(i,...e){$fo(i,!1)}}),W(class extends K{constructor(){super({id:"workbench.action.chat.previousUserPrompt",title:L(5543,"Previous User Prompt"),keybinding:{primary:2576,weight:200,when:ie.inChatSession},precondition:ie.enabled,f1:!0,category:vi})}run(i,...e){$fo(i,!0)}})}function $fo(a,i){let t=a.get(At).lastFocusedWidget;if(!t)return;let o=t.viewModel?.getItems();if(!o||o.length===0)return;let n=o.filter(u=>Rr(u));if(n.length===0)return;let r=t.getFocus(),s=-1;r&&(Rr(r)?s=n.findIndex(u=>u.id===r.id):Vi(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 kot=x.and(x.or(ie.requestInProgress,ie.editingRequestType.isEqualTo(ie.EditingRequestType.QueueOrSteer)),ie.editingRequestType.notEqualsTo(ie.EditingRequestType.Sent));function Ien(a){return!!a&&typeof a=="object"&&"sessionResource"in a&&"pendingRequestId"in a&&A.isUri(a.sessionResource)&&typeof a.pendingRequestId=="string"}var $te=class a extends K{static{this.ID="workbench.action.chat.queueMessage"}constructor(){super({id:a.ID,title:L(5544,"Add to Queue"),tooltip:d(5545,null),icon:M.add,f1:!1,category:vi,precondition:x.and(kot,ie.inputHasText),keybinding:{when:x.and(ie.inChatInput,kot),primary:515,weight:101}})}run(i,...e){let o=i.get(At).lastFocusedWidget;!o?.viewModel||!o.getInput().trim()||o.acceptInput(void 0,{queue:"queued"})}},qte=class a extends K{static{this.ID="workbench.action.chat.steerWithMessage"}constructor(){super({id:a.ID,title:L(5550,"Steer with Message"),tooltip:d(5551,null),icon:M.arrowUp,f1:!1,category:vi,precondition:x.and(kot,ie.inputHasText),keybinding:{when:x.and(ie.inChatInput,kot),primary:3,weight:101}})}run(i,...e){let o=i.get(At).lastFocusedWidget;!o?.viewModel||!o.getInput().trim()||o.acceptInput(void 0,{queue:"steering"})}},j_i=class a extends K{static{this.ID="workbench.action.chat.removePendingRequest"}constructor(){super({id:a.ID,title:L(5548,"Remove from Queue"),icon:M.close,f1:!1,category:vi,menu:[{id:D.ChatMessageTitle,group:"navigation",order:4,when:x.and(ie.isRequest,ie.isPendingRequest)}]})}run(i,...e){let t=i.get(Si),[o]=e;if(Rr(o)&&o.pendingKind){t.removePendingRequest(o.sessionResource,o.id);return}if(Ien(o)){t.removePendingRequest(o.sessionResource,o.pendingRequestId);return}}},Q_i=class a extends K{static{this.ID="workbench.action.chat.sendPendingImmediately"}constructor(){super({id:a.ID,title:L(5549,"Send Immediately"),icon:M.arrowUp,f1:!1,category:vi,menu:[{id:D.ChatMessageTitle,group:"navigation",order:3,when:x.and(ie.isRequest,ie.isPendingRequest)}]})}run(i,...e){let t=i.get(Si),o=i.get(At),[n]=e;if(!Rr(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),t.cancelCurrentRequestForSession(n.sessionResource,"queueRunNext"),t.processPendingRequests(n.sessionResource)}},Y_i=class a extends K{static{this.ID="workbench.action.chat.removeAllPendingRequests"}constructor(){super({id:a.ID,title:L(5547,"Remove All Queued"),icon:M.clearAll,f1:!1,category:vi,menu:[{id:D.ChatContext,group:"navigation",order:3,when:ie.hasPendingRequests}]})}run(i,...e){let t=i.get(Si),o=i.get(At),[n]=e,s=(Rr(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 jfo(){W($te),W(qte),W(j_i),W(Q_i),W(Y_i),fe.appendMenuItem(D.ChatExecuteQueue,{command:{id:$te.ID,title:L(5544,"Add to Queue"),icon:M.add},group:"navigation",order:1}),fe.appendMenuItem(D.ChatExecuteQueue,{command:{id:qte.ID,title:L(5550,"Steer with Message"),icon:M.arrowUp},group:"navigation",order:2}),fe.appendMenuItem(D.ChatExecute,{submenu:D.ChatExecuteQueue,title:L(5546,"Queue"),icon:M.listOrdered,when:x.and(kot,ie.inputHasText),group:"navigation",order:4})}var yen="chat.installRecommendationAvailable",Ohe=class extends C{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=Ei.toKey(e.extensionId),o=`chat.installRecommendation.${t}.${e.name}`,n=`${yen}.${t}`,r=new Q(n,!1).bindTo(this.contextKeyService);this.availabilityContextKeys.set(t,r);let s=L(5428,"New {0}",e.displayName);this._register(W(class extends K{constructor(){super({id:o,title:s,tooltip:e.description,f1:!1,category:vi,icon:M.extensions,menu:[{id:D.ChatNewMenu,group:"4_recommendations",when:x.equals(n,!0)}]})}async run(l){let c=l.get(ge),u=l.get(nt),p=l.get(Si),h=u.quality!=="stable";await c.executeCommand("workbench.extensions.installExtension",e.extensionId,{installPreReleaseVersion:h}),await wen(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=>Ei.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)})}};Ohe=I([m(0,nt),m(1,ta),m(2,Hd),m(3,X)],Ohe);async function wen(a,i,e){if(e){await Cen(e),await i.activateDefaultAgent("panel");try{await a.executeCommand(e)}catch{}}}function Cen(a){return qe.getCommands().has(a)?Promise.resolve():new Promise(i=>{let e=new Nl,t=qe.onDidRegisterCommand(o=>{o===a&&(t.dispose(),e.dispose(),i())});e.cancelAndSet(()=>{t.dispose(),i()},1e4)})}var Fhe=class extends C{static{this.ID="workbench.contrib.chatTransfer"}constructor(i){super(),i.checkAndSetTransferredWorkspaceTrust()}};Fhe=I([m(0,hOe)],Fhe);var xen=Re("chat-debug-editor-label-icon",M.bug,d(6245,null)),XR=class a extends Us{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(6246,null)}getIcon(){return xen}matches(e){return super.matches(e)?!0:e instanceof a}},Fzt=class{canSerialize(i){return!0}serialize(i){return""}deserialize(i){return XR.instance}};function Qfo(){W(class extends K{constructor(){super({id:"workbench.action.chat.openAgentDebugPanel",title:L(5539,"Open Agent Debug Panel"),f1:!0,category:We.Developer,precondition:ie.enabled})}async run(i){let e=i.get(ee),t=i.get(em);t.activeSessionResource=void 0;let o={pinned:!0,viewHint:"home"};await e.openEditor(XR.instance,o)}}),W(class extends K{constructor(){super({id:"workbench.action.chat.openAgentDebugPanelForSession",title:L(5540,"Show Agent Logs"),f1:!1,category:vi,precondition:x.and(ie.enabled,ie.chatSessionHasDebugData),menu:[{id:fy,when:x.and(ie.enabled,x.equals("view",Vr)),order:0,group:"4_logs"},{id:D.ChatWelcomeContext,group:"2_settings",order:0,when:ie.inChatEditor.negate()}]})}async run(i,e,t){let o=i.get(ee),n=i.get(At),r=i.get(em),s;A.isUri(e)?s=e:Mme(e)&&(s=e.sessionResource),s||(s=n.lastFocusedWidget?.viewModel?.sessionResource),r.activeSessionResource=s;let l={pinned:!0,sessionResource:s,viewHint:"logs",filter:t};await o.openEditor(XR.instance,l)}})}var Wzt=class a extends C{constructor(){super(...arguments);this._buffer=new Array(a.MAX_EVENTS);this._head=0;this._size=0;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 vt;this._providers=new Set;this._invocationCts=new vt;this._providerEvents=new WeakSet}static{this.MAX_EVENTS=1e4}log(e,t,o,n=1,r){cs.isLocalSession(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._head+this._size)%a.MAX_EVENTS;this._buffer[t]=e,this._size<a.MAX_EVENTS?this._size++:this._head=(this._head+1)%a.MAX_EVENTS,this._onDidAddEvent.fire(e)}addProviderEvent(e){this._providerEvents.add(e),this.addEvent(e)}getEvents(e){let t=[],o=e?.toString();for(let n=0;n<this._size;n++){let r=this._buffer[(this._head+n)%a.MAX_EVENTS];r&&(!o||r.sessionResource.toString()===o)&&t.push(r)}return t.sort((n,r)=>n.created.getTime()-r.created.getTime()),t}getSessionResources(){let e=new vt,t=[];for(let o=0;o<this._size;o++){let n=this._buffer[(this._head+o)%a.MAX_EVENTS];n&&(e.has(n.sessionResource)||(e.set(n.sessionResource,!0),t.push(n.sessionResource)))}return t}clear(){this._buffer.fill(void 0),this._head=0,this._size=0,this._debugDataAttachedSessions.clear()}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(!cs.isLocalSession(e))return;let t=this._invocationCts.get(e);t&&(t.cancel(),t.dispose()),this._clearProviderEvents(e);let o=new $e;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 r of n)this.addProviderEvent({...r,sessionResource:r.sessionResource??t})}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=e.toString(),o=0;for(let n=0;n<this._size;n++){let r=(this._head+n)%a.MAX_EVENTS,s=this._buffer[r];if(!(s&&this._providerEvents.has(s)&&s.sessionResource.toString()===t)){if(o!==n){let l=(this._head+o)%a.MAX_EVENTS;this._buffer[l]=s}o++}}for(let n=o;n<this._size;n++)this._buffer[(this._head+n)%a.MAX_EVENTS]=void 0;this._size=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,ve.None);if(o!==void 0)return o}catch(o){mt(o)}}dispose(){for(let e of this._invocationCts.values())e.cancel(),e.dispose();this._invocationCts.clear(),super.dispose()}};var ken=_;var Vzt=new Q("chatDebugFilterActive",!1),Bzt=new Q("chatDebug.kindToolCall",!0),Hzt=new Q("chatDebug.kindModelTurn",!0),Uzt=new Q("chatDebug.kindPromptDiscovery",!0),zzt=new Q("chatDebug.kindSubagent",!0),Xfo="chatDebug.filter.toggleToolCall",Jfo="chatDebug.filter.toggleModelTurn",Zfo="chatDebug.filter.togglePromptDiscovery",evo="chatDebug.filter.toggleSubagent",pT=class a extends _J{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"),R(e,ken("span.chat-debug-breadcrumb-item-label",void 0,this._text))}};function zOe(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 Kzt=class a extends C{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._parseTimestampFilters(t),this._onDidChange.fire())}setBeforeTimestamp(e){this.beforeTimestamp!==e&&(this.beforeTimestamp=e,this._onDidChange.fire())}_parseTimestampFilters(e){this.beforeTimestamp=a.parseTimeToken(e,"before"),this.afterTimestamp=a.parseTimeToken(e,"after")}static parseTimeToken(e,t){let n=new RegExp(`${t}:(\\d{4})(?:-(\\d{2})(?:-(\\d{2})(?:t(\\d{1,2})(?::(\\d{2})(?::(\\d{2}))?)?)?)?)?(?!\\w)`).exec(e);if(!n)return;let r=parseInt(n[1],10),s=n[2]!==void 0?parseInt(n[2],10)-1:void 0,l=n[3]!==void 0?parseInt(n[3],10):void 0,c=n[4]!==void 0?parseInt(n[4],10):void 0,u=n[5]!==void 0?parseInt(n[5],10):void 0,p=n[6]!==void 0?parseInt(n[6],10):void 0;return t==="before"?p!==void 0?new Date(r,s,l,c,u,p,999).getTime():u!==void 0?new Date(r,s,l,c,u,59,999).getTime():c!==void 0?new Date(r,s,l,c,59,59,999).getTime():l!==void 0?new Date(r,s,l,23,59,59,999).getTime():s!==void 0?new Date(r,s+1,0,23,59,59,999).getTime():new Date(r,11,31,23,59,59,999).getTime():new Date(r,s??0,l??1,c??0,u??0,p??0,0).getTime()}get textFilterWithoutTimestamps(){return this.textFilter.replace(/\b(?:before|after):\d{4}(?:-\d{2}(?:-\d{2}(?:t\d{1,2}(?::\d{2}(?::\d{2})?)?)?)?)?\b/g,"").trim()}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 tvo(a,i){let e=new P;Vzt.bindTo(i).set(!0);let t=Bzt.bindTo(i);t.set(!0);let o=Hzt.bindTo(i);o.set(!0);let n=Uzt.bindTo(i);n.set(!0);let r=zzt.bindTo(i);r.set(!0);let s=(l,c,u,p,h,g,f)=>{e.add(qe.registerCommand(l,()=>{let v=!h();g(v),f.set(v),a.fire()})),e.add(fe.appendMenuItem(TC,{command:{id:l,title:c,toggled:u},group:p,when:Vzt}))};return s(Xfo,d(6272,null),Bzt,"1_kind",()=>a.filterKindToolCall,l=>{a.filterKindToolCall=l},t),s(Jfo,d(6269,null),Hzt,"1_kind",()=>a.filterKindModelTurn,l=>{a.filterKindModelTurn=l},o),s(Zfo,d(6270,null),Uzt,"1_kind",()=>a.filterKindPromptDiscovery,l=>{a.filterKindPromptDiscovery=l},n),s(evo,d(6271,null),zzt,"1_kind",()=>a.filterKindSubagent,l=>{a.filterKindSubagent=l},r),e}function Gzt(a,i){Vzt.bindTo(i).set(!0);let e=Bzt.bindTo(i),t=Hzt.bindTo(i),o=Uzt.bindTo(i),n=zzt.bindTo(i);return()=>{e.set(a.filterKindToolCall),t.set(a.filterKindModelTurn),o.set(a.filterKindPromptDiscovery),n.set(a.filterKindSubagent)}}var u8=_,KOe=class extends C{constructor(e,t,o,n){super();this.chatService=t;this.chatDebugService=o;this.chatWidgetService=n;this._onNavigateToSession=this._register(new E);this.onNavigateToSession=this._onNavigateToSession.event;this.renderDisposables=this._register(new P);this.container=R(e,u8(".chat-debug-home")),this.scrollContent=R(this.container,u8("div.chat-debug-home-content"))}show(){this.container.style.display="",this.render()}hide(){this.container.style.display="none"}render(){Rt(this.scrollContent),this.renderDisposables.clear(),R(this.scrollContent,u8("h2.chat-debug-home-title",void 0,d(6304,null)));let t=this.chatWidgetService.lastFocusedWidget?.viewModel?.sessionResource,o=[...this.chatDebugService.getSessionResources()].reverse();if(t){let n=o.findIndex(r=>r.toString()===t.toString());n>0&&(o.splice(n,1),o.unshift(t))}if(R(this.scrollContent,u8("p.chat-debug-home-subtitle",void 0,o.length>0?d(6299,null):d(6301,null))),o.length>0){let n=R(this.scrollContent,u8(".chat-debug-home-session-list"));n.setAttribute("role","list"),n.setAttribute("aria-label",d(6303,null));let r=[];for(let s of o){let l=this.chatService.getSessionTitle(s)||cs.parseLocalSessionId(s)||s.toString(),c=t!==void 0&&s.toString()===t.toString(),u=R(n,u8("button.chat-debug-home-session-item"));u.setAttribute("role","listitem"),c&&(u.classList.add("chat-debug-home-session-item-active"),u.setAttribute("aria-current","true")),R(u,u8(`span${q.asCSSSelector(M.comment)}`));let p=R(u,u8("span.chat-debug-home-session-item-title")),h=Ugt(l);if(h)p.classList.add("chat-debug-home-session-item-shimmer"),u.disabled=!0,u.setAttribute("aria-busy","true"),u.setAttribute("aria-label",d(6300,null));else{p.textContent=l;let g=c?d(6302,null,l):l;u.setAttribute("aria-label",g)}c&&R(u,u8("span.chat-debug-home-session-badge",void 0,d(6298,null))),h||(this.renderDisposables.add(j(u,re.CLICK,()=>{this._onNavigateToSession.fire(s)})),r.push(u))}this.renderDisposables.add(j(n,re.KEY_DOWN,s=>{if(r.length===0)return;let l=Pn(),c=r.indexOf(l);if(c===-1)return;let u;switch(s.key){case"ArrowDown":u=c+1<r.length?c+1:c;break;case"ArrowUp":u=c-1>=0?c-1:c;break;case"Home":u=0;break;case"End":u=r.length-1;break}u!==void 0&&(s.preventDefault(),r[u].focus())}))}}};KOe=I([m(1,Si),m(2,em),m(3,At)],KOe);var af=_;var GOe=class extends C{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 P);this.isFirstLoad=!0;this.container=R(e,af(".chat-debug-overview")),xo(this.container);let s=R(this.container,af(".chat-debug-breadcrumb"));this.breadcrumbWidget=this._register(new bK(s,3,void 0,M.chevronRight,f1)),this._register(zOe(s,this.breadcrumbWidget)),this._register(this.breadcrumbWidget.onDidSelectItem(l=>{l.type==="select"&&l.item instanceof pT&&(this.breadcrumbWidget.setSelection(void 0),this.breadcrumbWidget.getItems().indexOf(l.item)===0&&this._onNavigate.fire("home"))})),this.content=R(this.container,af(".chat-debug-overview-content"))}setSession(e){this.currentSessionResource=e,this.isFirstLoad=!0}show(){bn(this.container),this.load()}hide(){xo(this.container)}refresh(){if(this.container.style.display!=="none")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)||cs.parseLocalSessionId(this.currentSessionResource)||this.currentSessionResource.toString();this.breadcrumbWidget.setItems([new pT(d(6376,null),!0),new pT(e)])}load(){if(Rt(this.content),this.loadDisposables.clear(),this.updateBreadcrumb(),!this.currentSessionResource)return;let e=this.chatService.getSessionTitle(this.currentSessionResource)||cs.parseLocalSessionId(this.currentSessionResource)||this.currentSessionResource.toString(),t=R(this.content,af(".chat-debug-overview-title-row")),o=R(t,af("h2.chat-debug-overview-title"));R(o,af(`span${q.asCSSSelector(M.comment)}`)),o.append(e);let n=R(t,af(".chat-debug-overview-title-actions")),r=this.loadDisposables.add(new Mi(n,{ariaLabel:d(6370,null),title:d(6370,null)}));r.element.classList.add("chat-debug-icon-button"),r.icon=M.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=fg(e),s=this.chatSessionsService.getChatSessionContribution(n)?.displayName||(n==="local"?d(6372,null):n);if(o.push({label:d(6358,null),value:s}),t){let l=this.getLocationLabel(t.initialLocation);o.push({label:d(6357,null),value:l});let u=t.requestInProgress.get()?d(6374,null):d(6373,null);o.push({label:d(6359,null),value:u});let p=t.timing;o.push({label:d(6355,null),value:new Date(p.created).toLocaleString()}),p.lastRequestEnded?o.push({label:d(6356,null),value:new Date(p.lastRequestEnded).toLocaleString()}):p.lastRequestStarted&&o.push({label:d(6356,null),value:new Date(p.lastRequestStarted).toLocaleString()})}if(o.length>0){let l=R(this.content,af(".chat-debug-overview-section"));R(l,af("h3.chat-debug-overview-section-label",void 0,d(6371,null)));let c=R(l,af(".chat-debug-overview-details"));for(let u of o){let p=R(c,af(".chat-debug-overview-detail-row"));R(p,af("span.chat-debug-overview-detail-label",void 0,u.label)),R(p,af("span.chat-debug-overview-detail-value",void 0,u.value))}}}getLocationLabel(e){switch(e){case"panel":return d(6361,null);case"terminal":return d(6364,null);case"notebook":return d(6363,null);case"editor":return d(6362,null);default:return String(e)}}renderDerivedOverview(e,t){let o=R(this.content,af(".chat-debug-overview-section"));R(o,af("h3.chat-debug-overview-section-label",void 0,d(6375,null))),this.metricsContainer=R(o,af(".chat-debug-overview-metrics")),t?this.renderMetricsShimmer(this.metricsContainer):this.renderMetricsContent(this.metricsContainer,e);let n=R(this.content,af(".chat-debug-overview-section"));R(n,af("h3.chat-debug-overview-section-label",void 0,d(6360,null)));let r=R(n,af(".chat-debug-overview-actions")),s=this.loadDisposables.add(new Mi(r,{...Ko,secondary:!0,supportIcons:!0,title:d(6377,null)}));s.element.classList.add("chat-debug-overview-action-button"),s.label=`$(list-flat) ${d(6377,null)}`,this.loadDisposables.add(s.onDidClick(()=>{this._onNavigate.fire("logs")}));let l=this.loadDisposables.add(new Mi(r,{...Ko,secondary:!0,supportIcons:!0,title:d(6354,null)}));l.element.classList.add("chat-debug-overview-action-button"),l.label=`$(type-hierarchy) ${d(6354,null)}`,this.loadDisposables.add(l.onDidClick(()=>{this._onNavigate.fire("flowchart")}))}renderMetricsShimmer(e){let t=[d(6366,null),d(6367,null),d(6369,null),d(6365,null),d(6368,null)];for(let o of t){let n=R(e,af(".chat-debug-overview-metric-card"));R(n,af("div.chat-debug-overview-metric-label",void 0,o));let r=R(n,af("div.chat-debug-overview-metric-value")),s=R(r,af("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(6366,null),value:String(o.length)},{label:d(6367,null),value:String(n.length)},{label:d(6369,null),value:s.toLocaleString()},{label:d(6365,null),value:String(r.length)},{label:d(6368,null),value:String(t.length)}];for(let c of l){let u=R(e,af(".chat-debug-overview-metric-card"));R(u,af("div.chat-debug-overview-metric-label",void 0,c.label)),R(u,af("div.chat-debug-overview-metric-value",void 0,c.value))}}};GOe=I([m(1,Si),m(2,em),m(3,At),m(4,Ls)],GOe);var X_i=_;function zB(a,i=""){return a==null||typeof a!="string"?i:a}var Een=Wu.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit"});function ivo(a,i){switch(i.created.textContent=Een.value.format(a.created),a.kind){case"toolCall":i.name.textContent=zB(a.toolName,d(6267,null)),i.details.textContent=zB(a.result);break;case"modelTurn":i.name.textContent=zB(a.model)||d(6265,null),i.details.textContent=[zB(a.requestName),a.totalTokens!==void 0?d(6266,null,a.totalTokens):""].filter(Boolean).join(" \xB7 ");break;case"generic":i.name.textContent=zB(a.name,d(6267,null)),i.details.textContent=zB(a.details);break;case"subagentInvocation":i.name.textContent=zB(a.agentName,d(6267,null)),i.details.textContent=zB(a.description)||zB(a.status);break;case"userMessage":i.name.textContent=d(6268,null),i.details.textContent=zB(a.message);break;case"agentResponse":i.name.textContent=d(6264,null),i.details.textContent=zB(a.message);break}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 ovo(a){a.classList.add("chat-debug-log-row");let i=R(a,X_i("span.chat-debug-log-created")),e=R(a,X_i("span.chat-debug-log-name")),t=R(a,X_i("span.chat-debug-log-details"));return{container:a,created:i,name:e,details:t}}var Eot=class a{static{this.TEMPLATE_ID="chatDebugEvent"}get templateId(){return a.TEMPLATE_ID}renderTemplate(i){return ovo(i)}renderElement(i,e,t){ivo(i,t)}disposeTemplate(i){}},Tot=class{getHeight(i){return 28}getTemplateId(i){return Eot.TEMPLATE_ID}},$zt=class a{static{this.TEMPLATE_ID="chatDebugEvent"}get templateId(){return a.TEMPLATE_ID}renderTemplate(i){return ovo(i)}renderElement(i,e,t){ivo(i.element,t)}disposeTemplate(i){}};function nvo(a){switch(a.kind){case"toolCall":{let i=[d(6260,null,a.toolName)];return a.toolCallId&&i.push(d(6249,null,a.toolCallId)),a.result&&i.push(d(6258,null,a.result)),a.durationInMillis!==void 0&&i.push(d(6251,null,a.durationInMillis)),a.input&&i.push(`
${d(6252,null)}
${a.input}`),a.output&&i.push(`
${d(6256,null)}
${a.output}`),i.join(`
`)}case"modelTurn":{let i=[a.model??d(6254,null)];return a.inputTokens!==void 0&&i.push(d(6253,null,a.inputTokens)),a.outputTokens!==void 0&&i.push(d(6257,null,a.outputTokens)),a.totalTokens!==void 0&&i.push(d(6262,null,a.totalTokens)),a.durationInMillis!==void 0&&i.push(d(6251,null,a.durationInMillis)),i.join(`
`)}case"generic":return`${a.name}
${a.details??""}`;case"subagentInvocation":{let i=[d(6247,null,a.agentName)];return a.description&&i.push(d(6250,null,a.description)),a.status&&i.push(d(6259,null,a.status)),a.durationInMillis!==void 0&&i.push(d(6251,null,a.durationInMillis)),a.toolCallCount!==void 0&&i.push(d(6261,null,a.toolCallCount)),a.modelTurnCount!==void 0&&i.push(d(6255,null,a.modelTurnCount)),i.join(`
`)}case"userMessage":{let i=[d(6263,null,a.message)];for(let e of a.sections)i.push(`
--- ${e.name} ---
${e.content}`);return i.join(`
`)}case"agentResponse":{let i=[d(6248,null,a.message)];for(let e of a.sections)i.push(`
--- ${e.name} ---
${e.content}`);return i.join(`
`)}}}var $Oe=_;function _ot(a,i,e,t,o=!1){let n=o;i.tabIndex=0,i.role="button",a.setAttribute("aria-hidden","true");let r=()=>{Rt(a);let s=n?M.chevronRight:M.chevronDown;a.classList.add(...q.asClassName(s).split(" ")),e.style.display=n?"none":"block",i.style.borderRadius=n?"":"3px 3px 0 0",i.setAttribute("aria-expanded",String(!n))};r(),t.add(j(i,re.CLICK,()=>{n=!n,a.className="chat-debug-message-section-chevron",r()})),t.add(j(i,re.KEY_DOWN,s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),i.click())}))}function qOe(a,i,e,t=!1){let o=R(a,$Oe("div.chat-debug-message-section")),n=R(o,$Oe("div.chat-debug-message-section-header")),r=R(n,$Oe("span.chat-debug-message-section-chevron"));R(n,$Oe("span.chat-debug-message-section-title",void 0,i.name));let s=$Oe("pre.chat-debug-message-section-content");s.textContent=i.content,s.tabIndex=0;let l=R(o,$Oe("div.chat-debug-message-section-content-wrapper"));l.appendChild(s),_ot(r,n,l,e,t)}var Lm=_;function Ten(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 _en(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 rvo(a,i,e,t,o,n,r,s,l,c){let u=Lm(`a.${RB.className}.show-file-icons`);u.tabIndex=-1;let p=R(u,Lm("span.icon")),h=js(o,n,a,e);p.classList.add(...h),R(u,Lm("span.icon-label",void 0,i));let g=s.getUriLabel(a,{relative:!0}),f=c?`${g} ${c}`:g;return l.add(r.setupManagedHover(Ni("element"),u,f)),l.add(j(u,re.CLICK,v=>{v.preventDefault(),v.stopPropagation(),t.open(a)})),u}function svo(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 avo(a,i,e,t,o,n){let r=new P,s=Lm("div.chat-debug-file-list");s.tabIndex=0;let l=a.discoveryType.charAt(0).toUpperCase()+a.discoveryType.slice(1);R(s,Lm("div.chat-debug-file-list-title",void 0,d(6220,null,l))),R(s,Lm("div.chat-debug-file-list-summary",void 0,d(6238,null,a.files.length)));let c=a.files.filter(p=>p.status==="loaded");if(c.length>0){let p=R(s,Lm("div.chat-debug-file-list-section"));R(p,Lm("div.chat-debug-file-list-section-title",void 0,d(6222,null,c.length)));let h=new Map;for(let v of c){let b=_en(v,n,a.discoveryType),S=h.get(b);S||(S=[],h.set(b,S)),S.push(v)}let g=R(p,Lm("div.chat-debug-file-list-rows"));g.setAttribute("role","list"),g.setAttribute("aria-label",d(6223,null));let f=[];for(let[v,b]of h){let S=R(g,Lm("div.chat-debug-file-list-group-header")),y=b[0];if(y.extensionId){let w=R(S,Lm("a.chat-debug-file-list-group-label.chat-debug-file-list-badge-link"));w.textContent=v,w.tabIndex=-1,r.add(o.setupManagedHover(Ni("element"),w,d(6224,null,y.extensionId))),r.add(j(w,re.CLICK,k=>{k.preventDefault(),k.stopPropagation(),i.open(A.parse(`command:extension.open?${encodeURIComponent(JSON.stringify([y.extensionId]))}`),{allowCommands:!0})}))}else R(S,Lm("span.chat-debug-file-list-group-label",void 0,v));for(let w of b){let k=R(g,Lm("div.chat-debug-file-list-row"));R(k,Lm(`span.chat-debug-file-list-icon${q.asCSSSelector(M.check)}`)),k.appendChild(rvo(w.uri,w.name??w.uri.path,0,i,e,t,o,n,r));let T=n.getUriLabel(w.uri,{relative:!0});k.setAttribute("aria-label",T);let N=w.uri;f.push({element:k,activate:()=>i.open(N)})}}svo(g,f,r)}let u=a.files.filter(p=>p.status==="skipped");if(u.length>0){let p=R(s,Lm("div.chat-debug-file-list-section"));R(p,Lm("div.chat-debug-file-list-section-title",void 0,d(6233,null,u.length)));let h=new Map;for(let v of u){let b=v.skipReason??d(6239,null),S=h.get(b);S||(S=[],h.set(b,S)),S.push(v)}let g=R(p,Lm("div.chat-debug-file-list-rows"));g.setAttribute("role","list"),g.setAttribute("aria-label",d(6234,null));let f=[];for(let[v,b]of h){let S=R(g,Lm("div.chat-debug-file-list-group-header"));R(S,Lm("span.chat-debug-file-list-group-label",void 0,v));for(let y of b){let w=R(g,Lm("div.chat-debug-file-list-row"));R(w,Lm(`span.chat-debug-file-list-icon${q.asCSSSelector(M.close)}`));let k="";y.errorMessage&&(k+=y.errorMessage),y.duplicateOf&&(k&&(k+=", "),k+=d(6221,null,y.duplicateOf.path)),w.appendChild(rvo(y.uri,y.name??y.uri.path,0,i,e,t,o,n,r)),k&&R(w,Lm("span.chat-debug-file-list-detail",void 0,` (${k})`));let T=n.getUriLabel(y.uri,{relative:!0});w.setAttribute("aria-label",T);let N=y.uri;f.push({element:w,activate:()=>i.open(N)})}}svo(g,f,r)}if(a.sourceFolders&&a.sourceFolders.length>0){let p=R(s,Lm("div.chat-debug-message-section")),h=R(p,Lm("div.chat-debug-message-section-header")),g=R(h,Lm("span.chat-debug-message-section-chevron"));R(h,Lm("span.chat-debug-message-section-title",void 0,d(6235,null,a.sourceFolders.length)));let f=Ten(a.discoveryType);if(f){let y=r.add(new Mi(h,{title:d(6225,null),ariaLabel:d(6219,null),hoverDelegate:Ni("mouse")}));y.icon=M.settingsGear,y.element.classList.add("chat-debug-settings-gear"),r.add(j(y.element,re.MOUSE_ENTER,()=>{h.classList.add("chat-debug-settings-gear-header-passthrough")})),r.add(j(y.element,re.MOUSE_LEAVE,()=>{h.classList.remove("chat-debug-settings-gear-header-passthrough")})),r.add(y.onDidClick(w=>{w&&$t.stop(w,!0),i.open(A.parse(`command:workbench.action.openSettings?${encodeURIComponent(JSON.stringify([`@id:${f}`]))}`),{allowCommands:!0})}))}let v=R(p,Lm("div.chat-debug-source-folder-content"));v.tabIndex=0,v.setAttribute("role","region"),v.setAttribute("aria-label",d(6236,null));let b=a.discoveryType.charAt(0).toUpperCase()+a.discoveryType.slice(1),S=b.endsWith("s")?b:b+"s";R(v,Lm("div.chat-debug-source-folder-note",void 0,d(6237,null,S)));for(let y=0;y<a.sourceFolders.length;y++){let w=a.sourceFolders[y],k=R(v,Lm("div.chat-debug-source-folder-row"));R(k,Lm("span.chat-debug-source-folder-index",void 0,`${y+1}.`)),R(k,Lm("span.chat-debug-source-folder-label",void 0,w.uri.path))}_ot(g,h,v,r,!0)}return{element:s,disposables:r}}function lvo(a){let i=[],e=a.discoveryType.charAt(0).toUpperCase()+a.discoveryType.slice(1);i.push(d(6226,null,e)),i.push(d(6231,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(6228,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(6229,null,o.length));let n=new Map;for(let r of o){let s=r.skipReason??d(6232,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(6227,null,l.duplicateOf.path)),u+=` (${p.join(", ")})`}i.push(u)}}}if(a.sourceFolders&&a.sourceFolders.length>0){i.push(""),i.push(d(6230,null,a.sourceFolders.length));for(let n of a.sourceFolders)i.push(`  ${n.uri.path}`)}return i.join(`
`)}var xD=_;function cvo(a){let i=new P,e=xD("div.chat-debug-message-content");if(e.tabIndex=0,R(e,xD("div.chat-debug-message-content-title",void 0,d(6330,null))),R(e,xD("div.chat-debug-message-content-summary",void 0,a.message)),a.sections.length>0){let t=R(e,xD("div.chat-debug-message-sections"));R(t,xD("div.chat-debug-message-sections-label",void 0,d(6328,null,a.sections.length)));for(let o of a.sections)qOe(t,o,i)}return{element:e,disposables:i}}function dvo(a){let i=new P,e=xD("div.chat-debug-message-content");if(e.tabIndex=0,R(e,xD("div.chat-debug-message-content-title",void 0,d(6327,null))),R(e,xD("div.chat-debug-message-content-summary",void 0,a.message)),a.sections.length>0){let t=R(e,xD("div.chat-debug-message-sections"));R(t,xD("div.chat-debug-message-sections-label",void 0,d(6329,null,a.sections.length)));for(let o of a.sections)qOe(t,o,i)}return{element:e,disposables:i}}function J_i(a){let i=[],e=a.kind==="userMessage"?d(6330,null):d(6327,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(`
`)}function uvo(a){let i=new P,e=xD("div.chat-debug-message-content");e.tabIndex=0;let t=a.type==="user"?d(6330,null):d(6327,null);if(R(e,xD("div.chat-debug-message-content-title",void 0,t)),R(e,xD("div.chat-debug-message-content-summary",void 0,a.message)),a.sections.length>0){let o=R(e,xD("div.chat-debug-message-sections")),n=a.type==="user"?d(6328,null,a.sections.length):d(6329,null,a.sections.length);R(o,xD("div.chat-debug-message-sections-label",void 0,n));for(let r of a.sections)qOe(o,r,i)}return{element:e,disposables:i}}function pvo(a){let i=[],e=a.type==="user"?d(6330,null):d(6327,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 F2=_,Den=Kg("chatDebugTokenizer",{createHTML(a){return a}});function mvo(a){try{return{parsed:JSON.parse(a),isJSON:!0}}catch{return{isJSON:!1}}}function hvo(a,i,e,t,o,n=!1){let r=R(a,F2("div.chat-debug-message-section")),s=R(r,F2("div.chat-debug-message-section-header")),l=R(s,F2("span.chat-debug-message-section-chevron"));R(s,F2("span.chat-debug-message-section-title",void 0,i));let c=R(r,F2("div.chat-debug-message-section-content-wrapper")),u=R(c,F2("pre.chat-debug-message-section-content"));if(u.tabIndex=0,t){let p=Den?.createHTML(t)??t;u.innerHTML=p}else u.textContent=e;_ot(l,s,c,o,n)}async function gvo(a,i){let e=new P,t=F2("div.chat-debug-message-content");t.tabIndex=0,R(t,F2("div.chat-debug-message-content-title",void 0,a.toolName));let o=[];a.result&&o.push(a.result==="success"?d(6384,null):d(6381,null)),a.durationInMillis!==void 0&&o.push(d(6379,null,a.durationInMillis)),o.length>0&&R(t,F2("div.chat-debug-message-content-summary",void 0,o.join(" \xB7 ")));let n=R(t,F2("div.chat-debug-message-sections"));if(a.input){let r=mvo(a.input),s=r.isJSON?JSON.stringify(r.parsed,null,2):a.input,l=r.isJSON?await bW(i,s,"json"):void 0;hvo(n,d(6378,null),s,l,e)}if(a.output){let r=mvo(a.output),s=r.isJSON?JSON.stringify(r.parsed,null,2):a.output,l=r.isJSON?await bW(i,s,"json"):void 0;hvo(n,d(6382,null),s,l,e)}return{element:t,disposables:e}}function fvo(a){let i=[];if(i.push(d(6385,null,a.toolName)),a.result&&i.push(d(6383,null,a.result)),a.durationInMillis!==void 0&&i.push(d(6380,null,a.durationInMillis)),a.input){i.push(""),i.push(`[${d(6378,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(6382,null)}]`);try{let e=JSON.parse(a.output);i.push(JSON.stringify(e,null,2))}catch{i.push(a.output)}}return i.join(`
`)}var JR=_;function vvo(a){let i=new P,e=JR("div.chat-debug-message-content");e.tabIndex=0,R(e,JR("div.chat-debug-message-content-title",void 0,d(6349,null)));let t=[];a.requestName&&t.push(a.requestName),a.model&&t.push(a.model),a.status&&t.push(a.status),a.durationInMillis!==void 0&&t.push(d(6333,null,a.durationInMillis)),t.length>0&&R(e,JR("div.chat-debug-message-content-summary",void 0,t.join(" \xB7 ")));let o=R(e,JR("div.chat-debug-model-turn-details"));if(a.inputTokens!==void 0&&R(o,JR("div",void 0,d(6337,null,a.inputTokens))),a.outputTokens!==void 0&&R(o,JR("div",void 0,d(6344,null,a.outputTokens))),a.cachedTokens!==void 0&&R(o,JR("div",void 0,d(6331,null,a.cachedTokens))),a.totalTokens!==void 0&&R(o,JR("div",void 0,d(6350,null,a.totalTokens))),a.timeToFirstTokenInMillis!==void 0&&R(o,JR("div",void 0,d(6352,null,a.timeToFirstTokenInMillis))),a.maxInputTokens!==void 0&&R(o,JR("div",void 0,d(6339,null,a.maxInputTokens))),a.maxOutputTokens!==void 0&&R(o,JR("div",void 0,d(6341,null,a.maxOutputTokens))),a.errorMessage&&R(o,JR("div.chat-debug-model-turn-error",void 0,d(6335,null,a.errorMessage))),a.sections&&a.sections.length>0){let n=R(e,JR("div.chat-debug-message-sections"));R(n,JR("div.chat-debug-message-sections-label",void 0,d(6347,null,a.sections.length)));for(let r of a.sections)qOe(n,r,i)}return{element:e,disposables:i}}function bvo(a){let i=[];if(i.push(d(6346,null,a.requestName)),a.model&&i.push(d(6343,null,a.model)),a.status&&i.push(d(6348,null,a.status)),a.durationInMillis!==void 0&&i.push(d(6334,null,a.durationInMillis)),a.timeToFirstTokenInMillis!==void 0&&i.push(d(6353,null,a.timeToFirstTokenInMillis)),a.inputTokens!==void 0&&i.push(d(6338,null,a.inputTokens)),a.outputTokens!==void 0&&i.push(d(6345,null,a.outputTokens)),a.cachedTokens!==void 0&&i.push(d(6332,null,a.cachedTokens)),a.totalTokens!==void 0&&i.push(d(6351,null,a.totalTokens)),a.maxInputTokens!==void 0&&i.push(d(6340,null,a.maxInputTokens)),a.maxOutputTokens!==void 0&&i.push(d(6342,null,a.maxOutputTokens)),a.errorMessage&&i.push(d(6336,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 qzt=_,jte=class extends C{constructor(e,t,o,n,r,s,l){super();this.chatDebugService=t;this.instantiationService=o;this.editorService=n;this.clipboardService=r;this.hoverService=s;this.openerService=l;this._onDidHide=this._register(new E);this.onDidHide=this._onDidHide.event;this.detailDisposables=this._register(new P);this.currentDetailText="";this.element=R(e,qzt(".chat-debug-detail-panel")),this.contentContainer=qzt(".chat-debug-detail-content"),xo(this.element),this._register(j(this.element,re.KEY_DOWN,c=>{if((c.ctrlKey||c.metaKey)&&c.key==="a"){let u=c.target;if(u&&this.element.contains(u)){c.preventDefault();let p=Me(u),h=p.getSelection();if(h){let g=p.document.createRange();g.selectNodeContents(u),h.removeAllRanges(),h.addRange(g)}}}}))}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;bn(this.element),Rt(this.element),Rt(this.contentContainer),this.detailDisposables.clear();let o=R(this.element,qzt(".chat-debug-detail-header"));this.element.appendChild(this.contentContainer);let n=this.detailDisposables.add(new Mi(o,{ariaLabel:d(6244,null),title:d(6244,null)}));n.element.classList.add("chat-debug-detail-button"),n.icon=M.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 Mi(o,{ariaLabel:d(6243,null),title:d(6243,null)}));r.element.classList.add("chat-debug-detail-button"),r.icon=M.copy,this.detailDisposables.add(r.onDidClick(()=>{this.clipboardService.writeText(this.currentDetailText)}));let s=this.detailDisposables.add(new Mi(o,{ariaLabel:d(6242,null),title:d(6242,null)}));if(s.element.classList.add("chat-debug-detail-button"),s.icon=M.close,this.detailDisposables.add(s.onDidClick(()=>{this.hide()})),t&&t.kind==="fileList"){this.currentDetailText=lvo(t);let{element:l,disposables:c}=this.instantiationService.invokeFunction(u=>avo(t,this.openerService,u.get(Ct),u.get(kt),this.hoverService,u.get(ot)));this.detailDisposables.add(c),this.contentContainer.appendChild(l)}else if(t&&t.kind==="toolCall"){this.currentDetailText=fvo(t);let l=this.instantiationService.invokeFunction(p=>p.get(kt)),{element:c,disposables:u}=await gvo(t,l);if(this.currentDetailEventId!==e.id){u.dispose();return}this.detailDisposables.add(u),this.contentContainer.appendChild(c)}else if(t&&t.kind==="message"){this.currentDetailText=pvo(t);let{element:l,disposables:c}=uvo(t);this.detailDisposables.add(c),this.contentContainer.appendChild(l)}else if(t&&t.kind==="modelTurn"){this.currentDetailText=bvo(t);let{element:l,disposables:c}=vvo(t);this.detailDisposables.add(c),this.contentContainer.appendChild(l)}else if(e.kind==="userMessage"){this.currentDetailText=J_i(e);let{element:l,disposables:c}=cvo(e);this.detailDisposables.add(c),this.contentContainer.appendChild(l)}else if(e.kind==="agentResponse"){this.currentDetailText=J_i(e);let{element:l,disposables:c}=dvo(e);this.detailDisposables.add(c),this.contentContainer.appendChild(l)}else{let l=R(this.contentContainer,qzt("pre"));l.tabIndex=0,t?this.currentDetailText=t.value:this.currentDetailText=nvo(e),l.textContent=this.currentDetailText}}get isVisible(){return this.element.style.display!=="none"}focus(){this.firstFocusableElement?.focus()}hide(){this.currentDetailEventId=void 0,this.firstFocusableElement=void 0,xo(this.element),Rt(this.element),Rt(this.contentContainer),this.detailDisposables.clear(),this._onDidHide.fire()}};jte=I([m(1,em),m(2,F),m(3,ee),m(4,Wi),m(5,tt),m(6,Qe)],jte);var by=_;var jOe=class extends C{constructor(e,t,o,n,r,s,l){super();this.filterState=t;this.chatService=o;this.chatDebugService=n;this.instantiationService=r;this.contextKeyService=s;this.chatWidgetService=l;this._onNavigate=this._register(new E);this.onNavigate=this._onNavigate.event;this.logsViewMode="list";this.events=[];this.eventListener=this._register(new me);this.sessionStateDisposable=this._register(new me);this.container=R(e,by(".chat-debug-logs")),xo(this.container);let c=R(this.container,by(".chat-debug-breadcrumb"));this.breadcrumbWidget=this._register(new bK(c,3,void 0,M.chevronRight,f1)),this._register(zOe(c,this.breadcrumbWidget)),this._register(this.breadcrumbWidget.onDidSelectItem(T=>{if(T.type==="select"&&T.item instanceof pT){this.breadcrumbWidget.setSelection(void 0);let O=this.breadcrumbWidget.getItems().indexOf(T.item);O===0?this._onNavigate.fire("home"):O===1&&this._onNavigate.fire("overview")}})),this.headerContainer=R(this.container,by(".chat-debug-editor-header"));let u=this._register(this.contextKeyService.createScoped(this.headerContainer)),p=Gzt(this.filterState,u);p();let h=this._register(this.instantiationService.createChild(new Io([X,u])));this.filterWidget=this._register(h.createInstance($z,{placeholder:d(6320,null),ariaLabel:d(6316,null)})),this.viewModeToggle=this._register(new Mi(this.headerContainer,{...Ko,secondary:!0,title:d(6324,null)})),this.viewModeToggle.element.classList.add("chat-debug-view-mode-toggle","monaco-text-button"),this.updateViewModeToggle(),this._register(this.viewModeToggle.onDidClick(()=>{this.toggleViewMode()})),R(this.headerContainer,by(".viewpane-filter-container")).appendChild(this.filterWidget.element);let f=this._register(new Mi(this.headerContainer,{...Ko,secondary:!0,title:d(6326,null)}));f.element.classList.add("chat-debug-troubleshoot-button","monaco-text-button"),R(f.element,by(`span${q.asCSSSelector(M.chatSparkle)}`)),this._register(f.onDidClick(async()=>{if(!this.currentSessionResource)return;let T=await this.chatWidgetService.openSession(this.currentSessionResource);if(T){let N=await bNe(this.currentSessionResource,this.chatDebugService);T.attachmentModel.addContext(N),T.focusInput()}})),this._register(this.filterWidget.onDidChangeFilterText(T=>{this.filterState.setTextFilter(T)})),this._register(this.filterState.onDidChange(()=>{p(),this.updateMoreFiltersChecked(),this.refreshList()}));let v=R(this.container,by(".chat-debug-logs-content")),b=R(v,by(".chat-debug-logs-main"));this.tableHeader=R(b,by(".chat-debug-table-header")),R(this.tableHeader,by("span.chat-debug-col-created",void 0,d(6313,null))),R(this.tableHeader,by("span.chat-debug-col-name",void 0,d(6315,null))),R(this.tableHeader,by("span.chat-debug-col-details",void 0,d(6314,null))),this.bodyContainer=R(b,by(".chat-debug-logs-body")),this.listContainer=R(this.bodyContainer,by(".chat-debug-list-container"));let S={getAriaLabel:T=>{switch(T.kind){case"toolCall":return d(6310,null,T.toolName,T.result?` (${T.result})`:"");case"modelTurn":return d(6307,null,T.model??d(6306,null),T.totalTokens?d(6309,null,T.totalTokens):"");case"generic":return`${T.category?T.category+": ":""}${T.name}: ${T.details??""}`;case"subagentInvocation":return d(6308,null,T.agentName,T.description?` - ${T.description}`:"");case"userMessage":return d(6311,null,T.message);case"agentResponse":return d(6305,null,T.message)}},getWidgetAriaLabel:()=>d(6312,null)},y=0,w=new WeakMap,k={getId:T=>{if(T.id)return T.id;let N=w.get(T);return N||(N=`_fallback_${y++}`,w.set(T,N)),N}};this.list=this._register(this.instantiationService.createInstance(Rl,"ChatDebugEvents",this.listContainer,new Tot,[new Eot],{identityProvider:k,accessibilityProvider:S})),this.treeContainer=R(this.bodyContainer,by(".chat-debug-list-container")),xo(this.treeContainer),this.tree=this._register(this.instantiationService.createInstance(mg,"ChatDebugEventsTree",this.treeContainer,new Tot,[new $zt],{identityProvider:k,accessibilityProvider:S})),this.shimmerRow=R(this.bodyContainer,by(".chat-debug-logs-shimmer-row")),this.shimmerRow.setAttribute("aria-label",d(6318,null)),this.shimmerRow.setAttribute("aria-busy","true"),R(this.shimmerRow,by("span.chat-debug-logs-shimmer-bar")),xo(this.shimmerRow),this.detailPanel=this._register(this.instantiationService.createInstance(jte,v)),this._register(this.detailPanel.onDidHide(()=>{this.list.getSelection().length>0&&this.list.setSelection([]),this.tree.getSelection().length>0&&this.tree.setSelection([])})),this._register(this.list.onDidChangeSelection(T=>{let N=T.elements[0];N?this.detailPanel.show(N):this.detailPanel.hide()})),this._register(this.tree.onDidChangeSelection(T=>{let N=T.elements[0];N?this.detailPanel.show(N):this.detailPanel.hide()}))}setSession(e){this.currentSessionResource=e}setFilterText(e){this.filterWidget.setFilterText(e)}show(){bn(this.container),this.loadEvents(),this.refreshList()}hide(){xo(this.container)}focus(){this.logsViewMode==="tree"?this.tree.domFocus():this.list.domFocus()}updateBreadcrumb(){if(!this.currentSessionResource)return;let e=this.chatService.getSessionTitle(this.currentSessionResource)||cs.parseLocalSessionId(this.currentSessionResource)||this.currentSessionResource.toString();this.breadcrumbWidget.setItems([new pT(d(6323,null),!0),new pT(e,!0),new pT(d(6319,null))])}layout(e){this.currentDimension=e;let t=22,o=this.headerContainer.offsetHeight,n=this.tableHeader.offsetHeight,s=this.detailPanel.element.style.display!=="none"?this.detailPanel.element.offsetWidth:0,l=e.height-t-o-n,c=e.width-s;this.logsViewMode==="tree"?this.tree.layout(l,c):this.list.layout(l,c)}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)}),e=e.filter(o=>this.filterState.isTimestampVisible(o.created));let t=this.filterState.textFilterWithoutTimestamps;if(t){let o=t.split(/\s*,\s*/).filter(s=>s.length>0),n=o.filter(s=>!s.startsWith("!")).map(s=>s.trim()),r=o.filter(s=>s.startsWith("!")).map(s=>s.slice(1).trim()).filter(s=>s.length>0);e=e.filter(s=>{let l=c=>{if(s.kind.toLowerCase().includes(c))return!0;switch(s.kind){case"toolCall":return s.toolName.toLowerCase().includes(c)||(s.input?.toLowerCase().includes(c)??!1)||(s.output?.toLowerCase().includes(c)??!1);case"modelTurn":return s.model?.toLowerCase().includes(c)??!1;case"generic":return s.name.toLowerCase().includes(c)||(s.details?.toLowerCase().includes(c)??!1)||(s.category?.toLowerCase().includes(c)??!1);case"subagentInvocation":return s.agentName.toLowerCase().includes(c)||(s.description?.toLowerCase().includes(c)??!1);case"userMessage":return s.message.toLowerCase().includes(c)||s.sections.some(u=>u.name.toLowerCase().includes(c)||u.content.toLowerCase().includes(c));case"agentResponse":return s.message.toLowerCase().includes(c)||s.sections.some(u=>u.name.toLowerCase().includes(c)||u.content.toLowerCase().includes(c))}};return r.some(c=>l(c))?!1:n.length>0?n.some(c=>l(c)):!0})}this.logsViewMode==="list"?this.list.splice(0,this.list.length,e):this.refreshTree(e),this.updateShimmerPosition(e.length)}updateShimmerPosition(e){this.shimmerRow.style.top=`${e*28}px`}addEvent(e){this.events.push(e),this.refreshList()}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.events.push(o),this.refreshList())}),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=hn(e,t),this.updateBreadcrumb(),this.trackSessionState()}trackSessionState(){if(!this.currentSessionResource){xo(this.shimmerRow),this.sessionStateDisposable.clear();return}let e=this.chatService.getSession(this.currentSessionResource);if(!e){xo(this.shimmerRow),this.sessionStateDisposable.clear();return}this.sessionStateDisposable.value=he(t=>{e.requestInProgress.read(t)?bn(this.shimmerRow):xo(this.shimmerRow)})}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",xo(this.listContainer),bn(this.treeContainer)):(this.logsViewMode="list",bn(this.listContainer),xo(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";R(e,by(`span${q.asCSSSelector(t?M.listTree:M.listFlat)}`));let o=R(e,by("span.chat-debug-view-mode-labels")),n=R(o,by("span.chat-debug-view-mode-label"));n.textContent=d(6325,null);let r=R(o,by("span.chat-debug-view-mode-label"));r.textContent=d(6317,null),t?r.classList.add("hidden"):n.classList.add("hidden");let s=t?d(6321,null):d(6322,null);e.setAttribute("aria-label",s),this.viewModeToggle.setTitle(s)}updateMoreFiltersChecked(){this.filterWidget.checkMoreFilters(!this.filterState.isAllFiltersDefault())}};jOe=I([m(2,Si),m(3,em),m(4,F),m(5,X),m(6,At)],jOe);function Len(a,i){return a.length<=i?a:a.substring(0,i-1)+"\u2026"}function eDi(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=Men(u),g=Aen(u,h),f=Oen(u),v;if(h==="subagentInvocation"&&(v=o(u),v&&(g=Len(v,30)+(g?` \xB7 ${g}`:""),f&&!f.includes(v)))){let b=f.split(`
`);b.splice(1,0,v),f=b.join(`
`)}return{id:u.id??`event-${a.indexOf(u)}`,kind:h,category:u.kind==="generic"?u.category:void 0,label:Pen(u,h),sublabel:g,description:v,tooltip:f,isError:Nen(u),created:u.created.getTime(),children:p?.map(c)??[]}}return l.map(c)}function tDi(a,i){let e=Z_i(a,i.isKindVisible);return i.textFilter&&(e=wvo(e,i.textFilter)),e}function Z_i(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(...Z_i(o.children,i));continue}let n=Z_i(o.children,i);n!==o.children?(t=!0,e.push({...o,children:n})):e.push(o)}return t?e:a}function Ren(a,i){return a.label.toLowerCase().includes(i)||(a.sublabel?.toLowerCase().includes(i)??!1)||(a.tooltip?.toLowerCase().includes(i)??!1)}function wvo(a,i){let e=[];for(let t of a){if(Ren(t,i)){e.push(t);continue}let o=wvo(t.children,i);o.length>0&&e.push({...t,children:o})}return e}function Cvo(a){let i=0;for(let e of a)i+=1+Cvo(e.children);return i}function iDi(a,i){let e=Cvo(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 Svo(a){return a.kind==="generic"&&a.category==="discovery"}function Qzt(a){let i=[],e=0;for(;e<a.length;){let t=a[e];if(!Svo(t)){let u=Qzt(t.children);i.push(u!==t.children?{...t,children:u}:t),e++;continue}let o=[t],n=e+1;for(;n<a.length&&Svo(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(6281,null,l[0],o.length-1);i.push({id:r,kind:"generic",category:"discovery",label:c,sublabel:d(6282,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 Ivo(a){return a.kind==="toolCall"}function yvo(a){return a.label}function Dot(a){let i=[],e=0;for(;e<a.length;){let t=a[e];if(!Ivo(t)){let l=Dot(t.children);i.push(l!==t.children?{...t,children:l}:t),e++;continue}let o=yvo(t),n=[t],r=e+1;for(;r<a.length&&Ivo(a[r])&&yvo(a[r])===o;)n.push(a[r]),r++;if(n.length<2){let l=Dot(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(6286,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 Men(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 Pen(a,i){switch(i??a.kind){case"userMessage":return d(6297,null);case"modelTurn":return a.kind==="modelTurn"?a.model??d(6283,null):d(6283,null);case"toolCall":return a.kind==="toolCall"?a.toolName:a.kind==="generic"?a.name:"";case"subagentInvocation":return a.kind==="subagentInvocation"?a.agentName:"";case"agentResponse":{if(a.kind==="agentResponse")return a.message||d(6284,null);if(a.kind==="generic"){let t=/\(([^)]+)\)\s*$/.exec(a.name);if(t)return t[1]}return d(6284,null)}case"generic":return a.kind==="generic"?a.name:""}}function Aen(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(6285,null,a.totalTokens)),a.kind==="modelTurn"&&a.durationInMillis&&t.push(jzt(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(jzt(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(jzt(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.sections[0]?.content||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){n=s;break}}return n?n.length>60?n.substring(0,57)+"...":n:void 0}default:return}}function jzt(a){return a<1e3?`${a}ms`:`${(a/1e3).toFixed(1)}s`}function Nen(a){return a.kind==="toolCall"&&a.result==="error"||a.kind==="generic"&&a.level===3||a.kind==="subagentInvocation"&&a.status==="failed"}var Qte=500;function Oen(a){switch(a.kind){case"userMessage":{let i=a.message.trim();return i.length>Qte?i.substring(0,Qte)+"\u2026":i||void 0}case"toolCall":{let i=[a.toolName];if(a.input){let e=a.input.trim();i.push(d(6288,null,e.length>Qte?e.substring(0,Qte)+"\u2026":e))}if(a.output){let e=a.output.trim();i.push(d(6291,null,e.length>Qte?e.substring(0,Qte)+"\u2026":e))}return a.result&&i.push(d(6293,null,a.result)),i.join(`
`)}case"subagentInvocation":{let i=[a.agentName];return a.description&&i.push(a.description),a.status&&i.push(d(6294,null,a.status)),a.toolCallCount!==void 0&&i.push(d(6296,null,a.toolCallCount)),a.modelTurnCount!==void 0&&i.push(d(6290,null,a.modelTurnCount)),i.join(`
`)}case"generic":{if(a.details){let i=a.details.trim();return i.length>Qte?i.substring(0,Qte)+"\u2026":i}return}case"modelTurn":{let i=[];return a.model&&i.push(a.model),a.totalTokens&&i.push(d(6295,null,a.totalTokens)),a.inputTokens&&i.push(d(6289,null,a.inputTokens)),a.outputTokens&&i.push(d(6292,null,a.outputTokens)),a.durationInMillis&&i.push(d(6287,null,jzt(a.durationInMillis))),i.length>0?i.join(`
`):void 0}default:return}}var Xzt=36,Fen=52,_vo=140,Wen=320,oDi=16,Yzt=6,ZR=24,YOe=6,Ven=1.5,Lot=12,Rot=10,p8=12,QOe=24,nDi=40,Whe=22,xvo=3,Jzt=36,Ben=5e3;function Dvo(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)<=Ben?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 Lvo(a){return a==="userMessage"||a==="agentResponse"}function Rvo(a,i){let t=a.length*7+oDi*2,o=i?i.length*6+oDi*2:0;return Math.min(Wen,Math.max(_vo,t,o))}function kvo(a){return a.description?`${a.label}: ${a.description}`:a.label}function Evo(a){return a.length*6+p8*2+20}function Mvo(a){let i=a.children.length;for(let e of a.children)i+=Mvo(e);return i}function Pvo(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=Uen(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(rDi(f,v));p=g.exitNodes,u=Math.max(u,g.width),c+=g.height+ZR}else for(let g of h.children){let f=Avo(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(rDi(v,f.entryNode));p=f.exitNodes,u=Math.max(u,f.width),c+=f.height+ZR}return{exitNodes:p,maxWidth:u,endY:c}}function rDi(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 sDi(a,i){if(a.length===0)return{nodes:[],edges:[],subgraphs:[],width:0,height:0};let e=i?.collapsedIds,t=i?.expandedMergedIds,o=Dvo(a),n=[],r={nodes:[],edges:[],subgraphs:[]},{maxWidth:s,endY:l}=Pvo(o,QOe,QOe,0,[],r,e,t,n);Hen(n,r);let c=s+QOe*2,u=l-ZR+QOe;for(let p of r.nodes)c=Math.max(c,p.x+p.width+QOe),u=Math.max(u,p.y+p.height+QOe);return zen(r,c/2),{nodes:r.nodes,edges:r.edges,subgraphs:r.subgraphs,width:c,height:u}}function Hen(a,i){for(let e of a){let{mergedNode:t,children:o}=e,n=o.length*Xzt+(o.length-1)*ZR,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+nDi,u=t.y,p=0,h=[];for(let g of o){let f=Rvo(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:Xzt};h.push(v),i.nodes.push(v),p=Math.max(p,f),u+=Xzt+ZR}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(rDi(h[g],h[g+1]))}}function Avo(a,i,e,t,o,n,r){let s=(a.mergedNodes?.length??0)>=2,l=s&&n?.has(a.id),c=s?Jzt:0,u=Rvo(a.label,a.sublabel)+c,p=a.kind==="subagentInvocation",h=p&&o?.has(a.id),g=Lvo(a.kind)&&a.sublabel?Fen:Xzt,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 U=Whe+p8*2,G=Mvo(a),$=e+g+ZR-ZR/2,te=kvo(a),pe=Math.max(_vo,Evo(te))+p8*2;return v.subgraphs.push({label:te,x:i-p8,y:$,width:pe,height:U,depth:t,nodeId:a.id,collapsedChildCount:G}),v.edges.push({fromX:i+u/2,fromY:e+g,toX:i-p8+pe/2,toY:$}),v.width=Math.max(u,pe),v.height=g+ZR+U,v}if(a.children.length===0)return v;let b=p?t+1:t,S=p?p8:0,y=Dvo(a.children),w=e+g+ZR;p&&(w+=Whe);let{exitNodes:k,maxWidth:T,endY:N}=Pvo(y,i+S,w,b,[f],v,o,n,r),O=N-w-ZR,V=T;if(p){let U=kvo(a);V=Math.max(T,Evo(U)),v.subgraphs.push({label:U,x:i-p8,y:e+g+ZR-ZR/2,width:V+p8*2,height:O+Whe+ZR,depth:t,nodeId:a.id})}return v.width=Math.max(u,T+S*2,p?V+S*2:0),v.height=g+ZR+O+(p?Whe:0),v.exitNodes=k,v}function Uen(a,i,e,t,o,n,r){let s=[],l=0,c=0;for(let b of a){let S=Avo(b,0,e,t,o,n,r);s.push(S),l+=S.width,c=Math.max(c,S.height)}l+=(a.length-1)*nDi;let u=[],p=[],h=[],g=[],f=[],v=i;for(let b of s){let S=v,y=b.nodes.map(N=>({...N,x:N.x+S})),w=b.edges.map(N=>({fromId:N.fromId,toId:N.toId,fromX:N.fromX+S,fromY:N.fromY,toX:N.toX+S,toY:N.toY})),k=b.subgraphs.map(N=>({...N,x:N.x+S}));u.push(...y),p.push(...w),h.push(...k),g.push(y.find(N=>N.id===b.entryNode.id));let T=new Set(b.exitNodes.map(N=>N.id));f.push(...y.filter(N=>T.has(N.id))),v+=b.width+nDi}return{nodes:u,edges:p,subgraphs:h,entryNodes:g,exitNodes:f,width:l,height:c}}function zen(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 XOe="http://www.w3.org/2000/svg";function Wv(a,i){let e=document.createElementNS(XOe,a);for(let[t,o]of Object.entries(i))e.setAttribute(t,String(o));return e}function Ken(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 Tvo=["var(--vscode-charts-purple, #b267e6)","var(--vscode-charts-blue, #3dc9b0)","var(--vscode-charts-yellow, #e5c07b)","var(--vscode-charts-orange, #d19a66)"];function aDi(a){let i=new Map,e=Wv("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"),Gen(e,a.subgraphs,i),$en(e,a.edges),qen(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 Gen(a,i,e){for(let t=0;t<i.length;t++){let o=i[t],n=Tvo[o.depth%Tvo.length],r=o.collapsedChildCount!==void 0,s=document.createElementNS(XOe,"g");s.classList.add("chat-debug-flowchart-subgraph");let l={x:o.x,y:o.y,width:o.width,height:o.height,rx:YOe,ry:YOe},c=`sg-clip-${t}`,u=Wv("clipPath",{id:c});u.appendChild(Wv("rect",l)),a.appendChild(u),s.appendChild(Wv("rect",{...l,fill:n,opacity:.06+o.depth*.02})),s.appendChild(Wv("rect",{...l,fill:"none",stroke:n,"stroke-width":1,"stroke-dasharray":"6,3",opacity:.5})),s.appendChild(Wv("rect",{x:o.x,y:o.y,width:xvo,height:o.height,fill:n,opacity:.7,"clip-path":`url(#${c})`}));let p=document.createElementNS(XOe,"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=Wv("rect",{x:o.x,y:o.y,width:o.width,height:Whe,fill:n,opacity:.15,"clip-path":`url(#${c})`});p.appendChild(h);let g=r?"\u25B6":"\u25BC",f=Wv("text",{x:o.x+xvo+8,y:o.y+Whe/2+4,"font-size":Rot,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=Wv("text",{x:o.x+o.width/2,y:o.y+Whe+p8+4,"font-size":Rot,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 $en(a,i){let e={fill:"none",stroke:"var(--vscode-descriptionForeground)","stroke-width":Ven,"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(Wv("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(Wv("path",{...e,"stroke-linejoin":"round",d:c}))}}function qen(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(XOe,"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(XOe,"title");b.textContent=n.tooltip,r.appendChild(b)}let l=Ken(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:YOe,ry:YOe},p=`clip-${c}`,h=Wv("clipPath",{id:p});h.appendChild(Wv("rect",u)),a.appendChild(h);let g=3;r.appendChild(Wv("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:YOe+g,ry:YOe+g,fill:"none",stroke:"var(--vscode-focusBorder)","stroke-width":2})),r.appendChild(Wv("rect",{...u,fill:o,stroke:l,"stroke-width":n.isError?2:1.5})),r.appendChild(Wv("rect",{x:n.x,y:n.y,width:4,height:n.height,fill:l,"clip-path":`url(#${p})`}));let f=n.x+oDi;if(Lvo(n.kind)&&n.sublabel){let b=Wv("text",{x:f,y:n.y+Yzt+Rot,"font-size":Rot,fill:"var(--vscode-descriptionForeground)","font-family":t,"clip-path":`url(#${p})`});b.textContent=n.label,r.appendChild(b);let S=Wv("text",{x:f,y:n.y+n.height-Yzt-2,"font-size":Lot,fill:"var(--vscode-foreground)","font-family":t,"clip-path":`url(#${p})`});S.textContent=n.sublabel,r.appendChild(S)}else if(n.sublabel){let b=Wv("text",{x:f,y:n.y+Yzt+Lot,"font-size":Lot,fill:"var(--vscode-foreground)","font-family":t,"clip-path":`url(#${p})`});b.textContent=n.label,r.appendChild(b);let S=Wv("text",{x:f,y:n.y+n.height-Yzt,"font-size":Rot,fill:"var(--vscode-descriptionForeground)","font-family":t,"clip-path":`url(#${p})`});S.textContent=n.sublabel,r.appendChild(S)}else{let b=Wv("text",{x:f,y:n.y+n.height/2+Lot/2-1,"font-size":Lot,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"),jen(r,n,l,t)),a.appendChild(r)}}function jen(a,i,e,t){let o=i.x+i.width-Jzt,n=document.createElementNS(XOe,"g");n.classList.add("chat-debug-flowchart-merged-toggle"),n.setAttribute("data-merged-id",i.id),n.appendChild(Wv("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+Jzt/2,s=i.y+i.height/2,l=Wv("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(Wv("rect",{x:o,y:i.y,width:Jzt,height:i.height,fill:"transparent",cursor:"pointer"})),a.appendChild(n)}var W2=_,Nvo=.1,Ovo=5,Fvo=.15,Qen=.002,Yen=25,Zzt=100;var JOe=class extends C{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 P);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=Zzt;this.eventById=new Map;this.container=R(e,W2(".chat-debug-flowchart")),xo(this.container);let l=R(this.container,W2(".chat-debug-breadcrumb"));this.breadcrumbWidget=this._register(new bK(l,3,void 0,M.chevronRight,f1)),this._register(zOe(l,this.breadcrumbWidget)),this._register(this.breadcrumbWidget.onDidSelectItem(v=>{if(v.type==="select"&&v.item instanceof pT){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=R(this.container,W2(".chat-debug-editor-header"));let c=this.headerContainer,u=this._register(this.contextKeyService.createScoped(c)),p=Gzt(this.filterState,u);p();let h=this._register(this.instantiationService.createChild(new Io([X,u])));this.filterWidget=this._register(h.createInstance($z,{placeholder:d(6277,null),ariaLabel:d(6274,null)})),R(c,W2(".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=Zzt,this.hasUserPanned=!1,this.lastEventCount=0,this.load()}));let f=R(this.container,W2(".chat-debug-flowchart-content-wrapper"));this.content=R(f,W2(".chat-debug-flowchart-content")),this.detailPanel=this._register(this.instantiationService.createInstance(jte,f)),this.setupPanZoom(),this.setupKeyboard()}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=Zzt,this.detailPanel.hide()),this.currentSessionResource=e}show(){bn(this.container),this.load()}hide(){xo(this.container)}refresh(){this.container.style.display!=="none"&&this.load()}updateBreadcrumb(){if(!this.currentSessionResource)return;let e=this.chatService.getSessionTitle(this.currentSessionResource)||cs.parseLocalSessionId(this.currentSessionResource)||this.currentSessionResource.toString();this.breadcrumbWidget.setItems([new pT(d(6280,null),!0),new pT(e,!0),new pT(d(6273,null))])}load(){let e=ts(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=R(this.content,W2(".chat-debug-flowchart-empty"));u.textContent=d(6275,null);return}let n=eDi(t),r=tDi(n,{isKindVisible:(u,p)=>this.filterState.isKindVisible(u,p),textFilter:this.filterState.textFilter});if(r.length===0){let u=R(this.content,W2(".chat-debug-flowchart-empty"));u.textContent=d(6276,null);return}let s=iDi(r,this.visibleLimit),l=Dot(Qzt(s.nodes)),c=sDi(l,{collapsedIds:this.collapsedNodeIds,expandedMergedIds:this.expandedMergedIds});if(this.renderResult=aDi(c),this.svgWrapper=R(this.content,W2(".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=R(this.svgWrapper,W2(".chat-debug-flowchart-show-more")),h=this.loadDisposables.add(new Mi(p,{...Ko,secondary:!0,title:d(6279,null)}));h.label=d(6278,null,u),this.loadDisposables.add(h.onDidClick(()=>{this.visibleLimit+=Zzt,this.load()}))}o&&!this.hasUserPanned?Me(this.content).requestAnimationFrame(()=>{this.centerContent()}):this.applyTransform(),this.focusedElementId&&e&&!ts(this.headerContainer)&&this.restoreFocus(this.focusedElementId)}setupPanZoom(){this._register(j(this.content,re.MOUSE_DOWN,t=>this.handleMouseDown(t)));let e=Me(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(Fvo));break;case"-":!e.ctrlKey&&!e.metaKey&&(e.preventDefault(),this.zoomBy(-Fvo));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(Ovo,Math.max(Nvo,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<Yen&&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*Qen,s=Math.min(Ovo,Math.max(Nvo,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()}};JOe=I([m(2,Si),m(3,em),m(4,X),m(5,F)],JOe);var Xen=_,Yte=class extends pa{constructor(e,t,o,n,r,s,l,c,u){super(Yte.ID,e,t,o,n);this.instantiationService=r;this.chatDebugService=s;this.chatWidgetService=l;this.chatService=c;this.contextKeyService=u;this.viewState="home";this.sessionModelListener=this._register(new me);this.modelChangeListeners=this._register(new jt)}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=R(e,Xen(".chat-debug-editor")),this.filterState=this._register(new Kzt);let t=this._register(this.contextKeyService.createScoped(this.container));this._register(tvo(this.filterState,t)),this.homeView=this._register(this.instantiationService.createInstance(KOe,this.container)),this._register(this.homeView.onNavigateToSession(o=>{this.navigateToSession(o)})),this.overviewView=this._register(this.instantiationService.createInstance(GOe,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(jOe,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(JOe,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=>{this.viewState==="home"&&this.homeView?.render();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.viewState==="home"){let t=this.chatDebugService.activeSessionResource??this.savedSessionResource;this.savedSessionResource=void 0,t?this.navigateToSession(t,"overview"):this.showView("home")}else{let t=this.chatDebugService.activeSessionResource??this.savedSessionResource;this.savedSessionResource=void 0,t?(this.chatDebugService.activeSessionResource=t,this.chatDebugService.hasInvokedProviders(t)||this.chatDebugService.invokeProviders(t)):this.showView("home")}else this.savedSessionResource=this.chatDebugService.activeSessionResource,this.endActiveSession()}_applyNavigationOptions(e){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)}};Yte=I([m(1,Te),m(2,De),m(3,le),m(4,F),m(5,em),m(6,At),m(7,Si),m(8,X)],Yte);var m8=class extends C{constructor(e,t){super();this._discoveryEventDetails=new Map;this._register(e.onDidLogDiscovery(o=>{let n;if(o.discoveryInfo&&(n=_t(),this._discoveryEventDetails.set(n,o.discoveryInfo),this._discoveryEventDetails.size>m8.MAX_DISCOVERY_DETAILS)){let r=this._discoveryEventDetails.keys().next().value;r!==void 0&&this._discoveryEventDetails.delete(r)}t.log(o.sessionResource,o.name,o.details,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.uri,name:o.name,status:o.status,storage:o.storage,extensionId:o.extensionId,skipReason:o.skipReason,errorMessage:o.errorMessage,duplicateOf:o.duplicateOf})),sourceFolders:t.sourceFolders?.map(o=>({uri:o.uri,storage:o.storage,exists:o.exists,fileCount:o.fileCount,errorMessage:o.errorMessage}))}}};m8=I([m(0,nr),m(1,em)],m8);var Vhe=ae("agentTitleBarStatusService"),eKt=class extends C{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 ZOe=new Q("chatInAgentSessionProjection",!1,{type:"boolean",description:d(5747,null)});var lDi=new Set(Object.values(np)),tFe=ae("agentSessionProjectionService"),eFe=class extends C{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=ZOe.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&&L_(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(5754,null,e.label)},ym),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(!lDi.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}),L_(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(im),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}};eFe=I([m(0,X),m(1,B),m(2,Et),m(3,ee),m(4,ne),m(5,At),m(6,Ls),m(7,fi),m(8,ge),m(9,dl),m(10,Vhe),m(11,ia)],eFe);var GB=class extends K{constructor(e,t,o,n,r){super({id:`toggle.${e}`,title:t,metadata:o?{description:o}:void 0,toggled:x.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 GB{constructor(){super("window.commandCenter",d(4221,null),d(4222,null),1,aV.toNegated())}});W(class extends GB{constructor(){super("workbench.navigationControl.enabled",d(4229,null),d(4230,null),2,x.and(aV.toNegated(),x.has("config.window.commandCenter")))}});W(class extends GB{constructor(){super("workbench.layoutControl.enabled",d(4227,null),d(4228,null),4)}});W(class extends GB{constructor(){super("workbench.notifications.showInTitleBar",d(4231,null),d(4232,null),5,x.equals("config.workbench.notifications.position","top-right"))}});W(class extends K{constructor(){super({id:"toggle.window.customTitleBarVisibility",title:d(4225,null),menu:[{id:D.TitleBarContext,order:0,when:x.equals(EY.key,"native"),group:"3_toggle"},{id:D.TitleBarTitleContext,order:0,when:x.equals(EY.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(4226,null),menu:[{id:D.TitleBarContext,order:1,when:lP,group:"3_toggle"},{id:D.TitleBarTitleContext,order:1,when:lP,group:"3_toggle"}]})}run(i,...e){i.get(B).updateValue("window.customTitleBarVisibility","windowed")}});var cDi=class extends K{constructor(){super({id:"toggle.toggleCustomTitleBar",title:d(4223,null),toggled:xce,menu:[{id:D.MenubarAppearanceMenu,order:6,when:x.or(x.and(x.equals(EY.key,"native"),x.and(x.equals("config.workbench.layoutControl.enabled",!1),x.equals("config.window.commandCenter",!1),x.notEquals("config.workbench.editor.editorActionsLocation","titleBar"),x.notEquals("config.workbench.activityBar.location","top"),x.notEquals("config.workbench.activityBar.location","bottom"))?.negate()),lP),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":{lP.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(cDi);W(class extends K{constructor(){super({id:"showCustomTitleBar",title:L(4220,"Show Custom Title Bar"),precondition:xce.negate(),f1:!0})}run(i,...e){i.get(B).updateValue("window.customTitleBarVisibility","auto")}});W(class extends K{constructor(){super({id:"hideCustomTitleBar",title:L(4217,"Hide Custom Title Bar"),precondition:xce,f1:!0})}run(i,...e){i.get(B).updateValue("window.customTitleBarVisibility","never")}});W(class extends K{constructor(){super({id:"hideCustomTitleBarInFullScreen",title:L(4218,"Hide Custom Title Bar In Full Screen"),precondition:x.and(xce,lP),f1:!0})}run(i,...e){i.get(B).updateValue("window.customTitleBarVisibility","windowed")}});W(class KB extends K{static{this.settingsID="workbench.editor.editorActionsLocation"}constructor(){let i=x.and(x.equals("config.workbench.editor.showTabs","none").negate(),x.equals(`config.${KB.settingsID}`,"default"))?.negate();super({id:`toggle.${KB.settingsID}`,title:d(4224,null),toggled:x.equals(`config.${KB.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(le),n=t.getValue(KB.settingsID);if(n==="hidden"){if(t.getValue("workbench.editor.showTabs")!=="none")t.updateValue(KB.settingsID,"titleBar");else{let s=o.get(KB.settingsID,0);t.updateValue(KB.settingsID,s??"default")}o.remove(KB.settingsID,0)}else t.updateValue(KB.settingsID,"hidden"),o.store(KB.settingsID,n,0,0)}});var wZm={id:OOt,label:d(4216,null),tooltip:d(4216,null),class:void 0,enabled:!0,run:function(){}},CZm={id:NOt,label:d(4219,null),tooltip:d(4219,null),class:void 0,enabled:!0,run:function(){}};var Xte=class a extends K{static{this.ID="agentSession.enterAgentSessionProjection"}constructor(){super({id:a.ID,title:L(5748,"Enter Agent Session Projection"),category:vi,f1:!1,precondition:x.and(ie.enabled,x.has("config.chat.agentSessionProjection.enabled"),ZOe.negate())})}async run(i,e){let t=i.get(tFe),o=i.get(ia),n;e&&(FMt(e)?n=o.getSession(e.session.resource):n=e),n&&await t.enterProjection(n)}},h8=class a extends K{static{this.ID="agentSession.exitAgentSessionProjection"}constructor(){super({id:a.ID,title:L(5749,"Exit Agent Session Projection"),category:vi,f1:!0,precondition:x.and(ie.enabled,ZOe),keybinding:{weight:200,primary:9,when:ZOe}})}async run(i){await i.get(tFe).exitProjection()}},tKt=class extends GB{constructor(){super("chat.agentsControl.enabled",d(5752,null),d(5753,null),6,x.and(ie.enabled,aV.negate(),ie.supported,x.has("config.window.commandCenter")))}},iKt=class extends GB{constructor(){super("chat.unifiedAgentsBar.enabled",d(5750,null),d(5751,null),7,x.and(ie.enabled,aV.negate(),ie.supported,x.has("config.window.commandCenter")))}};var g8=class extends Ma{constructor(e){super();this._onDidSelect=this._register(new E);this.onDidSelect=this._onDidSelect.event;this.items=[];this.buttons=this._register(new jt);this.hoverDelegate=e.hoverDelegate??this._register(Gg()),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 P,r=n.add(new Mi(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 Mot="unified-quick-access-send-to-agent",dDi=[{id:"agentSessions",label:d(5793,null),prefix:"agent ",placeholder:d(5792,null),tooltip:d(5794,null)},{id:"commands",label:d(5796,null),prefix:">",placeholder:d(5795,null),tooltip:d(5797,null)},{id:"files",label:d(5799,null),prefix:"",placeholder:d(5798,null),tooltip:d(5800,null)}],iFe=class extends C{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=oe.as(Tu.Quickaccess);this.mapProviderToDescriptor=new Map;this._currentDisposables=this._register(new P);this._providerDisposables=this._register(new P);this._isInternalValueChange=!1;this._isUpdatingSendToAgent=!1;this._tabs=e??dDi}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===Mot,c=s.some(p=>p.id!==Mot),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(H.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(Gg()),c=this._tabs.map(h=>({text:h.label,tooltip:h.tooltip,isActive:h===this._currentTab})),u=this._currentDisposables.add(new g8({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=Qo(M.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(Ni("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(5806,null),this._sendButtonHover?.update(d(5809,null)),this._sendButtonIcon.style.display="";else{let n=this.keybindingService.lookupKeybinding(qC)?.getLabel()??"";this._sendButtonLabel.textContent=d(5802,null);let r=n?d(5804,null,n):d(5803,null);this._sendButtonHover?.update(r),this._sendButtonIcon.style.display="none"}}_openChat(){this.hide(),this.commandService.executeCommand(qC)}async _sendMessageRaw(e){let t=e.trim();if(!t)return;this.hide(),await this.commandService.executeCommand(im);let o={query:t,isPartialQuery:!1};this.commandService.executeCommand(qC,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(im);let o={query:t,isPartialQuery:!1};this.commandService.executeCommand(qC,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===Mot&&r.description===o)return;let s={id:Mot,label:`$(send) ${d(5808,null)}`,description:o,alwaysShow:!0,ariaLabel:d(5807,null,o)},l=e.items.filter(h=>h.id!==Mot),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 $e,this._providerDisposables.add(this._providerCts),e.isSendTab){t.busy=!1,t.items=[{label:d(5805,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(5801,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())Ac(e)&&e.dispose();super.dispose()}};iFe=I([m(1,Ge),m(2,F),m(3,X),m(4,nc),m(5,ge),m(6,_e),m(7,tt)],iFe);var uDi;function oKt(a){return uDi||(uDi=a.createInstance(iFe,dDi)),uDi}var nKt="workbench.action.unifiedQuickAccess",pDi=class a extends K{static{this.ID=nKt}constructor(){super({id:a.ID,title:L(5810,"Show Agent Quick Access"),f1:!0,precondition:x.and(ie.enabled,x.has("config.chat.unifiedAgentsBar.enabled"))})}run(i,e){let t=i.get(F);oKt(t).show(e)}},mDi=class a extends K{static{this.ID="workbench.action.showAgentSessionsQuickAccess"}constructor(){super({id:a.ID,title:L(5811,"Show Agent Sessions"),f1:!0,precondition:x.and(ie.enabled,x.has("config.chat.unifiedAgentsBar.enabled"))})}run(i){let e=i.get(F);oKt(e).show("agentSessions")}},hDi=class a extends K{static{this.ID="workbench.action.showCommandsQuickAccess"}constructor(){super({id:a.ID,title:L(5812,"Show Commands (Unified)"),f1:!0,precondition:x.and(ie.enabled,x.has("config.chat.unifiedAgentsBar.enabled"))})}run(i){let e=i.get(F);oKt(e).show("commands")}},gDi=class a extends K{static{this.ID="workbench.action.showFilesQuickAccess"}constructor(){super({id:a.ID,title:L(5813,"Show Files (Unified)"),f1:!0,precondition:x.and(ie.enabled,x.has("config.chat.unifiedAgentsBar.enabled"))})}run(i){let e=i.get(F);oKt(e).show("files")}};W(pDi);W(mDi);W(hDi);W(gDi);var Jen="workbench.action.chat.toggle",Zen="workbench.action.chat.triggerSetup",etn="workbench.action.chat.openQuotaExceededDialog",rKt="workbench.action.quickOpenWithModes",Wvo="agentSessions.filterExcludes.agentsessionsviewerfiltersubmenu",fDi="agentSessions.filterExcludes.previousUserFilter",Vvo=d(5772,null),ttn="\u25CF ",Pot=class extends oc{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T){super(void 0,e,t);this.instantiationService=o;this.agentTitleBarStatusService=n;this.hoverService=r;this.commandService=s;this.keybindingService=l;this.agentSessionsService=c;this.labelService=u;this.workspaceContextService=p;this.environmentService=h;this.editorGroupsService=g;this.editorService=f;this.menuService=v;this.contextKeyService=b;this.storageService=S;this.configurationService=y;this.chatEntitlementService=w;this.chatWidgetService=k;this.telemetryService=T;this._dynamicDisposables=this._register(new P);this._isRendering=!1;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._register(this.agentTitleBarStatusService.onDidChangeMode(()=>{this._render()})),this._register(this.agentTitleBarStatusService.onDidChangeSessionInfo(()=>{this._render()})),this._register(this.agentSessionsService.model.onDidChangeSessions(()=>{this._render()})),this._register(this.editorService.onDidActiveEditorChange(()=>{this._render()})),this._register(this.editorGroupsService.onDidChangeEditorPartOptions(({newPartOptions:N,oldPartOptions:O})=>{N.showTabs!==O.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(N=>{(N.affectsConfiguration("chat.unifiedAgentsBar.enabled")||N.affectsConfiguration("chat.agentsControl.enabled")||N.affectsConfiguration("chat.viewSessions.enabled"))&&(this._lastRenderState=void 0,this._render())})),this._register(H.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.tabIndex=-1,this._render()}setFocusable(e){}focus(){this._firstFocusableElement?.focus()}blur(){if(!this._container)return;let e=Me(this._container).document.activeElement;Ao(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((b,S)=>{let y=b.timing.lastRequestStarted??b.timing.created;return(S.timing.lastRequestStarted??S.timing.created)-y})[0]:void 0,l=s?.description?typeof s.description=="string"?s.description:qa(s.description):s?.label,c=this._getLabel(),{isFilteredToUnread:u,isFilteredToInProgress:p}=this._getCurrentFilterState(),h=this.configurationService.getValue("chat.unifiedAgentsBar.enabled")===!0,g=this.configurationService.getValue("chat.agentsControl.enabled")===!0,f=this.configurationService.getValue("chat.viewSessions.enabled")!==!1,v=JSON.stringify({mode:e,sessionTitle:t?.title,activeCount:o.length,unreadCount:n.length,attentionCount:r.length,attentionText:l,label:c,isFilteredToUnread:u,isFilteredToInProgress:p,unifiedAgentsBarEnabled:h,agentStatusEnabled:g,viewSessionsEnabled:f});if(this._lastRenderState===v)return;this._lastRenderState=v,Fi(this._container),this._dynamicDisposables.clear(),this._firstFocusableElement=void 0,this.agentTitleBarStatusService.mode==="session"?this._renderSessionMode(this._dynamicDisposables):this.agentTitleBarStatusService.mode==="sessionReady"?this._renderSessionReadyMode(this._dynamicDisposables):h?this._renderChatInputMode(this._dynamicDisposables):g&&this._renderBadgeOnlyMode(this._dynamicDisposables)}finally{this._isRendering=!1}}}_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=>L_(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();this._renderCommandCenterToolbar(e);let s=_("div.agent-status-pill.chat-input-mode");r&&s.classList.add("needs-attention"),s.setAttribute("role","button"),s.setAttribute("aria-label",d(5782,null)),s.tabIndex=0,this._firstFocusableElement=s,this._container.appendChild(s);let l=_("span.agent-status-left-icon");if(r){let b=Qo(M.report),S=_("span.agent-status-attention-count");S.textContent=String(n.length),Fi(l,b,S),l.classList.add("has-attention")}else Fi(l,Qo(M.searchSparkle));s.appendChild(l);let c=_("span.agent-status-label"),{session:u,progress:p}=this._getSessionNeedingAttention(n);this._displayedSession=u;let h=p??this._getLabel();p&&c.classList.add("has-progress");let g=d(5768,null);c.textContent=h,s.appendChild(c);let f=_("span.agent-status-send");Fi(f,Qo(M.send)),f.classList.add("hidden"),s.appendChild(f),p||(e.add(j(s,re.MOUSE_ENTER,()=>{Fi(l,Qo(M.searchSparkle)),l.classList.remove("has-attention"),c.textContent=g,c.classList.remove("has-progress"),f.classList.remove("hidden")})),e.add(j(s,re.MOUSE_LEAVE,()=>{Fi(l,Qo(M.searchSparkle)),c.textContent=h,f.classList.add("hidden")})));let v=Ni("mouse");e.add(this.hoverService.setupManagedHover(v,s,()=>{if(this._displayedSession)return d(5786,null,this._displayedSession.label);let b=this.keybindingService.lookupKeybinding(nKt)?.getLabel();return b?d(5769,null,b):d(5770,null)})),e.add(j(s,re.CLICK,b=>{b.preventDefault(),b.stopPropagation(),this._handlePillClick()})),e.add(j(s,re.KEY_DOWN,b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),b.stopPropagation(),this._handlePillClick())})),this.configurationService.getValue("chat.agentsControl.enabled")===!0&&this._renderStatusBadge(e,t,o,n)}_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(5761,null),r.appendChild(s),this._renderEscapeButton(e,r);let c=Ni("mouse");e.add(this.hoverService.setupManagedHover(c,r,()=>{let p=this.agentTitleBarStatusService.sessionInfo;return p?d(5762,null,p.title):d(5761,null)}));let u=p=>{p.preventDefault(),p.stopPropagation(),this.commandService.executeCommand(h8.ID)};e.add(j(r,re.CLICK,u)),e.add(j(r,re.MOUSE_DOWN,u)),this.configurationService.getValue("chat.agentsControl.enabled")===!0&&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(5763,null),r.appendChild(s),this._renderEnterButton(e,r);let c=Ni("mouse");e.add(this.hoverService.setupManagedHover(c,r,()=>{let p=this.agentTitleBarStatusService.sessionInfo;return p?d(5765,null,p.title):d(5764,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(Xte.ID,g)}};e.add(j(r,re.CLICK,u)),e.add(j(r,re.MOUSE_DOWN,u)),this.configurationService.getValue("chat.agentsControl.enabled")===!0&&this._renderStatusBadge(e,t,o,n)}_renderBadgeOnlyMode(e){if(!this._container)return;let{activeSessions:t,unreadSessions:o,attentionNeededSessions:n}=this._getSessionStats();this._renderStatusBadge(e,t,o,n)}_renderCommandCenterToolbar(e){if(!this._container)return;let t=[];for(let[,l]of this._commandCenterMenu.getActions({shouldForwardArgs:!0}))for(let c of l)c.id!==rKt&&(c instanceof $l?t.push(...c.actions):t.push(c));if(t.length===0)return;let o=Ni("mouse"),n=_("div.agent-status-command-center-toolbar");this._container.appendChild(n);let r=this.instantiationService.createInstance(Ol,n,{hiddenItemStrategy:-1,telemetrySource:"agentStatusCommandCenter",actionViewItemProvider:(l,c)=>Ca(this.instantiationService,l,{...c,hoverDelegate:o})});e.add(r),r.setActions(t);let s=Qo(M.circleSmallFilled);s.classList.add("agent-status-separator"),this._container.appendChild(s)}_renderSearchButton(e,t){let o=t??this._container;if(!o)return;let n=_("span.agent-status-search");Fi(n,Qo(M.searchSparkle)),n.setAttribute("role","button"),n.setAttribute("aria-label",d(5783,null)),n.tabIndex=0,this._firstFocusableElement||(this._firstFocusableElement=n),o.appendChild(n);let r=Ni("mouse"),s=this.keybindingService.lookupKeybinding(rKt)?.getLabel(),l=s?d(5784,null,s):d(5785,null);e.add(this.hoverService.setupManagedHover(r,n,l)),e.add(j(n,re.CLICK,c=>{c.preventDefault(),c.stopPropagation(),this.commandService.executeCommand(rKt)})),e.add(j(n,re.KEY_DOWN,c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),c.stopPropagation(),this.commandService.executeCommand(rKt))}))}_renderStatusBadge(e,t,o,n){if(!this._container)return;let r=t.length>0,s=o.length>0,l=n.length>0;this._clearFilterIfCategoryEmpty(s,r);let c=_("div.agent-status-badge");this._container.appendChild(c);let u=_("span.agent-status-badge-section.sparkle");u.tabIndex=0,this._firstFocusableElement||(this._firstFocusableElement=u),c.appendChild(u);let p=li.join(...this._chatTitleBarMenu.getActions({shouldForwardArgs:!0}).map(([,U])=>U)),h=this.chatEntitlementService.sentiment,g=this.chatEntitlementService.quotas.chat?.percentRemaining===0,f=this.chatEntitlementService.entitlement===1,v=this.chatEntitlementService.anonymous,b=this.chatEntitlementService.entitlement===5,S=Jen,y=d(5789,null),w=M.chatSparkle;h.installed&&!h.disabled&&(f&&!v?(S=Zen,y=d(5788,null),w=M.chatSparkleError):g&&b&&(S=etn,y=d(5771,null),w=M.chatSparkleWarning));let k=this.instantiationService.createInstance(Eo,{id:S,title:y,icon:w},void 0,void 0,void 0,void 0),T=pi({id:"agentStatus.sparkle.dropdown",label:d(5766,null),run(){}}),N=this.instantiationService.createInstance(dI,k,T,p,"agent-status-sparkle-dropdown",{skipTelemetry:!0});N.render(u),e.add(N),e.add(j(u,re.KEY_DOWN,U=>{U.key==="Enter"||U.key===" "?(U.preventDefault(),U.stopPropagation(),this.commandService.executeCommand(S)):(U.key==="ArrowDown"||U.key==="ArrowUp")&&(U.preventDefault(),U.stopPropagation(),N.showDropdown())}));let O=Ni("mouse"),V=this.configurationService.getValue("chat.viewSessions.enabled")!==!1;if(V&&s&&this.workspaceContextService.getWorkbenchState()!==1){let{isFilteredToUnread:U}=this._getCurrentFilterState(),G=_("span.agent-status-badge-section.unread");U&&G.classList.add("filtered"),G.setAttribute("role","button"),G.tabIndex=0;let $=_("span.agent-status-icon");Fi($,Qo(M.circleFilled)),G.appendChild($);let te=_("span.agent-status-text");te.textContent=String(o.length),G.appendChild(te),c.appendChild(G),e.add(j(G,re.CLICK,de=>{de.preventDefault(),de.stopPropagation(),this._openSessionsWithFilter("unread")})),e.add(j(G,re.KEY_DOWN,de=>{(de.key==="Enter"||de.key===" ")&&(de.preventDefault(),de.stopPropagation(),this._openSessionsWithFilter("unread"))}));let pe=o.length===1?d(5791,null,o.length):d(5790,null,o.length);e.add(this.hoverService.setupManagedHover(O,G,pe))}if(V&&r){let{isFilteredToInProgress:U}=this._getCurrentFilterState(),G=_("span.agent-status-badge-section.active");l&&G.classList.add("needs-input"),U&&G.classList.add("filtered"),G.setAttribute("role","button"),G.tabIndex=0;let $=_("span.agent-status-icon");Fi($,Qo(l?M.report:M.sessionInProgress)),G.appendChild($);let te=_("span.agent-status-text");te.textContent=String(l?n.length:t.length),G.appendChild(te),c.appendChild(G),e.add(j(G,re.CLICK,de=>{de.preventDefault(),de.stopPropagation(),this._openSessionsWithFilter("inProgress")})),e.add(j(G,re.KEY_DOWN,de=>{(de.key==="Enter"||de.key===" ")&&(de.preventDefault(),de.stopPropagation(),this._openSessionsWithFilter("inProgress"))}));let pe=l?n.length===1?d(5781,null,n.length):d(5780,null,n.length):t.length===1?d(5760,null,t.length):d(5759,null,t.length);e.add(this.hoverService.setupManagedHover(O,G,pe))}}_clearFilterIfCategoryEmpty(e,t){this._badgeFilterAppliedByThisWindow==="unread"&&!e?this._restoreUserFilter():this._badgeFilterAppliedByThisWindow==="inProgress"&&!t&&this._restoreUserFilter()}_getCurrentFilterState(){let e=this._getStoredFilter();if(!e)return{isFilteredToUnread:!1,isFilteredToInProgress:!1};let t=e.read===!0&&e.states.length===0,o=e.states?.length===2&&e.read===!1;return{isFilteredToUnread:t,isFilteredToInProgress:o}}_getStoredFilter(){let e=this.storageService.get(Wvo,0);if(e)try{return JSON.parse(e)}catch{return}}_storeFilter(e){this.storageService.store(Wvo,JSON.stringify(e),0,0)}_clearFilter(){this._storeFilter({providers:[],states:[],archived:!0,read:!1})}_saveUserFilter(){let{isFilteredToUnread:e,isFilteredToInProgress:t}=this._getCurrentFilterState();if(e||t)return;let o=this._getStoredFilter();o&&this.storageService.store(fDi,JSON.stringify(o),0,0)}_restoreUserFilter(){let e=this.storageService.get(fDi,0);if(e)try{let t=JSON.parse(e);this._storeFilter(t)}catch{this._clearFilter()}else this._clearFilter();this.storageService.remove(fDi,0),this._badgeFilterAppliedByThisWindow=null}_openSessionsWithFilter(e){let{isFilteredToUnread:t,isFilteredToInProgress:o}=this._getCurrentFilterState(),r=this._getStoredFilter()?.providers??[],s=e==="unread"&&t||e==="inProgress"&&o;this.telemetryService.publicLog2("agentStatusWidget.click",{source:e,action:s?"clearFilter":"applyFilter"}),e==="unread"?t?this._restoreUserFilter():(this._saveUserFilter(),this._storeFilter({providers:r,states:[],archived:!0,read:!0}),this._badgeFilterAppliedByThisWindow="unread"):o?this._restoreUserFilter():(this._saveUserFilter(),this._storeFilter({providers:r,states:[1,0],archived:!0,read:!1}),this._badgeFilterAppliedByThisWindow="inProgress"),this.commandService.executeCommand(N2.id)}_renderEscapeButton(e,t){let o=_("span.agent-status-esc-button");o.textContent="Esc",o.setAttribute("role","button"),o.setAttribute("aria-label",d(5776,null)),o.tabIndex=0,t.appendChild(o);let n=Ni("mouse");e.add(this.hoverService.setupManagedHover(n,o,d(5777,null))),e.add(j(o,re.MOUSE_DOWN,r=>{r.preventDefault(),r.stopPropagation(),this.commandService.executeCommand(h8.ID)})),e.add(j(o,re.CLICK,r=>{r.preventDefault(),r.stopPropagation(),this.commandService.executeCommand(h8.ID)})),e.add(j(o,re.KEY_DOWN,r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),r.stopPropagation(),this.commandService.executeCommand(h8.ID))}))}_renderEnterButton(e,t){let o=_("span.agent-status-enter-button"),n=this.keybindingService.lookupKeybinding(Xte.ID);o.textContent=n?.getLabel()??d(5787,null),o.setAttribute("role","button"),o.setAttribute("aria-label",d(5773,null)),o.tabIndex=0,this._firstFocusableElement||(this._firstFocusableElement=o),t.appendChild(o);let r=Ni("mouse"),s=n?d(5774,null,n.getLabel()):d(5775,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(Xte.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)}))}_handlePillClick(){this._displayedSession?(this.telemetryService.publicLog2("agentStatusWidget.click",{source:"pill",action:"openSession"}),this.instantiationService.invokeFunction(UB,this._displayedSession)):(this.telemetryService.publicLog2("agentStatusWidget.click",{source:"pill",action:"quickAccess"}),this.commandService.executeCommand(nKt))}_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:qa(o.description);return{session:o,progress:n}}_getLabel(){let{prefix:e,suffix:t}=this._getTitleDecorations(),o=this.labelService.getWorkspaceLabel(this.workspaceContextService.getWorkspace());if(this.editorGroupsService.partOptions.showTabs==="none"){let n=this.editorService.activeEditor;n&&(o=`${n.isDirty()&&!n.isSaving()?ttn:""}${n.getTitle(0)}`)}return o||(o=d(5767,null)),e&&(o=d(5778,null,e,o)),t&&(o=d(5779,null,o,t)),o.replaceAll(/\r\n|\r|\n/g,"\u23CE")}_getTitleDecorations(){let e;return this.environmentService.remoteAuthority&&(e=this.labelService.getHostLabel(Y.vscodeRemote,this.environmentService.remoteAuthority)),this.environmentService.isExtensionDevelopment&&(e=e?`${Vvo} - ${e}`:Vvo),{prefix:e,suffix:void 0}}};Pot=I([m(2,F),m(3,Vhe),m(4,tt),m(5,ge),m(6,_e),m(7,ia),m(8,ot),m(9,Pe),m(10,ru),m(11,Et),m(12,ee),m(13,qt),m(14,X),m(15,le),m(16,B),m(17,vr),m(18,At),m(19,Te)],Pot);var Bhe=class extends C{static{this.ID="workbench.contrib.agentStatus.rendering"}constructor(i,e,t){super(),this._register(i.register(D.CommandCenter,D.AgentsTitleBarControlMenu,(n,r)=>{if(n instanceof Cc)return e.createInstance(Pot,n,r)},void 0));let o=()=>{let n=t.getValue("window.commandCenter")===!0,r=t.getValue("chat.agentsControl.enabled")===!0&&n,s=t.getValue("chat.unifiedAgentsBar.enabled")===!0&&n;It.document.body.classList.toggle("agent-status-enabled",r),It.document.body.classList.toggle("unified-agents-bar",s)};o(),this._register(t.onDidChangeConfiguration(n=>{(n.affectsConfiguration("chat.agentsControl.enabled")||n.affectsConfiguration("chat.unifiedAgentsBar.enabled")||n.affectsConfiguration("window.commandCenter"))&&o()}))}};Bhe=I([m(0,Yy),m(1,F),m(2,B)],Bhe);var oFe=class extends C{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 P);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(he(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(!lDi.has(o.providerType)){this._clearEntriesWatcher(),this.agentTitleBarStatusService.exitSessionReadyMode();return}if(L_(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=he(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()}};oFe=I([m(0,At),m(1,B),m(2,Vhe),m(3,ia),m(4,tFe),m(5,dl)],oFe);W(Xte);W(h8);W(tKt);W(iKt);we(tFe,eFe,1);we(Vhe,eKt,1);pt(Bhe.ID,Bhe,ut.AfterRestored);pt(oFe.ID,oFe,ut.AfterRestored);fe.appendMenuItem(D.CommandCenter,{submenu:D.AgentsTitleBarControlMenu,title:d(5755,null),icon:M.chatSparkle,when:x.and(ie.enabled,x.or(x.has("config.chat.agentsControl.enabled"),x.has("config.chat.unifiedAgentsBar.enabled"))),order:10002});fe.appendMenuItem(D.TitleBar,{submenu:D.ChatTitleBarMenu,title:d(5757,null),group:"navigation",icon:M.chatSparkle,when:x.and(ie.supported,x.and(ie.Setup.hidden.negate(),ie.Setup.disabled.negate()),x.has("config.chat.agentsControl.enabled"),x.has("config.window.commandCenter").negate()),order:1});fe.appendMenuItem(D.AgentsTitleBarControlMenu,{command:{id:"workbench.action.chat.toggle",title:d(5756,null)},when:x.and(ie.enabled,x.or(x.has("config.chat.agentsControl.enabled"),x.has("config.chat.unifiedAgentsBar.enabled"))),group:"a_open",order:1});fe.appendMenuItem(D.AgentsTitleBarControlMenu,{command:{id:"toggle.chat.unifiedAgentsBar.enabled",title:d(5758,null),toggled:x.has("config.chat.unifiedAgentsBar.enabled")},when:x.and(ie.enabled,RW.notEqualsTo("stable")),group:"z_experimental",order:10});var Hhe=class extends C{constructor(e,t,o){super();this.chatService=e;this.chatSessionsService=t;this.logService=o;this.chatSessionType=qp;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._onDidChangeChatSessionItems=this._register(new E);this.onDidChangeChatSessionItems=this._onDidChangeChatSessionItems.event;this._items=[];this._register(this.chatSessionsService.registerChatSessionItemController(this.chatSessionType,this)),this.registerListeners()}static{this.ID="workbench.contrib.localAgentsSessionsController"}get items(){return this._items}async refresh(e){this._items=await this.provideChatSessionItems(e)}registerListeners(){let e=async()=>{this._onDidChangeChatSessionItems.fire(),await this.refresh(ve.None),this._onDidChangeChatSessionItems.fire()};this._register(this.chatSessionsService.registerChatModelChangeListeners(this.chatService,Y.vscodeLocalChatSession,e)),this._register(this.chatService.onDidDisposeSession(t=>{t.sessionResource.filter(n=>fg(n)===this.chatSessionType).length>0&&e()}))}async provideChatSessionItems(e){let t=[],o=new Mn;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 si(e.map(t=>this.toChatSessionItem(t)))}catch{return[]}}toChatSessionItem(e){let t=this.chatService.getSession(e.sessionResource),o;if(t){if(!t.hasRequests)return;o=this.chatSessionsService.getInProgressSessionDescription(t)}return{resource:e.sessionResource,label:e.title,description:o,status:t?this.modelToStatus(t):this.chatResponseStateToStatus(e.lastResponseState),iconPath:M.chatSparkle,timing:NYi(e.timing),changes:e.stats?{insertions:e.stats.added,deletions:e.stats.removed,files:e.stats.fileCount}:void 0}}modelToStatus(e){if(e.requestInProgress.get())return this.logService.trace(`[agent sessions] Session ${e.sessionResource.toString()} request is in progress.`),2;let t=e.getRequests().at(-1);if(this.logService.trace(`[agent sessions] Session ${e.sessionResource.toString()} last request response: state ${t?.response?.state}, isComplete ${t?.response?.isComplete}, isCanceled ${t?.response?.isCanceled}, error: ${t?.response?.result?.errorDetails?.message}.`),t?.response)return t.response.state===4?3:t.response.isCanceled||t.response.result?.errorDetails?.code==="canceled"?1:t.response.result?.errorDetails?0:t.response.isComplete?1:2}chatResponseStateToStatus(e){switch(e){case 2:case 1:return 1;case 3:return 0;case 0:return 2;case 4:return 3}}};Hhe=I([m(0,Si),m(1,Ls),m(2,ne)],Hhe);var vDi="agent ",nFe=class extends yh{constructor(e,t,o){super(vDi,{canAcceptInBackground:!0,noResultsPick:{label:d(5721,null)}});this.agentSessionsService=e;this.instantiationService=t;this.commandService=o;this.sorter=new zte;this.filter=this._register(this.instantiationService.createInstance(f0,{}))}async _getPicks(e){let t=[],o=this.agentSessionsService.model.sessions.filter(r=>!this.filter.exclude(r)).sort(this.sorter.compare.bind(this.sorter)),n=uot(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=Up(e,s.label,!0);l&&t.push(this.toPickItem(s,l))}}return t}toPickItem(e,t){let o=YTi(e),n=XTi(e);return{label:e.label,description:o,highlights:{label:t},iconClass:q.asClassName(e.icon),buttons:n,trigger:async r=>{switch(n[r]){case G1t:return await this.commandService.executeCommand(lke,e),2;case $1t:return await this.commandService.executeCommand(cke,e),2;case jTi:case QTi:{let l=!e.isArchived();return e.setArchived(l),2}default:return 0}},accept:(r,s)=>{this.instantiationService.invokeFunction(UB,e,{sideBySide:s.inBackground,editorOptions:{preserveFocus:s.inBackground,pinned:s.inBackground}})}}}};nFe=I([m(0,ia),m(1,F),m(2,ge)],nFe);W(N2);W(Y1t);W(X1t);W(J1t);W(ezt);W(tzt);W(izt);W(rzt);W(szt);W(azt);W(lzt);W(czt);W(ozt);W(nzt);W(pzt);W(dzt);W(uzt);W(mzt);W(hzt);W(wD);W(A2);W(fzt);W(q1t);W(j1t);W(Q1t);fe.appendMenuItem(D.AgentSessionsToolbar,{submenu:D.AgentSessionsViewerFilterSubMenu,title:L(5654,"Filter Agent Sessions"),group:"navigation",order:3,icon:M.filter});fe.appendMenuItem(D.AgentSessionsToolbar,{command:{id:wD.ID,title:wD.TITLE,icon:M.layoutSidebarRightOff},group:"navigation",order:5,when:x.and(ie.agentSessionsViewerOrientation.isEqualTo(1),ie.agentSessionsViewerPosition.isEqualTo(2))});fe.appendMenuItem(D.AgentSessionsToolbar,{command:{id:wD.ID,title:wD.TITLE,icon:M.layoutSidebarLeftOff},group:"navigation",order:5,when:x.and(ie.agentSessionsViewerOrientation.isEqualTo(1),ie.agentSessionsViewerPosition.isEqualTo(1))});fe.appendMenuItem(D.AgentSessionsToolbar,{command:{id:A2.ID,title:A2.TITLE,icon:M.layoutSidebarRight},group:"navigation",order:5,when:x.and(ie.agentSessionsViewerOrientation.isEqualTo(2),ie.agentSessionsViewerPosition.isEqualTo(2))});fe.appendMenuItem(D.AgentSessionsToolbar,{command:{id:A2.ID,title:A2.TITLE,icon:M.layoutSidebarLeft},group:"navigation",order:5,when:x.and(ie.agentSessionsViewerOrientation.isEqualTo(2),ie.agentSessionsViewerPosition.isEqualTo(1))});fe.appendMenuItem(D.ChatViewSessionTitleToolbar,{command:{id:wD.ID,title:wD.TITLE,icon:M.layoutSidebarLeftOff},group:"navigation",order:1,when:x.and(x.or(ie.agentSessionsViewerVisible.negate(),ie.agentSessionsViewerOrientation.isEqualTo(1)),ie.agentSessionsViewerPosition.isEqualTo(1))});fe.appendMenuItem(D.ChatViewSessionTitleToolbar,{command:{id:wD.ID,title:wD.TITLE,icon:M.layoutSidebarRightOff},group:"navigation",order:1,when:x.and(x.or(ie.agentSessionsViewerVisible.negate(),ie.agentSessionsViewerOrientation.isEqualTo(1)),ie.agentSessionsViewerPosition.isEqualTo(2))});oe.as(Tu.Quickaccess).registerQuickAccessProvider({ctor:nFe,prefix:vDi,contextKey:"inAgentSessionsPicker",when:ie.enabled,placeholder:d(5653,null),helpEntries:[{description:d(5652,null),commandId:"workbench.action.chat.history"}]});pt(Hhe.ID,Hhe,ut.AfterRestored);we(ia,BTe,1);var otn=5e3,Jte=class extends C{constructor(e,t,o){super();this._accessibilitySignalService=o;this._scheduler=this._register(new Dt(()=>{this._signalLoop=this._accessibilitySignalService.playSignalLoop($o.progress,t??otn)},e)),this._scheduler.schedule()}dispose(){super.dispose(),this._signalLoop?.dispose(),this._scheduler.dispose()}};Jte=I([m(2,tr)],Jte);var To=ae("nativeHostService");var ntn=4e3,rFe=class extends C{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 jt);this.toasts=this._register(new ibe);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(Jte,ntn,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=qa(new xe(l)),u=s&&o.errorDetails?` ${o.errorDetails.message}`:"";this._showOSNotification(e,t,c+u),(!r||this._configurationService.getValue("accessibility.voice.autoSynthesize")!=="on")&&Or(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;Jo(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=Me(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(5286,null,e.viewModel.model.title):d(5285,null),c=new $e,u=Z(()=>c.dispose(!0));this.toasts.add(u);let{clicked:p}=await this._hostService.showToast({title:l,body:d(5287,null)},c.token);this.toasts.deleteAndDispose(u),p&&(await this._hostService.focus(r,{mode:2}),await this._widgetService.reveal(e),e.focusInput())}};rFe=I([m(0,tr),m(1,F),m(2,B),m(3,oi),m(4,At),m(5,Si)],rFe);var aKt=_,sFe=class extends C{constructor(e,t,o,n){super();this.chatEntitlementService=e;this.commandService=t;this.configurationService=o;this.telemetryService=n;this.domNode=aKt(".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=aKt(".chat-status-content");this.messageElement=aKt(".chat-status-message"),t.appendChild(this.messageElement);let o=aKt(".chat-status-action");if(this.actionButton=this._register(new Mi(o,{...Ko,supportIcons:!0})),this.actionButton.element.classList.add("chat-status-button"),e==="anonymous"){let n=d(7420,null),r=d(7421,null);this.messageElement.textContent=n,this.actionButton.label=r,this.actionButton.element.ariaLabel=d(7422,null,n,r)}else{let n=d(7423,null),r=d(7424,null);this.messageElement.textContent=n,this.actionButton.label=r,this.actionButton.element.ariaLabel=d(7425,null,n,r)}this._register(this.actionButton.onDidClick(async()=>{let n=this.chatEntitlementService.anonymous?pI:"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)}};sFe=I([m(0,vr),m(1,ge),m(2,B),m(3,Te)],sFe);ytt.register(sFe.ID,sFe,x.and(ie.chatQuotaExceeded,ie.chatSessionIsEmpty,x.or(ie.Entitlement.planFree,xs.chatAnonymous)));var aFe=class extends C{constructor(e,t,o){super();this.modelService=t;this.languageService=o;this._register(e.registerTextModelContentProvider(Y.vscodeChatInput,this))}async provideTextContent(e){let t=this.modelService.getModel(e);return t||this.modelService.createModel("",this.languageService.createById("chatinput"),e)}};aFe=I([m(0,Nt),m(1,Ct),m(2,kt)],aFe);var Uhe=class{constructor(i,e,t){this._store=new P;let o=ui(this,e.onDidActiveEditorChange,()=>e.activeEditorPane?.input.resource);this._store.add(he(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()}};Uhe=I([m(0,dl),m(1,ee),m(2,tr)],Uhe);var bDi=class{constructor(i,e,t){this.total=i;this.remaining=e;this.cancel=t}},SDi=J("minimap.chatEditHighlight",ei(qo,.6),d(6475,null)),Dk=class extends C{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=`${Dk.scheme}::${++Dk.lastEntryId}`;this._onDidDelete=this._register(new E);this.onDidDelete=this._onDidDelete.event;this._stateObs=Le(this,0);this.state=this._stateObs;this._waitsForLastEdits=Le(this,!1);this.waitsForLastEdits=this._waitsForLastEdits;this._isCurrentlyBeingModifiedByObs=Le(this,void 0);this.isCurrentlyBeingModifiedBy=this._isCurrentlyBeingModifiedByObs;this._isExternalEditInProgress=!1;this._lastModifyingResponseObs=rg({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=Le(this,0);this.rewriteRatio=this._rewriteRatioObs;this._reviewModeTempObs=Le(this,void 0);this._autoAcceptCtrl=Le(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 jt);o===0&&(this.createdInRequestId=this._telemetryInfo.requestId),this.modifiedURI.scheme!==Y.untitled&&this.modifiedURI.scheme!==Y.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=pr("chat.editing.autoAcceptDelay",0,n);this._autoAcceptTimeout=Ce(f=>{let v=h.read(f);return Kn(v,0,100)}),this.reviewMode=Ce(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(he(f=>{this._waitsForLastEdits.read(f)?g.value=r.disableAutoSave(this.modifiedURI):g.clear()})),this._store.add(he(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 bDi(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=he(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&&Ui(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&&Ui(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 zy(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}};Dk=I([m(3,B),m(4,lr),m(5,Si),m(6,be),m(7,Cl),m(8,F),m(9,rS)],Dk);function Uvo(a){let i=cs.parseLocalSessionId(a);if(i)return i;let e=new Ly;return e.update(a.toString()),e.digest()}var kD=class{constructor(i,e){this._chatEditingService=i;this._modelService=e}static{this.scheme=Y.chatEditingModel}static getFileURI(i,e,t){return A.from({scheme:kD.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}};kD=I([m(1,Ct)],kD);var V2=class{constructor(i,e){this._chatEditingService=i;this._modelService=e}static getSnapshotFileURI(i,e,t,o,n){return A.from({scheme:Y.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)}};V2=I([m(1,Ct)],V2);var zvo="ArrayBuffer-4f56482b-5a03-49ba-8356-210d3b0c1c3d",yDi="chat-editing-notebook-snapshot-model";function wDi(a,i,e,t,o){return A.from({scheme:yDi,path:t,query:JSON.stringify({session:a,requestId:i??"",undoStop:e??"",viewType:o})})}function mT(a,i,e){let t=(typeof e=="number"?e:e.getValue(ft.outputBackupSizeLimit))*1024;return rtn(a.createSnapshot({context:2,outputSizeLimit:t,transientOptions:i}),i)}function RA(a,i){try{let{transientOptions:e,data:t}=lFe(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 Zte=class{constructor(i){let{transientOptions:e,data:t}=lFe(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=DM(i.metadata||{},r=>!e[r]),o=DM(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 M4){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=DM(s.metadata||{},p=>!n[p]),u=DM(l.metadata||{},p=>!n[p]);if(JSON.stringify(c)!==JSON.stringify(u)||JSON.stringify(IDi(s,!0,this.transientOptions))!==JSON.stringify(IDi(l,!0,this.transientOptions)))return!1}}return!0}};function IDi(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?DM(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 rtn(a,i){let e={cells:a.cells.map(t=>IDi(t)),metadata:a.metadata};return JSON.stringify([JSON.stringify(i),JSON.stringify(e,(t,o)=>o instanceof Je?{type:zvo,data:Qd(o)}:o)])}function lFe(a){let[i,e]=JSON.parse(a),t=i?JSON.parse(i):void 0,o=JSON.parse(e,(n,r)=>r&&r.type===zvo?Sl(r.data):r);return{transientOptions:t,data:o}}var Kvo="$$start",cFe="__epoch_",dFe=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=Le(this,[]);this._currentEpoch=Le(this,0);this._operations=rg({equalsFn:()=>!1},[]);this._fileBaselines=new Map;this._refCountedDiffs=new Map;this._finalizedDiffCache=new Map;this._willUndoToCheckpoint=Ce(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=Jve(t,c=>c.epoch<e),r=n===-1?void 0:ju(t,c=>c.undoStopId===void 0,n),s=ju(o,c=>c.epoch<e),l=s&&ju(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=Ce(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=ju(o,c=>c.epoch<e);if(l&&r&&l.requestId!==r.requestId){let c=Jve(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=Rut(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=hs({equalsFn:(i,e)=>$i(i,e,uo)},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=ju(t,u=>u.epoch<e)?.epoch||0,s=ju(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=_t(),u=this.incrementEpoch();return s.push({checkpointId:c,requestId:i,undoStopId:e,epoch:u,label:t,description:o}),Ui(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 V2.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),Ui(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&&Xe(i,o.uri))}async getContentAtStop(i,e,t){let o;t?.startsWith(cFe)?o=Number(t.slice(cFe.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(cFe))return C.None;let n=Number(t.slice(cFe.length));if(n<=this._epochCounter)return C.None;let r=new P,s=r.add(new ya(500));return r.add(H.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 ju(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"&&Xe(s.uri,i))return{uri:s.uri,requestId:s.requestId,content:s.initialContent,epoch:s.epoch,telemetryInfo:s.telemetryInfo};if(s.type==="rename"&&Xe(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&&(Xe(o.uri,i)||n&&Xe(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&&RA(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=mT(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&&RA(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:Hr(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 Mn;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:Hr(i)}}_applyTextEditsToContent(i,e){let{textBuffer:t,disposable:o}=n1(i,1);try{t.applyEdits(e.map(r=>new H6(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=hs({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 hs({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=Rut(o,l=>l.requestId!==i,n+1):s=o.find(l=>l.requestId===e)||Rut(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 Oo(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=Ce(this,s=>{let{start:l,end:c}=t.read(s);if(!l)return;let u=s.store.add(new P),p=this.getContentURIAtStop(l.requestId||Kvo,i,cFe+l.epoch),h=this.getContentURIAtStop(c?.requestId||l.requestId||Kvo,i,cFe+(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:Nr(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 Au(g)}}),r=Ce(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 Au(Promise.resolve(E_t(c,u)))}:(g.forEach(b=>b.onChange.read(s)),{originalURI:c,modifiedURI:u,promise:new Au(this._computeDiff(c,u,!!f))})});return hs({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?E_t(l.originalURI,l.modifiedURI):{...E_t(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=hs({equalsFn:mre},o=>{let n=new vt;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 vt,o;return Ce(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}`,Oo({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(mo))}getDiffsForFilesInSession(){let i=hs({equalsFn:mre},e=>{let t=new vt;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,Oo(void 0))}getDiffForSession(){let i=this.getDiffsForFilesInSession();return Ce(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}})}};dFe=I([m(2,mh),m(3,un),m(4,Nt),m(5,$s),m(6,B)],dFe);var f8=class extends Dk{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=Oo(0);this._changesCount=Le(this,1);this.changesCount=this._changesCount;this.isDeletion=!0;this._originalContent=t,this.initialContent=t,this.originalURI=kD.getFileURI(n.sessionResource,this.entryId,e.path),this.diffInfo=Oo(this._diffInfo()),this.linesRemoved=Oo(this._getOrCreateOriginalModel().getLineCount())}dispose(){this._originalModel?.dispose(),this._modifiedModel?.dispose(),super.dispose()}_getOrCreateOriginalModel(){return(!this._originalModel||this._originalModel.isDisposed())&&(this._originalModel=this._modelService.createModel(i_(Tke(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 wf(new ro(1,t+1),new ro(1,1),void 0)],quitEarly:!1,identical:!1,moves:[]}}getDiffInfo(){return Promise.resolve(this._diffInfo())}equalsSnapshot(e){return!!e&&this.modifiedURI.toString()===e.resource.toString()&&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,Je.fromString(e.current))}async resetToInitialContent(){await this._fileService.writeFile(this.modifiedURI,Je.fromString(this._originalContent))}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,Je.fromString(this._originalContent))},redo:async()=>{await this._fileService.del(this.modifiedURI,{useTrash:!1})}}}async acceptAgentEdits(e,t,o,n){Ui(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,Je.fromString(this._originalContent)),this._multiDiffEntryDelegate.collapse(void 0)}_createEditorIntegration(e){return{currentIndex:Le(this,0),reveal:()=>{},next:()=>!1,previous:()=>!1,enableAccessibleDiffView:()=>{},acceptNearestChange:async()=>{},rejectNearestChange:async()=>{},toggleDiff:async()=>{},dispose:()=>{}}}async computeEditsFromSnapshots(e,t){return[]}async save(){}async revertToDisk(){}};f8=I([m(5,Ct),m(6,kt),m(7,B),m(8,lr),m(9,Si),m(10,be),m(11,Cl),m(12,F),m(13,rS)],f8);function Gvo(a,i,e){let t=JSt(a,e);if(!t)return!1;let o=t.getOriginalEditor().getModel(),n=t.getModifiedEditor().getModel();return Xe(o?.uri,i.originalURI)&&Xe(n?.uri,i.modifiedURI)}var CDi=class{constructor(){this._free=new Vs}dispose(){Ue(this._free)}get(){return this._free.shift()}putBack(i){this._free.push(i)}get free(){return this._free}},B2=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=Le(this,-1);this.currentIndex=this._currentIndex;this._store=new P;this._diffHunksRenderStore=this._store.add(new P);this._diffHunkWidgetPool=this._store.add(new CDi);this._diffHunkWidgets=[];this._viewZones=[];this._accessibleDiffViewVisible=Le(this,!1);this._diffLineDecorations=e.createDecorationsCollection();let g=os(e);this._diffLineDecorations=this._editor.createDecorationsCollection(),this._diffVisualDecorations=this._editor.createDecorationsCollection(),this._store.add(new VMe(this._editor,this._chatWidgetService,this._viewsService,this._explanationModelManager,this._entry.modifiedURI));let f=Ce(k=>!(!Xe(g.model.read(k)?.uri,t.read(k).modifiedModel.uri)||this._editor.getOption(70)&&!l.invokeFunction(Gvo,i,this._editor)));this._store.add(he(k=>{if(!f.read(k)){this._diffLineDecorations.clear();return}let T=[],N=t.read(k);for(let O of N.changes)T.push({range:O.modified.toInclusiveRange()??new z(O.modified.startLineNumber,1,O.modified.startLineNumber,Number.MAX_SAFE_INTEGER),options:B2._diffLineDecorationData});this._diffLineDecorations.set(T)}));let v;this._store.add(he(k=>{if(f.read(k)&&!i.isCurrentlyBeingModifiedBy.read(k)&&v!==i.lastModifyingRequestId&&!t.read(k).identical){v=i.lastModifyingRequestId;let T=e.getPosition()??new Ie(1,1),N=this._diffLineDecorations.getRanges(),O=N.findIndex(V=>V.containsPosition(T));if(O<0)for(O=0;O<N.length-1&&!(N[O].endLineNumber>=T.lineNumber);O++);this._currentIndex.set(O,void 0),e.revealRange(N[O])}})),this._store.add(he(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 N=i.reviewMode.read(k),O=t.read(k);this._updateDiffRendering(O,N,T)}}));let b=wBt.bindTo(s);this._store.add(he(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(he(k=>{if(!this._accessibleDiffViewVisible.read(k)||!f.read(k))return;let N=new xDi;e.addOverlayWidget(N),k.store.add(Z(()=>e.removeOverlayWidget(N))),k.store.add(l.createInstance(QN,N.getDomNode(),f,(O,V)=>this._accessibleDiffViewVisible.set(O,V),Oo(!0),g.layoutInfo.map((O,V)=>O.width),g.layoutInfo.map((O,V)=>O.height),t.map(O=>O.changes.slice()),l.createInstance(kDi,t,e)))}));let S,y=()=>{S!==void 0&&(this._editor.updateOptions(S),S=void 0)};this._store.add(Z(y));let w=Ce(this,k=>f.read(k)&&!!i.isCurrentlyBeingModifiedBy.read(k));this._store.add(he(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=po.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=po.createDynamic({...Eae,stickiness:1}),n=po.createDynamic({...zye,stickiness:1}),r=(v,b)=>po.createDynamic({description:"chat-editing-decoration",overviewRuler:{color:If(v),position:1},minimap:{color:If(b),position:2}}),s=r(jY,Pke),l=r(QY,Ake),c=r(YY,Nke);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=uE.fromEditor(this._editor),k=this._editor.getModel()?.getLineCount();for(let T of i.changes){let N=T.original;i.originalModel.tokenization.forceTokenization(Math.max(1,N.endLineNumberExclusive-1));let O=new dE(N.mapToLineArray($=>i.originalModel.tokenization.getLineTokens($)),[],S,y),V=[];if(e)for(let $ of T.innerChanges||[])V.push(new Zk($.originalRange.delta(-(T.original.startLineNumber-1)),Cq.className,0)),!($.originalRange.isEmpty()&&$.originalRange.startLineNumber===1&&$.modifiedRange.endLineNumber===k)&&!$.modifiedRange.isEmpty()&&b.push({range:$.modifiedRange,options:o});let U=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 te=EL(O,w,V,$);if(G=te.heightInLines,!U){let pe={afterLineNumber:T.modified.startLineNumber-1,heightInLines:te.heightInLines,domNode:$,ordinal:50002};this._viewZones.push(v.addZone(pe))}}if(e||t){let $=this._diffHunkWidgetPool.get();$?$.update(i,T,this._editor.getModel().getVersionId(),U?0:G):$=this._editor.invokeWithinContext(te=>te.get(F).createInstance(H2,this._editor,i,T,this._editor.getModel().getVersionId(),U?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=Ce(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(he(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(H.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(Ie.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 H2&&(await i.reject(),this.next(!0))}async acceptNearestChange(i){i=i??this._findClosestWidget(),i instanceof H2&&(await i.accept(),this.next(!0))}async toggleDiff(i,e){if(!this._editor.hasModel())return;let t=this._editor.getSelection();if(i instanceof H2){let n=i.getStartLineNumber(),r=n?new Ie(n,1):void 0;r&&!t.containsPosition(r)&&(t=Yt.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(6421,null,Ye(this._entry.modifiedURI))});if(n&&n.input){n.getControl()?.setSelection(t);let r=he(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))Lj(u.editor)&&Xe(u.editor.original.resource,this._entry.originalURI)&&Xe(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}})}};B2=I([m(4,ee),m(5,tr),m(6,X),m(7,F),m(8,dl),m(9,hme),m(10,At),m(11,Ft)],B2);var H2=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-${H2._idPool++}`;this._store=new P;this._removed=!1;this._domNode=document.createElement("div"),this._domNode.className="chat-diff-change-content-widget";let s=r.createInstance(Ln,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 Lr{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+yl(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)}};H2=I([m(5,F)],H2);var xDi=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}}},kDi=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(ro.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 U2=Object.freeze({identical:!0,quitEarly:!1,changes:Object.freeze([]),moves:Object.freeze([])});var v0=class extends C{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=Le(this,U2);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=Qc.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(he(l=>this.updateLineChangeCount(this._diffInfo.read(l)))),e.equalsTextBuffer(t.getTextBuffer())||this._updateDiffInfoSeq()}static{this._lastEditDecorationOptions=po.register({isWholeLine:!0,description:"chat-last-edit",className:"chat-editing-last-edit-line",marginClassName:"chat-editing-last-edit",overviewRuler:{position:7,color:If(sv)}})}static{this._pendingEditDecorationOptions=po.register({isWholeLine:!0,description:"chat-pending-edit",className:"chat-editing-pending-edit",minimap:{position:1,color:If(SDi)}})}static{this._atomicEditDecorationOptions=po.register({isWholeLine:!0,description:"chat-atomic-edit",className:"chat-editing-atomic-edit",minimap:{position:1,color:If(SDi)}})}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){So(t.every(Qk.isTextEdit),"INVALID args, can only handle text edits"),Ey(Xe(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(Qk.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 Go,v=j(Me(void 0),"animationend",b=>{b.animationName==="kf-chat-editing-atomic-edit"&&(f.complete(),v.dispose())});this._editDecorations=this.modifiedModel.deltaDecorations(this._editDecorations,[{options:v0._atomicEditDecorationOptions,range:g}]),await Promise.any([f.p,Pi(500)]),v.dispose()}}}else{let u=t.map(Qk.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:v0._pendingEditDecorationOptions,range:new z(s+1,1,Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER)}];s>0&&h.push({options:v0._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 _c.unknown({name:"editSessionUndoRedo"});let t=P_(e.session.sessionResource),o=e.session.getRequests().at(-1),n=this.modifiedModel.getLanguageId(),r=e.agent,s=Aht.tryCreate(r?.extensionId.value,r?.extensionVersion);return e.request?.locationData?.type==="editor"?_c.inlineChatApplyEdit({modelId:o?.modelId,requestId:o?.id,sessionId:t,languageId:n,extensionId:s}):_c.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([An.replace(this.modifiedModel.getFullModelRange(),this.originalModel.getValue())],_c.chatUndoEdits()),this.modifiedModel.pushStackElement(),this._reset()}_reset(){this._originalToModifiedEdit=Qc.empty,this._diffInfo.set(U2,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([An.replace(this.modifiedModel.getFullModelRange(),t)],_c.chatReset()),this.modifiedModel.pushStackElement(),o=!0),o&&await this._updateDiffInfoSeq()}_mirrorEdits(e){let t=O9(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=fji(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(An.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(An.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(ro.fromRangeInclusive(e)))}async _updateDiffInfo(){if(this.originalModel.isDisposed()||this.modifiedModel.isDisposed()||this._store.isDisposed)return;if(this.state.get()!==0)return this._diffInfo.set(U2,void 0),this._originalToModifiedEdit=Qc.empty,U2;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??U2;return this._diffInfo.set(n,void 0),this._originalToModifiedEdit=vji(this.originalModel,this.modifiedModel,n.changes),n}}};v0=I([m(4,$s),m(5,tr)],v0);var eie=class extends Dk{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=kD.getFileURI(o.sessionResource,this.entryId,this.modifiedURI.path),this.initialContent=r??this.modifiedModel.getValue();let k=this.originalModel=this._register(l.createModel(i_(r!==void 0?Tke(r):this.modifiedModel.createSnapshot()),u.createById(this.modifiedModel.getLanguageId()),this.originalURI,!1));this._textModelChangeService=this._register(S.createInstance(v0,this.originalModel,this.modifiedModel,this._stateObs,()=>this._isExternalEditInProgress)),this._register(this._textModelChangeService.onDidAcceptOrRejectAllHunks(N=>{this._stateObs.set(N,void 0),this._notifySessionAction(N===1?"accepted":"rejected")})),this._register(this._textModelChangeService.onDidAcceptOrRejectLines(N=>{this._notifyAction({kind:"chatEditingHunkAction",uri:this.modifiedURI,outcome:N.state,languageId:this.modifiedModel.getLanguageId(),...N})})),(async()=>{let N=await c.createModelReference(k.uri);if(this._store.isDisposed){N.dispose();return}this._register(N)})(),this._register(this._textModelChangeService.onDidUserEditModel(()=>{this._userEditScheduler.schedule();let N=this.modifiedModel.getValue()===this.initialContent;this._stateObs.get()===0&&N&&this._stateObs.set(2,void 0)}));let T=this._register(new me);this._register(he(N=>{if(this._waitsForLastEdits.read(N)){let V=this._lastModifyingResponseObs.read(N),U=V&&V.session.getRequests().find(G=>G.id===V.requestId);T.value=s.installResourceFilter(this.modifiedURI,U?.message.text||d(6474,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&&this.modifiedURI.toString()===e.resource.toString()&&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:V2.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 _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(6472,null,t.message.text):d(6473,null);return new IL(o,"chat.edit",this.modifiedModel,null)}async acceptAgentEdits(e,t,o,n){let r=await this._textModelChangeService.acceptAgentEdits(e,t,o,n);Ui(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?(gQe(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&&gQe(this._docFileEditorModel)&&this._shouldAutoSave()&&await this._docFileEditorModel.save({reason:1,skipSaveParticipants:!0}),this._multiDiffEntryDelegate.collapse(void 0))}_createEditorIntegration(e){let t=ca(e.getControl());So(t);let o=this._textModelChangeService.diffInfo;return this._instantiationService.createInstance(B2,this,t,o,!1)}_shouldAutoSave(){return this.modifiedURI.scheme!==Y.untitled}async computeEditsFromSnapshots(e,t){let o=await this._editorWorkerService.computeStringEditFromDiff(e,t,{maxComputationTimeMs:5e3},"advanced");return bp.fromStringEdit(o,new _S(e)).replacements.slice()}async save(){this.modifiedModel.uri.scheme!==Y.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===Y.untitled)return;let e=this._textFileService.files.get(this.modifiedModel.uri);e&&!e.isDisposed()&&await e.revert({soft:!1})}};eie=I([m(5,Ns),m(6,Ct),m(7,Nt),m(8,kt),m(9,B),m(10,lr),m(11,Si),m(12,Ho),m(13,be),m(14,Cl),m(15,F),m(16,rS),m(17,$s)],eie);var uFe=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(Je.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 atn(this.textEdits)}catch(i){return console.error("Failed to generate content from text edits",i),""}}};uFe=I([m(1,un)],uFe);function atn(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 pFe=class extends C{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=Le(this,0);this.maxModifiedLineNumber=this._maxModifiedLineNumber;this._stateObs=Le(this,0);this.state=this._stateObs;this.initialContent=this.originalModel.getValue(),this._register(s),this._textModelChangeService=this._register(this.instantiationService.createInstance(v0,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);Ui(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)}};pFe=I([m(6,Zc),m(7,F)],pFe);var lKt=class extends C{constructor(e){super();this.notebookEditor=e;this.decorators=this._register(new P)}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:jY,modelRanges:[],includeOutput:!0,position:7}}})));this.clear(),this.decorators.add(Z(()=>{this.notebookEditor.isDisposed||this.notebookEditor.deltaCellDecorations(n,[])}))}clear(){this.decorators.clear()}};function Aot(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 ED(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 mFe=class extends C{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 P)}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 Io([X,this.notebookEditor.scopedContextKeyService]))).createInstance(Ln,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 Lr{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)}};mFe=I([m(2,F),m(3,tr)],mFe);var hFe=class extends C{constructor(e,t,o,n,r,s){super();this.instantiationService=s;let l=qn(t);So(l),this.notebookEditor=l,this.integration=this.instantiationService.createInstance(gFe,e,l,o,n,r),this._register(t.onDidChangeControl(()=>{let c=qn(t);c&&c!==this.notebookEditor&&(this.notebookEditor=c,this.integration.dispose(),this.integration=this.instantiationService.createInstance(gFe,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()}};hFe=I([m(5,F)],hFe);var gFe=class extends C{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=Le(this,-1);this.currentIndex=this._currentIndex;this.cellEditorIntegrations=new Map;this.markdownEditState=Le(this,"");this.markupCellListeners=new Map;this.sortedCellChanges=[];this.changeIndexComputer=new KT(new Uint32Array(0));let h=kM(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(he(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}),N.dispose()},100),N=Z(()=>clearTimeout(T));y.store.add(N)}}}));let v;this._store.add(he(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(N=>T>=N.start&&T<N.end)})||this.reveal(!0))})),this._register(he(y=>{this.sortedCellChanges=ED(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 KT(new Uint32Array(w)),this.changeIndexComputer.getTotalSum()===0&&this.revertMarkupCellState()})),this._register(he(y=>{if(this.notebookEditor.textModel!==this.notebookModel)return;let k=ED(r.read(y)).filter(N=>N.type!=="delete");if(h.read(y),!k.length){this.cellEditorIntegrations.forEach(({diff:N})=>{N.set({...N.read(void 0),...U2},void 0)});return}this.markdownEditState.read(y);let T=new Set;k.forEach(N=>{if(N.modifiedCellIndex===void 0||N.modifiedCellIndex>=o.cells.length)return;let O=o.cells[N.modifiedCellIndex],V=t.codeEditors.find(([pe])=>pe.handle===o.cells[N.modifiedCellIndex].handle)?.[1],U=N.modifiedModel.promiseResult.read(y)?.data,G=N.originalModel.promiseResult.read(y)?.data;if(!O||!G||!U)return;if(O.cellKind===1&&!this.markupCellListeners.has(O.handle)){let pe=this.notebookEditor.getViewModel()?.viewCells.find(de=>de.handle===O.handle);if(pe){let de=pe.onDidChangeState(se=>{se.editStateChanged&&setTimeout(()=>this.markdownEditState.set(pe.handle+"-"+pe.getEditState(),void 0),0)});this.markupCellListeners.set(O.handle,de)}}if(!V)return;let $={...N.diff.read(y),modifiedModel:U,originalModel:G,keep:N.keep,undo:N.undo};T.add(O);let te=this.cellEditorIntegrations.get(O);if(te)ltn(te.diff.read(void 0),$)||te.diff.set($,void 0);else{let pe=Le(`diff${O.handle}`,$),de=this.instantiationService.createInstance(B2,e,V,pe,!0);this.cellEditorIntegrations.set(O,{integration:de,diff:pe}),this._register(de),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((N,O)=>{T.has(O)||(N.integration.dispose(),this.cellEditorIntegrations.delete(O))})}));let b=h.map(y=>y.length>0),S=kM(r,10);this._register(he(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(dMe,this.notebookEditor)),this.modifiedCellDecorator??=this._register(this.instantiationService.createInstance(lKt,this.notebookEditor)),this.overlayToolbarDecorator??=this._register(this.instantiationService.createInstance(mFe,this.notebookEditor,this.notebookModel)),this.deletedCellDecorator&&(this._store.delete(this.deletedCellDecorator),this.deletedCellDecorator.dispose()),this.deletedCellDecorator=this._register(this.instantiationService.createInstance(qZ,this.notebookEditor,{className:"chat-diff-change-content-widget",telemetrySource:"chatEditingNotebookHunk",menuId:D.ChatEditingEditorHunk,actionViewItemProvider:(o,n)=>{if(!o.class)return new class extends Lr{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 ro(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>=$vo(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?$vo(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(6482,null,Ye(this._entry.modifiedURI))};await this._editorService.openEditor(o)}};gFe=I([m(5,F),m(6,ee),m(7,Zc),m(8,tr),m(9,ne)],gFe);var cKt=class extends C{constructor(e,t){super();this.notebookDiffEditor=e;this.cellChanges=t;this._currentIndex=Le(this,-1);this.currentIndex=this._currentIndex;this._store.add(he(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=Aot(r.slice(0,n+1));this._currentIndex.set(s-1,void 0)}else this._currentIndex.set(-1,void 0)}))}reveal(e){ED(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 ltn(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 $vo(a){return a.type==="modified"?a.diff.get().changes.length-1:0}var zhe=class extends C{constructor(e,t){super();this.fileService=e;let o=t.createInstance(b0);this._register(this.fileService.registerProvider(yDi,o))}static{this.ID="chatEditingNotebookFileSystemProviderContribution"}};zhe=I([m(0,be),m(1,F)],zhe);var b0=class{constructor(i){this._chatEditingService=i;this.capabilities=18434;this.onDidChangeCapabilities=H.None;this.onDidChangeFile=H.None}static{this.registeredFiles=new vt}static registerFile(i,e){return b0.registeredFiles.set(i,e),{dispose(){b0.registeredFiles.get(i)===e&&b0.registeredFiles.delete(i)}}}watch(i,e){return C.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=b0.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(cs.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.")}};b0=I([m(0,dl)],b0);function qvo(a,i,e,t,o){i=ED(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 jvo(a,i,e){if(a===-1)return i;i=ED(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 Qvo(a,i,e,t,o){if(i=ED(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 Yvo(a,i,e,t,o,n){i=ED(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 Xvo(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 Not(a,i){return i.find(t=>t.modifiedCellIndex===a)?.originalCellIndex}function Jvo(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 Zvo(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 ebo="VSCodeChatNotebookSnapshotLanguage",Lk=class extends Dk{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=Le("isProcessingResponse",!1);this._isEditFromUs=!1;this._allEditsAreFromUs=!0;this._changesCount=Le(this,0);this.changesCount=this._changesCount;this.cellEntryMap=new vt;this.modifiedToOriginalCell=new vt;this._cellsDiffInfo=Le("diffInfo",[]);this.editedCells=new Mn;this.computeRequestId=0;this.cellTextModelMap=new vt;this.initialContentComparer=new Zte(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(un),u=l.get(mh),p=l.get(B),h=await u.resolve(e),g=h.object.notebook,f=wDi(o.sessionResource,o.requestId,_t(),g.uri.scheme===Y.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,ve.None).then(k=>Kv(k))]),S=new P;S.add(b0.registerFile(f,b));let y=await u.resolve(f,g.viewType);if(r!==void 0)try{RA(y.object.notebook,r)}catch(k){console.error(`Error restoring snapshot: ${r}`,k),r=mT(g,v.serializer.options,p)}else{r=mT(g,v.serializer.options,p),RA(y.object.notebook,r);let k=[];g.cells.forEach((T,N)=>{let O=EDi(T.uri);k.push({editType:9,index:N,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(Lk,h,y,t,v.serializer.options,o,n,r);return w._register(S),w})}static canHandleSnapshotContent(e){if(!e)return!1;try{return lFe(e),!0}catch{return!1}}static canHandleSnapshot(e){return!!(e.languageId===ebo&&Lk.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(Aot(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=sMe(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(ED(e),t),this._changesCount.set(Aot(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&&!Jvo(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=ED(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=EDi(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=Yvo(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=Not(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=Not(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=Not(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=Not(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=Xvo(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=mT(this.modifiedModel,this.transientOptions,this.configurationService);RA(this.originalModel,e),this.initializeModelsFromDiff(),await this._collapse(void 0);let t=this._fileConfigService.getAutoSaveConfiguration(this.modifiedURI);this.modifiedModel.uri.scheme!==Y.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=mT(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=qn(e);if(!t&&e.getId()===Xm.ID){let o=e.getControl();return this._instantiationService.createInstance(cKt,o,this._cellsDiffInfo)}return So(t),this._instantiationService.createInstance(hFe,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(6476,null,t.message.text):d(6477,null),n=this.transientOptions,r=this.configurationService.getValue(ft.outputBackupSizeLimit)*1024,s=mT(this.modifiedModel,n,r),l="",c=2;return{type:0,resource:this.modifiedURI,label:o,code:"chat.edit",confirmBeforeUndo:!1,undo:async()=>{l=mT(this.modifiedModel,n,r),this._isEditFromUs=!0;try{RA(this.modifiedModel,s),RA(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=mT(this.modifiedModel,n,r),this._isEditFromUs=!0;try{RA(this.modifiedModel,l),RA(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=mT(this.originalModel,this.transientOptions,this.configurationService);return new Zte(e).isEqual(this.modifiedModel)}async acceptAgentEdits(e,t,o,n){let r=e.scheme===Y.vscodeNotebookCell,s=r&&this.modifiedModel.cells.find(u=>Xe(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=>Xe(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;Qk.isTextEdit(u)?Xe(e,this.modifiedModel.uri)?(this.newNotebookEditGenerator??=this._instantiationService.createInstance(uFe,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))}Ui(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(),Zvo(this._cellsDiffInfo.get(),this.originalModel,this.modifiedModel));this._rewriteRatioObs.set(Math.min(1,p),u)}})}disposeDeletedCellEntries(){let e=new Mn(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=EDi(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=ED(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=ED(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=mT(this.modifiedModel,this.transientOptions,this.configurationService);if(new Zte(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=Le("diff",U2);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 Au(r),originalModel:new Au(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 cg(n,r),l=[new wf(new ro(1,1),new ro(1,o.length),[s])],c=this.modifiedModel.uri.with({query:(Lk.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 Au(this.resolveCellModel(t.uri)),originalModel:new Au(Promise.resolve(u)),diff:Le("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 cg(r,n),l=[new wf(new ro(1,o.length),new ro(1,1),[s])],c=this.modifiedModel.uri.with({query:(Lk.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 Au(this.resolveCellModel(t.uri)),modifiedModel:new Au(Promise.resolve(u)),keep:p,undo:h,diff:Le("cellDiff",{changes:l,identical:!1,moves:[],quitEarly:!1})}}undoPreviouslyInsertedCell(e){let t=[];this._applyEditsSync(()=>{let o=this.modifiedModel.cells.indexOf(e);t=jvo(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=Qvo(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=qvo(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=ED(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}}getCurrentSnapshot(){return mT(this.modifiedModel,this.transientOptions,this.configurationService)}createSnapshot(e,t,o){return{resource:this.modifiedURI,languageId:ebo,snapshotUri:wDi(e,t,o,this.modifiedURI.path,this.modifiedModel.viewType),original:mT(this.originalModel,this.transientOptions,this.configurationService),current:mT(this.modifiedModel,this.transientOptions,this.configurationService),state:this.state.get(),telemetryInfo:this.telemetryInfo}}equalsSnapshot(e){return!!e&&Xe(this.modifiedURI,e.resource)&&this.state.get()===e.state&&new Zte(e.original).isEqual(this.originalModel)&&new Zte(e.current).isEqual(this.modifiedModel)}async restoreFromSnapshot(e,t=!0){this.updateCellDiffInfo([],void 0),this._stateObs.set(e.state,void 0),RA(this.originalModel,e.original),t&&this.restoreSnapshotInModifiedModel(e.current),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!==mT(this.modifiedModel,this.transientOptions,this.configurationService)&&this._applyEditsSync(()=>{this.modifiedModel.pushStackElement(),RA(this.modifiedModel,e),this.modifiedModel.pushStackElement()})}async resolveCellModel(e){let t=this.originalModel.cells.concat(this.modifiedModel.cells).find(n=>Xe(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 jut(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 P;return n=this._register(this._instantiationService.createInstance(pFe,this.modifiedResourceRef.object.resource,e,t,o,()=>this._isExternalEditInProgress,r)),this.cellEntryMap.set(e.uri,n),r.add(he(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}),Ui(h=>{this.updateCellDiffInfo(l,h)})})),r.add(he(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=lFe(e),n=lFe(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!==Y.untitled&&this.notebookResolver.isDirty(this.modifiedModel.uri)&&await this.modifiedResourceRef.object.save({reason:1,skipSaveParticipants:!0})}async revertToDisk(){this.modifiedModel.uri.scheme!==Y.untitled&&await this.modifiedResourceRef.object.revert({soft:!1})}};Lk=I([m(7,B),m(8,lr),m(9,Si),m(10,be),m(11,F),m(12,Nt),m(13,Ct),m(14,Cl),m(15,JK),m(16,_v),m(17,mh),m(18,rS)],Lk);function EDi(a){let i=new Ly;return i.update(a.toString()),i.digest().substring(0,8)}var tbo="contents",ibo="state.json",tie=class{constructor(i,e,t,o,n){this._chatSessionResource=i;this._fileService=e;this._environmentService=t;this._logService=o;this._workspaceContextService=n;this.storageKey=Uvo(i)}_getStorageLocation(){let i=this._workspaceContextService.getWorkspace().id;return je(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(je(i,tbo,s)).then(c=>c.value.toString()),e.set(s,l)),l},o=async s=>{let l=new vt;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=je(i,ibo);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(!ctn.includes(c.version))return;let u=new vt;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:Xn(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,tbo),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=Je.fromString(p),g=(await Q0(h)).substring(0,7);return o.has(g)||await this._fileService.writeFile(je(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:dtn,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(je(e,ibo),Je.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)}}}};tie=I([m(1,be),m(2,Co),m(3,ne),m(4,Pe)],tie);var ctn=[1,2],dtn=2;var TDi=class extends Nm{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):Pi(this._minDuration,ve.None),[r]=await Promise.all([o,n]);return r}finally{this._size-=1}})}};function ptn(a,i,e){return[{kind:"markdownContent",content:new xe("\n````\n")},{kind:"codeblockUri",uri:a,isEdit:!0,undoStopId:e},{kind:"markdownContent",content:new xe("\n````\n")},i?{kind:"notebookEdit",uri:a,edits:[],done:!1,isExternalEdit:!0}:{kind:"textEdit",uri:a,edits:[],done:!1,isExternalEdit:!0}]}var iie=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){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._state=Le(this,0);this._initialFileContents=new vt;this._baselineCreationLocks=new NT;this._streamingEditLocks=new NT;this._externalEditOperations=new Map;this._entriesObs=Le(this,[]);this.entries=Ce(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(dFe,e,this._getTimelineDelegate()),this.canRedo=this._timeline.canRedo.map((w,k)=>w&&this._state.read(k)===2),this.canUndo=this._timeline.canUndo.map((w,k)=>w&&this._state.read(k)===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(Je.fromString(t)):void 0}}]}),deleteFile:async e=>{let t=this._entriesObs.get().filter(o=>!Xe(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=>Xe(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 Lk?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(tie,this.chatSessionResource),o;if(e instanceof iie)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&&Ui(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=>Xe(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=>Xe(o.modifiedURI,e))}storeState(){return this._instantiationService.createInstance(tie,this.chatSessionResource).storeState(this._getStoredState())}_getStoredState(e=this.chatSessionResource){let t=new vt;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"?Je.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 P;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 ni("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=>Xe(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 Ui(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=xu.fromResourceMultiDiffEditorInput({multiDiffSource:wXi(this,e),label:d(6481,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(tie,this.chatSessionResource).clearState()}async _performStop(){let e=[Dk.scheme,kD.scheme];await Promise.allSettled(this._editorGroupsService.groups.flatMap(async t=>t.editors.map(async o=>{(o instanceof xu&&o.initialResources?.some(n=>n.originalUri&&e.indexOf(n.originalUri.scheme)!==-1)||o instanceof Fa&&o.original.resource&&e.indexOf(o.original.resource.scheme)!==-1)&&await t.closeEditor(o)})))}dispose(){this._assertNotDisposed(),this.clearExplanations(),Ue(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 Go,r=new Go,s=new TDi(15,1e3);s.queue(()=>r.p),this._baselineCreationLocks.queue(e.path,()=>r.p),this._streamingEditLocks.queue(e.toString(),async()=>(await Qj(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 Qj(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(f8,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){let r=new vt,s=[],l=[],c=[],u=this._getTelemetryInfoForModel(e);await Qj(this);for(let p of o){let h=new Go;l.push(h);let g=new Go;s.push(g),this._streamingEditLocks.queue(p.toString(),async()=>{if(this.isDisposed){g.complete();return}let f=await this._getOrCreateModifiedFileEntry(p,1,u);f&&await this._acceptStreamingEditsStart(e,n,p);let v=Zo.parse(p)?.notebook||p;return c.push(...ptn(p,this._notebookService.hasSupportedNotebooks(v),n)),await f?.save(),r.set(p,f&&this._getCurrentTextOrNotebookSnapshot(f)),f?.startExternalEdit(),g.complete(),h.p})}return await Promise.all(s.map(p=>p.p)),this.createSnapshot(e.requestId,n),this._externalEditOperations.set(t,{responseModel:e,snapshots:r,undoStopId:n,releaseLocks:()=>l.forEach(p=>p.complete())}),c}async stopExternalEdits(e,t){let o=this._externalEditOperations.get(t);if(!o)return this._logService.warn(`stopExternalEdits called for unknown operation ${t}`),[];this._externalEditOperations.delete(t);let n=[];try{for(let[r,s]of o.snapshots){let l=this._getEntry(r);if(!l&&s===void 0&&(l=await this._getOrCreateModifiedFileEntry(r,1,this._getTelemetryInfoForModel(e),""),l&&(l.startExternalEdit(),l.acceptStreamingEditsStart(e,o.undoStopId,void 0))),!l)continue;await l.revertToDisk();let c=this._getCurrentTextOrNotebookSnapshot(l),u=[];s===void 0?this._timeline.recordFileOperation({type:"create",uri:r,requestId:e.requestId,epoch:this._timeline.incrementEpoch(),initialContent:c,telemetryInfo:l.telemetryInfo}):(u=await l.computeEditsFromSnapshots(s,c),this._recordEditOperations(l,r,u,e)),n.push(l instanceof Lk?{kind:"notebookEdit",uri:r,edits:u,done:!0,isExternalEdit:!0}:{kind:"textEdit",uri:r,edits:u,done:!0,isExternalEdit:!0}),await l.acceptStreamingEditsEnd(),fg(this.chatSessionResource)==="copilotcli"&&await l.accept(),l.stopExternalEdit()}}finally{o.releaseLocks(),ht.some(this._streamingEditLocks.keys(),s=>!o.snapshots.has(A.parse(s)))||this._state.set(2,void 0)}return n}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 eie){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,ve.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&&Wo(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 Lk){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 Lk)return e.getCurrentSnapshot();if(e instanceof eie)return e.getCurrentContents();if(e instanceof f8)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 Lk?n.viewType:void 0}),Ui(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(f8,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)}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"}}}async _resolve(e,t,o){ht.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=>Xe(p.modifiedURI,e));if(r)if(r instanceof f8){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=>!Xe(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 Lk.create(s,r,t,c,n,this._instantiationService);{let u=await this._textModelService.createModelReference(e);return this._instantiationService.createInstance(eie,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 Lk.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=>Xe(n.originalUri,o.originalUri)&&Xe(n.modifiedUri,o.modifiedUri))?.collapsed.set(!0,t)}};iie=I([m(4,F),m(5,Ct),m(6,kt),m(7,Nt),m(8,ma),m(9,Et),m(10,ee),m(11,un),m(12,tr),m(13,ne),m(14,B),m(15,be),m(16,hme)],iie);var fFe=class extends C{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._sessionsObs=rg({equalsFn:(e,t)=>!1},new Vs);this.editingSessionsObs=Ce(e=>Array.from(this._sessionsObs.read(e)));this._register(l.registerDecorationsProvider(e.createInstance(_Di,this.editingSessionsObs))),this._register(t.registerResolver(e.createInstance(Oot,this.editingSessionsObs))),this._register(o.registerTextModelContentProvider(kD.scheme,e.createInstance(kD,this))),this._register(o.registerTextModelContentProvider(Y.chatEditingSnapshotScheme,e.createInstance(V2,this))),this._register(this._chatService.onDidDisposeSession(k=>{if(k.reason==="cleared")for(let T of k.sessionResource)this.getEditingSession(T)?.stop()}));let S=IXi.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(6480,null)})}))}dispose(){Ue(this._sessionsObs.get()),super.dispose()}startOrContinueGlobalEditingSession(e){return this.getEditingSession(e.sessionResource)||this.createEditingSession(e,!0)}_lookupEntry(e){for(let t of ht.concat(this.editingSessionsObs.get())){let o=t.getEntry(e);if(o instanceof Dk)return o.acquire()}}getEditingSession(e){return this.editingSessionsObs.get().find(t=>Xe(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){So(this.getEditingSession(e.sessionResource)===void 0,"CANNOT have more than one editing session per chat session");let n=this._instantiationService.createInstance(iie,e.sessionResource,t,this._lookupEntry.bind(this),o),r=this._sessionsObs.get(),s=r.unshift(n),l=new P;return this._store.add(l),l.add(this.installAutoApplyObserver(n,e)),l.add(n.onDidDispose(c=>{s(),this._sessionsObs.set(r,void 0),this._store.delete(l)})),this._sessionsObs.set(r,void 0),n}installAutoApplyObserver(e,t){if(!t)throw new Zs(`Edit session was created for a non-existing chat session: ${e.chatSessionResource}`);let o=new P;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=H.once(this._editorService.onDidActiveEditorChange)(()=>{l=!0}),u=new vt,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===Y.untitled||await this._fileService.exists(b).catch(()=>!1)){let S=this._editorService.activeEditorPane?.input.resource,y=l||this._editorService.activeEditorPane?.input instanceof Va&&Xe(this._editorService.activeEditorPane.input.sessionResource,o.chatSessionResource)||!!(S&&o.entries.get().find(w=>Xe(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 N=k[T],O=S.done?T===k.length-1:!1;if(mtn(N))y.stream.pushText(N,O);else if(xMe(N))for(let V of Object.values(wI(N,U=>U.uri.toString())))V&&y.stream.pushNotebookCellText(V[0].uri,V.map(U=>U.edit),O);else y.stream.pushNotebook(N,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))})}))}}};fFe=I([m(0,F),m(1,Rz),m(2,Nt),m(3,X),m(4,Si),m(5,ee),m(6,Cv),m(7,be),m(8,ao),m(9,le),m(10,ne),m(11,lt),m(12,nt),m(13,un),m(14,B)],fFe);function obo(a,i,e){let t=e.add(new E);return e.add(_s(a,(o,n)=>{let r=cre(n||[],o,i),s=[].concat(r.added).concat(r.removed);t.fire(s)})),t.event}var _Di=class extends C{constructor(e){super();this._sessions=e;this.label=d(6478,null);this._currentEntries=Ce(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=Ce(this,e=>this._currentEntries.read(e).filter(o=>o.isCurrentlyBeingModifiedBy.read(e)).map(o=>o.modifiedURI));this._modifiedUris=Ce(this,e=>this._currentEntries.read(e).filter(o=>!o.isCurrentlyBeingModifiedBy.read(e)&&o.state.read(e)===0).map(o=>o.modifiedURI));this.onDidChange=H.any(obo(this._currentlyEditingUris,tl(t=>t.toString(),Al),this._store),obo(this._modifiedUris,tl(t=>t.toString(),Al),this._store))}provideDecorations(e,t){if(this._currentlyEditingUris.get().some(r=>r.toString()===e.toString()))return{weight:1e3,letter:q.modify(M.loading,"spin"),bubble:!1};if(this._modifiedUris.get().some(r=>r.toString()===e.toString()))return{weight:1e3,letter:M.diffModified,tooltip:d(6479,null),bubble:!0}}},Oot=class{constructor(i,e){this._editingSessionsObs=i;this._instantiationService=e}canHandleUri(i){return i.scheme===_z}async resolveDiffSource(i){let e=EQe(i),t=Ce(this,o=>this._editingSessionsObs.read(o).find(n=>Xe(n.chatSessionResource,e.chatSessionResource)));return this._instantiationService.createInstance(DDi,t,e.showPreviousChanges)}};Oot=I([m(1,F)],Oot);var DDi=class{constructor(i,e){this._currentSession=i;this._showPreviousChanges=e;this._resources=Ce(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 ik(r.originalURI,r.modifiedURI,void 0,void 0,{[Oke.key]:o.entryId})}return new ik(o.originalURI,o.modifiedURI,void 0,void 0,{[Oke.key]:o.entryId})}):[]});this.resources=new pN(this._resources);this.contextKeys={[T_t.key]:!0}}};function mtn(a){return a.some(i=>Qk.isTextEdit(i))}var Khe=ae("browserElementsService");var LDi=ae("nativeBrowserElementsService");function dKt(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}`}var Fot=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 P;this._timeout=void 0;this._activeLocator=void 0;this._browserType=void 0;this._showStore.add(this.configurationService.onDidChangeConfiguration(pe=>{pe.affectsConfiguration("chat.sendElementsToChat.enabled")&&(this.configurationService.getValue("chat.sendElementsToChat.enabled")?this.showElement(this._domNode):this.hideElement(this._domNode))})),this.imagesFolder=je(this.environmentService.workspaceStorageHome,"vscode-chat-images"),VEt(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(6047,null);f.textContent=v,g.appendChild(f);let b,S=[];S.push(pi({id:"singleSelection",label:d(6051,null),enabled:!0,run:async()=>{await te()}}),pi({id:"continuousSelection",label:d(6043,null),enabled:!0,run:async()=>{for(this._editor.focus(),b=new $e,f.textContent=d(6046,null),this.hideElement(y.element),this.showElement(w.element),w.label=d(6048,null);!b.token.isCancellationRequested;)try{await this.addElementToChat(b)}catch(pe){this.logService.error("Failed to select this element.",pe),b.cancel();break}f.textContent=d(6045,null),$()}}));let y=this._showStore.add(new $I(g,{actions:S,addPrimaryActionToDropdown:!1,contextMenuProvider:this.contextMenuService,supportShortLabel:!0,title:d(6050,null),supportIcons:!0,...Ko}));y.primaryButton.label=d(6052,null),y.element.classList.add("element-selection-start");let w=this._showStore.add(new Mi(g,{...Ko,supportIcons:!0,title:d(6036,null)}));w.element.className="element-selection-cancel hidden";let k=d(6037,null);w.label=k;let T=this._showStore.add(new Mi(g,{supportIcons:!0,title:d(6038,null)}));T.icon=M.gear;let N=this._showStore.add(new Mi(g,{supportIcons:!0,title:d(6040,null)}));N.icon=M.chevronRight;let O=this._showStore.add(new Mi(g,{supportIcons:!0,title:d(6041,null)}));O.icon=M.close,O.element.classList.add("hidden");let V=document.createElement("div");V.className="element-expand-container hidden";let U=this._showStore.add(new Mi(V,{supportIcons:!0,title:d(6039,null)}));U.icon=M.layout,this._domNode.appendChild(g),this._domNode.appendChild(V);let G=()=>{this.hideElement(O.element),this.showElement(y.element),this.showElement(N.element)},$=()=>{this.hideElement(w.element),w.label=k,this.hideElement(N.element),this.showElement(O.element),this._timeout=setTimeout(()=>{f.textContent=v,G()},3e3)},te=async()=>{b=new $e,this._editor.focus(),f.textContent=d(6046,null),this.hideElement(y.element),this.showElement(w.element),await this.addElementToChat(b),f.textContent=d(6045,null),$()};this._showStore.add(j(y.primaryButton.element,"click",async()=>{await te()})),this._showStore.add(j(w.element,"click",()=>{b.cancel(),f.textContent=d(6044,null),$()})),this._showStore.add(j(N.element,"click",()=>{this.hideElement(g),this.showElement(V)})),this._showStore.add(j(U.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=dKt(o.outerHTML);if(r.push({id:"element-"+Date.now(),name:u,fullName:u,value:c,kind:"element",icon:q.fromId(M.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 WEt(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}};Fot=I([m(2,oi),m(3,At),m(4,be),m(5,Co),m(6,ne),m(7,B),m(8,Po),m(9,Khe),m(10,ze),m(11,Te)],Fot);var Wot=class{constructor(i,e,t,o,n,r){this.configurationService=o;this._browserElementsService=n;this.contextKeyService=r;this._store=new P;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(Fot,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 $e,u=async(b,S)=>{s.setActiveLocator(b,S),l.textContent=d(6042,null),i.contains(l)||i.appendChild(l),c.cancel(),c=new $e;try{await this._browserElementsService.startDebugSession(c.token,b)}catch{l.textContent=d(6049,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=Nr(this,H.any(e.onDidActiveEditorChange,e.onDidModelChange)),g=hs({},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=Mji(ie.enabled.key,this.contextKeyService),v=pr("chat.sendElementsToChat.enabled",!0,this.configurationService);this._store.add(he(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()}};Wot=I([m(2,F),m(3,B),m(4,Khe),m(5,X)],Wot);var Ghe=class{constructor(i,e){this._store=new P;let t=ui(this,H.any(i.onDidAddGroup,i.onDidRemoveGroup),()=>i.groups),o=this._store.add(new jt);this._store.add(he(n=>{let r=new Set(o.keys()),s=t.read(n);for(let l of s)if(l instanceof Uf&&(r.delete(l),!o.has(l))){let c=e.createChild(new Io([X,l.scopedContextKeyService])),u=l.element,p=c.createInstance(Wot,u,l);o.set(l,hn(p,c))}for(let l of r)o.deleteAndDispose(l)}))}static{this.ID="chat.simpleBrowser.overlay"}dispose(){this._store.dispose()}};Ghe=I([m(0,Et),m(1,F)],Ghe);var htn=13,vFe=class extends C{constructor(i){super();let e=pr("chat.fontFamily","default",i);this.fontFamily=Ce(t=>{let o=e.read(t);return o==="default"?null:o}),this.fontSize=pr("chat.fontSize",htn,i)}};vFe=I([m(0,B)],vFe);var bFe=class extends C{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||!uo(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=ca(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(),Qr.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,Je.fromString(JSON.stringify([],void 0,"	")));let o=await this.textModelService.createModelReference(this.modelsConfigurationFile),n=o.object.textEditorModel;try{let r=gtn(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()}}};bFe=I([m(0,be),m(1,Ho),m(2,Nt),m(3,ee),m(4,lk),m(5,mn),m(6,dt)],bFe);function gtn(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 Wx(a.getValue(),r),i}var nbo="vscode://schemas/language-models",$he=class extends C{constructor(e,t){super();this.languageModelsService=e;let o=oe.as(ea.JSONContribution);this._register(o.registerSchemaAssociation(nbo,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={type:"array",items:{properties:{vendor:{type:"string",enum:t.map(n=>n.vendor)},name:{type:"string"}},allOf:t.map(n=>({if:{properties:{vendor:{const:n.vendor}}},then:n.configuration})),required:["vendor","name"]}};e.registerSchema(nbo,o)}};$he=I([m(0,Wr),m(1,Wj)],$he);var ftn=Re("ai-management-editor-label-icon",M.copilot,d(6503,null)),vtn=Re("models-management-editor-label-icon",M.settings,d(6505,null)),uKt="usage",pKt="models",SFe=class a extends Us{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(6502,null)}getIcon(){return ftn}async resolve(){return null}},qhe=class a extends Us{constructor(){super();this.resource=void 0}static{this.ID="workbench.input.modelsManagement"}matches(e){return super.matches(e)||e instanceof a}get typeId(){return a.ID}getName(){return d(6504,null)}getIcon(){return vtn}async resolve(){return null}};var btn="model.entry.template",Stn="vendor.entry.template",rbo="group.entry.template",Itn=GN(z9,Gy),RDi=/@capability:\s*([^\s]+)/gi,sbo=/@visible:\s*(true|false)/i,MDi=/@provider:\s*((".+?")|([^\s]+))/gi,Vot={FILTER_TYPES:["@provider:","@capability:","@visible:"],CAPABILITIES:["@capability:tools","@capability:vision","@capability:agent"],VISIBILITY:["@visible:true","@visible:false"]};function S0(a){return a.type==="vendor"}function z2(a){return a.type==="group"}function Bot(a){return a.type==="status"}var IFe=class extends C{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=sbo.exec(t);n&&n[1]&&(o=n[1].toLowerCase()==="true",t=t.replace(sbo,""));let r=[],s;for(MDi.lastIndex=0;(s=MDi.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(MDi,""));let l=[],c;for(RDi.lastIndex=0;(c=RDi.exec(t))!==null;)l.push(c[1].toLowerCase());l.length>0&&(t=t.replace(RDi,""));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 N=this.getMatchingCapabilities(b,T);if(N.length===0){k=!1;break}S.push(...N)}if(!k)continue;S=Uo(S)}let y;if(t&&(y=new PDi(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:btn,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(6507,null),templateId:rbo,collapsed:this.collapsedGroups.has("visible")},models:o}),t.push({group:{type:"group",id:"hidden",label:d(6506,null),templateId:rbo,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:Stn,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 S0(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=z2(e)||S0(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)(S0(e)||z2(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}};IFe=I([m(0,Wr)],IFe);var PDi=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)=>Gy(n,r,!0),t):null,this.modelIdMatches=this.matches(e,i.metadata.id,GN(Gy,K9),t),this.providerMatches=this.matches(e,i.provider.group.name,(n,r)=>Gy(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,GN(Gy,K9),t))}}matches(i,e,t,o){let n=i?Itn(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 Uo(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 YC=_,ytn=30,wtn=30,Ctn=26;var ADi=class extends st{constructor(){super("workbench.models.filter",d(6517,null),q.asClassName(M.filter))}async run(){}};function abo(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 Hot=class extends wp{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(6526,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(6521,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(6520,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(6522,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=abo(t,e);this.search.setValue(o)}getActions(){let e=[];e.push(this.createCapabilityAction("tools",d(6510,null)),this.createCapabilityAction("vision",d(6511,null)),this.createCapabilityAction("agent",d(6509,null))),e.push(new li),e.push(this.createVisibleAction(!0,d(6519,null))),e.push(this.createVisibleAction(!1,d(6518,null)));let t=this.viewModel.getConfiguredVendors();t.length>1&&(e.push(new li),e.push(...t.map(n=>this.createProviderAction(n.vendor.vendor,n.group.name)))),e.push(new li);let o=[];return o.push(this.createGroupByAction("vendor",d(6524,null))),o.push(this.createGroupByAction("visibility",d(6525,null))),e.push(new $l("groupBy",d(6523,null),o)),e}};Hot=I([m(4,ze)],Hot);var NDi=class{constructor(){this.headerRowHeight=ytn}getHeight(i){return S0(i)||z2(i)?wtn:Ctn}},v8=class{renderElement(i,e,t){t.elementDisposables.clear();let o=S0(i),n=z2(i),r=Bot(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()}},mKt=class a extends v8{constructor(e){super();this.viewModel=e;this.templateId=a.TEMPLATE_ID}static{this.TEMPLATE_ID="gutter"}renderTemplate(e){let t=new P,o=new P;e.classList.add("models-gutter-column");let n=t.add(new ji(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(6516,null):d(6513,null),n={id:"toggleCollapse",label:o,tooltip:o,enabled:!0,class:q.asClassName(e.collapsed?M.chevronRight:M.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=pi({id:"toggleVisibility",label:r?d(6544,null):d(6549,null),class:`model-visibility-toggle ${r?`${q.asClassName(M.eye)} model-visible`:`${q.asClassName(M.eyeClosed)} model-hidden`}`,tooltip:r?d(6555,null):d(6543,null),checked:!r,run:async()=>this.viewModel.toggleVisibility(e)});o.actionBar.push(s,{icon:!0,label:!1})}},oie=class extends v8{constructor(e){super();this.hoverService=e;this.templateId=oie.TEMPLATE_ID}static{this.TEMPLATE_ID="modelName"}renderTemplate(e){let t=new P,o=new P,n=R(e,YC(".model-name-container")),r=R(n,YC(".status-icon")),s=t.add(new Oa(R(n,YC(".model-name")))),l=R(n,YC(".model-status-icon")),c=t.add(new ji(R(n,YC(".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 xe("",{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(6554,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 gt.Error:o.nameLabel.element.classList.add("error-status"),o.statusIcon.classList.add(...q.asClassNameArray(M.error));break;case gt.Warning:o.nameLabel.element.classList.add("warning-status"),o.statusIcon.classList.add(...q.asClassNameArray(M.warning));break;case gt.Info:o.nameLabel.element.classList.add("info-status"),o.statusIcon.classList.add(...q.asClassNameArray(M.info));break}o.nameLabel.set(e.message,void 0,e.message)}};oie=I([m(0,tt)],oie);var nie=class extends v8{constructor(e){super();this.hoverService=e;this.templateId=nie.TEMPLATE_ID}static{this.TEMPLATE_ID="multiplier"}renderTemplate(e){let t=new P,o=new P,n=R(e,YC(".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(6558,null,n),appearance:{compact:!0,skipFadeInAnimation:!0}})))}};nie=I([m(0,tt)],nie);var rie=class extends v8{constructor(e){super();this.hoverService=e;this.templateId=rie.TEMPLATE_ID}static{this.TEMPLATE_ID="tokenLimits"}renderTemplate(e){let t=new P,o=new P,n=R(e,YC(".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 xe("",{isTrusted:!0,supportThemeIcons:!0});if(n.metadata.maxInputTokens||n.metadata.maxOutputTokens){let s=(n.metadata.maxInputTokens??0)+(n.metadata.maxOutputTokens??0),l=R(o.tokenLimitsElement,YC(".token-limit-item")),c=R(l,YC("span"));c.textContent=ODi(s),r.appendMarkdown(`${d(6538,null)}: `),r.appendMarkdown(`${ODi(s)}`)}o.elementDisposables.add(this.hoverService.setupDelayedHoverAtMouse(o.container,()=>({content:r,appearance:{compact:!0,skipFadeInAnimation:!0}})))}};rie=I([m(0,tt)],rie);var hKt=class a extends v8{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 P,o=new P;e.classList.add("model-capability-column");let n=R(e,YC(".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(6553,null),"tools")),n.metadata.capabilities?.vision&&o.elementDisposables.add(this.createCapabilityButton(o.metadataRow,r?.includes("vision")||!1,d(6556,null),"vision"))}createCapabilityButton(e,t,o,n){let r=new P,s=R(e,YC(".model-badge-container")),l=r.add(new Mi(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}},sie=class extends v8{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=sie.TEMPLATE_ID}static{this.TEMPLATE_ID="actions"}renderTemplate(e){let t=new P,o=new P;e.classList.add("models-actions-column");let n=R(e,YC(".actions-container")),r=t.add(this.instantiationService.createInstance(Ju,n,this.contextMenuService,{icon:!0,label:!1,moreIcon:M.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(pi({id:"configureAction",label:d(6536,null),run:()=>this.languageModelsService.configureLanguageModelsProviderGroup(n.vendor.vendor,n.group.name)})),s.push(pi({id:"deleteAction",label:d(6540,null),class:q.asClassName(M.trash),run:async()=>{(await this.dialogService.confirm({type:"info",message:d(6541,null,n.group.name)})).confirmed&&await this.languageModelsService.removeLanguageModelsProviderGroup(n.vendor.vendor,n.group.name)}}))):n.vendor.managementCommand&&r.push(pi({id:"manageVendor",label:d(6548,null,n.group.name),class:q.asClassName(M.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){}};sie=I([m(1,F),m(2,Wr),m(3,ct),m(4,ge),m(5,ze)],sie);var gKt=class a extends v8{constructor(){super(...arguments);this.templateId=a.TEMPLATE_ID}static{this.TEMPLATE_ID="provider"}renderTemplate(e){let t=new P,o=new P,n=R(e,YC(".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 ODi(a){return a>=1e6?`${(a/1e6).toFixed(1)}M`:a>=1e3?`${(a/1e3).toFixed(0)}K`:a.toString()}var $B=class extends C{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.dropdownActions=[];this.tableDisposables=this._register(new P);this.searchFocusContextKey=lTt.bindTo(c),this.delayedFiltering=this._register(new jo(200)),this.viewModel=this._register(this.instantiationService.createInstance(IFe)),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=R(e,YC(".models-search-and-button-container")),o=d(6560,null),n=R(t,YC(".models-search-container"));this.searchWidget=this._register(this.instantiationService.createInstance(tA,"chatModelsWidget.searchbox",n,{triggerCharacters:["@",":"],provideResults:h=>{let g=this.viewModel.getVendors().map(S=>`@provider:"${S.displayName}"`),f=[...g,...Vot.CAPABILITIES,...Vot.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:")?Vot.CAPABILITIES:b.startsWith("@visible:")?Vot.VISIBILITY:b.startsWith("@")?f:[]}},o,`chatModelsWidget:searchinput:${$B.NUM_INSTANCES++}`,{placeholderText:o,styleOverrides:{inputBorder:ZE},focusContextKey:this.searchFocusContextKey}));let r=this._register(new ADi),s=this._register(new st("workbench.models.clearSearch",d(6512,null),q.asClassName(wLe),!1,()=>this.clearSearch())),l=this._register(new st("workbench.models.collapseAll",d(6514,null),q.asClassName(M.collapseAll),!1,()=>{this.viewModel.collapseAll()}));l.enabled=this.viewModel.viewModelEntries.some(h=>z2(h)||S0(h)),this._register(this.viewModel.onDidChange(()=>l.enabled=this.viewModel.viewModelEntries.some(h=>S0(h)||z2(h)))),this._register(this.searchWidget.onInputDidChange(()=>{s.enabled=!!this.searchWidget.getValue(),this.filterModels()})),this.searchActionsContainer=R(n,YC(".models-search-actions"));let c=[s,l,r];this._register(new Ju(this.searchActionsContainer,this.contextMenuService,{actionViewItemProvider:(h,g)=>{if(h.id===r.id)return this.instantiationService.createInstance(Hot,h,g,{getValue:()=>this.searchWidget.getValue(),setValue:f=>this.search(f)},this.viewModel)},getKeyBinding:()=>{}})).setActions(c),this.searchWidget.inputWidget.getContainerDomNode().style.paddingRight=`${yl(this.searchActionsContainer)+12}px`,this.addButtonContainer=R(t,YC(".section-title-actions"));let p={...Ko,supportIcons:!0};this.addButton=this._register(new Mi(this.addButtonContainer,p)),this.addButton.label=`$(${M.add.id}) ${d(6542,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=R(e,YC(".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(mKt,this.viewModel),t=this.instantiationService.createInstance(oie),o=this.instantiationService.createInstance(nie),n=this.instantiationService.createInstance(rie),r=this.instantiationService.createInstance(hKt),s=this.instantiationService.createInstance(sie,this.viewModel),l=this.instantiationService.createInstance(gKt);this.tableDisposables.add(r),this.tableDisposables.add(r.onDidClickCapability(u=>{let p=this.searchWidget.getValue(),h=`@capability:${u}`,g=abo(p,{query:h});this.search(g)}));let c=[{label:"",tooltip:"",weight:.05,minimumWidth:40,maximumWidth:40,templateId:mKt.TEMPLATE_ID,project(u){return u}},{label:d(6533,null),tooltip:"",weight:.35,minimumWidth:200,templateId:oie.TEMPLATE_ID,project(u){return u}}];this.viewModel.groupBy==="visibility"&&c.push({label:d(6559,null),tooltip:"",weight:.15,minimumWidth:100,templateId:gKt.TEMPLATE_ID,project(u){return u}}),c.push({label:d(6562,null),tooltip:"",weight:.1,minimumWidth:140,templateId:rie.TEMPLATE_ID,project(u){return u}},{label:d(6508,null),tooltip:"",weight:.2,minimumWidth:180,templateId:hKt.TEMPLATE_ID,project(u){return u}},{label:d(6515,null),tooltip:"",weight:.1,minimumWidth:60,templateId:nie.TEMPLATE_ID,project(u){return u}},{label:"",tooltip:"",weight:.05,minimumWidth:64,maximumWidth:64,templateId:sie.TEMPLATE_ID,project(u){return u}}),this.table=this.tableDisposables.add(this.instantiationService.createInstance(rC,"ModelsWidget",this.tableContainer,new NDi,c,[e,t,o,n,r,s,l],{identityProvider:{getId:u=>u.id},horizontalScrolling:!1,accessibilityProvider:{getAriaLabel:u=>{if(S0(u))return d(6563,null,u.vendorEntry.group.name);if(z2(u))return u.id==="visible"?d(6564,null):d(6527,null);if(Bot(u))return d(6561,null,u.message);let p=[];if(p.push(d(6531,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(6529,null,ODi(g)))}u.model.metadata.capabilities&&p.push(d(6528,null,Object.keys(u.model.metadata.capabilities).join(", ")));let h=u.model.metadata.multiplier??"-";return h!=="-"&&p.push(d(6558,null,h)),u.model.visible?p.push(d(6532,null)):p.push(d(6530,null)),p.join(". ")},getWidgetAriaLabel:()=>d(6557,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=>!S0(S)&&!z2(S)&&!Bot(S)),f=[],v,b;if(g.length){let S=g.filter(w=>w.model.visible),y=g.filter(w=>!w.model.visible);f.push(pi({id:"hideSelectedModels",label:d(6546,null),enabled:S.length>0,run:()=>this.viewModel.setModelsVisibility(g,!1)})),f.push(pi({id:"showSelectedModels",label:d(6551,null),enabled:y.length>0,run:()=>this.viewModel.setModelsVisibility(g,!0)})),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;S0(S)&&(S.vendorEntry.vendor.isDefault||(f.push(pi({id:"hideAllModels",label:d(6545,null),run:()=>this.viewModel.setGroupVisibility(S,!1)})),f.push(pi({id:"showAllModels",label:d(6550,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 li),b.managementCommand?f.push(pi({id:"configureVendor",label:d(6537,null),run:async()=>{await this.commandService.executeCommand(b.managementCommand,b.vendor),await this.viewModel.refresh()}})):f.push(pi({id:"configureVendor",label:d(6537,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.tableDisposables.add(this.viewModel.onDidChange(({at:u,removed:p,added:h})=>{if(this.table.splice(u,p,h),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&&(Bot(u)||(S0(u)||z2(u)?this.viewModel.toggleCollapsed(u):(!Vp(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(6547,null):""),this.dropdownActions=e.map(r=>pi({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 ai(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())}};$B=I([m(0,Wr),m(1,F),m(2,lt),m(3,ze),m(4,vr),m(5,rd),m(6,ge),m(7,X)],$B);var hT=_,yFe=class extends C{constructor(e){super();this.chatEntitlementService=e;this._onDidChangeContentHeight=this._register(new E);this.onDidChangeContentHeight=this._onDidChangeContentHeight.event;this.dateFormatter=Wu.DateTimeFormat(Dr,{year:"numeric",month:"long",day:"numeric"});this.dateTimeFormatter=Wu.DateTimeFormat(Dr,{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=R(e,hT(".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(6566,null)),this.renderLimitedQuotaItem(this.usageSection,d(6565,null));else if(t||e||o){if(t&&this.renderQuotaItem(this.usageSection,d(6571,null),t),e&&this.renderQuotaItem(this.usageSection,d(6568,null),e),o){let l=o.overageEnabled?d(6570,null):d(6574,null);if(this.renderQuotaItem(this.usageSection,l,o,o.overageEnabled),o.overageEnabled&&!o.unlimited){let c=R(this.usageSection,hT(".overage-message"));c.append(d(6572,null)),R(c,hT("br")),c.append(d(6573,null))}}if(n){let l=R(this.usageSection,hT(".allowance-resets"));l.textContent=d(6567,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=R(e,hT(".quota-item")),s=R(r,hT(".quota-item-header")),l=R(s,hT(".quota-item-label"));l.textContent=t;let c=R(s,hT(".quota-item-value"));o.unlimited?c.textContent=d(6569,null):c.textContent=d(6569,null);let u=R(r,hT(".quota-bar")),p=R(u,hT(".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=R(e,hT(".quota-item")),n=R(o,hT(".quota-item-header")),r=R(n,hT(".quota-item-label"));r.textContent=t;let s=R(n,hT(".quota-item-value"));s.textContent=d(6575,null);let l=R(o,hT(".quota-bar"));R(l,hT(".quota-bit"))}};yFe=I([m(0,vr)],yFe);var TD=_,K2=class extends pa{constructor(e,t,o,n,r,s){super(K2.ID,e,t,o,n);this.instantiationService=r;this.editorDisposables=this._register(new P);this.inModelsEditorContextKey=nke.bindTo(s)}static{this.ID="workbench.editor.modelsManagement"}createEditor(e){this.editorDisposables.clear(),this.bodyContainer=R(e,TD(".ai-models-management-editor")),this.modelsWidget=this.editorDisposables.add(this.instantiationService.createInstance($B)),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)}};K2=I([m(1,Te),m(2,De),m(3,le),m(4,F),m(5,X)],K2);var xtn=J("chatManagement.sashBorder",cb,d(6489,null));function ktn(a){return!a.sentiment.installed||a.entitlement===3}var b8=class extends pa{constructor(e,t,o,n,r,s,l){super(b8.ID,e,t,o,n);this.instantiationService=r;this.selectedSection=uKt;this.sections=[];this.actionButtonClickListener=this._register(new me);this.commandService=s,this.chatEntitlementService=l}static{this.ID="workbench.editor.chatManagement"}createEditor(e){this.container=R(e,TD(".ai-management-editor")),this.renderHeader(this.container);let t=R(this.container,TD(".split-view-container")),o=R(t,TD(".sidebar-view")),n=R(o,TD(".sidebar-container")),r=R(t,TD(".contents-view"));this.contentsContainer=R(r,TD(".contents-container")),this.splitView=new vu(t,{orientation:1,proportionalLayout:!0}),this.renderSidebar(n),this.renderContents(this.contentsContainer),this.splitView.addView({onDidChange:H.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:H.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)}},Wl.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(xtn);this.splitView?.style({separatorBorder:e})}renderSidebar(e){this.sections=[{id:uKt,label:d(6498,null)},{id:pKt,label:d(6495,null)}];let t=new FDi,o=new WDi;this.sectionsList=this._register(this.instantiationService.createInstance(Rl,"ChatManagementSections",e,t,[o],{multipleSelectionSupport:!1,setRowLineHeight:!1,horizontalScrolling:!1,accessibilityProvider:{getAriaLabel(n){return n.label},getWidgetAriaLabel(){return d(6499,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=R(e,TD(".ai-management-header"));let t=R(this.headerContainer,TD(".header-title-container")),o=R(t,TD(".header-title-wrapper")),n=R(o,TD(".ai-management-editor-title"));n.textContent=d(6493,null),this.planBadge=R(o,TD(".plan-badge"));let r=R(t,TD(".header-upgrade-button-container"));this.actionButton=this._register(new Mi(r,{...Ko})),this.actionButton.element.classList.add("header-upgrade-button"),this.actionButton.element.style.display="none"}renderContents(e){let t=R(e,TD(".ai-management-body"));this.chatUsageWidget=this._register(this.instantiationService.createInstance(yFe)),this.modelsWidget=this._register(this.instantiationService.createInstance($B)),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===uKt?this.chatUsageWidget.element.style.display="":this.selectedSection===pKt&&(this.modelsWidget.element.style.display=""),this.dimension&&this.layout(this.dimension)}layoutContents(e,t){this.contentsContainer&&this.selectedSection===pKt&&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=ktn(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(6494,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(6497,null):l=d(6496,null),c="workbench.action.chat.upgradePlan"):s&&(r||t)?(l=d(6501,null),c="workbench.action.chat.upgradePlan"):e?(l=d(6490,null),c=e&&t?"workbench.action.chat.triggerSetupAnonymousWithoutDialog":"workbench.action.chat.triggerSetup"):t?(l=d(6492,null),c="workbench.action.chat.triggerSetup"):o?(l=d(6491,null),c="workbench.action.chat.triggerSetup"):(l=d(6500,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 sTt(this.chatEntitlementService.entitlement)}shouldShowUpgradeButton(){let e=this.chatEntitlementService.entitlement;return e===3||e===5||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()}};b8=I([m(1,Te),m(2,De),m(3,le),m(4,F),m(5,ge),m(6,vr)],b8);var FDi=class{getHeight(i){return 22}getTemplateId(){return"sectionItem"}},WDi=class{constructor(){this.templateId="sectionItem"}renderTemplate(i){return i.classList.add("section-list-item"),{label:R(i,TD(".section-list-item-label"))}}renderElement(i,e,t){t.label.textContent=i.label}disposeTemplate(i){}};var lbo=Re("language-models-open-settings",M.goToFile,d(6484,null)),fKt=x.and(ie.enabled,x.or(ie.Entitlement.planFree,ie.Entitlement.planPro,ie.Entitlement.planProPlus,ie.Entitlement.planBusiness,ie.Entitlement.planEnterprise,ie.Entitlement.internal));oe.as(rn.EditorPane).registerEditorPane(ys.create(b8,b8.ID,d(6483,null)),[new Mt(SFe)]);oe.as(rn.EditorPane).registerEditorPane(ys.create(K2,K2.ID,d(6486,null)),[new Mt(qhe)]);var VDi=class{canSerialize(i){return!0}serialize(i){return""}deserialize(i){return i.createInstance(SFe)}},BDi=class{canSerialize(i){return!0}serialize(i){return""}deserialize(i){return i.createInstance(qhe)}};oe.as(rn.EditorFactory).registerEditorSerializer(SFe.ID,VDi);oe.as(rn.EditorFactory).registerEditorSerializer(qhe.ID,BDi);function cbo(a){return Ae(a)?a:void 0}function Etn(a){yi(a)||(a={});let i=a;return{query:cbo(i?.query),section:cbo(i?.section)}}var wFe=class extends C{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:V8e,title:L(6487,"Manage Language Models"),category:vi,precondition:fKt,f1:!0})}async run(e,t){let o=e.get(ee);return t=Etn(t),o.openEditor(new qhe,{pinned:!0},ym)}})),this._register(W(class extends K{constructor(){super({id:"chat.models.action.clearSearchResults",precondition:nke,keybinding:{primary:9,weight:100,when:lTt},title:L(6485,"Clear Models Search Results")})}run(e){let t=e.get(ee).activeEditorPane;return t instanceof K2&&t.clearSearch(),null}})),this._register(W(class extends K{constructor(){super({id:"workbench.action.openLanguageModelsJson",title:L(6488,"Open Language Models (JSON)"),category:vi,precondition:fKt,f1:!0})}async run(e){await e.get(Wj).configureLanguageModels()}}))}registerLanguageModelsEditorTitleActions(){let e=this.languageModelsConfigurationService.configurationFile,t=x.and(nke.toNegated(),Fo.Resource.isEqualTo(e.toString()),x.not("isInDiffEditor"),fKt);fe.appendMenuItem(D.EditorTitle,{command:{id:V8e,title:L(6487,"Manage Language Models"),icon:lbo},when:t,group:"navigation",order:1});let o=x.and(nke,fKt);fe.appendMenuItem(D.EditorTitle,{command:{id:"workbench.action.openLanguageModelsJson",title:L(6488,"Open Language Models (JSON)"),icon:lbo},when:o,group:"navigation",order:1})}};wFe=I([m(0,Wj)],wFe);pt(wFe.ID,wFe,ut.AfterRestored);var lf=ae("aiCustomizationWorkspaceService"),kn={Agents:"agents",Skills:"skills",Instructions:"instructions",Prompts:"prompts",Hooks:"hooks",McpServers:"mcpServers",Plugins:"plugins",Models:"models"};function qB(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=>La(t.uri,o)):!0:!1)}var jhe=class{constructor(i,e,t){this.workspaceContextService=i;this.commandService=e;this.promptsService=t;this.managementSections=[kn.Agents,kn.Skills,kn.Instructions,kn.Prompts,kn.Hooks,kn.McpServers,kn.Plugins];this.isSessionsWindow=!1;this.hasOverrideProjectRoot=Oo(!1);let o=ff({owner:this},this.workspaceContextService.onDidChangeWorkspaceFolders,()=>this.workspaceContextService.getWorkspace().folders);this.activeProjectRoot=Ce(n=>o.read(n)[0]?.uri)}getActiveProjectRoot(){return this.workspaceContextService.getWorkspace().folders[0]?.uri}static{this._defaultFilter={sources:["local","user","extension","plugin"]}}getStorageSourceFilter(i){return jhe._defaultFilter}setOverrideProjectRoot(i){}clearOverrideProjectRoot(){}async commitFiles(i,e){}async deleteFiles(i,e){}async generateCustomization(i){let t={agent:a3,skill:s3,instructions:pet,prompt:r3,hook:kCi}[i];t&&await this.commandService.executeCommand(t)}async getFilteredPromptSlashCommands(i){return this.promptsService.getPromptSlashCommands(i)}};jhe=I([m(0,Pe),m(1,ge),m(2,nr)],jhe);we(lf,jhe,1);var qbh=Re("ai-customization-view-icon",M.sparkle,d(5825,null)),G2=Re("ai-customization-agent",M.agent,d(5815,null)),S8=Re("ai-customization-skill",M.lightbulb,d(5823,null)),I8=Re("ai-customization-instructions",M.book,d(5818,null)),y8=Re("ai-customization-prompt",M.bookmark,d(5821,null)),CFe=Re("ai-customization-hook",M.zap,d(5817,null)),jbh=Re("ai-customization-add",M.add,d(5814,null)),Qbh=Re("ai-customization-run",M.play,d(5822,null)),xFe=Re("ai-customization-workspace",M.folder,d(5826,null)),kFe=Re("ai-customization-user",M.account,d(5824,null)),EFe=Re("ai-customization-extension",M.extensions,d(5816,null)),I0=Re("ai-customization-plugin",M.plug,d(5820,null)),vKt=Re("ai-customization-mcp-server",M.server,d(5819,null));var bKt="workbench.editor.aiCustomizationManagement",SKt="workbench.input.aiCustomizationManagement",IKt={OpenEditor:"aiCustomization.openManagementEditor",CreateNewAgent:"aiCustomization.createNewAgent",CreateNewSkill:"aiCustomization.createNewSkill",CreateNewInstructions:"aiCustomization.createNewInstructions",CreateNewPrompt:"aiCustomization.createNewPrompt"},dbo=new Q("aiCustomizationManagementEditorFocused",!1,d(5874,null)),ubo=new Q("aiCustomizationManagementSection",kn.Agents,d(5875,null)),tSh=D.for("AICustomizationManagementEditorTitle"),Qhe=D.for("AICustomizationManagementEditorItem"),yKt="aiCustomizationManagement.selectedSection",HDi="aiCustomizationManagement.sidebarWidth";var wKt=200,pbo=150,mbo=350,hbo=400;function Ttn(a){switch(a){case kn.Agents:return"agent";case kn.Skills:return"skill";case kn.Instructions:return"instructions";case kn.Hooks:return"hook";case kn.Prompts:default:return"prompt"}}async function gbo(a,i,e,t){let o=Ttn(a),n=e.getStorageSourceFilter(o),r=[];if(r.push(`== Customization Debug: ${a} (${o}) ==`),r.push(`Window: ${e.isSessionsWindow?"Sessions":"Core VS Code"}`),r.push(`Active root: ${e.getActiveProjectRoot()?.fsPath??"(none)"}`),r.push(`Sections: [${e.managementSections.join(", ")}]`),r.push(`Filter sources: [${n.sources.join(", ")}]`),n.includedUserFileRoots){r.push("Filter includedUserFileRoots:");for(let s of n.includedUserFileRoots)r.push(`  ${s.fsPath}`)}else r.push("Filter includedUserFileRoots: (all)");return r.push(""),await _tn(r,i,o),await Dtn(r,i,o,n),Ltn(r,t),await Rtn(r,i,o),r.join(`
`)}async function _tn(a,i,e){a.push("--- Stage 1: Raw PromptsService Data ---");let[t,o,n]=await Promise.all([i.listPromptFilesForStorage(e,"local",ve.None),i.listPromptFilesForStorage(e,"user",ve.None),i.listPromptFilesForStorage(e,"extension",ve.None)]);a.push(`  listPromptFilesForStorage(local):  ${t.length} files`),CKt(a,t),a.push(`  listPromptFilesForStorage(user):   ${o.length} files`),CKt(a,o),a.push(`  listPromptFilesForStorage(ext):    ${n.length} files`),CKt(a,n);let r=await i.listPromptFiles(e,ve.None);if(a.push(`  listPromptFiles (merged):          ${r.length} files`),e==="instructions"){let s=await i.listAgentInstructions(ve.None,void 0);a.push(`  listAgentInstructions (extra):     ${s.length} files`),CKt(a,s)}if(e==="skill"){let s=await i.findAgentSkills(ve.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(ve.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(ve.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 Dtn(a,i,e,t){a.push("--- Stage 2: After applyStorageSourceFilter ---");let[o,n,r]=await Promise.all([i.listPromptFilesForStorage(e,"local",ve.None),i.listPromptFilesForStorage(e,"user",ve.None),i.listPromptFilesForStorage(e,"extension",ve.None)]),s=[...o,...n,...r],l=qB(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 Ltn(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 Rtn(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 CKt(a,i){for(let e of i)a.push(`    ${e.uri.fsPath}`)}var Lb=_,Mtn=44,Ptn=36,Atn=40,UDi=class{getHeight(i){return i.type==="group-header"?i.isFirst?Ptn:Atn:Mtn}getTemplateId(i){return i.type==="group-header"?"groupHeader":"aiCustomizationItem"}},zDi=class{constructor(i){this.hoverService=i;this.templateId="groupHeader"}renderTemplate(i){let e=new P,t=new P;i.classList.add("ai-customization-group-header");let o=R(i,Lb(".group-chevron")),n=R(i,Lb(".group-icon")),r=R(i,Lb(".group-label-group")),s=R(r,Lb(".group-label")),l=R(r,Lb(".group-info"));l.classList.add(...q.asClassNameArray(M.info));let c=R(i,Lb(".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?M.chevronRight:M.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()}},Uot=class{constructor(i,e){this.hoverService=i;this.labelService=e;this.templateId="aiCustomizationItem"}renderTemplate(i){let e=new P,t=new P;i.classList.add("ai-customization-list-item");let o=R(i,Lb(".item-left")),n=R(o,Lb(".item-text")),r=e.add(new Oa(R(n,Lb(".item-name")))),s=e.add(new Oa(R(n,Lb(".item-description")))),l=R(i,Lb(".item-right"));return{container:i,actionsContainer:l,nameLabel:r,description:s,disposables:e,elementDisposables:t}}renderElement(i,e,t){t.elementDisposables.clear();let o=i.item;t.elementDisposables.add(this.hoverService.setupDelayedHover(t.container,()=>{let r=this.labelService.getUriLabel(o.uri,{relative:!1});return{content:`${o.name}
${r}`,appearance:{compact:!0,skipFadeInAnimation:!0}}})),t.nameLabel.set(o.name,o.nameMatches);let n=o.description||o.filename;n?(t.description.set(n,o.description?o.descriptionMatches:void 0),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")}disposeTemplate(i){i.elementDisposables.dispose(),i.disposables.dispose()}};Uot=I([m(0,tt),m(1,ot)],Uot);function xKt(a){switch(a){case kn.Agents:return"agent";case kn.Skills:return"skill";case kn.Instructions:return"instructions";case kn.Hooks:return"hook";case kn.Prompts:default:return"prompt"}}var TFe=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){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.currentSection=kn.Agents;this.allItems=[];this.displayEntries=[];this.searchQuery="";this.collapsedGroups=new Set;this.dropdownActionDisposables=this._register(new P);this.delayedFilter=new jo(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=Lb(".ai-customization-list-widget"),this.create(),this._register(this.workspaceContextService.onDidChangeWorkspaceFolders(()=>this.refresh())),this._register(he(b=>{this.workspaceService.activeProjectRoot.read(b),this.updateAddButton(),this.refresh()}))}create(){this.searchAndButtonContainer=R(this.element,Lb(".list-search-and-button-container")),this.searchContainer=R(this.searchAndButtonContainer,Lb(".list-search-container")),this.searchInput=this._register(new Dc(this.searchContainer,this.contextViewService,{placeholder:d(5866,null),inputBoxStyles:pl})),this._register(this.searchInput.onDidChange(()=>{this.searchQuery=this.searchInput.value,this.delayedFilter.trigger(()=>this.filterItems())})),this.addButtonContainer=R(this.searchAndButtonContainer,Lb(".list-add-button-container")),this.addButtonSimple=this._register(new Mi(this.addButtonContainer,{...Ko,supportIcons:!0})),this.addButtonSimple.element.classList.add("list-add-button"),this._register(this.addButtonSimple.onDidClick(()=>this.executePrimaryCreateAction())),this.addButton=this._register(new $I(this.addButtonContainer,{...Ko,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=R(this.element,Lb(".list-container")),this.emptyStateContainer=R(this.element,Lb(".list-empty-state")),this.emptyStateIcon=R(this.emptyStateContainer,Lb(".empty-state-icon")),this.emptyStateText=R(this.emptyStateContainer,Lb(".empty-state-text")),this.emptyStateSubtext=R(this.emptyStateContainer,Lb(".empty-state-subtext")),this.emptyStateContainer.style.display="none",this.list=this._register(this.instantiationService.createInstance(Rl,"AICustomizationManagementList",this.listContainer,new UDi,[new zDi(this.hoverService),this.instantiationService.createInstance(Uot)],{identityProvider:{getId:e=>e.type==="group-header"?e.id:e.item.id},accessibilityProvider:{getAriaLabel:e=>e.type==="group-header"?d(5843,null,e.label,e.count,e.collapsed?d(5831,null):d(5840,null)):e.item.description?d(5849,null,e.item.name,e.item.description):e.item.name,getWidgetAriaLabel:()=>d(5855,null)},keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:e=>e.type==="group-header"?e.label:e.item.name},multipleSelectionSupport:!1,openOnSingleClick:!0})),this._register(this.list.onDidOpen(e=>{e.element&&(e.element.type==="group-header"?this.toggleGroup(e.element):this._onDidSelectItem.fire(e.element.item))})),this._register(this.list.onContextMenu(e=>this.onContextMenu(e))),this._register(this.promptsService.onDidChangeCustomAgents(()=>this.refresh())),this._register(this.promptsService.onDidChangeSlashCommands(()=>this.refresh())),this.sectionHeader=R(this.element,Lb(".section-footer")),this.sectionDescription=R(this.sectionHeader,Lb("p.section-footer-description")),this.sectionLink=R(this.sectionHeader,Lb("a.section-footer-link")),this._register(j(this.sectionLink,"click",e=>{e.preventDefault();let t=this.sectionLink.href;t&&this.openerService.open(A.parse(t))})),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},n=this.menuService.getMenuActions(Qhe,this.contextKeyService,{arg:o,shouldForwardArgs:!0}),r=Uc(n),s=[new li,new st("copyFullPath",d(5832,null),void 0,!0,async()=>{await this.clipboardService.writeText(t.uri.fsPath)}),new st("copyRelativePath",d(5833,null),void 0,!0,async()=>{let l=this.workspaceService.getActiveProjectRoot();if(l&&t.uri.fsPath.startsWith(l.fsPath)){let c=t.uri.fsPath.substring(l.fsPath.length+1);await this.clipboardService.writeText(c)}else{let c=this.labelService.getUriLabel(t.uri,{relative:!0});await this.clipboardService.writeText(c)}})];this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>[...r,...s]})}async setSection(e){this.currentSection=e,this.updateSectionHeader(),this.updateAddButton(),await this.loadItems()}updateSectionHeader(){let e,t,o;switch(this.currentSection){case kn.Agents:e=d(5828,null),t="https://code.visualstudio.com/docs/copilot/customization/custom-agents",o=d(5850,null);break;case kn.Skills:e=d(5868,null),t="https://code.visualstudio.com/docs/copilot/customization/agent-skills",o=d(5854,null);break;case kn.Instructions:e=d(5848,null),t="https://code.visualstudio.com/docs/copilot/customization/custom-instructions",o=d(5852,null);break;case kn.Hooks:e=d(5845,null),t="https://code.visualstudio.com/docs/copilot/customization/hooks",o=d(5851,null);break;case kn.Prompts:default:e=d(5865,null),t="https://code.visualstudio.com/docs/copilot/customization/prompt-files",o=d(5853,null);break}this.sectionDescription.textContent=e,this.sectionLink.textContent=o,this.sectionLink.href=t}updateAddButton(){let e=this.getTypeLabel(),o=this.getDropdownActions().length>0;if(this.addButton.element.style.display=o?"":"none",this.addButtonSimple.element.style.display=o?"none":"",this.workspaceService.isSessionsWindow){let n=this.hasActiveWorkspace(),r=`$(${M.add.id}) New ${e} (Workspace)`;if(o){if(this.addButton.label=r,this.addButton.enabled=n,this.addButton.primaryButton.setTitle(""),this.addButton.dropdownButton.setTitle(""),!n){let s=d(5834,null);this.addButton.primaryButton.setTitle(s),this.addButton.dropdownButton.setTitle(s)}}else this.addButtonSimple.label=r,this.addButtonSimple.enabled=n,n?this.addButtonSimple.setTitle(""):this.addButtonSimple.setTitle(d(5834,null))}else{let n=`$(${M.sparkle.id}) Generate ${e}`;o?(this.addButton.label=n,this.addButton.enabled=!0,this.addButton.primaryButton.setTitle(""),this.addButton.dropdownButton.setTitle("")):(this.addButtonSimple.label=n,this.addButtonSimple.enabled=!0,this.addButtonSimple.setTitle(""))}}getDropdownActions(){this.dropdownActionDisposables.clear();let e=this.getTypeLabel(),t=[],o=xKt(this.currentSection);return o==="hook"?(this.workspaceService.isSessionsWindow||this.hasActiveWorkspace()&&t.push(this.dropdownActionDisposables.add(new st("configureHooks",`$(${M.add.id}) Configure Hooks`,void 0,!0,()=>{this._onDidRequestCreateManual.fire({type:o,target:"workspace"})}))),t):(this.workspaceService.isSessionsWindow?t.push(this.dropdownActionDisposables.add(new st("createUser",`$(${M.account.id}) New ${e} (User)`,void 0,!0,()=>{this._onDidRequestCreateManual.fire({type:o,target:"user"})}))):(this.hasActiveWorkspace()&&t.push(this.dropdownActionDisposables.add(new st("createWorkspace",`$(${M.folder.id}) New ${e} (Workspace)`,void 0,!0,()=>{this._onDidRequestCreateManual.fire({type:o,target:"workspace"})}))),t.push(this.dropdownActionDisposables.add(new st("createUser",`$(${M.account.id}) New ${e} (User)`,void 0,!0,()=>{this._onDidRequestCreateManual.fire({type:o,target:"user"})})))),t)}hasActiveWorkspace(){return!!this.workspaceService.getActiveProjectRoot()}executePrimaryCreateAction(){let e=xKt(this.currentSection);if(this.workspaceService.isSessionsWindow){if(!this.hasActiveWorkspace())return;this._onDidRequestCreateManual.fire({type:e,target:"workspace"})}else this._onDidRequestCreate.fire(e)}getTypeLabel(){switch(this.currentSection){case kn.Agents:return d(5827,null);case kn.Skills:return d(5867,null);case kn.Instructions:return d(5847,null);case kn.Hooks:return d(5844,null);case kn.Prompts:default:return d(5864,null)}}async refresh(){this.updateAddButton(),await this.loadItems()}async loadItems(){let e=this.currentSection,t=xKt(e),o=[];if(t==="agent"){let s=await this.promptsService.getCustomAgents(ve.None);for(let l of s){let c=Ye(l.uri);o.push({id:l.uri.toString(),uri:l.uri,name:l.name,filename:c,description:l.description,storage:l.source.storage,promptType:t})}}else if(t==="skill"){let s=await this.promptsService.findAgentSkills(ve.None);for(let l of s||[]){let c=Ye(l.uri),u=l.name||Ye(ci(l.uri))||c;o.push({id:l.uri.toString(),uri:l.uri,name:u,filename:c,description:l.description,storage:l.storage,promptType:t})}}else if(t==="prompt"){let s=await this.promptsService.getPromptSlashCommands(ve.None);for(let l of s){if(l.promptPath.type==="skill")continue;let c=Ye(l.promptPath.uri);o.push({id:l.promptPath.uri.toString(),uri:l.promptPath.uri,name:l.name,filename:c,description:l.description,storage:l.promptPath.storage,promptType:t})}}else if(t==="hook"){let s=await this.promptsService.listPromptFiles("hook",ve.None),l=this.workspaceService.getActiveProjectRoot(),c=await this.pathService.userHome(),u=c.scheme===Y.file?c.fsPath:c.path;for(let h of s){let g=!1;try{let f=await this.fileService.readFile(h.uri),v=Ur(f.value.toString()),{hooks:b}=r8(h.uri,v,l,u);if(b.size>0){g=!0;for(let[S,y]of b){let w=CC[S];for(let k=0;k<y.hooks.length;k++){let T=y.hooks[k],N=p5(T,zo),O=N.length>60?N.substring(0,57)+"...":N;o.push({id:`${h.uri.toString()}#${y.originalId}[${k}]`,uri:h.uri,name:w?.label??y.originalId,filename:Ye(h.uri),description:O||d(5846,null),storage:h.storage,promptType:t})}}}}catch{}if(!g){let f=Ye(h.uri);o.push({id:h.uri.toString(),uri:h.uri,name:this.getFriendlyName(f),filename:f,storage:h.storage,promptType:t})}}let p=this.workspaceService.isSessionsWindow?[]:await this.promptsService.getCustomAgents(ve.None);for(let h of p)if(h.hooks)for(let g of Object.values(TP)){let f=h.hooks[g];if(!f||f.length===0)continue;let v=CC[g];for(let b=0;b<f.length;b++){let S=f[b],y=p5(S,zo),w=y.length>60?y.substring(0,57)+"...":y;o.push({id:`${h.uri.toString()}#hook:${g}[${b}]`,uri:h.uri,name:v?.label??g,filename:Ye(h.uri),description:`${h.name}: ${w||d(5846,null)}`,storage:h.source.storage,groupKey:"agents",promptType:t})}}}else{let l=[...await this.promptsService.listPromptFiles(t,ve.None)];if(t==="instructions"){let f=await this.promptsService.listAgentInstructions(ve.None,void 0),v=this.workspaceContextService.getWorkspace().folders.map(S=>S.uri),b=this.workspaceService.getActiveProjectRoot();b&&v.push(b);for(let S of f){let y=v.some(w=>La(S.uri,w));l.push({uri:S.uri,storage:y?"local":"user",type:"instructions",name:Ye(S.uri)})}}let c=l.filter(f=>f.storage==="local"),u=l.filter(f=>f.storage==="user"),p=l.filter(f=>f.storage==="extension"),h=l.filter(f=>f.storage==="plugin"),g=f=>{let v=Ye(f.uri),b=f.name||this.getFriendlyName(v);return{id:f.uri.toString(),uri:f.uri,name:b,filename:v,description:f.description,storage:f.storage,promptType:t}};o.push(...c.map(g)),o.push(...u.map(g)),o.push(...p.map(g)),o.push(...h.map(g))}let n=this.workspaceService.getStorageSourceFilter(t),r=qB(o,n);o.length=0,o.push(...r),o.sort((s,l)=>s.name.localeCompare(l.name)),this.currentSection===e&&(this.allItems=o,this.filterItems(),this._onDidChangeItemCount.fire(o.length))}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(s=>({...s,nameMatches:void 0,descriptionMatches:void 0}));else{let s=this.searchQuery.toLowerCase();e=[];for(let l of this.allItems){let c=SW(s,l.name),u=l.description?SW(s,l.description):null,p=SW(s,l.filename);(c||u||p)&&e.push({...l,nameMatches:c||void 0,descriptionMatches:u||void 0})}}let t=xKt(this.currentSection),o=new Set(this.workspaceService.getStorageSourceFilter(t).sources),n=[{groupKey:"local",label:d(5872,null),icon:xFe,description:d(5873,null),items:[]},{groupKey:"user",label:d(5870,null),icon:kFe,description:d(5871,null),items:[]},{groupKey:"extension",label:d(5841,null),icon:EFe,description:d(5842,null),items:[]},{groupKey:"plugin",label:d(5862,null),icon:I0,description:d(5863,null),items:[]},{groupKey:"agents",label:d(5829,null),icon:G2,description:d(5830,null),items:[]}].filter(s=>o.has(s.groupKey)||s.groupKey==="agents");for(let s of e){let l=s.groupKey??s.storage,c=n.find(u=>u.groupKey===l);c&&c.items.push(s)}for(let s of n)s.items.sort((l,c)=>l.name.localeCompare(c.name));this.displayEntries=[];let r=!0;for(let s of n){if(s.items.length===0)continue;let l=this.collapsedGroups.has(s.groupKey);if(this.displayEntries.push({type:"group-header",id:`group-${s.groupKey}`,groupKey:s.groupKey,label:s.label,icon:s.icon,count:s.items.length,isFirst:r,description:s.description,collapsed:l}),r=!1,!l)for(let c of s.items)this.displayEntries.push({type:"file-item",item:c})}this.list.splice(0,this.list.length,this.displayEntries),this.updateEmptyState()}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(5859,null,this.searchQuery),this.emptyStateSubtext.textContent=d(5869,null);else{let o=this.getEmptyStateInfo();this.emptyStateText.textContent=o.title,this.emptyStateSubtext.textContent=o.description}}}getSectionIcon(){switch(this.currentSection){case kn.Agents:return G2;case kn.Skills:return S8;case kn.Instructions:return I8;case kn.Hooks:return CFe;case kn.Prompts:default:return y8}}getEmptyStateInfo(){switch(this.currentSection){case kn.Agents:return{title:d(5856,null),description:d(5835,null)};case kn.Skills:return{title:d(5861,null),description:d(5839,null)};case kn.Instructions:return{title:d(5858,null),description:d(5837,null)};case kn.Hooks:return{title:d(5857,null),description:d(5836,null)};case kn.Prompts:default:return{title:d(5860,null),description:d(5838,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])}layout(e,t){let o=this.sectionHeader.offsetHeight||0,n=this.searchAndButtonContainer.offsetHeight||52,r=e-o-n;this.searchInput.layout(),this.listContainer.style.height=`${Math.max(0,r)}px`,this.list.layout(Math.max(0,r),t),o===0&&Me(this.listContainer).requestAnimationFrame(()=>{if(this._store.isDisposed)return;let s=this.sectionHeader.offsetHeight;if(s>0){let l=e-s-n;this.listContainer.style.height=`${Math.max(0,l)}px`,this.list.layout(Math.max(0,l),t)}})}get itemCount(){return this.allItems.length}async generateDebugReport(){return gbo(this.currentSection,this.promptsService,this.workspaceService,{allItems:this.allItems,displayEntries:this.displayEntries})}};TFe=I([m(0,F),m(1,nr),m(2,_n),m(3,Qe),m(4,ze),m(5,qt),m(6,X),m(7,Pe),m(8,ot),m(9,lf),m(10,Wi),m(11,tt),m(12,be),m(13,wn)],TFe);var Rb=class a extends st{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()}},Kot=class extends Rb{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(H.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 li]);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.enabled=this.primaryAction.enabled,this.label=this.getLabel(this.primaryAction),this.tooltip=this.primaryAction.tooltip):this.enabled=!1}async run(){this.enabled&&await this.primaryAction?.run()}getLabel(e){return e.label}},kKt=class extends jye{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)}}},w8=class extends Rb{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(zot,this,e),this._actionViewItem}run(e){return this._actionViewItem?.showMenu(e),Promise.resolve()}};w8=I([m(4,F)],w8);var zot=class extends Lr{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=Yn(this.element),n={x:o.left,y:o.top+o.height+10};this.contextMenuService.showContextMenu({getAnchor:()=>n,getActions:()=>t,actionRunner:this.actionRunner,onHide:()=>jH(t)})}}getActions(e){let t=[];for(let o of e)t=[...t,...o,new li];return t.length?t.slice(0,t.length-1):t}};zot=I([m(2,ze)],zot);var gT=class extends Rb{constructor(e,t,o,n){super("extensions.install",d(11259,null),gT.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=gT.HIDE,!(!this.mcpServer?.gallery&&!this.mcpServer?.installable)&&this.mcpServer.installState===3&&(this.class=gT.CLASS,this.enabled=this.mcpWorkbenchService.canInstall(this.mcpServer)===!0)}async run(){if(!this.mcpServer)return;this.open&&(this.mcpWorkbenchService.open(this.mcpServer),Jo(d(11274,null,this.mcpServer.label))),this.telemetryService.publicLog2("mcp:action:install",{name:this.mcpServer.gallery?.name});let e=await this.mcpWorkbenchService.install(this.mcpServer);await DHt(this.mcpService,t=>t.definition.label===e.name)}};gT=I([m(1,Nf),m(2,Te),m(3,es)],gT);var $2=class extends Rb{constructor(e,t,o,n,r,s){super("extensions.installWorkspace",d(11264,null),gT.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=$2.HIDE,this.workspaceService.getWorkbenchState()!==1&&(!this.mcpServer?.gallery&&!this.mcpServer?.installable||this.mcpServer.installState!==3&&this.mcpServer.local?.scope==="workspace"||(this.class=gT.CLASS,this.enabled=this.mcpWorkbenchService.canInstall(this.mcpServer)===!0))}async run(){if(!this.mcpServer)return;this.open&&(this.mcpWorkbenchService.open(this.mcpServer,{preserveFocus:!0}),Jo(d(11274,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 DHt(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(11260,null)});return this.workspaceService.getWorkbenchState()===3&&(e.length>0&&e.push({type:"separator"}),e.push({target:5,label:d(11273,null)})),e.length===1?e[0].target:(await this.quickInputService.pick(e,{title:d(11272,null)}))?.target}};$2=I([m(1,Nf),m(2,Pe),m(3,Ge),m(4,Te),m(5,es)],$2);var q2=class extends Rb{constructor(e,t,o,n,r,s){super("extensions.installRemote",d(11262,null),gT.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(Y.vscodeRemote,this.environmentService.remoteAuthority);this.label=d(11263,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=q2.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=gT.CLASS,this.enabled=this.mcpWorkbenchService.canInstall(this.mcpServer)===!0))}async run(){if(!this.mcpServer)return;this.open&&(this.mcpWorkbenchService.open(this.mcpServer),Jo(d(11274,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 DHt(this.mcpService,t=>t.definition.label===e.name)}};q2=I([m(1,Nf),m(2,Vt),m(3,Te),m(4,ot),m(5,es)],q2);var _Fe=class a extends Rb{static{this.LABEL=d(11261,null)}static{this.CLASS=`${Rb.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"}`}},y0=class extends Rb{constructor(e){super("extensions.uninstall",d(11279,null),y0.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=y0.HIDE,!!this.mcpServer&&this.mcpServer.local){if(this.mcpServer.installState!==1){this.enabled=!1;return}this.class=y0.CLASS,this.enabled=!0,this.label=d(11279,null)}}async run(){this.mcpServer&&await this.mcpWorkbenchService.uninstall(this.mcpServer)}};y0=I([m(0,Nf)],y0);function Got(a,i,e){return e.invokeFunction(t=>{let o=t.get(Pe),n=t.get(Vt),r=[];if(a.installState===1){if(r.push([e.createInstance(C8)]),r.push([e.createInstance(x8),e.createInstance(j2)]),r.push([e.createInstance(jB)]),r.push([e.createInstance(k8),e.createInstance(Q2),e.createInstance(aie)]),r.push([e.createInstance(E8),e.createInstance(T8)]),r.push([e.createInstance(_8)]),!i){let l=[e.createInstance(y0)];o.getWorkbenchState()!==1&&l.push(e.createInstance($2,!1)),n.remoteAuthority&&a.local?.scope!=="remoteUser"&&l.push(e.createInstance(q2,!1)),r.push(l)}}else{let l=[];o.getWorkbenchState()!==1&&l.push(e.createInstance($2,!i)),n.remoteAuthority&&l.push(e.createInstance(q2,!i)),r.push(l)}return r.forEach(l=>l.forEach(c=>c.mcpServer=a)),r})}var eM=class extends w8{constructor(e,t){super(eM.ID,"","",!0,t);this.isEditorAction=e;this.tooltip=d(11265,null),this.update()}static{this.ID="mcpServer.manage"}static{this.Class=`${Rb.ICON_ACTION_CLASS} manage `+q.asClassName(_pe)}static{this.HideManageExtensionClass=`${this.Class} hide`}async run(){return super.run(this.mcpServer?Got(this.mcpServer,this.isEditorAction,this.instantiationService):[])}update(){this.class=eM.HideManageExtensionClass,this.enabled=!1,this.mcpServer&&(this.isEditorAction?(this.enabled=!0,this.class=eM.Class):(this.enabled=!!this.mcpServer.local,this.class=this.enabled?eM.Class:eM.HideManageExtensionClass))}};eM=I([m(1,F)],eM);var C8=class extends Rb{constructor(e){super("extensions.start",d(11277,null),C8.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=C8.HIDE;let e=this.getServer();if(!e)return;let t=e.connectionState.get();ir.canBeStarted(t.state)&&(this.class=C8.CLASS,this.enabled=!0,this.label=d(11277,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)}};C8=I([m(0,es)],C8);var x8=class extends Rb{constructor(e){super("extensions.stop",d(11278,null),x8.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=x8.HIDE;let e=this.getServer();if(!e)return;let t=e.connectionState.get();ir.canBeStarted(t.state)||(this.class=x8.CLASS,this.enabled=!0,this.label=d(11278,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)}};x8=I([m(0,es)],x8);var j2=class extends Rb{constructor(e){super("extensions.restart",d(11276,null),j2.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=j2.HIDE;let e=this.getServer();if(!e)return;let t=e.connectionState.get();ir.canBeStarted(t.state)||(this.class=j2.CLASS,this.enabled=!0,this.label=d(11276,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)}};j2=I([m(0,es)],j2);var jB=class extends Rb{constructor(e,t,o){super("extensions.restart",d(11276,null),j2.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(11271,null)}static{this.DISCONNECT=d(11267,null)}update(){if(this.enabled=!1,this.class=jB.HIDE,!this.getServer())return;let t=this.getAccountQuery();if(!t)return;this._accountQuery=t,this.class=jB.CLASS,this.enabled=!0;let o=t.entities().getEntityCount().total>1?jB.DISCONNECT:jB.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===jB.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}}};jB=I([m(0,es),m(1,RR),m(2,Cs)],jB);var k8=class extends Rb{constructor(e){super("extensions.output",d(11275,null),k8.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=k8.HIDE,this.getServer()&&(this.class=k8.CLASS,this.enabled=!0,this.label=d(11275,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)}};k8=I([m(0,es)],k8);var Q2=class extends Rb{constructor(e){super("extensions.config",d(11257,null),Q2.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=Q2.HIDE,this.mcpServer?.local&&(this.class=Q2.CLASS,this.enabled=!0)}async run(){this.mcpServer?.local&&this.mcpWorkbenchService.open(this.mcpServer,{tab:"configuration"})}};Q2=I([m(0,Nf)],Q2);var aie=class extends Rb{constructor(e,t,o){super("extensions.jsonConfig",d(11258,null),aie.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=aie.HIDE,this.getConfigurationTarget()&&(this.class=Q2.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}};aie=I([m(0,es),m(1,md),m(2,ee)],aie);var E8=class extends Rb{constructor(e,t){super("extensions.config",d(11266,null),E8.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=E8.HIDE,this.getServer()&&(this.class=E8.CLASS,this.enabled=!0,this.label=d(11266,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)}};E8=I([m(0,es),m(1,ge)],E8);var T8=class extends Rb{constructor(e,t,o){super("extensions.config",d(11269,null),T8.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=T8.HIDE;let e=this.getServer();e&&this.samplingService.hasLogs(e)&&(this.class=T8.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(11270,null,e.definition.label)})}getServer(){if(this.mcpServer&&this.mcpServer.local)return this.mcpService.servers.get().find(e=>e.definition.id===this.mcpServer?.id)}};T8=I([m(0,es),m(1,h5),m(2,ee)],T8);var _8=class extends Rb{constructor(e,t){super("extensions.config",d(11268,null),_8.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=_8.HIDE;let e=this.getServer();if(!e)return;let t=e.capabilities.get();t!==void 0&&!(t&16)||(this.class=_8.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)}};_8=I([m(0,es),m(1,ge)],_8);var _D=class extends Rb{constructor(e,t){super("extensions.status","",`${_D.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=`${Rb.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:_u,message:t},!0);return}}let e=this.mcpServer.runtimeStatus;e?.message&&this.updateStatus({icon:e.message.severity===gt.Warning?_u:e.message.severity===gt.Error?gS:kg,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===NR?-1:o.icon===NR?1:n.icon===gS?-1:o.icon===gS?1:n.icon===_u?-1:o.icon===_u?1:n.icon===kg?-1:o.icon===kg?1:0)),t&&(e?.icon===gS?this.class=`${_D.CLASS} extension-status-error ${q.asClassName(gS)}`:e?.icon===_u?this.class=`${_D.CLASS} extension-status-warning ${q.asClassName(_u)}`:e?.icon===kg?this.class=`${_D.CLASS} extension-status-info ${q.asClassName(kg)}`:e?.icon===NR?this.class=`${_D.CLASS} ${q.asClassName(NR)}`:this.class=`${_D.CLASS} hide`),this._onDidChangeStatus.fire()}async run(){if(this._status[0]?.icon===NR)return this.commandService.executeCommand("workbench.trust.manage")}};_D=I([m(0,Nf),m(1,ge)],_D);var Dp=_,Ntn=36,Otn=36,Ftn=40,GDi=class{getHeight(i){return i.type==="group-header"?i.isFirst?Otn:Ftn:Ntn}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"}},$Di=class{constructor(i){this.hoverService=i;this.templateId="mcpGroupHeader"}renderTemplate(i){let e=new P,t=new P;i.classList.add("ai-customization-group-header");let o=R(i,Dp(".group-chevron")),n=R(i,Dp(".group-icon")),r=R(i,Dp(".group-label-group")),s=R(r,Dp(".group-label")),l=R(r,Dp(".group-info"));l.classList.add(...q.asClassNameArray(M.info));let c=R(i,Dp(".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?M.chevronRight:M.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()}},$ot=class{constructor(i,e){this.mcpService=i;this.workspaceService=e;this.templateId="mcpServerItem"}renderTemplate(i){i.classList.add("mcp-server-item");let e=R(i,Dp(".mcp-server-details")),t=R(e,Dp(".mcp-server-name")),o=R(e,Dp(".mcp-server-description")),n=R(i,Dp(".mcp-server-status"));return{container:i,name:t,description:o,status:n,disposables:new P}}renderElement(i,e,t){if(t.disposables.clear(),i.type==="builtin-item"){t.container.classList.add("builtin"),t.name.textContent=i.label,i.description?(t.description.textContent=i.description,t.description.style.display=""):t.description.style.display="none",t.status.style.display="none";return}t.container.classList.remove("builtin"),t.name.textContent=i.server.label,i.server.description?(t.description.textContent=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(he(n=>{let r=o?.connectionState.read(n);this.updateStatus(t.status,r?.state)}))}updateStatus(i,e){if(i.className="mcp-server-status",this.workspaceService.isSessionsWindow){i.style.display="none";return}switch(i.style.display="",e){case ir.Kind.Running:i.textContent=d(5942,null),i.classList.add("running");break;case ir.Kind.Starting:i.textContent=d(5945,null),i.classList.add("starting");break;case ir.Kind.Error:i.textContent=d(5928,null),i.classList.add("error");break;case ir.Kind.Stopped:default:i.textContent=d(5946,null),i.classList.add("stopped");break}}disposeTemplate(i){i.disposables.dispose()}};$ot=I([m(0,es),m(1,lf)],$ot);var qDi=class{constructor(i){this.mcpWorkbenchService=i;this.templateId="mcpGalleryItem"}renderTemplate(i){i.classList.add("mcp-server-item","mcp-gallery-item");let e=R(i,Dp(".mcp-server-details")),t=R(e,Dp(".mcp-gallery-name-row")),o=R(t,Dp(".mcp-server-name")),n=R(t,Dp(".mcp-gallery-publisher")),r=R(e,Dp(".mcp-server-description")),s=R(i,Dp(".mcp-gallery-action")),l=new Mi(s,{...Ko,supportIcons:!0});l.element.classList.add("mcp-gallery-install-button");let c=new P;return c.add(l),{container:i,name:o,publisher:n,description:r,installButton:l,elementDisposables:new P,templateDisposables:c}}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(5933,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(5932,null),i.enabled=!1;break;case 0:i.label=d(5933,null),i.enabled=!1;break;default:i.label=d(5931,null),i.enabled=!0;break}}disposeTemplate(i){i.elementDisposables.dispose(),i.templateDisposables.dispose()}},DFe=class extends C{constructor(e,t,o,n,r,s,l,c){super();this.instantiationService=e;this.mcpWorkbenchService=t;this.mcpService=o;this.commandService=n;this.openerService=r;this.contextViewService=s;this.contextMenuService=l;this.hoverService=c;this._onDidSelectServer=this._register(new E);this.onDidSelectServer=this._onDidSelectServer.event;this.filteredServers=[];this.displayEntries=[];this.galleryServers=[];this.searchQuery="";this.browseMode=!1;this.collapsedGroups=new Set;this.delayedFilter=new jo(200);this.delayedGallerySearch=new jo(400);this.element=Dp(".mcp-list-widget"),this.create(),this._register({dispose:()=>{this.galleryCts?.dispose()}})}create(){this.searchAndButtonContainer=R(this.element,Dp(".list-search-and-button-container"));let e=R(this.searchAndButtonContainer,Dp(".list-search-container"));this.searchInput=this._register(new Dc(e,this.contextViewService,{placeholder:d(5944,null),inputBoxStyles:pl})),this._register(this.searchInput.onDidChange(()=>{this.searchQuery=this.searchInput.value,this.browseMode?this.delayedGallerySearch.trigger(()=>this.queryGallery()):this.delayedFilter.trigger(()=>this.filterServers())}));let t=R(this.searchAndButtonContainer,Dp(".list-button-group")),o=R(t,Dp(".list-add-button-container"));this.browseButton=this._register(new Mi(o,{...Ko,secondary:!0,supportIcons:!0})),this.browseButton.label=`$(${M.library.id}) ${d(5923,null)}`,this.browseButton.element.classList.add("list-add-button"),this._register(this.browseButton.onDidClick(()=>{this.toggleBrowseMode(!this.browseMode)}));let n=R(t,Dp(".list-add-button-container"));this.addButton=this._register(new Mi(n,{...Ko,supportIcons:!0})),this.addButton.label=`$(${M.add.id}) ${d(5920,null)}`,this.addButton.element.classList.add("list-add-button"),this._register(this.addButton.onDidClick(()=>{this.commandService.executeCommand("workbench.mcp.addConfiguration")})),this.backLink=R(this.element,Dp(".mcp-back-link")),this.backLink.setAttribute("role","button"),this.backLink.tabIndex=0,this.backLink.setAttribute("aria-label",d(5922,null)),R(this.backLink,Dp("span")).classList.add(...q.asClassNameArray(M.arrowLeft));let s=R(this.backLink,Dp("span"));s.textContent=d(5921,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=R(this.element,Dp(".mcp-empty-state")),R(this.emptyContainer,Dp(".empty-icon")).classList.add(...q.asClassNameArray(M.server)),this.emptyText=R(this.emptyContainer,Dp(".empty-text")),this.emptySubtext=R(this.emptyContainer,Dp(".empty-subtext")),this.listContainer=R(this.element,Dp(".mcp-list-container")),this.sectionHeader=R(this.element,Dp(".section-footer")),this.sectionDescription=R(this.sectionHeader,Dp("p.section-footer-description")),this.sectionDescription.textContent=d(5937,null),this.sectionLink=R(this.sectionHeader,Dp("a.section-footer-link")),this.sectionLink.textContent=d(5934,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 GDi,u=new $Di(this.hoverService),p=this.instantiationService.createInstance($ot),h=new qDi(this.mcpWorkbenchService);this.list=this._register(this.instantiationService.createInstance(Rl,"McpManagementList",this.listContainer,c,[u,p,h],{multipleSelectionSupport:!1,setRowLineHeight:!1,horizontalScrolling:!1,accessibilityProvider:{getAriaLabel(g){return g.type==="group-header"?d(5936,null,g.label,g.count,g.collapsed?d(5926,null):d(5929,null)):g.type==="builtin-item"?g.label:g.server.label},getWidgetAriaLabel(){return d(5938,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(he(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.parentElement.style.display=e?"none":"",this.browseButton.element.parentElement.style.display=e?"none":"",this.searchInput.setPlaceHolder(e?d(5943,null):d(5944,null)),e?this.queryGallery():(this.galleryCts?.dispose(!0),this.galleryServers=[],this.filterServers())}async queryGallery(){this.galleryCts?.dispose(!0);let e=this.galleryCts=new $e;this.emptyContainer.style.display="flex",this.listContainer.style.display="none",this.emptyText.textContent=d(5935,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(5930,null),this.emptySubtext.textContent=d(5947,null))}}updateGalleryList(){this.galleryServers.length===0?(this.emptyContainer.style.display="flex",this.listContainer.style.display="none",this.searchQuery.trim()?(this.emptyText.textContent=d(5939,null,this.searchQuery),this.emptySubtext.textContent=d(5948,null)):(this.emptyText.textContent=d(5927,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(l=>l.label.toLowerCase().includes(e)||l.description?.toLowerCase().includes(e)):this.filteredServers=[...this.mcpWorkbenchService.local];let t=new Set(this.filteredServers.map(l=>l.id)),o=this.mcpService.servers.get().filter(l=>!t.has(l.definition.id)).filter(l=>!e||l.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(5940,null,this.searchQuery),this.emptySubtext.textContent=d(5948,null)):(this.emptyText.textContent=d(5941,null),this.emptySubtext.textContent=d(5919,null))):(this.emptyContainer.style.display="none",this.listContainer.style.display="");let n=[{scope:"workspace",label:d(5951,null),icon:xFe,description:d(5952,null),servers:[]},{scope:"user",label:d(5949,null),icon:kFe,description:d(5950,null),servers:[]}];for(let l of this.filteredServers)l.local?.scope==="workspace"?n[0].servers.push(l):n[1].servers.push(l);let r=[],s=!0;for(let l of n){if(l.servers.length===0)continue;let c=this.collapsedGroups.has(l.scope);if(r.push({type:"group-header",id:`mcp-group-${l.scope}`,scope:l.scope,label:l.label,icon:l.icon,count:l.servers.length,isFirst:s,description:l.description,collapsed:c}),!c)for(let u of l.servers)r.push({type:"server-item",server:u});s=!1}if(o.length>0){let l=this.collapsedGroups.has("builtin");if(r.push({type:"group-header",id:"mcp-group-builtin",scope:"builtin",label:d(5924,null),icon:EFe,count:o.length,isFirst:s,description:d(5925,null),collapsed:l}),!l)for(let c of o)r.push({type:"builtin-item",id:`builtin-${c.definition.id}`,label:c.definition.label,description:""})}this.displayEntries=r,this.list.splice(0,this.list.length,this.displayEntries)}toggleGroup(e){this.collapsedGroups.has(e.scope)?this.collapsedGroups.delete(e.scope):this.collapsedGroups.add(e.scope),this.filterServers()}layout(e,t){let o=this.sectionHeader.offsetHeight||0,n=this.searchAndButtonContainer.offsetHeight||52,r=this.browseMode?this.backLink.offsetHeight||28:0,s=e-o-n-r;this.listContainer.style.height=`${Math.max(0,s)}px`,this.list.layout(Math.max(0,s),t),o===0&&Me(this.listContainer).requestAnimationFrame(()=>{if(this._store.isDisposed)return;let l=this.sectionHeader.offsetHeight;if(l>0){let c=e-l-n-r;this.listContainer.style.height=`${Math.max(0,c)}px`,this.list.layout(Math.max(0,c),t)}})}focusSearch(){this.searchInput.focus()}focus(){this.list.domFocus(),this.list.length>0&&this.list.setFocus([0])}onContextMenu(e){if(!e.element||e.element.type!=="server-item")return;let t=e.element,o=new P,n=this.mcpWorkbenchService.local.find(l=>l.id===t.server.id)||t.server,r=Got(n,!1,this.instantiationService),s=[];for(let l of r){for(let c of l)s.push(c),Ac(c)&&o.add(c);s.push(new li)}s.length>0&&s[s.length-1]instanceof li&&s.pop(),this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>s,onHide:()=>o.dispose()})}};DFe=I([m(0,F),m(1,Nf),m(2,es),m(3,ge),m(4,Qe),m(5,_n),m(6,ze),m(7,tt)],DFe);var lie=ae("agentPluginRepositoryService");var QB=ae("pluginMarketplaceService"),fbo=[{type:"copilot",path:".github/plugin/marketplace.json"},{type:"claude",path:".claude-plugin/marketplace.json"}],Wtn=480*60*1e3,jDi="chat.plugins.marketplaces.githubCache.v1";function vbo(a){return a.sourceDescriptor?a:{...a,sourceDescriptor:{kind:"relativePath",path:a.source}}}var Vtn=PB({defaultValue:[],key:"chat.plugins.installed.v1",toStorage:a=>JSON.stringify(a),fromStorage:a=>{let i=JSON.parse(a);return Array.isArray(i)?i:[]}}),Btn=PB({defaultValue:[],key:"chat.plugins.trustedMarketplaces.v1",toStorage:a=>JSON.stringify(a),fromStorage:a=>{let i=JSON.parse(a);return Array.isArray(i)?i:[]}}),RFe=class extends C{constructor(e,t,o,n,r,s){super();this._configurationService=e;this._requestService=t;this._fileService=o;this._pluginRepositoryService=n;this._logService=r;this._storageService=s;this._gitHubMarketplaceCache=new co(()=>this._loadPersistedGitHubMarketplaceCache());this._installedPluginsStore=this._register(Vtn(-1,1,s)),this._trustedMarketplacesStore=this._register(Btn(-1,1,s)),this.installedPlugins=this._installedPluginsStore.map(l=>Xn(l).map(c=>({...c,plugin:vbo(c.plugin)}))),this.onDidChangeMarketplaces=H.filter(e.onDidChangeConfiguration,l=>l.affectsConfiguration("chat.plugins.enabled")||l.affectsConfiguration("chat.plugins.marketplaces"))}async fetchMarketplacePlugins(e){if(!this._configurationService.getValue("chat.plugins.enabled"))return[];let t=this._configurationService.getValue("chat.plugins.marketplaces")??[],o=Htn(t);for(let r of t)(typeof r!="string"||!QDi(r))&&this._logService.debug(`[PluginMarketplaceService] Ignoring invalid marketplace entry: ${String(r)}`);return(await Promise.all(o.map(r=>r.kind==="githubShorthand"&&r.githubRepo?this._fetchFromGitHubRepo(r,r.githubRepo,e):this._fetchFromClonedRepo(r,e)))).flat()}async _fetchFromGitHubRepo(e,t,o){let n=this._gitHubMarketplaceCache.value,r=this._getCachedGitHubMarketplacePlugins(n,e.canonicalId);if(r)return r;let s=!0;for(let l of fbo){if(o.isCancellationRequested)return[];let c=`https://raw.githubusercontent.com/${t}/main/${l.path}`;try{let u=await this._requestService.request({type:"GET",url:c},o),p=u.res.statusCode;if(p!==200){s&&=p!==void 0&&p>=400&&p<500,this._logService.debug(`[PluginMarketplaceService] ${c} returned status ${p}, skipping`);continue}let h=await hh(u);if(!h?.plugins||!Array.isArray(h.plugins)){this._logService.debug(`[PluginMarketplaceService] ${c} did not contain a valid plugins array, skipping`);continue}let g=h.plugins.filter(f=>typeof f.name=="string"&&!!f.name).flatMap(f=>{let v=Ibo(f.source,h.metadata?.pluginRoot,{pluginName:f.name,logService:this._logService,logPrefix:"[PluginMarketplaceService]"});if(!v)return[];let b=v.kind==="relativePath"?v.path:"";return[{name:f.name,description:f.description??"",version:f.version??"",source:b,sourceDescriptor:v,marketplace:e.displayLabel,marketplaceReference:e,marketplaceType:l.type,readmeUri:qtn(t,b)}]});return n.set(e.canonicalId,{plugins:g,expiresAt:Date.now()+Wtn,referenceRawValue:e.rawValue}),this._savePersistedGitHubMarketplaceCache(n),g}catch(u){this._logService.debug(`[PluginMarketplaceService] Failed to fetch marketplace.json from ${c}:`,u);continue}}return 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(jDi,-1);if(!o)return e;let n=Xn(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=QDi(s.referenceRawValue);if(!l)continue;let c=s.plugins.map(u=>vbo({...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(jDi,-1);return}this._storageService.store(jDi,JSON.stringify(t),-1,1)}getMarketplacePluginMetadata(e){return this.installedPlugins.get().find(o=>La(e,o.pluginUri))?.plugin}addInstalledPlugin(e,t){let o=this.installedPlugins.get();o.some(n=>Xe(n.pluginUri,e))?this._installedPluginsStore.set([...o],void 0):this._installedPluginsStore.set([...o,{pluginUri:e,plugin:t,enabled:!0}],void 0)}removeInstalledPlugin(e){let t=this.installedPlugins.get();this._installedPluginsStore.set(t.filter(o=>!Xe(o.pluginUri,e)),void 0)}setInstalledPluginEnabled(e,t){let o=this.installedPlugins.get();this._installedPluginsStore.set(o.map(n=>Xe(n.pluginUri,e)?{...n,enabled:t}:n),void 0)}isMarketplaceTrusted(e){return this._trustedMarketplacesStore.get().includes(e.canonicalId)}trustMarketplace(e){let t=this._trustedMarketplacesStore.get();t.includes(e.canonicalId)||this._trustedMarketplacesStore.set([...t,e.canonicalId],void 0)}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),[]}for(let n of fbo){if(t.isCancellationRequested)return[];let r=je(o,n.path),s;try{let l=await this._fileService.readFile(r);s=Ur(l.value.toString())}catch{continue}if(!s?.plugins||!Array.isArray(s.plugins)){this._logService.debug(`[PluginMarketplaceService] ${r.toString()} did not contain a valid plugins array, skipping`);continue}return s.plugins.filter(l=>typeof l.name=="string"&&!!l.name).flatMap(l=>{let c=Ibo(l.source,s.metadata?.pluginRoot,{pluginName:l.name,logService:this._logService,logPrefix:"[PluginMarketplaceService]"});if(!c)return[];let u=c.kind==="relativePath"?c.path:"";return[{name:l.name,description:l.description??"",version:l.version??"",source:u,sourceDescriptor:c,marketplace:e.displayLabel,marketplaceReference:e,marketplaceType:n.type,readmeUri:jtn(o,u)}]})}return this._logService.debug(`[PluginMarketplaceService] No marketplace.json found in ${e.rawValue}`),[]}};RFe=I([m(0,B),m(1,_a),m(2,be),m(3,lie),m(4,ne),m(5,le)],RFe);function Htn(a){let i=new Map;for(let e of a){if(typeof e!="string")continue;let t=QDi(e);t&&(i.has(t.canonicalId)||i.set(t.canonicalId,t))}return[...i.values()]}function QDi(a){let i=a.trim();if(!i)return;let e=Utn(i);if(e)return e;let t=ztn(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:Gtn(n,r),cacheSegments:["github.com",n,r],kind:"githubShorthand",githubRepo:`${n}/${r}`}}}function Utn(a){let i;try{i=A.parse(a)}catch{return}let e=i.scheme.toLowerCase();if(e==="file"&&/^file:\/\//i.test(a)){let r=A.file(i.fsPath);return{rawValue:a,displayLabel:r.fsPath,cloneUrl:a,canonicalId:`file:${r.toString().toLowerCase()}`,cacheSegments:[],kind:"localFileUri",localRepositoryUri:r}}if(e!=="http"&&e!=="https"&&e!=="ssh"||!i.authority)return;let t=Ktn(i.path);if(!t)return;let o=TKt(i.authority.toLowerCase()),n=t.slice(1,-4).split("/").map(TKt);return{rawValue:a,displayLabel:a,cloneUrl:a,canonicalId:`git:${i.authority.toLowerCase()}/${t.slice(1).toLowerCase()}`,cacheSegments:[o,...n],kind:"gitUri"}}function ztn(a){let i=/^([^@\s]+)@([^:\s]+):(.+\.git)$/i.exec(a);if(!i)return;let e=i[2],t=i[3].replace(/^\/+/,"");if(!t.toLowerCase().endsWith(".git"))return;let o=t.slice(0,-4).split("/").map(TKt);return{rawValue:a,displayLabel:a,cloneUrl:a,canonicalId:`git:${e.toLowerCase()}/${t.toLowerCase()}`,cacheSegments:[TKt(e.toLowerCase()),...o],kind:"gitUri"}}function Ktn(a){let i=a.replace(/\/+/g,"/").replace(/\/+$/g,"");if(!i.toLowerCase().endsWith(".git"))return;let e=i.startsWith("/")?i:`/${i}`,t=e.slice(1,-4);if(!(!t||!t.includes("/")))return e}function Gtn(a,i){return`github:${a.toLowerCase()}/${i.toLowerCase()}`}function TKt(a){return a.replace(/[\\/:*?"<>|]/g,"_")}function bbo(a){let i=a.trim().replace(/\\/g,"/");return i=i.replace(/^\.?\/+/,"").replace(/\/+$/g,""),i}function Sbo(a,i){let e=a?bbo(a):"",t=bbo(i),o=A.file("/"),n=e?_re(je(o,e)):o;if(!t)return e||void 0;if(e&&(t===e||t.startsWith(`${e}/`)))return t;let r=_re(je(n,t));return Fc(o,r)??void 0}function Ibo(a,i,e){if(a==null){let t=Sbo(i,"");return t===void 0?void 0:{kind:"relativePath",path:t}}if(typeof a=="string"){let t=Sbo(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(!$tn(a.repo)){e.logService.warn(`${e.logPrefix} Skipping plugin '${e.pluginName}': github source repo must be in 'owner/repo' format`);return}if(!LFe(a.ref)){e.logService.warn(`${e.logPrefix} Skipping plugin '${e.pluginName}': github source 'ref' must be a string when provided`);return}if(!ybo(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}return{kind:"github",repo:a.repo,ref:a.ref,sha:a.sha}}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(!LFe(a.ref)){e.logService.warn(`${e.logPrefix} Skipping plugin '${e.pluginName}': url source 'ref' must be a string when provided`);return}if(!ybo(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(!LFe(a.version)||!LFe(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(!LFe(a.version)||!LFe(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 LFe(a){return a===void 0||typeof a=="string"}function ybo(a){return a===void 0||typeof a=="string"&&/^[0-9a-fA-F]{40}$/.test(a)}function $tn(a){return/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(a)}function qtn(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 jtn(a,i){let e=i.trim().replace(/^\.?\/+|\/+$/g,"");return e?je(a,e,"README.md"):je(a,"README.md")}var Y2=ae("pluginInstallService");var nm=_,Qtn=36,Ytn=36,Xtn=40,YDi=class{getHeight(i){return i.type==="group-header"?i.isFirst?Ytn:Xtn:Qtn}getTemplateId(i){return i.type==="group-header"?"pluginGroupHeader":i.type==="marketplace-item"?"pluginMarketplaceItem":"pluginInstalledItem"}},XDi=class{constructor(i){this.hoverService=i;this.templateId="pluginGroupHeader"}renderTemplate(i){let e=new P,t=new P;i.classList.add("ai-customization-group-header");let o=R(i,nm(".group-chevron")),n=R(i,nm(".group-icon")),r=R(i,nm(".group-label-group")),s=R(r,nm(".group-label")),l=R(r,nm(".group-info"));l.classList.add(...q.asClassNameArray(M.info));let c=R(i,nm(".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?M.chevronRight:M.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()}},JDi=class{constructor(){this.templateId="pluginInstalledItem"}renderTemplate(i){i.classList.add("mcp-server-item");let e=R(i,nm(".mcp-server-details")),t=R(e,nm(".mcp-server-name")),o=R(e,nm(".mcp-server-description")),n=R(i,nm(".mcp-server-status"));return{container:i,name:t,description:o,status:n,disposables:new P}}renderElement(i,e,t){t.disposables.clear(),t.name.textContent=i.item.name,i.item.description?(t.description.textContent=i.item.description,t.description.style.display=""):t.description.style.display="none",t.disposables.add(he(o=>{let n=i.item.plugin.enabled.read(o);t.status.className="mcp-server-status",n?(t.status.textContent=d(5965,null),t.status.classList.add("running")):(t.status.textContent=d(5960,null),t.status.classList.add("stopped"))}))}disposeTemplate(i){i.disposables.dispose()}},ZDi=class{constructor(i){this.pluginInstallService=i;this.templateId="pluginMarketplaceItem"}renderTemplate(i){i.classList.add("mcp-server-item","mcp-gallery-item");let e=R(i,nm(".mcp-server-details")),t=R(e,nm(".mcp-gallery-name-row")),o=R(t,nm(".mcp-server-name")),n=R(t,nm(".mcp-gallery-publisher")),r=R(e,nm(".mcp-server-description")),s=R(i,nm(".mcp-gallery-action")),l=new Mi(s,{...Ko,supportIcons:!0});l.element.classList.add("mcp-gallery-install-button");let c=new P;return c.add(l),{container:i,name:o,publisher:n,description:r,installButton:l,elementDisposables:new P,templateDisposables:c}}renderElement(i,e,t){t.elementDisposables.clear(),t.name.textContent=i.item.name,t.publisher.textContent=i.item.marketplace?d(5957,null,i.item.marketplace):"",t.description.textContent=i.item.description||"",t.installButton.label=d(5969,null),t.installButton.enabled=!0,t.elementDisposables.add(t.installButton.onDidClick(async()=>{t.installButton.label=d(5971,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(5970,null)}catch{t.installButton.label=d(5969,null),t.installButton.enabled=!0}}))}disposeTemplate(i){i.elementDisposables.dispose(),i.templateDisposables.dispose()}};function Jtn(a,i){let e=[];return a.enabled.get()?e.push([i.createInstance(jot,a)]):e.push([i.createInstance(qot,a)]),e.push([i.createInstance(Qot,a)]),a.fromMarketplace&&e.push([new eLi(a)]),e}var qot=class extends st{constructor(e,t){super("pluginListWidget.enable",d(5964,null));this.plugin=e;this.agentPluginService=t}async run(){this.agentPluginService.setPluginEnabled(this.plugin.uri,!0)}};qot=I([m(1,Db)],qot);var jot=class extends st{constructor(e,t){super("pluginListWidget.disable",d(5959,null));this.plugin=e;this.agentPluginService=t}async run(){this.agentPluginService.setPluginEnabled(this.plugin.uri,!1)}};jot=I([m(1,Db)],jot);var Qot=class extends st{constructor(e,t,o){super("pluginListWidget.openFolder",d(5978,null));this.plugin=e;this.commandService=t;this.openerService=o}async run(){try{await this.commandService.executeCommand("revealFileInOS",this.plugin.uri)}catch{await this.openerService.open(ci(this.plugin.uri))}}};Qot=I([m(1,ge),m(2,Qe)],Qot);var eLi=class extends st{constructor(e){super("pluginListWidget.uninstall",d(5986,null));this.plugin=e}async run(){this.plugin.remove()}};function Ztn(a,i){let e=a.label??Ye(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 ein(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 MFe=class extends C{constructor(e,t,o,n,r,s,l,c,u){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._onDidSelectPlugin=this._register(new E);this.onDidSelectPlugin=this._onDidSelectPlugin.event;this.installedItems=[];this.displayEntries=[];this.marketplaceItems=[];this.searchQuery="";this.browseMode=!1;this.collapsedGroups=new Set;this.delayedFilter=new jo(200);this.delayedMarketplaceSearch=new jo(400);this.element=nm(".mcp-list-widget"),this.create(),this._register({dispose:()=>{this.marketplaceCts?.dispose()}})}create(){this.searchAndButtonContainer=R(this.element,nm(".list-search-and-button-container"));let e=R(this.searchAndButtonContainer,nm(".list-search-container"));this.searchInput=this._register(new Dc(e,this.contextViewService,{placeholder:d(5983,null),inputBoxStyles:pl})),this._register(this.searchInput.onDidChange(()=>{this.searchQuery=this.searchInput.value,this.browseMode?this.delayedMarketplaceSearch.trigger(()=>this.queryMarketplace()):this.delayedFilter.trigger(()=>this.filterPlugins())}));let t=R(this.searchAndButtonContainer,nm(".list-button-group")),o=R(t,nm(".list-add-button-container"));this.browseButton=this._register(new Mi(o,{...Ko,secondary:!0,supportIcons:!0})),this.browseButton.label=`$(${M.library.id}) ${d(5955,null)}`,this.browseButton.element.classList.add("list-add-button"),this._register(this.browseButton.onDidClick(()=>{this.toggleBrowseMode(!this.browseMode)})),this.backLink=R(this.element,nm(".mcp-back-link")),this.backLink.setAttribute("role","button"),this.backLink.tabIndex=0,this.backLink.setAttribute("aria-label",d(5954,null)),R(this.backLink,nm("span")).classList.add(...q.asClassNameArray(M.arrowLeft));let r=R(this.backLink,nm("span"));r.textContent=d(5953,null),this._register(j(this.backLink,"click",()=>{this.toggleBrowseMode(!1)})),this._register(j(this.backLink,"keydown",h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),this.toggleBrowseMode(!1))})),this.backLink.style.display="none",this.emptyContainer=R(this.element,nm(".mcp-empty-state")),R(this.emptyContainer,nm(".empty-icon")).classList.add(...q.asClassNameArray(I0)),this.emptyText=R(this.emptyContainer,nm(".empty-text")),this.emptySubtext=R(this.emptyContainer,nm(".empty-subtext")),this.listContainer=R(this.element,nm(".mcp-list-container")),this.sectionHeader=R(this.element,nm(".section-footer")),this.sectionDescription=R(this.sectionHeader,nm("p.section-footer-description")),this.sectionDescription.textContent=d(5980,null),this.sectionLink=R(this.sectionHeader,nm("a.section-footer-link")),this.sectionLink.textContent=d(5972,null),this.sectionLink.href="https://code.visualstudio.com/docs/copilot/chat/agent-plugins",this._register(j(this.sectionLink,"click",h=>{h.preventDefault();let g=this.sectionLink.href;g&&this.openerService.open(A.parse(g))}));let l=new YDi,c=new XDi(this.hoverService),u=new JDi,p=new ZDi(this.pluginInstallService);this.list=this._register(this.instantiationService.createInstance(Rl,"PluginManagementList",this.listContainer,l,[c,u,p],{multipleSelectionSupport:!1,setRowLineHeight:!1,horizontalScrolling:!1,accessibilityProvider:{getAriaLabel(h){return h.type==="group-header"?d(5979,null,h.label,h.count,h.collapsed?d(5958,null):d(5968,null)):(h.type==="marketplace-item",h.item.name)},getWidgetAriaLabel(){return d(5981,null)}},openOnSingleClick:!0,identityProvider:{getId(h){return h.type==="group-header"?h.id:h.type==="marketplace-item"?`marketplace-${h.item.marketplaceReference.canonicalId}/${h.item.source}`:h.item.plugin.uri.toString()}}})),this._register(this.list.onDidOpen(h=>{h.element&&(h.element.type==="group-header"?this.toggleGroup(h.element):h.element.type==="plugin-item"?this._onDidSelectPlugin.fire(h.element.item):h.element.type==="marketplace-item"&&this._onDidSelectPlugin.fire(h.element.item))})),this._register(this.list.onContextMenu(h=>this.onContextMenu(h))),this._register(he(h=>{this.agentPluginService.allPlugins.read(h),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(5982,null):d(5983,null)),e?this.queryMarketplace():(this.marketplaceCts?.dispose(!0),this.marketplaceItems=[],this.filterPlugins())}async queryMarketplace(){this.marketplaceCts?.dispose(!0);let e=this.marketplaceCts=new $e;this.emptyContainer.style.display="flex",this.listContainer.style.display="none",this.emptyText.textContent=d(5973,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.allPlugins.get().map(s=>s.uri.toString()));this.marketplaceItems=n.filter(s=>{let l=this.pluginInstallService.getPluginInstallUri(s);return!r.has(l.toString())}).map(ein),this.updateMarketplaceList()}catch{e.token.isCancellationRequested||(this.marketplaceItems=[],this.emptyContainer.style.display="flex",this.listContainer.style.display="none",this.emptyText.textContent=d(5974,null),this.emptySubtext.textContent=d(5984,null))}}updateMarketplaceList(){this.marketplaceItems.length===0?(this.emptyContainer.style.display="flex",this.listContainer.style.display="none",this.searchQuery.trim()?(this.emptyText.textContent=d(5975,null,this.searchQuery),this.emptySubtext.textContent=d(5985,null)):(this.emptyText.textContent=d(5963,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.allPlugins.get();this.installedItems=t.map(l=>Ztn(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(5976,null,this.searchQuery),this.emptySubtext.textContent=d(5985,null)):(this.emptyText.textContent=d(5977,null),this.emptySubtext.textContent=d(5956,null))):(this.emptyContainer.style.display="none",this.listContainer.style.display="");let o=this.installedItems.filter(l=>l.plugin.enabled.get()),n=this.installedItems.filter(l=>!l.plugin.enabled.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(5966,null),icon:I0,count:o.length,isFirst:s,description:d(5967,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(5961,null),icon:I0,count:n.length,isFirst:s,description:d(5962,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)}toggleGroup(e){this.collapsedGroups.has(e.group)?this.collapsedGroups.delete(e.group):this.collapsedGroups.add(e.group),this.filterPlugins()}layout(e,t){let o=this.sectionHeader.offsetHeight||0,n=this.searchAndButtonContainer.offsetHeight||52,r=this.browseMode?this.backLink.offsetHeight||28:0,s=e-o-n-r;this.listContainer.style.height=`${Math.max(0,s)}px`,this.list.layout(Math.max(0,s),t),o===0&&Me(this.listContainer).requestAnimationFrame(()=>{if(this._store.isDisposed)return;let l=this.sectionHeader.offsetHeight;if(l>0){let c=e-l-n-r;this.listContainer.style.height=`${Math.max(0,c)}px`,this.list.layout(Math.max(0,c),t)}})}focusSearch(){this.searchInput.focus()}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 P,n=Jtn(t.item.plugin,this.instantiationService),r=[];for(let s of n){for(let l of s)r.push(l),Ac(l)&&o.add(l);r.push(new li)}r.length>0&&r[r.length-1]instanceof li&&r.pop(),this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>r,onHide:()=>o.dispose()})}};MFe=I([m(0,F),m(1,Db),m(2,QB),m(3,Y2),m(4,Qe),m(5,_n),m(6,ze),m(7,tt),m(8,ot)],MFe);var PFe=class{constructor(i,e,t,o,n,r){this.commandService=i;this.chatService=e;this.chatWidgetService=t;this.workspaceService=o;this.promptsService=n;this.quickInputService=r}async createWithAI(i){let e=oin(i),t=await this.quickInputService.input({prompt:d(5916,null,e),placeHolder:d(5917,null,e),validateInput:async u=>{if(!u||!u.trim())return d(5918,null)}});if(!t)return;let o=t.trim(),n=this.resolveTargetDirectory(i),r=tin(i,n,o),s=iin(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 iLi(this.workspaceService,i)}async resolveUserDirectory(i){return oLi(this.promptsService,i)}};PFe=I([m(0,ge),m(1,Si),m(2,At),m(3,lf),m(4,nr),m(5,Ge)],PFe);function iLi(a,i){let e=a.getActiveProjectRoot();if(!e)return;let o=lme(i).find(n=>n.storage==="local");return o?A.joinPath(e,o.path):e}async function oLi(a,i){return(await a.getSourceFolders(i)).find(o=>o.storage==="user")?.uri}function tin(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 iin(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 oin(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 nin=Re("mcp-server-editor-icon",M.mcp,d(11315,null)),cie=class a extends Us{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:Y.extension,path:Ld(this.mcpServer.id,"mcpServer")})}get mcpServer(){return this._mcpServer}getName(){return d(11314,null,this._mcpServer.label)}getIcon(){return nin}matches(e){return super.matches(e)?!0:e instanceof a&&this._mcpServer.id===e._mcpServer.id}};var rin=/[\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 sin(a){return a.trim().toLowerCase().replace(rin,"").replace(/\s/g,"-")}var ain=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function lin(a){return a.replace(ain,(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 wbo({prefix:a="",globalSlugs:i=!1}={}){return{renderer:{heading({tokens:e,depth:t}){let o=this.parser.parseInline(e),n=lin(this.parser.parseInline(e,this.parser.textRenderer)).trim().replace(/<[!\/a-z].*?>/gi,""),r=t,s=`${a}${sin(n)}`;return`<h${r} id="${s}">${o}</h${r}>
`}}}}var die=`
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;
	}
}
`,cin=Object.freeze([Y.http,Y.https]);function din(a,i){return dSt(a,{allowedLinkProtocols:{override:i?.allowedLinkProtocols?.override??cin},allowRelativeLinkPaths:i?.allowRelativeLinkPaths,allowedMediaProtocols:i?.allowedMediaProtocols,allowRelativeMediaPaths:i?.allowRelativeMediaPaths,allowedTags:{override:Ati,augment:i?.allowedTags?.augment},allowedAttributes:{override:[...Sje,"name","id","class","role","tabindex","placeholder"],augment:i?.allowedAttributes?.augment??[]}})}async function uie(a,i,e,t,o=ve.None){let n=new bae(Cbo.markedHighlight({async:!0,async highlight(s,l){if(typeof l!="string")return ur(s);if(await i.whenInstalledExtensionsRegistered(),o?.isCancellationRequested)return"";let c=e.getLanguageIdByLanguageName(l)??e.getLanguageIdByLanguageName(l.split(/\s+|:|,|(?!^)\{|\?]/,1)[0]);return bW(e,s,c)}}),wbo(),...t?.markedExtensions??[]),r=await pm(n.parse(a,{async:!0}),o??ve.None);return din(r,t?.sanitizerConfig)}var Cbo;(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}})(Cbo||={});var AFe=Re("mcp-server",M.mcp,d(11317,null)),nLi=Re("mcp-server-remote",M.remote,d(11318,null)),rLi=Re("mcp-server-workspace",M.rootFolder,d(11319,null)),_Kt=Re("mcp-server-starred",M.starFull,d(11320,null)),xbo=Re("mcp-server-license",M.law,d(11316,null));var YB=class extends C{constructor(){super(...arguments);this._mcpServer=null}get mcpServer(){return this._mcpServer}set mcpServer(e){this._mcpServer=e,this.update()}update(){this.render()}};function Yot(a,i){let e=new P;return e.add(j(a,re.CLICK,Ybe(i))),e.add(j(a,re.KEY_UP,t=>{let o=new Ii(t);(o.equals(10)||o.equals(3))&&(t.preventDefault(),t.stopPropagation(),i())})),e}var pie=class extends YB{constructor(e,t){super();this.themeService=t;this.iconLoadingDisposable=this._register(new me);this.element=R(e,_(".extension-icon")),this.iconElement=R(this.element,_("img.icon",{alt:""})),this.iconElement.style.display="none",this.codiconIconElement=R(this.element,_(q.asCSSSelector(AFe))),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(AFe),this.iconLoadingDisposable.clear()}render(){if(!this.mcpServer){this.clear();return}if(this.mcpServer.icon){let e=this.themeService.getColorTheme().type,t=Ip(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(AFe),this.codiconIconElement.style.display="inherit",this.iconLoadingDisposable.clear()}};pie=I([m(1,De)],pie);var mie=class extends YB{constructor(e,t,o,n){super();this.container=e;this.small=t;this.hoverService=o;this.openerService=n;this.disposables=this._register(new P);this.render(),this._register(Z(()=>this.clear()))}clear(){this.element?.remove(),this.disposables.clear()}render(){if(this.clear(),!this.mcpServer?.publisherDisplayName)return;this.element=R(this.container,_(".publisher"));let e=_(".publisher-name.ellipsis");e.textContent=this.mcpServer.publisherDisplayName;let t=_(".verified-publisher");if(R(t,_("span.extension-verified-publisher.clickable"),Qo(XF)),this.small)this.mcpServer.gallery?.publisherDomain?.verified&&R(this.element,t),R(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(Ni("mouse"),this.element,d(11334,null,this.mcpServer.publisherDisplayName))),R(this.element,e),this.mcpServer.gallery?.publisherDomain?.verified){R(this.element,t);let o=A.parse(this.mcpServer.gallery?.publisherDomain.link);t.tabIndex=0,t.setAttribute("role","button"),this.containerHover.update(d(11336,null,this.mcpServer.gallery?.publisherDomain.link)),t.setAttribute("role","link"),R(t,_("span.extension-verified-publisher-domain",void 0,o.authority.startsWith("www.")?o.authority.substring(4):o.authority)),this.disposables.add(Yot(t,()=>this.openerService.open(o)))}this.mcpServer.gallery?.publisherUrl&&this.disposables.add(Yot(this.element,()=>this.openerService.open(this.mcpServer?.gallery?.publisherUrl)))}}};mie=I([m(2,tt),m(3,Qe)],mie);var Yhe=class a extends YB{constructor(e,t){super();this.container=e;this.small=t;this.disposables=this._register(new P);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:R(this.container,_("span.rating",{tabIndex:0}));R(e,_("span"+q.asCSSSelector(_Kt)));let t=R(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)}},DKt=class extends YB{constructor(e){super();this.container=e;this.disposables=this._register(new P);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=R(this.container,_("span.license",{tabIndex:0}));R(e,_("span"+q.asCSSSelector(xbo)));let t=R(e,_("span",void 0,this.mcpServer.license));t.style.paddingLeft="3px"}},NFe=class extends YB{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 xe("",{isTrusted:!0,supportThemeIcons:!0});e.appendMarkdown(`**${this.mcpServer.label}**`),e.appendText(`
`);let t=!1;if(this.mcpServer.local?.scope==="workspace"&&(e.appendMarkdown(`$(${rLi.id})&nbsp;`),e.appendMarkdown(d(11337,null)),t=!0),this.mcpServer.local?.scope==="remoteUser"&&(e.appendMarkdown(`$(${nLi.id})&nbsp;`),e.appendMarkdown(d(11335,null)),t=!0),this.mcpServer.installState===1&&this.mcpServer.starsCount){t&&e.appendText("  |  ");let n=Yhe.getCountLabel(this.mcpServer.starsCount);e.appendMarkdown(`$(${_Kt.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}};NFe=I([m(2,tt),m(3,B)],NFe);var hie=class extends YB{constructor(e,t){super();this.container=e;this.instantiationService=t;this.badge=this._register(new me);this.element=R(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=rLi;break}case"remoteUser":{t=nLi;break}}this.badge.value=this.instantiationService.createInstance(Eme,t,void 0),R(this.element,this.badge.value.element)}};hie=I([m(1,F)],hie);var OFe=class extends YB{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(){Fi(this.container),this.renderDisposables.value=void 0;let e=new P;this.renderDisposables.value=e;let t=this.extensionStatusAction.status;if(t.length){let o=new xe("",{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));R(this.container,n.element)}this._onDidRender.fire()}};OFe=I([m(2,Qn)],OFe);var uin=J("mcpIcon.starForeground",{light:"#DF6100",dark:"#FF8E00",hcDark:"#FF8E00",hcLight:WI},d(11333,null),!1);is((a,i)=>{let e=a.getColor(uin);e&&(i.addRule(`.extension-ratings .codicon-mcp-server-starred { color: ${e}; }`),i.addRule(`.monaco-hover.extension-hover .markdown-hover .hover-contents ${q.asCSSSelector(_Kt)} { color: ${e}; }`))});var sLi=class extends C{constructor(e){super();this._onChange=this._register(new E);this._currentId=null;let t=R(e,_(".navbar"));this.actions=[],this.actionbar=this._register(new ji(t))}get onChange(){return this._onChange.event}get currentId(){return this._currentId}push(e,t,o,n){let r=new st(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=Ue(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 XB=class extends pa{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super(XB.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 P);this.transientDisposables=this._register(new P);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=R(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=R(t,_(".header")),n=R(o,_(".icon-container")),r=this.instantiationService.createInstance(pie,n),s=this.instantiationService.createInstance(hie,n),l=R(o,_(".details")),c=R(l,_(".title")),u=R(c,_("span.name.clickable",{role:"heading",tabIndex:0}));this._register(this.hoverService.setupManagedHover(Ni("mouse"),u,d(11294,null)));let p=R(l,_(".subtitle")),h=[],g=R(p,_(".subtitle-entry"));h.push(g);let f=this.instantiationService.createInstance(mie,g,!1),v=R(p,_(".subtitle-entry"));h.push(v);let b=this.instantiationService.createInstance(Yhe,v,!1),S=R(p,_(".subtitle-entry"));h.push(S);let y=this.instantiationService.createInstance(DKt,S),w=[r,f,b,s,y],k=R(l,_(".description")),T=[this.instantiationService.createInstance(gT,!1),this.instantiationService.createInstance(_Fe),this.instantiationService.createInstance(Kot,"extensions.uninstall",y0.CLASS,[[this.instantiationService.createInstance(y0),this.instantiationService.createInstance($2,!1),this.instantiationService.createInstance(q2,!1)]]),this.instantiationService.createInstance(eM,!0)],N=R(l,_(".actions-status-container.mcp-server-actions")),O=this._register(new ji(N,{actionViewItemProvider:(Se,ke)=>{if(Se instanceof w8)return Se.createActionViewItem(ke);if(Se instanceof Kot)return new kKt(Se,{...ke,icon:!0,label:!0,menuActionsOrProvider:{getActions:()=>Se.menuActions},menuActionClassNames:Se.menuActionClassNames},this.contextMenuService)},focusOnlyEnabledItems:!0}));O.push(T,{icon:!0,label:!0}),O.setFocusable(!0),this._register(H.any(...T.map(Se=>H.filter(Se.onDidChange,ke=>ke.enabled!==void 0)))(()=>{O.setFocusable(!1),O.setFocusable(!0)}));let V=[],U=this.instantiationService.createInstance(_D),G=this._register(this.instantiationService.createInstance(OFe,R(N,_(".status")),U));this._register(H.any(G.onDidRender)(()=>{this.dimension&&this.layout(this.dimension)})),V.push(U,new class extends YB{render(){N.classList.toggle("list-layout",this.mcpServer?.installState===1)}});let $=this.instantiationService.createInstance(mX,[...T,...w,...V]);for(let Se of[...T,...w,...V,$])this._register(Se);let te=H.chain(O.onDidRun,Se=>Se.map(({error:ke})=>ke).filter(ke=>!!ke));this._register(te(this.onError,this));let pe=R(t,_(".body")),de=new sLi(pe),se=R(pe,_(".content"));se.id=_t(),this.template={content:se,description:k,header:o,name:u,navbar:de,actionsAndStatusContainer:N,actionBar:O,set mcpServer(Se){$.mcpServer=Se;let ke;for(let Ee of h)Ee.classList.remove("last-non-empty"),Ee.children.length>0&&(ke=Ee);ke&&ke.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 $e).token;this.mcpServerReadme=new z0(()=>e.getReadme(n)),this.mcpServerManifest=new z0(()=>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(Yot(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(11284,null),d(11285,null)),(e.gallery||e.local?.manifest)&&t.navbar.push("manifest",d(11291,null),d(11292,null)),e.config&&t.navbar.push("configuration",d(11282,null),d(11283,null)),this.transientDisposables.add(this.mcpWorkbenchService.onChange(n=>{n===e&&(n.config&&!t.navbar.has("configuration")&&t.navbar.push("configuration",d(11282,null),d(11283,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 $e;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),vN(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=Zm(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&&(jd(g,Y.http)||jd(g,Y.https)||jd(g,Y.mailto))&&this.openerService.open(g)})),u}catch{let u=R(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 uie(r,this.extensionService,this.languageService,{},n);return n?.isCancellationRequested?"":this.renderBody(s)}renderBody(e){let t=_t(),o=kc.getColorMap(),n=o?KN(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}">
					${die}

					/* 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=R(t.content,_(".details")),r=R(n,_(".content-container")),s=R(n,_(".additional-details-container")),l=()=>n.classList.toggle("narrow",this.dimension&&this.dimension.width<500);l(),this.contentDisposables.add(Z(Zm(this.layoutParticipants,{layout:l})));let c=await this.openMarkdown(e,this.mcpServerReadme.get(),d(11297,null),r,0,d(11302,null),o);return this.renderAdditionalDetails(s,e),c}async openConfiguration(e,t,o){let n=R(t.content,_(".configuration")),r=_("div",{class:"configuration-content"});this.renderConfigurationDetails(r,e);let s=new Pa(r,{}),l=()=>s.scanDomNode();return this.contentDisposables.add(Z(Zm(this.layoutParticipants,{layout:l}))),R(n,s.getDomNode()),{focus:()=>r.focus()}}async openManifestWithAdditionalDetails(e,t,o){let n=R(t.content,_(".details")),r=R(n,_(".content-container")),s=R(n,_(".additional-details-container")),l=()=>n.classList.toggle("narrow",this.dimension&&this.dimension.width<500);l(),this.contentDisposables.add(Z(Zm(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=R(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=R(r,_(".no-manifest"));u.textContent=d(11296,null)}let s=new Pa(r,{}),l=()=>s.scanDomNode();return this.contentDisposables.add(Z(Zm(this.layoutParticipants,{layout:l}))),R(n,s.getDomNode()),{focus:()=>r.focus()}}renderConfigurationDetails(e,t){Rt(e);let o=t.config;if(!o){let p=R(e,_(".no-config"));p.textContent=d(11295,null);return}let n=R(e,_(".config-section")),r=R(n,_(".config-label"));r.textContent=d(11307,null);let s=R(n,_(".config-value"));s.textContent=t.name;let l=R(e,_(".config-section")),c=R(l,_(".config-label"));c.textContent=d(11308,null);let u=R(l,_(".config-value"));if(u.textContent=o.type,o.type==="stdio"){let p=R(e,_(".config-section")),h=R(p,_(".config-label"));h.textContent=d(11281,null);let g=R(p,_("code.config-value"));if(g.textContent=o.command,o.args&&o.args.length>0){let f=R(e,_(".config-section")),v=R(f,_(".config-label"));v.textContent=d(11280,null);let b=R(f,_("code.config-value"));b.textContent=o.args.join(" ")}}else if(o.type==="http"){let p=R(e,_(".config-section")),h=R(p,_(".config-label"));h.textContent=d(11312,null);let g=R(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)}R(e,_(".manifest-section",void 0,_(".manifest-section-title",void 0,d(11300,null))));for(let[n,r]of o){let s=R(e,_(".package-section",void 0,_(".package-section-title",void 0,n.toUpperCase()))),l=R(s,_(".package-details"));for(let c=0;c<r.length;c++){let u=r[c];if(R(l,_(".package-detail",void 0,_(".detail-label",void 0,d(11299,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)}R(l,_(".package-detail",void 0,_(".detail-label",void 0,d(11298,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)}R(l,_(".package-detail",void 0,_(".detail-label",void 0,d(11306,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??""}`);R(l,_(".package-detail",void 0,_(".detail-label",void 0,d(11286,null)),_("code.detail-value",void 0,p.join(" "))))}c<r.length-1&&R(l,_(".package-separator"))}}}if(t.remotes&&t.remotes.length>0){let o=R(e,_(".package-section",void 0,_(".package-section-title",void 0,d(11303,null).toLocaleUpperCase())));for(let n of t.remotes){let r=R(o,_(".package-details"));if(R(r,_(".package-detail",void 0,_(".detail-label",void 0,d(11312,null)),_(".detail-value",void 0,n.url))),n.type&&R(r,_(".package-detail",void 0,_(".detail-label",void 0,d(11311,null)),_(".detail-value",void 0,n.type))),n.headers&&n.headers.length>0){let s=n.headers.map(l=>`${l.name}: ${l.value??""}`);R(r,_(".package-detail",void 0,_(".detail-label",void 0,d(11287,null)),_(".detail-value",void 0,s.join(", "))))}}}}renderAdditionalDetails(e,t){let o=_("div",{class:"additional-details-content",tabindex:"0"}),n=new Pa(o,{}),r=()=>n.scanDomNode(),s=Zm(this.layoutParticipants,{layout:r});this.contentDisposables.add(Z(s)),this.contentDisposables.add(n),this.contentDisposables.add(this.instantiationService.createInstance(Xot,o,t)),R(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){so(e)||this.notificationService.error(e)}};XB=I([m(1,Te),m(2,F),m(3,De),m(4,Ne),m(5,Qe),m(6,le),m(7,lt),m(8,wm),m(9,kt),m(10,X),m(11,Nf),m(12,tt),m(13,ze)],XB);var Xot=class extends C{constructor(e,t,o,n,r){super();this.container=e;this.mcpGalleryManifestService=o;this.hoverService=n;this.openerService=r;this.disposables=this._register(new P);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=R(e,_(".categories-container.additional-details-element"));R(o,_(".additional-details-title",void 0,d(11310,null)));let n=R(o,_(".categories"));for(let r of t.gallery.topics)R(n,_("span.category",{tabindex:"0"},r))}}async renderExtensionResources(e,t){let o=[],n=await this.mcpGalleryManifestService.getMcpGalleryManifest();if(t.repository)try{o.push([d(11304,null),q.fromId(M.repo.id),A.parse(t.repository)])}catch{}if(n){let r=m5(n,"ContactSupportUri");if(r)try{o.push([d(11309,null),q.fromId(M.commentDiscussion.id),A.parse(r)])}catch{}}if(o.length){let r=R(e,_(".resources-container.additional-details-element"));R(r,_(".additional-details-title",void 0,d(11305,null)));let s=R(r,_(".resources"));for(let[l,c,u]of o){let p=R(s,_(".resource"));R(p,_(q.asCSSSelector(c))),R(p,_("a",{tabindex:"0"},l)),this.disposables.add(Yot(p,()=>this.openerService.open(u))),this.disposables.add(this.hoverService.setupManagedHover(Ni("mouse"),p,u.toString()))}}}renderInstallInfo(e,t){let o=R(e,_(".more-info-container.additional-details-element"));R(o,_(".additional-details-title",void 0,d(11289,null)));let n=R(o,_(".more-info"));R(n,_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(11288,null)),_("code",void 0,t.name))),t.version&&R(n,_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(11313,null)),_("code",void 0,t.version)))}renderMarketplaceInfo(e,t){let o=t.gallery,n=R(e,_(".more-info-container.additional-details-element"));R(n,_(".additional-details-title",void 0,d(11293,null)));let r=R(n,_(".more-info"));o&&(t.local||(R(r,_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(11288,null)),_("code",void 0,t.name))),o.version&&R(r,_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(11313,null)),_("code",void 0,o.version)))),o.lastUpdated&&R(r,_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(11290,null)),_("div",{title:new Date(o.lastUpdated).toString()},Bs(o.lastUpdated,!0,!0,!0)))),o.publishDate&&R(r,_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(11301,null)),_("div",{title:new Date(o.publishDate).toString()},Bs(o.publishDate,!0,!0,!0)))))}};Xot=I([m(2,wV),m(3,tt),m(4,Qe)],Xot);var JB=class extends pa{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super(JB.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.labelService=v;this.pluginReadme=null;this.initialScrollProgress=new Map;this.currentIdentifier="";this.layoutParticipants=[];this.contentDisposables=this._register(new P);this.transientDisposables=this._register(new P);this.activeElement=null}static{this.ID="workbench.editor.agentPlugin"}createEditor(e){let t=R(e,_(".extension-editor.agent-plugin-editor"));t.tabIndex=0,t.style.outline="none",t.setAttribute("role","document");let o=R(t,_(".header")),n=R(o,_(".icon-container")),r=R(n,_("span.codicon.codicon-extensions"));r.style.fontSize="64px";let s=R(o,_(".details")),l=R(s,_(".title")),c=R(l,_("span.name",{role:"heading",tabIndex:0})),u=R(s,_(".description")),p=R(s,_(".subtitle")),h=R(p,_("span.subtitle-entry")),g=R(s,_(".actions-status-container")),f=this._register(new ji(g,{focusOnlyEnabledItems:!0}));f.setFocusable(!0);let v=R(t,_(".body")),b=R(v,_(".content"));b.id=_t(),this.template={content:b,description:u,header:o,name:c,marketplace:h,actionBar:f}}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 $e;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 z0(()=>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 u=`https://github.com/${l}`,p=_("a.marketplace-link",{href:u},s);this.transientDisposables.add(j(p,re.CLICK,h=>{h.preventDefault(),h.stopPropagation(),this.openerService.open(A.parse(u))})),Fi(t.marketplace,p)}else Fi(t.marketplace,s);let c=this.transientDisposables.add(new P);this.transientDisposables.add(he(u=>{c.clear(),t.actionBar.clear();let p=this.agentPluginService.allPlugins.read(u),h=e;if(e.kind==="marketplace"){let f=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}),v=p.find(b=>b.uri.toString()===f.toString());v&&(h=this.installedPluginToItem(v))}else{let f=p.find(v=>v.uri.toString()===e.plugin.uri.toString());if(f)f.enabled.read(u),h=this.installedPluginToItem(f);else if(e.plugin.fromMarketplace){let v=e.plugin.fromMarketplace;h={kind:"marketplace",name:e.name,description:v.description,source:v.source,sourceDescriptor:v.sourceDescriptor,marketplace:v.marketplace,marketplaceReference:v.marketplaceReference,marketplaceType:v.marketplaceType,readmeUri:v.readmeUri}}else return}let g=this.getItemActions(h);g.length>0&&t.actionBar.push(g,{icon:!0,label:!0});for(let f of g)c.add(f)})),this.activeElement=await this.openDetails(e,t,n)}getItemActions(e){if(e.kind==="marketplace")return[this.instantiationService.createInstance(Xhe,e)];let t=[];return e.plugin.enabled.get()?t.push(this.instantiationService.createInstance(Zhe,e.plugin)):t.push(this.instantiationService.createInstance(Jhe,e.plugin)),t.push(this.instantiationService.createInstance(aLi,e.plugin)),t}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=je(e.plugin.uri,"README.md"):o=e.readmeUri,!o)return"";if(o.scheme===Y.file||o.scheme===Y.vscodeRemote)try{return(await this.fileService.readFile(o)).value.toString()}catch{return""}if(o.scheme===Y.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},t);return await E_(s)??""}catch{return""}}return""}async openDetails(e,t,o){let n=R(t.content,_(".details")),r=R(n,_(".content-container")),s=()=>n.classList.toggle("narrow",this.dimension!==void 0&&this.dimension.width<500);return s(),this.contentDisposables.add(Z(Zm(this.layoutParticipants,{layout:s}))),this.openMarkdown(this.pluginReadme.get(),d(5610,null),r,0,d(5611,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),vN(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=Zm(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&&(jd(h,Y.http)||jd(h,Y.https)||jd(h,Y.mailto))&&this.openerService.open(h)})),c}catch{let c=R(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 uie(n,this.extensionService,this.languageService,{},o);return o?.isCancellationRequested?"":this.renderBody(r)}renderBody(e){let t=_t(),o=kc.getColorMap(),n=o?KN(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}">
					${die}

					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())}};JB=I([m(1,Te),m(2,F),m(3,De),m(4,Qe),m(5,le),m(6,lt),m(7,wm),m(8,kt),m(9,be),m(10,_a),m(11,Db),m(12,Y2),m(13,ot)],JB);var Xhe=class extends st{constructor(e,t){super(Xhe.ID,d(5609,null),"extension-action label prominent install");this.item=e;this.pluginInstallService=t}static{this.ID="agentPlugin.editor.install"}async run(){await this.pluginInstallService.installPlugin({name:this.item.name,description:this.item.description,version:"",source:this.item.source,sourceDescriptor:this.item.sourceDescriptor,marketplace:this.item.marketplace,marketplaceReference:this.item.marketplaceReference,marketplaceType:this.item.marketplaceType,readmeUri:this.item.readmeUri})}};Xhe=I([m(1,Y2)],Xhe);var Jhe=class extends st{constructor(e,t){super(Jhe.ID,d(5608,null),"extension-action label prominent");this.plugin=e;this.agentPluginService=t}static{this.ID="agentPlugin.editor.enable"}async run(){this.agentPluginService.setPluginEnabled(this.plugin.uri,!0)}};Jhe=I([m(1,Db)],Jhe);var Zhe=class extends st{constructor(e,t){super(Zhe.ID,d(5607,null),"extension-action label disable");this.plugin=e;this.agentPluginService=t}static{this.ID="agentPlugin.editor.disable"}async run(){this.agentPluginService.setPluginEnabled(this.plugin.uri,!1)}};Zhe=I([m(1,Db)],Zhe);var aLi=class a extends st{constructor(e){super(a.ID,d(5612,null),"extension-action label uninstall");this.plugin=e}static{this.ID="agentPlugin.editor.uninstall"}async run(){this.plugin.remove()}};var pin=Re("agent-plugin-editor-icon",M.extensions,d(5613,null));function lLi(a){return a.kind==="installed"?a.plugin.uri.toString():`${a.marketplaceReference.canonicalId}/${a.source}`}var gie=class a extends Us{constructor(e){super();this._item=e}static{this.ID="workbench.agentPlugin.input"}get typeId(){return a.ID}get capabilities(){return 10}get resource(){return A.from({scheme:Y.extension,path:`/agentPlugin/${encodeURIComponent(lLi(this._item))}`})}get item(){return this._item}getName(){return d(5614,null,this._item.name)}getIcon(){return pin}matches(e){return super.matches(e)?!0:e instanceof a&&lLi(this._item)===lLi(e._item)}};var jc=_,min=J("aiCustomizationManagement.sashBorder",cb,d(5894,null)),cLi=class{getHeight(){return 26}getTemplateId(){return"sectionItem"}},dLi=class{constructor(){this.templateId="sectionItem"}renderTemplate(i){i.classList.add("section-list-item");let e=R(i,jc(".section-icon")),t=R(i,jc(".section-label"));return{container:i,icon:e,label:t}}renderElement(i,e,t){t.icon.className="section-icon",t.icon.classList.add(...q.asClassNameArray(i.icon)),t.label.textContent=i.label}disposeTemplate(){}},MA=class extends pa{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super(MA.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.textFileService=v;this.fileDialogService=b;this.hoverService=S;this.editorModelChangeDisposables=this._register(new P);this.viewMode="list";this.mcpDetailDisposables=this._register(new P);this.pluginDetailDisposables=this._register(new P);this.sections=[];this.selectedSection=kn.Agents;this.editorDisposables=this._register(new P);this._editorContentChanged=!1;this.inEditorContextKey=dbo.bindTo(s),this.sectionContextKey=ubo.bindTo(s),this._register(he(k=>{this.workspaceService.activeProjectRoot.read(k),this.viewMode==="editor"&&(this.currentEditingProjectRoot=this.workspaceService.getActiveProjectRoot())})),this._register(Z(()=>{this.currentModelRef?.dispose(),this.currentModelRef=void 0}));let y={[kn.Agents]:{label:d(5893,null),icon:G2},[kn.Skills]:{label:d(5914,null),icon:S8},[kn.Instructions]:{label:d(5901,null),icon:I8},[kn.Prompts]:{label:d(5908,null),icon:y8},[kn.Hooks]:{label:d(5900,null),icon:CFe},[kn.McpServers]:{label:d(5903,null),icon:M.server},[kn.Plugins]:{label:d(5907,null),icon:I0},[kn.Models]:{label:d(5904,null),icon:M.vm}};for(let k of this.workspaceService.managementSections){let T=y[k];T&&this.sections.push({id:k,...T})}let w=this.storageService.get(yKt,0);w&&this.sections.some(k=>k.id===w)?this.selectedSection=w:this.sections.length>0&&(this.selectedSection=this.sections[0].id)}static{this.ID=bKt}createEditor(e){this.editorDisposables.clear(),this.container=R(e,jc(".ai-customization-management-editor")),this.createSplitView(),this.updateStyles()}createSplitView(){this.splitViewContainer=R(this.container,jc(".management-split-view")),this.sidebarContainer=jc(".management-sidebar"),this.contentContainer=jc(".management-content"),this.createSidebar(),this.createContent(),this.splitView=this.editorDisposables.add(new vu(this.splitViewContainer,{orientation:1,proportionalLayout:!0}));let e=this.storageService.getNumber(HDi,0,wKt);this.splitView.addView({onDidChange:H.None,element:this.sidebarContainer,minimumSize:pbo,maximumSize:mbo,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:H.None,element:this.contentContainer,minimumSize:hbo,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 ai(t,Math.max(0,n-40))),this.viewMode==="pluginDetail"&&this.embeddedPluginEditor&&this.embeddedPluginEditor.layout(new ai(t,Math.max(0,n-40)))}}},Wl.Distribute,void 0,!0),this.editorDisposables.add(this.splitView.onDidSashChange(()=>{let t=this.splitView.getViewSize(0);this.storageService.store(HDi,t,0,0)})),this.editorDisposables.add(this.splitView.onDidSashReset(()=>{let t=this.splitView.getViewSize(0)+this.splitView.getViewSize(1);this.splitView.resizeView(0,wKt),this.splitView.resizeView(1,t-wKt)}))}createSidebar(){let e=R(this.sidebarContainer,jc(".sidebar-content")),t=R(e,jc(".sidebar-sections-list"));this.sectionsList=this.editorDisposables.add(this.instantiationService.createInstance(Rl,"AICustomizationManagementSections",t,new cLi,[new dLi],{multipleSelectionSupport:!1,setRowLineHeight:!1,horizontalScrolling:!1,accessibilityProvider:{getAriaLabel:n=>n.label,getWidgetAriaLabel:()=>d(5912,null)},openOnSingleClick:!0,identityProvider:{getId:n=>n.id}})),this.sectionsList.splice(0,this.sectionsList.length,this.sections);let o=this.sections.findIndex(n=>n.id===this.selectedSection);o>=0&&this.sectionsList.setSelection([o]),this.editorDisposables.add(this.sectionsList.onDidChangeSelection(n=>{n.elements.length>0&&this.selectSection(n.elements[0].id)})),this.workspaceService.isSessionsWindow&&this.createFolderPicker(e)}createFolderPicker(e){let t=this.folderPickerContainer=R(e,jc(".sidebar-folder-picker")),o=R(t,jc("button.folder-picker-button"));o.setAttribute("aria-label",d(5898,null)),R(o,jc(`.codicon.codicon-${M.folder.id}`)).classList.add("folder-picker-icon"),this.folderPickerLabel=R(o,jc("span.folder-picker-label")),this.folderPickerClearButton=R(t,jc("button.folder-picker-clear")),this.folderPickerClearButton.setAttribute("aria-label",d(5899,null)),R(this.folderPickerClearButton,jc(`.codicon.codicon-${M.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(Ni("element"),o,()=>this.workspaceService.getActiveProjectRoot()?.fsPath??"")),this.editorDisposables.add(he(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?Ye(e):d(5906,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(5913,null),defaultUri:this.workspaceService.getActiveProjectRoot()});e?.[0]&&this.workspaceService.setOverrideProjectRoot(e[0])}createContent(){let e=R(this.contentContainer,jc(".content-inner"));this.promptsContentContainer=R(e,jc(".prompts-content-container")),this.listWidget=this.editorDisposables.add(this.instantiationService.createInstance(TFe)),this.promptsContentContainer.appendChild(this.listWidget.element),this.editorDisposables.add(this.listWidget.onDidSelectItem(o=>{let n=o.storage==="local",r=o.storage==="extension"||o.storage==="plugin";this.showEmbeddedEditor(o.uri,o.name,n,r)})),this.editorDisposables.add(this.listWidget.onDidRequestCreate(o=>{this.createNewItemWithAI(o)})),this.editorDisposables.add(this.listWidget.onDidRequestCreateManual(({type:o,target:n})=>{this.createNewItemManual(o,n)}));let t=new Set(this.workspaceService.managementSections);if(t.has(kn.Models)){this.modelsContentContainer=R(e,jc(".models-content-container")),this.modelsWidget=this.editorDisposables.add(this.instantiationService.createInstance($B)),this.modelsContentContainer.appendChild(this.modelsWidget.element),this.modelsFooterElement=R(this.modelsContentContainer,jc(".section-footer"));let o=R(this.modelsFooterElement,jc("p.section-footer-description"));o.textContent=d(5905,null);let n=R(this.modelsFooterElement,jc("a.section-footer-link"));n.textContent=d(5902,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(kn.McpServers)&&(this.mcpContentContainer=R(e,jc(".mcp-content-container")),this.mcpListWidget=this.editorDisposables.add(this.instantiationService.createInstance(DFe)),this.mcpContentContainer.appendChild(this.mcpListWidget.element),this.mcpDetailContainer=R(e,jc(".mcp-detail-container")),this.createEmbeddedMcpDetail(),this.editorDisposables.add(this.mcpListWidget.onDidSelectServer(o=>{this.showEmbeddedMcpDetail(o)}))),t.has(kn.Plugins)&&(this.pluginContentContainer=R(e,jc(".plugin-content-container")),this.pluginListWidget=this.editorDisposables.add(this.instantiationService.createInstance(MFe)),this.pluginContentContainer.appendChild(this.pluginListWidget.element),this.pluginDetailContainer=R(e,jc(".plugin-detail-container")),this.createEmbeddedPluginDetail(),this.editorDisposables.add(this.pluginListWidget.onDidSelectPlugin(o=>{this.showEmbeddedPluginDetail(o)}))),this.editorContentContainer=R(e,jc(".editor-content-container")),this.createEmbeddedEditor(),this.updateContentVisibility(),this.isPromptsSection(this.selectedSection)&&this.listWidget.setSection(this.selectedSection)}isPromptsSection(e){return e===kn.Agents||e===kn.Skills||e===kn.Instructions||e===kn.Prompts||e===kn.Hooks}selectSection(e){this.selectedSection!==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(yKt,e,0,0),this.updateContentVisibility(),this.isPromptsSection(e)&&this.listWidget.setSection(e))}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===kn.Models,l=this.selectedSection===kn.McpServers,c=this.selectedSection===kn.Plugins;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.input&&this.group.closeEditor(this.input),await this.workspaceService.generateCustomization(e)}async createNewItemManual(e,t){if(e==="hook"){this.workspaceService.isSessionsWindow?await this.instantiationService.invokeFunction(UOe,{openEditor:async s=>{await this.showEmbeddedEditor(s,Ye(s),!0)},target:"github-copilot"}):await this.instantiationService.invokeFunction(UOe,{openEditor:async s=>{await this.showEmbeddedEditor(s,Ye(s),!0)}});return}let n={targetFolder:t==="workspace"?iLi(this.workspaceService,e):await oLi(this.promptsService,e),targetStorage:t==="user"?"user":"local",openFile:async s=>{let l=t==="workspace";return await this.showEmbeddedEditor(s,Ye(s),l),this.embeddedEditor}},r;switch(e){case"prompt":r=hot;break;case"instructions":r=got;break;case"agent":r=fot;break;case"skill":r=vot;break;default:return}await this.commandService.executeCommand(r,n),this.listWidget.refresh()}updateStyles(){let e=this.theme.getColor(min);e&&this.splitView?.style({separatorBorder:e})}async setInput(e,t,o,n){this.workspaceService.clearOverrideProjectRoot(),this.inEditorContextKey.set(!0),this.sectionContextKey.set(this.selectedSection),await super.setInput(e,t,o,n),this.dimension&&this.layout(this.dimension)}clearInput(){this.inEditorContextKey.set(!1),this.viewMode==="editor"&&this.goBackToList(),this.viewMode==="mcpDetail"&&this.goBackFromMcpDetail(),this.viewMode==="pluginDetail"&&this.goBackFromPluginDetail(),this.workspaceService.clearOverrideProjectRoot(),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===kn.McpServers?this.mcpListWidget?.focusSearch():this.selectedSection===kn.Plugins?this.pluginListWidget?.focusSearch():this.selectedSection===kn.Models?this.modelsWidget?.focusSearch():this.listWidget?.focusSearch()}selectSectionById(e){let t=this.sections.findIndex(o=>o.id===e);t>=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(yKt,e,0,0),this.updateContentVisibility(),this.isPromptsSection(e)&&this.listWidget.setSection(e),this.sectionsList.setFocus([t]),this.sectionsList.setSelection([t]))}refreshList(){this.listWidget.refresh()}async generateDebugReport(){return this.listWidget.generateDebugReport()}createEmbeddedEditor(){if(!this.editorContentContainer)return;let e=R(this.editorContentContainer,jc(".editor-header")),t=R(e,jc("button.editor-back-button"));t.setAttribute("aria-label",d(5895,null)),R(t,jc(`.codicon.codicon-${M.arrowLeft.id}`)).setAttribute("aria-hidden","true"),this.editorDisposables.add(j(t,"click",()=>{this.goBackToList()}));let n=R(e,jc(".editor-item-info"));this.editorItemNameElement=R(n,jc(".editor-item-name")),this.editorItemPathElement=R(n,jc(".editor-item-path")),this.editorSaveIndicator=R(e,jc(".editor-save-indicator"));let r=R(this.editorContentContainer,jc(".embedded-editor-container")),s=R(this.editorContentContainer,jc(".embedded-editor-overflow-widgets.monaco-editor"));this.editorDisposables.add(Z(()=>s.remove())),this.embeddedEditor=this.editorDisposables.add(this.instantiationService.createInstance(jr,r,{...Kf(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:s},{isSimpleWidget:!1}))}async showEmbeddedEditor(e,t,o=!1,n=!1){this.currentModelRef?.dispose(),this.currentModelRef=void 0,this.currentEditingUri=e,this.currentEditingProjectRoot=o?this.workspaceService.getActiveProjectRoot():void 0,this.viewMode="editor",this.editorItemNameElement.textContent=t,this.editorItemPathElement.textContent=Ye(e),this.updateContentVisibility();try{let r=await this.textModelService.createModelReference(e);if(!Xe(this.currentEditingUri,e)){r.dispose();return}this.currentModelRef=r,this.embeddedEditor.setModel(r.object.textEditorModel),this.embeddedEditor.updateOptions({readOnly:n}),this.dimension&&this.layout(this.dimension),this.embeddedEditor.focus(),this.editorModelChangeDisposables.clear(),this._editorContentChanged=!1;let s=this.editorModelChangeDisposables.add(new jo(500));this.editorModelChangeDisposables.add(r.object.textEditorModel.onDidChangeContent(()=>{this._editorContentChanged=!0,this.editorSaveIndicator.className="editor-save-indicator visible",this.editorSaveIndicator.classList.add(...q.asClassNameArray(M.loading),"codicon-modifier-spin"),this.editorSaveIndicator.title=d(5911,null),s.trigger(async()=>{try{await this.textFileService.save(e)}catch(l){console.error("Failed to save AI customization file:",l),this.editorSaveIndicator.className="editor-save-indicator visible error",this.editorSaveIndicator.classList.add(...q.asClassNameArray(M.error)),this.editorSaveIndicator.title=d(5910,null)}})})),this.editorModelChangeDisposables.add(this.workingCopyService.onDidSave(l=>{Xe(l.workingCopy.resource,e)&&(this.editorSaveIndicator.className="editor-save-indicator visible saved",this.editorSaveIndicator.classList.add(...q.asClassNameArray(M.check)),this.editorSaveIndicator.title=d(5909,null))}))}catch(r){console.error("Failed to load model for embedded editor:",r),Xe(this.currentEditingUri,e)&&this.goBackToList()}}goBackToList(){let e=this.currentEditingUri,t=this.currentEditingProjectRoot;e&&t&&this._editorContentChanged&&this.workspaceService.commitFiles(t,[e]),this.currentModelRef?.dispose(),this.currentModelRef=void 0,this.currentEditingUri=void 0,this.currentEditingProjectRoot=void 0,this.editorModelChangeDisposables.clear(),this.editorSaveIndicator.className="editor-save-indicator",this.editorSaveIndicator.title="",this.embeddedEditor?.setModel(null),this.viewMode="list",this.updateContentVisibility(),this.listWidget?.refresh(),this.dimension&&this.layout(this.dimension),this.listWidget?.focusSearch()}createEmbeddedMcpDetail(){if(!this.mcpDetailContainer)return;let e=R(this.mcpDetailContainer,jc(".editor-header")),t=R(e,jc("button.editor-back-button"));t.setAttribute("aria-label",d(5896,null)),R(t,jc(`.codicon.codicon-${M.arrowLeft.id}`)).setAttribute("aria-hidden","true"),this.editorDisposables.add(j(t,"click",()=>{this.goBackFromMcpDetail()}));let n=R(this.mcpDetailContainer,jc(".mcp-detail-editor-container"));this.embeddedMcpEditor=this.editorDisposables.add(this.instantiationService.createInstance(XB,this.group)),this.embeddedMcpEditor.create(n)}async showEmbeddedMcpDetail(e){if(!this.embeddedMcpEditor)return;this.viewMode="mcpDetail",this.updateContentVisibility();let t=this.instantiationService.createInstance(cie,e);this.mcpDetailDisposables.clear(),this.mcpDetailDisposables.add(t);try{await this.embeddedMcpEditor.setInput(t,void 0,{},ve.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=R(this.pluginDetailContainer,jc(".editor-header")),t=R(e,jc("button.editor-back-button"));t.setAttribute("aria-label",d(5897,null)),R(t,jc(`.codicon.codicon-${M.arrowLeft.id}`)).setAttribute("aria-hidden","true"),this.editorDisposables.add(j(t,"click",()=>{this.goBackFromPluginDetail()}));let n=R(this.pluginDetailContainer,jc(".plugin-detail-editor-container"));this.embeddedPluginEditor=this.editorDisposables.add(this.instantiationService.createInstance(JB,this.group)),this.embeddedPluginEditor.create(n)}async showEmbeddedPluginDetail(e){if(!this.embeddedPluginEditor)return;this.viewMode="pluginDetail",this.updateContentVisibility();let t=new gie(e);this.pluginDetailDisposables.clear(),this.pluginDetailDisposables.add(t);try{await this.embeddedPluginEditor.setInput(t,void 0,{},ve.None)}catch{this.goBackFromPluginDetail();return}this.dimension&&this.layout(this.dimension)}goBackFromPluginDetail(){this.pluginDetailDisposables.clear(),this.embeddedPluginEditor?.clearInput(),this.viewMode="list",this.updateContentVisibility(),this.dimension&&this.layout(this.dimension),this.pluginListWidget?.focusSearch()}};MA=I([m(1,Te),m(2,De),m(3,le),m(4,F),m(5,X),m(6,Qe),m(7,ge),m(8,lf),m(9,nr),m(10,Nt),m(11,B),m(12,Wa),m(13,Ho),m(14,dn),m(15,tt)],MA);var ZB=class a extends Us{constructor(){super();this.resource=void 0}static{this.ID=SKt}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(5915,null)}getIcon(){return M.settingsGear}async resolve(){return null}};oe.as(rn.EditorPane).registerEditorPane(ys.create(MA,bKt,d(5876,null)),[new Mt(ZB)]);var uLi=class{canSerialize(i){return i instanceof ZB}serialize(i){return""}deserialize(i){return ZB.getOrCreate()}};oe.as(rn.EditorFactory).registerEditorSerializer(SKt,uLi);function RKt(a){return A.isUri(a)?a:typeof a=="string"?A.parse(a):A.isUri(a.uri)?a.uri:A.parse(a.uri)}function hin(a){if(!(A.isUri(a)||typeof a=="string"))return a.storage}function gin(a){if(!(A.isUri(a)||typeof a=="string"))return a.promptType}var kbo="aiCustomizationManagement.openFile";W(class extends K{constructor(){super({id:kbo,title:L(5885,"Open"),icon:M.goToFile})}async run(a,i){await a.get(ee).openEditor({resource:RKt(i)})}});var Ebo="aiCustomizationManagement.runPrompt";W(class extends K{constructor(){super({id:Ebo,title:L(5891,"Run Prompt"),icon:M.play})}async run(a,i){await a.get(ge).executeCommand("workbench.action.chat.run.prompt.current",RKt(i))}});var Tbo=ri?L(5890,"Reveal in File Explorer"):it?L(5889,"Reveal in Finder"):L(5888,"Open Containing Folder"),_bo="aiCustomizationManagement.revealInOS";W(class extends K{constructor(){super({id:_bo,title:Tbo,icon:M.folderOpened})}async run(a,i){let e=a.get(ge),t=RKt(i);await e.executeCommand("revealFileInOS",t)}});var Dbo="aiCustomizationManagement.delete";W(class extends K{constructor(){super({id:Dbo,title:L(5883,"Delete"),icon:M.trash})}async run(a,i){let e=a.get(be),t=a.get(ct),o=RKt(i),n=hin(i),s=gin(i)==="skill",l=s?Ye(ci(o)):Ye(o);if(n==="extension"||n==="plugin"){await t.info(d(5878,null),d(5879,null));return}let c=s?d(5882,null,l):d(5880,null,l);if((await t.confirm({message:c,detail:d(5881,null),primaryButton:d(5884,null),type:"warning"})).confirmed){let p=s?ci(o):o;if(await e.del(p,{useTrash:!0,recursive:s}),n==="local"){let h=a.get(lf),g=h.getActiveProjectRoot();g&&await h.deleteFiles(g,[p])}}}});var fin="aiCustomizationManagementItemType";fe.appendMenuItem(Qhe,{command:{id:kbo,title:d(5886,null)},group:"1_open",order:1});fe.appendMenuItem(Qhe,{command:{id:Ebo,title:d(5892,null),icon:M.play},group:"2_run",order:1,when:x.equals(fin,"prompt")});fe.appendMenuItem(Qhe,{command:{id:_bo,title:Tbo.value},group:"3_file",order:1,when:x.or(x.regex("aiCustomizationManagementItemUri",new RegExp(`^${Y.file}:`)),x.regex("aiCustomizationManagementItemUri",new RegExp(`^${Y.vscodeUserData}:`)))});fe.appendMenuItem(Qhe,{command:{id:Dbo,title:d(5884,null)},group:"4_modify",order:1});var LKt=class extends C{static{this.ID="workbench.contrib.aiCustomizationManagementActions"}constructor(){super(),this.registerActions()}registerActions(){this._register(W(class extends K{constructor(){super({id:IKt.OpenEditor,title:L(5887,"Open Customizations (Preview)"),shortTitle:L(5877,"Customizations (Preview)"),category:vi,precondition:x.and(ie.enabled,x.has("config.chat.customizationsMenu.enabled")),f1:!0})}async run(i,e){let t=i.get(ee),o=ZB.getOrCreate(),n=await t.openEditor(o,{pinned:!0},ym);e&&n instanceof MA&&n.selectSectionById(e)}}))}};pt(LKt.ID,LKt,ut.AfterRestored);var eH=class extends C{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(7506,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:eH.PICK_AGENT_SESSION_ACTION_ID,title:d(7507,null),f1:!1,menu:[{id:D.ChatViewSessionTitleNavigationToolbar,group:"navigation",order:2}]})}async run(t){await t.get(F).createInstance(P2,e.titleLabel.value?.element,void 0).pickAgentSession()}}))}render(e){let t=bt("div.chat-view-title-container",[bt("div.chat-view-title-inner",[bt("div.chat-view-title-navigation-toolbar@navigationToolbar"),bt("div.chat-view-title-actions-toolbar@actionsToolbar")])]);this.navigationToolbar=this._register(this.instantiationService.createInstance(Ln,t.navigationToolbar,D.ChatViewSessionTitleNavigationToolbar,{actionViewItemProvider:o=>{if(o.id===eH.PICK_AGENT_SESSION_ACTION_ID)return this.titleLabel.value=new pLi(o),this.titleLabel.value.updateTitle(this.title??eH.DEFAULT_TITLE),this.titleLabel.value},hiddenItemStrategy:-1,menuOptions:{shouldForwardArgs:!0}})),this.actionsToolbar=this._register(this.instantiationService.createInstance(Ln,t.actionsToolbar,D.ChatViewSessionTitleToolbar,{menuOptions:{shouldForwardArgs:!0},hiddenItemStrategy:-1})),this.titleContainer=t.root,this._register(ws.addTarget(this.titleContainer));for(let o of[Gn.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 xe(this.model?.title??"");this.title=qa(e),this.updateTitle(this.title??eH.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}};eH=I([m(2,F)],eH);var pLi=class extends Lr{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(bt("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 FFe=class extends C{constructor(e,t){super();this._chatService=e;this._languageService=t;this._approvals=new Map;this._modelTrackers=this._register(new UD);this._register(I$(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=Le(`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 he(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===lo.StateKind.WaitingForConfirmation||c.type===lo.StateKind.WaitingForPostApproval){let u,p;if(l.toolSpecificData?.kind==="terminal"){let g=fR(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:qa(g)}let h=c;o({label:u,languageId:p,confirm:()=>h.confirm({type:4})});return}}o(void 0)})}};FFe=I([m(0,Si),m(1,kt)],FFe);var fie=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h){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.sessionsListFindIsOpen=!1;this.updateSessionsListThrottler=this._register(new um);this._onDidUpdate=this._register(new E);this.onDidUpdate=this._onDidUpdate.event;this.visible=!0;this.focusedAgentSessionArchivedContextKey=ie.isArchivedAgentSession.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}registerListeners(){this._register(this.editorService.onDidActiveEditorChange(()=>this.revealAndFocusActiveEditorSession()))}revealAndFocusActiveEditorSession(){if(!this.options.trackActiveEditorSession()||!this.visible)return;let e=this.editorService.activeEditor,t=e instanceof Va?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=R(e,_(".agent-sessions-viewer")),this.createEmptyFilterMessage(this.sessionsContainer),this.createList(this.sessionsContainer)}createEmptyFilterMessage(e){this.emptyFilterMessage=R(e,_(".agent-sessions-empty-filter-message")),xo(this.emptyFilterMessage);let t=R(this.emptyFilterMessage,_("span"));t.textContent=`${d(5705,null)} - `;let o=R(this.emptyFilterMessage,_("span.reset-filter-link"));o.textContent=d(5706,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 Ii(n);(r.keyCode===3||r.keyCode===10)&&($t.stop(n,!0),this.options.filter.reset())}))}createList(e){let t=u=>!!(hw(u)&&(u.section==="more"&&!this.options.filter.getExcludes().read||u.section==="archived"&&this.options.filter.getExcludes().archived||this.options.collapseOlderSections?.()&&(["week","older","archived"].includes(u.section)||u.section==="yesterday"&&this.hasTodaySessions()))),o=new zte(this.options),n=this.options.enableApprovalRow?this._register(this.instantiationService.createInstance(FFe)):void 0,r=this._register(this.instantiationService.createInstance(YR,this.options,n)),s=this._register(new B1t(this.options.filter,o)),l=this.sessionsList=this._register(this.instantiationService.createInstance(qI,"AgentSessionsView",e,new W1t(n),new z1t,[r,this.instantiationService.createInstance(a8)],s,{accessibilityProvider:new V1t,dnd:this.instantiationService.createInstance(POe),identityProvider:new U1t,horizontalScrolling:!1,multipleSelectionSupport:!0,findWidgetEnabled:!0,defaultFindMode:1,keyboardNavigationLabelProvider:new K1t,overrideStyles:this.options.overrideStyles,twistieAdditionalCssClass:()=>"force-no-twistie",collapseByDefault:u=>t(u),renderIndentGuides:"none"}));ie.agentSessionsViewerFocused.bindTo(l.contextKeyService),this._register(r.onDidChangeItemHeight(u=>{l.hasNode(u)&&l.updateElementHeight(u,void 0)})),this._register(s.onDidGetChildren(u=>{this.updateEmpty(u===0)}));let c=this.agentSessionsService.model;this._register(this.options.filter.onDidChange(async()=>{this.visible&&(this.updateSectionCollapseStates(),this.update())})),this._register(c.onDidChangeSessions(()=>{this.visible&&this.update()})),l.setInput(c),this._register(l.onDidOpen(u=>this.openAgentSession(u))),this._register(l.onContextMenu(u=>this.showContextMenu(u))),this._register(l.onMouseDblClick(({element:u})=>{u===null&&this.commandService.executeCommand(im)})),this._register(H.any(l.onDidChangeFocus,l.onDidChangeSelection,c.onDidChangeSessions)(()=>{let u=l.getFocus().at(0);u&&gR(u)?(this.focusedAgentSessionArchivedContextKey.set(u.isArchived()),this.focusedAgentSessionReadContextKey.set(u.isRead()),this.focusedAgentSessionTypeContextKey.set(u.providerType)):(this.focusedAgentSessionArchivedContextKey.reset(),this.focusedAgentSessionReadContextKey.reset(),this.focusedAgentSessionTypeContextKey.reset());let p=l.getSelection().filter(gR);this.hasMultipleAgentSessionsSelectedContextKey.set(p.length>1)})),this._register(l.onDidChangeFindOpenState(u=>{this.sessionsListFindIsOpen=u,this.updateSectionCollapseStates()}))}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;mm(r,this.emptyFilterMessage),mm(!r,this.sessionsList.getHTMLElement())}hasTodaySessions(){let e=new Date().setHours(0,0,0,0);return this.agentSessionsService.model.sessions.some(t=>!t.isArchived()&&Bj(t.timing)>=e)}async openAgentSession(e){let t=e.element;if(!t||hw(t))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(UB,t,o);n&&this.options.notifySessionOpened?.(t.resource,n)}}async showContextMenu({element:e,anchor:t,browserEvent:o}){e&&($t.stop(o,!0),hw(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:()=>li.join(...n.getActions({arg:e,shouldForwardArgs:!0}).map(([,r])=>r)),getAnchor:()=>t,getActionsContext:()=>e}),n.dispose()}async showAgentSessionContextMenu(e,t){this.chatSessionsService.activateChatSessionItemProvider(e.providerType);let o=[];o.push([ie.isArchivedAgentSession.key,e.isArchived()]),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(gR)??[],s={session:e,sessions:r.length>1&&r.includes(e)?r:[e],$mid:25};this.contextMenuService.showContextMenu({getActions:()=>li.join(...n.getActions({arg:s,shouldForwardArgs:!0}).map(([,l])=>l)),getAnchor:()=>t,getActionsContext:()=>s}),n.dispose()}openFind(){this.sessionsList?.openFind()}updateSectionCollapseStates(){if(!this.sessionsList)return;let e=this.agentSessionsService.model;for(let t of this.sessionsList.getNode(e).children)if(hw(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)}async update(){return this.updateSessionsListThrottler.queue(async()=>{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=>gR(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)}};fie=I([m(2,ze),m(3,X),m(4,F),m(5,Ls),m(6,ge),m(7,qt),m(8,ia),m(9,Te),m(10,ee)],fie);var XC=class extends zr{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N,O,V,U,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=N;this.chatEntitlementService=O;this.commandService=V;this.activityService=U;this.workbenchEnvironmentService=G;this.hostService=$;this.lastDimensionsPerOrientation=new Map;this.modelRef=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 Bl(`interactive-session-view-${ake}`,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(XC.SESSIONS_SIDEBAR_MIN_WIDTH,this.viewState.sessionsSidebarWidth??XC.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(H.any(H.filter(this.configurationService.onDidChangeConfiguration,e=>e.affectsConfiguration("workbench.sideBar.location")),this.layoutService.onDidChangePanelPosition,H.filter(this.viewDescriptorService.onDidChangeContainerLocation,e=>e.viewContainer===this.viewDescriptorService.getViewContainerByViewId(this.id)))(()=>{this.updateContextKeys(),this.updateViewPaneClasses(!0)})),this._register(H.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",ve.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(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?cs.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(VAe,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=R(t,_(".agent-sessions-title-container")),n=this.sessionsTitle=R(o,_("span.agent-sessions-title"));n.textContent=d(7505,null),this._register(j(n,re.CLICK,()=>{this.sessionsControl?.scrollToTop(),this.sessionsControl?.focus()}));let r=R(o,_(".agent-sessions-toolbar")),s=this._register(this.instantiationService.createInstance(Ln,r,D.AgentSessionsToolbar,{menuOptions:{shouldForwardArgs:!0}})),l=this._register(this.instantiationService.createInstance(f0,{filterMenuId:D.AgentSessionsViewerFilterSubMenu,groupResults:()=>this.sessionsViewerOrientation===1?"capped":"date"}));this._register(H.runAndSubscribe(l.onDidChange,()=>{r.classList.toggle("filtered",!l.isDefault())}));let c=this.sessionsNewButtonContainer=R(t,_(".agent-sessions-new-button-container")),u=this._register(new Mi(c,{...Ko,secondary:!0}));u.label=d(7503,null),this._register(u.onDidClick(()=>this.commandService.executeCommand(im))),this.sessionsControlContainer=R(t,_(".agent-sessions-control-container"));let p=this.sessionsControl=this._register(this.instantiationService.createInstance(fie,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(H.runAndSubscribe(H.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>=XC.SESSIONS_SIDEBAR_VIEW_MIN_WIDTH:e=!1,this.viewPaneContainer.classList.toggle("has-sessions-control",e);let t=this.sessionsContainer.style.display!=="none";return mm(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=R(e,_(".chat-controls-container")),o=this.getLocationBasedColors(),n=this.layoutService.getContainer(Me(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 Io([X,this.scopedContextKeyService])));this._widget=this._register(r.createInstance(Cw,"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:nP,listBackground:o.background,overlayBackground:o.overlayBackground,inputEditorBackground:o.background,resultEditorBackground:qo})),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(he(l=>s(l))),this._widget}createChatTitleControl(e){this.titleControl=this._register(this.instantiationService.createInstance(eH,e,{focusChat:()=>this._widget.focusInput()})),this._register(this.titleControl.onDidChangeHeight(()=>{this.relayout()}))}registerControlsListeners(e,t,o){this._register(H.any(t.onDidChangeEmptyState,H.fromObservable(o.isShowingWelcome),H.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(he(s=>{t.inputPart.height.read(s),this.sessionsViewerVisible&&this.sessionsViewerOrientation===1&&this.relayout()}));let n=this._register(new me),r=()=>{if(n.value=new P,!this.configurationService.getValue("chat.viewProgressBadge.enabled")){this.activityBadge.clear();return}let s=t.viewModel?.model;s?n.value.add(he(l=>{s.requestInProgress.read(l)?this.activityBadge.value=this.activityService.showViewActivity(this.id,{badge:new PC(()=>d(7504,null))}):this.activityBadge.clear()})):this.activityBadge.clear()};this._register(t.onDidChangeViewModel(()=>r())),this._register(H.filter(this.configurationService.onDidChangeConfiguration,s=>s.affectsConfiguration("chat.viewProgressBadge.enabled"))(()=>r())),r()}setupContextMenu(e){this._register(j(e,re.CONTEXT_MENU,t=>{$t.stop(t,!0),this.contextMenuService.showContextMenu({menuId:D.ChatWelcomeContext,contextKeyService:this.contextKeyService,getAnchor:()=>new yn(Me(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",ve.None):void 0;await this.showModel(t)}async showModel(e,t=!0){let o=this.modelRef.value?.object.sessionResource;this.modelRef.value=void 0;let n;if(t&&(n=e??(this.chatService.transferredSessionResource?await this.chatService.acquireOrLoadSession(this.chatService.transferredSessionResource,"panel",ve.None):this.chatService.startNewLocalSession("panel")),!n))throw new Error("Could not start chat session");this.modelRef.value=n;let r=n?.object;return r&&(await this.updateWidgetLockState(fg(r.sessionResource)),this.viewState.sessionResource=r.sessionResource),this._widget.setModel(r),this.titleControl?.update(r),this.updateActions(),o&&this.agentSessionsService.model.getSession(o)?.setRead(!0),r}async updateWidgetLockState(e){if(e===qp){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,o.type):this._widget.unlockFromCodingAgent()}async clear(){this.updateViewState(),await this.showModel(void 0),this.updateActions()}async loadSession(e){return this.restoringSession&&await this.restoringSession,this.progressService.withProgress({location:Vr,delay:200},async()=>{let t=Promise.resolve(),o=nn(()=>{t=this.showModel(void 0,!1).then(()=>{})},100);try{let n=await this.chatService.acquireOrLoadSession(e,"panel",ve.None);return o.dispose(),await t,this.showModel(n)}catch(n){return o.dispose(),await t,this.logService.error(`Failed to load chat session '${e.toString()}'`,n),this.notificationService.error(d(7502,null,In(n))),this.showModel(void 0)}})}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,{heightReduction:r,widthReduction:s}=this.layoutSessionsControl(o,n);o-=r,n-=s,o-=this.titleControl?.getHeight()??0,this._widget.layout(o,n),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>=XC.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(XC.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(XC.SESSIONS_SIDEBAR_MIN_WIDTH,Math.min(t,e-XC.CHAT_WIDGET_DEFAULT_WIDTH))}getLastDimensions(e){return this.lastDimensionsPerOrientation.get(e)}createSessionsViewerSash(e,t,o){let n=this.sessionsViewerSashDisposables.value=new P,r=this.sessionsViewerSash=n.add(new pv(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<XC.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=XC.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}};XC=I([m(1,_e),m(2,ze),m(3,B),m(4,X),m(5,Ri),m(6,F),m(7,Qe),m(8,De),m(9,tt),m(10,le),m(11,Si),m(12,br),m(13,ne),m(14,Ne),m(15,fi),m(16,Ls),m(17,Te),m(18,ao),m(19,Bo),m(20,ia),m(21,vr),m(22,ge),m(23,zl),m(24,Vt),m(25,oi)],XC);var vin=Re("chat-view-icon",M.chatSparkle,d(6602,null)),Zot=oe.as(on.ViewContainersRegistry).registerViewContainer({id:eR,title:L(6579,"Chat"),icon:vin,ctorDescriptor:new Mt(Ha,[eR,{mergeViewWithContainerWhenSingleView:!0}]),storageId:eR,hideIfEmpty:!0,order:1},2,{isDefault:!0,doNotRegisterOpenCommand:!0}),bin={id:Vr,containerIcon:Zot.icon,containerTitle:Zot.title.value,singleViewPaneContainerTitle:Zot.title.value,name:L(6579,"Chat"),canToggleVisibility:!1,canMoveView:!0,openCommandActionDescriptor:{id:eR,title:Zot.title,mnemonicTitle:d(6603,null),keybindings:{primary:2599,mac:{primary:2343}},order:1},ctorDescriptor:new Mt(XC),when:x.or(x.or(ie.Setup.hidden,ie.Setup.disabled)?.negate(),ie.panelParticipantRegistered,ie.extensionInvalid)};oe.as(on.ViewsRegistry).registerViews([bin],Zot);var Sin=Tn.registerExtensionPoint({extensionPoint:"chatParticipants",jsonSchema:{description:d(6609,null),type:"array",items:{additionalProperties:!1,type:"object",defaultSnippets:[{body:{name:"",description:""}}],required:["name","id"],properties:{id:{description:d(6597,null),type:"string"},name:{description:d(6598,null),type:"string",pattern:"^[\\w-]+$"},fullName:{markdownDescription:d(6596,null,"`name`"),type:"string"},description:{description:d(6591,null),type:"string"},isSticky:{description:d(6588,null),type:"boolean"},sampleRequest:{description:d(6601,null),type:"string"},when:{description:d(6600,null),type:"string"},disambiguation:{description:d(6592,null),type:"array",items:{additionalProperties:!1,type:"object",defaultSnippets:[{body:{category:"",description:"",examples:[]}}],required:["category","description","examples"],properties:{category:{markdownDescription:d(6593,null),type:"string"},description:{description:d(6594,null),type:"string"},examples:{description:d(6595,null),type:"array"}}}},commands:{markdownDescription:d(6587,null),type:"array",items:{additionalProperties:!1,type:"object",defaultSnippets:[{body:{name:"",description:""}}],required:["name"],properties:{name:{description:d(6580,null),type:"string"},description:{description:d(6581,null),type:"string"},when:{description:d(6589,null),type:"string"},sampleRequest:{description:d(6586,null),type:"string"},isSticky:{description:d(6588,null),type:"boolean"},disambiguation:{description:d(6582,null),type:"array",items:{additionalProperties:!1,type:"object",defaultSnippets:[{body:{category:"",description:"",examples:[]}}],required:["category","description","examples"],properties:{category:{markdownDescription:d(6583,null),type:"string"},description:{description:d(6584,null),type:"string"},examples:{description:d(6585,null),type:"array"}}}}}}}}}},activationEventsGenerator:function*(a){for(let i of a)yield`onChatParticipant:${i.id}`}}),ege=class{constructor(i){this._chatAgentService=i;this._participantRegistrationDisposables=new jt;this.handleAndRegisterChatExtensions()}static{this.ID="workbench.contrib.chatExtensionPointHandler"}handleAndRegisterChatExtensions(){Sin.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&&p6.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&&K0.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)&&!Ea(t.description,"defaultChatParticipant")){t.collector.error(`Extension '${t.description.identifier.value}' CANNOT use API proposal: defaultChatParticipant.`);continue}if(o.locations&&!Ea(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 P;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:dr(o.locations)?o.locations.map(ks.fromRaw):["panel"],modes:o.isDefault?o.modes??["ask"]:["agent","ask","edit"],slashCommands:o.commands??[],disambiguation:si(n.flat())})),this._participantRegistrationDisposables.set(Lbo(t.description.identifier,o.id),r)}catch(r){t.collector.error(`Failed to register participant ${o.id}: ${In(r,!0)}`)}}for(let t of e.removed)for(let o of t.value)this._participantRegistrationDisposables.deleteAndDispose(Lbo(t.description.identifier,o.id))})}};ege=I([m(0,br)],ege);function Lbo(a,i){return`${a.value}_${i}`}var tge=class extends C{constructor(e,t,o){super();this.productService=o;this.registeredWelcomeView=!1;let n=ie.extensionInvalid.bindTo(t);this._register(H.runAndSubscribe(e.onDidChangeExtensionsNotification,()=>{let s=e.getExtensionsNotification()?.extensions.find(l=>Ei.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(6608,null),o=d(6590,null,this.productService.nameLong),n=`[${t}](${ic(mRe,[this.productService.defaultChatAgent?.chatExtensionId])})`,r=`Copilot Chat version: ${e.version}`,s=oe.as(on.ViewsRegistry);this._register(s.registerViewWelcomeContent(Vr,{content:[o,n,r].join(`

`),when:ie.extensionInvalid}))}};tge=I([m(0,zi),m(1,X),m(2,nt)],tge);var mLi=class extends C{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(6607,null),d(6606,null),d(6605,null),d(6604,null)],n=t.map(r=>["@"+r.name,r.fullName,r.description??"-",r.commands?.length?new xe(r.commands.map(s=>"- /"+s.name).join(`
`)):"-"]);return{data:{headers:o,rows:n},dispose:()=>{}}}};oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:"chatParticipants",label:d(6599,null),access:{canToggle:!1},renderer:new Mt(mLi)});var WFe=class extends C{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?ts(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(H.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 P;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(vie),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()}};WFe=I([m(0,Ge),m(1,Si),m(2,F)],WFe);var vie=class extends C{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=nn(()=>{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 Io([X,this._register(this.contextKeyService.createScoped(e))])));this.widget=this._register(t.createInstance(Cw,"panel",{isQuickChat:!0},{autoScroll:!0,renderInputOnTop:!0,renderStyle:"compact",menus:{inputSideToolbar:D.ChatInputSide,telemetrySource:"chatQuick"},enableImplicitContext:!0,defaultMode:Pl.Ask,clear:()=>this.clear()},{listForeground:Sgt,listBackground:sIe,overlayBackground:_E,inputEditorBackground:Gb,resultEditorBackground:qo})),this.widget.render(e),this.widget.setVisible(!0),this.widget.setDynamicChatTreeItemLayout(2,this.maxHeight),this.updateModel(),this.sash=this._register(new pv(e,{getHorizontalSashTop:()=>e.offsetHeight},{orientation:1})),this.setupDisclaimer(e),this.registerListeners(e)}setupDisclaimer(e){let t=R(e,_(".disclaimer.hidden")),o=this._store.add(new P);this._register(he(n=>{o.clear(),Fi(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 xe(d(7483,null,to.defaultChatAgent?.provider?.default?.name??"",to.defaultChatAgent?.provider?.default?.name??"",to.defaultChatAgent?.termsStatementUrl??"",to.defaultChatAgent?.privacyStatementUrl??""),{isTrusted:!0})));t.appendChild(u.element)}}))}get maxHeight(){return this.layoutService.mainContainerDimension.height-vie.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<vie.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)xMe(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()}};vie=I([m(0,F),m(1,X),m(2,Si),m(3,fi),m(4,At),m(5,vr),m(6,Qn)],vie);var MKt=class{constructor(){this.priority=115;this.name="chatTerminalOutput";this.type="view";this.when=ie.inChatTerminalToolOutput}getProvider(i){let t=i.get(kv).getFocusedProgressPart();if(!t)return;let o=t.getCommandAndOutputAsText();if(o)return new tp("chatTerminalOutput",{type:"view",id:"chatTerminalOutput",language:"text"},()=>o,()=>t.focusOutput(),"accessibility.verbosity.terminalChatOutput")}};var VFe={completionsRefreshTokenCommand:to.defaultChatAgent?.completionsRefreshTokenCommand??"",chatRefreshTokenCommand:to.defaultChatAgent?.chatRefreshTokenCommand??"",providerExtensionId:to.defaultChatAgent?.providerExtensionId??""};function ent(a){a.executeCommand(VFe.completionsRefreshTokenCommand),a.executeCommand(VFe.chatRefreshTokenCommand)}async function PKt(a,i){if(!VFe.providerExtensionId)return!1;let e=a.local.find(t=>Ei.equals(t.identifier.id,VFe.providerExtensionId));if(!e)return!1;if(e.enablementState===10||e.enablementState===11){i.info(`[chat setup] auth provider extension '${VFe.providerExtensionId}' is disabled, re-enabling it`);try{return await a.setEnablement([e],12),await a.updateRunningExtensions(d(6663,null)),!0}catch(t){return i.error(`[chat setup] failed to re-enable auth provider extension '${VFe.providerExtensionId}'`,t),!1}}return!1}var DD={chatExtensionId:to.defaultChatAgent?.chatExtensionId??"",provider:to.defaultChatAgent?.provider??{default:{id:"",name:""},enterprise:{id:"",name:""},apple:{id:"",name:""},google:{id:"",name:""}},providerUriSetting:to.defaultChatAgent?.providerUriSetting??"",completionsAdvancedSetting:to.defaultChatAgent?.completionsAdvancedSetting??""},BFe=class extends C{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 En(!1),o=d(6682,null),n=this.activityService.showViewContainerActivity(eR,{badge:new PC(()=>o)});try{return await this.progressService.withProgress({location:10,command:qC,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?DD.provider.enterprise.id:DD.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 PKt(this.extensionsWorkbenchService,this.logService)&&ent(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:gt.Error,message:d(6684,null,this.defaultAccountService.getDefaultAccountAuthenticationProvider().name),detail:d(6685,null),primaryButton:d(6681,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?DD.provider.enterprise.id:DD.provider.default.id);try{if(!o.forceAnonymous&&e!==5&&!dP(e)&&e!==4){if(r=await this.requests.signUpFree(),cn(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:so(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&&ent(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:gt.Error,message:d(6683,null),detail:e&&!so(e)?In(e):void 0,primaryButton:d(6681,null)});if(t)return this.doInstallWithRetry()}throw e}}async doInstall(){await this.extensionsWorkbenchService.install(DD.chatExtensionId,{enable:!0,isApplicationScoped:!0,isMachineScoped:!1,installEverywhere:!0,installPreReleaseVersion:this.productService.quality!=="stable"},Vr)}async setupWithProvider(e){if(oe.as(ii.Configuration).registerConfiguration({id:"copilot.setup",type:"object",properties:{[DD.completionsAdvancedSetting]:{type:"object",properties:{authProvider:{type:"string"}}},[DD.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(DD.completionsAdvancedSetting).user?.value;return yi(o)||(o={}),e.useEnterpriseProvider?await this.configurationService.updateValue(`${DD.completionsAdvancedSetting}`,{...o,authProvider:DD.provider.enterprise.id},2):await this.configurationService.updateValue(`${DD.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(DD.providerUriSetting);if(typeof o=="string"&&t.test(o))return!0;let n=!1,r=await this.quickInputService.input({prompt:d(6678,null,DD.provider.enterprise.name),placeHolder:d(6679,null),ignoreFocusLost:!0,value:o,validateInput:async l=>{if(n=!1,!!l){if(e.test(l))return n=!0,{content:d(6686,null,`https://${l}.ghe.com`),severity:gt.Info};if(!t.test(l))return{content:d(6680,null,DD.provider.enterprise.name),severity:gt.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(DD.providerUriSetting,s,2),!0}};BFe=I([m(2,Te),m(3,zi),m(4,nt),m(5,ne),m(6,Bo),m(7,zl),m(8,ge),m(9,ct),m(10,B),m(11,ao),m(12,Ge),m(13,Um)],BFe);var tH=class extends C{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(tH.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:tH.SESSION_URI,label:d(6689,null),description:d(6688,null),status:3,iconPath:M.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(tH.STORAGE_KEY,!0,-1,0),this._onDidChangeChatSessionItems.fire(),this._onDidDismiss.fire())}};tH=I([m(0,le),m(1,At),m(2,ao),m(3,ne)],tH);var hLi=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(6690,null),response:d(6691,null)}]};return await o.executeCommand(qC,n),!0}};function Rbo(a,i){let e=new P;return e.add(a.registerChatSessionItemController("copilot-growth",i)),e.add(KTi.registerParticipant(new hLi)),e}W(class extends K{constructor(){super({id:"workbench.action.chat.resetGrowthSession",title:L(6692,"Reset Growth Session Notification"),category:L(6687,"Developer"),f1:!0})}run(i){i.get(le).remove(tH.STORAGE_KEY,-1)}});var PA={publicCodeMatchesUrl:to.defaultChatAgent?.publicCodeMatchesUrl??"",provider:to.defaultChatAgent?.provider??{default:{id:"",name:""},enterprise:{id:"",name:""},apple:{id:"",name:""},google:{id:"",name:""}},manageSettingsUrl:to.defaultChatAgent?.manageSettingsUrl??"",completionsRefreshTokenCommand:to.defaultChatAgent?.completionsRefreshTokenCommand??"",chatRefreshTokenCommand:to.defaultChatAgent?.chatRefreshTokenCommand??"",termsStatementUrl:to.defaultChatAgent?.termsStatementUrl??"",privacyStatementUrl:to.defaultChatAgent?.privacyStatementUrl??""},AA=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g){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.experimentService=g;this.pendingRun=void 0;this.skipDialogOnce=!1}static{this.instance=void 0}static getInstance(i,e,t){let o=AA.instance;return o||(o=AA.instance=i.invokeFunction(n=>new AA(e,t,n.get(Te),n.get(fi),n.get(_e),n.get(vr),n.get(ne),n.get(At),n.get(Vd),n.get(Qn),n.get(Um),n.get(oi),n.get(kC)))),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(6715,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||dP(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: ${In(r)}`),n=!1}return{success:n,dialogSkipped:e}}async showDialog(i){let e=new P,t=i?.dialogHideSkip||await this.experimentService.getTreatment("chatSetupDialogCloseButton"),o=this.getButtons(i,t),n=e.add(new PJ(this.layoutService.activeContainer,this.getDialogTitle(i),o.map(s=>s[0]),mDe({type:"none",extraClasses:["chat-setup-dialog"],detail:" ",icon:i?.dialogIcon??M.copilotLarge,alignment:1,cancelId:t?o.length:o.length-1,disableCloseButton:!t,renderFooter:s=>s.appendChild(this.createDialogFooter(e,i)),buttonOptions:o.map(s=>s[2])},this.keybindingService,this.layoutService,this.hostService))),{button:r}=await n.show();return e.dispose(),o[r]?.[1]??0}getButtons(i,e){let t=(...n)=>({styleButton:r=>r.element.classList.add(...n)}),o;if(!i?.forceAnonymous&&(this.context.state.entitlement===1||i?.forceSignInDialog)){let n=[d(6716,null,PA.provider.default.name),2,t("continue-button","default")],r=[n[0],n[1],t("link-button")],s=[d(6716,null,PA.provider.enterprise.name),3,t("continue-button","default")],l=[s[0],s[1],t("link-button")],c=[d(6716,null,PA.provider.google.name),4,t("continue-button","google")],u=[d(6716,null,PA.provider.apple.name),5,t("continue-button","apple")];this.defaultAccountService.getDefaultAccountAuthenticationProvider().enterprise?o=si([s,c,u,r]):o=si([n,c,u,l])}else o=[[d(6720,null),1,void 0]];return e||o.push([d(6722,null),0,t("link-button","skip-button")]),o}getDialogTitle(i){return i?.dialogTitle?i.dialogTitle:this.chatEntitlementService.anonymous?i?.forceAnonymous?d(6723,null):d(6717,null):this.context.state.entitlement===1||i?.forceSignInDialog?d(6721,null):d(6723,null)}createDialogFooter(i,e){let t=_(".chat-setup-dialog-footer"),o;return e?.forceAnonymous||this.telemetryService.telemetryLevel===0?o=d(6719,null,PA.provider.default.name,PA.termsStatementUrl,PA.privacyStatementUrl):o=d(6718,null,PA.provider.default.name,PA.termsStatementUrl,PA.privacyStatementUrl,PA.provider.default.name,PA.publicCodeMatchesUrl,PA.manageSettingsUrl),t.appendChild(_("p",void 0,i.add(this.markdownRendererService.render(new xe(o,{isTrusted:!0}))).element)),t}};AA=I([m(2,Te),m(3,nc),m(4,_e),m(5,vr),m(6,ne),m(7,At),m(8,Vd),m(9,Qn),m(10,Um),m(11,oi),m(12,kC)],AA);var iH={extensionId:to.defaultChatAgent?.extensionId??"",chatExtensionId:to.defaultChatAgent?.chatExtensionId??"",provider:to.defaultChatAgent?.provider??{default:{id:"",name:""},enterprise:{id:"",name:""},apple:{id:"",name:""},google:{id:"",name:""}},outputChannelId:to.defaultChatAgent?.chatExtensionOutputId??"",outputExtensionStateCommand:to.defaultChatAgent?.chatExtensionOutputExtensionStateCommand??""},yin=x.and(x.equals("config.chat.agent.enabled",!0),x.not("previewFeaturesDisabled")),Mb=class extends C{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 vt;this.registerCommands()}static registerDefaultAgents(e,t,o,n,r){return e.invokeFunction(s=>{let l=s.get(br),c;o==="ask"?c=Pl.Ask.description.get():o==="edit"?c=Pl.Edit.description.get():c=Pl.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 Mb.doRegisterAgent(e,l,u,`${iH.provider.default.name} Copilot`,!0,c,t,o,n,r)})}static registerBuiltInAgents(e,t,o){return e.invokeFunction(n=>{let r=n.get(br),s=new P,{disposable:l}=Mb.doRegisterAgent(e,r,"setup.vscode","vscode",!1,L(6711,"Ask questions about VS Code").value,"panel","agent",t,o);s.add(l);let{disposable:c}=Mb.doRegisterAgent(e,r,"setup.workspace","workspace",!1,L(6714,"Ask about your workspace").value,"panel","agent",t,o);s.add(c);let{disposable:u}=Mb.doRegisterAgent(e,r,"setup.terminal.agent","terminal",!1,L(6709,"Ask how to do something in the terminal").value,"panel","agent",t,o);return s.add(u),s.add(gLi.registerTool(e,{id:"setup_tools_createNewWorkspace",source:Rn.Internal,icon:M.newFolder,displayName:d(6706,null),modelDescription:"Scaffold a new workspace in VS Code",userDescription:d(6707,null),canBeReferencedInPrompt:!0,toolReferenceName:"new",when:x.true()})),s})}static doRegisterAgent(e,t,o,n,r,s,l,c,u,p){let h=new P;h.add(t.registerAgent(o,{id:o,name:n,isDefault:r,isCore:!0,modes:[c],when:c==="agent"?yin?.serialize():void 0,slashCommands:[],disambiguation:[],locations:[l],metadata:{helpTextPrefix:Mb.SETUP_NEEDED_MESSAGE},description:s,extensionId:tkt.identifier,extensionVersion:void 0,extensionDisplayName:tkt.name,extensionPublisherId:tkt.publisher}));let g=h.add(e.createInstance(Mb,u,p,l));return h.add(t.registerAgentImplementation(o,g)),c==="agent"&&t.updateAgent(o,{themeIcon:M.tools}),{agent:g,disposable:h}}static{this.SETUP_NEEDED_MESSAGE=new xe(d(6704,null))}static{this.TRUST_NEEDED_MESSAGE=new xe(d(6710,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(qe.registerCommand(Mb.CHAT_RETRY_COMMAND_ID,async(e,t)=>{let o=e.get(oi);await e.get(At).getWidgetBySessionResource(t)?.clear(),o.reload()})),this._register(qe.registerCommand(Mb.CHAT_SHOW_OUTPUT_COMMAND_ID,async e=>{let t=e.get(ge);iH.outputExtensionStateCommand&&Wp(t.executeCommand(iH.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)}),iH.outputChannelId&&await t.executeCommand(`workbench.action.output.show.${iH.outputChannelId}`)}))}async invoke(e,t){return this.instantiationService.invokeFunction(async o=>{let n=o.get(Si),r=o.get(Wr),s=o.get(At),l=o.get(br),c=o.get(jn),u=o.get(Um);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 xe(d(6712,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 xe(d(6697,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 PKt(this.extensionsWorkbenchService,this.logService)&&ent(this.commandService);let u=s.getWidgetBySessionResource(e.session.sessionResource),p=u?.input.currentModeInfo,h=!1,g=!1,f=!1,v=!1,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 xe(d(6713,null)),shimmer:!0})},1e4),T=new P;T.add(Z(()=>clearTimeout(k)));try{let N=await Promise.race([Pi(this.environmentService.remoteAuthority?6e4:2e4).then(()=>"timedout"),this.whenPanelAgentHasGuidance(T).then(()=>"panelGuidance"),Promise.allSettled([b,S,y,w])]);if(N==="panelGuidance"){let O=d(6696,null);t({kind:"markdownContent",content:new xe(O)}),this._onUnresolvableError.fire();return}if(N==="timedout"){let O;this.chatEntitlementService.anonymous?O=d(6695,null,iH.chatExtensionId):O=d(6694,null,iH.provider.default.name,iH.chatExtensionId);let V=n.getLanguageModelIds(),U=0;for(let He of V)n.lookupLanguageModel(He)?.isDefaultForLocation.panel&&U++;let G=r.getDefaultAgent(this.location,p?.kind),$=!!G,te=G?.isCore??!1,pe=r.getContributedDefaultAgent(this.location),de=!!pe,se=pe?.isCore??!1,Se=r.getActivatedAgents().length;this.logService.warn(O,{agentActivated:h,agentReady:g,agentHasDefault:$,agentDefaultIsCore:te,agentHasContributedDefault:de,agentContributedDefaultIsCore:se,agentActivatedCount:Se,agentLocation:this.location,agentModeKind:p?.kind,languageModelReady:f,languageModelCount:V.length,languageModelDefaultCount:U,languageModelHasRequestedModel:!!e.modelId,toolsModelReady:v});let ke=this.viewsService.getActiveViewWithId(Vr),Ee=ke?.getMatchingWelcomeView();this.telemetryService.publicLog2("chatSetup.timeout",{agentActivated:h,agentReady:g,agentHasDefault:$,agentDefaultIsCore:te,agentHasContributedDefault:de,agentContributedDefaultIsCore:se,agentActivatedCount:Se,agentLocation:this.location,agentModeKind:p?.kind??"",languageModelReady:f,languageModelCount:V.length,languageModelDefaultCount:U,languageModelHasRequestedModel:!!e.modelId,toolsModelReady:v,isRemote:!!this.environmentService.remoteAuthority,isAnonymous:this.chatEntitlementService.anonymous,matchingWelcomeViewWhen:Ee?.when.serialize()??(ke?"noWelcomeView":"noChatViewPane")}),t({kind:"warning",content:new xe(O)}),iH.outputChannelId&&this.outputService.getChannelDescriptor(iH.outputChannelId)?t({kind:"command",command:{id:Mb.CHAT_SHOW_OUTPUT_COMMAND_ID,title:d(6708,null)}}):t({kind:"command",command:{id:Mb.CHAT_RETRY_COMMAND_ID,title:d(6703,null),arguments:[e.session.sessionResource]}}),this._onUnresolvableError.fire();return}}finally{T.dispose()}}await o.resendRequest(e,{...u?.getModeRequestOptions(),modeInfo:p,userSelectedModelId:u?.input.currentLanguageModel})}async whenPanelAgentHasGuidance(e){let t=()=>NB.get().some(o=>this.contextKeyService.contextMatchesRules(o.when));if(!t())return new Promise(o=>{let n=new Set,r=()=>{let c=NB.get();n=new Set(c.flatMap(u=>u.when.keys()))};r();let s=H.map(NB.onDidChange,()=>"registry"),l=H.map(H.filter(this.contextKeyService.onDidChangeContext,c=>c.affectsSome(n)),()=>"context");e.add(H.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 H.toPromise(H.filter(e.onDidChangeLanguageModels,()=>o()))}whenToolsModelReady(e,t){if(t.message.parts.some(n=>n instanceof ZS)){for(let n of e.getAllToolsIncludingDisabled())if(n.id.startsWith("copilot_"))return;return H.toPromise(H.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 H.toPromise(H.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:pI,from:"chat"});let u=r.getWidgetBySessionResource(e.sessionResource),p=u?.viewModel?.model.getRequests().at(-1),h=H.runAndSubscribe(this.controller.value.onDidChange,(()=>{switch(this.controller.value.step){case 2:t({kind:"progressMessage",content:new xe(d(6705,null,c.getDefaultAccountAuthenticationProvider().name)),shimmer:!0});break;case 3:t({kind:"progressMessage",content:new xe(d(6701,null)),shimmer:!0});break}})),g;try{g=await AA.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: ${In(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 xe(d(6693,null))});else t({kind:"markdownContent",content:this.workspaceTrustManagementService.isWorkspaceTrusted()?Mb.SETUP_NEEDED_MESSAGE:Mb.TRUST_NEEDED_MESSAGE});return{}}replaceAgentInRequestModel(e,t){let o=e.message.parts.find(l=>l instanceof zu);if(!o)return e;let n=o.agent.id.replace(/setup\./,`${iH.extensionId}.`.toLowerCase()),r=t.getAgent(n);if(!r)return e;let s=new zu(o.range,o.editorRange,r);return new yB({session:e.session,message:{parts:e.message.parts.map(l=>l instanceof zu?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 ZS);if(!t)return e;let o=t.toolId.replace(/setup.tools\./,"copilot_".toLowerCase()),n=new ZS(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 yB({session:e.session,message:{parts:e.message.parts.map(l=>l instanceof ZS?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})}};Mb=I([m(3,F),m(4,ne),m(5,Te),m(6,Vt),m(7,ns),m(8,vr),m(9,Ft),m(10,X),m(11,Ml),m(12,zi),m(13,ge)],Mb);var gLi=class a{static registerTool(i,e){return i.invokeFunction(t=>{let o=t.get(jn),n=i.createInstance(a);return o.registerTool(e,n)})}async invoke(i,e,t,o){return{content:[{kind:"text",value:""}]}}async prepareToolInvocation(i,e){}},bie=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(zt),r=i.createInstance(bie,e,t);return n.newSymbolNamesProvider.register("*",r)})}async provideNewSymbolNames(i,e,t,o){return await this.instantiationService.invokeFunction(n=>AA.getInstance(this.instantiationService,this.context,this.controller).run({forceAnonymous:this.chatEntitlementService.anonymous?1:void 0})),[]}};bie=I([m(2,F),m(3,vr)],bie);var Sie=class{constructor(i){this.markerService=i}static registerProvider(i){return i.invokeFunction(e=>{let t=e.get(zt),o=i.createInstance(Sie);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(6700,null),n=oH.generate(e))}else{let s=i.getValueInRange(e);/^\s*$/.test(s)||(o=d(6702,null),n=oH.modify(e))}o&&n&&t.push({kind:gr.RefactorRewrite.append("copilot").value,isAI:!0,title:o,command:n});let r=oH.warningOrErrorMarkersAtRange(this.markerService,i.uri,e);return r.length>0&&(t.push({kind:gr.QuickFix.append("copilot").value,isAI:!0,diagnostics:r,title:d(6699,null),command:oH.fixMarkers(r,e)}),t.push({kind:gr.QuickFix.append("explain").append("copilot").value,isAI:!0,diagnostics:r,title:d(6698,null),command:oH.explainMarkers(r)})),{actions:t,dispose(){}}}};Sie=I([m(0,Ns)],Sie);var oH=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:XZ,title:d(6702,null),arguments:[{initialSelection:this.rangeToSelection(i),initialRange:i,position:i.getStartPosition()}]}}static generate(i){return{id:XZ,title:d(6700,null),arguments:[{initialSelection:this.rangeToSelection(i),initialRange:i,position:i.getStartPosition()}]}}static rangeToSelection(i){return new Yt(i.startLineNumber,i.startColumn,i.endLineNumber,i.endColumn)}static explainMarkers(i){return{id:qC,title:d(6698,null),arguments:[{query:`@workspace /explain ${i.map(e=>e.message).join(", ")}`,isPartialQuery:!0}]}}static fixMarkers(i,e){return{id:XZ,title:d(6699,null),arguments:[{message:`/fix ${i.map(t=>t.message).join(", ")}`,initialSelection:this.rangeToSelection(e),initialRange:e,position:e.getStartPosition()}]}}};var nH={chatExtensionId:to.defaultChatAgent?.chatExtensionId??"",manageOveragesUrl:to.defaultChatAgent?.manageOverageUrl??"",upgradePlanUrl:to.defaultChatAgent?.upgradePlanUrl??"",completionsRefreshTokenCommand:to.defaultChatAgent?.completionsRefreshTokenCommand??"",chatRefreshTokenCommand:to.defaultChatAgent?.chatRefreshTokenCommand??""},ige=class extends C{constructor(e,t,o,n,r,s,l,c,u,p){super();this.instantiationService=e;this.logService=o;this.contextKeyService=n;this.extensionEnablementService=r;this.extensionsWorkbenchService=s;this.extensionService=l;this.environmentService=c;this.chatSessionsService=u;this.configurationService=p;let h=t.context?.value,g=t.requests?.value;if(!h||!g)return;let f=new co(()=>this._register(this.instantiationService.createInstance(BFe,h,g)));this.registerSetupAgents(h,f),this.registerGrowthSession(t),this.registerActions(h,g,f),this.registerUrlLinkHandler(),this.checkExtensionInstallation(h)}static{this.ID="workbench.contrib.chatSetup"}registerSetupAgents(e,t){let o=Mp(new me),n=Mp(new me),r=Mp(new me),s=Mp(new me),l=()=>{{if(!e.state.hidden&&!e.state.disabled){if(!o.value){let c=o.value=new P,u=c.add(new P);for(let p of["ask","edit","agent"]){let{agent:h,disposable:g}=Mb.registerDefaultAgents(this.instantiationService,"panel",p,e,t);u.add(g),u.add(h.onUnresolvableError(()=>{NB.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(Mb.registerDefaultAgents(this.instantiationService,"terminal","ask",e,t).disposable),c.add(Mb.registerDefaultAgents(this.instantiationService,"notebook","ask",e,t).disposable),c.add(Mb.registerDefaultAgents(this.instantiationService,"editor","ask",e,t).disposable)}(!e.state.installed||e.state.entitlement===1||e.state.entitlement===2)&&!n.value&&(n.value=new P).add(Mb.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=bie.registerProvider(this.instantiationService,e,t)):r.clear(),!e.state.installed&&!e.state.hidden&&!e.state.disabled?s.value||(s.value=Sie.registerProvider(this.instantiationService)):s.clear()};this._register(H.runAndSubscribe(e.onDidChange,()=>l()))}registerGrowthSession(e){let t=Mp(new me),o=()=>{let r=this.configurationService.getValue("chat.growthNotification.enabled")===!0&&!e.sentiment.installed;if(r&&!t.value){let s=new P,l=s.add(this.instantiationService.createInstance(tH));l.isDismissed?s.dispose():(s.add(Rbo(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(6676,"Use AI Features with Copilot for free...")}constructor(){super({id:pI,title:n.CHAT_SETUP_ACTION_LABEL,category:vi,f1:!0,precondition:x.or(ie.Setup.hidden,ie.Setup.disabled,ie.Setup.untrusted,ie.Setup.installed.negate(),ie.Entitlement.canSignUp)})}async run(b,S,y){let w=b.get(At),k=b.get(F),T=b.get(ct),N=b.get(ge),O=b.get(ao),V=b.get(B);await e.update({hidden:!1}),V.updateValue("chat.disableAIFeatures",!1),S&&(await w.revealWidget())?.input.setChatMode(S),y?.inputValue&&(await w.revealWidget())?.setInput(y.inputValue);let U=AA.getInstance(k,e,o),{success:G}=await U.run(y);if(G===!1&&!O.willShutdown){let{confirmed:$}=await T.confirm({type:gt.Error,message:d(6675,null),primaryButton:d(6673,null)});if($)return!!await N.executeCommand(pI,S,y)}return!!G}}class r extends K{constructor(){super({id:n3,title:n.CHAT_SETUP_ACTION_LABEL})}async run(b,S){let y=b.get(ge),w=b.get(Te),k=b.get(vr);return w.publicLog2("workbenchActionExecuted",{id:pI,from:"api"}),y.executeCommand(pI,void 0,{forceAnonymous:k.anonymous?1:void 0,...S})}}class s extends K{constructor(){super({id:"workbench.action.chat.triggerSetupForceSignIn",title:L(6667,"Sign in to use AI features")})}async run(b){let S=b.get(ge);return b.get(Te).publicLog2("workbenchActionExecuted",{id:pI,from:"api"}),S.executeCommand(pI,void 0,{forceSignInDialog:!0})}}class l extends K{constructor(){super({id:"workbench.action.chat.triggerSetupAnonymousWithoutDialog",title:n.CHAT_SETUP_ACTION_LABEL})}async run(b){let S=b.get(ge);return b.get(Te).publicLog2("workbenchActionExecuted",{id:pI,from:"api"}),S.executeCommand(pI,void 0,{forceAnonymous:2})}}class c extends K{constructor(){super({id:"workbench.action.chat.triggerSetupFromAccounts",title:L(6677,"Sign in to use AI features..."),menu:{id:D.AccountsContext,group:"2_copilot",when:x.and(ie.Setup.hidden.negate(),ie.Setup.installed.negate(),ie.Entitlement.signedOut)}})}async run(b){let S=b.get(ge);return b.get(Te).publicLog2("workbenchActionExecuted",{id:pI,from:"accounts"}),S.executeCommand(pI)}}let u=this._register(new me);class p extends K{constructor(){super({id:"workbench.action.chat.upgradePlan",title:L(6670,"Upgrade to GitHub Copilot Pro"),category:L(6664,"Chat"),f1:!0,precondition:x.and(ie.Setup.hidden.negate(),x.or(ie.Entitlement.canSignUp,ie.Entitlement.planFree)),menu:{id:D.ChatTitleBarMenu,group:"a_first",order:1,when:x.and(ie.Entitlement.planFree,x.or(ie.chatQuotaExceeded,ie.completionsQuotaExceeded))}})}async run(b){let S=b.get(Qe),y=b.get(oi),w=b.get(ge);S.open(A.parse(nH.upgradePlanUrl));let k=e.state.entitlement;dP(k)||(u.value=y.onDidChangeFocus(T=>this.onWindowFocus(T,w)))}async onWindowFocus(b,S){if(b){u.clear();let y=await t.forceResolveEntitlement();y?.entitlement&&dP(y?.entitlement)&&win(S)}}}class h extends K{constructor(){super({id:"workbench.action.chat.manageOverages",title:L(6669,"Manage GitHub Copilot Overages"),category:L(6664,"Chat"),f1:!0,precondition:x.and(ie.Setup.hidden.negate(),x.or(ie.Entitlement.planPro,ie.Entitlement.planProPlus)),menu:{id:D.ChatTitleBarMenu,group:"a_first",order:1,when:x.and(x.or(ie.Entitlement.planPro,ie.Entitlement.planProPlus),x.or(ie.chatQuotaExceeded,ie.completionsQuotaExceeded))}})}async run(b){b.get(Qe).open(A.parse(nH.manageOveragesUrl))}}W(n),W(s),W(c),W(l),W(r),W(p),W(h);function g(v,b){qe.registerCommand(v,async S=>{let y=S.get(ge),w=S.get(Kt),k=S.get(Ns);switch(v){case"chat.internal.explain":case"chat.internal.fix":{let T=w.getActiveCodeEditor(),N=T?.getModel()?.uri,O=T?.getSelection();if(!N||!O)return;let V=oH.warningOrErrorMarkersAtRange(k,N,O),U=v==="chat.internal.explain"?oH.explainMarkers(V):oH.fixMarkers(V,O);await y.executeCommand(U.id,...U.arguments??[]);break}case"chat.internal.review":await y.executeCommand(n3)&&await y.executeCommand(b)}})}g("chat.internal.explain","github.copilot.chat.explain"),g("chat.internal.fix","github.copilot.chat.fix"),g("chat.internal.review","github.copilot.chat.review");let f=x.and(ie.Setup.hidden.negate(),ie.Setup.disabled.negate(),ie.Setup.installed.negate());fe.appendMenuItem(D.EditorContext,{command:{id:"chat.internal.explain",title:d(6665,null)},group:"1_chat",order:4,when:f}),fe.appendMenuItem(D.EditorContext,{command:{id:"chat.internal.fix",title:d(6666,null)},group:"1_chat",order:5,when:x.and(f,ue.readOnly.negate())}),fe.appendMenuItem(D.EditorContext,{command:{id:"chat.internal.review",title:d(6674,null)},group:"1_chat",order:6,when:f})}registerUrlLinkHandler(){this._register(J6e.registerHandler(this.instantiationService.createInstance(tnt)))}async checkExtensionInstallation(e){if(this.environmentService.isExtensionDevelopment&&(await this.extensionService.whenInstalledExtensionsRegistered(),this.extensionService.extensions.find(t=>Ei.equals(t.identifier,nH.chatExtensionId)))){e.update({installed:!0,disabled:!1,untrusted:!1});return}await this.extensionsWorkbenchService.queryLocal(),this._register(H.runAndSubscribe(this.extensionsWorkbenchService.onChange,t=>{if(t&&!Ei.equals(t.identifier.id,nH.chatExtensionId))return;let o=this.extensionsWorkbenchService.local.find(l=>Ei.equals(l.identifier.id,nH.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})}))}};ige=I([m(0,F),m(1,vr),m(2,ne),m(3,X),m(4,Os),m(5,zi),m(6,lt),m(7,Co),m(8,Ls),m(9,B)],ige);var tnt=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&&mr(i.authority,nH.chatExtensionId)}async handleURL(i){let e=new URLSearchParams(i.query);this.telemetryService.publicLog2("workbenchActionExecuted",{id:pI,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(pI,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}};tnt=I([m(0,nt),m(1,ge),m(2,Te),m(3,Pv)],tnt);var oge=class extends C{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&&!Ei.equals(e.identifier.id,nH.chatExtensionId))return;let t=this.extensionsWorkbenchService.local.find(o=>Ei.equals(o.identifier.id,nH.chatExtensionId));t?.local&&this.extensionEnablementService.isEnabled(t.local)&&this.configurationService.updateValue("chat.disableAIFeatures",!1)}))}async maybeEnableOrDisableExtension(e){let t=this.extensionsWorkbenchService.local.find(o=>Ei.equals(o.identifier.id,nH.chatExtensionId));t&&(await this.extensionsWorkbenchService.setEnablement([t],e),await this.extensionsWorkbenchService.updateRunningExtensions(e===12||e===13?d(6672,null):d(6671,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===eR)&&this.layoutService.setPartHidden(!0,"workbench.parts.auxiliarybar")}registerActions(){class e extends K{static{this.ID="workbench.action.chat.hideSetup"}static{this.TITLE=L(6668,"Learn How to Hide AI Features")}constructor(){super({id:e.ID,title:e.TITLE,f1:!0,category:vi,precondition:ie.Setup.hidden.negate(),menu:{id:D.ChatTitleBarMenu,group:"z_hide",order:1,when:ie.Setup.installed.negate()}})}async run(o){o.get(Po).openSettings({jsonEditor:!1,query:"@id:chat.disableAIFeatures"})}}W(e)}};oge=I([m(0,vr),m(1,B),m(2,zi),m(3,Os),m(4,Ri),m(5,fi)],oge);function win(a){a.executeCommand(nH.completionsRefreshTokenCommand),a.executeCommand(nH.chatRefreshTokenCommand)}var NKt=class extends C{static createAppend(i,e,...t){if(!rE()){let n=new this(...t);i.appendChild(n.element),e.add(n);return}let o=this.createObservable(e,...t);e.add(he(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(!rE())return Oo(new this(...e));let t=this[fLi],o=t?AKt.get(t):void 0;return o?Ce(n=>{let r=o.read(n);return new r(...e)}):Oo(new this(...e))}static instantiateAppend(i,e,t,...o){if(!rE()){let s=i.createInstance(this,...o);e.appendChild(s.element),t.add(s);return}let n=this.instantiateObservable(i,t,...o),r;t.add(he(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(!rE())return Oo(i.createInstance(this,...t));let o=this[fLi],n=o?AKt.get(o):void 0;return n?Ce(r=>{let s=n.read(r);return i.createInstance(s,...t)}):Oo(i.createInstance(this,...t))}static registerWidgetHotReplacement(i){if(!rE())return;let e=AKt.get(i);e?e.set(this,void 0):(e=Le(i,this),AKt.set(i,e)),this[fLi]=i}},fLi=Symbol("DomWidgetHotReloadId"),AKt=new Map;function OKt(a){return!a.sentiment.installed||a.entitlement===3}var NA=to.defaultChatAgent,Pbo=J("gauge.foreground",{dark:z$e,light:z$e,hcDark:gi,hcLight:gi},d(6776,null));J("gauge.background",{dark:ei(Pbo,.3),light:ei(Pbo,.3),hcDark:Oe.white,hcLight:Oe.white},d(6772,null));J("gauge.border",{dark:null,light:null,hcDark:gi,hcLight:gi},d(6773,null));var Abo=J("gauge.warningForeground",{dark:K$e,light:K$e,hcDark:gi,hcLight:gi},d(6778,null));J("gauge.warningBackground",{dark:ei(Abo,.3),light:ei(Abo,.3),hcDark:Oe.white,hcLight:Oe.white},d(6777,null));var Nbo=J("gauge.errorForeground",{dark:Nse,light:Nse,hcDark:gi,hcLight:gi},d(6775,null));J("gauge.errorBackground",{dark:ei(Nbo,.3),light:ei(Nbo,.3),hcDark:Oe.white,hcLight:Oe.white},d(6774,null));var HFe=class extends NKt{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=Wu.DateTimeFormat(Dr,{year:"numeric",month:"long",day:"numeric"});this.dateTimeFormatter=Wu.DateTimeFormat(Dr,{year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"numeric"});this.quotaPercentageFormatter=Wu.NumberFormat(void 0,{maximumFractionDigits:1,minimumFractionDigits:0});this.quotaOverageFormatter=Wu.NumberFormat(void 0,{maximumFractionDigits:2,minimumFractionDigits:0});this.render()}render(){let e=u6(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,pi({id:"workbench.action.manageCopilot",label:d(6788,null),tooltip:d(6790,null),class:q.asClassName(M.settings),run:()=>this.runCommandAndClose(()=>this.openerService.open(A.parse(NA.manageSettingsUrl)))}));let p=r&&(r.total>0||r.unlimited)?this.createQuotaIndicator(this.element,this._store,r,d(6763,null),!1):void 0,h=n&&(n.total>0||n.unlimited)?this.createQuotaIndicator(this.element,this._store,n,d(6756,null),!1):void 0,g=s?.overageEnabled&&!s?.unlimited?d(6779,null):d(6785,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(6783,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 Mi(this.element,{...Ko,hoverDelegate:US,secondary:this.canUseChat()}));v.label=d(6804,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(6753,null)),this.createQuotaIndicator(this.element,this._store,d(6789,null),d(6763,null),!1),this.createQuotaIndicator(this.element,this._store,d(6789,null),d(6756,null),!1));{let u=this.chatSessionsService.getInProgress();if(u.some(p=>p.count>0)){o(d(6755,null),pi({id:"workbench.view.chat.status.sessions",label:d(6806,null),tooltip:d(6807,null),class:q.asClassName(M.eye),run:()=>{this.viewService.openView(Vr,!0),this.hoverService.hideHover(!0)}}));for(let{displayName:p,count:h}of u)if(h>0){let g=d(6781,null,p),f=this.element.appendChild(_("div.description")),v=Bn(g);f.append(...v)}}}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(6780,null),u.installed&&!u.disabled&&!u.untrusted?pi({id:"workbench.action.openChatSettings",label:d(6800,null),tooltip:d(6801,null),class:q.asClassName(M.settingsGear),run:()=>this.runCommandAndClose(()=>this.commandService.executeCommand("workbench.action.openSettings",{query:`@id:${NA.completionsEnablementSetting} @id:${NA.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(6784,null)));let v=f.appendChild(_("div.model-action-bar"));this._store.add(new ji(v,{hoverDelegate:US})).push([pi({id:"workbench.action.selectInlineCompletionsModel",label:g.name,tooltip:d(6792,null),class:q.asClassName(M.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 ji(v,{hoverDelegate:US})).push([pi({id:`workbench.action.selectProviderOption.${h.id}`,label:g.label,tooltip:d(6794,null,h.label),run:async()=>{await this.showProviderOptionPicker(p,h)}})],{icon:!1,label:!0})}}}if(this.canUseChat()){let u=R(this.element,_("div.snooze-completions"));this.createCompletionsSnooze(u,d(6799,null),this._store)}{let u=OKt(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 xe(d(6749,null,NA.provider.default.name,NA.provider.default.name,NA.termsStatementUrl,NA.privacyStatementUrl),{isTrusted:!0}),v=`${v}.terms`):u?f=d(6748,null):p?f=d(6771,null):h?f=d(6769,null):f=d(6802,null);let b;u?b=d(6767,null):p?b=d(6770,null):h?b=d(6768,null):b=d(6803,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 Mi(this.element,{...Ko,hoverDelegate:US}));y.label=b,this._store.add(y.onDidClick(()=>this.runCommandAndClose(S)))}}}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=sTt(this.chatEntitlementService.entitlement);return d(6805,null,e)}renderHeader(e,t,o,n){let r=e.appendChild(_("div.header",void 0,o??""));n&&t.add(new ji(r,{hoverDelegate:US})).push([n],{icon:!0,label:!1})}renderContributedChatStatusItem(e){let t=new P,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?pi({id:"workbench.action.openChatStatusItemLink",label:d(6782,null),tooltip:d(6782,null),class:q.asClassName(M.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 lS(t).nodes)if(typeof n=="string"){let r=Bn(n);e.append(...r)}else o.add(new Xg(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===6||this.chatEntitlementService.entitlement===7)){let h=t.add(new Mi(u,{...Ko,secondary:!0,hoverDelegate:US}));h.label=d(6766,null),t.add(h.onDidClick(()=>this.runCommandAndClose(()=>this.openerService.open(A.parse(NA.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(6791,null):h.overageCount?s.textContent=d(6787,null,this.quotaOverageFormatter.value.format(h.overageCount)):s.textContent=d(6786,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(6750,null),_("br"),d(6751,null)):c.textContent=d(6752,null):c.textContent=""};return p(o),p}createSettings(e,t){let o=this.editorService.activeTextEditorLanguageId,n=e.appendChild(_("div.settings"));{let r=R(n,_("div.setting"));if(this.createInlineSuggestionsSetting(r,d(6796,null),"*",t),o){let s=R(n,_("div.setting"));this.createInlineSuggestionsSetting(s,d(6797,null,this.languageService.getLanguageName(o)??o),o,t)}}{let r=R(n,_("div.setting"));this.createNextEditSuggestionsSetting(r,d(6798,null),this.getCompletionsSettingAccessor(o),t)}return n}createSetting(e,t,o,n,r){let s=r.add(new hv(o,!!n.readSetting(),{...kf}));e.appendChild(s.domNode);let l=R(e,_("span.setting-label",void 0,o));return r.add(ws.addTarget(l)),[re.CLICK,Gn.Tap].forEach(c=>{r.add(j(l,c,u=>{s?.enabled&&($t.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,[NA.completionsEnablementSetting],t,this.getCompletionsSettingAccessor(o),n)}getCompletionsSettingAccessor(e="*"){let t=NA.completionsEnablementSetting;return{readSetting:()=>zSe(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 yi(n)||(n=Object.create(null)),this.configurationService.updateValue(t,{...n,[e]:o})}}}createNextEditSuggestionsSetting(e,t,o,n){let r=NA.nextEditSuggestionsSetting,s=NA.completionsEnablementSetting,l=no.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=zSe(this.configurationService),v=zSe(this.configurationService,this.editorService.activeTextEditorLanguageId);return f||v},r=o.add(new Mi(e,{disabled:!n(),...Ko,hoverDelegate:US,secondary:!0})),s=e.appendChild(_("span.snooze-label")),l=e.appendChild(_("div.snooze-action-bar")),c=o.add(new ji(l,{hoverDelegate:US})),u=pi({id:"workbench.action.cancelSnoozeStatusBarLink",label:d(6754,null),run:()=>this.inlineCompletionsService.cancelSnooze(),class:q.asClassName(M.stopCircle)}),p=f=>{e.classList.toggle("disabled",!f),c.clear();let v=this.inlineCompletionsService.snoozeTimeLeft;if(!f||v<=0)return s.textContent=d(6760,null),s.title="",r.label=t,r.setTitle(d(6759,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(6758,null)}`,s.title=d(6762,null),r.label=d(6757,null),r.setTitle(d(6761,null)),c.push([u],{icon:!0,label:!1}),!1},h=o.add(new P);function g(){h.clear();let f=n();p(f)||h.add(MI(Me(e),()=>p(f),1e3))}g(),o.add(r.onDidClick(()=>{this.inlineCompletionsService.snooze(),p(n())})),o.add(this.configurationService.onDidChangeConfiguration(f=>{f.affectsConfiguration(NA.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(6764,null):void 0,picked:r.id===t.currentModelId})),n=await this.quickInputService.pick(o,{placeHolder:d(6793,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(6765,null):void 0,picked:r.id===t.currentValueId})),n=await this.quickInputService.pick(o,{placeHolder:d(6795,null,t.label),canPickMany:!1});n&&n.id&&n.id!==t.currentValueId&&await e.setProviderOption(t.id,n.id),this.hoverService.hideHover(!0)}};HFe=I([m(0,vr),m(1,n7e),m(2,ge),m(3,B),m(4,ee),m(5,tt),m(6,kt),m(7,Qe),m(8,Te),m(9,Nn),m(10,ej),m(11,Ls),m(12,Qn),m(13,zt),m(14,Ge),m(15,Ft)],HFe);var nge=class extends C{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(to.defaultChatAgent?.completionsEnablementSetting)&&this.update()}))}onDidActiveEditorChange(){this.update(),this.activeCodeEditorListener.clear();let e=ca(this.editorService.activeTextEditorControl);e&&(this.activeCodeEditorListener.value=e.onDidChangeModelLanguage(()=>{this.update()}))}getEntryProps(){let e="$(copilot)",t=d(6813,null),o;if(OKt(this.chatEntitlementService)){let r=this.chatEntitlementService.entitlement;if(this.chatEntitlementService.sentiment.later||r===3||dP(r)||r===5){let s=d(6818,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(6817,null);else if(this.runningSessionsCount>0)e="$(copilot-in-progress)",this.runningSessionsCount>1?t=d(6811,null,this.runningSessionsCount):t=d(6810,null);else if(this.chatEntitlementService.entitlement===1){let l=d(6819,null);e=`${this.chatEntitlementService.anonymous?"$(copilot)":"$(copilot-not-connected)"} ${l}`,t=l,o="prominent"}else if(this.chatEntitlementService.entitlement===5&&(r||s)){let l;r&&!s?l=d(6809,null):s&&!r?l=d(6815,null):l=d(6808,null),e=`$(copilot-warning) ${l}`,t=l,o="prominent"}else this.editorService.activeTextEditorLanguageId&&!zSe(this.configurationService,this.editorService.activeTextEditorLanguageId)?(e="$(copilot-unavailable)",t=d(6814,null)):this.completionsService.isSnoozing()&&(e="$(copilot-snooze)",t=d(6816,null))}return{name:d(6812,null),text:e,ariaLabel:t,command:GL,showInAllWindows:!0,kind:o,tooltip:{element:r=>{let s=new P;s.add(r.onCancellationRequested(()=>{s.dispose()}));let l=HFe.instantiateInContents(this.instantiationService,s);return s.add(MI(It,()=>{l.isConnected||s.dispose()},2e3)),l}}}}dispose(){super.dispose(),this.entry?.dispose(),this.entry=void 0}};nge=I([m(0,vr),m(1,F),m(2,Tr),m(3,ee),m(4,B),m(5,ej),m(6,Ls)],nge);var FKt=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 D8="chat",WKt="chat-session-detail",Obo="chat-session-text",Fbo="chat-variable-text";function vLi(a,i){return i?`${a.id}__${i}`:a.id}function Cin(a){return a instanceof pb&&!a.text.trim().length||a instanceof Qx}function VKt(a,i){let e=a.indexOf(i);if(a.length>e+2)return!1;let t=a[e+1];return t&&t instanceof pb&&t.text===" "}function BKt(a){return{startLineNumber:a.editorRange.startLineNumber,endLineNumber:a.editorRange.endLineNumber,startColumn:a.editorRange.endColumn+1,endColumn:1e3}}var rge=class extends C{constructor(e,t,o,n,r,s){super();this.widget=e;this.codeEditorService=t;this.themeService=o;this.chatAgentService=n;this.labelService=r;this.promptsService=s;this.id="inputEditorDecorations";this.previouslyUsedAgents=new Set;this.viewModelDisposables=this._register(new me);this.updateThrottle=this._register(new ya(rge.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(l=>{this.previouslyUsedAgents.add(vLi(l.agent,l.slashCommand?.name))})),this._register(this.chatAgentService.onDidChangeAgents(()=>this.triggerInputEditorDecorationsUpdate())),this._register(this.promptsService.onDidChangeSlashCommands(()=>this.triggerInputEditorDecorationsUpdate())),this._register(he(l=>{let c=this.widget.input.currentModeObs.read(l);c&&c.description.read(l),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(D8,WKt,{})),this._register(this.codeEditorService.registerDecorationType(D8,Obo,{color:If(y3),backgroundColor:If(I3),borderRadius:"3px"})),this._register(this.codeEditorService.registerDecorationType(D8,Fbo,{color:If(y3),backgroundColor:If(I3),borderRadius:"3px"})),this._register(this.codeEditorService.registerDecorationType(D8,Tdi,{color:If(y3),backgroundColor:If(I3),borderRadius:"3px",rangeBehavior:1}))}getPlaceholderColor(){return this.themeService.getColorTheme().getColor(u9)?.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(D8,WKt,f);return}this.updateAriaPlaceholder(void 0);let o=this.widget.parsedInput.parts,n,r=o.find(p=>p instanceof zu),s=o.find(p=>p instanceof Pf);if(r&&o.every(p=>p instanceof pb&&!p.text.trim().length||p instanceof zu)){let h=this.previouslyUsedAgents.has(vLi(r.agent,void 0))&&r.agent.metadata.followupPlaceholder;r.agent.description&&VKt(o,r)&&(n=[{range:BKt(r),renderOptions:{after:{contentText:h?r.agent.metadata.followupPlaceholder:r.agent.description,color:this.getPlaceholderColor()}}}])}if(r&&s&&o.every(p=>p instanceof pb&&!p.text.trim().length||p instanceof zu||p instanceof Pf)){let h=this.previouslyUsedAgents.has(vLi(r.agent,s.command.name))&&s.command.followupPlaceholder;s?.command.description&&VKt(o,s)&&(n=[{range:BKt(s),renderOptions:{after:{contentText:h?s.command.followupPlaceholder:s.command.description,color:this.getPlaceholderColor()}}}])}s&&o.every(p=>p instanceof pb&&!p.text.trim().length||p instanceof Pf)&&s?.command.description&&VKt(o,s)&&(n=[{range:BKt(s),renderOptions:{after:{contentText:s.command.description,color:this.getPlaceholderColor()}}}]),this.widget.inputEditor.setDecorationsByType(D8,WKt,n??[])}async updateAsyncInputEditorDecorations(e){let t=this.widget.parsedInput.parts,o=t.find(f=>f instanceof zu),n=t.find(f=>f instanceof Pf),r=t.find(f=>f instanceof jx),s=t.find(f=>f instanceof Qx),l=s?await this.promptsService.resolvePromptSlashCommand(s.name,e):void 0;if(e.isCancellationRequested)return;if(s&&l&&s&&t.every(Cin)&&VKt(t,s)&&l){let v=l.argumentHint??l.description;v&&this.widget.inputEditor.setDecorationsByType(D8,WKt,[{range:BKt(s),renderOptions:{after:{contentText:v,color:this.getPlaceholderColor()}}}])}let c=[];o&&c.push({range:o.editorRange}),n&&c.push({range:n.editorRange,hoverMessage:new xe(n.command.description)}),r&&c.push({range:r.editorRange}),s&&l&&c.push({range:s.editorRange}),this.widget.inputEditor.setDecorationsByType(D8,Obo,c);let u=[],p=t.filter(f=>f instanceof ZS||f instanceof OO);for(let f of p)u.push({range:f.editorRange});let h=t.filter(f=>f instanceof tR);if(!!this.widget.viewModel?.editing)for(let f of h)u.push({range:f.editorRange,hoverMessage:A.isUri(f.data)?new xe(this.labelService.getUriLabel(f.data,{relative:!0})):void 0});this.widget.inputEditor.setDecorationsByType(D8,Fbo,u)}updateAriaPlaceholder(e){let t=iae.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=bvt.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")}}}};rge=I([m(1,Kt),m(2,De),m(3,br),m(4,ot),m(5,nr)],rge);var bLi=class extends C{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=`${vg}${e.name} ${yu}${t.name} `:e.metadata.isSticky&&(o=`${vg}${e.name} `),o&&(this.widget.inputEditor.setValue(o),this.widget.inputEditor.setPosition({lineNumber:1,column:o.length+1}))}};Cw.CONTRIBS.push(rge,bLi);var int=class extends C{constructor(e,t){super();this.widget=e;this.instantiationService=t;this.id="chatTokenDeleter";let o=this.instantiationService.createInstance(AE),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(WO(this.widget),gz(this.widget),r,this.widget.location,{selectedAgent:s,mode:this.widget.input.currentModeKind,attachmentCapabilities:u}).parts.filter(g=>g instanceof zu||g instanceof Pf||g instanceof jx||g instanceof Qx||g instanceof ZS).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}))}};int=I([m(1,F)],int);Cw.CONTRIBS.push(int);var Wbo=_,Vbo=bt,UFe=class{constructor(i,e,t){this.keybindingService=t;let o=Vbo(".chat-editor-hover-wrapper@root",[Vbo(".chat-editor-hover-wrapper-content@content")]);if(this.domNode=o.root,o.content.appendChild(i),e&&e.length>0){let n=Wbo(".hover-row.status-bar"),r=Wbo(".actions");e.forEach(s=>{let l=this.keybindingService.lookupKeybinding(s.commandId),c=l?l.getLabel():null;t7.render(r,{label:s.label,commandId:s.commandId,run:u=>{s.run(u)},iconClass:s.iconClass},c)}),n.appendChild(r),this.domNode.appendChild(n)}}};UFe=I([m(2,_e)],UFe);var ont=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}=TYi(t.parsedInput);return o?z.containsPosition(o.editorRange,i.range.getStartPosition())?[new SLi(this,z.lift(o.editorRange),o.agent)]:[]:[]}renderHoverParts(i,e){if(!e.length)return new Lx([]);let t=new P,o=t.add(this.instantiationService.createInstance(l2));t.add(o.onDidChangeContents(()=>i.onContentsChanged()));let n=e[0],r=n.agent;o.setAgent(r.id);let s=KMe(()=>r,this.commandService).actions,c=this.instantiationService.createInstance(UFe,o.domNode,s).domNode;i.fragment.appendChild(c);let u={hoverPart:n,hoverElement:c,dispose(){t.dispose()}};return new Lx([u])}getAccessibleContent(i){return d(7439,null)}};ont=I([m(1,F),m(2,At),m(3,ge)],ont);var SLi=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}};d_.register(ont);var HKt=d(7046,null),UKt=d(7044,null),zFe=class extends C{constructor(e,t){super();this._storageKey=e;this._instantiationService=t;this._memoryStore=new Set;this._workspaceStore=new co(()=>this._register(this._instantiationService.createInstance(KFe,1,this._storageKey))),this._profileStore=new co(()=>this._register(this._instantiationService.createInstance(KFe,0,this._storageKey)))}setAutoConfirmation(e,t){this._workspaceStore.value.setAutoConfirm(e,!1),this._profileStore.value.setAutoConfirm(e,!1),this._memoryStore.delete(e),t==="workspace"?this._workspaceStore.value.setAutoConfirm(e,!0):t==="profile"?this._profileStore.value.setAutoConfirm(e,!0):t==="session"&&this._memoryStore.add(e)}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)}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)e.add(t);return e}},KFe=class extends C{constructor(e,t,o){super();this._scope=e;this._storageKey=t;this.storageService=o;this._autoConfirmTools=new il(100);this._didChange=!1;let n=o.getObject(this._storageKey,this._scope);if(n)for(let r of n)this._autoConfirmTools.set(r,!0);this._register(o.onWillSaveState(()=>{this._didChange&&(this.storageService.store(this._storageKey,[...this._autoConfirmTools.keys()],this._scope,1),this._didChange=!1)}))}reset(){this._autoConfirmTools.clear(),this._didChange=!0}getAutoConfirm(e){return this._autoConfirmTools.get(e)?(this._didChange=!0,!0):!1}setAutoConfirm(e,t){t?this._autoConfirmTools.set(e,!0):this._autoConfirmTools.delete(e),this._didChange=!0}getAll(){return[...this._autoConfirmTools.keys()]}};KFe=I([m(2,le)],KFe);var GFe=class extends C{constructor(e,t){super();this._instantiationService=e;this._quickInputService=t;this._contributions=new Map;this._preExecutionToolConfirmStore=this._register(new zFe("chat/autoconfirm",this._instantiationService)),this._postExecutionToolConfirmStore=this._register(new zFe("chat/autoconfirm-post",this._instantiationService)),this._preExecutionServerConfirmStore=this._register(new zFe("chat/servers/autoconfirm",this._instantiationService)),this._postExecutionServerConfirmStore=this._register(new zFe("chat/servers/autoconfirm-post",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;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(t.push({label:d(7032,null),detail:d(7035,null),divider:!!t.length,scope:"session",select:async()=>(this._preExecutionToolConfirmStore.setAutoConfirmation(e.toolId,"session"),!0)},{label:d(7036,null),detail:d(7039,null),scope:"workspace",select:async()=>(this._preExecutionToolConfirmStore.setAutoConfirmation(e.toolId,"workspace"),!0)},{label:d(7016,null),detail:d(7019,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(7024,null,n),detail:d(7027,null),divider:!0,scope:"session",select:async()=>(this._preExecutionServerConfirmStore.setAutoConfirmation(r,"session"),!0)},{label:d(7028,null,n),detail:d(7031,null),scope:"workspace",select:async()=>(this._preExecutionServerConfirmStore.setAutoConfirmation(r,"workspace"),!0)},{label:d(7020,null,n),detail:d(7023,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(7033,null),detail:d(7034,null),divider:!!t.length,scope:"session",select:async()=>(this._postExecutionToolConfirmStore.setAutoConfirmation(e.toolId,"session"),!0)},{label:d(7037,null),detail:d(7038,null),scope:"workspace",select:async()=>(this._postExecutionToolConfirmStore.setAutoConfirmation(e.toolId,"workspace"),!0)},{label:d(7017,null),detail:d(7018,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(7025,null,n),detail:d(7026,null),divider:!0,scope:"session",select:async()=>(this._postExecutionServerConfirmStore.setAutoConfirmation(r,"session"),!0)},{label:d(7029,null,n),detail:d(7030,null),scope:"workspace",select:async()=>(this._postExecutionServerConfirmStore.setAutoConfirmation(r,"workspace"),!0)},{label:d(7021,null,n),detail:d(7022,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)}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))}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(te=>te.id===G)?.canRequestPreApproval),w=Array.from(b.tools).some(G=>e.find(te=>te.id===G)?.canRequestPostApproval),k=this._preExecutionServerConfirmStore.getAutoConfirmationIn(v,l),T=this._postExecutionServerConfirmStore.getAutoConfirmationIn(v,l);for(let G of b.tools){let $=e.find(He=>He.id===G);if(!$)continue;let te=[],pe=!k&&($.canRequestPreApproval||this._preExecutionToolConfirmStore.getAutoConfirmationIn($.id,l)),de=!T&&($.canRequestPostApproval||this._postExecutionToolConfirmStore.getAutoConfirmationIn($.id,l));pe&&de&&(te.push({type:"tool-pre",toolId:$.id,label:HKt,checked:this._preExecutionToolConfirmStore.getAutoConfirmationIn($.id,l)}),te.push({type:"tool-post",toolId:$.id,label:UKt,checked:this._postExecutionToolConfirmStore.getAutoConfirmationIn($.id,l)}));let se=this._preExecutionToolConfirmStore.getAutoConfirmationIn($.id,l),Se=this._postExecutionToolConfirmStore.getAutoConfirmationIn($.id,l),ke,Ee;if(pe&&de)ke=se&&Se?!0:!se&&!Se?!1:"mixed";else if(pe)ke=se,Ee=HKt;else if(de)ke=Se,Ee=UKt;else continue;S.push({type:"tool",toolId:$.id,label:$.displayName||$.id,description:Ee,checked:ke,collapsed:!0,children:te.length>0?te:void 0})}S.sort((G,$)=>G.label.localeCompare($.label)),w&&S.unshift({type:"server-post",serverId:v,iconClass:q.asClassName(M.play),label:d(7043,null),checked:T}),y&&S.unshift({type:"server-pre",serverId:v,iconClass:q.asClassName(M.play),label:d(7045,null),checked:k});let N=this._preExecutionServerConfirmStore.getAutoConfirmationIn(v,l),O=this._postExecutionServerConfirmStore.getAutoConfirmationIn(v,l),V;y&&w?V=N&&O?!0:!N&&!O?!1:"mixed":y?V=N:w?V=O:V=!1;let U=p.itemTree.find(G=>G.serverId===v);g.push({type:"server",serverId:v,label:b.label,checked:V,children:S,collapsed:U?p.isCollapsed(U):!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(N=>({type:"manage",...N})));let w=!1,k,T=!1;if(b?.canUseDefaultApprovals!==!1){T=!0;let N=v.canRequestPreApproval||this._preExecutionToolConfirmStore.getAutoConfirmationIn(v.id,l),O=v.canRequestPostApproval||this._postExecutionToolConfirmStore.getAutoConfirmationIn(v.id,l);N&&O&&(S.push({type:"tool-pre",toolId:v.id,label:HKt,checked:this._preExecutionToolConfirmStore.getAutoConfirmationIn(v.id,l)}),S.push({type:"tool-post",toolId:v.id,label:UKt,checked:this._postExecutionToolConfirmStore.getAutoConfirmationIn(v.id,l)}));let V=this._preExecutionToolConfirmStore.getAutoConfirmationIn(v.id,l),U=this._postExecutionToolConfirmStore.getAutoConfirmationIn(v.id,l);N&&O?w=V&&U?!0:!V&&!U?!1:"mixed":N?(w=V,k=HKt):O?(w=U,k=UKt):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 P,p=u.add(this._quickInputService.createQuickTree());if(p.ignoreFocusOut=!0,p.sortByLabel=!1,l!=="session"){let g={iconClass:q.asClassName(M.folder),tooltip:d(7047,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(7041,null):p.placeholder=l==="workspace"?d(7042,null):d(7040,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);(v?.canRequestPostApproval||f==="never")&&this._postExecutionToolConfirmStore.setAutoConfirmation(g.toolId,f),(v?.canRequestPreApproval||f==="never")&&this._preExecutionToolConfirmStore.setAutoConfirmation(g.toolId,f)}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)})),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))})),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();for(let e of this._contributions.values())e.reset?.()}};GFe=I([m(0,F),m(1,Ge)],GFe);var Bbo=oe.as(ea.JSONContribution);var xin="vscode.chat.tools.global.autoApprove.testMode",ILi="vscode_get_confirmation_with_options",nnt=L(7051,`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.`),OA=class extends C{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 k6;this.toolSets=Ce(this,e=>Array.from(this._toolSets.observable.read(e)).filter(o=>this.isPermitted(o,e)));this.allToolsIncludingDisableObs=ff({equalsFn:lN()},this.onDidChangeTools,()=>Array.from(this.getAllToolsIncludingDisabled()));this.toolsWithFullReferenceName=Ce(e=>{let t=[],o=new Set;for(let n of this.toolSets.read(e))if(n.source.type!=="user"){t.push([n,Hbo(n)]);for(let r of n.getTools())t.push([r,Iie(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,Iie(n)]);return t});this._isAgentModeEnabled=pr("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(H.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(Rn.Internal,"vscode",Kj.vscode,{icon:q.fromId(M.vscode.id),description:d(7055,null)})),this.executeToolSet=this._register(this.createToolSet(Rn.Internal,"execute",jp.execute,{icon:q.fromId(M.terminal.id),description:d(7053,null)})),this.readToolSet=this._register(this.createToolSet(Rn.Internal,"read",jp.read,{icon:q.fromId(M.book.id),description:d(7054,null)})),this.agentToolSet=this._register(this.createToolSet(Rn.Internal,"agent",jp.agent,{icon:q.fromId(M.agent.id),description:d(7052,null)}))}isPermitted(e,t){if(this._isAgentModeEnabled.read(t)!==!1||!Km(e)&&e.canBeReferencedInPrompt===!1&&e.source.type==="internal")return!0;let n=[jp.read,jp.search,jp.web];if(Km(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(jp.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 P;let o=q8e(e.id).toString();Bbo.registerSchema(o,e.inputSchema,t),t.add(Bbo.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 hn(this.registerToolData(e),this.registerToolImplementation(e.id,t))}getTools(e){let t=ht.map(this._tools.values(),n=>n.data),o=this._configurationService.getValue("chat.extensionTools.enabled");return ht.filter(t,n=>{let r=!n.when||this._contextKeyService.contextMatchesRules(n.when),s=n.source.type!=="extension"||!!o,l=this.isPermitted(n),c=_Tt(n,e);return r&&s&&l&&c})}observeTools(e){let t=Ce(o=>{let n=Wc("observeToolsContext"),r=()=>Ui(s=>n.trigger(s));return o.store.add(this.onDidChangeTools(r)),n});return hs({equalsFn:lN()},o=>(t.read(o).read(o),Array.from(this.getTools(e))))}getAllToolsIncludingDisabled(){let e=ht.map(this._tools.values(),o=>o.data),t=this._configurationService.getValue("chat.extensionTools.enabled");return ht.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(7061,null),l=d(7059,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=JZ.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=q8e(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: ${In(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 ho;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 P,this._callsByRequestId.has(u)||this._callsByRequestId.set(u,[]);let w={store:p};this._callsByRequestId.get(u).push(w);let k=new $e;p.add(Z(()=>{k.dispose(!0)})),p.add(o.onCancellationRequested((()=>{lo.confirmWith(c,{type:0}),k.cancel()}))),p.add(k.token.onCancellationRequested(()=>{lo.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=En.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 JZ(y,g.data,e.callId,e.subAgentInvocationId,e.parameters),k&&lo.confirmWith(c,k),this._chatService.appendProgress(s,c)),e.toolSpecificData=c?.toolSpecificData,y?.confirmationMessages?.title){!lo.executionConfirmedOrDenied(c)&&!k&&this.playAccessibilitySignal([c],e.context?.sessionResource);let N=await lo.awaitConfirmation(c,o);if(N.type===0)throw new ho;if(N.type===5)return v={content:[{kind:"text",value:"The user chose to skip the tool call, they want to proceed without running it"}]},v;N.type===4&&N.selectedButton&&(e.selectedCustomButton=N.selectedButton),e.toolSpecificData?.kind==="input"&&(e.parameters=e.toolSpecificData.rawInput,e.toolSpecificData=void 0)}}else{b=En.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:qa(y.confirmationMessages.title),detail:qa(y.confirmationMessages.message)})).confirmed)throw new ho;e.toolSpecificData=y?.toolSpecificData}if(o.isCancellationRequested)throw new ho;S=En.create(!0),v=await g.impl.invoke(e,t,{report:k=>{c?.acceptProgress(k)}},o),S.stop(),this.ensureToolDetails(e,v,g.data);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===lo.StateKind.WaitingForPostApproval){let k=await lo.awaitPostConfirmation(c,o);if(k.type===0)throw new ho;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?P_(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=so(w)?"userCancelled":"error";throw this._telemetryService.publicLog2("languageModelToolInvoked",{result:k,chatSessionId:e.context?.sessionResource?P_(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()}),so(w)||this._logService.error(`[LanguageModelToolsService#invokeTool] Error from tool ${e.toolId} with parameters ${JSON.stringify(e.parameters)}:
${In(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(7067,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(7060,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 l=e.permissionDecisionReason,c=l?d(7064,null,"PreToolUse",l):d(7065,null,"PreToolUse"),u=n.confirmationMessages;if(n.toolSpecificData?.kind==="terminal"){let p=u.disclaimer?typeof u.disclaimer=="string"?u.disclaimer:u.disclaimer.value:void 0,h=p?`${c}

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

${p}`),allowAutoConfirm:!1}}}else{n||(n={});let l=Iie(t.data),c=e.permissionDecisionReason,u=c?d(7063,null,"PreToolUse",c):d(7062,null,"PreToolUse");n.confirmationMessages={...n.confirmationMessages,title:d(7066,null,l),message:new xe(`_${u}_`),allowAutoConfirm:!1},n.toolSpecificData={kind:"input",rawInput:o.parameters}}return{autoConfirmed:void 0,preparedInvocation:n}}return{autoConfirmed:await this.shouldAutoConfirm(t.data.id,t.data.runsInWorkspace,t.data.source,o.parameters,r,o.chatRequestId),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([Pi(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=Iie(e.data);r.confirmationMessages={...r.confirmationMessages,title:d(7058,null),message:d(7057,null,l),disclaimer:e.data.id===ILi?void 0:new xe(d(7056,null,Iie(e.data),qy({title:"`chat.tools.eligibleForAutoApproval`",id:"workbench.action.openSettings",arguments:["chat.tools.eligibleForAutoApproval"]},!1)),{isTrusted:!0}),allowAutoConfirm:!1}}return!s&&r?.confirmationMessages?.title&&(r.confirmationMessages.disclaimer=e.data.id===ILi?void 0:new xe(d(7056,null,Iie(e.data),qy({title:"`chat.tools.eligibleForAutoApproval`",id:"workbench.action.openSettings",arguments:["chat.tools.eligibleForAutoApproval"]},!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=JZ.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,ve.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(pz(u?.modeInfo?.permissionLevel)||this._isSessionLiveAutoApproveLevel(t))return}let n=e.filter(c=>!lo.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(Vki,n),userGesture:!0,modality:s?void 0:"announcement"})}ensureToolDetails(e,t,o){!t.toolResultDetails&&o.alwaysDisplayInputOutput&&(t.toolResultDetails={input:this.formatToolInput(e),output:this.toolResultToIO(t)})}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:$8e(t)};if(t.kind==="data")return{type:"embed",value:Qd(t.value.data),mimeType:t.value.mimeType};Hr(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&&pz(t.input.currentModeInfo.permissionLevel)}getEligibleForAutoApprovalSpecialCase(e){if(e.id==="vscode_fetchWebPage_internal")return"fetch"}isToolEligibleForAutoApproval(e){let t=this.getEligibleForAutoApprovalSpecialCase(e)??Iie(e);if(e.id==="copilot_fetchWebPage")return!0;if(e.id===ILi)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){let l=this._tools.get(e);if(!l)return;if(r&&!this._isAutoApprovePolicyRestricted()){let f=this._chatService.getSession(r)?.getRequests().at(-1);if(pz(f?.modeInfo?.permissionLevel)||this._isSessionLiveAutoApproveLevel(r))return{type:1,reason:"auto-approve-all"}}if(!this.isToolEligibleForAutoApproval(l.data))return;let c=this._confirmationService.getPreConfirmAction({toolId:e,source:o,parameters:n,chatSessionResource:r});if(c)return c;let u=this._configurationService.inspect("chat.tools.global.autoApprove"),p=u.value??u.defaultValue;if(typeof t=="boolean"&&(p=u.userLocalValue??u.applicationValue,t&&(p=u.workspaceValue??u.workspaceFolderValue??u.userRemoteValue??p)),(p===!0||typeof p=="object"&&p.hasOwnProperty(e)&&p[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(pz(c?.modeInfo?.permissionLevel)||this._isSessionLiveAutoApproveLevel(r))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(xin)===!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 P;try{let t=new $e;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:gt.Warning,message:d(7050,null),buttons:[{label:d(7049,null),run:()=>!0},{label:d(7048,null),run:()=>!1}],custom:{icon:M.warning,markdownDetails:[{markdown:new xe(nnt.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 OA.githubMCPServerAliases)yield o+"/*";break;case"playwright":for(let o of OA.playwrightMCPServerAliases)yield o+"/*";break;case jp.execute:yield"shell";break;case jp.agent:yield Kj.runSubagent,yield"custom-agent";break}}*getToolAliases(e,t){let o=e.toolReferenceName??e.displayName;if(t!==o&&o!==Kj.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 OA.githubMCPServerAliases)yield r+t.substring(n);break;case"playwright":for(let r of OA.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(Km(r)){let l=o.has(s)||ht.some(this.getToolSetAliases(r,s),u=>o.has(u)),c=t?new G8e(r,t):r;if(n.set(c,l),l)for(let u of c.getTools())n.set(u,!0)}else{if(t&&!_Tt(r,t))continue;if(!n.has(r)){let l=o.has(s)||ht.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=ht.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(Km(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&&(Km(r)?o.push(CTt(r,n.range)):o.push(Dce(r,n.range)))}return o}getToolSetsForModel(e,t){return e?ht.map(this.toolSets.read(t),o=>new G8e(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 OA.githubMCPServerAliases.includes(e)?"github":OA.playwrightMCPServerAliases.includes(e)?"playwright":e}createToolSet(e,t,o,n){let r=this;o=this.getSpecedToolSetName(o);let s=new class extends hke{dispose(){r._toolSets.has(s)&&(this._tools.clear(),r._toolSets.delete(s))}}(t,o,n?.icon??M.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(Km(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(Km(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=Km(t)?this.getToolSetAliases(t,o):this.getToolAliases(t,o);if(ht.some(n,r=>e===r))return t}}getFullReferenceName(e,t){return Km(e)?Hbo(e):Iie(e,t)}};OA=I([m(0,F),m(1,lt),m(2,X),m(3,Si),m(4,ct),m(5,Te),m(6,ne),m(7,B),m(8,Bi),m(9,tr),m(10,le),m(11,gD),m(12,ge),m(13,At)],OA);function Iie(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 Hbo(a){return a.source.type==="mcp"?`${a.referenceName}/*`:a.referenceName}var zKt=".md";function Ubo(a){return[...a.entries()].map(([i,{hooks:e,originalId:t}])=>({type:i,hooks:e,originalId:t}))}function zbo(a,i){let e=i.getWorkspace().folders[0];return(i.getWorkspaceFolder(a)??e)?.uri}var rnt=class{constructor(i){this._workspaceContextService=i;this.format=0;this.manifestPaths=["plugin.json"];this.hookConfigPaths=["hooks.json"];this.hookWatchPaths=["hooks.json"]}parseHooks(i,e,t){let o=zbo(e,this._workspaceContextService);return Ubo(_1t(i,o,t))}};rnt=I([m(0,Pe)],rnt);var kin=/[\s&|<>()^;!`"']/;function Ein(a,i,e="${CLAUDE_PLUGIN_ROOT}"){if(!a.includes(e))return a;if(!kin.test(i))return a.replaceAll(e,i);let t=Yr(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,'\\"')+'"'})}var snt=class{constructor(i){this._workspaceContextService=i;this.format=1;this.manifestPaths=[".claude-plugin/plugin.json"];this.hookConfigPaths=["hooks/hooks.json"];this.hookWatchPaths=["hooks"]}parseHooks(i,e,t){let o="${CLAUDE_PLUGIN_ROOT}",n=e.fsPath,r=i,s=h=>{for(let g of["command","windows","linux","osx"])typeof h[g]=="string"&&(h[g]=Ein(h[g],n,o));h.env??={},h.env.CLAUDE_PLUGIN_ROOT=n};for(let h of Object.values(r.hooks??{}))if(Array.isArray(h))for(let g of h){if(!g||typeof g!="object")continue;let f=g;if(Array.isArray(f.hooks))for(let v of f.hooks)s(v);else s(f)}let l=h=>typeof h=="string"?h.replaceAll("${CLAUDE_PLUGIN_ROOT}",e.fsPath):void 0,c=zbo(e,this._workspaceContextService),{hooks:u,disabledAllHooks:p}=sot(Gk(i,l),c,t);return p?[]:Ubo(u)}};snt=I([m(0,Pe)],snt);var $Fe=class extends C{constructor(i,e){super();let t=pr("chat.plugins.enabled",!0,e),o=[];for(let n of oot.getAll()){let r=i.createInstance(n);this._register(r),o.push(r),r.start()}this.allPlugins=Ce(n=>t.read(n)?this._dedupeAndSort(o.flatMap(r=>r.plugins.read(n))):[]),this.plugins=Ce(n=>this.allPlugins.read(n).filter(s=>s.enabled.read(n)))}setPluginEnabled(i,e){let t=this.allPlugins.get().find(o=>o.uri.toString()===i.toString());t&&t.setEnabled(e)}_dedupeAndSort(i){let e=[],t=new Mn;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}};$Fe=I([m(0,F),m(1,B)],$Fe);var KKt=class extends C{constructor(e,t,o,n){super();this._fileService=e;this._pathService=t;this._logService=o;this._instantiationService=n;this._pluginEntries=new Map;this._plugins=Le("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,n.enabled,s,n.fromMarketplace,l=>n.setEnabled(l),()=>n.remove()))}}return this._disposePluginEntriesExcept(o),t.sort((n,r)=>n.uri.toString().localeCompare(r.uri.toString())),t}async _detectPluginFormatAdapter(e){return e.path.split("/").includes(".claude")||await this._pathExists(je(e,".claude-plugin","plugin.json"))?this._instantiationService.createInstance(snt):this._instantiationService.createInstance(rnt)}async _pathExists(e){try{return await this._fileService.resolve(e),!0}catch{return!1}}_toPlugin(e,t,o,n,r,s){let l=e.toString(),c=this._pluginEntries.get(l);if(c)if(c.adapter.format!==o.format)c.store.dispose(),this._pluginEntries.delete(l);else return c.plugin.enabled.set(t,void 0),c.plugin;let u=new P,p=Le("agentPluginCommands",[]),h=Le("agentPluginSkills",[]),g=Le("agentPluginAgents",[]),f=Le("agentPluginHooks",[]),v=Le("agentPluginMcpServerDefinitions",[]),b=Le("agentPluginEnabled",t),S=je(e,"commands"),y=je(e,"skills"),w=je(e,"agents"),k=u.add(new Dt(async()=>{p.set(await this._readCommands(e),void 0)},200)),T=u.add(new Dt(async()=>{h.set(await this._readSkills(e),void 0)},200)),N=u.add(new Dt(async()=>{g.set(await this._readAgents(e),void 0)},200)),O=u.add(new Dt(async()=>{f.set(await this._readHooks(e,o),void 0)},200)),V=u.add(new Dt(async()=>{v.set(await this._readMcpDefinitions(e,o),void 0)},200));u.add(this._fileService.watch(e,{recursive:!0,excludes:[]})),u.add(this._fileService.onDidFilesChange(G=>{G.affects(S)&&k.schedule(),G.affects(y)&&T.schedule(),G.affects(w)&&N.schedule(),o.hookWatchPaths.some($=>G.affects(je(e,$)))&&O.schedule(),(G.affects(je(e,".mcp.json"))||o.manifestPaths.some($=>G.affects(je(e,$))))&&(V.schedule(),O.schedule())})),k.schedule(),T.schedule(),N.schedule(),O.schedule(),V.schedule();let U={uri:e,label:n?.name??Ye(e),enabled:b,setEnabled:r,remove:s,hooks:f,commands:p,skills:h,agents:g,mcpServerDefinitions:v,fromMarketplace:n};return this._pluginEntries.set(l,{store:u,plugin:U,adapter:o}),U}async _readMcpDefinitions(e,t){let o=je(e,".mcp.json"),n=await this._readJsonFile(o),r=this._parseMcpServerDefinitionMap(n),s=await this._readInlinePluginJsonMcpDefinitions(e,t),l=new Map;for(let u of r)l.set(u.name,u.configuration);for(let u of s)l.has(u.name)||l.set(u.name,u.configuration);return[...l.entries()].map(([u,p])=>({name:u,configuration:p})).sort((u,p)=>u.name.localeCompare(p.name))}async _readInlinePluginJsonMcpDefinitions(e,t){for(let o of t.manifestPaths.map(n=>je(e,n))){let n=await this._readJsonFile(o);if(!n||typeof n!="object")continue;let r=this._parseMcpServerDefinitionMap(n);if(r.length>0)return r}return[]}_parseMcpServerDefinitionMap(e){if(!e||typeof e!="object"||!e.hasOwnProperty("mcpServers"))return[];let t=[];for(let[o,n]of Object.entries(e.mcpServers)){let r=this._normalizeMcpServerConfiguration(n);r&&t.push({name:o,configuration:r})}return t}_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 _readHooks(e,t){let o=(await this._pathService.userHome()).fsPath;for(let n of t.hookConfigPaths.map(r=>je(e,r))){let r=await this._readJsonFile(n);if(r)try{return t.parseHooks(r,e,o)}catch(s){this._logService.info(`[ConfiguredAgentPluginDiscovery] Failed to parse hooks from ${n.toString()}:`,s)}}for(let n of t.manifestPaths.map(r=>je(e,r))){let r=await this._readJsonFile(n);if(r&&typeof r=="object"){let s=r.hooks;if(s&&typeof s=="object")try{return t.parseHooks({hooks:s},e,o)}catch(l){this._logService.info(`[ConfiguredAgentPluginDiscovery] Failed to parse hooks from manifest ${n.toString()}:`,l)}}}return[]}async _readJsonFile(e){try{let t=await this._fileService.readFile(e);return Ur(t.value.toString())}catch{return}}async _readSkills(e){let t=je(e,"skills"),o;try{o=await this._fileService.resolve(t)}catch{return[]}if(!o.isDirectory||!o.children)return[];let n=[];for(let r of o.children){let s=A.joinPath(r.resource,"SKILL.md");await this._pathExists(s)&&n.push({uri:s,name:Ye(r.resource)})}return n.sort((r,s)=>r.name.localeCompare(s.name)),n}async _readAgents(e){let t=je(e,"agents"),o;try{o=await this._fileService.resolve(t)}catch{return[]}if(!o.isDirectory||!o.children)return[];let n=[];for(let r of o.children){if(!r.isFile||ms(r.resource).toLowerCase()!==zKt)continue;let s=Ye(r.resource).slice(0,-zKt.length);n.push({uri:r.resource,name:s})}return n.sort((r,s)=>r.name.localeCompare(s.name)),n}async _readCommands(e){let t=je(e,"commands"),o;try{o=await this._fileService.resolve(t)}catch{return[]}if(!o.isDirectory||!o.children)return[];let n=[];for(let r of o.children){if(!r.isFile||ms(r.resource).toLowerCase()!==zKt)continue;let s=Ye(r.resource).slice(0,-zKt.length);n.push({uri:r.resource,name:s})}return n.sort((r,s)=>r.name.localeCompare(s.name)),n}_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()}},qFe=class extends KKt{constructor(e,t,o,n,r,s,l){super(t,r,s,l);this._configurationService=e;this._pluginMarketplaceService=o;this._workspaceContextService=n;this._pluginLocationsConfig=pr("chat.pluginLocations",{},e)}start(){let e=this._register(new Dt(()=>this._refreshPlugins(),0));this._register(he(t=>{this._pluginLocationsConfig.read(t),e.schedule()})),e.schedule()}async _discoverPluginSources(){let e=[],t=this._pluginLocationsConfig.get(),o=await this._getUserHome();for(let[n,r]of Object.entries(t)){if(!n.trim())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,enabled:r,fromMarketplace:u,setEnabled:h=>this._updatePluginPathEnabled(p,h),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=v9(e,t)),Ms.isAbsolute(e)||Lo.isAbsolute(e)?[A.file(e)]:this._workspaceContextService.getWorkspace().folders.map(o=>je(o.uri,e))}_updatePluginPathEnabled(e,t){let o=this._configurationService.inspect("chat.pluginLocations"),n=[6,5,3,4,2,1];for(let s of n){let l=ose(o,s);if(l&&Object.prototype.hasOwnProperty.call(l,e)){this._configurationService.updateValue("chat.pluginLocations",{...l,[e]:t},s);return}}let r=ose(o,3)??{};this._configurationService.updateValue("chat.pluginLocations",{...r,[e]:t},3)}_removePluginPath(e){let t=this._configurationService.inspect("chat.pluginLocations"),o=[6,5,3,4,2,1];for(let n of o){let r=ose(t,n);if(r&&Object.prototype.hasOwnProperty.call(r,e)){let s={...r};delete s[e],this._configurationService.updateValue("chat.pluginLocations",s,n);return}}}};qFe=I([m(0,B),m(1,be),m(2,QB),m(3,Pe),m(4,wn),m(5,ne),m(6,F)],qFe);var jFe=class extends KKt{constructor(e,t,o,n,r,s){super(o,n,r,s);this._pluginMarketplaceService=e;this._pluginRepositoryService=t}start(){let e=this._register(new Dt(()=>this._refreshPlugins(),0));this._register(he(t=>{this._pluginMarketplaceService.installedPlugins.read(t),e.schedule()})),e.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,enabled:o.enabled,fromMarketplace:o.plugin,setEnabled:r=>this._pluginMarketplaceService.setInstalledPluginEnabled(o.pluginUri,r),remove:()=>{this._pluginMarketplaceService.removeInstalledPlugin(o.pluginUri),this._pluginRepositoryService.cleanupPluginSource(o.plugin).catch(r=>{this._logService.error("[MarketplaceAgentPluginDiscovery] Failed to clean up plugin source",r)})}})}return t}};jFe=I([m(0,QB),m(1,lie),m(2,be),m(3,wn),m(4,ne),m(5,F)],jFe);function ant(a){switch(a){case 1:return"file";case 2:return"workspace";case 3:return"exe"}}var yie=ae("IExtensionRecommendationNotificationService");var X2=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 oe.as(Ds.ExtensionFeaturesRegistry).getExtensionFeatures())r.push(p.id);let s={sort:n,category:o?gO.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 Tin=Re("extensions-editor-label-icon",M.extensions,d(10075,null)),J2=class a extends Us{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:Y.extension,path:Ld(this._extension.identifier.id,"extension")})}get extension(){return this._extension}getName(){return d(10076,null,this._extension.displayName)}getIcon(){return Tin}matches(e){return super.matches(e)?!0:e instanceof a&&Ot(this._extension.identifier,e._extension.identifier)}};var _in="vscode_searchExtensions_internal",yLi={id:_in,toolReferenceName:"extensions",legacyToolReferenceFullNames:["extensions"],icon:q.fromId(M.extensions.id),displayName:d(10083,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(10085,null),source:Rn.Internal,inputSchema:{type:"object",properties:{category:{type:"string",description:"The category of extensions to search for",enum:gO},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"}}}},QFe=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(10084,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))}]}}}};QFe=I([m(0,zi)],QFe);var wie=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}`}},Z2=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}`}},Cie=class{constructor(){this.kind=3;this.affinity=0}equals(i){return this.kind===i.kind}asString(){return"Remote"}};var Din=Re("runtime-extensions-editor-label-icon",M.extensions,d(10082,null)),w0=class a extends Us{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(10081,null)}getIcon(){return Din}matches(e){return super.matches(e)?!0:e instanceof a}};var xie=class extends pa{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super(xie.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 Fd,o=await this._extensionsWorkbenchService.queryLocal();for(let h of o)t.set(h.identifier.id,h);let n=this._extensionService.getExtensionsStatus(),r=new Fd,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=R(r,_(".extension")),l=R(s,_(".icon-container")),c=this._instantiationService.createInstance(c2,l),u=R(s,_("div.desc")),p=R(u,_(".header-container")),h=R(p,_(".header")),g=R(h,_("div.name")),f=R(h,_("span.version")),v=R(u,_("div.msg")),b=new ji(u),S=b.onDidRun(({error:N})=>N&&this._notificationService.error(N)),y=R(s,_(".time")),w=R(y,_("div.activation-time")),k=R(y,_("div.profile-time"));return{root:r,element:s,name:g,version:f,actionbar:b,activationTime:w,profileTime:k,msgContainer:v,set extension(N){c.extension=N||null},disposables:[c,b,S],elementDisposables:[]}},renderElement:(r,s,l)=>{l.elementDisposables=Ue(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}),dr(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(9467,null,f);else if(/^workspaceContains:/.test(v)){let b=v.substr(18);b.indexOf("*")>=0||b.indexOf("?")>=0?p=d(9471,null,b,f):p=d(9470,null,b,f)}else if(/^workspaceContainsTimeout:/.test(v)){let b=v.substr(25);p=d(9472,null,b,f)}else if(v==="onStartupFinished")p=d(9468,null,f);else if(/^onLanguage:/.test(v)){let b=v.substr(11);p=d(9461,null,b,f)}else p=d(9473,null,v,f)}else p=d(9460,null);if(l.elementDisposables.push(this._hoverService.setupManagedHover(Ni("mouse"),l.activationTime,p)),Rt(l.msgContainer),this._getUnresponsiveProfile(r.description.identifier)){let f=_("span",void 0,...Bn(" $(alert) Unresponsive")),v=d(9469,null);l.elementDisposables.push(this._hoverService.setupManagedHover(Ni("mouse"),f,v)),l.msgContainer.appendChild(f)}if(dr(r.status.runtimeErrors)){let f=_("span",void 0,...Bn(`$(bug) ${d(9459,null,r.status.runtimeErrors.length)}`));l.msgContainer.appendChild(f)}if(r.status.messages&&r.status.messages.length>0){let f=_("span",void 0,...Bn(`$(alert) ${r.status.messages[0].message}`));l.msgContainer.appendChild(f)}let h=null;if(r.status.runningLocation&&r.status.runningLocation.equals(new Z2(0)))h="$(globe) web worker";else if(r.description.extensionLocation.scheme===Y.vscodeRemote){let f=this._labelService.getHostLabel(Y.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 Z2?`$(globe) web worker ${r.status.runningLocation.affinity+1}`:`$(server-process) local process ${r.status.runningLocation.affinity+1}`);if(h){let f=_("span",void 0,...Bn(h));l.msgContainer.appendChild(f)}let g=oe.as(Ds.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,...Bn(`$(${b.severity===St.Error?gS.id:_u.id}) ${b.message}`)))),v?.accessTimes.length>0){let S=_("span",void 0,`${d(9462,null,f.label,v.accessTimes.length)}${v.current?d(9465,null,v.current.accessTimes.length):""}`);if(v.current){let y=d(9463,null,Bs(v.current.lastAccessed,!0,!0));l.elementDisposables.push(this._hoverService.setupManagedHover(Ni("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=Ue(r.disposables)}};this._list=this._instantiationService.createInstance(Rl,"RuntimeExtensions",e,o,[n],{multipleSelectionSupport:!1,setRowLineHeight:!1,horizontalScrolling:!1,overrideStyles:{listBackground:qo},accessibilityProvider:new class{getWidgetAriaLabel(){return d(9464,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 st("runtimeExtensionsEditor.action.copyId",d(9456,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 li),r.element.marketplaceInfo&&(s.push(new st("runtimeExtensionsEditor.action.disableWorkspace",d(9458,null),void 0,!0,()=>this._extensionsWorkbenchService.setEnablement(r.element.marketplaceInfo,11))),s.push(new st("runtimeExtensionsEditor.action.disable",d(9457,null),void 0,!0,()=>this._extensionsWorkbenchService.setEnablement(r.element.marketplaceInfo,10)))),s.push(new li);let c=this._menuService.getMenuActions(D.ExtensionEditorContextMenu,this.contextKeyService);s.push(...Ef(c).secondary),this._contextMenuService.showContextMenu({getAnchor:()=>r.anchor,getActions:()=>s})}))}layout(e){this._list?.layout(e.height)}};xie=I([m(1,Te),m(2,De),m(3,X),m(4,zi),m(5,lt),m(6,Ne),m(7,ze),m(8,F),m(9,le),m(10,ot),m(11,Vt),m(12,Wi),m(13,YI),m(14,tt),m(15,qt)],xie);var GKt=class extends K{constructor(){super({id:"workbench.action.showRuntimeExtensions",title:L(9466,"Show Running Extensions"),category:We.Developer,f1:!0,menu:{id:D.ViewContainerTitle,when:x.equals("viewContainer","workbench.view.extensions"),group:"2_enablement",order:3}})}async run(i){await i.get(ee).openEditor(w0.instance,{pinned:!0})}};var YFe=class extends C{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 Ei(Jb(e.publisher,e.name));return this.extensionService.extensions.some(o=>Ei.equals(o.identifier,t))?!!e.main||!!e.browser:!1}render(e){let t=new P,o=new Ei(Jb(e.publisher,e.name)),n=t.add(new E);return t.add(this.extensionService.onDidChangeExtensionsStatus(r=>{r.some(s=>Ei.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 Ei(Jb(e.publisher,e.name)),r=this.extensionService.getExtensionsStatus()[n.value];if(this.extensionService.extensions.some(l=>Ei.equals(l.identifier,n))){let l=new xe;l.appendMarkdown(`### ${d(9521,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=oe.as(Ds.ExtensionFeaturesRegistry).getExtensionFeatures();for(let l of s){let c=this.extensionFeaturesManagementService.getAccessData(n,l.id);if(c){if(this.renderMarkdown(new xe(`
 ### ${d(9529,null,l.label)}

`),o,t),c.accessTimes.length){let p=R(o,_(".feature-chart-description",void 0,d(9523,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 xe;u?.severity===gt.Error&&p.appendMarkdown(`$(${gS.id}) ${u.message}

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

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

`)}if(r.messages.length){l.appendMarkdown(`
 ### ${d(9530,null,r.messages.length)}
`);for(let c of r.messages)l.appendMarkdown(`$(${(c.type===gt.Error?M.error:c.type===gt.Warning?M.warning:M.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}));R(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=R(e,_(".feature-chart-container"));u.style.position="relative";let p=R(u,_(".feature-chart-tooltip"));p.style.position="absolute",p.style.width="0px",p.style.height="0px";let h=100,g=new Map;for(let U of t){let G=`${U.getDate()} ${U.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 U=0;U<=30;U++){let G=new Date(f);G.setDate(f.getDate()-(30-U));let $=`${G.getDate()} ${G.toLocaleString("default",{month:"short"})}`,te=g.get($)??0,pe=U/30*l,de=c-te/h*c;v.push({x:pe,y:de,date:$,count:te})}let b=R(u,_(".feature-chart")),S=R(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",wt(HXt)),w.setAttribute("stroke-width","1px"),y.appendChild(w);for(let U=1;U<=30;U+=7){let G=new Date(f);G.setDate(f.getDate()-(30-U));let $=`${G.getDate()} ${G.toLocaleString("default",{month:"short"})}`,te=U/30*l,pe=_.SVG("line");pe.setAttribute("x1",`${te}`),pe.setAttribute("y1",`${c}`),pe.setAttribute("x2",`${te}`),pe.setAttribute("y2",`${c+10}`),pe.setAttribute("stroke",wt(HXt)),pe.setAttribute("stroke-width","1px"),y.appendChild(pe);let de=_.SVG("line");de.setAttribute("x1",`${te}`),de.setAttribute("y1","0"),de.setAttribute("x2",`${te}`),de.setAttribute("y2",`${c}`),de.setAttribute("stroke",wt(Y2i)),de.setAttribute("stroke-width","1px"),y.appendChild(de);let se=_.SVG("text");se.setAttribute("x",`${te}`),se.setAttribute("y","250"),se.setAttribute("text-anchor","middle"),se.setAttribute("fill",wt(ko)),se.setAttribute("font-size","10px"),se.textContent=$,y.appendChild(se)}let k=_.SVG("polyline");k.setAttribute("fill","none"),k.setAttribute("stroke",wt(Q2i)),k.setAttribute("stroke-width","2px"),k.setAttribute("points",v.map(U=>`${U.x},${U.y}`).join(" ")),y.appendChild(k);let T=_.SVG("circle");T.setAttribute("r","4px"),T.style.display="none",y.appendChild(T);let N=o.add(new me),O=U=>{let G=S.getBoundingClientRect(),$=U.clientX-G.left-s.left,te,pe=1/0;v.forEach(de=>{let se=Math.abs(de.x-$);se<pe&&(pe=se,te=de)}),te?(T.setAttribute("cx",`${te.x}`),T.setAttribute("cy",`${te.y}`),T.style.display="block",p.style.left=`${te.x+24}px`,p.style.top=`${te.y+14}px`,N.value=this.hoverService.showInstantHover({content:new xe(`${te.date}: ${te.count} requests`),target:p,appearance:{showPointer:!0,skipFadeInAnimation:!0}})):N.value=void 0};o.add(j(S,re.MOUSE_MOVE,O));let V=()=>{T.style.display="none",N.value=void 0};o.add(j(S,re.MOUSE_LEAVE,V))}};YFe=I([m(0,lt),m(1,tt),m(2,YI),m(3,Qn)],YFe);var wLi={id:YFe.ID,label:d(9534,null),access:{canToggle:!1},renderer:new Mt(YFe)},XFe=class extends Jd{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 Ei(Jb(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){R(_(".no-features"),this.domNode).textContent=d(9531,null);return}let t=this._register(new vu(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:H.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:H.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()}},Wl.Distribute,void 0,!0),t.style({separatorBorder:this.theme.getColor(CEt)})}createFeaturesList(e){let t=this.instantiationService.createInstance(lnt,this.extensionId),o=new CLi;return this.instantiationService.createInstance(Rl,"ExtensionFeaturesList",R(e,_(".features-list-wrapper")),o,[t],{multipleSelectionSupport:!1,setRowLineHeight:!1,horizontalScrolling:!1,accessibilityProvider:{getAriaLabel(r){return r?.label??""},getWidgetAriaLabel(){return d(9527,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(cnt,this.extensionId,this.manifest,e),t.appendChild(this.featureView.value.domNode),this.layoutFeatureView())}getFeatures(){let e=oe.as(Ds.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(wLi);return t?.shouldRender(this.manifest)&&e.splice(0,0,wLi),t?.dispose(),e}getRenderer(e){return e.renderer?this.instantiationService.createInstance(e.renderer):void 0}};XFe=I([m(2,De),m(3,F)],XFe);var CLi=class{getHeight(){return 22}getTemplateId(){return"extensionFeatureDescriptor"}},lnt=class{constructor(i,e){this.extensionId=i;this.extensionFeaturesManagementService=e;this.templateId="extensionFeatureDescriptor"}renderTemplate(i){i.classList.add("extension-feature-list-item");let e=R(i,_(".extension-feature-label")),t=R(i,_(".extension-feature-disabled-label"));t.textContent=d(9533,null);let o=R(i,_(".extension-feature-status"));return{label:e,disabledElement:t,statusElement:o,disposables:new P}}renderElement(i,e,t){t.disposables.clear(),t.label.textContent=i.label,t.disabledElement.style.display=i.id===wLi.id||this.extensionFeaturesManagementService.isEnabled(this.extensionId,i.id)?"none":"inherit",t.disposables.add(this.extensionFeaturesManagementService.onDidChangeEnablement(({extension:r,featureId:s,enabled:l})=>{Ei.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} ${Px.className(r.current.status.severity)}`):t.statusElement.style.display="none"};n(),t.disposables.add(this.extensionFeaturesManagementService.onDidChangeAccessData(({extension:r,featureId:s})=>{Ei.equals(r,this.extensionId)&&s===i.id&&n()}))}disposeElement(i,e,t){t.disposables.dispose()}disposeTemplate(i){i.disposables.dispose()}};lnt=I([m(1,YI)],lnt);var cnt=class extends C{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=R(e,_(".feature-header")),o=R(t,_(".feature-title"));if(o.textContent=this.feature.label,this.feature.access.canToggle){let u=R(t,_(".feature-actions")),p=new Mi(u,Ko);this.updateButtonLabel(p),this._register(this.extensionFeaturesManagementService.onDidChangeEnablement(({extension:h,featureId:g})=>{Ei.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(9520,null,this.feature.label),message:h?d(9524,null,this.manifest.displayName??this.extensionId.value,this.feature.label):d(9526,null,this.manifest.displayName??this.extensionId.value,this.feature.label),custom:!0,primaryButton:h?d(9532,null):d(9528,null),cancelButton:d(9522,null)})).confirmed&&this.extensionFeaturesManagementService.setEnablement(this.extensionId,this.feature.id,!h)}))}let n=R(e,_(".feature-body")),r=_(".feature-body-content"),s=this._register(new Pa(r,{}));if(R(n,s.getDomNode()),this.layoutParticipants.push({layout:()=>s.scanDomNode()}),s.scanDomNode(),this.feature.description){let u=R(r,_(".feature-description"));u.textContent=this.feature.description}let l=this.extensionFeaturesManagementService.getAccessData(this.extensionId,this.feature.id);l?.current?.status&&R(r,_(".feature-status",void 0,_(`span${q.asCSSSelector(l.current.status.severity===gt.Error?gS:l.current.status.severity===gt.Warning?_u:kg)}`,void 0),_("span",void 0,l.current.status.message)));let c=R(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(9532,null):d(9525,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 P;return R(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(Mr(r)){let u=_("",void 0);this.renderMarkdown(r,u),c.push(u)}else if(l instanceof Ibe){let u=_("");o.add(new ah(u,zo,l_)).set(l),c.push(u)}else l instanceof Oe&&(c.push(_("span",{class:"colorBox",style:"background-color: "+Oe.Format.CSS.format(l)},"")),c.push(_("code",void 0,Oe.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}));R(t,o)}renderMarkdownAndTable(e,t){for(let o of e)if(Mr(o)){let n=_("",void 0);this.renderMarkdown(o,n),R(t,n)}else{let n=R(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))}};cnt=I([m(3,F),m(4,YI),m(5,ct),m(6,Qn)],cnt);var JFe="update.showCurrentReleaseNotes",Kbo="developer.showCurrentFileAsReleaseNotes";var xLi=class extends C{constructor(e){super();this._onChange=this._register(new E);this.onChange=this._onChange.event;this._currentId=null;let t=R(e,_(".navbar"));this.actions=[],this.actionbar=this._register(new ji(t))}get currentId(){return this._currentId}push(e,t,o){let n=new st(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=Ue(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 Lin=new Q("showPreReleaseVersion",!1),kLi=class extends gI{constructor(){super(...arguments);this._gallery=null}get gallery(){return this._gallery}set gallery(e){this.extension&&e&&!Ot(this.extension.identifier,e.identifier)||(this._gallery=e,this.update())}},ELi=class extends kLi{constructor(i,e){super(),this.element=R(i,_("code.version",void 0,"pre-release")),this._register(e.setupManagedHover(Ni("mouse"),this.element,d(9488,null))),this.render()}render(){this.extension?.preRelease?bn(this.element):xo(this.element)}},C0=class extends pa{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super(C0.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 P);this.transientDisposables=this._register(new P);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=R(e,_(".extension-editor"));this._scopedContextKeyService.value=this.contextKeyService.createScoped(t),this._scopedContextKeyService.value.createKey("inExtensionEditor",!0),this.showPreReleaseVersionContextKey=Lin.bindTo(this._scopedContextKeyService.value),t.tabIndex=0,t.style.outline="none",t.setAttribute("role","document");let o=R(t,_(".header")),n=R(o,_(".icon-container")),r=this.instantiationService.createInstance(c2,n),s=this.instantiationService.createInstance(Vee,n,!0),l=R(o,_(".details")),c=R(l,_(".title")),u=R(c,_("span.name.clickable",{role:"heading",tabIndex:0}));this._register(this.hoverService.setupManagedHover(Ni("mouse"),u,d(9504,null)));let p=new ELi(c,this.hoverService),h=R(c,_("span.preview"));this._register(this.hoverService.setupManagedHover(Ni("mouse"),h,d(9509,null))),h.textContent=d(9509,null);let g=R(c,_("span.builtin"));g.textContent=d(9476,null);let f=R(l,_(".subtitle")),v=[],b=R(f,_(".subtitle-entry"));v.push(b);let S=this.instantiationService.createInstance(Wee,b,!1),y=R(f,_(".subtitle-entry"));v.push(y);let w=this.instantiationService.createInstance(Bee,y,!1),k=R(f,_(".subtitle-entry"));v.push(k);let T=this.instantiationService.createInstance(MB,k,!1),N=R(f,_(".subtitle-entry"));v.push(N);let O=this.instantiationService.createInstance(Fee,N,!1),V=R(f,_(".subtitle-entry"));v.push(V);let U=this.instantiationService.createInstance(bPe,V),G=[r,s,p,S,w,T,O,U],$=R(l,_(".description")),te=this.instantiationService.createInstance(TZ),pe=[this.instantiationService.createInstance(zK),this.instantiationService.createInstance(UF),this.instantiationService.createInstance(nA,!0),this.instantiationService.createInstance(fk),this.instantiationService.createInstance(vk),this.instantiationService.createInstance(bk),this.instantiationService.createInstance(FR),this.instantiationService.createInstance(KC),this.instantiationService.createInstance(nRe),this.instantiationService.createInstance(dD),this.instantiationService.createInstance(rRe),this.instantiationService.createInstance(T4,!1),this.instantiationService.createInstance(_Z),this.instantiationService.createInstance(DZ),te,this.instantiationService.createInstance(uRe),this.instantiationService.createInstance(qK,"extensions.uninstall",iT.UninstallClass,[[this.instantiationService.createInstance(HF,!1),this.instantiationService.createInstance(iT),this.instantiationService.createInstance(oT,null,!0)]]),this.instantiationService.createInstance(zC),new AWt(this.scopedContextKeyService||this.contextKeyService,this.instantiationService)],de=R(l,_(".actions-status-container")),se=this._register(new ji(de,{actionViewItemProvider:(ti,bo)=>{if(ti instanceof fB)return ti.createActionViewItem(bo);if(ti instanceof qK)return new dRe(ti,{...bo,icon:!0,label:!0,menuActionsOrProvider:{getActions:()=>ti.menuActions},menuActionClassNames:ti.menuActionClassNames},this.contextMenuService);if(ti instanceof zC)return new OIt(void 0,ti,{...bo,icon:!0,label:!0,checkboxStyles:kf})},focusOnlyEnabledItems:!0}));se.push(pe,{icon:!0,label:!0}),se.setFocusable(!0),this._register(H.any(...pe.map(ti=>H.filter(ti.onDidChange,bo=>bo.enabled!==void 0)))(()=>{se.setFocusable(!1),se.setFocusable(!0)}));let Se=[],ke=this.instantiationService.createInstance(cD),Ee=this._register(this.instantiationService.createInstance(CPe,R(de,_(".status")),ke));Se.push(ke,new class extends gI{render(){de.classList.toggle("list-layout",this.extension?.state===1)}});let He=this.instantiationService.createInstance(xPe,R(l,_(".recommendation")));G.push(He),this._register(H.any(Ee.onDidRender,He.onDidRender)(()=>{this.dimension&&this.layout(this.dimension)}));let Ve=this.instantiationService.createInstance(dX,[...pe,...G,...Se]);for(let ti of[...pe,...G,...Se,Ve])this._register(ti);let Fe=H.chain(se.onDidRun,ti=>ti.map(({error:bo})=>bo).filter(bo=>!!bo));this._register(Fe(this.onError,this));let Qt=R(t,_(".body")),Ze=this._register(new xLi(Qt)),Ti=R(Qt,_(".content"));Ti.id=_t(),this.template={builtin:g,content:Ti,description:$,header:o,name:u,navbar:Ze,preview:h,actionsAndStatusContainer:de,extensionActionBar:se,set extension(ti){Ve.extension=ti;let bo;for(let Ro of v)Ro.classList.remove("last-non-empty"),Ro.children.length>0&&(bo=Ro);bo&&bo.classList.add("last-non-empty")},set gallery(ti){p.gallery=ti},set manifest(ti){te.manifest=ti}}}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;cn(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"||cn(t)||t===e.gallery?.properties.isPreReleaseVersion||t&&!e.hasPreReleaseVersion||!t&&!e.hasReleaseVersion?null:(await this.extensionGalleryService.getExtensions([{...e.identifier,preRelease:t,hasPreRelease:e.hasPreReleaseVersion}],ve.None))[0]||null}async render(e,t,o){this.activeElement=null,this.transientDisposables.clear();let n=this.transientDisposables.add(new $e).token,r=await this.getGalleryVersionToShow(e,this.options?.showPreReleaseVersion);if(n.isCancellationRequested)return;this.extensionReadme=new z0(()=>r?this.extensionGalleryService.getReadme(r,n):e.getReadme(n)),this.extensionChangelog=new z0(()=>r?this.extensionGalleryService.getChangelog(r,n):e.getChangelog(n)),this.extensionManifest=new z0(()=>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(o0(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(9484,null),d(9485,null)),t&&o.navbar.push("features",d(9491,null),d(9492,null)),e.hasChangelog()&&o.navbar.push("changelog",d(9479,null),d(9481,null)),e.dependencies.length&&o.navbar.push("dependencies",d(9482,null),d(9483,null)),t&&t.extensionPack?.length&&!this.shallRenderAsExtensionPack(t)&&o.navbar.push("extensionPack",d(9489,null),d(9490,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 $e;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=R(o.content,_(".details")),s=R(r,_(".content-container")),l=R(r,_(".additional-details-container")),c=()=>r.classList.toggle("narrow",this.dimension&&this.dimension.width<500);switch(c(),this.contentDisposables.add(Z(Zm(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),vN(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=Zm(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&&(jd(g,Y.http)||jd(g,Y.https)||jd(g,Y.mailto)?this.openerService.open(g):jd(g,Y.command)&&e.type===0&&this.openerService.open(g,{allowCommands:[JFe]}))})),u}catch{let u=R(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=[Y.http,Y.https,Y.mailto],l=await uie(r,this.extensionService,this.languageService,{sanitizerConfig:{allowedLinkProtocols:{override:e.type===0?[...s,Y.command]:s}}},n);return n?.isCancellationRequested?"":this.renderBody(l)}renderBody(e){let t=_t(),o=kc.getColorMap(),n=o?KN(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}">
					${die}

					/* 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(9507,null),t,0,d(9511,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=R(o,_("div",{class:"extension-pack-readme"}));r.style.margin="0 auto",r.style.maxWidth="882px";let s=R(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(Zm(this.layoutParticipants,{layout:p})));let h=R(s,_("div.header"));h.textContent=d(9487,null,t.extensionPack.length);let g=R(s,_("div",{class:"extension-pack-content"}));g.setAttribute("tabindex","0");let f=R(r,_("div.readme-content"));return await Promise.all([this.renderExtensionPack(t,g,n),this.openMarkdown(e,this.extensionReadme.get(),d(9507,null),f,0,d(9511,null),n)]),{focus:()=>g.focus()}}renderAdditionalDetails(e,t){let o=_("div",{class:"additional-details-content",tabindex:"0"}),n=new Pa(o,{}),r=()=>n.scanDomNode(),s=Zm(this.layoutParticipants,{layout:r});this.contentDisposables.add(Z(s)),this.contentDisposables.add(n),this.contentDisposables.add(this.instantiationService.createInstance(dnt,o,t)),R(e,n.getDomNode()),n.scanDomNode()}async openChangelog(e,t,o){return await this.openMarkdown(e,this.extensionChangelog.get(),d(9505,null),t,1,d(9480,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(XFe,n,this.options?.feature)),s=()=>r.layout(t.clientHeight,t.clientWidth),l=Zm(this.layoutParticipants,{layout:s});return this.contentDisposables.add(Z(l)),R(t,r.domNode),s(),r.domNode}openExtensionDependencies(e,t,o){if(o.isCancellationRequested)return Promise.resolve(null);if(JA(e.dependencies))return R(t,_("p.nocontent")).textContent=d(9506,null),Promise.resolve(t);let n=_("div",{class:"subcontent"}),r=new Pa(n,{});R(t,r.getDomNode()),this.contentDisposables.add(r);let s=this.instantiationService.createInstance(_Pe,new _Ht(e,null,u=>u.dependencies||[],this.extensionsWorkbenchService),n,{listBackground:qo}),l=()=>{r.scanDomNode();let u=r.getScrollDimensions();s.layout(u.height)},c=Zm(this.layoutParticipants,{layout:l});return this.contentDisposables.add(Z(c)),this.contentDisposables.add(s),r.scanDomNode(),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 Pa(n,{useShadows:!1});R(t,r.getDomNode());let s=this.instantiationService.createInstance(EPe,n,new kPe),l=await jet(e.extensionPack,this.extensionsWorkbenchService);return s.setExtensions(l),r.scanDomNode(),this.contentDisposables.add(r),this.contentDisposables.add(s),this.contentDisposables.add(Z(Zm(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){so(e)||this.notificationService.error(e)}};C0=I([m(1,Te),m(2,F),m(3,zi),m(4,ta),m(5,De),m(6,Ne),m(7,Qe),m(8,nD),m(9,le),m(10,lt),m(11,wm),m(12,kt),m(13,ze),m(14,X),m(15,tt)],C0);var dnt=class extends C{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 P);this.render(t),this._register(this.extensionsWorkbenchService.onChange(h=>{h&&Ot(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=R(e,_(".categories-container.additional-details-element"));R(o,_(".additional-details-title",void 0,d(9478,null)));let n=R(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=R(n,_("span.category",{tabindex:"0"},l));s&&(c.classList.add("clickable"),this.disposables.add(o0(c,()=>this.extensionsWorkbenchService.openSearch(`@category:"${l}"`))))}})}}renderExtensionResources(e,t){let o=[];if(t.repository)try{o.push([d(9512,null),q.fromId(M.repo.id),A.parse(t.repository)])}catch{}if(t.supportUrl)try{o.push([d(9498,null),q.fromId(M.issues.id),A.parse(t.supportUrl)])}catch{}if(t.licenseUrl)try{o.push([d(9501,null),q.fromId(M.linkExternal.id),A.parse(t.licenseUrl)])}catch{}if(t.publisherUrl&&o.push([t.publisherDisplayName,q.fromId(M.linkExternal.id),t.publisherUrl]),t.url&&o.push([d(9502,null),q.fromId(M.linkExternal.id),A.parse(t.url)]),o.length||t.publisherSponsorLink){let n=R(e,_(".resources-container.additional-details-element"));R(n,_(".additional-details-title",void 0,d(9513,null)));let r=R(n,_(".resources"));for(let[s,l,c]of o){let u=R(r,_(".resource"));R(u,_(q.asCSSSelector(l))),R(u,_("a",{tabindex:"0"},s)),this.disposables.add(o0(u,()=>this.openerService.open(c))),this.disposables.add(this.hoverService.setupManagedHover(Ni("mouse"),u,c.toString()))}}}renderInstallInfo(e,t){let o=R(e,_(".more-info-container.additional-details-element"));R(o,_(".additional-details-title",void 0,d(9497,null)));let n=R(o,_(".more-info"));if(R(n,_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(9496,null)),_("code",void 0,t.identifier.id))),t.type!==0&&R(n,_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(9517,null)),_("code",void 0,t.manifest.version))),t.installedTimestamp&&R(n,_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(9500,null)),_("div",{title:new Date(t.installedTimestamp).toString()},Bs(t.installedTimestamp,!0,!0,!0)))),!t.isBuiltin&&t.source!=="gallery"){let r=_("div",void 0,t.source==="vsix"?d(9518,null):d(9508,null));R(n,_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(9516,null)),r)),kr&&t.source==="resource"&&t.location.scheme===Y.file&&(r.classList.add("link"),r.tabIndex=0,r.setAttribute("role","link"),r.title=t.location.fsPath,this.disposables.add(o0(r,()=>this.openerService.open(t.location,{openExternal:!0}))))}if(t.size){let r=_("div",void 0,ll.formatSize(t.size));R(n,_(".more-info-entry",void 0,_("div.more-info-entry-name",{title:d(9515,null)},d(9514,null)),r)),kr&&t.location.scheme===Y.file&&(r.classList.add("link"),r.tabIndex=0,r.setAttribute("role","link"),r.title=t.location.fsPath,this.disposables.add(o0(r,()=>this.openerService.open(t.location,{openExternal:!0}))))}this.getCacheLocation(t).then(r=>{r&&xci(r,this.fileService).then(s=>{if(!s)return;let l=_("div",void 0,ll.formatSize(s));R(n,_(".more-info-entry",void 0,_("div.more-info-entry-name",{title:d(9486,null)},d(9477,null)),l)),kr&&t.location.scheme===Y.file&&(l.classList.add("link"),l.tabIndex=0,l.setAttribute("role","link"),l.title=r.fsPath,this.disposables.add(o0(l,()=>this.openerService.open(r.with({scheme:Y.file}),{openExternal:!0}))))})})}async getCacheLocation(e){let t=this.uriIdentityService.extUri.joinPath(this.userDataProfilesService.defaultProfile.globalStorageHome,e.identifier.id.toLowerCase());if(e.location.scheme===Y.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=R(e,_(".more-info-container.additional-details-element"));R(n,_(".additional-details-title",void 0,d(9503,null)));let r=R(n,_(".more-info"));o&&(t.local||(R(r,_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(9496,null)),_("code",void 0,t.identifier.id))),R(r,_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(9517,null)),_("code",void 0,o.version)))),R(r,_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(9510,null)),_("div",{title:new Date(o.releaseDate).toString()},Bs(o.releaseDate,!0,!0,!0))),_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(9499,null)),_("div",{title:new Date(o.lastUpdated).toString()},Bs(o.lastUpdated,!0,!0,!0)))))}};dnt=I([m(2,tt),m(3,Qe),m(4,an),m(5,yo),m(6,be),m(7,dt),m(8,zi),m(9,vv)],dnt);var TLi=x.and(x.equals("activeEditor",C0.ID),ue.focus.toNegated());W(class extends K{constructor(){super({id:"editor.action.extensioneditor.showfind",title:d(9493,null),keybinding:{when:TLi,weight:100,primary:2084}})}run(i){_Li(i)?.showFind()}});W(class extends K{constructor(){super({id:"editor.action.extensioneditor.findNext",title:d(9494,null),keybinding:{when:x.and(TLi,bz),primary:3,weight:100}})}run(i){_Li(i)?.runFindAction(!1)}});W(class extends K{constructor(){super({id:"editor.action.extensioneditor.findPrevious",title:d(9495,null),keybinding:{when:x.and(TLi,bz),primary:1027,weight:100}})}run(i){_Li(i)?.runFindAction(!0)}});is((a,i)=>{let e=a.getColor(WI);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(igt);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(B$);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(YT);n&&i.addRule(`.monaco-workbench .extension-editor .content > .details > .additional-details-container .categories-container > .categories > .category.clickable:hover { color: ${n}; }`)});function _Li(a){let i=a.get(ee).activeEditorPane;return i instanceof C0?i:null}var ZFe=class extends C{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(9519,null));await o.updateExtensionsEnablementsWhenWorkspaceTrustChanges(),c&&i.startExtensionHosts()}}};this._register(r.addWorkspaceTrustTransitionParticipant(s))})}};ZFe=I([m(0,lt),m(1,oi),m(2,Vt),m(3,Os),m(4,BL),m(5,ns)],ZFe);var Gbo="extensionsAssistant/importantRecommendationsIgnore",$bo="extensionsAssistant/workspaceRecommendationsIgnore",DLi=class extends C{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))}},e0e=class extends C{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 Uo([...JSON.parse(this.storageService.get(Gbo,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:ant(e.source)})),onDidShowRecommendedExtensions:n=>n.forEach(r=>this.telemetryService.publicLog2("extensionRecommendations:popup",{userReaction:"show",extensionId:r.identifier.id,source:ant(e.source)})),onDidCancelRecommendedExtensions:n=>n.forEach(r=>this.telemetryService.publicLog2("extensionRecommendations:popup",{userReaction:"cancelled",extensionId:r.identifier.id,source:ant(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:ant(e.source)});this.notificationService.prompt(St.Info,d(9545,null),[{label:d(9544,null),run:()=>this.setIgnoreRecommendationsConfig(!0)},{label:d(9548,null),run:()=>this.setIgnoreRecommendationsConfig(!1)}])}}):"ignored"}async promptWorkspaceRecommendations(e){if(this.storageService.getBoolean($bo,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=>Ae(o)?!Ot({id:o},n.identifier):!this.uriIdentityService.extUri.isEqual(o,n.location))),e.length&&await this.promptRecommendationsNotification({extensions:e,source:2,name:d(9551,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($bo,!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=>Ae(p)&&this.recommendedExtensions.includes(p)))return"ignored";let s=await this.getInstallableExtensions(e);if(!s.length)return"ignored";this.recommendedExtensions=Uo([...this.recommendedExtensions,...e.filter(Ae)]);let l="";if(s.length===1)l=d(9540,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(9541,null,p[0],p[1]):p.length===2?l=d(9543,null,p[0],p[1]):l=d(9542,null,p[0])}let c=d(9549,null,l,o);t===3&&(c=d(9539,null,o,l)),n||(n=t===2?"@recommended":s.map(p=>`@id:${p.identifier.id}`).join(" "));let u=t===2?d(9536,null):s.length>1?d(9537,null):d(9538,null);return Dre([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 xn(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 fn.settled([fn.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(9546,null),run:()=>f(!1),menu:this.userDataSyncEnablementService.isEnabled()&&this.userDataSyncEnablementService.isResourceEnabled("extensions")?[{label:d(9547,null),run:()=>f(!0)}]:void 0}),g.push({label:d(9550,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(St.Info,t,g,r,p)}catch(v){if(!so(v))throw v}return h?"reacted":(c(e),"cancelled")})}waitUntilRecommendationsAreInstalled(e){let t=[],o=new P;return xn(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 P;try{let l=s.add(new DLi(e,t,o,this.notificationService));if(s.add(H.once(H.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 wa(new Promise(c=>s.add(H.once(l.onDidClose)(c))),r),!l.isCancelled()}finally{s.dispose()}}showNextNotification(){let e=this.getNextPendingNotificationIndex(),[t]=e>-1?this.pendingNotificaitons.splice(e,1):[];Pi(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=Pi(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"},ve.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(Gbo,JSON.stringify(t),0,0))}setIgnoreRecommendationsConfig(e){this.configurationService.updateValue("extensions.ignoreRecommendations",e)}_registerP(e){return this._register(Z(()=>e.cancel())),e}};e0e=I([m(0,B),m(1,le),m(2,Ne),m(3,Te),m(4,zi),m(5,Hd),m(6,Os),m(7,uk),m(8,_l),m(9,Vt),m(10,dt)],e0e);var JC=class extends C{constructor(){super(...arguments);this._activationPromise=null}get activated(){return this._activationPromise!==null}activate(){return this._activationPromise||(this._activationPromise=this.doActivate()),this._activationPromise}};var t0e=class extends JC{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(9475,null,e.exeFriendlyName)}}}};t0e=I([m(0,oxe)],t0e);var LLi=".vscode/extensions",i0e=class extends JC{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,LLi)));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,LLi),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,LLi);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(10069,null)}})}for(let n of this.workspaceExtensions)this._recommendations.push({extension:n,reason:{reasonId:0,reasonText:d(10069,null)}})}async validateExtensions(e){let t=[],o=[],n="",r=Uo(e.flatMap(({recommendations:l})=>l||[])),s=new RegExp(CO);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()}};i0e=I([m(0,EK),m(1,Pe),m(2,dt),m(3,be),m(4,Hd),m(5,Ne)],i0e);var Qbo="fileBasedRecommendations/promptedRecommendations",Ybo="extensionsAssistant/recommendations",Rin=1e3*60*60*24,Min=1e3,o0e=class extends JC{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(10066,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(mf(this.fileOpenRecommendations))return;await this.extensionsWorkbenchService.whenInitialized;let e=this.getCachedRecommendations(),t=Date.now();Object.entries(e).forEach(([o,n])=>{(t-n)/Rin<=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===Y.vscodeNotebookCell?Zo.parse(e.uri)?.notebook:e.uri;if(!t)return;let o=Uo([Y.untitled,Y.file,Y.vscodeRemote,...this.workspaceContextService.getWorkspace().folders.map(n=>n.uri.scheme)]);!t||!o.includes(t.scheme)||nn(()=>this.promptImportantRecommendations(t,e),0,this._store)}promptImportantRecommendations(e,t,o){if(t.isDisposed())return;let n=ms(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()>Min;for(let[b,S]of r){let y=[],w=[],k=[];for(let T of S){let N=!1,O=!1,V=!!T.languages,U=!!T.contentPattern;(V||U)&&y.push(T),V&&v&&T.languages.includes(g)&&(N=!0);let G=T.pathGlob;G&&((s.get(G)??Cp(G,e.with({fragment:""}).toString(),{ignoreCase:!0}))&&(O=!0),s.set(G,O));let $=N||O;n&&!$||($&&T.whenInstalled&&(T.whenInstalled.every(te=>l.some(pe=>Ot({id:te},pe.identifier)))||($=!1)),$&&T.whenNotInstalled&&l.some(te=>T.whenNotInstalled?.some(pe=>Ot({id:pe},te.identifier)))&&($=!1),$&&U&&(t.findMatches(T.contentPattern,!1,!0,!1,null,!1).length||($=!1)),$?(w.push(T),y.pop()):(V||U)&&(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 P;b.add(t.onDidChangeLanguage(()=>{nn(()=>{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!==Fr?d(10067,null,c):Ye(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!==Fr?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(Qbo,0,"{}"))}addToPromptedRecommendations(e,t){let o=this.getPromptedRecommendations();o[e]=Uo([...o[e]??[],...t]),this.storageService.store(Qbo,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(Ybo,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(Ybo,JSON.stringify(e),0,1)}};o0e=I([m(0,zi),m(1,Ct),m(2,kt),m(3,nt),m(4,le),m(5,yie),m(6,uk),m(7,Pe),m(8,H_)],o0e);var n0e=class extends JC{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:""}})))}};n0e=I([m(0,nt)],n0e);var r0e=class extends JC{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:""}})))}};r0e=I([m(0,nt)],r0e);var s0e=class extends JC{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(9474,null)},whenNotInstalled:e.whenNotInstalled}}};s0e=I([m(0,oxe),m(1,Pe)],s0e);var a0e=class extends JC{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(10068,null,this.productService.nameLong)}})))}};a0e=I([m(0,nt),m(1,Gc)],a0e);var l0e=class extends JC{constructor(e){super();this.productService=e;this._recommendations=[]}get recommendations(){return this._recommendations}async doActivate(){let e={...this.productService.remoteExtensionTips,...this.productService.virtualWorkspaceExtensionTips},t=LT(Pp);this._recommendations=Object.values(e).filter(({supportedPlatforms:o})=>!o||o.includes(t)).map(o=>({extension:o.extensionId.toLowerCase(),reason:{reasonId:6,reasonText:""}}))}};l0e=I([m(0,nt)],l0e);var c0e=class extends C{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(i0e)),this.fileBasedRecommendations=this._register(e.createInstance(o0e)),this.configBasedRecommendations=this._register(e.createInstance(s0e)),this.exeBasedRecommendations=this._register(e.createInstance(t0e)),this.keymapRecommendations=this._register(e.createInstance(n0e)),this.webRecommendations=this._register(e.createInstance(a0e)),this.languageRecommendations=this._register(e.createInstance(r0e)),this.remoteRecommendations=this._register(e.createInstance(l0e)),!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(H.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)Ae(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 l6(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 l6(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)Ae(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)Ae(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=>!Ot(r.identifier,{id:n}))))].map(({extension:o})=>o).filter(o=>!Ae(o)||this.isExtensionAllowedToBeRecommended(o));t.length&&(await this._registerP(Pi(5e3)),await this.extensionRecommendationNotificationService.promptWorkspaceRecommendations(t))}_registerP(e){return this._register(Z(()=>e.cancel())),e}};c0e=I([m(0,F),m(1,ao),m(2,ta),m(3,Te),m(4,Co),m(5,ls),m(6,uk),m(7,yie),m(8,zi),m(9,_K),m(10,r4)],c0e);var d0e=class{constructor(i,e,t){let o={location:10,title:d(9862,null)},n,r=0;this._listener=i.onWillActivateByEvent(s=>{t.trace("onWillActivateByEvent: ",s.event),n||(n=new Go,e.withProgress(o,l=>n.p)),r++,Promise.race([s.activation,Pi(5e3,ve.None)]).finally(()=>{--r===0&&(n.complete(void 0),n=void 0)})})}dispose(){this._listener.dispose()}};d0e=I([m(0,lt),m(1,Bo),m(2,ne)],d0e);var u0e=class extends C{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=Z6i(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(Ur(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(9863,null),kind:13,insertText:s,filterText:s,range:t})}return o}};u0e=I([m(0,ls),m(1,zt)],u0e);var p0e=class extends C{constructor(e,t,o,n){super();this.extensionService=e;this.extensionsWorkbenchService=t;this.notificationService=o;this.hostService=n;qe.registerCommand("workbench.extensions.installMissingDependencies",()=>this.installMissingDependencies()),fe.appendMenuItem(D.CommandPalette,{command:{id:"workbench.extensions.installMissingDependencies",category:d(9865,null),title:d(9864,null)}})}async getUninstalledMissingDependencies(){let e=await this.getAllMissingDependencies(),t=await this.extensionsWorkbenchService.queryLocal();return e.filter(o=>t.every(n=>!Ot(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})),ve.None);t.length&&(await fn.settled(t.map(o=>this.extensionsWorkbenchService.install(o))),this.notificationService.notify({severity:St.Info,message:d(9866,null),actions:{primary:[new st("realod",d(9868,null),"",!0,()=>this.hostService.reload())]}}))}else this.notificationService.info(d(9867,null))}};p0e=I([m(0,lt),m(1,zi),m(2,Ne),m(3,oi)],p0e);var L8=class extends yh{constructor(e,t,o,n,r){super(L8.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(9897,null)}];let n={label:d(9896,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(9894,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)}}};L8=I([m(0,zi),m(1,ta),m(2,ls),m(3,Ne),m(4,ne)],L8);var R8=class extends yh{constructor(e){super(R8.PREFIX);this.extensionsWorkbenchService=e}static{this.PREFIX="ext "}_getPicks(){return[{label:d(9895,null),accept:()=>this.extensionsWorkbenchService.openSearch("")}]}};R8=I([m(0,zi)],R8);var PLi="none",RLi=class extends C{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 Pin(a){if(a==="UpdateDate")return!0}var M8=class extends zr{},yr=class extends M8{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N,O,V,U,G,$,te,pe){super({...t,showActions:2,maximumBodySize:e.flexibleHeight?V.getNumber(`${t.id}.size`,0,0)?void 0:0:void 0},n,r,f,T,N,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=U;this.extensionEnablementService=G;this.extensionFeaturesManagementService=$;this.uriIdentityService=te;this.logService=pe;this.list=null;this.queryRequest=null;this.contextMenuActionRunner=this._register(new as);this.options.onDidChangeTitle&&this._register(this.options.onDidChangeTitle(de=>this.updateTitle(de))),this._register(this.contextMenuActionRunner.onDidRun(({error:de})=>de&&this.notificationService.error(de))),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 fv(R(e,_(".count-badge-wrapper")),{},BS)))}renderBody(e){super.renderBody(e);let t=R(e,_(".message-container")),o=R(t,_("")),n=R(t,_(".message")),r=R(e,_(".extensions-list"));this.extensionsViewState=this._register(new RLi),this.list=this._register(this.instantiationService.createInstance(Uee,r,this.id,{},this.extensionsViewState)).list,FJi.bindTo(this.list.contextKeyService),this._register(this.list.onDidChangeFocus(s=>this.extensionsViewState?.onFocusChange(si(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=X2.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=xn(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 Tm([]);return so(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 Tm([]);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 P};if(yr.isLocalExtensionsQuery(e.value,e.sortBy))return this.queryLocal(e,t);yr.isSearchPopularQuery(e.value)?(e.value=e.value.replace("@popular",""),t.sortBy=t.sortBy?t.sortBy:"InstallCount"):yr.isSearchRecentlyPublishedQuery(e.value)&&(e.value=e.value.replace("@recentlyPublished",""),t.sortBy=t.sortBy?t.sortBy:"PublishedDate");let l={...t,sortBy:Pin(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=>!Ot(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 Tm(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 P,c=l.add(new E);if(r){let u=!1;l.add(Z(()=>u=!0)),l.add(H.debounce(H.any(H.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 Tm(n)))}}))}return{model:new Tm(n),message:s?{text:s,severity:St.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(PLi)}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 Fd),h=(y,w)=>{let k=p.get(y.identifier.id),T=!!k&&this.extensionManagementServerService.getExtensionManagementServer(kE(k))===y.server,N=p.get(w.identifier.id),O=N&&this.extensionManagementServerService.getExtensionManagementServer(kE(N))===w.server;if(T&&O)return y.displayName.localeCompare(w.displayName);let V=y.local&&NL(y.local.manifest),U=w.local&&NL(w.local.manifest);return!T&&!O?V?-1:U?1:y.displayName.localeCompare(w.displayName):T&&U||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=>!Ot({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=>Ot({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?Yle(e.map(y=>y.local),f.local).some(y=>this.extensionManifestPropertiesService.getExtensionUntrustedWorkspaceSupportType(y.manifest)===v):!1},h=LO(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<yr.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=oe.as(Ds.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 Ei(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=>Ot(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=>!Ot(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 P};let r=e.value;if(!r){t.source="viewlet";let s=await this.extensionsWorkbenchService.queryGallery(t,o);return{model:new Tm(s),disposables:new P}}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 Tm(s),disposables:new P}}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 Tm(s),disposables:new P}}try{let[s,l]=await Promise.all([this.extensionsWorkbenchService.queryGallery(t,o),this.getPreferredExtensions(t.text.toLowerCase(),o).catch(()=>[])]);return{model:l.length?new MLi(l,s):new Tm(s),disposables:new P}}catch(s){if(so(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 Tm(c),disposables:new P,message:{text:d(9958,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,ve.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 yr.isWorkspaceRecommendedExtensionsQuery(e.value)||yr.isKeymapsRecommendedExtensionsQuery(e.value)||yr.isLanguageRecommendedExtensionsQuery(e.value)||yr.isExeRecommendedExtensionsQuery(e.value)||yr.isRemoteRecommendedExtensionsQuery(e.value)||/@recommended:all/i.test(e.value)||yr.isSearchRecommendedExtensionsQuery(e.value)||yr.isRecommendedExtensionsQuery(e.value)}async queryRecommendations(e,t,o){return yr.isWorkspaceRecommendedExtensionsQuery(e.value)?this.getWorkspaceRecommendationsModel(e,t,o):yr.isKeymapsRecommendedExtensionsQuery(e.value)?this.getKeymapRecommendationsModel(e,t,o):yr.isLanguageRecommendedExtensionsQuery(e.value)?this.getLanguageRecommendationsModel(e,t,o):yr.isExeRecommendedExtensionsQuery(e.value)?this.getExeRecommendationsModel(e,t,o):yr.isRemoteRecommendedExtensionsQuery(e.value)?this.getRemoteRecommendationsModel(e,t,o):/@recommended:all/i.test(e.value)?this.getAllRecommendationsModel(t,o):yr.isSearchRecommendedExtensionsQuery(e.value)||yr.isRecommendedExtensionsQuery(e.value)&&t.sortBy!==void 0?this.searchRecommendations(e,t,o):yr.isRecommendedExtensionsQuery(e.value)?this.getOtherRecommendationsModel(e,t,o):new Tm([])}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 Tm(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 Tm(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 Tm(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 Tm(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 Tm(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=si(n.map(l=>r.find(c=>Ot(c.identifier,{id:l}))));return new Tm(s)}async getOtherRecommendations(){let e=(await this.extensionsWorkbenchService.queryLocal(this.options.server)).map(o=>o.identifier.id.toLowerCase()),t=(await this.getWorkspaceRecommendations()).map(o=>Ae(o)?o.toLowerCase():o);return Uo((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=Uo((await Promise.all([this.getWorkspaceRecommendations(),this.extensionRecommendationsService.getImportantRecommendations(),this.extensionRecommendationsService.getFileBasedRecommendations(),this.extensionRecommendationsService.getOtherRecommendations()])).flat().filter(c=>Ae(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(Ae(u)){let p=s.find(h=>Ot(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 Tm(l)}async searchRecommendations(e,t,o){let n=e.value.replace(/@recommended/g,"").trim().toLowerCase(),r=Uo([...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 Tm(this.sortExtensions(s,t))}setModel(e,t,o){this.list&&(this.list.model=new C3(e),this.updateBody(t),o||(this.list.scrollTop=0)),this.badge&&this.badge.setCount(this.count())}updateModel(e){this.list&&(this.list.model=new C3(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=Px.className(e.severity),this.bodyTemplate.messageBox.textContent=e.text):this.count()===0&&(this.bodyTemplate.messageSeverityIcon.className="",this.bodyTemplate.messageBox.textContent=d(9955,null)),this.bodyTemplate.messageBox.textContent&&Jo(this.bodyTemplate.messageBox.textContent))}this.updateSize()}getMessage(e){return this.isOfflineError(e)?{text:d(9957,null),severity:St.Warning}:{text:d(9954,null,Cn(e)),severity:St.Error}}isOfflineError(e){return e instanceof xE?e.code==="Offline":oXe(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)}static isSearchInstalledExtensionsQuery(e){return/@installed\s./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())}};yr=I([m(2,Ne),m(3,_e),m(4,ze),m(5,F),m(6,De),m(7,lt),m(8,zi),m(9,nD),m(10,Te),m(11,tt),m(12,B),m(13,Pe),m(14,Gc),m(15,xp),m(16,Hd),m(17,Pe),m(18,nt),m(19,X),m(20,Ri),m(21,Qe),m(22,le),m(23,ns),m(24,Os),m(25,YI),m(26,dt),m(27,ne)],yr);var $Kt=class extends yr{async show(){let i=this.extensionManagementServerService.webExtensionManagementServer&&!this.extensionManagementServerService.localExtensionManagementServer&&!this.extensionManagementServerService.remoteExtensionManagementServer?"@web":"";return super.show(i)}},qKt=class extends yr{async show(i){return i=i||"@installed",(!yr.isLocalExtensionsQuery(i)||yr.isSortInstalledExtensionsQuery(i))&&(i=i+=" @installed"),super.show(i.trim())}},jKt=class extends yr{async show(i){return i=i||"@enabled",yr.isEnabledExtensionsQuery(i)?super.show(i):yr.isSortInstalledExtensionsQuery(i)?super.show("@enabled "+i):this.showEmptyModel()}},QKt=class extends yr{async show(i){return i=i||"@disabled",yr.isDisabledExtensionsQuery(i)?super.show(i):yr.isSortInstalledExtensionsQuery(i)?super.show("@disabled "+i):this.showEmptyModel()}},YKt=class extends yr{async show(i){return i=i||"@outdated",yr.isSearchExtensionUpdatesQuery(i)&&(i=i.replace("@updates","@outdated")),super.show(i.trim())}updateSize(){super.updateSize(),this.setExpanded(this.count()>0)}},XKt=class extends yr{async show(i){return i=i||"@recentlyUpdated",yr.isSearchExtensionUpdatesQuery(i)&&(i=i.replace("@updates","@recentlyUpdated")),super.show(i.trim())}},kie=class extends yr{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N,O,V,U,G,$,te,pe){super(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N,O,V,U,G,$,te,pe);this.options=e}show(){return super.show(this.options.query)}};kie=I([m(2,Ne),m(3,_e),m(4,ze),m(5,F),m(6,De),m(7,lt),m(8,zi),m(9,nD),m(10,Te),m(11,tt),m(12,B),m(13,Pe),m(14,Gc),m(15,xp),m(16,Hd),m(17,Pe),m(18,nt),m(19,X),m(20,Ri),m(21,Qe),m(22,le),m(23,ns),m(24,Os),m(25,YI),m(26,dt),m(27,ne)],kie);function a2t(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 JKt=class extends yr{async show(i){let e=a2t(i,"untrusted");return e?super.show(e):this.showEmptyModel()}},ZKt=class extends yr{async show(i){let e=a2t(i,"untrustedPartial");return e?super.show(e):this.showEmptyModel()}},e2t=class extends yr{async show(i){let e=a2t(i,"virtual");return e?super.show(e):this.showEmptyModel()}},t2t=class extends yr{async show(i){let e=a2t(i,"virtualPartial");return e?super.show(e):this.showEmptyModel()}},i2t=class extends yr{async show(i){return yr.isSearchDeprecatedExtensionsQuery(i)?super.show(i):this.showEmptyModel()}},o2t=class extends yr{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")}},n2t=class extends yr{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}},r2t=class extends yr{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)}},s2t=class extends yr{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=>Ae(o)?!Ot({id:o},n.identifier):!this.uriIdentityService.extUri.isEqual(o,n.local?.location)));return this.getInstallableRecommendations(t,{source:"install-all-workspace-recommendations"},ve.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:St.Info,message:d(9956,null)})}},MLi=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 H.None}isResolved(i){return this.resolved.has(i)}get(i){return this.resolved.get(i)}async resolve(i,e){if(e.isCancellationRequested)throw new ho;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 $e,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 NLi=new Q("extensionsSortByValue",""),OLi=new Q("searchMarketplaceExtensions",!1),FLi=new Q("extensionSearchHasText",!1),Ain=new Q("installedExtensions",!1),Nin=new Q("searchInstalledExtensions",!1),Oin=new Q("searchRecentlyUpdatedExtensions",!1),ALi=new Q("searchExtensionUpdates",!1),Fin=new Q("searchOutdatedExtensions",!1),Win=new Q("searchEnabledExtensions",!1),Vin=new Q("searchDisabledExtensions",!1),Bin=new Q("hasInstalledExtensions",!0),sge=new Q("builtInExtensions",!1),Hin=new Q("searchBuiltInExtensions",!1),unt=new Q("searchUnsupportedWorkspaceExtensions",!1),Jbo=new Q("searchDeprecatedExtensions",!1),Zbo=new Q("searchRestartRequiredExtensions",!1),WLi=new Q("recommendedExtensions",!1),eSo=new Q("sortByUpdateDate",!1),VLi=new Q("extensionsSearchValue",""),Xbo=L(9938,"Remote"),m0e=class extends C{constructor(e,t,o){super();this.extensionManagementServerService=e;this.labelService=t;this.contextKeyService=o;this.container=oe.as(on.ViewContainersRegistry).get(Yh),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(9931,"Marketplace"),ctorDescriptor:new Mt(class extends zr{shouldShowWelcome(){return!0}}),when:x.and(x.or(x.has("searchMarketplaceExtensions"),x.and(yC)),x.or(uX.isEqualTo("requiresSignIn"),uX.isEqualTo("accessDenied"))),order:-1});let t=oe.as(on.ViewsRegistry);t.registerViews(e,this.container),t.registerViewWelcomeContent("workbench.views.extensions.marketplaceAccess",{content:d(9944,null,`command:${rJe}`),when:uX.isEqualTo("requiresSignIn")}),t.registerViewWelcomeContent("workbench.views.extensions.marketplaceAccess",{content:d(9905,null),when:uX.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=H.None;if(this.extensionManagementServerService.webExtensionManagementServer&&this.extensionManagementServerService.remoteExtensionManagementServer){let s=new Set;s.add("hasInstalledWebExtensions"),n=H.filter(this.contextKeyService.onDidChangeContext,l=>l.affectsSome(s))}let r=H.any(this.labelService.onDidChangeFormatters,n);for(let s of t){let l=()=>o(d(9927,null),s),c=H.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:x.and(yC),ctorDescriptor:new Mt(qKt,[{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(9942,"Install Local Extensions in '{0}'...",s.label)},category:Xbo,icon:glo,f1:!0,menu:{id:D.ViewTitle,when:x.equals("view",u),group:"navigation"}})}run(h){return h.get(F).createInstance(lRe).run()}}))}return this.extensionManagementServerService.localExtensionManagementServer&&this.extensionManagementServerService.remoteExtensionManagementServer&&this._register(W(class extends K{constructor(){super({id:"workbench.extensions.actions.installLocalExtensionsInRemote",title:L(9926,"Install Remote Extensions Locally..."),category:Xbo,f1:!0})}run(l){return l.get(F).createInstance(cRe,"workbench.extensions.actions.installLocalExtensionsInRemote").run()}})),e.push({id:"workbench.views.extensions.popular",name:L(9934,"Popular"),ctorDescriptor:new Mt($Kt,[{hideBadge:!0}]),when:x.and(yC,x.not("hasInstalledExtensions"),fh),weight:60,order:2,canToggleVisibility:!1}),e.push({id:"extensions.recommendedList",name:L(9936,"Recommended"),ctorDescriptor:new Mt(n2t,[{flexibleHeight:!0}]),when:x.and(yC,eSo.negate(),x.not("config.extensions.showRecommendationsOnlyOnDemand"),fh),weight:40,order:3,canToggleVisibility:!0}),t.length===1&&(e.push({id:"workbench.views.extensions.enabled",name:L(9917,"Enabled"),ctorDescriptor:new Mt(jKt,[{}]),when:x.and(yC,x.has("hasInstalledExtensions")),hideByDefault:!0,weight:40,order:4,canToggleVisibility:!0}),e.push({id:"workbench.views.extensions.disabled",name:L(9915,"Disabled"),ctorDescriptor:new Mt(QKt,[{}]),when:x.and(yC,x.has("hasInstalledExtensions")),hideByDefault:!0,weight:10,order:5,canToggleVisibility:!0})),e}createSearchExtensionsViewDescriptors(){let e=[];return e.push({id:"workbench.views.extensions.marketplace",name:L(9931,"Marketplace"),ctorDescriptor:new Mt(o2t,[{}]),when:x.and(x.has("searchMarketplaceExtensions"),fh)}),e.push({id:"workbench.views.extensions.searchInstalled",name:L(9928,"Installed"),ctorDescriptor:new Mt(yr,[{}]),when:x.or(x.has("searchInstalledExtensions"),x.has("installedExtensions"))}),e.push({id:"workbench.views.extensions.searchRecentlyUpdated",name:L(9935,"Recently Updated"),ctorDescriptor:new Mt(XKt,[{}]),when:x.or(ALi,x.has("searchRecentlyUpdatedExtensions")),order:2}),e.push({id:"workbench.views.extensions.searchEnabled",name:L(9916,"Enabled"),ctorDescriptor:new Mt(yr,[{}]),when:x.and(x.has("searchEnabledExtensions"))}),e.push({id:"workbench.views.extensions.searchDisabled",name:L(9914,"Disabled"),ctorDescriptor:new Mt(yr,[{}]),when:x.and(x.has("searchDisabledExtensions"))}),e.push({id:gDt,name:L(9907,"Available Updates"),ctorDescriptor:new Mt(YKt,[{}]),when:x.or(ALi,x.has("searchOutdatedExtensions")),order:1}),e.push({id:"workbench.views.extensions.searchBuiltin",name:L(9908,"Builtin"),ctorDescriptor:new Mt(yr,[{}]),when:x.and(x.has("searchBuiltInExtensions"))}),e.push({id:"workbench.views.extensions.searchWorkspaceUnsupported",name:L(9953,"Workspace Unsupported"),ctorDescriptor:new Mt(yr,[{}]),when:x.and(x.has("searchWorkspaceUnsupportedExtensions"))}),e}createRecommendedExtensionsViewDescriptors(){let e=[];return e.push({id:iEe,name:L(9952,"Workspace Recommendations"),ctorDescriptor:new Mt(s2t,[{}]),when:x.and(x.has("recommendedExtensions"),Qa.notEqualsTo("empty")),order:1}),e.push({id:"workbench.views.extensions.otherRecommendations",name:L(9933,"Other Recommendations"),ctorDescriptor:new Mt(r2t,[{}]),when:x.has("recommendedExtensions"),order:2}),e}createBuiltinExtensionsViewDescriptors(){let e=[],t=["themes","programming languages"],o=gO.filter(r=>!t.includes(r.toLowerCase()));o.push(PLi);let n=`${o.map(r=>`category:"${r}"`).join(" ")} ${t.map(r=>`category:"-${r}"`).join(" ")}`;return e.push({id:"workbench.views.extensions.builtinFeatureExtensions",name:L(9909,"Features"),ctorDescriptor:new Mt(kie,[{query:`@builtin ${n}`}]),when:x.has("builtInExtensions")}),e.push({id:"workbench.views.extensions.builtinThemeExtensions",name:L(9911,"Themes"),ctorDescriptor:new Mt(kie,[{query:"@builtin category:themes"}]),when:x.has("builtInExtensions")}),e.push({id:"workbench.views.extensions.builtinProgrammingLanguageExtensions",name:L(9910,"Programming Languages"),ctorDescriptor:new Mt(kie,[{query:'@builtin category:"programming languages"'}]),when:x.has("builtInExtensions")}),e}createUnsupportedWorkspaceExtensionsViewDescriptors(){let e=[];return e.push({id:"workbench.views.extensions.untrustedUnsupportedExtensions",name:L(9949,"Disabled in Restricted Mode"),ctorDescriptor:new Mt(JKt,[{}]),when:x.and(unt)}),e.push({id:"workbench.views.extensions.untrustedPartiallySupportedExtensions",name:L(9948,"Limited in Restricted Mode"),ctorDescriptor:new Mt(ZKt,[{}]),when:x.and(unt)}),e.push({id:"workbench.views.extensions.virtualUnsupportedExtensions",name:L(9951,"Disabled in Virtual Workspaces"),ctorDescriptor:new Mt(e2t,[{}]),when:x.and(JL,unt)}),e.push({id:"workbench.views.extensions.virtualPartiallySupportedExtensions",name:L(9950,"Limited in Virtual Workspaces"),ctorDescriptor:new Mt(t2t,[{}]),when:x.and(JL,unt)}),e}createOtherLocalFilteredExtensionsViewDescriptors(){let e=[];return e.push({id:"workbench.views.extensions.deprecatedExtensions",name:L(9913,"Deprecated"),ctorDescriptor:new Mt(i2t,[{}]),when:x.and(Jbo)}),e.push({id:"workbench.views.extensions.restartRequired",name:L(9939,"Restart Required"),ctorDescriptor:new Mt(yr,[{}]),when:x.and(Zbo)}),e}};m0e=I([m(0,Gc),m(1,ot),m(2,X)],m0e);var h0e=class extends Ha{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N){super(Yh,{mergeViewWithContainerWhenSingleView:!0},n,g,e,S,t,y,h,f,v,w,N);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 jo(500)),this.extensionsSearchValueContextKey=VLi.bindTo(b),this.defaultViewsContextKey=yC.bindTo(b),this.sortByContextKey=NLi.bindTo(b),this.searchMarketplaceExtensionsContextKey=OLi.bindTo(b),this.searchMcpServersContextKey=n6e.bindTo(b),this.searchAgentPluginsContextKey=SDt.bindTo(b),this.searchHasTextContextKey=FLi.bindTo(b),this.sortByUpdateDateContextKey=eSo.bindTo(b),this.installedExtensionsContextKey=Ain.bindTo(b),this.searchInstalledExtensionsContextKey=Nin.bindTo(b),this.searchRecentlyUpdatedExtensionsContextKey=Oin.bindTo(b),this.searchExtensionUpdatesContextKey=ALi.bindTo(b),this.searchWorkspaceUnsupportedExtensionsContextKey=unt.bindTo(b),this.searchDeprecatedExtensionsContextKey=Jbo.bindTo(b),this.searchRestartRequiredExtensionsContextKey=Zbo.bindTo(b),this.searchOutdatedExtensionsContextKey=Fin.bindTo(b),this.searchEnabledExtensionsContextKey=Win.bindTo(b),this.searchDisabledExtensionsContextKey=Vin.bindTo(b),this.hasInstalledExtensionsContextKey=Bin.bindTo(b),this.builtInExtensionsContextKey=sge.bindTo(b),this.searchBuiltInExtensionsContextKey=Hin.bindTo(b),this.recommendedExtensionsContextKey=WLi.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=R(this.root,_(".overlay")),o=this.getColor(Tj)??"";t.style.backgroundColor=o,xo(t),this.header=R(this.root,_(".header"));let n=d(9941,null),r=this.searchViewletState["query.value"]?this.searchViewletState["query.value"]:"",s=R(this.header,_(".extensions-search-container"));this.searchBox=this._register(this.instantiationService.createInstance(tA,`${Yh}.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=>X2.suggestions(p,this.extensionGalleryManifest)},n,"extensions:searchinput",{placeholderText:n,value:r})),this.notificationContainer=R(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(X2.parse(this.searchBox?.getValue()??"").sortBy),this.triggerSearch()},this)),this._register(this.searchBox.onShouldFocusResults(()=>this.focusListView(),this));let l=R(s,_(".extensions-search-actions-container"));this._register(this.instantiationService.createInstance(Ln,l,s6e,{toolbarOptions:{primaryGroup:()=>!0},actionViewItemProvider:(p,h)=>Ca(this.instantiationService,p,h)})),this._register(new Om(this.root,{onDragEnter:p=>{this.isSupportedDragElement(p)&&bn(t)},onDragLeave:p=>{this.isSupportedDragElement(p)&&xo(t)},onDragOver:p=>{this.isSupportedDragElement(p)&&(p.dataTransfer.dropEffect="copy")},onDrop:async p=>{if(this.isSupportedDragElement(p)){xo(t);let h=si((await this.instantiationService.invokeFunction(g=>TIe(g,p))).map(g=>g.resource&&ms(g.resource)===".vsix"?g.resource:void 0));if(h.length>0)try{await this.commandService.executeCommand(o6e,h)}catch(g){this.notificationService.error(g)}}}})),super.create(R(this.root,_(".extensions")));let c=this._register(Vn(this.root)),u=()=>this.searchBox?.inputWidget.hasWidgetFocus();this._register(zE({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 ai(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 ai(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(i6e)&&this.extensionsWorkbenchService.checkForUpdates()}renderNotificaiton(){if(!this.notificationContainer)return;Rt(this.notificationContainer),this.notificationDisposables.value=new P;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=R(this.notificationContainer,_(".message-container"));R(o,_("span")).className=Px.className(e.severity);let n=R(o,_("span.message-text"));R(n,_("span.message",void 0,e.message));let r=R(n,_("span.message-text-action",{tabindex:"0",role:"button","aria-label":`${e.message}. ${d(9912,null)}`},d(9943,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 Ii(l);(c.keyCode===3||c.keyCode===10)&&this.search(t??""),c.stopPropagation()}));let s=R(this.notificationContainer,_(".notification-actions"));if(e.action){let l=R(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 Ii(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&&yr.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():"";yr.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=yr.isRecommendedExtensionsQuery(t);this.searchHasTextContextKey.set(t.trim()!==""),this.extensionsSearchValueContextKey.set(t),this.installedExtensionsContextKey.set(yr.isInstalledExtensionsQuery(t)),this.searchInstalledExtensionsContextKey.set(yr.isSearchInstalledExtensionsQuery(t)),this.searchRecentlyUpdatedExtensionsContextKey.set(yr.isSearchRecentlyUpdatedQuery(t)&&!yr.isSearchExtensionUpdatesQuery(t)),this.searchOutdatedExtensionsContextKey.set(yr.isOutdatedExtensionsQuery(t)&&!yr.isSearchExtensionUpdatesQuery(t)),this.searchExtensionUpdatesContextKey.set(yr.isSearchExtensionUpdatesQuery(t)),this.searchEnabledExtensionsContextKey.set(yr.isEnabledExtensionsQuery(t)),this.searchDisabledExtensionsContextKey.set(yr.isDisabledExtensionsQuery(t)),this.searchBuiltInExtensionsContextKey.set(yr.isSearchBuiltInExtensionsQuery(t)),this.searchWorkspaceUnsupportedExtensionsContextKey.set(yr.isSearchWorkspaceUnsupportedExtensionsQuery(t)),this.searchDeprecatedExtensionsContextKey.set(yr.isSearchDeprecatedExtensionsQuery(t)),this.searchRestartRequiredExtensionsContextKey.set(yr.isRestartRequiredQuery(t)),this.builtInExtensionsContextKey.set(yr.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&&!yr.isLocalExtensionsQuery(t)&&!o&&!this.searchMcpServersContextKey.get()&&!this.searchAgentPluginsContextKey.get()),this.sortByUpdateDateContextKey.set(yr.isSortUpdateDateQuery(t)),this.defaultViewsContextKey.set(!t||yr.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 M8){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?Jo(d(9919,null,o.name.value)):Jo(d(9918,null));break;default:o?Jo(d(9921,null,e,o.name.value)):Jo(d(9920,null,e));break}}getFirstExpandedPane(){for(let e of this.panes)if(e.isExpanded()&&e instanceof yr)return e}focusListView(){let e=this.getFirstExpandedPane();e&&e.count()>0&&e.focus()}onViewletOpen(e){if(!(!e||e.getId()===Yh)&&this.configurationService.getValue(OJi)){let t=this.editorGroupService.groups.map(o=>{let n=o.editors.filter(r=>r instanceof J2);return o.closeEditors(n)});Promise.all(t)}}progress(e){return this.progressService.withProgress({location:5},()=>e)}onError(e){if(so(e))return;let t=e&&e.message||"";if(/ECONNREFUSED/.test(t)){let o=dU(d(9947,null),[new st("open user settings",d(9932,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}};h0e=I([m(0,fi),m(1,Te),m(2,Bo),m(3,F),m(4,Et),m(5,vv),m(6,zi),m(7,Gc),m(8,Ne),m(9,ds),m(10,De),m(11,B),m(12,le),m(13,Pe),m(14,X),m(15,ze),m(16,lt),m(17,Ri),m(18,Po),m(19,ge),m(20,ne)],h0e);var g0e=class extends C{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(H.any(H.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===gt.Warning&&(e=new J9e(()=>t.message)),!e){let o=this.configurationService.getValue(IV)===!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(9925,null,n):d(9923,null,n)),n>0&&o.length>0&&(s+=", "),o.length&&(s+=o.length===1?d(9924,null,o.length):d(9922,null,o.length)),e=new qc(r,()=>s)}}e&&(this.badgeHandle.value=this.activityService.showViewContainerActivity(Yh,{badge:e}))}};g0e=I([m(0,zl),m(1,zi),m(2,Os),m(3,B)],g0e);var f0e=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(()=>Pi(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(9940,null):d(9937,null),run:()=>e?this.extensionsWorkbenchService.updateRunningExtensions():this.hostService.reload()}),n&&r.push({label:d(9929,null),run:()=>this.commandService.executeCommand("vscode.open",A.parse(n))}),this.notificationService.prompt(gt.Warning,d(9930,null,o.manifest.displayName||o.identifier.id),r,{sticky:!0,priority:3})}}}catch(i){this.logService.error(i)}}};f0e=I([m(0,ls),m(1,zi),m(2,oi),m(3,ne),m(4,Ne),m(5,ge)],f0e);var v0e=class extends C{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 qc(1,()=>d(9946,null));break;case"accessDenied":t=new J9e(()=>d(9906,null));break}if(t&&(this.badgeHandle.value=this.activityService.showViewContainerActivity(Yh,{badge:t})),this.accountBadgeDisposable.clear(),e==="requiresSignIn"){let o=new qc(1,()=>d(9945,null));this.accountBadgeDisposable.value=this.activityService.showAccountsActivity({badge:o})}}};v0e=I([m(0,zl),m(1,vv)],v0e);var x0=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 gn.uriToBrowserUri(je(this.local.location,this.local.manifest.icon)).toString(!0)}get resourceExtensionIconUrl(){if(this.resourceExtension?.manifest.icon)return gn.uriToBrowserUri(je(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 gn.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 gn.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(iR(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&&HTt(this.latestVersion,this.version)}get runtimeState(){return this.runtimeStateProvider(this)}get telemetryData(){let{local:i,gallery:e}=this;return e?Qle(e):i?Yxt(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=ve.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(10028,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:${JFe}) 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=zci(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}};x0=I([m(6,ta),m(7,Te),m(8,ne),m(9,be),m(10,nt)],x0);var BLi="extensions.autoUpdate",HLi="extensions.donotAutoUpdate",ULi="extensions.dismissedNotifications",age=class extends C{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(H.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=>Ot(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=>Ot(l,s.identifier))&&r.push(s);if(r.length){let s=await this.galleryService.getExtensions(r.map(u=>({...u.identifier,version:u.version})),ve.None),l=[],c=[];for(let u of r){l.push(u.identifier.id);let p=s.find(h=>Ot(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 Im(l.join(";")),missingIds:new Im(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},ve.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}],ve.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=>Ot(n.identifier,t.identifier))??this.instantiationService.createInstance(x0,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=Uci(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=a6(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(x0,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=>Ot(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(x0,this.stateProvider,this.runtimeStateProvider,this.server,n,void 0,void 0):void 0);if(u){if(n){let p=this.installed.filter(h=>Ot(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=>Ot(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()},ve.None);for(let n of e){let r=o.find(s=>Ot(s.identifier,n.identifier));r&&(n.gallery=r,this._onChange.fire({extension:n}))}}onUninstallExtension(e){let t=this.installed.filter(o=>Ot(o.identifier,e))[0];if(t){let o=this.uninstalling.filter(n=>Ot(n.identifier,e))[0]||t;this.uninstalling=[o,...this.uninstalling.filter(n=>!Ot(n.identifier,e))],this._onChange.fire(o?{extension:o}:void 0)}}onDidUninstallExtension({identifier:e,error:t}){let o=this.uninstalling.find(n=>Ot(n.identifier,e))||this.installed.find(n=>Ot(n.identifier,e));this.uninstalling=this.uninstalling.filter(n=>!Ot(n.identifier,e)),t||(this.installed=this.installed.filter(n=>!Ot(n.identifier,e))),o&&this._onChange.fire({extension:o})}onEnablementChanged(e){let t=this.local.filter(o=>e.some(n=>Ot(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&&Ot(o.gallery.identifier,e.gallery.identifier))?0:this.uninstalling.some(o=>Ot(o.identifier,e.identifier))?2:this.installed.filter(o=>o===e||o.gallery&&e.gallery&&Ot(o.gallery.identifier,e.gallery.identifier))[0]?1:3}};age=I([m(4,ta),m(5,Os),m(6,Hd),m(7,Te),m(8,F)],age);var P8=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N,O,V,U,G,$,te,pe,de,se,Se,ke,Ee,He,Ve,Fe,Qt){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=N;this.localeService=O;this.lifecycleService=V;this.fileService=U;this.userDataProfileService=G;this.userDataProfilesService=$;this.storageService=te;this.dialogService=pe;this.userDataSyncEnablementService=de;this.updateService=se;this.uriIdentityService=Se;this.workspaceContextService=ke;this.viewsService=Ee;this.fileDialogService=He;this.quickInputService=Ve;this.allowedExtensionsService=Fe;this.meteredConnectionService=Qt;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=bDt.bindTo(w),f.localExtensionManagementServer&&(this.localExtensions=this._register(e.createInstance(age,f.localExtensionManagementServer,Ze=>this.getExtensionState(Ze),Ze=>this.getRuntimeState(Ze),!f.remoteExtensionManagementServer)),this._register(this.localExtensions.onChange(Ze=>this.onDidChangeExtensions(Ze?.extension))),this._register(this.localExtensions.onReset(Ze=>this.reset())),this.extensionsServers.push(this.localExtensions)),f.remoteExtensionManagementServer&&(this.remoteExtensions=this._register(e.createInstance(age,f.remoteExtensionManagementServer,Ze=>this.getExtensionState(Ze),Ze=>this.getRuntimeState(Ze),!0)),this._register(this.remoteExtensions.onChange(Ze=>this.onDidChangeExtensions(Ze?.extension))),this._register(this.remoteExtensions.onReset(Ze=>this.reset())),this.extensionsServers.push(this.remoteExtensions)),f.webExtensionManagementServer&&(this.webExtensions=this._register(e.createInstance(age,f.webExtensionManagementServer,Ze=>this.getExtensionState(Ze),Ze=>this.getRuntimeState(Ze),!(f.remoteExtensionManagementServer||f.localExtensionManagementServer))),this._register(this.webExtensions.onChange(Ze=>this.onDidChangeExtensions(Ze?.extension))),this._register(this.webExtensions.onReset(Ze=>this.reset())),this.extensionsServers.push(this.webExtensions)),this.updatesCheckDelayer=new ya(P8.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,ULi,this._store)(e=>this.onDidDismissedNotificationsValueChange())),this._register(this.storageService.onDidChangeValue(-1,BLi,this._store)(e=>this.onDidSelectedExtensionToAutoUpdateValueChange())),this._register(this.storageService.onDidChangeValue(-1,HLi,this._store)(e=>this.onDidSelectedExtensionToAutoUpdateValueChange())),this._register(H.debounce(this.onChange,()=>{},100)(()=>{this.updateExtensionsNotificaiton(),this.reportProgressFromOtherSources()}))))}initializeAutoUpdate(){this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration(VE)&&this.isAutoUpdateEnabled()&&this.eventuallyAutoUpdateExtensions(),e.affectsConfiguration(i6e)&&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(H.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"),Gt&&!this.isAutoUpdateEnabled()&&this.autoUpdateBuiltinExtensions()})),this.hasOutdatedExtensionsContextKey.set(this.outdated.length>0),this.eventuallyCheckForUpdates(!0),Gt&&(this.syncPinnedBuiltinExtensions(),this.isAutoUpdateEnabled()||this.autoUpdateBuiltinExtensions()),this.registerAutoRestartListener(),this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration(IV)&&this.registerAutoRestartListener()}))}isAutoUpdateEnabled(){return this.meteredConnectionService.isConnectionMetered?!1:this.getAutoUpdateValue()!==!1}getAutoUpdateValue(){let e=this.configurationService.getValue(VE);return e==="onlySelectedExtensions"?!1:Da(e)||e==="onlyEnabledExtensions"?e:!0}async updateAutoUpdateForAllExtensions(e){this.isAutoUpdateEnabled()===e||!(await this.dialogService.confirm({title:d(9992,null),message:e?d(9991,null):d(9990,null),detail:d(9993,null)})).confirmed||(this.setEnabledAutoUpdateExtensions([]),await this.configurationService.updateValue(VE,e),this.setDisabledAutoUpdateExtensions([]),await this.updateExtensionsPinnedState(!e),this._onChange.fire(void 0))}registerAutoRestartListener(){this.autoRestartListenerDisposable.value=void 0,this.configurationService.getValue(IV)===!0&&(this.autoRestartListenerDisposable.value=this.hostService.onDidChangeFocus(e=>{!e&&this.configurationService.getValue(IV)===!0&&this.updateRunningExtensions(void 0,!0)}))}reportInstalledExtensionsTelemetry(){let e=this.installed.filter(t=>!t.isBuiltin&&(t.enablementState===13||t.enablementState===12)).map(t=>Ei.toKey(t.identifier.id));this.telemetryService.publicLog2("installedExtensions",{extensionIds:new Im(e.join(";")),count:e.length})}async onDidChangeRunningExtensions(e,t){let o=[],n=[];for(let s of e){let l=this.installed.find(c=>Ot({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})),ve.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(10065,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=Uci(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 Rxi([]);let o=ve.isCancellationToken(e)?{}:e,n=ve.isCancellationToken(e)?e:t;o.text=o.text?this.resolveQueryText(o.text):o.text,o.includePreRelease=cn(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(x0,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(Kle).policy?d(10001,null):d(10000,null),severity:St.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&&(!Kue(r.local.manifest.engines.vscode,this.productService.version,this.productService.date)||s4([...r.local.manifest.enabledApiProposals??[]])))?e.push({message:d(10018,null),severity:St.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(10026,null),severity:St.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(IV)){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(10014,null):d(10015,null),severity:St.Info,extensions:r,query:"@restartrequired",action:{label:s?d(10047,null):d(10051,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(9996,null),severity:St.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:"${Rxt}"`);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(x0,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"&&Ot(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=>Ot(r.identifier,{id:n}))??(await this.getExtensions([{id:e}],ve.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(J2,e),t,t?.sideByside?vn:o?ym:Un)}async openSearch(e,t){let o=(await this.viewsService.openViewContainer(Yh,!0))?.getViewPaneContainer();o.search(e),t||o.focus()}getExtensionRuntimeStatus(e){let t=this.extensionService.getExtensionsStatus();for(let o of Object.keys(t))if(Ot({id:o},e.identifier))return t[o]}async updateRunningExtensions(e=d(10049,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=>Ot({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=>Ot({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:St.Info,message:d(10016,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=>Ot({id:s.identifier.value},e.identifier)),n=this.extensionManagementServerService.remoteExtensionManagementServer?"reloadWindow":"restartExtensions",r=n==="reloadWindow"?d(10046,null):d(10050,null);if(t){let s=o&&this.extensionService.canRemoveExtension(o),l=o&&(!e.server||e.server===this.extensionManagementServerService.getExtensionManagementServer(kE(o)))&&(!e.resourceExtension||this.uriIdentityService.extUri.isEqual(e.resourceExtension.location,o.extensionLocation));return!s&&l&&!o.isUnderDevelopment?{action:n,reason:d(10040,null,r)}:void 0}if(e.local){let s=o&&e.server===this.extensionManagementServerService.getExtensionManagementServer(kE(o)),l=this.extensionEnablementService.isEnabled(e.local);if(o){if(l){if(this.extensionService.canAddExtension(kO(e.local)))return;let c=this.extensionManagementServerService.getExtensionManagementServer(kE(o));if(s){if(!o.isUnderDevelopment&&(e.version!==o.version||e.local.targetPlatform!==o.targetPlatform)){let u=this.getProductCurrentVersion(),p=this.getProductUpdateVersion();if(p&&!Kue(e.local.manifest.engines.vscode,u.version,u.date)&&Kue(e.local.manifest.engines.vscode,p.version,p.date)){let h=this.updateService.state;return h.type==="available for download"?{action:"downloadUpdate",reason:d(10041,null,this.productService.nameLong)}:h.type==="downloaded"?{action:"applyUpdate",reason:d(10044,null,this.productService.nameLong)}:h.type==="ready"?{action:"quitAndInstall",reason:d(10042,null,this.productService.nameLong)}:void 0}return{action:n,reason:d(10043,null,r)}}if(this.extensionsServers.length>1){let u=this.installed.filter(p=>Ot(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(10007,null,r)};if(c===this.extensionManagementServerService.localExtensionManagementServer&&this.extensionManifestPropertiesService.prefersExecuteOnWorkspace(e.local.manifest)&&u.server===this.extensionManagementServerService.remoteExtensionManagementServer)return{action:n,reason:d(10008,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(10039,null,r)};if(e.server===this.extensionManagementServerService.remoteExtensionManagementServer&&c===this.extensionManagementServerService.localExtensionManagementServer&&this.extensionManifestPropertiesService.prefersExecuteOnWorkspace(e.local.manifest))return{action:n,reason:d(10039,null,r)}}return}else if(s)return{action:n,reason:d(10038,null,r)};return}else{if(l&&!this.extensionService.canAddExtension(kO(e.local)))return{action:n,reason:d(10039,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=>Ot(p.identifier,e.identifier)&&p.server===c)[0];if(u&&u.local&&this.extensionEnablementService.isEnabled(u.local))return{action:n,reason:d(10039,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=>Ot(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()},ve.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:{[UL]:!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,ve.None);if(!s)throw new Error(d(10013,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(9988,null):D3e(p),id:p});if(c.length>1){let p=d(10037,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},ve.None));let u=await this.fileDialogService.showOpenDialog({title:d(10003,null),canSelectFiles:!1,canSelectFolders:!0,canSelectMany:!1,openLabel:d(10002,null)});u?.[0]&&this.progressService.withProgress({location:15},async p=>{try{p.report({message:d(10006,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(10004,null))}catch(h){this.notificationService.error(d(10005,null,Cn(h)))}})}async pickVersionToDownload(e){let t=await this.galleryService.getAllVersions({id:e});if(!t.length){await this.dialogService.info(d(10031,null));return}let o=t.map((r,s)=>({id:r.version,label:r.version,description:`${Bs(new Date(Date.parse(r.date)),!0)}${r.isPreReleaseVersion?` (${d(10045,null)})`:""}`,ariaLabel:`${r.isPreReleaseVersion?"Pre-Release version":"Release version"} ${r.version}`,data:r}));return(await this.quickInputService.pick(o,{placeHolder:d(10052,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(i6e)}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:P8.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 fn.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,ve.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 fn.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&&vke(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(9995,null);if(!(!e.local.manifest.engines.vscode||e.local.manifest.main||e.local.manifest.browser)){if(mo(e.gallery.properties?.executesCode)){if(!e.gallery.properties.executesCode)return}else{let t=e instanceof x0?await e.getGalleryManifest():await this.galleryService.getManifest(e.gallery,ve.None);if(!t?.main&&!t?.browser)return}return d(9994,null,e.displayName)}}}isAutoUpdateEnabledFor(e){if(Ae(e)){if(mj.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(Ae(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(Ae(e)){if(mj.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 x0))return new xe().appendText(d(10032,null));if(e.isMalicious)return new xe().appendText(d(10027,null));if(e.deprecationInfo?.disallowInstall)return new xe().appendText(d(9999,null));if(e.gallery){if(!e.gallery.isSigned&&L3e(e.private,await this.extensionGalleryManifestService.getExtensionGalleryManifest()))return new xe().appendText(d(10035,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 xe().appendText(d(9989,null,e.displayName??e.identifier.id))}return e.resourceExtension&&await this.extensionManagementService.canInstall(e.resourceExtension)===!0?!0:new xe().appendText(d(9989,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(Ae(e)?(r=this.local.find(u=>Ot(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},ve.None)).at(0)}if(!r&&c&&(r=this.instantiationService.createInstance(x0,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(10027,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=>Ot(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=Ae(e)?e:e.identifier.id,p=await this.extensionGalleryManifestService.getExtensionGalleryManifest(),h=p?oP(p,"ContactSupportUri"):void 0,g=h?d(10048,null,h.toString()):"";if(t.version){let f=d(10034,null,u,t.version);throw new ch(g?`${f} ${g}`:f,"NotFound")}else{let f=d(10033,null,u);throw new ch(g?`${f} ${g}`:f,"NotFound")}}n=c}t.version&&(t.installGivenVersion=!0),r?.isWorkspaceScoped&&(t.isWorkspaceScoped=!0)}}if(n){if(t.justification){let l=cn(t.isMachineScoped)&&this.userDataSyncEnablementService.isEnabled()&&this.userDataSyncEnablementService.isResourceEnabled("extensions"),c=[];c.push({label:Ae(t.justification)||!t.justification.action?d(10019,null):d(10020,null,t.justification.action),run:()=>!0}),r||c.push({label:d(10036,null),run:()=>(this.open(r),!1)});let u=await this.dialogService.prompt({title:d(10022,null),message:r?d(10021,null,r.displayName,r.publisherDisplayName):d(10025,null),detail:Ae(t.justification)?t.justification:t.justification.reason,cancelButton:!0,buttons:c,checkbox:l?{label:d(10055,null),checked:!0}:void 0});if(!u.result)throw new ho;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(10064,null));if(t.enable){if(r.enablementState===11||r.enablementState===10){if(t.justification&&!(await this.dialogService.confirm({title:d(10012,null),message:d(10011,null,r.displayName),detail:Ae(t.justification)?t.justification:t.justification.reason,primaryButton:Ae(t.justification)?d(10009,null):d(10010,null,t.justification.action)})).confirmed)throw new ho;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}],ve.None))[0]??e),e.gallery)return t.extensionManagementService.installFromGallery(e.gallery,{installPreReleaseVersion:n.preRelease,...o});let r=await t.extensionManagementService.getTargetPlatform();if(!zle(n.targetPlatform,[n.targetPlatform],r))throw new Error(d(10017,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!(!Gt||!e.gallery||!vY(e.gallery))}async setLanguage(e){if(!this.canSetLanguage(e))throw new Error("Can not set language");let t=vY(e.gallery);if(t===Dr)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=>Ot(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(10060,null),type:St.Info,message:d(10061,null,t.displayName),primaryButton:d(10059,null)});if(!s)throw new ho}let o=[{extension:t.local}];if(!Ot(t.identifier,{id:this.productService.defaultChatAgent.extensionId}))for(let s of this.getAllPackedExtensions(t,this.local))s.local&&!o.some(l=>Ot(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)Ot(c.identifier,s.identifier)||!c.manifest.extensionDependencies||c.manifest.extensionDependencies.length===0||s.manifest.extensionPack?.some(p=>Ot({id:p},c.identifier))||n.some(p=>p.manifest.extensionPack?.some(h=>Ot({id:h},c.identifier)))||c.manifest.extensionDependencies.some(p=>Ot(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(10062,null),type:St.Warning,message:this.getErrorMessageForUninstallingAnExtensionWithDependents(t,n),buttons:[{label:d(10058,null),run:()=>!0}],cancelButton:{run:()=>!1}});if(!s)throw new ho}return this.withProgress({location:5,title:d(10063,null),source:`${t.identifier.id}`},()=>this.extensionManagementService.uninstallExtensions(o).then(()=>{}))}getAllPackedExtensions(e,t,o=[]){if(o.some(r=>Ot(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=>Ot({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(10054,null,e.displayName,t[0].manifest.displayName):t.length===2?d(10057,null,e.displayName,t[0].manifest.displayName,t[1].manifest.displayName):d(10030,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||Xq(n.local.manifest)||n.isBuiltin)return;let r=n.local.isApplicationScoped;await Promise.all(o.map(async s=>{let l=s.local.find(c=>Ot(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(10024,null,e.displayName):d(10023,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=>Ot(r.identifier,{id:Df(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=>Ot(o.identifier,e));if(t||await H.toPromise(H.filter(this.onChange,o=>!!o&&this.local.some(n=>Ot(n.identifier,e)))),t=this.local.find(o=>Ot(o.identifier,e)),!t)throw new Error("Extension should have been installed");return t}async waitUntilExtensionIsEnabled(e){this.extensionService.extensions.find(t=>Ei.equals(t.identifier,e.identifier.id))||!e.local||!this.extensionService.canAddExtension(kO(e.local))||await new Promise((t,o)=>{let n=this.extensionService.onDidChangeExtensions(()=>{try{this.extensionService.extensions.find(r=>Ei.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(9998,null),type:St.Warning,message:this.getDependentsErrorMessageForDisablement(s,n,l),buttons:[{label:d(9997,null),run:()=>!0}],cancelButton:{run:()=>!1}});if(!c)throw new ho;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=>Ot({id:g},c.identifier))||n.pack&&h.extensionPack.some(g=>Ot({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=>Ot(s.identifier,{id:r}))))}getDependentsErrorMessageForDisablement(e,t,o){for(let n of[e,...t]){let r=o.filter(s=>s.dependencies.some(l=>Ot({id:l},n.identifier)));if(r.length)return this.getErrorMessageForDisablingAnExtensionWithDependents(n,r)}return""}getErrorMessageForDisablingAnExtensionWithDependents(e,t){return t.length===1?d(10053,null,e.displayName,t[0].displayName):t.length===2?d(10056,null,e.displayName,t[0].displayName,t[1].displayName):d(10029,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=xn(()=>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(so(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=>Ot(s.identifier,{id:o}));r||([r]=await this.getExtensions([{id:o}],{source:"uri"},ve.None)),r&&(await this.hostService.focus(It),await this.open(r))}).then(void 0,n=>this.onError(n))}getPublishersToAutoUpdate(){return this.getEnabledAutoUpdateExtensions().filter(e=>!mj.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(BLi,-1,"[]")}setEnabledAutoUpdateExtensionsValue(e){this.storageService.store(BLi,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(HLi,-1,"[]")}setDisabledAutoUpdateExtensionsValue(e){this.storageService.store(HLi,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(ULi,0,"[]")}setDismissedNotificationsValue(e){this.storageService.store(ULi,e,0,0)}};P8=I([m(0,F),m(1,ee),m(2,Hd),m(3,ta),m(4,vv),m(5,B),m(6,Te),m(7,Ne),m(8,nI),m(9,Os),m(10,oi),m(11,Bo),m(12,Gc),m(13,kt),m(14,MK),m(15,JE),m(16,nt),m(17,X),m(18,xp),m(19,ne),m(20,lt),m(21,oB),m(22,ao),m(23,be),m(24,mn),m(25,an),m(26,le),m(27,ct),m(28,_l),m(29,zd),m(30,dt),m(31,Pe),m(32,Ft),m(33,dn),m(34,Ge),m(35,zp),m(36,eJ)],P8);async function zLi(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=>Ot(v.identifier,{id:l}));if(!g)continue;let f=(await e.getExtensions([{id:u,preRelease:h}],{targetPlatform:await i.getTargetPlatform(),compatible:!0},ve.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=>Ot(S,g.identifier));await i.uninstall(g,{profileLocation:a?.extensionsResource}),n.info(`Uninstalled the unsupported extension '${g.identifier.id}'`);let b=s.find(S=>Ot(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:{[UL]:!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(Jb(g.manifest.publisher,g.manifest.name),Jb(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=>Ot(h.identifier,{id:l})&&KYi(h.manifest.version,c));if(!u)continue;let p=(await e.getExtensions([{id:l,preRelease:u.preRelease}],{targetPlatform:await i.getTargetPlatform(),compatible:!0},ve.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:{[UL]:!0}}),n.info(`Autoupdated '${u.identifier.id}' extension to '${p.version}' extension.`)}catch(u){n.error(u)}}catch(r){n.error(r)}}var b0e=class{constructor(i,e,t,o,n){i.remoteExtensionManagementServer&&zLi(void 0,i.remoteExtensionManagementServer.extensionManagementService,e,t,o,n),i.webExtensionManagementServer&&zLi(void 0,i.webExtensionManagementServer.extensionManagementService,e,t,o,n)}};b0e=I([m(0,Gc),m(1,ta),m(2,Hz),m(3,nz),m(4,ne)],b0e);we(zi,P8,0);we(yie,e0e,1);we(nD,c0e,0);oe.as(Tu.Quickaccess).registerQuickAccessProvider({ctor:R8,prefix:R8.PREFIX,placeholder:d(9643,null),helpEntries:[{description:d(9642,null)}]});oe.as(rn.EditorPane).registerEditorPane(ys.create(C0,C0.ID,d(9572,null)),[new Mt(J2)]);var I0e=oe.as(on.ViewContainersRegistry).registerViewContainer({id:Yh,title:L(9580,"Extensions"),openCommandActionDescriptor:{id:Yh,mnemonicTitle:d(9645,null),keybindings:{primary:3126},order:4},ctorDescriptor:new Mt(h0e),icon:plo,order:4,rejectAddedViews:!0,alwaysUseContainerInfo:!0},0);oe.as(ii.Configuration).registerConfiguration({id:"extensions",order:30,title:d(9598,null),type:"object",properties:{"extensions.autoUpdate":{enum:[!0,"onlyEnabledExtensions",!1],enumItemLabels:[d(9552,null),d(9569,null),d(9648,null)],enumDescriptions:[d(9586,null),d(9584,null),d(9585,null)],description:d(9583,null),default:!0,scope:1,tags:["usesOnlineServices"]},"extensions.autoCheckUpdates":{type:"boolean",description:d(9596,null),default:!0,scope:1,tags:["usesOnlineServices"]},"extensions.ignoreRecommendations":{type:"boolean",description:d(9600,null),default:!1},"extensions.showRecommendationsOnlyOnDemand":{type:"boolean",deprecationMessage:d(9603,null),default:!1,tags:["usesOnlineServices"]},"extensions.closeExtensionDetailsOnViewChange":{type:"boolean",description:d(9597,null),default:!1},"extensions.confirmedUriHandlerExtensionIds":{type:"array",items:{type:"string"},description:d(9614,null),default:[],scope:1},"extensions.webWorker":{type:["boolean","string"],enum:[!0,!1,"auto"],enumDescriptions:[d(9608,null),d(9607,null),d(9606,null)],description:d(9605,null),default:"auto"},"extensions.supportVirtualWorkspaces":{type:"object",markdownDescription:d(9594,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(9581,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}}]},[zTt]:{type:"object",scope:1,markdownDescription:d(9588,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(9592,null),d(9589,null),d(9590,null)],description:d(9591,null)},version:{type:"string",description:d(9593,null)}}}}},"extensions.experimental.deferredStartupFinishedActivation":{type:"boolean",description:d(9599,null),default:!1},"extensions.experimental.issueQuickAccess":{type:"boolean",description:d(9601,null),default:!0},"extensions.allowOpenInModalEditor":{type:"boolean",description:d(9582,null),default:!1,tags:["experimental"],experiment:{mode:"auto"}},[nxe]:{type:"boolean",description:d(9595,null),default:!0,scope:1,included:kr},[IV]:{type:"boolean",description:d(9553,null),default:!1,included:to.quality!=="stable"},[A3e]:{type:"string",description:d(9587,null),default:"",scope:1,tags:["usesOnlineServices"],included:!1,policy:{name:"ExtensionGalleryServiceUrl",category:"Extensions",minimumVersion:"1.99",localization:{description:{key:"extensions.gallery.serviceUrl",value:d(9587,null)}}}},"extensions.supportNodeGlobalNavigator":{type:"boolean",description:d(9604,null),default:!1},[Axt]:{type:"number",description:d(9602,null),default:6e4,scope:1,tags:["advanced","usesOnlineServices"]}}});var Uin=oe.as(ea.JSONContribution);Uin.registerSchema(Tyi,ulo);qe.registerCommand("_extensions.manage",(a,i,e,t,o)=>{let n=a.get(zi),r=n.local.find(s=>Ot(s.identifier,{id:i}));if(r)n.open(r,{tab:e,preserveFocus:t,feature:o});else throw new Error(d(9649,null,i))});qe.registerCommand("extension.open",async(a,i,e,t,o,n)=>{let r=a.get(zi),s=a.get(ge),[l]=await r.getExtensions([{id:i}],ve.None);return l?r.open(l,{tab:e,preserveFocus:t,feature:o,sideByside:n}):s.executeCommand("_extensions.manage",i,e,t,o)});qe.registerCommand({id:"workbench.extensions.installExtension",metadata:{description:d(9695,null),args:[{name:"extensionIdOrVSIXUri",description:d(9694,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(9699,null),default:!1},installPreReleaseVersion:{type:"boolean",description:d(9700,null),default:!1},donotSync:{type:"boolean",description:d(9697,null),default:!1},justification:{type:["string","object"],description:d(9701,null)},enable:{type:"boolean",description:d(9698,null),default:!1},context:{type:"object",description:d(9696,null)}}}}]},handler:async(a,i,e)=>{let t=a.get(zi),o=a.get(Hd),n=a.get(ta);try{if(typeof i=="string"){let[r,s]=M3e(i);if(t.local.find(c=>Ot(c.identifier,{id:r,uuid:s}))?.enablementState===1){let[c]=await n.getExtensions([{id:r,preRelease:e?.installPreReleaseVersion}],ve.None);if(!c)throw new Error(d(9649,null,i));await o.installFromGallery(c,{isMachineScoped:e?.donotSync?!0:void 0,installPreReleaseVersion:e?.installPreReleaseVersion,installGivenVersion:!!s,context:{...e?.context,[YW]:"command"}})}else await t.install(r,{version:s,installPreReleaseVersion:e?.installPreReleaseVersion,context:{...e?.context,[YW]:"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}}});qe.registerCommand({id:"workbench.extensions.uninstallExtension",metadata:{description:d(9705,null),args:[{name:d(9704,null),schema:{type:"string"}}]},handler:async(a,i)=>{if(!i)throw new Error(d(9615,null));let e=a.get(ls),t=await e.getInstalled(),[o]=t.filter(n=>Ot(n.identifier,{id:i}));if(!o)throw new Error(d(9650,null,i));if(o.isBuiltin)throw new Error(d(9554,null,i));try{await e.uninstall(o)}catch(n){throw mt(n),n}}});qe.registerCommand({id:"workbench.extensions.search",metadata:{description:d(9703,null),args:[{name:d(9702,null),schema:{type:"string"}}]},handler:async(a,i="")=>a.get(zi).openSearch(i)});function $Li(a,i){a?.addImplementation(105,"extensions-editor",e=>{let o=e.get(ee).activeEditorPane;return o instanceof C0&&o.activeWebview?.isFocused?(i(o.activeWebview),!0):!1})}$Li($M,a=>a.copy());$Li(EW,a=>a.cut());$Li(GM,a=>a.paste());var ZC=new Q("hasLocalServer",!1),Rk=new Q("hasRemoteServer",!1),FA=new Q("hasWebServer",!1),tSo=new Q("gallerySortCapabilities",""),KLi=new Q("galleryFilterCapabilities",""),iSo=new Q("galleryAllPublicRepositorySigned",!1),oSo=new Q("galleryAllPrivateRepositorySigned",!1),nSo=new Q("galleryHasExtensionLink",!1);async function GLi(a){try{await a.run()}finally{Ac(a)&&a.dispose()}}var pnt=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h){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;let g=ZC.bindTo(n);this.extensionManagementServerService.localExtensionManagementServer&&g.set(!0);let f=Rk.bindTo(n);this.extensionManagementServerService.remoteExtensionManagementServer&&f.set(!0);let v=FA.bindTo(n);this.extensionManagementServerService.webExtensionManagementServer&&v.set(!0),this.updateExtensionGalleryStatusContexts(),this._register(o.onDidChangeExtensionGalleryManifestStatus(()=>this.updateExtensionGalleryStatusContexts())),o.getExtensionGalleryManifest().then(b=>{this.updateGalleryCapabilitiesContexts(b),this._register(o.onDidChangeExtensionGalleryManifest(S=>this.updateGalleryCapabilitiesContexts(S)))}),this.registerGlobalActions(),this.registerContextMenuActions(),this.registerQuickAccessProvider()}async updateExtensionGalleryStatusContexts(){fh.bindTo(this.contextKeyService).set(this.extensionGalleryManifestService.extensionGalleryManifestStatus==="available"),uX.bindTo(this.contextKeyService).set(this.extensionGalleryManifestService.extensionGalleryManifestStatus)}async updateGalleryCapabilitiesContexts(e){tSo.bindTo(this.contextKeyService).set(`_${e?.capabilities.extensionQuery.sorting?.map(t=>t.name)?.join("_")}_UpdateDate_`),KLi.bindTo(this.contextKeyService).set(`_${e?.capabilities.extensionQuery.filtering?.map(t=>t.name)?.join("_")}_`),iSo.bindTo(this.contextKeyService).set(!!e?.capabilities?.signing?.allPublicRepositorySigned),oSo.bindTo(this.contextKeyService).set(!!e?.capabilities?.signing?.allPrivateRepositorySigned),nSo.bindTo(this.contextKeyService).set(!!(e&&oP(e,"ExtensionDetailsViewUriTemplate")))}registerQuickAccessProvider(){(this.extensionManagementServerService.localExtensionManagementServer||this.extensionManagementServerService.remoteExtensionManagementServer||this.extensionManagementServerService.webExtensionManagementServer)&&oe.as(Tu.Quickaccess).registerQuickAccessProvider({ctor:L8,prefix:L8.PREFIX,placeholder:d(9625,null),helpEntries:[{description:d(9624,null)}]})}registerGlobalActions(){this._register(fe.appendMenuItem(D.MenubarPreferencesMenu,{command:{id:Yh,title:d(9644,null)},group:"2_configuration",order:3})),this._register(fe.appendMenuItem(D.GlobalActivity,{command:{id:Yh,title:d(9660,null)},group:"2_configuration",order:3})),this.registerExtensionAction({id:"workbench.extensions.action.focusExtensionsView",title:L(9613,"Focus on Extensions View"),category:dh,f1:!0,run:async l=>{await l.get(zi).openSearch("")}}),this.registerExtensionAction({id:"workbench.extensions.action.installExtensions",title:L(9626,"Install Extensions"),category:dh,menu:{id:D.CommandPalette,when:x.and(fh,x.or(ZC,Rk,FA))},run:async l=>{l.get(Ft).openViewContainer(Yh,!0)}}),this.registerExtensionAction({id:"workbench.extensions.action.showRecommendedKeymapExtensions",title:L(9665,"Keymaps"),category:kci,menu:[{id:D.CommandPalette,when:fh},{id:D.EditorTitle,when:x.and(nf,fh),group:"2_keyboard_discover_actions"}],menuTitles:{[D.EditorTitle.id]:d(9616,null)},run:()=>this.extensionsWorkbenchService.openSearch("@recommended:keymaps ")}),this.registerExtensionAction({id:"workbench.extensions.action.showLanguageExtensions",title:L(9662,"Language Extensions"),category:kci,menu:{id:D.CommandPalette,when:fh},run:()=>this.extensionsWorkbenchService.openSearch("@recommended:languages ")}),this.registerExtensionAction({id:"workbench.extensions.action.checkForUpdates",title:L(9556,"Check for Extension Updates"),category:dh,menu:[{id:D.CommandPalette,when:x.and(fh,x.or(ZC,Rk,FA))},{id:D.ViewContainerTitle,when:x.and(x.equals("viewContainer",Yh),fh),group:"1_updates",order:1}],run:async()=>(await this.extensionsWorkbenchService.checkForUpdates(),this.extensionsWorkbenchService.outdated.length?this.extensionsWorkbenchService.openSearch("@outdated "):this.dialogService.info(d(9651,null)))});let e=x.equals(`config.${VE}`,!1);this.registerExtensionAction({id:"workbench.extensions.action.enableAutoUpdate",title:L(9568,"Enable Auto Update for All Extensions"),category:dh,precondition:e,menu:[{id:D.ViewContainerTitle,order:5,group:"1_updates",when:x.and(x.equals("viewContainer",Yh),e)},{id:D.CommandPalette}],run:l=>l.get(zi).updateAutoUpdateForAllExtensions(!0)});let t=x.notEquals(`config.${VE}`,!1);this.registerExtensionAction({id:"workbench.extensions.action.disableAutoUpdate",title:L(9560,"Disable Auto Update for All Extensions"),precondition:t,category:dh,menu:[{id:D.ViewContainerTitle,order:5,group:"1_updates",when:x.and(x.equals("viewContainer",Yh),t)},{id:D.CommandPalette}],run:l=>l.get(zi).updateAutoUpdateForAllExtensions(!1)}),this.registerExtensionAction({id:"workbench.extensions.action.updateAllExtensions",title:L(9676,"Update All Extensions"),category:dh,precondition:bDt,menu:[{id:D.CommandPalette,when:x.and(fh,x.or(ZC,Rk,FA))},{id:D.ViewContainerTitle,when:x.and(x.equals("viewContainer",Yh),x.or(x.has(`config.${VE}`).negate(),x.equals(`config.${VE}`,"onlyEnabledExtensions"))),group:"1_updates",order:2},{id:D.ViewTitle,when:x.equals("view",gDt),group:"navigation",order:1}],icon:Dyi,run:async()=>{await this.extensionsWorkbenchService.updateAll()}}),this.registerExtensionAction({id:"workbench.extensions.action.enableAll",title:L(9566,"Enable All Extensions"),category:dh,menu:[{id:D.CommandPalette,when:x.or(ZC,Rk,FA)},{id:D.ViewContainerTitle,when:x.equals("viewContainer",Yh),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(9567,"Enable All Extensions for this Workspace"),category:dh,menu:{id:D.CommandPalette,when:x.and(Qa.notEqualsTo("empty"),x.or(ZC,Rk,FA))},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(9558,"Disable All Installed Extensions"),category:dh,menu:[{id:D.CommandPalette,when:x.or(ZC,Rk,FA)},{id:D.ViewContainerTitle,when:x.equals("viewContainer",Yh),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(9559,"Disable All Installed Extensions for this Workspace"),category:dh,menu:{id:D.CommandPalette,when:x.and(Qa.notEqualsTo("empty"),x.or(ZC,Rk,FA))},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:vDt,title:L(9630,"Install from VSIX..."),category:dh,menu:[{id:D.CommandPalette,when:x.or(ZC,Rk)},{id:D.ViewContainerTitle,when:x.and(x.equals("viewContainer",Yh),x.or(ZC,Rk)),group:"3_install",order:1}],run:async l=>{let c=l.get(dn),u=l.get(ge),p=await c.showOpenDialog({title:d(9629,null),filters:[{name:"VSIX Extensions",extensions:["vsix"]}],canSelectFiles:!0,canSelectMany:!0,openLabel:$$(d(9620,null))});p&&await u.executeCommand(o6e,p)}}),this.registerExtensionAction({id:o6e,title:d(9632,null),menu:[{id:D.ExplorerContext,group:"extensions",when:x.and(Fo.Extension.isEqualTo(".vsix"),x.or(ZC,Rk))}],run:async(l,c)=>{let u=l.get(zi),p=l.get(oi),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(St.Info,g.length>1?d(9639,null):d(9636,null),[{label:d(9633,null),run:()=>p.reload()}]):S?h.prompt(St.Info,g.length>1?d(9640,null):d(9637,null),[{label:d(9634,null),run:()=>u.updateRunningExtensions()}]):h.prompt(St.Info,g.length>1?d(9638,null):d(9635,null),[])}}),this.registerExtensionAction({id:"workbench.extensions.action.installExtensionFromLocation",title:L(9623,"Install Extension from Location..."),category:We.Developer,menu:[{id:D.CommandPalette,when:x.or(FA,ZC)}],run:async l=>{let c=l.get(Hd);if(Gt)return new Promise((u,p)=>{let h=l.get(Ge),g=new P,f=g.add(h.createQuickPick());f.title=d(9627,null),f.customButton=!0,f.customLabel=d(9618,null),f.placeholder=d(9628,null),f.ignoreFocusOut=!0,g.add(H.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(dn).showOpenDialog({canSelectFolders:!0,canSelectFiles:!1,canSelectMany:!1,title:d(9627,null)});p?.[0]&&await c.installFromLocation(p[0])}}}),fe.appendMenuItem(s6e,{submenu:Xh,title:d(9612,null),group:"navigation",order:2,icon:MWt});let o="extensions.filter.featured",n=x.and(fh,x.regex(KLi.key,new RegExp("_Featured_")));this.registerExtensionAction({id:o,title:L(9661,"Show Featured Extensions"),category:dh,menu:[{id:D.CommandPalette,when:n},{id:Xh,when:n,group:"1_predefined",order:1}],menuTitles:{[Xh.id]:d(9610,null)},run:()=>this.extensionsWorkbenchService.openSearch("@featured ")}),this.registerExtensionAction({id:"workbench.extensions.action.showPopularExtensions",title:L(9663,"Show Popular Extensions"),category:dh,menu:[{id:D.CommandPalette,when:fh},{id:Xh,when:fh,group:"1_predefined",order:2}],menuTitles:{[Xh.id]:d(9646,null)},run:()=>this.extensionsWorkbenchService.openSearch("@popular ")}),this.registerExtensionAction({id:"workbench.extensions.action.showRecommendedExtensions",title:L(9664,"Show Recommended Extensions"),category:dh,menu:[{id:D.CommandPalette,when:fh},{id:Xh,when:fh,group:"1_predefined",order:2}],menuTitles:{[Xh.id]:d(9647,null)},run:()=>this.extensionsWorkbenchService.openSearch("@recommended ")}),this.registerExtensionAction({id:"workbench.extensions.action.recentlyPublishedExtensions",title:L(9653,"Show Recently Published Extensions"),category:dh,menu:[{id:D.CommandPalette,when:fh},{id:Xh,when:fh,group:"1_predefined",order:2}],menuTitles:{[Xh.id]:d(9652,null)},run:()=>this.extensionsWorkbenchService.openSearch("@recentlyPublished ")});let r=new D("extensionsCategoryFilterSubMenu");fe.appendMenuItem(Xh,{submenu:r,title:d(9611,null),when:x.and(fh,x.regex(KLi.key,new RegExp("_Category_"))),group:"2_categories",order:1}),gO.forEach((l,c)=>{this.registerExtensionAction({id:`extensions.actions.searchByCategory.${l}`,title:l,menu:[{id:r,when:fh,order:c}],run:()=>this.extensionsWorkbenchService.openSearch(`@category:"${l.toLowerCase()}"`)})}),this.registerExtensionAction({id:"workbench.extensions.action.installedExtensions",title:L(9622,"Show Installed Extensions"),category:dh,f1:!0,menu:[{id:Xh,group:"3_installed",order:1}],menuTitles:{[Xh.id]:d(9621,null)},run:()=>this.extensionsWorkbenchService.openSearch("@installed ")}),this.registerExtensionAction({id:"workbench.extensions.action.listBuiltInExtensions",title:L(9657,"Show Built-in Extensions"),category:dh,menu:[{id:D.CommandPalette,when:x.or(ZC,Rk,FA)},{id:Xh,group:"3_installed",order:3}],menuTitles:{[Xh.id]:d(9555,null)},run:()=>this.extensionsWorkbenchService.openSearch("@builtin ")}),this.registerExtensionAction({id:"workbench.extensions.action.extensionUpdates",title:L(9609,"Show Extension Updates"),category:dh,precondition:fh,f1:!0,menu:[{id:Xh,group:"3_installed",when:fh,order:2}],menuTitles:{[Xh.id]:d(9573,null)},run:()=>this.extensionsWorkbenchService.openSearch("@updates")}),this.registerExtensionAction({id:yV,title:L(9666,"Show Extensions Unsupported By Workspace"),category:dh,menu:[{id:D.CommandPalette,when:x.or(ZC,Rk)},{id:Xh,group:"3_installed",order:6,when:x.or(ZC,Rk)}],menuTitles:{[Xh.id]:d(9706,null)},run:()=>this.extensionsWorkbenchService.openSearch("@workspaceUnsupported")}),this.registerExtensionAction({id:"workbench.extensions.action.showEnabledExtensions",title:L(9659,"Show Enabled Extensions"),category:dh,menu:[{id:D.CommandPalette,when:x.or(ZC,Rk,FA)},{id:Xh,group:"3_installed",order:4}],menuTitles:{[Xh.id]:d(9570,null)},run:()=>this.extensionsWorkbenchService.openSearch("@enabled ")}),this.registerExtensionAction({id:"workbench.extensions.action.showDisabledExtensions",title:L(9658,"Show Disabled Extensions"),category:dh,menu:[{id:D.CommandPalette,when:x.or(ZC,Rk,FA)},{id:Xh,group:"3_installed",order:5}],menuTitles:{[Xh.id]:d(9561,null)},run:()=>this.extensionsWorkbenchService.openSearch("@disabled ")});let s=new D("extensionsSortSubMenu");fe.appendMenuItem(Xh,{submenu:s,title:d(9673,null),when:x.and(x.or(fh,yC)),group:"4_sort",order:1}),[{id:"installs",title:d(9668,null),precondition:sge.negate(),sortCapability:"InstallCount"},{id:"rating",title:d(9671,null),precondition:sge.negate(),sortCapability:"WeightedRating"},{id:"name",title:d(9669,null),precondition:sge.negate(),sortCapability:"Title"},{id:"publishedDate",title:d(9670,null),precondition:sge.negate(),sortCapability:"PublishedDate"},{id:"updateDate",title:d(9672,null),precondition:x.and(OLi.negate(),WLi.negate(),sge.negate()),sortCapability:"UpdateDate"}].map(({id:l,title:c,precondition:u,sortCapability:p},h)=>{let g=x.regex(tSo.key,new RegExp(`_${p}_`));this.registerExtensionAction({id:`extensions.sort.${l}`,title:c,precondition:x.and(u,x.regex(VLi.key,/^@contribute:/).negate(),g),menu:[{id:s,when:x.and(x.or(fh,yC),g),order:h}],toggled:NLi.isEqualTo(l),run:async()=>{let f=(await this.viewsService.openViewContainer(Yh,!0))?.getViewPaneContainer(),v=X2.parse(f?.searchValue??"");f?.search(new X2(v.value,l).toString()),f?.focus()}})}),this.registerExtensionAction({id:"workbench.extensions.action.clearExtensionsSearchResults",title:L(9557,"Clear Extensions Search Results"),category:dh,icon:mlo,f1:!0,precondition:FLi,menu:{id:s6e,group:"navigation",order:1},run:async l=>{let c=l.get(Ft).getActiveViewPaneContainerWithId(Yh);if(c){let u=c;u.search(""),u.focus()}}}),this.registerExtensionAction({id:"workbench.extensions.action.refreshExtension",title:L(9654,"Refresh"),category:dh,icon:hlo,f1:!0,menu:{id:D.ViewContainerTitle,when:x.equals("viewContainer",Yh),group:"navigation",order:2},run:async l=>{let c=l.get(Ft).getActiveViewPaneContainerWithId(Yh);c&&await c.refresh()}}),this.registerExtensionAction({id:"workbench.extensions.action.installWorkspaceRecommendedExtensions",title:d(9641,null),icon:Dyi,menu:{id:D.ViewTitle,when:x.equals("view",iEe),group:"navigation",order:1},run:async l=>l.get(Ft).getActiveViewWithId(iEe).installWorkspaceRecommendations()}),this.registerExtensionAction({id:GK.ID,title:GK.LABEL,icon:flo,menu:[{id:D.CommandPalette,when:Qa.notEqualsTo("empty")},{id:D.ViewTitle,when:x.equals("view",iEe),group:"navigation",order:2}],run:()=>GLi(this.instantiationService.createInstance(GK,GK.ID,GK.LABEL))}),this.registerExtensionAction({id:aA.ID,title:{value:aA.LABEL,original:"Install Specific Version of Extension..."},category:dh,menu:{id:D.CommandPalette,when:x.and(fh,x.or(ZC,Rk,FA))},run:()=>GLi(this.instantiationService.createInstance(aA,aA.ID,aA.LABEL))})}registerContextMenuActions(){this.registerExtensionAction({id:fk.ID,title:fk.TITLE,menu:{id:D.ExtensionContext,group:oEe,order:0,when:x.and(x.not("inExtensionEditor"),x.equals("extensionStatus","installed"),x.has("extensionHasColorThemes"))},run:async(e,t)=>{let o=e.get(zi),n=e.get(F),r=o.local.find(s=>Ot(s.identifier,{id:t}));if(r){let s=n.createInstance(fk);return s.extension=r,s.run()}}}),this.registerExtensionAction({id:vk.ID,title:vk.TITLE,menu:{id:D.ExtensionContext,group:oEe,order:0,when:x.and(x.not("inExtensionEditor"),x.equals("extensionStatus","installed"),x.has("extensionHasFileIconThemes"))},run:async(e,t)=>{let o=e.get(zi),n=e.get(F),r=o.local.find(s=>Ot(s.identifier,{id:t}));if(r){let s=n.createInstance(vk);return s.extension=r,s.run()}}}),this.registerExtensionAction({id:bk.ID,title:bk.TITLE,menu:{id:D.ExtensionContext,group:oEe,order:0,when:x.and(x.not("inExtensionEditor"),x.equals("extensionStatus","installed"),x.has("extensionHasProductIconThemes"))},run:async(e,t)=>{let o=e.get(zi),n=e.get(F),r=o.local.find(s=>Ot(s.identifier,{id:t}));if(r){let s=n.createInstance(bk);return s.extension=r,s.run()}}}),this.registerExtensionAction({id:"workbench.extensions.action.showPreReleaseVersion",title:L(9655,"Show Pre-Release Version"),menu:{id:D.ExtensionContext,group:pX,order:0,when:x.and(x.has("inExtensionEditor"),x.has("galleryExtensionHasPreReleaseVersion"),x.has("isPreReleaseExtensionAllowed"),x.not("showPreReleaseVersion"),x.not("isBuiltinExtension"))},run:async(e,t)=>{let o=e.get(zi),n=(await o.getExtensions([{id:t}],ve.None))[0];o.open(n,{showPreReleaseVersion:!0})}}),this.registerExtensionAction({id:"workbench.extensions.action.showReleasedVersion",title:L(9656,"Show Release Version"),menu:{id:D.ExtensionContext,group:pX,order:1,when:x.and(x.has("inExtensionEditor"),x.has("galleryExtensionHasPreReleaseVersion"),x.has("extensionHasReleaseVersion"),x.has("showPreReleaseVersion"),x.not("isBuiltinExtension"))},run:async(e,t)=>{let o=e.get(zi),n=(await o.getExtensions([{id:t}],ve.None))[0];o.open(n,{showPreReleaseVersion:!1})}}),this.registerExtensionAction({id:zC.ID,title:zC.LABEL,category:dh,precondition:x.and(x.or(x.notEquals(`config.${VE}`,"onlyEnabledExtensions"),x.equals("isExtensionEnabled",!0)),x.not("extensionDisallowInstall"),x.has("isExtensionAllowed")),menu:{id:D.ExtensionContext,group:r6e,order:1,when:x.and(x.not("inExtensionEditor"),x.equals("extensionStatus","installed"),x.not("isBuiltinExtension"))},run:async(e,t)=>{let o=e.get(F),r=e.get(zi).local.find(s=>Ot(s.identifier,{id:t}));if(r){let s=o.createInstance(zC);return s.extension=r,s.run()}}}),this.registerExtensionAction({id:BF.ID,title:{value:BF.LABEL,original:"Auto Update (Publisher)"},category:dh,precondition:x.equals(`config.${VE}`,!1),menu:{id:D.ExtensionContext,group:r6e,order:2,when:x.and(x.equals("extensionStatus","installed"),x.not("isBuiltinExtension"))},run:async(e,t)=>{let o=e.get(F),r=e.get(zi).local.find(s=>Ot(s.identifier,{id:t}));if(r){let s=o.createInstance(BF);return s.extension=r,s.run()}}}),this.registerExtensionAction({id:"workbench.extensions.action.switchToPreRlease",title:d(9571,null),category:dh,menu:{id:D.ExtensionContext,group:pX,order:2,when:x.and(fh,x.has("galleryExtensionHasPreReleaseVersion"),x.has("isPreReleaseExtensionAllowed"),x.not("installedExtensionIsOptedToPreRelease"),x.not("inExtensionEditor"),x.equals("extensionStatus","installed"),x.not("isBuiltinExtension"))},run:async(e,t)=>{let o=e.get(F),r=e.get(zi).local.find(s=>Ot(s.identifier,{id:t}));if(r){let s=o.createInstance(dD);return s.extension=r,s.run()}}}),this.registerExtensionAction({id:"workbench.extensions.action.switchToRelease",title:d(9562,null),category:dh,menu:{id:D.ExtensionContext,group:pX,order:2,when:x.and(fh,x.has("galleryExtensionHasPreReleaseVersion"),x.has("isExtensionAllowed"),x.has("installedExtensionIsOptedToPreRelease"),x.not("inExtensionEditor"),x.equals("extensionStatus","installed"),x.not("isBuiltinExtension"))},run:async(e,t)=>{let o=e.get(F),r=e.get(zi).local.find(s=>Ot(s.identifier,{id:t}));if(r){let s=o.createInstance(dD);return s.extension=r,s.run()}}}),this.registerExtensionAction({id:KC.ID,title:KC.TITLE,menu:{id:D.ExtensionContext,group:pX,order:0,when:x.and(x.not("inExtensionEditor"),x.has("canSetLanguage"),x.has("isActiveLanguagePackExtension"))},run:async(e,t)=>{let o=e.get(F),r=(await e.get(zi).getExtensions([{id:t}],ve.None))[0],s=o.createInstance(KC);return s.extension=r,s.run()}}),this.registerExtensionAction({id:"workbench.extensions.action.installUnsigned",title:d(9617,null),menu:{id:D.ExtensionContext,group:"0_install",when:x.and(x.equals("extensionStatus","uninstalled"),x.has("isGalleryExtension"),x.not("extensionDisallowInstall"),x.has("extensionIsUnsigned"),x.or(x.and(iSo,x.not("extensionIsPrivate")),x.and(oSo,x.has("extensionIsPrivate")))),order:1},run:async(e,t)=>{let o=e.get(F),n=this.extensionsWorkbenchService.local.filter(r=>Ot(r.identifier,{id:t}))[0]||(await this.extensionsWorkbenchService.getExtensions([{id:t}],ve.None))[0];if(n){let r=o.createInstance(Iw,{installPreReleaseVersion:this.extensionManagementService.preferPreReleases});return r.extension=n,r.run()}}}),this.registerExtensionAction({id:"workbench.extensions.action.installAndDonotSync",title:d(9619,null),menu:{id:D.ExtensionContext,group:"0_install",when:x.and(x.equals("extensionStatus","uninstalled"),x.has("isGalleryExtension"),x.has("isExtensionAllowed"),x.not("extensionDisallowInstall"),rD),order:1},run:async(e,t)=>{let o=e.get(F),n=this.extensionsWorkbenchService.local.filter(r=>Ot(r.identifier,{id:t}))[0]||(await this.extensionsWorkbenchService.getExtensions([{id:t}],ve.None))[0];if(n){let r=o.createInstance(Iw,{installPreReleaseVersion:this.extensionManagementService.preferPreReleases,isMachineScoped:!0});return r.extension=n,r.run()}}}),this.registerExtensionAction({id:"workbench.extensions.action.installPrereleaseAndDonotSync",title:d(9631,null),menu:{id:D.ExtensionContext,group:"0_install",when:x.and(x.equals("extensionStatus","uninstalled"),x.has("isGalleryExtension"),x.has("extensionHasPreReleaseVersion"),x.has("isPreReleaseExtensionAllowed"),x.not("extensionDisallowInstall"),rD),order:2},run:async(e,t)=>{let o=e.get(F),n=this.extensionsWorkbenchService.local.filter(r=>Ot(r.identifier,{id:t}))[0]||(await this.extensionsWorkbenchService.getExtensions([{id:t}],ve.None))[0];if(n){let r=o.createInstance(Iw,{isMachineScoped:!0,preRelease:!0});return r.extension=n,r.run()}}}),this.registerExtensionAction({id:oT.ID,title:oT.LABEL,menu:{id:D.ExtensionContext,group:"0_install",when:x.and(x.equals("extensionStatus","uninstalled"),x.has("isGalleryExtension"),x.has("isExtensionAllowed"),x.not("extensionDisallowInstall")),order:3},run:async(e,t)=>{let o=e.get(F),n=this.extensionsWorkbenchService.local.filter(r=>Ot(r.identifier,{id:t}))[0]||(await this.extensionsWorkbenchService.getExtensions([{id:t}],ve.None))[0];if(n)return o.createInstance(oT,n,!1).run()}}),this.registerExtensionAction({id:"workbench.extensions.action.copyExtension",title:L(9685,"Copy"),menu:{id:D.ExtensionContext,group:"1_copy"},run:async(e,t)=>{let o=e.get(Wi),n=this.extensionsWorkbenchService.local.filter(r=>Ot(r.identifier,{id:t}))[0]||(await this.extensionsWorkbenchService.getExtensions([{id:t}],ve.None))[0];if(n){let r=d(9576,null,n.displayName),s=d(9575,null,t),l=d(9574,null,n.description),c=d(9578,null,n.version),u=d(9577,null,n.publisherDisplayName),p=n.url?d(9579,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(9686,"Copy Extension ID"),menu:{id:D.ExtensionContext,group:"1_copy"},run:async(e,t)=>e.get(Wi).writeText(t)}),this.registerExtensionAction({id:"workbench.extensions.action.copyLink",title:L(9687,"Copy Link"),menu:{id:D.ExtensionContext,group:"1_copy",when:x.and(x.has("isGalleryExtension"),nSo)},run:async(e,t,o)=>{let n=e.get(Wi);o.galleryLink&&await n.writeText(o.galleryLink)}}),this.registerExtensionAction({id:"workbench.extensions.action.configure",title:L(9683,"Settings"),menu:{id:D.ExtensionContext,group:"2_configure",when:x.and(x.equals("extensionStatus","installed"),x.has("extensionHasConfiguration")),order:1},run:async(e,t)=>e.get(Po).openSettings({jsonEditor:!1,query:`@ext:${t}`})}),this.registerExtensionAction({id:"workbench.extensions.action.download",title:d(9565,null),menu:{id:D.ExtensionContext,when:x.and(x.not("extensionDisallowInstall"),x.has("isGalleryExtension")),order:this.productService.quality==="stable"?0:1},run:async(e,t)=>{e.get(zi).downloadVSIX(t,"release")}}),this.registerExtensionAction({id:"workbench.extensions.action.downloadPreRelease",title:d(9563,null),menu:{id:D.ExtensionContext,when:x.and(x.not("extensionDisallowInstall"),x.has("isGalleryExtension"),x.has("extensionHasPreReleaseVersion")),order:this.productService.quality==="stable"?1:0},run:async(e,t)=>{e.get(zi).downloadVSIX(t,"prerelease")}}),this.registerExtensionAction({id:"workbench.extensions.action.downloadSpecificVersion",title:d(9564,null),menu:{id:D.ExtensionContext,when:x.and(x.not("extensionDisallowInstall"),x.has("isGalleryExtension")),order:2},run:async(e,t)=>{e.get(zi).downloadVSIX(t,"any")}}),this.registerExtensionAction({id:"workbench.extensions.action.manageAccountPreferences",title:L(9682,"Account Preferences"),menu:{id:D.ExtensionContext,group:"2_configure",when:x.and(x.equals("extensionStatus","installed"),x.has("extensionHasAccountPreferences")),order:2},run:(e,t)=>e.get(ge).executeCommand("_manageAccountPreferencesForExtension",t)}),this.registerExtensionAction({id:"workbench.extensions.action.configureKeybindings",title:L(9684,"Keyboard Shortcuts"),menu:{id:D.ExtensionContext,group:"2_configure",when:x.and(x.equals("extensionStatus","installed"),x.has("extensionHasKeybindings")),order:2},run:async(e,t)=>e.get(Po).openGlobalKeybindingSettings(!1,{query:`@ext:${t}`})}),this.registerExtensionAction({id:"workbench.extensions.action.toggleApplyToAllProfiles",title:L(9691,"Apply Extension to all Profiles"),toggled:x.has("isApplicationScopedExtension"),menu:{id:D.ExtensionContext,group:"2_configure",when:x.and(x.equals("extensionStatus","installed"),x.has("isDefaultApplicationScopedExtension").negate(),x.has("isBuiltinExtension").negate(),x.equals("isWorkspaceScopedExtension",!1)),order:3},run:async(e,t,o)=>{let n=e.get(dt),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:fDt,title:L(9692,"Sync This Extension"),menu:{id:D.ExtensionContext,group:"2_configure",when:x.and(x.equals("extensionStatus","installed"),rD,x.equals("isWorkspaceScopedExtension",!1)),order:4},run:async(e,t)=>{let o=this.extensionsWorkbenchService.local.find(n=>Ot({id:t},n.identifier));if(o)return this.extensionsWorkbenchService.toggleExtensionIgnoredToSync(o)}}),this.registerExtensionAction({id:"workbench.extensions.action.ignoreRecommendation",title:L(9688,"Ignore Recommendation"),menu:{id:D.ExtensionContext,group:"3_recommendations",when:x.has("isExtensionRecommended"),order:1},run:async(e,t)=>e.get(uk).toggleGlobalIgnoredRecommendation(t,!0)}),this.registerExtensionAction({id:"workbench.extensions.action.undoIgnoredRecommendation",title:L(9693,"Undo Ignored Recommendation"),menu:{id:D.ExtensionContext,group:"3_recommendations",when:x.has("isUserIgnoredRecommendation"),order:1},run:async(e,t)=>e.get(uk).toggleGlobalIgnoredRecommendation(t,!1)}),this.registerExtensionAction({id:"workbench.extensions.action.addExtensionToWorkspaceRecommendations",title:L(9677,"Add to Workspace Recommendations"),menu:{id:D.ExtensionContext,group:"3_recommendations",when:x.and(Qa.notEqualsTo("empty"),x.has("isBuiltinExtension").negate(),x.has("isExtensionWorkspaceRecommended").negate(),x.has("isUserIgnoredRecommendation").negate(),x.notEquals("extensionSource","resource")),order:2},run:(e,t)=>e.get(EK).toggleRecommendation(t)}),this.registerExtensionAction({id:"workbench.extensions.action.removeExtensionFromWorkspaceRecommendations",title:L(9690,"Remove from Workspace Recommendations"),menu:{id:D.ExtensionContext,group:"3_recommendations",when:x.and(Qa.notEqualsTo("empty"),x.has("isBuiltinExtension").negate(),x.has("isExtensionWorkspaceRecommended")),order:2},run:(e,t)=>e.get(EK).toggleRecommendation(t)}),this.registerExtensionAction({id:"workbench.extensions.action.addToWorkspaceRecommendations",title:L(9681,"Add Extension to Workspace Recommendations"),category:c5,menu:{id:D.CommandPalette,when:x.and(Qa.isEqualTo("workspace"),x.equals("resourceScheme",Y.extension))},async run(e){let t=e.get(ee),o=e.get(EK);if(!(t.activeEditor instanceof J2))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(9679,"Add Extension to Workspace Folder Recommendations"),category:c5,menu:{id:D.CommandPalette,when:x.and(Qa.isEqualTo("folder"),x.equals("resourceScheme",Y.extension))},run:()=>this.commandService.executeCommand("workbench.extensions.action.addToWorkspaceRecommendations")}),this.registerExtensionAction({id:"workbench.extensions.action.addToWorkspaceIgnoredRecommendations",title:L(9680,"Add Extension to Workspace Ignored Recommendations"),category:c5,menu:{id:D.CommandPalette,when:x.and(Qa.isEqualTo("workspace"),x.equals("resourceScheme",Y.extension))},async run(e){let t=e.get(ee),o=e.get(EK);if(!(t.activeEditor instanceof J2))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(9678,"Add Extension to Workspace Folder Ignored Recommendations"),category:c5,menu:{id:D.CommandPalette,when:x.and(Qa.isEqualTo("folder"),x.equals("resourceScheme",Y.extension))},run:()=>this.commandService.executeCommand("workbench.extensions.action.addToWorkspaceIgnoredRecommendations")}),this.registerExtensionAction({id:KK.ID,title:{value:KK.LABEL,original:"Configure Recommended Extensions (Workspace)"},category:c5,menu:{id:D.CommandPalette,when:Qa.isEqualTo("workspace")},run:()=>GLi(this.instantiationService.createInstance(KK,KK.ID,KK.LABEL))}),this.registerExtensionAction({id:"workbench.extensions.action.manageTrustedPublishers",title:L(9689,"Manage Trusted Extension Publishers"),category:c5,f1:!0,run:async e=>{let t=e.get(Ge),o=e.get(Hd),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(9674,null),placeHolder:d(9675,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 P;return r.add(W(class extends K{constructor(){super({...e,menu:o})}run(s,...l){return e.run(s,...l)}})),n.length&&r.add(fe.appendMenuItems(n)),r}};pnt=I([m(0,ls),m(1,Gc),m(2,vv),m(3,X),m(4,Ft),m(5,zi),m(6,Os),m(7,F),m(8,ct),m(9,ge),m(10,nt)],pnt);var mnt=class{constructor(i,e){pw.removeOutdatedExtensionVersions(i,e)}};mnt=I([m(0,ls),m(1,le)],mnt);var hnt=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)})}};hnt=I([m(0,Hd),m(1,an),m(2,nt),m(3,le)],hnt);var S0e=class extends C{static{this.ID="extensions.chat.toolsContribution"}constructor(i,e){super();let t=e.createInstance(QFe);this._register(i.registerTool(yLi,t)),this._register(i.vscodeToolSet.addTool(yLi))}};S0e=I([m(0,jn),m(1,F)],S0e);var WA=oe.as(Qi.Workbench);WA.registerWorkbenchContribution(pnt,3);WA.registerWorkbenchContribution(g0e,4);WA.registerWorkbenchContribution(f0e,4);WA.registerWorkbenchContribution(GNe,3);WA.registerWorkbenchContribution(m0e,3);WA.registerWorkbenchContribution(d0e,4);WA.registerWorkbenchContribution(p0e,4);WA.registerWorkbenchContribution(ZFe,3);WA.registerWorkbenchContribution(u0e,3);WA.registerWorkbenchContribution(b0e,4);WA.registerWorkbenchContribution(hnt,4);WA.registerWorkbenchContribution(v0e,4);Gt&&WA.registerWorkbenchContribution(mnt,4);pt(S0e.ID,S0e,ut.AfterRestored);W(GKt);W(class extends K{constructor(){super({id:"workbench.extensions.actions.gallery.signIn",title:L(9667,"Sign in to access Extensions Marketplace"),menu:{id:D.AccountsContext,when:uX.isEqualTo("requiresSignIn")}})}run(i){return i.get(ge).executeCommand(rJe)}});oe.as(rp.ConfigurationMigration).registerConfigurationMigrations([{key:VE,migrateFn:(a,i)=>a==="onlySelectedExtensions"?{value:!1}:[]}]);var qLi=new Q("hasInstalledAgentPlugins",!1),sSo="workbench.views.agentPlugins.installed";function zin(a,i){let e=a.label,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 Kin(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 Eie=class extends st{constructor(e,t){super(Eie.ID,d(5627,null),"extension-action label prominent install");this.item=e;this.pluginInstallService=t}static{this.ID="agentPlugin.install"}async run(){await this.pluginInstallService.installPlugin({name:this.item.name,description:this.item.description,version:"",source:this.item.source,sourceDescriptor:this.item.sourceDescriptor,marketplace:this.item.marketplace,marketplaceReference:this.item.marketplaceReference,marketplaceType:this.item.marketplaceType,readmeUri:this.item.readmeUri})}};Eie=I([m(1,Y2)],Eie);var lge=class extends st{constructor(e,t){super(lge.ID,d(5626,null));this.plugin=e;this.agentPluginService=t}static{this.ID="agentPlugin.enable"}async run(){this.agentPluginService.setPluginEnabled(this.plugin.uri,!0)}};lge=I([m(1,Db)],lge);var cge=class extends st{constructor(e,t){super(cge.ID,d(5625,null));this.plugin=e;this.agentPluginService=t}static{this.ID="agentPlugin.disable"}async run(){this.agentPluginService.setPluginEnabled(this.plugin.uri,!1)}};cge=I([m(1,Db)],cge);var jLi=class a extends st{constructor(e){super(a.ID,d(5632,null));this.plugin=e}static{this.ID="agentPlugin.uninstall"}async run(){this.plugin.remove()}},dge=class extends st{constructor(e,t,o){super(dge.ID,d(5630,null));this.plugin=e;this.commandService=t;this.openerService=o}static{this.ID="agentPlugin.openFolder"}async run(){try{await this.commandService.executeCommand("revealFileInOS",this.plugin.uri)}catch{await this.openerService.open(ci(this.plugin.uri))}}};dge=I([m(1,ge),m(2,Qe)],dge);var Tie=class extends st{constructor(e,t){super(Tie.ID,d(5631,null));this.readmeUri=e;this.openerService=t}static{this.ID="agentPlugin.openReadme"}async run(){await this.openerService.open(this.readmeUri)}};Tie=I([m(1,Qe)],Tie);function aSo(a,i){let e=[];return a.enabled.get()?e.push([i.createInstance(cge,a)]):e.push([i.createInstance(lge,a)]),e.push([i.createInstance(dge,a),i.createInstance(Tie,je(a.uri,"README.md"))]),e.push([i.createInstance(jLi,a)]),e}var A8=class extends st{constructor(e,t){super(A8.ID,"",A8.CLASS,!0);this.getActionGroups=e;this.instantiationService=t;this._actionViewItem=null;this.tooltip=d(5628,null)}static{this.ID="agentPlugin.manage"}static{this.CLASS=`extension-action icon manage ${q.asClassName(_pe)}`}createActionViewItem(e){return this._actionViewItem=this.instantiationService.createInstance(gnt,this,e),this._actionViewItem}async run(){this._actionViewItem?.showMenu(this.getActionGroups())}};A8=I([m(1,F)],A8);var gnt=class extends Lr{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 li]);t.length>0&&t.pop();let{left:o,top:n,height:r}=Yn(this.element);this.contextMenuService.showContextMenu({getAnchor:()=>({x:o,y:n+r+10}),getActions:()=>t,onHide:()=>jH(t)})}};gnt=I([m(2,ze)],gnt);var _ie=class{constructor(i){this.instantiationService=i;this.templateId=_ie.templateId}static{this.templateId="agentPlugin"}renderTemplate(i){let e=R(i,_(".agent-plugin-item.extension-list-item")),t=R(e,_(".details")),o=R(t,_(".header-container")),n=R(o,_(".header")),r=R(n,_("span.name")),s=R(t,_(".description.ellipsis")),l=R(t,_(".footer")),c=R(l,_(".publisher-container")),u=R(c,_("span.publisher-name")),p=new ji(l,{focusOnlyEnabledItems:!0,actionViewItemProvider:(h,g)=>{if(h instanceof A8)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){if(this.disposeElement(void 0,0,t),t.name.textContent=i.name,t.description.textContent=i.description,t.elementDisposables.push(he(o=>{t.root.classList.toggle("disabled",i.kind==="installed"&&!i.plugin.enabled.read(o))})),t.actionbar.clear(),i.kind==="marketplace"){t.detail.textContent=i.marketplace;let o=this.instantiationService.createInstance(Eie,i);t.elementDisposables.push(o),t.actionbar.push([o],{icon:!0,label:!0})}else{t.detail.textContent=i.marketplace??"";let o=this.instantiationService.createInstance(A8,()=>aSo(i.plugin,this.instantiationService));t.elementDisposables.push(o),t.actionbar.push([o],{icon:!0,label:!1})}}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)}};_ie=I([m(0,F)],_ie);var uge=class extends M8{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 P);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(he(y=>{this.agentPluginService.plugins.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=R(e,_(".message-container")),o=R(t,_(".message")),n=_(".agent-plugins-list");this.bodyTemplate={pluginsList:n,messageBox:o,messageContainer:t},this.listContainer=R(e,n),this.list=this._register(this.instantiationService.createInstance(F1,`${this.id}-Agent-Plugins`,this.listContainer,{getHeight(){return 72},getTemplateId:()=>_ie.templateId},[this.instantiationService.createInstance(_ie)],{multipleSelectionSupport:!1,setRowLineHeight:!1,horizontalScrolling:!1,accessibilityProvider:{getAriaLabel(r){return r?.name??""},getWidgetAriaLabel(){return d(5622,null)}},overrideStyles:qz(this.viewDescriptorService.getViewLocationById(this.id)).listOverrideStyles})),this._register(this.list.onContextMenu(r=>this.onContextMenu(r),this)),this._register(H.debounce(H.filter(this.list.onDidOpen,r=>r.element!==null),(r,s)=>s,75,!0)(r=>{this.editorService.openEditor(this.instantiationService.createInstance(gie,r.element),r.editorOptions,ym)}))}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=aSo(e.plugin,this.instantiationService).flatMap(n=>[...n,new li]),t.length>0&&t.pop()):(t=[],e.readmeUri&&t.push(this.instantiationService.createInstance(Tie,e.readmeUri)),t.push(this.instantiationService.createInstance(Eie,e))),this.actionStore.clear();for(let o of t)Ac(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().toLowerCase(),o=this.queryInstalled();t&&(o=o.filter(s=>s.name.toLowerCase().includes(t)||s.description.toLowerCase().includes(t)));let n=o;if(!this.listOptions.installedOnly){let s=await this.queryMarketplace(t),l=new Set(o.map(u=>u.plugin.uri.toString())),c=s.filter(u=>{let p=this.pluginInstallService.getPluginInstallUri({name:u.name,description:u.description,version:"",source:u.source,sourceDescriptor:u.sourceDescriptor,marketplace:u.marketplace,marketplaceReference:u.marketplaceReference,marketplaceType:u.marketplaceType});return!l.has(p.toString())});n=[...o,...c]}let r=new Tm(n);return this.list&&(this.list.model=r),this.updateBody(r.length),r}queryInstalled(){return this.agentPluginService.allPlugins.get().map(t=>zin(t,this.labelService))}async queryMarketplace(e){this.queryCts.value?.cancel();let t=new $e;this.queryCts.value=t;try{let o=await this.pluginMarketplaceService.fetchMarketplacePlugins(t.token),n=e.toLowerCase();return o.filter(r=>r.name.toLowerCase().includes(n)||r.description.toLowerCase().includes(n)).map(Kin)}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(5629,null)))}};uge=I([m(2,_e),m(3,ze),m(4,F),m(5,De),m(6,tt),m(7,B),m(8,X),m(9,Ri),m(10,Qe),m(11,Db),m(12,QB),m(13,Y2),m(14,ot),m(15,ee)],uge);var QLi=class extends K{constructor(){super({id:"workbench.agentPlugins.browse",title:L(5623,"Agent Plugins"),tooltip:L(5624,"Browse Agent Plugins"),icon:M.search,precondition:ie.Setup.hidden.negate(),menu:[{id:Xh,group:"1_predefined",order:2,when:ie.Setup.hidden.negate()},{id:D.ViewTitle,when:x.and(x.equals("view",sSo),ie.Setup.hidden.negate()),group:"navigation"}]})}async run(i){i.get(zi).openSearch("@agentPlugins ")}},pge=class extends C{static{this.ID="workbench.chat.agentPlugins.views.contribution"}constructor(i,e){super();let t=qLi.bindTo(i);this._register(he(o=>{t.set(e.allPlugins.read(o).length>0)})),W(QLi),oe.as(on.ViewsRegistry).registerViews([{id:sSo,name:L(5621,"Agent Plugins - Installed"),ctorDescriptor:new Mt(uge,[{installedOnly:!0}]),when:x.and(yC,qLi,ie.Setup.hidden.negate()),weight:30,order:5,canToggleVisibility:!0},{id:"workbench.views.agentPlugins.default.marketplace",name:L(5620,"Agent Plugins"),ctorDescriptor:new Mt(uge,[{}]),when:x.and(yC,qLi.toNegated(),ie.Setup.hidden.negate()),weight:30,order:5,canToggleVisibility:!0,hideByDefault:!0},{id:"workbench.views.agentPlugins.marketplace",name:L(5620,"Agent Plugins"),ctorDescriptor:new Mt(uge,[{}]),when:x.and(SDt,ie.Setup.hidden.negate())}],I0e)}};pge=I([m(0,X),m(1,Db)],pge);function C0e(a){return a.replace(/[\\/:*?"<>|]/g,"_")}function XLi(a,i){return i?[`sha_${C0e(i)}`]:a?[`ref_${C0e(a)}`]:[]}function YLi(a){return new st("showGitOutput",d(6866,null),void 0,!0,()=>{a.executeCommand("git.showOutput")})}function Gin(a){return ri?`"${a.replace(/[`$"]/g,"`$&")}"`:`'${a.replace(/'/g,"'\\''")}'`}function $in(a){let[i,...e]=a;return[i,...e.map(t=>Gin(t))].join(" ")}var y0e=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.getInstallUri(i,e)}async ensure(i,e,t){let o=e.sourceDescriptor,n=this.getInstallUri(i,o),r=await this._fileService.exists(n),s=this._displayLabel(o);if(r)return await this._checkoutRevision(n,o,t?.failureLabel??s),n;let l=t?.progressTitle??d(6858,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),n}async update(i,e,t){let o=e.sourceDescriptor,n=this.getInstallUri(i,o);if(!await this._fileService.exists(n)){this._logService.warn(`[${this.kind}] Cannot update plugin '${t?.pluginName??e.name}': source repository not cloned`);return}let s=t?.pluginName??e.name,l=t?.failureLabel??s;try{await this._progressService.withProgress({location:15,title:d(6869,null,s),cancellable:!1},async()=>{await this._commandService.executeCommand("git.openRepository",n.fsPath),o.sha?await this._commandService.executeCommand("git.fetch",n.fsPath):await this._commandService.executeCommand("_git.pull",n.fsPath),await this._checkoutRevision(n,o,l)})}catch(c){this._logService.error(`[${this.kind}] Failed to update plugin source '${s}':`,c),this._notificationService.notify({severity:St.Error,message:d(6865,null,l,c?.message??String(c)),actions:{primary:[YLi(this._commandService)]}})}}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:St.Error,message:d(6857,null,o,r?.message??String(r)),actions:{primary:[YLi(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:St.Error,message:d(6856,null,t,n?.message??String(n)),actions:{primary:[YLi(this._commandService)]}}),n}}};y0e=I([m(0,ge),m(1,be),m(2,ne),m(3,Ne),m(4,Bo)],y0e);var l2t=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||"."}},c2t=class extends y0e{constructor(){super(...arguments);this.kind="github"}getInstallUri(e,t){let o=t,[n,r]=o.repo.split("/");return je(e,"github.com",n,r,...XLi(o.ref,o.sha))}getLabel(e){return e.repo}_cloneUrl(e){return`https://github.com/${e.repo}.git`}_displayLabel(e){return e.repo}},d2t=class extends y0e{constructor(){super(...arguments);this.kind="url"}getInstallUri(e,t){let o=t,n=this._gitUrlCacheSegments(o.url,o.ref,o.sha);return je(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,...XLi(t,o)]}catch{return["git",e.replace(/[\\/:*?"<>|]/g,"_"),...XLi(t,o)]}}},w0e=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);await this.runInstall(o,n,e)}async runInstall(i,e,t){let o=this._buildInstallArgs(i,t),n=$in(o);if(!await this._confirmTerminalCommand(t.name,n))return;let s=d(6862,null,this._managerName,t.name),{success:l,terminal:c}=await this._runTerminalCommand(n,s);if(!l)return;if(!await this._fileService.exists(e)){this._notificationService.notify({severity:St.Error,message:d(6863,null,this._managerName,this.getLabel(t.sourceDescriptor))});return}return c?.dispose(),{pluginDir:e}}async _confirmTerminalCommand(i,e){let{confirmed:t}=await this._dialogService.confirm({type:"question",message:d(6860,null,i),detail:d(6861,null,e),primaryButton:d(6859,null)});return t}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(6864,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(6867,null,n))}),{success:!0,terminal:t}}catch(o){return this._logService.error(`[${this.kind}] Terminal command failed:`,o),this._notificationService.notify({severity:St.Error,message:d(6868,null,o?.message??String(o))}),{success:!1,terminal:t}}}_waitForTerminalCommandCompletion(i){return new Promise(e=>{let t=new P,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=Pi(12e4);t.add(Z(()=>s.cancel())),s.then(()=>{o||(this._logService.warn(`[${this.kind}] Terminal command completion timed out`),n(void 0))})})}};w0e=I([m(0,ct),m(1,be),m(2,ne),m(3,Ne),m(4,Bo),m(5,Yo)],w0e);var u2t=class extends w0e{constructor(){super(...arguments);this.kind="npm";this._managerName="npm"}getInstallUri(e,t){let o=t;return je(e,"npm",C0e(o.package),"node_modules",o.package)}getLabel(e){let t=e;return t.version?`${t.package}@${t.version}`:t.package}_getCacheDir(e,t){return je(e,"npm",C0e(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}},p2t=class extends w0e{constructor(){super(...arguments);this.kind="pip";this._managerName="pip"}getInstallUri(e,t){return je(e,"pip",C0e(t.package))}getLabel(e){let t=e;return t.version?`${t.package}==${t.version}`:t.package}_getCacheDir(e,t){return je(e,"pip",C0e(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 JLi="chat.plugins.marketplaces.index.v1",x0e=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._cacheRoot=je(e.cacheHome,"agentPlugins"),this._pluginSources=new Map([["relativePath",new l2t],["github",o.createInstance(c2t)],["url",o.createInstance(d2t)],["npm",o.createInstance(u2t)],["pip",o.createInstance(p2t)]])}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){let t=this.getRepositoryUri(i,e?.marketplaceType);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(5616,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)){this._logService.warn(`[AgentPluginRepositoryService] Cannot update plugin '${e?.pluginName??i.displayLabel}': repository not cloned`);return}let n=e?.pluginName??i.displayLabel;try{await this._progressService.withProgress({location:15,title:d(5619,null,n),cancellable:!1},async()=>{await this._commandService.executeCommand("_git.pull",t.fsPath)})}catch(r){this._logService.error(`[AgentPluginRepositoryService] Failed to update ${i.displayLabel}:`,r),this._notificationService.notify({severity:St.Error,message:d(5617,null,e?.failureLabel??n,r?.message??String(r)),actions:{primary:[new st("showGitOutput",d(5618,null),void 0,!0,()=>{this._commandService.executeCommand("git.showOutput")})]}})}}_getRepoCacheDirForReference(i){return je(this._cacheRoot,...i.cacheSegments)}_loadMarketplaceIndex(){let i=new Map,e=this._storageService.getObject(JLi,-1);if(!e)return i;let t=Xn(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(JLi,-1);return}this._storageService.store(JLi,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:St.Error,message:d(5615,null,o,r?.message??String(r)),actions:{primary:[new st("showGitOutput",d(5618,null),void 0,!0,()=>{this._commandService.executeCommand("git.showOutput")})]}}),r}}_getPluginDir(i,e){let t=e.trim().replace(/^\.?\/+|\/+$/g,""),o=t?je(i,t):i;if(!La(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){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 cleanupPluginSource(i){let t=this.getPluginSource(i.sourceDescriptor.kind).getCleanupTarget(this._cacheRoot,i.sourceDescriptor);if(t){try{await this._fileService.exists(t)&&(await this._fileService.del(t,{recursive:!0}),this._logService.info(`[${i.sourceDescriptor.kind}] Removed plugin cache: ${t.toString()}`))}catch(o){this._logService.warn(`[${i.sourceDescriptor.kind}] Failed to remove plugin cache '${t.toString()}':`,o)}try{await this._pruneEmptyParents(t)}catch(o){this._logService.warn(`[${i.sourceDescriptor.kind}] Failed to cleanup plugin source:`,o)}}}async _pruneEmptyParents(i){if(!La(i,this._cacheRoot))return;let e=ci(i);for(;La(e,this._cacheRoot)&&!Xe(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)}}};x0e=I([m(0,ge),m(1,Co),m(2,be),m(3,F),m(4,ne),m(5,Ne),m(6,Bo),m(7,le)],x0e);var k0e=class{constructor(i,e,t,o,n,r){this._pluginRepositoryService=i;this._pluginMarketplaceService=e;this._fileService=t;this._notificationService=o;this._dialogService=n;this._logService=r}async installPlugin(i){if(!await this._ensureMarketplaceTrusted(i))return;let e=i.sourceDescriptor.kind;return e==="relativePath"?this._installRelativePathPlugin(i):e==="npm"||e==="pip"?this._installPackagePlugin(i):this._installGitPlugin(i)}async updatePlugin(i){let e=i.sourceDescriptor.kind;return e==="npm"||e==="pip"?this._installPackagePlugin(i):this._pluginRepositoryService.updatePluginSource(i,{pluginName:i.name,failureLabel:i.name,marketplaceType:i.marketplaceType})}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(6854,null,i.marketplaceReference.displayLabel),detail:d(6855,null,i.marketplaceReference.rawValue),primaryButton:d(6853,null),custom:{icon:M.shield}});return e?(this._pluginMarketplaceService.trustMarketplace(i.marketplaceReference),!0):!1}async _installRelativePathPlugin(i){try{await this._pluginRepositoryService.ensureRepository(i.marketplaceReference,{progressTitle:d(6849,null,i.name),failureLabel:i.name,marketplaceType:i.marketplaceType})}catch{return}let e;try{e=this._pluginRepositoryService.getPluginInstallUri(i)}catch{this._notificationService.notify({severity:St.Error,message:d(6850,null,i.source,i.marketplace)});return}if(!await this._fileService.exists(e)){this._notificationService.notify({severity:St.Error,message:d(6851,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(6849,null,i.name),failureLabel:i.name,marketplaceType:i.marketplaceType})}catch{return}if(!await this._fileService.exists(t)){this._notificationService.notify({severity:St.Error,message:d(6852,null,e.getLabel(i.sourceDescriptor))});return}this._pluginMarketplaceService.addInstalledPlugin(t,i)}async _installPackagePlugin(i){let e=this._pluginRepositoryService.getPluginSource(i.sourceDescriptor.kind);if(!e.runInstall){this._logService.error(`[PluginInstallService] Expected package repository for kind '${i.sourceDescriptor.kind}'`);return}let t=await this._pluginRepositoryService.ensurePluginSource(i),o=this._pluginRepositoryService.getPluginSourceInstallUri(i.sourceDescriptor),n=await e.runInstall(t,o,i);n&&this._pluginMarketplaceService.addInstalledPlugin(n.pluginDir,i)}};k0e=I([m(0,lie),m(1,QB),m(2,be),m(3,Ne),m(4,ct),m(5,ne)],k0e);var vnt=ae("remoteCodingAgentsService"),fnt=class extends C{constructor(e){super();this.contextKeyService=e;this.agents=[];this.contextKeys=new Set;this._ctxHasRemoteCodingAgent=ie.hasRemoteCodingAgent.bindTo(this.contextKeyService),this._register(H.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=x.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=x.deserialize(e.when);return!t||this.contextKeyService.contextMatchesRules(t)}updateContextKeys(){let e=this.getAvailableAgents().length>0;this._ctxHasRemoteCodingAgent.set(e)}};fnt=I([m(0,X)],fnt);we(vnt,fnt,1);var Die=class extends C{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 Mi(this._domNode,{supportIcons:!0,title:d(6988,null)})),this._button.element.style.background="var(--vscode-button-background)",this._button.element.style.color="var(--vscode-button-foreground)",this._button.label=d(6989,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 Die.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()===PE&&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,ve.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()}};Die=I([m(1,ge),m(2,X),m(3,vnt),m(4,nr)],Die);var E0e=class extends C{constructor(e,t){super();this._editor=e;this._instantiationService=t;this._overlayWidgets=this._register(new jt);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()===PE){let t=this._instantiationService.createInstance(Die,this._editor);this._overlayWidgets.set(this._editor,t)}}};E0e=I([m(1,F)],E0e);go(E0e.ID,E0e,1);var bnt=class extends C{constructor(e,t,o,n){super();this.promptsService=e;this.languageService=t;this.languageModelToolsService=o;this.instantiationService=n;this.cmdId=`_configure/${_t()}`;this._register(this.languageService.codeLensProvider.register(hz,this)),this._register(qe.registerCommand(this.cmdId,(r,...s)=>{let[l,c,u,p,h]=s,g=l;U6(g)&&z.isIRange(c)&&Da(u)&&Array.isArray(p)&&aBt(h)&&this.updateTools(g,z.lift(c),u,p,h)}))}async provideCodeLenses(e,t){let o=Mf(e.getLanguageId());if(!o||o==="instructions")return;let r=this.promptsService.getParsedPromptFile(e).header;if(!r)return;let s=mD(o,r);if(!ree(s))return;let l=r.getAttribute(Hi.tools);if(!l)return;let c=l.value;if(c.type==="scalar"&&(c=xB(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(6990,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(WHt,d(6991,null),"codeLens",void 0,s);l&&this.instantiationService.createInstance(p2).rewriteTools(e,l,t,o)}};bnt=I([m(0,nr),m(1,zt),m(2,jn),m(3,F)],bnt);Dx(bnt);var mge=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.environmentService=h;this._store.add(e.registerSlashCommand({command:"clear",detail:d(6734,null),sortText:"z2_clear",executeImmediately:!0,locations:["panel"]},async(v,b,S,y,w)=>{r.getSession(w)?.setArchived(!0),t.executeCommand(im)})),this._store.add(e.registerSlashCommand({command:"hooks",detail:d(6739,null),sortText:"z3_hooks",executeImmediately:!0,silent:!0,locations:["panel"],target:"vscode"},async()=>{await n.invokeFunction(UOe)})),this._store.add(e.registerSlashCommand({command:"models",detail:d(6741,null),sortText:"z3_models",executeImmediately:!0,silent:!0,locations:["panel"],target:"vscode"},async()=>{await t.executeCommand(Ome.ID)})),this._store.add(e.registerSlashCommand({command:"tools",detail:d(6746,null),sortText:"z3_tools",executeImmediately:!0,silent:!0,locations:["panel"],target:"vscode"},async()=>{await t.executeCommand(ltt.ID)})),this._store.add(e.registerSlashCommand({command:"plugins",detail:d(6742,null),sortText:"z3_plugins",executeImmediately:!0,silent:!0,locations:["panel"],target:"vscode"},async()=>{await t.executeCommand(xot.ID)})),this.environmentService.isSessionsWindow||this._store.add(e.registerSlashCommand({command:"debug",detail:d(6735,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(6724,null),sortText:"z3_agents",executeImmediately:!0,silent:!0,locations:["panel"],target:"vscode"},async()=>{await t.executeCommand(Fme.ID)})),this._store.add(e.registerSlashCommand({command:"skills",detail:d(6745,null),sortText:"z3_skills",executeImmediately:!0,silent:!0,locations:["panel"],target:"vscode"},async()=>{await t.executeCommand(L_i)})),this._store.add(e.registerSlashCommand({command:"instructions",detail:d(6740,null),sortText:"z3_instructions",executeImmediately:!0,silent:!0,locations:["panel"],target:"vscode"},async()=>{await t.executeCommand(Ezt)})),this._store.add(e.registerSlashCommand({command:"prompts",detail:d(6743,null),sortText:"z3_prompts",executeImmediately:!0,silent:!0,locations:["panel"],target:"vscode"},async()=>{await t.executeCommand(__i)})),this._store.add(e.registerSlashCommand({command:"fork",detail:d(6738,null),sortText:"z2_fork",executeImmediately:!0,silent:!0,locations:["panel"],target:"vscode"},async(v,b,S,y,w)=>{await t.executeCommand("workbench.action.chat.forkConversation",w)})),this._store.add(e.registerSlashCommand({command:"rename",detail:d(6744,null),sortText:"z2_rename",executeImmediately:!1,silent:!0,locations:["panel"],target:"vscode"},async(v,b,S,y,w)=>{let k=v.trim();k&&s.setChatSessionTitle(w,k)}));let g=async()=>{let v=l.inspect("chat.tools.global.autoApprove");if(v.policyValue!==void 0){if(v.policyValue===!0){u.info(d(6727,null));return}u.warn(d(6733,null));return}if(l.getValue("chat.tools.global.autoApprove")){u.info(d(6727,null));return}if(!p.getBoolean("chat.tools.global.autoApprove.optIn",-1,!1)){let S=new P;try{let y=new $e;S.add(y),S.add(p.onDidChangeValue(-1,"chat.tools.global.autoApprove.optIn",S)(()=>{p.getBoolean("chat.tools.global.autoApprove.optIn",-1,!1)&&y.cancel()}));let w=await c.prompt({type:St.Warning,message:d(6731,null),buttons:[{label:d(6730,null),run:()=>!0},{label:d(6728,null),run:()=>!1}],custom:{markdownDetails:[{markdown:new xe(nnt.value,{isTrusted:{enabledCommands:["workbench.action.openSettings"]}})}]},token:y.token});if(!y.token.isCancellationRequested&&w.result!==!0)return;p.store("chat.tools.global.autoApprove.optIn",!0,-1,0)}finally{S.dispose()}}await l.updateValue("chat.tools.global.autoApprove",!0),u.info(d(6732,null))},f=async()=>{let v=l.inspect("chat.tools.global.autoApprove");if(v.policyValue!==void 0){if(v.policyValue===!1){u.info(d(6726,null));return}u.warn(d(6733,null));return}if(!l.getValue("chat.tools.global.autoApprove")){u.info(d(6726,null));return}await l.updateValue("chat.tools.global.autoApprove",!1),u.info(d(6729,null))};this._store.add(e.registerSlashCommand({command:"autoApprove",detail:d(6725,null),sortText:"z1_autoApprove",executeImmediately:!0,silent:!0,locations:["panel"],target:"vscode"},g)),this._store.add(e.registerSlashCommand({command:"disableAutoApprove",detail:d(6736,null),sortText:"z1_disableAutoApprove",executeImmediately:!0,silent:!0,locations:["panel"],target:"vscode"},f)),this._store.add(e.registerSlashCommand({command:"yolo",detail:d(6747,null),sortText:"z1_yolo",executeImmediately:!0,silent:!0,locations:["panel"],target:"vscode"},g)),this._store.add(e.registerSlashCommand({command:"disableYolo",detail:d(6737,null),sortText:"z1_disableYolo",executeImmediately:!0,silent:!0,locations:["panel"],target:"vscode"},f)),this._store.add(e.registerSlashCommand({command:"help",detail:"",sortText:"z1_help",executeImmediately:!0,locations:["panel"],modes:["ask"],target:"vscode"},async(v,b,S,y,w)=>{let k=o.getDefaultAgent("panel"),T=o.getAgents();k?.metadata.helpTextPrefix&&(Mr(k.metadata.helpTextPrefix)?b.report({content:k.metadata.helpTextPrefix,kind:"markdownContent"}):b.report({content:new xe(k.metadata.helpTextPrefix),kind:"markdownContent"}),b.report({content:new xe(`

`),kind:"markdownContent"}));let N=(await Promise.all(T.filter(O=>!O.isDefault&&!O.isCore).filter(O=>O.locations.includes("panel")).map(async O=>{let V=O.description?`- ${O.description}`:"",G=`- ${n.invokeFunction(te=>Txi(O,w,!0,te))} ${V}`,$=O.slashCommands.map(te=>{let pe=te.description?`- ${te.description}`:"";return`	* ${Xuo(O,te,w)} ${pe}`}).join(`
`);return(G+`
`+$).trim()}))).join(`
`);b.report({content:new xe(N,{isTrusted:{enabledCommands:[SA.ID]}}),kind:"markdownContent"}),k?.metadata.helpTextPostfix&&(b.report({content:new xe(`

`),kind:"markdownContent"}),Mr(k.metadata.helpTextPostfix)?b.report({content:k.metadata.helpTextPostfix,kind:"markdownContent"}):b.report({content:new xe(k.metadata.helpTextPostfix),kind:"markdownContent"})),await Pi(200)}))}static{this.ID="workbench.contrib.chatSlashCommands"}};mge=I([m(0,FO),m(1,ge),m(2,br),m(3,F),m(4,ia),m(5,Si),m(6,B),m(7,ct),m(8,Ne),m(9,le),m(10,Vt)],mge);var hge=class extends C{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!==Y.https&&r.scheme!==Y.http)return this.logService.error(`[PromptUrlHandler] Invalid URL: ${n}`),!0;if(await this.hostService.focus(It),await this.shouldBlockInstall(t,r))return!0;let s=await this.requestService.request({type:"GET",url:n},ve.None);if(s.res.statusCode!==200)return this.logService.error(`[PromptUrlHandler] Failed to fetch URL: ${n}`),this.notificationService.error(d(6997,null,n)),!0;let l=(await Kv(s.stream)).toString(),c=await this.instantiationService.invokeFunction(c8,t);if(!c)return!0;let u=await this.instantiationService.invokeFunction(Gte,t,c.uri,Tb(r));if(!u)return!0;let p=A.joinPath(c.uri,u);return await this.fileService.createFolder(c.uri),await this.fileService.createFile(p,Je.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 xe("",{supportHtml:!0});n.appendMarkdown(d(6995,null,`[${o}](${t.toString()})`)),n.appendMarkdown(d(6996,null));let r;switch(e){case"prompt":r=d(6994,null);break;case"instructions":r=d(6993,null);break;default:r=d(6992,null);break}let{confirmed:s}=await this.dialogService.confirm({type:"warning",primaryButton:d(6999,null),cancelButton:d(6998,null),message:r,custom:{markdownDetails:[{markdown:n}]}});return!s}};hge=I([m(0,nI),m(1,Ne),m(2,_a),m(3,F),m(4,be),m(5,Qe),m(6,ne),m(7,ct),m(8,oi)],hge);var qin={type:"object",additionalProperties:!1,required:["icon","title","contents","when"],properties:{icon:{type:"string",description:d(7093,null)},title:{type:"string",description:d(7094,null)},content:{type:"string",description:d(7092,null)},when:{type:"string",description:d(7095,null)}}},jin=Tn.registerExtensionPoint({extensionPoint:"chatViewsWelcome",jsonSchema:{description:d(7096,null),type:"array",items:qin}}),gge=class{constructor(i){this.logService=i;jin.setHandler((e,t)=>{for(let o of t.added)for(let n of o.value){P3e(o.description,"chatParticipantPrivate");let r=x.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 xe(n.content,{isTrusted:!0})};oe.as("workbench.registry.chat.viewsWelcome").register(s)}})}static{this.ID="workbench.contrib.chatViewsWelcomeHandler"}};gge=I([m(0,ne)],gge);var T0e=class extends C{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=>Xe(t.input.inputUri,e))}getWidgetBySessionResource(e){return this._widgets.find(t=>Xe(t.viewModel?.sessionResource,e))}async revealWidget(e){let t=this.lastFocusedWidget;return t&&await this.reveal(t,e)?t:(await this.viewsService.openView(Vr,!e))?.widget}async reveal(e,t){if(e.viewModel?.sessionResource&&await this.revealSessionIfAlreadyOpen(e.viewModel.sessionResource,{preserveFocus:t}))return!0;if(XI(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===$x||typeof t>"u"){let r=await this.viewsService.openView(Vr,!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 LA?n.widget:void 0}async revealSessionIfAlreadyOpen(e,t){let o=this.viewsService.getViewWithId(Vr);if(o?.widget.viewModel?.sessionResource&&Xe(o.widget.viewModel.sessionResource,e)){let r=await this.viewsService.openView(Vr,!t?.preserveFocus);return t?.preserveFocus||r?.focus(),o.widget}let n=this.findExistingChatEditorByUri(e);if(n){let r=n.group.windowId,s=()=>Me(this.layoutService.activeContainer).vscodeWindowId===r,l;!s()&&!t?.preserveFocus&&(l=H.toPromise(H.once(H.filter(this.layoutService.onDidChangeActiveContainer,s))));let c=await n.group.openEditor(n.editor,t);return await l,c instanceof LA?c.widget:void 0}if(Xe(e,this.quickChatService.sessionResource)){this.quickChatService.focus();return}}async prepareSessionForMove(e,t){let o=this.getWidgetBySessionResource(e);if(o){let n=XI(o.viewContext)?void 0:this.findExistingChatEditorByUri(e);if(XI(o.viewContext)&&t===$x||!XI(o.viewContext)&&t!==$x&&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 Va&&Xe(o.sessionResource,e))return{editor:o,group:t}}isSameEditorTarget(e,t){return typeof t=="number"&&t===e||t===Un&&this.editorGroupsService.activeGroup?.id===e||hce(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),hn(e.onDidFocus(()=>this.setLastFocusedWidget(e)),e.onDidChangeViewModel(({previousSessionResource:t,currentSessionResource:o})=>{this._lastFocusedWidget===e&&!Xe(t,o)&&this._onDidChangeFocusedSession.fire(),!(!t||o&&Xe(t,o))&&Pi(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)}))}};T0e=I([m(0,Et),m(1,Ft),m(2,M_),m(3,nc),m(4,ee),m(5,Si)],T0e);var fge=class extends C{constructor(e,t,o,n){super();this._chatService=e;this._chatWidgetService=t;this._hostService=o;this._configurationService=n;this._activeNotifications=this._register(new UD);let r=this._register(new UD);this._register(I$(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 Mre(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?Me(n.domNode):It,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(6838,null,t.title):d(6837,null),c=new $e;this._activeNotifications.set(e,Z(()=>c.dispose(!0)));let u=this._isQuestionCarouselPending(e);try{let p=u?d(6840,null):d(6836,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===lo.StateKind.WaitingForConfirmation||r?.type===lo.StateKind.WaitingForPostApproval)return r.confirm({type:4}),!0}return!1}_getNotificationBody(e,t,o){if(o)return d(6841,null);let n=this._getPendingTerminalCommand(e);return n?this._sanitizeOSToastText(n):t.detail?this._sanitizeOSToastText(t.detail):d(6839,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=fR(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)}};fge=I([m(0,Si),m(1,At),m(2,oi),m(3,B)],fge);var Qin=100,Yin=900*1024,cSo=1*1024*1024,Xin=/^\s*url\s*=\s*(.+\S)\s*$/mg;function Jin(a){let i=[],e;for(;e=Xin.exec(a);)i.push(e[1]);return i}function Zin(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 eon(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 ton(a,i,e,t,o){try{let n="",r="";if(e&&o!=="added")try{let f=await a.readFile(e,{limits:{size:cSo}});if(zke({buffer:f.value,bytesRead:f.value.byteLength}).seemsBinary)return;n=f.value.toString()}catch(f){if(f instanceof As&&f.fileOperationResult===7||o==="modified")return}if(o!=="deleted")try{let f=await a.readFile(t,{limits:{size:cSo}});if(zke({buffer:f.value,bytesRead:f.value.byteLength}).seemsBinary)return;r=f.value.toString()}catch(f){return f instanceof As&&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=ion(s,l,c,u);for(let v of f)p.push(v)}return p.join(`
`)}catch{return}}function ion(a,i,e,t){let n=[],s=_U.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 N of u){let O=N.original.startLineNumber,V=N.original.endLineNumberExclusive,U=N.modified.startLineNumber,G=N.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 te=b.length;b.push(`-${a[$-1]}`),$===a.length&&(S=te),w++,k++}for(let $=U;$<G;$++){let te=b.length;b.push(`+${i[$-1]}`),$===i.length&&(y=te),T++}}for(;w<=f;){let N=b.length;b.push(` ${a[w-1]}`),w===a.length&&(S=N),v+T===i.length&&(y=N),w++,k++,T++}n.push(`@@ -${g},${k} +${v},${T} @@`);for(let N=0;N<b.length;N++){n.push(b[N]);let O=N===S,V=N===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 oon(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 ZLi(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 U=await i.readFile(O);r=Jin(U.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 U=h.historyItemBaseRef.get();U&&(p=U.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=Zin(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>Qin)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 U=Fc(o,V.sourceUri)??V.sourceUri.path,G=eon(V,O.id),$=(async()=>{let te=await ton(i,U,V.multiDiffEditorOriginalUri,V.sourceUri,G);return{relativePath:U,changeType:G,status:O.label||O.id,unifiedDiff:te}})();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>Yin?{...S,diffs:void 0,diffsStatus:"tooLarge",changedFileCount:b}:{...S,diffs:y,diffsStatus:"included",changedFileCount:b}}var vge=class extends C{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;oe.as(ii.Configuration).registerConfiguration({id:"chatRepoInfo",title:d(6611,null),type:"object",properties:{"chat.repoInfo.enabled":{type:"boolean",description:d(6610,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=oon(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)}}};vge=I([m(0,Si),m(1,vr),m(2,$c),m(3,ne),m(4,B)],vge);var Snt=class extends oc{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 st("chat.queuePickerPrimary",u?d(7418,null):d(7413,null),q.asClassName(u?M.arrowUp:M.add),!!l.getContextKeyValue(ie.inputHasText.key),()=>this._runDefaultAction())),this._primaryAction=this._register(new Lr(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 st("chat.queuePickerDropdown",d(7415,null)));this._dropdown=this._register(new eRi(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(bf.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(7418,null):d(7413,null),this._primaryActionAction.class=q.asClassName(e?M.arrowUp:M.add)}_runDefaultAction(){let e=this._isEffectiveSteer()?qte.ID:$te.ID;this.commandService.executeCommand(e)}render(e){super.render(e),e.classList.add("monaco-dropdown-with-default");let t=_(".action-container");this._primaryAction.render(R(e,t)),this._register(j(t,re.KEY_DOWN,n=>{let r=new Ii(n);r.equals(17)&&(this._primaryAction.blur(),this._dropdown.focus(),r.stopPropagation())}));let o=_(".dropdown-action-container");this._dropdown.render(R(e,o)),this._register(j(o,re.KEY_DOWN,n=>{let r=new Ii(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:$te.ID,label:d(7413,null),tooltip:"",enabled:!0,checked:!e,icon:M.add,class:void 0,hover:{content:d(7414,null)},run:()=>{this.commandService.executeCommand($te.ID)}},o={id:qte.ID,label:d(7418,null),tooltip:"",enabled:!0,checked:e,icon:M.arrowUp,class:void 0,hover:{content:d(7419,null)},run:()=>{this.commandService.executeCommand(qte.ID)}};return[{id:"_"+SA.ID,label:d(7416,null),tooltip:"",enabled:!0,icon:M.arrowRight,class:void 0,hover:{content:d(7417,null)},run:()=>{this.commandService.executeCommand(SA.ID)}},t,o]}};Snt=I([m(2,ge),m(3,B),m(4,nl),m(5,_e),m(6,X),m(7,Te)],Snt);var eRi=class extends r0{renderLabel(i){return i.classList.add("codicon","codicon-chevron-down"),null}},bge=class extends C{static{this.ID="chat.queuePickerRendering"}constructor(i){super(),this._register(i.register(D.ChatExecute,D.ChatExecuteQueue,(e,t,o)=>{if(e instanceof Cc)return o.createInstance(Snt,e,t)}))}};bge=I([m(0,Yy)],bge);var tRi={label:d(8088,null),order:Number.MAX_SAFE_INTEGER};var non=oe.as(ii.Configuration);function m2t(){return{modelIds:[""],modelLabels:[d(6847,null)],modelDescriptions:[d(6848,null)]}}var Lie=class extends C{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(6847,null)),o.push(d(6848,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??tRi,v=g.metadata.modelPickerCategory??tRi;return f.order!==v.order?f.order-v.order:h.metadata.name.localeCompare(g.metadata.name)});for(let h of p)try{let g=R_.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&&non.notifyConfigurationSchemaUpdated({id:r,properties:{[n]:{}}})}catch(c){this._logService.error(`${s} Error updating model values:`,c)}}};Lie=I([m(2,Wr),m(3,ne)],Lie);var h2t=m2t(),eG=class extends Lie{static{this.ID="workbench.contrib.exploreAgentDefaultModel"}static{this.modelIds=h2t.modelIds}static{this.modelLabels=h2t.modelLabels}static{this.modelDescriptions=h2t.modelDescriptions}constructor(i,e){super(h2t,{configKey:"chat.exploreAgent.defaultModel",configSectionId:"chatSidebar",logPrefix:"[ExploreAgentDefaultModel]",filter:t=>!!t.capabilities?.toolCalling},i,e)}};eG=I([m(0,Wr),m(1,ne)],eG);pt(eG.ID,eG,ut.BlockRestore);var g2t=m2t(),tG=class extends Lie{static{this.ID="workbench.contrib.planAgentDefaultModel"}static{this.modelIds=g2t.modelIds}static{this.modelLabels=g2t.modelLabels}static{this.modelDescriptions=g2t.modelDescriptions}constructor(i,e){super(g2t,{configKey:"chat.planAgent.defaultModel",configSectionId:"chatSidebar",logPrefix:"[PlanAgentDefaultModel]",filter:t=>!!t.capabilities?.toolCalling},i,e)}};tG=I([m(0,Wr),m(1,ne)],tG);pt(tG.ID,tG,ut.BlockRestore);var iRi=[],oRi=[],pSo=oe.as(ea.JSONContribution);pSo.registerSchema(cpi,qJi);var nRi=oe.as(ii.Configuration);nRi.registerConfiguration({id:"chatSidebar",title:d(6215,null),type:"object",properties:{"chat.experimentalSessionsWindowOverride":{type:"boolean",description:d(6099,null),default:!1,tags:["experimental"]},"chat.fontSize":{type:"number",description:d(6104,null),default:13,minimum:6,maximum:100},"chat.fontFamily":{type:"string",description:d(6103,null),default:"default"},"chat.editor.fontSize":{type:"number",description:d(6211,null),default:it?12:14},"chat.editor.fontFamily":{type:"string",description:d(6210,null),default:"default"},"chat.editor.fontWeight":{type:"string",description:d(6212,null),default:"default"},"chat.editor.wordWrap":{type:"string",description:d(6214,null),default:"off",enum:["on","off"]},"chat.editor.lineHeight":{type:"number",description:d(6213,null),default:0},"chat.agentsControl.enabled":{type:"boolean",markdownDescription:d(6074,null,"`#window.commandCenter#`","`#chat.viewSessions.enabled#`"),default:!0,tags:["experimental"]},"chat.unifiedAgentsBar.enabled":{type:"boolean",markdownDescription:d(6181,null),default:!1,tags:["experimental"]},"chat.agentSessionProjection.enabled":{type:"boolean",markdownDescription:d(6075,null),default:!1,tags:["experimental"]},"chat.implicitContext.enabled":{type:"object",description:d(6109,null),additionalProperties:{type:"string",enum:["never","first","always"],description:d(6111,null),enumDescriptions:[d(6114,null),d(6113,null),d(6112,null)]},default:{panel:"always"},tags:["experimental"],experiment:{mode:"startup"}},"chat.implicitContext.suggestedContext":{type:"boolean",markdownDescription:d(6110,null),default:!0},"chat.editing.autoAcceptDelay":{type:"number",markdownDescription:d(6089,null),default:0,minimum:0,maximum:100},"chat.editing.confirmEditRequestRemoval":{type:"boolean",scope:1,markdownDescription:d(6090,null),default:!0},"chat.editing.confirmEditRequestRetry":{type:"boolean",scope:1,markdownDescription:d(6091,null),default:!0},"chat.editing.explainChanges.enabled":{type:"boolean",markdownDescription:d(6092,null),default:!1,tags:["experimental"],experiment:{mode:"auto"}},"chat.tips.enabled":{type:"boolean",scope:1,description:d(6170,null),default:!1,tags:["experimental"],experiment:{mode:"auto"}},"chat.upvoteAnimation":{type:"string",enum:["off","confetti","floatingThumbs","pulseWave","radiantLines"],enumDescriptions:[d(6185,null),d(6183,null),d(6184,null),d(6186,null),d(6187,null)],description:d(6182,null),default:"floatingThumbs"},"chat.experimental.detectParticipant.enabled":{type:"boolean",deprecationMessage:d(6098,null),description:d(6097,null),default:null},"chat.detectParticipant.enabled":{type:"boolean",description:d(6087,null),default:!0},"chat.inlineReferences.style":{type:"string",enum:["box","link"],enumDescriptions:[d(6120,null),d(6121,null)],description:d(6119,null),default:"box"},"chat.editorAssociations":{type:"object",markdownDescription:d(6094,null),additionalProperties:{type:"string"},default:{}},"chat.notifyWindowOnConfirmation":{type:"string",enum:["off","windowNotFocused","always"],enumDescriptions:[d(6146,null),d(6147,null),d(6145,null)],description:d(6144,null),default:"windowNotFocused"},"chat.autoReply":{default:!1,markdownDescription:d(6082,null),type:"boolean",scope:3,tags:["experimental","advanced"]},"chat.autopilot.enabled":{type:"boolean",markdownDescription:d(6081,null),default:to.quality!=="stable",tags:["experimental"]},"chat.tools.global.autoApprove":{default:!1,markdownDescription:nnt.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(6054,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(6172,null),type:"object",additionalProperties:{type:"boolean"}},"chat.tools.urls.autoApprove":{default:{},markdownDescription:d(6175,null),type:"object",additionalProperties:{oneOf:[{type:"boolean"},{type:"object",properties:{approveRequest:{type:"boolean"},approveResponse:{type:"boolean"}}}]}},"chat.tools.eligibleForAutoApproval":{default:{},markdownDescription:d(6174,null),type:"object",propertyNames:{enum:iRi,enumDescriptions:oRi},additionalProperties:{type:"boolean"},examples:[{fetch:!1,runTask:!1}],policy:{name:"ChatToolsEligibleForAutoApproval",category:"InteractiveSession",minimumVersion:"1.107",localization:{description:{key:"chat.tools.eligibleForAutoApproval",value:d(6174,null)}}}},"chat.sendElementsToChat.enabled":{default:!0,description:d(6167,null),type:"boolean",tags:["preview"]},"chat.sendElementsToChat.attachCSS":{default:!0,markdownDescription:d(6165,null,"`#chat.sendElementsToChat.enabled#`"),type:"boolean",tags:["preview"]},"chat.sendElementsToChat.attachImages":{default:!0,markdownDescription:d(6166,null,"`#chat.sendElementsToChat.enabled#`"),type:"boolean",tags:["experimental"]},"chat.undoRequests.restoreInput":{default:!0,markdownDescription:d(6180,null),type:"boolean"},"chat.editRequests":{markdownDescription:d(6095,null),type:"string",enum:["inline","hover","input","none"],default:"inline"},"chat.viewSessions.enabled":{type:"boolean",default:!0,description:d(6205,null)},"chat.viewSessions.orientation":{type:"string",enum:["stacked","sideBySide"],enumDescriptions:[d(6208,null),d(6207,null)],default:"sideBySide",description:d(6206,null)},"chat.viewProgressBadge.enabled":{type:"boolean",default:!1,description:d(6204,null)},"chat.contextUsage.enabled":{type:"boolean",default:!0,description:d(6086,null)},"chat.notifyWindowOnResponseReceived":{type:"string",enum:["off","windowNotFocused","always"],enumDescriptions:[d(6150,null),d(6151,null),d(6149,null)],default:"windowNotFocused",description:d(6148,null)},"chat.checkpoints.enabled":{type:"boolean",default:!0,description:d(6083,null)},"chat.checkpoints.showFileChanges":{type:"boolean",description:d(6084,null),default:!1},[mk]:{type:"string",description:d(6126,null),enum:["none","registry","all"],enumDescriptions:[d(6128,null),d(6129,null),d(6127,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(6126,null)},enumDescriptions:[{key:"chat.mcp.access.none",value:d(6128,null)},{key:"chat.mcp.access.registry",value:d(6129,null)},{key:"chat.mcp.access.any",value:d(6127,null)}]}}},[ZJ]:{type:"string",description:d(6131,null),default:"newAndOutdated",enum:["never","onlyNew","newAndOutdated"],enumDescriptions:[d(6132,null),d(6134,null),d(6133,null)],tags:["experimental"]},[g0t]:{type:"boolean",description:d(6140,null),default:!0,tags:["experimental"]},[SJe]:{type:"object",description:d(6136,null,"MCP: "+d(6218,null)),scope:5,additionalProperties:{type:"object",properties:{allowedDuringChat:{type:"boolean",description:d(6137,null),default:!0},allowedOutsideChat:{type:"boolean",description:d(6138,null),default:!1},allowedModels:{type:"array",items:{type:"string",description:d(6139,null)}}}}},[tot[4].enabledConfigKey]:{type:"boolean",description:d(6130,null),default:!1,tags:["experimental"],experiment:{mode:"startup"}},"chat.extensionTools.enabled":{type:"boolean",description:d(6101,null),default:!0,policy:{name:"ChatAgentExtensionTools",category:"InteractiveSession",minimumVersion:"1.99",localization:{description:{key:"chat.extensionToolsEnabled",value:d(6101,null)}}}},"chat.plugins.enabled":{type:"boolean",description:d(6154,null),default:!0,tags:["preview"]},"chat.pluginLocations":{type:"object",additionalProperties:{type:"boolean"},restricted:!0,markdownDescription:d(6153,null),scope:2,tags:["experimental"]},"chat.plugins.marketplaces":{type:"array",items:{type:"string"},markdownDescription:d(6155,null),default:["github/copilot-plugins","github/awesome-copilot"],scope:1,tags:["experimental"]},"chat.agent.enabled":{type:"boolean",description:d(6056,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(6056,null)}}}},"chat.planAgent.defaultModel":{type:"string",description:d(6152,null),default:"",enum:tG.modelIds,enumItemLabels:tG.modelLabels,markdownEnumDescriptions:tG.modelDescriptions},"chat.exploreAgent.defaultModel":{type:"string",description:d(6100,null),default:"",enum:eG.modelIds,enumItemLabels:eG.modelLabels,markdownEnumDescriptions:eG.modelDescriptions},"chat.requestQueuing.defaultAction":{type:"string",enum:["queue","steer"],enumDescriptions:[d(6160,null),d(6161,null)],description:d(6159,null),default:"steer"},"chat.editMode.hidden":{type:"boolean",description:d(6093,null),default:!0,tags:["experimental"],experiment:{mode:"auto"}},"chat.math.enabled":{type:"boolean",description:d(6125,null),default:!0},"chat.agent.codeBlockProgress":{type:"boolean",description:d(6085,null),default:!0,tags:["experimental"]},"chat.statusWidget.anonymous":{type:"boolean",description:d(6168,null),default:!1,tags:["experimental","advanced"],experiment:{mode:"auto"}},[lZ]:{type:"object",properties:Object.fromEntries(RLe.map(a=>[a,{type:"boolean",description:Kso[a]}])),additionalProperties:!1,default:Object.fromEntries(RLe.map(a=>[a,!1])),markdownDescription:d(6216,null)},[AK]:{type:"boolean",default:!1,tags:["preview"],description:d(6135,null),included:to.quality==="stable"},[b4]:{type:"string",description:d(6217,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(6217,null)}}}},[Ts.INSTRUCTIONS_LOCATION_KEY]:{type:"object",title:d(6123,null),markdownDescription:d(6122,null,XZe,mTt),default:{...iBt.map(a=>({[a.path]:!0})).reduce((a,i)=>({...a,...i}),{})},additionalProperties:{type:"boolean"},propertyNames:{pattern:Dhe,patternErrorMessage:d(6124,null)},restricted:!0,tags:["prompts","reusable prompts","prompt snippets","instructions"],examples:[{[iBt[0].path]:!0},{[dCi]:!0,"/Users/vscode/repos/instructions":!0}]},[Ts.PROMPT_LOCATIONS_KEY]:{type:"object",title:d(6164,null),markdownDescription:d(6163,null,YZe,RY),default:{[JZe]:!0},additionalProperties:{type:"boolean"},unevaluatedProperties:{type:"boolean"},propertyNames:{pattern:Dhe,patternErrorMessage:d(6156,null)},restricted:!0,tags:["prompts","reusable prompts","prompt snippets","instructions"],examples:[{[JZe]:!0},{[JZe]:!0,"/Users/vscode/repos/prompts":!0}]},[Ts.MODE_LOCATION_KEY]:{type:"object",title:d(6143,null),markdownDescription:d(6142,null,o2,U8e),default:{[eBt]:!0},deprecationMessage:d(6141,null),additionalProperties:{type:"boolean"},unevaluatedProperties:{type:"boolean"},restricted:!0,tags:["experimental","prompts","reusable prompts","prompt snippets","instructions"],examples:[{[eBt]:!0},{[eBt]:!0,"/Users/vscode/repos/chatmodes":!0}]},[Ts.AGENTS_LOCATION_KEY]:{type:"object",title:d(6073,null),markdownDescription:d(6072,null,iee,U8e),default:{[n2]:!0,[i2]:!0,[tBt]:!0},additionalProperties:{type:"boolean"},propertyNames:{pattern:Dhe,patternErrorMessage:d(6071,null)},restricted:!0,tags:["prompts","reusable prompts","prompt snippets","instructions"],examples:[{[n2]:!0},{[n2]:!0,"my-agents":!0,"../shared-agents":!0,"~/.copilot/agents":!0}]},[Ts.USE_AGENT_MD]:{type:"boolean",title:d(6189,null),markdownDescription:d(6188,null),default:!0,restricted:!0,disallowConfigurationDefault:!0,tags:["prompts","reusable prompts","prompt snippets","instructions"]},[Ts.USE_NESTED_AGENT_MD]:{type:"boolean",title:d(6201,null),markdownDescription:d(6200,null),default:!1,restricted:!0,disallowConfigurationDefault:!0,tags:["experimental","prompts","reusable prompts","prompt snippets","instructions"]},[Ts.USE_CLAUDE_MD]:{type:"boolean",title:d(6195,null),markdownDescription:d(6194,null),default:!0,restricted:!0,disallowConfigurationDefault:!0,tags:["prompts","reusable prompts","prompt snippets","instructions"]},[Ts.USE_AGENT_SKILLS]:{type:"boolean",title:d(6191,null),markdownDescription:d(6190,null),default:!0,restricted:!0,disallowConfigurationDefault:!0,tags:["prompts","reusable prompts","prompt snippets","instructions"]},[Ts.USE_SKILL_ADHERENCE_PROMPT]:{type:"boolean",title:d(6203,null),markdownDescription:d(6202,null),default:!1,restricted:!0,disallowConfigurationDefault:!0,tags:["experimental","prompts","reusable prompts","prompt snippets","instructions"],experiment:{mode:"auto"}},[Ts.INCLUDE_APPLYING_INSTRUCTIONS]:{type:"boolean",title:d(6116,null),markdownDescription:d(6115,null),default:!0,restricted:!0,disallowConfigurationDefault:!0,tags:["prompts","reusable prompts","prompt snippets","instructions"]},[Ts.INCLUDE_REFERENCED_INSTRUCTIONS]:{type:"boolean",title:d(6118,null),markdownDescription:d(6117,null),default:!1,restricted:!0,disallowConfigurationDefault:!0,tags:["prompts","reusable prompts","prompt snippets","instructions"]},[Ts.SKILLS_LOCATION_KEY]:{type:"object",title:d(6078,null),markdownDescription:d(6076,null,J4,hTt),default:{...ZZe.map(a=>({[a.path]:!0})).reduce((a,i)=>({...a,...i}),{})},additionalProperties:{type:"boolean"},propertyNames:{pattern:Dhe,patternErrorMessage:d(6077,null)},restricted:!0,tags:["prompts","reusable prompts","prompt snippets","instructions"],examples:[{[ZZe[0].path]:!0},{[ZZe[0].path]:!0,"my-skills":!0,"../shared-skills":!0,"~/.custom/skills":!0}]},[Ts.HOOKS_LOCATION_KEY]:{type:"object",title:d(6108,null),markdownDescription:d(6106,null,gTt),default:{...eet.map(a=>({[a.path]:!0})).reduce((a,i)=>({...a,...i}),{})},additionalProperties:{type:"boolean"},propertyNames:{pattern:Dhe,patternErrorMessage:d(6107,null)},restricted:!0,tags:["preview","prompts","hooks","agent"],examples:[{[eet[0].path]:!0},{[eet[0].path]:!0,"custom-hooks/hooks.json":!0}]},[Ts.USE_CHAT_HOOKS]:{type:"boolean",title:d(6199,null),markdownDescription:d(6198,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(6198,null)}}}},[Ts.USE_CLAUDE_HOOKS]:{type:"boolean",title:d(6193,null),markdownDescription:d(6192,null),default:!1,restricted:!0,disallowConfigurationDefault:!0,tags:["preview","prompts","hooks","agent"]},[Ts.USE_CUSTOM_AGENT_HOOKS]:{type:"boolean",title:d(6197,null),markdownDescription:d(6196,null),default:!1,restricted:!0,disallowConfigurationDefault:!0,tags:["preview","prompts","hooks","agent"]},[Ts.PROMPT_FILES_SUGGEST_KEY]:{type:"object",scope:5,title:d(6158,null),markdownDescription:d(6157,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(6178,null)},"chat.agent.thinkingStyle":{type:"string",default:"fixedScrolling",enum:["collapsed","collapsedPreview","fixedScrolling"],enumDescriptions:[d(6067,null),d(6068,null),d(6069,null)],description:d(6070,null),tags:["experimental"]},"chat.agent.thinking.generateTitles":{type:"boolean",default:!0,description:d(6062,null),tags:["experimental"]},"chat.agent.thinking.collapsedTools":{type:"string",default:"always",enum:["off","withThinking","always"],enumDescriptions:[d(6060,null),d(6061,null),d(6059,null)],markdownDescription:d(6058,null),tags:["experimental"]},"chat.agent.thinking.terminalTools":{type:"boolean",default:!0,markdownDescription:d(6066,null),tags:["experimental"]},"chat.tools.terminal.simpleCollapsible":{type:"boolean",default:!0,markdownDescription:d(6177,null),tags:["experimental"]},"chat.tools.usagesTool.enabled":{type:"boolean",default:!0,markdownDescription:d(6179,null),tags:["preview"],experiment:{mode:"auto"}},"chat.tools.renameTool.enabled":{type:"boolean",default:!0,markdownDescription:d(6176,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(6064,null)},phrases:{type:"array",items:{type:"string"},default:[],description:d(6065,null)}},additionalProperties:!1,markdownDescription:d(6063,null),tags:["experimental"]},"chat.tools.autoExpandFailures":{type:"boolean",default:!0,markdownDescription:d(6173,null)},"chat.disableAIFeatures":{type:"boolean",description:d(6088,null),default:!1,scope:4},"chat.allowAnonymousAccess":{type:"boolean",description:d(6080,null),default:!1,tags:["experimental"],experiment:{mode:"auto"}},"chat.growthNotification.enabled":{type:"boolean",description:d(6105,null),default:!1,tags:["experimental"],experiment:{mode:"auto"}},"chat.restoreLastPanelSession":{type:"boolean",description:d(6162,null),default:!1},"chat.exitAfterDelegation":{type:"boolean",description:d(6096,null),default:!1,tags:["preview"]},"chat.extensionUnification.enabled":{type:"boolean",description:d(6102,null),default:!0,tags:["experimental"],experiment:{mode:"auto"}},"chat.customAgentInSubagent.enabled":{type:"boolean",description:d(6169,null),default:!0,experiment:{mode:"auto"}},"chat.customizationsMenu.enabled":{type:"boolean",tags:["preview"],description:d(6079,null),default:!0}}});oe.as(rn.EditorPane).registerEditorPane(ys.create(LA,Va.EditorID,d(6055,null)),[new Mt(Va)]);oe.as(rn.EditorPane).registerEditorPane(ys.create(Yte,XR.ID,d(6209,null)),[new Mt(XR)]);oe.as(rn.EditorPane).registerEditorPane(ys.create(JB,JB.ID,d(6053,null)),[new Mt(gie)]);oe.as(rp.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:lZ,migrateFn:a=>typeof a=="boolean"?{value:Object.fromEntries(RLe.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 _0e=class extends C{constructor(e,t,o){super();this.editorResolverService=t;this.instantiationService=o;this._editorRegistrations=this._register(new jt);this._registerEditor(Y.vscodeChatEditor),this._registerEditor(Y.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:Va.EditorID,label:d(6055,null),priority:"builtin"},{singlePerResource:!0,canSupportResource:t=>t.scheme===e},{createEditorInput:({resource:t,options:o})=>({editor:this.instantiationService.createInstance(Va,t,o),options:o})}))}};_0e=I([m(0,Ls),m(1,ul),m(2,F)],_0e);var D0e=class{static{this.ID="workbench.contrib.chatDebugResolver"}constructor(i){i.registerEditor(`${XR.RESOURCE.scheme}:**/**`,{id:XR.ID,label:d(6209,null),priority:"exclusive"},{singlePerResource:!0,canSupportResource:e=>e.scheme===XR.RESOURCE.scheme},{createEditorInput:()=>({editor:XR.instance,options:{pinned:!0}})})}};D0e=I([m(0,ul)],D0e);var L0e=class extends C{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(6215,null),type:"object",properties:{"chat.agent.maxRequests":{type:"number",markdownDescription:d(6057,null),default:n??50,order:2}}};nRi.updateConfigurations({remove:e?[e]:[],add:[r]}),e=r})};this._register(H.runAndSubscribe(H.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()})}};L0e=I([m(0,kC),m(1,vr),m(2,X)],L0e);var R0e=class extends C{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(H.filter(this.viewsService.onDidChangeViewVisibility,r=>r.id===Vr)(()=>{this.updateForegroundSessionCount()})),this.updateForegroundSessionCount()}static{this.ID="workbench.contrib.chatForegroundSessionCount"}updateForegroundSessionCount(){let e=this.viewsService.isViewVisible(Vr)?1:0;for(let t of this.chatWidgetService.getWidgetsByLocations("panel"))t.domNode.offsetParent!==null&&(XI(t.viewContext)||_ce(t.viewContext)&&t.viewContext.isQuickChat||e++);this.foregroundSessionCountContextKey.set(e)}};R0e=I([m(0,X),m(1,At),m(2,Ft),m(3,ee)],R0e);function dSo(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 M0e=class extends C{constructor(e){super();this.chatModeService=e;this._modeActionDisposables=new jt;this._store.add(this._modeActionDisposables);let{builtin:t,custom:o}=this.chatModeService.getModes(),n=dSo(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=dSo(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 pme{constructor(){super(e)}};this._modeActionDisposables.set(e.id,W(t))}};M0e=I([m(0,Pv)],M0e);var P0e=class extends C{constructor(e){super();this._configurationService=e;this._registrations=this._register(new P);this._updateAssociations(),this._register(this._configurationService.onDidChangeConfiguration(t=>{t.affectsConfiguration(Ts.HOOKS_LOCATION_KEY)&&this._updateAssociations()}))}static{this.ID="workbench.contrib.hookSchemaAssociation"}_updateAssociations(){this._registrations.clear();let e=Ts.promptSourceFolders(this._configurationService,"hook");for(let t of e){if(t.source==="claude-workspace"||t.source==="claude-workspace-local"||t.source==="claude-personal")continue;let o=t.path.toLowerCase().endsWith(".json")?t.path:`${t.path}/*.json`;this._registrations.add(pSo.registerSchemaAssociation(cpi,o))}}};P0e=I([m(0,B)],P0e);var A0e=class extends C{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));iRi.length=0,oRi.length=0;for(let t of e)iRi.push(t.toolReferenceName),oRi.push(d(6171,null,t.toolReferenceName,t.userDescription||t.displayName));nRi.notifyConfigurationSchemaUpdated({id:"chatSidebar",properties:{"chat.tools.eligibleForAutoApproval":{}}})}};A0e=I([m(0,jn)],A0e);xa.register(new MKt);xa.register(new O1t);xa.register(new vzt);xa.register(new bzt);xa.register(new Szt);xa.register(new Izt);Dx(aFe);oe.as(rn.EditorFactory).registerEditorSerializer(Va.TypeID,O_t);oe.as(rn.EditorFactory).registerEditorSerializer(XR.ID,Fzt);pt(_0e.ID,_0e,ut.BlockStartup);pt(D0e.ID,D0e,ut.BlockStartup);pt(m8.ID,m8,ut.BlockRestore);pt($he.ID,$he,ut.BlockRestore);pt(mge.ID,mge,ut.Eventually);pt(ege.ID,ege,ut.BlockStartup);pt(Mce.ID,Mce,ut.BlockRestore);pt(Ehe.ID,Ehe,ut.BlockRestore);pt(tge.ID,tge,ut.Eventually);pt(Ahe.ID,Ahe,ut.BlockRestore);pt(Qme.ID,Qme,ut.Eventually);pt(gge.ID,gge,ut.BlockStartup);pt(O2.ID,O2,ut.Eventually);pt(ige.ID,ige,ut.BlockRestore);pt(oge.ID,oge,ut.AfterRestored);pt(nge.ID,nge,ut.BlockRestore);pt(Rhe.ID,Rhe,ut.Eventually);pt(Phe.ID,Phe,ut.BlockRestore);pt(Mhe.ID,Mhe,ut.BlockRestore);pt(L0e.ID,L0e,ut.AfterRestored);pt(R0e.ID,R0e,ut.AfterRestored);pt(M0e.ID,M0e,ut.Eventually);pt(P0e.ID,P0e,ut.AfterRestored);pt(A0e.ID,A0e,ut.AfterRestored);pt(Ohe.ID,Ohe,ut.Eventually);pt(Uhe.ID,Uhe,ut.AfterRestored);pt(bge.ID,bge,ut.BlockRestore);pt(fme.ID,fme,ut.AfterRestored);pt(Ghe.ID,Ghe,ut.AfterRestored);pt(mme.ID,mme,ut.AfterRestored);pt(Fhe.ID,Fhe,ut.BlockRestore);pt(Nhe.ID,Nhe,ut.AfterRestored);pt(hge.ID,hge,ut.BlockRestore);pt(zhe.ID,zhe,ut.BlockStartup);pt(Hme.ID,Hme,ut.AfterRestored);pt(Vme.ID,Vme,ut.Eventually);pt(_he.ID,_he,ut.Eventually);pt(fge.ID,fge,ut.AfterRestored);pt(vge.ID,vge,ut.Eventually);pt(pge.ID,pge,ut.AfterRestored);Ldo();Ygo();Mfo();Qfo();nfo();sfo();Ofo();qfo();Ndo();Tpo();jfo();pfo();Bfo();Ffo();Kfo();Gfo();Rfo();Afo();Pdo();npo();Npo();Hfo();Ufo();W(eAe);Dx(kMe);oot.register(new Mt(qFe));oot.register(new Mt(jFe));we(dtt,tAe,1);we(hOe,mOe,1);we(Si,gOe,1);we(At,T0e,1);we(M_,WFe,1);we(NO,rFe,1);we(uet,OMe,1);we(Wj,bFe,1);we(Wr,Vj,1);we(Cdo,FMe,1);we(FO,mke,1);we(br,dke,1);we(mz,pke,1);we(TTt,gke,1);we(Db,$Fe,1);we(QB,RFe,1);we(lie,x0e,1);we(Y2,k0e,1);we(jn,OA,1);we(gD,GFe,1);we(A1t,Fv,1);we(LY,FKt,1);we(NY,PTt,1);we(dl,fFe,1);we(Av,yHt,1);we(jxe,BEt,1);we(nr,Ute,1);we(uS,RMt,1);we(Pv,e3,1);we(jF,EMe,1);we(Aee,pHt,1);we(dF,UTe,1);we(UEe,HEe,1);we(XHt,vFe,1);we(l0,HAe,1);we(em,Wzt,1);Cw.CONTRIBS.push(JS);var mSo="mcp.extCachedServers",ron=Tn.registerExtensionPoint(jso);var Rie=class extends C{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 jt);this.cachedServers=t.getObject(mSo,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(CV.toSerialized)})}r&&t.store(mSo,this.cachedServers,1,1)}))}start(){let e=this._register(new jt);this._register(ron.setHandler((t,o)=>{let{added:n,removed:r}=o;for(let s of r)for(let l of s.value){let c=p6e(s.description.identifier,l.id);e.deleteAndDispose(c),this._conditionalCollections.deleteAndDispose(c)}for(let s of n)if(Rie._validate(s))for(let l of s.value){let c=p6e(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:nk.Kind.Trusted,scope:1,configTarget:2,serverDefinitions:Le(this,r?.map(CV.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=x.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(bJe(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(11344,null)),!1;for(let t of e.value){if(typeof t.id!="string"||Jl(t.id))return e.collector.error(d(11345,null)),!1;if(typeof t.label!="string"||Jl(t.label))return e.collector.error(d(11346,null)),!1;if(t.when!==void 0&&(typeof t.when!="string"||Jl(t.when)))return e.collector.error(d(11347,null)),!1}return!0}};Rie=I([m(0,md),m(1,le),m(2,lt),m(3,X)],Rie);var hSo=a=>{let i=zL(a.model.getValue()),e=lC(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 N0e=class extends C{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 jt)}start(){let e=this._register(new um);this._register(this.mcpWorkbenchService.onChange(()=>e.queue(()=>this.sync()))),this.sync()}async getServerIdMapping(e,t){let o=new P;try{let n=await this.textModelService.createModelReference(e);return o.add(n),hSo({model:n.object.textEditorModel,pathToServers:t})}catch{return new Map}finally{o.dispose()}}async sync(){try{let e=new Map,t=new vt;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 _P.hash(u),roots:s?.workspaceFolder?[s.workspaceFolder.uri]:void 0,variableReplacement:{folder:s?.workspaceFolder,section:FF,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=Le(this,r),l={id:o,label:n?.label??"",presentation:{order:r[0]?.presentation?.order,origin:n?.uri},remoteAuthority:n?.remoteAuthority??null,serverDefinitions:s,trustBehavior:nk.Kind.Trusted,configTarget:n?.target??2,scope:n?.scope??0},c=this.collections.get(o);if(!(c?!upi.equals(c.definition,l):!0)){(!c||!$i(c.definition.serverDefinitions.get(),l.serverDefinitions.get(),CV.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)}}};N0e=I([m(0,Nf),m(1,md),m(2,Nt),m(3,ne)],N0e);var rRi=class{constructor(){this._discovery=[]}register(i){this._discovery.push(i)}getAll(){return this._discovery}},iG=new rRi;var vtg=ae("INativeMcpDiscoveryHelperService"),f2t="NativeMcpDiscoveryHelper";async function sRi(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 _P.hash(r)}}))}var O0e=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 sRi(this.id,i,e)}},v2t=class extends O0e{constructor(e){super(e);this.discoverySource="windsurf";this.id=`windsurf.${this.remoteAuthority}`}getFilePath({homedir:e}){return A.joinPath(e,".codeium","windsurf","mcp_config.json")}},b2t=class extends O0e{constructor(e){super(e);this.discoverySource="cursor-global";this.id=`cursor.${this.remoteAuthority}`}getFilePath({homedir:e}){return A.joinPath(e,".cursor","mcp.json")}};var Sge=class extends C{constructor(e,t,o){super();this._fileService=t;this._mcpRegistry=o;this.fromGallery=!1;this._fsDiscoveryEnabled=pr(lZ,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 P,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(he(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}};Sge=I([m(0,B),m(1,be),m(2,md)],Sge);var Mie=class extends Sge{constructor(e,t,o,n,r,s){super(s,o,r);this.suffix="";e&&(this.suffix=" "+d(11348,null,t.getHostLabel(Y.vscodeRemote,e))),this.adapters=[n.createInstance(O0e,e),n.createInstance(b2t,e),n.createInstance(v2t,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:zso[o.discoverySource]+this.suffix,remoteAuthority:o.remoteAuthority,configTarget:2,scope:0,trustBehavior:nk.Kind.TrustedOnNonce,serverDefinitions:Le(this,[]),presentation:{origin:n,order:o.order+(o.remoteAuthority?-50:0)}};this._register(this.watchFile(n,r,o.discoverySource,s=>o.adaptFile(s,t)))}}};Mie=I([m(1,ot),m(2,be),m(3,F),m(4,md),m(5,B)],Mie);var F0e=class extends Mie{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(f2t,async t=>{dd.toService(t).load().then(n=>this.setDetails(n),n=>{this.logService.warn("Error getting remote process MCP environment",n),this.setDetails(void 0)})})}};F0e=I([m(0,yo),m(1,ne),m(2,ot),m(3,be),m(4,F),m(5,md),m(6,B)],F0e);var W0e=class extends C{constructor(e,t){super();this._agentPluginService=e;this._mcpRegistry=t;this.fromGallery=!1;this._collections=this._register(new UD)}start(){this._register(he(e=>{let t=this._agentPluginService.plugins.read(e),o=new Mn;for(let n of t){o.add(n.uri);let r=this._collections.get(n.uri);r||(r=this.createCollectionState(n),this._collections.set(n.uri,r))}for(let[n]of this._collections)o.has(n)||this._collections.deleteAndDispose(n)}))}createCollectionState(e){let t=`plugin.${e.uri}`;return this._mcpRegistry.registerCollection({id:t,label:`${e.label} (Agent Plugin)`,remoteAuthority:e.uri.scheme===Y.vscodeRemote?e.uri.authority:null,configTarget:2,scope:0,trustBehavior:nk.Kind.Trusted,serverDefinitions:e.mcpServerDefinitions.map(o=>o.map(n=>this._toServerDefinition(t,n)).filter(mo)),presentation:{origin:e.uri,order:350}})}_toServerDefinition(e,{name:t,configuration:o}){let n=this._toLaunch(o);if(n)return{id:`${e}.${t}`,label:t,launch:n,cacheNonce:String(Ir(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}}};W0e=I([m(0,Db),m(1,md)],W0e);var V0e=class extends Sge{constructor(e,t,o,n,r){super(n,e,o);this._workspaceContextService=t;this._remoteAgentService=r;this._collections=this._register(new jt)}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=je(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:nk.Kind.TrustedOnNonce,serverDefinitions:Le(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 sRi(o.id,n,e.uri);return r?.forEach(s=>s.roots=[e.uri]),r}))}};V0e=I([m(0,be),m(1,Pe),m(2,md),m(3,B),m(4,yo)],V0e);var rH;(o=>(o.serverCount=new Q("mcp.serverCount",void 0,{type:"number",description:d(11391,null)}),o.hasUnknownTools=new Q("mcp.hasUnknownTools",void 0,{type:"boolean",description:d(11390,null)}),o.hasServersWithErrors=new Q("mcp.hasServersWithErrors",void 0,{type:"boolean",description:d(11389,null)}),o.toolsCount=new Q("mcp.toolsCount",void 0,{type:"number",description:d(11392,null)})))(rH||={});var B0e=class extends C{static{this.ID="workbench.contrib.mcp.contextKey"}constructor(i,e){super();let t=rH.serverCount.bindTo(e),o=rH.toolsCount.bindTo(e),n=rH.hasUnknownTools.bindTo(e);this._store.add(tc(rH.hasServersWithErrors,e,r=>i.servers.read(r).some(s=>s.connectionState.read(r).state===ir.Kind.Error))),this._store.add(he(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}))}))}};B0e=I([m(0,es),m(1,X)],B0e);var H0e=ae("imageResizeMainService");var Ige=class extends C{constructor(e,t,o,n,r){super();this._toolsService=e;this._instantiationService=o;this._mcpRegistry=n;this.lifecycleService=r;let s=this._register(new jt);this._register(he(l=>{let c=t.servers.read(l),u=new Set(s.keys());for(let p of c){let h=s.get(p);if(h){if(u.delete(p),!h.source||uo(h.source,BPe(p,l)))continue;h.dispose()}let g=new P,f={dispose:()=>g.dispose()},v=new co(()=>{let b=f.source=BPe(p),S=p.definition.label.toLowerCase().replace(/\s+/g,"-");return{toolSet:g.add(this._toolsService.createToolSet(b,p.definition.id,S,{icon:M.mcp,description:d(11396,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(he(s=>{let l=new Set(n.keys()),c=[],u=(h,g,f)=>{f.add(this._toolsService.registerTool(g,this._instantiationService.createInstance(Int,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||M.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)uo(g.toolData,v)||(g.toolData=v,g.store.clear(),u(h,v,g.store)),l.delete(h.id);else{let b=new P;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()}))}};Ige=I([m(0,jn),m(1,es),m(2,F),m(3,md),m(4,ao)],Ige);var Int=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 Ov.callOn(t,async(u,p)=>p.definition.sandboxEnabled)===!0,r=d(11395,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 xe(d(11400,null,s)),l.message=new xe(e.definition.description,{supportThemeIcons:!0}),l.disclaimer=r,l.allowAutoConfirm=!0),e.definition.annotations?.openWorldHint&&(l.confirmResults=!0));let c=this._configurationService.getValue(g0t);return{confirmationMessages:l,invocationMessage:new xe(d(11398,null,s)),pastTenseMessage:new xe(d(11397,null,s)),originMessage:d(11399,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(mo);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(Sl(f).buffer,g);b=Je.wrap(S)}catch{b=Sl(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:ZJi,data:Je.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=uw.fromServer(this._server.definition,l.uri);s.output.push({type:"ref",uri:g,audience:c,mimeType:l.mimeType}),h&&(l.mimeType&&X4(l.mimeType)?n.content.push({kind:"data",audience:c,value:{mimeType:l.mimeType,data:await this._fileService.readFile(g).then(f=>f.value).catch(()=>Je.alloc(0))}}):p(g,l.mimeType))}else if(l.type==="resource"){let g=uw.fromServer(this._server.definition,l.resource.uri);if(l.resource.mimeType&&X4(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&&wB.createUri(i.context.sessionResource,i.callId,n.content.length,Ye(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}};Int=I([m(2,B),m(3,nt),m(4,be),m(5,H0e)],Int);var fSo="mcpEncryptionKey",I2t="AES-GCM",aon=256,lon=12,aRi=1,vSo="mcpInputs",N8=class extends C{constructor(e,t,o,n,r){super();this._scope=e;this._storageService=o;this._secretStorageService=n;this._logService=r;this._secretsSealerSequencer=new Nm;this._getEncryptionKey=new co(()=>N8.secretSequencer.queue(async()=>{let e=await this._secretStorageService.get(fSo);if(e)try{let n=JSON.parse(e);return await crypto.subtle.importKey("jwk",n,I2t,!1,["encrypt","decrypt"])}catch{}let t=await crypto.subtle.generateKey({name:I2t,length:aon},!0,["encrypt","decrypt"]),o=await crypto.subtle.exportKey("jwk",t);return await this._secretStorageService.set(fSo,JSON.stringify(o)),t}));this._didChange=!1;this._record=new co(()=>{let e=this._storageService.getObject(vSo,this._scope);return e?.version===aRi?{...e}:{version:aRi,values:{}}});this._register(o.onWillSaveState(()=>{this._didChange&&(this._storageService.store(vSo,{version:aRi,values:this._record.value.values,secrets:this._record.value.secrets},this._scope,t),this._didChange=!1)}))}static{this.secretSequencer=new Nm}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||mf(this._record.value.unsealedSecrets)){this._record.value.secrets=void 0;return}let t=JSON.stringify(this._record.value.unsealedSecrets),o=crypto.getRandomValues(new Uint8Array(lon)),n=await crypto.subtle.encrypt({name:I2t,iv:o.buffer},e,new TextEncoder().encode(t).buffer),r=Qd(Je.wrap(new Uint8Array(n)));this._record.value.secrets={iv:Qd(Je.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=Sl(this._record.value.secrets.iv),o=Sl(this._record.value.secrets.value),n=await crypto.subtle.decrypt({name:I2t,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{}}};N8=I([m(2,le),m(3,LE),m(4,ne)],N8);var Pie=class extends Error{constructor(e,t,o){super(t);this.code=e;this.data=o}},y2t=class a extends C{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=ve.None,o){if(this._store.isDisposed)return Promise.reject(new ho);let n=this._nextRequestId++,r=new Go,s=new $e;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)){for(let t of e)await this._handleMessage(t);return}await this._handleMessage(e)}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){don(e)&&(Wo(e,{result:!0})?this._handleResult(e):this._handleError(e)),con(e)&&await this._handleRequest(e),uon(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 Pie(e.error.code,e.error.message,e.error.data)),t.cts.dispose(!0))}async _handleRequest(e){if(!this._handlers.handleRequest){this._send({jsonrpc:"2.0",id:e.id,error:{code:a.MethodNotFound,message:`Method not found: ${e.method}`}});return}let t=new $e;this._register(Z(()=>t.dispose(!0)));try{let o=this._handlers.handleRequest(e,t.token),n=pon(o)?await o:o;this._send({jsonrpc:"2.0",id:e.id,result:n})}catch(o){o instanceof Pie?this._send({jsonrpc:"2.0",id:e.id,error:{code:o.code,message:o.message,data:o.data}}):this._send({jsonrpc:"2.0",id:e.id,error:{code:a.InternalError,message:o instanceof Error?o.message:"Internal error"}})}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 con(a){return"method"in a&&"id"in a&&(typeof a.id=="string"||typeof a.id=="number")}function don(a){return Wo(a,{id:!0,result:!0})||Wo(a,{id:!0,error:!0})}function uon(a){return Wo(a,{method:!0})&&!Wo(a,{id:!0})}function pon(a){return typeof a=="object"&&a!==null&&"then"in a&&typeof a.then=="function"}var w2t=class a extends C{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 y2t(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:Tv.JSONRPC_VERSION,method:"notifications/tasks/status",params:l})})),this._register(Z(()=>this._taskManager.setHandler(void 0))),this._register(e.onDidReceiveMessage(l=>{eSe(this.logger.getLevel(),this._requestLogLevel)&&Kre(this.logger,this._requestLogLevel,`[server -> editor] ${JSON.stringify(l)}`),this._rpc.handleMessage(l)})),this._register(he(l=>{let c=e.state.read(l).state;(c===ir.Kind.Error||c===ir.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 P;try{return r.add(new EI).cancelAndSet(()=>{t.logger.info("Waiting for server to respond to `initialize` request...")},5e3),await e.invokeFunction(async l=>{let c=l.get(nt),u=await n.sendRequest({method:"initialize",params:{protocolVersion:Tv.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=ve.None){return this._store.isDisposed?Promise.reject(new ho):this._rpc.sendRequest(e,t,o=>this.sendNotification({method:"notifications/cancelled",params:{requestId:o}})).catch(o=>{throw o instanceof Pie?new gX(o.message,o.code,o.data):o})}send(e){eSe(this.logger.getLevel(),this._requestLogLevel)&&Kre(this.logger,this._requestLogLevel,`[editor -> server] ${JSON.stringify(e)}`),this._launch.send(e)}async*sendRequestPaginated(e,t,o,n=ve.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:Tv.JSONRPC_VERSION})}handleServerRequest(e,t){let o=n=>{if(n instanceof gb)return new Pie(n.code,n.message,n.data);this.logger.error(`Error handling request ${e.method}:`,n);let r=gb.unknown(n instanceof Error?n:new Error(String(n)));return new Pie(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 gb.methodNotFound(e.method);return FT(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){LHt(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:mon(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 ht.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 ht.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 ht.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 ht.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(cpo(n)){let r=new cRi(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 ht.asyncToArrayFlat(this.sendRequestPaginated("tasks/list",o=>o.tasks,e,t))}};function lRi(a){return a.status==="completed"||a.status==="failed"||a.status==="cancelled"}var cRi=class extends C{constructor(e,t=ve.None,o){super();this._task=e;this._onStatusMessage=o;this.promise=new Go;this._handler=Le("mcpTaskHandler",void 0);let n=e.ttl?Date.now()+e.ttl:void 0;this._lastTaskState=Le("lastTaskState",this._task);let r=this._register(new P);if(t.isCancellationRequested?this._lastTaskState.set({...this._task,status:"cancelled"},void 0):r.add(t.onCancellationRequested(()=>{let c=this._lastTaskState.get();lRi(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(nn(()=>{let u=this._lastTaskState.get();lRi(u)||this._lastTaskState.set({...u,status:"cancelled",statusMessage:"Task timed out."},void 0)},c))}let s=Le("activeResultLookup",void 0);r.add(he(c=>{let u=this._lastTaskState.read(c);if(lRi(u))return;let p=s.read(c);if(p){let v=p.promiseResult.read(c);return Ui(b=>{v&&(v.data?(s.set(void 0,b),this._lastTaskState.set(v.data,b)):(s.set(void 0,b),v.error instanceof gb&&v.error.code===Tv.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 $e(t);c.store.add(Z(()=>f.dispose(!0))),c.store.add(nn(()=>{h.getTask({taskId:u.taskId},f.token).catch(v=>v instanceof gb&&v.code===Tv.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(he(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 $e(t);c.store.add(Z(()=>g.dispose(!0))),s.set(new Au(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 mon(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 Hr(a)}}var U0e=class extends C{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=Le("mcpServerState",{state:ir.Kind.Stopped});this._requestHandler=Le("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(!ir.canBeStarted(t.state))return this._waitForState(ir.Kind.Running,ir.Kind.Error);this._launch.value=void 0,this._state.set({state:ir.Kind.Starting},void 0),this._logger.info(d(11442,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(ir.Kind.Running,ir.Kind.Error)}catch(o){let n={state:ir.Kind.Error,message:o instanceof Error?o.message:String(o)};return this._state.set(n,void 0),n}}adoptLaunch(e,t){let o=new P,n=new $e;o.add(Z(()=>n.dispose(!0))),o.add(e),o.add(e.onDidLog(({level:s,message:l})=>{Kre(this._logger,s,l);let c=this._toPotentialSandboxBlock(l);c&&this._onPotentialSandboxBlock.fire(c)}));let r=!1;return o.add(he(s=>{let l=e.state.read(s);this._state.set(l,void 0),this._logger.info(d(11443,null,ir.toString(l))),l.state===ir.Kind.Running&&!r&&(r=!0,w2t.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&&ir.isRunning(this._state.read(void 0))){let u=c.message;c instanceof ho?(u="Server exited before responding to `initialize` request.",this._logger.error(u)):this._logger.error(c),this._state.set({state:ir.Kind.Error,message:u},void 0)}o.dispose()}))})),{dispose:()=>o.dispose(),object:e}}async stop(){this._logger.info(d(11444,null,this.definition.label)),this._launch.value?.object.stop(),await this._waitForState(ir.Kind.Stopped,ir.Kind.Error)}dispose(){this._requestHandler.get()?.dispose(),super.dispose(),this._state.set({state:ir.Kind.Stopped},void 0)}_waitForState(...e){let t=this._state.get();return e.includes(t.state)?Promise.resolve(t):new Promise(o=>{let n=he(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(?:EAI_AGAIN|ENOTFOUND)\b/i.test(e))return{kind:"network",message:e,host:this._extractSandboxHost(e)};if(/(?:\b(?:EACCES|EPERM|ENOENT|fail(?:ed|ure)?)\b|not accessible)/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){let n=(e.match(/No matching config rule, denying:\s+(.+)$/i)?.[1]??e).trim().replace(/^["'`]+|["'`,.;]+$/g,"");return n&&(n.replace(/^[a-z][a-z0-9+.-]*:\/\//i,"").split(/[\s/]/,1)[0]??"").replace(/:\d+$/,"")||void 0}};U0e=I([m(7,F)],U0e);var dRi="__vscode_not_trusted",z0e=class extends C{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=Le("collections",[]);this._delegates=Le("delegates",[]);this.collections=Ce(e=>this._mcpAccessValue.read(e)==="none"?[]:this._collections.read(e));this._workspaceStorage=new co(()=>this._register(this._instantiationService.createInstance(N8,1,0)));this._profileStorage=new co(()=>this._register(this._instantiationService.createInstance(N8,0,0)));this._ongoingLazyActivations=Le(this,0);this.lazyCollectionState=Ce(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=pr(mk,"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?C.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=cS.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=cS.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 dw("workspaceTrust");if(!await this._workspaceTrustRequestService.requestWorkspaceTrust({message:d(11408,null)}))return!1}if(e.trustBehavior===nk.Kind.Trusted)return this._logService.trace(`MCP server ${t.id} is trusted, no trust prompt needed`),!0;if(e.trustBehavior===nk.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===dRi)if(r==="all-untrusted"){if(l)throw new dw("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 dw("serverTrust");let c=await this._promptForTrust(t,e,n,o);return c?!0:c===void 0?void 0:(o.trustedAtNonce=dRi,!1)}else Hr(e.trustBehavior)}async _promptForTrust(e,t,o,n){o??=new hX,o.participants.set(e.id,{s:"waiting",definition:e,collection:t});let r=await new Promise(s=>{ux(l=>{let c=o.participants.observable.read(l);ht.some(c.values(),u=>u.s==="unknown")||(l.dispose(),o.choice??=this._promptForTrustOpenDialog([...c.values()].map(u=>u.s==="waiting"?u:void 0).filter(mo)),s(o.choice))})});return this._logService.trace("MCP trusted servers:",r),r&&(n.trustedAtNonce=r.includes(e.id)?e.cacheNonce:dRi),!!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 Ei&&(p+=` (${d(11409,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(11410,null,c.definition.label),custom:{icon:M.shield,markdownDetails:[{markdown:new xe(d(11403,null,t(c))),actionHandler:()=>this._editorService.openEditor({resource:u},hg).then(Boolean)}]},buttons:[{label:d(11407,null),run:()=>!0},{label:d(11405,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(11411,null,e.length),custom:{icon:M.shield,markdownDetails:[{markdown:new xe(d(11404,null,o)),actionHandler:c=>this._editorService.openEditor({resource:A.parse(c)},hg).then(Boolean)}]},buttons:[{label:d(11407,null),run:()=>"all"},{label:d(11406,null),run:()=>"pick"},{label:d(11405,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 P,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 Ei?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=cS.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 dw("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(oAe).transform(c,h))),h=await this._mcpSandboxService.launchInSandboxIfEnabled(c,h,l.remoteAuthority??void 0,l.configTarget)}catch(g){if(g instanceof dw)throw g;this._notificationService.notify({severity:St.Error,message:d(11401,null,c.label,String(g)),actions:{primary:l.presentation?.origin&&[{id:"mcp.launchError.openConfig",class:void 0,enabled:!0,tooltip:"",label:d(11402,null),run:()=>this._editorService.openEditor({resource:l.presentation.origin,options:{selection:c.presentation?.origin?.range}})}]}});return}return this._instantiationService.createInstance(U0e,l,c,u,h,r,e.errorOnUserInteraction,e.taskManager)}}};z0e=I([m(0,F),m(1,sp),m(2,ct),m(3,Ne),m(4,ee),m(5,B),m(6,Ge),m(7,ot),m(8,ne),m(9,rAe),m(10,ns),m(11,Vd)],z0e);var hon=3e3,K0e=class extends C{constructor(e,t,o){super();this._instantiationService=e;this._fileService=t;this._webContentExtractorService=o;this._mcpServiceLazy=new co(()=>this._instantiationService.invokeFunction(e=>e.get(es)));this._momentaryCache=new vt;this.onDidChangeCapabilities=H.None;this._onDidChangeFile=this._register(new E);this.onDidChangeFile=this._onDidChangeFile.event;this.capabilities=19474;this._register(this._fileService.registerProvider(uw.scheme,this))}get _mcpService(){return this._mcpServiceLazy.value}async readFile(e){return this._readFile(e)}readFileStream(e,t,o){let n=_I(r=>Je.concat(r.map(s=>Je.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 C.None;n.start();let s=new P,l,c=s.add(new me),u=s.add(new me);return s.add(he(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 $e,l=g;let f=u.value.token;g.subscribe({uri:o.toString()},f).then(()=>{f.isCancellationRequested||(c.value=g.onDidUpdateResource(v=>{bSo(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 Jr("File not found","EntryNotFound");return{ctime:0,mtime:0,size:ky(o,n=>uRi(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 Jr("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)=>mr(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,uRi(l).byteLength>0?1:2)}}return[...s]}mkdir(e){throw Jr("write is not supported","NoPermissions")}writeFile(e,t,o){throw Jr("write is not supported","NoPermissions")}delete(e,t){throw Jr("delete is not supported","NoPermissions")}rename(e,t,o){throw Jr("rename is not supported","NoPermissions")}async _readFile(e,t){let{forSameURI:o,contents:n}=await this._readURI(e);if(!o.length)throw n.length?Jr("File is a directory","EntryIsADirectory"):Jr("File not found","EntryNotFound");return uRi(o[0])}_decodeURI(e){let t,o;try{({definitionId:t,resourceURL:o}=uw.toServer(e))}catch(s){throw Jr(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 Jr(`MCP server ${t} not found`,"EntryNotFound");let r=n.capabilities.get();if(r!==void 0&&!(r&16))throw Jr(`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||ve.None),o.promise;let n=this._store.add(new cpt);n.add(t||ve.None);let r=this._readURIInner(e,n.token);this._momentaryCache.set(e,{pool:n,promise:r});let s=this._store.add(nn(()=>{this._momentaryCache.delete(e),this._store.delete(s),this._store.delete(n)},hon));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(lpo(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 Ov.callOn(n,l=>l.readResource({uri:o.toString()},t),t);return{contents:s.contents,resourceURI:o,forSameURI:s.contents.filter(l=>bSo(l.uri,o))}}};K0e=I([m(0,F),m(1,be),m(2,wMe)],K0e);function bSo(a,i){return mr(new URL(a).pathname,i.pathname)}function uRi(a){if("text"in a)return Je.fromString(a.text).buffer;if("blob"in a)return Sl(a.blob).buffer;throw Jr("Unknown content type","Unknown")}var gon=PB({defaultValue:new Map,key:"mcp.sampling.logs",toStorage:a=>JSON.stringify(Array.from(a.entries())),fromStorage:a=>new Map(JSON.parse(a))}),G0e=class extends C{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(11412,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(gon(t,1,this._storageService))}};G0e=I([m(0,le)],G0e);var $0e=class extends C{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 Nm;this._logs=this._register(s.createInstance(G0e))}async sample(e,t=ve.None){let o=e.params.messages.map(c=>{let u=Yl(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:Sl(p.data)}}:void 0).filter(mo);if(u.length)return{role:c.role==="assistant"?2:1,content:u}}).filter(mo);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 gb.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(11420,null,e.server.definition.label),d(11419,null,e.server.definition.label),this.allowButtons(e.server,"allowedDuringChat")))return this._getMatchingModel(e);throw gb.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(11422,null,e.server.definition.label),d(11421,null,e.server.definition.label),this.allowButtons(e.server,"allowedOutsideChat")))return this._getMatchingModel(e);throw gb.notAllowed()}else{if(t===2)throw gb.notAllowed();if(t===3){if(e.isDuringToolCall?await this._commandService.executeCommand("workbench.mcp.configureSamplingModels",e.server):await this._notify(d(11423,null,e.server.definition.label),{[d(11414,null)]:()=>this._commandService.executeCommand("workbench.mcp.configureSamplingModels",e.server),[d(11413,null)]:()=>Promise.resolve(void 0)}))return this._getMatchingModel(e);throw gb.notAllowed()}}return t}allowButtons(e,t){return{[d(11416,null)]:async()=>(this._sessionSets[t].set(e.definition.id,!0),!0),[d(11415,null)]:async()=>(await this.updateConfig(e,o=>o[t]=!0),!0),[d(11418,null)]:async()=>(this._sessionSets[t].set(e.definition.id,!1),!1),[d(11417,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(St.Info,e,Object.entries(t).map(([r,s])=>({label:r,run:()=>o(s())})));H.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=DT(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(mo),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(SJe,{resource:s});for(let c=o;c>=n;c--){let u=ose(l,c),p=u?.[r];if(p)return{value:p,key:r,mapping:u,target:c,resource:s}}return{value:void 0,mapping:ose(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(SJe,{...n,[r]:c},{resource:l},s),c}};$0e=I([m(0,Wr),m(1,B),m(2,ct),m(3,Ne),m(4,ge),m(5,F)],$0e);var q0e=class extends C{constructor(e,t,o,n){super();this._instantiationService=e;this._mcpRegistry=t;this._logService=o;this.configurationService=n;this._currentAutoStarts=new Set;this._servers=Le(this,[]);this.servers=this._servers.map(e=>e.map(t=>t.object));this.userCache=this._register(e.createInstance(Ume,0)),this.workspaceCache=this._register(e.createInstance(Ume,1));let r=this._store.add(new Dt(()=>this.updateCollectedServers(),500));this._register(he(s=>{for(let l of this._mcpRegistry.collections.read(s))l.serverDefinitions.read(s);r.schedule(500)}))}get lazyCollectionState(){return this._mcpRegistry.lazyCollectionState}cancelAutostart(){for(let e of this._currentAutoStarts)e.cancel()}autostart(e){let t=this.configurationService.getValue(ZJ);if(t==="never")return Le(this,rEe.Empty);let o=Le(this,{working:!0,starting:[],serversRequiringInteraction:[]}),n=new P,r=n.add(new $e(e));return this._currentAutoStarts.add(r),n.add(Z(()=>{this._currentAutoStarts.delete(r)})),n.add(r.token.onCancellationRequested(()=>{o.set(rEe.Empty,void 0)})),this._autostart(t,o,r.token).catch(s=>{this._logService.error("Error during MCP autostart:",s),o.set(rEe.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!==ir.Kind.Error),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(rEe.Empty,void 0);return}let s=new hX,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 n0(u,{interaction:s,errorOnUserInteraction:!0},o)}catch(h){h instanceof dw&&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 pRi,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&&!CV.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=>fon(l.object,u)&&l.toolPrefix===u.toolPrefix);c?s(c,l):l.object.dispose()}for(let l of o){let c=this._instantiationService.createInstance(Ov,l.collectionDefinition,l.serverDefinition,l.serverDefinition.roots,!!l.collectionDefinition.lazy,l.collectionDefinition.scope===1?this.workspaceCache:this.userCache,l.toolPrefix);r.push({object:c,toolPrefix:l.toolPrefix})}Ui(l=>{this._servers.set(r,l)})}dispose(){this._servers.get().forEach(e=>e.object.dispose()),super.dispose()}};q0e=I([m(0,F),m(1,md),m(2,ne),m(3,B)],q0e);function fon(a,i){return a.collection.id===i.collectionDefinition.id&&a.definition.id===i.serverDefinition.id}var pRi=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 Eag=ae("IMcpGatewayService"),ynt="mcpGateway",C2t="mcpGatewayToolBroker";var j0e=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(ynt,async t=>{let o=dd.toService(t),n=await o.createGateway(void 0),r=A.revive(n.address);return this._logService.info(`[McpGateway][BrowserWorkbench] Remote gateway created: ${r}`),{address:r,dispose:()=>{this._logService.info(`[McpGateway][BrowserWorkbench] Disposing remote gateway: ${n.gatewayId}`),o.disposeGateway(n.gatewayId)}}})}};j0e=I([m(0,yo),m(1,ne)],j0e);var Q0e=class extends C{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._serverIdMap=new Map;this._nextServerIndex=0;this._startupGrace=new Map;this._logService.debug("[McpGateway][ToolBroker] Initialized");let n=!1;this._register(he(s=>{for(let l of this._mcpService.servers.read(s))l.tools.read(s);n?(this._logService.debug("[McpGateway][ToolBroker] Tools changed, firing onDidChangeTools"),this._onDidChangeTools.fire()):n=!0}));let r=!1;this._register(he(s=>{for(let l of this._mcpService.servers.read(s))l.capabilities.read(s);r?(this._logService.debug("[McpGateway][ToolBroker] Resources changed, firing onDidChangeResources"),this._onDidChangeResources.fire()):r=!0}))}_getServerIndex(e){let t=e.definition.id,o=this._serverIdMap.get(t);return o===void 0&&(o=this._nextServerIndex++,this._serverIdMap.set(t,o)),o}_getServerByIndex(e){for(let t of this._mcpService.servers.get())if(this._getServerIndex(t)===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}throw new Error(`Invalid listen: ${t}`)}async call(e,t,o,n){switch(this._logService.debug(`[McpGateway][ToolBroker] IPC call: ${t}`),t){case"listTools":return await this._listTools();case"callTool":{let{name:r,args:s}=o;return await this._callTool(r,s||{},n)}case"listResources":return await this._listResources();case"readResource":{let{serverIndex:r,uri:s}=o;return await this._readResource(r,s,n)}case"listResourceTemplates":return await this._listResourceTemplates()}throw new Error(`Invalid call: ${t}`)}async _listTools(){let e=this._mcpService.servers.get(),o=(await Promise.all(e.map(async n=>await this._shouldUseCachedData(n)?n.tools.get().filter(r=>r.visibility&1).map(r=>r.definition):(this._logService.debug(`[McpGateway][ToolBroker] Server '${n.definition.id}' not ready, skipping tool listing`),[])))).flat();return this._logService.debug(`[McpGateway][ToolBroker] listTools result: ${o.length} tool(s): [${o.map(n=>n.name).join(", ")}]`),o}async _callTool(e,t,o=ve.None){this._logService.debug(`[McpGateway][ToolBroker] callTool '${e}' with args: ${JSON.stringify(t)}`);for(let n of this._mcpService.servers.get()){let r=n.tools.get().find(s=>s.definition.name===e&&s.visibility&1);if(r){this._logService.debug(`[McpGateway][ToolBroker] Found tool '${e}' on server '${n.definition.id}' (index=${this._getServerIndex(n)})`);let s=await r.call(t,void 0,o);return this._logService.debug(`[McpGateway][ToolBroker] Tool '${e}' completed (isError=${s.isError??!1}, content blocks=${s.content.length})`),{result:s,serverIndex:this._getServerIndex(n)}}}throw this._logService.warn(`[McpGateway][ToolBroker] Tool '${e}' not found on any server`),new Error(`Unknown tool: ${e}`)}async _listResources(){let e=[],t=this._mcpService.servers.get();return this._logService.debug(`[McpGateway][ToolBroker] listResources: ${t.length} server(s) known`),await Promise.all(t.map(async o=>{if(!await this._shouldUseCachedData(o))return;let n=o.capabilities.get();if(!n||!(n&16)){this._logService.debug(`[McpGateway][ToolBroker] Server '${o.definition.id}' has no resource capability, skipping`);return}try{let r=await Ov.callOn(o,s=>s.listResources());this._logService.debug(`[McpGateway][ToolBroker] Server '${o.definition.id}' (index=${this._getServerIndex(o)}) listed ${r.length} resource(s)`),e.push({serverIndex:this._getServerIndex(o),resources:r})}catch(r){this._logService.warn(`[McpGateway][ToolBroker] Server '${o.definition.id}' failed to list resources`,r)}})),this._logService.debug(`[McpGateway][ToolBroker] listResources result: ${e.length} server(s) with resources`),e}async _readResource(e,t,o=ve.None){let n=this._getServerByIndex(e);if(!n)throw this._logService.warn(`[McpGateway][ToolBroker] readResource: unknown server index ${e}`),new Error(`Unknown server index: ${e}`);this._logService.debug(`[McpGateway][ToolBroker] readResource '${t}' from server '${n.definition.id}' (index=${e})`);let r=await Ov.callOn(n,s=>s.readResource({uri:t},o),o);return this._logService.debug(`[McpGateway][ToolBroker] readResource returned ${r.contents.length} content(s)`),r}async _listResourceTemplates(){let e=[],t=this._mcpService.servers.get();return this._logService.debug(`[McpGateway][ToolBroker] listResourceTemplates: ${t.length} server(s) known`),await Promise.all(t.map(async o=>{if(!await this._shouldUseCachedData(o))return;let n=o.capabilities.get();if(!(!n||!(n&16)))try{let r=await Ov.callOn(o,s=>s.listResourceTemplates());this._logService.debug(`[McpGateway][ToolBroker] Server '${o.definition.id}' (index=${this._getServerIndex(o)}) listed ${r.length} resource template(s)`),e.push({serverIndex:this._getServerIndex(o),resourceTemplates:r})}catch(r){this._logService.warn(`[McpGateway][ToolBroker] Server '${o.definition.id}' failed to list resource templates`,r)}})),this._logService.debug(`[McpGateway][ToolBroker] listResourceTemplates result: ${e.length} server(s) with templates`),e}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 n0(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 Y0e=class{constructor(i,e,t){i.getConnection()?.registerChannel(C2t,new Q0e(e,t))}};Y0e=I([m(0,yo),m(1,es),m(2,ne)],Y0e);async function x2t(a,i){await a.openView(Vr,!0);let e=i.getWidgetsByLocations("panel");if(e.length)return e[0];let t=H.toPromise(H.filter(i.onDidAddWidget,o=>o.location==="panel"));return await Wp(t,1e4,()=>t.cancel())}var sH=class extends C{constructor(e,t,o,n,r){super();this._mcpService=e;this._fileService=t;this._quickInputService=o;this._notificationService=n;this._chatAttachmentResolveService=r;this._resources=Le(this,{picks:new Map,isBusy:!0});this._pickItemsStack=new Vs;this._inDirectory=Le(this,void 0);this.hasServersWithResources=Ce(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 sEe(e)?{id:e.template.template,label:e.title||e.name,description:e.description,detail:d(11252,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?" ("+ll.formatSize(e.sizeInBytes)+")":""),iconPath:t}}async navigate(e,t){if(sEe(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:uw.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:h2.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):sEe(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(sEe(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(11254,null,uw.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 $e,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 P,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(11256,null,t.name.toUpperCase(),n.template.resolve(l).replaceAll("%24","$"));t.optional&&(c+=" ("+d(11255,null)+")"),e.placeholder=c,e.value="",e.items=[],e.show();let u=_t(),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(11253,null)}),e.items=S},h=new $e;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 $e,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:sEe(e)?e.template.template.endsWith("/"):e.uri.path.endsWith("/")}getPicks(e){let t=new $e(e),o=!0;this._register(Z(()=>t.dispose(!0)));let n=!0;this._register(nn(()=>{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 Go,resourcesSoFar:[],resources:new Go};s.set(l,u),c===void 0&&(c=await new Promise(p=>{l.start().then(h=>{(h.state===ir.Kind.Error||h.state===ir.Kind.Stopped)&&p(void 0)}),this._register(t.token.onCancellationRequested(()=>p(void 0))),this._register(he(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()}),Ce(this,l=>{let c=this._inDirectory.read(l);return c?{picks:new Map([[c.server,c.resources]]),isBusy:!1}:this._resources.read(l)})}};sH=I([m(0,es),m(1,be),m(2,Ge),m(3,Ne),m(4,jF)],sH);var X0e=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 P,n="_goback_",r=d(11250,null),s=o.add(this._instantiationService.createInstance(sH));this._scopeTo&&(s.explicitServers=[this._scopeTo]);let l=s.getPicks(e);return o.add(he(c=>{let u=l.read(c),p=u.isBusy,h=[];for(let[g,f]of u.picks){h.push(sH.sep(g));for(let v of f){let b=sH.item(v);b.buttons=[{iconClass:q.asClassName(M.attach),tooltip:r}],h.push({...b,resource:v,server:g})}}if(s.checkIfNestedResources()){let g={id:n,label:d(11249,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 x2t(this._viewsService,this._chatWidgetService))?.attachmentModel.addContext(...Yl(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}};X0e=I([m(1,F),m(2,ee),m(3,At),m(4,Ft)],X0e);var J0e=class extends X0e{constructor(e,t,o,n,r,s){super(e,t,o,n,r);this._quickInputService=s}async pick(e=ve.None){let t=new P,o=t.add(this._quickInputService.createQuickPick({useSeparators:!0}));o.placeholder=d(11251,null),t.add(this.applyToPick(o,e)),t.add(o.onDidHide(()=>t.dispose())),o.show(),await H.toPromise(o.onDidHide)}};J0e=I([m(1,F),m(2,ee),m(3,At),m(4,Ft),m(5,Ge)],J0e);var O8=class extends X0e{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)}};O8=I([m(0,F),m(1,ee),m(2,At),m(3,Ft)],O8);var Z0e=class extends C{constructor(e,t,o){super();this._chatContextPickService=e;this._instantiationService=t;this._addContextMenu=this._register(new me);let n=Ce(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(he(r=>{n.read(r)&&!this._addContextMenu.value?this._registerAddContextMenu():this._addContextMenu.clear()}))}_registerAddContextMenu(){this._addContextMenu.value=this._chatContextPickService.registerChatContextItem({type:"pickerPick",label:d(11067,null),icon:M.mcp,isEnabled(e){return!!e.attachmentCapabilities.supportsMCPAttachments},asPicker:()=>{let e=this._instantiationService.createInstance(sH);return{placeholder:d(11068,null),picks:(t,o)=>this._getResourcePicks(o,e),goBack:()=>e.navigateBack(),dispose:()=>{e.dispose()}}}})}_getResourcePicks(e,t){let o=t.getPicks(e);return Ce(this,n=>{let r=o.read(n),s=[];for(let[l,c]of r.picks)if(c.length!==0){s.push(sH.sep(l));for(let u of c)s.push({...sH.item(u),asAttachment:()=>t.toAttachment(u,l)})}return{picks:s,busy:r.isBusy}})}};Z0e=I([m(0,uS),m(1,F),m(2,es)],Z0e);var Qf={original:"MCP",value:"MCP"},k2t=class extends K{constructor(){super({id:"workbench.mcp.listServer",title:L(11101,"List Servers"),icon:M.server,category:Qf,f1:!0,precondition:ie.Setup.hidden.negate(),menu:[{when:x.and(x.or(x.and(x.equals(`config.${ZJ}`,"never"),rH.hasUnknownTools),rH.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(es),t=i.get(ge),o=i.get(Ge),n=new P,r=o.createQuickPick({useSeparators:!0});r.placeholder=d(11114,null),e.activateCollections(),n.add(r),n.add(he(l=>{let c=wI(e.servers.read(l).slice().sort((p,h)=>(p.collection.presentation?.order||0)-(h.collection.presentation?.order||0)),p=>p.collection.id),u=r.items.length===0;r.items=[{id:"$add",label:d(11074,null),description:d(11075,null),alwaysShow:!0,iconClass:q.asClassName(M.add)},...Object.values(c).filter(p=>p.length).flatMap(p=>[{type:"separator",label:p[0].collection.label,id:p[0].collection.id},...p.map(h=>({id:h.definition.id,label:h.definition.label,description:ir.toString(h.connectionState.read(l))}))])],u&&r.items.length>3&&(r.activeItems=r.items.slice(2,3))}));let s=await new Promise(l=>{n.add(r.onDidAccept(()=>{l(r.activeItems[0])})),n.add(r.onDidHide(()=>{l(void 0)})),r.show()});n.dispose(),s&&(s.id==="$add"?t.executeCommand("workbench.mcp.addConfiguration"):t.executeCommand("workbench.mcp.serverOptions",s.id))}},E2t=class extends K{constructor(){super({id:"workbench.mcp.serverOptionsInConfirmation",title:L(11105,"Server Options"),category:Qf,icon:M.settingsGear,f1:!1,menu:[{id:D.ChatConfirmationMenu,when:x.and(x.equals("chatConfirmationPartSource","mcp"),x.or(x.equals("chatConfirmationPartType","chatToolConfirmation"),x.equals("chatConfirmationPartType","elicitation"))),group:"navigation"}]})}async run(i,e){let t=i.get(jn);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):Hr(e)}},T2t=class extends K{constructor(){super({id:"workbench.mcp.serverOptions",title:L(11105,"Server Options"),category:Qf,f1:!1})}async run(i,e){let t=i.get(es),o=i.get(Ge),n=i.get(md),r=i.get(ee),s=i.get(ge),l=i.get(h5),c=i.get(RR),u=i.get(Cs),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(11071,null)}),ir.canBeStarted(v.state)?f.push({label:d(11120,null),action:"start"}):(f.push({label:d(11122,null),action:"stop"}),f.push({label:d(11109,null),action:"restart"})),f.push(...this._getAuthActions(c,p.definition.id));let b=g?.presentation?.origin||h?.presentation?.origin;b&&f.push({label:d(11091,null),action:"config"}),f.push({label:d(11116,null),action:"showOutput"}),f.push({type:"separator",label:d(11070,null)},{label:d(11092,null),description:d(11117,null),action:"configSampling"}),l.hasLogs(p)&&f.push({label:d(11110,null),description:d(11111,null),action:"samplingLog"});let S=p.capabilities.get();(S===void 0||S&16)&&(f.push({type:"separator",label:d(11069,null)}),f.push({label:d(11108,null),action:"resources"}));let y=await o.pick(f,{placeHolder:d(11113,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(11112,null,p.definition.label)});break;default:Hr(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(11095,null),description:`(${n})`,accountQuery:r}):t.push({action:"signout",label:d(11118,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)}}}},eWe=class extends C{constructor(i,e,t,o,n){super();let r=Le(this,!1),s=pr(ZJ,"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=Ce(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===ir.Kind.Error?2:1;break;case 3:w=3;break;default:w=y.connectionState.read(g).state===ir.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=vf(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 Eo)return t.createInstance(class extends ml{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(he(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(M.refresh))):w===2?(b.style.display="block",b.classList.add("chat-mcp-state-error",...q.asClassNameArray(M.warning))):w===3?(b.style.display="block",b.classList.add("chat-mcp-state-refreshing",...q.asClassNameArray(cE))):b.style.display="none"}))}async onClick(v){v.preventDefault(),v.stopPropagation();let{state:b,servers:S}=u.get();if(b===1){let y=new hX;S.filter(c).forEach(w=>w.stop().then(()=>w.start({interaction:y}))),e.activateCollections()}else if(b===3)ju(S,c)?.showOutput();else if(b===2){let y=ju(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=>qy({title:T.definition.label,id:"workbench.mcp.serverOptions",arguments:[T.definition.id]}),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 xe(y?d(11104,null,w):d(11103,null,w));else if(v===2)k=new xe(y?d(11098,null,w):d(11097,null,w));else return this.getLabelForState()||void 0;return{element:T=>{r.set(!0,void 0);let N=new P;N.add(Z(()=>r.set(!1,void 0))),N.add(T.onCancellationRequested(()=>{N.dispose()})),N.add(MI(It,()=>{O.isConnected||N.dispose()},2e3));let O=_("div.mcp-hover-contents");k.isTrusted=!0;let V=N.add(nb(k));O.appendChild(V.element);let U=_("hr.mcp-hover-divider");O.appendChild(U);let G=_("div.mcp-hover-setting"),$=d(11076,null),te=N.add(new hv($,s.get()!=="never",{...kf}));G.appendChild(te.domNode);let pe=_("span.mcp-hover-setting-label",void 0,$);G.appendChild(pe);let de=()=>{let se=te.checked?"newAndOutdated":"never";n.updateValue(ZJ,se)};return N.add(te.onChange(de)),N.add(j(pe,re.CLICK,()=>{te.checked=!te.checked,de()})),O.appendChild(G),O}}}getLabelForState({state:v,servers:b}=u.get()){return v===1?d(11102,null,b.length||1):v===2?d(11123,null,b.length||1):v===3?d(11124,null):null}},g,{...f,keybindingNotRenderedWithLabel:!0})},H.fromObservableLight(h)))}};eWe=I([m(0,Yy),m(1,es),m(2,F),m(3,ge),m(4,B)],eWe);var _2t=class extends K{constructor(){super({id:"workbench.mcp.resetTrust",title:L(11107,"Reset Trust"),category:Qf,f1:!0,precondition:x.and(rH.toolsCount.greater(0),ie.Setup.hidden.negate())})}run(i){i.get(es).resetTrust()}},D2t=class extends K{constructor(){super({id:"workbench.mcp.resetCachedTools",title:L(11106,"Reset Cached Tools"),category:Qf,f1:!0,precondition:x.and(rH.toolsCount.greater(0),ie.Setup.hidden.negate())})}run(i){i.get(es).resetCaches()}},L2t=class extends K{constructor(){super({id:"workbench.mcp.addConfiguration",title:L(11072,"Add Server..."),metadata:{description:L(11073,"Installs a new Model Context protocol to the mcp.json settings")},category:Qf,f1:!0,precondition:ie.Setup.hidden.negate(),menu:{id:D.EditorContent,when:x.and(x.regex(Fo.Path.key,/\.vscode[/\\]mcp\.json$/),fr.isEqualTo(mF),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(aOe,n??void 0).run()}},R2t=class extends K{constructor(){super({id:"workbench.mcp.installFromManifest",title:L(11099,"Install Server from Manifest..."),metadata:{description:L(11100,"Install an MCP server from a JSON manifest file")},category:Qf,f1:!0,precondition:ie.Setup.hidden.negate()})}async run(i){return i.get(F).createInstance(lOe).run()}},M2t=class extends K{constructor(){super({id:"workbench.mcp.removeStoredInput",title:L(11106,"Reset Cached Tools"),category:Qf,f1:!1})}run(i,e,t){i.get(md).clearSavedInputs(e,t)}},P2t=class extends K{constructor(){super({id:"workbench.mcp.editStoredInput",title:L(11096,"Edit Stored Input"),category:Qf,f1:!1})}run(i,e,t,o,n){let r=t&&i.get(Pe).getWorkspaceFolder(t);i.get(md).editSavedInput(e,r||void 0,o,n)}},A2t=class extends K{constructor(){super({id:"workbench.mcp.showConfiguration",title:L(11087,"Show Configuration"),category:Qf,f1:!1})}run(i,e,t){let o=i.get(md).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})}},N2t=class extends K{constructor(){super({id:"workbench.mcp.showOutput",title:L(11088,"Show Output"),category:Qf,f1:!1})}run(i,e){i.get(es).servers.get().find(t=>t.definition.id===e)?.showOutput()}},O2t=class extends K{constructor(){super({id:"workbench.mcp.restartServer",title:L(11085,"Restart Server"),category:Qf,f1:!1})}async run(i,e,t){let o=i.get(es).servers.get().find(n=>n.definition.id===e);o?.showOutput(),await o?.stop(),await o?.start({promptType:"all-untrusted",...t})}},F2t=class extends K{constructor(){super({id:"workbench.mcp.startServer",title:L(11089,"Start Server"),category:Qf,f1:!1})}async run(i,e,t){let o=i.get(es).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=>n0(r,n))):await Promise.all(o.map(r=>r.start(n)))}},W2t=class extends K{constructor(){super({id:"workbench.mcp.stopServer",title:L(11090,"Stop Server"),category:Qf,f1:!1})}async run(i,e){await i.get(es).servers.get().find(o=>o.definition.id===e)?.stop()}},V2t=class extends K{constructor(){super({id:"workbench.mcp.browseServers",title:L(11078,"MCP Servers"),tooltip:L(11080,"Browse MCP Servers"),category:Qf,icon:M.search,precondition:ie.Setup.hidden.negate(),menu:[{id:Xh,group:"1_predefined",order:1,when:ie.Setup.hidden.negate()},{id:D.ViewTitle,when:x.and(x.equals("view",aEe),ie.Setup.hidden.negate()),group:"navigation"}]})}async run(i){i.get(zi).openSearch("@mcp ")}};fe.appendMenuItem(D.CommandPalette,{command:{id:"workbench.mcp.browseServers",title:L(11079,"Browse MCP Servers"),category:Qf,precondition:ie.Setup.hidden.negate()}});var B2t=class extends K{constructor(){super({id:"workbench.mcp.showInstalledServers",title:L(11086,"Show Installed Servers"),category:Qf,precondition:x.and(fX,ie.Setup.hidden.negate()),f1:!0})}async run(i){let e=i.get(Ft);await e.openView(aEe,!0)||(await e.openViewContainer(I0e.id),await e.openView(aEe,!0))}};fe.appendMenuItem(fy,{command:{id:"workbench.mcp.showInstalledServers",title:L(11115,"MCP Servers")},when:x.and(ie.enabled,x.equals("view",Vr)),order:10,group:"2_level"});var H2t=class extends K{async run(i){let e=i.get(be),t=i.get(ee),o=await this.getURI(i);await e.exists(o)||await e.createFile(o,Je.fromString(JSON.stringify({servers:{}},null,"	"))),await t.openEditor({resource:o})}},U2t=class extends H2t{constructor(){super({id:"workbench.mcp.openUserMcpJson",title:L(11082,"Open User Configuration"),category:Qf,f1:!0,precondition:ie.Setup.hidden.negate()})}getURI(i){let e=i.get(mn);return Promise.resolve(e.currentProfile.mcpResource)}},z2t=class extends H2t{constructor(){super({id:"workbench.mcp.openRemoteUserMcpJson",title:L(11081,"Open Remote User Configuration"),category:Qf,f1:!0,precondition:x.and(ie.Setup.hidden.negate(),ub.notEqualsTo(""))})}async getURI(i){let e=i.get(mn);return(await i.get(ZP).getRemoteProfile(e.currentProfile)).mcpResource}},K2t=class extends K{constructor(){super({id:"workbench.mcp.openWorkspaceFolderMcpJson",title:L(11083,"Open Workspace Folder MCP Configuration"),category:Qf,f1:!0,precondition:x.and(ie.Setup.hidden.negate(),mC.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(SR);r&&await o.openEditor({resource:r.toResource(X_[Dv])})}},G2t=class extends K{constructor(){super({id:"workbench.mcp.openWorkspaceMcpJson",title:L(11084,"Open Workspace MCP Configuration"),category:Qf,f1:!0,precondition:x.and(ie.Setup.hidden.negate(),Qa.isEqualTo("workspace"))})}async run(i){let e=i.get(Pe),t=i.get(ee),o=e.getWorkspace().configuration;o&&await t.openEditor({resource:o})}},$2t=class extends K{constructor(){super({id:"workbench.mcp.browseResources",title:L(11077,"Browse Resources..."),category:Qf,precondition:x.and(rH.serverCount.greater(0),ie.Setup.hidden.negate()),f1:!0})}run(i,e){e?i.get(F).createInstance(J0e,e).pick():i.get(Ge).quickAccess.show(O8.PREFIX)}},q2t=class extends K{constructor(){super({id:"workbench.mcp.configureSamplingModels",title:L(11093,"Configure SamplingModel"),category:Qf})}async run(i,e){let t=i.get(Ge),o=i.get(Wr),n=i.get(h5),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(mo);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(11094,null,e.definition.label),canPickMany:!0});return l&&await n.updateConfig(e,c=>c.allowedModels=l.map(u=>u.id)),l?.length||0}},j2t=class extends K{constructor(){super({id:"workbench.mcp.startPromptForServer",title:L(11121,"Start Prompting Server"),category:Qf,f1:!1})}async run(i,e){let t=await x2t(i.get(Ft),i.get(At));if(!t)return;let o=t.inputEditor,n=o.getModel();if(!n)return;let r=(o.getSelection()||n.getFullModelRange()).collapseToEnd(),s=JJi(e.definition)+".";n.applyEdits([{range:r,text:s}]),o.setSelection(z.fromPositions(r.getEndPosition().delta(0,s.length))),t.focusInput(),El.get(o)?.triggerSuggest()}},Q2t=class extends K{constructor(){super({id:"workbench.mcp.skipAutostart",title:L(11119,"Skip Current Autostart"),category:Qf,f1:!1})}async run(i){i.get(es).cancelAutostart()}};var tWe=class extends C{static{this.ID="workbench.contrib.mcp.discovery"}constructor(i,e){super();let t=pr(mk,"all",e),o=this._register(new P);this._register(he(n=>{o.clear();let r=t.read(n);if(r!=="none")for(let s of iG.getAll()){let l=i.createInstance(s);if(r==="registry"&&!l.fromGallery){l.dispose();continue}o.add(l),l.start()}}))}};tWe=I([m(0,F),m(1,B)],tWe);var yge=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=Le("state","pending");this._isHiddenValue=Le("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 mRi={id:void 0,label:d(11190,null),description:d(11191,null),alwaysShow:!0};function von(a){return a.mode==="form"||a.mode===void 0&&!!a.requestedSchema}function bon(a){return a.mode==="url"}function Son(a){let i=a;return i.type==="string"&&Array.isArray(i.enum)&&Array.isArray(i.enumNames)}function Ion(a){let i=a;return i.type==="string"&&Array.isArray(i.enum)}function yon(a){let i=a;return i.type==="string"&&Array.isArray(i.oneOf)}function won(a){let i=a;return i.type==="array"&&!!i.items?.enum}function Con(a){let i=a;return i.type==="array"&&!!i.items?.anyOf}var iWe=class{constructor(i,e,t,o){this._notificationService=i;this._quickInputService=e;this._chatService=t;this._openerService=o}elicit(i,e,t,o){return von(t)?this._elicitForm(i,e,t,o):bon(t)?this._elicitUrl(i,e,t,o):Promise.reject(new gX("Unsupported elicitation type",Tv.INVALID_PARAMS,void 0))}async _elicitForm(i,e,t,o){let n=new P,r=await new Promise(s=>{let l=e?.chatSessionResource&&this._chatService.getSession(e.chatSessionResource);if(l instanceof Eb){let c=l.getRequests().at(-1);if(c){let u=new yge(d(11195,null),t.message,d(11212,null,i.definition.label),d(11188,null),d(11193,null),async()=>{let p=this._doElicitForm(t,o);s(p);let h=await p;return u.acceptedResult=h.content,h.action==="accept"?"accepted":"rejected"},()=>(s({action:"decline"}),Promise.resolve("rejected")),BPe(i));l.acceptResponseProgress(c,u)}}else{let c=this._notificationService.notify({message:t.message,source:d(11194,null,i.definition.label),severity:St.Info,actions:{primary:[n.add(new st("mcp.elicit.give",d(11192,null),void 0,!0,()=>s(this._doElicitForm(t,o))))],secondary:[n.add(new st("mcp.elicit.cancel",d(11189,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 P,r=new Promise((c,u)=>{n.add(o.onCancellationRequested(()=>u(new ho))),n.add(he(p=>{let g=i.connection.read(p)?.handler.read(p);g?p.store.add(g.onDidReceiveElicitationCompleteNotification(f=>{f.params.elicitationId===t.elicitationId&&c()})):ir.isRunning(i.connectionState.read(p))||u(new ho)}))}).finally(()=>n.dispose()),s=new P,l=await new Promise(c=>{let u=e?.chatSessionResource&&this._chatService.getSession(e.chatSessionResource);if(u instanceof Eb){let p=u.getRequests().at(-1);if(p){let h=new yge(d(11200,null),new xe().appendText(t.message).appendMarkdown(`

`+d(11196,null)).appendCodeblock("",t.url),d(11212,null,i.definition.label),d(11198,null,A.parse(t.url).authority),d(11193,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")),BPe(i));u.acceptResponseProgress(p,h)}}else{let p=this._notificationService.notify({message:t.message+" "+d(11197,null,t.url),source:d(11194,null,i.definition.label),severity:St.Info,actions:{primary:[s.add(new st("mcp.elicit.url.open2",d(11199,null),void 0,!0,()=>c(this._doElicitUrl(t,o))))],secondary:[s.add(new st("mcp.elicit.cancel",d(11189,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 P;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")):Son(p)?f=await this._handleEnumField(t,{enum:p.enum.map((v,b)=>({const:v,title:p.enumNames[b]})),default:p.default},h,o,e):Ion(p)?f=await this._handleEnumField(t,{enum:p.enum.map(v=>({const:v})),default:p.default},h,o,e):yon(p)?f=await this._handleEnumField(t,{enum:p.oneOf,default:p.default},h,o,e):Con(p)?f=await this._handleMultiEnumField(t,{enum:p.items.anyOf,default:p.default},h,o,e):won(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(11213,null)})`:d(11213,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(mRi),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(mRi),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(mo)})})),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(11201,null)});i.validationMessage?i.severity=St.Warning:(i.severity=St.Ignore,t||s.push(mRi)),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:Hr(e)}}_validateString(i,e){if(e.minLength&&i.length<e.minLength)return{isValid:!1,message:d(11209,null,e.minLength)};if(e.maxLength&&i.length>e.maxLength)return{isValid:!1,message:d(11207,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(11204,null)};case"uri":return URL.canParse(i)?{isValid:!0}:{isValid:!1,message:d(11211,null)};case"date":{if(!/^\d{4}-\d{2}-\d{2}$/.test(i))return{isValid:!1,message:d(11202,null)};let o=new Date(i);return isNaN(o.getTime())?{isValid:!1,message:d(11202,null)}:{isValid:!0}}case"date-time":{let t=new Date(i);return isNaN(t.getTime())?{isValid:!1,message:d(11203,null)}:{isValid:!0}}default:return{isValid:!0}}}_validateNumber(i,e){let t=Number(i);return isNaN(t)?{isValid:!1,message:d(11210,null)}:e.type==="integer"&&!Number.isInteger(t)?{isValid:!1,message:d(11205,null)}:e.minimum!==void 0&&t<e.minimum?{isValid:!1,message:d(11208,null,e.minimum)}:e.maximum!==void 0&&t>e.maximum?{isValid:!1,message:d(11206,null,e.maximum)}:{isValid:!0,parsedValue:t}}};iWe=I([m(0,Ne),m(1,Ge),m(2,Si),m(3,Qe)],iWe);var hRi="vscode.mcp",oWe=class extends C{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=zL(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(hRi,[t]),Ue(s)}}}_addDiagnostics(e,t,o,n){let r=lC(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=t2i(c,h);g<p&&(p=g,u=h)}return u},l=[];Y2t(r,c=>{let u=cS.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(11223,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(hRi,e.uri,l):this._markerService.remove(hRi,[e.uri])}async _provideCodeLenses(e,t){let o=await this._parseModel(e);if(!o)return;let{tree:n,inConfig:r}=o,s=lC(n,r.section?[...r.section,"servers"]:["servers"]);if(!s)return;let l=new P,c=[],u={lenses:c,dispose:()=>l.dispose()},p=f=>(l.add(H.fromObservableLight(f)(t)),f.get()),h=p(this._mcpRegistry.collections).find(f=>Xe(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 ir.Kind.Error:c.push({range:S,command:{id:"workbench.mcp.showOutput",title:"$(error) "+d(11224,null),arguments:[b.definition.id]}},{range:S,command:{id:"workbench.mcp.restartServer",title:d(11219,null),arguments:[b.definition.id,{autoTrustChanges:!0}]}}),y&&c.push({range:S,command:{id:"workbench.mcp.restartServer",title:d(11218,null),arguments:[b.definition.id,{debug:!0,autoTrustChanges:!0}]}});break;case ir.Kind.Starting:c.push({range:S,command:{id:"workbench.mcp.showOutput",title:"$(loading~spin) "+d(11227,null),arguments:[b.definition.id]}},{range:S,command:{id:"workbench.mcp.stopServer",title:d(11214,null),arguments:[b.definition.id]}});break;case ir.Kind.Running:c.push({range:S,command:{id:"workbench.mcp.showOutput",title:"$(check) "+d(11226,null),arguments:[b.definition.id]}},{range:S,command:{id:"workbench.mcp.stopServer",title:d(11222,null),arguments:[b.definition.id]}},{range:S,command:{id:"workbench.mcp.restartServer",title:d(11219,null),arguments:[b.definition.id,{autoTrustChanges:!0}]}}),y&&c.push({range:S,command:{id:"workbench.mcp.restartServer",title:d(11218,null),arguments:[b.definition.id,{autoTrustChanges:!0,debug:!0}]}});break;case ir.Kind.Stopped:c.push({range:S,command:{id:"workbench.mcp.startServer",title:"$(debug-start) "+d(11221,null),arguments:[b.definition.id,{autoTrustChanges:!0}]}}),y&&c.push({range:S,command:{id:"workbench.mcp.startServer",title:d(11218,null),arguments:[b.definition.id,{autoTrustChanges:!0,debug:!0}]}})}if(w!==ir.Kind.Error){let k=p(b.tools).length;k&&c.push({range:S,command:{id:"",title:d(11228,null,k)}});let T=p(b.prompts).length;T&&c.push({range:S,command:{id:"workbench.mcp.startPromptForServer",title:d(11225,null,T),arguments:[b]}}),c.push({range:S,command:{id:"workbench.mcp.serverOptions",title:d(11220,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?lC(n,[...r.section]):n;if(!s)return;let l=lC(s,["inputs"]);if(!l)return;let c=await this._mcpRegistry.getSavedInputs(r.scope),u=[],p=lC(s,["servers"]);return p&&h(p),g(l),{hints:u,dispose:()=>{}};function h(v){Y2t(v,b=>{let S=cS.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 xe([qy({id:"workbench.mcp.editStoredInput",title:d(11217,null),arguments:[v,e.uri,FF,r.target]}),qy({id:"workbench.mcp.removeStoredInput",title:d(11215,null),arguments:[r.scope,v]}),qy({id:"workbench.mcp.removeStoredInput",title:d(11216,null),arguments:[r.scope]})].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}}};oWe=I([m(0,zt),m(1,md),m(2,Nf),m(3,es),m(4,Ns),m(5,sp)],oWe);function Y2t(a,i){a.type==="string"&&typeof a.value=="string"&&a.value.includes(cS.VARIABLE_LHS)?i(a):a.type==="property"?a.children?.slice(1).forEach(e=>Y2t(e,i)):a.children?.forEach(e=>Y2t(e,i))}var wge=class extends C{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(11231,null):d(11233,null),o=e?d(11229,null):d(11230,null),n=e?"workbench.mcp.openRemoteUserMcpJson":"workbench.mcp.openUserMcpJson";this.notificationService.prompt(St.Error,t,[{label:d(11232,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=xk(t.value.toString());if(!yi(o))return;let n=o[FF];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){hu(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:[FF],value:void 0}],!0)}catch(t){this.logService.warn(`MCP migration: Failed to remove MCP config from ${e}:`,t)}}};wge=I([m(0,n8),m(1,mn),m(2,be),m(3,yo),m(4,zf),m(5,ne),m(6,Ne),m(7,ge)],wge);var Aie=class extends M8{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 as);this.modalNavigationDisposable=this._register(new me)}renderBody(e){super.renderBody(e),this.welcomeContainer=R(e,_(".mcp-welcome-container.hide")),this.createWelcomeContent(this.welcomeContainer);let t=R(e,_(".message-container")),o=R(t,_("")),n=R(t,_(".message")),r=_(".mcp-servers-list");this.bodyTemplate={mcpServersList:r,messageBox:n,messageContainer:t,messageSeverityIcon:o},this.listContainer=R(e,r),this.list=this._register(this.instantiationService.createInstance(F1,`${this.id}-MCP-Servers`,this.listContainer,{getHeight(){return 72},getTemplateId:()=>Nie.templateId},[this.instantiationService.createInstance(Nie,{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(11322,null)}},overrideStyles:qz(this.viewDescriptorService.getViewLocationById(this.id)).listOverrideStyles,openOnSingleClick:!0})),this._register(H.debounce(H.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:Axi(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 P,o=e.element&&this.mcpWorkbenchService.local.find(s=>s.id===e.element.id)||e.element,n=Got(o,!1,this.instantiationService),r=[];for(let s of n){for(let l of s)r.push(l),Ac(l)&&t.add(l);r.push(new li)}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 Tm([]),disposables:new P,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 C3(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=R(e,_(".mcp-welcome-content")),o=R(t,_(".mcp-welcome-icon")),n=R(o,_("span"));n.className=q.asClassName(AFe);let r=R(t,_(".mcp-welcome-title"));r.textContent=d(11331,null);let s=qy({id:"workbench.action.openSettings",arguments:[`@id:${AK}`],title:AK,tooltip:d(11330,null)}).toString(),l=R(t,_(".mcp-welcome-description")),c=this._register(this.markdownRendererService.render(new xe(d(11328,null),{isTrusted:{enabledCommands:["workbench.action.openSettings"]}}).appendMarkdown(`

`).appendMarkdown(d(11326,null,s))));l.appendChild(c.element);let u=R(t,_(".mcp-welcome-button-container")),p=this._register(new Mi(u,{title:d(11329,null),...Ko}));p.label=d(11329,null),this._register(p.onDidClick(async()=>{let{result:h}=await this.dialogService.prompt({type:"info",message:d(11327,null),custom:{markdownDetails:[{markdown:new xe(d(11326,null,s),{isTrusted:!0})}]},buttons:[{label:d(11325,null),run:()=>!0},{label:d(11324,null),run:()=>!1}]});h&&await this.configurationService.updateValue(AK,!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=Px.className(e.severity),this.bodyTemplate.messageBox.textContent=e.text):t===0&&(this.bodyTemplate.messageSeverityIcon.className="",this.bodyTemplate.messageBox.textContent=d(11332,null)),this.bodyTemplate.messageBox.textContent&&Jo(this.bodyTemplate.messageBox.textContent))}}async query(e){let t=new P;if(e){let r=await this.mcpWorkbenchService.queryGallery({text:e.replace("@mcp","")});return{model:t.add(new EHt(r)),disposables:t}}let o=t.add(new E),n=await this.mcpWorkbenchService.queryLocal();return t.add(H.debounce(this.mcpWorkbenchService.onChange,()=>{})(()=>{let r=this.mergeChangedMcpServers(n,[...this.mcpWorkbenchService.local]);r&&(n=r,o.fire(new Tm(n)))})),t.add(this.mcpWorkbenchService.onReset(()=>o.fire(new Tm([...this.mcpWorkbenchService.local])))),{model:new Tm(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}};Aie=I([m(2,_e),m(3,ze),m(4,F),m(5,De),m(6,tt),m(7,B),m(8,X),m(9,Ri),m(10,Qe),m(11,ct),m(12,Nf),m(13,wV),m(14,fi),m(15,Qn),m(16,ne)],Aie);var Nie=class{constructor(i,e,t,o){this.options=i;this.instantiationService=e;this.mcpWorkbenchService=t;this.notificationService=o;this.templateId=Nie.templateId}static{this.templateId="mcpServer"}renderTemplate(i){let e=R(i,_(".mcp-server-item.extension-list-item")),t=R(e,_(".icon-container")),o=this.instantiationService.createInstance(pie,t),n=R(e,_(".details")),r=R(n,_(".header-container")),s=R(r,_(".header")),l=R(s,_("span.name")),c=R(s,_("span.ratings")),u=R(n,_(".description.ellipsis")),p=R(n,_(".footer")),h=this.instantiationService.createInstance(mie,R(p,_(".publisher-container")),!0),g=new ji(p,{actionViewItemProvider:(k,T)=>{if(k instanceof w8)return k.createActionViewItem(T)},focusOnlyEnabledItems:!0});g.setFocusable(!1);let f=g.onDidRun(({error:k})=>k&&this.notificationService.error(k)),v=this.instantiationService.createInstance(_D),b=[this.instantiationService.createInstance(gT,!0),this.instantiationService.createInstance(_Fe),this.instantiationService.createInstance(eM,!1),v],S=[o,h,this.instantiationService.createInstance(Yhe,c,!0),this.instantiationService.createInstance(hie,t),this.instantiationService.createInstance(NFe,{target:i,position:this.options.hoverOptions.position},v)],y=this.instantiationService.createInstance(mX,[...b,...S]);g.push(b,{icon:!0,label:!0});let w=hn(...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=Ue(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=Ue(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!==2);o(),t.mcpServerDisposables.push(this.mcpWorkbenchService.onChange(n=>{(!n||n.id===i.id)&&o()}))}disposeElement(i,e,t){t.mcpServerDisposables=Ue(t.mcpServerDisposables)}disposeTemplate(i){i.mcpServerDisposables=Ue(i.mcpServerDisposables),i.disposables=Ue(i.disposables)}};Nie=I([m(1,F),m(2,Nf),m(3,Ne)],Nie);var X2t=class extends Aie{renderBody(i){super.renderBody(i),this._register(this.mcpGalleryManifestService.onDidChangeMcpGalleryManifest(()=>this.show()))}async show(){return super.show("@mcp")}},wnt=class extends C{static{this.ID="workbench.mcp.servers.views.contribution"}constructor(){super(),oe.as(on.ViewsRegistry).registerViews([{id:aEe,name:L(11323,"MCP Servers - Installed"),ctorDescriptor:new Mt(Aie,[{}]),when:x.and(yC,fX,ie.Setup.hidden.negate()),weight:40,order:4,canToggleVisibility:!0},{id:"workbench.views.mcp.default.marketplace",name:L(11321,"MCP Servers"),ctorDescriptor:new Mt(X2t,[{}]),when:x.and(yC,fX.toNegated(),ie.Setup.hidden.negate(),ode.isEqualTo("available"),x.or(zk.create(`config.${b4}`),RW.notEqualsTo("stable"),zk.create(`config.${AK}`))),weight:40,order:4,canToggleVisibility:!0},{id:"workbench.views.mcp.marketplace",name:L(11321,"MCP Servers"),ctorDescriptor:new Mt(Aie,[{}]),when:x.and(n6e,ie.Setup.hidden.negate(),ode.isEqualTo("available"),x.or(zk.create(`config.${b4}`),RW.notEqualsTo("stable"),zk.create(`config.${AK}`)))},{id:"workbench.views.mcp.default.welcomeView",name:L(11321,"MCP Servers"),ctorDescriptor:new Mt(X2t,[{showWelcome:!0}]),when:x.and(yC,fX.toNegated(),ie.Setup.hidden.negate(),ode.isEqualTo("available"),zk.create(`config.${b4}`).negate(),RW.isEqualTo("stable"),zk.create(`config.${AK}`).negate()),weight:40,order:4,canToggleVisibility:!0},{id:"workbench.views.mcp.welcomeView",name:L(11321,"MCP Servers"),ctorDescriptor:new Mt(Aie,[{showWelcome:!0}]),when:x.and(n6e,ie.Setup.hidden.negate(),ode.isEqualTo("available"),zk.create(`config.${b4}`).negate(),RW.isEqualTo("stable"),zk.create(`config.${AK}`).negate())}],I0e)}};var VA=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")}};VA=I([m(5,PK),m(6,be)],VA);var nWe=class extends C{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 Op);this._register(e.onDidChangeMcpGalleryManifest(N=>T.queue(()=>this.syncInstalledMcpServers()))),T.queue(()=>this.syncInstalledMcpServers())}),k.registerHandler(this),this._register(this.configurationService.onDidChangeConfiguration(T=>{T.affectsConfiguration(mk)&&this._onChange.fire(void 0)})),this._register(this.allowedMcpServersService.onDidChangeAllowedMcpServers(()=>{this._local=this.sort(this._local),this._onChange.fire(void 0)})),this._register(_s(w.servers,()=>{this._local=this.sort(this._local),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(VA,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(VA,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(VA,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(VA,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===2?-1:!o.runtimeStatus||o.runtimeStatus.state===2?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!==2||(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(11343,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(11343,null,n.name,n.mcpResource.path,r.mcpResource.path)),e.set(n.name,n)}return[...e.values()]}canInstall(e){if(!(e instanceof VA))return new xe().appendText(d(11342,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 xe().appendText(d(11338,null,e.label))}async install(e,t){if(!(e instanceof VA))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 H.toPromise(H.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:bTi,key:"userLocalValue",target:3,label:d(11341,null,this.productService.nameShort),scope:0,order:200,uri:e,section:[]}}getRemoteMcpConfigPath(e){return{id:STi,key:"userRemoteValue",target:4,label:this.environmentService.remoteAuthority?this.labelService.getHostLabel(Y.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:ITi,key:"workspaceValue",target:5,label:Ye(e),scope:1,order:100,remoteAuthority:this.environmentService.remoteAuthority,uri:e,section:["settings",FF]};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,X_[Dv]),e))return{id:`${yTi}${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(`${Y.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(VA,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(VA,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(VA,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(cie,e),t,o?ym:Un)}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;if(!this.mcpService.servers.get().find(o=>o.definition.id===e.id))return{state:0}}getEnablementStatus(e){if(!e.local)return;let t=ic("workbench.action.openSettings",{query:`@id:${mk}`}).toString(),o=this.configurationService.getValue(mk);if(o==="none")return{state:1,message:{severity:gt.Warning,text:new xe(d(11339,null,t))}};if(o==="registry"){if(!e.gallery)return{state:1,message:{severity:gt.Warning,text:new xe(d(11340,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:gt.Warning,text:new xe(d(11340,null,t))}}}}};nWe=I([m(0,wV),m(1,PK),m(2,n8),m(3,ee),m(4,an),m(5,dt),m(6,Pe),m(7,Vt),m(8,ot),m(9,nt),m(10,yo),m(11,B),m(12,F),m(13,Te),m(14,ne),m(15,zi),m(16,MR),m(17,es),m(18,nI)],nWe);var Cge=class extends C{static{this.ID="workbench.mcp.contexts.initialisation"}constructor(i,e,t){super();let o=ode.bindTo(t);o.set(e.mcpGalleryManifestStatus),this._register(e.onDidChangeMcpGalleryManifestStatus(r=>o.set(r)));let n=fX.bindTo(t);i.queryLocal().finally(()=>{n.set(i.local.length>0),this._register(i.onChange(()=>n.set(i.local.length>0)))})}};Cge=I([m(0,Nf),m(1,wV),m(2,X)],Cge);we(md,z0e,1);we(rAe,nAe,1);we(es,q0e,1);we(Nf,nWe,0);we(oAe,Zee,1);we(h5,$0e,1);we(m6e,iWe,1);we(WTe,j0e,1);iG.register(new Mt(F0e));iG.register(new Mt(N0e));iG.register(new Mt(Rie));iG.register(new Mt(V0e));iG.register(new Mt(W0e));pt("mcpDiscovery",tWe,ut.AfterRestored);pt("mcpContextKeys",B0e,ut.BlockRestore);pt("mcpLanguageFeatures",oWe,ut.Eventually);pt("mcpResourceFilesystem",K0e,ut.BlockRestore);pt(Ige.ID,Ige,ut.AfterRestored);pt("mcpGatewayToolBrokerRemote",Y0e,ut.AfterRestored);W(k2t);W(T2t);W(E2t);W(_2t);W(D2t);W(L2t);W(R2t);W(M2t);W(P2t);W(F2t);W(W2t);W(N2t);W(O2t);W(A2t);W(V2t);W(U2t);W(z2t);W(G2t);W(K2t);W(B2t);W($2t);W(q2t);W(j2t);W(Q2t);pt("mcpActionRendering",eWe,ut.BlockRestore);pt("mcpAddContext",Z0e,ut.Eventually);pt(Cge.ID,Cge,ut.AfterRestored);pt(wge.ID,wge,ut.Eventually);pt(wnt.ID,wnt,ut.AfterRestored);var kon=oe.as(ea.JSONContribution);kon.registerSchema(s_e,qso);oe.as(rn.EditorPane).registerEditorPane(ys.create(XB,XB.ID,d(11066,null)),[new Mt(cie)]);oe.as(Tu.Quickaccess).registerQuickAccessProvider({ctor:O8,prefix:O8.PREFIX,when:ie.enabled,placeholder:d(11065,null),helpEntries:[{description:d(11064,null),commandId:"workbench.mcp.addConfiguration"}]});oe.as(rp.ConfigurationMigration).registerConfigurationMigrations([{key:"chat.mcp.enabled",migrateFn:(a,i)=>{let e=[["chat.mcp.enabled",{value:void 0}]];return a===!0&&e.push([mk,{value:"all"}]),a===!1&&e.push([mk,{value:"none"}]),e}}]);var Eon=Tn.registerExtensionPoint({extensionPoint:"chatSessions",jsonSchema:{description:d(6624,null),type:"array",items:{type:"object",additionalProperties:!1,properties:{type:{description:d(6628,null),type:"string"},name:{description:d(6634,null),type:"string",pattern:"^[\\w-]+$"},displayName:{description:d(6631,null),type:"string"},description:{description:d(6630,null),type:"string"},when:{description:d(6651,null),type:"string"},icon:{description:d(6632,null),anyOf:[{type:"string"},{type:"object",properties:{light:{description:d(6653,null),type:"string"},dark:{description:d(6652,null),type:"string"}}}]},order:{description:d(6635,null),type:"integer"},alternativeIds:{description:d(6625,null),type:"array",items:{type:"string"}},welcomeTitle:{description:d(6650,null),type:"string"},welcomeMessage:{description:d(6648,null),type:"string"},welcomeTips:{description:d(6649,null),type:"string"},inputPlaceholder:{description:d(6633,null),type:"string"},capabilities:{description:d(6627,null),type:"object",additionalProperties:!1,properties:{supportsFileAttachments:{description:d(6637,null),type:"boolean"},supportsToolAttachments:{description:d(6647,null),type:"boolean"},supportsMCPAttachments:{description:d(6641,null),type:"boolean"},supportsImageAttachments:{description:d(6639,null),type:"boolean"},supportsSearchResultAttachments:{description:d(6644,null),type:"boolean"},supportsInstructionAttachments:{description:d(6640,null),type:"boolean"},supportsSourceControlAttachments:{description:d(6645,null),type:"boolean"},supportsProblemAttachments:{description:d(6642,null),type:"boolean"},supportsSymbolAttachments:{description:d(6646,null),type:"boolean"},supportsPromptAttachments:{description:d(6643,null),type:"boolean"},supportsHandOffs:{description:d(6638,null),type:"boolean"}}},commands:{markdownDescription:d(6621,null),type:"array",items:{additionalProperties:!1,type:"object",defaultSnippets:[{body:{name:"",description:""}}],required:["name"],properties:{name:{description:d(6619,null),type:"string"},description:{description:d(6620,null),type:"string"},when:{description:d(6622,null),type:"string"}}}},canDelegate:{description:d(6626,null),type:"boolean",default:!1},customAgentTarget:{description:d(6629,null),type:"string"},requiresCustomModels:{description:d(6636,null),type:"boolean",default:!1}},required:["type","name","displayName","description"]}},activationEventsGenerator:function*(a){for(let i of a)yield`onChatSession:${i.type}`}}),gRi=class extends C{constructor(e,t,o,n,r){super();this.session=e;this.chatSessionType=t;this.resource=o;this.options=n;this.onWillDispose=r;if(this._optionsCache=new Map,n)for(let[s,l]of Object.entries(n))this._optionsCache.set(s,l);this._register(this.session.onWillDispose(()=>{this.onWillDispose(this.resource)}))}getOption(e){return this._optionsCache.get(e)}setOption(e,t){this._optionsCache.set(e,t)}},Cnt=class extends C{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 jt);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._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._onRequestNotifyExtension=this._register(new JH);this.inProgressMap=new Map;this._sessionTypeOptions=new Map;this._sessionTypeNewSessionOptions=new Map;this._sessionTypeIcons=new Map;this._sessionTypeWelcomeTitles=new Map;this._sessionTypeWelcomeMessages=new Map;this._sessionTypeWelcomeTips=new Map;this._sessionTypeInputPlaceholders=new Map;this._sessions=new vt;this._resourceAliases=new vt;this._hasCanDelegateProvidersKey=ie.hasCanDelegateProviders.bindTo(this._contextKeyService),this._register(Eon.setHandler(p=>{for(let h of p)if(Ea(h.description,"chatSessionsProvider")&&Array.isArray(h.value))for(let g of h.value)this._register(this.registerContribution(g,h.description))})),this._register(H.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)&&SSo(p))).recomputeInitiallyAndOnChange(this._store);this._register(he(p=>{let h=[...c,...u.read(p)];for(let g of Object.values(np))h.includes(g)&&p.store.add(Ton(g,XS(g)))})),this._register(this.onDidChangeSessionItems(({chatSessionType:p})=>{this.updateInProgressStatus(p).catch(h=>{this._logService.warn(`Failed to update progress status for '${p}':`,h)})})),this._register(this._labelService.registerFormatter({scheme:Y.copilotPr,formatting:{label:"${authority}${path}",separator:Rd,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}get onRequestNotifyExtension(){return this._onRequestNotifyExtension.event}reportInProgress(e,t){let o;e==="local"?o=d(6616,null):e==="copilotcli"?o=d(6614,null):e==="copilot-cloud-agent"?o=d(6615,null):o=this._contributions.get(e)?.contribution.displayName,o&&this.inProgressMap.set(o,t),this._onDidChangeInProgress.fire()}getInProgress(){return Array.from(this.inProgressMap.entries()).map(([e,t])=>({displayName:e,count:t}))}async updateInProgressStatus(e){try{let n=(await this.getChatSessionItems([e],ve.None)).flatMap(r=>r.items).filter(r=>r.status&&L_(r.status));this.reportInProgress(e,n.length)}catch(t){this._logService.warn(`Failed to update in-progress status for chat session type '${e}':`,t)}}registerContribution(e,t){if(this._logService.info(`[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.info(`[ChatSessionsService] registerContribution: type='${e.type}' already registered, skipping`),{dispose:()=>{}};if(e.when){let n=x.deserialize(e.when);if(n)for(let r of n.keys())this._contextKeys.add(r)}if(this._contributions.set(e.type,{contribution:e,extension:t}),e.alternativeIds)for(let n of e.alternativeIds)this._alternativeIdMap.has(n)&&this._logService.warn(`Alternative ID '${n}' is already mapped to '${this._alternativeIdMap.get(n)}'. Remapping to '${e.type}'.`),this._alternativeIdMap.set(n,e.type);let o;return e.icon&&(typeof e.icon=="string"?o=e.icon.startsWith("$(")&&e.icon.endsWith(")")?q.fromString(e.icon):q.fromId(e.icon):o={dark:je(t.extensionLocation,e.icon.dark),light:je(t.extensionLocation,e.icon.light)}),o&&this._sessionTypeIcons.set(e.type,o),e.welcomeTitle&&this._sessionTypeWelcomeTitles.set(e.type,e.welcomeTitle),e.welcomeMessage&&this._sessionTypeWelcomeMessages.set(e.type,e.welcomeMessage),e.welcomeTips&&this._sessionTypeWelcomeTips.set(e.type,e.welcomeTips),e.inputPlaceholder&&this._sessionTypeInputPlaceholders.set(e.type,e.inputPlaceholder),this._evaluateAvailability(),{dispose:()=>{if(this._contributions.delete(e.type),e.alternativeIds)for(let n of e.alternativeIds)this._alternativeIdMap.get(n)===e.type&&this._alternativeIdMap.delete(n);this._sessionTypeIcons.delete(e.type),this._sessionTypeWelcomeTitles.delete(e.type),this._sessionTypeWelcomeMessages.delete(e.type),this._sessionTypeWelcomeTips.delete(e.type),this._sessionTypeInputPlaceholders.delete(e.type),this._contributionDisposables.deleteAndDispose(e.type),this._updateHasCanDelegateProvidersContextKey()}}}_isContributionAvailable(e){if(!e.when)return!0;let t=x.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 P;for(let l=0;l<r.length;l++){let c=r[l];c instanceof Eo&&(l===0&&!e.canDelegate?s.add(_on(e.type,e.displayName,c.item.id)):s.add(fe.appendMenuItem(D.ChatNewMenu,{command:c.item,group:"4_externally_contributed"})))}return{dispose:()=>s.dispose()}}_registerCommands(e){let t=SSo(e.type);return hn(W(class extends K{constructor(){super({id:`workbench.action.chat.openSessionWithPrompt.${e.type}`,title:L(6658,"New {0} with Prompt",e.displayName),category:vi,icon:M.plus,f1:!1,precondition:ie.enabled})}async run(n,r){let s=n.get(Si),{type:l}=e;if(r){let c=A.revive(r.resource),u=await s.acquireOrLoadSession(c,"panel",ve.None);try{let p=await s.sendRequest(c,r.prompt,{agentIdSilent:l,attachedContext:r.attachedContext});p.kind==="queued"?await p.deferred:p.kind==="sent"&&await p.data.responseCompletePromise}finally{u?.dispose()}}}}),W(class extends K{constructor(){super({id:`workbench.action.chat.openNewSessionEditor.${e.type}`,title:L(6656,"New {0}",e.displayName),category:vi,icon:M.plus,f1:!0,precondition:ie.enabled})}async run(n,r){let{type:s,displayName:l}=e;await fRi(n,{type:s,displayName:l,position:"editor"},r)}}),W(class extends K{constructor(){super({id:`workbench.action.chat.openNewSessionSidebar.${e.type}`,title:L(6657,"New {0}",e.displayName),category:vi,icon:M.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 fRi(n,{type:s,displayName:l,position:"sidebar"},r)}}))}_evaluateAvailability(){let e=!1;for(let{contribution:t,extension:o}of this._contributions.values()){let n=this._contributionDisposables.has(t.type),r=this._isContributionAvailable(t);this._logService.trace(`[ChatSessionsService] _evaluateAvailability: type='${t.type}', isCurrentlyRegistered=${n}, shouldBeRegistered=${r}, when='${t.when}'`),n&&!r?(this._contributionDisposables.deleteAndDispose(t.type),this._disposeSessionsForContribution(t.type),e=!0):!n&&r&&(this._enableContribution(t,o),e=!0)}if(e){this._onDidChangeAvailability.fire();for(let t of this._itemControllers.keys())this._onDidChangeItemsProviders.fire({chatSessionType:t});for(let{contribution:t}of this._contributions.values())this._onDidChangeSessionItems.fire({chatSessionType:t.type})}this._updateHasCanDelegateProvidersContextKey()}_enableContribution(e,t){this._logService.info(`[ChatSessionsService] _enableContribution: type='${e.type}', canDelegate=${e.canDelegate}`);let o=new P;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()}}_registerAgent(e,t){let{type:o,name:n,displayName:r,description:s}=e,l=this._sessionTypeIcons.get(o),c=q.isThemeIcon(l)?{themeIcon:l,icon:void 0,iconDark:void 0}:l?{icon:l.light,iconDark:l.dark}:{themeIcon:M.sendToRemoteAgent},u={id:o,name:n,fullName:r,description:s,isDefault:!1,isCore:!1,isDynamic:!0,slashCommands:e.commands??[],locations:["panel"],modes:["agent","ask"],disambiguation:[],metadata:{...c},capabilities:e.capabilities,canAccessPreviousChatHistory:!0,extensionId:t.identifier,extensionVersion:t.version,extensionDisplayName:t.displayName||t.name,extensionPublisherId:t.publisher};return this._chatAgentService.registerAgent(o,u)}getAllChatSessionContributions(){return Array.from(this._contributions.values(),e=>e.contribution).filter(e=>this._isContributionAvailable(e))}_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)?.contribution;if(t)return this._isContributionAvailable(t)?t:void 0}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}`)}))}async getChatSessionItems(e,t){await this.tryActivateControllers(e);let o=[];return await Promise.all(Array.from(this._itemControllers).map(async([n,r])=>{let s=this._resolveToPrimaryType(n)??n;if(!(e&&!e.includes(s)))try{await r.initialRefresh;let l=r.controller.items;this._logService.trace(`[ChatSessionsService] Resolved ${l.length} sessions for provider ${s}`),o.push({chatSessionType:s,items:l})}catch(l){so(l)||this._logService.error(`[ChatSessionsService] Failed to resolve sessions for provider ${s}`,l)}})),o}async refreshChatSessionItems(e,t){await this.tryActivateControllers(e),await Promise.all(Array.from(this._itemControllers).map(async([o,n])=>{try{await n.controller.refresh(t)}catch(r){so(r)||this._logService.error(`[ChatSessionsService] Failed to resolve sessions for provider ${o}`,r)}}))}registerChatSessionItemController(e,t){let o=new P,n=o.add(new $e);return this._itemControllers.set(e,{controller:t,initialRefresh:t.refresh(n.token)}),this._onDidChangeItemsProviders.fire({chatSessionType:e}),o.add(t.onDidChangeChatSessionItems(()=>{this._onDidChangeSessionItems.fire({chatSessionType:e})})),this.updateInProgressStatus(e).catch(r=>{this._logService.warn(`Failed to update initial progress status for '${e}':`,r)}),{dispose:()=>{n.cancel(),o.dispose(),this._itemControllers.get(e)&&(this._itemControllers.delete(e),this._onDidChangeItemsProviders.fire({chatSessionType: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))}}}registerChatModelChangeListeners(e,t,o){let n=new P,r=e.chatModels.map(c=>Array.from(c).filter(u=>u.sessionResource.scheme===t)),s=new vt,l=I$(c=>r.read(c),({addedValues:c,removedValues:u})=>{u.forEach(p=>{let h=s.get(p.sessionResource);h&&(s.delete(p.sessionResource),h.dispose())}),c.forEach(p=>{let h=p.lastRequestObs.map(f=>f?.response&&Nr("chatSessions.modelRequestChangeListener",f.response.onDidChange)),g=Nr("chatSessions.modelChangeListener",p.onDidChange);s.set(p.sessionResource,he(f=>{h.read(f)?.read(f),g.read(f),o()}))})});return n.add(Z(()=>{for(let c of s.values())c.dispose()})),n.add(l),n}getInProgressSessionDescription(e){let t=e.getRequests();if(t.length===0)return;let n=t.at(-1)?.response;if(!n||n.isComplete)return;let r=n.response.value,s="";for(let l=r.length-1;l>=0;l--){let c=r[l];if(s)break;if(c.kind==="confirmation"&&typeof c.message=="string")s=c.message;else if(c.kind==="toolInvocation"){let u=c,p=u.state.get();if(s=u.generatedTitle||u.pastTenseMessage||u.invocationMessage,p.type===lo.StateKind.WaitingForConfirmation){let h=p.confirmationMessages?.title,g=h&&(typeof h=="string"?h:h.value),f=typeof s=="string"?s:s.value;s=g??d(6618,null,f)}}else c.kind==="toolInvocationSerialized"?s=c.invocationMessage:c.kind==="progressMessage"?s=c.content:c.kind==="thinking"&&(s=d(6617,null))}return s?qa(s,{useLinkFormatter:!0}):""}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 pm(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);e.path.startsWith("/untitled")&&s?r={sessionResource:e,onWillDispose:H.None,history:[],options:s??{},dispose:()=>{}}:r=await pm(n.provideChatSessionContent(e,t),t);for(let[c,u]of Object.entries(r.options??{}))this.setSessionOption(e,c,u);{let c=this._sessions.get(e);if(c)return r.dispose(),c.session}let l=new gRi(r,e.scheme,e,r.options,c=>{l.dispose(),this._sessions.delete(c)});return this._sessions.set(e,l),this._onDidChangeSessionOptions.fire(e),r}hasAnySessionOptions(e){let t=this._sessions.get(this._resolveResource(e));return!!t&&!!t.options&&Object.keys(t.options).length>0}getSessionOption(e,t){return this._sessions.get(this._resolveResource(e))?.getOption(t)}setSessionOption(e,t,o){return!!this._sessions.get(this._resolveResource(e))?.setOption(t,o)}_resolveResource(e){return this._resourceAliases.get(e)??e}registerSessionResourceAlias(e,t){this._resourceAliases.set(t,e)}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){return this._sessionTypeNewSessionOptions.get(e)}setNewSessionOptionsForSessionType(e,t){this._sessionTypeNewSessionOptions.set(e,t)}async notifySessionOptionsChange(e,t){if(t.length){this._logService.trace(`[ChatSessionsService] notifySessionOptionsChange: starting for ${e}, ${t.length} update(s): [${t.map(o=>o.optionId).join(", ")}]`),await this._onRequestNotifyExtension.fireAsync({sessionResource:e,updates:t},ve.None),this._logService.trace(`[ChatSessionsService] notifySessionOptionsChange: fireAsync completed for ${e}`);for(let o of t)this.setSessionOption(e,o.optionId,o.value);this._onDidChangeSessionOptions.fire(this._resolveResource(e)),this._logService.trace(`[ChatSessionsService] notifySessionOptionsChange: finished for ${e}`)}}getIconForSessionType(e){let t=this._sessionTypeIcons.get(e);return q.isThemeIcon(t)?t:Ip(this._themeService.getColorTheme().type)?t?.dark:t?.light}getWelcomeTitleForSessionType(e){return this._sessionTypeWelcomeTitles.get(e)}getWelcomeMessageForSessionType(e){return this._sessionTypeWelcomeMessages.get(e)}getInputPlaceholderForSessionType(e){return this._sessionTypeInputPlaceholders.get(e)}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}getContentProviderSchemes(){return Array.from(this._contentProviders.keys())}};Cnt=I([m(0,ne),m(1,br),m(2,lt),m(3,X),m(4,qt),m(5,De),m(6,ot)],Cnt);we(Ls,Cnt,1);function Ton(a,i){return W(class extends K{constructor(){super({id:`workbench.action.chat.openNewChatSessionInPlace.${a}`,title:L(6655,"New {0}",i),category:vi,f1:!1,precondition:ie.enabled})}async run(t,...o){if(o.length===0)throw new ni("Expected chat session position argument");let n=o[0];if(n!=="sidebar"&&n!=="editor")throw new ni(`Invalid chat session position argument: ${n}`);await fRi(t,{type:a,displayName:d(6613,null),position:n,replaceEditor:!0})}})}function _on(a,i,e){return W(class extends K{constructor(){super({id:`workbench.action.chat.openNewChatSessionExternal.${a}`,title:L(6654,"New {0}",i),category:vi,f1:!1,precondition:ie.enabled})}async run(o){await o.get(ge).executeCommand(e)}})}async function fRi(a,i,e){let t=a.get(Ft),o=a.get(Si),n=a.get(ne),r=a.get(Et),s=a.get(ee),l=vRi(i);try{switch(i.position){case"sidebar":{let c=await t.openView(Vr);i.type==="local"?await c.widget.clear():await c.loadSession(l),c.focus();break}case"editor":{let c={override:Va.EditorID,pinned:!0,title:{fallback:d(6623,null,i.displayName)}};if(i.replaceEditor){let u=r.activeGroup.activeEditor;if(!u||!(u instanceof Va))throw new Error("No active chat editor to replace");await s.replaceEditors([{editor:u,replacement:{resource:l,options:c}}],r.activeGroup)}else await s.openEditor({resource:l,options:c});break}default:Hr(i.position,`Unknown chat session position: ${i.position}`)}}catch(c){n.error(`Failed to open '${i.type}' chat session with openOptions: ${JSON.stringify(i)}`,c);return}if(e)try{if(e.initialSessionOptions){let c=o.getSession(l);c?.contributedChatSession&&c.setContributedChatSession({...c.contributedChatSession,initialSessionOptions:e.initialSessionOptions})}await o.sendRequest(l,e.prompt,{agentIdSilent:i.type,attachedContext:e.attachedContext})}catch(c){n.error(`Failed to send initial request to '${i.type}' chat session with contextOptions: ${JSON.stringify(e)}`,c)}}function vRi(a){return a.chatResource?A.revive(a.chatResource):a.type!=="local"?A.from({scheme:a.type,path:`/untitled-${_t()}`}):a.position==="editor"?Va.getNewEditorUri():cs.forSession(_t())}function SSo(a){return Object.values(np).includes(a)}var Don=Tn.registerExtensionPoint({extensionPoint:"chatContext",jsonSchema:{description:d(6842,null),type:"array",items:{type:"object",properties:{id:{description:d(6844,null),type:"string"},icon:{description:d(6843,null),type:"string"},displayName:{description:d(6846,null),type:"string"}},required:["id","icon","displayName"]}},activationEventsGenerator:function*(a){for(let i of a)yield`onChatContextProvider:${i.id}`}}),rWe=class extends C{constructor(e){super();this._chatContextService=e;Don.setHandler(t=>{for(let o of t)if(Ea(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(6845,null,n.id));continue}r&&this._chatContextService.setChatContextProvider(`${o.description.id}-${n.id}`,{title:n.displayName,icon:r})}})}static{this.ID="workbench.contrib.chatContextContribution"}};rWe=I([m(0,Q_)],rWe);pt(rWe.ID,rWe,ut.AfterRestored);var aH=new Q("interactiveInputCursorAtBoundary","none"),tM={interactiveWindowAlwaysScrollOnNewCell:"interactiveWindow.alwaysScrollOnNewCell",executeWithShiftEnter:"interactiveWindow.executeWithShiftEnter",showExecutionHint:"interactiveWindow.showExecutionHint"};var oG=class extends C{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=H.debounce(this.editor.onDidFocusEditorText,()=>{},500);this._register(n(()=>{this.editor.hasTextFocus()&&this.ariaLabel&&t.getValue("accessibility.verbosity.replEditor")&&Or(this.ariaLabel)})),this._register(t.onDidChangeConfiguration(r=>{r.affectsConfiguration(tM.executeWithShiftEnter)&&this.setHint()})),this.editor.addContentWidget(this)}static{this.ID="replInput.widget.emptyHint"}getId(){return oG.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 Ie(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(10685,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 ah(e,zo)),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(10686,null,l):d(10687,null);this.ariaLabel=n.concat(c,d(10684,null,"accessibility.verbosity.replEditor"))}}getKeybinding(){let e=this.keybindingService.lookupKeybindings("interactive.execute"),t=this.configurationService.getValue(tM.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()}};oG=I([m(1,B),m(2,_e)],oG);var Lon="interactiveInputDecoration",Ron="InteractiveEditorViewState",xnt=8,bRi=10,knt=8,sWe=class extends pa{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w){super(cY,e,t,o,n);this._notebookWidget={value:void 0};this._widgetDisposableStore=this._register(new P);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 Io([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(nT,this.window,!0,{cellToolbarInteraction:"hover",globalToolbar:!0,stickyScrollEnabled:!1,dragAndDropEnabled:!1,disableRulers:!0}),this._editorMemento=this.getEditorMemento(b,S,Ron),this._register(c.registerDecorationType("interactive-decoration",Lon,{})),this._register(this._keybindingService.onDidUpdateKeybindings(this._updateInputHint,this)),this._register(this._notebookExecutionStateService.onDidChangeExecution(k=>{if(k.type===0&&Xe(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+xnt*2+knt*2}get inputCellEditorHeight(){return 19+knt*2}createEditor(e){R(e,this._rootElement),this._rootElement.style.position="relative",this._notebookEditorContainer=R(this._rootElement,_(".notebook-editor-container")),this._inputCellContainer=R(this._rootElement,_(".input-cell-container")),this._inputCellContainer.style.position="absolute",this._inputCellContainer.style.height=`${this.inputCellContainerHeight}px`,this._inputFocusIndicator=R(this._inputCellContainer,_(".input-focus-indicator")),this._inputRunButtonContainer=R(this._inputCellContainer,_(".run-button-container")),this._setupRunButtonToolbar(this._inputRunButtonContainer),this._inputEditorContainer=R(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 Ju(e,this._contextMenuService,{getKeyBinding:r=>this._keybindingService.lookupKeybinding(r.id),actionViewItemProvider:(r,s)=>Ca(this._instantiationService,r,s),renderDropdownAsChildElement:!0}));let{primary:o,secondary:n}=hl(t.getActions({shouldForwardArgs:!0}));this._runbuttonToolbar.setActions([...o,...n])}_createLayoutStyles(){this._styleElement=hr(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: ${xnt}px ${bRi}px ${xnt}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: ${xnt}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: ${knt-2}px;
			}
		`),this._styleElement.textContent=e.join(`
`)}_computeEditorOptions(){let e;this._codeEditorWidget&&(e=this._codeEditorWidget.getModel()?.getLanguageId());let t=Xi(this._configurationService.getValue("editor",{overrideIdentifier:e})),o=Kf(this._configurationService);return Object.freeze({...t,...o,glyphMargin:!0,padding:{top:knt,bottom:knt},hover:{enabled:"on"},rulers:[]})}saveState(){this._saveEditorViewState(this.input),super.saveState()}getViewState(){let e=this.input;if(e instanceof Zg)return this._saveEditorViewState(e),this._loadNotebookEditorViewState(e)}_saveEditorViewState(e){if(this._notebookWidget.value&&e instanceof Zg){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:A4.getSomeEditorContributions([L2.id,R2.id,kw.id]),menuIds:{notebookToolbar:D.InteractiveToolbar,cellTitleToolbar:D.InteractiveCellTitle,cellDeleteToolbar:D.InteractiveCellDelete,cellInsertToolbar:D.NotebookCellBetween,cellTopInsertToolbar:D.NotebookCellListTop,cellExecuteToolbar:D.InteractiveCellExecute,cellExecutePrimary:void 0},cellEditorContributions:aa.getSomeEditorContributions([ly,Hm.ID,kl.ID,Yg.ID,tw.ID]),options:this._notebookOptions,codeWindow:this.window},void 0,this.window),this._codeEditorWidget=this._instantiationService.createInstance(jr,this._inputEditorContainer,this._editorOptions,{isSimpleWidget:!1,contributions:aa.getSomeEditorContributions([ry.ID,ly,Hm.ID,El.ID,IO.ID,Qr.ID,ay.ID,kl.ID,Yg.ID,tw.ID,NVt])}),this._lastLayoutDimensions){this._notebookEditorContainer.style.height=`${this._lastLayoutDimensions.dimension.height-this.inputCellContainerHeight}px`,this._notebookWidget.value.layout(new ai(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-bRi,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??Fr,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(tM.showExecutionHint)&&this._updateInputHint()}));let p=aH.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(tM.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)}ZLe.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&&El.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+xnt*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-bRi,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 ai(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(tM.showExecutionHint)===!1||this._codeEditorWidget.getModel().getValueLength()!==0||this._hasConflictingDecoration();!this._hintElement&&!e?this._hintElement=this._instantiationService.createInstance(oG,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:H.None}}};sWe=I([m(1,Te),m(2,De),m(3,le),m(4,F),m(5,Zc),m(6,X),m(7,Kt),m(8,Tl),m(9,kt),m(10,_e),m(11,B),m(12,qt),m(13,ze),m(14,Et),m(15,Nn),m(16,rs),m(17,lt)],sWe);var Mon=Re("repl-editor-label-icon",M.debugLineByLine,d(12920,null)),Sy=class extends ha{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(ft.InteractiveWindowPromptToSave)!==!0,this.label=t??this.createEditorLabel(e)}static{this.ID="workbench.editorinputs.replEditorInput"}getIcon(){return Mon}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 Sy.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())}};Sy=I([m(2,un),m(3,mh),m(4,dn),m(5,ot),m(6,be),m(7,lr),m(8,lt),m(9,ee),m(10,Nn),m(11,Sv),m(12,$O),m(13,Nt),m(14,B),m(15,Vt),m(16,wn)],Sy);var Pon="InteractiveEditorViewState",Ent=8,SRi=10,Tnt=8,aWe=class extends pa{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w){super(uxe,e,t,o,n);this._accessibilityService=w;this._notebookWidget={value:void 0};this._widgetDisposableStore=this._register(new P);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 Io([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(nT,this.window,!0,{cellToolbarInteraction:"hover",globalToolbar:!0,stickyScrollEnabled:!1,dragAndDropEnabled:!1,disableRulers:!0}),this._editorMemento=this.getEditorMemento(v,b,Pon),this._register(this._keybindingService.onDidUpdateKeybindings(this._updateInputHint,this)),this._register(S.onDidChangeExecution(k=>{if(k.type===0&&Xe(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+Ent*2+Tnt*2}get inputCellEditorHeight(){return 19+Tnt*2}createEditor(e){R(e,this._rootElement),this._rootElement.style.position="relative",this._notebookEditorContainer=R(this._rootElement,_(".notebook-editor-container")),this._inputCellContainer=R(this._rootElement,_(".input-cell-container")),this._inputCellContainer.style.position="absolute",this._inputCellContainer.style.height=`${this.inputCellContainerHeight}px`,this._inputFocusIndicator=R(this._inputCellContainer,_(".input-focus-indicator")),this._inputRunButtonContainer=R(this._inputCellContainer,_(".run-button-container")),this._setupRunButtonToolbar(this._inputRunButtonContainer),this._inputEditorContainer=R(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 Ju(e,this._contextMenuService,{getKeyBinding:r=>this._keybindingService.lookupKeybinding(r.id),actionViewItemProvider:(r,s)=>Ca(this._instantiationService,r,s),renderDropdownAsChildElement:!0}));let{primary:o,secondary:n}=hl(t.getActions({shouldForwardArgs:!0}));this._runbuttonToolbar.setActions([...o,...n])}_createLayoutStyles(){this._styleElement=hr(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: ${Ent}px ${SRi}px ${Ent}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: ${Ent}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: ${Tnt-2}px;
			}
		`),this._styleElement.textContent=e.join(`
`)}_computeEditorOptions(){let e;this._codeEditorWidget&&(e=this._codeEditorWidget.getModel()?.getLanguageId());let t=Xi(this._configurationService.getValue("editor",{overrideIdentifier:e})),o=Kf(this._configurationService);return Object.freeze({...t,...o,ariaLabel:d(12906,null),glyphMargin:!0,padding:{top:Tnt,bottom:Tnt},hover:{enabled:"on"},rulers:[]})}saveState(){this._saveEditorViewState(this.input),super.saveState()}getViewState(){let e=this.input;if(e instanceof Sy)return this._saveEditorViewState(e),this._loadNotebookEditorViewState(e)}_saveEditorViewState(e){if(this._notebookWidget.value&&e instanceof Sy){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:A4.getSomeEditorContributions([L2.id,R2.id,kw.id]),menuIds:{notebookToolbar:D.InteractiveToolbar,cellTitleToolbar:D.InteractiveCellTitle,cellDeleteToolbar:D.InteractiveCellDelete,cellInsertToolbar:D.NotebookCellBetween,cellTopInsertToolbar:D.NotebookCellListTop,cellExecuteToolbar:D.InteractiveCellExecute,cellExecutePrimary:void 0},cellEditorContributions:aa.getSomeEditorContributions([ly,Hm.ID,kl.ID,Yg.ID,tw.ID]),options:this._notebookOptions,codeWindow:this.window},void 0,this.window);let r=["workbench.notebook.cellToolbar","editor.contrib.inlineCompletionsController"],s=UZ().cellEditorContributions?.filter(h=>r.indexOf(h.id)===-1);if(this._codeEditorWidget=this._instantiationService.createInstance(jr,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 ai(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-SRi,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=aH.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(tM.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)}ZLe.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&&El.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+Ent*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-SRi,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 ai(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(tM.showExecutionHint)===!1||this._codeEditorWidget.getModel().getValueLength()!==0||this._hasConflictingDecoration();!this._hintElement&&!e?this._hintElement=this._instantiationService.createInstance(oG,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:H.None}}getActiveCodeEditor(){if(this._codeEditorWidget)return this._codeEditorWidget.hasWidgetFocus()||!this._notebookWidget.value?.activeCodeEditor?this._codeEditorWidget:this._notebookWidget.value.activeCodeEditor}};aWe=I([m(1,Te),m(2,De),m(3,le),m(4,F),m(5,Zc),m(6,X),m(7,Tl),m(8,kt),m(9,_e),m(10,B),m(11,qt),m(12,ze),m(13,Et),m(14,Nn),m(15,rs),m(16,lt),m(17,Bi)],aWe);function Mk(a){let i=a;return i?.activeCodeEditor instanceof jr&&i?.notebookEditor instanceof XK}var F8=L(10679,"Interactive Window");oe.as(rn.EditorPane).registerEditorPane(ys.create(sWe,cY,"Interactive Window"),[new Mt(Zg)]);var lWe=class extends C{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(`${Y.vscodeInteractiveInput}:/**`,{id:"vscode-interactive-input",label:"Interactive Editor",priority:"exclusive"},{canSupportResource:s=>s.scheme===Y.vscodeInteractiveInput,singlePerResource:!0},{createEditorInput:({resource:s})=>o.findEditors({resource:s,editorId:"interactive",typeId:Zg.ID},{order:1}).at(0)}),t.registerEditor("*.interactive",{id:"interactive",label:"Interactive Editor",priority:"exclusive"},{canSupportResource:s=>s.scheme===Y.untitled&&ms(s)===".interactive"||s.scheme===Y.vscodeNotebookCell&&ms(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:IRi(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:IRi(s,this.instantiationService),options:p}}})}static{this.ID="workbench.contrib.interactiveDocument"}};lWe=I([m(0,un),m(1,ul),m(2,ee),m(3,F)],lWe);var cWe=class{constructor(i,e){this._modelService=e;this._registration=i.registerTextModelContentProvider(Y.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)}};cWe=I([m(0,Nt),m(1,Ct)],cWe);function IRi(a,i){let e=/\/Interactive-(\d+)/.exec(a.path),t=e&&e[1]?`/InteractiveInput-${e[1]}`:"InteractiveInput",o=A.from({scheme:Y.vscodeInteractiveInput,path:t});return Zg.create(i,a,o)}var dWe=class extends C{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 Zg&&Xe(e.resource,t.resource):!1}createEditor(e){return IRi(e.resource,this._instantiationService)}async _installHandler(){await this._extensionService.whenInstalledExtensionsRegistered(),this._register(this._workingCopyEditorService.registerHandler(this))}_getViewType(e){return _O.parse(e.typeId)?.viewType}};dWe=I([m(0,F),m(1,Vf),m(2,lt)],dWe);pt(lWe.ID,lWe,ut.BlockRestore);pt(cWe.ID,cWe,{editorTypeId:cY});pt(dWe.ID,dWe,{editorTypeId:cY});var J2t=class{static{this.ID=Zg.ID}canSerialize(i){return i instanceof Zg?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=zg(e);if(!t)return;let{resource:o,inputResource:n,name:r,language:s}=t;return!A.isUri(o)||!A.isUri(n)?void 0:Zg.create(i,o,n,r,s)}};oe.as(rn.EditorFactory).registerEditorSerializer(J2t.ID,J2t);we($O,K_t,1);we(Kke,z_t,1);W(class extends K{constructor(){super({id:"_interactive.open",title:L(10675,"Open Interactive Window"),f1:!1,category:F8,metadata:{description:d(10676,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(Et),s=a.get($O),l=a.get(Tl),c=a.get(ne),u=a.get(B),p=W_(r,u,typeof i=="number"?i:i?.viewColumn),h={activation:3,preserveFocus:typeof i!="number"?i?.preserveFocus??!1:!1};if(e&&ms(e)===".interactive"){c.debug("Open interactive window from resource:",e.toString());let k=A.revive(e),T=n.findEditors(k).filter(N=>N.editor instanceof Zg&&N.editor.resource?.toString()===k.toString());if(T.length){c.debug("Find existing interactive window:",e.toString());let N=T[0].editor,O=T[0].groupId,U=(await n.openEditor(N,h,O))?.getControl();return{notebookUri:N.resource,inputUri:N.inputResource,notebookEditorId:U?.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:Y.untitled,path:`/Interactive-${b}.interactive`}),v=A.from({scheme:Y.vscodeInteractiveInput,path:`/InteractiveInput-${b}`}),b++;while(g.has(f.toString()));if(Zg.setName(f,o),c.debug("Open new interactive window:",f.toString(),v.toString()),t){let T=l.getMatchingKernel({uri:f,notebookType:"interactive"}).all.find(N=>N.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(10668,"Execute Code"),category:F8,keybinding:[{when:x.and(mS,x.equals("activeEditor","workbench.editor.interactive")),primary:2051,weight:rf},{when:x.and(mS,x.equals("activeEditor","workbench.editor.interactive"),x.equals("config.interactiveWindow.executeWithShiftEnter",!0)),primary:1027,weight:rf},{when:x.and(mS,x.equals("activeEditor","workbench.editor.interactive"),x.equals("config.interactiveWindow.executeWithShiftEnter",!1)),primary:3,weight:rf}],menu:[{id:D.InteractiveInputExecute}],icon:HK,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(ma),o=a.get($O),n=a.get(Zc),r;if(i){let s=A.revive(i),l=e.findEditors(s);for(let c of l)if(c.editor.typeId===Zg.ID){r=(await e.openEditor(c.editor,c.groupId))?.getControl();break}}else r=e.activeEditorPane?.getControl();if(r&&Mk(r)&&r.notebookEditor){let s=r.notebookEditor.textModel,l=r.activeCodeEditor?.getModel(),u=r.notebookEditor.activeKernel?.supportedLanguages[0]??Fr;if(s&&l&&r.activeCodeEditor){let p=s.length,h=l.getValue();if(Jl(h))return;let g=_m.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 Iv(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(10673,"Clear the interactive window input editor contents"),category:F8,f1:!1})}async run(a){let e=a.get(ee).activeEditorPane?.getControl();if(e&&Mk(e)&&e.notebookEditor){let t=e.notebookEditor.textModel,o=e.activeCodeEditor,n=o?.getModel()?.getFullModelRange();t&&o&&n&&o.executeEdits("",[An.replace(n,null)])}}});W(class extends K{constructor(){super({id:"interactive.history.previous",title:L(10671,"Previous value in history"),category:F8,f1:!1,keybinding:{when:x.and(aH.notEqualsTo("bottom"),aH.notEqualsTo("none"),$n.Visible.toNegated()),primary:16,weight:200},precondition:x.and(mS,rr.negate())})}async run(a){let i=a.get(ee),e=a.get($O),t=i.activeEditorPane?.getControl();if(t&&Mk(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(10670,"Next value in history"),category:F8,f1:!1,keybinding:{when:x.and(aH.notEqualsTo("top"),aH.notEqualsTo("none"),$n.Visible.toNegated()),primary:18,weight:200},precondition:x.and(mS,rr.negate())})}async run(a){let i=a.get(ee),e=a.get($O),t=i.activeEditorPane?.getControl();if(t&&Mk(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(10678,null),keybinding:{when:x.equals("activeEditor","workbench.editor.interactive"),primary:2062,mac:{primary:2064},weight:200},category:F8})}async run(a){let e=a.get(ee).activeEditorPane?.getControl();if(e&&Mk(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(10677,null),keybinding:{when:x.equals("activeEditor","workbench.editor.interactive"),primary:2061,mac:{primary:2066},weight:200},category:F8})}async run(a){let e=a.get(ee).activeEditorPane?.getControl();if(e&&Mk(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(10674,"Focus Input Editor"),category:F8,menu:{id:D.CommandPalette,when:fWt}})}async run(a){let i=a.get(ee),e=i.activeEditorPane?.getControl();if(e&&Mk(e)&&e.notebookEditor)i.activeEditorPane?.focus();else{let t=i.getEditors(0),o=ht.find(t,n=>n.editor.typeId===Zg.ID);if(o){let n=o.editor,r=o.groupId,l=(await i.openEditor(n,r))?.getControl();l&&Mk(l)&&l.notebookEditor&&i.activeEditorPane?.focus()}}}});W(class extends K{constructor(){super({id:"interactive.history.focus",title:L(10669,"Focus History"),category:F8,menu:{id:D.CommandPalette,when:x.equals("activeEditor","workbench.editor.interactive")},keybinding:[{when:x.and(aH.notEqualsTo("bottom"),aH.notEqualsTo("none")),weight:205,primary:2064},{when:x.or(Zy,Jae),weight:200,primary:2064}],precondition:x.and(mS,rr.negate())})}async run(a){let e=a.get(ee).activeEditorPane?.getControl();e&&Mk(e)&&e.notebookEditor&&e.notebookEditor.focus()}});J("interactive.activeCodeBorder",{dark:Dse(p_,p_,"#007acc"),light:Dse(p_,p_,"#007acc"),hcDark:gi,hcLight:gi},d(10667,null));J("interactive.inactiveCodeBorder",{dark:Dse(xf,xf,"#37373D"),light:Dse(xf,xf,"#E4E6F1"),hcDark:cb,hcLight:cb},d(10672,null));oe.as(ii.Configuration).registerConfiguration({id:"interactiveWindow",order:100,type:"object",properties:{[tM.interactiveWindowAlwaysScrollOnNewCell]:{type:"boolean",default:!0,markdownDescription:d(10680,null)},[ft.InteractiveWindowPromptToSave]:{type:"boolean",default:!1,markdownDescription:d(10682,null)},[tM.executeWithShiftEnter]:{type:"boolean",default:!1,markdownDescription:d(10681,null),tags:["replExecute"]},[tM.showExecutionHint]:{type:"boolean",default:!0,markdownDescription:d(10683,null),tags:["replExecute"]}}});var ISo=_,uWe=class extends oc{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 aE([],-1,c,pE,{ariaLabel:d(8841,null),useCustomDrawn:!HS(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=R(e,ISo(q.asCSSSelector(qWt)));let t=this.keybindingService.appendKeybinding(this.action.label,this.action.id);this.toDispose.push(this.hoverService.setupManagedHover(Ni("mouse"),this.start,t)),this.start.setAttribute("role","button"),this._setAriaLabel(t),this._register(ws.addTarget(this.start));for(let s of[re.CLICK,Gn.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 Ii(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=ISo(".configuration");this.selectBox.render(R(e,o)),this.toDispose.push(j(o,re.KEY_DOWN,s=>{let l=new Ii(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 ${wt(PN)}`,o.style.borderLeft=`1px solid ${wt(PN)}`,this.container.style.backgroundColor=wt(FU);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=Ue(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:jN.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(8843,null),handler:async()=>!1}),this.debugOptions.push({label:jN.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(8837,null,s.name):d(8838,null);this.debugOptions.push({label:l,handler:async()=>(await this.commandService.executeCommand(nhe,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(8839,null,t,o):t=d(8840,null,t),this.start.ariaLabel=t}};uWe=I([m(3,Li),m(4,B),m(5,ge),m(6,Pe),m(7,_n),m(8,_e),m(9,tt),m(10,X)],uWe);var nG=class extends h1{constructor(e,t,o,n,r){super(null,e,[],-1,n,pE,{ariaLabel:d(8842,null),useCustomDrawn:!HS(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(()=>Ue(c))),this.update()})),this.getSessions().forEach(l=>{let c=[];c.push(l.onDidChangeName(()=>this.update())),c.push(l.onDidEndAdapter(()=>Ue(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}};nG=I([m(2,Li),m(3,_n),m(4,B)],nG);var Z2t=class a{constructor(){this._parsedQueries=[]}static{this.matchQuery=Up}set filterQuery(i){if(this._parsedQueries=[],i=i.trim(),i&&i!==""){let e=HL(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 dte||i instanceof yA||i instanceof Hl)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 BA=_,_nt=class a{static{this.ID="replEvaluationInput"}get templateId(){return a.ID}renderTemplate(i){R(i,BA("span.arrow"+q.asCSSSelector($lo)));let e=R(i,BA(".expression"));return{label:new Oa(e)}}renderElement(i,e,t){let o=i.element;t.label.set(o.value,ua(i.filterData))}disposeTemplate(i){i.label.dispose()}},W8=class{constructor(i,e){this.expressionRenderer=i;this.instaService=e}static{this.ID="replGroup"}get templateId(){return W8.ID}renderTemplate(i){i.classList.add("group");let e=R(i,BA(".output.expression.value-and-source")),t=R(e,BA("span.label")),o=this.instaService.createInstance(pWe,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()}};W8=I([m(1,F)],W8);var Dnt=class a{constructor(i){this.expressionRenderer=i}static{this.ID="replEvaluationResult"}get templateId(){return a.ID}renderTemplate(i){let e=R(i,BA(".evaluation-result.expression"));return{value:R(e,BA("span.value")),elementStore:new P}}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()}},V8=class{constructor(i,e){this.expressionRenderer=i;this.instaService=e}static{this.ID="outputReplElement"}get templateId(){return V8.ID}renderTemplate(i){let e=Object.create(null);i.classList.add("output");let t=R(i,BA(".output.expression.value-and-source"));return e.container=i,e.countContainer=R(t,BA(".count-badge-wrapper")),e.count=new fv(e.countContainer,{},BS),e.value=R(t,BA("span.value.label")),e.source=this.instaService.createInstance(pWe,t),e.elementDisposable=new P,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===gt.Warning?"warn":i.severity===gt.Error?"error":i.severity===gt.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()}};V8=I([m(1,F)],V8);var B8=class extends OB{constructor(e,t,o,n){super(t,o,n);this.expressionRenderer=e}static{this.ID="replVariable"}get templateId(){return B8.ID}renderElement(e,t,o){let n=e.element;o.elementDisposable.clear(),super.renderExpressionElement(n instanceof ohe?n.expression:n,e,o)}renderExpression(e,t,o){let n=e instanceof ohe;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",yRi(e))}getInputBoxOptions(e){}};B8=I([m(1,Li),m(2,_n),m(3,tt)],B8);var Lnt=class a{constructor(i){this.expressionRenderer=i}static{this.ID="rawObject"}get templateId(){return a.ID}renderTemplate(i){i.classList.add("output");let e=R(i,BA(".output.expression")),t=R(e,BA("span.name")),o=new Oa(t),n=R(e,BA("span.value"));return{container:i,expression:e,name:t,label:o,value:n,elementStore:new P}}renderElement(i,e,t){t.elementStore.clear();let o=i.element;t.label.set(o.name?`${o.name}:`:"",ua(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 yRi(a){return a instanceof Hl&&(a.parent instanceof yA||a.parent instanceof Hl)}var eGt=class extends d1{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)&&!yRi(e)){let s=e.value,l=n(s)+(t?0:Math.floor(s.length/70))+(e instanceof xw?0:1);return Math.max(l,1)*o}return o}getTemplateId(e){return e instanceof Hl||e instanceof ohe?B8.ID:e instanceof yA?Dnt.ID:e instanceof dte?_nt.ID:e instanceof xw?V8.ID:e instanceof S2?W8.ID:Lnt.ID}hasDynamicHeight(e){return yRi(e)?!1:e.toString().length>0}};function ySo(a){return typeof a.getReplElements=="function"}var tGt=class{hasChildren(i){return ySo(i)?!0:!!i.hasChildren}getChildren(i){return ySo(i)?Promise.resolve(i.getReplElements()):Promise.resolve(i.getChildren())}},iGt=class{getWidgetAriaLabel(){return d(9161,null)}getAriaLabel(i){return i instanceof Hl?d(9165,null,i.name,i.value):i instanceof xw||i instanceof dte||i instanceof yA?i.value+(i instanceof xw&&i.count>1?d(9162,null,i.count):""):i instanceof uUt?d(9164,null,i.name,i.value):i instanceof S2?d(9163,null,i.name):""}},pWe=class extends C{constructor(e,t,o,n){super();this.hoverService=o;this.labelService=n;this.el=R(e,BA(".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?`${No(e.source.name)}:${e.lineNumber}`:"",this.hover??=this._register(this.hoverService.setupManagedHover(Ni("mouse"),this.el,"")),this.hover.update(e?`${this.labelService.getUriLabel(e.source.uri)}:${e.lineNumber}`:"")}};pWe=I([m(1,ee),m(2,tt),m(3,ot)],pWe);var oGt=_,wRi="debug.repl.history",CRi="debug.repl.filterHistory",xRi="debug.repl.filterValue",wSo="replinputdecoration";function mWe(a){a.scrollTop=a.scrollHeight-a.renderHeight}var hWe=new Set,CSo={getId:a=>a.getId()},lH=class extends iF{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k){let T=n.get(xRi,1,"");super({...e,filterOptions:{placeholder:d(9124,null),text:T,history:JSON.parse(n.get(CRi,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=C.None;this.findIsOpen=!1;this.menu=y.createMenu(D.DebugConsoleContext,l),this._register(this.menu),this.history=this._register(new I7(new Set(JSON.parse(this.storageService.get(wRi,1,"[]"))),100)),this.filter=new Z2t,this.filter.filterQuery=T,this.multiSessionRepl=qdi.bindTo(l),this.replOptions=this._register(this.instantiationService.createInstance(H8,this.id,()=>this.getLocationBasedColors().background)),this._register(this.replOptions.onDidChange(()=>this.onDidStyleChange())),this._register(c.registerDecorationType("repl-decoration",wSo,{})),this.multiSessionRepl.set(this.isMultiSessionView),this.registerListeners()}static{this.REFRESH_DELAY=50}static{this.URI=A.parse(`${vC}: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 Hl&&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(lH.URI)||this.modelService.createModel("",null,lH.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(),mWe(this.tree))}))}async onDidFocusSession(e){e&&(hWe.delete(e),this.completionItemProvider?.dispose(),e.capabilities.supportsCompletionsRequest&&(this.completionItemProvider=this.languageFeaturesService.completionProvider.register({scheme:vC,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:xU.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"?Yd.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),Or(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||hWe.has(t))&&(e=this.debugService.getModel().getSessions(!0).find(n=>!hWe.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)}mWe(this.tree)}this.replInput?.updateOptions({readOnly:this.isReadonly}),this.updateInputDecoration()}async clearRepl(){let e=this.tree?.getInput();e&&(e.removeReplExpressions(),e.state===0&&(hWe.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()),mWe(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),mWe(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 CS(e)}layoutBodyContent(e,t){this.bodyContentDimension=new ai(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&&mWe(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 Pi(0),this.replInput.focus()}createActionViewItem(e){if(e.id===xSo){let t=(this.tree?this.tree.getInput():void 0)??this.debugService.getViewModel().focusedSession;return this.instantiationService.createInstance(DRi,e,t)}return super.createActionViewItem(e)}get isMultiSessionView(){return this.debugService.getModel().getSessions(!0).filter(e=>e.hasSeparateRepl()&&!hWe.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:CSo});let t=this.tree.getInput();if(t){let r=async s=>{for(let l of s)l instanceof S2&&(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(9122,null,n,o))},lH.REFRESH_DELAY)}render(){super.render(),this._register(zE({name:"repl",focusNotifiers:[this,this.filterWidget],focusNextWidget:()=>{let e=this.tree?.getHTMLElement();this.filterWidget.hasFocus()?this.tree?.domFocus():e&&sa(e)&&this.focus()},focusPreviousWidget:()=>{let e=this.tree?.getHTMLElement();this.replInput.hasTextFocus()?this.tree?.domFocus():e&&sa(e)&&this.focusFilter()}}))}renderBody(e){super.renderBody(e),this.container=R(e,oGt(".repl")),this.treeContainer=R(this.container,oGt(`.repl-tree.${tE}`)),this.createReplInput(this.container),this.createReplTree()}createReplTree(){this.replDelegate=new eGt(this.configurationService,this.replOptions);let e=this.configurationService.getValue("debug").console.wordWrap;this.treeContainer.classList.toggle("word-wrap",e);let t=this.instantiationService.createInstance($R);this.replDataSource=new tGt;let o=this.tree=this.instantiationService.createInstance(nu,"DebugRepl",this.treeContainer,this.replDelegate,[this.instantiationService.createInstance(B8,t),this.instantiationService.createInstance(V8,t),new _nt,this.instantiationService.createInstance(W8,t),new Dnt(t),new Lnt(t)],this.replDataSource,{filter:this.filter,accessibilityProvider:new iGt,identityProvider:CSo,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(()=>{mWe(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=Me(this.treeContainer).getSelection();(!r||r.type!=="Range"||n===r.toString())&&this.replInput.focus(),n=r?r.toString():""})),this.selectSession(),this.styleElement=hr(this.container,void 0,this._store),this.onDidStyleChange()}createReplInput(e){this.replInputContainer=R(e,oGt(".repl-input-wrapper")),R(this.replInputContainer,oGt(".repl-input-chevron"+q.asCSSSelector(qlo)));let{historyNavigationBackwardsEnablement:t,historyNavigationForwardsEnablement:o}=this._register(qM(this.scopedContextKeyService,this));this.setHistoryNavigationEnablement=l=>{t.set(l),o.set(l)},BO.bindTo(this.scopedContextKeyService).set(!0),this.scopedInstantiationService=this._register(this.instantiationService.createChild(new Io([X,this.scopedContextKeyService])));let n=Kf(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(jr,this.replInputContainer,n,xLe());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(Vo(this.replInputContainer,re.FOCUS,()=>this.replInputContainer.classList.add("synthetic-focus"))),this._register(Vo(this.replInputContainer,re.BLUR,()=>this.replInputContainer.classList.remove("synthetic-focus")))}getAriaLabel(){let e=d(9116,null);if(!this.configurationService.getValue("accessibility.verbosity.debug"))return e;let t=this.keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getAriaLabel();return t?e=d(9112,null,e,t):e=d(9113,null,e),e}onContextMenu(e){let t=Uc(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=$T(od,this.themeService.getColorTheme())?.transparent(.4);e.push({range:{startLineNumber:0,endLineNumber:0,startColumn:0,endColumn:1},renderOptions:{after:{contentText:d(9123,null),color:t?t.toString():void 0}}})}this.replInput.setDecorationsByType("repl-decoration",wSo,e)}saveState(){let e=this.history.getHistory();e.length?this.storageService.store(wRi,JSON.stringify(e),1,1):this.storageService.remove(wRi,1);let t=this.filterWidget.getHistory();t.length?this.storageService.store(CRi,JSON.stringify(t),1,1):this.storageService.remove(CRi,1);let o=this.filterWidget.getFilterText();o?this.storageService.store(xRi,o,1,1):this.storageService.remove(xRi,1),super.saveState()}dispose(){this.replInput?.dispose(),this.replElementsChangeListener?.dispose(),this.refreshScheduler.dispose(),this.modelChangeListener.dispose(),super.dispose()}};I([mi],lH.prototype,"refreshScheduler",1),lH=I([m(1,Li),m(2,F),m(3,le),m(4,De),m(5,Ct),m(6,X),m(7,Kt),m(8,Ri),m(9,ze),m(10,B),m(11,sL),m(12,ee),m(13,_e),m(14,Qe),m(15,tt),m(16,qt),m(17,zt),m(18,ne)],lH);var H8=class extends C{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:H8.lineHeightEm*e.fontSize,cssLineHeight:e.lineHeight?`${e.lineHeight}px`:`${H8.lineHeightEm}em`,backgroundColor:this.themeService.getColorTheme().getColor(this.backgroundColorDelegate()),fontSizeForTwistie:e.fontSize*H8.lineHeightEm/2-8},this._onDidChange.fire()}};H8=I([m(2,B),m(3,De),m(4,Ri)],H8);var kRi=class extends xi{constructor(){super({id:"repl.action.acceptInput",label:L(9107,"Debug Console: Accept Input"),precondition:BO,kbOpts:{kbExpr:ue.textInputFocus,primary:3,weight:100}})}run(i,e){El.get(e)?.cancelSuggestWidget(),Oie(i.get(Ft))?.acceptReplInput()}},ERi=class extends Fn{constructor(){super({viewId:ld,id:"repl.action.filter",title:d(9119,null),precondition:BO,keybinding:[{when:ue.textInputFocus,primary:2084,weight:100}]})}runInView(i,e){e.focusFilter()}},TRi=class extends Fn{constructor(){super({viewId:ld,id:"repl.action.find",title:d(9120,null),precondition:BO,keybinding:[{when:x.or(BO,x.equals("focusedView","workbench.panel.repl.view")),primary:2596,weight:100}],icon:M.search,menu:[{id:D.ViewTitle,group:"navigation",when:x.equals("view",ld),order:15},{id:D.DebugConsoleContext,group:"z_commands",order:25}]})}runInView(i,e){e.openFind()}},_Ri=class extends xi{constructor(){super({id:"repl.action.copyAll",label:d(9108,null),alias:"Debug Console Copy All",precondition:BO})}run(i,e){let t=i.get(Wi),o=Oie(i.get(Ft));if(o)return t.writeText(o.getVisibleContent())}};Jt(kRi);Jt(_Ri);W(ERi);W(TRi);var DRi=class extends nG{getSessions(){return this.debugService.getModel().getSessions(!0).filter(i=>i.hasSeparateRepl()&&!hWe.has(i))}mapFocusedSessionToSelected(i){for(;i.parentSession&&!i.hasSeparateRepl();)i=i.parentSession;return i}};function Oie(a){return a.getActiveViewWithId(ld)??void 0}var xSo="workbench.action.debug.selectRepl";W(class extends Fn{constructor(){super({id:xSo,viewId:ld,title:d(9121,null),f1:!1,menu:{id:D.ViewTitle,group:"navigation",when:x.and(x.equals("view",ld),qdi),order:20}})}async runInView(a,i,e){let t=a.get(Li);e&&e.state!==0&&e!==t.getViewModel().focusedSession&&(e=h_t(e,t.getModel().getSessions()),await t.focusStackFrame(void 0,void 0,e,{explicit:!0})),await i.selectSession(e)}});W(class extends Fn{constructor(){super({id:"workbench.debug.panel.action.clearReplAction",viewId:ld,title:L(9109,"Clear Console"),metadata:{description:L(9110,"Clears all program output from your debug REPL")},f1:!0,icon:Wlo,menu:[{id:D.ViewTitle,group:"navigation",when:x.equals("view",ld),order:30},{id:D.DebugConsoleContext,group:"z_commands",order:20}],keybinding:[{primary:0,mac:{primary:2089},weight:201,when:x.equals("focusedView","workbench.panel.repl.view")}]})}runInView(a,i){let e=a.get(tr);i.clearRepl(),e.playSignal($o.clear)}});W(class extends Fn{constructor(){super({id:"debug.collapseRepl",title:d(9111,null),viewId:ld,menu:{id:D.DebugConsoleContext,group:"z_commands",order:10}})}runInView(a,i){i.collapseAll(),i.focus()}});W(class extends Fn{constructor(){super({id:"debug.replPaste",title:d(9118,null),viewId:ld,precondition:Fs.notEqualsTo(oR(0)),menu:{id:D.DebugConsoleContext,group:"2_cutcopypaste",order:30}})}async runInView(a,i){let t=await a.get(Wi).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 Fn{constructor(){super({id:"workbench.debug.action.copyAll",title:d(9115,null),viewId:ld,menu:{id:D.DebugConsoleContext,group:"2_cutcopypaste",order:20}})}async runInView(a,i){await a.get(Wi).writeText(i.getVisibleContent())}});W(class extends K{constructor(){super({id:"debug.replCopy",title:d(9114,null),menu:{id:D.DebugConsoleContext,group:"2_cutcopypaste",order:10}})}async run(a,i){let e=a.get(Wi),t=a.get(Li),n=Ki().getSelection()?.toString();if(n&&n.length>0)return e.writeText(n);if(i){let s=await this.tryEvaluateAndCopy(t,i)||CS(i.toString());return e.writeText(s)}}async tryEvaluateAndCopy(a,i){if(!(i instanceof yA))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:Bmo,category:bte,title:L(9117,"Focus on Debug Console View")})}async run(a){await(await a.get(Ft).openView(ld))?.focus()}});var nGt=class{constructor(){this.priority=100;this.name="replEditorInput";this.type="view";this.when=x.and(mS,$u.negate())}getProvider(i){let e=i.get(ee);return Aon(e)}};function Aon(a){let i=a.activeEditorPane?.getControl();if(i&&Mk(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=yRe(t.notebookDocument,n);if(r)return new tp("notebook",{type:"view"},()=>r,()=>{i.activeCodeEditor?.focus()},"accessibility.verbosity.replEditor")}}}}var rGt=class{constructor(){this.priority=105;this.name="REPL Editor Input";this.when=x.and(mS,$u.negate());this.type="help"}getProvider(i){return kSo(i.get(Kt),Non())}};function Non(){return[d(12919,null),d(12911,null,"<keybinding:repl.execute>"),d(12910,null),d(12908,null),d(12914,null,"<keybinding:repl.focusLastItemExecuted>"),d(12918,null,"<keybinding:editor.action.accessibleView>"),d(12915,null,"<keybinding:repl.input.focus>")].join(`
`)}var sGt=class{constructor(){this.priority=105;this.name="REPL Editor History";this.when=x.and(mS,$u);this.type="help"}getProvider(i){return kSo(i.get(Kt),Oon())}};function Oon(){return[d(12917,null),d(12912,null,"<keybinding:notebook.cell.edit>"),d(12909,null,"<keybinding:notebook.cell.quitEdit>"),d(12907,null,"<keybinding:editor.action.accessibleView>"),d(12913,null,"<keybinding:notebook.cell.focusInOutput>"),d(12916,null,"<keybinding:repl.input.focus>"),d(12914,null,"<keybinding:repl.focusLastItemExecuted>")].join(`
`)}function kSo(a,i){let e=a.getActiveCodeEditor()||a.getFocusedCodeEditor();if(e)return new tp("replEditor",{type:"help"},()=>i,()=>e.focus(),"accessibility.verbosity.replEditor")}var LRi=class{canSerialize(i){return i.typeId===Sy.ID}serialize(i){So(i instanceof Sy);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=zg(e);if(!t)return;let{resource:o,viewType:n}=t;return!t||!A.isUri(o)||typeof n!="string"?void 0:i.createInstance(Sy,o,t.label)}};oe.as(rn.EditorPane).registerEditorPane(ys.create(aWe,uxe,"REPL Editor"),[new Mt(Sy)]);oe.as(rn.EditorFactory).registerEditorSerializer(Sy.ID,LRi);var gWe=class extends C{constructor(e,t,o,n,r){super();this.notebookEditorModelResolverService=o;this.instantiationService=n;this.configurationService=r;this.editorInputCache=new vt;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(ft.InteractiveWindowPromptToSave)!==!0,u=await this.notebookEditorModelResolverService.resolve({untitledResource:s},"jupyter-notebook",{scratchpad:c,viewType:"repl"}),p=u.object.notebook.uri;H.once(u.object.notebook.onWillDispose)(()=>{u.dispose()});let h=l?.label??void 0,g=this.instantiationService.createInstance(Sy,p,h);return this.editorInputCache.set(p,g),H.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(Sy,s,c);return this.editorInputCache.set(s,u),H.once(u.onWillDispose)(()=>this.editorInputCache.delete(s)),{editor:u,options:l}}})}static{this.ID="workbench.contrib.replDocument"}};gWe=I([m(0,un),m(1,ul),m(2,mh),m(3,F),m(4,B)],gWe);var fWe=class extends C{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 Sy&&Xe(e.resource,t.resource):!1}createEditor(e){return this.instantiationService.createInstance(Sy,e.resource,void 0)}async _installHandler(){await this.extensionService.whenInstalledExtensionsRegistered(),this._register(this.workingCopyEditorService.registerHandler(this))}_getNotebookType(e){return _O.parse(e.typeId)}};fWe=I([m(0,F),m(1,Vf),m(2,lt),m(3,un)],fWe);pt(fWe.ID,fWe,ut.BlockRestore);pt(gWe.ID,gWe,ut.BlockRestore);xa.register(new rGt);xa.register(new sGt);W(class extends K{constructor(){super({id:"repl.focusLastItemExecuted",title:L(12904,"Focus Most Recent REPL Execution"),category:"REPL",menu:{id:D.CommandPalette,when:C4},keybinding:[{primary:Ai(525,525),weight:rf,when:x.or(mS,$u.negate())}],precondition:C4})}async run(a,i){let e=a.get(ee),t=e.activeEditorPane?.getControl(),o=a.get(X),n;if(t&&Mk(t))n=t.notebookEditor;else{let s=C4.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&&Mk(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(12905,"Focus Input Editor"),category:"REPL",menu:{id:D.CommandPalette,when:C4},keybinding:[{when:x.and(mS,rr),weight:rf,primary:2066},{when:x.and(C4),weight:205,primary:Ai(526,526)}]})}async run(a){let i=a.get(ee),e=i.activeEditorPane?.getControl(),t=a.get(X);if(e&&Mk(e)&&e.notebookEditor)i.activeEditorPane?.focus();else{let o=C4.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(12903,"Execute REPL input"),category:"REPL",keybinding:[{when:x.and(mS,x.equals("activeEditor","workbench.editor.repl"),$u.negate()),primary:2051,weight:rf},{when:x.and(mS,x.equals("activeEditor","workbench.editor.repl"),x.equals("config.interactiveWindow.executeWithShiftEnter",!0),$u.negate()),primary:1027,weight:rf},{when:x.and(mS,x.equals("activeEditor","workbench.editor.repl"),x.equals("config.interactiveWindow.executeWithShiftEnter",!1),$u.negate()),primary:3,weight:rf}],menu:[{id:D.ReplInputExecute}],icon:HK,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(ma),o=a.get($O),n=a.get(Zc),r;if(i){let s=A.revive(i),l=e.findEditors(s);for(let c of l)if(c.editor.typeId===Sy.ID){r=(await e.openEditor(c.editor,c.groupId))?.getControl();break}}else r=e.activeEditorPane?.getControl();Mk(r)&&Fon(t,o,n,r)}});async function Fon(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]??Fr;if(o&&n){let l=o.length-1,c=n.getValue();if(Jl(c))return;let u=_m.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 Iv(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))}}}xa.register(new nGt);yt.registerCommandAndKeybindingRule({id:"list.find.replInputFocus",weight:201,when:x.equals("view",ld),primary:2596,secondary:[61],handler:a=>{Oie(a.get(Ft))?.openFind()}});var ESo={id:"testing",order:21,title:d(15307,null),type:"object",properties:{"testing.automaticallyOpenPeekView":{description:d(15309,null),enum:["failureAnywhere","failureInVisibleDocument","never"],default:"never",enumDescriptions:[d(15310,null),d(15311,null),d(15312,null)]},"testing.showAllMessages":{description:d(15341,null),type:"boolean",default:!1},"testing.automaticallyOpenPeekViewDuringAutoRun":{description:d(15313,null),type:"boolean",default:!1},"testing.countBadge":{description:d(15314,null),enum:["failed","off","passed","skipped"],enumDescriptions:[d(15315,null),d(15316,null),d(15317,null),d(15318,null)],default:"failed"},"testing.followRunningTest":{description:d(15330,null),type:"boolean",default:!1},"testing.defaultGutterClickAction":{description:d(15321,null),enum:["run","debug","runWithCoverage","contextMenu"],enumDescriptions:[d(15325,null),d(15324,null),d(15323,null),d(15322,null)],default:"run"},"testing.gutterEnabled":{description:d(15331,null),type:"boolean",default:!0},"testing.saveBeforeTest":{description:d(15340,null),type:"boolean",default:!0},"testing.automaticallyOpenTestResults":{enum:["neverOpen","openOnTestStart","openOnTestFailure","openExplorerOnTestStart"],enumDescriptions:[d(15333,null),d(15336,null),d(15335,null),d(15334,null)],default:"openOnTestStart",description:d(15332,null)},"testing.alwaysRevealTestOnStateChange":{markdownDescription:d(15308,null,"`#testing.followRunningTest#`"),type:"boolean",default:!1},"testing.showCoverageInExplorer":{description:d(15342,null),type:"boolean",default:!0},"testing.displayedCoveragePercent":{markdownDescription:d(15326,null),default:"totalCoverage",enum:["totalCoverage","statement","minimum"],enumDescriptions:[d(15329,null),d(15328,null),d(15327,null)]},"testing.coverageBarThresholds":{markdownDescription:d(15319,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(15320,null),type:"boolean",default:!1},"testing.resultsView.layout":{description:d(15337,null),enum:["treeRight","treeLeft"],enumDescriptions:[d(15339,null),d(15338,null)],default:"treeRight"}}};oe.as(rp.ConfigurationMigration).registerConfigurationMigrations([{key:"testing.openTesting",migrateFn:a=>[["testing.automaticallyOpenTestResults",{value:a}]]},{key:"testing.automaticallyOpenResults",migrateFn:a=>[["testing.automaticallyOpenTestResults",{value:a}]]}]);var Lp=(a,i)=>a.getValue(i),TSo=(a,i)=>ui(a.onDidChangeConfiguration,()=>Lp(a,i));var Tw=ae("testCoverageService"),vWe=class extends C{constructor(e,t,o,n){super();this.viewsService=n;this.lastOpenCts=this._register(new me);this.selected=Le("testCoverage",void 0);this.filterToTest=Le("filterToTest",void 0);this.showInline=Le("inlineCoverage",!1);let r=pr("testing.coverageToolbarEnabled",!0,o);this._register(tc(Ji.coverageToolbarEnabled,e,s=>r.read(s))),this._register(tc(Ji.inlineCoverageEnabled,e,s=>this.showInline.read(s))),this._register(tc(Ji.isTestCoverageOpen,e,s=>!!this.selected.read(s))),this._register(tc(Ji.hasPerTestCoverage,e,s=>!ht.isEmpty(this.selected.read(s)?.allPerTestIDs()))),this._register(tc(Ji.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 $e,n=e.coverage.get();n&&(Ui(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)}};vWe=I([m(0,X),m(1,ed),m(2,B),m(3,Ft)],vWe);var _So=a=>({onDidChange:H.None,value:a}),iM=class a extends C{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 k0=ae("testingFilterState"),Won=/!?@([^ ,:]+)/g,Von=a=>a.replace(/\s\s+/g," ").trim(),bWe=class extends C{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 iM(""));this.reveal=Le("TestExplorerFilterState.reveal",void 0);this.onDidRequestInputFocus=this.focusEmitter.event;this.selectTestInExplorerEmitter=this._register(new E);this.onDidSelectTestInExplorer=this.selectTestInExplorerEmitter.event;this.fuzzy=this._register(iM.stored(new dS({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(Won)){let r=n.index+n[0].length,s=n[0];if(Bon.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(lEe(n[1],c)):this.includeTags.add(lEe(n[1],c)),r++}t+=e.slice(o,n.index),o=r}if(t+=e.slice(o).trim(),t.length)for(let n of HL(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(Von(o.replace(e,"")))}};bWe=I([m(0,le)],bWe);var Bon=["@failed","@executed","@doc","@openedFiles","@hidden"];var aGt=class extends _Dt{constructor(e,t){super(e);this.expandActual=t;this.testsByUrl=new vt;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 ht.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)||ht.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 Vs;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 SWe=class extends C{constructor(e){super();this.storageService=e;this.excluded=this._register(iM.stored(new dS({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(ht.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}};SWe=I([m(0,le)],SWe);var IWe=class extends C{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=Le("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 aGt(o,this.expandTest.bind(this)),this.showInlineOutput=this._register(iM.stored(new dS({key:"inlineTestOutputVisible",scope:1,target:0},n),!0)),this.excluded=t.createInstance(SWe),this.isRefreshingTests=Ji.isRefreshingTests.bindTo(e),this.activeEditorHasTests=Ji.activeEditorHasTests.bindTo(e),this._register(tc(Ji.providerCount,e,g=>this.testControllers.read(g).size));let h=(g,f)=>this._register(tc(g,e,v=>ht.some(this.testControllers.read(v).values(),b=>!!(b.capabilities.read(v)&f))));h(Ji.canRefreshTests,2),h(Ji.canGoToRelatedCode,4),h(Ji.canGoToRelatedTest,8),this._register(r.onDidActiveEditorChange(()=>this.updateEditorContextKeys()))}async expandTest(e,t){await this.testControllers.get().get(Pr.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=ve.None){let o=[];for(let r of e.tests){let s=o.find(c=>hR(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 Pg(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&&hR(u,c)),test:c}));for(let c of Pg(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(15405,null)}))return;let r=Pg(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(mo);c.length&&this.notificationService.error(d(15404,null,c.join(" ")))}));await Promise.all(r)}async runResolvedTests(e,t=ve.None){e.exclude||(e.exclude=[...this.excluded.all]);let o=this.testResults.createLiveResult(e);if(!await this.workspaceTrustRequestService.requestWorkspaceTrust({message:d(15405,null)}))return o.markComplete(),o;try{let r=new $e(t);this.uiRunningTests.set(o.id,r);let l=Pg(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(mo);p.length&&this.notificationService.error(d(15404,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 $e;try{await Promise.all([...this.testControllers.get().values()].map(t=>t.syncTests(e.token)))}finally{e.dispose(!0)}}async refreshTests(e){let t=new $e;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=ve.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(mo)}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=ve.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(!ht.isEmpty(this.collection.getNodeByUrl(e))):this.activeEditorHasTests.set(!1)}async saveAllBeforeTest(e,t=this.configurationService,o=this.editorService){if(e.preserveFocus===!0)return;Lp(this.configurationService,"testing.saveBeforeTest")&&await o.saveAll()}};IWe=I([m(0,X),m(1,F),m(2,dt),m(3,le),m(4,ee),m(5,$d),m(6,Ne),m(7,B),m(8,ed),m(9,Vd)],IWe);var yWe=(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}},Rnt=({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(15399,null):o===0?d(15398,null,i,t,r.toPrecision(3)):d(15401,null,i,t,r.toPrecision(3),o):o===0?d(15397,null,i,e,r.toPrecision(3)):d(15400,null,i,e,r.toPrecision(3),o)};var xge=class extends C{static{this.ID="workbench.contrib.testing.chatAgentTool"}constructor(i,e,t){super();let o=i.createInstance(kge);this._register(e.registerTool(kge.DEFINITION,o)),this._register(e.executeToolSet.addTool(kge.DEFINITION)),t.createKey("chat.coreTestFailureToolEnabled",!0).set(!0)}};xge=I([m(0,F),m(1,jn),m(2,X)],xge);var kge=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:Ji.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:M.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. Only the first matching file will be summarized.'}}},userDescription:d(15364,null),source:Rn.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(15363,null)};t.report({message:d(15361,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(15358,null)}],toolResultMessage:d(15358,null)}):{content:[{kind:"text",value:await this._buildSummary(p,r,l)}],toolResultMessage:Rnt(yWe(!1,[p]))}):{content:[{kind:"text",value:"No test run was started. Instruct the user to ensure their test runner is correctly configured"}],toolResultError:d(15362,null)}}async _buildSummary(i,e,t){let o=i.counts[6]+i.counts[4],n=`<summary passed=${i.counts[3]} failed=${o} />
`;return o!==0&&(n+=await this._getFailureDetails(i)),e==="coverage"&&(n+=await this._getCoverageSummary(i,t)),n}async _getCoverageSummary(i,e){if(!e||!e.length)return"";for(let t of i.tasks){let o=t.coverage.get();if(!o)continue;let n=e.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);if(!l)continue;let c=`<coverage task=${JSON.stringify(t.name||"")}>
`,u=Gde(l.statement,l.branch,l.declaration)*100;c+=`<firstUncoveredFile path=${JSON.stringify(s)} statementsCovered=${l.statement.covered} statementsTotal=${l.statement.total}`,l.branch&&(c+=` branchesCovered=${l.branch.covered} branchesTotal=${l.branch.total}`),l.declaration&&(c+=` declarationsCovered=${l.declaration.covered} declarationsTotal=${l.declaration.total}`),c+=` percent=${u.toFixed(2)}`;try{let p=await l.details();for(let h of p){if(h.count||!h.location)continue;let g,f;Ie.isIPosition(h.location)?g=f=h.location.lineNumber:(g=h.location.startLineNumber,f=h.location.endLineNumber),c+=` firstUncoveredStart=${g} firstUncoveredEnd=${f}`;break}}catch{}return c+=` />
`,c+=`</coverage>
`,c}}return""}async _getFailureDetails(i){let e="",t=!1;for(let o of i.tests){if(!ak(o.ownComputedState))continue;let[,...n]=Pr.split(o.item.extId),r=n.pop();e+=`<testFailure name=${JSON.stringify(r)} path=${JSON.stringify(n.join(" > "))}>
`;for(let s of o.tasks)for(let l of s.messages.filter(c=>c.type===0)){if(t=!0,l.expected!==void 0&&l.actual!==void 0)e+=`<expectedOutput>
${l.expected}
</expectedOutput>
`,e+=`<actualOutput>
${l.actual}
</actualOutput>
`;else{let c=typeof l.message=="string"?l.message:l.message.value;e+=`<message>
${c}
</message>
`}if(l.stackTrace&&l.stackTrace.length>0)for(let c of l.stackTrace.slice(0,10))c.uri&&c.position?e+=`<stackFrame path="${c.uri.fsPath}" line="${c.position.lineNumber}" col="${c.position.column}" />
`:c.uri?e+=`<stackFrame path="${c.uri.fsPath}">${c.label}</stackFrame>
`:e+=`<stackFrame>${c.label}</stackFrame>
`;l.location&&(e+=`<location path="${l.location.uri.fsPath}" line="${l.location.range.startLineNumber}" col="${l.location.range.startColumn}" />
`)}e+=`</testFailure>
`}if(!t){let o=i.tasks.map(n=>n.output.getRange(0,n.output.length).toString().trim()).join(`
`);o&&(e+=`<output>
${o}
</output>
`)}return e}async _monitorRunProgress(i,e,t){let o=new P,n=()=>{let s=yWe(!i.completedAt,[i]),l=Rnt(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 P,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(nn(()=>n.fire(),5e3))})}).finally(()=>o.dispose())}async _getTestCasesToRun(i,e,t){if(!i.testNames?.length)return e;t.report({message:d(15360,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 Q9e(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(15359,null)});let t=this._workspaceContextService.getWorkspace().folders.at(0)?.uri,o=i.files.map(r=>Xl(r)?A.file(r):t?A.joinPath(t,r):void 0).filter(mo),n=[];for(let r of o)for await(let s of qde(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(15357,null),n=t.files?.map(r=>"`"+No(r)+"`");return Promise.resolve({invocationMessage:d(15355,null),confirmationMessages:{title:o,message:n?.length?new xe().appendMarkdown(d(15356,null,n.join(", "))):d(15354,null),allowAutoConfirm:!0}})}};kge=I([m(0,Es),m(1,dt),m(2,Pe),m(3,ed),m(4,$d)],kge);var RRi="vscode-test-data";var Ege=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}}},LD=a=>{let i={scheme:RRi,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:Hr(a,"Invalid test uri")}};var Tge=class{constructor(i,e,t,o){this.languageService=e;this.modelService=t;this.resultService=o;i.registerTextModelContentProvider(RRi,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=Ege(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=Je.concat(l.output.buffers,l.output.length).toString();u(CS(p));let h=p.length>0,g=new P;return g.add(l.output.onDidWriteData(f=>{h||=f.byteLength>0,u(CS(f.toString()))})),l.output.endPromise.then(()=>{g.isDisposed||h||(u(d(15365,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+=CS(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=CS(c.toString())}else typeof l.message=="string"?r=CS(l.message):(r=l.message.value,s=this.languageService.createById("markdown"))}}return r===void 0?null:this.modelService.createModel(r,s,i,!1)}};Tge=I([m(0,Nt),m(1,kt),m(2,Ct),m(3,ed)],Tge);var oM=ae("testingContinuousRunService"),wWe=class extends C{constructor(e,t,o,n){super();this.testService=e;this.testProfileService=n;this.changeEmitter=this._register(new E);this.running=new EP;this.onDidChange=this.changeEmitter.event;let r=Ji.isContinuousModeOn.bindTo(o);this._register(this.onDidChange(()=>{r.set(!!this.running.root.value)})),this.lastRun=this._register(new dS({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(Pr.fromString(e).path)}isEnabledForAParentOf(e){return!!this.running.root.value||this.running.size>0&&this.running.hasKeyOrParent(Pr.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(Pr.fromString(e).path)}isEnabled(){return!!this.running.root.value||this.running.size>0}start(e,t){let o=new P,n;if(e instanceof Array)n=Le("crProfiles",e);else{let u=()=>this.testProfileService.getGroupDefaultProfiles(e).filter(p=>p.supportsContinuousRun&&(!t||Pr.root(t)===p.controllerId));n=Le("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?Pr.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 jt;o.add(Z(()=>{for(let u of c.values())u.cancel();c.dispose()})),o.add(I$(u=>n.read(u),({addedValues:u,removedValues:p})=>{for(let h of u){let g=new $e;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?Pr.fromString(e).path:[])];for(let o=t.length-1;o>=0;o--)t[o].handle.dispose();this.changeEmitter.fire(e)}};wWe=I([m(0,Es),m(1,le),m(2,X),m(3,$d)],wWe);var cGt=class{constructor(){this.value=[]}push(i){let e=cx(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)]}},Mnt=ae("testingDecorationService");var RD=ae("testingPeekOpener");var dH=a=>Kn(a.total===0?1:a.covered/a.total,0,1),DSo=[{color:`var(${TN(V$e)})`,key:"red"},{color:`var(${TN(TGi)})`,key:"yellow"},{color:`var(${TN(Ase)})`,key:"green"}],LSo=(a,i)=>{let e=DSo[0].color,t=a;for(let{key:o,color:n}of DSo){let r=i[o]/100;r&&a>=r&&a-r<t&&(e=n,t=a-r)}return e},Uon=1e-7,CWe=(a,i=2)=>{let e=(a*100).toFixed(i);return a<1-Uon&&e==="100"?`${100-10**-i}%`:`${e}%`},RSo=(a,i)=>{switch(i){case"statement":return dH(a.statement);case"minimum":{let e=dH(a.statement);return a.branch&&(e=Math.min(e,dH(a.branch))),a.declaration&&(e=Math.min(e,dH(a.declaration))),e}case"totalCoverage":return Gde(a.statement,a.branch,a.declaration);default:Hr(i)}};function dGt(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 Fie;(n=>(n.showingFilterFor=r=>d(15061,null,r),n.clickToChangeFiltering=d(15059,null),n.percentCoverage=(r,s)=>d(15062,null,CWe(r,s)),n.allTests=d(15060,null),n.pickShowCoverage=d(15063,null)))(Fie||={});var MSo=J("testing.iconFailed",{dark:"#f14c4c",light:"#f14c4c",hcDark:"#f14c4c",hcLight:"#B5200D"},d(15283,null)),PSo=J("testing.iconErrored",{dark:"#f14c4c",light:"#f14c4c",hcDark:"#f14c4c",hcLight:"#B5200D"},d(15281,null)),ARi=J("testing.iconPassed",{dark:"#73c991",light:"#73c991",hcDark:"#73c991",hcLight:"#007100"},d(15285,null)),ASo=J("testing.runAction",ARi,d(15302,null)),NSo=J("testing.iconQueued","#cca700",d(15287,null)),OSo=J("testing.iconUnset","#848484",d(15291,null)),FSo=J("testing.iconSkipped","#848484",d(15289,null)),WSo=J("testing.peekBorder",{dark:av,light:av,hcDark:gi,hcLight:gi},d(15301,null)),VSo=J("testing.messagePeekBorder",{dark:fm,light:fm,hcDark:gi,hcLight:gi},d(15299,null)),BSo=J("testing.peekHeaderBackground",{dark:ei(av,.1),light:ei(av,.1),hcDark:null,hcLight:null},d(15301,null)),HSo=J("testing.messagePeekHeaderBackground",{dark:ei(fm,.1),light:ei(fm,.1),hcDark:null,hcLight:null},d(15300,null)),PRi=J("testing.coveredBackground",{dark:Hg,light:Hg,hcDark:null,hcLight:null},d(15278,null)),zon=J("testing.coveredBorder",{dark:ei(PRi,.75),light:ei(PRi,.75),hcDark:gi,hcLight:gi},d(15279,null)),G_g=J("testing.coveredGutterBackground",{dark:ei(Hg,.6),light:ei(Hg,.6),hcDark:Ase,hcLight:Ase},d(15280,null)),$_g=J("testing.uncoveredBranchBackground",{dark:W$(ei(Cf,2),qo),light:W$(ei(Cf,2),qo),hcDark:null,hcLight:null},d(15305,null)),uGt=J("testing.uncoveredBackground",{dark:Cf,light:Cf,hcDark:null,hcLight:null},d(15303,null)),Kon=J("testing.uncoveredBorder",{dark:ei(uGt,.75),light:ei(uGt,.75),hcDark:gi,hcLight:gi},d(15304,null)),q_g=J("testing.uncoveredGutterBackground",{dark:ei(Cf,1.5),light:ei(Cf,1.5),hcDark:V$e,hcLight:V$e},d(15306,null)),j_g=J("testing.coverCountBadgeBackground",rv,d(15276,null)),Q_g=J("testing.coverCountBadgeForeground",Yw,d(15277,null)),USo=J("testing.message.error.badgeBackground",BXt,d(15293,null));J("testing.message.error.badgeBorder",USo,d(15294,null));J("testing.message.error.badgeForeground",VXt,d(15295,null));J("testing.message.error.lineBackground",null,d(15296,null));J("testing.message.info.decorationForeground",ei(od,.5),d(15297,null));J("testing.message.info.lineBackground",null,d(15298,null));var zSo={6:PSo,4:MSo,3:ARi,1:NSo,0:OSo,5:FSo},Gon=J("testing.iconErrored.retired",ei(PSo,.7),d(15282,null)),$on=J("testing.iconFailed.retired",ei(MSo,.7),d(15284,null)),qon=J("testing.iconPassed.retired",ei(ARi,.7),d(15286,null)),jon=J("testing.iconQueued.retired",ei(NSo,.7),d(15288,null)),Qon=J("testing.iconUnset.retired",ei(OSo,.7),d(15292,null)),Yon=J("testing.iconSkipped.retired",ei(FSo,.7),d(15290,null)),KSo={6:Gon,4:$on,3:qon,1:jon,0:Qon,5:Yon};is((a,i)=>{let e=a.getColor(qo);if(i.addRule(`
	.coverage-deco-inline.coverage-deco-hit.coverage-deco-hovered {
		background: ${a.getColor(PRi)?.transparent(1.3)};
		outline-color: ${a.getColor(zon)?.transparent(2)};
	}
	.coverage-deco-inline.coverage-deco-miss.coverage-deco-hovered {
		background: ${a.getColor(uGt)?.transparent(1.3)};
		outline-color: ${a.getColor(Kon)?.transparent(2)};
	}
		`),e){let t=a.getColor(uGt)?.transparent(2).makeOpaque(e),o=a.getColor(USo)?.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 xWe=Re("test-view-icon",M.beaker,d(15092,null)),NRi=Re("test-results-icon",M.checklist,d(15079,null)),uH=Re("testing-run-icon",M.run,d(15082,null)),Wie=Re("testing-rerun-icon",M.debugRerun,d(15078,null)),z8=Re("testing-run-all-icon",M.runAll,d(15080,null)),_ge=Re("testing-debug-all-icon",M.debugAltSmall,d(15070,null)),ex=Re("testing-debug-icon",M.debugAltSmall,d(15071,null)),ORi=Re("testing-coverage-icon",M.runCoverage,d(15069,null)),GSo=Re("testing-coverage-all-icon",M.runAllCoverage,d(15081,null)),pGt=Re("testing-cancel-icon",M.debugStop,d(15066,null)),Pnt=Re("testing-filter",M.filter,d(15064,null)),$So=Re("testing-hidden",M.eyeClosed,d(15065,null)),nDg=Re("testing-show-as-list-icon",M.listTree,d(15083,null)),rDg=Re("testing-show-as-list-icon",M.listFlat,d(15084,null)),Ant=Re("testing-update-profiles",M.gear,d(15090,null)),qSo=Re("testing-refresh-tests",M.refresh,d(15077,null)),Nnt=Re("testing-turn-continuous-run-on",M.eye,d(15088,null)),mGt=Re("testing-turn-continuous-run-off",M.eyeClosed,d(15087,null)),Ont=Re("testing-continuous-is-on",M.eye,d(15086,null)),jSo=Re("testing-cancel-refresh-tests",M.stop,d(15067,null)),Fnt=Re("testing-coverage",M.coverage,d(15068,null)),QSo=Re("testing-was-covered",M.check,d(15091,null)),YSo=Re("testing-missing-branch",M.question,d(15074,null)),HA=new Map([[6,Re("testing-error-icon",M.issues,d(15072,null))],[4,Re("testing-failed-icon",M.error,d(15073,null))],[3,Re("testing-passed-icon",M.pass,d(15075,null))],[1,Re("testing-queued-icon",M.history,d(15076,null))],[2,cE],[5,Re("testing-skipped-icon",M.debugStepOver,d(15085,null))],[0,Re("testing-unset-icon",M.circleOutline,d(15089,null))]]);is((a,i)=>{for(let[e,t]of HA.entries()){let o=zSo[e],n=KSo[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(uH)},
		.monaco-editor .glyph-margin-widgets ${q.asCSSSelector(z8)},
		.monaco-editor .glyph-margin-widgets ${q.asCSSSelector(ex)},
		.monaco-editor .glyph-margin-widgets ${q.asCSSSelector(_ge)} {
			color: ${a.getColor(ASo)};
		}
	`)});var rG=class extends C{constructor(e,t,o){super();this.options=e;this.configurationService=t;this.hoverService=o;this.el=new co(()=>{if(this.options.compact){let e=bt(".test-coverage-bars.compact",[bt(".tpc@overall"),bt(".bar@tpcBar")]);return this.attachHover(e.tpcBar,Jon),e}else{let e=bt(".test-coverage-bars",[bt(".tpc@overall"),bt(".bar@statement"),bt(".bar@function"),bt(".bar@branch")]);return this.attachHover(e.statement,XSo),this.attachHover(e.function,JSo),this.attachHover(e.branch,ZSo),e}});this.visibleStore=this._register(new P);this.customHovers=[]}get visible(){return!!this._coverage}attachHover(e,t){this._register(this.hoverService.setupManagedHover(Ni("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=Lp(this.configurationService,"testing.coverageBarThresholds"),r=RSo(e,Lp(this.configurationService,"testing.displayedCoveragePercent"));this.options.overall!==!1?t.overall.textContent=CWe(r,o):t.overall.style.display="none","tpcBar"in t?gGt(t.tpcBar,r,!1,n):(gGt(t.statement,dH(e.statement),e.statement.total===0,n),gGt(t.function,e.declaration&&dH(e.declaration),e.declaration?.total===0,n),gGt(t.branch,e.branch&&dH(e.branch),e.branch?.total===0,n))}};rG=I([m(1,B),m(2,tt)],rG);var Xon=16,gGt=(a,i,e,t)=>{if(i===void 0){a.style.display="none";return}if(a.style.display="block",a.style.width=`${Xon}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=LSo(i,t),a.style.opacity="1"},kWe=Wu.NumberFormat(),XSo=a=>d(15095,null,kWe.value.format(a.statement.covered),kWe.value.format(a.statement.total),CWe(dH(a.statement))),JSo=a=>a.declaration&&d(15094,null,kWe.value.format(a.declaration.covered),kWe.value.format(a.declaration.total),CWe(dH(a.declaration))),ZSo=a=>a.branch&&d(15093,null,kWe.value.format(a.branch.covered),kWe.value.format(a.branch.total),CWe(dH(a.branch))),Jon=a=>{let i=[XSo(a),JSo(a),ZSo(a)].filter(mo).join(`

`);return{markdown:new xe().appendText(i),markdownNotSupportedFallback:i}},Vie=class extends rG{constructor(e,t,o,n){super(e,t,o);this.resource=Le(this,void 0);let r=TSo(t,"testing.showCoverageInExplorer");this._register(he(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,oe.as("workbench.registry.explorer.fileContributions").register({create(e,t){return e.createInstance(Vie,{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)}};Vie=I([m(1,B),m(2,tt),m(3,Tw)],Vie);var eIo="coverage-deco-hit",FRi="coverage-deco-miss",Zon=d(15056,null),nIo="testing.toggleInlineCoverage",enn=4,rIo=L(15046,"Go to Next Uncovered Line"),sIo=L(15048,"Go to Previous Uncovered Line"),Bie=class extends C{constructor(e,t,o,n,r,s){super();this.editor=e;this.coverage=o;this.log=r;this.displayedStore=this._register(new P);this.hoveredStore=this._register(new P);this.decorationIds=new Map;this.hasInlineCoverageDetails=Le("hasInlineCoverageDetails",!1);this.summaryWidget=new co(()=>this._register(t.createInstance(Wnt,this.editor)));let l=ui(this,e.onDidChangeModel,()=>e.getModel()),c=ui(this,e.onDidChangeConfiguration,h=>h),u=Ce(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(tc(Ji.hasPerTestCoverage,s,h=>!!u.read(h)?.file.perTestData?.size)),this._register(tc(Ji.hasCoverageInFile,s,h=>!!u.read(h)?.file)),this._register(tc(Ji.hasInlineCoverageDetails,s,h=>this.hasInlineCoverageDetails.read(h))),this._register(he(h=>{let g=u.read(h);g?this.apply(e.getModel(),g.file,g.testId,o.showInline.read(h)):this.clear()}));let p=pr("testing.coverageToolbarEnabled",!0,n);this._register(he(h=>{let g=u.read(h);g&&p.read(h)?this.summaryWidget.value.setCoverage(g.file,g.testId):this.summaryWidget.rawValue?.clearCoverage()})),this._register(he(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=DT(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(FRi)){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 Ie(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?eIo:FRi,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(enn),inlineClassName:`coverage-deco-branch-miss-indicator ${q.asClassName(YSo)}`,inlineClassNameAffectsLetterSpacing:!0,cursorStops:3}:(y.className=`coverage-deco-inline ${f}`,h&&typeof g=="number"&&(y.before=tIo(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?eIo:FRi,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=tIo(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 $e;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 WRi(r,o)}catch(r){this.log.error("Error loading coverage details",r)}}};Bie=I([m(1,F),m(2,Tw),m(3,B),m(4,ne),m(5,X)],Bie);var tIo=a=>{if(a!==0)return{content:`${a>99?"99+":a}x`,cursorStops:3,inlineClassName:"coverage-deco-inline-count",inlineClassNameAffectsLetterSpacing:!0}},WRi=class{constructor(i,e){this.details=i;this.ranges=[];let t=i.map(s=>({range:fGt(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:fGt(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 iIo(i.name,i);if(i.type===1){let t=oIo(e.getValueInRange(fGt(i.location)).trim()||"<empty statement>");if(i.branches?.length){let o=i.branches.filter(n=>!!n.count).length;return new xe().appendMarkdown(d(15037,null,o,i.branches.length,t))}else return iIo(t,i)}else if(i.type===2){let t=oIo(e.getValueInRange(fGt(i.detail.location)).trim()||"<empty statement>"),{count:o,label:n}=i.detail.branches[i.branch],r=n?aIo(n):`#${i.branch+1}`;return o?o===!0?new xe().appendMarkdown(d(15036,null,r,t)):new xe().appendMarkdown(d(15035,null,r,t,o)):new xe().appendMarkdown(d(15038,null,r,t))}Hr(i)}};function iIo(a,i){return new xe().appendMarkdown(i.count?typeof i.count=="number"?d(15039,null,a,i.count):d(15041,null,a):d(15040,null,a))}function fGt(a){return a instanceof Ie?z.fromPositions(a,new Ie(a.lineNumber,2147483647)):a}function aIo(a){return"`"+a.replace(/[\n\r`]/g,"")+"`"}function oIo(a){return a.length>50&&(a=a.slice(0,40)+"..."),aIo(a)}var Wnt=class extends C{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 P);this._domNode=bt("div.coverage-summary-widget",[bt("div",[bt("span.bars@bars"),bt("span.toolbar@toolbar")])]);this.bars=this._register(c.createInstance(rG,{compact:!1,overall:!1,container:this._domNode.bars})),this.actionBar=this._register(c.createInstance(ji,this._domNode.toolbar,{orientation:0,actionViewItemProvider:(u,p)=>{if(u instanceof K8){if(u.iconOnly)return u.class=q.asClassName(u.icon),new Lr(void 0,u,{...p,label:!1,icon:!0});let h=new VRi(void 0,u,p);return h.themeIcon=u.icon,h}}})),this._register(he(u=>{l.showInline.read(u),this.setActions()})),this._register(Vo(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 K8("toggleInline",this.coverage.showInline.get()?d(15051,null):d(15053,null),Fnt,void 0,()=>this.coverage.showInline.set(!this.coverage.showInline.get(),void 0));t.tooltip=this.keybindingService.appendKeybinding(Zon,nIo);let o=e.coverage.statement.covered<e.coverage.statement.total;if(this.actionBar.push(new K8("goToPreviousMissed",sIo.value,M.arrowUp,o,()=>this.commandService.executeCommand("testing.coverage.goToPreviousMissedLine"),!0)),this.actionBar.push(new K8("goToNextMissed",rIo.value,M.arrowDown,o,()=>this.commandService.executeCommand("testing.coverage.goToNextMissedLine"),!0)),this.actionBar.push(t),e.testId){let n=e.coverage.fromResult.getTestById(e.testId.toString());Ey(!!n,"got coverage for an unreported test"),this.actionBar.push(new K8("perTestFilter",Fie.showingFilterFor(n.label),Pnt,void 0,()=>this.commandService.executeCommand("testing.coverageFilterToTestInEditor",this.current,this.editor)))}else e.coverage.perTestData?.size&&this.actionBar.push(new K8("perTestFilter",d(15044,null,e.coverage.perTestData.size),Pnt,void 0,()=>this.commandService.executeCommand("testing.coverageFilterToTestInEditor",this.current,this.editor)));this.actionBar.push(new K8("rerun",d(15052,null),Wie,!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()}};Wnt=I([m(1,B),m(2,ze),m(3,Es),m(4,_e),m(5,ge),m(6,Tw),m(7,F)],Wnt);W(class extends K{constructor(){super({id:nIo,title:L(15043,"Toggle Inline Coverage"),category:We.Test,keybinding:{weight:200,primary:Ai(2133,3111)},toggled:{condition:Ji.inlineCoverageEnabled,title:d(15042,null)},icon:Fnt,menu:[{id:D.CommandPalette,when:Ji.isTestCoverageOpen},{id:D.EditorTitle,when:x.and(Ji.hasInlineCoverageDetails,Ji.coverageToolbarEnabled.notEqualsTo(!0)),group:"navigation"}]})}run(i){let e=i.get(Tw);e.showInline.set(!e.showInline.get(),void 0)}});W(class extends K{constructor(){super({id:"testing.coverageToggleToolbar",title:L(15058,"Show Test Coverage Toolbar"),metadata:{description:L(15057,"Toggle the sticky coverage bar in the editor.")},category:We.Test,toggled:{condition:Ji.coverageToolbarEnabled},menu:[{id:D.CommandPalette,when:Ji.isTestCoverageOpen},{id:D.StickyScrollContext,when:Ji.isTestCoverageOpen},{id:D.EditorTitle,when:Ji.hasCoverageInFile,group:"coverage",order:1}]})}run(i){let e=i.get(B),t=Lp(e,"testing.coverageToolbarEnabled");e.updateValue("testing.coverageToolbarEnabled",!t)}});W(class extends K{constructor(){super({id:"testing.coverageFilterToTestInEditor",title:L(15045,"Filter Coverage to Test"),category:We.Test,icon:M.filter,toggled:{icon:M.filterFilled,condition:Ji.isCoverageFilteredToTest},menu:[{id:D.EditorTitle,when:x.and(Ji.hasCoverageInFile,Ji.coverageToolbarEnabled.notEqualsTo(!0),Ji.hasPerTestCoverage,fr.isEqualTo(mF)),group:"navigation"}]})}run(i,e,t){let o=i.get(Tw),n=i.get(Ge),r=i.get(ge),s=pn(t)?t:i.get(Kt).getActiveCodeEditor(),l;if(e instanceof N5)l=e;else if(oh(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(Pr.fromString),u=Pr.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:Fie.allTests,testId:void 0},{type:"separator"},...c.map(S=>({label:dGt(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:Fie.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 $e;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 Ie?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(15055,"Toggle Coverage in Explorer"),metadata:{description:L(15054,"Toggle the display of test coverage in the File Explorer view.")},category:We.Test,toggled:{condition:x.equals("config.testing.showCoverageInExplorer",!0),title:d(15050,null)},menu:[{id:D.CommandPalette,when:Ji.isTestCoverageOpen}]})}run(i){let e=i.get(B),t=Lp(e,"testing.showCoverageInExplorer");e.updateValue("testing.showCoverageInExplorer",!t)}});W(class extends K{constructor(){super({id:"testing.coverage.goToNextMissedLine",title:rIo,metadata:{description:L(15047,"Navigate to the next line that is not covered by tests.")},category:We.Test,icon:M.arrowDown,precondition:Ji.hasCoverageInFile,keybinding:{when:fr,weight:100,primary:579},menu:[{id:D.CommandPalette,when:Ji.isTestCoverageOpen},{id:D.EditorTitle,when:Ji.hasCoverageInFile,group:"coverage",order:2}]})}run(i){let t=i.get(Kt).getActiveCodeEditor();if(!t)return;t.getContribution(Bie.ID)?.goToNextMissedLine()}});W(class extends K{constructor(){super({id:"testing.coverage.goToPreviousMissedLine",title:sIo,metadata:{description:L(15049,"Navigate to the previous line that is not covered by tests.")},category:We.Test,icon:M.arrowUp,precondition:Ji.hasCoverageInFile,keybinding:{when:fr,weight:100,primary:1603},menu:[{id:D.CommandPalette,when:Ji.isTestCoverageOpen},{id:D.EditorTitle,when:Ji.hasCoverageInFile,group:"coverage",order:3}]})}run(i){let t=i.get(Kt).getActiveCodeEditor();if(!t)return;t.getContribution(Bie.ID)?.goToPreviousMissedLine()}});var K8=class extends st{constructor(e,t,o,n,r,s=!1){super(e,t,void 0,n,r);this.icon=o;this.iconOnly=s}},VRi=class extends Lr{updateLabel(){this.options.label&&this.label&&this.themeIcon&&Fi(this.label,Qo(this.themeIcon),this.action.label)}};function lIo(a,i){let e={beginUpdate(){},endUpdate(){},handlePossibleChange(t){t.reportChanges()},handleChange(t,o){i(o)}};return a.addObserver(e),{dispose(){a.removeObserver(e)}}}var EWe=class extends zr{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,t,o,n,r,s,l,c,u,p);this.coverageService=h;this.tree=this._register(new me);this.sortOrder=Le("sortOrder",1)}renderBody(e){super.renderBody(e);let t=this._register(this.instantiationService.createInstance(Za,{onDidChangeVisibility:this.onDidChangeBodyVisibility}));this._register(he(o=>{let n=this.coverageService.selected.read(o);n?(this.tree.value??=this.instantiationService.createInstance(Vnt,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()}};EWe=I([m(1,_e),m(2,ze),m(3,B),m(4,X),m(5,Ri),m(6,F),m(7,Qe),m(8,De),m(9,tt),m(10,Tw)],EWe);var IGt=0,Bnt=class{constructor(i,e,t){this.uri=i;this.data=e;this.id=String(IGt++);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&&Gde(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([mi],Bnt.prototype,"attributableCoverage",1);var BRi=class{constructor(i){this.n=i;this.id=String(IGt++)}get label(){return d(15097,null,this.n)}},Hnt=class{constructor(i){this.testItem=i;this.id=String(IGt++)}get label(){return d(15096,null,this.testItem.label)}},vGt=class{constructor(){this.id=String(IGt++);this.label=d(15098,null)}},Kie=a=>typeof a=="object"&&"value"in a,bGt=a=>a instanceof Bnt,tnn=a=>Kie(a)&&a.value instanceof N5&&!!a.value.declaration?.total,Vnt=class extends C{constructor(e,t,o,n,r,s){super();this.inputDisposables=this._register(new P);e.classList.add("testing-stdtree"),this.tree=n.createInstance(PL,"TestCoverageView",e,new HRi,[n.createInstance(Uie,t),n.createInstance(zie),n.createInstance(SGt),n.createInstance(Hie)],{expandOnlyOnTwistieClick:!0,sorter:new URi(o),keyboardNavigationLabelProvider:{getCompressedNodeKeyboardNavigationLabel(l){return l.map(c=>this.getKeyboardNavigationLabel(c)).join("/")},getKeyboardNavigationLabel(l){return Kie(l)?Ra(l.value.uri):l.label}},accessibilityProvider:{getAriaLabel(l){if(Kie(l)){let c=Ra(l.value.uri);return d(15099,null,c,(l.value.tpc*100).toFixed(2))}else return l.label},getWidgetAriaLabel(){return d(15100,null)}},identityProvider:new zRi}),this._register(he(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&&tnn(c)&&(c.value.hasSynchronousDetails&&this.tree.setChildren(c,[{element:new vGt,incompressible:!0}]),c.value.details().then(u=>this.updateWithDetails(c,u)))})),this._register(this.tree.onDidOpen(l=>{let c,u;if(l.element){if(Kie(l.element)&&!l.element.children?.size)c=l.element.value.uri;else if(bGt(l.element))c=l.element.uri,u=l.element.location;else if(l.element instanceof Hnt){s.executeCommand("testing.coverageFilterToTest");return}}c&&r.openEditor({resource:c,options:{selection:u instanceof Ie?z.fromPositions(u,u):u,revealIfOpened:!0,selectionRevealType:3,preserveFocus:l.editorOptions.preserveFocus,pinned:l.editorOptions.pinned,source:1}},l.sideBySide?vn:Un)}))}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 N5)&&c.children?.size===1;)c=ht.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&&ht.map(c.children?.values(),r)}};this.inputDisposables.add(lIo(e.didAddCoverage,c=>{let u=ju(c,p=>this.tree.hasElement(p));u&&this.tree.setChildren(u,ht.map(u.children?.values()||[],r),{diffIdentityProvider:{getId:p=>p.value.id}})}));let s=ht.map(n,r),l=t&&e.result.getTestById(t.toString());l&&(s=ht.concat(ht.single({element:new Hnt(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 Bnt(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))}};Vnt=I([m(3,F),m(4,ee),m(5,ge)],Vnt);var HRi=class{getHeight(i){return 22}getTemplateId(i){if(Kie(i))return Uie.ID;if(bGt(i))return zie.ID;if(i instanceof vGt||i instanceof BRi)return SGt.ID;if(i instanceof Hnt)return Hie.ID;Hr(i)}},URi=class{constructor(i){this.order=i}compare(i,e){let t=this.order.get();if(Kie(i)&&Kie(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(bGt(i)&&bGt(e))switch(t){case 1:return Ie.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}},Hie=class{constructor(i,e){this.menuService=i;this.contextKeyService=e;this.templateId=Hie.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=R(i,_(".label")),t=this.menuService.getMenuActions(D.TestCoverageFilterItem,this.contextKeyService,{shouldForwardArgs:!0}),o=new ji(i);return o.push(hl(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}};Hie=I([m(0,qt),m(1,X)],Hie);var Uie=class{constructor(i,e,t){this.labels=i;this.labelService=e;this.instantiationService=t;this.templateId=Uie.ID}static{this.ID="F"}renderTemplate(i){let e=new P;return i.classList.add("testing-stdtree-container","test-coverage-list-item"),{container:i,bars:e.add(this.instantiationService.createInstance(rG,{compact:!1,container:i})),label:e.add(this.labels.create(i,{supportHighlights:!0})),elementsDisposables:e.add(new P),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=>Ra(s.value.uri)):Ra(n.uri);n instanceof K9e?e.bars.setCoverageInfo(void 0):(e.elementsDisposables.add(he(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:ua(t),separator:this.labelService.getSeparator(n.uri.scheme,n.uri.authority),extraClasses:["label"]})}};Uie=I([m(1,ot),m(2,F)],Uie);var zie=class{constructor(i){this.instantiationService=i;this.templateId=zie.ID}static{this.ID="N"}renderTemplate(i){let e=new P;i.classList.add("test-coverage-list-item","testing-stdtree-container");let t=R(i,_(".state")),o=R(i,_(".label"));return{container:i,bars:e.add(this.instantiationService.createInstance(rG,{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?QSo:HA.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())}};zie=I([m(0,F)],zie);var SGt=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}},zRi=class{getId(i){return Kie(i)?i.value.uri.toString():i.id}};W(class extends K{constructor(){super({id:"testing.coverageFilterToTest",category:We.Test,title:L(15101,"Filter Coverage by Test"),icon:M.filter,toggled:{icon:M.filterFilled,condition:Ji.isCoverageFilteredToTest},menu:[{id:D.CommandPalette,when:Ji.hasPerTestCoverage},{id:D.TestCoverageFilterItem,group:"inline"},{id:D.ViewTitle,when:x.and(Ji.hasPerTestCoverage,x.equals("view","workbench.view.testCoverage")),group:"navigation"}]})}run(i){let e=i.get(Tw),t=i.get(Ge),o=e.selected.get();if(!o)return;let n=[...o.allPerTestIDs()].map(Pr.fromString),r=Pr.getLengthOfCommonPrefix(n.length,p=>n[p]),s=o.result,l=e.filterToTest.get(),c=l?.toString(),u=[{label:Fie.allTests,id:void 0},{type:"separator"},...n.map(p=>({label:dGt(s,p,r),testId:p}))];t.pick(u,{activeItem:u.find(p=>"testId"in p&&p.testId?.toString()===c),placeHolder:Fie.pickShowCoverage,onDidFocus:p=>{e.filterToTest.set(p.testId,void 0)}}).then(p=>{e.filterToTest.set(p?p.testId:l,void 0)})}});W(class extends Fn{constructor(){super({id:"testing.coverageViewChangeSorting",viewId:"workbench.view.testCoverage",title:L(15102,"Change Sort Order"),icon:M.sortPrecedence,menu:{id:D.ViewTitle,when:x.equals("view","workbench.view.testCoverage"),group:"navigation",order:1}})}runInView(i,e){let t=new P,o=t.add(i.get(Ge).createQuickPick()),n=[{label:d(15106,null),value:1,description:d(15107,null)},{label:d(15104,null),value:0,description:d(15105,null)},{label:d(15108,null),value:2,description:d(15109,null)}];o.placeholder=d(15110,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 Fn{constructor(){super({id:"testing.coverageViewCollapseAll",viewId:"workbench.view.testCoverage",title:L(15103,"Collapse All Coverage"),icon:M.collapseAll,menu:{id:D.ViewTitle,when:x.equals("view","workbench.view.testCoverage"),group:"navigation",order:2}})}runInView(i,e){e.collapseAll()}});function TWe(a,i){i instanceof Pr||(i=Pr.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 inn=0,cIo=()=>String(inn++),kh=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=cIo();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:[pR.serialize(this.test)]};for(let e=this.parent;e&&e.depth>0;e=e.parent)i.tests.unshift(pR.serialize(e.test));return i}},tx=class{constructor(i,e){this.message=i;this.parent=e;this.treeId=cIo();this.children=new Set}get description(){return typeof this.message=="string"?this.message:this.message.value}},yGt={getId(a){let i=a instanceof tx?"error":a.test.expand===0?!!a.children.size:a.test.expand;return a.treeId+"\0"+i}},_We=(a,i,e)=>{let t;if(e===null){let o=[...i];if(o.length===1)return _We(a,o,o[0]);t=o}else t=e.children;return ht.map(t,o=>o instanceof tx?{element:o}:{element:o,collapsible:o.test.expand!==0,collapsed:o.test.item.error?2:TWe(a,o.test.item.extId)??o.depth>0?3:2,children:_We(a,i,o)})};var Du=We.Test;var TGt=P6.create(Ji.providerCount.key,0),dIo=L(15134,"Run Tests"),uIo=L(15115,"Debug Tests"),pIo=L(15112,"Run Tests with Coverage"),KRi=class extends K{constructor(){super({id:"testing.hideTest",title:L(15119,"Hide Test"),menu:{id:D.TestItem,group:"builtin@2",when:Ji.testItemIsHidden.isEqualTo(!1)}})}run(i,...e){let t=i.get(Es);for(let o of e)t.excluded.toggle(o.test,!0);return Promise.resolve()}},GRi=class extends K{constructor(){super({id:"testing.unhideTest",title:L(15182,"Unhide Test"),menu:{id:D.TestItem,order:21,when:Ji.testItemIsHidden.isEqualTo(!0)}})}run(i,...e){let t=i.get(Es);for(let o of e)o instanceof kh&&t.excluded.toggle(o.test,!1);return Promise.resolve()}},$Ri=class extends K{constructor(){super({id:"testing.unhideAllTests",title:L(15181,"Unhide All Tests")})}run(i){return i.get(Es).excluded.clear(),Promise.resolve()}},_Gt=(a,i)=>[{id:D.TestItem,group:"inline",order:a,when:i},{id:D.TestItem,group:"builtin@1",order:a,when:i}],Unt=class extends Fn{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(Es).runTests({tests:n,exclude:r,group:this.bitset})}},qRi=class extends Unt{constructor(){super(4,{id:"testing.debug",title:L(15113,"Debug Test"),icon:ex,menu:_Gt(12,Ji.hasDebuggableTests.isEqualTo(!0))})}},jRi=class extends Unt{constructor(){super(8,{id:"testing.coverage",title:L(15131,"Run Test with Coverage"),icon:ORi,menu:_Gt(13,Ji.hasCoverableTests.isEqualTo(!0))})}},QRi=class extends K{constructor(){super({id:"testing.runUsing",title:L(15164,"Execute Using Profile..."),icon:ex,menu:{id:D.TestItem,order:15,group:"builtin@2",when:Ji.hasNonDefaultProfile.isEqualTo(!0)}})}async run(i,...e){let t=i.get(ge),o=i.get(Es),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=>hR(n,r.test)).map(r=>r.test.item.extId)}]})}},YRi=class extends Unt{constructor(){super(2,{id:"testing.run",title:L(15130,"Run Test"),icon:uH,menu:_Gt(11,Ji.hasRunnableTests.isEqualTo(!0))})}},XRi=class extends K{constructor(){super({id:"testing.selectDefaultTestProfiles",title:L(15167,"Select Default Profile"),icon:Ant,category:Du})}async run(i,e){let t=i.get(ge),o=i.get($d),n=await t.executeCommand("vscode.pickMultipleTestProfiles",{showConfigureButtons:!1,selected:o.getGroupDefaultProfiles(e),onlyGroup:e});n?.length&&o.setGroupDefaultProfiles(e,n)}},JRi=class extends K{constructor(){super({id:"testing.toggleContinuousRunForTest",title:L(15176,"Turn on Continuous Run"),icon:Nnt,precondition:x.or(Ji.isContinuousModeOn.isEqualTo(!0),Ji.isParentRunningContinuously.isEqualTo(!1)),toggled:{condition:Ji.isContinuousModeOn.isEqualTo(!0),icon:Ont,title:d(15175,null)},menu:_Gt(2147483647,Ji.supportsContinuousRun.isEqualTo(!0))})}async run(i,...e){let t=i.get(oM);for(let o of e){let n=o.test.item.extId;if(t.isSpecificallyEnabledFor(n)){t.stop(n);continue}t.start(2,n)}}},ZRi=class extends K{constructor(){super({id:"testing.continuousRunUsingForTest",title:L(15173,"Start Continous Run Using..."),icon:ex,menu:[{id:D.TestItem,order:14,group:"builtin@2",when:x.and(Ji.supportsContinuousRun.isEqualTo(!0),Ji.isContinuousModeOn.isEqualTo(!1))}]})}async run(i,...e){let t=i.get(oM),o=i.get($d),n=i.get(Ne),r=i.get(Ge);for(let s of e){let l=await hIo(t,n,r,[{profiles:o.getControllerProfiles(s.test.controllerId)}]);l.length&&t.start(l,s.test.item.extId)}}},eMi=class extends K{constructor(){super({id:"testing.configureProfile",title:L(15140,"Configure Test Profiles"),icon:Ant,f1:!0,category:Du,menu:{id:D.CommandPalette,when:Ji.hasConfigurableProfile.isEqualTo(!0)}})}async run(i,e){let t=i.get(ge),o=i.get($d),n=await t.executeCommand("vscode.pickTestProfile",{placeholder:d(15111,null),showConfigureButtons:!1,onlyConfigurable:!0,onlyGroup:e});n&&o.configure(n.controllerId,n.profileId)}},mIo=a=>[{id:D.ViewTitle,group:"navigation",order:15,when:x.and(x.equals("view","workbench.view.testing"),Ji.supportsContinuousRun.isEqualTo(!0),Ji.isContinuousModeOn.isEqualTo(a))},{id:D.CommandPalette,when:Ji.supportsContinuousRun.isEqualTo(!0)}],tMi=class extends K{constructor(){super({id:"testing.stopContinuousRun",title:L(15174,"Stop Continuous Run"),category:Du,icon:mGt,menu:mIo(!0)})}run(i){i.get(oM).stop()}};function hIo(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(15153,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:bMt[p.profile.group]}),n.push(p),s.has(p.profile.profileId)&&r.push(p)}let l=new P,c=l.add(e.createQuickPick({useSeparators:!0}));return c.title=d(15166,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 iMi=class extends K{constructor(){super({id:"testing.startContinuousRun",title:L(15172,"Start Continuous Run"),category:Du,icon:Nnt,menu:mIo(!1)})}async run(i){let e=i.get(oM),o=[...i.get($d).all()].flatMap(r=>r.profiles.filter(s=>e.lastRunProfileIds.has(s.profileId)));if(o.length)return e.start(o);let n=await hIo(e,i.get(Ne),i.get(Ge),i.get($d).all());n.length&&e.start(n)}},znt=class extends Fn{constructor(e,t){super({...e,menu:[{id:D.ViewTitle,order:t===2?11:t===4?12:13,group:"navigation",when:x.and(x.equals("view","workbench.view.testing"),Ji.isRunning.isEqualTo(!1),Ji.capabilityToContextKey[t].isEqualTo(!0))}],category:Du,viewId:"workbench.view.testing"});this.group=t}runInView(e,t){let{include:o,exclude:n}=t.getTreeIncludeExclude(this.group);return e.get(Es).runTests({tests:o,exclude:n,group:this.group})}},oMi=class extends K{constructor(){super({id:"testing.getSelectedProfiles",title:L(15118,"Get Selected Profiles")})}run(i){let e=i.get($d);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}))}},nMi=class extends Fn{constructor(){super({id:"_testing.getExplorerSelection",title:L(15117,"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)}}},rMi=class extends znt{constructor(){super({id:"testing.runSelected",title:dIo,icon:z8},2)}},sMi=class extends znt{constructor(){super({id:"testing.debugSelected",title:uIo,icon:_ge},4)}},aMi=class extends znt{constructor(){super({id:"testing.coverageSelected",title:pIo,icon:GSo},8)}},gIo=(a,i)=>a.withProgress({location:10,title:d(15116,null)},()=>i),Knt=class extends K{constructor(e,t,o){super({...e,category:Du,menu:[{id:D.CommandPalette,when:Ji.capabilityToContextKey[t].isEqualTo(!0)}]});this.group=t;this.noTestsFoundError=o}async run(e){let t=e.get(Es),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})}},lMi=class extends Knt{constructor(){super({id:"testing.runAll",title:L(15132,"Run All Tests"),icon:z8,keybinding:{weight:200,primary:Ai(2133,31)}},2,d(15124,null))}},cMi=class extends Knt{constructor(){super({id:"testing.debugAll",title:L(15114,"Debug All Tests"),icon:ex,keybinding:{weight:200,primary:Ai(2133,2079)}},4,d(15121,null))}},dMi=class extends Knt{constructor(){super({id:"testing.coverageAll",title:L(15133,"Run All Tests with Coverage"),icon:ORi,keybinding:{weight:200,primary:Ai(2133,3103)}},8,d(15120,null))}},uMi=class extends K{constructor(){super({id:"testing.cancelRun",title:L(15135,"Cancel Test Run"),icon:pGt,category:Du,keybinding:{weight:200,primary:Ai(2133,2102)},menu:[{id:D.ViewTitle,order:11,group:"navigation",when:x.and(x.equals("view","workbench.view.testing"),x.equals(Ji.isRunning.serialize(),!0))},{id:D.CommandPalette,when:Ji.isRunning}]})}async run(i,e,t){let o=i.get(ed),n=i.get(Es);if(e)n.cancelTestRun(e,t);else for(let r of o.results)r.completedAt||n.cancelTestRun(r.id)}},pMi=class extends Fn{constructor(){super({id:"testing.viewAsList",viewId:"workbench.view.testing",title:L(15179,"View as List"),toggled:Ji.viewMode.isEqualTo("list"),menu:{id:D.ViewTitle,order:18,group:"viewAs",when:x.equals("view","workbench.view.testing")}})}runInView(i,e){e.viewModel.viewMode="list"}},mMi=class extends Fn{constructor(){super({id:"testing.viewAsTree",viewId:"workbench.view.testing",title:L(15180,"View as Tree"),toggled:Ji.viewMode.isEqualTo("true"),menu:{id:D.ViewTitle,order:18,group:"viewAs",when:x.equals("view","workbench.view.testing")}})}runInView(i,e){e.viewModel.viewMode="true"}},hMi=class extends Fn{constructor(){super({id:"testing.sortByStatus",viewId:"workbench.view.testing",title:L(15171,"Sort by Status"),toggled:Ji.viewSorting.isEqualTo("status"),menu:{id:D.ViewTitle,order:19,group:"sortBy",when:x.equals("view","workbench.view.testing")}})}runInView(i,e){e.viewModel.viewSorting="status"}},gMi=class extends Fn{constructor(){super({id:"testing.sortByLocation",viewId:"workbench.view.testing",title:L(15170,"Sort by Location"),toggled:Ji.viewSorting.isEqualTo("location"),menu:{id:D.ViewTitle,order:19,group:"sortBy",when:x.equals("view","workbench.view.testing")}})}runInView(i,e){e.viewModel.viewSorting="location"}},fMi=class extends Fn{constructor(){super({id:"testing.sortByDuration",viewId:"workbench.view.testing",title:L(15169,"Sort by Duration"),toggled:Ji.viewSorting.isEqualTo("duration"),menu:{id:D.ViewTitle,order:19,group:"sortBy",when:x.equals("view","workbench.view.testing")}})}runInView(i,e){e.viewModel.viewSorting="duration"}},vMi=class extends K{constructor(){super({id:"testing.showMostRecentOutput",title:L(15168,"Show Output"),category:Du,icon:M.terminal,keybinding:{weight:200,primary:Ai(2133,2093)},precondition:Ji.hasAnyResults.isEqualTo(!0),menu:[{id:D.ViewTitle,order:16,group:"navigation",when:x.equals("view","workbench.view.testing")},{id:D.CommandPalette,when:Ji.hasAnyResults.isEqualTo(!0)}]})}async run(i){(await i.get(Ft).openView("workbench.panel.testResults.view",!0))?.showLatestRun()}},bMi=class extends Fn{constructor(){super({id:"testing.collapseAll",viewId:"workbench.view.testing",title:L(15139,"Collapse All Tests"),icon:M.collapseAll,menu:{id:D.ViewTitle,order:16,group:"displayAction",when:x.equals("view","workbench.view.testing")}})}runInView(i,e){e.viewModel.collapseAll()}},SMi=class extends K{constructor(){super({id:"testing.clearTestResults",title:L(15138,"Clear All Results"),category:Du,icon:M.clearAll,menu:[{id:D.TestPeekTitle},{id:D.CommandPalette,when:Ji.hasAnyResults.isEqualTo(!0)},{id:D.ViewTitle,order:17,group:"displayAction",when:x.equals("view","workbench.view.testing")},{id:D.ViewTitle,order:17,group:"navigation",when:x.equals("view","workbench.panel.testResults.view")}]})}run(i){i.get(ed).clear()}},IMi=class extends K{constructor(){super({id:"testing.editFocusedTest",title:L(15149,"Go to Test"),icon:M.goToFile,menu:{id:D.TestItem,group:"builtin@1",order:20,when:Ji.testItemHasUri.isEqualTo(!0)},keybinding:{weight:90,when:Vl.isEqualTo("workbench.view.testing"),primary:515}})}async run(i,e,t){e||(e=i.get(Ft).getActiveViewWithId("workbench.view.testing")?.focusedTreeElements[0]),e&&e instanceof kh&&i.get(ge).executeCommand("vscode.revealTest",e.test.item.extId,t)}};async function fIo(a,i,e,t,o){let n=[],r,s=[],l;for await(let c of qde(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=>Pr.isChild(h.item.extId,u.item.extId))||n.push(u):(r=p,n=[u]):Ie.isBefore(p.getStartPosition(),t)&&(!l||l.getStartPosition().isBefore(p.getStartPosition())?(l=p,s=[u]):p.equalsRange(l)&&!s.some(h=>Pr.isChild(h.item.extId,u.item.extId))&&s.push(u))}return n.length?n:s}var Gnt=class extends K{constructor(e,t){super({...e,menu:[{id:D.CommandPalette,when:TGt},{id:D.EditorContext,group:"testing",order:t===2?0:1,when:x.and(Ji.activeEditorHasTests,Ji.capabilityToContextKey[t])}]});this.group=t}async run(e){let t=e.get(Kt),o=e.get(ee),n=o.activeEditorPane,r=t.getActiveCodeEditor();if(!n||!r)return;r instanceof zc&&(r=r.getParentEditor());let s=r?.getPosition(),l=r?.getModel();if(!s||!l||!("uri"in l))return;let c=e.get(Es),u=e.get($d),p=e.get(dt),h=e.get(Bo),g=e.get(B);Lp(g,"testing.saveBeforeTest")&&(await o.save({editor:n.input,groupId:n.group.id}),await c.syncTests());let v=await gIo(h,fIo(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&&iu.get(r)?.showMessage(d(15126,null),s)}},yMi=class extends Gnt{constructor(){super({id:"testing.runAtCursor",title:L(15162,"Run Test at Cursor"),category:Du,keybinding:{weight:200,when:ue.editorTextFocus,primary:Ai(2133,33)}},2)}},wMi=class extends Gnt{constructor(){super({id:"testing.debugAtCursor",title:L(15144,"Debug Test at Cursor"),category:Du,keybinding:{weight:200,when:ue.editorTextFocus,primary:Ai(2133,2081)}},4)}},CMi=class extends Gnt{constructor(){super({id:"testing.coverageAtCursor",title:L(15141,"Run Test at Cursor with Coverage"),category:Du,keybinding:{weight:200,when:ue.editorTextFocus,primary:Ai(2133,3105)}},8)}},$nt=class extends K{constructor(e,t){super({...e,menu:[{id:D.ExplorerContext,when:Ji.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(Es),n=e.get(Ne),r=await ht.asyncToArray(eio(o,e.get(dt),t));if(!r.length){n.notify({message:d(15125,null),severity:St.Info});return}return o.runTests({tests:r,group:this.group})}},xMi=class extends $nt{constructor(){super({id:"testing.run.uri",title:dIo,category:Du},2)}},kMi=class extends $nt{constructor(){super({id:"testing.debug.uri",title:uIo,category:Du},4)}},EMi=class extends $nt{constructor(){super({id:"testing.coverage.uri",title:pIo,category:Du},8)}},qnt=class extends K{constructor(e,t){super({...e,menu:[{id:D.CommandPalette,when:Ji.capabilityToContextKey[t].isEqualTo(!0)},{id:D.EditorContext,group:"testing",order:t===2?2:3,when:x.and(Ji.activeEditorHasTests,Ji.capabilityToContextKey[t])}]});this.group=t}async _runByUris(e,t){let o=e.get(dt),n=e.get(Es),r=[];for(let s of t)for await(let l of qde(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(dt),n=e.get(Kt).getActiveCodeEditor();if(!n)return;n instanceof zc&&(n=n.getParentEditor());let r=n?.getPosition(),s=n?.getModel();if(!r||!s||!("uri"in s))return;let l=e.get(Es),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&&iu.get(n)?.showMessage(d(15127,null),r)}},TMi=class extends qnt{constructor(){super({id:"testing.runCurrentFile",title:L(15163,"Run Tests in Current File"),category:Du,keybinding:{weight:200,when:ue.editorTextFocus,primary:Ai(2133,36)}},2)}},_Mi=class extends qnt{constructor(){super({id:"testing.debugCurrentFile",title:L(15145,"Debug Tests in Current File"),category:Du,keybinding:{weight:200,when:ue.editorTextFocus,primary:Ai(2133,2084)}},4)}},DMi=class extends qnt{constructor(){super({id:"testing.coverageCurrentFile",title:L(15142,"Run Tests with Coverage in Current File"),category:Du,keybinding:{weight:200,when:ue.editorTextFocus,primary:Ai(2133,3108)}},8)}},Xnt=async(a,i,e,t)=>{let o=Promise.all(e.map(r=>Zto(a,r))),n=(await gIo(i,o)).filter(mo);return n.length?await t(n):void 0},LMi=class extends K{async run(i,...e){let t=i.get(Es);await Xnt(i.get(Es).collection,i.get(Bo),[...this.getTestExtIdsToRun(i,...e)],o=>this.runTest(t,o))}},wGt=class extends LMi{constructor(i){super({...i,menu:{id:D.CommandPalette,when:TGt}})}getTestExtIdsToRun(i){let{results:e}=i.get(ed),t=new Set;for(let o=e.length-1;o>=0;o--){let n=e[o];for(let r of n.tests)ak(r.ownComputedState)?t.add(r.item.extId):t.delete(r.item.extId)}return t}},jnt=class extends K{constructor(i){super({...i,menu:{id:D.CommandPalette,when:x.and(TGt,Ji.hasAnyResults.isEqualTo(!0))}})}getLastTestRunRequest(i,e){let t=i.get(ed);return(e?t.results.find(n=>n.id===e):t.results[0])?.request}async run(i,e){let t=i.get(ed),o=e?t.results.find(c=>c.id===e):t.results[0];if(!o)return;let n=o.request,r=i.get(Es),s=i.get($d),l=c=>s.getControllerProfiles(c.controllerId).some(u=>u.profileId===c.profileId);await Xnt(r.collection,i.get(Bo),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()}))}},RMi=class extends wGt{constructor(){super({id:"testing.reRunFailTests",title:L(15160,"Rerun Failed Tests"),category:Du,keybinding:{weight:200,primary:Ai(2133,35)}})}runTest(i,e){return i.runTests({group:2,tests:e})}},MMi=class extends wGt{constructor(){super({id:"testing.debugFailTests",title:L(15147,"Debug Failed Tests"),category:Du,keybinding:{weight:200,primary:Ai(2133,2083)}})}runTest(i,e){return i.runTests({group:4,tests:e})}},Qnt=class extends jnt{constructor(){super({id:"testing.reRunLastRun",title:L(15161,"Rerun Last Run"),category:Du,keybinding:{weight:200,primary:Ai(2133,42)}})}getGroup(){return 2}},Ynt=class extends jnt{constructor(){super({id:"testing.debugLastRun",title:L(15148,"Debug Last Run"),category:Du,keybinding:{weight:200,primary:Ai(2133,2090)}})}getGroup(){return 4}},PMi=class extends jnt{constructor(){super({id:"testing.coverageLastRun",title:L(15143,"Rerun Last Run with Coverage"),category:Du,keybinding:{weight:200,primary:Ai(2133,3114)}})}getGroup(){return 8}},CGt=class extends K{constructor(i){super({...i,menu:{id:D.CommandPalette,when:x.and(TGt,Ji.hasAnyResults.isEqualTo(!0))}})}async run(i,e){let t=i.get(ed),o=i.get(Es),n=i.get(Bo),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)ak(l.ownComputedState)&&s.add(l.item.extId);s.size!==0&&await Xnt(o.collection,n,Array.from(s),l=>o.runTests({tests:l,group:this.getGroup()}))}},AMi=class extends CGt{constructor(){super({id:"testing.reRunFailedFromLastRun",title:L(15159,"Rerun Failed Tests from Last Run"),category:Du})}getGroup(){return 2}},NMi=class extends CGt{constructor(){super({id:"testing.debugFailedFromLastRun",title:L(15146,"Debug Failed Tests from Last Run"),category:Du})}getGroup(){return 4}},OMi=class extends K{constructor(){super({id:"testing.searchForTestExtension",title:L(15165,"Search for Test Extension")})}async run(i){i.get(zi).openSearch('@category:"testing"')}},FMi=class extends K{constructor(){super({id:"testing.openOutputPeek",title:L(15155,"Peek Output"),category:Du,keybinding:{weight:200,primary:Ai(2133,2091)},menu:{id:D.CommandPalette,when:Ji.hasAnyResults.isEqualTo(!0)}})}async run(i){i.get(RD).open()}},WMi=class extends K{constructor(){super({id:"testing.toggleInlineTestOutput",title:L(15177,"Toggle Inline Test Output"),category:Du,keybinding:{weight:200,primary:Ai(2133,2087)},menu:{id:D.CommandPalette,when:Ji.hasAnyResults.isEqualTo(!0)}})}async run(i){let e=i.get(Es);e.showInlineOutput.value=!e.showInlineOutput.value}},vIo=a=>[{id:D.TestItem,group:"inline",order:10,when:x.and(Ji.canRefreshTests.isEqualTo(!0),Ji.isRefreshingTests.isEqualTo(a))},{id:D.ViewTitle,group:"navigation",order:10,when:x.and(x.equals("view","workbench.view.testing"),Ji.canRefreshTests.isEqualTo(!0),Ji.isRefreshingTests.isEqualTo(a))},{id:D.CommandPalette,when:Ji.canRefreshTests.isEqualTo(!0)}],VMi=class extends K{constructor(){super({id:"testing.refreshTests",title:L(15158,"Refresh Tests"),category:Du,icon:qSo,keybinding:{weight:200,primary:Ai(2133,2096),when:Ji.canRefreshTests.isEqualTo(!0)},menu:vIo(!1)})}async run(i,...e){let t=i.get(Es),o=i.get(Bo),n=Uo(e.filter(mo).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()})}},BMi=class extends K{constructor(){super({id:"testing.cancelTestRefresh",title:L(15136,"Cancel Test Refresh"),category:Du,icon:jSo,menu:vIo(!0)})}async run(i){i.get(Es).cancelRefreshTests()}},HMi=class extends K{constructor(){super({id:"testing.coverage.close",title:L(15137,"Clear Coverage"),icon:lE,category:Du,menu:[{id:D.ViewTitle,group:"navigation",order:10,when:x.equals("view","workbench.view.testCoverage")},{id:D.CommandPalette,when:Ji.isTestCoverageOpen.isEqualTo(!0)}]})}run(i){i.get(Tw).closeCoverage()}},UMi=class extends K{constructor(){super({id:"testing.openCoverage",title:L(15154,"Open Coverage"),category:Du,menu:[{id:D.CommandPalette,when:Ji.hasAnyResults.isEqualTo(!0)}]})}run(i){let e=i.get(ed).results,t=e.length&&e[0].tasks.find(o=>o.coverage);if(!t){i.get(Ne).info(d(15152,null));return}i.get(Tw).openCoverage(t,!0)}},xGt=class extends mO{runEditorCommand(i,e,...t){return this.testService=i.get(Es),this.uriIdentityService=i.get(dt),super.runEditorCommand(i,e,...t)}_getAlternativeCommand(i){return i.getOption(67).alternativeTestsCommand}_getGoToPreference(i){return i.getOption(67).multipleTests||"peek"}},kGt=class extends xGt{async _getLocationModel(i,e,t,o){let n=await this.testService.getTestsRelatedToCode(e.uri,t,o);return new ew(n.map(r=>r.item.uri&&{uri:r.item.uri,range:r.item.range||new z(1,1,1,1)}).filter(mo),d(15129,null))}_getNoResultFoundMessage(){return d(15123,null)}},zMi=class extends kGt{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:"testing.goToRelatedTest",title:L(15151,"Go to Related Test"),category:Du,precondition:x.and(x.not(Ji.activeEditorHasTests.key),Ji.canGoToRelatedTest),menu:[{id:D.EditorContext,group:"testing",order:4}]})}},KMi=class extends kGt{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"testing.peekRelatedTest",title:L(15157,"Peek Related Test"),category:Du,precondition:x.and(Ji.canGoToRelatedTest,x.not(Ji.activeEditorHasTests.key),Gh.notInPeekEditor,ue.isInEmbeddedEditor.toNegated()),menu:[{id:D.EditorContext,group:"testing",order:5}]})}},EGt=class extends xGt{async _getLocationModel(i,e,t,o){let n=await fIo(this.testService,this.uriIdentityService,e.uri,t),r=await Promise.all(n.map(s=>this.testService.getCodeRelatedToTest(s)));return new ew(r.flat(),d(15128,null))}_getNoResultFoundMessage(){return d(15122,null)}},GMi=class extends EGt{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:"testing.goToRelatedCode",title:L(15150,"Go to Related Code"),category:Du,precondition:x.and(Ji.activeEditorHasTests,Ji.canGoToRelatedCode),menu:[{id:D.EditorContext,group:"testing",order:4}]})}},$Mi=class extends EGt{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"testing.peekRelatedCode",title:L(15156,"Peek Related Code"),category:Du,precondition:x.and(Ji.activeEditorHasTests,Ji.canGoToRelatedCode,Gh.notInPeekEditor,ue.isInEmbeddedEditor.toNegated()),menu:[{id:D.EditorContext,group:"testing",order:5}]})}},qMi=class extends K{constructor(){super({id:"testing.toggleResultsViewLayout",title:L(15178,"Toggle Tree Position"),category:Du,icon:M.arrowSwap,menu:{id:D.ViewTitle,order:18,group:"navigation",when:x.equals("view","workbench.panel.testResults.view")}})}async run(i){let e=i.get(B),o=Lp(e,"testing.resultsView.layout")==="treeLeft"?"treeRight":"treeLeft";await e.updateValue("testing.resultsView.layout",o)}},bIo=[BMi,uMi,HMi,SMi,bMi,eMi,JRi,ZRi,jRi,dMi,CMi,DMi,PMi,aMi,EMi,qRi,cMi,wMi,_Mi,MMi,Ynt,sMi,kMi,nMi,oMi,GMi,zMi,IMi,KRi,UMi,FMi,$Mi,KMi,VMi,RMi,Qnt,YRi,lMi,yMi,TMi,rMi,xMi,QRi,OMi,XRi,vMi,iMi,tMi,fMi,gMi,hMi,pMi,mMi,WMi,qMi,$Ri,GRi,AMi,NMi];function SIo(a,{onlyGroup:i,showConfigureButtons:e=!0,onlyForTest:t,onlyConfigurable:o,placeholder:n=d(15190,null)}){let r=a.get($d),s=[],l=(u,p)=>{for(let h of Pg(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:bMt[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(Ant),tooltip:d(15191,null)}]:[]}))}};if(t!==void 0)l(r.getControllerProfiles(t.controllerId).filter(u=>hR(u,t)));else for(let{profiles:u,controller:p}of r.all())l(u,p.label.get());let c=a.get(Ge).createQuickPick({useSeparators:!0});return c.items=s,c.placeholder=n,c}var IIo=(a,i)=>e=>{let t=e.item.profile;t&&(a.configure(t.controllerId,t.profileId),i(void 0))};qe.registerCommand({id:"vscode.pickMultipleTestProfiles",handler:async(a,i)=>{let e=a.get($d),t=SIo(a,i);if(!t)return;let o=new P;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(mo))})),o.add(t.onDidHide(()=>r(void 0))),o.add(t.onDidTriggerItemButton(IIo(e,r))),t.show()});return o.dispose(),n}});qe.registerCommand({id:"vscode.pickTestProfile",handler:async(a,i)=>{let e=a.get($d),t=SIo(a,i);if(!t)return;let o=new P;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(IIo(e,r))),t.show()});return o.dispose(),n}});var DWe=(a,i)=>{if(!a)return[];let e=Pr.fromString(a.item.extId);return[[Ji.testItemExtId.key,e.localId],[Ji.controllerId.key,a.controllerId],[Ji.testItemHasUri.key,!!a.item.uri],...SMt(i)]};var nnn=/^\x1b\[([0-9]+)m$/;var Lge=a=>typeof a=="string"?CS(a):qa(a),yIo=(a,i)=>{let e=[];return i.changeDecorations(t=>{let o=new Ie(1,1),n=[];for(let r of u1i(a))if(r.isCode){let s=nnn.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 d$(r.str);for(let p=0;!c.eol();p+=c.nextGraphemeLength())r.str[p]===`
`?(s++,l=1):l++;let u=new Ie(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 jMi=(a,i)=>({$mid:18,test:pR.serialize(a),message:XO.serialize(i)}),wIo=a=>a instanceof Rm&&!!a.stack?.length,Rm=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=LD({...r,type:4}),this.actualUri=LD({...r,type:3}),this.messageUri=LD({...r,type:2});let s=this.message=n[this.messageIndex];this.context=jMi(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 Pr.root(this.test.extId)}get isDiffable(){return this.message.type===0&&XO.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=LD({resultId:i.id,taskIndex:e,type:0})}get controllerId(){return this.result.tasks[this.taskIndex].ctrlId}},vS=class{constructor(i,e,t){this.result=i;this.taskIndex=e;this.test=t;this.outputUri=LD({resultId:this.result.id,taskIndex:this.taskIndex,testExtId:this.test.item.extId,type:1}),this.task=i.tasks[this.taskIndex]}get controllerId(){return Pr.root(this.test.item.extId)}},CIo=(a,i)=>a instanceof Rm&&i instanceof Rm&&a.message===i.message||a instanceof fS&&i instanceof fS&&a.result===i.result&&a.taskIndex===i.taskIndex||a instanceof vS&&i instanceof vS&&a.test===i.test&&a.taskIndex===i.taskIndex,LWe=(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}}},xIo=a=>{if(a instanceof Rm)return a.test;if(!(a instanceof fS))return a.test.item};var MD=class extends Hu{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){Nu(this._overwriteOptions,i,!0),super.updateOptions(this._overwriteOptions)}};MD=I([m(4,X),m(5,F),m(6,Kt),m(7,tr),m(8,rd)],MD);var jie=class{constructor(i,e,t=1,o=1){this.name=i;this.source=e;this.line=t;this.column=o}},AWe=class{constructor(i,e){this.label=i;this.load=e}},Znt=class{constructor(){this.showHeader=Le("CustomStackFrame.showHeader",!0)}},DGt=class extends jie{constructor(e){super(e.name,e.source,e.line,e.column);this.editorHeight=Le("WrappedCallStackFrame.height",this.source?100:0);this.collapsed=Le("WrappedCallStackFrame.collapsed",!1);this.height=Ce(e=>this.collapsed.read(e)?NWe:NWe+this.editorHeight.read(e))}},Rge=class{constructor(i){this.original=i;this.collapsed=Le("WrappedCallStackFrame.collapsed",!1);this.height=Ce(i=>{let e=this.original.showHeader.read(i)?NWe:0;return this.collapsed.read(i)?e:e+this.original.height.read(i)})}},rnn=a=>a instanceof DGt||a instanceof Rge,kIo="multiCallStackWidget",RWe=class extends C{constructor(e,t,o){super();this.layoutEmitter=this._register(new E);this.currentFramesDs=this._register(new P);e.classList.add(kIo),this._register(Z(()=>e.classList.remove(kIo))),this.list=this._register(o.createInstance(Rl,"TestResultStackWidget",e,new QMi,[o.createInstance(Gie,t,this.layoutEmitter.event),o.createInstance($ie),o.createInstance(LGt),o.createInstance(qie,n=>this.loadFrame(n))],{multipleSelectionSupport:!1,mouseSupport:!1,keyboardSupport:!1,setRowLineHeight:!1,alwaysConsumeMouseWheel:!1,accessibilityProvider:o.createInstance(Jnt)}))}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 $e;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(){Ui(e=>{for(let t=0;t<this.list.length;t++){let o=this.list.element(t);rnn(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 AWe){t.push(o);continue}let n=o instanceof Znt?new Rge(o):new DGt(o);t.push(n),this.currentFramesDs.add(he(r=>{let s=n.height.read(r),l=this.list.indexOf(n);l!==-1&&this.list.updateElementHeight(l,s)}))}return t}};RWe=I([m(2,F)],RWe);var Jnt=class{constructor(i){this.labelService=i}getAriaLabel(i){if(i instanceof AWe)return i.label;if(i instanceof Rge)return i.original.label;if(i instanceof jie)return i.source&&i.line?d(8729,null,i.name,i.line,this.labelService.getUriLabel(i.source,{relative:!0})):i.name;Hr(i)}getWidgetAriaLabel(){return d(8728,null)}};Jnt=I([m(0,ot)],Jnt);var QMi=class{getHeight(i){if(i instanceof jie||i instanceof Rge)return i.height.get();if(i instanceof AWe)return NWe;Hr(i)}getTemplateId(i){if(i instanceof jie)return i.source?Gie.templateId:$ie.templateId;if(i instanceof AWe)return qie.templateId;if(i instanceof Rge)return LGt.templateId;Hr(i)}},EIo={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},_Io=()=>bt("div.multiCallStackFrame",[bt("div.header@header",[bt("div.collapse-button@collapseButton"),bt("div.title.show-file-icons@title"),bt("div.actions@actions")]),bt("div.editorParent",[bt("div.editorContainer@editor")])]),NWe=24,MWe=class{constructor(i){this.instantiationService=i}renderTemplate(i){let e=_Io();i.appendChild(e.root);let t=new P;i.classList.add("multiCallStackFrameContainer"),t.add(Z(()=>{i.classList.remove("multiCallStackFrameContainer"),e.root.remove()}));let o=t.add(this.instantiationService.createInstance(rk,e.title,{})),n=t.add(new Mi(e.collapseButton,{})),r=_t();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 P),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(he(r=>{o.element.className="";let s=i.collapsed.read(r);o.icon=s?M.chevronRight:M.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()}};MWe=I([m(0,F)],MWe);var TIo=2,Gie=class extends MWe{constructor(e,t,o,n){super(n);this.containingEditor=e;this.onLayout=t;this.modelService=o;this.templateId=Gie.templateId}static{this.templateId="f"}finishRenderTemplate(e){let t=[{id:PWe.ID,instantiation:2,ctor:PWe}],o=this.containingEditor?this.instantiationService.createInstance(zc,e.elements.editor,EIo,{isSimpleWidget:!0,contributions:t},this.containingEditor):this.instantiationService.createInstance(jr,e.elements.editor,EIo,{isSimpleWidget:!0,contributions:t});e.templateStore.add(o);let n=e.templateStore.add(this.instantiationService.createInstance(Ln,e.elements.actions,D.DebugCallStackToolbar,{menuOptions:{shouldForwardArgs:!0},actionViewItemProvider:(r,s)=>Ca(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 $e;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-TIo-1)}),z.fromPositions({column:1,lineNumber:e.line+TIo+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,cTi(!s))),t.decorations.push(n.addDecoration(l,lTi))}),e.editorHeight.set(t.editor.getContentHeight(),void 0)}};Gie=I([m(2,Nt),m(3,F)],Gie);var $ie=class{constructor(i){this.instantiationService=i;this.templateId=$ie.templateId}static{this.templateId="m"}renderTemplate(i){let e=_Io();e.root.classList.add("missing"),i.appendChild(e.root);let t=this.instantiationService.createInstance(rk,e.title,{});return{elements:e,label:t}}renderElement(i,e,t){let o=i;t.label.element.setResource({name:o.name,description:d(8727,null,o.line,o.column),range:{startLineNumber:o.line,startColumn:o.column,endColumn:o.column,endLineNumber:o.line}},{icon:M.fileBinary})}disposeTemplate(i){i.label.dispose(),i.elements.root.remove()}};$ie=I([m(0,F)],$ie);var LGt=class a extends MWe{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(he(u=>{o.elements.header.style.display=n.original.showHeader.read(u)?"":"none"})),r.add(Ga((u,p)=>{n.collapsed.read(u)||p.add(n.original.render(s))}));let c=n.original.renderActions?.(o.elements.actions);c&&r.add(c)}},qie=class{constructor(i,e){this.loadFrames=i;this.notificationService=e;this.templateId=qie.templateId}static{this.templateId="s"}renderTemplate(i){let e=new P,t=new Mi(i,{title:"",...Ko}),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(8725,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()}};qie=I([m(1,Ne)],qie);var PWe=class extends C{constructor(e,t){super();this.editor=e;this.linkDecorations=e.createDecorationsCollection(),this._register(Z(()=>this.linkDecorations.clear()));let o=this._register(new sO(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 Ie(this.current.line,this.current.word.startColumn)),selectionRevealType:1}},n.hasSideBySideModifier?vn: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}};PWe=I([m(1,ee)],PWe);W(class extends K{constructor(){super({id:"callStackWidget.goToFile",title:L(8726,"Open File"),icon:M.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 Pk(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 ert=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 LIo(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;for(let n=i;n<e;n++)o=this._xterm.buffer.active.getLine(n),o&&(t+=o.translateToString(!o.isWrapped)+(o.isWrapped?"":`
`));return 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=Ae(n)?1:i.length||snn(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(DIo(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(DIo(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 RIo(this,this._xterm.buffer.active)}getCommandRowCount(){return MIo(this)}},trt=class{constructor(i,e){this._xterm=i;this.id=e??_t()}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 ert(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 LIo(this._xterm.buffer.active,this._xterm.cols,this.commandStartMarker,this.commandStartX,this.commandExecutedMarker,this.commandExecutedX)}getPromptRowCount(){return RIo(this,this._xterm.buffer.active)}getCommandRowCount(){return MIo(this)}};function LIo(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 DIo(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 snn(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 RIo(a,i){let e=_w(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 MIo(a){let i=_w(a)?a.marker:a.commandStartMarker,e=_w(a)?a.executedMarker:a.commandExecutedMarker;if(!i||!e)return 1;let o=Math.max(e.line,i.line)-i.line+1;return(_w(a)?a.executedX:a.commandExecutedX)===0&&o--,o}function _w(a){return!!a.hasOutput}var OWe=class extends C{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=si(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&&Ue(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(irt(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(irt(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(Qie(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&&PIo(e))return e;{let o=this._terminal?.registerMarker(-this._terminal.buffer.active.cursorY+Qie(e)-this._terminal.buffer.active.baseY+t);if(o)return o;throw new Error(`Could not register marker with offset ${Qie(e)}, ${t}`)}}revealCommand(e,t=1){let o=_w(e)?e.marker:e.commandStartMarker;if(!this._terminal||!o)return;let n=Qie(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(ty.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 P;if(!e.executedMarker||!e.endMarker)return;let o=e.marker.line-(e.getPromptRowCount()-1),n=Qie(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(uDt),r=Qie(e),s=t?Qie(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=`-${Me(this._terminal.element).getComputedStyle(this._terminal.element).paddingLeft}`)}),c.onDispose(()=>{this._navigationDecorations=this._navigationDecorations?.filter(p=>p!==c)}),o&&Pi(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=Qie(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),RGt(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),RGt(this._terminal,this._currentMarker,this._selectionStart))}selectToPreviousLine(){this._terminal&&(this._selectionStart===null&&(this._selectionStart=this._currentMarker),this.scrollToPreviousLine(this._terminal,1,!0),RGt(this._terminal,this._currentMarker,this._selectionStart))}selectToNextLine(){this._terminal&&(this._selectionStart===null&&(this._selectionStart=this._currentMarker),this.scrollToNextLine(this._terminal,1,!0),RGt(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=irt(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}};OWe=I([m(1,B),m(2,De)],OWe);function irt(a,i){return i===1?a.buffer.active.baseY+a.rows-1:i===0?0:i.line}function RGt(a,i,e){e===null&&(e=1);let t=irt(a,i),o=irt(a,e);if(t>o){let n=t;t=o,o=n}o-=1,a.selectLines(t,o)}function PIo(a){return typeof a!="number"}function Qie(a){return PIo(a)?a.line:a}var Mge=class extends C{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(H.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([OM(0)],Mge.prototype,"_sync",1),Mge=I([m(5,ne)],Mge);var Pge=class extends C{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 trt(this._terminal),this._promptInputModel=this._register(new Mge(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",_w(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 $ut(new ort(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 _w(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 Age)){let t=this;this._ptyHeuristics.value=new Age(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 ort)&&(this._ptyHeuristics.value=new ort(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&&_w(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=nrt(this._terminal,t.executedMarker,1)),this._currentCommand.promptStartMarker=e?.marker||(!this._currentCommand.wasCleared&&t?.endMarker?nrt(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 trt(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 Age,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=ert.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([Nd(500)],Pge.prototype,"_handleCursorMove",1),Pge=I([m(1,ne)],Pge);var ort=class extends C{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 Age=class extends C{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?nrt(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=Ae(n)?n:n.prompt;if(this._capability.currentCommand.commandStartMarker=this._terminal.registerMarker(0),!Ae(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=nrt(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=nrt(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}};Age=I([m(3,ne)],Age);function YMi(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(AIo(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(AIo(a,p,h,e)),c.length===l&&c.shift()}return c}function AIo(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 nrt(a,i,e=0){return a.registerMarker(i.line-(a.buffer.active.baseY+a.buffer.active.cursorY)+e)}var PGt=class extends C{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 AGt=class extends P{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 NGt=class extends C{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 XMi(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 NIo(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 rrt(a){return a.match(/^['"].*['"]$/)&&(a=a.substring(1,a.length-1)),zo===1&&a&&a[1]===":"?a[0].toUpperCase()+a.substring(1):a}function OGt(a){return!a.strictEnv}var FGt=class extends C{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(!uo(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,!mre(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 WGt=class extends C{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 VGt=class extends C{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 jC);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(){Ue(this._commonProtocolDisposables),this._commonProtocolDisposables.length=0}activate(e){this._terminal=e,this.capabilities.add(3,this._register(new AGt(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=srt(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(srt(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=srt(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=srt(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?srt(r):"",{key:l,value:c}=OIo(s);if(c===void 0)return!0;switch(l){case"ContinuationPrompt":return this._updateContinuationPrompt(p1i(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(lnn(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=rrt(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}=OIo(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 PGt),this.capabilities.add(0,e)),e}_createOrGetCommandDetection(e){let t=this.capabilities.get(2);return t||(t=this._register(new Pge(e,this._logService)),this.capabilities.add(2,t)),t}_createOrGetBufferMarkDetection(e){let t=this.capabilities.get(4);return t||(t=this._register(new NGt(e)),this.capabilities.add(4,t)),t}_createOrGetShellEnvDetection(){let e=this.capabilities.get(5);return e||(e=this._register(new FGt),this.capabilities.add(5,e)),e}_createOrGetPromptTypeDetection(){let e=this.capabilities.get(6);return e||(e=this._register(new WGt),this.capabilities.add(6,e)),e}};function srt(a){return a.replaceAll(/\\(\\|x([0-9a-f]{2}))/gi,(i,e,t)=>t?String.fromCharCode(parseInt(t,16)):e)}function WIo(a){return a.replace(/[\\;\x00-\x20]/g,i=>i==="\\"?"\\\\":`\\x${i.charCodeAt(0).toString(16).padStart(2,"0")}`)}function OIo(a){let i=a.indexOf("=");return i===-1?{key:a,value:void 0}:{key:a.substring(0,i),value:a.substring(1+i)}}function lnn(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 sG(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 FWe(a,i,e,t){let o=new URLSearchParams;return t&&o.set("command",t),A.from({scheme:Y.vscodeTerminal,path:`/${a}/${i}`,fragment:e||void 0,query:t?o.toString():void 0})}function WWe(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 VWe(a,i){if(i){for(let e of a)if(e.resource.path===i.path)return e}}var BWe=class extends C{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 jt);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 P;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(),Ue(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(){dAe(this._configurationService,this._placeholderDecoration?.element);for(let e of this._decorations)dAe(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())Ue(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 P;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(),Ue(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)&&(dAe(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 xe(Iki(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(Gpo)),o.hoverMessage||e.classList.add("default");else{let n=qHt(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(14251,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 li);let n=this._createAttachToChatAction(e);if(n&&t.push(n,new li),e.command!==""){let c=d(14247,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(St.Info,d(14240,null,e.command),[{label:d(14252,null),run:()=>h(!0)},{label:d(14238,null),run:()=>h(!1)}])})||this._onDidRequestRunCommand.fire({command:e}))}}),t.push(new li);let u=d(14242,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(14243,null);t.push({class:void 0,tooltip:c,id:"terminal.copyCommandAndOutput",label:c,enabled:!0,run:()=>{let h=e.getOutput();Ae(h)&&this._clipboardService.writeText(`${e.command!==""?e.command+`
`:""}${h}`)}});let u=d(14244,null);t.push({class:void 0,tooltip:u,id:"terminal.copyOutput",label:u,enabled:!0,run:()=>{let h=e.getOutput();Ae(h)&&this._clipboardService.writeText(h)}});let p=d(14245,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 li);let r=d(14250,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(14249,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 li);let l=d(14246,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(14241,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=sG(this._resource);r=this._instantiationService.createInstance(WOe,FWe(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(14248,null);let t=this._configurationService.getValue("terminal.integrated.shellIntegration.decorationsEnabled"),o={label:d(14237,null),picked:t!=="never"&&t!=="overviewRuler"},n={label:d(14239,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=kJi:t=e.exitCode?TJi:EJi,this._themeService.getColorTheme().getColor(t)?.toString()}};BWe=I([m(2,Wi),m(3,ze),m(4,B),m(5,De),m(6,Qe),m(7,Ge),m(8,ao),m(9,ge),m(10,tr),m(11,Ne),m(12,tt),m(13,uS),m(14,At),m(15,F)],BWe);var VIo=new Map,HWe=class{async importAddon(i){let e=VIo.get(i);if(!e){switch(i){case"clipboard":e=(await bg("@xterm/addon-clipboard","lib/addon-clipboard.js")).ClipboardAddon;break;case"image":e=(await bg("@xterm/addon-image","lib/addon-image.js")).ImageAddon;break;case"ligatures":e=(await bg("@xterm/addon-ligatures","lib/addon-ligatures.js")).LigaturesAddon;break;case"progress":e=(await bg("@xterm/addon-progress","lib/addon-progress.js")).ProgressAddon;break;case"search":e=(await bg("@xterm/addon-search","lib/addon-search.js")).SearchAddon;break;case"serialize":e=(await bg("@xterm/addon-serialize","lib/addon-serialize.js")).SerializeAddon;break;case"unicode11":e=(await bg("@xterm/addon-unicode11","lib/addon-unicode11.js")).Unicode11Addon;break;case"webgl":e=(await bg("@xterm/addon-webgl","lib/addon-webgl.js")).WebglAddon;break}if(!e)throw new Error(`Could not load addon ${i}`);VIo.set(i,e)}return e}};function dnn(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 nM=class extends C{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=HU.INSTANCE.isPhysicalMouseWheel();this._progressState={state:0,value:0};this._webglAddonCustomGlyphs=!1;this._ligaturesAddon=this._register(new me);this._attachedDisposables=this._register(new P);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 HWe,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:BIo(this._logService.getLevel()),logger:this._logService,minimumContrastRatio:y.minimumContrastRatio,tabStopWidth:y.tabStopWidth,cursorBlink:y.cursorBlinking,blinkIntervalDuration:y.textBlinking?600:0,cursorStyle:BGt(y.cursorStyle),cursorInactiveStyle:BGt(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")&&(nM._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=BIo(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(OWe,o.capabilities),this.raw.loadAddon(this._markNavigationAddon),this._decorationAddon=this._instantiationService.createInstance(BWe,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 VGt(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,N){return g.writeText(N,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 N=()=>{uo(this._progressState,T.progress)||(this._progressState=T.progress,this._onDidChangeProgress.fire(this._progressState))};this._register(T.onChange(()=>N())),N();let O=this._capabilities.get(2);if(O)this._register(O.onCommandFinished(()=>T.progress={state:0,value:0}));else{let V=this._capabilities.onDidAddCapability(U=>{U.id===2&&(this._register(U.capability.onCommandFinished(()=>T.progress={state:0,value:0})),this._store.delete(V))});this._store.add(V)}}),this._anyTerminalFocusContextKey=at.focusInAny.bindTo(f),this._anyFocusedTerminalHasSelection=at.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 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?ts(this.raw.element):!1}*getBufferReverseIterator(){for(let e=this.raw.buffer.active.length-1;e>=0;e--){let{lineData:t,lineIndex:o}=dnn(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=HU.INSTANCE;s.acceptStandardWheelEvent(new MT(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"&&nM._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(lX)||t.getColor(jS),n=t.getColor(DJi),r=t.getColor(LJi),s=t.getColor(uDt),l=t.getColor(RJi),c=t.getColor(MJi),u=t.getColor(PJi);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(Me(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=Ore(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(14263,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=BGt(e);this.raw.options.cursorStyle!==t&&(this.raw.options.cursorStyle=t)}_setCursorStyleInactive(e){let t=BGt(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),nM._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&&!uo(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)}}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 l=await this._xtermAddonLoader.importAddon("serialize");this._serializeAddon=new l,this.raw.loadAddon(this._serializeAddon)}let n=Xo(t?.line),r=Xo(e?.line)&&e?.line>-1?e.line:0,s=n?t.line:this.raw.buffer.active.length-1;return o&&n&&(s=s-1),s=Math.max(s,r),this._serializeAddon.serialize({range:{start:e?.line??0,end:s}})}getXtermTheme(e){e||(e=this._themeService.getColorTheme());let t=this._terminalConfigurationService.config,o=["never","gutter"].includes(t.shellIntegration?.decorationsEnabled??""),n=e.getColor(IJi),r=this._xtermColorProvider.getBackgroundColor(e),s=e.getColor(yJi)||n,l=e.getColor(wJi)||r,c=e.getColor(eEe),u=e.getColor(CJi),p=e.getColor(xJi)||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(_Ji)?.toString(),scrollbarSliderActiveBackground:e.getColor(NU)?.toString(),scrollbarSliderBackground:e.getColor(o9)?.toString(),scrollbarSliderHoverBackground:e.getColor(AU)?.toString(),black:e.getColor(nS[0])?.toString(),red:e.getColor(nS[1])?.toString(),green:e.getColor(nS[2])?.toString(),yellow:e.getColor(nS[3])?.toString(),blue:e.getColor(nS[4])?.toString(),magenta:e.getColor(nS[5])?.toString(),cyan:e.getColor(nS[6])?.toString(),white:e.getColor(nS[7])?.toString(),brightBlack:e.getColor(nS[8])?.toString(),brightRed:e.getColor(nS[9])?.toString(),brightGreen:e.getColor(nS[10])?.toString(),brightYellow:e.getColor(nS[11])?.toString(),brightBlue:e.getColor(nS[12])?.toString(),brightMagenta:e.getColor(nS[13])?.toString(),brightCyan:e.getColor(nS[14])?.toString(),brightWhite:e.getColor(nS[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([Nd(100)],nM.prototype,"_refreshLigaturesAddon",1),I([Nd(100)],nM.prototype,"_refreshImageAddon",1),nM=I([m(4,B),m(5,F),m(6,Xs),m(7,Ne),m(8,De),m(9,Te),m(10,ku),m(11,Wi),m(12,X),m(13,tr),m(14,nc)],nM);function HGt(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 BIo(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 BGt(a){return a==="line"?"bar":a}var ZMi=class extends gg{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()}},lrt={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},JMi={...lrt,enableSplitViewResizing:!0,isInEmbeddedEditor:!0,renderOverviewRuler:!1,ignoreTrimWhitespace:!1,renderSideBySide:!0,useInlineViewWhenSpaceIsLimited:!1,originalAriaLabel:d(15252,null),modifiedAriaLabel:d(15251,null),diffAlgorithm:"advanced"};function UIo(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 UWe=class extends C{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||H.None}async update(e){if(!(e instanceof Rm))return this.clear(),!1;let t=e.message;if(!XO.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 ZMi(o,n);if(!this.widget.value){let s={...JMi},l=UIo(s,this.configurationService,u=>c.updateOptions(u)),c=this.widget.value=this.editor?this.instantiationService.createInstance(MD,this.container,s,{},this.editor):this.instantiationService.createInstance(Hu,this.container,s,{});H.once(c.onDidDispose)(()=>{l.dispose()}),this.dimension&&c.layout(this.dimension)}return this.widget.value.setModel(r),this.widget.value.updateOptions(this.getOptions(HIo(t.expected)||HIo(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:{...lrt.scrollbar,handleMouseWheel:!t}}),this.helper=new UGt(t,n,e.height),n}onScrolled(e){this.helper?.onScrolled(e,this.widget.value?.getDomNode(),this.widget.value?.getOriginalEditor())}getOptions(e){return e?{...JMi,lineNumbers:"on"}:{...JMi,lineNumbers:"off"}}};UWe=I([m(2,F),m(3,Nt),m(4,B)],UWe);var zWe=class extends C{constructor(e,t){super();this.container=e;this.markdownRendererService=t;this.rendered=this._register(new P);this._register(Z(()=>this.clear()))}async update(e){if(this.clear(),!(e instanceof Rm))return!1;let t=e.message;if(XO.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}};zWe=I([m(1,Qn)],zWe);var UGt=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?NWe:0));o=Math.min(Math.max(0,this.contentHeight-this.viewHeight),o),t.setScrollTop(o),e.style.transform=`translateY(${o}px)`}},KWe=class extends C{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||H.None}async update(e){if(!(e instanceof Rm))return this.clear(),!1;let t=e.message;if(XO.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={...lrt},r=UIo(n,this.configurationService,l=>s.updateOptions(l)),s=this.widget.value=this.editor?this.instantiationService.createInstance(zc,this.container,n,{},this.editor):this.instantiationService.createInstance(jr,this.container,n,{isSimpleWidget:!0});H.once(s.onDidDispose)(()=>{r.dispose()}),this.dimension&&s.layout(this.dimension)}return this.widget.value.setModel(o.object.textEditorModel),this.widget.value.updateOptions(lrt),this.widgetDecorations.value=yIo(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 UGt(t,n,e.height),o.updateOptions({scrollbar:{...lrt.scrollbar,handleMouseWheel:!t}}),n}};KWe=I([m(2,F),m(3,Nt),m(4,B)],KWe);var GWe=class extends C{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 iM(""));this.xtermLayoutDelayer=this._register(new jo(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 jC,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 Gme({initialCwd:o.value}),colorProvider:{getBackgroundColor:n=>{let r=n.getColor(lX);return r||(this.isInPeekView?n.getColor(x7):this.viewDescriptorService.getViewLocationById("workbench.panel.testResults.view")===1?n.getColor(jS):n.getColor(op))}}})}async update(e){if(this.outputDataListener.clear(),e instanceof fS)await this.updateForTaskSubject(e);else if(e instanceof vS||e instanceof Rm&&e.message.type===1)await this.updateForTestSubject(e);else return this.clear(),!1;return!0}async updateForTestSubject(e){let t=this,o=e instanceof vS?e.test.item:e.test,n=await this.updateGenerically({subject:e,noOutputMessage:d(15248,null),getTarget:r=>r?.tasks[e.taskIndex].output,*doInitialWrite(r,s){t.updateCwd(o.uri);let l=e instanceof vS?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 Rm&&e.message.type===1&&e.message.marker!==void 0&&n?.xterm.selectMarkedRange(f6e(e.message.marker,!0),f6e(e.message.marker,!1),!0)}updateForTaskSubject(e){return this.updateGenerically({subject:e,noOutputMessage:d(15249,null),getTarget:t=>t?.tasks[e.taskIndex],doInitialWrite:(t,o)=>(this.updateCwd(ht.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 iM(0);if(t instanceof Ih)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(15250,null));if(this.attachTerminalToDom(n),this.outputDataListener.clear(),t instanceof Ih&&!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=hn(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(Pk(t))}attachTerminalToDom(e){e.xterm.write("\x1B[?25l"),$r(Me(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=HGt(Me(this.container),e.getFont(),t,o);n&&e.resize(n.cols,n.rows)})}};GWe=I([m(2,Yo),m(3,Ri),m(4,Pe)],GWe);var HIo=a=>!!a&&a.includes(`
`);function ePi(a,i){return{testRunName:i.name,controllerId:i.ctrlId,resultId:a,taskId:i.id}}var drt=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 HA.get(this.value.completedAt===void 0?2:Yto(this.value.counts))}},unn=d(15259,null),pnn=d(15253,null),zGt=class{constructor(i,e,t){this.task=e;this.coverageService=t;this.type="coverage";this.id=`coverage-${i.id}/${e.id}`,this.onDidChange=H.fromObservableLight(t.selected)}get label(){return this.isOpen?pnn:unn}get icon(){return this.isOpen?lE:Fnt}get isOpen(){return this.coverageService.selected.get()?.fromTaskId===this.task.id}},KGt=class{constructor(i){this.n=i;this.type="older";this.onDidChange=H.None;this.label=i===1?d(15258,null):d(15257,null,i),this.id=`older-${this.n}`}},G8=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=Pr.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 urt([{$mid:16,tests:[pR.serialize(e)]},ePi(i.id,i.tasks[this.taskIndex])])}get onDidChange(){return this.results instanceof Ih?H.filter(this.results.onChange,i=>i.item.item.extId===this.test.item.extId&&i.reason!==2):H.None}get state(){return this.test.tasks[this.taskIndex].state}get label(){return this.test.item.label}get labelWithIcons(){return Bn(this.label)}get icon(){return HA.get(this.state)}get outputSubject(){return new vS(this.results,this.taskIndex,this.test)}},Nge=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 GGt;this.id=`${i.id}/${t}`,this.task=i.tasks[t],this.context=ePi(i.id,this.task),this.label=this.task.name}get icon(){return this.results.tasks[this.index].running?HA.get(2):void 0}},Xie=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=LD({type:2,messageIndex:o,resultId:i.id,taskIndex:t,testExtId:e.item.extId}),this.id=this.uri.toString();let r=Lge(n.message),s=IM(r.trimEnd(),`
`);this.label=mnn(r),s>0&&(this.description=s>1?d(15256,null,s):d(15255,null))}get onDidChange(){return this.result instanceof Ih?H.filter(this.result.onChange,i=>i.item.item.extId===this.test.item.extId&&i.reason!==2):H.None}get context(){return new urt([jMi(this.test,this.message),ePi(this.result.id,this.result.tasks[this.taskIndex])])}get outputSubject(){return new vS(this.result,this.taskIndex,this.test)}},$We=class extends C{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 $Gt);this.onDidRequestReview=this.requestReveal.event;this.treeActions=s.createInstance(crt,o.showRevealLocationOnMessages,this.requestReveal);let h={getId(O){return O.id}};this.tree=this._register(s.createInstance(PL,"Test Output Peek",e,{getHeight:()=>22,getTemplateId:()=>Yie.ID},[s.createInstance(Yie,this.treeActions)],{compressionEnabled:!0,hideTwistiesOfChildlessElements:!0,identityProvider:h,alwaysConsumeMouseWheel:!1,sorter:{compare(O,V){return O instanceof G8&&V instanceof G8?G9e(O.state,V.state):0}},accessibilityProvider:{getAriaLabel(O){return O.ariaLabel||O.label},getWidgetAriaLabel(){return d(15272,null)}}}));let g=new GGt,f=O=>{let{results:V,index:U,itemsCache:G,task:$}=O,te=ht.filter(V.tests,de=>de.tasks[U].state>=2||de.tasks[U].messages.length>0),pe=ht.map(te,de=>({element:G.getOrCreate(de,()=>new G8(V,de,U)),incompressible:!0,children:v(V,de,U)}));return $.coverage.get()&&(pe=ht.concat(ht.single({element:new zGt(V,$,c),collapsible:!0,incompressible:!0}),pe)),pe},v=(O,V,U)=>V.tasks[U].messages.map((G,$)=>G.type===0?{element:g.getOrCreate(G,()=>new Xie(O,V,U,$)),incompressible:!1}:void 0).filter(mo),b=O=>O.tasks.map((V,U)=>{let G=g.getOrCreate(V,()=>new Nge(O,V,U));return{element:G,incompressible:!1,collapsible:!0,children:f(G)}}),S=()=>{let O=[],V=[];for(let U of r.results)if(!O.length&&U.tasks.length)O=b(U);else if(O){let G=g.getOrCreate(U,()=>new drt(U));V.push({element:G,incompressible:!0,collapsible:!0,collapsed:this.tree.hasElement(G)?this.tree.isCollapsed(G):!0,children:b(U)})}return O.length?(V.length&&O.push({element:new KGt(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 P;V.add(O.onNewTask(U=>{this.tree.setChildren(null,S(),{diffIdentityProvider:h}),O.tasks.length===1&&this.requestReveal.fire(new fS(O,0));let G=O.tasks[U];V.add(he($=>{G.coverage.read($),k(g.get(G))}))})),V.add(O.onEndTask(U=>{g.get(O.tasks[U])?.changeEmitter.fire()})),V.add(O.onChange(U=>{for(let[G,$]of O.tasks.entries()){let te=g.get($);if(!this.tree.hasElement(te))continue;let pe=te.itemsCache.get(U.item);if(pe&&this.tree.hasElement(pe)){U.reason===2&&U.message.type===0&&this.tree.setChildren(pe,v(O,U.item,G),{diffIdentityProvider:h});return}k(te)}})),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 N=(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(te=>te.element instanceof Nge?te.element.results.id===O.result.id&&te.element.index===O.taskIndex:te.element instanceof drt?te.element.id===O.result.id:!1);$&&N($.element,V);return}let U=O instanceof vS?g.get(O.task)?.itemsCache.get(O.test):g.get(O.message);if(!U||!this.tree.hasElement(U))return;let G=[];for(let $=this.tree.getParentElement(U);$;$=this.tree.getParentElement($))G.unshift($);for(let $ of G)this.tree.expand($);this.tree.getRelativeTop(U)===null&&this.tree.reveal(U,.5),N(U,V)})),this._register(this.tree.onDidOpen(async O=>{if(O.element instanceof Xie)this.requestReveal.fire(new Rm(O.element.result,O.element.test,O.element.taskIndex,O.element.messageIndex));else if(O.element instanceof G8){let V=O.element,U=LWe(O.element.test,(G,$,te,pe)=>new Rm(V.results,V.test,pe,te));this.requestReveal.fire(U||new vS(V.results,0,V.test))}else if(O.element instanceof zGt){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 Nge){for(let U of V.children)if(U.element instanceof G8&&U.element.test.item.extId===O){this.tree.setSelection([U.element]),this.tree.getRelativeTop(U.element)===null&&this.tree.reveal(U.element,.5);break}}}})),this._register(this.tree.onContextMenu(O=>this.onContextMenu(O))),this._register(this.tree.onDidChangeCollapseState(O=>{O.node.element instanceof KGt&&!O.node.collapsed&&p.publicLog2("testing.expandOlderResults")})),this.tree.setChildren(null,S());for(let O of r.results)!O.completedAt&&O instanceof Ih&&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 li,...t.secondary]:t.primary,getActionsContext:()=>e.element?.context,actionRunner:this.contextMenuActionRunner})}dispose(){super.dispose(),this.disposed=!0}};$We=I([m(3,ze),m(4,ed),m(5,F),m(6,k0),m(7,Tw),m(8,Bo),m(9,Te)],$We);var Yie=class{constructor(i,e){this.treeActions=i;this.instantiationService=e;this.templateId=Yie.ID}static{this.ID="testRunElementRenderer"}renderCompressedElements(i,e,t){let o=i.element.elements,n=o[o.length-1];(n instanceof Nge||n instanceof Xie)&&o.length>=2?this.doRender(o[o.length-2],t,n):this.doRender(n,t)}renderTemplate(i){let e=new P;i.classList.add("testing-stdtree-container");let t=R(i,_(".state")),o=R(i,_(".label")),n=new ji(i,{actionRunner:e.add(new $Gt),actionViewItemProvider:(s,l)=>s instanceof Eo?this.instantiationService.createInstance(ml,s,{hoverDelegate:l.hoverDelegate}):void 0}),r=new P;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 Xie&&(r=t.label,i.description&&(r=`${r} @ ${i.description}`));let s=r?_("span.test-label-description",{},r):"";n?Fi(e.label,...n,s):Fi(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})}};Yie=I([m(1,F)],Yie);var crt=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 G8?i.test:void 0,t=e?this.testProfileService.capabilitiesForTest(e.item):0,o=[["peek","editor.contrib.testingOutputPeek"],[Ji.peekItemType.key,i.type]],n=D.TestPeekElement,r=[],s=[];if(i instanceof Nge)if(r.push(new st("testing.outputPeek.showResultOutput",d(15271,null),q.asClassName(M.terminal),void 0,()=>this.requestReveal.fire(new fS(i.results,i.index)))),i.task.running)r.push(new st("testing.outputPeek.cancel",d(15261,null),q.asClassName(pGt),void 0,()=>this.commandService.executeCommand("testing.cancelRun",i.results.id,i.task.id)));else{r.push(new st("testing.outputPeek.rerun",d(15268,null),q.asClassName(Wie),void 0,()=>this.commandService.executeCommand("testing.reRunLastRun",i.results.id)));let p=ht.some(i.results.tests,h=>ak(h.ownComputedState));p&&r.push(new st("testing.outputPeek.rerunFailed",d(15267,null),q.asClassName(Wie),void 0,()=>this.commandService.executeCommand("testing.reRunFailedFromLastRun",i.results.id))),r.push(new st("testing.outputPeek.debug",d(15263,null),q.asClassName(ex),void 0,()=>this.commandService.executeCommand("testing.debugLastRun",i.results.id))),p&&r.push(new st("testing.outputPeek.debugFailed",d(15262,null),q.asClassName(ex),void 0,()=>this.commandService.executeCommand("testing.debugFailedFromLastRun",i.results.id)))}if(i instanceof drt){i.value.tasks.length===1&&r.push(new st("testing.outputPeek.showResultOutput",d(15271,null),q.asClassName(M.terminal),void 0,()=>this.requestReveal.fire(new fS(i.value,0)))),r.push(new st("testing.outputPeek.reRunLastRun",d(15269,null),q.asClassName(uH),void 0,()=>this.commandService.executeCommand("testing.reRunLastRun",i.value.id)));let p=ht.some(i.value.tests,h=>ak(h.ownComputedState));p&&r.push(new st("testing.outputPeek.rerunFailedResult",d(15267,null),q.asClassName(Wie),void 0,()=>this.commandService.executeCommand("testing.reRunFailedFromLastRun",i.value.id))),t&4&&(r.push(new st("testing.outputPeek.debugLastRun",d(15264,null),q.asClassName(ex),void 0,()=>this.commandService.executeCommand("testing.debugLastRun",i.value.id))),p&&r.push(new st("testing.outputPeek.debugFailedResult",d(15262,null),q.asClassName(ex),void 0,()=>this.commandService.executeCommand("testing.debugFailedFromLastRun",i.value.id))))}if(i instanceof G8||i instanceof Xie){o.push([Ji.testResultOutdated.key,i.test.retired],[Ji.testResultState.key,DDt[i.test.ownComputedState]],...DWe(i.test,t));let{extId:p,uri:h}=i.test.item;h&&r.push(new st("testing.outputPeek.goToTest",d(15266,null),q.asClassName(M.goToFile),void 0,()=>this.commandService.executeCommand("vscode.revealTest",p))),i.test.tasks[i.taskIndex].messages.some(g=>g.type===1)&&r.push(new st("testing.outputPeek.showResultOutput",d(15271,null),q.asClassName(M.terminal),void 0,()=>this.requestReveal.fire(i.outputSubject))),s.push(new st("testing.outputPeek.revealInExplorer",d(15270,null),q.asClassName(M.listTree),void 0,()=>this.commandService.executeCommand("_revealTestInExplorer",p))),t&2&&r.push(new st("testing.outputPeek.runTest",d(15260,null),q.asClassName(uH),void 0,()=>this.commandService.executeCommand("vscode.runTestsById",2,p))),t&4&&r.push(new st("testing.outputPeek.debugTest",d(15254,null),q.asClassName(ex),void 0,()=>this.commandService.executeCommand("vscode.runTestsById",4,p)))}i instanceof Xie&&(n=D.TestMessageContext,o.push([Ji.testMessageContext.key,i.contextValue]),this.showRevealLocationOnMessages&&i.location&&r.push(new st("testing.outputPeek.goToError",d(15265,null),q.asClassName(M.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 Dq(u,c,"inline"),c}};crt=I([m(2,X),m(3,qt),m(4,ge),m(5,$d),m(6,ee)],crt);var GGt=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}},mnn=a=>{let i=a.indexOf(`
`);return i===-1?a:a.slice(0,i)},urt=class{constructor(i){this.value=i}},$Gt=class extends as{async runAction(i,e){e instanceof urt?await i.run(...e.value):await i.run(e)}};var prt=class extends Znt{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=Le("MessageStackFrame.height",100);this.icon=xWe;this.label=o instanceof Rm?o.test.label:o instanceof vS?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 P;e.appendChild(this.followup.domNode),t.add(Z(()=>this.followup.domNode.remove()));let o=xIo(this.subject),n=o&&this.profileService.capabilitiesForTest(o),r;if(n)r=this.contextKeyService.createOverlay(SMt(n));else{let c=this.profileService.getControllerProfiles(this.subject.controllerId);r=this.contextKeyService.createOverlay([[Ji.hasRunnableTests.key,c.some(u=>u.group&2)],[Ji.hasDebuggableTests.key,c.some(u=>u.group&4)]])}let s=t.add(this.instantiationService.createChild(new Io([X,r]))),l=t.add(s.createInstance(Ln,e,D.TestCallStack,{menuOptions:{shouldForwardArgs:!0},actionViewItemProvider:(c,u)=>Ca(this.instantiationService,c,u)}));return l.context=this.subject,t.add(l),t}};prt=I([m(3,F),m(4,X),m(5,$d)],prt);function zIo(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(Es),o=e instanceof Rm?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(15275,null),icon:uH,menu:{id:D.TestCallStack,when:Ji.hasRunnableTests,group:"navigation"}})}run(a,i){zIo(a,2,i)}});W(class extends K{constructor(){super({id:"testing.callStack.debug",title:d(15274,null),icon:ex,menu:{id:D.TestCallStack,when:Ji.hasDebuggableTests,group:"navigation"}})}run(a,i){zIo(a,4,i)}});var aG=class extends C{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 P);this.onCloseEmitter=this._register(new Mh);this.contentProvidersUpdateLimiter=this._register(new OT(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=aG.lastSplitWidth;this.splitView=new vu(e,{orientation:1});let{historyVisible:o,showRevealLocationOnMessages:n}=this.options,r=this.editor!==void 0,s=Lp(this.configurationService,"testing.resultsView.layout");this.isTreeLeft=s==="treeLeft",this._register(this.configurationService.onDidChangeConfiguration(g=>{if(g.affectsConfiguration("testing.resultsView.layout")){let v=Lp(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=R(e,_(".test-output-call-stack-container")),this.callStackWidget=this._register(this.instantiationService.createInstance(RWe,this.stackContainer,this.editor)),this.followupWidget=this._register(this.instantiationService.createInstance(mrt,this.editor)),this.onCloseEmitter.input=this.followupWidget.onClose,this.contentProviders=[this._register(this.instantiationService.createInstance(UWe,this.editor,l)),this._register(this.instantiationService.createInstance(zWe,l)),this._register(this.instantiationService.createInstance(GWe,l,r)),this._register(this.instantiationService.createInstance(KWe,this.editor,l))],this.messageContextKeyService=this._register(this.contextKeyService.createScoped(e)),this.contextKeyTestMessage=Ji.testMessageContext.bindTo(this.messageContextKeyService),this.contextKeyResultOutdated=Ji.testResultOutdated.bindTo(this.messageContextKeyService);let c=R(e,_(".test-output-peek-tree.testing-stdtree")),u=this._register(this.instantiationService.createInstance($We,c,this.didReveal.event,{showRevealLocationOnMessages:n,locationForProgress:this.options.locationForProgress}));this.onDidRequestReveal=u.onDidRequestReview;let p={onDidChange:H.None,element:this.stackContainer,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:g=>{aG.lastSplitWidth=g,this.dimension&&(this.callStackWidget?.layout(this.dimension.height,g),this.layoutContentWidgets(this.dimension,g))}},h={onDidChange:H.None,element:c,minimumSize:100,maximumSize:Number.MAX_VALUE,layout:g=>{this.dimension&&u.layout(this.dimension.height,g)}};this.splitView.addView(p,Wl.Distribute),this.splitView.addView(h,Wl.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&&CIo(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 jie(o.label,o.uri,o.position?.lineNumber,o.position?.column))])}collapseStack(){this.callStackWidget.collapseAll()}getCallFrames(e){if(!(e instanceof Rm))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(prt,this.messageContainer,this.followupWidget,e),n=t.length>0;o.showHeader.set(n,void 0);let r=await fUi(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 Rm))return;this.currentSubjectStore.add(Z(()=>{this.contextKeyResultOutdated.reset(),this.contextKeyTestMessage.reset()})),this.contextKeyTestMessage.set(e.contextValue||""),e.result instanceof Ih?(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 Io([X,this.messageContextKeyService])));this.currentSubjectStore.add(t.createInstance(DLe,{container:this.messageContainer,menuId:D.TestMessageContent,getActionArg:()=>e.context}))}onLayoutBody(e,t){this.dimension=new ai(t,e),this.splitView.layout(t)}onWidth(e){this.splitView.layout(e)}};aG=I([m(2,F),m(3,Nt),m(4,X),m(5,dt),m(6,B)],aG);var hnn=500,mrt=class extends C{constructor(e,t,o){super();this.editor=e;this.testService=t;this.quickInput=o;this.el=bt("div.testing-followup-action",[]);this.visibleStore=this._register(new P);this.onCloseEmitter=this._register(new E);this.onClose=this.onCloseEmitter.event}get domNode(){return this.el.root}show(e){this.visibleStore.clear(),e instanceof Rm&&this.showMessage(e)}async showMessage(e){let t=this.visibleStore.add(new $e),o=Date.now();e.result instanceof Ih&&!e.result.completedAt&&await new Promise(r=>H.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>hnn),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 Fi(t,...Bn(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(15273,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 Ii(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())}};mrt=I([m(1,Es),m(2,Ge)],mrt);function*KIo([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 tPi({result:a,test:i,taskIndex:e,messageIndex:t}){return LD({type:2,resultId:a.id,testExtId:i.item.extId,taskIndex:e,messageIndex:t})}var Jie=class extends C{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(iM.stored(new dS({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=Ege(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())Pb.get(e)?.removePeek()}openCurrentInEditor(){let e=this.getActiveControl();if(!e)return;let t={pinned:!1,revealIfOpened:!0};if(e instanceof fS||e instanceof vS){this.editorService.openEditor({resource:e.outputUri,options:t});return}if(e instanceof vS){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(15242,null,n.message))})}getActiveControl(){let e=grt(this.codeEditorService);return(e&&Pb.get(e))?.subject.get()??this.viewsService.getActiveViewWithId("workbench.panel.testResults.view")?.subject}async showPeekFromUri(e,t,o){if(pn(t))return this.lastUri=e,Pb.get(t)?.show(LD(this.lastUri)),!0;let r=(await this.editorService.openEditor({resource:e.documentUri,options:{revealIfOpened:!0,...o}}))?.getControl();return pn(r)?(this.lastUri=e,Pb.get(r)?.show(LD(this.lastUri)),!0):!1}openPeekOnFailure(e){if(e.reason!==1||!this.getFailedCandidateMessage(e.item)||e.result.request.continuous&&!Lp(this.configuration,"testing.automaticallyOpenPeekViewDuringAutoRun"))return;let o=this.codeEditorService.listCodeEditors();switch(Lp(this.configuration,"testing.automaticallyOpenPeekView")){case"failureInVisibleDocument":{let s=this.editorService.visibleTextEditorControls,l=new Set(s.filter(pn).map(c=>c.getModel()?.uri.toString()));if(!ht.some(Qto(e.result,e.item),c=>c.item.uri&&l.has(c.item.uri.toString())))return;break}case"failureAnywhere":break;default:return}o.map(Pb.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&&LWe(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=LWe(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 LWe(e,(n,r,s,l)=>{let c=r.location||t;!ak(n.state)||!c||o&&r.type!==0||(o={taskId:l,index:s,message:r,location:c})}),o}};Jie=I([m(0,B),m(1,ee),m(2,Kt),m(3,ed),m(4,Es),m(5,le),m(6,Ft),m(7,ge),m(8,Ne)],Jie);var Pb=class extends C{constructor(e,t,o,n,r){super();this.editor=e;this.codeEditorService=t;this.instantiationService=o;this.testResults=n;this.peek=this._register(X0("TestingOutputPeek",void 0));this.subject=Ce(e=>this.peek.read(e)?.current.read(e));this.visible=Ji.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(hrt,this.editor);this.peek.set(t,void 0),H.once(t.onDidClose)(()=>{this.visible.set(!1),this.peek.set(void 0,void 0)}),this.visible.set(!0),t.create()}e instanceof Rm&&Jo(Lge(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 Pb.get(o)?.removePeek(),Pb.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 KIo(this.testResults.results)){if(t??=n,e instanceof fS&&n.result.id===e.result.id&&(o=!0),o){this.openAndShow(tPi(n));return}e instanceof vS&&e.test.item.extId===n.test.item.extId&&e.taskIndex===n.taskIndex&&e.result.id===n.result.id&&(o=!0),e instanceof Rm&&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(tPi(t))}previous(){let e=this.subject.get();if(!e)return;let t,o=!1,n;for(let s of KIo(this.testResults.results))if(n=s,!o){if(e instanceof fS){s.result.id===e.result.id&&(o=!0);continue}if(e instanceof vS){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(tPi(r))}removeIfPeekingForTest(e){let t=this.subject.get();t&&t instanceof Rm&&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=Ege(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 vS(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 Rm(o,l,r,s)}};Pb=I([m(1,Kt),m(2,F),m(3,ed),m(4,X)],Pb);var hrt=class extends bE{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=Le("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 Rm&&t.message.type===0,n=(o?e.getColor(WSo):e.getColor(VSo))||Oe.transparent,r=(o?e.getColor(BSo):e.getColor(HSo))||Oe.transparent,s=e.getColor(qo);this.style({arrowColor:n,frameColor:n,headerBackgroundColor:s&&r?r.makeOpaque(s):r,primaryHeadingColor:e.getColor(lO),secondaryHeadingColor:e.getColor(cO)})}_fillContainer(e){if(!this.scopedContextKeyService){this.scopedContextKeyService=this._disposables.add(this.contextKeyService.createScoped(e)),Ji.isInPeek.bindTo(this.scopedContextKeyService).set(!0);let t=this._disposables.add(this.instantiationService.createChild(new Io([X,this.scopedContextKeyService])));this.content=this._disposables.add(t.createInstance(aG,this.editor,{historyVisible:this.testingPeek.historyVisible,showRevealLocationOnMessages:!1,locationForProgress:"workbench.panel.testResults.view"})),this._disposables.add(this.content.onClose(()=>{Pb.get(this.editor)?.removePeek()}))}super._fillContainer(e)}_fillHead(e){super._fillHead(e);let t=this._disposables.add(this.contextKeyService.createScoped(e));this._disposables.add(tc(Ji.peekHasStack,t,s=>wIo(this.current.read(s))));let o=this.menuService.createMenu(D.TestPeekTitle,t),n=this._actionbarWidget;this._disposables.add(o.onDidChange(()=>{for(r.length=0,Dq(o.getActions(),r);n.getAction(1);)n.pull(0);n.push(r,{label:!1,icon:!0,index:0})}));let r=[];Dq(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=>{Pb.get(this.editor)?.show(o instanceof Rm?o.messageUri:o.outputUri)}))}setModel(e){if(e instanceof fS||e instanceof vS)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 Rm){let t=e.message;this.setTitle(gnn(Lge(t.message)),fu(e.test.label))}else this.setTitle(d(15246,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 ai(e,this.dimension.height)),this.content.onWidth(e)}};hrt=I([m(1,De),m(2,Kq),m(3,RD),m(4,X),m(5,qt),m(6,F),m(7,Nt),m(8,Kt),m(9,dt)],hrt);var qWe=class extends zr{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(aG,void 0,{historyVisible:_So(!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(H.once(H.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)})}};qWe=I([m(1,_e),m(2,ze),m(3,B),m(4,X),m(5,Ri),m(6,F),m(7,Qe),m(8,De),m(9,tt),m(10,ed)],qWe);var gnn=a=>{let i=a.indexOf(`
`);return i===-1?a:a.slice(0,i)};function fnn(a){let i=a.listDiffEditors();for(let e of i)if(e.hasTextFocus()&&e instanceof MD)return e.getParentEditor();return null}var qGt=class extends wl{constructor(){super({id:"editor.closeTestPeek",title:L(15236,"Close"),icon:M.close,precondition:x.or(Ji.isInPeek,Ji.isPeekVisible),keybinding:{weight:-1,primary:9,when:x.not("config.editor.stablePeek")}})}runEditorCommand(i,e){let t=grt(i.get(Kt));Pb.get(t??e)?.removePeek()}},jGt=x.and(ue.focus,Ji.isPeekVisible),grt=a=>{let i=a.getFocusedCodeEditor()||a.getActiveCodeEditor();return i&&vnn(a,i)},vnn=(a,i)=>{if(Pb.get(i)?.subject.get())return i;if(i instanceof zc)return i.getParentEditor();let e=fnn(a);return e||i},QGt=class a extends K{static{this.ID="testing.goToNextMessage"}constructor(){super({id:a.ID,f1:!0,title:L(15238,"Go to Next Test Failure"),metadata:{description:L(15239,"Shows the next failure message in your file")},icon:M.arrowDown,category:We.Test,keybinding:{primary:578,weight:101,when:jGt},menu:[{id:D.TestPeekTitle,group:"navigation",order:2},{id:D.CommandPalette,when:jGt}]})}run(i){let e=grt(i.get(Kt));e&&Pb.get(e)?.next()}},YGt=class a extends K{static{this.ID="testing.goToPreviousMessage"}constructor(){super({id:a.ID,f1:!0,title:L(15240,"Go to Previous Test Failure"),metadata:{description:L(15241,"Shows the previous failure message in your file")},icon:M.arrowUp,category:We.Test,keybinding:{primary:1602,weight:101,when:jGt},menu:[{id:D.TestPeekTitle,group:"navigation",order:1},{id:D.CommandPalette,when:jGt}]})}run(i){let e=grt(i.get(Kt));e&&Pb.get(e)?.previous()}},XGt=class a extends K{static{this.ID="testing.collapsePeekStack"}constructor(){super({id:a.ID,title:L(15237,"Collapse Stack Frames"),icon:M.collapseAll,category:We.Test,menu:[{id:D.TestPeekTitle,when:Ji.peekHasStack,group:"navigation",order:4}]})}run(i){let e=grt(i.get(Kt));e&&Pb.get(e)?.collapseStack()}},JGt=class a extends K{static{this.ID="testing.openMessageInEditor"}constructor(){super({id:a.ID,f1:!1,title:L(15243,"Open in Editor"),icon:M.goToFile,category:We.Test,menu:[{id:D.TestPeekTitle}]})}run(i){i.get(RD).openCurrentInEditor()}},ZGt=class a extends K{static{this.ID="testing.toggleTestingPeekHistory"}constructor(){super({id:a.ID,f1:!0,title:L(15244,"Toggle Test History in Peek"),metadata:{description:L(15245,"Shows or hides the history of test runs in the peek view")},icon:M.history,category:We.Test,menu:[{id:D.TestPeekTitle,group:"navigation",order:3}],keybinding:{weight:200,primary:550,when:Ji.isPeekVisible.isEqualTo(!0)}})}run(i){let e=i.get(RD);e.historyVisible.value=!e.historyVisible.value}};var GIo=128,$Io=30,QIo=2;function bnn(a,i){let e=a.listDiffEditors();for(let t of e)if(t.getOriginalEditor()===i)return!0;return!1}var Srt=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}},jWe=class extends C{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 vt;this.invalidatedMessages=new WeakSet;this.onDidChange=this.changeEmitter.event;this._register(e.registerDecorationType("test-message-decoration",$8.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(H.any(this.results.onResultsChanged,this.results.onTestChanged,this.testService.excluded.onTestExclusionsChanged,H.filter(t.onDidChangeConfiguration,c=>c.affectsConfiguration("testing.gutterEnabled")))(()=>{l.isScheduled()||l.schedule()})),this._register(Hit.registerGutterActionsGenerator((c,u)=>{let p=c.editor.getModel(),h=UA.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 Srt;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=ht.find(this.syncDecorations(e),r=>r instanceof Zie&&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 Zie&&s.editorDecoration.alternate&&r.changeDecorationOptions(s.id,t?s.editorDecoration.alternate:s.editorDecoration.options)}))}applyDecorations(e){let t=Lp(this.configurationService,"testing.gutterEnabled"),o=this.decorationCache.get(e.uri),n=o?.rangeUpdateVersionId===e.getVersionId(),r=o?.value??new Srt;return e.changeDecorations(l=>{let c=new Srt,u=new cGt;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(frt,g,t,e):this.instantiationService.createInstance(vrt,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}};jWe=I([m(0,Kt),m(1,B),m(2,Es),m(3,ed),m(4,F),m(5,Ct)],jWe);var UA=class extends C{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 jt);this.loggedMessageDecorations=new Map;this._register(t.registerDecorationType("test-message-decoration",$8.decorationId,{},void 0,e)),this.attachModel(e.getModel()?.uri),this._register(n.onDidChange(()=>{this._currentUri&&n.syncDecorations(this._currentUri)}));let u=this._register(new um);this._register(this.results.onTestChanged(g=>{g.reason===2&&u.queue(()=>(this.applyResults(),Pi(100)))})),this._register(H.any(this.results.onResultsChanged,e.onDidChangeModel,this.testService.showInlineOutput.onDidChange)(()=>this.applyResults()));let p=Me(e.getDomNode());this._register(j(p,"keydown",g=>{new Ii(g).keyCode===6&&this._currentUri&&n.updateDecorationsAlternateAction(this._currentUri,!0)})),this._register(j(p,"keyup",g=>{new Ii(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(H.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,UA.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&&Ege(e)?.type){case 4:this.expectedWidget.value=new iPi(this.editor),this.actualWidget.clear();break;case 3:this.expectedWidget.clear(),this.actualWidget.value=new oPi(this.editor);break;default:this.expectedWidget.clear(),this.actualWidget.clear()}bnn(this.codeEditorService,this.editor)&&(e=void 0),this._currentUri=e,e&&(this.decorations.syncDecorations(e),(async()=>{for await(let t of qde(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 UA.invalidatedTests.has(e)}applyResultsContentWidgets(e,t){let o=new Set;Lp(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(!UA.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&&DT(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(brt,this.editor,new Ie(p,g+1),u,r,LD({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;Lp(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 Ih))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($8,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(!UA.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,LD({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)}};UA=I([m(1,Kt),m(2,Es),m(3,Mnt),m(4,dt),m(5,ed),m(6,B),m(7,F)],UA);var qIo=a=>({startLineNumber:a.startLineNumber,endLineNumber:a.startLineNumber,startColumn:a.startColumn,endColumn:a.startColumn}),jIo=(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:qIo(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(vMt(S.item.label,w)),n=PTe(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?z8:uH:HA.get(n),p=t==="debug"?c?z8:uH:c?_ge:ex,h,g="testing-run-glyph";l&&(g+=" retired");let f={description:"run-test-decoration",showIfCollapsed:!0,get hoverMessage(){if(!h){let b=h=new xe("",!0).appendText(r.join(", ")+".");if(s){let S=encodeURIComponent(JSON.stringify([s]));b.appendMarkdown(` [${d(15198,null)}](command:vscode.peekTestError?${S})`)}}return h},glyphMargin:{position:QIo},glyphMarginClassName:`${q.asClassName(u)} ${g}`,stickiness:1,zIndex:1e4},v={...f,glyphMarginClassName:`${q.asClassName(p)} ${g}`};return{range:qIo(o),options:f,alternate:v}};var e$t=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]}}},iPi=class extends e$t{getId(){return"expectedTestingLens"}getText(){return d(15196,null)}},oPi=class extends e$t{getId(){return"actualTestingLens"}getText(){return d(15192,null)}},Zie=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=jIo(i.map(h=>h.test),i.map(h=>h.resultItem),e,Lp(this.configurationService,"testing.defaultGutterClickAction")),this.editorDecoration.options.glyphMarginHoverMessage=new xe().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!==QIo||i.event.rightButton||it&&i.event.leftButton&&i.event.ctrlKey)return!1;let e=i.event.altKey;switch(Lp(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}=jIo(i.map(r=>r.test),i.map(r=>r.resultItem),e,Lp(this.configurationService,"testing.defaultGutterClickAction"));return this.editorDecoration.options=o,this.editorDecoration.alternate=n,this.editorDecoration.options.glyphMarginHoverMessage=new xe().appendText(this.getGutterLabel()),!0}isForTest(i){return this.tests.some(e=>e.test.item.extId===i)}runWith(i){return this.testService.runTests({tests:tio(this.testService.collection,this.tests.map(({test:e})=>e)),group:i})}showContextMenu(i){this.codeEditorService.listCodeEditors().find(t=>t.getModel()===this.model)?.getContribution(Nte.ID)?.show(i)}getGutterLabel(){switch(Lp(this.configurationService,"testing.defaultGutterClickAction")){case"contextMenu":return d(15205,null);case"debug":return d(15207,null);case"runWithCoverage":return d(15206,null);case"run":default:return d(15208,null)}}getTestContextMenuActions(i,e){let t=[],o=this.testProfileService.capabilitiesForTest(i.item);[{bitset:2,label:d(15202,null)},{bitset:4,label:d(15195,null)},{bitset:8,label:d(15193,null)}].forEach(({bitset:r,label:s})=>{o&r&&t.push(new st(`testing.gutter.${r}`,s,void 0,void 0,()=>this.testService.runTests({group:r,tests:[i]})))}),o&16&&t.push(new st("testing.runUsing",d(15209,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&&ak(e.computedState)&&t.push(new st("testing.gutter.peekFailure",d(15197,null),void 0,void 0,()=>this.commandService.executeCommand("vscode.peekTestError",i.item.extId))),e?.computedState===2&&t.push(new st("testing.gutter.cancel",d(15204,null),void 0,void 0,()=>this.commandService.executeCommand("testing.cancelRun"))),t.push(new st("testing.gutter.reveal",d(15199,null),void 0,void 0,()=>this.commandService.executeCommand("_revealTestInExplorer",i.item.extId)));let n=this.getContributedTestActions(i,o);return{object:li.join(t,n),dispose(){t.forEach(r=>r.dispose())}}}getContributedTestActions(i,e){let t=this.contextKeyService.createOverlay(DWe(i,e)),o=Jto(this.testService.collection,i.item.extId),n=this.menuService.getMenuActions(D.TestItemGutter,t,{shouldForwardArgs:!0,arg:o});return Uc(n)}};Zie=I([m(3,Kt),m(4,Es),m(5,ze),m(6,ge),m(7,B),m(8,$d),m(9,X),m(10,qt)],Zie);var frt=class extends Zie{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 P,t=[];[{bitset:2,label:d(15200,null)},{bitset:8,label:d(15201,null)},{bitset:4,label:d(15194,null)}].forEach(({bitset:u,label:p},h)=>{this.tests.some(({test:f})=>this.testProfileService.capabilitiesForTest(f.item)&u)&&t.push(new st(`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:Pr.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=fu(u),f=g.indexOf(`
`);return f!==-1&&(g=g.slice(0,f)),new $l(p.test.item.extId,g,h.object)}),c=l.length-$Io;return c>0&&(l=l.slice(0,$Io),l.push(new st("testing.gutter.overflow",d(15210,null,c),void 0,void 0,()=>this.pickAndRun(o)))),{object:li.join(t,l),dispose:()=>e.dispose()}}async pickAndRun(e){let t=(r,s)=>new Promise(l=>{let c=new P,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(15203,null));if(!o)return;let n=this.getTestContextMenuActions(o.test,o.result);try{(await t(n.object,o.label))?.run()}finally{n.dispose()}}};frt=I([m(3,Kt),m(4,Es),m(5,ze),m(6,ge),m(7,B),m(8,$d),m(9,X),m(10,qt),m(11,Ge)],frt);var vrt=class extends Zie{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)}};vrt=I([m(4,Kt),m(5,Es),m(6,ge),m(7,ze),m(8,B),m(9,$d),m(10,X),m(11,qt)],vrt);var Snn=/\r?\n\s*/g,$8=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${_t()}`;let r=i.location;this.line=Kn(r.range.startLineNumber,0,t.getLineCount());let s=i.type,l=i.message,c=n.resolveDecorationOptions($8.decorationId,!0);c.hoverMessage=typeof l=="string"?new xe().appendText(l):l,c.zIndex=10,c.className=`testing-inline-message-severity-${s}`,c.isWholeLine=!0,c.stickiness=1,c.collapseOnReplaceEdit=!0;let u=Lge(l).replace(Snn," ");u.length>GIo&&(u=u.slice(0,GIo-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?NIe:w9;p&&(c.overviewRuler={color:Ss(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-${_t()}`}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:()=>{}}}};$8=I([m(3,RD),m(4,Kt)],$8);var Inn=20,brt=class extends C{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=_t();this.allowEditorOverflow=!1;this.node=bt("div.test-error-content-widget",[bt("div.inner@inner",[bt("div.arrow@arrow"),bt(`span${q.asCSSSelector(HA.get(4))}`),bt("span.content@name")])]);let l=()=>{let g=e.getLineHeightForPosition(t);this.node.root.style.marginTop=(g-Inn)/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=`${o9t(o.actual.replace(/\s+/g," "),30)} != ${o9t(o.expected.replace(/\s+/g," "),30)}`;else{let g=qa(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=Pb.get(e);u&&this._register(he(g=>{let f=u.subject.read(g),v=f instanceof Rm&&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)&&(UA.invalidatedTests.add(this.resultItem),this.dispose());let v=IM(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`}}};brt=I([m(5,RD)],brt);var t$t=class extends kh{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){cEe(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 tx(this.test.item.error,this),this.children.add(this.errorChild))}},QWe=class extends C{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=ht.map(this.testService.collection.rootItems,t=>this.items.get(t.item.extId));return ht.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||Pr.isChild(t.itemId,o))&&this.unstoreItem(n);break}}e.length!==0&&this.updateEmitter.fire()}applyTo(e){e.setChildren(null,_We(this.lastState,this.rootsWithChildren,null),{diffIdentityProvider:yGt,diffDepth:1/0})}expandElement(e,t){e instanceof t$t&&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=Pr.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 t$t(t,o,n);o?.children.add(r),this.items.set(r.test.item.extId,r),(r.depth===0||TWe(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=Pr.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)}};QWe=I([m(1,Es),m(2,ed)],QWe);var i$t=class extends mg{getOptimizedViewState(i){let e=i||{},t=(o,n)=>{if(!(o.element instanceof kh))return!1;let r=Pr.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 kh)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 o$t={getOwnState:a=>a instanceof kh?a.ownState:0,getCurrentComputedState:a=>a.state,setComputedState:(a,i)=>a.state=i,getCurrentComputedDuration:a=>a.duration,getOwnDuration:a=>a instanceof kh?a.ownDuration:void 0,setComputedDuration:(a,i)=>a.duration=i,getChildren:a=>ht.filter(a.children.values(),i=>i instanceof Oge),*getParents(a){for(let i=a.parent;i;i=i.parent)yield i}},Oge=class extends kh{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){cEe(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 tx(this.test.item.error,this),this.children.add(this.errorChild),this.addedOrRemoved(this))}},YWe=class extends C{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,$de(o$t,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(),$de(o$t,s,c,l).forEach(u=>u.fireChange())}));for(let n of t.collection.all)this.storeItem(this.createItem(n))}get rootsWithChildren(){let e=ht.map(this.testService.collection.rootItems,t=>this.items.get(t.item.extId));return ht.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||!ht.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 Oge&&s.push(this.unstoreItem(l));n instanceof Oge&&$de(o$t,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,_We(this.lastState,this.rootsWithChildren,t),{diffIdentityProvider:yGt});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 Oge&&e.test.expand!==0&&this.testService.collection.expand(e.test.item.extId,t)}createItem(e){let t=Pr.parentId(e.item.extId),o=t?this.items.get(t):null;return new Oge(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||TWe(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,$de(o$t,e,void 0,!!e.ownDuration).forEach(r=>r.fireChange()))}};YWe=I([m(1,Es),m(2,ed)],YWe);var YIo={"@failed":d(15220,null),"@executed":d(15219,null),"@doc":d(15213,null),"@openedFiles":d(15216,null),"@hidden":d(15218,null)},XWe=class extends oc{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 st("markersFiltersAction",d(15215,null),"testing-filter-button "+q.asClassName(Pnt));this.history=this._register(n.createInstance(dS,{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 jo(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(ELe,{id:"testing.explorer.filter",ariaLabel:d(15212,null),parent:o,suggestionProvider:{triggerCharacters:["@"],provideResults:()=>[...Object.entries(YIo).map(([l,c])=>({label:l,detail:c})),...ht.map(this.testService.collection.tags.values(),l=>{let{ctrlId:c,tagId:u}=LDt(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(15211,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 ji(e,{actionViewItemProvider:(l,c)=>{if(l.id===this.filtersAction.id)return this.instantiationService.createInstance(Irt,l,c,this.state,this.actionRunner)}})).push(this.filtersAction,{icon:!0,label:!1}),this.layout(this.wrapper.clientWidth)}layout(e){this.input.layout(new ai(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}};XWe=I([m(2,k0),m(3,F),m(4,Es)],XWe);var Irt=class extends wp{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:YIo[e],run:()=>this.filters.toggleFilteringFor(e),tooltip:"",dispose:()=>null})),new li,{checked:this.filters.fuzzy.value,class:void 0,enabled:!0,id:"fuzzy",label:d(15214,null),run:()=>this.filters.fuzzy.value=!this.filters.fuzzy.value,tooltip:""},new li,{checked:this.filters.isFilteringFor("@hidden"),class:void 0,enabled:this.testService.excluded.hasAny,id:"showExcluded",label:d(15218,null),run:()=>this.filters.toggleFilteringFor("@hidden"),tooltip:""},{class:void 0,enabled:this.testService.excluded.hasAny,id:"removeExcluded",label:d(15217,null),run:async()=>this.testService.excluded.clear(),tooltip:""}]}updateChecked(){this.element.classList.toggle("checked",this._action.checked)}};Irt=I([m(4,ze),m(5,Es)],Irt);var JWe=class extends zr{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(H.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(mo)}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):hR(e,p),l.set(p,h)),h},u=(p,h)=>{if(!(p instanceof kh)||!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 kh&&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(mo);if(p.length){e:for(let h of p)if(h instanceof kh){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"&&!hR(e,p)||(r.add(h.test),h.children.forEach(g=>u(g,!0))))}return{include:[...r],exclude:s}}render(){super.render(),this._register(zE({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=R(e,_(".test-explorer")),this.treeHeader=R(this.container,_(".test-explorer-header")),this.filterActionBar.value=this.createFilterActionBar();let t=R(this.treeHeader,_(".result-summary-container"));this._register(this.instantiationService.createInstance(yrt,t));let o=R(this.container,_(".test-explorer-tree"));this.viewModel=this.instantiationService.createInstance(wrt,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(XWe,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(pi({id:`${f.id}.$root`,label:f.label.get(),enabled:!1,checked:!1,run:()=>{}}))),r=r||b.hasConfigurationHandler,n++,t.push(pi({id:`${f.id}.${b.profileId}`,label:s.includes(b)?d(15222,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=Uc(u),h=[];return n>1&&h.push(pi({id:"selectDefaultTestConfigurations",label:d(15224,null),run:()=>this.commandService.executeCommand("testing.selectDefaultTestProfiles",e)})),r&&h.push(pi({id:"configureTestProfiles",label:d(15221,null),run:()=>this.commandService.executeCommand("testing.configureProfile",e)})),{numberOfProfiles:n,actions:p.length>0?li.join(t,p,h):li.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(Eo,{id:t.id,title:t.label,icon:e===2?z8:_ge},void 0,void 0,void 0,void 0);return this.instantiationService.createInstance(dI,r,this.getDropdownAction(),n.actions,"",o)}getDropdownAction(){return new st("selectRunConfig",d(15235,null),"codicon-chevron-down",!0)}getContinuousRunDropdown(e,t){let o=[...ht.flatMap(this.testProfileService.all(),c=>this.testService.collection.getNodeById(c.controller.id)?.children.size?ht.filter(c.profiles,u=>u.supportsContinuousRun):ht.empty())];if(o.length<=1)return super.createActionViewItem(e,t);let n=this.instantiationService.createInstance(Eo,{id:e.id,title:e.label,icon:e.id==="testing.startContinuousRun"?Nnt:mGt},void 0,void 0,void 0,void 0),r=[],s=wI(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:Spi[c],enabled:!1,class:void 0,tooltip:Spi[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(dI,n,this.getDropdownAction(),r,"",t)}createFilterActionBar(){let e=new ji(this.treeHeader,{actionViewItemProvider:(t,o)=>this.createActionViewItem(t,o),triggerKeys:{keyDown:!1,keys:[]}});return e.push(new st("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(kye,{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)}};JWe=I([m(1,ze),m(2,_e),m(3,B),m(4,F),m(5,Ri),m(6,X),m(7,Qe),m(8,De),m(9,Es),m(10,tt),m(11,$d),m(12,ge),m(13,qt),m(14,oM)],JWe);var Cnn=200,yrt=class extends C{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(),Cnn));this.elements=bt("div.result-summary",[bt("div@status"),bt("div@count"),bt("div@count"),bt("span"),bt("duration@duration"),bt("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(Ni("mouse"),this.elements.count,"")),this._register(new ji(this.elements.rerun,{actionViewItemProvider:(u,p)=>Ca(s,u,p)})).push(s.createInstance(Eo,{...new Qnt().desc,icon:Wie},{...new Ynt().desc,icon:ex},{},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(15223,null),this.badgeDisposable.clear();return}let l=e.filter(u=>!u.completedAt),c;if(l.length){n.className=q.asClassName(cE),c=yWe(!0,l),this.renderLoop.schedule();let u=l[l.length-1];r.textContent=krt(Date.now()-u.startedAt),s.style.display="none"}else{let u=e[0],p=DT($9e,h=>u.counts[h]>0?h:void 0);n.className=q.asClassName(HA.get(p??0)),c=yWe(!1,[u]),r.textContent=u instanceof Ih?krt(u.completedAt-u.startedAt):"",s.style.display="block"}t.textContent=`${c.passed}/${c.totalWillBeRun}`,this.countHover.update(Rnt(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 eK&&this.lastBadge.icon===cE)return;this.lastBadge=new eK(cE,()=>d(15234,null))}else if(e&&this.badgeType!=="off"&&e[this.badgeType]!==0){if(this.badgeDisposable.value&&this.lastBadge instanceof qc&&this.lastBadge.number===e[this.badgeType])return;this.lastBadge=new qc(e[this.badgeType],o=>this.getLocalizedBadgeString(this.badgeType,o))}else if(this.crService.isEnabled()){if(this.badgeDisposable.value&&this.lastBadge instanceof eK&&this.lastBadge.icon===Ont)return;this.lastBadge=new eK(Ont,()=>d(15228,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(15230,null,t);case"skipped":return d(15231,null,t);default:return d(15229,null,t)}}};yrt=I([m(1,ed),m(2,zl),m(3,oM),m(4,B),m(5,F),m(6,tt)],yrt);var wrt=class extends C{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 rPi(()=>this.tree.getSelection().filter(mo)));this.hasPendingReveal=!1;this.onChangeWelcomeVisibility=this.welcomeVisibilityEmitter.event;this.welcomeExperience=0;this.hasPendingReveal=!!u.reveal.get(),this.noTestForDocumentWidget=this._register(p.createInstance(xrt,e)),this.lastViewState=this._register(new dS({key:"testing.treeState",scope:1,target:1},this.storageService)),this._viewMode=Ji.viewMode.bindTo(g),this._viewSorting=Ji.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(Crt,c.collection),this.tree=p.createInstance(i$t,"Test Explorer List",e,new lPi,[p.createInstance(toe,this.actionRunner),p.createInstance(eoe)],{identityProvider:p.createInstance(cPi),hideTwistiesOfChildlessElements:!1,sorter:p.createInstance(nPi,this),keyboardNavigationLabelProvider:p.createInstance(aPi),accessibilityProvider:p.createInstance(sPi),filter:this.filter,findWidgetEnabled:!1});let w=this._register(new Dt(()=>{let U=this.tree.getOptimizedViewState(this.lastViewState.get({})),G=this.projection.value;G&&(G.lastState=U)},3e3));this._register(this.tree.onDidChangeCollapseState(U=>{U.node.element instanceof kh&&(U.node.collapsed||this.projection.value?.expandElement(U.node.element,U.deep?1/0:0),w.schedule())})),this._register(this.crService.onDidChange(U=>{if(U){let G=this.projection.value?.getElementByTestId(U);this.tree.resort(G?.parent&&this.tree.hasElement(G.parent)?G.parent:null,!1)}})),this._register(t(U=>{U&&this.ensureProjection()})),this._register(this.tree.onContextMenu(U=>this.onContextMenu(U))),this._register(H.any(u.text.onDidChange,u.fuzzy.onDidChange,c.excluded.onTestExclusionsChanged)(()=>{if(!u.text.value)return this.tree.refilter();let U=this.filter.lastIncludedTests=new Set;this.tree.refilter(),this.filter.lastIncludedTests=void 0;for(let G of U)this.tree.expandTo(G)})),this._register(this.tree.onDidOpen(U=>{U.element instanceof kh&&(u.didSelectTestInExplorer(U.element.test.item.extId),!U.element.children.size&&U.element.test.item.uri&&(this.tryPeekError(U.element)||y.executeCommand("vscode.revealTest",U.element.test.item.extId,{openToSide:U.sideBySide,preserveFocus:!0})))})),this._register(this.tree),this._register(this.onChangeWelcomeVisibility(U=>{this.noTestForDocumentWidget.setVisible(U===2)})),this._register(Vo(this.tree.getHTMLElement(),"keydown",U=>{U.equals(3)?this.handleExecuteKeypress(U):cti.mightProducePrintableCharacter(U)&&(u.text.value=U.browserEvent.key,u.focusInput())})),this._register(he(U=>{this.revealById(u.reveal.read(U),void 0,!1)})),this._register(t(U=>{U&&u.focusInput()}));let k=Lp(o,"testing.followRunningTest");this._register(o.onDidChangeConfiguration(U=>{U.affectsConfiguration("testing.followRunningTest")&&(k=Lp(o,"testing.followRunningTest"))}));let T=Lp(o,"testing.alwaysRevealTestOnStateChange");this._register(o.onDidChangeConfiguration(U=>{U.affectsConfiguration("testing.alwaysRevealTestOnStateChange")&&(T=Lp(o,"testing.alwaysRevealTestOnStateChange"))})),this._register(f.onTestChanged(U=>{k&&U.reason===1&&(this.tree.selectionSize>1||U.item.ownComputedState!==2&&!(U.previousState===1&&Gto(U.item.ownComputedState))||this.revealById(U.item.item.extId,T,!1))})),this._register(f.onResultsChanged(()=>{this.tree.resort(null)})),this._register(this.testProfileService.onDidChange(()=>{this.tree.rerender()}));let N=ui(this,n.onDidEditorsChange,()=>new Set(r.groups.flatMap(U=>U.editors).map(U=>U.resource).filter(mo))),O=ui(this,n.onDidActiveEditorChange,()=>n.activeEditor instanceof Fa?n.activeEditor.primary.resource:n.activeEditor?.resource),V=ui(this.filterState.text.onDidChange,()=>this.filterState.text);this._register(he(U=>{V.read(U),this.filterState.isFilteringFor("@openedFiles")?this.filter.filterToDocumentUri([...N.read(U)]):this.filter.filterToDocumentUri([O.read(U)].filter(mo)),(this.filterState.isFilteringFor("@doc")||this.filterState.isFilteringFor("@openedFiles"))&&this.tree.refilter()})),this._register(this.storageService.onWillSaveState(({reason:U})=>{U===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=[...Pr.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 kh;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=nn(()=>{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=>ak(o.state))?this.peekOpener.tryPeekFirstError(t[0],t[1],{preserveFocus:!0}):!1}onContextMenu(e){let t=e.element;if(!(t instanceof kh))return;let{actions:o}=JIo(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 kh);r.length&&this.testService.runTests({group:2,tests:r.map(s=>s.test)})}reevaluateWelcomeState(){let t=this.testService.collection.busyProviders===0&&Xto(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(QWe,e):this.projection.value=this.instantiationService.createInstance(YWe,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()}};wrt=I([m(2,B),m(3,ee),m(4,Et),m(5,qt),m(6,ze),m(7,Es),m(8,k0),m(9,F),m(10,le),m(11,X),m(12,ed),m(13,RD),m(14,$d),m(15,oM),m(16,ge)],wrt);var xnn=(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},Crt=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 tx)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")?ak(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 kh)||this.documentUris.some(e=>xnn(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?hGe(n,s):n.includes(s))&&(o=r?2:0);if(o!==1)return o}return 1}};Crt=I([m(1,k0),m(2,Es),m(3,dt)],Crt);var nPi=class{constructor(i){this.viewModel=i}compare(i,e){if(i instanceof tx||e instanceof tx)return(i instanceof tx?-1:0)+(e instanceof tx?1:0);let t=(e.duration||0)-(i.duration||0);if(this.viewModel.viewSorting==="duration"&&t!==0)return t;let o=G9e(i.state,e.state);if(this.viewModel.viewSorting==="status"&&o!==0)return o;let n=!1;if(i instanceof kh&&e instanceof kh&&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:jE(r||i.test.item.label,s||e.test.item.label)}},xrt=class extends C{constructor(i,e){super();let t=this.el=R(i,_(".testing-no-test-placeholder")),o=R(t,_("p"));o.innerText=d(15233,null);let n=d(15232,null),r=this._register(new Mi(t,{title:n,...Ko}));r.label=n,this._register(r.onDidClick(()=>e.toggleFilteringFor("@doc",!1)))}setVisible(i){this.el.classList.toggle("visible",i)}};xrt=I([m(1,k0)],xrt);var rPi=class extends as{constructor(e){super();this.getSelectedTests=e}async runAction(e,t){if(!(e instanceof Eo))return super.runAction(e,t);let o=this.getSelectedTests(),s=(o.some(l=>l===t)?o:[t]).filter(l=>l instanceof kh);await e.run(...s)}},XIo=a=>{let i=vMt(a.description||a.test.item.label,a.state);return a instanceof kh&&(a.duration!==void 0&&(i=d(15226,null,i,krt(a.duration))),a.retired&&(i=d(15227,null,i))),i},sPi=class{getWidgetAriaLabel(){return d(15225,null)}getAriaLabel(i){return i instanceof tx?i.description:XIo(i)}},aPi=class{getKeyboardNavigationLabel(i){return i instanceof tx?i.message:i.test.item.label}},lPi=class{getHeight(i){return i instanceof tx?27:22}getTemplateId(i){return i instanceof tx?eoe.ID:toe.ID}},cPi=class{getId(i){return i.treeId}},eoe=class{constructor(i,e){this.hoverService=i;this.markdownRendererService=e}static{this.ID="error"}get templateId(){return eoe.ID}renderTemplate(i){return{label:R(i,_(".error")),disposable:new P}}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(Ni("mouse"),t.label,i.description))}disposeTemplate(i){i.disposable.dispose()}};eoe=I([m(0,tt),m(1,Qn)],eoe);var toe=class extends C{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=toe.ID}static{this.ID="testItem"}renderTemplate(e){e.classList.add("testing-stdtree-container");let t=R(e,_(".computed-state")),o=R(e,_(".label")),n=new P;R(e,_(q.asCSSSelector($So)));let r=n.add(new ji(e,{actionRunner:this.actionRunner,actionViewItemProvider:(l,c)=>l instanceof Eo?this.instantiationService.createInstance(ml,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||Pr.isChild(c,l))&&this.fillActionBar(s.current,s)}));let s={wrapper:e,label:o,actionBar:r,icon:t,elementDisposable:new P,templateDisposable:n};return s}disposeTemplate(e){e.templateDisposable.clear()}disposeElement(e,t,o){o.elementDisposable.clear()}fillActionBar(e,t){let{actions:o,contextOverlay:n}=JIo(this.contextKeyService,this.menuService,this.testService,this.crService,this.profiles,e),r=!!n.getContextKeyValue(Ji.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=HA.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(Ni("mouse"),t.label,XIo(e.element))),e.element.test.item.label.trim()?Fi(t.label,...Bn(e.element.test.item.label)):t.label.textContent="\xA0";let r=e.element.description;e.element.duration!==void 0&&(r=r?`${r}: ${krt(e.element.duration)}`:krt(e.element.duration)),r&&R(t.label,_("span.test-label-description",{},r))}};toe=I([m(1,qt),m(2,Es),m(3,$d),m(4,X),m(5,F),m(6,oM),m(7,tt)],toe);var krt=a=>a<10?`${a.toFixed(1)}ms`:a<1e3?`${a.toFixed(0)}ms`:`${(a/1e3).toFixed(1)}s`,JIo=(a,i,e,t,o,n)=>{let r=n instanceof kh?n.test:void 0,s=DWe(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&&hR(g,r));s.push([Ji.canRefreshTests.key,p&&!!(p.capabilities.get()&2)&&Pr.isRoot(r.item.extId)],[Ji.testItemIsHidden.key,e.excluded.contains(r)],[Ji.isContinuousModeOn.key,h&&t.isSpecificallyEnabledFor(r.item.extId)],[Ji.isParentRunningContinuously.key,h&&t.isEnabledForAParentOf(r.item.extId)],[Ji.supportsContinuousRun.key,h],[Ji.testResultOutdated.key,n.retired],[Ji.testResultState.key,DDt[n.state]])}let l=a.createOverlay(s),c=i.getMenuActions(D.TestItem,l,{shouldForwardArgs:!0});return{actions:hl(c,"inline"),contextOverlay:l}};is((a,i)=>{if(a.type==="dark"){let e=a.getColor(ko);if(e){let t=new Oe(new Bt(e.rgba.r,e.rgba.g,e.rgba.b,.65));i.addRule(`.test-explorer .test-explorer-messages { color: ${t}; }`)}}});var Fge=class extends C{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=he(s=>{t.selected.read(s)&&(r.dispose(),Vie.register())});this._register(r)}static{this.ID="workbench.contrib.testing.progressTrigger"}attachAutoOpenForNewResults(e){if(e.request.preserveFocus===!0)return;let t=Lp(this.configurationService,"testing.automaticallyOpenTestResults");if(t==="neverOpen")return;if(t==="openExplorerOnTestStart")return this.openExplorerView();if(t==="openOnTestStart")return this.openResultsView();let o=new P;o.add(e.onComplete(()=>o.dispose())),o.add(e.onChange(n=>{n.reason===1&&ak(n.item.ownComputedState)&&(this.openResultsView(),o.dispose())}))}openExplorerView(){this.viewsService.openView("workbench.view.testing",!1)}openResultsView(){this.viewsService.openView("workbench.panel.testResults.view",!1)}};Fge=I([m(0,ed),m(1,Tw),m(2,B),m(3,Ft)],Fge);var ZWe=class extends Ha{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(15247,null)}};ZWe=I([m(0,fi),m(1,Te),m(2,F),m(3,ze),m(4,De),m(5,le),m(6,B),m(7,lt),m(8,Pe),m(9,Ri),m(10,ne)],ZWe);we(Es,IWe,1);we(wMt,ATe,1);we($d,MTe,1);we(Tw,vWe,1);we(oM,wWe,1);we(ed,NTe,1);we(k0,bWe,1);we(RD,Jie,1);we(Mnt,jWe,1);var knn=oe.as(on.ViewContainersRegistry).registerViewContainer({id:"workbench.view.extension.test",title:L(15186,"Testing"),ctorDescriptor:new Mt(ZWe),icon:xWe,alwaysUseContainerInfo:!0,order:6,openCommandActionDescriptor:{id:"workbench.view.extension.test",mnemonicTitle:d(15183,null),order:4},hideIfEmpty:!0},0),Enn=oe.as(on.ViewContainersRegistry).registerViewContainer({id:"workbench.panel.testResults",title:L(15189,"Test Results"),icon:NRi,ctorDescriptor:new Mt(Ha,["workbench.panel.testResults",{mergeViewWithContainerWhenSingleView:!0}]),hideIfEmpty:!0,order:3},1,{doNotRegisterOpenCommand:!0}),n$t=oe.as(on.ViewsRegistry);n$t.registerViews([{id:"workbench.panel.testResults.view",name:L(15189,"Test Results"),containerIcon:NRi,canToggleVisibility:!1,canMoveView:!0,when:Ji.hasAnyResults.isEqualTo(!0),ctorDescriptor:new Mt(qWe)}],Enn);n$t.registerViewWelcomeContent("workbench.view.testing",{content:d(15184,null)});n$t.registerViewWelcomeContent("workbench.view.testing",{content:"["+d(15185,null)+"](command:testing.searchForTestExtension)",order:10});n$t.registerViews([{id:"workbench.view.testing",name:L(15188,"Test Explorer"),ctorDescriptor:new Mt(JWe),canToggleVisibility:!0,canMoveView:!0,weight:80,order:-999,containerIcon:xWe,when:x.greater(Ji.providerCount.key,0)},{id:"workbench.view.testCoverage",name:L(15187,"Test Coverage"),ctorDescriptor:new Mt(EWe),canToggleVisibility:!0,canMoveView:!0,weight:80,order:-998,containerIcon:xWe,when:Ji.isTestCoverageOpen}],knn);bIo.forEach(W);W(JGt);W(YGt);W(QGt);W(qGt);W(ZGt);W(XGt);pt(Tge.ID,Tge,ut.AfterRestored);pt(Jie.ID,Jie,ut.Eventually);pt(Fge.ID,Fge,ut.Eventually);pt(xge.ID,xge,ut.Eventually);go("editor.contrib.testingOutputPeek",Pb,1);go("editor.contrib.testingDecorations",UA,1);go("editor.contrib.coverageDecorations",Bie,3);qe.registerCommand({id:"_revealTestInExplorer",handler:async(a,i,e)=>{a.get(k0).reveal.set(typeof i=="string"?i:i.extId,void 0),a.get(Ft).openView("workbench.view.testing",e)}});qe.registerCommand({id:"testing.startContinuousRunFromExtension",handler:async(a,i,e)=>{let t=a.get($d),o=a.get(Es).collection,n=t.getControllerProfiles(i.controllerId).find(s=>s.profileId===i.profileId);if(!n?.supportsContinuousRun)return;let r=a.get(oM);for(let s of e){let l=o.getNodeById(s.extId);l&&hR(n,l)&&r.start([n],l.item.extId)}}});qe.registerCommand({id:"testing.stopContinuousRunFromExtension",handler:async(a,i)=>{let e=a.get(oM);for(let t of i)e.stop(t.extId)}});qe.registerCommand({id:"vscode.peekTestError",handler:async(a,i)=>{let e=a.get(ed).getStateById(i);if(!e)return!1;let[t,o]=e,n=a.get(RD);if(n.tryPeekFirstError(t,o))return!0;for(let r of t.tests)if(Pr.compare(o.item.extId,r.item.extId)===2&&n.tryPeekFirstError(t,r))return!0;return!1}});qe.registerCommand({id:"vscode.revealTest",handler:async(a,i,e)=>{let t=a.get(Es).collection.getNodeById(i);if(!t)return;let o=a.get(ge),n=a.get(be),r=a.get(Qe),{range:s,uri:l}=t.item;if(!l)return;let c=a.get(Mnt).getDecoratedTestPosition(l,i)||s?.getStartPosition();a.get(k0).reveal.set(i,void 0),a.get(RD).closeAllPeeks();let u=!0;try{(await n.stat(l)).isFile||(u=!1)}catch{}if(!u){await o.executeCommand(JF,l);return}await r.open(c?l.with({fragment:`L${c.lineNumber}:${c.column}`}):l,{openToSide:e?.openToSide,editorOptions:{preserveFocus:e?.preserveFocus}})}});qe.registerCommand({id:"vscode.runTestsById",handler:async(a,i,...e)=>{let t=a.get(Es);await Xnt(a.get(Es).collection,a.get(Bo),e,o=>t.runTests({group:i,tests:o}))}});qe.registerCommand({id:"vscode.testing.getControllersWithTests",handler:async a=>[...a.get(Es).collection.rootItems].filter(e=>e.children.size>0).map(e=>e.controllerId)});qe.registerCommand({id:"vscode.testing.getTestsInFile",handler:async(a,i)=>[...a.get(Es).collection.getNodeByUrl(i)].map(t=>Pr.split(t.item.extId))});oe.as(ii.Configuration).registerConfiguration(ESo);var lG=class extends st{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(10900,"Set Log Level...")}async run(){let e=await this.selectLogLevelOrChannel();e!==null&&(N6(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=LP(s)?[s.source]:EV(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(10888,null)}),r.push(...this.getLogLevelEntries(e.default,this.loggerService.getLogLevel(),!0)),t.length&&(r.push({type:"separator",label:d(10891,null)}),r.push(...t.sort((s,l)=>s.label.localeCompare(l.label)))),r.push({type:"separator",label:d(10893,null)}),r.push(...o.sort((s,l)=>s.label.localeCompare(l.label))),new Promise((s,l)=>{let c=new P,u=c.add(this.quickInputService.createQuickPick({useSeparators:!0}));u.placeholder=d(10896,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 P,c=l.add(this.quickInputService.createQuickPick());c.placeholder=e?d(10898,null,e?.label):d(10897,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(M.checkAll),tooltip:d(10895,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=zGe(e).value;return e===t?`$(check) ${o}`:o}getDescription(e,t){return t===e?d(10890,null):void 0}};lG=I([m(2,Ge),m(3,ol),m(4,Ml),m(5,aD)],lG);var r$t=class extends st{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(10894,"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:Ye(o),description:n===0?d(10889,null):void 0}))),{canPickMany:!1,placeHolder:d(10899,null)});if(e){let t=await this.quickInputService.pick(this.getLogFiles(A.parse(e.id)).then(o=>o.map(n=>({id:n.toString(),label:Ye(n)}))),{canPickMany:!1,placeHolder:d(10892,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=>!Xe(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):[]}};r$t=I([m(2,Vt),m(3,be),m(4,Ge),m(5,ee)],r$t);W(class extends K{constructor(){super({id:lG.ID,title:lG.TITLE,category:We.Developer,f1:!0})}run(a){let i=a.get(F).createInstance(lG,lG.ID,lG.TITLE.value);return i.run().finally(()=>i.dispose())}});W(class extends K{constructor(){super({id:"workbench.action.setDefaultLogLevel",title:L(10886,"Set Default Log Level"),category:We.Developer})}run(a,i,e){return a.get(aD).setDefaultLogLevel(i,e)}});var Ert=class extends C{constructor(e,t,o){super();this.loggerService=e;this.contextKeyService=t;this.uriIdentityService=o;this.contextKeys=new ebe;this.outputChannelRegistry=oe.as(sS.OutputChannels);let n=sKi.bindTo(t);n.set($w(e.getLogLevel())),this._register(e.onDidChangeLogLevel(r=>{N6(r)&&n.set($w(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(H.filter(t.onDidChangeContext,r=>r.affectsSome(this.contextKeys))(()=>this.onDidChangeContext()))}onDidAddLoggers(e){for(let t of e){if(t.when){let o=x.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(x.deserialize(e.when))?this.registerLogChannel(e):this.deregisterLogChannel(e))}onDidRemoveLoggers(e){for(let t of e){if(t.when){let o=x.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&&LP(t)&&this.uriIdentityService.extUri.isEqual(t.source.resource,e.resource))return;let o=this.outputChannelRegistry.getChannel(e.id),n=o&&LP(o)&&o.source.resource.scheme===Y.vscodeRemote?this.loggerService.getRegisteredLogger(o.source.resource):void 0;n&&this.deregisterLogChannel(n);let r=o&&e.resource.scheme===Y.vscodeRemote,s=r?`${e.id}.remote`:e.id,l=r?d(10885,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?EV(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&&EV(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:iK,title:L(10887,"Show Window Log"),category:We.Developer,f1:!0})}async run(t){t.get(Ml).showChannel(eue)}}))}};Ert=I([m(0,ol),m(1,X),m(2,dt)],Ert);oe.as(Qi.Workbench).registerWorkbenchContribution(Ert,3);var E0=class{constructor(i,e,t){this.quickInputService=i;this.keybindingService=e;this.contextKeyService=t;this.registry=oe.as(Tu.Quickaccess)}static{this.PREFIX="?"}provide(i){let e=new P;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(E0.PREFIX.length),this.contextKeyService);o?.prefix&&o.prefix!==E0.PREFIX&&this.quickInputService.quickAccess.show(o.prefix,{preserveValue:!0})})),i.items=this.getQuickAccessProviders().filter(t=>t.prefix!==E0.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(2225,null,o,e.description),description:e.description}})}};E0=I([m(0,Ge),m(1,_e),m(2,X)],E0);var pH=class extends yh{constructor(e,t,o,n,r,s,l,c){super(pH.PREFIX,{noResultsPick:{label:d(12657,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:Up(e,s.label,!0)??void 0},s.highlights.label||hGe(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(12664,null)),o(1,d(12659,null)),o(2,d(12661,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(12663,null,`${l+1}.${u+1}`,c.title);e.push({label:p,containerLabel:d(12662,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(12656,null),accept:async()=>{await this.debugService.focusStackFrame(void 0,void 0,s,{explicit:!0}),this.viewsService.isViewVisible(ld)||await this.viewsService.openView(ld,!0)}})});let r=this.outputService.getChannelDescriptors();for(let s of r)e.push({label:s.label,containerLabel:d(12655,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}};pH=I([m(0,Ri),m(1,Ft),m(2,Ml),m(3,Yo),m(4,jl),m(5,Li),m(6,ds),m(7,X)],pH);var eVe=class a extends K{static{this.ID="workbench.action.openView"}constructor(){super({id:a.ID,title:L(12658,"Open View"),category:We.View,f1:!0})}async run(i){i.get(Ge).quickAccess.show(pH.PREFIX)}},Trt=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(12660,"Quick Open View"),category:We.View,f1:!1,keybinding:{weight:200,when:void 0,...a.KEYBINDING}})}async run(i){let e=i.get(_e),t=i.get(Ge),o=e.lookupKeybindings(a.ID);t.quickAccess.show(pH.PREFIX,{quickNavigateConfiguration:{keybindings:o},itemActivation:1})}};var T0=class extends yh{constructor(e,t,o,n,r,s){super(T0.PREFIX,e);this.keybindingService=o;this.commandService=n;this.telemetryService=r;this.dialogService=s;this.commandsHistory=this._register(t.createInstance(Td)),this.options=e}static{this.PREFIX=">"}static{this.TFIDF_THRESHOLD=.5}static{this.TFIDF_MAX_RESULTS=5}static{this.WORD_FILTER=GN(z9,Gy)}async _getPicks(e,t,o,n){let r=await this.getCommandPicks(o);if(o.isCancellationRequested)return[];let s=wd(()=>{let f=new ULe;f.updateDocuments(r.map(b=>({key:b.commandId,textChunks:[this.getTfIdfChunk(b)]})));let v=f.calculateScores(e,o);return Pao(v).filter(b=>b.score>T0.TFIDF_THRESHOLD).slice(0,T0.TFIDF_MAX_RESULTS)}),l=[];for(let f of r){let v=T0.WORD_FILTER(e,f.label)??void 0,b;if(f.commandAlias&&(b=T0.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===We.Developer.value,w=v.commandCategory===We.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(2222,null)}),p=!0),h&&v.tfIdfScore!==void 0&&(u.push({type:"separator",label:d(2224,null)}),h=!1),g&&v.tfIdfScore===void 0&&!b&&this.options.suggestedCommandIds?.has(v.commandId)&&(u.push({type:"separator",label:d(2220,null)}),p=!0,g=!1),p&&v.tfIdfScore===void 0&&!b&&!this.options.suggestedCommandIds?.has(v.commandId)&&(u.push({type:"separator",label:d(2221,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(2224,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(2219,null,e.label,r.getAriaLabel()):e.label,l=e.buttons||[],c=o?[...l,{iconClass:q.asClassName(M.close),tooltip:d(2223,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){so(u)||this.dialogService.error(d(2218,null,e.label),In(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}};T0=I([m(1,F),m(2,_e),m(3,ge),m(4,Te),m(5,ct)],T0);var Td=class extends C{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=Td.getConfiguredCommandHistoryLength(this.configurationService),Td.cache&&Td.cache.limit!==this.configuredCommandsHistoryLength&&(Td.cache.limit=this.configuredCommandsHistoryLength,Td.hasChanges=!0))}load(){let e=this.storageService.get(Td.PREF_KEY_CACHE,0),t;if(e)try{t=JSON.parse(e)}catch(n){this.logService.error(`[CommandsHistory] invalid data: ${n}`)}let o=Td.cache=new il(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))}Td.counter=this.storageService.getNumber(Td.PREF_KEY_COUNTER,0,Td.counter)}push(e){Td.cache&&(Td.cache.set(e,Td.counter++),Td.hasChanges=!0)}peek(e){return Td.cache?.peek(e)}remove(e){Td.cache&&(Td.cache.delete(e),Td.hasChanges=!0)}saveState(){if(!Td.cache||!Td.hasChanges)return;let e={usesLRU:!0,entries:[]};Td.cache.forEach((t,o)=>e.entries.push({key:o,value:t})),this.storageService.store(Td.PREF_KEY_CACHE,JSON.stringify(e),0,0),this.storageService.store(Td.PREF_KEY_COUNTER,Td.counter,0,0),Td.hasChanges=!1}static getConfiguredCommandHistoryLength(e){let o=e.getValue().workbench?.commandPalette?.history;return typeof o=="number"?o:Td.DEFAULT_COMMANDS_HISTORY_LENGTH}static clearHistory(e,t){let o=Td.getConfiguredCommandHistoryLength(e);Td.cache=new il(o),Td.counter=1,Td.hasChanges=!0}};Td=I([m(0,le),m(1,B),m(2,ne)],Td);var s$t=class extends T0{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&&(xq(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:fu(t.label)||t.id})}return e}};var mH=class extends s$t{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super({showAlias:!IS.isDefaultVariant(),noResultsPick:()=>({label:d(12641,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=Wp(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(M.gear),tooltip:d(12638,null)}],trigger:()=>(this.preferencesService.openGlobalKeybindingSettings(!1,{query:Vno(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 Pi(mH.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(12635,null,o),commandId:this.configuration.experimental.askChatLocation==="quickChat"?wot:qC,args:[o],buttons:[{iconClass:q.asClassName(M.gear),tooltip:d(12636,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===mH.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 Eo&&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(12637,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||xq(h)?h:{value:h,original:h};e.push({commandId:r.item.id,commandWhen:r.item.precondition?.serialize(),commandAlias:p,label:fu(s),commandDescription:g,commandCategory:l})}return e}};mH=I([m(0,ee),m(1,qt),m(2,lt),m(3,F),m(4,_e),m(5,ge),m(6,Te),m(7,ct),m(8,B),m(9,Et),m(10,Po),m(11,nt),m(12,FTe),m(13,br)],mH);var q8=class a extends K{static{this.ID="workbench.action.showCommands"}constructor(){super({id:a.ID,title:L(12642,"Show All Commands"),keybinding:{weight:200,when:void 0,primary:yc?void 0:3118,secondary:[59]},f1:!0})}async run(i){i.get(Ge).quickAccess.show(mH.PREFIX)}},a$t=class extends K{constructor(){super({id:"workbench.action.clearCommandHistory",title:L(12634,"Clear Command History"),f1:!0})}async run(i){let e=i.get(B),t=i.get(le),o=i.get(ct);if(Td.getConfiguredCommandHistoryLength(e)>0){let{confirmed:r}=await o.confirm({type:"warning",message:d(12640,null),detail:d(12639,null),primaryButton:d(12633,null)});if(!r)return;Td.clearHistory(e,t)}}};var dPi=oe.as(Tu.Quickaccess);dPi.registerQuickAccessProvider({ctor:E0,prefix:E0.PREFIX,placeholder:d(12647,null,E0.PREFIX),helpEntries:[{description:d(12646,null),commandCenterOrder:70,commandCenterLabel:d(12652,null)}]});dPi.registerQuickAccessProvider({ctor:pH,prefix:pH.PREFIX,contextKey:"inViewsPicker",placeholder:d(12654,null),helpEntries:[{description:d(12653,null),commandId:eVe.ID}]});dPi.registerQuickAccessProvider({ctor:mH,prefix:mH.PREFIX,contextKey:"inCommandsPicker",placeholder:d(12645,null),helpEntries:[{description:d(12644,null),commandId:q8.ID,commandCenterOrder:20}]});fe.appendMenuItem(D.MenubarViewMenu,{group:"1_open",command:{id:q8.ID,title:d(12648,null)},order:1});fe.appendMenuItem(D.MenubarHelpMenu,{group:"1_welcome",command:{id:q8.ID,title:d(12651,null)},order:2});fe.appendMenuItem(D.MenubarViewMenu,{group:"1_open",command:{id:eVe.ID,title:d(12650,null)},order:2});fe.appendMenuItem(D.MenubarGoMenu,{group:"5_infile_nav",command:{id:"workbench.action.gotoLine",title:d(12649,null)},order:1});fe.appendMenuItem(D.GlobalActivity,{group:"1_command",command:{id:q8.ID,title:d(12643,null)},order:1});fe.appendMenuItem(D.EditorContext,{group:"z_commands",when:ue.editorSimpleInput.toNegated(),command:{id:q8.ID,title:d(12643,null)},order:1});W(a$t);W(q8);W(eVe);W(Trt);var Tnn="inViewsPicker",tyo=x.and($E,x.has(Tnn)),tVe=Trt.KEYBINDING,ZIo="workbench.action.quickOpenNavigateNextInViewPicker";yt.registerCommandAndKeybindingRule({id:ZIo,weight:250,handler:Y_(ZIo,!0),when:tyo,primary:tVe.primary,linux:tVe.linux,mac:tVe.mac});var eyo="workbench.action.quickOpenNavigatePreviousInViewPicker";yt.registerCommandAndKeybindingRule({id:eyo,weight:250,handler:Y_(eyo,!1),when:tyo,primary:tVe.primary|1024,linux:tVe.linux,mac:{primary:tVe.mac.primary|1024}});var PD=class extends zr{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(10471,"No Folder Opened")}shouldShowWelcome(){return!0}renderBody(e){super.renderBody(e),this._register(new Om(e,{onDrop:t=>{e.style.backgroundColor="",this.instantiationService.createInstance(sF,{allowWorkspaceOpen:!Gt||xx(this.contextService.getWorkspace())}).handleDrop(t,Me(e))},onDragEnter:()=>{let t=this.themeService.getColorTheme().getColor(mgt);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(PD.NAME.value):this.updateTitle(this.title))}dispose(){this._disposed=!0,super.dispose()}};PD=I([m(1,De),m(2,Ri),m(3,F),m(4,_e),m(5,ze),m(6,Pe),m(7,B),m(8,ot),m(9,X),m(10,Qe),m(11,tt)],PD);var uPi=Re("explorer-view-icon",M.files,d(10173,null)),Dnn=Re("open-editors-view-icon",M.book,d(10180,null)),Wge=class extends C{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(){sn("code/willRegisterExplorerViews");let e=ioe.getViews(Vge),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&&ioe.deregisterViews(o,Vge),t.length&&ioe.registerViews(t,Vge),sn("code/didRegisterExplorerViews")}createOpenEditorsViewDescriptor(){return{id:ww.ID,name:ww.NAME,ctorDescriptor:new Mt(ww),containerIcon:Dnn,order:0,canToggleVisibility:!0,canMoveView:!0,collapsed:!1,hideByDefault:!0,focusCommand:{id:"workbench.files.action.focusOpenEditorsView",keybindings:{primary:Ai(2089,35)}}}}createEmptyViewDescriptor(){return{id:PD.ID,name:PD.NAME,containerIcon:uPi,ctorDescriptor:new Mt(PD),order:1,canToggleVisibility:!0,focusCommand:{id:"workbench.explorer.fileView.focus"}}}createExplorerViewDescriptor(){return{id:Cb,name:L(10174,"Folders"),containerIcon:uPi,ctorDescriptor:new Mt(zR),order:1,canMoveView:!0,canToggleVisibility:!1,focusCommand:{id:"workbench.explorer.fileView.focus"}}}};Wge=I([m(0,Pe),m(1,Bo)],Wge);var _rt=class extends Ha{constructor(i,e,t,o,n,r,s,l,c,u,p,h){super(Hf,{mergeViewWithContainerWhenSingleView:!0},r,n,i,c,e,u,l,o,t,p,h),this.viewletVisibleContextKey=yoo.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===Cb?this.instantiationService.createInstance(zR,{...e,delegate:{willOpenElement:t=>{if(!Vp(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(!Vp(t))return;this.getOpenEditorsView()?.setStructuralRefreshDelay(0)}}}):super.createView(i,e)}getExplorerView(){return this.getView(Cb)}getOpenEditorsView(){return this.getView(ww.ID)}setVisible(i){this.viewletVisibleContextKey.set(i),super.setVisible(i)}focus(){let i=this.getView(Cb);i&&this.panes.every(e=>!e.isExpanded())&&i.setExpanded(!0),i?.isExpanded()?i.focus():super.focus()}};_rt=I([m(0,fi),m(1,Te),m(2,Pe),m(3,le),m(4,B),m(5,F),m(6,X),m(7,De),m(8,ze),m(9,lt),m(10,Ri),m(11,ne)],_rt);var Lnn=oe.as(on.ViewContainersRegistry),Vge=Lnn.registerViewContainer({id:Hf,title:L(10172,"Explorer"),ctorDescriptor:new Mt(_rt),storageId:"workbench.explorer.views.state",icon:uPi,alwaysUseContainerInfo:!0,hideIfEmpty:!0,order:0,openCommandActionDescriptor:{id:Hf,title:L(10172,"Explorer"),mnemonicTitle:d(10175,null),keybindings:{primary:3107},order:0}},0,{isDefault:!0}),pPi=d(10181,null),Rnn=d(10171,null),Mnn=d(10182,null),Pnn=`[${pPi}](command:${o_e.ID})`,Ann=`[${Rnn}](command:${o_e.ID})`,mPi=`[${pPi}](command:${nK.ID})`,Nnn=`[${pPi}](command:${i_e.ID})`,Onn=`[${Mnn}](command:${F5.ID})`,ioe=oe.as(on.ViewsRegistry);ioe.registerViewWelcomeContent(PD.ID,{content:d(10179,null,Pnn),when:x.and(Qa.isEqualTo("workspace"),PO),group:"2_open",order:1});ioe.registerViewWelcomeContent(PD.ID,{content:d(10178,null,Nnn,Onn),when:x.and(Qa.isEqualTo("workspace"),PO.toNegated()),group:"2_open",order:1});ioe.registerViewWelcomeContent(PD.ID,{content:d(10183,null,mPi),when:x.and(Qa.notEqualsTo("workspace"),ub.notEqualsTo(""),ep.toNegated()),group:"2_open",order:1});ioe.registerViewWelcomeContent(PD.ID,{content:d(10176,null,mPi,Ann),when:x.and(x.has("editorIsOpen"),x.or(x.and(Qa.notEqualsTo("workspace"),ub.isEqualTo("")),x.and(Qa.notEqualsTo("workspace"),ep))),group:"2_open",order:1});ioe.registerViewWelcomeContent(PD.ID,{content:d(10177,null,mPi),when:x.and(x.has("editorIsOpen")?.negate(),x.or(x.and(Qa.notEqualsTo("workspace"),ub.isEqualTo("")),x.and(Qa.notEqualsTo("workspace"),ep))),group:"2_open",order:1});var Bge=class extends C{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 wM(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(Uo(e.filter(t=>{if(!this.textFileService.isDirty(t))return!1;let o=this.textFileService.files.get(t);if(o?.hasState(2)||t.scheme!==Y.untitled&&!o?.hasState(5)&&this.filesConfigurationService.hasShortAutoSaveDelay(t)||this.editorService.isOpened({resource:t,typeId:t.scheme===Y.untitled?qm.ID:pue,editorId:Ys.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(){Uo(si(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}}))}};Bge=I([m(0,ee),m(1,Ho),m(2,ao),m(3,oi),m(4,Kt),m(5,lr),m(6,Vf)],Bge);var j8=class extends CR{constructor(e,t,o,n,r){super(j8.ID,e,{openInternal:(s,l)=>this.openInternal(s,l)},t,o,r);this.editorResolverService=n}static{this.ID=UPt}async openInternal(e,t){if(e instanceof hI&&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(tV(r))for(let s of r.editor instanceof Fa?[r.editor.original,r.editor.modified]:[r.editor])s instanceof hI&&(s.setForceOpenAsText(),s.setPreferredLanguageId(E_e));await this.group.replaceEditors([{editor:o,replacement:r?.editor??e,options:{...r?.options??t}}])}}getTitle(){return this.input?this.input.getName():d(10142,null)}};j8=I([m(1,Te),m(2,De),m(3,ul),m(4,le)],j8);var iVe=new $U,ooe=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 P;this.fileChangeEvents=[];this.config=this.configurationService.getValue("explorer"),this.model=new KBt(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=iyo(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(Ye(v))){g=!0;break}}}),g&&await this.refresh(!1)},ooe.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(H.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 YS(p=>Wnn(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 $e,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:iVe,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=Tg.create(this.fileService,this.configurationService,this.filesConfigurationService,s,void 0,n.resolveTo);Tg.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=Tg.create(this.fileService,this.configurationService,this.filesConfigurationService,c,r.parent);Tg.mergeLocalWithDisk(u,r)}}let l=Tg.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()}};ooe=I([m(0,be),m(1,B),m(2,Pe),m(3,Wi),m(4,ee),m(5,dt),m(6,ma),m(7,Bo),m(8,oi),m(9,lr)],ooe);function iyo(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&&iyo(n,i,e,t)))return!0;return!1}function Wnn(a){let i=a?.explorer?.autoRevealExclude;return i||{}}var Hge=class extends C{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 vt(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(St.Warning,d(10506,null),[{label:d(10508,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(St.Warning,d(10507,null),[{label:d(10509,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 vt(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(Xl(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 P;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)&&(Ue(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()}};Hge=I([m(0,be),m(1,B),m(2,Pe),m(3,Ne),m(4,Qe),m(5,dt),m(6,oi),m(7,Te)],Hge);var Uge=class extends C{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(Hf,{badge:new qc(e,t=>t===1?d(10510,null):d(10511,null,e))}):this.badgeHandle.clear()}};Uge=I([m(0,zl),m(1,Wa),m(2,lr)],Uge);var l$t=class{canSerialize(i){return!0}serialize(i){let e=i,t=e.resource,o=e.preferredResource,n={resourceJSON:t.toJSON(),preferredResourceJSON:Xe(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(lk).createTextEditor({resource:n,label:s,description:l,encoding:c,languageId:u,forceFile:!0});return r&&p.setPreferredResource(r),p})}},zge=class extends C{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===CP&&this.fileService.canHandleResource(e.resource)}handlesSync(e){return e.typeId===CP&&this.fileService.hasProvider(e.resource)}isOpen(e,t){return this.handlesSync(e)?Xe(e.resource,t.resource):!1}createEditor(e){return this.textEditorService.createTextEditor({resource:e.resource,forceFile:!0})}};zge=I([m(0,Vf),m(1,lk),m(2,be)],zge);var Q8=class extends fJ{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k){super(Q8.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=mF}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(10149,null)}get input(){return this._input}async setInput(e,t,o,n){sn("code/willSetInputToTextFileEditor"),await super.setInput(e,t,o,n);try{let r=await e.resolve(t);if(n.isCancellationRequested)return;if(r instanceof hK)return this.openAsBinary(e,t);let s=r,l=Oi(this.editorControl);if(l.setModel(s.textEditorModel),!Mj(t?.viewState)){let c=this.loadEditorViewState(e,o);c&&(t?.selection&&(c.cursorState=[]),l.restoreViewState(c))}t&&QE(t,l,1),l.updateOptions(this.getReadonlyConfiguration(s.isReadonly())),l.handleInitialized&&l.handleInitialized()}catch(r){await this.handleSetInputError(r,e,t)}sn("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(pi({id:"workbench.files.action.openFolder",label:d(10147,null),run:async()=>this.hostService.openWindow([{folderUri:t.resource}],{forceNewWindow:!0})})),this.contextService.isInsideWorkspace(t.preferredResource)&&n.push(pi({id:"workbench.files.action.reveal",label:d(10148,null),run:async()=>(await this.paneCompositeService.openPaneComposite(Hf,0,!0),this.explorerService.select(t.preferredResource,!0))})),Aj(d(10144,null),n,{forceMessage:!0})}if(e.fileOperationResult===7){let n;throw e instanceof WN?n=d(10146,null,ll.formatSize(e.size)):n=d(10145,null),Uxe(this.group,t,o,n,this.preferencesService)}throw e.fileOperationResult===1&&!this.filesConfigurationService.isReadonly(t.preferredResource)&&await this.pathService.hasValidBasename(t.preferredResource)?Aj(new As(d(10150,null),1),[pi({id:"workbench.files.action.createMissingFile",label:d(10143,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!==Ys.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===Ys.id?(o.setForceOpenAsText(),o.setPreferredLanguageId(E_e),n={...n,forceReload:!0}):o.setForceOpenAsBinary(),e.openEditor(o,n)}clearInput(){super.clearInput(),this.editorControl?.setModel(null)}createEditorControl(e,t){sn("code/willCreateTextFileEditorControl"),super.createEditorControl(e,t),sn("code/didCreateTextFileEditorControl")}tracksEditorViewState(e){return e instanceof hI}tracksDisposedEditorViewState(){return!0}};Q8=I([m(1,Te),m(2,be),m(3,ds),m(4,F),m(5,Pe),m(6,le),m(7,Nn),m(8,ee),m(9,De),m(10,Et),m(11,Ho),m(12,za),m(13,dt),m(14,wn),m(15,B),m(16,Po),m(17,oi),m(18,lr)],Q8);var oVe=class{static{this.ID="workbench.contrib.fileUriLabel"}constructor(i){i.registerFormatter({scheme:Y.file,formatting:{label:"${authority}${path}",separator:Rd,tildify:!ri,normalizeDriveLetter:ri,authorityPrefix:Rd+Rd,workspaceSuffix:""}})}};oVe=I([m(0,ot)],oVe);we(za,ooe,1);oe.as(rn.EditorPane).registerEditorPane(ys.create(Q8,Q8.ID,d(10463,null)),[new Mt(hI)]);oe.as(rn.EditorPane).registerEditorPane(ys.create(j8,j8.ID,d(10373,null)),[new Mt(hI)]);oe.as(rn.EditorFactory).registerFileEditorFactory({typeId:pue,createFileEditor:(a,i,e,t,o,n,r,s)=>s.createInstance(hI,a,i,e,t,o,n,r),isFileEditor:a=>a instanceof hI});oe.as(rn.EditorFactory).registerEditorSerializer(pue,l$t);pt(zge.ID,zge,ut.BlockRestore);pt(Wge.ID,Wge,ut.BlockStartup);pt(Bge.ID,Bge,ut.BlockStartup);pt(Cme.ID,Cme,ut.BlockStartup);pt(oVe.ID,oVe,ut.BlockStartup);pt(Hge.ID,Hge,ut.AfterRestored);pt(Uge.ID,Uge,ut.BlockStartup);var hPi=oe.as(ii.Configuration),Vnn=kr?{type:"string",scope:1,enum:[AS.OFF,AS.ON_EXIT,AS.ON_EXIT_AND_WINDOW_CLOSE],default:AS.ON_EXIT,markdownEnumDescriptions:[d(10434,null),d(10435,null),d(10436,null)],markdownDescription:d(10433,null,AS.ON_EXIT,AS.ON_EXIT_AND_WINDOW_CLOSE)}:{type:"string",scope:1,enum:[AS.OFF,AS.ON_EXIT_AND_WINDOW_CLOSE],default:AS.ON_EXIT_AND_WINDOW_CLOSE,markdownEnumDescriptions:[d(10434,null),d(10437,null)],markdownDescription:d(10433,null,AS.ON_EXIT,AS.ON_EXIT_AND_WINDOW_CLOSE)};hPi.registerConfiguration({id:"files",order:9,title:d(10427,null),type:"object",properties:{[Xgt]:{type:"object",markdownDescription:d(10402,null),default:{"**/.git":!0,"**/.svn":!0,"**/.hg":!0,"**/.DS_Store":!0,"**/Thumbs.db":!0,...Gt?{"**/*.crswap":!0}:void 0},scope:5,additionalProperties:{anyOf:[{type:"boolean",enum:[!0,!1],enumDescriptions:[d(10467,null),d(10411,null)],description:d(10421,null)},{type:"object",properties:{when:{type:"string",pattern:"\\w*\\$\\(basename\\)\\w*",default:"$(basename).ext",markdownDescription:d(10422,null)}}}]}},[Y$]:{type:"object",markdownDescription:d(10361,null),additionalProperties:{type:"string"}},"files.encoding":{type:"string",enum:Object.keys(aw),default:"utf8",description:d(10396,null),scope:6,enumDescriptions:Object.keys(aw).map(a=>aw[a].labelLong),enumItemLabels:Object.keys(aw).map(a=>aw[a].labelLong)},"files.autoGuessEncoding":{type:"boolean",default:!1,markdownDescription:d(10362,null,"`#files.encoding#`"),scope:6},"files.candidateGuessEncodings":{type:"array",items:{type:"string",enum:Object.keys(HQe),enumDescriptions:Object.keys(HQe).map(a=>HQe[a].labelLong)},default:[],markdownDescription:d(10374,null,"`#files.encoding#`"),scope:6},"files.eol":{type:"string",enum:[`
`,`\r
`,"auto"],enumDescriptions:[d(10400,null),d(10399,null),d(10398,null)],default:"auto",description:d(10397,null),scope:6},"files.enableTrash":{type:"boolean",default:!0,description:d(10468,null)},"files.trimTrailingWhitespace":{type:"boolean",default:!1,description:d(10465,null),scope:6},"files.trimTrailingWhitespaceInRegexAndStrings":{type:"boolean",default:!0,description:d(10466,null),scope:6},"files.insertFinalNewline":{type:"boolean",default:!1,description:d(10438,null),scope:6},"files.trimFinalNewlines":{type:"boolean",default:!1,description:d(10464,null),scope:6},"files.autoSave":{type:"string",enum:[cv.OFF,cv.AFTER_DELAY,cv.ON_FOCUS_CHANGE,cv.ON_WINDOW_CHANGE],markdownEnumDescriptions:[d(10418,null),d(10417,null),d(10419,null),d(10420,null)],default:Gt?cv.AFTER_DELAY:cv.OFF,markdownDescription:d(10369,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(10370,null,cv.AFTER_DELAY),scope:6},"files.autoSaveWorkspaceFilesOnly":{type:"boolean",default:!1,markdownDescription:d(10372,null,"`#files.autoSave#`"),scope:6},"files.autoSaveWhenNoErrors":{type:"boolean",default:!1,markdownDescription:d(10371,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(10469,null),scope:5},"files.watcherInclude":{type:"array",items:{type:"string"},default:[],description:d(10470,null),scope:5},"files.hotExit":Vnn,"files.defaultLanguage":{type:"string",markdownDescription:d(10388,null)},[Jgt]:{type:"object",patternProperties:{".*":{type:"boolean"}},default:{},markdownDescription:d(10430,null),scope:5},[Zgt]:{type:"object",patternProperties:{".*":{type:"boolean"}},default:{},markdownDescription:d(10428,null),scope:5},[A$i]:{type:"boolean",markdownDescription:d(10429,null),default:!1},"files.restoreUndoStack":{type:"boolean",description:d(10424,null),default:!0},"files.saveConflictResolution":{type:"string",enum:["askUser","overwriteFileOnDisk"],enumDescriptions:[d(10360,null),d(10444,null)],description:d(10425,null),default:"askUser",scope:6},"files.dialog.defaultPath":{type:"string",pattern:"^((\\/|\\\\\\\\|[a-zA-Z]:\\\\).*)?$",patternErrorMessage:d(10389,null),description:d(10412,null),scope:2},"files.simpleDialog.enable":{type:"boolean",description:d(10426,null),default:!1},"files.participants.timeout":{type:"number",default:6e4,markdownDescription:d(10423,null)}}});hPi.registerConfiguration({...nC,properties:{"editor.formatOnSave":{type:"boolean",markdownDescription:d(10431,null,"`#files.autoSave#`"),scope:6},"editor.formatOnSaveMode":{type:"string",default:"file",enum:["file","modifications","modificationsIfAvailable"],enumDescriptions:[d(10401,null),d(10439,null),d(10440,null)],markdownDescription:d(10432,null),scope:6}}});hPi.registerConfiguration({id:"explorer",order:10,title:d(10410,null),type:"object",properties:{"explorer.openEditors.visible":{type:"number",description:d(10442,null),default:9,minimum:1},"explorer.openEditors.minVisible":{type:"number",description:d(10443,null),default:0,minimum:0},"explorer.openEditors.sortOrder":{type:"string",enum:["editorOrder","alphabetical","fullPath"],description:d(10441,null),enumDescriptions:[d(10450,null),d(10448,null),d(10453,null)],default:"editorOrder"},"explorer.autoReveal":{type:["boolean","string"],enum:[!0,!1,"focusNoScroll"],default:!0,enumDescriptions:[d(10367,null),d(10366,null),d(10365,null)],description:d(10364,null)},"explorer.autoRevealExclude":{type:"object",markdownDescription:d(10368,null),default:{"**/node_modules":!0,"**/bower_components":!0},additionalProperties:{anyOf:[{type:"boolean",description:d(10405,null)},{type:"object",properties:{when:{type:"string",pattern:"\\w*\\$\\(basename\\)\\w*",default:"$(basename).ext",description:d(10406,null)}}}]}},"explorer.enableDragAndDrop":{type:"boolean",description:d(10391,null),default:!0},"explorer.confirmDragAndDrop":{type:"boolean",description:d(10377,null),default:!0},"explorer.confirmPasteNative":{type:"boolean",description:d(10378,null),default:!0},"explorer.confirmDelete":{type:"boolean",description:d(10376,null),default:!0},"explorer.enableUndo":{type:"boolean",description:d(10392,null),default:!0},"explorer.confirmUndo":{type:"string",enum:["verbose","default","light"],description:d(10379,null),default:"default",enumDescriptions:[d(10395,null),d(10393,null),d(10394,null)]},"explorer.expandSingleFolderWorkspaces":{type:"boolean",description:d(10404,null),default:!0},"explorer.sortOrder":{type:"string",enum:["default","mixed","filesFirst","type","modified","foldersNestsFiles"],default:"default",enumDescriptions:[d(10449,null),d(10454,null),d(10451,null),d(10456,null),d(10455,null),d(10452,null)],markdownDescription:d(10447,null)},"explorer.sortOrderLexicographicOptions":{type:"string",enum:["default","upper","lower","unicode"],default:"default",enumDescriptions:[d(10458,null),d(10461,null),d(10459,null),d(10460,null)],description:d(10457,null)},"explorer.sortOrderReverse":{type:"boolean",description:d(10462,null),default:!1},"explorer.decorations.colors":{type:"boolean",description:d(10408,null),default:!0},"explorer.decorations.badges":{type:"boolean",description:d(10407,null),default:!0},"explorer.incrementalNaming":{type:"string",enum:["simple","smart","disabled"],enumDescriptions:[d(10445,null),d(10446,null),d(10390,null)],description:d(10409,null),default:"simple"},"explorer.autoOpenDroppedFile":{type:"boolean",description:d(10363,null),default:!0},"explorer.compactFolders":{type:"boolean",description:d(10375,null),default:!0},"explorer.copyRelativePathSeparator":{type:"string",enum:["/","\\","auto"],enumDescriptions:[d(10387,null),d(10386,null),d(10385,null)],description:d(10384,null),default:"auto"},"explorer.copyPathSeparator":{type:"string",enum:["/","\\","auto"],enumDescriptions:[d(10383,null),d(10382,null),d(10381,null)],description:d(10380,null),default:"auto"},"explorer.excludeGitIgnore":{type:"boolean",markdownDescription:d(10403,null,"`#files.exclude#`"),default:!1,scope:5},"explorer.fileNesting.enabled":{type:"boolean",scope:5,markdownDescription:d(10414,null),default:!1},"explorer.fileNesting.expand":{type:"boolean",markdownDescription:d(10415,null,"`#explorer.fileNesting.enabled#`"),default:!0},"explorer.fileNesting.patterns":{type:"object",scope:5,markdownDescription:d(10416,null,"`#explorer.fileNesting.enabled#`"),patternProperties:{"^[^*]*\\*?[^*]*$":{markdownDescription:d(10413,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"}}}});BT.addImplementation(110,"explorer",a=>{let i=a.get(Cl),e=a.get(za),o=a.get(B).getValue().explorer.enableUndo;return e.hasViewFocus()&&i.canUndo(iVe)&&o?(i.undo(iVe),!0):!1});HT.addImplementation(110,"explorer",a=>{let i=a.get(Cl),e=a.get(za),o=a.get(B).getValue().explorer.enableUndo;return e.hasViewFocus()&&i.canRedo(iVe)&&o?(i.redo(iVe),!0):!1});LM.registerLanguage({id:E_e,aliases:["Binary"],mimetypes:["text/x-code-binary"]});var $ge=class{constructor(){this.uris=[]}async perform(){return this}toString(){return"(noop)"}},c$t=class{constructor(i,e,t){this.newUri=i;this.oldUri=e;this.options=t;this.type="rename"}},Kge=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 c$t(o.oldUri,o.newUri,o.options)));return e.length===0?new $ge:(await this._workingCopyFileService.move(e,i,this._undoRedoInfo),new Kge(t,{isUndoing:!0},this._workingCopyFileService,this._fileService))}toString(){return`(rename ${this._edits.map(i=>`${i.oldUri} to ${i.newUri}`).join(", ")})`}};Kge=I([m(2,kp),m(3,be)],Kge);var gPi=class{constructor(i,e,t){this.newUri=i;this.oldUri=e;this.options=t;this.type="copy"}},Drt=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 $ge;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 Lrt(r.resource,{recursive:!0,folder:this._edits[n].options.folder||r.isDirectory,...s.options},!1))}return this._instaService.createInstance(Gge,o,{isUndoing:!0})}toString(){return`(copy ${this._edits.map(i=>`${i.oldUri} to ${i.newUri}`).join(", ")})`}};Drt=I([m(2,kp),m(3,be),m(4,F)],Drt);var d$t=class{constructor(i,e,t){this.newUri=i;this.options=e;this.contents=t;this.type="create"}},nVe=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!==Y.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 Lrt(n.newUri,n.options,!n.options.folder&&!n.contents))}return e.length===0&&t.length===0?new $ge:(await this._workingCopyFileService.createFolder(e,i,this._undoRedoInfo),await this._workingCopyFileService.create(t,i,this._undoRedoInfo),this._instaService.createInstance(Gge,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(", ")})`}};nVe=I([m(2,be),m(3,kp),m(4,F),m(5,Ho)],nVe);var Lrt=class{constructor(i,e,t){this.oldUri=i;this.options=e;this.undoesCreate=t;this.type="delete"}},Gge=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 d$t(o.oldUri,o.options,r?.value))}return e.length===0?new $ge:(await this._workingCopyFileService.delete(e,i,this._undoRedoInfo),t.length===0?new $ge:this._instaService.createInstance(nVe,t,{isUndoing:!0}))}toString(){return`(delete ${this._edits.map(i=>i.oldUri).join(", ")})`}};Gge=I([m(2,kp),m(3,be),m(4,B),m(5,F),m(6,ne)],Gge);var fPi=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(ve.None);this.operations[i]=t}}toString(){return this.operations.map(i=>String(i)).join(", ")}},rVe=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 c$t(r.newResource,r.oldResource,r.options??{})):r.newResource&&r.oldResource&&r.options?.copy?t.push(new gPi(r.newResource,r.oldResource,r.options??{})):!r.newResource&&r.oldResource?t.push(new Lrt(r.oldResource,r.options??{},!1)):r.newResource&&!r.oldResource&&t.push(new d$t(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(Kge,r,e);break;case"copy":s=this._instaService.createInstance(Drt,r,e);break;case"delete":s=this._instaService.createInstance(Gge,r,e);break;case"create":s=this._instaService.createInstance(nVe,r,e);break}if(s){let l=await s.perform(this._token);i.push(l)}this._progress.report(void 0)}let n=new fPi(this._label,this._code,i,this._confirmBeforeUndo);return this._undoRedoService.pushElement(n,this._undoRedoGroup,this._undoRedoSource),n.resources}};rVe=I([m(8,F),m(9,Cl)],rVe);var u$t=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({...An.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=zh.asInsertText(i.text);return{...i,insertAsSnippet:!1,text:e}}},vPi=class extends u$t{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=Qr.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:zh.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()}},sVe=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 vt;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 vPi(r,this._editor),l=!0):s=new u$t(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 ja(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 IL(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 vW(this._label,this._code,e.map(r=>new IL(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{Ue(e)}}};sVe=I([m(8,$s),m(9,Ct),m(10,Nt),m(11,Cl)],sVe);var lVe=class a extends s7{constructor(e,t,o,n){super(n);this.resource=e;this.undo=t;this.redo=o}static is(e){return e instanceof a?!0:yi(e)&&!!(e.undo&&e.redo)}static lift(e){return e instanceof a?e:new a(e.resource,e.undo,e.redo,e.metadata)}},aVe=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}};aVe=I([m(5,Cl)],aVe);function Bnn(a){return a.map(i=>{if(ja.is(i))return ja.lift(i);if(tu.is(i))return tu.lift(i);if(Iv.is(i))return Iv.lift(i);if(lVe.is(i))return lVe.lift(i);throw new Error("Unsupported edit")})}var Rrt=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 vt,e=new vt,t=0;for(let o of this._edits)o instanceof ja?(t+=1,e.set(o.resource,!0)):o instanceof tu&&i.set(o.oldResource??o.newResource,!0);return this._edits.length===0?d(5212,null):i.size===0?t>1&&e.size>1?d(5214,null,t,e.size):d(5213,null,t):d(5215,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 tu?n.push(await this._performFileEdits(l,this._undoRedoGroup,this._undoRedoSource,this._confirmBeforeUndo,o)):l[0]instanceof ja?n.push(await this._performTextEdits(l,this._undoRedoGroup,this._undoRedoSource,o,i)):l[0]instanceof Iv?n.push(await this._performCellEdits(l,this._undoRedoGroup,this._undoRedoSource,o)):l[0]instanceof lVe?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(rVe,this._label||d(5216,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(sVe,this._label||d(5216,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($xe,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(aVe,e,t,o,this._token,i).apply()}};Rrt=I([m(9,F),m(10,ne)],Rrt);var Mrt=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 Vs}setPreviewHandler(i){return this._previewHandler=i,Z(()=>{this._previewHandler===i&&(this._previewHandler=void 0)})}hasPreviewHandler(){return!!this._previewHandler}async apply(i,e){let t=Bnn(Array.isArray(i)?i:i.edits);if(t.length===0)return{ariaSummary:d(5207,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:Ec(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 R9,r=this._activeUndoRedoGroups.push(n));let s=e?.quotableLabel||e?.label,l=this._instaService.createInstance(Rrt,s,e?.code,o,e?.progress??bm.None,e?.token??ve.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(oyo)===!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 Mn(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(5205,null);break;case 4:t=d(5204,null);break;case 3:t=d(5211,null);break;default:t=it?d(5209,null):d(5208,null);break}return!(await this._dialogService.confirm({message:t,detail:d(5203,null,i||d(5206,null))})).confirmed}};Mrt=I([m(0,F),m(1,ne),m(2,ee),m(3,ao),m(4,ct),m(5,Wa),m(6,B)],Mrt);we(ma,Mrt,1);var oyo="files.refactoring.autoSave";oe.as(ii.Configuration).registerConfiguration({id:"files",properties:{[oyo]:{description:d(5210,null),default:!0,type:"boolean"}}});var cVe=class{constructor(i,e,t,o){this._conflicts=new vt;this._disposables=new P;this._onDidConflict=new E;this.onDidConflict=this._onDidConflict.event;let n=new vt;for(let s of i)if(s instanceof ja){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 tu?s.newResource?n.set(s.newResource,!0):s.oldResource&&n.set(s.oldResource,!0):s instanceof Iv?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}};cVe=I([m(1,be),m(2,Ct),m(3,ne)],cVe);var bPi=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))}},SPi=class{constructor(i,e){this.parent=i;this.textEdit=e}};var IPi=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 ja?this.textEdits.push(new SPi(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}},p$t=class a{constructor(i=a._defaultMetadata){this.metadata=i;this.operationByResource=new Map}static{this._defaultMetadata=Object.freeze({label:d(5233,null),icon:M.symbolFile,needsConfirmation:!1})}static keyOf(i){return i?.label||"<default>"}get fileOperations(){return this.operationByResource.values()}},cG=class{constructor(i,e,t){this._bulkEdit=i;this._fileService=e;this.checked=new bPi;this.fileOperations=[];this.categories=[];this.conflicts=t.createInstance(cVe,i)}static async create(i,e){return await i.get(F).createInstance(cG,e)._init()}dispose(){this.checked.dispose(),this.conflicts.dispose()}async _init(){let i=new Map,e=new Map,t=new vt;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 ja)s=1,r=n.resource;else if(n instanceof tu)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 IPi(p,this),h.set(g,f)),f.addEdit(o,s,n)};l(r,i);let c=p$t.keyOf(n.metadata),u=e.get(c);u||(u=new p$t(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 tu&&(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:(ZG(i),i)}async getFileEditOperation(i){let e=await i.options.contents;if(e)return An.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 tu?t.push(this.getFileEditOperation(n)):n instanceof ja?this.checked.isChecked(n)&&t.push(Promise.resolve(An.replaceMove(z.lift(n.textEdit.range),n.textEdit.insertAsSnippet?zh.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")}};cG=I([m(1,be),m(2,F)],cG);var hH=class{constructor(i,e,t,o){this._operations=i;this._languageService=e;this._modelService=t;this._textModelResolverService=o;this._disposables=new P;this._modelPreviewEdits=new Map;this._instanceId=_t();this._disposables.add(this._textModelResolverService.registerTextModelContentProvider(hH.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===Y.untitled?`/${i.path}`:i.path;return A.from({scheme:hH.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(H.debounce(this._operations.checked.onDidChange,(i,e)=>e,QD)(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(i_(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()===hH.emptyPreview.toString()?this._modelService.createModel("",null,i):(await this._ready,this._modelService.getModel(i))}};hH=I([m(1,kt),m(2,Ct),m(3,Nt)],hH);var fT=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)}},vT=class{constructor(i,e){this.parent=i;this.edit=e}isChecked(){let i=this.parent instanceof fT?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 tu&&(e=e&&i.checked.isChecked(t));if(this.parent instanceof fT&&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 tu&&(e=e&&i.checked.isChecked(n))}return e}setChecked(i){let e=this.parent instanceof fT?this.parent.parent:this.parent;for(let t of this.edit.originalEdits.values())e.checked.updateChecked(t,i);if(this.parent instanceof fT&&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 fT&&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 tu&&(e=e&&i.checked.isChecked(n));return!e}return!1}},_0=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 fT&&(i=i.parent),i.checked.isChecked(this.edit.textEdit)}setChecked(i){let e=this.parent.parent;if(e instanceof fT&&(e=e.parent),e.checked.updateChecked(this.edit.textEdit,i),i)for(let t of this.parent.edit.originalEdits.values())t instanceof tu&&e.checked.updateChecked(t,i)}isDisabled(){return this.parent.isDisabled()}},dVe=class{constructor(i,e){this._textModelService=i;this._instantiationService=e;this.groupByFile=!0}hasChildren(i){return i instanceof vT?i.edit.textEdits.length>0:!(i instanceof _0)}async getChildren(i){if(i instanceof cG)return this.groupByFile?i.fileOperations.map(e=>new vT(i,e)):i.categories.map(e=>new fT(i,e));if(i instanceof fT)return Array.from(i.category.fileOperations,e=>new vT(i,e));if(i instanceof vT&&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(Bu,"",Fr,Bu.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 _0(i,r,n,e.getValueInRange(new z(s.startLineNumber,s.startColumn-c,s.startLineNumber,s.startColumn)),e.getValueInRange(s),n.textEdit.textEdit.insertAsSnippet?zh.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[]}};dVe=I([m(0,Nt),m(1,F)],dVe);var m$t=class{compare(i,e){return i instanceof vT&&e instanceof vT?wPi(i.edit,e.edit):i instanceof _0&&e instanceof _0?z.compareRangesUsingStarts(i.edit.textEdit.textEdit.range,e.edit.textEdit.textEdit.range):0}};function wPi(a,i){return Al(a.uri.toString(),i.uri.toString())}var uVe=class{constructor(i){this._labelService=i}getWidgetAriaLabel(){return d(5244,null)}getRole(i){return"checkbox"}getAriaLabel(i){if(i instanceof vT){if(i.edit.textEdits.length>0)return i.edit.type&8&&i.edit.newUri?d(5242,null,this._labelService.getUriLabel(i.edit.uri,{relative:!0}),this._labelService.getUriLabel(i.edit.newUri,{relative:!0})):i.edit.type&2?d(5235,null,this._labelService.getUriLabel(i.edit.uri,{relative:!0})):i.edit.type&4?d(5238,null,this._labelService.getUriLabel(i.edit.uri,{relative:!0})):d(5239,null,this._labelService.getUriLabel(i.edit.uri,{relative:!0}));if(i.edit.type&8&&i.edit.newUri)return d(5241,null,this._labelService.getUriLabel(i.edit.uri,{relative:!0}),this._labelService.getUriLabel(i.edit.newUri,{relative:!0}));if(i.edit.type&2)return d(5234,null,this._labelService.getUriLabel(i.edit.uri,{relative:!0}));if(i.edit.type&4)return d(5237,null,this._labelService.getUriLabel(i.edit.uri,{relative:!0}))}if(i instanceof _0){if(i.selecting.length>0&&i.inserting.length>0)return d(5243,null,i.edit.textEdit.textEdit.range.startLineNumber,i.selecting,i.inserting);if(i.selecting.length>0&&i.inserting.length===0)return d(5236,null,i.edit.textEdit.textEdit.range.startLineNumber,i.selecting);if(i.selecting.length===0&&i.inserting.length>0)return d(5240,null,i.edit.textEdit.textEdit.range.startLineNumber,i.selecting)}return null}};uVe=I([m(0,ot)],uVe);var h$t=class{getId(i){return i instanceof vT?i.edit.uri+(i.parent instanceof fT?JSON.stringify(i.parent.category.metadata):""):i instanceof _0?i.parent.edit.uri.toString()+i.idx:JSON.stringify(i.category.metadata)}},yPi=class{constructor(i){i.classList.add("category"),this.icon=document.createElement("div"),i.appendChild(this.icon),this.label=new Lc(i)}},Y8=class{constructor(i){this._themeService=i;this.templateId=Y8.id}static{this.id="CategoryElementRenderer"}renderTemplate(i){return new yPi(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",Na(o.iconPath)),t.icon.style.setProperty("--background-light",Na(o.iconPath))):o.iconPath&&(t.icon.className="uri-icon",t.icon.style.setProperty("--background-dark",Na(o.iconPath.dark)),t.icon.style.setProperty("--background-light",Na(o.iconPath.light)));t.label.setLabel(o.label,o.description,{descriptionMatches:ua(i.filterData)})}disposeTemplate(i){i.label.dispose()}};Y8=I([m(0,De)],Y8);var Prt=class{constructor(i,e,t){this._labelService=t;this._disposables=new P;this._localDisposables=new P;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(5248,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(5247,null);else{let t={matches:ua(e),fileKind:0,fileDecorations:{colors:!0,badges:!1},extraClasses:[]};i.edit.type&2?this._details.innerText=d(5245,null):i.edit.type&4?(this._details.innerText=d(5246,null),t.extraClasses.push("delete")):this._details.innerText="",this._label.setFile(i.edit.uri,t)}}};Prt=I([m(2,ot)],Prt);var X8=class{constructor(i,e){this._resourceLabels=i;this._labelService=e;this.templateId=X8.id}static{this.id="FileElementRenderer"}renderTemplate(i){return new Prt(i,this._resourceLabels,this._labelService)}renderElement(i,e,t){t.set(i.element,i.filterData)}disposeTemplate(i){i.dispose()}};X8=I([m(1,ot)],X8);var Art=class{constructor(i,e){this._themeService=e;this._disposables=new P;this._localDisposables=new P;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 Oa(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(5249,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",Na(s)),this._icon.style.setProperty("--background-light",Na(s))):(this._icon.className="uri-icon",this._icon.style.setProperty("--background-dark",Na(s.dark)),this._icon.style.setProperty("--background-light",Na(s.light)));this._label.set(e,[t,o],n,!0),this._icon.title=n||""}};Art=I([m(1,De)],Art);var J8=class{constructor(i){this._themeService=i;this.templateId=J8.id}static{this.id="TextEditElementRenderer"}renderTemplate(i){return new Art(i,this._themeService)}renderElement({element:i},e,t){t.set(i)}disposeTemplate(i){i.dispose()}};J8=I([m(0,De)],J8);var g$t=class{getHeight(){return 23}getTemplateId(i){return i instanceof vT?X8.id:i instanceof _0?J8.id:Y8.id}},f$t=class{getKeyboardNavigationLabel(i){if(i instanceof vT)return Ye(i.edit.uri);if(i instanceof fT)return i.category.metadata.label}};var rm=class extends zr{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 P;this._sessionDisposables=new P;this._computeResourceDiffEditorInputs=new Cbe(async e=>{let t=new kI(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=hH.emptyPreview}return{original:{resource:A.revive(u)},modified:{resource:A.revive(c)},goToFileResource:u}}}),o=e.slice().sort(wPi),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=rm.ctxHasCategories.bindTo(u),this._ctxGroupByFile=rm.ctxGroupByFile.bindTo(u),this._ctxHasCheckedChanges=rm.ctxHasCheckedChanges.bindTo(u)}static{this.ID="refactorPreview"}static{this.Schema="vscode-bulkeditpreview-multieditor"}static{this.ctxHasCategories=new Q("refactorPreview.hasCategories",!1)}static{this.ctxGroupByFile=new Q("refactorPreview.groupByFile",!0)}static{this.ctxHasCheckedChanges=new Q("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(Za,{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(dVe),this._treeDataSource.groupByFile=this._storageService.getBoolean(rm._memGroupByFile,0,!0),this._ctxGroupByFile.set(this._treeDataSource.groupByFile),this._tree=this._instaService.createInstance(nu,this.id,n,new g$t,[this._instaService.createInstance(J8),this._instaService.createInstance(X8,t),this._instaService.createInstance(Y8)],this._treeDataSource,{accessibilityProvider:this._instaService.createInstance(uVe),identityProvider:new h$t,expandOnlyOnTwistieClick:!0,multipleSelectionSupport:!1,keyboardNavigationLabelProvider:new f$t,sorter:new m$t,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 _x(r);this._disposables.add(s);let l=s.addButton({supportIcons:!0,...Ko});l.label=d(5232,null),l.onDidClick(()=>this.accept(),this,this._disposables);let c=s.addButton({...Ko,secondary:!0});c.label=d(5228,null),c.onDidClick(()=>this.discard(),this,this._disposables),this._message=document.createElement("span"),this._message.className="message",this._message.innerText=d(5231,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(cG.create,e);this._currentProvider=this._instaService.createInstance(hH,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 vT&&await this._tree.expand(n,!0),n instanceof fT&&(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(5229,null,this._labelService.getUriLabel(e[0],{relative:!0})):t=d(5230,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 vT||e instanceof _0)&&!e.isDisabled()||e instanceof fT)&&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(rm._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 _0)n=e.element.parent,o=e.element.edit.textEdit.textEdit.range;else if(e.element instanceof vT)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:rm.Schema}),u="Refactor Preview";this._editorService.openEditor({multiDiffSource:c,label:u,options:l,isTransient:!0,description:u,resources:r.resources},e.sideBySide?vn:Un)}_onContextMenu(e){this._contextMenuService.showContextMenu({menuId:D.BulkEditContext,contextKeyService:this.contextKeyService,getAnchor:()=>e.anchor})}};rm=I([m(1,F),m(2,ee),m(3,ot),m(4,Nt),m(5,ct),m(6,ze),m(7,le),m(8,X),m(9,Ri),m(10,_e),m(11,ze),m(12,B),m(13,Qe),m(14,De),m(15,tt)],rm);async function qge(a){let i=await a.openView(rm.ID,!0);if(i instanceof rm)return i}var Nrt=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)no.getCanonicalUri(n,{supportSideBySide:1})?.scheme===rm.Schema&&o.push(n);o.length&&t.closeEditors(o,{preserveFocus:!0})}}};Nrt=I([m(0,ds),m(1,Et)],Nrt);var v$t=class{constructor(i,e=new $e){this.uxState=i;this.cts=e}},bT=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=bT.ctxEnabled.bindTo(r)}static{this.ID="workbench.contrib.bulkEditPreview"}static{this.ctxEnabled=new Q("refactorPreview.enabled",!1)}async _previewEdit(i){this._ctxEnabled.set(!0);let e=this._activeSession?.uxState??new Nrt(this._paneCompositeService,this._editorGroupsService),t=await qge(this._viewsService);if(!t)return this._ctxEnabled.set(!1),i;if(t.hasInput()){let{confirmed:n}=await this._dialogService.confirm({type:gt.Info,message:d(5224,null),detail:d(5220,null),primaryButton:d(5219,null)});if(!n)return[]}let o;this._activeSession?(await this._activeSession.uxState.restore(!1,!0),this._activeSession.cts.dispose(!0),o=new v$t(e)):o=new v$t(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)}}};bT=I([m(0,ds),m(1,Ft),m(2,Et),m(3,ct),m(4,ma),m(5,X)],bT);W(class extends K{constructor(){super({id:"refactorPreview.apply",title:L(5217,"Apply Refactoring"),category:L(5218,"Refactor Preview"),icon:M.check,precondition:x.and(bT.ctxEnabled,rm.ctxHasCheckedChanges),menu:[{id:D.BulkEditContext,order:1}],keybinding:{weight:90,when:x.and(bT.ctxEnabled,Vl.isEqualTo(rm.ID)),primary:2051}})}async run(i){let e=i.get(Ft);(await qge(e))?.accept()}});W(class extends K{constructor(){super({id:"refactorPreview.discard",title:L(5221,"Discard Refactoring"),category:L(5218,"Refactor Preview"),icon:M.clearAll,precondition:bT.ctxEnabled,menu:[{id:D.BulkEditContext,order:2}]})}async run(i){let e=i.get(Ft);(await qge(e))?.discard()}});W(class extends K{constructor(){super({id:"refactorPreview.toggleCheckedState",title:L(5227,"Toggle Change"),category:L(5218,"Refactor Preview"),precondition:bT.ctxEnabled,keybinding:{weight:200,when:rc,primary:10},menu:{id:D.BulkEditContext,group:"navigation"}})}async run(i){let e=i.get(Ft);(await qge(e))?.toggleChecked()}});W(class extends K{constructor(){super({id:"refactorPreview.groupByFile",title:L(5222,"Group Changes By File"),category:L(5218,"Refactor Preview"),icon:M.ungroupByRefType,precondition:x.and(rm.ctxHasCategories,rm.ctxGroupByFile.negate(),bT.ctxEnabled),menu:[{id:D.BulkEditTitle,when:x.and(rm.ctxHasCategories,rm.ctxGroupByFile.negate()),group:"navigation",order:3}]})}async run(i){let e=i.get(Ft);(await qge(e))?.groupByFile()}});W(class extends K{constructor(){super({id:"refactorPreview.groupByType",title:L(5223,"Group Changes By Type"),category:L(5218,"Refactor Preview"),icon:M.groupByRefType,precondition:x.and(rm.ctxHasCategories,rm.ctxGroupByFile,bT.ctxEnabled),menu:[{id:D.BulkEditTitle,when:x.and(rm.ctxHasCategories,rm.ctxGroupByFile),group:"navigation",order:3}]})}async run(i){let e=i.get(Ft);(await qge(e))?.groupByType()}});W(class extends K{constructor(){super({id:"refactorPreview.toggleGrouping",title:L(5223,"Group Changes By Type"),category:L(5218,"Refactor Preview"),icon:M.listTree,toggled:rm.ctxGroupByFile.negate(),precondition:x.and(rm.ctxHasCategories,bT.ctxEnabled),menu:[{id:D.BulkEditContext,order:3}]})}async run(i){let e=i.get(Ft);(await qge(e))?.toggleGrouping()}});pt(bT.ID,bT,ut.BlockRestore);var nyo=Re("refactor-preview-view-icon",M.lightbulb,d(5226,null)),Unn=oe.as(on.ViewContainersRegistry).registerViewContainer({id:rm.ID,title:L(5225,"Refactor Preview"),hideIfEmpty:!0,ctorDescriptor:new Mt(Ha,[rm.ID,{mergeViewWithContainerWhenSingleView:!0}]),icon:nyo,storageId:rm.ID},1);oe.as(on.ViewsRegistry).registerViews([{id:rm.ID,name:L(5225,"Refactor Preview"),when:bT.ctxEnabled,ctorDescriptor:new Mt(rm),containerIcon:nyo}],Unn);function znn(a){if(a.isUndoing||a.isRedoing||a.isFlush)return!1;for(let i of a.detailedReasons)if(!Gnn(i))return!1;return a.detailedReasons.length>0}var Knn=new Set(["type","paste","cut","executeCommands","executeCommand","compositionType","compositionEnd"]);function Gnn(a){let i=a.metadata;if(i.source!=="cursor")return!1;let e=i.kind;return Knn.has(e)}var CPi=class extends C{constructor(e){super();this._model=e;this._trackedWord=Le(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(!znn(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}},Ort=class extends C{constructor(e,t){super();this._codeEditorService=e;this._modelService=t;this._modelTrackers=new Map;this._editorFocusTrackingDisposables=new Map;this._focusedModelTracker=Le(this,void 0);this.trackedWord=Ce(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=os(e),o=he(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 CPi(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()}};Ort=I([m(0,Kt),m(1,Ct)],Ort);we($wt,Ort,1);var jge=class a extends VOe{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(1500,null);return i.items=[{label:e}],i.ariaLabel=e,C.None}provideWithTextEditor(i,e,t){let o=i.editor,n=new P;e.ariaLabel=d(1494,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(M.indexZero),tooltip:d(1503,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(1497,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=ca(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(1500,null)};if(e.startsWith(":")){let o=parseInt(e.substring(1),10),n=t.getValueLength();if(isNaN(o))return{inOffsetMode:!0,label:this.useZeroBasedOffset?d(1502,null,n-1):d(1501,null,n)};{let r=o<0;this.useZeroBasedOffset||(o-=Math.sign(o)),r&&(o+=n);let s=t.getPositionAt(o),l=al.visibleColumnFromColumn(t.getLineContent(s.lineNumber),s.column,t.getOptions().tabSize)+1;return{...s,inOffsetMode:!0,label:d(1496,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(1499,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=al.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(1498,null,r):d(1495,null,r,c)};u=u>=0?u:c+u,u=Math.min(Math.max(1,u),c);let p=al.columnFromVisibleColumn(l,u-1,s);return{lineNumber:r,column:p,label:d(1496,null,r,u)}}}};var syo="replacePreview",ryo=a=>a.with({scheme:Y.internal,fragment:syo,query:JSON.stringify({scheme:a.scheme})}),$nn=a=>a.with({scheme:JSON.parse(a.query).scheme,fragment:"",query:""}),Qge=class{constructor(i,e){this.instantiationService=i;this.textModelResolverService=e;this.textModelResolverService.registerTextModelContentProvider(Y.internal,this)}static{this.ID="workbench.contrib.replacePreviewContentProvider"}provideTextContent(i){return i.fragment===syo?this.instantiationService.createInstance(Frt).resolve(i):null}};Qge=I([m(0,F),m(1,Nt)],Qge);var Frt=class extends C{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=$nn(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(i_(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)}};Frt=I([m(0,Ct),m(1,kt),m(2,Nt),m(3,fI),m(4,Lte)],Frt);var Z8=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=ph.registerSource("searchReplace.source",d(13167,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===Y.vscodeNotebookCell){let s=Zo.parse(r.resource)?.notebook;if(s){let l;try{l=await this.notebookEditorModelResolverService.resolve(s),await l.object.save({source:Z8.REPLACE_SAVE_SOURCE})}finally{l?.dispose()}}return}else return this.textFileService.files.get(r.resource)?.save({source:Z8.REPLACE_SAVE_SOURCE})});return fn.settled(n)}async openReplacePreview(i,e,t,o){let n=Ka(i)?i.parent():i,r=await this.editorService.openEditor({original:{resource:n.resource},modified:{resource:ryo(n.resource)},label:d(13166,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();Ka(i)&&c&&c.revealLineInCenter(i.range().startLineNumber,1)}}async updateReplacePreview(i,e=!1){let t=ryo(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(An.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(Ka(i)&&!i.isReadonly)if(VB(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 fl(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 ja(t??o.resource,{range:i.range(),text:e},void 0,void 0)}};Z8=I([m(0,Ho),m(1,ee),m(2,Nt),m(3,ma),m(4,ot),m(5,mh)],Z8);function ayo(){we(fI,Z8,1),pt(Qge.ID,Qge,ut.BlockStartup)}var b$t=ae("notebookSearchService");var pVe=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(aS)}notebookSearch(i,e,t,o){if(i.type!==2)return{openFilesToScan:new Mn,completeData:Promise.resolve({messages:[],limitHit:!1,results:[]}),allScannedFiles:Promise.resolve(new Mn)};let n=this.getLocalNotebookWidgets(),r=n.map(c=>c.viewModel.uri),l=(()=>{let c=Date.now(),u=this.getLocalNotebookResults(i,e??ve.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 Mn(r,v=>this.uriIdentityService.extUri.getComparisonKey(v)),e??ve.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=si(w);return o&&k.forEach(o),this.logService.trace(`local notebook search time | ${p-c}ms`),{messages:[],limitHit:y.reduce((T,N)=>T||N.limitHit,!1),results:k}}),allScannedFiles:f.then(v=>{let b=v[0],S=v[1],y=si([...b.results.keys(),...S?.results.keys()??[]]);return new Mn(y,w=>this.uriIdentityService.extUri.getComparisonKey(w))})}})();return{openFilesToScan:new Mn(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=si(await Promise.all(s)),u=c.flatMap(v=>v.results),p=c.some(v=>v.limitHit),h=new vt(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 vt(s=>this.uriIdentityService.extUri.getComparisonKey(s)),r=!1;for(let s of t){if(!s.hasModel())continue;let l=(Xo(i.maxResults)?i.maxResults:y5)+1,c=s.viewModel.uri;if(!Sde(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=QUt(g.contentMatches,g.cell),v=YUt(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())}};pVe=I([m(0,dt),m(1,Zc),m(2,ne),m(3,un),m(4,B),m(5,ul),m(6,Jp),m(7,F)],pVe);function lyo(){we(b$t,pVe,1)}var Wrt=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=u$(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=u$(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?S5e(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 mVe=class extends C{constructor(e,t,o,n){super();this.searchModel=e;this.instantiationService=t;this.modelService=o;this.notebookEditorService=n;this._onChange=this._register(new Pm({merge:AUt}));this.onChange=this._onChange.event;this._plainTextSearchResult=this._register(this.instantiationService.createInstance(fNe,this)),this._aiTextSearchResult=this._register(this.instantiationService.createInstance(J3,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 XK&&this.onDidAddNotebookEditorWidget(r)})),this._id=DEi+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();(bd(o)||fl(o))&&z3(o,e)||(fl(t)?await t.parent().replace(t):Ka(t)?await t.parent().replace(t):bd(t)&&await t.replaceAll())}))}finally{this._onChange.resume()}}batchRemove(e){let t=[];try{this._onChange.pause(),e.forEach(o=>{if(!z3(o,t)){if(jf(o))o.hide();else if(!bd(o)||K3(o)||p0(o)){if(fl(o))o.parent().remove(o);else if(Ka(o))o.parent().remove(o);else if(K3(o))o.parent().remove(o);else if(p0(o)){let n=o.parent();jf(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=qnn(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()}};mVe=I([m(1,F),m(2,Ct),m(3,Zc)],mVe);function qnn(a){return a===null?null:{...a,contentPattern:a.contentPattern.pattern,type:3}}var dG=class extends C{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 Pm({merge:AUt}));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(mVe,this),this._register(this._searchResult.onChange(l=>this._onSearchResultChanged.fire(l))),this._aiTextResultProviderName=new co(async()=>this.searchService.getAIName()),this._id=_ho+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 Wrt(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 $e;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 $e(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 Wrt(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=H.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===Y.file),c=this._searchQuery.folderQueries.every(p=>p.folder.scheme!==Y.file),u=l?Y.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){so(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()}};dG=I([m(0,Jp),m(1,Te),m(2,B),m(3,F),m(4,ne),m(5,b$t)],dG);var hVe=class{constructor(i){this.instantiationService=i;this._searchModel=null}get searchModel(){return this._searchModel||(this._searchModel=this.instantiationService.createInstance(dG)),this._searchModel}set searchModel(i){this._searchModel?.dispose(),this._searchModel=i}};hVe=I([m(0,F)],hVe);W(class extends K{constructor(){super({id:"search.action.copyMatch",title:L(13302,"Copy"),category:vl,keybinding:{weight:200,when:Ci.FileMatchOrMatchFocusKey,primary:2081},menu:[{id:D.SearchContext,when:Ci.FileMatchOrMatchFocusKey,group:"search_2",order:1}]})}async run(i,e){await Qnn(i,e)}});W(class extends K{constructor(){super({id:"search.action.copyPath",title:L(13303,"Copy Path"),category:vl,keybinding:{weight:200,when:Ci.FileMatchOrFolderMatchWithResourceFocusKey,primary:2593,win:{primary:1569}},menu:[{id:D.SearchContext,when:Ci.FileMatchOrFolderMatchWithResourceFocusKey,group:"search_2",order:2}]})}async run(i,e){await jnn(i,e)}});W(class extends K{constructor(){super({id:"search.action.copyAll",title:L(13301,"Copy All"),category:vl,menu:[{id:D.SearchContext,when:Ci.HasSearchResults,group:"search_2",order:3}]})}async run(i,e){await Ynn(i,e)}});W(class extends K{constructor(){super({id:"search.action.getSearchResults",title:L(13304,"Get Search Results"),category:vl,f1:!1})}async run(i){let e=i.get(Ft),t=i.get(ot),o=Pc(e);if(o){let n=o.searchResult,r=xPi(n.folderMatches(),t),s=xPi(n.folderMatches(!0),t);return`${r}${noe}${noe}${s}`}}});var noe=ri?`\r
`:`
`;async function jnn(a,i){if(!i){let n=EPi(a);if(!fl(n)||K3(n))return;i=n}let e=a.get(Wi),o=a.get(ot).getUriLabel(i.resource,{noPrefix:!0});await e.writeText(o)}async function Qnn(a,i){if(!i){let n=EPi(a);if(!n)return;i=n}let e=a.get(Wi),t=a.get(ot),o;Ka(i)?o=cyo(i):fl(i)?o=dyo(i,t).text:bd(i)&&(o=kPi(i,t).text),o&&await e.writeText(o)}async function Ynn(a,i){let e=a.get(Ft),t=a.get(Wi),o=a.get(ot),n=Pc(e);if(n){let r=n.searchResult,s=Jnn(i);i||(i=EPi(a));let l=xPi(r.folderMatches(s),o);await t.writeText(l)}}function cyo(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 Xnn(a,i){return fl(a)?dyo(a,i):kPi(a,i)}function dyo(a,i){let e=a.matches().sort(CA).map(o=>cyo(o,2));return{text:`${i.getUriLabel(a.resource,{noPrefix:!0})}${noe}${e.join(noe)}`,count:e.length}}function kPi(a,i){let e=[],t=0;return a.matches().sort(CA).forEach(n=>{let r=Xnn(n,i);t+=r.count,e.push(r.text)}),{text:e.join(noe+noe),count:t}}function xPi(a,i){let e=[];a=a.sort(CA);for(let t=0;t<a.length;t++){let o=kPi(a[t],i);o.count&&e.push(o.text)}return e.join(noe+noe)}function EPi(a){let i=a.get(Ft);return Pc(i)?.getControl().getSelection()[0]}function Jnn(a){return a?Ka(a)?a.parent().parent().isAIContributed():fl(a)?a.parent().isAIContributed():bd(a)?a.isAIContributed():jf(a)?a.isAIContributed:!1:!1}W(class extends K{constructor(){super({id:"search.action.restrictSearchToFolder",title:L(13314,"Restrict Search to Folder"),category:vl,keybinding:{weight:200,when:x.and(Ci.SearchViewVisibleKey,Ci.ResourceFolderFocusKey),primary:1572},menu:[{id:D.SearchContext,group:"search",order:3,when:x.and(Ci.ResourceFolderFocusKey)}]})}async run(i,e){await TPi(i,!1,!0,void 0,e)}});W(class extends K{constructor(){super({id:"search.action.expandRecursively",title:d(13316,null),category:vl,menu:[{id:D.SearchContext,when:x.and(Ci.FolderFocusKey,Ci.HasSearchResults),group:"search",order:4}]})}async run(i){return Znn(i)}});W(class extends K{constructor(){super({id:"search.action.excludeFromSearch",title:L(13306,"Exclude Folder from Search"),category:vl,menu:[{id:D.SearchContext,group:"search",order:4,when:Ci.ResourceFolderFocusKey}]})}async run(i,e){await TPi(i,!1,!1,void 0,e)}});W(class extends K{constructor(){super({id:"search.action.excludeFileTypeFromSearch",title:L(13305,"Exclude File Type from Search"),category:vl,menu:[{id:D.SearchContext,group:"search",order:5,when:Ci.FileFocusKey}]})}async run(i,e){await uyo(i,e,!0)}});W(class extends K{constructor(){super({id:"search.action.includeFileTypeInSearch",title:L(13312,"Include File Type from Search"),category:vl,menu:[{id:D.SearchContext,group:"search",order:6,when:Ci.FileFocusKey}]})}async run(i,e){await uyo(i,e,!1)}});W(class extends K{constructor(){super({id:"search.action.revealInSideBar",title:L(13315,"Reveal in Explorer View"),category:vl,menu:[{id:D.SearchContext,when:x.and(Ci.FileFocusKey,Ci.HasSearchResults),group:"search_3",order:1}]})}async run(i,e){let t=i.get(ds),o=i.get(za),n=i.get(Pe),r=Pc(i.get(Ft));if(!r)return;let s;if(fl(e))s=e;else{e=r.getControl().getFocus()[0];return}t.openPaneComposite(Hf,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(13307,"Find in Files"),mnemonicTitle:d(13313,null)},metadata:{description:d(13309,null),args:[{name:d(13308,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:vl,keybinding:{weight:200,primary:3108},menu:[{id:D.MenubarEditMenu,group:"4_find_global",order:1}],f1:!0})}async run(i,e={}){_Pi(i,e)}});W(class extends K{constructor(){super({id:"filesExplorer.findInFolder",title:L(13310,"Find in Folder..."),category:vl,keybinding:{weight:200,when:x.and(WC,lu),primary:1572},menu:[{id:D.ExplorerContext,group:"4_search",order:10,when:lu}]})}async run(i,e){await TPi(i,!0,!0,e)}});W(class extends K{constructor(){super({id:"filesExplorer.findInWorkspace",title:L(13311,"Find in Workspace..."),category:vl,menu:[{id:D.ExplorerContext,group:"4_search",order:10,when:x.and(FC,lu.toNegated())}]})}async run(i){let t=i.get(B).getValue().search.mode;t==="view"?(await Q3(i.get(Ft),!0))?.searchInFolders():await i.get(ge).executeCommand(ahe,{location:t==="newEditor"?"new":"reuse",filesToInclude:""})}});async function Znn(a){let i=a.get(Ft),e=Pc(i);if(e){let t=e.getControl(),o=t.getFocus()[0];await vNe(t,o)}}function ern(a){let i=a.split(".");return i.length<=1?a:`*.${i.slice(1).join(".")}`}function trn(a,i){return a.trim()?a.split(",").map(t=>t.trim()).filter(t=>t.length>0).includes(i)?a:`${a}, ${i}`:i}async function TPi(a,i,e,t,o){let n=a.get(be),r=a.get(Ft),s=a.get(Pe),l=a.get(ge),c=a.get(B).getValue().search,u=c.mode,p;if(i)p=e0(t,a.get(fo),a.get(ee),a.get(Et),a.get(za));else{let g=Pc(r);if(!g)return;p=irn(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))}),Neo(f,s)});if(u==="view"){let g=await Q3(r,!0);p&&p.length&&g&&(e?g.searchInFolders(await h):g.searchOutsideOfFolders(await h));return}else return e?l.executeCommand(ahe,{filesToInclude:(await h).join(", "),showIncludesExcludes:!0,location:u==="newEditor"?"new":"reuse"}):l.executeCommand(ahe,{filesToExclude:(await h).join(", "),showIncludesExcludes:!0,location:u==="newEditor"?"new":"reuse"})}function irn(a,i,e){return tit(a,i,e).map(t=>Ka(t)?null:t.resource).filter(t=>t!==null)}async function _Pi(a,i={}){let e=a.get(B).getValue().search,t=a.get(Ft),o=a.get(ge),n={};if(Object.keys(i).length!==0){let s=a.get(sp),l=a.get(zs),c=a.get(Pe),u=l.getLastActiveWorkspaceRoot(),p=u?.scheme===Y.file||u?.scheme===Y.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")Q3(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(ahe,s(n))}}async function uyo(a,i,e){let t=a.get(Ft),o=Pc(t);if(!o||!i)return;let r=i.resource.path.split("/").pop()||"",s=ern(r),l=e?o.searchExcludePattern:o.searchIncludePattern,c=l.getValue(),u=trn(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(13330,"Toggle Query Details"),category:vl,keybinding:{weight:200,when:x.or(Ci.SearchViewFocusedKey,_b),primary:3112}})}run(i,...e){let t=e[0],o=i.get(X).getContext(Pn());if(o.getValue(_b.serialize()))i.get(ee).activeEditorPane.toggleQueryDetails(t?.show);else if(o.getValue(Ci.SearchViewFocusedKey.serialize())){let n=Pc(i.get(Ft));Oi(n).toggleQueryDetails(void 0,t?.show)}}});W(class extends K{constructor(){super({id:"closeReplaceInFilesWidget",title:L(13318,"Close Replace Widget"),category:vl,keybinding:{weight:200,when:x.and(Ci.SearchViewVisibleKey,Ci.ReplaceInputBoxFocusedKey),primary:9}})}run(i){let e=Pc(i.get(Ft));return e&&(e.searchAndReplaceWidget.toggleReplace(!1),e.searchAndReplaceWidget.focus()),Promise.resolve(null)}});W(class extends K{constructor(){super({id:"toggleSearchCaseSensitive",title:L(13328,"Toggle Case Sensitive"),category:vl,keybinding:Object.assign({weight:200,when:it?x.and(Ci.SearchViewFocusedKey,Ci.FileMatchOrFolderMatchFocusKey.toNegated()):Ci.SearchViewFocusedKey},Bq)})}async run(i){orn(i)}});W(class extends K{constructor(){super({id:"toggleSearchWholeWord",title:L(13333,"Toggle Whole Word"),keybinding:Object.assign({weight:200,when:Ci.SearchViewFocusedKey},Hq),category:vl})}async run(i){return nrn(i)}});W(class extends K{constructor(){super({id:"toggleSearchRegex",title:L(13331,"Toggle Regex"),keybinding:Object.assign({weight:200,when:Ci.SearchViewFocusedKey},Uq),category:vl})}async run(i){return rrn(i)}});W(class extends K{constructor(){super({id:"toggleSearchPreserveCase",title:L(13329,"Toggle Preserve Case"),keybinding:Object.assign({weight:200,when:Ci.SearchViewFocusedKey},$ae),category:vl})}async run(i){return srn(i)}});W(class extends K{constructor(){super({id:"search.action.openResult",title:L(13325,"Open Match"),category:vl,keybinding:{weight:200,when:x.and(Ci.SearchViewVisibleKey,Ci.FileMatchOrMatchFocusKey),primary:3,mac:{primary:3,secondary:[2066]}}})}run(i){let e=Pc(i.get(Ft));if(e){let t=e.getControl(),o=e.getControl(),n=t.getFocus()[0];bd(n)?o.toggleCollapsed(n):e.open(t.getFocus()[0],!1,!1,!0)}}});W(class extends K{constructor(){super({id:"search.action.openResultToSide",title:L(13326,"Open Match To Side"),category:vl,keybinding:{weight:200,when:x.and(Ci.SearchViewVisibleKey,Ci.FileMatchOrMatchFocusKey),primary:2051,mac:{primary:259}}})}run(i){let e=Pc(i.get(Ft));if(e){let t=e.getControl();e.open(t.getFocus()[0],!1,!0,!0)}}});W(class extends K{constructor(){super({id:"addCursorsAtSearchResults",title:L(13317,"Add Cursors at Search Results"),keybinding:{weight:200,when:x.and(Ci.SearchViewVisibleKey,Ci.FileMatchOrMatchFocusKey),primary:3114},category:vl})}async run(i){let e=Pc(i.get(Ft));if(e){let t=e.getControl();e.openEditorWithMultiCursor(t.getFocus()[0])}}});W(class extends K{constructor(){super({id:"search.focus.nextInputBox",title:L(13319,"Focus Next Input"),category:vl,keybinding:{weight:200,when:x.or(x.and(_b,Ci.InputBoxFocusedKey),x.and(Ci.SearchViewVisibleKey,Ci.InputBoxFocusedKey)),primary:2066}})}async run(i){let e=i.get(ee);e.activeEditor instanceof pp&&e.activeEditorPane.focusNextInput(),Pc(i.get(Ft))?.focusNextInputBox()}});W(class extends K{constructor(){super({id:"search.focus.previousInputBox",title:L(13321,"Focus Previous Input"),category:vl,keybinding:{weight:200,when:x.or(x.and(_b,Ci.InputBoxFocusedKey),x.and(Ci.SearchViewVisibleKey,Ci.InputBoxFocusedKey,Ci.SearchInputBoxFocusedKey.toNegated())),primary:2064}})}async run(i){let e=i.get(ee);e.activeEditor instanceof pp&&e.activeEditorPane.focusPrevInput(),Pc(i.get(Ft))?.focusPreviousInputBox()}});W(class extends K{constructor(){super({id:"search.action.focusSearchFromResults",title:L(13323,"Focus Search From Results"),category:vl,keybinding:{weight:200,when:x.and(Ci.SearchViewVisibleKey,x.or(Ci.FirstMatchFocusKey,$a)),primary:2064}})}run(i){Pc(i.get(Ft))?.focusPreviousInputBox()}});W(class DPi extends K{static{this.searchOnTypeKey="search.searchOnType"}constructor(){super({id:"workbench.action.toggleSearchOnType",title:L(13332,"Toggle Search on Type"),category:vl})}async run(i){let e=i.get(B),t=e.getValue(DPi.searchOnTypeKey);return e.updateValue(DPi.searchOnTypeKey,!t)}});W(class extends K{constructor(){super({id:"search.action.focusSearchList",title:L(13324,"Focus List"),category:vl,f1:!0})}async run(i){arn(i)}});W(class extends K{constructor(){super({id:"search.action.focusNextSearchResult",title:L(13320,"Focus Next Search Result"),keybinding:[{primary:62,weight:200}],category:vl,f1:!0,precondition:x.or(Ci.HasSearchResults,_b)})}async run(i){return await lrn(i)}});W(class extends K{constructor(){super({id:"search.action.focusPreviousSearchResult",title:L(13322,"Focus Previous Search Result"),keybinding:[{primary:1086,weight:200}],category:vl,f1:!0,precondition:x.or(Ci.HasSearchResults,_b)})}async run(i){return await crn(i)}});W(class extends K{constructor(){super({id:"workbench.action.replaceInFiles",title:L(13327,"Replace in Files"),keybinding:[{primary:3110,weight:200}],category:vl,f1:!0,menu:[{id:D.MenubarEditMenu,group:"4_find_global",order:2}]})}async run(i){return await drn(i,!0)}});function orn(a){Pc(a.get(Ft))?.toggleCaseSensitive()}function nrn(a){Pc(a.get(Ft))?.toggleWholeWords()}function rrn(a){Pc(a.get(Ft))?.toggleRegex()}function srn(a){Pc(a.get(Ft))?.togglePreserveCase()}var arn=a=>{let i=a.get(Ft);Q3(i).then(e=>{e?.moveFocusToResults()})};async function lrn(a){let i=a.get(ee);return i.activeEditor instanceof pp?i.activeEditorPane.focusNextResult():Q3(a.get(Ft)).then(t=>t?.selectNextMatch())}async function crn(a){let i=a.get(ee);return i.activeEditor instanceof pp?i.activeEditorPane.focusPreviousResult():Q3(a.get(Ft)).then(t=>t?.selectPreviousMatch())}async function drn(a,i){return Q3(a.get(Ft),!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(13336,"Dismiss"),category:vl,icon:vho,keybinding:{weight:200,when:x.and(Ci.SearchViewVisibleKey,Ci.FileMatchOrMatchFocusKey),primary:20,mac:{primary:2049}},menu:[{id:D.SearchContext,group:"search",order:2},{id:D.SearchActionMenu,group:"inline",when:x.or(Ci.FileFocusKey,Ci.MatchFocusKey,Ci.FolderFocusKey),order:2}]})}async run(i,e){let t=i.get(Ft),o=i.get(B),n=Pc(t);if(!n)return;let r=e?.element,s=e?.viewer;s||(s=n.getControl()),r||(r=s.getFocus()[0]??void 0);let l=tit(s,r,o.getValue("search")),c=s.getFocus()[0]??void 0;if(l.length===0)return;(!c||wA(c))&&(c=r);let u,p=Mho(l,c);c&&p&&(u=await pyo(s,c,l));let h=n.searchResult;h&&h.batchRemove(l),await n.queueRefreshTree(),c&&p?(u||(u=await myo(s,c).catch(()=>{})),u&&!z3(u,l)&&(s.reveal(u),s.setFocus([u],IE()),s.setSelection([u],IE()))):$i(s.getFocus(),s.getSelection())||s.setSelection(s.getFocus()),s.domFocus()}});W(class extends K{constructor(){super({id:"search.action.replace",title:L(13335,"Replace"),category:vl,keybinding:{weight:200,when:x.and(Ci.SearchViewVisibleKey,Ci.ReplaceActiveKey,Ci.MatchFocusKey,Ci.IsEditableItemKey),primary:3094},icon:RUt,menu:[{id:D.SearchContext,when:x.and(Ci.ReplaceActiveKey,Ci.MatchFocusKey,Ci.IsEditableItemKey),group:"search",order:1},{id:D.SearchActionMenu,when:x.and(Ci.ReplaceActiveKey,Ci.MatchFocusKey,Ci.IsEditableItemKey),group:"inline",order:1}]})}async run(i,e){return LPi(i,e)}});W(class extends K{constructor(){super({id:"search.action.replaceAllInFile",title:L(13334,"Replace All"),category:vl,keybinding:{weight:200,when:x.and(Ci.SearchViewVisibleKey,Ci.ReplaceActiveKey,Ci.FileFocusKey,Ci.IsEditableItemKey),primary:3094,secondary:[3075]},icon:RUt,menu:[{id:D.SearchContext,when:x.and(Ci.ReplaceActiveKey,Ci.FileFocusKey,Ci.IsEditableItemKey),group:"search",order:1},{id:D.SearchActionMenu,when:x.and(Ci.ReplaceActiveKey,Ci.FileFocusKey,Ci.IsEditableItemKey),group:"inline",order:1}]})}async run(i,e){return LPi(i,e)}});W(class extends K{constructor(){super({id:"search.action.replaceAllInFolder",title:L(13334,"Replace All"),category:vl,keybinding:{weight:200,when:x.and(Ci.SearchViewVisibleKey,Ci.ReplaceActiveKey,Ci.FolderFocusKey,Ci.IsEditableItemKey),primary:3094,secondary:[3075]},icon:RUt,menu:[{id:D.SearchContext,when:x.and(Ci.ReplaceActiveKey,Ci.FolderFocusKey,Ci.IsEditableItemKey),group:"search",order:1},{id:D.SearchActionMenu,when:x.and(Ci.ReplaceActiveKey,Ci.FolderFocusKey,Ci.IsEditableItemKey),group:"inline",order:1}]})}async run(i,e){return LPi(i,e)}});async function LPi(a,i){let e=a.get(B),t=a.get(Ft),o=Pc(t),n=i?.viewer??o?.getControl();if(!n)return;let r=i?.element??n.getFocus()[0],s=tit(n,r??void 0,e.getValue("search")),l=n.getFocus()[0];if((!l||l&&!z3(l,s)||wA(l))&&(l=r),s.length===0)return;let c;l&&(c=await pyo(n,l,s));let u=o?.searchResult;u&&await u.batchReplace(s),await o?.queueRefreshTree(),l&&(c||(c=await myo(n,l)),c&&(n.reveal(c),n.setFocus([c],IE()),n.setSelection([c],IE()),Ka(c)?!e.getValue().search.useReplacePreview||urn(a,c)||c instanceof Mte?o?.open(c,!0):a.get(fI).openReplacePreview(c,!0):fl(c)&&o?.open(c,!0))),n.domFocus()}function urn(a,i){if(!Ka(i))return!1;let t=a.get(ee).activeEditor?.resource;return t?a.get(dt).extUri.isEqual(t,i.parent().resource):!1}function prn(a,i){return Ka(a)?Ka(i)?0:-1:fl(a)?Ka(i)?1:fl(i)?0:-1:bd(a)?jf(i)?-1:bd(i)?0:1:jf(i)?0:1}async function pyo(a,i,e){let t=a.navigate(i);if(bd(i))for(;t.next()&&(!bd(t.current())||z3(t.current(),e)););else if(fl(i))for(;t.next()&&(!fl(t.current())||z3(t.current(),e));){if(t.current()instanceof J3)return t.current();await a.expand(t.current())}else for(;t.next()&&(!Ka(t.current())||z3(t.current(),e));){if(t.current()instanceof J3)return t.current();await a.expand(t.current())}return t.current()}async function myo(a,i){let e=a.lastVisibleElement??null;for(;e;){let t=prn(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(wA(o))break;e=o}else return e}}W(class hyo extends K{static{this.ID="workbench.action.showAllSymbols"}static{this.LABEL=d(13338,null)}static{this.ALL_SYMBOLS_PREFIX="#"}constructor(){super({id:"workbench.action.showAllSymbols",title:{...L(13339,"Go to Symbol in Workspace..."),mnemonicTitle:d(13337,null)},f1:!0,keybinding:{weight:200,primary:2098},menu:{id:D.MenubarGoMenu,group:"3_global_nav",order:2}})}async run(i){i.get(Ge).quickAccess.show(hyo.ALL_SYMBOLS_PREFIX)}});var Yge="%",mrn={_reason:"quickAccessSearch",disregardIgnoreFiles:!1,disregardExcludeSettings:!1,onlyOpenEditors:!1,expandPatterns:!0},RPi=30,hrn=10,grn=75,gVe=class extends yh{constructor(e,t,o,n,r,s){super(Yge,{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(aS),this.searchModel=this._register(this._instantiationService.createInstance(dG)),this.editorViewState=this._register(this._instantiationService.createInstance(oK)),this.searchModel.location=1,this.editorSequencer=new Nm}_getTextQueryBuilderOptions(e){return{...mrn,extraFileResources:this._instantiationService.invokeFunction(SX),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 P;Yge.length<e.value.length&&(e.valueSelection=[Yge.length,e.value.length]),e.buttons=[{location:2,iconClass:q.asClassName(M.goToSearch),tooltip:d(13160,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(H.debounce(e.onDidChangeActive,(s,l)=>l,grn,!0)(r)),n.add(H.once(e.onWillHide)(({reason:s})=>{s===2&&this.editorViewState.restore()})),n.add(H.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 Mn(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(ny,!1);let t=this._viewsService.getActiveViewWithId(ny);await t.replaceSearchModel(this.searchModel,this.currentAsyncSearch),this.searchModel=this._instantiationService.createInstance(dG),this.searchModel.location=1;let o=t?.getControl();e?(o.setFocus([e],IE()),o.setSelection([e],IE()),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 NUt(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(13164,null),iconClass:q.asClassName(she),accept:async()=>{await this.moveToSearchViewlet(e[t])}});break}let l=n[s],c=Ra(l.resource),u=this._labelService.getUriLabel(ci(l.resource),{relative:!0});r.push({label:c,type:"separator",description:u,buttons:[{iconClass:q.asClassName(kho),tooltip:d(13163,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===hrn){r.push({label:d(13162,null),iconClass:q.asClassName(she),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(hho),tooltip:d(13165,null)}],ariaLabel:`Match at location ${g.range().startLineNumber}:${g.range().startColumn} - ${v}`,accept:async(S,y)=>{await this.handleAccept(l,{keyMods:S,selection:UEi(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?vn:Un;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(13159,null)}];let r=t.add(new $e);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,RPi,this._editorService.activeEditor?.resource);return c.length>0&&this.searchModel.searchResult.toggleHighlights(!0),l.length>=RPi?c:{picks:c,additionalPicks:s.asyncResults.then(u=>u.length+c.length===0?[{label:d(13161,null)}]:this._getPicksFromMatches(u,RPi-l.length)).then(u=>(u.length>0&&this.searchModel.searchResult.toggleHighlights(!0),u))}}};gVe=I([m(0,F),m(1,Pe),m(2,ee),m(3,ot),m(4,Ft),m(5,B)],gVe);W(class extends K{constructor(){super({id:"workbench.action.quickTextSearch",title:L(13340,"Quick Search"),category:vl,f1:!0})}async run(i,e){let t=i.get(Ge),o=frn(i)??"";t.quickAccess.show(Yge+o,{preserveValue:!!o})}});function frn(a){let i=a.get(ee),e=a.get(B),t=i.activeTextEditorControl;return!t||!t.hasTextFocus()||!e.getValue("editor.find.seedSearchStringFromSelection")?null:zEi(!1,t)}var S$t=class{constructor(){this.priority=105;this.name="search";this.type="help";this.when=Ci.SearchInputBoxFocusedKey}getProvider(i){let e=i.get(Lte),t=i.get(Ft),o=e.searchModel;if(o)return new MPi(o,t)}},MPi=class extends C{constructor(e,t){super();this._searchModel=e;this._viewsService=t;this.id="searchHelp";this.verbositySettingKey="accessibility.verbosity.find";this.options={type:"help"}}onClose(){Pc(this._viewsService)?.focus()}provideContent(){let e=[],t=this._searchModel.searchResult.count(),o=this._searchModel.replaceActive;return e.push(d(13252,null)),e.push(d(13247,null)),e.push(""),e.push(d(13298,null)),e.push(d(13299,null)),t!==void 0?t===0?e.push(d(13273,null)):e.push(d(13283,null,t)):e.push(d(13274,null)),e.push(""),e.push(d(13260,null)),e.push(d(13259,null)),e.push(""),e.push(d(13258,null)),e.push(d(13257,null)),e.push(d(13253,null)),e.push(d(13254,null)),e.push(d(13255,null)),e.push(d(13256,null)),e.push(""),e.push(d(13251,null)),e.push(d(13248,null)),e.push(d(13249,null)),e.push(d(13250,null,"<keybinding:search.action.focusNextSearchResult>")),e.push(""),e.push(d(13262,null)),e.push(""),e.push(d(13267,null)),e.push(d(13263,null)),e.push(d(13270,null)),e.push(""),e.push(d(13266,null)),e.push(d(13261,null)),e.push(d(13268,null)),e.push(""),e.push(d(13265,null)),e.push(d(13264,null,"<keybinding:search.action.focusNextSearchResult>")),e.push(d(13269,null,"<keybinding:search.action.focusPreviousSearchResult>")),e.push(""),e.push(d(13277,null)),e.push(d(13275,null)),e.push(d(13278,null)),e.push(d(13276,null)),e.push(""),o&&(e.push(d(13281,null)),e.push(d(13279,null)),e.push(d(13280,null)),e.push(d(13282,null)),e.push("")),e.push(d(13292,null,"<keybinding:workbench.action.openSettings>")),e.push(d(13293,null)),e.push(d(13296,null)),e.push(d(13294,null)),e.push(d(13291,null)),e.push(d(13287,null)),e.push(d(13289,null)),e.push(d(13285,null)),e.push(d(13288,null)),e.push(d(13295,null)),e.push(d(13286,null)),e.push(d(13297,null)),e.push(d(13284,null)),o&&e.push(d(13290,null)),it&&(e.push(""),e.push(d(13272,null)),e.push(d(13271,null))),e.push(""),e.push(d(13246,null)),e.push(d(13245,null)),e.join(`
`)}};we(Lte,hVe,1);we(aNe,xA,1);ayo();lyo();Vho();pt(uhe.ID,uhe,ut.AfterRestored);xa.register(new S$t);var vrn="search.mode",gyo=oe.as(on.ViewContainersRegistry).registerViewContainer({id:xmi,title:L(13180,"Search"),ctorDescriptor:new Mt(Ha,[xmi,{mergeViewWithContainerWhenSingleView:!0}]),hideIfEmpty:!0,icon:TEi,order:1},0,{doNotRegisterOpenCommand:!0}),brn={id:ny,containerIcon:TEi,name:L(13180,"Search"),ctorDescriptor:new Mt(D2),canToggleVisibility:!1,canMoveView:!0,openCommandActionDescriptor:{id:gyo.id,mnemonicTitle:d(13177,null),keybindings:{primary:3108,when:x.regex("neverMatch",/doesNotMatch/)},order:1}};oe.as(on.ViewsRegistry).registerViews([brn],gyo);var PPi=oe.as(Tu.Quickaccess);PPi.registerQuickAccessProvider({ctor:Ew,prefix:Ew.PREFIX,placeholder:d(13169,null,jge.GO_TO_LINE_PREFIX,_k.PREFIX),contextKey:ifi,helpEntries:[{description:d(13168,null),commandId:"workbench.action.quickOpen",commandCenterOrder:10}]});PPi.registerQuickAccessProvider({ctor:Tk,prefix:Tk.PREFIX,placeholder:d(13236,null),contextKey:"inWorkspaceSymbolsPicker",helpEntries:[{description:d(13235,null),commandId:"workbench.action.showAllSymbols"}]});PPi.registerQuickAccessProvider({ctor:gVe,prefix:Yge,contextKey:"inTextSearchPicker",placeholder:d(13238,null),helpEntries:[{description:d(13237,null),commandId:"workbench.action.quickTextSearch",commandCenterOrder:25}]});var Srn=oe.as(ii.Configuration);Srn.registerConfiguration({id:"search",order:13,title:d(13228,null),type:"object",properties:{[_Lt]:{type:"object",markdownDescription:d(13170,null),default:{"**/node_modules":!0,"**/bower_components":!0,"**/*.code-search":!0},additionalProperties:{anyOf:[{type:"boolean",description:d(13171,null)},{type:"object",properties:{when:{type:"string",pattern:"\\w*\\$\\(basename\\)\\w*",default:"$(basename).ext",markdownDescription:d(13172,null)}}}]},scope:5},[vrn]:{type:"string",enum:["view","reuseEditor","newEditor"],default:"view",markdownDescription:d(13196,null),enumDescriptions:[d(13199,null),d(13198,null),d(13197,null)]},"search.useRipgrep":{type:"boolean",description:d(13243,null),deprecationMessage:d(13244,null),default:!0},"search.maintainFileSearchCache":{type:"boolean",deprecationMessage:d(13176,null),description:d(13194,null),default:!1},"search.useIgnoreFiles":{type:"boolean",markdownDescription:d(13240,null),default:!0,scope:5},"search.useGlobalIgnoreFiles":{type:"boolean",markdownDescription:d(13239,null,"`#search.useIgnoreFiles#`"),default:!1,scope:5},"search.useParentIgnoreFiles":{type:"boolean",markdownDescription:d(13241,null,"`#search.useIgnoreFiles#`"),default:!1,scope:5},"search.quickOpen.includeSymbols":{type:"boolean",description:d(13202,null),default:!1},"search.ripgrep.maxThreads":{type:"number",description:d(13203,null),default:0},"search.quickOpen.includeHistory":{type:"boolean",description:d(13201,null),default:!0},"search.quickOpen.history.filterSortOrder":{type:"string",enum:["default","recency"],default:"default",enumDescriptions:[d(13174,null),d(13175,null)],description:d(13173,null)},"search.followSymlinks":{type:"boolean",description:d(13190,null),default:!0},"search.smartCase":{type:"boolean",description:d(13224,null),default:!1},"search.globalFindClipboard":{type:"boolean",default:!1,description:d(13191,null),included:it},"search.location":{type:"string",enum:["sidebar","panel"],default:"sidebar",description:d(13192,null),deprecationMessage:d(13193,null)},"search.maxResults":{type:["number","null"],default:y5,markdownDescription:d(13195,null)},"search.collapseResults":{type:"string",enum:["auto","alwaysCollapse","alwaysExpand"],enumDescriptions:[d(13185,null),"",""],default:"alwaysExpand",description:d(13184,null)},"search.useReplacePreview":{type:"boolean",default:!0,description:d(13227,null)},"search.showLineNumbers":{type:"boolean",default:!1,description:d(13223,null)},"search.usePCRE2":{type:"boolean",default:!1,description:d(13226,null),deprecationMessage:d(13242,null)},"search.actionsPosition":{type:"string",enum:["auto","right"],enumDescriptions:[d(13182,null),d(13183,null)],default:"right",description:d(13181,null)},"search.searchOnType":{type:"boolean",default:!0,description:d(13214,null)},"search.seedWithNearestWord":{type:"boolean",default:!1,description:d(13222,null)},"search.seedOnFocus":{type:"boolean",default:!1,markdownDescription:d(13221,null)},"search.searchOnTypeDebouncePeriod":{type:"number",default:300,markdownDescription:d(13215,null,"`#search.searchOnType#`")},"search.searchEditor.doubleClickBehaviour":{type:"string",enum:["selectWord","goToLocation","openLocationToSide"],default:"goToLocation",enumDescriptions:[d(13208,null),d(13206,null),d(13207,null)],markdownDescription:d(13205,null)},"search.searchEditor.singleClickBehaviour":{type:"string",enum:["default","peekDefinition"],default:"default",enumDescriptions:[d(13212,null),d(13213,null)],markdownDescription:d(13211,null)},"search.searchEditor.reusePriorSearchConfiguration":{type:"boolean",default:!1,markdownDescription:d(13210,null)},"search.searchEditor.defaultNumberOfContextLines":{type:["number","null"],default:1,markdownDescription:d(13204,null)},"search.searchEditor.focusResultsOnSearch":{type:"boolean",default:!1,markdownDescription:d(13209,null)},"search.sortOrder":{type:"string",enum:["default","fileNames","type","modified","countDescending","countAscending"],default:"default",enumDescriptions:[d(13231,null),d(13232,null),d(13234,null),d(13233,null),d(13230,null),d(13229,null)],description:d(13225,null)},"search.decorations.colors":{type:"boolean",description:d(13187,null),default:!0},"search.decorations.badges":{type:"boolean",description:d(13186,null),default:!0},"search.defaultViewMode":{type:"string",enum:["tree","list"],default:"list",enumDescriptions:[d(13179,null),d(13178,null)],description:d(13188,null)},"search.quickAccess.preserveInput":{type:"boolean",description:d(13200,null),default:!1},"search.experimental.closedNotebookRichContentResults":{type:"boolean",description:d(13189,null),default:!1},"search.searchView.semanticSearchBehavior":{type:"string",description:d(13217,null),enum:["manual","runOnEmpty","auto"],default:"manual",enumDescriptions:[d(13219,null),d(13220,null),d(13218,null)],tags:["preview"]},"search.searchView.keywordSuggestions":{type:"boolean",description:d(13216,null),default:!1,tags:["preview"]}}});qe.registerCommand("_executeWorkspaceSymbolProvider",async function(a,...i){let[e]=i;return So(typeof e=="string"),(await VDt(e)).map(o=>o.symbol)});oe.as(rp.ConfigurationMigration).registerConfigurationMigrations([{key:"search.experimental.quickAccess.preserveInput",migrateFn:(a,i)=>[["search.quickAccess.preserveInput",{value:a}],["search.experimental.quickAccess.preserveInput",{value:void 0}]]}]);var fyo=/^(\s+)(\d+)(: |  )(\s*)(.*)$/,vyo=/^(\S.*):$/,uG=class extends fJ{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T){super(uG.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 jo(0));this.pauseSearching=!1;this.showingIncludesExcludes=!1;this.ongoingOperations=0;this.updatingModelForSearch=!1;this.container=_(".search-editor"),this.searchOperation=this._register(new Eye(f)),this._register(this.messageDisposables=new P),this.searchHistoryDelayer=this._register(new jo(2e3)),this.searchModel=this._register(this.instantiationService.createInstance(dG))}static{this.ID=iit}static{this.SEARCH_EDITOR_VIEW_STATE_PREFERENCE_KEY="searchEditorViewState"}get searchResultEditor(){return this.editorControl}createEditor(e){R(e,this.container),this.queryEditorContainer=R(this.container,_(".query-container"));let t=R(this.container,_(".search-results"));super.createEditor(t),this.registerEditorListeners();let o=Oi(this.scopedContextKeyService);_b.bindTo(o).set(!0),this.createQueryEditor(this.queryEditorContainer,this._register(this.instantiationService.createChild(new Io([X,o]))),Ci.InputBoxFocusedKey.bindTo(o))}createQueryEditor(e,t,o){let n=c_({inputBorder:Irn});this.queryEditorWidget=this._register(t.createInstance(jR,e,{_hideReplaceToggle:!0,showContextToggle:!0,inputBoxStyles:n,toggleStyles:qg})),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=R(e,_(".includes-excludes"));let r=d(13464,null);this.toggleQueryDetailsButton=R(this.includesExcludesContainer,_(".expand"+q.asCSSSelector(she),{tabindex:0,role:"button","aria-label":r})),this._register(this.hoverService.setupManagedHover(Ni("element"),this.toggleQueryDetailsButton,r)),this._register(j(this.toggleQueryDetailsButton,re.CLICK,p=>{$t.stop(p),this.toggleIncludesExcludes()})),this._register(j(this.toggleQueryDetailsButton,re.KEY_UP,p=>{let h=new Ii(p);(h.equals(3)||h.equals(10))&&($t.stop(p),this.toggleIncludesExcludes())})),this._register(j(this.toggleQueryDetailsButton,re.KEY_DOWN,p=>{new Ii(p).equals(1026)&&(this.queryEditorWidget.isReplaceActive()?this.queryEditorWidget.focusReplaceAllAction():this.queryEditorWidget.isReplaceShown()?this.queryEditorWidget.replaceInput?.focusOnPreserve():this.queryEditorWidget.focusRegexAction(),$t.stop(p))}));let s=R(this.includesExcludesContainer,_(".file-types.includes")),l=d(13469,null);R(s,_("h4",void 0,l)),this.inputPatternIncludes=this._register(t.createInstance(Tte,s,this.contextViewService,{ariaLabel:d(13463,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=R(this.includesExcludesContainer,_(".file-types.excludes")),u=d(13468,null);R(c,_("h4",void 0,u)),this.inputPatternExcludes=this._register(t.createInstance(_te,c,this.contextViewService,{ariaLabel:d(13462,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=R(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=R(this.messageBox,_("a.pointer.prominent.message",{},d(13465,null)));this.messageDisposables.add(j(t,re.CLICK,async()=>{await this.triggerSearch(),this.searchResultEditor.focus()}))}}_getContributions(){let e=[oY.ID];return aa.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(vyo)||n.match(fyo))&&(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(fyo)?(this.searchResultEditor.setSelection(z.fromPositions(o)),this.commandService.executeCommand(t==="goToLocation"?"editor.action.goToDeclaration":"editor.action.openDeclarationToTheSide")):n.match(vyo)&&(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 Yt(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 Ie(o,n):new Ie(1,1),s=this.searchResultEditor.getSelection()?.getStartPosition()??r,l=this.getInput()?.getMatchRanges();if(!l)return;let c=(e?wrn:yrn)(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}Jo(d(13467,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 Yt(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 Ie(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(SX),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(aS).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),yE.get(this.searchResultEditor)?.closeWidget(!1);let l=p=>this.labelService.getUriLabel(p,{relative:!0}),c=VUt(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=R(this.messageBox,_(".message")),R(t,PUt(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-nh(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===oit)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===oit}restoreViewState(e){let t=this.loadEditorViewState(this.getInput(),e);t&&this.searchResultEditor.restoreViewState(t)}getAriaLabel(){return this.getInput()?.getName()??d(13466,null)}};uG=I([m(1,Te),m(2,De),m(3,le),m(4,Ct),m(5,Pe),m(6,ot),m(7,F),m(8,_n),m(9,ge),m(10,Qe),m(11,Ne),m(12,rd),m(13,Nn),m(14,Et),m(15,ee),m(16,B),m(17,be),m(18,ne),m(19,tt)],uG);var Irn=J("searchEditor.textInputBorder",Vy,d(13470,null));function yrn(a,i){for(let e of a)if(Ie.isBefore(i,e.getStartPosition()))return e;return a[0]}function wrn(a,i){for(let e=a.length-1;e>=0;e--){let t=a[e];if(Ie.isBefore(t.getStartPosition(),i))return t}return a[a.length-1]}var Crn="search.action.openInEditor",xrn="search.action.openNewEditorToSide",krn="search.action.focusQueryEditorWidget",Ern="search.action.focusFilesToInclude",Trn="search.action.focusFilesToExclude",_rn="toggleSearchEditorCaseSensitive",Drn="toggleSearchEditorWholeWord",Lrn="toggleSearchEditorRegex",Rrn="increaseSearchEditorContextLines",Mrn="decreaseSearchEditorContextLines",Prn="rerunSearchEditorSearch",Arn="cleanSearchEditorState",Nrn="selectAllSearchEditorMatches";oe.as(rn.EditorPane).registerEditorPane(ys.create(uG,uG.ID,d(13482,null)),[new Mt(pp)]);var fVe=class{static{this.ID="workbench.contrib.searchEditor"}constructor(i,e){i.registerEditor("*"+dNe,{id:pp.ID,label:d(13471,null),detail:Ys.providerDisplayName,priority:"default"},{singlePerResource:!0,canSupportResource:t=>ms(t)===dNe},{createEditorInput:({resource:t})=>({editor:e.invokeFunction(kA,{from:"existingFile",fileUri:t})})})}};fVe=I([m(0,ul),m(1,F)],fVe);pt(fVe.ID,fVe,ut.BlockStartup);var APi=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(kA,{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(kA,{from:"existingFile",fileUri:A.parse(s)}):i.invokeFunction(kA,{from:"rawData",resultsContents:"",config:n})}};oe.as(rn.EditorFactory).registerEditorSerializer(pp.ID,APi);qe.registerCommand(Arn,a=>{let i=a.get(ee).activeEditorPane;i instanceof uG&&i.cleanState()});var Ak=L(13472,"Search Editor"),NPi=(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},OPi={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(13490,"Delete File Results"),keybinding:{weight:100,primary:3073},precondition:_b,category:Ak,f1:!0})}async run(a){a.get(X).getContext(Pn()).getValue(_b.serialize())&&a.get(ee).activeEditorPane.deleteResultBlock()}});W(class extends K{constructor(){super({id:Pho,title:L(13478,"New Search Editor"),category:Ak,f1:!0,metadata:OPi})}async run(a,i){await a.get(F).invokeFunction(uNe,NPi({location:"new",...i}))}});W(class extends K{constructor(){super({id:ahe,title:L(13480,"Open Search Editor"),category:Ak,f1:!0,metadata:OPi})}async run(a,i){await a.get(F).invokeFunction(uNe,NPi({location:"reuse",...i}))}});W(class extends K{constructor(){super({id:xrn,title:L(13477,"Open New Search Editor to the Side"),category:Ak,f1:!0,metadata:OPi})}async run(a,i){await a.get(F).invokeFunction(uNe,NPi(i),!0)}});W(class extends K{constructor(){super({id:Crn,title:L(13479,"Open Results in Editor"),category:Ak,f1:!0,keybinding:{primary:515,when:x.and(Ci.HasSearchResults,Ci.SearchViewFocusedKey),weight:200,mac:{primary:2051}}})}async run(a){let i=a.get(Ft),e=a.get(F),t=Pc(i);t&&await e.invokeFunction(UUt,t.searchResult,t.searchIncludePattern.getValue(),t.searchExcludePattern.getValue(),t.searchIncludePattern.onlySearchInOpenEditors())}});W(class extends K{constructor(){super({id:Prn,title:L(13481,"Search Again"),category:Ak,keybinding:{primary:3120,when:_b,weight:100},icon:MUt,menu:[...[D.EditorTitle,D.CompactWindowEditorTitle].map(a=>({id:a,group:"navigation",when:fr.isEqualTo(iit)})),{id:D.CommandPalette,when:fr.isEqualTo(iit)}]})}async run(a){let i=a.get(ee);i.activeEditor instanceof pp&&i.activeEditorPane.triggerSearch({resetCursor:!1})}});W(class extends K{constructor(){super({id:krn,title:L(13475,"Focus Search Editor Input"),category:Ak,f1:!0,precondition:_b,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:Ern,title:L(13474,"Focus Search Editor Files to Include"),category:Ak,f1:!0,precondition:_b})}async run(a){let i=a.get(ee);i.activeEditor instanceof pp&&i.activeEditorPane.focusFilesToIncludeInput()}});W(class extends K{constructor(){super({id:Trn,title:L(13473,"Focus Search Editor Files to Exclude"),category:Ak,f1:!0,precondition:_b})}async run(a){let i=a.get(ee);i.activeEditor instanceof pp&&i.activeEditorPane.focusFilesToExcludeInput()}});W(class extends K{constructor(){super({id:_rn,title:L(13486,"Toggle Match Case"),category:Ak,f1:!0,precondition:_b,keybinding:Object.assign({weight:200,when:Ci.SearchInputBoxFocusedKey},Bq)})}run(a){zho(a)}});W(class extends K{constructor(){super({id:Drn,title:L(13489,"Toggle Match Whole Word"),category:Ak,f1:!0,precondition:_b,keybinding:Object.assign({weight:200,when:Ci.SearchInputBoxFocusedKey},Hq)})}run(a){Kho(a)}});W(class extends K{constructor(){super({id:Lrn,title:L(13488,"Toggle Use Regular Expression"),category:Ak,f1:!0,precondition:_b,keybinding:Object.assign({weight:200,when:Ci.SearchInputBoxFocusedKey},Uq)})}run(a){Gho(a)}});W(class extends K{constructor(){super({id:FUt,title:L(13487,"Toggle Context Lines"),category:Ak,f1:!0,precondition:_b,keybinding:{weight:200,primary:554,mac:{primary:2602}}})}run(a){$ho(a)}});W(class extends K{constructor(){super({id:Rrn,title:L(13484,"Increase Context Lines"),category:Ak,f1:!0,precondition:_b,keybinding:{weight:200,primary:598}})}run(a){HEi(a,!0)}});W(class extends K{constructor(){super({id:Mrn,title:L(13483,"Decrease Context Lines"),category:Ak,f1:!0,precondition:_b,keybinding:{weight:200,primary:600}})}run(a){HEi(a,!1)}});W(class extends K{constructor(){super({id:Nrn,title:L(13485,"Select All Matches"),category:Ak,f1:!0,precondition:_b,keybinding:{weight:200,primary:3114}})}run(a){qho(a)}});W(class extends K{constructor(){super({id:"search.action.openNewEditorFromView",title:d(13476,null),category:Ak,icon:xho,menu:[{id:D.ViewTitle,group:"navigation",order:2,when:x.equals("view",ny)}]})}run(i,...e){return jho(i)}});var vVe=class extends C{constructor(e,t){super();this.instantiationService=e;this._register(t.registerHandler(this))}static{this.ID="workbench.contrib.searchEditorWorkingCopyEditorHandler"}handles(e){return e.resource.scheme===iNe}isOpen(e,t){return this.handles(e)?t instanceof pp&&Xe(e.resource,t.modelUri):!1}createEditor(e){let t=this.instantiationService.invokeFunction(kA,{from:"model",modelUri:e.resource});return t.setDirty(!0),t}};vVe=I([m(0,F),m(1,Vf)],vVe);pt(vVe.ID,vVe,ut.BlockRestore);var Xge=class extends C{constructor(e){super();this.configurationService=e;this.styleSheet=hr();H.filter(e.onDidChangeConfiguration,n=>n.affectsConfiguration("workbench.sash.size"))(this.onDidChangeSize,this,this._store),this.onDidChangeSize(),H.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=Kn(e,4,20),o=Kn(e,1,8);this.styleSheet.textContent=`
			.monaco-workbench {
				--vscode-sash-size: ${t}px;
				--vscode-sash-hover-size: ${o}px;
			}
		`,u4i(t)}onDidChangeHoverDelay(){h4i(this.configurationService.getValue("workbench.sash.hoverDelay"))}};Xge=I([m(0,B)],Xge);pt(Xge.ID,Xge,ut.AfterRestored);oe.as(ii.Configuration).registerConfiguration({...Cm,properties:{"workbench.sash.size":{type:"number",default:Nc?20:4,minimum:1,maximum:20,description:d(12922,null)},"workbench.sash.hoverDelay":{type:"number",default:300,minimum:0,maximum:2e3,description:d(12921,null)}}});we(tJ,GTe,1);var I$t=new Q("quickDiffDecorationCount",0),ST=class extends C{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(12929,null),p={gutter:s,overview:{active:l,color:QY},minimap:{active:c,color:Ake},isWholeLine:!0};this.addedOptions=ST.createDecoration("dirty-diff-added primary",u,p),this.addedPatternOptions=ST.createDecoration("dirty-diff-added primary pattern",u,p),this.addedSecondaryOptions=ST.createDecoration("dirty-diff-added secondary",u,p),this.addedSecondaryPatternOptions=ST.createDecoration("dirty-diff-added secondary pattern",u,p);let h=d(12931,null),g={gutter:s,overview:{active:l,color:jY},minimap:{active:c,color:Pke},isWholeLine:!0};this.modifiedOptions=ST.createDecoration("dirty-diff-modified primary",h,g),this.modifiedPatternOptions=ST.createDecoration("dirty-diff-modified primary pattern",h,g),this.modifiedSecondaryOptions=ST.createDecoration("dirty-diff-modified secondary",h,g),this.modifiedSecondaryPatternOptions=ST.createDecoration("dirty-diff-modified secondary pattern",h,g);let f=d(12930,null),v={gutter:s,overview:{active:l,color:YY},minimap:{active:c,color:Nke},isWholeLine:!1};this.deletedOptions=ST.createDecoration("dirty-diff-deleted primary",f,v),this.deletedSecondaryOptions=ST.createDecoration("dirty-diff-deleted secondary",f,v),this._register(o.onDidChangeConfiguration(b=>{b.affectsConfiguration("scm.diffDecorationsGutterPattern")&&this.onDidChange()})),this._register(H.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:Ss(o.overview.color),position:1}),o.minimap.active&&(n.minimap={color:Ss(o.minimap.color),position:2}),po.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=CQe(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()}};ST=I([m(2,B),m(3,OE)],ST);var bVe=class extends C{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 vt;this.viewState={width:3,visibility:"always"};this.transientDisposables=this._register(new P);this.stylesheet=hr(void 0,void 0,this._store),this.quickDiffDecorationCount=I$t.bindTo(s),this.activeEditor=ui(this,this.editorService.onDidActiveEditorChange,()=>this.editorService.activeEditor),this.quickDiffProviders=ui(this,this.quickDiffService.onDidChangeQuickDiffProviders,()=>this.quickDiffService.providers);let l=H.filter(t.onDidChangeConfiguration,p=>p.affectsConfiguration("scm.diffDecorations"));this._register(l(this.onDidChangeConfiguration,this)),this.onDidChangeConfiguration();let c=H.filter(t.onDidChangeConfiguration,p=>p.affectsConfiguration("scm.diffDecorationsGutterWidth"));this._register(c(this.onDidChangeDiffWidthConfiguration,this)),this.onDidChangeDiffWidthConfiguration();let u=H.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(H.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(he(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(he(s=>{let l=r.read(s);this.quickDiffDecorationCount.set(l)}))}))}onDidChangeQuickDiffProviders(){this.transientDisposables.add(he(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?PI.INSTANCE:Ry.INSTANCE,menu:{id:D.SCMQuickDiffDecorations,group:l,order:c},f1:!1})}run(u){u.get(OE).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 jt),this.decorators.get(t.uri).set(o,new ST(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()}};bVe=I([m(0,ee),m(1,B),m(2,HO),m(3,OE),m(4,dt),m(5,X)],bVe);var y$t={ActiveRepositoryName:new Q("scmActiveRepositoryName",""),ActiveRepositoryBranchName:new Q("scmActiveRepositoryBranchName","")},SVe=class extends C{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=y$t.ActiveRepositoryName.bindTo(this.contextKeyService),this._activeRepositoryBranchNameContextKey=y$t.ActiveRepositoryBranchName.bindTo(this.contextKeyService),this.titleService.registerVariables([{name:"activeRepositoryName",contextKey:y$t.ActiveRepositoryName.key},{name:"activeRepositoryBranchName",contextKey:y$t.ActiveRepositoryBranchName.key}]),this._countBadgeConfig=pr("scm.countBadge","all",this.configurationService),this._repositories=ui(this,H.any(this.scmService.onDidAddRepository,this.scmService.onDidRemoveRepository),()=>ht.filter(this.scmService.repositories,c=>c.provider.isHidden!==!0)),this._activeRepositoryHistoryItemRefName=Ce(c=>this.scmViewService.activeRepository.read(c)?.repository.provider.historyProvider.read(c)?.historyItemRef.read(c)?.name),this._countBadgeRepositories=Ce(this,c=>{switch(this._countBadgeConfig.read(c)){case"all":{let u=this._repositories.read(c);return[...ht.map(u,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=Ce(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(he(c=>{let u=this._countBadge.read(c);this._updateActivityCountBadge(u,c.store)})),this._register(he(c=>{let u=this.scmViewService.activeRepository.read(c),p=u?.repository.provider.statusBarCommands.read(c);this._updateStatusBar(u,p??[],c.store)})),this._register(he(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,()=>cHt(e.provider))}_updateActivityCountBadge(e,t){if(e===0)return;let o=new qc(e,n=>d(12925,null,n));t.add(this.activityService.showViewActivity(Af,{badge:o}))}_updateStatusBar(e,t,o){if(!e)return;let n=e.repository.provider.rootUri?`${Ye(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=Sxi(s),u={name:d(12926,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=uHt(e,e.repository),s={name:d(12927,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??"")}};SVe=I([m(0,zl),m(1,B),m(2,X),m(3,$c),m(4,au),m(5,Tr),m(6,qP)],SVe);var IVe=class extends C{constructor(e,t,o){super();this.scmService=t;this.uriIdentityService=o;this._onDidRepositoryChange=new E;let n=new Q("scmActiveResourceHasChanges",!1,d(12923,null)),r=new Q("scmActiveResourceRepository",void 0,d(12924,null));this._repositories=ui(this,H.any(this.scmService.onDidAddRepository,this.scmService.onDidRemoveRepository),()=>this.scmService.repositories),this._register(he(c=>{for(let u of this._repositories.read(c))c.store.add(H.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=no.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=no.getOriginalUri(e);return t?this.scmService.getRepository(t)?.id:void 0}dispose(){this._onDidRepositoryChange.dispose(),super.dispose()}};IVe=I([m(0,Et),m(1,$c),m(2,dt)],IVe);var FPi=class extends C{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 zq([""],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}},WPi=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 FPi(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()}},VPi=class{constructor(){this._didChangeHistory=!1}get didChangeHistory(){return this._didChangeHistory}historyDidIndeedChange(){this._didChangeHistory=!0}},Vrt=class{constructor(i,e){this.storageService=i;this.workspaceContextService=e;this.disposables=new P;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 vt,this.histories.set(o,s)),s.set(n,new zq(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 ht.reverse(l))c.prepend(u)}}})),this.disposables.add(this.storageService.onWillSaveState(o=>{let n=new VPi;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 vt,this.histories.set(i,t));let o=t.get(e);return o||(o=new zq([""],100),t.set(e,o)),o}migrateStorage(){let i=!1,e=ht.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 ht.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()}};Vrt=I([m(0,le),m(1,Pe)],Vrt);var yVe=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 Vrt(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 P,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 WPi(i.id,i,e,this.inputHistory);return this._repositories.set(i.id,o),e.add(_s(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!==Y.file&&i.scheme!==Y.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}};yVe=I([m(0,ne),m(1,Pe),m(2,X),m(3,le),m(4,dt)],yVe);var wVe=class extends Ha{constructor(i,e,t,o,n,r,s,l,c,u,p){super(Uce,{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}};wVe=I([m(0,fi),m(1,Te),m(2,F),m(3,ze),m(4,De),m(5,le),m(6,B),m(7,lt),m(8,Pe),m(9,Ri),m(10,ne)],wVe);var CVe=class extends as{constructor(e){super();this.getSelectedRepositories=e}async runAction(e,t){if(!(e instanceof Eo))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)}},D0=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=Nr(this,this.scmViewService.onDidChangeVisibleRepositories)}static{this.TEMPLATE_ID="repository"}get templateId(){return D0.TEMPLATE_ID}renderTemplate(i){let e=R(i,_(".scm-provider")),t=R(e,_(".icon")),o=new Lc(e,{supportIcons:!1}),n=R(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=R(e,_(".count")),l=new fv(s,{},BS),c=r.onDidChangeDropdownVisibility(p=>e.classList.toggle("active",p)),u=hn(o,c,r);return{icon:t,label:o,countContainer:s,count:l,toolBar:r,elementDisposables:new P,templateDisposable:u}}renderElement(i,e,t){let o=fd(i)?i:i.element;t.elementDisposables.add(he(h=>{this.onDidChangeVisibleRepositoriesSignal.read(h);let g=this.scmViewService.isVisible(o),f=q.isThemeIcon(o.provider.iconPath)?o.provider.iconPath:M.repo,v=f.id===M.repo.id&&g&&this.scmViewService.repositories.length>1;t.icon.className=v?`icon ${q.asClassName(M.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=wIe(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(he(h=>{l=(o.provider.statusBarCommands.read(h)??[]).map(f=>h.store.add(new Uet(f,this.commandService))),p()})),t.elementDisposables.add(he(h=>{let g=o.provider.count.read(h)??cHt(o.provider);t.countContainer.setAttribute("data-count",String(g)),t.count.setCount(g)})),t.elementDisposables.add(he(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(bee(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()}};D0=I([m(2,ge),m(3,X),m(4,ze),m(5,_e),m(6,ot),m(7,qt),m(8,au),m(9,Te),m(10,dt)],D0);function byo(a,i){return a.id===i.id}var xVe=class{constructor(i,e){this._actions=[];this._secondaryActions=[];this.disposables=new P;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}=hl(this.menu.getActions({shouldForwardArgs:!0}));$i(i,this._actions,byo)&&$i(e,this._secondaryActions,byo)||(this._actions=i,this._secondaryActions=e,this._onDidChangeTitle.fire())}dispose(){this.disposables.dispose()}};xVe=I([m(0,qt),m(1,X)],xVe);var BPi=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&&(Ue(this.contextualResourceGroupMenus.values()),this.contextualResourceGroupMenus.clear(),this.contextualResourceGroupMenus=void 0),this.contextualResourceMenus&&(Ue(this.contextualResourceMenus.values()),this.contextualResourceMenus.clear(),this.contextualResourceMenus=void 0)}},Brt=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 P;this.contextKeyService=e.createOverlay([["scmProvider",i.providerId],["scmProviderRootUri",i.rootUri?.toString()],["scmProviderHasRootUri",!!i.rootUri]]);let n=new Io([X,this.contextKeyService]);t=t.createChild(n,this.disposables),this.titleMenu=t.createInstance(xVe),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 BPi(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&&(Ue(this.contextualRepositoryMenus.values()),this.contextualRepositoryMenus.clear(),this.contextualRepositoryMenus=void 0),this.resourceGroupMenusItems.forEach(i=>i.dispose()),this.disposables.dispose()}};Brt=I([m(1,X),m(2,F),m(3,qt)],Brt);var kVe=class{constructor(i,e){this.instantiationService=e;this.disposables=new P;this.menus=new Map;this.titleMenu=e.createInstance(xVe),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(Brt,i);e={menus:t,dispose:()=>{t.dispose(),this.menus.delete(i)}},this.menus.set(i,e)}return e.menus}dispose(){this.disposables.dispose()}};kVe=I([m(0,$c),m(1,F)],kVe);fe.appendMenuItem(D.SCMResourceContext,{title:d(12928,null),submenu:D.SCMResourceContextShare,group:"45_share",order:3});function HPi(a){return`${a.providerId}:${a.label}${a.rootUri?`:${a.rootUri.toString()}`:""}`}function Syo(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:Ye(i.provider.rootUri)}var Hrt={RepositorySortKey:new Q("scmRepositorySortKey","discoveryTime"),RepositorySelectionMode:new Q("scmRepositorySelectionMode","single")},EVe=class{constructor(i,e,t,o){this._placeHolder=i;this._autoQuickItemDescription=e;this._quickInputService=t;this._scmViewService=o;this._autoQuickPickItem={label:d(13124,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=uHt(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})}};EVe=I([m(2,Ge),m(3,au)],EVe);var pG=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 P;this._repositories=[];this.didFinishLoadingRepositories=Le(this,!1);this._onDidChangeRepositories=new E;this.onDidChangeRepositories=this._onDidChangeRepositories.event;this._onDidSetVisibleRepositories=new E;this.onDidChangeVisibleRepositories=H.any(this._onDidSetVisibleRepositories.event,H.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(kVe);let c=pr("scm.repositories.explorer",!1,this.configurationService);this.graphShowIncomingChangesConfig=pr("scm.graph.showIncomingChanges",!0,this.configurationService),this.graphShowOutgoingChangesConfig=pr("scm.graph.showOutgoingChanges",!0,this.configurationService),this.selectionModeConfig=pr("scm.repositories.selectionMode","multiple",this.configurationService),this.explorerEnabledConfig=Ce(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=ff({owner:this,equalsFn:()=>!1},this.onDidFocusRepository,()=>this.focusedRepository),this._activeEditorObs=ff({owner:this,equalsFn:()=>!1},this.editorService.onDidActiveEditorChange,()=>this.editorService.activeEditor),this._activeEditorRepositoryObs=vf(this,(u,p)=>{let h=this._activeEditorObs.read(u),g=no.getOriginalUri(h);if(!g)return p;let f=this.scmService.getRepository(g);return f?Object.create(f):p}),this._activeRepositoryPinnedObs=Le(this,void 0),this._activeRepositoryObs=_Ge(this,[this._activeEditorRepositoryObs,this._focusedRepositoryObs]),this.activeRepository=hs({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(_s(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=Hrt.RepositorySortKey.bindTo(e),this._sortKeyContextKey.set(this._repositoriesSortKey),this._selectionModelContextKey=Hrt.RepositorySelectionMode.bindTo(e),this.disposables.add(he(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=ht.empty();if(this.previousState&&!this.didFinishLoadingRepositories.get()){let o=this.previousState.all.indexOf(HPi(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:ht.empty()})),this.didSelectRepository=!1;return}if(this.previousState.visible.indexOf(o)===-1){if(this.didSelectRepository){this.insertRepositoryView(this._repositories,e),this._onDidChangeRepositories.fire({added:ht.empty(),removed:ht.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:ht.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=ht.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:ht.empty(),removed:ht.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 lJ(i.repository.provider.rootUri.fsPath,e.repository.provider.rootUri.fsPath);let t=Syo(this.workspaceContextService,i.repository),o=Syo(this.workspaceContextService,e.repository),n=jE(t,o);return n===0&&i.repository.provider.rootUri&&e.repository.provider.rootUri?lJ(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=cx(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=>HPi(t.provider)),e=this.visibleRepositories.map(t=>i.indexOf(HPi(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([Nd(5e3)],pG.prototype,"eventuallyFinishLoading",1),pG=I([m(0,$c),m(1,X),m(2,ee),m(3,lt),m(4,F),m(5,B),m(6,le),m(7,Pe)],pG);var w$t={SCMInputHasValidationMessage:new Q("scmInputHasValidationMessage",!1)};var Urt=class extends as{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 $e,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"?to.defaultChatAgent?.generateCommitMessageCommand??e.id:e.id;this.storageService.store("scm.input.lastActionId",t,0,0)}}}};Urt=I([m(1,le)],Urt);var zrt=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 st("scmInputMoreActions",d(13103,null),"codicon-chevron-down"),this._cancelAction=new Eo({id:"scm.input.cancelAction",title:d(13101,null),icon:M.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 P;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=Vm(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 Urt(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()}};zrt=I([m(2,qt),m(3,X),m(4,ze),m(5,ge),m(6,_e),m(7,le),m(8,Te)],zrt);var UPi=class{constructor(i,e){this.overflowWidgetsDomNode=i;this.configurationService=e;this._onDidChange=new E;this.onDidChange=this._onDidChange.event;this.defaultInputFontFamily=HN;this._disposables=new P;let t=H.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{...Kf(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")?zb.rulers.validate(i.value):[],t=this.configurationService.inspect("editor.wordWrap",{overrideIdentifier:"scminput"}),o=t.overrideIdentifiers?.includes("scminput")?zb.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()}},roe=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 P;this.repositoryDisposables=new P;this.validationHasFocus=!1;this.lastLayoutWasTrash=!1;this.shouldFocusAfterLayout=!1;this.element=R(i,_(".scm-editor")),this.editorContainer=R(this.element,_(".scm-editor-container")),this.toolbarContainer=R(this.element,_(".scm-editor-toolbar")),this.contextKeyService=this.disposables.add(t.createScoped(this.element)),this.repositoryIdContextKey=this.contextKeyService.createKey("scmRepository",void 0),this.validationMessageContextKey=w$t.SCMInputHasValidationMessage.bindTo(this.contextKeyService),this.inputEditorOptions=new UPi(e,this.configurationService),this.disposables.add(this.inputEditorOptions.onDidChange(this.onDidChangeEditorOptions,this)),this.disposables.add(this.inputEditorOptions);let g={contributions:aa.getSomeEditorContributions([Zu.ID,Xy.ID,Hm.ID,ou.ID,sCe.ID,lh.ID,_C.ID,P7.ID,kl.ID,Yg.ID,Rc.ID,Fx.ID,ry.ID,iu.ID,GW.ID,ly,Qr.ID,El.ID]),isSimpleWidget:!0},f=new Io([X,this.contextKeyService]),v=o.createChild(f,this.disposables),b=this.inputEditorOptions.getEditorConstructionOptions();this.inputEditor=v.createInstance(jr,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(()=>{ou.get(this.inputEditor)?.clearWidgets(),lh.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(),N=k.getLineLength(T)+1,O=k.coordinatesConverter.convertModelPositionToViewPosition(w);S.set(O.lineNumber===1&&O.column===1),y.set(O.lineNumber===T&&O.column===N)})),this.disposables.add(this.inputEditor.onDidScrollChange(w=>{this.toolbarContainer.classList.toggle("scroll-decoration",w.scrollTop>0)})),H.filter(this.configurationService.onDidChangeConfiguration,w=>w.affectsConfiguration("scm.showInputActionButton"))(()=>this.layout(),this,this.disposables),this.onDidChangeContentHeight=H.signal(H.filter(this.inputEditor.onDidContentSizeChange,w=>w.contentHeightChanged,this.disposables)),this.toolbar=v.createInstance(zrt,this.toolbarContainer,{actionViewItemProvider:(w,k)=>w instanceof Eo&&this.toolbar.dropdownActions.length>1?o.createInstance(dI,w,this.toolbar.dropdownAction,this.toolbar.dropdownActions,"",{actionRunner:this.toolbar.actionRunner,hoverDelegate:k.hoverDelegate}):Ca(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=H.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,[An.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=pr("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(13099,null,f,b):d(13100,null,f)},u=()=>{let f=this.keybindingService.lookupKeybinding("scm.acceptInput"),v=f?f.getLabel():it?"Cmd+Enter":"Ctrl+Enter";return id(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(_s(l,f=>{let v=u(),b=c(v,f);this.inputEditor.updateOptions({ariaLabel:b})})),p();let h="";this.repositoryDisposables.add(he(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),roe.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"?Kn(o,1,50):1)*i+e+t,s=this.configurationService.getValue("scm.inputMaxLineCount"),c=(typeof s=="number"?Kn(s,1,50):10)*i+e+t;return Kn(this.inputEditor.getContentHeight(),r,c)}layout(){let i=this.getContentHeight(),e=this.getToolbarWidth(),t=new ai(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 P;this.validationContextView=this.contextViewService.showContextView({getAnchor:()=>this.element,render:e=>{this.element.style.borderBottomLeftRadius="0",this.element.style.borderBottomRightRadius="0";let t=R(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=R(t,_(".scm-editor-validation")),n=this.validation.message;if(typeof n=="string")o.textContent=n;else{let c=Vn(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)=>{zM(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=R(t,_(".scm-editor-validation-actions")),s=new ji(r),l=new st("scmInputWidget.validationMessage.close",d(13098,null),q.asClassName(M.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}),C.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()}};roe=I([m(2,X),m(3,F),m(4,Ct),m(5,_e),m(6,B),m(7,au),m(8,_n),m(9,Qe),m(10,Bi),m(11,Qn)],roe);W(class extends K{constructor(){super({id:"scm.input.triggerSetup",title:d(13102,null),icon:M.sparkle,f1:!1,menu:{id:D.SCMInputBox,when:x.and(ie.Setup.hidden.negate(),ie.Setup.disabled.negate(),ie.Setup.installed.negate(),x.equals("scmProvider","git"))}})}async run(a,...i){let e=a.get(ge);if(!await e.executeCommand(n3))return;let o=to.defaultChatAgent?.generateCommitMessageCommand;o&&await e.executeCommand(o,...i)}});kLe(".scm-view .scm-editor-container");function Hrn(a,i){if(!i)return[void 0,void 0];if(!i.label)return[ua(i),void 0];let e=Ye(a),t=i.label,o=t.length-e.length,n=ua(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 eQ=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 eQ.TEMPLATE_ID}renderTemplate(i){i.parentElement.parentElement.classList.add("cursor-default","force-no-hover");let e=R(i,_(".button-container")),t=new cAi(e,this.contextMenuService,this.commandService,this.notificationService);return{actionButton:t,disposable:C.None,templateDisposable:t}}renderElement(i,e,t){t.disposable.dispose();let o=new P,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()}};eQ=I([m(0,ge),m(1,ze),m(2,Ne)],eQ);var zPi=class a{constructor(i){this.instantiationService=i}getDragURI(i){return gA(i)?i.sourceUri.toString():null}onDragStart(i,e){let t=a.getResourcesFromDragAndDropData(i);if(e.dataTransfer&&t?.length){this.instantiationService.invokeFunction(n=>Ig(n,t,e));let o=t.filter(n=>n.scheme===Y.file).map(n=>n.fsPath);o.length&&e.dataTransfer.setData(Ll.FILES,JSON.stringify(o))}}getDragLabel(i,e){if(i.length===1){let t=i[0];if(gA(t))return Ye(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])gA(t)&&e.push(t.sourceUri);return e}dispose(){}},gH=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 gH.TEMPLATE_ID}renderTemplate(i){i.parentElement.parentElement.classList.add("force-no-hover");let e=new P,t=R(i,_(".scm-input")),o=this.instantiationService.createInstance(roe,t,this.overflowWidgetsDomNode);return e.add(o),{inputWidget:o,inputWidgetHeight:gH.DEFAULT_HEIGHT,elementDisposables:new P,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=gH.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())};nn(()=>{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)??gH.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()}};gH=I([m(3,F)],gH);var soe=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 soe.TEMPLATE_ID}renderTemplate(i){let e=R(i,_(".resource-group")),t=R(e,_(".name")),o=R(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=R(e,_(".count")),s=new fv(r,{},BS),l=hn(n,s);return{name:t,count:s,actionBar:n,elementDisposables:new P,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(bee(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()}};soe=I([m(2,ge),m(3,X),m(4,ze),m(5,_e),m(6,qt),m(7,au),m(8,Te)],soe);var C$t=class extends as{constructor(e){super();this.getSelectedResources=e}async runAction(e,t){if(!(e instanceof Eo))return super.runAction(e,t);let o=vy(t),n=this.getSelectedResources().filter(c=>vy(c)===o),l=(n.some(c=>c===t)?n:[t]).map(c=>Xp.isResourceNode(c)?Xp.collect(c):[c]).flat();await e.run(...l)}},aoe=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 P;this.renderedResources=new Map;g.onDidColorThemeChange(this.onDidColorThemeChange,this,this.disposables)}static{this.TEMPLATE_ID="resource"}get templateId(){return aoe.TEMPLATE_ID}renderTemplate(i){let e=R(i,_(".resource")),t=R(e,_(".name")),o=this.labels.create(t,{supportDescriptionHighlights:!0,supportHighlights:!0}),n=R(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=R(e,_(".decoration-icon")),l=new me,c=hn(r,o,l);return{element:e,name:t,fileLabel:o,decorationIcon:s,actionBar:r,actionBarMenu:void 0,actionBarMenuListener:l,elementDisposables:new P,disposables:c}}renderElement(i,e,t){let o=i.element,n=Xp.isResourceNode(o)?o.element:o,r=Xp.isResourceNode(o)?o.uri:o.sourceUri,s=Xp.isResourceNode(o)?1:0,l=!Xp.isResourceNode(o)&&o.decorations.tooltip||"",c=this.viewMode()==="tree",u,p,h;if(Xp.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=ua(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]=Hrn(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=ua(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=bee(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=Ip(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=Na(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()}};aoe=I([m(4,ge),m(5,X),m(6,ze),m(7,_e),m(8,ot),m(9,qt),m(10,au),m(11,Te),m(12,De)],aoe);var KPi=class{constructor(i){this.inputRenderer=i}getHeight(i){return mA(i)?this.inputRenderer.getHeight(i):hA(i)?eQ.DEFAULT_HEIGHT+8:22}getTemplateId(i){if(fd(i))return D0.TEMPLATE_ID;if(mA(i))return gH.TEMPLATE_ID;if(hA(i))return eQ.TEMPLATE_ID;if(vy(i))return soe.TEMPLATE_ID;if(gA(i)||m3(i))return aoe.TEMPLATE_ID;throw new Error("Unknown element")}},GPi=class{isIncompressible(i){return Xp.isResourceNode(i)?i.childrenCount===0||!i.parent||!i.parent.parent:!0}},$Pi=class{filter(i){return vy(i)?i.resources.length>0||!i.hideWhenEmpty:!0}},qPi=class{constructor(i,e){this.viewMode=i;this.viewSortKey=e}compare(i,e){if(fd(i)){if(!fd(e))throw new Error("Invalid comparison");return 0}if(mA(i))return-1;if(mA(e))return 1;if(hA(i))return-1;if(hA(e))return 1;if(vy(i))return vy(e)?0:-1;if(this.viewMode()==="list"){if(this.viewSortKey()==="name"){let c=Ye(i.sourceUri),u=Ye(e.sourceUri);return jE(c,u)}if(this.viewSortKey()==="status"){let c=i.decorations.tooltip??"",u=e.decorations.tooltip??"";if(c!==u)return Al(c,u)}let s=i.sourceUri.fsPath,l=e.sourceUri.fsPath;return lJ(s,l)}let t=Xp.isResourceNode(i),o=Xp.isResourceNode(e);if(t!==o)return t?-1:1;let n=Xp.isResourceNode(i)?i.name:Ye(i.sourceUri),r=Xp.isResourceNode(e)?e.name:Ye(e.sourceUri);return jE(n,r)}},Krt=class{constructor(i,e){this.viewMode=i;this.labelService=e}getKeyboardNavigationLabel(i){if(Xp.isResourceNode(i))return i.name;if(fd(i)||mA(i)||hA(i))return;if(vy(i))return i.label;if(this.viewMode()==="list"){let e=Ye(i.sourceUri),t=this.labelService.getUriLabel(i.sourceUri,{relative:!0});return[e,t]}else return Ye(i.sourceUri)}getCompressedNodeKeyboardNavigationLabel(i){return i.map(t=>t.name).join("/")}};Krt=I([m(1,ot)],Krt);function Urn(a){if(fd(a))return`repo:${a.provider.id}`;if(mA(a))return`input:${a.repository.provider.id}`;if(hA(a))return`actionButton:${a.repository.provider.id}`;if(vy(a))return`resourceGroup:${a.provider.id}/${a.id}`;if(gA(a)){let i=a.resourceGroup;return`resource:${i.provider.id}/${i.id}/${a.sourceUri.toString()}`}else if(m3(a)){let i=a.context;return`folder:${i.provider.id}/${i.id}/$FOLDER/${a.uri.toString()}`}else throw new Error("Invalid tree element")}var jPi=class{getId(i){return Urn(i)}},Grt=class{constructor(i,e,t,o){this.accessibilityService=i;this.configurationService=e;this.keybindingService=t;this.labelService=o}getWidgetAriaLabel(){return d(13113,null)}getAriaLabel(i){if(Xp.isResourceNode(i))return this.labelService.getUriLabel(i.uri,{relative:!0,noPrefix:!0})||i.name;if(fd(i))return`${i.provider.name} ${i.provider.label}`;if(mA(i)){if(!(this.configurationService.getValue("accessibility.verbosity.sourceControl")===!0)||!this.accessibilityService.isScreenReaderOptimized())return d(13115,null);let t=this.keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getLabel();return t?d(13116,null,t):d(13117,null)}else{if(hA(i))return i.button?.command.title??"";if(vy(i))return i.label;{let e=[];e.push(Ye(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(", ")}}}};Grt=I([m(0,Bi),m(1,B),m(2,_e),m(3,ot)],Grt);var mG={ViewSort:new D("SCMViewSort"),Repositories:new D("SCMRepositories"),ChangesSettings:new D("SCMChangesSettings")},Sc={SCMViewMode:new Q("scmViewMode","list"),SCMViewSortKey:new Q("scmViewSortKey","path"),SCMViewAreAllRepositoriesCollapsed:new Q("scmViewAreAllRepositoriesCollapsed",!1),SCMViewIsAnyRepositoryCollapsible:new Q("scmViewIsAnyRepositoryCollapsible",!1),SCMProvider:new Q("scmProvider",void 0),SCMProviderRootUri:new Q("scmProviderRootUri",void 0),SCMProviderHasRootUri:new Q("scmProviderHasRootUri",void 0),SCMHistoryItemCount:new Q("scmHistoryItemCount",0),SCMHistoryViewMode:new Q("scmHistoryViewMode","list"),SCMCurrentHistoryItemRefHasRemote:new Q("scmCurrentHistoryItemRefHasRemote",!1),SCMCurrentHistoryItemRefHasBase:new Q("scmCurrentHistoryItemRefHasBase",!1),SCMCurrentHistoryItemRefInFilter:new Q("scmCurrentHistoryItemRefInFilter",!1),RepositoryCount:new Q("scmRepositoryCount",0),RepositoryVisibilityCount:new Q("scmRepositoryVisibleCount",0),RepositoryVisibility(a){return new Q(`scmRepositoryVisible:${a.provider.id}`,!1)}};fe.appendMenuItem(D.SCMTitle,{title:d(13120,null),submenu:mG.ViewSort,when:x.and(x.equals("view",Af),Sc.RepositoryCount.notEqualsTo(0)),group:"0_view&sort",order:1});fe.appendMenuItem(mG.ViewSort,{title:d(13107,null),submenu:mG.Repositories,when:x.greater(Sc.RepositoryCount.key,1),group:"0_repositories"});var QPi=class extends K{constructor(i){super({id:`workbench.scm.action.toggleRepositoryVisibility.${i.provider.id}`,title:i.provider.name,f1:!1,precondition:x.or(Sc.RepositoryVisibilityCount.notEqualsTo(1),Sc.RepositoryVisibility(i).isEqualTo(!1)),toggled:Sc.RepositoryVisibility(i).isEqualTo(!0),menu:{id:mG.Repositories,group:"0_repositories"}}),this.repository=i}run(i){i.get(au).toggleVisibility(this.repository)}},$rt=class{constructor(i,e,t){this.contextKeyService=i;this.scmViewService=e;this.items=new Map;this.disposables=new P;this.repositoryCountContextKey=Sc.RepositoryCount.bindTo(i),this.repositoryVisibilityCountContextKey=Sc.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 QPi{constructor(){super(i)}}),t=Sc.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(ht.reduce(this.items.keys(),(i,e)=>i+(this.scmViewService.isVisible(e)?1:0),0))}dispose(){this.disposables.dispose(),Ue(this.items.values()),this.items.clear()}};$rt=I([m(0,X),m(1,au),m(2,$c)],$rt);var x$t=class extends Fn{constructor(i="workbench.scm.action.setListViewMode",e={}){super({id:i,title:d(13118,null),viewId:Af,f1:!1,icon:M.listTree,toggled:Sc.SCMViewMode.isEqualTo("list"),menu:{id:mG.ViewSort,group:"1_viewmode",...e}})}async runInView(i,e){e.viewMode="list"}},YPi=class extends x$t{constructor(){super("workbench.scm.action.setListViewModeNavigation",{id:D.SCMTitle,when:x.and(x.equals("view",Af),Sc.RepositoryCount.notEqualsTo(0),Sc.SCMViewMode.isEqualTo("tree")),group:"navigation",isHiddenByDefault:!0,order:-1e3})}},k$t=class extends Fn{constructor(i="workbench.scm.action.setTreeViewMode",e={}){super({id:i,title:d(13119,null),viewId:Af,f1:!1,icon:M.listFlat,toggled:Sc.SCMViewMode.isEqualTo("tree"),menu:{id:mG.ViewSort,group:"1_viewmode",...e}})}async runInView(i,e){e.viewMode="tree"}},XPi=class extends k$t{constructor(){super("workbench.scm.action.setTreeViewModeNavigation",{id:D.SCMTitle,when:x.and(x.equals("view",Af),Sc.RepositoryCount.notEqualsTo(0),Sc.SCMViewMode.isEqualTo("list")),group:"navigation",isHiddenByDefault:!0,order:-1e3})}};W(x$t);W(k$t);W(YPi);W(XPi);var jrt=class extends K{constructor(e,t){super({id:`workbench.scm.action.repositories.setSortKey.${e}`,title:t,f1:!1,toggled:Hrt.RepositorySortKey.isEqualTo(e),menu:[{id:mG.Repositories,group:"1_sort"},{id:D.SCMSourceControlTitle,group:"1_sort"}]});this.sortKey=e}run(e){e.get(au).toggleSortKey(this.sortKey)}},JPi=class extends jrt{constructor(){super("discoveryTime",d(13110,null))}},ZPi=class extends jrt{constructor(){super("name",d(13111,null))}},eAi=class extends jrt{constructor(){super("path",d(13112,null))}};W(JPi);W(ZPi);W(eAi);var E$t=class extends K{constructor(e,t,o){super({id:`workbench.scm.action.repositories.setSelectionMode.${e}`,title:t,f1:!1,toggled:Hrt.RepositorySelectionMode.isEqualTo(e),menu:[{id:mG.Repositories,when:x.and(x.has("scm.providerCount"),x.greater("scm.providerCount",1)),group:"2_selectionMode",order:o},{id:D.SCMSourceControlTitle,when:x.and(x.has("scm.providerCount"),x.greater("scm.providerCount",1)),group:"2_selectionMode",order:o}]});this.selectionMode=e}run(e){e.get(au).toggleSelectionMode(this.selectionMode)}},tAi=class extends E$t{constructor(){super("single",d(13109,null),1)}},iAi=class extends E$t{constructor(){super("multiple",d(13108,null),2)}};W(tAi);W(iAi);var Qrt=class extends Fn{constructor(e,t){super({id:`workbench.scm.action.setSortKey.${e}`,title:t,viewId:Af,f1:!1,toggled:Sc.SCMViewSortKey.isEqualTo(e),precondition:Sc.SCMViewMode.isEqualTo("list"),menu:{id:mG.ViewSort,group:"2_sort"}});this.sortKey=e}async runInView(e,t){t.viewSortKey=this.sortKey}},oAi=class extends Qrt{constructor(){super("name",d(13121,null))}},nAi=class extends Qrt{constructor(){super("path",d(13122,null))}},rAi=class extends Qrt{constructor(){super("status",d(13123,null))}};W(oAi);W(nAi);W(rAi);var sAi=class extends Fn{constructor(){super({id:"workbench.scm.action.collapseAllRepositories",title:d(13105,null),viewId:Af,f1:!1,icon:M.collapseAll,menu:{id:D.SCMTitle,group:"navigation",when:x.and(x.equals("view",Af),Sc.SCMViewIsAnyRepositoryCollapsible.isEqualTo(!0),Sc.SCMViewAreAllRepositoriesCollapsed.isEqualTo(!1))}})}async runInView(i,e){e.collapseAllRepositories()}},aAi=class extends Fn{constructor(){super({id:"workbench.scm.action.expandAllRepositories",title:d(13106,null),viewId:Af,f1:!1,icon:M.expandAll,menu:{id:D.SCMTitle,group:"navigation",when:x.and(x.equals("view",Af),Sc.SCMViewIsAnyRepositoryCollapsible.isEqualTo(!0),Sc.SCMViewAreAllRepositoriesCollapsed.isEqualTo(!0))}})}async runInView(i,e){e.expandAllRepositories()}};W(sAi);W(aAi);var lAi=class extends Fn{constructor(){super({id:"workbench.scm.action.collapseAll",title:d(13114,null),viewId:Af,f1:!1,icon:M.collapseAll,menu:{id:D.SCMResourceGroupContext,group:"9_collapse",when:Sc.SCMViewMode.isEqualTo("tree")}})}async runInView(i,e,t){t&&e.collapseAllResources(t)}};W(lAi);var TVe=class extends zr{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 jt;this.visibilityDisposables=new P;this.treeOperationSequencer=new Nm;this.revealResourceThrottler=new um;this.updateChildrenThrottler=new um;this.disposables=new P;this._viewMode=this.getViewMode(),this._viewSortKey=this.getViewSortKey(),this.viewModeContextKey=Sc.SCMViewMode.bindTo(b),this.viewModeContextKey.set(this._viewMode),this.viewSortKeyContextKey=Sc.SCMViewSortKey.bindTo(b),this.viewSortKeyContextKey.set(this.viewSortKey),this.areAllRepositoriesCollapsedContextKey=Sc.SCMViewAreAllRepositoriesCollapsed.bindTo(b),this.isAnyRepositoryCollapsibleContextKey=Sc.SCMViewIsAnyRepositoryCollapsible.bindTo(b),this.scmProviderContextKey=Sc.SCMProvider.bindTo(b),this.scmProviderRootUriContextKey=Sc.SCMProviderRootUri.bindTo(b),this.scmProviderHasRootUriContextKey=Sc.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),H.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=R(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"));H.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")};H.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),H.filter(this.configurationService.onDidChangeConfiguration,s=>s.affectsConfiguration("scm.alwaysShowRepositories"),this.visibilityDisposables)(()=>{this.updateActions(),this.updateChildren()},this,this.visibilityDisposables),H.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:ht.empty()}),typeof this.treeScrollTop=="number"&&(this.tree.scrollTop=this.treeScrollTop,this.treeScrollTop=void 0),this.updateRepositoryCollapseAllContextKeys()}):(this.visibilityDisposables.clear(),this.onDidChangeVisibleRepositories({added:ht.empty(),removed:[...this.items.keys()]}),this.treeScrollTop=this.tree.scrollTop,this.updateRepositoryCollapseAllContextKeys())},this,this.disposables),this.disposables.add(this.instantiationService.createInstance($rt)),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(gH,this.layoutCache,o,(l,c)=>{try{this.tree.updateElementHeight(l,c)}catch{}}),this.actionButtonRenderer=this.instantiationService.createInstance(eQ),this.listLabels=this.instantiationService.createInstance(Za,{onDidChangeVisibility:this.onDidChangeBodyVisibility}),this.disposables.add(this.listLabels);let n=new C$t(()=>this.getSelectedResources());n.onWillRun(()=>this.tree.domFocus(),this,this.disposables),this.disposables.add(n);let r=this.instantiationService.createInstance(qrt,()=>this.viewMode);this.disposables.add(r);let s=pr("scm.compactFolders",!0,this.configurationService);this.tree=this.instantiationService.createInstance(qI,"SCM Tree Repo",e,new KPi(this.inputRenderer),new GPi,[this.inputRenderer,this.actionButtonRenderer,this.instantiationService.createInstance(D0,D.SCMTitle,See(this.instantiationService)),this.instantiationService.createInstance(soe,See(this.instantiationService),n),this.instantiationService.createInstance(aoe,()=>this.viewMode,this.listLabels,See(this.instantiationService),n)],r,{horizontalScrolling:!1,setRowLineHeight:!1,transformOptimization:!1,filter:new $Pi,dnd:new zPi(this.instantiationService),identityProvider:new jPi,sorter:new qPi(()=>this.viewMode,()=>this.viewSortKey),keyboardNavigationLabelProvider:this.instantiationService.createInstance(Krt,()=>this.viewMode),overrideStyles:this.getLocationBasedColors().listOverrideStyles,compressionEnabled:s.get(),collapseByDefault:l=>!(fd(l)||vy(l)||m3(l)),accessibilityProvider:this.instantiationService.createInstance(Grt),twistieAdditionalCssClass:l=>{if(hA(l)||mA(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),H.filter(this.tree.onDidChangeCollapseState,l=>fd(l.node.element?.element),this.disposables)(this.updateRepositoryCollapseAllContextKeys,this,this.disposables),this.disposables.add(he(l=>{this.tree.updateOptions({compressionEnabled:s.read(l)})})),R(e,o)}async open(e){if(e.element){if(fd(e.element)){this.scmViewService.focus(e.element);return}else if(mA(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(hA(e.element)){this.scmViewService.focus(e.element.repository),this.actionButtonRenderer.focusActionButton(e.element),this.tree.setFocus([],e.browserEvent);return}else if(vy(e.element)){let t=e.element.provider,o=ht.find(this.scmService.repositories,n=>n.provider===t);o&&this.scmViewService.focus(o);return}else if(gA(e.element)){if(e.element.command?.id===Zh||e.element.command?.id===NC)if(Jpt(e.browserEvent)&&e.browserEvent.button===1){let n=e.element.resourceGroup,r=`${n.provider.label}: ${n.label}`;await NMe.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=ht.find(this.scmService.repositories,n=>n.provider===t);o&&this.scmViewService.focus(o)}else if(m3(e.element)){let t=e.element.context.provider,o=ht.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=no.getOriginalUri(this.editorService.activeEditor,{supportSideBySide:1});e&&(this.tree.getFocus().some(t=>gA(t)&&this.uriIdentityService.extUri.isEqual(t.sourceUri,e))&&this.tree.getSelection().some(t=>gA(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 P;n.add(he(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 jt),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 P;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(mG.ViewSort,this.contextKeyService),c=Uc(l);return this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>c,onHide:()=>{}})}let t=e.element,o=t,n=[],r=new P,s=new C$t(()=>this.getSelectedResources());if(r.add(s),fd(t)){let c=this.scmViewService.menus.getRepositoryMenus(t.provider).getRepositoryContextMenu(t);o=t.provider,s=new CVe(()=>this.getSelectedRepositories()),r.add(s),n=f3(c)}else if(!(mA(t)||hA(t))){if(vy(t)){let c=this.scmViewService.menus.getRepositoryMenus(t.provider).getResourceGroupMenu(t);n=f3(c)}else if(gA(t)){let c=this.scmViewService.menus.getRepositoryMenus(t.resourceGroup.provider).getResourceMenu(t);n=f3(c)}else if(m3(t))if(t.element){let c=this.scmViewService.menus.getRepositoryMenus(t.element.resourceGroup.provider).getResourceMenu(t.element);n=f3(c)}else{let c=this.scmViewService.menus.getRepositoryMenus(t.context.provider).getResourceFolderMenu(t.context);n=f3(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&&fd(o)),t=this.tree.getSelection().filter(o=>!!o&&fd(o));return Array.from(new Set([...e,...t]))}getSelectedResources(){return this.tree.getSelection().filter(e=>vy(e)||gA(e)||m3(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=ht.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)zet(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=Y0(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=sa(this.tree.getHTMLElement()),o=this.scmViewService.focusedRepository.provider.groups,n=this.tree.getFocus().find(l=>vy(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=Y0(r+e,o.length);for(;l!==r;){if(this.tree.hasNode(o[l])){s=o[l];break}l=Y0(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()}};TVe=I([m(1,ge),m(2,ee),m(3,qt),m(4,$c),m(5,au),m(6,le),m(7,dt),m(8,_e),m(9,De),m(10,ze),m(11,F),m(12,Ri),m(13,B),m(14,X),m(15,Qe),m(16,tt)],TVe);var qrt=class extends C{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(zet(e)&&(t>1||n))return this.scmViewService.visibleRepositories;if(zet(e)&&t===1&&!n||fd(e)){let r=[];e=fd(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(vy(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(m3(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(m3(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(gA(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(mA(e))return e.repository;if(hA(e))return e.repository;if(vy(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(fd(e))return this.scmViewService;throw new Error("Unexpected call to getParent")}}}hasChildren(e){if(zet(e))return this.scmViewService.visibleRepositories.length!==0;if(fd(e))return!0;if(mA(e))return!1;if(hA(e))return!1;if(vy(e))return!0;if(gA(e))return!1;if(Xp.isResourceNode(e))return e.childrenCount>0;throw new Error("hasChildren not implemented.")}};qrt=I([m(1,B),m(2,au)],qrt);var cAi=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(pi({id:n.id,label:n.title,enabled:!0,run:async()=>{await this.executeCommand(n.id,...n.arguments||[])}}));o.length&&e.push(new li)}e.pop(),this.button=new $I(this.container,{actions:e,addPrimaryActionToDropdown:!1,contextMenuProvider:this.contextMenuService,title:i.command.tooltip,supportIcons:!0,...Ko})}else this.button=new Mi(this.container,{supportIcons:!0,supportShortLabel:!!i.command.shortTitle,title:i.command.tooltip,...Ko});this.button.enabled=i.enabled,this.button.label=i.command.title,this.button instanceof Mi&&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 P,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 dAi=class{getHeight(){return 22}getTemplateId(i){if(fd(i))return D0.TEMPLATE_ID;if(_B(i))return loe.TEMPLATE_ID;if(UR(i)||g3(i))return coe.TEMPLATE_ID;throw new Error("Invalid tree element")}},loe=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 loe.TEMPLATE_ID}renderTemplate(i){let e=R(i,_(".scm-artifact-group")),t=R(e,_(".icon")),o=new Lc(e,{supportIcons:!1}),n=R(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 P,templateDisposable:hn(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(bee(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()}};loe=I([m(1,ze),m(2,X),m(3,_e),m(4,qt),m(5,ge),m(6,au),m(7,Te)],loe);var coe=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 coe.TEMPLATE_ID}renderTemplate(i){let e=R(i,_(".scm-artifact")),t=R(e,_(".icon")),o=new Lc(e,{supportIcons:!1}),n=R(e,_(".timestamp-container")),r=R(n,_(".timestamp")),s=R(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 P,templateDisposable:hn(o,l)}}renderElement(i,e,t){let o=i.element;if(UR(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?Bs(r.timestamp):"",t.timestampContainer.classList.toggle("duplicate",o.hideTimestamp),t.timestampContainer.style.display=""}else g3(o)&&(t.icon.className=`icon ${q.asClassName(M.folder)}`,t.label.setLabel(Ye(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(UR(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?Bs(s.timestamp):"",t.timestampContainer.classList.toggle("duplicate",r.hideTimestamp),t.timestampContainer.style.display=""}else g3(r)&&(t.icon.className=`icon ${q.asClassName(M.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(UR(i)){let t=i.artifact,o=i.repository.provider,n=this._scmViewService.menus.getRepositoryMenus(o);e.elementDisposables.add(bee(n.getArtifactMenu(i.group,t),r=>{e.actionBar.setActions(r)},"inline",o)),e.actionBar.context=t}else Xp.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()}};coe=I([m(1,ze),m(2,X),m(3,_e),m(4,qt),m(5,ge),m(6,au),m(7,Te)],coe);var Yrt=class extends C{constructor(e){super();this.scmViewService=e}async getChildren(e){if(this.scmViewService.explorerEnabledConfig.get()===!1){let t=fd(e)?e.provider.id:void 0;return this.scmViewService.repositories.filter(n=>n.provider.parentId===t)}if(e instanceof pG){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(fd(e))return(await e.provider.artifactProvider.get()?.provideArtifactGroups()??[]).map(o=>({repository:e,artifactGroup:o,type:"artifactGroup"}));if(_B(e)){let t=e.repository,o=await t.provider.artifactProvider.get()?.provideArtifacts(e.artifactGroup.id)??[];if(e.artifactGroup.supportsFolders){let n=new Xp(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&&Bs(u.timestamp)===Bs(s.timestamp);n.add(l,{repository:t,group:e.artifactGroup,artifact:s,hideTimestamp:h,type:"artifact"})}return ht.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&&Bs(s[r-1].timestamp)===Bs(n.timestamp),type:"artifact"}))}else if(g3(e))return ht.map(e.children,t=>t.element&&t.childrenCount===0?t.element:t)}return[]}hasChildren(e){if(this.scmViewService.explorerEnabledConfig.get()===!1){let t=fd(e)?e.provider.id:void 0;return this.scmViewService.repositories.filter(n=>n.provider.parentId===t).length>0}return e instanceof pG?this.scmViewService.repositories.length>0:fd(e)||_B(e)?!0:UR(e)?!1:g3(e)?e.childrenCount>0:!1}};Yrt=I([m(0,au)],Yrt);var uAi=class{getId(i){if(fd(i))return`repo:${i.provider.id}`;if(_B(i))return`artifactGroup:${i.repository.provider.id}/${i.artifactGroup.id}`;if(UR(i))return`artifact:${i.repository.provider.id}/${i.group.id}/${i.artifact.id}`;if(g3(i))return`artifactFolder:${i.context.repository.provider.id}/${i.context.artifactGroup.id}/${i.uri.fsPath}`;throw new Error("Invalid tree element")}},pAi=class{isIncompressible(i){return Xp.isResourceNode(i)?i.childrenCount>1:!0}},_Ve=class extends zr{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 Nm;this.updateChildrenThrottler=new um;this.visibilityDisposables=new P;this.repositoryDisposables=new jt;this.visibleCountObs=pr("scm.repositories.visible",10,this.configurationService),this.providerCountBadgeObs=pr("scm.providerCountBadge","hidden",this.configurationService),this.storageService.onWillSaveState(()=>{this.storeTreeViewState()},this,this._store),this._register(this.updateChildrenThrottler)}renderBody(e){super.renderBody(e);let t=R(e,_(".scm-view.scm-repositories-view"));this._register(he(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(he(s=>{let l=this.visibleCountObs.read(s);this.updateBodySize(this.tree.contentHeight,l)})),this.visibilityDisposables.add(_s(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=Nr(this,this.scmViewService.onDidChangeVisibleRepositories);this.visibilityDisposables.add(he(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(he(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 uAi,this.treeDataSource=this.instantiationService.createInstance(Yrt),this._register(this.treeDataSource),this.tree=this.instantiationService.createInstance(qI,"SCM Repositories",e,new dAi,new pAi,[this.instantiationService.createInstance(D0,D.SCMSourceControlInline,See(this.instantiationService)),this.instantiationService.createInstance(loe,See(this.instantiationService)),this.instantiationService.createInstance(coe,See(this.instantiationService))],this.treeDataSource,{identityProvider:this.treeIdentityProvider,horizontalScrolling:!1,collapseByDefault:o=>this.scmViewService.explorerEnabledConfig.get()===!1?!(fd(o)&&o.provider.parentId===void 0):t?.expanded&&(fd(o)||_B(o)||UR(o))?t.expanded.indexOf(this.treeIdentityProvider.getId(o))===-1:g3(o)?!(o.childrenCount===1&&ht.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 fd(o)?o.provider.label:_B(o)?o.artifactGroup.name:UR(o)?o.artifact.name:""},getWidgetAriaLabel(){return d(13104,null)}}}),this._register(this.tree),this._register(he(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 P;t.add(he(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(he(async o=>{let n=e.provider.historyProvider.read(o);n&&o.store.add(_s(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||!UR(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(fd(e.element)){let t=e.element.provider,n=this.scmViewService.menus.getRepositoryMenus(t).getRepositoryContextMenu(e.element),r=f3(n),s=new P,l=new CVe(()=>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(UR(e.element)){let t=e.element.repository.provider,o=e.element.artifact,r=this.scmViewService.menus.getRepositoryMenus(t).getArtifactMenu(e.element.group,o),s=f3(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=>fd(o))?this.scmViewService.visibleRepositories=e.elements:e.elements.every(o=>_B(o)||UR(o))&&(this.scmViewService.visibleRepositories=e.elements.map(o=>o.repository)),this.tree.scrollTop=t}}onTreeDidChangeFocus(e){e.browserEvent&&e.elements.length>0&&fd(e.elements[0])&&this.scmViewService.focus(e.elements[0])}onDidTreeFocus(){let e=this.tree.getFocus();e.length>0&&(fd(e[0])?this.scmViewService.focus(e[0]):(_B(e[0])||UR(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(ht.filter(o,c=>!t.has(c))),r=new Set(ht.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(fd(e))return e;if(_B(e)||UR(e))return e.repository;if(g3(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()}};_Ve=I([m(1,$c),m(2,au),m(3,_e),m(4,ze),m(5,ge),m(6,F),m(7,Ri),m(8,X),m(9,B),m(10,Qe),m(11,De),m(12,tt),m(13,le)],_Ve);var hG={IsEnabled:new Q("isWorkspaceTrustEnabled",!1,d(16327,null)),IsTrusted:new Q("isWorkspaceTrusted",!1,d(16326,null))},gG="workbench.trust.manage";function zrn(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=La(a,i.rootUri),o=La(a,e.rootUri);return t&&o?Iyo(i,e):t?-1:o?1:0}}function Iyo(a,i){return a.kind==="primary"?-1:i.kind==="primary"?1:a.kind==="secondary"?-1:i.kind==="secondary"?1:0}var fG=class extends C{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(Iyo)}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(zrn(e)),r=await Promise.allSettled(n.map(async l=>{let u=(l.selector?jW(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(fG.STORAGE_KEY,0);if(e)try{this.hiddenQuickDiffProviders=new Set(JSON.parse(e))}catch{}}saveState(){this.hiddenQuickDiffProviders.size===0?this.storageService.remove(fG.STORAGE_KEY,0):this.storageService.store(fG.STORAGE_KEY,JSON.stringify(Array.from(this.hiddenQuickDiffProviders)),0,0)}};fG=I([m(0,le),m(1,dt)],fG);async function yyo(a,i,e,t){let n=(await a.getQuickDiffs(i,e,t)).find(r=>r.kind==="primary");return n?n.originalResource:null}var Jge=class extends C{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 jt;this._enabledConfig=pr("scm.workingSets.enabled",!1,this.configurationService),this._store.add(he(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 P,o=Ce(n=>e.provider.historyProvider.read(n)?.historyItemRef.read(n)?.id);t.add(he(async n=>{let r=o.read(n);if(!r)return;let s=v3(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()}};Jge=I([m(0,B),m(1,Et),m(2,$c),m(3,le),m(4,fi)],Jge);var wyo="workbench.scm.action.graph.pickRepository",Cyo="workbench.scm.action.graph.pickHistoryItemRefs",mAi=class extends Lr{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(M.repo);e.classList.add(...t);let o=_(".name");o.textContent=this._repository.provider.name,Fi(this.label,e,o)}}getTooltip(){return this._repository.provider.name}},hAi=class extends Lr{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(M.gitBranch));let t=_(".name");this._historyItemsFilter==="all"?t.textContent=d(13078,null):this._historyItemsFilter==="auto"?t.textContent=d(13080,null):this._historyItemsFilter.length===1?t.textContent=this._historyItemsFilter[0].name:t.textContent=d(13084,null,this._historyItemsFilter.length),Fi(this.label,e,t)}}getTooltip(){if(this._historyItemsFilter==="all")return d(13079,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 Fn{constructor(){super({id:wyo,title:d(13091,null),viewId:IP,f1:!1,menu:{id:D.SCMHistoryTitle,when:x.and(x.has("scm.providerCount"),x.greater("scm.providerCount",1),x.equals("config.scm.repositories.selectionMode","multiple")),group:"navigation",order:0}})}async runInView(a,i){i.pickRepository()}});W(class extends Fn{constructor(){super({id:Cyo,title:d(13089,null),icon:M.gitBranch,viewId:IP,precondition:Sc.SCMHistoryItemCount.notEqualsTo(0),f1:!1,menu:{id:D.SCMHistoryTitle,group:"navigation",order:1}})}async runInView(a,i){i.pickHistoryItemRef()}});W(class extends Fn{constructor(){super({id:"workbench.scm.action.graph.revealCurrentHistoryItem",title:d(13082,null),icon:M.target,viewId:IP,precondition:x.and(Sc.SCMHistoryItemCount.notEqualsTo(0),Sc.SCMCurrentHistoryItemRefInFilter.isEqualTo(!0)),f1:!1,menu:{id:D.SCMHistoryTitle,group:"navigation",order:2}})}async runInView(a,i){i.revealCurrentHistoryItem()}});W(class extends Fn{constructor(){super({id:"workbench.scm.action.graph.refresh",title:d(13090,null),viewId:IP,f1:!1,icon:M.refresh,menu:{id:D.SCMHistoryTitle,group:"navigation",order:1e3}})}async runInView(a,i){i.refresh()}});W(class extends Fn{constructor(){super({id:"workbench.scm.action.graph.setListViewMode",title:d(13096,null),viewId:IP,toggled:Sc.SCMHistoryViewMode.isEqualTo("list"),menu:{id:D.SCMHistoryTitle,group:"9_viewmode",order:1},f1:!1})}async runInView(a,i){i.setViewMode("list")}});W(class extends Fn{constructor(){super({id:"workbench.scm.action.graph.setTreeViewMode",title:d(13097,null),viewId:IP,toggled:Sc.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(13086,null),icon:M.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===JO||s.id===_X)){let h=await o.resolveHistoryItemRefsCommonAncestor([n.name,r.name]);h&&s.id===JO?(l=`${s.subject} - ${n.name} \u2194 ${r.name}`,c=r.id,u=h):h&&s.id===_X&&(l=`${s.subject} - ${r.name} \u2194 ${n.name}`,c=n.id,u=h)}else l=dHt(s),c=s.id,s.parentIds.length>0&&(s.parentIds[0]===JO&&r?u=await o.resolveHistoryItemRefsCommonAncestor([n.name,r.name]):u=s.parentIds[0]);if(!l||!c||!u)return;let p=$C.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(13087,null),icon:M.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===JO?o=d(13083,null):i.id===_X?o=d(13088,null):o=i.displayId??i.id;let n=No(e.modifiedUri.fsPath);await t.openEditor({resource:e.modifiedUri,label:`${n} (${o})`})}});var gAi=class{getHeight(){return 22}getTemplateId(i){if(fA(i))return doe.TEMPLATE_ID;if(h3(i)||rPe(i))return uoe.TEMPLATE_ID;if(nPe(i))return poe.TEMPLATE_ID;throw new Error("Unknown element")}},doe=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=pr("scm.graph.badges","filter",this._configurationService)}static{this.TEMPLATE_ID="history-item"}get templateId(){return doe.TEMPLATE_ID}renderTemplate(i){let e=R(i,_(".history-item")),t=R(e,_(".graph-container")),o=new Lc(e,{supportIcons:!0,supportHighlights:!0,supportDescriptionHighlights:!0}),n=R(e,_(".label-container")),r=R(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 P,disposables:hn(o,s)}}renderElement(i,e,t){let o=i.element.repository.provider,n=i.element.historyItemViewModel,r=n.historyItem,{content:s,disposables:l}=B6e(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(leo(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(hl(b,"inline").primary)}renderCompressedElements(i,e,t){throw new Error("Should never happen since node is incompressible")}_renderBadges(i,e){e.elementDisposables.add(he(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=wI(n,s=>s.color?s.color:"");for(let[s,l]of Object.entries(r)){if(s===""&&o!=="all"||!l)continue;let c=wI(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=bt("div.label",{style:{color:i[0].color?wt(fmi):wt(ko),backgroundColor:i[0].color?wt(i[0].color):wt(gmi)}},[bt("div.count@count",{style:{display:i.length>1?"":"none"}}),bt("div.icon@icon"),bt("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:"",R(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?ua(e.score):void 0,i.historyItem.author===e.label?ua(e.score):void 0]:[void 0,void 0]}disposeElement(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.elementDisposables.dispose(),i.disposables.dispose()}};doe=I([m(1,ge),m(2,B),m(3,X),m(4,ze),m(5,tt),m(6,_e),m(7,Qn),m(8,qt),m(9,Te)],doe);var uoe=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 uoe.TEMPLATE_ID}renderTemplate(i){let e=i.parentElement,t=R(i,_(".history-item-change")),o=R(t,_(".graph-placeholder")),n=R(t,_(".label-container")),r=this.resourceLabels.create(n,{supportDescriptionHighlights:!0,supportHighlights:!0}),s=new P,l=R(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=h3(i.element)?i.element.historyItemViewModel:i.element.context.historyItemViewModel,r=h3(i.element)?i.element.historyItemChange:i.element,s=h3(i.element)?i.element.graphColumns:i.element.context.historyItemViewModel.outputSwimlanes;this._renderGraphPlaceholder(t,n,s);let l=this.viewMode()==="tree",c=h3(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(hl(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=vh*(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(vmi(t,deo(e)))}disposeTemplate(i){i.disposables.dispose()}};uoe=I([m(2,ge),m(3,X),m(4,ze),m(5,_e),m(6,ot),m(7,qt),m(8,Te)],uoe);var poe=class{constructor(i,e,t){this._isLoadingMore=i;this._loadMoreCallback=e;this._configurationService=t}static{this.TEMPLATE_ID="historyItemLoadMore"}get templateId(){return poe.TEMPLATE_ID}renderTemplate(i){let e=R(i,_(".history-item-load-more")),t=R(e,_(".graph-placeholder")),o=R(e,_(".history-item-placeholder")),n=new Lc(o,{supportIcons:!0});return{element:e,graphPlaceholder:t,historyItemPlaceholderContainer:o,historyItemPlaceholderLabel:n,elementDisposables:new P,disposables:n}}renderElement(i,e,t){t.graphPlaceholder.textContent="",t.graphPlaceholder.style.width=`${vh*(i.element.graphColumns.length+1)}px`,t.graphPlaceholder.appendChild(vmi(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(he(n=>{let s=`$(${this._isLoadingMore.read(n)?"loading~spin":"fold-down"})`;t.historyItemPlaceholderLabel.setLabel(d(13085,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()}};poe=I([m(2,B)],poe);var Xrt=class extends as{constructor(e){super();this._progressService=e}runAction(e,t){return this._progressService.withProgress({location:IP},async()=>await super.runAction(e,t))}};Xrt=I([m(0,Bo)],Xrt);var fAi=class{getWidgetAriaLabel(){return d(13092,null)}getAriaLabel(i){if(fd(i))return`${i.provider.name} ${i.provider.label}`;if(fA(i)){let e=i.historyItemViewModel.historyItem;return`${fu(e.message).trim()}${e.author?`, ${e.author}`:""}`}else return""}},vAi=class{getId(i){if(fd(i))return`repo:${i.provider.id}`;if(fA(i)){let e=i.repository.provider,t=i.historyItemViewModel.historyItem;return`historyItem:${e.id}/${t.id}/${t.parentIds.join(",")}`}else if(h3(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(rPe(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(nPe(i))return`historyItemLoadMore:${i.repository.provider.id}`;throw new Error("Invalid tree element")}}},bAi=class{getKeyboardNavigationLabel(i){if(!fd(i)){if(fA(i))return[i.historyItemViewModel.historyItem.message,i.historyItemViewModel.historyItem.author];if(nPe(i))return"";throw new Error("Invalid tree element")}}getCompressedNodeKeyboardNavigationLabel(i){return i.map(t=>t.name).join("/")}},SAi=class{isIncompressible(i){return Xp.isResourceNode(i)?i.childrenCount===0||!i.parent||!i.parent.parent:!0}},IAi=class extends C{constructor(e){super();this.viewMode=e}async getChildren(e){let t=[];if(e instanceof Zge){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(fA(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]===JO){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 Xp(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(Xp.isResourceNode(e)&&rPe(e))for(let o of e.children)t.push(o.element&&o.childrenCount===0?o.element:o);return t}hasChildren(e){return e instanceof Zge||fA(e)||rPe(e)&&e.childrenCount>0}},yAi=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(Ll.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(!fA(t))continue;let o=t.repository.provider,n=t.historyItemViewModel.historyItem,r=`$(${M.repo.id})\xA0${o.name}\xA0$(${M.gitCommit.id})\xA0${n.displayId??n.id}`,s=n.parentIds.length>0?n.parentIds[0]:void 0;e.push({name:r,resource:$C.getMultiDiffSourceUri(o,n.id,s,n.displayId),historyItem:n})}return e}_getTreeElementLabel(i){if(fA(i)){let e=i.historyItemViewModel.historyItem;return e.displayId??e.id}}_getTreeElementUri(i){if(fA(i)){let e=i.repository.provider,t=i.historyItemViewModel.historyItem,o=t.parentIds.length>0?t.parentIds[0]:void 0;return $C.getMultiDiffSourceUri(e,t.id,o,t.displayId)}}dispose(){}},Zge=class extends C{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=Le(this,"auto");this.onDidChangeHistoryItemsFilter=Wc(this);this.isViewModelEmpty=Le(this,!1);this._repositoryState=new Map;this._repositoryFilterState=new Map;this._repositoryFilterState=this._loadHistoryItemsFilterState(),this.viewMode=Le(this,this._getViewMode()),this._extensionService.onWillStop(this._saveHistoryItemsFilterState,this,this._store),this._storageService.onWillSaveState(this._saveHistoryItemsFilterState,this,this._store),this._scmHistoryItemCountCtx=Sc.SCMHistoryItemCount.bindTo(this._contextKeyService),this._scmHistoryViewModeCtx=Sc.SCMHistoryViewMode.bindTo(this._contextKeyService),this._scmHistoryViewModeCtx.set(this.viewMode.get());let l=this._scmService.repositoryCount>0?Oo(ht.first(this._scmService.repositories)):ui(this,H.once(this._scmService.onDidAddRepository),p=>p),c=Ce(p=>{let h=this._selectedRepository.read(p);return h!=="auto"?h:this._scmViewService.activeRepository.read(p)?.repository});this.repository=_Ge(this,[l,c]);let u=ui(this,this._scmService.onDidRemoveRepository,p=>p);this._register(he(p=>{let h=u.read(p);h&&(this.repository.read(void 0)===h&&this._selectedRepository.set(ht.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(v3(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=Kn(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=ceo(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(v3(t.provider),e):this._repositoryFilterState.delete(v3(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(v3(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(v3(e.provider))):(o.push(...r),this._repositoryFilterState.set(v3(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()}};Zge=I([m(0,B),m(1,X),m(2,lt),m(3,$c),m(4,au),m(5,le)],Zge);var Jrt=class{constructor(i,e){this._quickInputService=i;this._scmViewService=e;this._autoQuickPickItem={label:d(13080,null),description:d(13077,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(M.repo),repository:e}))),this._quickInputService.pick(i,{placeHolder:d(13094,null)})}};Jrt=I([m(0,Ge),m(1,au)],Jrt);var Zrt=class extends C{constructor(e,t,o){super();this._historyProvider=e;this._historyItemsFilter=t;this._quickInputService=o;this._allQuickPickItem={id:"all",label:d(13078,null),description:d(13079,null),historyItemRef:"all"};this._autoQuickPickItem={id:"auto",label:d(13080,null),description:d(13081,null),historyItemRef:"auto"}}async pickHistoryItemRef(){let e=this._quickInputService.createQuickPick({useSeparators:!0});this._store.add(e),e.placeholder=d(13093,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}=cre(o,r,(l,c)=>Al(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=Pg(t,(n,r)=>Al(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}};Zrt=I([m(2,Ge)],Zrt);var DVe=class extends zr{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=Le(this,!1);this._repositoryOutdated=Le(this,!1);this._visibilityDisposables=new P;this._treeOperationSequencer=new Nm;this._treeLoadMoreSequencer=new Nm;this._refreshThrottler=new um;this._updateChildrenThrottler=new um;this._contextMenuDisposables=new me;this._scmProviderCtx=Sc.SCMProvider.bindTo(this.scopedContextKeyService),this._scmCurrentHistoryItemRefHasRemote=Sc.SCMCurrentHistoryItemRefHasRemote.bindTo(this.scopedContextKeyService),this._scmCurrentHistoryItemRefHasBase=Sc.SCMCurrentHistoryItemRefHasBase.bindTo(this.scopedContextKeyService),this._scmCurrentHistoryItemRefInFilter=Sc.SCMCurrentHistoryItemRefInFilter.bindTo(this.scopedContextKeyService),this._actionRunner=this.instantiationService.createInstance(Xrt),this._register(this._actionRunner),this._register(this._refreshThrottler),this._register(this._updateChildrenThrottler)}renderHeaderTitle(e){super.renderHeaderTitle(e,this.title);let t=bt("div.scm-graph-view-badge-container",[bt("div.scm-graph-view-badge.monaco-count-badge.long@badge")]);t.badge.textContent="Outdated",e.appendChild(t.root),this._register(he(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 xe(d(13095,null),{supportThemeIcons:!0}),position:{hoverPosition:2}}))}))}renderBody(e){super.renderBody(e),this._treeContainer=R(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(Zge),this._visibilityDisposables.add(this._treeViewModel);let o=Ce(this,s=>this._treeViewModel.repository.read(s)?.provider.historyProvider.read(s)?.historyItemRef.read(s)!==void 0?!0:void 0);await gf(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(he(s=>{this._treeViewModel.isViewModelEmpty.read(s),this._onDidChangeViewWelcomeState.fire()})),this._visibilityDisposables.add(_s(this._scmViewService.graphShowIncomingChangesConfig,async()=>{await this.refresh()})),this._visibilityDisposables.add(_s(this._scmViewService.graphShowOutgoingChangesConfig,async()=>{await this.refresh()}));let n=!0;this._visibilityDisposables.add(he(s=>{let l=this._treeViewModel.repository.read(s),c=l?.provider.historyProvider.read(s);if(!l||!c)return;let u=Ce(p=>c.historyItemRef.read(p)?.id);s.store.add(_s(u,async p=>{await this.refresh(),this._scmCurrentHistoryItemRefInFilter.set(this._isCurrentHistoryItemInFilter(p))})),s.store.add(_s(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(_s(this._treeViewModel.onDidChangeHistoryItemsFilter,async()=>{await this.refresh(),this._scmCurrentHistoryItemRefInFilter.set(this._isCurrentHistoryItemInFilter(u.read(void 0)))})),s.store.add(he(p=>{this._scmCurrentHistoryItemRefHasRemote.set(!!c.historyItemRemoteRef.read(p))})),s.store.add(he(p=>{this._scmCurrentHistoryItemRefHasBase.set(!!c.historyItemBaseRef.read(p))})),s.store.add(_s(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(he(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===wyo){let o=this._treeViewModel?.repository.get();if(o)return new mAi(o,e,t)}else if(e.id===Cyo){let o=this._treeViewModel?.repository.get(),n=this._treeViewModel?.getHistoryItemsFilter();if(o&&n)return new hAi(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(Jrt).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(Zrt,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 vAi;let t=this.instantiationService.createInstance(Za,{onDidChangeVisibility:this.onDidChangeBodyVisibility});this._register(t),this._treeDataSource=this.instantiationService.createInstance(IAi,()=>this._treeViewModel.viewMode.get()),this._register(this._treeDataSource);let o=pr("scm.compactFolders",!0,this.configurationService);this._tree=this.instantiationService.createInstance(qI,"SCM History Tree",e,new gAi,new SAi,[this.instantiationService.createInstance(doe,this.viewDescriptorService.getViewLocationById(this.id)),this.instantiationService.createInstance(uoe,()=>this._treeViewModel.viewMode.get(),t),this.instantiationService.createInstance(poe,this._repositoryIsLoadingMore,()=>this._loadMore())],this._treeDataSource,{accessibilityProvider:new fAi,identityProvider:this._treeIdentityProvider,collapseByDefault:n=>!rPe(n),compressionEnabled:o.get(),dnd:new yAi,keyboardNavigationLabelProvider:new bAi,horizontalScrolling:!1,multipleSelectionSupport:!1,twistieAdditionalCssClass:n=>fA(n)||nPe(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(h3(e.element)){let t=e.element.historyItemChange,o=e.element.historyItemViewModel.historyItem,n=o.id===JO?d(13083,null):o.id===_X?d(13088,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=`${No(t.originalUri.fsPath)} (${s})`,c=`${No(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:`${No(t.modifiedUri.fsPath)} (${n})`,resource:t.modifiedUri,options:e.editorOptions}):t.originalUri&&await this._editorService.openEditor({label:`${No(t.originalUri.fsPath)} (${s})`,resource:t.originalUri,options:e.editorOptions})}else nPe(e.element)&&(this.configurationService.getValue("scm.graph.pageOnScroll")===!0||(this._loadMore(),this._tree.setSelection([])));else return}_onContextMenu(e){let t=e.element;if(fA(t)){if(t.historyItemViewModel.kind==="incoming-changes"||t.historyItemViewModel.kind==="outgoing-changes")return;this._contextMenuDisposables.value=new P;let n=t.repository.provider.historyProvider.get()?.historyItemRef.get(),r=t.historyItemViewModel.historyItem,s=fe.getMenuItems(D.SCMHistoryItemRefContext).filter(u=>Kk(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(fe.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:()=>Uc(c),getActionsContext:()=>t.historyItemViewModel.historyItem})}else if(h3(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:()=>Uc(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()}};DVe=I([m(1,ee),m(2,F),m(3,qt),m(4,Bo),m(5,au),m(6,B),m(7,ze),m(8,_e),m(9,F),m(10,Ri),m(11,X),m(12,Qe),m(13,De),m(14,tt)],DVe);var EAi=new Q("dirtyDiffVisible",!1),est=class extends h1{constructor(e,t,o,n){let r={...pE},s=o.getColorTheme(),l=s.getColor(qo),u=s.getColor(DW)?.makeOpaque(l)??l;r.selectBackground=u.lighten(.6).toString();super(null,e,[],0,t,r,{ariaLabel:d(12942,null),useCustomDrawn:!HS(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)}};est=I([m(1,_n),m(2,De),m(3,B)],est);var wAi=class a extends st{constructor(e){super(a.ID,a.LABEL,void 0,void 0);this.callback=e}static{this.ID="quickDiff.base.switch"}static{this.LABEL=d(12941,null)}async run(e){return this.callback(e)}},CAi=class extends as{runAction(i,e){return i instanceof Eo?i.run(...e):super.runAction(i,e)}},efe=class extends st{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)))}};efe=I([m(3,_e),m(4,F)],efe);var tst=class extends bE{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()),ht.isEmpty(this.model.originalTextModels)||(s=s.createOverlay([["originalResourceScheme",ht.first(this.model.originalTextModels)?.uri.scheme],["originalResourceSchemes",ht.map(this.model.originalTextModels,c=>c.uri.scheme)]])),this.create(),e.hasModel()?this.title=Ye(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,ht.isEmpty(this.model.originalTextModels))return;H.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 Ie(xQe(n),1),c=this.editor.getOption(75),u=this.editor.getLayoutInfo().height,p=Math.floor(u/c),h=Math.min(bXi(n)+2+6,Math.floor(p/3));this.renderTitle(),this.updateDropdown();let g=CQe(n),f=vXi(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(12940,null,t+1,e.length):d(12939,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(12933,null,n,t+1,e.length):d(12932,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(efe,this.editor,new T$t(this.editor),q.asClassName(J5i)),t=this.instantiationService.createInstance(efe,this.editor,new _$t(this.editor),q.asClassName(Z5i));this._disposables.add(e),this._disposables.add(t),this.menu&&this.menu.dispose(),this.menu=this.menuService.createMenu(D.SCMChangeContext,this.contextKeyService);let o=Vm(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 st("peekview.close",d(12934,null),q.asClassName(M.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 wAi(o=>this.switchQuickDiff(o));this._disposables.add(t),this.dropdownContainer=Sf(this._titleElement,_(".dropdown")),this.dropdown=this.instantiationService.createInstance(est,t),this.dropdown.render(this.dropdownContainer)}_getActionBarOptions(){let e=new CAi;return this._disposables.add(e),this._disposables.add(e.onDidRun(t=>{!(t.action instanceof efe)&&!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(MD,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(p_)||Oe.transparent;this.style({arrowColor:t,frameColor:t,headerBackgroundColor:e.getColor(DW)||Oe.transparent,primaryHeadingColor:e.getColor(lO),secondaryHeadingColor:e.getColor(cO)})}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()}};tst=I([m(2,De),m(3,F),m(4,qt),m(5,X),m(6,OE)],tst);var zA=class extends C{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=C.None;this.mouseDownInfo=null;this.enabled=!1;this.gutterActionDisposables=new P;if(this.enabled=!t.getContextKeyValue("isInDiffEditor"),this.stylesheet=hr(void 0,void 0,this._store),this.enabled){this.isQuickDiffVisible=EAi.bindTo(t),this._register(e.onDidChangeModel(()=>this.close()));let s=H.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(zA.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[Y0(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[Y0(n-1,o.length)]}this.widget.showChange(t)}close(){this.session.dispose(),this.session=C.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(tst,this.editor,this.model),this.isQuickDiffVisible.set(!0);let o=new P;return o.add(H.once(this.widget.onDidClose)(this.close,this)),H.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=>SXi(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()}};zA=I([m(1,X),m(2,B),m(3,HO),m(4,F)],zA);var T$t=class extends xi{constructor(e){super({id:"editor.action.dirtydiff.previous",label:L(12944,"Show Previous Change"),precondition:tS.toNegated(),kbOpts:{kbExpr:ue.editorTextFocus,primary:1597,weight:100}});this.outerEditor=e}run(e){let t=this.outerEditor??LVe(e);if(!t)return;let o=zA.get(t);o&&o.canNavigate()&&o.previous()}};Jt(T$t);var _$t=class extends xi{constructor(e){super({id:"editor.action.dirtydiff.next",label:L(12943,"Show Next Change"),precondition:tS.toNegated(),kbOpts:{kbExpr:ue.editorTextFocus,primary:573,weight:100}});this.outerEditor=e}run(e){let t=this.outerEditor??LVe(e);if(!t)return;let o=zA.get(t);o&&o.canNavigate()&&o.next()}};Jt(_$t);var xAi=class extends xi{constructor(){super({id:"workbench.action.editor.previousChange",label:L(12938,"Go to Previous Change"),precondition:x.and(tS.toNegated(),I$t.notEqualsTo(0)),kbOpts:{kbExpr:ue.editorTextFocus,primary:1599,weight:100}})}async run(i){let e=LVe(i),t=i.get(tr),o=i.get(Bi),n=i.get(Kt),r=i.get(HO);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 kyo(u.change,t),xyo(u.change,e,o,n)}finally{s?.dispose()}}};Jt(xAi);var kAi=class extends xi{constructor(){super({id:"workbench.action.editor.nextChange",label:L(12937,"Go to Next Change"),precondition:x.and(tS.toNegated(),I$t.notEqualsTo(0)),kbOpts:{kbExpr:ue.editorTextFocus,primary:575,weight:100}})}async run(i){let e=i.get(tr),t=LVe(i),o=i.get(Bi),n=i.get(Kt),r=i.get(HO);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 kyo(u,e),xyo(u,t,o,n)}finally{s?.dispose()}}};Jt(kAi);fe.appendMenuItem(D.MenubarGoMenu,{group:"7_change_nav",command:{id:"editor.action.dirtydiff.next",title:d(12935,null)},order:1});fe.appendMenuItem(D.MenubarGoMenu,{group:"7_change_nav",command:{id:"editor.action.dirtydiff.previous",title:d(12936,null)},order:2});yt.registerCommandAndKeybindingRule({id:"closeQuickDiff",weight:150,primary:9,secondary:[1033],when:x.and(EAi),handler:a=>{let i=LVe(a);if(!i)return;let e=zA.get(i);e&&e.close()}});yt.registerCommandAndKeybindingRule({id:"toggleQuickDiffWidgetFocus",weight:100,primary:Ai(2089,60),when:EAi,handler:a=>{let i=LVe(a);if(!i)return;let e=zA.get(i);e&&e.toggleFocus()}});function xyo(a,i,e,t){let o=new Ie(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 kyo(a,i){switch(CQe(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 LVe(a){let i=a.get(Kt).listDiffEditors();for(let e of i)if(e.hasTextFocus()&&e instanceof MD)return e.getParentEditor();return Bwe(a)}var D$t=class{constructor(){this.name="scm";this.type="help";this.priority=100;this.when=x.or(x.and(x.equals("activeViewlet","workbench.view.scm"),sV),x.equals(Vl.key,k_t),x.equals(Vl.key,Af),x.equals(Vl.key,IP))}getProvider(i){let e=i.get(ge),t=i.get(au),o=i.get(Ft);return new ist(e,t,o)}},ist=class extends C{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(13051,null,o))}let t=this._scmViewService.focusedRepository;if(t){e.push(d(13052,null,t.provider.name));let o=t.provider.historyProvider.get()?.historyItemRef.get();o&&e.push(d(13053,null,o.name)),t.input.visible&&t.input.enabled&&t.input.value!==""&&e.push(d(13054,null,t.input.value));let n=t.provider.actionButton.get();if(n){let s=n.command.tooltip??n.command.title,l=n.enabled?d(13034,null):d(13033,null);e.push(d(13055,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(13056,null,r.join(", ")))}return e.push(d(13045,null)),e.push(d(13046,null)),e.push(d(13047,null)),e.push(d(13048,null)),e.push(d(13049,null)),e.push(d(13050,null)),e.push(d(13040,null)),e.push(d(13041,null)),e.push(d(13042,null)),e.push(d(13043,null)),e.push(d(13044,null)),e.push(d(13035,null)),e.push(d(13036,null)),e.push(d(13037,null)),e.push(d(13038,null)),e.push(d(13039,null)),e.join(`
`)}};ist=I([m(0,ge),m(1,au),m(2,Ft)],ist);LM.registerLanguage({id:"scminput",extensions:[],aliases:[],mimetypes:["text/x-scm-input"]});oe.as(Qi.Workbench).registerWorkbenchContribution(bVe,3);go(zA.ID,zA,1);var M$t=Re("source-control-view-icon",M.sourceControl,d(13032,null)),L$t=oe.as(on.ViewContainersRegistry).registerViewContainer({id:Uce,title:L(13028,"Source Control"),ctorDescriptor:new Mt(wVe),storageId:"workbench.scm.views.state",icon:M$t,alwaysUseContainerInfo:!0,order:2,hideIfEmpty:!0},0,{doNotRegisterOpenCommand:!0}),tfe=oe.as(on.ViewsRegistry),R$t=d(13031,null);tfe.registerViewWelcomeContent(Af,{content:d(12961,null),when:"default"});tfe.registerViewWelcomeContent(Af,{content:d(12962,null),when:x.and(x.equals("scm.providerCount",0),hG.IsEnabled,hG.IsTrusted.toNegated())});tfe.registerViewWelcomeContent(Af,{content:`[${d(12958,null)}](command:${gG})`,when:x.and(x.equals("scm.providerCount",0),hG.IsEnabled,hG.IsTrusted.toNegated())});tfe.registerViewWelcomeContent(IP,{content:d(12960,null),when:Sc.SCMHistoryItemCount.isEqualTo(0)});tfe.registerViews([{id:k_t,containerTitle:R$t,name:L(13025,"Repositories"),singleViewPaneContainerTitle:d(13030,null),ctorDescriptor:new Mt(_Ve),canToggleVisibility:!0,hideByDefault:!0,canMoveView:!0,weight:20,order:0,when:x.and(x.has("scm.providerCount"),x.notEquals("scm.providerCount",0)),containerIcon:M$t}],L$t);tfe.registerViews([{id:Af,containerTitle:R$t,name:L(13021,"Changes"),singleViewPaneContainerTitle:R$t,ctorDescriptor:new Mt(TVe),canToggleVisibility:!0,canMoveView:!0,weight:40,order:1,containerIcon:M$t,openCommandActionDescriptor:{id:L$t.id,mnemonicTitle:d(12959,null),keybindings:{primary:0,win:{primary:3109},linux:{primary:3109},mac:{primary:1317}},order:2}}],L$t);tfe.registerViews([{id:IP,containerTitle:R$t,name:L(13024,"Graph"),singleViewPaneContainerTitle:d(13029,null),ctorDescriptor:new Mt(DVe),canToggleVisibility:!0,canMoveView:!0,weight:40,order:2,when:x.and(x.has("scm.historyProviderCount"),x.notEquals("scm.historyProviderCount",0)),containerIcon:M$t}],L$t);oe.as(Qi.Workbench).registerWorkbenchContribution(SVe,3);oe.as(Qi.Workbench).registerWorkbenchContribution(IVe,3);pt(Jge.ID,Jge,ut.AfterRestored);pt(ume.ID,ume,ut.AfterRestored);oe.as(ii.Configuration).registerConfiguration({id:"scm",order:5,title:d(13022,null),type:"object",scope:5,properties:{"scm.diffDecorations":{type:"string",enum:["all","gutter","overview","minimap","none"],enumDescriptions:[d(12983,null),d(12984,null),d(12987,null),d(12985,null),d(12986,null)],default:"all",description:d(12948,null)},"scm.diffDecorationsGutterWidth":{type:"number",enum:[1,2,3,4,5],default:3,description:d(12953,null)},"scm.diffDecorationsGutterVisibility":{type:"string",enum:["always","hover"],enumDescriptions:[d(12992,null),d(12993,null)],description:d(12991,null),default:"always"},"scm.diffDecorationsGutterAction":{type:"string",enum:["diff","none"],enumDescriptions:[d(12989,null),d(12990,null)],description:d(12988,null),default:"diff"},"scm.diffDecorationsGutterPattern":{type:"object",description:d(12950,null),additionalProperties:!1,properties:{added:{type:"boolean",description:d(12951,null)},modified:{type:"boolean",description:d(12952,null)}},default:{added:!1,modified:!0}},"scm.diffDecorationsIgnoreTrimWhitespace":{type:"string",enum:["true","false","inherit"],enumDescriptions:[d(12996,null),d(12994,null),d(12995,null)],description:d(12949,null),default:"false"},"scm.alwaysShowActions":{type:"boolean",description:d(12945,null),default:!1},"scm.countBadge":{type:"string",enum:["all","focused","off"],enumDescriptions:[d(12973,null),d(12974,null),d(12975,null)],description:d(12972,null),default:"all"},"scm.providerCountBadge":{type:"string",enum:["hidden","auto","visible"],enumDescriptions:[d(13006,null),d(13005,null),d(13007,null)],markdownDescription:d(13004,null,"`#scm.alwaysShowRepositories#`"),default:"hidden"},"scm.defaultViewMode":{type:"string",enum:["tree","list"],enumDescriptions:[d(12978,null),d(12977,null)],description:d(12976,null),default:"list"},"scm.defaultViewSortKey":{type:"string",enum:["name","path","status"],enumDescriptions:[d(12980,null),d(12981,null),d(12982,null)],description:d(12979,null),default:"path"},"scm.autoReveal":{type:"boolean",description:d(12947,null),default:!0},"scm.inputFontFamily":{type:"string",markdownDescription:d(12954,null),default:"default"},"scm.inputFontSize":{type:"number",markdownDescription:d(12955,null),default:13},"scm.inputMaxLineCount":{type:"number",markdownDescription:d(12956,null),minimum:1,maximum:50,default:10},"scm.inputMinLineCount":{type:"number",markdownDescription:d(12957,null),minimum:1,maximum:50,default:1},"scm.alwaysShowRepositories":{type:"boolean",markdownDescription:d(12946,null),default:!1},"scm.repositories.sortOrder":{type:"string",enum:["discovery time","name","path"],enumDescriptions:[d(13012,null),d(13013,null),d(13014,null)],description:d(12967,null),default:"discovery time"},"scm.repositories.visible":{type:"number",description:d(12965,null),default:10},"scm.repositories.selectionMode":{type:"string",enum:["multiple","single"],enumDescriptions:[d(13010,null),d(13011,null)],description:d(13009,null),default:"multiple"},"scm.repositories.explorer":{type:"boolean",markdownDescription:d(13008,null,"`#scm.repositories.selectionMode#`","single"),default:!1,tags:["experimental"]},"scm.showActionButton":{type:"boolean",markdownDescription:d(13026,null),default:!0},"scm.showInputActionButton":{type:"boolean",markdownDescription:d(13027,null),default:!0},"scm.workingSets.enabled":{type:"boolean",description:d(13018,null),default:!1},"scm.workingSets.default":{type:"string",enum:["empty","current"],enumDescriptions:[d(13017,null),d(13016,null)],description:d(13015,null),default:"current"},"scm.compactFolders":{type:"boolean",description:d(12971,null),default:!0},"scm.graph.pageOnScroll":{type:"boolean",description:d(13000,null),default:!0},"scm.graph.pageSize":{type:"number",description:d(13001,null),minimum:1,maximum:1e3,default:50},"scm.graph.badges":{type:"string",enum:["all","filter"],enumDescriptions:[d(12998,null),d(12999,null)],description:d(12997,null),default:"filter"},"scm.graph.showIncomingChanges":{type:"boolean",description:d(13002,null),default:!0},"scm.graph.showOutgoingChanges":{type:"boolean",description:d(13003,null),default:!0}}});yt.registerCommandAndKeybindingRule({id:"scm.acceptInput",metadata:{description:d(12968,null),args:[]},weight:200,when:x.has("scmRepository"),primary:2051,handler:a=>{let t=a.get(X).getContext(Pn()).getValue("scmRepository");if(!t)return Promise.resolve(null);let n=a.get($c).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||[])}});yt.registerCommandAndKeybindingRule({id:"scm.clearValidation",weight:200,when:x.and(x.has("scmRepository"),w$t.SCMInputHasValidationMessage),primary:9,handler:async a=>{a.get(au).activeRepository.get()?.repository.input.clearValidation()}});yt.registerCommandAndKeybindingRule({id:"scm.clearInput",weight:200,when:x.and(x.has("scmRepository"),$n.Visible.toNegated(),ka.inlineSuggestionVisible.toNegated(),w$t.SCMInputHasValidationMessage.toNegated(),ue.hasNonEmptySelection.toNegated()),primary:9,handler:async a=>{let i=a.get($c),o=a.get(X).getContext(Pn()).getValue("scmRepository");(o?i.getRepository(o):void 0)?.input.setValue("",!0)}});var Eyo={description:{description:d(12969,null),args:[]},weight:200,handler:a=>{let i=a.get(X),e=a.get($c),o=i.getContext(Pn()).getValue("scmRepository");(o?e.getRepository(o):void 0)?.input.showNextHistoryValue()}},Tyo={description:{description:d(12970,null),args:[]},weight:200,handler:a=>{let i=a.get(X),e=a.get($c),o=i.getContext(Pn()).getValue("scmRepository");(o?e.getRepository(o):void 0)?.input.showPreviousHistoryValue()}};yt.registerCommandAndKeybindingRule({...Eyo,id:"scm.viewNextCommit",when:x.and(x.has("scmRepository"),x.has("scmInputIsInLastPosition"),$n.Visible.toNegated()),primary:18});yt.registerCommandAndKeybindingRule({...Tyo,id:"scm.viewPreviousCommit",when:x.and(x.has("scmRepository"),x.has("scmInputIsInFirstPosition"),$n.Visible.toNegated()),primary:16});yt.registerCommandAndKeybindingRule({...Eyo,id:"scm.forceViewNextCommit",when:x.has("scmRepository"),primary:530});yt.registerCommandAndKeybindingRule({...Tyo,id:"scm.forceViewPreviousCommit",when:x.has("scmRepository"),primary:528});qe.registerCommand("scm.openInIntegratedTerminal",async(a,...i)=>{if(!i||i.length===0)return;let e=a.get(ge),t=a.get(fo),o=i.length===1?i[0]:void 0;if(!o){let n=t.lastFocusedList,r=n?.getHTMLElement();if(n instanceof Rl&&r&&sa(r)){let[s]=n.getFocus(),l=n.element(s);fd(l)&&(o=l.provider)}}o?.rootUri&&await e.executeCommand("openInIntegratedTerminal",o.rootUri)});qe.registerCommand("scm.openInTerminal",async(a,i)=>{if(!i||!i.rootUri)return;await a.get(ge).executeCommand("openInTerminal",i.rootUri)});qe.registerCommand("scm.setActiveProvider",async a=>{let i=a.get(F),e=a.get(au),t=d(13020,null),o=d(13019,null),r=await i.createInstance(EVe,t,o).pickRepository();if(r?.repository){let s=r.repository!=="auto"?r.repository:void 0;e.pinActiveRepository(s)}});fe.appendMenuItem(D.SCMSourceControl,{group:"99_terminal",command:{id:"scm.openInTerminal",title:d(12963,null)},when:x.and(ub.isEqualTo(""),x.equals("scmProviderHasRootUri",!0),x.or(x.equals("config.terminal.sourceControlRepositoriesKind","external"),x.equals("config.terminal.sourceControlRepositoriesKind","both")))});fe.appendMenuItem(D.SCMSourceControl,{group:"99_terminal",command:{id:"scm.openInIntegratedTerminal",title:d(12964,null)},when:x.and(x.equals("scmProviderHasRootUri",!0),x.or(x.equals("config.terminal.sourceControlRepositoriesKind","integrated"),x.equals("config.terminal.sourceControlRepositoriesKind","both")))});yt.registerCommandAndKeybindingRule({id:"workbench.scm.action.focusPreviousInput",weight:200,when:Sc.RepositoryVisibilityCount.notEqualsTo(0),handler:async a=>{let e=await a.get(Ft).openView(Af);e&&e.focusPreviousInput()}});yt.registerCommandAndKeybindingRule({id:"workbench.scm.action.focusNextInput",weight:200,when:Sc.RepositoryVisibilityCount.notEqualsTo(0),handler:async a=>{let e=await a.get(Ft).openView(Af);e&&e.focusNextInput()}});yt.registerCommandAndKeybindingRule({id:"workbench.scm.action.focusPreviousResourceGroup",weight:200,handler:async a=>{let e=await a.get(Ft).openView(Af);e&&e.focusPreviousResourceGroup()}});yt.registerCommandAndKeybindingRule({id:"workbench.scm.action.focusNextResourceGroup",weight:200,handler:async a=>{let e=await a.get(Ft).openView(Af);e&&e.focusNextResourceGroup()}});fe.appendMenuItem(D.EditorLineNumberContext,{title:d(12966,null),submenu:D.SCMQuickDiffDecorations,when:x.or(x.equals("config.scm.diffDecorations","all"),x.equals("config.scm.diffDecorations","gutter")),group:"9_quickDiffDecorations"});W(class extends K{constructor(){super({id:"scm.editor.triggerSetup",title:d(13023,null),icon:M.chatSparkle,f1:!1,menu:{id:D.EditorContent,when:x.and(ie.Setup.hidden.negate(),ie.Setup.disabled.negate(),ie.Setup.installed.negate(),x.in(Fo.Resource.key,"git.mergeChanges"),x.equals("git.activeResourceHasMergeConflicts",!0))}})}async run(a,...i){let e=a.get(ge);if(!await e.executeCommand(n3))return;let o=to.defaultChatAgent?.resolveMergeConflictsCommand;o&&await e.executeCommand(o,...i)}});we($c,yVe,1);we(au,pG,1);we(OE,fG,1);we(HO,Fke,1);xa.register(new D$t);var TAi="workbench.debug.viewlet.action.copyWorkspaceVariableValue",_Ai=d(11718,null);W(class extends K{constructor(){super({id:TAi,title:_Ai,f1:!1})}run(a,i){let e=a.get(Wi);i.value&&e.writeText(i.value)}});W(class extends K{constructor(){super({id:"_executeNotebookVariableProvider",title:d(11719,null),f1:!1})}async run(a,i){if(!i)return[];let e=A.revive(i),t=a.get(Tl),n=a.get(un).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,ve.None),l=[];for await(let c of s)l.push(c);return l}return[]}});var ife=class extends C{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===Jc.DEFAULT_VALUE||(this._accessibilityService.alert(`${t.name} = ${t.value}`),this._logService.trace(`debugAccessibilityAnnouncerValueChanged ${t.name} ${t.value}`))}):this._listener.clear()}};ife=I([m(0,Li),m(1,ne),m(2,Bi),m(3,B)],ife);var fH=class extends C{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(vC,this)),fH.INSTANCE=this}dispose(){this.pendingUpdates.forEach(e=>e.dispose()),super.dispose()}provideTextContent(e){return this.createOrUpdateContentModel(e,!0)}static refreshDebugContent(e){fH.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=Ez.getEncodedDebugData(e);n=this.debugService.getModel().getSession(s.sessionId)}if(n||(n=this.debugService.getViewModel().focusedSession),!n)return Promise.reject(new Zs(d(9278,null)));let r=s=>{this.debugService.sourceIsNotAvailable(e);let l=this.languageService.createById(Fr),c=s?d(9277,null,e.path,s):d(9276,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 $e;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=>An.replace(z.lift(h.range),h.text))),o))}else{let l=s.body.mimeType||JEe(e)[0],c=this.languageService.createByMimeType(l);return this.modelService.createModel(s.body.content,c,e)}return r()},s=>r(s.message))}};fH=I([m(0,Nt),m(1,Li),m(2,Ct),m(3,kt),m(4,$s)],fH);var RVe=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(9291,null):e=d(9290,null),!(await this.dialogService.confirm({message:e,type:"warning",primaryButton:d(9292,null)})).confirmed}};RVe=I([m(0,ao),m(1,Li),m(2,B),m(3,ct)],RVe);var ofe=class extends C{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)}))}))}};ofe=I([m(0,Li),m(1,Bi),m(2,ne)],ofe);var _yo="debug.actionswidgetposition",Dyo="debug.actionswidgety",MVe=class extends Jd{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 P);this.auxWindowCoordinates=new WeakMap;this.trackPixelRatioListener=this._register(new me);this.$el=_("div.debug-toolbar");let h=v1(this.configurationService)==="custom",g=h&&Pp===1,f=h&&(Pp===3||Pp===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=R(this.$el,_("div.drag-area"+q.asCSSSelector(Alo)));let v=R(this.$el,_("div.action-bar-container"));this.debugToolBarMenu=u.createMenu(D.DebugToolBar,p),this._register(this.debugToolBarMenu),this.activeActions=[],this.actionBar=this._register(new ji(v,{orientation:0,actionViewItemProvider:(b,S)=>{if(b.id===qAe)return this.instantiationService.createInstance(nG,b,void 0);if(b.id===uT||b.id===GR){this.stopActionViewItemDisposables.clear();let y=this.instantiationService.invokeFunction(w=>ost(b,this.stopActionViewItemDisposables,w,{hoverDelegate:S.hoverDelegate}));if(y)return y}return Ca(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=Vm(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&&!so(e.error)&&this.notificationService.warn(e.error),this.telemetryService.publicLog2("workbenchActionExecuted",{id:e.action.id,from:"debugActionsWidget"})})),this._register(Fre(this.dragArea,e=>{new yn(Me(this.dragArea),e).detail===2&&(this.setCoordinates(.5,this.yDefault),this.storePosition())})),this._register(C$(this.dragArea,e=>{this.dragArea.classList.add("dragged");let t=Me(this.layoutService.activeContainer),o=new yn(t,e),n=this.computeCurrentXPercent(),r=this.getCurrentYPosition(),s=$be(t,c=>{let u=new yn(t,c);u.preventDefault(),this.setCoordinates(n+(u.posx-o.posx)/t.innerWidth,r+u.posy-o.posy)}),l=Fre(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(Me(this.layoutService.activeContainer)),this.isBuilt&&(this.doShowInActiveContainer(),this.setCoordinates())}))}computeCurrentXPercent(){let{left:e,width:t}=this.$el.getBoundingClientRect();return(e+t/2)/Me(this.$el).innerWidth}getCurrentXPercent(){return Number(this.$el.style.getPropertyValue("--x-position"))}getCurrentYPosition(){return parseInt(this.$el.style.getPropertyValue("--y-position"))}storePosition(){let e=Me(this.layoutService.activeContainer),t=this.layoutService.activeContainer===this.layoutService.mainContainer,o=this.getCurrentXPercent(),n=this.getCurrentYPosition();t?(this.storageService.store(_yo,o,0,1),this.storageService.store(Dyo,n,0,1)):this.auxWindowCoordinates.set(e,{x:o,y:n})}updateStyles(){if(super.updateStyles(),this.$el){this.$el.style.backgroundColor=this.getColor(jlo)||"";let e=this.getColor(jT),t=this.getColor(Qlo);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=Me(this.layoutService.activeContainer),o=e===It?Number(this.storageService.get(_yo,0)):this.auxWindowCoordinates.get(e)?.x;return o!==void 0&&!isNaN(o)?o:.5}getStoredYPosition(){let e=Me(this.layoutService.activeContainer);return(e===It?this.storageService.getNumber(Dyo,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",Me(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,bn(this.$el),this.setCoordinates()}doShowInActiveContainer(){this.layoutService.activeContainer.appendChild(this.$el),this.trackPixelRatioListener.value=Xd.getInstance(Me(this.$el)).onDidChange(()=>this.setCoordinates())}hide(){this.isVisible=!1,xo(this.$el)}dispose(){super.dispose(),this.$el?.remove()}};MVe=I([m(0,Ne),m(1,Te),m(2,Li),m(3,fi),m(4,le),m(5,B),m(6,De),m(7,F),m(8,qt),m(9,X)],MVe);function ost(a,i,e,t){let o=e.get(qt),n=e.get(X),r=e.get(F),s=o.getMenuActions(D.DebugToolBarStop,n,{shouldForwardArgs:!0}),l=Vm(s);if(!l.length)return;let c=i.add(new st("notebook.moreRunActions",d(9069,null),"codicon-chevron-down",!0));return r.createInstance(dI,a,c,l,"debug-stop-actions",t)}var DAi=new P,vH=(a,i,e,t,o,n,r)=>{fe.appendMenuItem(D.DebugToolBar,{group:"navigation",when:o,order:e,command:{id:a,title:i,icon:t,precondition:n},alt:r}),DAi.add(fe.appendMenuItem(D.ViewContainerTitle,{group:"navigation",when:x.and(o,x.equals("viewContainer",jh),Fs.notEqualsTo("inactive"),x.equals("config.debug.toolBarLocation","docked")),order:e,command:{id:a,title:i,icon:t,precondition:n}}))};Mp(fe.onDidChangeMenu(a=>{if(a.has(D.DebugToolBar)){DAi.clear();let i=fe.getMenuItems(D.DebugToolBar);for(let e of i)DAi.add(fe.appendMenuItem(D.ViewContainerTitle,{...e,when:x.and(e.when,x.equals("viewContainer",jh),Fs.notEqualsTo("inactive"),x.equals("config.debug.toolBarLocation","docked"))}))}}));var Lyo=x.equals("config.debug.toolBarLocation","commandCenter");fe.appendMenuItem(D.CommandCenterCenter,{submenu:D.DebugToolBar,title:"Debug",icon:M.debug,order:1,when:x.and(Xa,Lyo)});vH(k2,xte,10,Vpe,Fs.isEqualTo("stopped"));vH(W3,Cte,10,Wpe,Fs.notEqualsTo("stopped"),x.and(Fs.isEqualTo("running"),wz.toNegated()));vH(uT,T2,70,P4,fC.toNegated(),void 0,{id:GR,title:H3,icon:KF,precondition:x.and(fC.toNegated(),gP)});vH(GR,H3,70,KF,fC,void 0,{id:uT,title:T2,icon:P4,precondition:x.and(fC,gP)});vH(w2,Ite,20,Fpe,void 0,Fs.isEqualTo("stopped"));vH(C2,yte,30,FZ,void 0,Fs.isEqualTo("stopped"));vH(x2,wte,40,WZ,void 0,Fs.isEqualTo("stopped"));vH(y2,Ste,60,Ope);vH(Yki,d(9071,null),50,iZe,lQe,Fs.isEqualTo("stopped"));vH(Qki,d(9070,null),55,oZe,lQe,Fs.isEqualTo("stopped"));vH(qAe,zmo,100,M.listTree,x.and(a_t,Lyo.negate()));fe.appendMenuItem(D.DebugToolBarStop,{group:"navigation",when:x.and(fC.toNegated(),gP),order:0,command:{id:GR,title:H3,icon:KF}});fe.appendMenuItem(D.DebugToolBarStop,{group:"navigation",when:x.and(fC,gP),order:0,command:{id:uT,title:T2,icon:P4}});fe.appendMenuItem(D.DebugToolBarStop,{group:"navigation",when:x.or(x.and(fC.toNegated(),zY,gP),x.and(fC,zY)),order:0,command:{id:$Ae,title:Btt,icon:KF}});var ix=_;function Myo(a){return{sessionId:a.getId()}}function Pyo(a){return{...Myo(a.session),threadId:a.getId()}}function Krn(a){return{...Pyo(a.thread),frameId:a.getId(),frameName:a.name,frameLocation:{range:a.range,source:a.source.raw}}}function OAi(a){return a instanceof NE?Krn(a):a instanceof bP?Pyo(a):bH(a)?Myo(a):void 0}function FAi(a){return a instanceof NE?a.source.inMemory?a.source.raw.path||a.source.reference||a.source.name:a.source.uri.toString():a instanceof bP?a.threadId:bH(a)?a.getId():""}function Ayo(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,zw(a.source.uri.path,n.uri.path)))}),t===0)return a.source.name;let o=Math.max(0,a.source.uri.path.lastIndexOf(Lo.sep,a.source.uri.path.length-t-1));return(o>0?"...":"")+a.source.uri.path.substring(o)}async function LAi(a,i){a.parentSession&&await LAi(a.parentSession,i),await i.expand(a)}var PVe=class extends zr{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=A$t(b),this.stateMessageLabelHover.update(MAi(b)),this.stateMessageLabel.classList.toggle("exception",b.reason==="exception"),this.stateMessage.hidden=!1):f.length===1&&f[0].state===3?(this.stateMessageLabel.textContent=d(8717,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 LAi(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=R(e,ix("span.call-stack-state-message")),this.stateMessage.hidden=!0,this.stateMessageLabel=R(this.stateMessage,ix("span.label")),this.stateMessageLabelHover=this._register(this.hoverService.setupManagedHover(Ni("mouse"),this.stateMessage,""))}renderBody(e){super.renderBody(e),this.element.classList.add("debug-pane"),e.classList.add("debug-call-stack");let t=cte(e);this.dataSource=new PAi(this.debugService),this.tree=this.instantiationService.createInstance(qI,"CallStackView",t,new RAi,new NAi(this.debugService),[this.instantiationService.createInstance(moe),this.instantiationService.createInstance(hoe),this.instantiationService.createInstance(goe),this.instantiationService.createInstance(foe),new AVe,new P$t],this.dataSource,{accessibilityProvider:new AAi,compressionEnabled:!0,autoExpandSingleChildren:!0,identityProvider:{getId:n=>typeof n=="string"?n:n instanceof Array?`showMore ${n[0].getId()}`:n.getId()},keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:n=>bH(n)?n.getLabel():n instanceof bP?`${n.name} ${n.stateLabel}`:n instanceof NE||typeof n=="string"?n:n instanceof $Y?AVe.LABEL:d(8722,null),getCompressedNodeKeyboardNavigationLabel:n=>{let r=n[0];return bH(r)?r.getLabel():""}},expandOnlyOnTwistieClick:!0,overrideStyles:this.getLocationBasedColors().listOverrideStyles}),XYi.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 NE){let l={preserveFocus:n.editorOptions.preserveFocus,sideBySide:n.sideBySide,pinned:n.editorOptions.pinned};r(s,s.thread,s.thread.session,l)}if(s instanceof bP&&r(void 0,s,s.session),bH(s)&&r(void 0,void 0,s),s instanceof $Y){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=H.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(()=>Ue(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 LAi(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=[];bH(t)?o=Nyo(t):t instanceof bP?o=Oyo(t):t instanceof NE&&(o=Grn(t));let n=this.contextKeyService.createOverlay(o),r=this.menuService.getMenuActions(D.DebugCallStackContext,n,{arg:FAi(t),shouldForwardArgs:!0}),s=Ef(r,"inline");this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>s.secondary,getActionsContext:()=>OAi(t)})}};PVe=I([m(1,ze),m(2,Li),m(3,_e),m(4,F),m(5,Ri),m(6,B),m(7,X),m(8,Qe),m(9,De),m(10,tt),m(11,qt)],PVe);function Nyo(a){return[[yv.key,"session"],[e_t.key,Wce(a)],[WY.key,a.state===2],[Kdi.key,a.getAllThreads().length===1]]}var moe=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 moe.ID}renderTemplate(i){let e=R(i,ix(".session"));R(e,ix(q.asCSSSelector(Flo)));let t=R(e,ix(".name")),o=R(e,ix("span.state.label.monaco-count-badge.long")),n=new P,r=n.add(new Oa(t)),s=n.add(new P),l=n.add(new ji(e,{actionViewItemProvider:(u,p)=>{if((u.id===uT||u.id===GR)&&u instanceof Eo){s.clear();let h=this.instantiationService.invokeFunction(g=>ost(u,s,g,{...p,menuAsChild:!1}));if(h)return h}if(u instanceof Eo)return this.instantiationService.createInstance(ml,u,{hoverDelegate:p.hoverDelegate});if(u instanceof Cc)return this.instantiationService.createInstance(mE,u,{hoverDelegate:p.hoverDelegate})}})),c=n.add(new P);return{session:e,name:t,stateLabel:o,label:r,actionBar:l,elementDisposable:c,templateDisposable:n}}renderElement(i,e,t){this.doRenderElement(i.element,ua(i.filterData),t)}renderCompressedElements(i,e,t){let o=i.element.elements[i.element.elements.length-1],n=ua(i.filterData);this.doRenderElement(o,n,t)}doRenderElement(i,e,t){let o=t.elementDisposable.add(this.hoverService.setupManagedHover(Ni("mouse"),t.session,d(8718,null)));t.label.set(i.getLabel(),e);let n=i.getStoppedDetails(),r=i.getAllThreads().find(u=>u.stopped),s=this.contextKeyService.createOverlay(Nyo(i)),l=t.elementDisposable.add(this.menuService.createMenu(D.DebugCallStackContext,s)),c=()=>{t.actionBar.clear();let{primary:u}=hl(l.getActions({arg:FAi(i),shouldForwardArgs:!0}),"inline");t.actionBar.push(u,{icon:!0,label:!1}),t.actionBar.context=OAi(i)};t.elementDisposable.add(l.onDidChange(()=>c())),c(),t.stateLabel.style.display="",n?(t.stateLabel.textContent=A$t(n),o.update(`${i.getLabel()}: ${MAi(n)}`),t.stateLabel.classList.toggle("exception",n.reason==="exception")):r&&r.stoppedDetails?(t.stateLabel.textContent=A$t(r.stoppedDetails),o.update(`${i.getLabel()}: ${MAi(r.stoppedDetails)}`),t.stateLabel.classList.toggle("exception",r.stoppedDetails.reason==="exception")):(t.stateLabel.textContent=d(8717,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()}};moe=I([m(0,F),m(1,X),m(2,tt),m(3,qt)],moe);function Oyo(a){return[[yv.key,"thread"],[WY.key,a.stopped]]}var hoe=class{constructor(i,e,t){this.contextKeyService=i;this.hoverService=e;this.menuService=t}static{this.ID="thread"}get templateId(){return hoe.ID}renderTemplate(i){let e=R(i,ix(".thread")),t=R(e,ix(".name")),o=R(e,ix("span.state.label.monaco-count-badge.long")),n=new P,r=n.add(new Oa(t)),s=n.add(new ji(e)),l=n.add(new P);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(Ni("mouse"),t.thread,o.name)),t.label.set(o.name,ua(i.filterData)),t.stateLabel.textContent=o.stateLabel,t.stateLabel.classList.toggle("exception",o.stoppedDetails?.reason==="exception");let n=this.contextKeyService.createOverlay(Oyo(o)),r=t.elementDisposable.add(this.menuService.createMenu(D.DebugCallStackContext,n)),s=()=>{t.actionBar.clear();let{primary:l}=hl(r.getActions({arg:FAi(o),shouldForwardArgs:!0}),"inline");t.actionBar.push(l,{icon:!0,label:!1}),t.actionBar.context=OAi(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()}};hoe=I([m(0,X),m(1,tt),m(2,qt)],hoe);function Grn(a){return[[yv.key,"stackFrame"],[o_t.key,a.canRestart]]}var goe=class{constructor(i,e,t){this.hoverService=i;this.labelService=e;this.notificationService=t}static{this.ID="stackFrame"}get templateId(){return goe.ID}renderTemplate(i){let e=R(i,ix(".stack-frame")),t=R(e,ix("span.label.expression")),o=R(e,ix(".file")),n=R(o,ix("span.file-name")),r=R(o,ix("span.line-number-wrapper")),s=R(r,ix("span.line-number.monaco-count-badge")),l=new P,c=new P;l.add(c);let u=l.add(new Oa(t)),p=l.add(new ji(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||kz(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(Ni("mouse"),t.file,r)),t.label.set(o.name,ua(i.filterData),o.name),t.fileName.textContent=Ayo(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 st("debug.callStack.restartFrame",d(8716,null),q.asClassName(tZe),!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()}};goe=I([m(0,tt),m(1,ot),m(2,Ne)],goe);var foe=class{constructor(i){this.hoverService=i}static{this.ID="error"}get templateId(){return foe.ID}renderTemplate(i){return{label:R(i,ix(".error")),templateDisposable:new P}}renderElement(i,e,t){let o=i.element;t.label.textContent=o,t.templateDisposable.add(this.hoverService.setupManagedHover(Ni("mouse"),t.label,o))}renderCompressedElements(i,e,t){throw new Error("Method not implemented.")}disposeTemplate(i){}};foe=I([m(0,tt)],foe);var AVe=class a{static{this.ID="loadMore"}static{this.LABEL=d(8713,null)}constructor(){}get templateId(){return a.ID}renderTemplate(i){let e=R(i,ix(".load-all"));return e.style.color=wt(WI),{label:e}}renderElement(i,e,t){t.label.textContent=a.LABEL}renderCompressedElements(i,e,t){throw new Error("Method not implemented.")}disposeTemplate(i){}},P$t=class a{static{this.ID="showMore"}constructor(){}get templateId(){return a.ID}renderTemplate(i){let e=R(i,ix(".show-more"));return e.style.color=wt(WI),{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(8720,null,o.length,o[0].source.origin):t.label.textContent=d(8721,null,o.length)}renderCompressedElements(i,e,t){throw new Error("Method not implemented.")}disposeTemplate(i){}},RAi=class{getHeight(i){return i instanceof NE&&i.presentationHint==="label"||i instanceof $Y||i instanceof Array?16:22}getTemplateId(i){return bH(i)?moe.ID:i instanceof bP?hoe.ID:i instanceof NE?goe.ID:typeof i=="string"?foe.ID:i instanceof $Y?AVe.ID:P$t.ID}};function MAi(a){return a.text??A$t(a)}function A$t(a){return a.description||(a.reason?d(8715,null,a.reason):d(8714,null))}function Ryo(a){return!!a&&typeof a.getSessions=="function"}function bH(a){return!!a&&typeof a.getAllThreads=="function"}var PAi=class{constructor(i){this.debugService=i;this.deemphasizedStackFramesToShow=new WeakSet}hasChildren(i){if(bH(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 Ryo(i)||i instanceof bP&&i.stopped}async getChildren(i){if(Ryo(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(bH(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 NE&&o.source&&kz(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 NE&&r.source&&kz(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 $Y(i.session.getId(),i.threadId)])),e}},AAi=class{getWidgetAriaLabel(){return d(8711,null)}getWidgetRole(){return"treegrid"}getRole(i){return"row"}getAriaLabel(i){if(i instanceof bP)return d(8724,null,i.name,i.stateLabel);if(i instanceof NE)return d(8723,null,i.name,i.range.startLineNumber,Ayo(i));if(bH(i)){let e=i.getAllThreads().find(o=>o.stopped),t=e?e.stateLabel:d(8717,null);return d(8719,null,i.getLabel(),t)}return typeof i=="string"?i:i instanceof Array?d(8721,null,i.length):AVe.LABEL}},NAi=class{constructor(i){this.debugService=i}isIncompressible(i){return bH(i)?!(i.compact||this.debugService.getModel().getSessions().some(t=>t.parentSession===i&&t.compact)):!0}};W(class extends Fn{constructor(){super({id:"callStack.collapse",viewId:qj,title:d(8712,null),f1:!1,icon:M.collapseAll,precondition:Fs.isEqualTo(oR(2)),menu:{id:D.ViewTitle,order:10,group:"navigation",when:x.equals("view",qj)}})}runInView(i,e){e.collapseAll()}});function voe(a,i,e,t,o,n){fe.appendMenuItem(D.DebugCallStackContext,{group:"inline",order:o,when:t,command:{id:a,title:i,icon:e,precondition:n}})}var nst=x.or(yv.isEqualTo("thread"),x.and(yv.isEqualTo("session"),Kdi));voe(W3,Cte,Wpe,x.and(nst,WY.toNegated()),10,wz.toNegated());voe(k2,xte,Vpe,x.and(nst,WY),10);voe(w2,Ite,Fpe,nst,20,WY);voe(C2,yte,FZ,nst,30,WY);voe(x2,wte,WZ,nst,40,WY);voe(y2,Ste,Ope,yv.isEqualTo("session"),50);voe(uT,T2,P4,x.and(e_t.toNegated(),yv.isEqualTo("session")),60);voe(GR,H3,KF,x.and(e_t,yv.isEqualTo("session")),60);var NVe=class extends yh{constructor(e,t,o){super(Gtt,{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(8922,null);return n.push({label:`$(plus) ${r}`,ariaLabel:r,accept:()=>this._commandService.executeCommand(V3)}),n}_createPick(e,t,o){let n=e.name,r=Up(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(ld)||this._viewsService.openView(ld,!0)}}}};NVe=I([m(0,Li),m(1,Ft),m(2,ge)],NVe);var WAi={allowBreakpoint:!1,isBreakpointSet:!1,isBreakpointEnabled:!1,instructionReference:"",instructionOffset:0,instructionReferenceOffset:0,address:0n,instruction:{address:"-1",instruction:d(9082,null)}},IT=class extends pa{constructor(e,t,o,n,r,s,l,c,u,p){super(QTt,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 LS(this._configurationService.getValue("editor"),Xd.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(L0,this));this._disassembledInstructions=this._register(this._instantiationService.createInstance(rC,"DisassemblyView",e,n,[{label:"",tooltip:"",weight:0,minimumWidth:this.fontInfo.lineHeight,maximumWidth:this.fontInfo.lineHeight,templateId:boe.TEMPLATE_ID,project(s){return s}},{label:d(9077,null),tooltip:"",weight:.3,templateId:L0.TEMPLATE_ID,project(s){return s}}],[this._instantiationService.createInstance(boe,this),r],{identityProvider:{getId:s=>s.instruction.address},horizontalScrolling:!1,overrideStyles:{listBackground:qo},multipleSelectionSupport:!1,setRowLineHeight:!1,openOnSingleClick:!1,accessibilityProvider:new VAi,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)!==WAi&&!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(IT.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(IT.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 iI){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 iI){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 iI){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,-IT.NUM_INSTRUCTIONS_TO_LOAD,IT.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,IT.NUM_INSTRUCTIONS_TO_LOAD),r&&s&&this._disassembledInstructions){let l=[],c,u;for(let O=0;O<s.length;O++){let V=s[O],U=o+O;if(V.location&&(c=V.location,u=void 0),V.line){let te={startLineNumber:V.line,startColumn:V.column??0,endLineNumber:V.endLine??V.line,endColumn:V.endColumn??0};z.equalsRange(te,u??null)||(u=te,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:U,instruction:V,address:G};l.push($),t===0&&U===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(U=>U?.address===O.address);V&&(O.isBreakpointSet=!0,O.isBreakpointEnabled=V.enabled)}let g=this._disassembledInstructions;g.length===1&&this._disassembledInstructions.row(0)===WAi&&g.splice(0,1);let f=l[0].address,v=l[l.length-1].address,b=bM(g.length,O=>Number(g.row(O).address-f)),S=b<0?~b:b,y=bM(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 N=O=>O.line!==void 0&&O.location!==void 0&&(!T||!pXi(O.location,T.location)||O.line!==T.line);for(let O of l)N(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?bM(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,-IT.NUM_INSTRUCTIONS_TO_LOAD*4,IT.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=bM(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,[WAi])}onContextMenu(e){let t=Uc(this.menu.getActions({shouldForwardArgs:!0}));this._contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>t,getActionsContext:()=>e.element})}};IT=I([m(1,Te),m(2,De),m(3,le),m(4,B),m(5,F),m(6,Li),m(7,ze),m(8,qt),m(9,X)],IT);var boe=class{constructor(i,e){this._disassemblyView=i;this._debugService=e;this.templateId=boe.TEMPLATE_ID;this._breakpointIcon="codicon-"+zF.regular.id;this._breakpointDisabledIcon="codicon-"+zF.disabled.id;this._breakpointHintIcon="codicon-"+eZe.id;this._debugStackframe="codicon-"+Ape.id;this._debugStackframeFocused="codicon-"+Npe.id}static{this.TEMPLATE_ID="breakpoint"}renderTemplate(i){i.style.alignSelf="flex-end";let e=R(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)),Vo(i,"mouseover",()=>{t.element?.allowBreakpoint&&e.classList.add(this._breakpointHintIcon)}),Vo(i,"mouseout",()=>{t.element?.allowBreakpoint&&e.classList.remove(this._breakpointHintIcon)}),Vo(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){Ue(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))}};boe=I([m(1,Li)],boe);var L0=class extends C{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=L0.TEMPLATE_ID;this._topStackFrameColor=t.getColorTheme().getColor(ONe),this._focusedStackFrameColor=t.getColorTheme().getColor(FNe),this._register(t.onDidColorThemeChange(l=>{this._topStackFrameColor=l.getColor(ONe),this._focusedStackFrameColor=l.getColor(FNe)}))}static{this.TEMPLATE_ID="instruction"}static{this.INSTRUCTION_ADDR_MIN_LENGTH=25}static{this.INSTRUCTION_BYTES_MIN_LENGTH=30}renderTemplate(e){let t=R(e,_(".sourcecode")),o=R(e,_(".instruction"));this.applyFontInfo(t),this.applyFontInfo(o);let n={element:void 0},r=[],s=[this._disassemblyView.onDidChangeStackFrame(()=>this.rerenderBackground(o,t,n.element)),Vo(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 ES(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 ES(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<L0.INSTRUCTION_ADDR_MIN_LENGTH&&(s=L0.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<L0.INSTRUCTION_BYTES_MIN_LENGTH&&(s=L0.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){Ue(o.cellDisposable),o.cellDisposable=[]}disposeTemplate(e){Ue(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(9079,null),options:{preserveFocus:!1,selection:o,revealIfOpened:!0,selectionRevealType:1,pinned:!1}})}}getUriFromSource(e){let t=e.location.path;return t&&GY(t)?this.uriService.asCanonicalUri(A.parse(t)):t&&Xl(t)?this.uriService.asCanonicalUri(A.file(t)):hQe(e.location,e.location.path,this._disassemblyView.debugSession.getId(),this.uriService,this.logService)}applyFontInfo(e){Pd(e,this._disassemblyView.fontInfo),e.style.whiteSpace="pre"}};L0=I([m(1,De),m(2,ee),m(3,Nt),m(4,dt),m(5,ne)],L0);var VAi=class{getWidgetAriaLabel(){return d(9078,null)}getAriaLabel(i){let e="",t=i.instruction;return t.address!=="-1"&&(e+=`${d(9080,null)}: ${t.address}`),t.instructionBytes&&(e+=`, ${d(9081,null)}: ${t.instructionBytes}`),e+=`, ${d(9083,null)}: ${t.instruction}`,e}},OVe=class{constructor(i,e,t){t.bufferChangeEvents(()=>{this._languageSupportsDisassembleRequest=l_t.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()}};OVe=I([m(0,ee),m(1,Li),m(2,X)],OVe);qe.registerCommand({metadata:{description:wUt},id:bUt,handler:async(a,i)=>{i?.instruction?.address&&a.get(Wi).writeText(i.instruction.address)}});var BAi=class extends K{constructor(){super({id:SUt,title:{...L(8944,"Toggle Breakpoint"),mnemonicTitle:d(8937,null)},category:L(8926,"Debug"),f1:!0,precondition:fa,keybinding:{when:x.or(ue.editorTextFocus,xz),primary:67,weight:100},menu:[{id:D.MenubarDebugMenu,when:fa,group:"4_new_breakpoint",order:1}]})}async run(i,e){let t=i.get(ee),o=i.get(Li),n=t.activeEditorPane;if(n instanceof IT){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(Kt),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}])}))}}},HAi=class extends xi{constructor(){super({id:"editor.debug.action.conditionalBreakpoint",label:L(8925,"Debug: Add Conditional Breakpoint..."),precondition:fa,menuOpts:{menuId:D.MenubarNewBreakpointMenu,title:d(8933,null),group:"1_breakpoints",order:1,when:fa}})}async run(i,e){let t=i.get(Li),o=e.getPosition();o&&e.hasModel()&&t.canSetBreakpointsIn(e.getModel())&&e.getContribution(fP)?.showBreakpointWidget(o.lineNumber,void 0,0)}},UAi=class extends xi{constructor(){super({id:"editor.debug.action.addLogPoint",label:L(8932,"Debug: Add Logpoint..."),precondition:fa,menuOpts:[{menuId:D.MenubarNewBreakpointMenu,title:d(8936,null),group:"1_breakpoints",order:4,when:fa}]})}async run(i,e){let t=i.get(Li),o=e.getPosition();o&&e.hasModel()&&t.canSetBreakpointsIn(e.getModel())&&e.getContribution(fP)?.showBreakpointWidget(o.lineNumber,o.column,2)}},zAi=class extends xi{constructor(){super({id:"editor.debug.action.triggerByBreakpoint",label:d(8947,null),precondition:fa,alias:"Debug: Triggered Breakpoint...",menuOpts:[{menuId:D.MenubarNewBreakpointMenu,title:d(8939,null),group:"1_breakpoints",order:4,when:fa}]})}async run(i,e){let t=i.get(Li),o=e.getPosition();o&&e.hasModel()&&t.canSetBreakpointsIn(e.getModel())&&e.getContribution(fP)?.showBreakpointWidget(o.lineNumber,o.column,3)}},KAi=class extends xi{constructor(){super({id:"editor.debug.action.editBreakpoint",label:d(8927,null),alias:"Debug: Edit Existing Breakpoint",precondition:fa,menuOpts:{menuId:D.MenubarNewBreakpointMenu,title:d(8935,null),group:"1_breakpoints",order:1,when:fa}})}async run(i,e){let t=i.get(Li),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(fP)?.showBreakpointWidget(c.lineNumber,c.column)}},GAi=class a extends K{static{this.ID="debug.action.openDisassemblyView"}constructor(){super({id:a.ID,title:{...L(8940,"Open Disassembly View"),mnemonicTitle:d(8934,null)},precondition:c_t,menu:[{id:D.EditorContext,group:"debug",order:5,when:x.and(Xa,kce.toNegated(),Fs.isEqualTo("stopped"),ue.editorTextFocus,Eke,l_t)},{id:D.DebugCallStackContext,group:"z_commands",order:50,when:x.and(Xa,Fs.isEqualTo("stopped"),yv.isEqualTo("stackFrame"),Eke)},{id:D.CommandPalette,when:x.and(Xa,Fs.isEqualTo("stopped"),Eke)}]})}run(i){i.get(ee).openEditor(nR.instance,{pinned:!0,revealIfOpened:!0})}},$Ai=class a extends K{static{this.ID="debug.action.toggleDisassemblyViewSourceCode"}static{this.configID="debug.disassemblyView.showSourceCode"}constructor(){super({id:a.ID,title:{...L(8945,"Toggle Source Code in Disassembly View"),mnemonicTitle:d(8938,null)},metadata:{description:L(8946,"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)}}},FVe=class a extends xi{static{this.ID="editor.debug.action.runToCursor"}static{this.LABEL=L(8941,"Run to Cursor")}constructor(){super({id:a.ID,label:a.LABEL.value,alias:"Debug: Run to Cursor",precondition:x.and(fa,kce.toNegated(),x.or(ue.editorTextFocus,xz),ie.inChatSession.negate()),contextMenuOpts:{group:"debug",order:2,when:Xa}})}async run(i,e){let t=e.getPosition();if(!(e.hasModel()&&t))return;let o=e.getModel().uri,n=i.get(Li),r=n.getViewModel(),s=i.get(dt),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)}},WVe=class a extends xi{static{this.ID="editor.debug.action.selectionToRepl"}static{this.LABEL=L(8929,"Evaluate in Debug Console")}constructor(){super({id:a.ID,label:a.LABEL.value,alias:"Debug: Evaluate in Console",precondition:x.and(Xa,ue.editorTextFocus,ie.inChatSession.negate()),contextMenuOpts:{group:"debug",order:0}})}async run(i,e){let t=i.get(Li),o=i.get(Ft),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(ld,!1))?.sendReplInput(l)}},VVe=class a extends xi{static{this.ID="editor.debug.action.selectionToWatch"}static{this.LABEL=L(8923,"Add to Watch")}constructor(){super({id:a.ID,label:a.LABEL.value,alias:"Debug: Add to Watch",precondition:x.and(Xa,ue.editorTextFocus,ie.inChatSession.negate()),contextMenuOpts:{group:"debug",order:1}})}async run(i,e){let t=i.get(Li),o=i.get(Ft),n=i.get(zt);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 m_t(n,s,c);if(!u)return;r=u.matchingExpression}r&&(await o.openView(Yx),t.addWatchExpression(r))}},qAi=class extends xi{constructor(){super({id:"editor.debug.action.showDebugHover",label:L(8942,"Debug: Show Hover"),precondition:Xa,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,2087),weight:100}})}async run(i,e){let t=e.getPosition();if(!(!t||!e.hasModel()))return e.getContribution(gV)?.showHover(t,!0)}},Fyo=d(8928,null),jAi=class a extends xi{static{this.ID="editor.debug.action.stepIntoTargets"}static{this.LABEL=d(8943,null)}constructor(){super({id:a.ID,label:a.LABEL,alias:"Debug: Step Into Target",precondition:x.and(BY,Xa,Fs.isEqualTo("stopped"),ue.editorTextFocus),contextMenuOpts:{group:"debug",order:1.5}})}async run(i,e){let t=i.get(Li),o=i.get(ze),n=i.get(dt),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&&iu.get(e)?.showMessage(Fyo,c);return}let u=await r.stepInTargets(s.frameId);if(!u?.length){iu.get(e)?.showMessage(Fyo,c);return}if(l){let v=[];for(let y of u)y.line&&v.push({start:new Ie(y.line,y.column||1),end:y.endLine?new Ie(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=Yn(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=>pi({id:`stepIntoTarget:${v.id}`,label:v.label,enabled:!0,run:()=>r.stepIn(s.thread.threadId,v.id)}))})}},N$t=class extends xi{constructor(e,t){super(t);this.isNext=e}async run(e,t){let o=e.get(Li),n=e.get(ee),r=e.get(dt);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 GAe(u,!1,!0,!1,o,n)}}},QAi=class extends N$t{constructor(){super(!0,{id:"editor.debug.action.goToNextBreakpoint",label:L(8930,"Debug: Go to Next Breakpoint"),precondition:fa})}},YAi=class extends N$t{constructor(){super(!1,{id:"editor.debug.action.goToPreviousBreakpoint",label:L(8931,"Debug: Go to Previous Breakpoint"),precondition:fa})}},XAi=class extends xi{constructor(){super({id:"editor.debug.action.closeExceptionWidget",label:L(8924,"Close Exception Widget"),precondition:s_t,kbOpts:{primary:9,weight:100}})}async run(i,e){e.getContribution(gV)?.closeExceptionWidget()}};W(GAi);W($Ai);W(BAi);Jt(HAi);Jt(UAi);Jt(zAi);Jt(KAi);Jt(FVe);Jt(jAi);Jt(WVe);Jt(VVe);Jt(qAi);Jt(QAi);Jt(YAi);Jt(XAi);var BVe=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=H.any(H.filter(r.onDidProgressEnd,h=>h.body.progressId===s.body.progressId),r.onDidEndAdapter)(()=>{p.dispose(),u()})});t.isViewContainerVisible(jh)&&e.withProgress({location:jh},()=>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(){Ue(this.toDispose)}};BVe=I([m(0,Li),m(1,Bo),m(2,Ft)],BVe);var HVe=class extends yh{constructor(e,t,o,n){super(Ktt,{noResultsPick:{label:d(9016,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=Up(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(hRe),tooltip:d(9014,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(9015,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(9013,null)}),o.getRecentDynamicConfigurations().forEach(({name:c,type:u})=>{let p=Up(e,c,!0);p&&t.push({label:c,highlights:{label:p},buttons:[{iconClass:q.asClassName(Olo),tooltip:d(9018,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(9017,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(9012,null)});for(let c of l){let u=this.contextService.getWorkbenchState()===3?d(9010,null,c.name):d(9011,null);t.push({label:u,description:this.contextService.getWorkbenchState()===3?c.name:"",highlights:{label:Up(e,u,!0)??void 0},accept:()=>this.commandService.executeCommand(nhe,c.uri.toString())})}return t}};HVe=I([m(0,Li),m(1,Pe),m(2,ge),m(3,Ne)],HVe);var O$t=class{constructor(){this.stopped=!1;this.stopEmitter=new E;this.onDidSessionStop=this.stopEmitter.event}sessionStopped(){this.stopped||(this.stopped=!0,this.stopEmitter.fire())}};var F$t="debug.breakpoint",W$t="debug.functionbreakpoint",V$t="debug.databreakpoint",B$t="debug.exceptionbreakpoint",H$t="debug.watchexpressions",Wyo="debug.chosenenvironment",Vyo="debug.uxstate",UVe=class extends C{constructor(e,t,o,n){super();this.storageService=e;this.textFileService=t;this.uriIdentityService=o;this.logService=n;this.breakpoints=Le(this,this.loadBreakpoints()),this.functionBreakpoints=Le(this,this.loadFunctionBreakpoints()),this.exceptionBreakpoints=Le(this,this.loadExceptionBreakpoints()),this.dataBreakpoints=Le(this,this.loadDataBreakpoints()),this.watchExpressions=Le(this,this.loadWatchExpressions()),this._register(e.onDidChangeValue(1,void 0,this._store)(r=>{if(r.external)switch(r.key){case F$t:return this.breakpoints.set(this.loadBreakpoints(),void 0);case W$t:return this.functionBreakpoints.set(this.loadFunctionBreakpoints(),void 0);case B$t:return this.exceptionBreakpoints.set(this.loadExceptionBreakpoints(),void 0);case V$t:return this.dataBreakpoints.set(this.loadDataBreakpoints(),void 0);case H$t:return this.watchExpressions.set(this.loadWatchExpressions(),void 0)}}))}loadDebugUxState(){return this.storageService.get(Vyo,1,"default")}storeDebugUxState(e){this.storageService.store(Vyo,e,1,1)}loadBreakpoints(){let e;try{e=JSON.parse(this.storageService.get(F$t,1,"[]")).map(t=>(t.uri=A.revive(t.uri),new wv(t,this.textFileService,this.uriIdentityService,this.logService,t.id)))}catch{}return e||[]}loadFunctionBreakpoints(){let e;try{e=JSON.parse(this.storageService.get(W$t,1,"[]")).map(t=>new tI(t,t.id))}catch{}return e||[]}loadExceptionBreakpoints(){let e;try{e=JSON.parse(this.storageService.get(B$t,1,"[]")).map(t=>new SP(t,t.id))}catch{}return e||[]}loadDataBreakpoints(){let e;try{e=JSON.parse(this.storageService.get(V$t,1,"[]")).map(t=>new ZI(t,t.id))}catch{}return e||[]}loadWatchExpressions(){let e;try{e=JSON.parse(this.storageService.get(H$t,1,"[]")).map(t=>new Jc(t.name,t.id))}catch{}return e||[]}loadChosenEnvironments(){let e=JSON.parse(this.storageService.get(Wyo,1,"{}"));return iSe(e,t=>typeof t=="string"?{type:t}:t)}storeChosenEnvironments(e){this.storageService.store(Wyo,JSON.stringify(e),1,1)}storeWatchExpressions(e){e.length?this.storageService.store(H$t,JSON.stringify(e.map(t=>({name:t.name,id:t.getId()}))),1,1):this.storageService.remove(H$t,1)}storeBreakpoints(e){let t=e.getBreakpoints();t.length?this.storageService.store(F$t,JSON.stringify(t),1,1):this.storageService.remove(F$t,1);let o=e.getFunctionBreakpoints();o.length?this.storageService.store(W$t,JSON.stringify(o),1,1):this.storageService.remove(W$t,1);let n=e.getDataBreakpoints().filter(s=>s.canPersist);n.length?this.storageService.store(V$t,JSON.stringify(n),1,1):this.storageService.remove(V$t,1);let r=e.getExceptionBreakpoints();r.length?this.storageService.store(B$t,JSON.stringify(r),1,1):this.storageService.remove(B$t,1)}};UVe=I([m(0,le),m(1,Ho),m(2,dt),m(3,ne)],UVe);var zVe=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})}};zVe=I([m(1,Te)],zVe);var U$t=class extends C{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=FY.bindTo(e),this.loadedScriptsSupportedContextKey=aQe.bindTo(e),this.stepBackSupportedContextKey=lQe.bindTo(e),this.focusedSessionIsAttach=fC.bindTo(e),this.focusedSessionIsNoDebug=wz.bindTo(e),this.restartFrameSupportedContextKey=i_t.bindTo(e),this.stepIntoTargetsSupported=BY.bindTo(e),this.jumpToCursorSupported=Nce.bindTo(e),this.setVariableSupported=cQe.bindTo(e),this.setDataBreakpointAtByteSupported=xke.bindTo(e),this.setExpressionSupported=dQe.bindTo(e),this.multiSessionDebug=a_t.bindTo(e),this.terminateDebuggeeSupported=gP.bindTo(e),this.suspendDebuggeeSupported=zY.bindTo(e),this.terminateThreadsSupported=uQe.bindTo(e),this.disassembleRequestSupported=Eke.bindTo(e),this.focusedStackFrameHasInstructionPointerReference=c_t.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&&Wce(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 KVe=class{constructor(i,e){this.breakpointContribution=i;this.contextKeyService=e;this.breakpointsWhen=typeof i.when=="string"?x.deserialize(i.when):void 0}get language(){return this.breakpointContribution.language}get enabled(){return!this.breakpointsWhen||this.contextKeyService.contextMatchesRules(this.breakpointsWhen)}};KVe=I([m(1,X)],KVe);function z$t(a){a.pattern=a.pattern||"^(?!.*\\$\\{(env|config|command)\\.)",a.patternErrorMessage=a.patternErrorMessage||d(16740,null)}var GVe=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"?x.deserialize(this.debuggerContribution.when):void 0,this.debuggerHiddenWhen=typeof this.debuggerContribution.hiddenWhen=="string"?x.deserialize(this.debuggerContribution.hiddenWhen):void 0}merge(i,e){function t(o,n,r,s=0){return yi(o)?(yi(n)&&Object.keys(n).forEach(l=>{l!=="__proto__"&&(yi(o[l])&&yi(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),sXi(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(9279,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:Y.untitled,path:"1"}))===`\r
`?`\r
`:`
`,o=JSON.stringify(e,null,"	").split(`
`).map(u=>"	"+u).join(t).trim(),n=d(9286,null),r=d(9287,null),s=d(9288,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=jxt(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(9283,null),pattern:"^(?!node2)",deprecationMessage:this.debuggerContribution.deprecated||(this.enabled?void 0:d_t(this.type)),doNotSuggest:!!this.debuggerContribution.deprecated,errorMessage:d(9284,null),patternErrorMessage:d(9289,null)},s.request={enum:[e],description:d(9282,null)};for(let c in i.common.properties)s[c]={$ref:`#/definitions/common/properties/${c}`};Object.keys(s).forEach(c=>{z$t(s[c])}),i[o]={...t},i[n]={type:"object",additionalProperties:!1,properties:DM(s,c=>c!=="type"&&c!=="request"&&c!=="name")};let l={...t};return l.properties={...s,windows:{$ref:`#/definitions/${n}`,description:d(9285,null)},osx:{$ref:`#/definitions/${n}`,description:d(9281,null)},linux:{$ref:`#/definitions/${n}`,description:d(9280,null)}},l}):null}};GVe=I([m(3,B),m(4,sL),m(5,sp),m(6,Vt),m(7,Li),m(8,X),m(9,nt)],GVe);var Uyo=Tn.registerExtensionPoint({extensionPoint:"debuggers",defaultExtensionKind:["workspace"],jsonSchema:{description:d(9320,null),type:"array",defaultSnippets:[{body:[{type:""}]}],items:{additionalProperties:!1,type:"object",defaultSnippets:[{body:{type:"",program:"",runtime:""}}],properties:{type:{description:d(9338,null),type:"string"},label:{description:d(9327,null),type:"string"},program:{description:d(9333,null),type:"string"},args:{description:d(9321,null),type:"array"},runtime:{description:d(9334,null),type:"string"},runtimeArgs:{description:d(9335,null),type:"array"},variables:{description:d(9339,null),type:"object"},initialConfigurations:{description:d(9326,null),type:["array","string"]},languages:{description:d(9328,null),type:"array"},configurationSnippets:{description:d(9323,null),type:"array"},configurationAttributes:{description:d(9322,null),type:"object"},when:{description:d(9340,null),type:"string",default:""},hiddenWhen:{description:d(9325,null),type:"string",default:""},deprecated:{description:d(9324,null),type:"string",default:""},windows:{description:d(9341,null),type:"object",properties:{runtime:{description:d(9342,null),type:"string"}}},osx:{description:d(9331,null),type:"object",properties:{runtime:{description:d(9332,null),type:"string"}}},linux:{description:d(9329,null),type:"object",properties:{runtime:{description:d(9330,null),type:"string"}}},strings:{description:d(9336,null),type:"object",properties:{unverifiedBreakpoints:{description:d(9337,null),type:"string"}}}}}}}),zyo=Tn.registerExtensionPoint({extensionPoint:"breakpoints",jsonSchema:{description:d(9317,null),type:"array",defaultSnippets:[{body:[{language:""}]}],items:{type:"object",additionalProperties:!1,defaultSnippets:[{body:{language:""}}],properties:{language:{description:d(9318,null),type:"string"},when:{description:d(9319,null),type:"string",default:""}}}}}),ZAi={type:"object",description:d(9312,null),properties:{hidden:{type:"boolean",default:!1,description:d(9314,null)},group:{type:"string",default:"",description:d(9313,null)},order:{type:"number",default:1,description:d(9315,null)}},default:{hidden:!1,group:"",order:1}},Hyo={name:"Compound",configurations:[]},Soe={id:VV,type:"object",title:d(9306,null),allowTrailingCommas:!0,allowComments:!0,required:[],default:{version:"0.2.0",configurations:[],compounds:[]},properties:{version:{type:"string",description:d(9307,null),default:"0.2.0"},configurations:{type:"array",description:d(9305,null),items:{defaultSnippets:[],type:"object",oneOf:[]}},compounds:{type:"array",description:d(9303,null),items:{type:"object",required:["name","configurations"],properties:{name:{type:"string",description:d(9301,null)},presentation:ZAi,configurations:{type:"array",default:[],items:{oneOf:[{enum:[],description:d(9316,null)},{type:"object",required:["name"],properties:{name:{enum:[],description:d(9301,null)},folder:{enum:[],description:d(9300,null)}}}]},description:d(9304,null)},stopAll:{type:"boolean",default:!1,description:d(9302,null)},preLaunchTask:{type:"string",default:"",description:d(9308,null)}},default:Hyo},default:[Hyo]},inputs:LLe.definitions.inputs}},JAi=class extends C{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(9309,null),d(9310,null)],n=t.map(r=>[r.label??"",r.type]);return{data:{headers:o,rows:n},dispose:()=>{}}}};oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:"debuggers",label:d(9311,null),access:{canToggle:!1},renderer:new Mt(JAi)});var qrn=oe.as(ea.JSONContribution),$Ve=class extends C{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=fa.bindTo(c),this.debugExtensionsAvailable=n_t.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(H.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(){Uyo.setHandler((e,t)=>{t.added.forEach(o=>{o.value.forEach(n=>{if((!n.type||typeof n.type!="string")&&o.collector.error(d(8846,null)),n.type!=="*"){let r=this.getDebugger(n.type);if(r)r.merge(n,o.description);else{let s=this.instantiationService.createInstance(GVe,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()}),zyo.setHandler(e=>{this.breakpointContributions=e.flatMap(t=>t.value.map(o=>this.instantiationService.createInstance(KVe,o)))})}updateTaskLabels(){this.tasksService.getKnownTasks().then(e=>{this.taskLabels=e.map(t=>t._label),this.updateDebugAdapterSchema()})}updateDebugAdapterSchema(){let e=Soe.properties.configurations.items,t=sk.getJsonSchema(),o={common:{properties:{name:{type:"string",description:d(8845,null),default:"Launch"},debugServer:{type:"number",description:d(8849,null),default:4711},preLaunchTask:{anyOf:[t,{type:["string"]}],default:"",defaultSnippets:[{body:{task:"",type:""}}],description:d(8848,null),examples:this.taskLabels},postDebugTask:{anyOf:[t,{type:["string"]}],default:"",defaultSnippets:[{body:{task:"",type:""}}],description:d(8847,null),examples:this.taskLabels},presentation:ZAi,internalConsoleOptions:u_t,suppressMultipleSessionWarning:{type:"boolean",description:d(8856,null),default:!0}}}};Soe.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)}),qrn.registerSchema(VV,Soe)}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=>mr(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:gt.Warning,message:d(8844,null,n),primaryButton:d(8850,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(8855,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(8853,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(8852,null,n):d(8851,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(8854,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 Eo){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)}};$Ve=I([m(1,ee),m(2,B),m(3,Ge),m(4,F),m(5,ge),m(6,lt),m(7,X),m(8,kt),m(9,ct),m(10,ao),m(11,yg),m(12,qt)],$Ve);var $yo=oe.as(ea.JSONContribution);$yo.registerSchema(VV,Soe);var eNi="debug.selectedconfigname",tNi="debug.selectedroot",Kyo="debug.selectedtype",iNi="debug.recentdynamicconfigurations",qVe="onDebugDynamicConfigurations",jVe=class{constructor(i,e,t,o,n,r,s,l,c,u,p){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.logService=p;this.getSelectedConfig=()=>Promise.resolve(void 0);this.selectedDynamic=!1;this._onDidSelectConfigurationName=new E;this._onDidChangeConfigurationProviders=new E;this.onDidChangeConfigurationProviders=this._onDidChangeConfigurationProviders.event;this.configProviders=[],this.toDispose=[this._onDidChangeConfigurationProviders,this._onDidSelectConfigurationName],this.initLaunches(),this.setCompoundSchemaValues(),this.registerListeners();let h=this.storageService.get(tNi,1),g=this.storageService.get(Kyo,1),f=this.launches.find(S=>S.uri.toString()===h),v=this.storageService.get(eNi,1);this.debugConfigurationTypeContext=YYi.bindTo(u);let b=g?{type:g}:void 0;f&&f.getConfigurationNames().length?this.selectConfiguration(f,v,void 0,b):this.launches.length>0&&this.selectConfiguration(void 0,v,void 0,b)}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 Tpt(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===qVe?n=!0:r.startsWith(`${qVe}:`)&&o.push(r.slice(qVe.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(qVe,e),this.configProviders.find(t=>t.type===e&&t.triggerKind===2&&t.provideDebugConfigurations)),type:e,pick:async()=>{await this.adapterManager.activateDebuggers(qVe,e);let t=new P,o=new $e;t.add(o);let n=t.add(this.quickInputService.createQuickPick());n.busy=!0,n.placeholder=d(8919,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=ve.None){await this.adapterManager.activateDebuggers(qVe,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(hRe),tooltip:d(8918,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 Qdi(i)}removeRecentDynamicConfigurations(i,e){let t=this.getRecentDynamicConfigurations().filter(o=>o.name!==i||o.type!==e);this.storageService.store(iNi,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(iNi,1,"[]"))}registerListeners(){this.toDispose.push(H.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(rst,this,this.adapterManager,i)),this.contextService.getWorkbenchState()===3&&this.launches.push(this.instantiationService.createInstance(QVe,this,this.adapterManager)),this.launches.push(this.instantiationService.createInstance(YVe,this,this.adapterManager)),this.selectedLaunch&&this.launches.indexOf(this.selectedLaunch)===-1&&this.selectConfiguration(void 0)}setCompoundSchemaValues(){let i=Soe.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,$yo.registerSchema(VV,Soe)}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(tNi,this.selectedLaunch.uri.toString(),1,1):this.storageService.remove(tNi,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 $e,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=Uo(u,p=>`${p.name} : ${p.type}`),this.storageService.store(iNi,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(Kyo,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(eNi,this.selectedName,1,1):this.storageService.remove(eNi,1)}dispose(){this.toDispose=Ue(this.toDispose)}};jVe=I([m(1,Pe),m(2,B),m(3,Ge),m(4,F),m(5,le),m(6,lt),m(7,zs),m(8,dt),m(9,X),m(10,ne)],jVe);var sst=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=[];return e.configurations&&t.push(...e.configurations.filter(o=>o&&typeof o.name=="string")),i?t.map(o=>o.name):(e.compounds&&t.push(...e.compounds.filter(o=>typeof o.name=="string"&&o.configurations&&o.configurations.length)),Qdi(t).map(o=>o.name))}}getConfiguration(i){let e=this.getDeduplicatedConfig();if(!e||!e.configurations)return;let t=e.configurations.find(o=>o&&o.name===i);if(t)return this instanceof YVe?{...t,__configurationTarget:2}:this instanceof QVe?{...t,__configurationTarget:5}:{...t,__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||ve.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&&Gyo(i.compounds),configurations:i.configurations&&Gyo(i.configurations)}}};function Gyo(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 rst=class extends sst{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 je(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(8917,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}},Un)??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)}};rst=I([m(3,be),m(4,Ho),m(5,ee),m(6,B)],rst);var QVe=class extends sst{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(8921,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",Ur(l),5);else return{editor:null,created:!1}}return{editor:await this.editorService.openEditor({resource:this.contextService.getWorkspace().configuration,options:{preserveFocus:e}},Un)??null,created:!1}}};QVe=I([m(2,ee),m(3,B),m(4,Pe)],QVe);var YVe=class extends sst{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(8920,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}}};YVe=I([m(2,B),m(3,Po)],YVe);var jrn=/range=([0-9]+):([0-9]+)/,K$t=class extends C{constructor(e){super();this.debugService=e;this.memoryFdCounter=0;this.fdMemory=new Map;this.changeEmitter=this._register(new E);this.onDidChangeCapabilities=H.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 P;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 Jr("Not allowed","NoPermissions")}readdir(){throw Jr("Not allowed","NoPermissions")}delete(){throw Jr("Not allowed","NoPermissions")}rename(){throw Jr("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 oNi(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 Jr("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 Jr("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 Jr("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 Jr(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:Hr(u)}return c}write(e,t,o,n,r){let s=this.fdMemory.get(e);if(!s)throw Jr("No file with that descriptor open","Unavailable");return s.region.write(t,Je.wrap(o).slice(n,n+r))}parseUri(e){if(e.scheme!==Fce)throw Jr(`Cannot open file with scheme ${e.scheme}`,"EntryNotFound");let t=this.debugService.getModel().getSession(e.authority);if(!t)throw Jr("Debug session not found","EntryNotFound");let o,n=jrn.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)}}},oNi=class extends C{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=Kn(o.fromOffset-t.fromOffset,0,this.width),r=Kn(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 XVe=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 P;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(9106,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:St.Warning,message:d(9102,null),primaryButton:d(9103,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")&&!GY(t.path)&&(s=GY(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(9105,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 ho;let t=i?.body?.error,o=i?.message||"",n=t?nXi(t.format,!1,t.variables):o,r=t?.url;if(t&&r){let l=t.urlLabel?t.urlLabel:d(9104,null),c=A.parse(r),u=c.scheme===Y.command?"debug.moreInfo.command":"debug.moreInfo";return dU(n,[pi({id:u,label:l,run:()=>this.openerService.open(c,{allowCommands:!0})})])}e&&t&&t.format&&t.showUser&&this.notificationService.error(n);let s=new Zs(n);return s.showUser=t?.showUser,s}mergeCapabilities(i){i&&(this._capabilities=Nu(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()}};XVe=I([m(4,SD),m(5,Qe),m(6,Ne),m(7,ct)],XVe);var Qrn=1500,JVe=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N){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=N;this.initialized=!1;this.sources=new Map;this.threads=new Map;this.threadIds=[];this.cancellationMap=new Map;this.rawListeners=new P;this.globalDisposables=new P;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 nNi);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 pUt(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(),Ue(O)})),this.correlatedTestRun=n?.testRun?T.getResult(n.testRun.runId):this.parentSession?.correlatedTestRun,this.correlatedTestRun&&O.add(this.correlatedTestRun.onComplete(()=>this.terminate()));let U=this._options.compoundRoot;U&&O.add(U.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 te=this.getStoppedDetails()?.threadId,pe=typeof te=="number"?this.getThread(te):void 0;this.debugService.focusStackFrame(void 0,pe)}}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 b_t(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} (${Ra(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(XVe,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:Dr,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(9044,null,"launch or attach"));if(this.parentSession&&this.parentSession.state===0)throw CI();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(9044,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(9044,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(9044,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(9044,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(9045,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(9044,null,"data breakpoints info"));if(!this.raw.readyForBreakpoints)throw new Error(d(9046,null));return(await this.raw.dataBreakpointInfo(i))?.body}async sendDataBreakpoints(i){if(!this.raw)throw new Error(d(9044,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(mo)});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(9044,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(9044,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 Uo(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(9044,null,i));return this.raw.custom(i,e)}stackTrace(i,e,t,o){if(!this.raw)throw new Error(d(9044,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(9044,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(9044,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(9044,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(9044,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(9044,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(9044,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(9044,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(9044,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(9044,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(9044,null,"continue"));await this.raw.continue({threadId:i})}async reverseContinue(i){if(await this.waitForTriggeredBreakpoints(),!this.raw)throw new Error(d(9044,null,"reverse continue"));await this.raw.reverseContinue({threadId:i})}async pause(i){if(!this.raw)throw new Error(d(9044,null,"pause"));await this.raw.pause({threadId:i})}async terminateThreads(i){if(!this.raw)throw new Error(d(9044,null,"terminateThreads"));await this.raw.terminateThreads({threadIds:i})}setVariable(i,e,t){if(!this.raw)throw new Error(d(9044,null,"setVariable"));return this.raw.setVariable({variablesReference:i,name:e,value:t})}setExpression(i,e,t){if(!this.raw)throw new Error(d(9044,null,"setExpression"));return this.raw.setExpression({expression:e,value:t,frameId:i})}gotoTargets(i,e,t){if(!this.raw)throw new Error(d(9044,null,"gotoTargets"));return this.raw.gotoTargets({source:i,line:e,column:t})}goto(i,e){if(!this.raw)throw new Error(d(9044,null,"goto"));return this.raw.goto({threadId:i,targetId:e})}loadSource(i){if(!this.raw)return Promise.reject(new Error(d(9044,null,"loadSource")));let e=this.getSourceForUri(i),t;if(e)t=e.raw;else{let o=Ez.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(9044,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(9044,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(9044,null,"stepInTargets")))}async cancel(i){return this.raw?this.raw.cancel({progressId:i}):Promise.reject(new Error(d(9044,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(9044,null,"disassemble")))}readMemory(i,e,t){return this.raw?this.raw.readMemory({count:t,memoryReference:i,offset:e}):Promise.reject(new Error(d(9044,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(9044,null,"disassemble")))}async resolveLocationReference(i){if(!this.raw)throw new Error(d(9044,null,"locations"));let e=await this.raw.locations({locationReference:i});if(!e?.body)throw new Error(d(9044,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=[],vP.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 bP(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 Wp(this._waitToResume,Qrn)}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()=>{Or(this.configuration.noDebug?d(9042,null):d(9041,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=>{Or(d(9043,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 Op;this.rawListeners.add(this.raw.onDidOutput(async t=>{let o=t.body.category==="stderr"?gt.Error:t.body.category==="console"?gt.Warning:gt.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 vP(this,void 0,t.body.variablesReference,_t()).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=rXi(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(jh,0),this.configurationService.getValue("debug").focusWindowOnBreak&&!this.workbenchEnvironmentService.extensionTestsLocationURI&&(Ki().document.hasFocus()||await this.hostService.focus(It,{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||kz(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 Ez(i,this.getId(),this.uriIdentityService,this.logService),t=e.uri.toString(),o=this.sources.get(t);return o?(e=o,e.raw=Nu(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=Ez.getEncodedDebugData(i);return{name:t.name,path:t.path,sourceReference:t.sourceReference}}}getNewCancellationToken(i,e){let t=new $e(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})}};JVe=I([m(5,Li),m(6,Te),m(7,oi),m(8,B),m(9,ds),m(10,Pe),m(11,nt),m(12,Ne),m(13,ao),m(14,dt),m(15,F),m(16,mmt),m(17,Vt),m(18,ne),m(19,Es),m(20,ed),m(21,Bi)],JVe);var nNi=class extends C{constructor(){super(...arguments);this.pendingCancellations=[];this.threadOps=this._register(new jt)}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 $e;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 wr;(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"))(wr||={});var mp;(u=>(u.MarkersViewModeContextKey=new Q("problemsViewMode","tree"),u.MarkersTreeVisibilityContextKey=new Q("problemsVisibility",!1),u.MarkerFocusContextKey=new Q("problemFocus",!1),u.MarkerViewFilterFocusContextKey=new Q("problemsFilterFocus",!1),u.RelatedInformationFocusContextKey=new Q("relatedInformationFocus",!1),u.ShowErrorsFilterContextKey=new Q("problems.filter.errors",!0),u.ShowWarningsFilterContextKey=new Q("problems.filter.warnings",!0),u.ShowInfoFilterContextKey=new Q("problems.filter.info",!0),u.ShowActiveFileFilterContextKey=new Q("problems.filter.activeFile",!1),u.ShowExcludedFilesFilterContextKey=new Q("problems.filter.excludedFiles",!0)))(mp||={});var rNi=(a,i)=>H.once(H.filter(a,i));var qyo="debug.taskerrorchoice",jyo=d(9053,null),Yrn=d(9055,null),Xrn=d(9056,null),ZVe=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 $e}cancel(){this.globalCancellation.dispose(!0),this.globalCancellation=new $e}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(wr.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(9061,null,l):o===1?d(9060,null,l):t&&typeof t.exitCode=="number"?d(9062,null,l,t.exitCode):d(9063,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:gt.Warning,message:c,buttons:[{label:Yrn,run:()=>1},{label:d(9067,null),run:()=>2}],cancelButton:{label:jyo,run:()=>0},checkbox:{label:d(9064,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(wr.MARKERS_VIEW_ID,!0),Promise.resolve(0))}catch(t){let o=this.taskService.configureAction(),n=JSON.parse(this.storageService.get(qyo,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:gt.Error,message:t.message,buttons:[{label:d(9055,null),run:()=>0},{label:o.label,run:()=>1}],cancelButton:{run:()=>2},checkbox:{label:d(9065,null)}});r=l,c&&(n[t.message]=r,this.storageService.store(qyo,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(9059,null,typeof e=="string"?e:e.type)));let o=await this.taskService.getTask(i,e);if(!o){let g=typeof e=="string"?d(9058,null,e):d(9057,null);return Promise.reject(dU(g,[pi({id:E2,label:jAe,enabled:!0,run:()=>this.commandService.executeCommand(E2)})]))}let n=!1,r=new P,s=g=>g.getKey()??g.getMapKey(),l=s(o),c=new Promise(g=>r.add(rNi(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(rNi(this.taskService.onDidStateChange,g=>(g.kind==="active"||g.kind==="dependsOnStarted")&&s(g.__task)===l)(()=>{n=!0}));let u=r.add(new E);r.add(rNi(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(nn(()=>{if(!n){let S=d(9068,null,typeof e=="string"?e:JSON.stringify(e));f({severity:gt.Error,message:S})}},v)),this.configurationService.getValue("debug").hideSlowPreLaunchWarning||r.add(nn(()=>{let S=d(9066,null,o.configurationProperties.name),y=[Xrn,jyo],w=o instanceof pd||o instanceof tf;w&&y.splice(1,0,d(9054,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())}};ZVe=I([m(0,yg),m(1,Ns),m(2,B),m(3,Ft),m(4,ct),m(5,le),m(6,ge),m(7,Bo)],ZVe);var eBe=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 P;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($Ve,{onDidNewSession:this.onDidNewSession,configurationManager:()=>this.configurationManager}),this.disposables.add(this.adapterManager),this.configurationManager=this.instantiationService.createInstance(jVe,this.adapterManager),this.disposables.add(this.configurationManager),this.debugStorage=this.disposables.add(this.instantiationService.createInstance(UVe)),this.chosenEnvironments=this.debugStorage.loadChosenEnvironments(),this.model=this.instantiationService.createInstance(_ke,this.debugStorage),this.telemetry=this.instantiationService.createInstance(zVe,this.model),this.viewModel=this.disposables.add(new U$t(c)),this.taskRunner=this.instantiationService.createInstance(ZVe),this.disposables.add(this.fileService.onDidFilesChange(N=>this.onFileChanges(N))),this.disposables.add(this.lifecycleService.onWillShutdown(this.dispose,this)),this.disposables.add(this.extensionHostDebugService.onAttachSession(N=>{let O=this.model.getSession(N.sessionId,!0);O&&(O.configuration.request="attach",O.configuration.port=N.port,O.setSubId(N.subId),this.launchOrAttachToSession(O))})),this.disposables.add(this.extensionHostDebugService.onTerminateSession(N=>{let O=this.model.getSession(N.sessionId);O&&O.subId===N.subId&&O.disconnect()})),this.disposables.add(this.viewModel.onDidFocusStackFrame(()=>{this.onStateChange()})),this.disposables.add(this.viewModel.onDidFocusSession(N=>{this.onStateChange(),N&&this.setExceptionBreakpointFallbackSession(N.getId())})),this.disposables.add(H.any(this.adapterManager.onDidRegisterDebugger,this.configurationManager.onDidSelectConfiguration)(()=>{let N=this.state!==0||this.configurationManager.getAllConfigurations().length>0&&this.adapterManager.hasEnabledDebuggers()?"default":"simple";this.debugUx.set(N),this.debugStorage.storeDebugUxState(N)})),this.disposables.add(this.model.onDidChangeCallStack(()=>{let N=this.model.getSessions().filter(O=>!O.parentSession).length;if(this.activity?.dispose(),N>0){let O=this.viewDescriptorService.getViewContainerByViewId(qj);O&&(this.activity=this.activityService.showViewContainerActivity(O.id,{badge:new qc(N,V=>V===1?d(9019,null):d(9036,null,V))}))}})),this.disposables.add(i.onDidActiveEditorChange(()=>{this.contextKeyService.bufferChangeEvents(()=>{i.activeEditor===nR.instance?this.disassemblyViewFocus.set(!0):this.disassemblyViewFocus?.reset()})})),this.disposables.add(this.lifecycleService.onBeforeShutdown(()=>{for(let N of i.editors)N.resource?.scheme===Fce&&N.dispose()})),this.disposables.add(h.onWillStop(N=>{N.veto(this.model.getSessions().length>0,d(9020,null))})),this.initContextKeys(c)}initContextKeys(i){queueMicrotask(()=>{i.bufferChangeEvents(()=>{this.debugType=wke.bindTo(i),this.debugState=Fs.bindTo(i),this.hasDebugged=XTt.bindTo(i),this.inDebugMode=Xa.bindTo(i),this.debugUx=hP.bindTo(i),this.debugUx.set(this.debugStorage.loadDebugUxState()),this.breakpointsExist=jj.bindTo(i),this.disassemblyViewFocus=xz.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(oR(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(Fce,this.disposables.add(new K$t(this)))),this.haveDoneLazySetup=!0)}async startDebugging(i,e,t,o=!t?.parentSession){let n=t&&t.noDebug?d(9040,null):d(9029,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 mQe(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(9023,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 O$t});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(9037,null,g):d(9034,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(9038,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(9024,null,typeof e=="string"?e:e.name):d(9033,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=Xi(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 $e,c=_t();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(9028,null,"request",u.request):d(9027,null,"request"):y=p.type?d(9031,null,p.type):d(9030,null);let w=[];return w.push(pi({id:"installAdditionalDebuggers",label:d(9032,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(d_t(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(9039,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(JVe,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(jh,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(ld,!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(so(l)||(r&&r.getReplElements().length>0&&this.viewsService.openView(ld,!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,A6(l)?l.actions:[]),!1}}async confirmConcurrentSession(i){return(await this.dialogService.confirm({message:d(9035,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 P;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(9025,null,o.error.message||o.error.toString())),this.telemetry.logDebugSessionStop(i,o));let n=pQe(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===vC&&i.getId()===Ez.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}=Qyo(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(Hf,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(ld);l&&this.viewsService.isViewContainerVisible(l.id)&&this.viewsService.closeViewContainer(l.id)}this.model.removeExceptionBreakpointsForSession(i.getId())}))}async restartSession(i,e){i.saveBeforeRestart&&await mQe(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=pQe(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&&!uo(s,i.unresolvedConfiguration)&&(s.noDebug=i.configuration.noDebug,r=!0));let c=i.configuration;if(l&&r&&s){let h=new $e;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 H.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!==t6&&this.showError(n.message,void 0,!!i?.getConfiguration(e.name));return}}return Promise.resolve(e)}async showError(i,e=[],t=!0){let o=pi({id:E2,label:jAe,enabled:!0,run:()=>this.commandService.executeCommand(E2)}),n=e.filter(r=>r.id.endsWith(".command")).length>0?e:[...e,...t?[o]:[]];await this.dialogService.prompt({type:gt.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}=Qyo(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!==nR.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);Jo(d(9026,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 wv?(await this.makeTriggeredBreakpointsMatchEnablement(i,e),await this.sendBreakpoints(e.originalUri)):e instanceof tI?await this.sendFunctionBreakpoints():e instanceof ZI?await this.sendDataBreakpoints():e instanceof iI?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=>Or(d(9021,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=>Or(d(9022,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=Uo(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 ast(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 ast(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 ast(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 ast(this.model,i,async t=>{t.capabilities.supportsInstructionBreakpoints&&!t.configuration.noDebug&&await t.sendInstructionBreakpoints(e)})}sendExceptionBreakpoints(i){return ast(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(Xi(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 Wp(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}}};eBe=I([m(0,ee),m(1,ds),m(2,Ft),m(3,Ri),m(4,Ne),m(5,ct),m(6,fi),m(7,Pe),m(8,X),m(9,ao),m(10,F),m(11,lt),m(12,be),m(13,B),m(14,SD),m(15,zl),m(16,ge),m(17,Ge),m(18,Vd),m(19,dt),m(20,Es)],eBe);function Qyo(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 ast(a,i,e){i?await e(i):await Promise.all(a.getSessions().map(t=>e(t)))}oe.as(rp.ConfigurationMigration).registerConfigurationMigrations([{key:"debug.autoExpandLazyVariables",migrateFn:a=>a===!0?{value:"on"}:a===!1?{value:"off"}:[]}]);var tBe=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(9052,null),text:"$(debug-alt-small) "+i,ariaLabel:d(9050,null,i),tooltip:d(9051,null),command:"workbench.action.debug.selectandstart"}}dispose(){this.entryAccessor?.dispose(),Ue(this.toDispose)}};tBe=I([m(0,Tr),m(1,Li),m(2,B)],tBe);var iBe=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(){Ue(this.toDispose)}};iBe=I([m(0,Li),m(1,oi),m(2,qP)],iBe);var sNi="debugStartLanguage",Jrn=new Q(sNi,void 0),Yyo=new Q("debuggerInterestedInActiveEditor",!1),AD=class extends zr{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=Jrn.bindTo(s),this.debuggerInterestedContext=Yyo.bindTo(s);let v=g.get(sNi,1);this.debugStartLanguageContext.set(v);let b=()=>{let y=this.editorService.activeTextEditorControl;if(Ec(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(sNi,k,1,1);return}}this.debuggerInterestedContext.set(!1)},S=new P;this._register(S),this._register(c.onDidActiveEditorChange(()=>{S.clear();let y=this.editorService.activeTextEditorControl;Ec(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(),Xyo=this.keybindingService.appendKeybinding("",d0)}static{this.ID="workbench.debug.welcome"}static{this.LABEL=L(9208,"Run")}shouldShowWelcome(){return!0}};AD=I([m(1,De),m(2,_e),m(3,ze),m(4,B),m(5,X),m(6,Li),m(7,ee),m(8,F),m(9,Ri),m(10,Qe),m(11,le),m(12,tt)],AD);var lst=oe.as(on.ViewsRegistry);lst.registerViewWelcomeContent(AD.ID,{content:d(9207,null,t_e.ID),when:x.and(fa,Yyo.toNegated()),group:"2_open"});var Xyo="";lst.registerViewWelcomeContent(AD.ID,{content:`[${d(9209,null)}${Xyo}](command:${d0})`,when:fa,group:"4_debug",order:1});lst.registerViewWelcomeContent(AD.ID,{content:d(9205,null,`${ic(E2,{addNew:!0}).toString()}`),when:x.and(fa,Qa.notEqualsTo("empty")),group:"4_debug"});lst.registerViewWelcomeContent(AD.ID,{content:d(9206,null,ic(nK.ID).toString()),when:x.and(fa,Qa.isEqualTo("empty")),group:"4_debug"});lst.registerViewWelcomeContent(AD.ID,{content:d(9204,null),when:n_t.toNegated(),group:"4_debug"});var oBe=class extends Ha{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super(jh,{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 P);this._register(this.debugService.onDidChangeState(S=>this.onDebugServiceStateChange(S))),this._register(this.contextKeyService.onDidChangeContext(S=>{S.affectsSome(new Set([Udi,"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(AD.ID)}getActionViewItem(e,t){if(e.id===d0)return this.startDebugActionViewItem=this.instantiationService.createInstance(uWe,null,e,t),this.startDebugActionViewItem;if(e.id===qAe)return new nG(e,void 0,this.debugService,this.contextViewService,this.configurationService);if(e.id===uT||e.id===GR){this.stopActionViewItemDisposables.clear();let o=this.instantiationService.invokeFunction(n=>ost(e,this.stopActionViewItemDisposables,n,{hoverDelegate:t.hoverDelegate}));if(o)return o}return Ca(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:jh},t=>new Promise(o=>this.progressResolve=o))}addPanes(e){super.addPanes(e);for(let{pane:t}of e)t.id===Xx?(this.breakpointView=t,this.updateBreakpointsMaxSize()):this.paneListeners.set(t.id,t.onDidChange(()=>this.updateBreakpointsMaxSize()))}removePanes(e){super.removePanes(e);for(let t of e)Ue(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}}};oBe=I([m(0,fi),m(1,Te),m(2,Bo),m(3,Li),m(4,F),m(5,Pe),m(6,le),m(7,De),m(8,ze),m(9,lt),m(10,B),m(11,_n),m(12,X),m(13,Ri),m(14,ne)],oBe);fe.appendMenuItem(D.ViewContainerTitle,{when:x.and(x.equals("viewContainer",jh),hP.notEqualsTo("simple"),Qa.notEqualsTo("empty"),x.or(Fs.isEqualTo("inactive"),x.notEquals("config.debug.toolBarLocation","docked")),x.or(x.not("config.debug.hideLauncherWhileDebugging"),x.not("inDebugMode"))),order:10,group:"navigation",command:{precondition:Fs.notEqualsTo(oR(1)),id:d0,title:Htt}});W(class extends K{constructor(){super({id:E2,title:{value:jAe,original:"Open 'launch.json'",mnemonicTitle:d(9073,null)},metadata:{description:L(9074,"Opens the file used to configure how your program is debugged")},f1:!0,icon:hRe,precondition:hP.notEqualsTo("simple"),menu:[{id:D.ViewContainerTitle,group:"navigation",order:20,when:x.and(x.equals("viewContainer",jh),hP.notEqualsTo("simple"),Qa.notEqualsTo("empty"),x.or(Fs.isEqualTo("inactive"),x.notEquals("config.debug.toolBarLocation","docked")))},{id:D.ViewContainerTitle,order:20,when:x.and(x.equals("viewContainer",jh),Fs.notEqualsTo("inactive"),x.equals("config.debug.toolBarLocation","docked"))},{id:D.MenubarDebugMenu,group:"2_configuration",order:1,when:fa}]})}async run(a,i){let e=a.get(Li),t=a.get(Ge),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(9075,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(gV)?.addLaunchConfiguration()}}}});W(class extends K{constructor(){super({id:"debug.toggleReplIgnoreFocus",title:d(9072,null),toggled:x.has(`view.${ld}.visible`),menu:[{id:T5,group:"3_toggleRepl",order:30,when:x.and(x.equals("viewContainer",jh))}]})}async run(a){let i=a.get(Ft);i.isViewVisible(ld)?i.closeView(ld):await i.openView(ld)}});fe.appendMenuItem(D.ViewContainerTitle,{when:x.and(x.equals("viewContainer",jh),Fs.notEqualsTo("inactive"),x.or(x.equals("config.debug.toolBarLocation","docked"),x.has("config.debug.hideLauncherWhileDebugging"))),order:10,command:{id:V3,title:d(9076,null)}});var Jyo=!0,Zrn=/^[a-zA-Z][a-zA-Z0-9\+\-\.]+:/,tQ=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 Ioe&&i?" \u2022 ":Lo.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 Jyo?this instanceof $$t:!(this instanceof Ioe)&&!(this instanceof yoe)}},Ioe=class extends tQ{constructor(e,t){super(e,t.name,!0);this.folder=t}},$$t=class extends tQ{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 yoe(this._labelService,this,e,this._pathService,this._contextService))}find(e){return this.getChild(e.getId())}},yoe=class a extends tQ{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 Ioe)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&&Zrn.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(Xl(n)){let l=A.file(n);t=this.rootProvider?this.rootProvider.getWorkspaceFolder(l):null,t?(n=th(Hw(l.path.substring(t.uri.path.length),Lo.sep)),this.rootProvider.getWorkspace().folders.length>1?n=Lo.sep+n:t=null):(n=th(n),ri?n=Hp(n):n=Z$e(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 Ioe(p,u))}else c===0&&o?s=s.createIfNeeded(o,u=>new tQ(u,o)):s=s.createIfNeeded(l,u=>new tQ(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 Zyo(a,i){let e=a.getChildren(),t=i?!i.expanded.has(a.getId()):!(a instanceof yoe);return{element:a,collapsed:t,collapsible:a.hasChildren(),children:e.map(o=>Zyo(o,i))}}var nBe=class extends zr{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=JYi.bindTo(c)}renderBody(e){super.renderBody(e),this.element.classList.add("debug-pane"),e.classList.add("debug-loaded-scripts","show-file-icons"),this.treeContainer=cte(e),this.filter=new cNi;let t=new $$t(this.pathService,this.contextService,this.labelService);this.treeLabels=this.instantiationService.createInstance(Za,{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(PL,"LoadedScriptsView",this.treeContainer,new aNi,[new q$t(this.treeLabels)],{compressionEnabled:Jyo,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 lNi,overrideStyles:this.getLocationBasedColors().listOverrideStyles});let n=p=>this.tree.setChildren(null,Zyo(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 tQ){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 yoe?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 jt),c=p=>{let h=new P;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"&&fH.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(){Ue(this.tree),Ue(this.treeLabels),super.dispose()}};nBe=I([m(1,ze),m(2,_e),m(3,F),m(4,Ri),m(5,B),m(6,ee),m(7,X),m(8,Pe),m(9,Li),m(10,ot),m(11,wn),m(12,Qe),m(13,De),m(14,tt)],nBe);var aNi=class{getHeight(i){return 22}getTemplateId(i){return q$t.ID}},q$t=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 Ioe)r.fileKind=2;else if(i instanceof yoe)r.title=d(9099,null),r.hideIcon=!0;else if(i instanceof tQ){let s=i.getSource();s&&s.uri?(n.resource=s.uri,r.fileKind=0):r.fileKind=1}r.matches=ua(o),t.label.setResource(n,r)}disposeTemplate(i){i.label.dispose()}},lNi=class{getWidgetAriaLabel(){return d(9096,null)}getAriaLabel(i){return i instanceof Ioe?d(9098,null,i.getLabel()):i instanceof yoe?d(9100,null,i.getLabel()):i.hasChildren()?d(9097,null,i.getLabel()):d(9101,null,i.getLabel())}},cNi=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 Fn{constructor(){super({id:"loadedScripts.collapse",viewId:Ace,title:d(9095,null),f1:!1,icon:M.collapseAll,menu:{id:D.ViewTitle,order:30,group:"navigation",when:x.equals("view",Ace)}})}runInView(i,e){e.collapseAll()}});var j$t=class{constructor(){this.priority=120;this.name="replHelp";this.when=x.or(x.equals("focusedView","workbench.panel.repl.view"),BO);this.type="help"}getProvider(i){let e=i.get(Ft),t=Oie(e);if(t)return new dNi(t)}},dNi=class extends C{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(9138,null)),e.push(d(9127,null)),e.push(""),e.push(d(9157,null)),e.push(d(9156,null)),e.push(""),e.push(d(9140,null)),e.push(d(9139,null)),e.push(""),e.push(d(9133,null)),e.push(d(9132,null)),e.push(""),e.push(d(9137,null)),e.push(d(9134,null)),e.push(d(9135,null)),e.push(d(9136,null)),e.push(""),e.push(d(9130,null)),e.push(d(9129,null)),e.push(d(9128,null)),e.push(d(9131,null,"<keybinding:workbench.panel.repl.view.focus>")),e.push(""),e.push(d(9159,null)),e.push(d(9160,null)),e.push(d(9158,null)),e.push(""),e.push(d(9141,null)),e.push(d(9142,null)),e.push(d(9145,null)),e.push(d(9143,null)),e.push(d(9144,null,"<keybinding:workbench.panel.repl.view.focus>")),e.push(""),e.push(d(9152,null,"<keybinding:workbench.action.openSettings>")),e.push(d(9153,null)),e.push(d(9154,null)),e.push(d(9146,null)),e.push(d(9149,null)),e.push(d(9148,null)),e.push(d(9155,null)),e.push(d(9150,null)),e.push(d(9147,null)),e.push(d(9151,null)),e.push(""),e.push(d(9126,null)),e.push(d(9125,null)),e.join(`
`)}};var Q$t=class{constructor(){this.priority=70;this.name="debugConsole";this.when=x.equals("focusedView","workbench.panel.repl.view");this.type="view"}getProvider(i){let e=i.get(Ft),t=i.get(Wd),o=Oie(e);if(!o)return;let n=o.getFocusedElement();return new cst(o,n,t)}},cst=class extends C{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 Ie(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 Ie(o,1)),s.push("  "+c.toString()),o++}n.push(s.join(`
`))}this._content=n.join(`
`),this._onDidResolveChildren.fire()}};cst=I([m(2,Wd)],cst);var Y$t=class{constructor(){this.priority=120;this.name="runAndDebugHelp";this.when=x.or(x.and(x.equals("activeViewlet","workbench.view.debug"),sV),x.equals(Vl.key,Iz),x.equals(Vl.key,Yx),x.equals(Vl.key,qj),x.equals(Vl.key,Ace),x.equals(Vl.key,Xx));this.type="help"}getProvider(i){return new dst(i.get(ge),i.get(Ft))}},dst=class extends C{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(9173,null,"<keybinding:workbench.view.debug>"),d(9174,null,"<keybinding:workbench.action.debug.start>"),d(9171,null,"<keybinding:workbench.panel.repl.view.focus>"),gc.setBreakpoint,gc.addToWatch,d(9181,null),d(9172,null,"<keybinding:workbench.action.debug.restart>"),d(9178,null,"<keybinding:workbench.action.debug.stop>"),d(9166,null,"<keybinding:workbench.action.debug.continue>"),d(9175,null,"<keybinding:workbench.action.debug.stepInto>"),d(9177,null,"<keybinding:workbench.action.debug.stepOver>"),d(9176,null,"<keybinding:workbench.action.debug.stepOut>"),d(9179,null),d(9167,null,"<keybinding:workbench.debug.action.focusBreakpointsView>"),d(9168,null,"<keybinding:workbench.debug.action.focusCallStackView>"),d(9169,null,"<keybinding:workbench.debug.action.focusVariablesView>"),d(9170,null,"<keybinding:workbench.debug.action.focusWatchView>"),d(9180,null,"accessibility.debugWatchVariableAnnouncements")].join(`
`)}};dst=I([m(0,ge),m(1,Ft)],dst);var ewo=J("statusBar.debuggingBackground",{dark:"#CC6633",light:"#CC6633",hcDark:"#BA592C",hcLight:"#B5200D"},d(9183,null)),esn=J("statusBar.debuggingForeground",{dark:jL,light:jL,hcDark:jL,hcLight:"#FFFFFF"},d(9185,null)),tsn=J("statusBar.debuggingBorder",dce,d(9184,null)),isn=J("commandCenter.debuggingBackground",ei(ewo,.258),d(9182,null),!0),rBe=class{constructor(i,e,t,o){this.debugService=i;this.contextService=e;this.statusbarService=t;this.configurationService=o;this.disposables=new P;this.styleSheet=hr();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:esn,background:ewo,border:tsn}):(this.disposable.dispose(),this.disposable=void 0))}update(){let i=this.configurationService.getValue("debug"),e=osn(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 {
				${TN(C7i)}: ${wt(isn)};
			}
		`:""}dispose(){this.disposable?.dispose(),this.disposables.dispose()}};rBe=I([m(0,Li),m(1,Pe),m(2,Tr),m(3,B)],rBe);function osn(a,i){return!(a===0||a===1||i.every(e=>e.suppressDebugStatusbar||e.configuration?.noDebug))}var nsn=1024,uNi=!1,pNi=!1,sBe=class extends zr{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=sQe.bindTo(c),this.watchExpressionsExist.set(this.debugService.getModel().getWatchExpressions().length>0),this.expressionRenderer=r.createInstance($R)}get treeSelection(){return this.tree.getSelection()}renderBody(e){super.renderBody(e),this.element.classList.add("debug-pane"),e.classList.add("debug-watch");let t=cte(e),o=this.instantiationService.createInstance(woe,this.expressionRenderer);this.tree=this.instantiationService.createInstance(nu,"WatchExpressions",t,new mNi,[o,this.instantiationService.createInstance(qR,this.expressionRenderer),this.instantiationService.createInstance(Ek,this.expressionRenderer)],this.instantiationService.createInstance(hNi),{accessibilityProvider:new fNi,identityProvider:{getId:r=>r.getId()},keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:r=>{if(r!==this.debugService.getViewModel().getSelectedExpression()?.expression)return dUt.getKeyboardNavigationLabel(r)}},dnd:new vNi(this.debugService),overrideStyles:this.getLocationBasedColors().listOverrideStyles}),this._register(this.tree),this.tree.setInput(this.debugService),rQe.bindTo(this.tree.contextKeyService),this._register(Ek.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&&(pNi=!0),await this.tree.updateChildren(),pNi=!1,r instanceof Jc&&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(()=>{uNi||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 Hl&&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 Jc&&t!==o?.expression||t instanceof rR&&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 rsn(this.contextKeyService,t,this.debugService,this.logService),r=this.menuService.getMenuActions(D.DebugWatchContext,n,{arg:t,shouldForwardArgs:!1}),{secondary:s}=Ef(r,"inline");this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>s,getActionsContext:()=>t&&o.includes(t)?o:t?[t]:[]})}};sBe=I([m(1,ze),m(2,Li),m(3,_e),m(4,F),m(5,Ri),m(6,B),m(7,X),m(8,Qe),m(9,De),m(10,tt),m(11,qt),m(12,ne)],sBe);var mNi=class{getHeight(i){return 22}getTemplateId(i){return i instanceof Jc?woe.ID:i instanceof rR?Ek.ID:qR.ID}};function two(a){return typeof a.getConfigurationManager=="function"}var hNi=class extends b2{hasChildren(i){return two(i)||i.hasChildren}doGetChildren(i){if(two(i)){let e=i,t=e.getModel().getWatchExpressions(),o=e.getViewModel();return Promise.all(t.map(n=>n.name&&!pNi?n.evaluate(o.focusedSession,o.focusedStackFrame,"watch").then(()=>n):Promise.resolve(n)))}return i.getChildren()}},woe=class extends OB{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 woe.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:nsn,colorize:!0,session:e.getSession()}))}getInputBoxOptions(e,t){return t?{initialValue:e.value,ariaLabel:d(9198,null),onFinish:async(o,n)=>{if(n&&o){let r=this.debugService.getViewModel().focusedStackFrame;r&&(e instanceof Hl||e instanceof Jc)&&(await e.setExpression(o,r),this.debugService.getViewModel().updateViews())}}}:{initialValue:e.name?e.name:"",ariaLabel:d(9201,null),placeholder:d(9202,null),onFinish:(o,n)=>{n&&o?(this.debugService.renameWatchExpression(e.getId(),o),uNi=!0,this.debugService.getViewModel().updateViews(),uNi=!1):e.name||this.debugService.removeWatchExpressions(e.getId())}}}renderActionBar(e,t){let o=gNi(this.contextKeyService,t),n=t,r=this.menuService.getMenuActions(D.DebugWatchContext,o,{arg:n,shouldForwardArgs:!1}),{primary:s}=Ef(r,"inline");e.clear(),e.context=n,e.push(s,{icon:!0,label:!1})}};woe=I([m(1,qt),m(2,X),m(3,Li),m(4,_n),m(5,tt),m(6,B)],woe);function gNi(a,i,e=[]){let t=i.getSession();return a.createOverlay([[hV.key,"evaluateName"in i],[yz.key,i instanceof Jc?"expression":i instanceof Hl?"variable":void 0],[VY.key,!!t?.capabilities.supportsReadMemoryRequest&&i.memoryReference!==void 0],[Oce.key,!!i.presentationHint?.attributes?.includes("readOnly")||i.presentationHint?.lazy],[KY.key,i.type],[wke.key,t?.configuration.type],...e])}async function rsn(a,i,e,t){let o=i.getSession();if(!o||!o.capabilities.supportsDataBreakpoints)return gNi(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 Hl?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(CUt(s),!c)n.push([Cz.key,!!l]);else for(let u of c)switch(u){case"read":n.push([UY.key,!!l]);break;case"write":n.push([Cz.key,!!l]);break;case"readWrite":n.push([HY.key,!!l]);break}return gNi(a,i,n)}var fNi=class{getWidgetAriaLabel(){return d(9199,null)}getAriaLabel(i){return i instanceof Jc?d(9200,null,i.name,i.value):d(9203,null,i.name,i.value)}},vNi=class{constructor(i){this.debugService=i}onDragStart(i,e){i instanceof $y&&e.dataTransfer.setData("text/plain",i.elements[0].name)}onDragOver(i,e,t,o,n){if(!(i instanceof $y))return!1;let r=i.elements;if(!(r.length>0&&r[0]instanceof Jc))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 Jc)||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 $y))return;let r=i.elements[0];if(!(r instanceof Jc))throw new Error("Invalid dragged element");let s=this.debugService.getModel().getWatchExpressions(),l=s.indexOf(r),c;if(e instanceof Jc){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 Fn{constructor(){super({id:"watch.collapse",viewId:Yx,title:d(9195,null),f1:!1,icon:M.collapseAll,precondition:sQe,menu:{id:D.ViewTitle,order:30,group:"navigation",when:x.equals("view",Yx)}})}runInView(i,e){e.collapseAll()}});var bNi="workbench.debug.viewlet.action.addWatchExpression",SNi=d(9194,null);W(class extends K{constructor(){super({id:bNi,title:SNi,f1:!1,icon:Hlo,menu:{id:D.ViewTitle,group:"navigation",when:x.equals("view",Yx)}})}run(i){i.get(Li).addWatchExpression()}});var INi="workbench.debug.viewlet.action.removeAllWatchExpressions",yNi=d(9197,null);W(class extends K{constructor(){super({id:INi,title:yNi,f1:!1,icon:Vlo,precondition:sQe,menu:{id:D.ViewTitle,order:20,group:"navigation",when:x.equals("view",Yx)}})}run(i){i.get(Li).removeWatchExpressions()}});W(class extends Fn{constructor(){super({id:Hmo,title:d(9196,null),f1:!1,viewId:Yx,precondition:sQe,keybinding:{primary:2593,weight:200,when:x.and(Vl.isEqualTo(Yx),FY.negate())},menu:{id:D.DebugWatchContext,order:20,group:"3_modification",when:yz.isEqualTo("expression")}})}runInView(i,e,t){let o=i.get(Wi);t||(t=e.treeSelection.at(-1)),t&&o.writeText(t.name)}});var ust=class{constructor(i){this.debugService=i;this.type="pickerPick";this.label=d(8859,null);this.icon=M.debug;this.ordinal=-200}isEnabled(){let e=this.debugService.getViewModel().focusedSession;return!!e&&e.state===2}asPicker(i){let e=new P,t=Le("debugPicker.mode","main"),o=Le("debugPicker.query",""),n=this.createPicksObservable(t,o,e);return{placeholder:d(8864,null),picks:(r,s)=>{e.add(he(c=>{o.set(r.read(c),void 0)}));let l=new $e(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=kM(e,300);return Ce(n=>i.read(n)==="expression"?this.getExpressionPicks(o,t):this.getMainPicks(i)).flatten()}getMainPicks(i){return Ce(t=>new Au(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(8861,null),iconClass:q.asClassName(M.symbolVariable),asAttachment:()=>(i.set("expression",void 0),"noop")});let r=this.debugService.getModel().getWatchExpressions();if(r.length>0){e.push({type:"separator",label:d(8866,null)});for(let l of r)e.push({label:l.name,description:l.value,iconClass:q.asClassName(M.eye),asAttachment:()=>X$t(o,J$t(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(8858,null,l.name),iconClass:q.asClassName(M.symbolNamespace),asAttachment:()=>X$t(o,iwo(l,c))});for(let u of c)e.push({label:u.name,description:ssn(u),iconClass:q.asClassName(M.symbolVariable),asAttachment:()=>X$t(o,J$t(u))})}catch{}}return e}getExpressionPicks(i,e){return Ce(o=>{let n=i.read(o),r=new $e;return o.store.add(Z(()=>r.dispose(!0))),new Au(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(8865,null),disabled:!0,asAttachment:()=>"noop"}];let t=this.debugService.getViewModel(),o=t.focusedSession,n=t.focusedStackFrame;if(!o||!n)return[{label:d(8862,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:asn(s,l),iconClass:q.asClassName(M.symbolVariable),asAttachment:()=>X$t(n,{kind:"debugVariable",id:`debug-expression:${i}`,name:i,fullName:i,icon:M.debug,value:s,expression:i,type:l,modelDescription:wNi(i,s,l)})}]}else return[{label:i,description:d(8863,null),disabled:!0,asAttachment:()=>"noop"}]}catch(r){return[{label:i,description:r instanceof Error?r.message:d(8860,null),disabled:!0,asAttachment:()=>"noop"}]}}};ust=I([m(0,Li)],ust);function J$t(a){return{kind:"debugVariable",id:`debug-variable:${a.getId()}`,name:a.name,fullName:a.name,icon:M.debug,value:a.value,expression:a.name,type:a.type,modelDescription:wNi(a.name,a.value,a.type)}}function Z$t(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:Ye(i),modelDescription:"The debugger is currently paused at this location"}}function X$t(a,i){return[Z$t(a),i]}function iwo(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:M.debug,value:e,expression:a.name,type:"scope",modelDescription:`Debug scope "${a.name}" with ${i.length} variables:
${e}`}}function ssn(a){let i=a.value,e=a.type;return e&&i?`${e}: ${i}`:i||e||""}function asn(a,i){return i&&a?`${i}: ${a}`:a||i||""}function wNi(a,i,e){let t=`Debug variable "${a}"`;return e&&(t+=` of type ${e}`),t+=` with value: ${i}`,t}var nfe=class extends C{static{this.ID="workbench.contrib.chat.debugChatContextContribution"}constructor(i,e){super(),this._register(i.registerChatContextItem(e.createInstance(ust)))}};nfe=I([m(0,uS),m(1,F)],nfe);W(class extends K{constructor(){super({id:"workbench.debug.action.addVariableToChat",title:d(8857,null),f1:!1,menu:{id:D.DebugVariablesContext,group:"z_commands",order:110,when:ie.enabled}})}async run(a,i){let e=a.get(At),t=a.get(Li),o=await e.revealWidget();if(!o)return;let n=csn(i);if(n){let r=t.getViewModel().focusedStackFrame;r&&o.attachmentModel.addContext(Z$t(r)),o.attachmentModel.addContext(n)}}});W(class extends K{constructor(){super({id:"workbench.debug.action.addWatchExpressionToChat",title:d(8857,null),f1:!1,menu:{id:D.DebugWatchContext,group:"z_commands",order:110,when:ie.enabled}})}async run(a,i){let e=a.get(At),t=a.get(Li),o=await e.revealWidget();if(!i||!o)return;let n=t.getViewModel().focusedStackFrame;n&&o.attachmentModel.addContext(Z$t(n)),o.attachmentModel.addContext(J$t(i))}});W(class extends K{constructor(){super({id:"workbench.debug.action.addScopeToChat",title:d(8857,null),f1:!1,menu:{id:D.DebugScopesContext,group:"z_commands",order:1,when:ie.enabled}})}async run(a,i){let e=a.get(At),t=a.get(Li),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(Z$t(r)),o.attachmentModel.addContext(iwo(l,c))}}catch{}}});function lsn(a){return typeof a=="object"&&a!==null&&"variable"in a&&"sessionId"in a}function csn(a){if(a instanceof Hl)return J$t(a);if(lsn(a)){let i=a.variable;return{kind:"debugVariable",id:`debug-variable:${i.name}`,name:i.name,fullName:i.evaluateName??i.name,icon:M.debug,value:i.value,expression:i.evaluateName??i.name,type:i.type,modelDescription:wNi(i.evaluateName||i.name,i.value,i.type)}}}var dsn=d(8775,null);Ylo();we(Li,eBe,1);we(qY,Dke,1);oe.as(Qi.Workbench).registerWorkbenchContribution(tBe,4);oe.as(Qi.Workbench).registerWorkbenchContribution(BVe,4);Gt&&oe.as(Qi.Workbench).registerWorkbenchContribution(iBe,4);oe.as(Qi.Workbench).registerWorkbenchContribution(MVe,3);oe.as(Qi.Workbench).registerWorkbenchContribution(fH,4);oe.as(Qi.Workbench).registerWorkbenchContribution(rBe,4);oe.as(Qi.Workbench).registerWorkbenchContribution(OVe,4);oe.as(Qi.Workbench).registerWorkbenchContribution(RVe,4);pt(nfe.ID,nfe,ut.AfterRestored);oe.as(Tu.Quickaccess).registerQuickAccessProvider({ctor:HVe,prefix:Ktt,contextKey:"inLaunchConfigurationsPicker",placeholder:d(8828,null),helpEntries:[{description:d(8827,null),commandId:V3,commandCenterOrder:50}]});oe.as(Tu.Quickaccess).registerQuickAccessProvider({ctor:NVe,prefix:Gtt,contextKey:"inDebugConsolePicker",placeholder:d(8830,null),helpEntries:[{description:d(8829,null),commandId:yUt}]});go("editor.contrib.callStack",NNe,1);go(fP,ANe,1);go(gV,U3,2);var Eh=(a,i,e,t)=>{fe.appendMenuItem(D.CommandPalette,{when:x.and(fa,e),group:dsn,command:{id:a,title:i,category:bte,precondition:t}})};Eh(y2,Ste);Eh(IUt,L(8831,"Terminate Thread"),Xa,uQe);Eh(w2,Ite,Xa,Fs.isEqualTo("stopped"));Eh(C2,yte,Xa,Fs.isEqualTo("stopped"));Eh(Xki,Umo,Xa,x.and(BY,Xa,Fs.isEqualTo("stopped")));Eh(x2,wte,Xa,Fs.isEqualTo("stopped"));Eh(W3,Cte,Xa,x.and(Fs.isEqualTo("running"),wz.toNegated()));Eh(GR,H3,Xa,x.or(fC,gP));Eh($Ae,Btt,Xa,x.or(fC,x.and(zY,gP)));Eh(uT,T2,Xa,x.or(fC.toNegated(),gP));Eh(k2,xte,Xa,Fs.isEqualTo("stopped"));Eh(Att,L(8790,"Jump to Cursor"),Nce);Eh(Att,L(8819,"Set Next Statement"),Nce);Eh(FVe.ID,FVe.LABEL,fa);Eh(WVe.ID,WVe.LABEL,Xa);Eh(VVe.ID,VVe.LABEL);Eh(Ptt,L(8785,"Inline Breakpoint"));Eh(d0,Htt,x.and(fa,Fs.notEqualsTo(oR(1))));Eh(Ntt,dEi,x.and(fa,Fs.notEqualsTo(oR(1))));Eh(V3,Kmo,x.and(fa,Fs.notEqualsTo(oR(1))));Eh(oEi,Gmo);Eh(nEi,$mo);Eh(rEi,qmo,Xa,aQe);Eh(yUt,Jmo);Eh(Zki,Zmo);Eh(sEi,jmo,Xa,Fs.isEqualTo("stopped"));Eh(aEi,Qmo,Xa,Fs.isEqualTo("stopped"));Eh(lEi,Ymo,Xa,Fs.isEqualTo("stopped"));Eh(cEi,Xmo,Xa,Fs.isEqualTo("stopped"));var _d=(a,i,e,t,o,n,r="navigation",s)=>{fe.appendMenuItem(a,{group:r,when:o,order:t,icon:s,command:{id:i,title:e,icon:s,precondition:n}})};_d(D.DebugCallStackContext,y2,Ste,10,yv.isEqualTo("session"),void 0,"3_modification");_d(D.DebugCallStackContext,GR,H3,20,yv.isEqualTo("session"),void 0,"3_modification");_d(D.DebugCallStackContext,$Ae,Btt,21,x.and(yv.isEqualTo("session"),zY,gP),void 0,"3_modification");_d(D.DebugCallStackContext,uT,T2,30,yv.isEqualTo("session"),void 0,"3_modification");_d(D.DebugCallStackContext,W3,Cte,10,x.and(yv.isEqualTo("thread"),x.and(Fs.isEqualTo("running"),wz.toNegated())));_d(D.DebugCallStackContext,k2,xte,10,x.and(yv.isEqualTo("thread"),Fs.isEqualTo("stopped")));_d(D.DebugCallStackContext,w2,Ite,20,yv.isEqualTo("thread"),Fs.isEqualTo("stopped"));_d(D.DebugCallStackContext,C2,yte,30,yv.isEqualTo("thread"),Fs.isEqualTo("stopped"));_d(D.DebugCallStackContext,x2,wte,40,yv.isEqualTo("thread"),Fs.isEqualTo("stopped"));_d(D.DebugCallStackContext,IUt,d(8832,null),10,yv.isEqualTo("thread"),uQe,"termination");_d(D.DebugCallStackContext,Jki,d(8815,null),10,x.and(yv.isEqualTo("stackFrame"),i_t),o_t);_d(D.DebugCallStackContext,jki,d(8739,null),20,yv.isEqualTo("stackFrame"),void 0,"3_modification");_d(D.DebugVariablesContext,$tt,d(8835,null),15,VY,Xa,"inline",jWt);_d(D.DebugVariablesContext,SEi,d(8820,null),10,x.or(cQe,x.and(hV,dQe)),Oce.toNegated(),"3_modification");_d(D.DebugVariablesContext,B3,Utt,10,void 0,void 0,"5_cutcopypaste");_d(D.DebugVariablesContext,vte,QAe,20,hV,void 0,"5_cutcopypaste");_d(D.DebugVariablesContext,Ott,ztt,100,hV,void 0,"z_commands");_d(D.DebugVariablesContext,Vtt,d(8735,null),200,UY,void 0,"z_commands");_d(D.DebugVariablesContext,Ftt,d(8733,null),210,Cz,void 0,"z_commands");_d(D.DebugVariablesContext,Wtt,d(8734,null),220,HY,void 0,"z_commands");_d(D.DebugHoverContext,$tt,d(8835,null),15,VY,Xa,"inline",jWt);_d(D.DebugHoverContext,B3,Utt,10,void 0,void 0,"5_cutcopypaste");_d(D.DebugHoverContext,vte,QAe,20,hV,void 0,"5_cutcopypaste");_d(D.DebugHoverContext,Ott,ztt,100,hV,void 0,"z_commands");_d(D.DebugHoverContext,Vtt,d(8735,null),200,UY,void 0,"z_commands");_d(D.DebugHoverContext,Ftt,d(8733,null),210,Cz,void 0,"z_commands");_d(D.DebugHoverContext,Wtt,d(8734,null),220,HY,void 0,"z_commands");_d(D.DebugWatchContext,bNi,SNi,10,void 0,void 0,"3_modification");_d(D.DebugWatchContext,eEi,d(8783,null),20,yz.isEqualTo("expression"),void 0,"3_modification");_d(D.DebugWatchContext,tEi,d(8820,null),30,x.or(x.and(yz.isEqualTo("expression"),dQe),x.and(yz.isEqualTo("variable"),cQe)),Oce.toNegated(),"3_modification");_d(D.DebugWatchContext,B3,d(8740,null),40,x.or(yz.isEqualTo("expression"),yz.isEqualTo("variable")),Xa,"3_modification");_d(D.DebugWatchContext,vte,QAe,50,hV,Xa,"3_modification");_d(D.DebugWatchContext,$tt,d(8835,null),10,VY,void 0,"inline",jWt);_d(D.DebugWatchContext,iEi,d(8814,null),20,yz.isEqualTo("expression"),void 0,"inline",Blo);_d(D.DebugWatchContext,INi,yNi,20,void 0,void 0,"z_commands");_d(D.DebugWatchContext,Vtt,d(8735,null),200,UY,void 0,"z_commands");_d(D.DebugWatchContext,Ftt,d(8733,null),210,Cz,void 0,"z_commands");_d(D.DebugWatchContext,Wtt,d(8734,null),220,HY,void 0,"z_commands");_d(D.NotebookVariablesContext,TAi,_Ai,20,kke);yt.registerKeybindingRule({id:B3,weight:200,when:x.and(FY.negate(),x.or(Vl.isEqualTo(Yx),Vl.isEqualTo(Iz))),primary:2081});if(it){let a=(i,e,t,o,n)=>{fe.appendMenuItem(D.TouchBarContext,{command:{id:i,title:e,icon:{dark:n}},when:x.and(fa,o),group:"9_debug",order:t})};a(Ntt,dEi,0,Xa.toNegated(),gn.asFileUri("vs/workbench/contrib/debug/browser/media/continue-tb.png")),a(d0,Htt,1,Xa.toNegated(),gn.asFileUri("vs/workbench/contrib/debug/browser/media/run-with-debugging-tb.png")),a(k2,xte,0,Fs.isEqualTo("stopped"),gn.asFileUri("vs/workbench/contrib/debug/browser/media/continue-tb.png")),a(W3,Cte,1,x.and(Xa,x.and(Fs.isEqualTo("running"),wz.toNegated())),gn.asFileUri("vs/workbench/contrib/debug/browser/media/pause-tb.png")),a(w2,Ite,2,Xa,gn.asFileUri("vs/workbench/contrib/debug/browser/media/stepover-tb.png")),a(C2,yte,3,Xa,gn.asFileUri("vs/workbench/contrib/debug/browser/media/stepinto-tb.png")),a(x2,wte,4,Xa,gn.asFileUri("vs/workbench/contrib/debug/browser/media/stepout-tb.png")),a(y2,Ste,5,Xa,gn.asFileUri("vs/workbench/contrib/debug/browser/media/restart-tb.png")),a(uT,T2,6,Xa,gn.asFileUri("vs/workbench/contrib/debug/browser/media/stop-tb.png"))}fe.appendMenuItem(D.EditorTitle,{submenu:D.EditorTitleRun,isSplitButton:{togglePrimaryAction:!0},title:L(8816,"Run or Debug..."),icon:Nlo,group:"navigation",order:-1});fe.appendMenuItem(D.MenubarMainMenu,{submenu:D.MenubarDebugMenu,title:{...L(8818,"Run"),mnemonicTitle:d(8808,null)},order:6});fe.appendMenuItem(D.MenubarDebugMenu,{group:"1_debug",command:{id:d0,title:d(8800,null)},order:1,when:fa});fe.appendMenuItem(D.MenubarDebugMenu,{group:"1_debug",command:{id:Ntt,title:d(8799,null)},order:2,when:fa});fe.appendMenuItem(D.MenubarDebugMenu,{group:"1_debug",command:{id:uT,title:d(8804,null),precondition:Xa},order:3,when:fa});fe.appendMenuItem(D.MenubarDebugMenu,{group:"1_debug",command:{id:y2,title:d(8798,null),precondition:Xa},order:4,when:fa});fe.appendMenuItem(D.MenubarDebugMenu,{group:"2_configuration",command:{id:nhe,title:d(8793,null)},order:2,when:fa});fe.appendMenuItem(D.MenubarDebugMenu,{group:"3_step",command:{id:w2,title:d(8803,null),precondition:Fs.isEqualTo("stopped")},order:1,when:fa});fe.appendMenuItem(D.MenubarDebugMenu,{group:"3_step",command:{id:C2,title:d(8801,null),precondition:Fs.isEqualTo("stopped")},order:2,when:fa});fe.appendMenuItem(D.MenubarDebugMenu,{group:"3_step",command:{id:x2,title:d(8802,null),precondition:Fs.isEqualTo("stopped")},order:3,when:fa});fe.appendMenuItem(D.MenubarDebugMenu,{group:"3_step",command:{id:k2,title:d(8794,null),precondition:Fs.isEqualTo("stopped")},order:4,when:fa});fe.appendMenuItem(D.MenubarNewBreakpointMenu,{group:"1_breakpoints",command:{id:Ptt,title:d(8795,null)},order:2,when:fa});fe.appendMenuItem(D.MenubarDebugMenu,{group:"4_new_breakpoint",title:d(8797,null),submenu:D.MenubarNewBreakpointMenu,order:2,when:fa});fe.appendMenuItem(D.DebugDisassemblyContext,{group:"1_edit",command:{id:bUt,title:wUt},order:2,when:fa});fe.appendMenuItem(D.DebugDisassemblyContext,{group:"3_breakpoints",command:{id:SUt,title:d(8805,null)},order:2,when:fa});fe.appendMenuItem(D.MenubarDebugMenu,{group:"z_install",command:{id:"debug.installAdditionalDebuggers",title:d(8796,null)},order:1});var usn=oe.as(on.ViewContainersRegistry).registerViewContainer({id:YTt,title:L(8777,"Debug Console"),icon:qyi,ctorDescriptor:new Mt(Ha,[YTt,{mergeViewWithContainerWhenSingleView:!0}]),storageId:YTt,hideIfEmpty:!0,order:2},1,{doNotRegisterOpenCommand:!0});oe.as(on.ViewsRegistry).registerViews([{id:ld,name:L(8777,"Debug Console"),containerIcon:qyi,canToggleVisibility:!0,canMoveView:!0,when:fa,ctorDescriptor:new Mt(lH),openCommandActionDescriptor:{id:"workbench.debug.action.toggleRepl",mnemonicTitle:d(8806,null),keybindings:{primary:3127},order:2}}],usn);var aBe=oe.as(on.ViewContainersRegistry).registerViewContainer({id:jh,title:L(8817,"Run and Debug"),openCommandActionDescriptor:{id:jh,mnemonicTitle:d(8807,null),keybindings:{primary:3106},order:3},ctorDescriptor:new Mt(oBe),icon:jyi,alwaysUseContainerInfo:!0,order:3},0),lBe=oe.as(on.ViewsRegistry);lBe.registerViews([{id:Iz,name:L(8834,"Variables"),containerIcon:Llo,ctorDescriptor:new Mt(YAe),order:10,weight:40,canToggleVisibility:!0,canMoveView:!0,focusCommand:{id:"workbench.debug.action.focusVariablesView"},when:hP.isEqualTo("default")}],aBe);lBe.registerViews([{id:Yx,name:L(8836,"Watch"),containerIcon:Rlo,ctorDescriptor:new Mt(sBe),order:20,weight:10,canToggleVisibility:!0,canMoveView:!0,focusCommand:{id:"workbench.debug.action.focusWatchView"},when:hP.isEqualTo("default")}],aBe);lBe.registerViews([{id:qj,name:L(8736,"Call Stack"),containerIcon:Mlo,ctorDescriptor:new Mt(PVe),order:30,weight:30,canToggleVisibility:!0,canMoveView:!0,focusCommand:{id:"workbench.debug.action.focusCallStackView"},when:hP.isEqualTo("default")}],aBe);lBe.registerViews([{id:Xx,name:L(8732,"Breakpoints"),containerIcon:zWt,ctorDescriptor:new Mt(KAe),order:40,weight:20,canToggleVisibility:!0,canMoveView:!0,focusCommand:{id:"workbench.debug.action.focusBreakpointsView"},when:x.or(jj,hP.isEqualTo("default"),XTt)}],aBe);lBe.registerViews([{id:AD.ID,name:AD.LABEL,containerIcon:jyi,ctorDescriptor:new Mt(AD),order:1,weight:40,canToggleVisibility:!0,when:hP.isEqualTo("simple")}],aBe);lBe.registerViews([{id:Ace,name:L(8792,"Loaded Scripts"),containerIcon:Plo,ctorDescriptor:new Mt(nBe),order:35,weight:5,canToggleVisibility:!0,canMoveView:!0,collapsed:!0,when:x.and(aQe,hP.isEqualTo("default"))}],aBe);oe.as(rn.EditorPane).registerEditorPane(ys.create(IT,QTt,d(8782,null)),[new Mt(nR)]);var psn=oe.as(ii.Configuration);psn.registerConfiguration({id:"debug",order:20,title:d(8776,null),type:"object",properties:{"debug.showVariableTypes":{type:"boolean",description:d(8826,null),default:!1},"debug.allowBreakpointsEverywhere":{type:"boolean",description:d(8730,null),default:!1},"debug.gutterMiddleClickAction":{type:"string",enum:["logpoint","conditionalBreakpoint","triggeredBreakpoint","none"],description:d(8784,null),enumDescriptions:[d(8763,null),d(8762,null),d(8765,null),d(8764,null)],default:"logpoint"},"debug.openExplorerOnEnd":{type:"boolean",description:d(8812,null),default:!1},"debug.closeReadonlyTabsOnEnd":{type:"boolean",description:d(8738,null),default:!1},"debug.inlineValues":{type:"string",enum:["on","off","auto"],description:d(8786,null),enumDescriptions:[d(8789,null),d(8788,null),d(8787,null)],default:"auto"},"debug.toolBarLocation":{enum:["floating","docked","commandCenter","hidden"],markdownDescription:d(8833,null,"`#window.commandCenter#`"),default:"floating",markdownEnumDescriptions:[d(8780,null),d(8779,null),d(8778,null),d(8781,null)]},"debug.showInStatusBar":{enum:["never","always","onFirstSessionStart"],enumDescriptions:[d(8809,null),d(8731,null),d(8810,null)],description:d(8824,null),default:"onFirstSessionStart"},"debug.internalConsoleOptions":u_t,"debug.console.closeOnEnd":{type:"boolean",description:d(8750,null),default:!1},"debug.terminal.clearBeforeReusing":{type:"boolean",description:d(8773,null),default:!1},"debug.openDebug":{enum:["neverOpen","openOnSessionStart","openOnFirstSessionStart","openOnDebugBreak"],default:"openOnDebugBreak",description:d(8811,null)},"debug.showSubSessionsInToolBar":{type:"boolean",description:d(8825,null),default:!1},"debug.console.fontSize":{type:"number",description:d(8753,null),default:it?12:14},"debug.console.fontFamily":{type:"string",description:d(8752,null),default:"default"},"debug.console.lineHeight":{type:"number",description:d(8755,null),default:0},"debug.console.wordWrap":{type:"boolean",description:d(8757,null),default:!0},"debug.console.historySuggestions":{type:"boolean",description:d(8754,null),default:!0},"debug.console.collapseIdenticalLines":{type:"boolean",description:d(8751,null),default:!0},"debug.console.acceptSuggestionOnEnter":{enum:["off","on"],description:d(8749,null),default:"off"},"debug.console.maximumLines":{type:"number",description:d(8756,null),default:1e4},launch:{type:"object",description:d(8791,null),default:{configurations:[],compounds:[]},$ref:VV,disallowConfigurationDefault:!0},"debug.focusWindowOnBreak":{type:"boolean",description:d(8761,null),default:!0},"debug.focusEditorOnBreak":{type:"boolean",description:d(8760,null),default:!0},"debug.onTaskErrors":{enum:["debugAnyway","showErrors","prompt","abort"],enumDescriptions:[d(8774,null),d(8822,null),d(8813,null),d(8737,null)],description:d(8768,null),default:"prompt"},"debug.showBreakpointsInOverviewRuler":{type:"boolean",description:d(8821,null),default:!1},"debug.breakpointsView.presentation":{type:"string",description:d(8745,null),enum:["tree","list"],default:"list"},"debug.showInlineBreakpointCandidates":{type:"boolean",description:d(8823,null),default:!0},"debug.saveBeforeStart":{description:d(8769,null),enum:["allEditorsInActiveGroup","nonUntitledEditorsInActiveGroup","none"],enumDescriptions:[d(8770,null),d(8772,null),d(8771,null)],default:"allEditorsInActiveGroup",scope:6},"debug.confirmOnExit":{description:d(8746,null),type:"string",enum:["never","always"],enumDescriptions:[d(8748,null),d(8747,null)],default:"never"},"debug.disassemblyView.showSourceCode":{type:"boolean",default:!0,description:d(8758,null)},"debug.autoExpandLazyVariables":{type:"string",enum:["auto","on","off"],default:"auto",enumDescriptions:[d(8742,null),d(8744,null),d(8743,null)],description:d(8741,null)},"debug.enableStatusBarColor":{type:"boolean",description:d(8759,null),default:!0},"debug.hideLauncherWhileDebugging":{type:"boolean",markdownDescription:d(8766,null,"`#debug.toolBarLocation#`"),default:!1},"debug.hideSlowPreLaunchWarning":{type:"boolean",markdownDescription:d(8767,null),default:!1}}});xa.register(new Q$t);xa.register(new j$t);xa.register(new Y$t);pt(ofe.ID,ofe,ut.AfterRestored);pt(ife.ID,ife,ut.AfterRestored);var CNi=class{constructor(i){this._markerService=i;this.label=d(11000,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(11002,null):d(11003,null,e.length),letter:e.length<10?e.length.toString():"9+",color:t.severity===8?uL:d9}}},pst=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(){Ue(this._provider),Ue(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 CNi(this._markerService);this._provider=this._decorationsService.registerDecorationsProvider(o)}else this._provider&&this._provider.dispose()}};pst=I([m(0,Ns),m(1,Cv),m(2,B)],pst);oe.as(ii.Configuration).registerConfiguration({id:"problems",order:101,type:"object",properties:{"problems.decorations.enabled":{markdownDescription:d(11001,null,"`#problems.visibility#`"),type:"boolean",default:!0}}});oe.as(Qi.Workbench).registerWorkbenchContribution(pst,3);function tqt(a,i){return ar.compare(a.resource,i.resource)}function msn(a,i){let[e]=a.markers,[t]=i.markers,o=0;return e&&t&&(o=cl.compare(e.marker.severity,t.marker.severity)),o===0&&(o=a.path.localeCompare(i.path)||a.name.localeCompare(i.name)),o}var rM=class a{constructor(i,e){this.id=i;this.resource=e;this._markersMap=new vt;this._total=0;this.path=this.resource.fsPath,this.name=Ye(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),dr(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 cl.compare(i.marker.severity,e.marker.severity)||ar.compare(i.resource,e.resource)||z.compareRangesUsingStarts(i.marker,e.marker)}},Th=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=mc(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,"	")}},KA=class extends Th{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}},R0=class{constructor(i,e,t){this.id=i;this.marker=e;this.raw=t}},eqt=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(msn)),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(npe.has(t.scheme))continue;let n=ar.getComparisonKey(t,!0),r=this.resourcesByUri.get(n);if(dr(o)){if(r)e.updated.add(r);else{let c=this.id(t.toString());r=new rM(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=TW.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 R0(this.id(p,g.resource.toString(),g.startLineNumber,g.startColumn,g.endLineNumber,g.endColumn,f),c,g))),l.push(new Th(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`${Ir(i)}`}dispose(){this._onDidChange.dispose(),this.resourcesByUri.clear()}};var hsn=/(!)?@source:("[^"]*"|[^\s,]+)(\s*)/i,iqt=class{constructor(i,e,t){this.globalExpression=zm(i),this.expressionsByRoot=Yu.forUris(o=>t.extUri.ignorePathCasing(o));for(let o of e)this.expressionsByRoot.set(o.root,{root:o.root,expression:zm(o.expression)})}matches(i){let e=this.expressionsByRoot.findSubstr(i);if(e){let t=Fc(e.root,i);if(t&&e.expression(t))return!0}return!!this.globalExpression(i.path)}},Nk=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)?Wli():e;for(let{expression:f}of s)for(let v of Object.keys(f))v.endsWith("/**")||(f[`${ih(v,"/")}/**`]=f[v]);let c=[],u=[],p;for(;(p=hsn.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?Hw(i,"!"):i).trim(),negate:h};let g=Wli();if(i){let f=HL(i,",").map(v=>v.trim()).filter(v=>!!v.length);for(let v of f)if(v.startsWith("!")){let b=Hw(v,"!");b&&this.setPattern(l,b)}else this.setPattern(g,v)}this.excludesMatcher=new iqt(l,s,r),this.includesMatcher=new iqt(g,[],r)}static{this._filter=Dye}static{this._messageFilter=Up}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 hp=class{static{this.MARKERS_PANEL_TOGGLE_LABEL=d(11063,null)}static{this.MARKERS_PANEL_SHOW_LABEL=L(11062,"Focus Problems (Errors, Warnings, Infos)")}static{this.PROBLEMS_PANEL_CONFIGURATION_TITLE=d(11049,null)}static{this.PROBLEMS_PANEL_CONFIGURATION_AUTO_REVEAL=d(11044,null)}static{this.PROBLEMS_PANEL_CONFIGURATION_VIEW_MODE=d(11050,null)}static{this.PROBLEMS_PANEL_CONFIGURATION_SHOW_CURRENT_STATUS=d(11048,null)}static{this.PROBLEMS_PANEL_CONFIGURATION_COMPARE_ORDER=d(11045,null)}static{this.PROBLEMS_PANEL_CONFIGURATION_COMPARE_ORDER_SEVERITY=d(11047,null)}static{this.PROBLEMS_PANEL_CONFIGURATION_COMPARE_ORDER_POSITION=d(11046,null)}static{this.MARKERS_PANEL_TITLE_PROBLEMS=L(11043,"Problems")}static{this.MARKERS_PANEL_NO_PROBLEMS_BUILT=d(11037,null)}static{this.MARKERS_PANEL_NO_PROBLEMS_ACTIVE_FILE_BUILT=d(11036,null)}static{this.MARKERS_PANEL_NO_PROBLEMS_FILTERS=d(11038,null)}static{this.MARKERS_PANEL_ACTION_TOOLTIP_MORE_FILTERS=d(11019,null)}static{this.MARKERS_PANEL_FILTER_LABEL_SHOW_ERRORS=d(11027,null)}static{this.MARKERS_PANEL_FILTER_LABEL_SHOW_WARNINGS=d(11029,null)}static{this.MARKERS_PANEL_FILTER_LABEL_SHOW_INFOS=d(11028,null)}static{this.MARKERS_PANEL_FILTER_LABEL_EXCLUDED_FILES=d(11030,null)}static{this.MARKERS_PANEL_FILTER_LABEL_ACTIVE_FILE=d(11022,null)}static{this.MARKERS_PANEL_ACTION_TOOLTIP_FILTER=d(11018,null)}static{this.MARKERS_PANEL_ACTION_TOOLTIP_QUICKFIX=d(11020,null)}static{this.MARKERS_PANEL_FILTER_ARIA_LABEL=d(11023,null)}static{this.MARKERS_PANEL_FILTER_PLACEHOLDER=d(11026,null)}static{this.MARKERS_PANEL_FILTER_ERRORS=d(11024,null)}static{this.MARKERS_PANEL_FILTER_WARNINGS=d(11031,null)}static{this.MARKERS_PANEL_FILTER_INFOS=d(11025,null)}static{this.MARKERS_PANEL_SINGLE_ERROR_LABEL=d(11039,null)}static{this.MARKERS_PANEL_MULTIPLE_ERRORS_LABEL=i=>d(11032,null,""+i)}static{this.MARKERS_PANEL_SINGLE_WARNING_LABEL=d(11042,null)}static{this.MARKERS_PANEL_MULTIPLE_WARNINGS_LABEL=i=>d(11035,null,""+i)}static{this.MARKERS_PANEL_SINGLE_INFO_LABEL=d(11040,null)}static{this.MARKERS_PANEL_MULTIPLE_INFOS_LABEL=i=>d(11033,null,""+i)}static{this.MARKERS_PANEL_SINGLE_UNKNOWN_LABEL=d(11041,null)}static{this.MARKERS_PANEL_MULTIPLE_UNKNOWNS_LABEL=i=>d(11034,null,""+i)}static{this.MARKERS_PANEL_AT_LINE_COL_NUMBER=(i,e)=>d(11021,null,""+i,""+e)}static{this.MARKERS_TREE_ARIA_LABEL_RESOURCE=(i,e,t)=>d(11059,null,i,e,t)}static{this.MARKERS_TREE_ARIA_LABEL_MARKER=i=>{let e=i.relatedInformation.length?d(11057,null,i.relatedInformation.length):"";switch(i.marker.severity){case 8:return i.marker.source?d(11051,null,i.marker.message,i.marker.startLineNumber,i.marker.startColumn,e,i.marker.source):d(11052,null,i.marker.message,i.marker.startLineNumber,i.marker.startColumn,e);case 4:return i.marker.source?d(11060,null,i.marker.message,i.marker.startLineNumber,i.marker.startColumn,e,i.marker.source):d(11061,null,i.marker.message,i.marker.startLineNumber,i.marker.startColumn,e,e);case 2:return i.marker.source?d(11053,null,i.marker.message,i.marker.startLineNumber,i.marker.startColumn,e,i.marker.source):d(11054,null,i.marker.message,i.marker.startLineNumber,i.marker.startColumn,e);default:return i.marker.source?d(11055,null,i.marker.source,i.marker.message,i.marker.startLineNumber,i.marker.startColumn,e,i.marker.source):d(11056,null,i.marker.message,i.marker.startLineNumber,i.marker.startColumn,e)}}}static{this.MARKERS_TREE_ARIA_LABEL_RELATED_INFORMATION=i=>d(11058,null,i.message,i.startLineNumber,i.startColumn,Ye(i.resource))}static{this.SHOW_ERRORS_WARNINGS_ACTION_LABEL=d(11017,null)}};var oqt=class extends C{constructor(e,t){super();this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._excludedFiles=mp.ShowExcludedFilesFilterContextKey.bindTo(t),this._excludedFiles.set(e.excludedFiles),this._activeFile=mp.ShowActiveFileFilterContextKey.bindTo(t),this._activeFile.set(e.activeFile),this._showWarnings=mp.ShowWarningsFilterContextKey.bindTo(t),this._showWarnings.set(e.showWarnings),this._showInfos=mp.ShowInfoFilterContextKey.bindTo(t),this._showInfos.set(e.showInfos),this._showErrors=mp.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}))}},rfe=class a extends st{constructor(e){super(a.ID,hp.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(M.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()}},Coe=class extends Lr{constructor(e,t,o){super(null,e,{...t,icon:!0,label:!1});this.contextMenuService=o}onClick(e){$t.stop(e,!0),this.showQuickFixes()}showQuickFixes(){if(!this.element||!this.isEnabled())return;let e=Yn(this.element),t=this.action.quickFixes;t.length&&this.contextMenuService.showContextMenu({getAnchor:()=>({x:e.left+10,y:e.top+e.height+4}),getActions:()=>t})}};Coe=I([m(2,ze)],Coe);var Toe=_,xoe=class{constructor(i,e){this.markersViewModel=i;this.instantiationService=e;this.templateId=xoe.TEMPLATE_ID}static{this.TEMPLATE_ID="severity"}renderTemplate(i){let e=R(i,Toe(".severity")),t=R(e,Toe("")),o=R(i,Toe(".actions"));return{actionBar:new ji(o,{actionViewItemProvider:(r,s)=>r.id===rfe.ID?this.instantiationService.createInstance(Coe,r,s):void 0}),icon:t,elementDisposables:new P}}renderElement(i,e,t){t.elementDisposables.clear();let o=r=>{Jn(r)||Nh(t.icon,"monaco-table-td").classList.toggle("quickFix",r)};t.icon.title=cl.toString(i.marker.severity),t.icon.className=`marker-icon ${gt.toString(cl.toSeverity(i.marker.severity))} codicon ${Px.className(cl.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()}};xoe=I([m(1,F)],xoe);var koe=class{constructor(i,e){this.hoverService=i;this.openerService=e;this.templateId=koe.TEMPLATE_ID}static{this.TEMPLATE_ID="code"}renderTemplate(i){let e=new P,t=R(i,Toe(".code")),o=e.add(new Oa(t));o.element.classList.add("source-label");let n=e.add(new Oa(t));n.element.classList.add("code-label");let r=e.add(new Xg(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 Oa(Toe(".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()}};koe=I([m(0,tt),m(1,Qe)],koe);var nqt=class a{constructor(){this.templateId=a.TEMPLATE_ID}static{this.TEMPLATE_ID="message"}renderTemplate(i){let e=R(i,Toe(".message")),t=new Oa(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()}},Eoe=class{constructor(i){this.labelService=i;this.templateId=Eoe.TEMPLATE_ID}static{this.TEMPLATE_ID="file"}renderTemplate(i){let e=R(i,Toe(".file")),t=new Oa(e);t.element.classList.add("file-label");let o=new Oa(e);return o.element.classList.add("file-position"),{columnElement:e,fileLabel:t,positionLabel:o}}renderElement(i,e,t){let o=hp.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()}};Eoe=I([m(0,ot)],Eoe);var rqt=class a{constructor(){this.templateId=a.TEMPLATE_ID}static{this.TEMPLATE_ID="source"}renderTemplate(i){let e=R(i,Toe(".source")),t=new Oa(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()}},xNi=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}},cBe=class extends C{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(rC,"Markers",this.container,new xNi,[{label:"",tooltip:"",weight:0,minimumWidth:36,maximumWidth:36,templateId:xoe.TEMPLATE_ID,project(f){return f}},{label:d(11004,null),tooltip:"",weight:1,minimumWidth:100,maximumWidth:300,templateId:koe.TEMPLATE_ID,project(f){return f}},{label:d(11006,null),tooltip:"",weight:4,templateId:nqt.TEMPLATE_ID,project(f){return f}},{label:d(11005,null),tooltip:"",weight:2,templateId:Eoe.TEMPLATE_ID,project(f){return f}},{label:d(11007,null),tooltip:"",weight:1,minimumWidth:100,maximumWidth:300,templateId:rqt.TEMPLATE_ID,project(f){return f}}],[this.instantiationService.createInstance(xoe,this.markersViewModel),this.instantiationService.createInstance(koe),this.instantiationService.createInstance(nqt),this.instantiationService.createInstance(Eoe),this.instantiationService.createInstance(rqt)],r);let c=this.table.domNode.querySelector(".monaco-list-rows"),u=H.chain(this._register(new On(c,"mouseover")).event,f=>f.map(v=>Nh(v.target,"monaco-list-row","monaco-list-rows")).filter(v=>!!v).map(v=>parseInt(v.getAttribute("data-index")))),p=H.map(this._register(new On(c,"mouseleave")).event,()=>-1),h=H.latch(H.any(u,p)),g=H.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(npe.has(n.resource.scheme)||this.filterOptions.excludesMatcher.matches(n.resource))continue;if(this.filterOptions.includesMatcher.matches(n.resource)){t.push(new KA(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?Nk._filter(this.filterOptions.textFilter.text,n.marker.source)??void 0:void 0,l=n.marker.code?Nk._filter(this.filterOptions.textFilter.text,typeof n.marker.code=="string"?n.marker.code:n.marker.code.value)??void 0:void 0,c=Nk._messageFilter(this.filterOptions.textFilter.text,n.marker.message)??void 0,u=Nk._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 KA(n,s,l,c,u));continue}t.push(new KA(n))}}this._itemCount=t.length,this.table.splice(0,Number.POSITIVE_INFINITY,t.sort((o,n)=>{let r=cl.compare(o.marker.severity,n.marker.severity);return r===0&&(r=tqt(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 Th&&e.has(t[0].marker.resource))}};cBe=I([m(5,F),m(6,ot)],cBe);var dBe=class{constructor(i){this.labelService=i}getWidgetAriaLabel(){return d(11011,null)}getAriaLabel(i){if(i instanceof rM){let e=this.labelService.getUriLabel(i.resource,{relative:!0})||i.resource.fsPath;return hp.MARKERS_TREE_ARIA_LABEL_RESOURCE(i.markers.length,i.name,wc(e))}return i instanceof Th||i instanceof KA?hp.MARKERS_TREE_ARIA_LABEL_MARKER(i):i instanceof R0?hp.MARKERS_TREE_ARIA_LABEL_RELATED_INFORMATION(i.raw):null}};dBe=I([m(0,ot)],dBe);var hst=class a{constructor(i){this.markersViewState=i}static{this.LINE_HEIGHT=22}getHeight(i){if(i instanceof Th){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 rM?"rm":i instanceof Th?"m":"ri"}};var sqt=class{constructor(i,e){this.labels=i;this.renderedNodes=new Map;this.disposables=new P;this.templateId="rm";e(this.onDidChangeRenderNodeCount,this,this.disposables)}renderTemplate(i){let e=R(i,_(".resource-label-container")),t=this.labels.create(e,{supportHighlights:!0}),o=R(i,_(".count-badge-wrapper"));return{count:new fv(o,{},BS),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 uBe=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 ENi(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()}};uBe=I([m(1,tt),m(2,F),m(3,Qe)],uBe);var rwo=Re("markers-view-multi-line-expanded",M.chevronUp,d(11009,null)),gsn=Re("markers-view-multi-line-collapsed",M.chevronDown,d(11008,null)),owo="problems.action.toggleMultiline",kNi=class extends Lr{render(i){super.render(i),this.updateExpandedAttribute()}updateClass(){super.updateClass(),this.updateExpandedAttribute()}updateExpandedAttribute(){this.element?.setAttribute("aria-expanded",`${this._action.class===q.asClassName(rwo)}`)}},ENi=class extends C{constructor(e,t,o,n,r){super();this.parent=e;this.markersViewModel=t;this._hoverService=o;this._openerService=n;this.disposables=this._register(new P);this.actionBar=this._register(new ji(R(e,_(".actions")),{actionViewItemProvider:(s,l)=>s.id===rfe.ID?r.createInstance(Coe,s,l):void 0})),this.iconContainer=R(e,_("")),this.icon=R(this.iconContainer,_("")),this.messageAndDetailsContainer=R(e,_(".marker-message-details-container")),this.messageAndDetailsContainerHover=this._register(this._hoverService.setupManagedHover(Ni("mouse"),this.messageAndDetailsContainer,""))}render(e,t){this.actionBar.clear(),this.disposables.clear(),Rt(this.messageAndDetailsContainer),this.iconContainer.className=`marker-icon ${gt.toString(cl.toSeverity(e.marker.severity))}`,this.icon.className=`codicon ${Px.className(cl.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})=>{Jn(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 ji(R(t,_(".multiline-actions")),{actionViewItemProvider:(l,c)=>{if(l.id===owo)return new kNi(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 st(owo));s.enabled=!!n&&e.lines.length>1,s.tooltip=r?d(11012,null):d(11010,null),s.class=q.asClassName(r?rwo:gsn),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=R(this.messageAndDetailsContainer,_(".marker-message-line")),h=R(p,_(".marker-message"));this.disposables.add(new Oa(h)).set(n[u].length>1e3?`${n[u].substring(0,1e3)}...`:n[u],l[u]),n[u]===""&&(p.style.height=`${hst.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 Oa(R(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 Oa(R(o,_(".marker-code")))),c=t&&t.codeMatches||[];l.set(e.code,c)}else{let l=_(".marker-code"),c=this.disposables.add(new Oa(l)),u=e.code.target.toString(!0);this.disposables.add(new Xg(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=R(o,_("span.marker-line"));n.textContent=hp.MARKERS_PANEL_AT_LINE_COL_NUMBER(e.startLineNumber,e.startColumn)}},pBe=class{constructor(i){this.labelService=i;this.templateId="ri"}renderTemplate(i){let e=Object.create(null);R(i,_(".actions")),R(i,_(".icon")),e.resourceLabel=new Oa(R(i,_(".related-info-resource"))),e.lnCol=R(i,_("span.marker-line"));let t=R(i,_("span.related-info-resource-separator"));return t.textContent=":",t.style.paddingRight="4px",e.description=new Oa(R(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(Ye(o.resource),n,s),t.lnCol.textContent=hp.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()}};pBe=I([m(0,ot)],pBe);var aqt=class{constructor(i){this.options=i}filter(i,e){return i instanceof rM?this.filterResourceMarkers(i):i instanceof Th?this.filterMarker(i,e):this.filterRelatedInformation(i,e)}filterResourceMarkers(i){if(npe.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=Nk._filter(this.options.textFilter.text,Ye(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=Nk._messageFilter(this.options.textFilter.text,l);o.push(c||[])}let n=i.marker.source?Nk._filter(this.options.textFilter.text,i.marker.source):void 0,r=i.marker.code?Nk._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=Nk._filter(this.options.textFilter.text,Ye(i.raw.resource)),o=Nk._messageFilter(this.options.textFilter.text,No(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}},mst=class extends C{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(rfe,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=xn(o=>DL(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:gr.QuickFix}},bm.None,o).then(n=>this._register(n)))),this.codeActionsPromise):null)}toActions(e){return e.validActions.map(t=>pi({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(Nq,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}},Un).then(()=>{})}getModel(e){let t=this.modelService.getModel(this.marker.resource);return t?Promise.resolve(t):e?(this.modelPromise||(this.modelPromise=xn(o=>new Promise(n=>{this._register(this.modelService.onModelAdded(r=>{Xe(r.uri,this.marker.resource)&&n(r)}))}))),this.modelPromise):Promise.resolve(null)}};mst=I([m(1,Ct),m(2,F),m(3,ee),m(4,zt)],mst);var mBe=class extends C{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 jo(300));this._multiline=!0;this._viewMode="tree";this._multiline=e,this._viewMode=t,this.viewModeContextKey=mp.MarkersViewModeContextKey.bindTo(this.contextKeyService),this.viewModeContextKey.set(t)}add(e){if(!this.markersViewStates.has(e.id)){let t=this.instantiationService.createInstance(mst,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&&Ue(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})=>Ue(e)),this.markersViewStates.clear(),this.markersPerResource.clear(),super.dispose()}};mBe=I([m(2,X),m(3,F)],mBe);function swo(a){return ht.map(a.markers,i=>{let e=ht.from(i.relatedInformation),t=ht.map(e,o=>({element:o}));return{element:i,children:t}})}var hBe=class extends iF{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){let S=new Bl(wr.MARKERS_VIEW_STORAGE_ID,g),y=S.getMemento(1,1);super({...e,filterOptions:{ariaLabel:hp.MARKERS_PANEL_FILTER_ARIA_LABEL,placeholder:hp.MARKERS_PANEL_FILTER_PLACEHOLDER,focusContextKey:mp.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 P);this.widgetDisposables=this._register(new P);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(eqt)),this.markersViewModel=this._register(t.createInstance(mBe,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(dBe),this.widgetIdentityProvider={getId(w){return w.id}},this.setCurrentActiveEditor(),this.filter=new aqt(Nk.EMPTY(p)),this.rangeHighlightDecorations=this._register(this.instantiationService.createInstance(OF)),this.filters=this._register(new oqt({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(zE({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 Ii(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=R(e,_(".markers-panel-container"));this.createArialLabelElement(t),this.createMessageBox(t),this.widgetContainer=R(t,_(".widget-container")),this.createWidget(this.widgetContainer),this.updateFilter(),this.renderContent()}getTitle(){return hp.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(),!sa(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(11016,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 Th?{resource:e.resource,selection:e.range}:e instanceof R0?{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?vn:Un).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 Th?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 Nk(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 Xi(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=R(e,_(".message-box-container")),this.messageBoxContainer.setAttribute("aria-labelledby","markers-panel-arialabel")}createArialLabelElement(e){this.ariaLabelElement=R(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=mp.MarkerFocusContextKey.bindTo(this.widget.contextKeyService),o=mp.RelatedInformationFocusContextKey.bindTo(this.widget.contextKeyService);this.widgetDisposables.add(this.widget.onDidChangeFocus(n=>{t.set(n.elements.some(r=>r instanceof Th)),o.set(n.elements.some(r=>r instanceof R0))})),this.widgetDisposables.add(H.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(H.any(this.widget.onDidChangeSelection,this.widget.onDidChangeFocus)(()=>{let n=[...this.widget.getSelection(),...this.widget.getFocus()];for(let r of n)r instanceof Th&&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(cBe,R(e,_(".markers-table-container")),this.markersViewModel,this.getResourceMarkers(),this.filter.options,{accessibilityProvider:this.widgetAccessibilityProvider,dnd:this.instantiationService.createInstance(k5,o=>o instanceof KA?fL(o.resource,o.range):null),horizontalScrolling:!1,identityProvider:this.widgetIdentityProvider,multipleSelectionSupport:!0,selectionNavigation:!0})}createTree(e){let t=new Mh,o=this.instantiationService.createInstance(Za,this),n=new hst(this.markersViewModel),r=[this.instantiationService.createInstance(sqt,o,t.event),this.instantiationService.createInstance(uBe,this.markersViewModel),this.instantiationService.createInstance(pBe)],s=this.instantiationService.createInstance(gst,"MarkersView",R(e,_(".tree-container.show-file-icons")),n,r,{filter:this.filter,accessibilityProvider:this.widgetAccessibilityProvider,identityProvider:this.widgetIdentityProvider,dnd:this.instantiationService.createInstance(fst),expandOnlyOnTwistieClick:l=>l instanceof Th&&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(Pg(t(),tqt).map(o=>[o[0].resource,o])),e.push(H.debounce(this.markerService.onMarkerChanged,(o,n)=>(o=o||new vt,n.forEach(r=>o.set(r,r)),o),64)(o=>{this.markersModel.setResourceMarkers([...o.values()].map(n=>[n,t(n)]))})),e.push(H.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 rM?o.markers.forEach(n=>e.add(n)):(o instanceof Th||o instanceof KA)&&e.add(o);let t=new Set;for(let o of this.widget.getFocus())(o instanceof Th||o instanceof KA)&&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?no.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(11014,null,e)):this.setAriaLabel(d(11015,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=R(e,_("span"));t.textContent=hp.MARKERS_PANEL_NO_PROBLEMS_FILTERS;let o=R(e,_("a.messageAction"));o.textContent=d(11013,null),o.setAttribute("tabIndex","0");let n=R(e,_("span"));n.textContent=".",Vo(o,re.CLICK,()=>this.clearFilters()),Vo(o,re.KEY_DOWN,r=>{(r.equals(3)||r.equals(10))&&(this.clearFilters(),r.stopPropagation())}),this.setAriaLabel(hp.MARKERS_PANEL_NO_PROBLEMS_FILTERS)}renderNoProblemsMessageForActiveFile(e){let t=R(e,_("span"));t.textContent=hp.MARKERS_PANEL_NO_PROBLEMS_ACTIVE_FILE_BUILT,this.setAriaLabel(hp.MARKERS_PANEL_NO_PROBLEMS_ACTIVE_FILE_BUILT)}renderNoProblemsMessage(e){let t=R(e,_("span"));t.textContent=hp.MARKERS_PANEL_NO_PROBLEMS_BUILT,this.setAriaLabel(hp.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(),sa(this.widget.getHTMLElement())&&this.highlightCurrentSelectedMarkerRange()}highlightCurrentSelectedMarkerRange(){let e=this.widget.getSelection()??[];if(e.length!==1)return;let t=e[0];t instanceof Th&&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 Lr(o,o,{label:!0,keybinding:n.getLabel()})},onHide:o=>{o&&this.widget.domFocus()}}))}getMenuActions(e){let t=[];if(e instanceof Th){let o=this.markersViewModel.getViewModel(e);if(o){let n=o.quickFixAction.quickFixes;n.length&&(t.push(...n),t.push(new li))}}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()}};hBe=I([m(1,F),m(2,Ri),m(3,ee),m(4,B),m(5,Ns),m(6,X),m(7,Pe),m(8,ze),m(9,dt),m(10,_e),m(11,le),m(12,Qe),m(13,De),m(14,tt)],hBe);var gst=class extends mg{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=mp.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,ht.map(e,t=>({element:t,children:swo(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 rM?o.markers[0]:o instanceof Th?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,swo(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 Th&&o.element.marker===e.marker)return o.element;return null}hasSelectedMarkerFor(e){let t=this.getSelection();return!!(t&&t.length>0&&t[0]instanceof Th&&e.has(t[0].marker.resource))}dispose(){super.dispose()}layout(e,t){this.container.style.height=`${e}px`,super.layout(e,t)}};gst=I([m(5,F),m(6,X),m(7,fo),m(8,De),m(9,B)],gst);var fst=class extends k5{constructor(i){super(e=>e instanceof KA?fL(e.resource,e.range):e instanceof rM?e.resource:e instanceof Th?fL(e.resource,e.range):e instanceof R0?fL(e.raw.resource,e.raw):null,i)}onWillDragElements(i,e){let t=i.map(o=>{if(o instanceof R0||o instanceof Th)return o.marker;if(o instanceof rM)return{uri:o.resource}}).filter(mo);t.length&&V$i(t,e)}};fst=I([m(0,F)],fst);var vst=class{constructor(i,e,t){this._markerService=i;this._labelService=e;this._editorService=t;this.type="pickerPick";this.label=d(10996,null);this.icon=M.error;this.ordinal=-100}isEnabled(i){return!!i.attachmentCapabilities.supportsProblemAttachments}asPicker(){return{placeholder:d(10997,null),picks:Xde(async(i,e)=>this.getPicksForQuery(i))}}getPicksForQuery(i){let e=this._markerService.read({severities:14}),t=Pg(e,(c,u)=>ar.compare(c.resource,u.resource)),o=no.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(10999,null,""+f.startLineNumber,""+f.startColumn),asAttachment(){return uP.toEntry(uP.fromMarker(f))}})}return s.unshift({label:d(10998,null),asAttachment(){return uP.toEntry({filterSeverity:2})}}),s}};vst=I([m(0,Ns),m(1,ot),m(2,ee)],vst);var sfe=class extends C{static{this.ID="workbench.contrib.chat.markerChatContextContribution"}constructor(i,e){super(),this._store.add(i.registerChatContextItem(e.createInstance(vst)))}};sfe=I([m(0,uS),m(1,F)],sfe);var lqt=class{constructor(){this.type="help";this.priority=105;this.name="problemsFilter";this.when=mp.MarkerViewFilterFocusContextKey}getProvider(i){return new TNi(i.get(_e))}},TNi=class extends C{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(10966,null)),e.push(d(10957,null)),e.push(""),e.push(d(10991,null)),e.push(d(10990,null)),e.push(""),e.push(d(10968,null)),e.push(d(10967,null)),e.push(""),e.push(d(10960,null)),e.push(d(10958,null)),e.push(d(10959,null)),e.push(""),e.push(d(10965,null)),e.push(d(10961,null)),e.push(d(10962,null)),e.push(d(10963,null)),e.push(d(10964,null)),e.push(""),e.push(d(10994,null)),e.push(d(10995,null)),e.push(d(10993,null)),e.push(d(10992,null)),e.push(""),e.push(d(10986,null)),e.push(d(10988,null)),e.push(d(10985,null)),e.push(d(10989,null)),e.push(d(10987,null)),e.push(d(10983,null)),e.push(d(10984,null)),e.push(""),e.push(d(10969,null)),e.push(d(10970,null)),e.push(d(10975,null)),e.push(d(10971,null)),e.push(d(10973,null,this._describeCommand("editor.action.marker.nextInFiles")||"F8")),e.push(d(10974,null,this._describeCommand("editor.action.marker.prevInFiles")||"Shift+F8")),e.push(d(10972,null)),e.push(""),e.push(d(10977,null,this._describeCommand("workbench.action.openSettings")||"Ctrl+,")),e.push(d(10979,null)),e.push(d(10981,null)),e.push(d(10976,null)),e.push(d(10982,null)),e.push(d(10980,null)),e.push(d(10978,null)),e.push(""),e.push(d(10956,null)),e.push(d(10955,null)),e.join(`
`)}_describeCommand(e){return this._keybindingService.lookupKeybinding(e)?.getAriaLabel()??void 0}onClose(){}};yt.registerCommandAndKeybindingRule({id:wr.MARKER_OPEN_ACTION_ID,weight:200,when:x.and(mp.MarkerFocusContextKey),primary:3,mac:{primary:3,secondary:[2066]},handler:(a,i)=>{let e=a.get(Ft).getActiveViewWithId(wr.MARKERS_VIEW_ID);e.openFileAtElement(e.getFocusElement(),!1,!1,!0)}});yt.registerCommandAndKeybindingRule({id:wr.MARKER_OPEN_SIDE_ACTION_ID,weight:200,when:x.and(mp.MarkerFocusContextKey),primary:2051,mac:{primary:259},handler:(a,i)=>{let e=a.get(Ft).getActiveViewWithId(wr.MARKERS_VIEW_ID);e.openFileAtElement(e.getFocusElement(),!1,!0,!0)}});yt.registerCommandAndKeybindingRule({id:wr.MARKER_SHOW_PANEL_ID,weight:200,when:void 0,primary:void 0,handler:async(a,i)=>{await a.get(Ft).openView(wr.MARKERS_VIEW_ID)}});yt.registerCommandAndKeybindingRule({id:wr.MARKER_SHOW_QUICK_FIX,weight:200,when:mp.MarkerFocusContextKey,primary:2137,handler:(a,i)=>{let e=a.get(Ft).getActiveViewWithId(wr.MARKERS_VIEW_ID),t=e.getFocusElement();t instanceof Th&&e.showQuickFixes(t)}});oe.as(ii.Configuration).registerConfiguration({...V_t,properties:{"problems.autoReveal":{description:hp.PROBLEMS_PANEL_CONFIGURATION_AUTO_REVEAL,type:"boolean",default:!0},"problems.defaultViewMode":{description:hp.PROBLEMS_PANEL_CONFIGURATION_VIEW_MODE,type:"string",default:"tree",enum:["table","tree"]},"problems.showCurrentInStatus":{description:hp.PROBLEMS_PANEL_CONFIGURATION_SHOW_CURRENT_STATUS,type:"boolean",default:!1},"problems.sortOrder":{description:hp.PROBLEMS_PANEL_CONFIGURATION_COMPARE_ORDER,type:"string",default:"severity",enum:["severity","position"],enumDescriptions:[hp.PROBLEMS_PANEL_CONFIGURATION_COMPARE_ORDER_SEVERITY,hp.PROBLEMS_PANEL_CONFIGURATION_COMPARE_ORDER_POSITION]}}});var awo=Re("markers-view-icon",M.warning,d(10928,null)),fsn=oe.as(on.ViewContainersRegistry).registerViewContainer({id:wr.MARKERS_CONTAINER_ID,title:hp.MARKERS_PANEL_TITLE_PROBLEMS,icon:awo,hideIfEmpty:!0,order:0,ctorDescriptor:new Mt(Ha,[wr.MARKERS_CONTAINER_ID,{mergeViewWithContainerWhenSingleView:!0}]),storageId:wr.MARKERS_VIEW_STORAGE_ID},1,{doNotRegisterOpenCommand:!0});oe.as(on.ViewsRegistry).registerViews([{id:wr.MARKERS_VIEW_ID,containerIcon:awo,name:hp.MARKERS_PANEL_TITLE_PROBLEMS,canToggleVisibility:!0,canMoveView:!0,ctorDescriptor:new Mt(hBe),openCommandActionDescriptor:{id:"workbench.actions.view.problems",mnemonicTitle:d(10929,null),keybindings:{primary:3115},order:0}}],fsn);var lwo=oe.as(Qi.Workbench);W(class extends Fn{constructor(){super({id:`workbench.actions.table.${wr.MARKERS_VIEW_ID}.viewAsTree`,title:d(10953,null),metadata:{description:L(10954,"Show the problems view as a tree.")},menu:{id:D.ViewTitle,when:x.and(x.equals("view",wr.MARKERS_VIEW_ID),mp.MarkersViewModeContextKey.isEqualTo("table")),group:"navigation",order:3},icon:M.listTree,viewId:wr.MARKERS_VIEW_ID})}async runInView(a,i){i.setViewMode("tree")}});W(class extends Fn{constructor(){super({id:`workbench.actions.table.${wr.MARKERS_VIEW_ID}.viewAsTable`,title:d(10951,null),metadata:{description:L(10952,"Show the problems view as a table.")},menu:{id:D.ViewTitle,when:x.and(x.equals("view",wr.MARKERS_VIEW_ID),mp.MarkersViewModeContextKey.isEqualTo("tree")),group:"navigation",order:3},icon:M.listFlat,viewId:wr.MARKERS_VIEW_ID})}async runInView(a,i){i.setViewMode("table")}});W(class extends Fn{constructor(){super({id:`workbench.actions.${wr.MARKERS_VIEW_ID}.toggleErrors`,title:d(10933,null),metadata:{description:L(10943,"Show or hide errors in the problems view.")},category:d(10931,null),toggled:mp.ShowErrorsFilterContextKey,menu:{id:TC,group:"1_filter",when:x.equals("view",wr.MARKERS_VIEW_ID),order:1},viewId:wr.MARKERS_VIEW_ID})}async runInView(a,i){i.filters.showErrors=!i.filters.showErrors}});W(class extends Fn{constructor(){super({id:`workbench.actions.${wr.MARKERS_VIEW_ID}.toggleWarnings`,title:d(10938,null),metadata:{description:L(10946,"Show or hide warnings in the problems view.")},category:d(10931,null),toggled:mp.ShowWarningsFilterContextKey,menu:{id:TC,group:"1_filter",when:x.equals("view",wr.MARKERS_VIEW_ID),order:2},viewId:wr.MARKERS_VIEW_ID})}async runInView(a,i){i.filters.showWarnings=!i.filters.showWarnings}});W(class extends Fn{constructor(){super({id:`workbench.actions.${wr.MARKERS_VIEW_ID}.toggleInfos`,title:d(10935,null),category:d(10931,null),toggled:mp.ShowInfoFilterContextKey,metadata:{description:L(10945,"Show or hide infos in the problems view.")},menu:{id:TC,group:"1_filter",when:x.equals("view",wr.MARKERS_VIEW_ID),order:3},viewId:wr.MARKERS_VIEW_ID})}async runInView(a,i){i.filters.showInfos=!i.filters.showInfos}});W(class extends Fn{constructor(){super({id:`workbench.actions.${wr.MARKERS_VIEW_ID}.toggleActiveFile`,title:d(10932,null),metadata:{description:L(10942,"Show or hide problems (errors, warnings, info) only from the active file in the problems view.")},category:d(10931,null),toggled:mp.ShowActiveFileFilterContextKey,menu:{id:TC,group:"2_filter",when:x.equals("view",wr.MARKERS_VIEW_ID),order:1},viewId:wr.MARKERS_VIEW_ID})}async runInView(a,i){i.filters.activeFile=!i.filters.activeFile}});W(class extends Fn{constructor(){super({id:`workbench.actions.${wr.MARKERS_VIEW_ID}.toggleExcludedFiles`,title:d(10934,null),metadata:{description:L(10944,"Show or hide excluded files in the problems view.")},category:d(10931,null),toggled:mp.ShowExcludedFilesFilterContextKey.negate(),menu:{id:TC,group:"2_filter",when:x.equals("view",wr.MARKERS_VIEW_ID),order:2},viewId:wr.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:hp.MARKERS_PANEL_SHOW_LABEL,category:We.View,f1:!0})}async run(a){a.get(Ft).openView(wr.MARKERS_VIEW_ID,!0)}});var cqt=class extends Fn{getSelectedMarkers(i){let e=i.getFocusedSelectedElements()||i.getAllResourceMarkers(),t=[],o=n=>{t.includes(n)||t.push(n)};for(let n of e)n instanceof rM?n.markers.forEach(o):n instanceof Th&&o(n);return t}};W(class extends cqt{constructor(){let a=x.and(Vl.isEqualTo(wr.MARKERS_VIEW_ID),mp.MarkersTreeVisibilityContextKey,mp.RelatedInformationFocusContextKey.toNegated());super({id:wr.MARKER_COPY_ACTION_ID,title:L(10923,"Copy"),menu:{id:D.ProblemsPanelContext,when:a,group:"navigation"},keybinding:{weight:200,primary:2081,when:a},viewId:wr.MARKERS_VIEW_ID})}async runInView(a,i){let e=a.get(Wi),t=this.getSelectedMarkers(i);t.length&&await e.writeText(`[${t}]`)}});W(class extends cqt{constructor(){super({id:wr.MARKER_COPY_MESSAGE_ACTION_ID,title:L(10924,"Copy Message"),menu:{id:D.ProblemsPanelContext,when:mp.MarkerFocusContextKey,group:"navigation"},viewId:wr.MARKERS_VIEW_ID})}async runInView(a,i){let e=a.get(Wi),t=this.getSelectedMarkers(i);t.length&&await e.writeText(t.map(o=>o.marker.message).join(`
`))}});W(class extends Fn{constructor(){super({id:wr.RELATED_INFORMATION_COPY_MESSAGE_ACTION_ID,title:L(10924,"Copy Message"),menu:{id:D.ProblemsPanelContext,when:mp.RelatedInformationFocusContextKey,group:"navigation"},viewId:wr.MARKERS_VIEW_ID})}async runInView(a,i){let e=a.get(Wi),t=i.getFocusElement();t instanceof R0&&await e.writeText(t.raw.message)}});W(class extends Fn{constructor(){super({id:wr.FOCUS_PROBLEMS_FROM_FILTER,title:d(10926,null),keybinding:{when:mp.MarkerViewFilterFocusContextKey,weight:200,primary:2066},viewId:wr.MARKERS_VIEW_ID})}async runInView(a,i){i.focus()}});W(class extends Fn{constructor(){super({id:wr.MARKERS_VIEW_FOCUS_FILTER,title:d(10925,null),keybinding:{when:Vl.isEqualTo(wr.MARKERS_VIEW_ID),weight:200,primary:2084},viewId:wr.MARKERS_VIEW_ID})}async runInView(a,i){i.focusFilter()}});W(class extends Fn{constructor(){super({id:wr.MARKERS_VIEW_SHOW_MULTILINE_MESSAGE,title:L(10936,"Show message in multiple lines"),category:d(10931,null),menu:{id:D.CommandPalette,when:x.has(O8e(wr.MARKERS_VIEW_ID))},viewId:wr.MARKERS_VIEW_ID})}async runInView(a,i){i.setMultiline(!0)}});W(class extends Fn{constructor(){super({id:wr.MARKERS_VIEW_SHOW_SINGLELINE_MESSAGE,title:L(10937,"Show message in single line"),category:d(10931,null),menu:{id:D.CommandPalette,when:x.has(O8e(wr.MARKERS_VIEW_ID))},viewId:wr.MARKERS_VIEW_ID})}async runInView(a,i){i.setMultiline(!1)}});W(class extends Fn{constructor(){super({id:wr.MARKERS_VIEW_CLEAR_FILTER_TEXT,title:d(10921,null),category:d(10931,null),keybinding:{when:mp.MarkerViewFilterFocusContextKey,weight:200,primary:9},viewId:wr.MARKERS_VIEW_ID})}async runInView(a,i){i.clearFilterText()}});W(class extends Fn{constructor(){super({id:`workbench.actions.treeView.${wr.MARKERS_VIEW_ID}.collapseAll`,title:d(10922,null),menu:{id:D.ViewTitle,when:x.and(x.equals("view",wr.MARKERS_VIEW_ID),mp.MarkersViewModeContextKey.isEqualTo("tree")),group:"navigation",order:2},icon:M.collapseAll,viewId:wr.MARKERS_VIEW_ID})}async runInView(a,i){return i.collapseAll()}});W(class extends K{constructor(){super({id:wr.TOGGLE_MARKERS_VIEW_ACTION_ID,title:hp.MARKERS_PANEL_TOGGLE_LABEL})}async run(a){let i=a.get(Ft);i.isViewVisible(wr.MARKERS_VIEW_ID)?i.closeView(wr.MARKERS_VIEW_ID):i.openView(wr.MARKERS_VIEW_ID,!0)}});var bst=class extends C{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(10939,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(10941,null);return{name:d(10940,null),text:"$(whole-word)",ariaLabel:o,tooltip:o,kind:"warning",command:{title:e,arguments:[t],id:e}}}getMarkersTooltip(e){let t=s=>d(10947,null,s),o=s=>d(10950,null,s),n=s=>d(10948,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(10930,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(10927,null);return e>9999?t:e>999?e.toString().charAt(0)+"K":e.toString()}};bst=I([m(0,Ns),m(1,Tr),m(2,B)],bst);lwo.registerWorkbenchContribution(bst,3);pt(sfe.ID,sfe,ut.AfterRestored);var Sst=class extends C{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(10949,null,n);this.activity.value=this.activityService.showViewActivity(wr.MARKERS_VIEW_ID,{badge:new qc(n,()=>r)})}else this.activity.value=void 0}};Sst=I([m(0,zl),m(1,Ns)],Sst);lwo.registerWorkbenchContribution(Sst,3);xa.register(new lqt);var vsn=Re("process-explorer-editor-label-icon",M.serverProcess,d(12630,null)),M0=class a extends Us{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(12631,null)}getIcon(){return vsn}matches(e){return super.matches(e)?!0:e instanceof a}};var gBe=class{static{this.ID="workbench.contrib.processExplorerEditor"}constructor(i,e){i.registerEditor(`${M0.RESOURCE.scheme}:**/**`,{id:M0.ID,label:d(12619,null),priority:"exclusive"},{singlePerResource:!0,canSupportResource:t=>t.scheme===M0.RESOURCE.scheme},{createEditorInput:()=>({editor:e.createInstance(M0),options:{pinned:!0}})})}};gBe=I([m(0,ul),m(1,F)],gBe);pt(gBe.ID,gBe,ut.BlockStartup);var _Ni=class{canSerialize(i){return!0}serialize(i){return""}deserialize(i){return M0.instance}};oe.as(rn.EditorFactory).registerEditorSerializer(M0.ID,_Ni);var cwo=x.or(ep.negate(),ub.notEqualsTo("")),dqt=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(12618,"Open Process Explorer"),category:We.Developer,precondition:cwo,f1:!0})}async run(i){let e=i.get(ee),t=i.get(Et),o=i.get($P),n=i.get(le),r=await e.openEditor({resource:M0.RESOURCE,options:{pinned:!0,revealIfOpened:!0,auxiliary:{...this.loadState(n),compact:!0,alwaysOnTop:!0}}},hg);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(dqt);fe.appendMenuItem(D.MenubarHelpMenu,{group:"5_tools",command:{id:dqt.ID,title:d(12617,null)},when:cwo,order:2});var $Bf=J("mergeEditor.change.background","#9bb95533",d(11531,null)),qBf=J("mergeEditor.change.word.background",{dark:"#9ccc2c33",light:"#9ccc2c66",hcDark:"#9ccc2c33",hcLight:"#9ccc2c66"},d(11532,null)),jBf=J("mergeEditor.changeBase.background",{dark:"#4B1818FF",light:"#FFCCCCFF",hcDark:"#4B1818FF",hcLight:"#FFCCCCFF"},d(11533,null)),QBf=J("mergeEditor.changeBase.word.background",{dark:"#6F1313FF",light:"#FFA3A3FF",hcDark:"#6F1313FF",hcLight:"#FFA3A3FF"},d(11534,null)),YBf=J("mergeEditor.conflict.unhandledUnfocused.border",{dark:"#ffa6007a",light:"#ffa600FF",hcDark:"#ffa6007a",hcLight:"#ffa6007a"},d(11542,null)),XBf=J("mergeEditor.conflict.unhandledFocused.border","#ffa600",d(11541,null)),JBf=J("mergeEditor.conflict.handledUnfocused.border","#86868649",d(11537,null)),ZBf=J("mergeEditor.conflict.handledFocused.border","#c1c1c1cc",d(11536,null)),iQ=J("mergeEditor.conflict.handled.minimapOverViewRuler","#adaca8ee",d(11535,null)),oQ=J("mergeEditor.conflict.unhandled.minimapOverViewRuler","#fcba03FF",d(11540,null)),eHf=J("mergeEditor.conflictingLines.background","#ffea0047",d(11543,null)),dwo=.4,tHf=J("mergeEditor.conflict.input1.background",ei(N$e,dwo),d(11538,null)),iHf=J("mergeEditor.conflict.input2.background",ei(O$e,dwo),d(11539,null));var _oe=class extends C{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=Nr("onDidChangeViewZones",this._editor.onDidChangeViewZones),this.editorOnDidContentSizeChange=Nr("onDidContentSizeChange",this._editor.onDidContentSizeChange),this.domNodeSizeChanged=Wc("domNodeSizeChanged"),this.views=new Map,this._domNode.className="gutter monaco-editor";let n=this._domNode.appendChild(bt("div.scroll-decoration",{role:"presentation",ariaHidden:"true",style:{width:"100%"}}).root),r=new ResizeObserver(()=>{Ui(s=>{this.domNodeSizeChanged.trigger(s)})});r.observe(this._domNode),this._register(Z(()=>r.disconnect())),this._register(he(s=>{n.className=this.isScrollTopZero.read(s)?"":"scroll-decoration"})),this._register(he(s=>this.render(s)))}dispose(){super.dispose(),Fi(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=Qh.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 DNi(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)}}},DNi=class{constructor(i,e){this.gutterItemView=i;this.domNode=e}};var Doe=class extends C{constructor(e,t,o){super();this.instantiationService=e;this.viewModel=t;this.configurationService=o;this.model=this.viewModel.map(n=>n?.model),this.htmlElements=bt("div.code-view",[bt("div.header@header",[bt("span.title@title"),bt("span.description@description"),bt("span.detail@detail"),bt("span.toolbar@toolbar")]),bt("div.container",[bt("div.gutter@gutterDiv"),bt("div@editor")])]),this._onDidViewChange=this._register(new E),this.view={element:this.htmlElements.root,minimumWidth:FE.width,maximumWidth:Jj.width,minimumHeight:FE.height,maximumHeight:Jj.height,onDidChange:this._onDidViewChange.event,layout:(n,r,s,l)=>{BXi(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=pr("mergeEditor.showCheckboxes",!1,this.configurationService),this.showDeletionMarkers=pr("mergeEditor.showDeletionMarkers",!0,this.configurationService),this.useSimplifiedDecorations=pr("mergeEditor.useSimplifiedDecorations",!1,this.configurationService),this.editor=this.instantiationService.createInstance(jr,this.htmlElements.editor,{},{contributions:this.getEditorContributions()}),this.isFocused=ui(this,H.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 aa.getEditorContributions().filter(e=>e.id!==Qg.ID&&e.id!==Oq.ID)}};function fBe(a,i){let e=Ce(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 he(t=>{let o=e.read(t);o.length!==0&&a.editor.setSelections(o.map(n=>new Yt(n.startLineNumber,n.startColumn,n.endLineNumber,n.endColumn)))})}var vG=class extends C{constructor(i,e,t){super();let o=t.createInstance(Ln,e,i,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:n=>n==="primary"}});this._store.add(o)}};vG=I([m(2,F)],vG);var vBe=class extends Doe{constructor(e,t,o){super(t,e,o);this.decorations=Ce(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?iQ:oQ}},overviewRuler:u.isConflicting?{position:2,color:{id:h?iQ:oQ}}:void 0}})}return c});this._register(fBe(this,(n,r)=>n)),this._register(t.createInstance(vG,D.MergeBaseToolbar,this.htmlElements.title)),this._register(Ga((n,r)=>{this.checkboxesVisible.read(n)&&r.add(new _oe(this.editor,this.htmlElements.gutterDiv,{getIntersectingGutterItems:(s,l)=>[],createView:(s,l)=>{throw new ni}}))})),this._register(he(n=>{let r=this.viewModel.read(n);if(!r)return;this.editor.setModel(r.model.base),Fi(this.htmlElements.title,...Bn(d(11562,null)));let s=r.baseShowDiffAgainst.read(n),l;if(s){let c=d(11563,null,s===1?r.model.input1.title:r.model.input2.title),u=d(11564,null);l=bt("span",{title:u},[c]).root}Fi(this.htmlElements.description,...l?[l]:[])})),this._register(qke(this.editor,this.decorations))}};vBe=I([m(1,F),m(2,B)],vBe);var uqt=class extends C{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 oX;this._isSyncing=!0;let l=Ce(c=>{let u=this.baseView.read(c),p=[this.input1View,this.input2View,this.inputResultView,u].filter(mo),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 qO(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 qO(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 qO(o,-1):void 0}else if(t===this.input2View){let o=this.model?.baseInput2Diffs.get();return o?new qO(o,-1):void 0}else if(t===this.inputResultView){let o=this.model?.baseResultMapping.get();return o||void 0}}throw new ni}_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 bBe=class extends C{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=Le(this,{range:void 0,counter:0}),this.attachedHistory=this._register(new LNi(this.model.resultTextModel)),this.shouldUseAppendInsteadOfAccept=pr("mergeEditor.shouldUseAppendInsteadOfAccept",!1,this.configurationService),this.counter=0,this.lastFocusedEditor=TGe(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=Ce(this,u=>{let p=this.lastFocusedEditor.read(u);if(p.view===this.inputCodeEditorView1)return 1;if(p.view===this.inputCodeEditorView2)return 2}),this.focusedEditorType=Ce(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=Ce(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=Ce(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(Qh.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(){Ui(g=>{for(let f of p)this.model.setHandled(f,!0,g)})},undo(){Ui(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()&&(Ui(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)=>ju(this.model.modifiedBaseRanges.get(),n=>e(n)&&this.getRangeOfModifiedBaseRange(t,n,void 0).endLineNumberExclusive<o)||ju(this.model.modifiedBaseRanges.get(),n=>e(n)))}toggleActiveConflict(e){let t=this.activeModifiedBaseRange.get();if(!t){this.notificationService.error(d(11581,null));return}Ui(o=>{this.setState(t,this.model.getState(t).get().toggle(e),o,e)})}acceptAll(e){Ui(t=>{for(let o of this.model.modifiedBaseRanges.get())this.setState(o,this.model.getState(o).get().withInputValue(e,!0),t,e)})}};bBe=I([m(6,B),m(7,Ne)],bBe);var LNi=class extends C{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 pqt=class a extends C{constructor(e,t,o,n,r){super();this.editor=e;this.overlayWidgetId=`fixedZoneWidget-${a.counter++}`;this.widgetDomNode=bt("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(H.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 SBe=class extends C{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_"+Ir(this._editor.getId()).toString(16),this._styleElement=hr(x$(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}), ${Yd.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 RNi(this._editor,e,t,r.codeLensHeight+2,this._styleClassName,o,n)}},mqt=class{constructor(i,e){this.viewModel=i;this.modifiedBaseRange=e;this.itemsInput1=this.getItemsInput(1);this.itemsInput2=this.getItemsInput(2);this.resultItems=Ce(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(11553,null),tooltip:d(11554,null)});else if(o.kind===0)r.push({text:d(11556,null),tooltip:d(11557,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(Loe(d(11558,null,n.input1.title),async()=>{Ui(l=>{n.setState(t,o.withInputValue(1,!1),!0,l),n.telemetry.reportRemoveInvoked(1,o.includesInput(2))})},d(11559,null,n.input1.title))),o.includesInput2&&s.push(Loe(d(11558,null,n.input2.title),async()=>{Ui(l=>{n.setState(t,o.withInputValue(2,!1),!0,l),n.telemetry.reportRemoveInvoked(2,o.includesInput(1))})},d(11559,null,n.input2.title))),o.kind===3&&o.firstInput===2&&s.reverse(),r.push(...s),o.kind===4&&r.push(Loe(d(11560,null),async()=>{Ui(l=>{n.setState(t,oS.base,!0,l),n.telemetry.reportResetToBaseInvoked()})},d(11561,null))),r});this.isEmpty=Ce(this,i=>this.itemsInput1.read(i).length+this.itemsInput2.read(i).length+this.resultItems.read(i).length===0);this.inputIsEmpty=Ce(this,i=>this.itemsInput1.read(i).length+this.itemsInput2.read(i).length===0)}getItemsInput(i){return Ce(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(Loe(d(11544,null,c.title),async()=>{Ui(h=>{s.setState(o,n.withInputValue(i,!0,!1),i,h),s.telemetry.reportAcceptInvoked(i,n.includesInput(p))})},d(11548,null,c.title))),o.canBeCombined){let h=o.isOrderRelevant?d(11546,null,c.title):d(11545,null);l.push(Loe(h,async()=>{Ui(g=>{s.setState(o,oS.base.withInputValue(i,!0).withInputValue(p,!0,!0),!0,g),s.telemetry.reportSmartCombinationInvoked(n.includesInput(p))})},d(11547,null)))}}else l.push(Loe(d(11549,null,c.title),async()=>{Ui(h=>{s.setState(o,n.withInputValue(i,!0,!1),i,h),s.telemetry.reportAcceptInvoked(i,n.includesInput(p))})},d(11550,null,c.title))),o.canBeCombined&&l.push(Loe(d(11551,null,c.title),async()=>{Ui(h=>{s.setState(o,n.withInputValue(i,!0,!0),i,h),s.telemetry.reportSmartCombinationInvoked(n.includesInput(p))})},d(11547,null)));s.isInputHandled(o,i).read(e)||l.push(Loe(d(11552,null),async()=>{Ui(h=>{s.setInputHandled(o,i,!0,h)})},d(11555,null)))}return l})}};function Loe(a,i,e){return{text:a,action:i,tooltip:e}}var RNi=class extends pqt{constructor(e,t,o,n,r,s,l){super(e,t,o,n,l);this._domNode=bt("div.merge-editor-conflict-actions").root;this.widgetDomNode.appendChild(this._domNode),this._domNode.classList.add(r),this._register(he(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=Bn(n.text);n.action?t.push(_("a",{title:n.tooltip,role:"button",onclick:()=>n.action()},...r)):t.push(_("span",{title:n.tooltip},...r))}Fi(this._domNode,...t)}};function pwo(a){let i=uwo(a.input1Diffs.flatMap(s=>s.rangeMappings),a.baseRange.toExclusiveRange(),a.input1Range.toExclusiveRange()),e=uwo(a.input2Diffs.flatMap(s=>s.rangeMappings),a.baseRange.toExclusiveRange(),a.input2Range.toExclusiveRange()),t=bsn(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 Zl(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),eh(()=>Ty(o.map(s=>s[0]).filter(mo),(s,l)=>s<l)&&Ty(o.map(s=>s[1]).filter(mo),(s,l)=>s<=l)&&Ty(o.map(s=>s[2]).filter(mo),(s,l)=>s<l)&&o.every(s=>s.filter(mo).length>=2)),o}function uwo(a,i,e){let t=[],o=i.getStartPosition(),n=e.getStartPosition();for(let s of a){let l=new bV(z.fromPositions(o,s.inputRange.getStartPosition()),z.fromPositions(n,s.outputRange.getStartPosition()));eh(()=>UQe(l.inputRange).equals(UQe(l.outputRange))),l.inputRange.isEmpty()||t.push(l),o=s.inputRange.getEndPosition(),n=s.outputRange.getEndPosition()}let r=new bV(z.fromPositions(o,i.getEndPosition()),z.fromPositions(n,e.getEndPosition()));return eh(()=>UQe(r.inputRange).equals(UQe(r.outputRange))),r.inputRange.isEmpty()||t.push(r),t}function bsn(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(tl(r=>r.inputPos,Ie.compare));let o=[void 0,void 0],n;for(let r of t){if(n&&o.some(s=>!!s)){let s=$_t(n,r.inputPos);s.isZero()||(e.push({inputPos:n,length:s,output1Pos:o[0],output2Pos:o[1]}),o[0]&&(o[0]=zQe(o[0],s)),o[1]&&(o[1]=zQe(o[1],s)))}o[r.input]=r.start?r.outputPos:void 0,n=r.inputPos}return e}var hqt=class{constructor(i,e,t){this.input1Editor=i;this.input2Editor=e;this.resultEditor=t;this.conflictActionsFactoryInput1=new SBe(this.input1Editor),this.conflictActionsFactoryInput2=new SBe(this.input2Editor),this.conflictActionsFactoryResult=new SBe(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=q_t(h.modifiedBaseRanges.read(i),g,(w,k)=>w.baseRange.intersectsOrTouches(k.inputRange)?Fw.neitherLessOrGreaterThan:Qh.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 N=new mqt(e,w.left);(t.shouldAlignResult||!N.inputIsEmpty.read(i))&&(l.push(new Ist(this.conflictActionsFactoryInput1,w.left.input1Range.startLineNumber-1,N.itemsInput1)),c.push(new Ist(this.conflictActionsFactoryInput2,w.left.input2Range.startLineNumber-1,N.itemsInput2)),t.shouldAlignBase&&u.push(new PNi(w.left.baseRange.startLineNumber-1,16)));let O=w.left.baseRange.startLineNumber+(y?.resultingDeltaFromOriginalToModified??0)-1;p.push(new Ist(this.conflictActionsFactoryResult,O,N.resultItems))}let k=w.rights.at(-1);k&&(y=k);let T;w.left?(T=pwo(w.left).map(N=>({input1Line:N[0],baseLine:N[1],input2Line:N[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:N,baseLine:O,input2Line:V,resultLine:U}of T){if(!t.shouldAlignBase&&(N===void 0||V===void 0))continue;let G=N!==void 0?N+o:-1,$=V!==void 0?V+n:-1,te=O+r,pe=U!==void 0?U+s:-1,de=Math.max(t.shouldAlignBase?te:0,G,$,t.shouldAlignResult?pe:0);if(N!==void 0){let se=de-G;se>0&&(l.push(new IBe(N-1,se)),o+=se)}if(V!==void 0){let se=de-$;se>0&&(c.push(new IBe(V-1,se)),n+=se)}if(t.shouldAlignBase){let se=de-te;se>0&&(u.push(new IBe(O-1,se)),r+=se)}if(t.shouldAlignResult&&U!==void 0){let se=de-pe;se>0&&(p.push(new IBe(U-1,se)),s+=se)}}}return new MNi(l,c,u,p)}},MNi=class{constructor(i,e,t,o){this.input1ViewZones=i;this.input2ViewZones=e;this.baseViewZones=t;this.resultViewZones=o}},yst=class{},IBe=class extends yst{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")}))}},PNi=class extends yst{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")}))}},Ist=class extends yst{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 afe=class extends Doe{constructor(e,t,o,n,r){super(o,t,r);this.inputNumber=e;this.otherInputNumber=this.inputNumber===1?2:1,this.modifiedBaseRangeGutterItemInfos=hs({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 ANi(g.toString(),h,u,l))}),this.decorations=hs({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 N=this.inputNumber===1?"input i1":"input i2";if(w.push(N),!(!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?iQ:oQ}},overviewRuler:S.isConflicting?{position:2,color:{id:T?iQ:oQ}}:void 0}}),!b&&(S.isConflicting||!c.isHandled(S).read(s)))){let O=S.getInputDiffs(this.inputNumber);for(let V of O){let U=V.outputRange.toInclusiveRange();if(U&&h.push({range:U,options:{className:`merge-editor-diff ${N}`,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 ${N}`:`merge-editor-diff-word ${N}`,description:"Merge Editor",showIfCollapsed:!0}})}}}return h}),this.htmlElements.root.classList.add("input"),this._register(new _oe(this.editor,this.htmlElements.gutterDiv,{getIntersectingGutterItems:(s,l)=>this.checkboxesVisible.read(l)?this.modifiedBaseRangeGutterItemInfos.read(l):[],createView:(s,l)=>new NNi(s,l,n)})),this._register(fBe(this,(s,l)=>l.model.translateBaseRangeToInput(this.inputNumber,s))),this._register(o.createInstance(vG,e===1?D.MergeInput1Toolbar:D.MergeInput2Toolbar,this.htmlElements.toolbar)),this._register(XD({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(11569,null):l.model.input2.title||d(11570,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;Fi(this.htmlElements.title,...Bn(c)),Fi(this.htmlElements.description,...u?Bn(u):[]),Fi(this.htmlElements.detail,...p?Bn(p):[])})),this._register(qke(this.editor,this.decorations))}};afe=I([m(2,F),m(3,ze),m(4,B)],afe);var ANi=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=Ce(this,n=>{let r=this.model.getState(this.baseRange).read(n).getInput(this.inputNumber);return r===2&&!this.baseRange.isOrderRelevant?1:r}),this.state=Ce(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(){Ui(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=>{Ui(s=>this.viewModel.setState(this.baseRange,r,s,this.inputNumber))};function o(r,s,l,c){let u=new st(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(11571,null,this.model.input1.title),i.toggle(1),i.includesInput1):void 0,this.baseRange.input2Diffs.length>0?o("mergeEditor.acceptInput2",d(11571,null,this.model.input2.title),i.toggle(2),i.includesInput2):void 0,this.baseRange.isConflicting?j_t(o("mergeEditor.acceptBoth",d(11572,null),i.withInputValue(1,!n).withInputValue(2,!n),n),{enabled:this.baseRange.canBeCombined}):void 0,new li,this.baseRange.isConflicting?j_t(o("mergeEditor.swap",d(11574,null),i.swap(),!1),{enabled:!i.kind&&(!n||this.baseRange.isOrderRelevant)}):void 0,j_t(new st("mergeEditor.markAsHandled",d(11573,null),void 0,!0,()=>{Ui(r=>{this.model.setHandled(this.baseRange,!e,r)})}),{checked:e})].filter(mo)}},NNi=class extends C{constructor(e,t,o){super();this.isMultiLine=Le(this,!1);this.item=Le(this,e);let n=new Kh({isChecked:!1,title:"",icon:M.check,...qg});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(he(r=>{let s=this.item.read(r),l=s.toggleState.read(r),u={0:{icon:void 0,checked:!1,title:d(11566,null)},3:{icon:M.circleFilled,checked:!1,title:d(11565,null)},1:{icon:M.check,checked:!0,title:d(11567,null)},2:{icon:M.checkAll,checked:!0,title:d(11568,null)}}[l];n.setIcon(u.icon),n.checked=u.checked,n.setTitle(u.title),s.enabled.read(r)?n.enable():n.disable()})),this._register(he(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(()=>{Ui(r=>{this.item.get().setState(n.checked,r)})})),t.appendChild(bt("div.background",[rN]).root),t.appendChild(this.checkboxDiv=bt("div.checkbox",[bt("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=Kn(c,u[0],u[1]),c=Kn(c,p[0],p[1])),this.checkboxDiv.style.top=`${c-e}px`,Ui(h=>{this.isMultiLine.set(t>30,h)})}update(e){Ui(t=>{this.item.set(e,t)})}};var yBe=class extends Doe{constructor(e,t,o,n){super(t,e,n);this._labelService=o;this.decorations=Ce(this,e=>{let t=this.viewModel.read(e);if(!t)return[];let o=t.model,n=o.resultTextModel,r=new Array,s=q_t(o.modifiedBaseRanges.read(e),o.baseResultDiffs.read(e),(u,p)=>u.baseRange.intersectsOrTouches(p.inputRange)?Fw.neitherLessOrGreaterThan:Qh.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?iQ:oQ}},overviewRuler:p.isConflicting?{position:2,color:{id:f?iQ:oQ}}: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=Z_t.bindTo(l);c.set(!0),this._register(Z(()=>c.reset()))}),this.htmlElements.gutterDiv.style.width="5px",this.htmlElements.root.classList.add("result"),this._register(Ga((s,l)=>{this.checkboxesVisible.read(s)&&l.add(new _oe(this.editor,this.htmlElements.gutterDiv,{getIntersectingGutterItems:(c,u)=>[],createView:(c,u)=>{throw new ni}}))})),this._register(he(s=>{let l=this.viewModel.read(s);l&&(this.editor.setModel(l.model.resultTextModel),Fi(this.htmlElements.title,...Bn(d(11579,null))),Fi(this.htmlElements.description,...Bn(this._labelService.getUriLabel(l.model.resultTextModel.uri,{relative:!0}))))}));let r=this._register(new ji(this.htmlElements.detail));this._register(he(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(11578,null,u):d(11577,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(11576,null):d(11575,null)})})),this._register(qke(this.editor,this.decorations)),this._register(fBe(this,(s,l)=>l.model.translateBaseRangeToResult(s))),this._register(t.createInstance(vG,D.MergeInputResultToolbar,this.htmlElements.toolbar))}};yBe=I([m(1,F),m(2,ot),m(3,B)],yBe);var Vv=class extends aR{constructor(e,t,o,n,r,s,l,c,u,p,h){super(Vv.ID,e,n,t,r,l,s,c,u,p);this.contextKeyService=o;this._codeEditorService=h;this._sessionDisposables=new P,this._viewModel=Le(this,void 0),this._grid=this._register(new me),this.input1View=this._register(this.instantiationService.createInstance(afe,1,this._viewModel)),this.baseView=Le(this,void 0),this.baseViewOptions=Le(this,void 0),this.input2View=this._register(this.instantiationService.createInstance(afe,2,this._viewModel)),this.inputResultView=this._register(this.instantiationService.createInstance(yBe,this._viewModel)),this._layoutMode=this.instantiationService.createInstance(Roe),this._layoutModeObs=Le(this,this._layoutMode.value),this._ctxIsMergeEditor=Ep.bindTo(this.contextKeyService),this._ctxUsesColumnLayout=nX.bindTo(this.contextKeyService),this._ctxShowBase=Qke.bindTo(this.contextKeyService),this._ctxShowBaseAtTop=$Qe.bindTo(this.contextKeyService),this._ctxResultUri=zXi.bindTo(this.contextKeyService),this._ctxBaseUri=tDt.bindTo(this.contextKeyService),this._ctxShowNonConflictingChanges=eDt.bindTo(this.contextKeyService),this._inputModel=Le(this,void 0),this.viewZoneComputer=new hqt(this.input1View.editor,this.input2View.editor,this.inputResultView.editor),this.scrollSynchronizer=this._register(new uqt(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 P),this.showNonConflictingChangesStore=this.instantiationService.createInstance($ke,"mergeEditor/showNonConflictingChanges"),this.showNonConflictingChanges=Le(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(11580,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=Q_t(e,{minimap:{enabled:!1},glyphMargin:!1,lineNumbersMinChars:2}),o=Q_t(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 hb))throw new ni("ONLY MergeEditorInput is supported");await super.setInput(e,t,o,n),this._sessionDisposables.clear(),Ui(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(bBe,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"}),Ui(g=>{this._viewModel.set(l,g),this._inputModel.set(r,g)}),this._sessionDisposables.add(l),this._sessionDisposables.add(he(g=>{let f=l.focusedEditorType.read(g);e instanceof hb&&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 P;this._sessionDisposables.add(c),this._sessionDisposables.add(Ga(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(N=>{c.add(this.setViewZones(g,l,this.input1View.editor,k,this.input2View.editor,T,f.editor,N,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(nbe(s.onInitialized,()=>{let g=s.modifiedBaseRanges.get().find(f=>f.isConflicting);g&&(this.input1View.editor.revealLineInCenter(g.input1Range.startLineNumber),Ui(f=>{l.setActiveModifiedBaseRange(g,f)}))}));let p=g=>{let f=SZ(g,this._codeEditorService);iA(s.input2.textModel,f,this._codeEditorService),iA(s.input1.textModel,f,this._codeEditorService),iA(s.resultTextModel,f,this._codeEditorService);let v=this.baseView.get()?.editor.getModel();v&&iA(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 P;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 P;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&&QE(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){Ui(t=>{if(e.showBase&&!this.baseView.get()){this.baseViewDisposables.clear();let o=this.baseViewDisposables.add(this.instantiationService.createInstance(vBe,this.viewModel));this.baseViewDisposables.add(he(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(mo)},{size:62,data:this.inputResultView.view}].filter(mo)):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(mo)),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=O5.from({orientation:0,size:100,groups:e},{styles:{separatorBorder:this.theme.getColor(gJe)??Oe.transparent},proportionalLayout:!0}),Fi(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(!Xe(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 hb}toggleShowNonConflictingChanges(){this.showNonConflictingChanges.set(!this.showNonConflictingChanges.get(),void 0),this.showNonConflictingChangesStore.set(this.showNonConflictingChanges.get()),this._ctxShowNonConflictingChanges.set(this.showNonConflictingChanges.get())}};Vv=I([m(1,F),m(2,X),m(3,Te),m(4,le),m(5,De),m(6,Nn),m(7,ee),m(8,Et),m(9,be),m(10,Kt)],Vv);var Roe=class{constructor(i){this._storageService=i;this._value={kind:"mixed",showBase:!1,showBaseAtTop:!0};let e=i.get(Roe._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(Roe._key,JSON.stringify(this._value),0,0))}};Roe=I([m(0,le)],Roe);var wBe=class extends C{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 Vv&&n.getControl()&&n.input instanceof hb&&Xe(e.resource,n.input.result)){let r=n.getControl();return QE(e.options,r,0),r}return null}};wBe=I([m(0,ee),m(1,Kt)],wBe);var lfe=class extends C{static{this.ID="workbench.contrib.mergeEditorResolver"}constructor(i,e){super();let t=o=>({editor:e.createInstance(hb,o.base.resource,{uri:o.input1.resource,title:o.input1.label??Ye(o.input1.resource),description:o.input1.description??"",detail:o.input1.detail},{uri:o.input2.resource,title:o.input2.label??Ye(o.input2.resource),description:o.input2.description??"",detail:o.input2.detail},o.result.resource)});this._register(i.registerEditor("*",{id:Ys.id,label:Ys.displayName,detail:Ys.providerDisplayName,priority:"builtin"},{},{createMergeEditorInput:t}))}};lfe=I([m(0,ul),m(1,F)],lfe);var GA=class extends K{constructor(i){super(i)}run(i){let{activeEditorPane:e}=i.get(ee);if(e instanceof Vv){let t=e.viewModel.get();if(!t)return;this.runWithViewModel(t,i)}}},wst=class extends K{constructor(i){super(i)}run(i,...e){let{activeEditorPane:t}=i.get(ee);if(t instanceof Vv){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}}},gqt=class extends K{constructor(){super({id:"_open.mergeEditor",title:L(11476,"Open Merge Editor")})}run(i,...e){let t=mwo.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)}},mwo;(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 a5(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 a5(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 a5(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"}})(mwo||={});var fqt=class extends K{constructor(){super({id:"merge.mixedLayout",title:L(11450,"Mixed Layout"),toggled:nX.isEqualTo("mixed"),menu:[{id:D.EditorTitle,when:Ep,group:"1_merge",order:9}],precondition:Ep})}run(i){let{activeEditorPane:e}=i.get(ee);e instanceof Vv&&e.setLayoutKind("mixed")}},vqt=class extends K{constructor(){super({id:"merge.columnLayout",title:L(11449,"Column Layout"),toggled:nX.isEqualTo("columns"),menu:[{id:D.EditorTitle,when:Ep,group:"1_merge",order:10}],precondition:Ep})}run(i){let{activeEditorPane:e}=i.get(ee);e instanceof Vv&&e.setLayoutKind("columns")}},bqt=class extends K{constructor(){super({id:"merge.showNonConflictingChanges",title:L(11475,"Show Non-Conflicting Changes"),toggled:eDt.isEqualTo(!0),menu:[{id:D.EditorTitle,when:Ep,group:"3_merge",order:9}],precondition:Ep})}run(i){let{activeEditorPane:e}=i.get(ee);e instanceof Vv&&e.toggleShowNonConflictingChanges()}},Sqt=class extends K{constructor(){super({id:"merge.showBase",title:L(11451,"Show Base"),toggled:Qke.isEqualTo(!0),menu:[{id:D.EditorTitle,when:x.and(Ep,nX.isEqualTo("columns")),group:"2_merge",order:9}]})}run(i){let{activeEditorPane:e}=i.get(ee);e instanceof Vv&&e.toggleBase()}},Iqt=class extends K{constructor(){super({id:"merge.showBaseTop",title:L(11453,"Show Base Top"),toggled:x.and(Qke,$Qe),menu:[{id:D.EditorTitle,when:x.and(Ep,nX.isEqualTo("mixed")),group:"2_merge",order:10}]})}run(i){let{activeEditorPane:e}=i.get(ee);e instanceof Vv&&e.toggleShowBaseTop()}},yqt=class extends K{constructor(){super({id:"merge.showBaseCenter",title:L(11452,"Show Base Center"),toggled:x.and(Qke,$Qe.negate()),menu:[{id:D.EditorTitle,when:x.and(Ep,nX.isEqualTo("mixed")),group:"2_merge",order:11}]})}run(i){let{activeEditorPane:e}=i.get(ee);e instanceof Vv&&e.toggleShowBaseCenter()}},ND=L(11461,"Merge Editor"),wqt=class extends GA{constructor(){super({id:"merge.openResult",icon:M.goToFile,title:L(11474,"Open File"),category:ND,menu:[{id:D.EditorTitle,when:Ep,group:"navigation",order:1}],precondition:Ep})}runWithViewModel(i,e){e.get(ee).openEditor({resource:i.model.resultTextModel.uri})}},Cqt=class extends GA{constructor(){super({id:"merge.goToNextUnhandledConflict",category:ND,title:L(11456,"Go to Next Unhandled Conflict"),icon:M.arrowDown,menu:[{id:D.EditorTitle,when:Ep,group:"navigation",order:3}],f1:!0,precondition:Ep})}runWithViewModel(i){i.model.telemetry.reportNavigationToNextConflict(),i.goToNextModifiedBaseRange(e=>!i.model.isHandled(e).get())}},xqt=class extends GA{constructor(){super({id:"merge.goToPreviousUnhandledConflict",category:ND,title:L(11457,"Go to Previous Unhandled Conflict"),icon:M.arrowUp,menu:[{id:D.EditorTitle,when:Ep,group:"navigation",order:2}],f1:!0,precondition:Ep})}runWithViewModel(i){i.model.telemetry.reportNavigationToPreviousConflict(),i.goToPreviousModifiedBaseRange(e=>!i.model.isHandled(e).get())}},kqt=class extends GA{constructor(){super({id:"merge.toggleActiveConflictInput1",category:ND,title:L(11459,"Toggle Current Conflict from Left"),f1:!0,precondition:Ep})}runWithViewModel(i){i.toggleActiveConflict(1)}},Eqt=class extends GA{constructor(){super({id:"merge.toggleActiveConflictInput2",category:ND,title:L(11460,"Toggle Current Conflict from Right"),f1:!0,precondition:Ep})}runWithViewModel(i){i.toggleActiveConflict(2)}},Tqt=class extends GA{constructor(){super({id:"mergeEditor.compareInput1WithBase",category:ND,title:L(11467,"Compare Input 1 With Base"),shortTitle:d(11469,null),f1:!0,precondition:Ep,menu:{id:D.MergeInput1Toolbar,group:"primary"},icon:M.compareChanges})}runWithViewModel(i,e){let t=e.get(ee);hwo(i,t,1)}},_qt=class extends GA{constructor(){super({id:"mergeEditor.compareInput2WithBase",category:ND,title:L(11468,"Compare Input 2 With Base"),shortTitle:d(11469,null),f1:!0,precondition:Ep,menu:{id:D.MergeInput2Toolbar,group:"primary"},icon:M.compareChanges})}runWithViewModel(i,e){let t=e.get(ee);hwo(i,t,2)}};async function hwo(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 Dqt=class extends GA{constructor(){super({id:"merge.openBaseEditor",category:ND,title:L(11458,"Open Base File"),f1:!0,precondition:Ep})}runWithViewModel(i,e){e.get(Qe).open(i.model.base.uri)}},Lqt=class extends GA{constructor(){super({id:"merge.acceptAllInput1",category:ND,title:L(11454,"Accept All Incoming Changes from Left"),f1:!0,precondition:Ep,menu:{id:D.MergeInput1Toolbar,group:"primary"},icon:M.checkAll})}runWithViewModel(i){i.acceptAll(1)}},Rqt=class extends GA{constructor(){super({id:"merge.acceptAllInput2",category:ND,title:L(11455,"Accept All Current Changes from Right"),f1:!0,precondition:Ep,menu:{id:D.MergeInput2Toolbar,group:"primary"},icon:M.checkAll})}runWithViewModel(i){i.acceptAll(2)}},Mqt=class extends GA{constructor(){super({id:"mergeEditor.resetResultToBaseAndAutoMerge",category:ND,title:L(11471,"Reset Result"),shortTitle:d(11472,null),f1:!0,precondition:Ep,menu:{id:D.MergeInputResultToolbar,group:"primary"},icon:M.discard})}runWithViewModel(i,e){i.model.reset()}},Pqt=class extends K{constructor(){super({id:"mergeEditor.resetCloseWithConflictsChoice",category:ND,title:L(11470,"Reset Choice for 'Close with Conflicts'"),f1:!0})}run(i){i.get(le).remove(qQe,0)}},Aqt=class extends wst{constructor(){super({id:"mergeEditor.acceptAllCombination",category:ND,title:L(11462,"Accept All Combination"),f1:!0})}runWithMergeEditor(i,e,...t){let{viewModel:o}=i,n=o.model.modifiedBaseRanges.get(),r=o.model;return Ui(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}}},Nqt=class extends wst{constructor(){super({id:"mergeEditor.acceptMerge",category:ND,title:L(11463,"Complete Merge"),f1:!0,precondition:Ep,keybinding:[{primary:2051,weight:100,when:Ep}]})}async runWithMergeEditor({inputModel:i,editorIdentifier:e,viewModel:t},o){let n=o.get(ct),r=o.get(ee);if(t.model.unhandledConflictsCount.get()>0){let{confirmed:s}=await n.confirm({message:d(11466,null,Ye(i.resultUri)),detail:d(11465,null),primaryButton:d(11464,null)});if(!s)return{successful:!1}}return await i.accept(),await r.closeEditor(e),{successful:!0}}},Oqt=class extends wst{constructor(){super({id:"mergeEditor.toggleBetweenInputs",category:ND,title:L(11473,"Toggle Between Merge Editor Inputs"),f1:!0,precondition:Ep,keybinding:[{primary:3122,weight:210,when:Ep}]})}runWithMergeEditor({viewModel:i},e){i.inputCodeEditorView1.editor.hasWidgetFocus()?i.inputCodeEditorView2.editor.focus():i.inputCodeEditorView1.editor.focus()}};var ONi=L(11480,"Merge Editor (Dev)"),Fqt=class extends K{constructor(){super({id:"merge.dev.copyContentsJson",category:ONi,title:L(11477,"Copy Merge Editor State as JSON"),icon:M.layoutCentered,f1:!0,precondition:Ep})}run(i){let{activeEditorPane:e}=i.get(ee),t=i.get(Wi),o=i.get(Ne);if(!(e instanceof Vv)){o.info({name:d(11481,null),message:d(11482,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(11481,null),message:d(11484,null)})}},Wqt=class extends K{constructor(){super({id:"merge.dev.saveContentsToFolder",category:ONi,title:L(11479,"Save Merge Editor State to Folder"),icon:M.layoutCentered,f1:!0,precondition:Ep})}async run(i){let{activeEditorPane:e}=i.get(ee),t=i.get(Ne),o=i.get(dn),n=i.get(be),r=i.get(kt);if(!(e instanceof Vv)){t.info({name:d(11481,null),message:d(11482,null)});return}let s=e.model;if(!s)return;let l=await o.showOpenDialog({canSelectFiles:!1,canSelectFolders:!0,canSelectMany:!1,title:d(11483,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),Je.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(11481,null),message:d(11485,null)})}},Vqt=class extends K{constructor(){super({id:"merge.dev.loadContentsFromFolder",category:ONi,title:L(11478,"Load Merge Editor State from Folder"),icon:M.layoutCentered,f1:!0})}async run(i,e){let t=i.get(dn),o=i.get(ee),n=i.get(be),r=i.get(Ge);e||(e={});let s;if(e.folderUri)s=e.folderUri;else{let b=await t.showOpenDialog({canSelectFiles:!1,canSelectFolders:!0,canSelectMany:!1,title:d(11483,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 Ssn(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 Ssn(a,i){return i?i==="initial":(await a.pick([{label:"result",result:!1},{label:"initial result",result:!0}],{canPickMany:!1}))?.result}var Bqt=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=zg(e);return i.createInstance(hb,t.base,new a5(t.input1.uri,t.input1.title,t.input1.detail,t.input1.description),new a5(t.input2.uri,t.input2.title,t.input2.detail,t.input2.description),t.result)}catch(t){mt(t);return}}};var Hqt=class{constructor(){this.name="mergeEditor";this.type="help";this.priority=125;this.when=eW.create("isMergeEditor",!0)}getProvider(i){let e=i.get(Kt),t=e.getActiveCodeEditor()||e.getFocusedCodeEditor();if(!t)return;let o=[d(11489,null),d(11490,null,"<keybinding:merge.goToNextUnhandledConflict>","<keybinding:merge.goToPreviousUnhandledConflict>"),d(11491,null,"<keybinding:merge.acceptAllInput1>","<keybinding:merge.acceptAllInput2>"),d(11492,null,"<keybinding:mergeEditor.acceptMerge>"),d(11493,null,"<keybinding:mergeEditor.toggleBetweenInputs>")];return new tp("mergeEditor",{type:"help"},()=>o.join(`
`),()=>t.focus(),"accessibility.verbosity.mergeEditor")}};oe.as(rn.EditorPane).registerEditorPane(ys.create(Vv,Vv.ID,d(11488,null)),[new Mt(hb)]);oe.as(rn.EditorFactory).registerEditorSerializer(hb.ID,Bqt);oe.as(ii.Configuration).registerConfiguration({properties:{"mergeEditor.diffAlgorithm":{type:"string",enum:["legacy","advanced"],default:"advanced",markdownEnumDescriptions:[d(11487,null),d(11486,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(wqt);W(fqt);W(vqt);W(gqt);W(Dqt);W(bqt);W(Sqt);W(Iqt);W(yqt);W(Cqt);W(xqt);W(kqt);W(Eqt);W(Tqt);W(_qt);W(Lqt);W(Rqt);W(Mqt);W(Nqt);W(Pqt);W(Aqt);W(Oqt);W(Fqt);W(Wqt);W(Vqt);oe.as(Qi.Workbench).registerWorkbenchContribution(wBe,3);pt(lfe.ID,lfe,ut.BlockStartup);xa.register(new Hqt);var Uqt=class extends K{constructor(){super({id:"multiDiffEditor.goToFile",title:L(11608,"Open File"),icon:M.goToFile,precondition:fr.isEqualTo(Eg.ID),menu:{when:fr.isEqualTo(Eg.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 Eg))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}})}},zqt=class extends K{constructor(){super({id:"multiDiffEditor.goToNextChange",title:L(11609,"Go to Next Change"),icon:M.arrowDown,precondition:x.equals("activeEditor",Eg.ID),menu:[D.EditorTitle,D.CompactWindowEditorTitle].map(i=>({id:i,when:x.equals("activeEditor",Eg.ID),group:"navigation",order:2})),keybinding:{primary:575,weight:100,when:x.equals("activeEditor",Eg.ID)},f1:!0})}async run(i){let t=i.get(ee).activeEditorPane;t instanceof Eg&&t.goToNextChange()}},Kqt=class extends K{constructor(){super({id:"multiDiffEditor.goToPreviousChange",title:L(11610,"Go to Previous Change"),icon:M.arrowUp,precondition:x.equals("activeEditor",Eg.ID),menu:[D.EditorTitle,D.CompactWindowEditorTitle].map(i=>({id:i,when:x.equals("activeEditor",Eg.ID),group:"navigation",order:1})),keybinding:{primary:1599,weight:100,when:x.equals("activeEditor",Eg.ID)},f1:!0})}async run(i){let t=i.get(ee).activeEditorPane;t instanceof Eg&&t.goToPreviousChange()}},Gqt=class extends K{constructor(){super({id:"multiDiffEditor.collapseAll",title:L(11606,"Collapse All Diffs"),icon:M.collapseAll,precondition:x.and(x.equals("activeEditor",Eg.ID),x.not("multiDiffEditorAllCollapsed")),menu:[D.EditorTitle,D.CompactWindowEditorTitle].map(i=>({id:i,when:x.and(x.equals("activeEditor",Eg.ID),x.not("multiDiffEditorAllCollapsed")),group:"navigation",order:100})),f1:!0})}async run(i,...e){let o=lp(e,i.get(ee),i.get(Et),i.get(fo)).groupedEditors[0];if(!o)return;let n=o.editors[0];n instanceof xu&&(await n.getViewModel()).collapseAll()}},$qt=class extends K{constructor(){super({id:"multiDiffEditor.expandAll",title:L(11607,"Expand All Diffs"),icon:M.expandAll,precondition:x.and(x.equals("activeEditor",Eg.ID),x.has("multiDiffEditorAllCollapsed")),menu:[D.EditorTitle,D.CompactWindowEditorTitle].map(i=>({id:i,when:x.and(x.equals("activeEditor",Eg.ID),x.has("multiDiffEditorAllCollapsed")),group:"navigation",order:100})),f1:!0})}async run(i,...e){let o=lp(e,i.get(ee),i.get(Et),i.get(fo)).groupedEditors[0];if(!o)return;let n=o.editors[0];n instanceof xu&&(await n.getViewModel()).expandAll()}};W(Uqt);W(zqt);W(Kqt);W(Gqt);W($qt);we(Rz,oDt,1);pt(ede.ID,ede,ut.BlockStartup);oe.as(rn.EditorPane).registerEditorPane(ys.create(Eg,Eg.ID,d(11612,null)),[new Mt(xu)]);oe.as(rn.EditorFactory).registerEditorSerializer(xu.ID,nDt);W(NMe);pt(dme.ID,dme,ut.BlockStartup);var FNi=class extends K{constructor(){super({id:"runCommands",title:L(8420,"Run Commands"),f1:!1,metadata:{description:d(8422,null),args:[{name:"args",schema:{type:"object",required:["commands"],properties:{commands:{type:"array",description:d(8421,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(8423,null));return}if(e.commands.length===0){t.warn(d(8424,null));return}let o=i.get(ge),n=i.get(ne),r=0;try{for(;r<e.commands.length;++r){let s=e.commands[r];n.debug(`runCommands: executing ${r}-th command: ${pU(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:pU(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(FNi);var cfe=class extends C{constructor(e,t,o,n){super();this._modelService=o;this._languageService=n;this._register(e.registerTextModelContentProvider(Y.commentsInput,this)),this._register(t.registerCodeEditorOpenHandler(async(r,s,l)=>!(s instanceof G_)||s.getModel()?.uri.toString()!==r.resource.toString()?null:(r.options&&QE(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)}};cfe=I([m(0,Nt),m(1,Kt),m(2,Ct),m(3,kt)],cfe);go(khi,RC,1);pt(cfe.ID,cfe,ut.BlockRestore);yt.registerCommandAndKeybindingRule({id:"editor.action.nextCommentThreadAction",handler:async(a,i)=>{let e=Moe(a);if(!e)return Promise.resolve();let t=RC.get(e);if(!t)return Promise.resolve();t.nextCommentThread(!0)},weight:100,primary:579});yt.registerCommandAndKeybindingRule({id:"editor.action.previousCommentThreadAction",handler:async(a,i)=>{let e=Moe(a);if(!e)return Promise.resolve();let t=RC.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(8493,null),original:"Go to Next Commented Range"},category:{value:d(8498,null),original:"Comments"},menu:[{id:D.CommandPalette,when:vc.activeEditorHasCommentingRange}],keybinding:{primary:580,weight:100,when:vc.activeEditorHasCommentingRange}})}run(a,...i){let e=Moe(a);if(!e)return;let t=RC.get(e);t&&t.nextCommentThread(!1)}});W(class extends K{constructor(){super({id:"editor.action.previousCommentedRangeAction",title:{value:d(8495,null),original:"Go to Previous Commented Range"},category:{value:d(8498,null),original:"Comments"},menu:[{id:D.CommandPalette,when:vc.activeEditorHasCommentingRange}],keybinding:{primary:1604,weight:100,when:vc.activeEditorHasCommentingRange}})}run(a,...i){let e=Moe(a);if(!e)return;let t=RC.get(e);t&&t.previousCommentThread(!1)}});W(class extends K{constructor(){super({id:"editor.action.nextCommentingRange",title:{value:d(8494,null),original:"Go to Next Commenting Range"},category:{value:d(8498,null),original:"Comments"},menu:[{id:D.CommandPalette,when:vc.activeEditorHasCommentingRange}],keybinding:{primary:Ai(2089,2578),weight:100,when:x.and($a,x.or(ue.focus,vc.commentFocused,x.and(LC,Kd.isEqualTo("comments"))))}})}run(a,i){let e=Moe(a);if(!e)return;let t=RC.get(e);t&&t.nextCommentingRange()}});W(class extends K{constructor(){super({id:"editor.action.previousCommentingRange",title:{value:d(8496,null),original:"Go to Previous Commenting Range"},category:{value:d(8498,null),original:"Comments"},menu:[{id:D.CommandPalette,when:vc.activeEditorHasCommentingRange}],keybinding:{primary:Ai(2089,2576),weight:100,when:x.and($a,x.or(ue.focus,vc.commentFocused,x.and(LC,Kd.isEqualTo("comments"))))}})}async run(a,...i){let e=Moe(a);if(!e)return;let t=RC.get(e);t&&t.previousCommentingRange()}});W(class extends K{constructor(){super({id:"workbench.action.toggleCommenting",title:{value:d(8497,null),original:"Toggle Editor Commenting"},category:{value:d(8498,null),original:"Comments"},menu:[{id:D.CommandPalette,when:vc.WorkspaceHasCommenting}]})}run(a,...i){let e=a.get(km),t=e.isCommentingEnabled;e.enableCommenting(!t)}});W(class extends K{constructor(){super({id:"workbench.action.addComment",title:{value:d(8487,null),original:"Add Comment on Current Selection"},category:{value:d(8498,null),original:"Comments"},menu:[{id:D.CommandPalette,when:vc.activeCursorHasCommentingRange}],keybinding:{primary:Ai(2089,2593),weight:100,when:vc.activeCursorHasCommentingRange}})}async run(a,i){let e=Moe(a);if(!e)return;let t=RC.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(8492,null),original:"Focus Comment on Current Line"},category:{value:d(8498,null),original:"Comments"},f1:!0,precondition:vc.activeCursorHasComment})}async run(a,...i){let e=Moe(a);if(!e)return;let t=RC.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(8491,null))}});function WNi(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(8488,null),original:"Collapse All Comments"},category:{value:d(8498,null),original:"Comments"},menu:[{id:D.CommandPalette,when:vc.WorkspaceHasCommenting}]})}run(a,...i){let e=a.get(km);WNi(e,()=>0)}});W(class extends K{constructor(){super({id:"workbench.action.expandAllComments",title:{value:d(8489,null),original:"Expand All Comments"},category:{value:d(8498,null),original:"Comments"},menu:[{id:D.CommandPalette,when:vc.WorkspaceHasCommenting}]})}run(a,...i){let e=a.get(km);WNi(e,()=>1)}});W(class extends K{constructor(){super({id:"workbench.action.expandUnresolvedComments",title:{value:d(8490,null),original:"Expand Unresolved Comments"},category:{value:d(8498,null),original:"Comments"},menu:[{id:D.CommandPalette,when:vc.WorkspaceHasCommenting}]})}run(a,...i){let e=a.get(km);WNi(e,t=>t.state===0?1:0)}});yt.registerCommandAndKeybindingRule({id:"editor.action.submitComment",weight:100,primary:2051,when:iTe,handler:(a,i)=>{let e=a.get(Kt).getFocusedCodeEditor();e instanceof G_&&e.getParentThread().submitComment()}});yt.registerCommandAndKeybindingRule({id:"workbench.action.hideComment",weight:100,primary:9,secondary:[1033],when:x.or(iTe,vc.commentFocused),handler:async(a,i)=>{let e=a.get(Kt).getFocusedCodeEditor(),t=a.get(_e),o=a.get(Ne),n=a.get(km);if(await t.enableKeybindingHoldMode("workbench.action.hideComment"),e instanceof G_)e.getParentThread().collapse();else if(e){let r=RC.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(8491,null))}}});yt.registerCommandAndKeybindingRule({id:"workbench.action.hideComment",weight:100,primary:2057,win:{primary:513},when:x.and(ue.focus,vc.commentWidgetVisible),handler:async(a,i)=>{let e=a.get(Kt).getFocusedCodeEditor();if(await a.get(_e).enableKeybindingHoldMode("workbench.action.hideComment"),e){let o=RC.get(e);o&&await o.collapseVisibleComments()}}});function Moe(a){let i=a.get(ee).activeTextEditorControl;return Ec(i)&&(i.getOriginalEditor().hasTextFocus()?i=i.getOriginalEditor():i=i.getModifiedEditor()),!pn(i)||!i.hasModel()?null:i}var qqt=class extends C{constructor(){super();this.priority=90;this.name="comment";this.when=Fhi;this.type="view"}getProvider(e){let t=e.get(X),o=e.get(Ft),n=e.get(qt),r=o.getActiveViewWithId(Eu),s=r?.focusedCommentNode;if(!r||!s)return;let l=this._register(new Ede(n));return l.setContextKeyService(t),new VNi(r,s,l)}},jqt=class extends C{constructor(){super();this.priority=85;this.name="commentThread";this.when=vc.commentFocused;this.type="view"}getProvider(e){let t=e.get(km),o=e.get(ee),n=e.get(dt);if(t.commentsModel.hasCommentThreads())return new Cst(t,o,n)}},VNi=class extends C{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()}},Cst=class extends C{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&&KX(this._commentService,this._editorService,this._uriIdentityService,e.thread,e.comment)}provideNextContent(){let e=Ehi(this._activeCommentInfo,"next");if(e)return this._activeCommentInfo=e,this.provideContent()}providePreviousContent(){let e=Ehi(this._activeCommentInfo,"previous");if(e)return this._activeCommentInfo=e,this.provideContent()}};Cst=I([m(0,km),m(1,ee),m(2,dt)],Cst);var OD;(h=>(h.intro=d(8470,null),h.tabFocus=d(8471,null,`<keybinding:${S3e.ID}>`),h.commentCommands=d(8468,null),h.escape=d(8469,null,"<keybinding:workbench.action.hideComment>"),h.nextRange=d(8472,null,"<keybinding:editor.action.nextCommentingRange>"),h.previousRange=d(8475,null,"<keybinding:editor.action.previousCommentingRange>"),h.nextCommentThread=d(8474,null,"<keybinding:editor.action.nextCommentThreadAction>"),h.previousCommentThread=d(8477,null,"<keybinding:editor.action.previousCommentThreadAction>"),h.nextCommentedRange=d(8473,null,"<keybinding:editor.action.nextCommentedRangeAction>"),h.previousCommentedRange=d(8476,null,"<keybinding:editor.action.previousCommentedRangeAction>"),h.addComment=d(8467,null,"<keybinding:workbench.action.addComment>"),h.submitComment=d(8478,null,"<keybinding:editor.action.submitComment>")))(OD||={});var BNi=class extends C{constructor(){super(...arguments);this.id="comments";this.verbositySettingKey="accessibility.verbosity.comments";this.options={type:"help"}}provideContent(){return[OD.tabFocus,OD.commentCommands,OD.escape,OD.addComment,OD.submitComment,OD.nextRange,OD.previousRange].join(`
`)}onClose(){this._element?.focus()}},Qqt=class{constructor(){this.priority=110;this.name="comments";this.type="help";this.when=x.or(iTe,vc.commentFocused)}getProvider(i){return i.get(F).createInstance(BNi)}};W(class extends Fn{constructor(){super({viewId:Eu,id:"comments.collapse",title:d(8448,null),f1:!1,icon:M.collapseAll,menu:{id:D.ViewTitle,group:"navigation",when:x.and(x.and(x.equals("view",Eu),_Rt),DRt),order:100}})}runInView(i,e){e.collapseAll()}});W(class extends Fn{constructor(){super({viewId:Eu,id:"comments.expand",title:d(8462,null),f1:!1,icon:M.expandAll,menu:{id:D.ViewTitle,group:"navigation",when:x.and(x.and(x.equals("view",Eu),_Rt),x.not(DRt.key)),order:100}})}runInView(i,e){e.expandAll()}});W(class extends K{constructor(){super({id:"comments.reply",title:d(8464,null),icon:M.reply,precondition:x.equals("canReply",!0),menu:[{id:D.CommentsViewThreadActions,order:100},{id:D.AccessibleView,when:x.and(ud,x.equals(Kd.key,"comments"))}]})}run(i,e){let t=i.get(km),o=i.get(ee),n=i.get(dt);KX(t,o,n,e.thread,e.thread.comments[e.thread.comments.length-1],!0)}});oe.as(ii.Configuration).registerConfiguration({id:"comments",order:20,title:d(8458,null),type:"object",properties:{"comments.openPanel":{enum:["neverOpen","openOnSessionStart","openOnSessionStartWithComments"],default:"openOnSessionStartWithComments",description:d(8463,null),restricted:!1,markdownDeprecationMessage:d(8451,null)},"comments.openView":{enum:["never","file","firstFile","firstFileUnresolved"],enumDescriptions:[d(8456,null),d(8453,null),d(8454,null),d(8455,null)],default:"firstFile",description:d(8452,null),restricted:!1},"comments.useRelativeTime":{type:"boolean",default:!0,description:d(8466,null)},"comments.visible":{type:"boolean",default:!0,description:d(8457,null)},"comments.maxHeight":{type:"boolean",default:!0,description:d(8450,null)},"comments.collapseOnResolve":{type:"boolean",default:!0,description:d(8449,null)},"comments.thread.confirmOnCollapse":{type:"string",enum:["whenHasUnsubmittedComments","never"],enumDescriptions:[d(8461,null),d(8460,null)],default:"whenHasUnsubmittedComments",description:d(8459,null)}}});we(km,$Ee,1);var xst=class extends C{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(8465,null,this.totalUnresolved);this.activity.value=this.activityService.showViewActivity(Eu,{badge:new qc(this.totalUnresolved,()=>t)})}};xst=I([m(0,km),m(1,zl)],xst);oe.as(Qi.Workbench).registerWorkbenchContribution(xst,4);xa.register(new qqt);xa.register(new jqt);xa.register(new Qqt);var dfe=class extends C{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:()=>{}})}))}};dfe=I([m(0,Qe),m(1,ru)],dfe);var Isn="trustedDomains",ysn={type:1,ctime:Date.now(),mtime:Date.now(),size:0},gwo=`// 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
//
`,fwo=`//
// You can use the "Manage Trusted Domains" command to open this file.
// Save this file to apply the trusted domains rules.
`,wsn=`[
	// "https://microsoft.com"
]`;function Csn(a,i,e){let t=gwo;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+=fwo,t+=e?`
// Currently configuring trust for ${e}
`:"",i.length===0?t+=wsn:t+=JSON.stringify(i,null,2),t}var ufe=class{constructor(i,e,t){this.fileService=i;this.storageService=e;this.instantiationService=t;this.capabilities=2;this.onDidChangeCapabilities=H.None;this.onDidChangeFile=H.None;this.fileService.registerProvider(Isn,this)}static{this.ID="workbench.contrib.trustedDomainsFileSystemProvider"}stat(i){return Promise.resolve(ysn)}async readFile(i){let e=this.storageService.get(ULt,-1),t=i.fragment,{defaultTrustedDomains:o,trustedDomains:n}=await this.instantiationService.invokeFunction(Reo);return(!e||e.indexOf(gwo)===-1||e.indexOf(fwo)===-1||e.indexOf(t??"")===-1||[...o,...n].some(s=>!Oi(e).includes(s)))&&(e=Csn(o,n,t)),Je.fromString(e).buffer}writeFile(i,e,t){try{let o=Je.wrap(e).toString(),n=Ur(o);this.storageService.store(ULt,o,-1,0),this.storageService.store(_Ee,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)}};ufe=I([m(0,be),m(1,le),m(2,F)],ufe);var CBe=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(!jd(i,Y.http)&&!jd(i,Y.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:gt.Info,message:d(15607,null,this._productService.nameShort),detail:typeof t=="string"?t:u,buttons:[{label:d(15606,null),run:()=>!0},{label:d(15605,null),run:()=>(this._clipboardService.writeText(typeof t=="string"?t:o.toString(!0)),!1)},{label:d(15604,null),run:async()=>{let{trustedDomains:v}=this._instantiationService.invokeFunction(DEe),b=`${n}://${r}`,S=await Leo(v,b,o,this._quickInputService,this._storageService,this._editorService,this._telemetryService);return!!(S.indexOf("*")!==-1||KLt(o,S))}}],cancelButton:{run:()=>!1}});return f}}};CBe=I([m(0,Qe),m(1,le),m(2,ct),m(3,nt),m(4,Ge),m(5,ee),m(6,Wi),m(7,Te),m(8,F),m(9,B),m(10,ns),m(11,_V)],CBe);var HNi=class a extends K{static{this.STORAGE_KEY="workbench.action.url.openUrl.lastInput"}constructor(){super({id:"workbench.action.url.openUrl",title:L(15608,"Open URL"),category:We.Developer,f1:!0})}async run(i){let e=i.get(Ge),t=i.get(nI),o=i.get(le),n=o.get(a.STORAGE_KEY,1,"");return e.input({prompt:d(15609,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(HNi);qe.registerCommand(zLt);fe.appendMenuItem(D.CommandPalette,{command:{id:zLt.id,title:zLt.description.description}});oe.as(Qi.Workbench).registerWorkbenchContribution(CBe,3);pt(ufe.ID,ufe,ut.BlockRestore);pt(dfe.ID,dfe,ut.BlockRestore);var xsn=oe.as(ii.Configuration);xsn.registerConfiguration({...Cm,properties:{"workbench.trustedDomains.promptInTrustedWorkspace":{scope:1,type:"boolean",default:!1,description:d(15610,null)}}});we(_V,REe,1);var tjt=x.and(x.equals("activeEditor",cR.ID),ue.focus.toNegated()),Yqt=class a extends K{static{this.ID="editor.action.webvieweditor.showFind"}static{this.LABEL=d(15887,null)}constructor(){super({id:a.ID,title:a.LABEL,keybinding:{when:x.and(tjt,FTt),primary:2084,weight:100}})}run(i){ijt(i)?.showFind()}},Xqt=class a extends K{static{this.ID="editor.action.webvieweditor.hideFind"}static{this.LABEL=d(15886,null)}constructor(){super({id:a.ID,title:a.LABEL,keybinding:{when:x.and(tjt,OTt),primary:9,weight:100}})}run(i){ijt(i)?.hideFind()}},Jqt=class a extends K{static{this.ID="editor.action.webvieweditor.findNext"}static{this.LABEL=d(15884,null)}constructor(){super({id:a.ID,title:a.LABEL,keybinding:{when:x.and(tjt,bz),primary:3,weight:100}})}run(i){ijt(i)?.runFindAction(!1)}},Zqt=class a extends K{static{this.ID="editor.action.webvieweditor.findPrevious"}static{this.LABEL=d(15885,null)}constructor(){super({id:a.ID,title:a.LABEL,keybinding:{when:x.and(tjt,bz),primary:1027,weight:100}})}run(i){ijt(i)?.runFindAction(!0)}},ejt=class a extends K{static{this.ID="workbench.action.webview.reloadWebviewAction"}static{this.LABEL=L(15888,"Reload Webviews")}constructor(){super({id:a.ID,title:a.LABEL,category:We.Developer,menu:[{id:D.CommandPalette}]})}async run(i){let e=i.get(wm);for(let t of e.webviews)t.reload()}};function ijt(a){let e=a.get(ee).activeEditor;return e instanceof wu?e.webview:void 0}var nQ=class{constructor(i){this._webviewWorkbenchService=i}static{this.ID=wu.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:UNi(i.extensionId,i.extensionLocation),iconPath:zNi(i.iconPath),state:ksn(i.state),webviewOptions:i.options,contentOptions:KNi(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}}};nQ=I([m(0,V_)],nQ);function UNi(a,i){if(!a)return;let e=ojt(i);if(e)return{id:new Ei(a),location:e}}function zNi(a){if(!a)return;if(q.isThemeIcon(a))return a;let i=ojt(a.light),e=ojt(a.dark);return i&&e?{light:i,dark:e}:void 0}function ojt(a){if(a)try{return typeof a=="string"?A.parse(a):A.from(a)}catch{return}}function ksn(a){return typeof a=="string"?a:void 0}function KNi(a){return{...a,localResourceRoots:a.localResourceRoots?.map(i=>ojt(i))}}oe.as(rn.EditorPane).registerEditorPane(ys.create(cR,cR.ID,d(15890,null)),[new Mt(wu)]);var xBe=class extends C{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 wu)||e.typeId!==wu.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)}};xBe=I([m(0,ee),m(1,Et)],xBe);pt(xBe.ID,xBe,ut.BlockStartup);oe.as(rn.EditorFactory).registerEditorSerializer(nQ.ID,nQ);we(V_,Uke,1);W(Yqt);W(Xqt);W(Jqt);W(Zqt);W(ejt);we(VEe,ZLt,1);var pfe=class extends nQ{constructor(e,t,o){super(e);this._instantiationService=t;this._webviewService=o}static{this.ID=Yp.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=vwo(this._webviewService,o),r=this._instantiationService.createInstance(Yp,{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}};pfe=I([m(0,V_),m(1,F),m(2,wm)],pfe);function vwo(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 mfe=class extends C{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===Y.vscodeCustomEditor}isOpen(e,t){if(!this.handles(e))return!1;if(e.resource.authority==="jupyter-notebook-ipynb"&&t instanceof ha)try{let o=JSON.parse(e.resource.query),n=A.from(o);return Xe(n,t.resource)}catch{return!1}if(!(t instanceof Yp)||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 Xe(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=UNi(o.extension?.id,o.extension?.location),r=vwo(this._webviewService,{viewType:o.viewType,origin:o.webview.origin,webviewOptions:o.webview.options,contentOptions:KNi(o.webview.options),state:o.webview.state,extension:n,title:o.customTitle}),s=this._instantiationService.createInstance(Yp,{resource:A.revive(o.editorResource),viewType:o.viewType,webviewTitle:o.customTitle,iconPath:zNi(o.iconPath)},r,{backupId:o.backupId});return s.updateGroup(0),s}};mfe=I([m(0,F),m(1,Vf),m(2,Gm),m(3,wm),m(4,tX)],mfe);var njt=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:wd(()=>{--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 SH=Object.freeze({viewType:"viewType",displayName:"displayName",selector:"selector",priority:"priority"}),Tsn={type:"object",required:[SH.viewType,SH.displayName,SH.selector],additionalProperties:!1,properties:{[SH.viewType]:{type:"string",markdownDescription:d(8581,null)},[SH.displayName]:{type:"string",description:d(8575,null)},[SH.selector]:{type:"array",description:d(8579,null),items:{type:"object",defaultSnippets:[{body:{filenamePattern:"$1"}}],additionalProperties:!1,properties:{filenamePattern:{type:"string",description:d(8580,null)}}}},[SH.priority]:{type:"string",markdownDeprecationMessage:d(8576,null),enum:["default","option"],markdownEnumDescriptions:[d(8577,null),d(8578,null)],default:"default"}}},bwo=Tn.registerExtensionPoint({extensionPoint:"customEditors",deps:[C5],jsonSchema:{description:d(8574,null),type:"array",defaultSnippets:[{body:[{[SH.viewType]:"$1",[SH.displayName]:"$2",[SH.selector]:[{filenamePattern:"$3"}]}]}],items:Tsn},activationEventsGenerator:function*(a){for(let i of a){let e=i[SH.viewType];e&&(yield`onCustomEditor:${e}`)}}}),GNi=class extends C{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(8585,null),d(8584,null),d(8583,null)],n=t.map(r=>[r.viewType,r.priority??"",si(r.selector.map(s=>s.filenamePattern)).join(", ")]);return{data:{headers:o,rows:n},dispose:()=>{}}}};oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:"customEditors",label:d(8582,null),access:{canToggle:!1},renderer:new Mt(GNi)});var rjt=class a extends C{constructor(e){super();this._editors=new Map;this._onChange=this._register(new E);this.onChange=this._onChange.event;this._memento=new Bl(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 VQe(o));this._register(bwo.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 VQe({id:n.viewType,displayName:n.displayName,providerDisplayName:o.description.isBuiltin?d(8571,null):o.description.displayName||o.description.identifier.value,selector:n.selector||[],priority:_sn(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 _sn(a,i){switch(a.priority){case"default":return"default";case"option":return"option";case"builtin":return i.isBuiltin?"builtin":"default";default:return"default"}}var kBe=class extends C{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 P);this._editorCapabilities=new Map;this._onDidChangeEditorTypes=this._register(new E);this.onDidChangeEditorTypes=this._onDidChangeEditorTypes.event;this._fileEditorFactory=oe.as(rn.EditorFactory).getFileEditorFactory();this._models=new njt,this._contributedEditors=this._register(new rjt(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:DXi,getGroupContextKeyValue:h=>this.getActiveCustomEditorId(h),onDidChange:this.onDidChangeEditorTypes},u={contextKey:LXi,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(BT.addImplementation(p,"custom-editor",()=>this.withActiveCustomEditor(h=>h.undo()))),this._register(HT.addImplementation(p,"custom-editor",()=>this.withActiveCustomEditor(h=>h.redo())))}getEditorTypes(){return[...this._contributedEditors]}withActiveCustomEditor(e){let t=this.editorService.activeEditor;if(t instanceof Yp){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:Yp.create(this.instantiationService,{resource:o,viewType:e.id,webviewTitle:void 0,iconPath:void 0},n.id)}),createUntitledEditorInput:({resource:o},n)=>({editor:Yp.create(this.instantiationService,{resource:o??A.from({scheme:Y.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=Yp.create(this.instantiationService,{resource:Oi(e.modified.resource),viewType:t,webviewTitle:void 0,iconPath:void 0},o.id,{customClasses:"modified"}),r=Yp.create(this.instantiationService,{resource:Oi(e.original.resource),viewType:t,webviewTitle:void 0,iconPath:void 0},o.id,{customClasses:"original"});return this.instantiationService.createInstance(Fa,e.label,e.description,r,n,!0)}get models(){return this._models}getCustomEditor(e){return this._contributedEditors.get(e)}getContributedCustomEditors(e){return new Hke(this._contributedEditors.getContributedEditors(e))}getUserConfiguredCustomEditors(e){let t=this.editorResolverService.getAssociationsForResource(e);return new Hke(si(t.map(o=>this._contributedEditors.get(o.viewType))))}getAllCustomEditors(e){return new Hke([...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 Yp?t.input.viewType:""}getCustomEditorIsEditable(e){let t=e.activeEditorPane;return t?.input?.resource?t?.input instanceof Yp:!1}async handleMovedFileInOpenedFileEditors(e,t){if(ms(e).toLowerCase()===ms(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 Yp)&&Xe(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=Yp.create(this.instantiationService,{resource:t,viewType:u,webviewTitle:void 0,iconPath:void 0},r)}else c={resource:t,options:{override:Ys.id}};return{editor:l,replacement:c,options:{preserveFocus:!0}}}),r)}};kBe=I([m(0,be),m(1,le),m(2,ee),m(3,Et),m(4,F),m(5,dt),m(6,ul)],kBe);we(tX,kBe,1);oe.as(rn.EditorPane).registerEditorPane(ys.create(cR,cR.ID,"Webview Editor"),[new Mt(Yp)]);oe.as(rn.EditorFactory).registerEditorSerializer(pfe.ID,pfe);pt(mfe.ID,mfe,ut.BlockStartup);we(NX,NEe,1);oe.as(ii.Configuration).registerConfiguration(Hmi);var Poe=class extends C{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(),Poe.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:bEe,scheme:"*"},{language:SEe,scheme:"*"}],{provideLinks:async t=>{let o=await this.provideLinks(t.uri);return o&&{links:o}}})):(Ue(this.linkProviderRegistration),this.linkProviderRegistration=void 0),this.disposeWorker(),this.disposeWorkerScheduler.cancel()}getOrCreateWorker(){return this.disposeWorkerScheduler.schedule(),this.worker||(this.worker=new kst(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)}};Poe=I([m(0,Pe),m(1,Ct),m(2,zt),m(3,Ay)],Poe);var kst=class extends C{constructor(e,t,o){super();this.contextService=e;this._workerClient=this._register(o.createWorkerClient(new gx({esmModuleLocation:gn.asBrowserUri("vs/workbench/contrib/output/common/outputLinkComputerMain.js"),label:"OutputLinkDetectionWorker"}))),this._workerTextModelSyncClient=this._register(Z6.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())}};kst=I([m(0,Pe),m(1,Ct),m(2,Ay)],kst);var Swo=/^(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3})\s(\[(info|trace|debug|error|warning)\])\s(\[(.*?)\])?/;function Iwo(a,i){let e=a.getLineContent(i),t=Swo.exec(e);if(t){let o=new Date(t[1]).getTime(),n=new z(i,1,i,t[1].length),r=Dsn(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(Swo.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*$Ni(a,i){for(let e=1;e<=a.getLineCount();e++){let t=Iwo(a,e);t&&(yield i(t),e=t.range.endLineNumber)}}function ywo(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 Dsn(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 EBe=class extends C{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(!so(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,Xo(e.size)&&this.endOffset>e.size?(this.reset(0),this._onDidReset.fire()):this._onDidAppend.fire())}catch(e){if(hu(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(hu(t)!==1)throw t;return{name:this.name,content:"",consume:()=>{}}}}parseLogEntries(e,t){let o=this.instantiationService.createInstance(Bu,e,kX,Bu.DEFAULT_CREATION_OPTIONS,null);try{if(!Iwo(o,1))return[];let n=[],r=t?t.range.endLineNumber+1:1;for(let s of $Ni(o,l=>ywo(l,r)))n.push(s),r=s.range.endLineNumber+1;return n}finally{o.dispose()}}};EBe=I([m(1,be),m(2,F),m(3,ne)],EBe);var Est=class extends C{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=H.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 P,o=t.add(new EBe(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=eGe(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(Bu,e[0].content,kX,Bu.DEFAULT_CREATION_OPTIONS,null);try{for(let[p,h]of $Ni(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(Bu,h,kX,Bu.DEFAULT_CREATION_OPTIONS,null);try{let v=$Ni(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 N=cx(o,S,(O,V)=>O.timestamp-V.timestamp);T=N<0?~N:N}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=ywo(o[p],u);c.push(h),u=h.range.endLineNumber+1}return{logEntries:c,content:l}}};Est=I([m(1,F),m(2,be),m(3,ne)],Est);var TBe=class extends C{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=fn.withAsyncBody(async(e,t)=>{try{this.modelDisposable.value=new P,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 $e);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([An.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(!so(n))throw n})}doAppendContent(e,t){let o=e.getLineCount(),n=e.getLineMaxColumn(o);e.applyEdits([An.insert(new Ie(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[An.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=>An.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")}};TBe=I([m(3,Ct),m(4,$s)],TBe);var hfe=class extends TBe{constructor(e,t,o,n,r,s,l,c){let u=new EBe(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)&&(Xo(t)?this.fileOutput.reset(t):this.fileOutput.resetToEnd()),this.doUpdate(e,o)})}updateChannelSources(e){throw new Error("Not supported")}};hfe=I([m(3,be),m(4,Ct),m(5,F),m(6,ne),m(7,$s)],hfe);var _Be=class extends TBe{constructor(e,t,o,n,r,s,l,c){let u=new Est(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")}};_Be=I([m(3,be),m(4,Ct),m(5,ne),m(6,$s),m(7,F)],_Be);var Tst=class extends hfe{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+=Je.fromString(i).byteLength,this.logger.info(i),this.isVisible()&&this.logger.flush()}};Tst=I([m(4,be),m(5,Ct),m(6,ol),m(7,F),m(8,ne),m(9,$s)],Tst);var DBe=class extends C{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=je(n,`${e.replace(/[\\/:\*\?"<>\|]/g,"")}.log`);this.source={resource:c}}async createOutputChannelModel(e,t,o,n,r){await r;let s=je(n,`${e.replace(/[\\/:\*\?"<>\|]/g,"")}.log`);await this.fileService.createFile(s);let l=this._register(this.instantiationService.createInstance(Tst,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))}};DBe=I([m(5,F),m(6,be)],DBe);var qNi="output.activechannel",_st=class extends C{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:Y.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?kX:tLt);return EV(t)?this.instantiationService.createInstance(_Be,e,o,[...t.source]):LP(t)?this.instantiationService.createInstance(hfe,e,o,t.source):this.instantiationService.createInstance(DBe,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)}};_st=I([m(3,kt),m(4,F)],_st);var jNi=class extends C{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=cLt.bindTo(this.contextKeyService),this._trace.set(e.trace),this._debug=dLt.bindTo(this.contextKeyService),this._debug.set(e.debug),this._info=uLt.bindTo(this.contextKeyService),this._info.set(e.info),this._warning=pLt.bindTo(this.contextKeyService),this._warning.set(e.warning),this._error=mLt.bindTo(this.contextKeyService),this._error.set(e.error),this._categories=hLt.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},`)}},LBe=class extends C{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 jt);this._onActiveOutputChannel=this._register(new E);this.onActiveOutputChannel=this._onActiveOutputChannel.event;this.outputFolderCreationPromise=null;this.activeChannelIdInStorage=this.storageService.get(qNi,1,""),this.activeOutputChannelContext=lLt.bindTo(c),this.activeOutputChannelContext.set(this.activeChannelIdInStorage),this._register(this.onActiveOutputChannel(v=>this.activeOutputChannelContext.set(v))),this.activeFileOutputChannelContext=oeo.bindTo(c),this.activeLogOutputChannelContext=oLt.bindTo(c),this.activeOutputChannelLevelSettableContext=nLt.bindTo(c),this.activeOutputChannelLevelContext=rLt.bindTo(c),this.activeOutputChannelLevelIsDefaultContext=sLt.bindTo(c),this.outputLocation=je(g.windowLogsPath,`output_${Pmt(new Date).replace(/-|:|\.\d+Z$/g,"")}`),this._register(o.registerTextModelContentProvider(Y.outputChannel,this)),this._register(t.createInstance(Poe));let f=oe.as(sS.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(H.filter(this.viewsService.onDidChangeViewVisibility,v=>v.id===Ul&&v.visible)(()=>{this.activeChannel&&this.viewsService.getActiveViewWithId(Ul)?.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 jNi({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(Ul,!t);n&&o&&n.showChannel(o,!!t)}getChannel(e){return this.channels.get(e)}getChannelDescriptor(e){return oe.as(sS.OutputChannels).getChannel(e)}getChannelDescriptors(){return oe.as(sS.OutputChannels).getChannels()}getActiveChannel(){return this.activeChannel}canSetLogLevel(e){return e.log&&e.id!==qle}getLogLevel(e){if(!e.log)return;let t=LP(e)?[e.source]:EV(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=LP(e)?[e.source]:EV(e)?e.source:[];if(o.length!==0)for(let n of o)this.loggerService.setLogLevel(n.resource,t)}registerCompoundLogChannel(e){let t=oe.as(sS.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(LP(n))return[{resource:n.source.resource,name:n.source.name??n.label}];if(EV(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(12258,null),availableFileSystems:[Y.file],defaultUri:je(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,Je.fromString(r.object.textEditorModel.getValue()))}finally{r.dispose()}return}finally{t.length>1&&oe.as(sS.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(Ul)?.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(H.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(Ul)?this.showChannel(n.id):this.setActiveChannel(void 0)}oe.as(sS.OutputChannels).removeChannel(e)})),t}instantiateChannel(e){let t=oe.as(sS.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(_st,t,this.outputLocation,this.outputFolderCreationPromise)}setLevelContext(){let e=this.activeChannel?.outputChannelDescriptor,t=e?this.getLogLevel(e):void 0;this.activeOutputChannelLevelContext.set(t!==void 0?$w(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&&LP(t)),this.activeLogOutputChannelContext.set(!!t?.log),this.activeOutputChannelLevelSettableContext.set(t!==void 0&&this.canSetLogLevel(t)),this.setLevelIsDefaultContext(),this.setLevelContext(),this.activeChannel?this.storageService.store(qNi,this.activeChannel.id,1,1):this.storageService.remove(qNi,1)}};LBe=I([m(0,le),m(1,F),m(2,Nt),m(3,ne),m(4,ol),m(5,ao),m(6,Ft),m(7,X),m(8,aD),m(9,dn),m(10,be),m(11,Vt)],LBe);var Aoe=class extends iF{constructor(e,t,o,n,r,s,l,c,u,p,h,g){let f=new Bl(wr.MARKERS_VIEW_STORAGE_ID,g),v=f.getMemento(1,1);super({...e,filterOptions:{placeholder:d(12262,null),focusContextKey:IEe.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=aLt.bindTo(this.contextKeyService);let S=this._register(l.createChild(new Io([X,this.scopedContextKeyService])));this.editor=this._register(S.createInstance(Dst)),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 ai(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=xn(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(IC,e.uri,d(12261,null,e.label),d(12259,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()}};Aoe=I([m(1,_e),m(2,ze),m(3,B),m(4,X),m(5,Ri),m(6,F),m(7,Qe),m(8,De),m(9,tt),m(10,Ml),m(11,le)],Aoe);var Dst=class extends gue{constructor(e,t,o,n,r,s,l,c,u){super(Ul,l.activeGroup,e,t,o,r,s,l,c,u);this.configurationService=n;this.resourceContext=this._register(t.createInstance(Fo))}getId(){return Ul}getTitle(){return d(12260,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(12263,null)}computeAriaLabel(){return this.input?JY(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&&iLt.bindTo(t).set(!0)}_getContributions(){return[...aa.getEditorContributions(),{id:RBe.ID,ctor:RBe,instantiation:0}]}getCodeEditorWidgetOptions(){return{contributions:this._getContributions()}}};Dst=I([m(0,Te),m(1,F),m(2,le),m(3,B),m(4,Nn),m(5,De),m(6,Et),m(7,ee),m(8,be)],Dst);var RBe=class extends C{constructor(e,t){super();this.editor=e;this.outputService=t;this.modelDisposables=this._register(new P);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.${Ul}.toggle.${l}`,title:c,toggled:x.regex(hLt.key,new RegExp(`.*,${Yr(l)},.*`)).negate(),menu:{id:TC,group:"1_category_filter",when:x.and(x.equals("view",Ul))}})}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:Vq._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}};RBe=I([m(1,Ml)],RBe);var sjt=class{constructor(){this.type="help";this.priority=105;this.name="outputFilter";this.when=IEe}getProvider(i){return new QNi(i.get(_e))}},QNi=class extends C{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(12239,null)),e.push(d(12231,null)),e.push(""),e.push(d(12251,null)),e.push(d(12250,null)),e.push(""),e.push(d(12241,null)),e.push(d(12240,null)),e.push(""),e.push(d(12234,null)),e.push(d(12232,null)),e.push(d(12233,null)),e.push(""),e.push(d(12238,null)),e.push(d(12235,null)),e.push(d(12236,null)),e.push(d(12237,null)),e.push(""),e.push(d(12255,null)),e.push(d(12257,null)),e.push(d(12254,null)),e.push(d(12252,null)),e.push(d(12256,null)),e.push(d(12253,null)),e.push(""),e.push(d(12242,null)),e.push(d(12243,null)),e.push(d(12245,null)),e.push(d(12244,null)),e.push(""),e.push(d(12246,null,this._describeCommand("workbench.action.openSettings")||"Ctrl+,")),e.push(d(12247,null)),e.push(d(12249,null)),e.push(d(12248,null)),e.push(""),e.push(d(12230,null)),e.push(d(12229,null)),e.join(`
`)}_describeCommand(e){return this._keybindingService.lookupKeybinding(e)?.getAriaLabel()??void 0}onClose(){}};var Lsn="importedLog.";we(Ml,LBe,1);xa.register(new sjt);LM.registerLanguage({id:bEe,extensions:[],mimetypes:[tLt]});LM.registerLanguage({id:SEe,extensions:[],mimetypes:[kX]});var wwo=Re("output-view-icon",M.output,d(12216,null)),Rsn=oe.as(on.ViewContainersRegistry).registerViewContainer({id:Ul,title:L(12211,"Output"),icon:wwo,order:1,ctorDescriptor:new Mt(Ha,[Ul,{mergeViewWithContainerWhenSingleView:!0}]),storageId:Ul,hideIfEmpty:!0},1,{doNotRegisterOpenCommand:!0});oe.as(on.ViewsRegistry).registerViews([{id:Ul,name:L(12211,"Output"),containerIcon:wwo,canMoveView:!0,canToggleVisibility:!0,ctorDescriptor:new Mt(Aoe),openCommandActionDescriptor:{id:"workbench.action.output.toggleOutput",mnemonicTitle:d(12206,null),keybindings:{primary:3123,linux:{primary:Ai(2089,2086)}},order:1}}],Rsn);var Lst=class extends C{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(12224,null)})}async run(r,s){s&&r.get(Ml).showChannel(s,!0)}}));let e=new D("workbench.output.menu.switchOutput");this._register(fe.appendMenuItem(D.ViewTitle,{submenu:e,title:d(12225,null),group:"navigation",when:x.equals("view",Ul),order:1,isSelection:!0}));let t=new Map;this._register(Z(()=>Ue(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:lLt.isEqualTo(s.id),menu:{id:e,group:c}})}async run(u){return u.get(Ml).showChannel(s.id,!0)}}))}};o(this.outputService.getChannelDescriptors());let n=oe.as(sS.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(12195,"Add Compound Log..."),category:L(12211,"Output"),f1:!0,menu:[{id:D.ViewTitle,when:x.equals("view",Ul),group:"2_add"}]})}async run(e){let t=e.get(Ml),o=e.get(Ge),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(12199,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(12219,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(12217,"Remove Output..."),category:L(12211,"Output"),f1:!0})}async run(e){let t=e.get(Ml),o=e.get(Ge),n=e.get(Ne),r=t.getChannelDescriptors().filter(c=>c.user);if(r.length===0){n.info(d(12207,null));return}let s=await o.pick(r,{placeHolder:d(12219,null),canPickMany:!0});if(!s?.length)return;let l=oe.as(sS.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(12223,"Show Output Channels..."),category:L(12211,"Output"),f1:!0})}async run(e){let t=e.get(Ml),o=e.get(Ge),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(12221,null)});if(l)return t.showChannel(l.id)}}))}registerClearOutputAction(){this._register(W(class extends K{constructor(){super({id:"workbench.output.action.clearOutput",title:L(12197,"Clear Output"),category:We.View,menu:[{id:D.ViewTitle,when:x.equals("view",Ul),group:"navigation",order:2},{id:D.CommandPalette},{id:D.EditorContext,when:iLt}],icon:M.clearAll})}async run(e){let t=e.get(Ml),o=e.get(tr),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(12226,"Toggle Auto Scrolling"),tooltip:d(12214,null),menu:{id:D.ViewTitle,when:x.and(x.equals("view",Ul)),group:"navigation",order:3},icon:M.lock,toggled:{condition:aLt,icon:M.unlock,tooltip:d(12215,null)}})}async run(e){let t=e.get(Ft).getActiveViewWithId(Ul);t.scrollLock=!t.scrollLock}}))}registerOpenActiveOutputFileAction(){let e=this;this._register(W(class extends K{constructor(){super({id:"workbench.action.openActiveLogOutputFile",title:L(12208,"Open Output in Editor"),menu:[{id:D.ViewTitle,when:x.equals("view",Ul),group:"navigation",order:4,isHiddenByDefault:!0}],icon:M.goToFile})}async run(){e.openActiveOutput()}}))}registerOpenActiveOutputFileInAuxWindowAction(){let e=this;this._register(W(class extends K{constructor(){super({id:"workbench.action.openActiveLogOutputFileInNewWindow",title:L(12209,"Open Output in New Window"),menu:[{id:D.ViewTitle,when:x.equals("view",Ul),group:"navigation",order:5,isHiddenByDefault:!0}],icon:M.emptyWindow})}async run(){e.openActiveOutput(hg)}}))}registerSaveActiveOutputAsAction(){this._register(W(class extends K{constructor(){super({id:"workbench.action.saveActiveLogOutputAs",title:L(12218,"Save Output As..."),menu:[{id:D.ViewTitle,when:x.equals("view",Ul),group:"1_export",order:1}]})}async run(e){let t=e.get(Ml),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(fe.appendMenuItem(D.ViewTitle,{submenu:e,title:d(12204,null),group:"navigation",when:x.and(x.equals("view",Ul),nLt),icon:M.gear,order:6}));let t=0,o=n=>{this._register(W(class extends K{constructor(){super({id:`workbench.action.output.activeOutputLogLevel.${n}`,title:zGe(n).value,toggled:rLt.isEqualTo($w(n)),menu:{id:e,order:t++,group:"0_level"}})}async run(r){let s=r.get(Ml),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(12205,null),menu:{id:e,order:t,group:"1_default"},precondition:sLt.negate()})}async run(n){let r=n.get(Ml),s=n.get(ol),l=n.get(aD),c=r.getActiveChannel();if(c){let u=r.getChannelDescriptor(c.id);if(u&&LP(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(12222,"Show Logs..."),category:We.Developer,menu:{id:D.CommandPalette}})}async run(e){let t=e.get(Ml),o=e.get(Ge),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(12199,null)});for(let{id:c,label:u}of n)s.push({id:c,label:u});let l=await o.pick(s,{placeHolder:d(12219,null)});if(l)return t.showChannel(l.id)}}))}registerOpenLogFileAction(){this._register(W(class extends K{constructor(){super({id:"workbench.action.openLogFile",title:L(12210,"Open Log..."),category:We.Developer,menu:{id:D.CommandPalette},metadata:{description:"workbench.action.openLogFile",args:[{name:"logFile",schema:{markdownDescription:d(12202,null),type:"string"}}]}})}async run(e,t){let o=e.get(Ml),n=e.get(Ge),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(12220,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 Fn{constructor(){super({id:`workbench.actions.${Ul}.toggle.${$w(o)}`,title:zGe(o).value,metadata:{description:L(12227,"Show or hide {0} messages in the output",$w(o))},toggled:n,menu:{id:TC,group:"2_log_filter",when:x.and(x.equals("view",Ul),oLt),order:e++},viewId:Ul})}async runInView(r,s){this.toggleLogLevelFilter(r.get(Ml),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,cLt),t(2,dLt),t(3,uLt),t(4,pLt),t(5,mLt)}registerClearFilterActions(){this._register(W(class extends Fn{constructor(){super({id:`workbench.actions.${Ul}.clearFilterText`,title:d(12196,null),keybinding:{when:IEe,weight:200,primary:9},viewId:Ul})}async runInView(e,t){t.clearFilterText()}}))}registerExportLogsAction(){this._register(W(class extends K{constructor(){super({id:"workbench.action.exportLogs",title:L(12198,"Export Logs..."),f1:!0,category:We.Developer,menu:[{id:D.ViewTitle,when:x.equals("view",Ul),group:"1_export",order:2}]})}async run(e,t){let o=e.get(Ml),n=e.get(Ge),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(12199,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(12228,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=>!(Wo(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(12219,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(12200,"Import Log..."),f1:!0,category:We.Developer,menu:[{id:D.ViewTitle,when:x.equals("view",Ul),group:"2_add",order:2}]})}async run(e){let t=e.get(Ml),n=await e.get(dn).showOpenDialog({title:d(12201,null),canSelectFiles:!0,canSelectFolders:!1,canSelectMany:!0,filters:[{name:d(12203,null),extensions:["log"]}]});if(n?.length){let r=Ye(n[0]),s=`${Lsn}${Date.now()}`;oe.as(sS.OutputChannels).registerChannel({id:s,label:r,log:!0,user:!0,source:n.length===1?{resource:n[0]}:n.map(l=>({resource:l,name:Ye(l).split(".")[0]}))}),t.showChannel(s)}}}))}};Lst=I([m(0,Ml),m(1,ee)],Lst);oe.as(Qi.Workbench).registerWorkbenchContribution(Lst,3);oe.as(ii.Configuration).registerConfiguration({id:"output",order:30,title:d(12212,null),type:"object",properties:{"output.smartScroll.enabled":{type:"boolean",description:d(12213,null),default:!0,scope:4,tags:["output"]}}});yt.registerKeybindingRule({id:"cursorWordAccessibilityLeft",when:x.and(ue.textInputFocus,$a,Zy,x.equals(Vl.key,Ul)),primary:2063,weight:200});yt.registerKeybindingRule({id:"cursorWordAccessibilityLeftSelect",when:x.and(ue.textInputFocus,$a,Zy,x.equals(Vl.key,Ul)),primary:3087,weight:200});yt.registerKeybindingRule({id:"cursorWordAccessibilityRight",when:x.and(ue.textInputFocus,$a,Zy,x.equals(Vl.key,Ul)),primary:2065,weight:200});yt.registerKeybindingRule({id:"cursorWordAccessibilityRightSelect",when:x.and(ue.textInputFocus,$a,Zy,x.equals(Vl.key,Ul)),primary:3089,weight:200});var MBe=class extends C{constructor(e,t,o){super();this._loggerService=e;this._logger=this._loggerService.createLogger(je(o.logsHome,"terminal.log"),{id:"terminal",name:d(2303,null)}),this._register(H.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}};MBe=I([m(0,ol),m(1,Pe),m(2,Co)],MBe);var PBe=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(dc),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}};PBe=I([m(0,Ft)],PBe);var xwo=`
- `+["`${cwd}`: "+d(14297,null),"`${cwdFolder}`: "+d(14298,null),"`${workspaceFolder}`: "+d(14458,null),"`${workspaceFolderName}`: "+d(14459,null),"`${local}`: "+d(14305,null),"`${process}`: "+d(14308,null),"`${progress}`: "+d(14309,null),"`${separator}`: "+d(14310,null,"(` - `)"),"`${sequence}`: "+d(14311,null),"`${task}`: "+d(14315,null),"`${shellType}`: "+d(14314,null),"`${shellCommand}`: "+d(14312,null),"`${shellPromptInput}`: "+d(14313,null)].join(`
- `),kwo=d(14457,null);kwo+=xwo;var Ewo=d(14455,null);Ewo+=xwo;var YNi=it?12:14,Cwo={"terminal.integrated.sendKeybindingsToShell":{markdownDescription:d(14407,null,"`#terminal.integrated.commandsToSkipShell#`"),type:"boolean",default:!1},"terminal.integrated.tabs.defaultColor":{description:d(14423,null),...Gui,scope:5},"terminal.integrated.tabs.defaultIcon":{description:d(14424,null),...$ui,default:M.terminal.id,scope:5},"terminal.integrated.tabs.enabled":{description:d(14426,null),type:"boolean",default:!0},"terminal.integrated.tabs.enableAnimation":{description:d(14425,null),type:"boolean",default:!0},"terminal.integrated.tabs.hideCondition":{description:d(14430,null),type:"string",enum:["never","singleTerminal","singleGroup"],enumDescriptions:[d(14431,null),d(14433,null),d(14432,null)],default:"singleTerminal"},"terminal.integrated.tabs.showActiveTerminal":{description:d(14443,null),type:"string",enum:["always","singleTerminal","singleTerminalOrNarrow","never"],enumDescriptions:[d(14444,null),d(14446,null),d(14447,null),d(14445,null)],default:"singleTerminalOrNarrow"},"terminal.integrated.tabs.showActions":{description:d(14438,null),type:"string",enum:["always","singleTerminal","singleTerminalOrNarrow","never"],enumDescriptions:[d(14439,null),d(14441,null),d(14442,null),d(14440,null)],default:"singleTerminalOrNarrow"},"terminal.integrated.tabs.location":{type:"string",enum:["left","right"],enumDescriptions:[d(14435,null),d(14436,null)],default:"right",description:d(14434,null)},"terminal.integrated.defaultLocation":{type:"string",enum:["editor","view"],enumDescriptions:[d(14340,null),d(14341,null)],default:"view",description:d(14339,null)},"terminal.integrated.tabs.focusMode":{type:"string",enum:["singleClick","doubleClick"],enumDescriptions:[d(14429,null),d(14428,null)],default:"doubleClick",description:d(14427,null)},"terminal.integrated.macOptionIsMeta":{description:d(14389,null),type:"boolean",default:!1},"terminal.integrated.macOptionClickForcesSelection":{description:d(14388,null),type:"boolean",default:!1},"terminal.integrated.altClickMovesCursor":{markdownDescription:d(14320,null,"`#editor.multiCursorModifier#`","`'alt'`"),type:"boolean",default:!0},"terminal.integrated.copyOnSelection":{description:d(14332,null),type:"boolean",default:!1},"terminal.integrated.enableMultiLinePasteWarning":{markdownDescription:d(14354,null),type:"string",enum:["auto","always","never"],markdownEnumDescriptions:[d(14356,null),d(14355,null),d(14357,null)],default:"auto"},"terminal.integrated.drawBoldTextInBrightColors":{description:d(14349,null),type:"boolean",default:!0},"terminal.integrated.fontFamily":{markdownDescription:d(14371,null,"`#editor.fontFamily#`"),type:"string"},"terminal.integrated.fontLigatures.enabled":{markdownDescription:d(14372,null,"`#terminal.integrated.fontFamily#`"),type:"boolean",default:!1},"terminal.integrated.fontLigatures.featureSettings":{markdownDescription:d(14374,null)+`

- `+['`"calt" off, "ss03"`','`"liga" on`','`"calt" off, "dlig" on`'].join(`
- `),type:"string",default:'"calt" on'},"terminal.integrated.fontLigatures.fallbackLigatures":{markdownDescription:d(14373,null,"`#terminal.integrated.gpuAcceleration#`","`#terminal.integrated.fontFamily#`"),type:"array",items:[{type:"string"}],default:["<--","<---","<<-","<-","->","->>","-->","--->","<==","<===","<<=","<=","=>","=>>","==>","===>",">=",">>=","<->","<-->","<--->","<---->","<=>","<==>","<===>","<====>","::",":::","<~~","</","</>","/>","~~>","==","!=","/=","~=","<>","===","!==","!===","<:",":=","*=","*+","<*","<*>","*>","<|","<|>","|>","+*","=*","=:",":>","/*","*/","+++","<!--","<!---"]},"terminal.integrated.fontSize":{description:d(14375,null),type:"number",default:YNi,minimum:6,maximum:100},"terminal.integrated.letterSpacing":{description:d(14386,null),type:"number",default:aDt},"terminal.integrated.lineHeight":{description:d(14387,null),type:"number",default:lDt},"terminal.integrated.minimumContrastRatio":{markdownDescription:d(14393,null),type:"number",default:4.5,tags:["accessibility"]},"terminal.integrated.tabStopWidth":{markdownDescription:d(14448,null),type:"number",minimum:1,default:8},"terminal.integrated.fastScrollSensitivity":{markdownDescription:d(14366,null),type:"number",default:5},"terminal.integrated.mouseWheelScrollSensitivity":{markdownDescription:d(14394,null),type:"number",default:1},"terminal.integrated.bellDuration":{markdownDescription:d(14321,null),type:"number",default:1e3},"terminal.integrated.fontWeight":{anyOf:[{type:"number",minimum:JQe,maximum:ZQe,errorMessage:d(14378,null)},{type:"string",pattern:"^(normal|bold|1000|[1-9][0-9]{0,2})$"},{enum:tpi}],description:d(14376,null),default:"normal"},"terminal.integrated.fontWeightBold":{anyOf:[{type:"number",minimum:JQe,maximum:ZQe,errorMessage:d(14378,null)},{type:"string",pattern:"^(normal|bold|1000|[1-9][0-9]{0,2})$"},{enum:tpi}],description:d(14377,null),default:"bold"},"terminal.integrated.cursorBlinking":{description:d(14333,null),type:"boolean",default:!1},"terminal.integrated.textBlinking":{description:d(14449,null),type:"boolean",default:!1},"terminal.integrated.cursorStyle":{description:d(14334,null),enum:["block","line","underline"],default:"block"},"terminal.integrated.cursorStyleInactive":{description:d(14335,null),enum:["outline","block","line","underline","none"],default:"outline"},"terminal.integrated.cursorWidth":{markdownDescription:d(14336,null,"`#terminal.integrated.cursorStyle#`","`line`"),type:"number",default:1},"terminal.integrated.scrollback":{description:d(14406,null),type:"number",default:1e3},"terminal.integrated.detectLocale":{markdownDescription:d(14342,null),type:"string",enum:["auto","off","on"],markdownEnumDescriptions:[d(14343,null),d(14344,null),d(14345,null)],default:"auto"},"terminal.integrated.gpuAcceleration":{type:"string",enum:["auto","on","off"],markdownEnumDescriptions:[d(14380,null),d(14382,null),d(14381,null)],default:"auto",description:d(14379,null)},"terminal.integrated.tabs.separator":{type:"string",default:" - ",markdownDescription:d(14437,null,"`#terminal.integrated.tabs.title#`","`#terminal.integrated.tabs.description#`")},"terminal.integrated.tabs.title":{type:"string",default:"${process}",markdownDescription:kwo},"terminal.integrated.tabs.description":{type:"string",default:"${task}${separator}${local}${separator}${cwdFolder}",markdownDescription:Ewo},"terminal.integrated.rightClickBehavior":{type:"string",enum:["default","copyPaste","paste","selectWord","nothing"],enumDescriptions:[d(14402,null),d(14401,null),d(14404,null),d(14405,null),d(14403,null)],default:it?"selectWord":ri?"copyPaste":"default",description:d(14400,null)},"terminal.integrated.middleClickBehavior":{type:"string",enum:["default","paste"],enumDescriptions:[d(14391,null),d(14392,null)],default:"default",description:d(14390,null)},"terminal.integrated.cwd":{restricted:!0,description:d(14338,null),type:"string",default:void 0,scope:5},"terminal.integrated.confirmOnExit":{description:d(14323,null),type:"string",enum:["never","always","hasChildProcesses"],enumDescriptions:[d(14326,null),d(14324,null),d(14325,null)],default:"never"},"terminal.integrated.confirmOnKill":{description:d(14327,null),type:"string",enum:["never","editor","panel","always"],enumDescriptions:[d(14330,null),d(14329,null),d(14331,null),d(14328,null)],default:"editor"},"terminal.integrated.enableBell":{markdownDeprecationMessage:d(14350,null),type:"boolean",default:!1},"terminal.integrated.enableVisualBell":{description:d(14359,null),type:"boolean",default:!1},"terminal.integrated.commandsToSkipShell":{markdownDescription:d(14322,null,cDt.sort().map(a=>`- ${a}`).join(`
`),`[${d(14306,null)}](command:workbench.action.openRawDefaultSettings '${d(14307,null)}')`),type:"array",items:{type:"string"},default:[]},"terminal.integrated.allowChords":{markdownDescription:d(14316,null,"`#terminal.integrated.commandsToSkipShell#`"),type:"boolean",default:!0},"terminal.integrated.allowMnemonics":{markdownDescription:d(14319,null),type:"boolean",default:!1},"terminal.integrated.env.osx":{restricted:!0,markdownDescription:d(14362,null),type:"object",additionalProperties:{type:["string","null"]},default:{}},"terminal.integrated.env.linux":{restricted:!0,markdownDescription:d(14361,null),type:"object",additionalProperties:{type:["string","null"]},default:{}},"terminal.integrated.env.windows":{restricted:!0,markdownDescription:d(14363,null),type:"object",additionalProperties:{type:["string","null"]},default:{}},"terminal.integrated.environmentChangesRelaunch":{markdownDescription:d(14364,null),type:"boolean",default:!0},"terminal.integrated.showExitAlert":{description:d(14417,null),type:"boolean",default:!0},"terminal.integrated.windowsUseConptyDll":{restricted:!0,markdownDescription:d(14453,null),type:"boolean",tags:["preview"],default:!1,experiment:{mode:"auto"}},"terminal.integrated.splitCwd":{description:d(14419,null),type:"string",enum:["workspaceRoot","initial","inherited"],enumDescriptions:[d(14422,null),d(14421,null),d(14420,null)],default:"inherited"},"terminal.integrated.wordSeparators":{markdownDescription:d(14454,null),type:"string",default:" ()[]{}',\"`\u2500\u2018\u2019\u201C\u201D|"},"terminal.integrated.enableFileLinks":{description:d(14351,null),type:"string",enum:["off","on","notRemote"],enumDescriptions:[d(14300,null),d(14301,null),d(14299,null)],default:"on"},"terminal.integrated.allowedLinkSchemes":{description:d(14317,null),type:"array",items:{type:"string"},default:["file","http","https","mailto","vscode","vscode-insiders"]},"terminal.integrated.unicodeVersion":{type:"string",enum:["6","11"],enumDescriptions:[d(14452,null),d(14451,null)],default:"11",description:d(14450,null)},"terminal.integrated.enablePersistentSessions":{description:d(14358,null),type:"boolean",default:!0},"terminal.integrated.persistentSessionReviveProcess":{markdownDescription:d(14395,null),type:"string",enum:["onExit","onExitAndWindowClose","never"],markdownEnumDescriptions:[d(14397,null),d(14398,null),d(14396,null)],default:"onExit"},"terminal.integrated.hideOnStartup":{description:d(14384,null),type:"string",enum:["never","whenEmpty","always"],markdownEnumDescriptions:[d(14303,null),d(14304,null),d(14302,null)],default:"never"},"terminal.integrated.hideOnLastClosed":{description:d(14383,null),type:"boolean",default:!0},"terminal.integrated.customGlyphs":{markdownDescription:d(14337,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(14399,null),type:"boolean",default:!0},"terminal.integrated.enableKittyKeyboardProtocol":{restricted:!0,markdownDescription:d(14353,null),type:"boolean",default:!0,tags:["advanced"]},"terminal.integrated.enableWin32InputMode":{restricted:!0,markdownDescription:d(14360,null),type:"boolean",default:!1,tags:["experimental","advanced"],experiment:{mode:"auto"}},"terminal.integrated.experimental.aiProfileGrouping":{markdownDescription:d(14365,null),type:"boolean",default:!1,tags:["experimental"],experiment:{mode:"auto"}},"terminal.integrated.shellIntegration.enabled":{restricted:!0,markdownDescription:d(14413,null,"`#terminal.integrated.shellIntegration.decorationsEnabled#`","`#editor.accessibilitySupport#`"),type:"boolean",default:!0},"terminal.integrated.shellIntegration.decorationsEnabled":{restricted:!0,markdownDescription:d(14408,null),type:"string",enum:["both","gutter","overviewRuler","never"],enumDescriptions:[d(14409,null),d(14410,null),d(14412,null),d(14411,null)],default:"both"},"terminal.integrated.shellIntegration.timeout":{restricted:!0,markdownDescription:d(14416,null,"`0`","`-1`"),type:"integer",minimum:-1,maximum:6e4,default:-1},"terminal.integrated.shellIntegration.quickFixEnabled":{restricted:!0,markdownDescription:d(14415,null),type:"boolean",default:!0},"terminal.integrated.shellIntegration.environmentReporting":{markdownDescription:d(14414,null,`\`#${ty.SuggestEnabled}#\``),type:"boolean",default:to.quality!=="stable"},"terminal.integrated.smoothScrolling":{markdownDescription:d(14418,null),type:"boolean",default:!1},"terminal.integrated.ignoreBracketedPasteMode":{markdownDescription:d(14385,null,"`\\x1b[200~`","`\\x1b[201~`"),type:"boolean",default:!1},"terminal.integrated.enableImages":{restricted:!0,markdownDescription:d(14352,null,"`#terminal.integrated.gpuAcceleration#`","`#terminal.integrated.windowsUseConptyDll#`"),type:"boolean",default:!1},"terminal.integrated.focusAfterRun":{markdownDescription:d(14367,null),enum:["terminal","accessible-buffer","none"],default:"none",tags:["accessibility"],markdownEnumDescriptions:[d(14370,null),d(14368,null),d(14369,null)]},"terminal.integrated.allowInUntrustedWorkspace":{restricted:!0,markdownDescription:d(14318,null),type:"boolean",default:!1},"terminal.integrated.developer.ptyHost.latency":{description:d(14347,null),type:"number",minimum:0,default:0,tags:["advanced"]},"terminal.integrated.developer.ptyHost.startupDelay":{description:d(14348,null),type:"number",minimum:0,default:0,tags:["advanced"]},"terminal.integrated.developer.devMode":{description:d(14346,null),type:"boolean",default:!1,tags:["advanced"]},...mJi};async function Two(a){oe.as(ii.Configuration).registerConfiguration({id:"terminal",order:100,title:d(14456,null),type:"object",properties:Cwo}),Cwo["terminal.integrated.fontFamily"].defaultSnippets=await a()}oe.as(rp.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&&!Ae(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}}]);var er={terminal:d(14489,null),new:d(14490,null),doNotShowAgain:d(14478,null),currentSessionCategory:d(14477,null),previousSessionCategory:d(14485,null),typeTask:d(14488,null),typeLocal:d(14481,null),actionCategory:L(14491,"Terminal"),focus:L(14495,"Focus Terminal"),focusInstance:L(14498,"Focus Terminal"),focusAndHideAccessibleBuffer:L(14496,"Focus Terminal and Hide Accessible Buffer"),kill:{...L(14479,"Kill Terminal"),short:d(14480,null)},moveToEditor:L(14483,"Move Terminal into Editor Area"),moveIntoNewWindow:L(14482,"Move Terminal into New Window"),newInNewWindow:L(14484,"New Terminal Window"),moveToTerminalPanel:L(14499,"Move Terminal into Panel"),changeIcon:L(14494,"Change Icon..."),changeColor:L(14493,"Change Color..."),split:{...L(14486,"Split Terminal"),short:d(14487,null)},unsplit:L(14492,"Unsplit Terminal"),rename:L(14501,"Rename..."),toggleSizeToContentWidth:L(14506,"Toggle Size to Content Width"),focusHover:L(14497,"Focus Hover"),newWithCwd:L(14500,"Create New Terminal Starting in a Custom Working Directory"),renameWithArgs:L(14502,"Rename the Currently Active Terminal"),scrollToPreviousCommand:L(14505,"Scroll to Previous Command"),scrollToNextCommand:L(14504,"Scroll to Next Command"),revealCommand:L(14503,"Reveal Command in Terminal")};var ABe=class extends C{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(14051,null),text:`$(debug-disconnect) ${d(14053,null)}`,tooltip:d(14050,null),ariaLabel:d(14052,null),command:lw.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(Y.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(!Psn(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 Psn(a){return yi(a)&&"version"in a&&Xo(a.version)&&"state"in a&&Array.isArray(a.state)}var NBe=class extends C{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&&!Ae(o.cwd)&&(o.cwd=A.revive(o.cwd));break}}this._onDidChangeProperty.fire({type:e,value:t})}async handleReplay(e){sn(`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}),sn(`code/terminal/didHandleReplay/${this.id}`),this._onProcessReplayComplete.fire()}};var gfe=class extends NBe{constructor(e,t,o,n,r){super(e,t);this._remoteTerminalChannel=o;this._remoteAgentService=n;this._logService=r;this._startBarrier=new Np}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&&Wo(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)}};gfe=I([m(3,yo),m(4,Xs)],gfe);var _wo="remoteterminal",OBe=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=cS.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,yde(T.map),G6e(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=no.getOriginalUri(this._editorService.activeEditor,{supportSideBySide:1,filterByScheme:[Y.file,Y.vscodeUserData,Y.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",[])}};OBe=I([m(2,Lv),m(3,Pe),m(4,sp),m(5,Uz),m(6,Mc),m(7,Xs),m(8,ee),m(9,ot),m(10,Vt)],OBe);function Dwo(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 Lwo(a){a&&(delete a.DEBUG,Wn&&delete a.LD_PRELOAD)}function ajt(a,i){if(i)if(ri)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&&Rwo(a,t,o)}else Object.keys(i).forEach(e=>{let t=i[e];t!==void 0&&Rwo(a,e,t)})}function Rwo(a,i,e){Ae(e)?a[i]=e:delete a[i]}function Asn(a,i,e,t){a.TERM_PROGRAM="vscode",i&&(a.TERM_PROGRAM_VERSION=i),Nsn(a,t)&&(a.LANG=Osn(e)),a.COLORTERM="truecolor"}function Mwo(a,i){if(i)for(let e of Object.keys(i)){let t=i[e];t!=null&&(a[e]=t)}}async function Pwo(a,i){return await Promise.all(Object.entries(i).map(async([e,t])=>{if(Ae(t))try{i[e]=await a(t)}catch{i[e]=t}})),i}function Nsn(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 Osn(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 Nwo(a,i,e,t,o,n){if(a.cwd){let s=typeof a.cwd=="object"?a.cwd.fsPath:a.cwd,l=await Awo(s,e);return rrt(l||s)}let r;return!a.ignoreConfigurationCwd&&o&&(e&&(o=await Awo(o,e,n)),o&&(Xl(o)?r=o:t&&(r=Ld(t.fsPath,o)))),r||(r=t?t.fsPath:i||""),rrt(r)}async function Awo(a,i,e){if(i)try{return await i(a)}catch(t){e?.error("Could not resolve terminal cwd",t);return}return a}function ljt(a,i,e){if(e)return t=>e.resolveWithEnvironment(i,a,t)}async function cjt(a,i,e,t,o,n){let r={};if(a.strictEnv)Mwo(r,a.env);else{Mwo(r,n);let s={...i};e&&(s&&await Pwo(e,s),a.env&&await Pwo(e,a.env)),it&&(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)),Dwo(r,"VSCODE_IPC_HOOK_CLI"),ajt(r,s),ajt(r,a.env),Asn(r,t,Dr,o)}return r}async function Owo(a,i,e,t,o,n,r=ri){let s;if(Ae(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=No(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"?XMi(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 XMi(s,t)}function rQ(a,i,e){let t=Ae(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 Fwo(a,i,e,t,o=ri){let n=Ae(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=Ae(a)?n:xre(a,!0),o?n:n.replaceAll("/","\\")):o?n.replaceAll("\\","/"):n}function djt(a,i,e,t){let o=a.getValue("terminal.integrated.shellIntegration.timeout"),n;if(!Xo(o)||o<0?n=i?5e3:e?3e3:2e3:n=Math.max(o,500),t!==void 0){let r=Date.now()-t;n=Math.max(0,n-r)}return n}var ffe=class{static{this.ID="remoteTerminalBackend"}constructor(i,e,t){let o=e.getConnection();if(o?.remoteAuthority){let n=i.createInstance(OBe,o.remoteAuthority,o.getChannel(_wo)),r=i.createInstance(Rst,o.remoteAuthority,n);oe.as(SV.Backend).registerTerminalBackend(r),t.didRegisterBackend(r)}}};ffe=I([m(0,F),m(1,yo),m(2,xm)],ffe);var Rst=class extends ABe{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 Go;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=>Xn(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(Ev),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=rQ(e.cwd,this._workspaceContextService,this._historyService)?.uri,v=await this._remoteTerminalChannel.createProcess(g,h,f,l,c,o,n,r),b=this._instantiationService.createInstance(gfe,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(gfe,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 En,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{sn("code/terminal/willReviveTerminalProcessesRemote"),await this._remoteTerminalChannel.reviveTerminalProcesses(e,o,Intl.DateTimeFormat().resolvedOptions().locale),sn("code/terminal/didReviveTerminalProcessesRemote"),this._storageService.remove("terminal.integrated.bufferState",1);let n=this._storageService.get("terminal.integrated.layoutInfo",1);n&&(sn("code/terminal/willSetTerminalLayoutInfoRemote"),await this._remoteTerminalChannel.setTerminalLayoutInfo(JSON.parse(n)),sn("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()}};Rst=I([m(2,yo),m(3,F),m(4,Xs),m(5,ge),m(6,le),m(7,Mc),m(8,Pe),m(9,sp),m(10,zs),m(11,B),m(12,Tr)],Rst);var sQ=class{constructor(i){this.instanceId=i.instanceId}toJSON(){return{$mid:15,instanceId:this.instanceId}}},bfe=class extends as{async runAction(i,e){if(Array.isArray(e)&&e.every(t=>t instanceof sQ)){await i.run(e?.[0],e);return}return super.runAction(i,e)}};function aQ(a,i,e,t,o,n){let r=new yn(a,i),s=Uc(t.getActions({shouldForwardArgs:!0}));n&&s.push(...n);let l=e?Yl(e).map(u=>new sQ(u)):[],c=new bfe;o.showContextMenu({actionRunner:c,getAnchor:()=>r,getActions:()=>s,getActionsContext:()=>l,onHide:()=>c.dispose()})}function Sfe(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(14229,null):d(14232,null),run(){i.store("terminal.integrated.tabs.showDetailed",(e+1)%2,-1,0)}});let r=Fsn(a,!!e);return{content:new xe(a.title+r+t,{supportThemeIcons:!0}),actions:n}}function Fsn(a,i){let e=[];if(a.processId&&a.processId>0&&e.push(d(14231,null,"PID",a.processId)+`
`),a.shellLaunchConfig.executable){let t="";if(!i&&a.shellLaunchConfig.executable.length>32){let n=No(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=Yl(a.injectedArgs||a.shellLaunchConfig.args||[]).map(n=>n.match(/\s/)?`'${n}'`:n).join(" ");o&&(t+=` ${o}`),e.push(d(14230,null,t))}return e.length?`

---

${e.join(`
`)}`:""}var FBe=class extends C{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&&(It.clearTimeout(o),this._statusTimeouts.delete(e.id)),t&&t>0){let r=It.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=Ae(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===cE.id?t=M.play:t=q.modify(e.icon,void 0),{...e,icon:t}}};FBe=I([m(0,B)],FBe);function ujt(a){switch(a){case gt.Error:return uL;case gt.Warning:return d9;default:return""}}var Vwo=_;var Noe=class extends Rl{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super("TerminalTabsList",e,{getHeight:()=>22,getTemplateId:()=>"terminal.tabs"},[c.createInstance(Mst,e,c.createInstance(Za,AP),()=>this.getSelectedElements(),()=>this.hasText,()=>this.hasActionBar)],{horizontalScrolling:!1,supportDynamicHeights:!1,selectionNavigation:!0,identityProvider:{getId:b=>b?.instanceId},accessibilityProvider:c.createInstance(Pst),smoothScrolling:n.getValue("workbench.list.smoothScrolling"),multipleSelectionSupport:!0,paddingBottom:22,dnd:c.createInstance(Ast),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=>{Ue(v),v.length=0})),this.disposables.add(Z(()=>{Ue(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=at.tabsSingularSelection.bindTo(t),this._isSplitContextKey=at.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(Nst)),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({...Sfe(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())}};Noe=I([m(1,X),m(2,fo),m(3,B),m(4,Yo),m(5,jl),m(6,sX),m(7,F),m(8,Cv),m(9,De),m(10,le),m(11,ao),m(12,tt)],Noe);var Mst=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=R(i,Vwo(".terminal-tabs-entry")),t={},o=new P,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=R(n.element,Vwo(".actions")),s=o.add(new ji(r,{actionRunner:o.add(new bfe),actionViewItemProvider:(l,c)=>l instanceof Eo?o.add(this._instantiationService.createInstance(ml,l,{hoverDelegate:c.hoverDelegate})):void 0}));return{element:e,label:n,actionBar:s,context:t,elementDisposables:new P,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=Sfe(i,this._storageService);t.context.hoverActions=l.actions;let c=this._instantiationService.invokeFunction(cX,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>gt.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=oy(i);h&&p.push(h);let g=z_(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 Dc(i,this._contextViewService,{validationOptions:{validation:c=>{let u=t.validationMessage(c);return!u||u.severity!==gt.Error?null:{content:u.content,formatContent:!0,type:3}}},ariaLabel:d(14228,null),inputBoxStyles:pl});n.element.style.height="22px",n.value=o,n.focus(),n.select({start:0,end:o.length});let r=wd((c,u)=>{n.element.style.display="none";let p=n.value;Ue(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===gt.Info?1:c.severity===gt.Warning?2:3}):n.hideMessage()}};s();let l=[n,Vo(n.inputElement,re.KEY_DOWN,c=>{c.stopPropagation(),c.equals(3)?r(n.isInputValid(),!0):c.equals(9)&&r(!1,!0)}),Vo(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 st("workbench.action.terminal.splitActiveTab",er.split.short,q.asClassName(M.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 st(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 st("workbench.action.terminal.killActiveTab",er.kill.short,q.asClassName(M.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()}};Mst=I([m(5,F),m(6,ku),m(7,Yo),m(8,jl),m(9,sX),m(10,tt),m(11,_e),m(12,fo),m(13,le),m(14,De),m(15,_n),m(16,ge)],Mst);var Pst=class{constructor(i){this._terminalGroupService=i}getWidgetAriaLabel(){return d(14226,null)}getAriaLabel(i){let e="",t=this._terminalGroupService.getGroupForInstance(i);if(t&&t.terminalInstances?.length>1){let o=t.terminalInstances.indexOf(i);e=d(14225,null,i.instanceId,i.title,o+1,t.terminalInstances.length)}else e=d(14227,null,i.instanceId,i.title);return e}};Pst=I([m(0,jl)],Pst);var Ast=class extends C{constructor(e,t,o,n){super();this._terminalService=e;this._terminalGroupService=t;this._terminalEditingService=o;this._listService=n;this._autoFocusDisposable=C.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=C.None}onDragStart(e,t){if(!t.dataTransfer)return;let o=e.getData();if(!Array.isArray(o))return;let n=o.filter(Bwo);n.length>0&&t.dataTransfer.setData("Terminals",JSON.stringify(n.map(r=>r.resource.toString())))}onDragOver(e,t,o,n,r){if(e instanceof p1&&!gu(r,Aa.FILES,Aa.RESOURCES,"Terminals",Ll.FILES))return!1;let s=this._autoFocusInstance!==t;return s&&(this._autoFocusDisposable.dispose(),this._autoFocusInstance=t),!t&&!gu(r,"Terminals")?e instanceof $y:(s&&t&&(this._autoFocusDisposable=nn(()=>{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=WWe(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=sG(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 $y)){this._handleExternalDrop(t,r);return}let p=e.getData();if(!p||!Array.isArray(p))return;s=[];for(let h of p)Bwo(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(Aa.RESOURCES);n&&(o=A.parse(JSON.parse(n)[0]));let r=t.dataTransfer.getData(Ll.FILES);!o&&r&&(o=A.file(JSON.parse(r)[0])),!o&&t.dataTransfer.files.length>0&&Ix(t.dataTransfer.files[0])&&(o=A.file(Ix(t.dataTransfer.files[0]))),o&&(this._terminalService.setActiveInstance(e),e.focus(),await e.sendPath(o,!1))}};Ast=I([m(0,Yo),m(1,jl),m(2,sX),m(3,fo)],Ast);var Nst=class extends C{constructor(e){super();this._terminalService=e;this.label=d(14224,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!==Y.vscodeTerminal)return;let t=this._terminalService.getInstanceFromResource(e);if(!t)return;let o=t?.statusList?.primary;if(o?.icon)return{color:ujt(o.severity),letter:o.icon,tooltip:o.tooltip}}};Nst=I([m(0,Yo)],Nst);function Bwo(a){return yi(a)&&"instanceId"in a}var ZNi=d(14066,null),Vsn=er.actionCategory,Js=(()=>{let a=x.or(at.processSupported,at.terminalHasBeenCreated);return{terminalAvailable:a,terminalAvailable_and_opened:x.and(a,at.isOpen),terminalAvailable_and_editorActive:x.and(a,at.terminalEditorActive),terminalAvailable_and_singularSelection:x.and(a,at.tabsSingularSelection),focusInAny_and_normalBuffer:x.and(at.focusInAny,at.altBufferActive.negate())}})();async function eOi(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(14091,null)},n=await e.executeCommand(SR,[o]);return n?Promise.resolve(n.uri):void 0}}return"";case"initial":return a.getInitialCwd();case"inherited":return a.getSpeculativeCwd()}}var VBe=class extends st{constructor(e){super("workbench.action.terminal.launchHelp",d(14067,null));this._openerService=e}async run(){this._openerService.open("https://aka.ms/vscode-troubleshoot-terminal-launch")}};VBe=I([m(0,Qe)],VBe);function Sr(a){a.f1=a.f1??!0,a.category=a.category??Vsn,a.precondition=a.precondition??at.processSupported;let i=a.run,e=a;return delete e.run,W(class extends K{constructor(){super(e)}run(t,o,n){return i(Uwo(t),t,o,n)}})}function Bsn(a){if(Array.isArray(a)){if(a.every(i=>i instanceof sQ))return a}else if(a instanceof sQ)return[a]}function pjt(a){let i=a.run;return Sr({...a,run:async(e,t,o,n)=>{let r=Hsn(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 Gl(a){let i=a.run;return Sr({...a,run:(e,t,o)=>{let n=e.service.activeInstance;if(n)return i(n,e,t,o)}})}function Mm(a){let i=a.run;return Sr({...a,run:(e,t,o)=>{let n=ht.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 Uwo(a){return{service:a.get(Yo),configService:a.get(ku),groupService:a.get(jl),instanceService:a.get(xm),editorService:a.get(xv),editingService:a.get(sX),profileService:a.get(iy),profileResolverService:a.get(Sg)}}function zwo(){Sr({id:"workbench.action.terminal.newInActiveWorkspace",title:L(14087,"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 Ife(e,i)}}}),tOi([]),Sr({id:"workbench.action.createTerminalEditor",title:L(14071,"Create New Terminal in Editor Area"),run:async(i,e,t)=>{function o(s){return yi(s)&&"location"in s}let n=o(t)?t:{location:{viewColumn:Un}};await(await i.service.createTerminal(n)).focusWhenReady()}}),Sr({id:"workbench.action.createTerminalEditorSameGroup",title:L(14071,"Create New Terminal in Editor Area"),f1:!1,run:async(i,e,t)=>{let o=e.get(Et);await(await i.service.createTerminal({location:{viewColumn:bC(o,o.activeGroup)}})).focusWhenReady()}}),Sr({id:"workbench.action.createTerminalEditorSide",title:L(14072,"Create New Terminal in Editor Area to the Side"),run:async i=>{await(await i.service.createTerminal({location:{viewColumn:vn}})).focusWhenReady()}}),Sr({id:"workbench.action.terminal.newInNewWindow",title:er.newInNewWindow,precondition:Js.terminalAvailable,keybinding:{primary:3675,mac:{primary:1883},weight:200},run:async i=>{await(await i.service.createTerminal({location:{viewColumn:hg,auxiliary:{compact:!0}}})).focusWhenReady()}}),pjt({id:"workbench.action.terminal.moveToEditor",title:er.moveToEditor,precondition:Js.terminalAvailable_and_opened,activeInstanceType:"view",run:(i,e)=>e.service.moveToEditor(i),runAfter:i=>i.at(-1)?.focus()}),pjt({id:"workbench.action.terminal.moveIntoNewWindow",title:er.moveIntoNewWindow,precondition:Js.terminalAvailable_and_opened,run:(i,e)=>e.service.moveIntoNewEditor(i),runAfter:i=>i.at(-1)?.focus()}),Sr({id:"workbench.action.terminal.moveToTerminalPanel",title:er.moveToTerminalPanel,precondition:Js.terminalAvailable_and_editorActive,run:(i,e,t)=>{let o=Gwo(t)??i.editorService.activeInstance;o&&i.service.moveToTerminalView(o)}}),Sr({id:"workbench.action.terminal.focusPreviousPane",title:L(14078,"Focus Previous Terminal in Terminal Group"),keybinding:{primary:527,secondary:[528],mac:{primary:2575,secondary:[2576]},when:x.and(at.focus,at.splitTerminalActive),weight:201},precondition:Js.terminalAvailable,run:async i=>{i.groupService.activeGroup?.focusPreviousPane(),await i.groupService.showPanel(!0)}}),Sr({id:"workbench.action.terminal.focusNextPane",title:L(14076,"Focus Next Terminal in Terminal Group"),keybinding:{primary:529,secondary:[530],mac:{primary:2577,secondary:[2578]},when:x.and(at.focus,at.splitTerminalActive),weight:201},precondition:Js.terminalAvailable,run:async i=>{i.groupService.activeGroup?.focusNextPane(),await i.groupService.showPanel(!0)}}),Sr({id:"workbench.action.terminal.resizePaneLeft",title:L(14099,"Resize Terminal Left"),keybinding:{linux:{primary:3087},mac:{primary:2319},when:at.focus,weight:200},precondition:Js.terminalAvailable,run:i=>i.groupService.activeGroup?.resizePane(0)}),Sr({id:"workbench.action.terminal.resizePaneRight",title:L(14100,"Resize Terminal Right"),keybinding:{linux:{primary:3089},mac:{primary:2321},when:at.focus,weight:200},precondition:Js.terminalAvailable,run:i=>i.groupService.activeGroup?.resizePane(1)}),Sr({id:"workbench.action.terminal.resizePaneUp",title:L(14101,"Resize Terminal Up"),keybinding:{mac:{primary:2320},when:at.focus,weight:200},precondition:Js.terminalAvailable,run:i=>i.groupService.activeGroup?.resizePane(2)}),Sr({id:"workbench.action.terminal.resizePaneDown",title:L(14098,"Resize Terminal Down"),keybinding:{mac:{primary:2322},when:at.focus,weight:200},precondition:Js.terminalAvailable,run:i=>i.groupService.activeGroup?.resizePane(3)}),Sr({id:"workbench.action.terminal.focus",title:er.focus,keybinding:{when:x.and($a,wRt,Kd.isEqualTo("terminal")),primary:2066,weight:200},precondition:Js.terminalAvailable,run:async i=>{let e=i.service.activeInstance||await i.service.createTerminal({location:1});e&&(i.service.setActiveInstance(e),await Ife(e,i))}}),Sr({id:"workbench.action.terminal.focusTabs",title:L(14074,"Focus Terminal Tabs View"),keybinding:{primary:3165,weight:200,when:x.or(at.tabsFocus,at.focus)},precondition:Js.terminalAvailable,run:i=>i.groupService.focusTabs()}),Sr({id:"workbench.action.terminal.focusNext",title:L(14075,"Focus Next Terminal Group"),precondition:Js.terminalAvailable,keybinding:{primary:2060,mac:{primary:3166},when:x.and(at.focus,at.editorFocus.negate()),weight:200},run:async i=>{i.groupService.setActiveGroupToNext(),await i.groupService.showPanel(!0)}}),Sr({id:"workbench.action.terminal.focusPrevious",title:L(14077,"Focus Previous Terminal Group"),precondition:Js.terminalAvailable,keybinding:{primary:2059,mac:{primary:3164},when:x.and(at.focus,at.editorFocus.negate()),weight:200},run:async i=>{i.groupService.setActiveGroupToPrevious(),await i.groupService.showPanel(!0)}}),Sr({id:"workbench.action.terminal.runSelectedText",title:L(14104,"Run Selected Text In Active Terminal"),run:async(i,e)=>{let o=e.get(Kt).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=ri?1:2;s=o.getModel().getValueInRange(r,l)}n.sendText(s,!0,!0),await i.service.revealActiveTerminal(!0)}}),Sr({id:"workbench.action.terminal.runActiveFile",title:L(14102,"Run Active File In Active Terminal"),precondition:Js.terminalAvailable,run:async(i,e)=>{let t=e.get(Kt),o=e.get(Ne),n=e.get(Vt),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!==Y.file&&c.scheme!==Y.vscodeUserData||l&&c.scheme!==Y.vscodeRemote){o.warn(d(14103,null));return}return await s.sendPath(c,!0),i.groupService.showPanel()}}),Mm({id:"workbench.action.terminal.scrollDown",title:L(14105,"Scroll Down (Line)"),keybinding:{primary:2572,linux:{primary:3090},when:Js.focusInAny_and_normalBuffer,weight:200},precondition:Js.terminalAvailable,run:i=>i.scrollDownLine()}),Mm({id:"workbench.action.terminal.scrollDownPage",title:L(14106,"Scroll Down (Page)"),keybinding:{primary:1036,mac:{primary:12},when:Js.focusInAny_and_normalBuffer,weight:200},precondition:Js.terminalAvailable,run:i=>i.scrollDownPage()}),Mm({id:"workbench.action.terminal.scrollToBottom",title:L(14107,"Scroll to Bottom"),keybinding:{primary:2061,linux:{primary:1037},when:Js.focusInAny_and_normalBuffer,weight:200},precondition:Js.terminalAvailable,run:i=>i.scrollToBottom()}),Mm({id:"workbench.action.terminal.scrollUp",title:L(14109,"Scroll Up (Line)"),keybinding:{primary:2571,linux:{primary:3088},when:Js.focusInAny_and_normalBuffer,weight:200},precondition:Js.terminalAvailable,run:i=>i.scrollUpLine()}),Mm({id:"workbench.action.terminal.scrollUpPage",title:L(14110,"Scroll Up (Page)"),f1:!0,keybinding:{primary:1035,mac:{primary:11},when:Js.focusInAny_and_normalBuffer,weight:200},precondition:Js.terminalAvailable,run:i=>i.scrollUpPage()}),Mm({id:"workbench.action.terminal.scrollToTop",title:L(14108,"Scroll to Top"),keybinding:{primary:2062,linux:{primary:1038},when:Js.focusInAny_and_normalBuffer,weight:200},precondition:Js.terminalAvailable,run:i=>i.scrollToTop()}),Mm({id:"workbench.action.terminal.clearSelection",title:L(14070,"Clear Selection"),keybinding:{primary:9,when:x.and(at.focusInAny,at.textSelected,at.notFindVisible),weight:200},precondition:Js.terminalAvailable,run:i=>{i.hasSelection()&&i.clearSelection()}}),Sr({id:"workbench.action.terminal.changeIcon",title:er.changeIcon,precondition:Js.terminalAvailable,run:(i,e,t)=>Ost(i,t)?.changeIcon()}),Sr({id:"workbench.action.terminal.changeIconActiveTab",title:er.changeIcon,f1:!1,precondition:Js.terminalAvailable_and_singularSelection,run:async(i,e,t)=>{let o;if(i.groupService.lastAccessedMenu==="inline-tab"){Ost(i,t)?.changeIcon();return}for(let n of WBe(e)??[])o=await n.changeIcon(o)}}),Sr({id:"workbench.action.terminal.changeColor",title:er.changeColor,precondition:Js.terminalAvailable,run:(i,e,t)=>Ost(i,t)?.changeColor()}),Sr({id:"workbench.action.terminal.changeColorActiveTab",title:er.changeColor,f1:!1,precondition:Js.terminalAvailable_and_singularSelection,run:async(i,e,t)=>{let o,n=0;if(i.groupService.lastAccessedMenu==="inline-tab"){Ost(i,t)?.changeColor();return}for(let r of WBe(e)??[]){let s=n!==0;o=await r.changeColor(o,s),n++}}}),Sr({id:"workbench.action.terminal.rename",title:er.rename,precondition:Js.terminalAvailable,run:(i,e,t)=>Hwo(i,e,t)}),Sr({id:"workbench.action.terminal.renameActiveTab",title:er.rename,f1:!1,keybinding:{primary:60,mac:{primary:3},when:x.and(at.tabsFocus),weight:200},precondition:Js.terminalAvailable_and_singularSelection,run:async(i,e)=>{let t=e.get(jl),o=e.get(Ne),n=WBe(e),r=n?.[0];if(r){if(t.lastAccessedMenu==="inline-tab")return Hwo(i,e,r);i.editingService.setEditingTerminal(r),i.editingService.setEditable(r,{validationMessage:s=>Usn(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)}}}})}}}),Gl({id:"workbench.action.terminal.detachSession",title:L(14073,"Detach Session"),run:i=>i.detachProcessAndDispose(3)}),Sr({id:"workbench.action.terminal.attachToSession",title:L(14068,"Attach to Session"),run:async(i,e)=>{let t=e.get(Ge),o=e.get(ot),n=e.get(yo),r=e.get(Ne),s=n.getConnection()?.remoteAuthority??void 0,l=await e.get(xm).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(14065,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 Ife(g,i)}}}),Gl({id:"workbench.action.terminal.scrollToPreviousCommand",title:er.scrollToPreviousCommand,keybinding:{primary:2064,when:x.and(at.focus,$a.negate()),weight:200},precondition:Js.terminalAvailable,icon:M.arrowUp,menu:[{id:D.ViewTitle,group:"navigation",order:4,when:x.equals("view",dc),isHiddenByDefault:!0},...[D.EditorTitle,D.CompactWindowEditorTitle].map(i=>({id:i,group:"1_shellIntegration",order:4,when:Fo.Scheme.isEqualTo(Y.vscodeTerminal),isHiddenByDefault:!0}))],run:i=>i.xterm?.markTracker.scrollToPreviousMark(void 0,void 0,i.capabilities.has(2))}),Gl({id:"workbench.action.terminal.scrollToNextCommand",title:er.scrollToNextCommand,keybinding:{primary:2066,when:x.and(at.focus,$a.negate()),weight:200},precondition:Js.terminalAvailable,icon:M.arrowDown,menu:[{id:D.ViewTitle,group:"navigation",order:5,when:x.equals("view",dc),isHiddenByDefault:!0},...[D.EditorTitle,D.CompactWindowEditorTitle].map(i=>({id:i,group:"1_shellIntegration",order:5,when:Fo.Scheme.isEqualTo(Y.vscodeTerminal),isHiddenByDefault:!0}))],run:i=>{i.xterm?.markTracker.scrollToNextMark(),i.focus()}}),Gl({id:"workbench.action.terminal.selectToPreviousCommand",title:L(14115,"Select to Previous Command"),keybinding:{primary:3088,when:at.focus,weight:200},precondition:Js.terminalAvailable,run:i=>{i.xterm?.markTracker.selectToPreviousMark(),i.focus()}}),Gl({id:"workbench.action.terminal.selectToNextCommand",title:L(14113,"Select to Next Command"),keybinding:{primary:3090,when:at.focus,weight:200},precondition:Js.terminalAvailable,run:i=>{i.xterm?.markTracker.selectToNextMark(),i.focus()}}),Mm({id:"workbench.action.terminal.selectToPreviousLine",title:L(14116,"Select to Previous Line"),precondition:Js.terminalAvailable,run:async(i,e,t)=>{i.markTracker.selectToPreviousLine(),(t||i).focus()}}),Mm({id:"workbench.action.terminal.selectToNextLine",title:L(14114,"Select to Next Line"),precondition:Js.terminalAvailable,run:async(i,e,t)=>{i.markTracker.selectToNextLine(),(t||i).focus()}}),Sr({id:"workbench.action.terminal.newWithCwd",title:er.newWithCwd,metadata:{description:er.newWithCwd.value,args:[{name:"args",schema:{type:"object",required:["cwd"],properties:{cwd:{description:d(14088,null),type:"string"}}}}]},run:async(i,e,t)=>{let o=t?JNi(t.cwd):void 0,n=await i.service.createTerminal({cwd:o});n&&(i.service.setActiveInstance(n),await Ife(n,i))}}),Gl({id:"workbench.action.terminal.renameWithArg",title:er.renameWithArgs,metadata:{description:er.renameWithArgs.value,args:[{name:"args",schema:{type:"object",required:["name"],properties:{name:{description:d(14096,null),type:"string",minLength:1}}}}]},precondition:Js.terminalAvailable,f1:!1,run:async(i,e,t,o)=>{let n=t.get(Ne),r=o?JNi(o.name):void 0;if(!r){n.warn(d(14097,null));return}i.rename(r)}}),Gl({id:"workbench.action.terminal.relaunch",title:L(14094,"Relaunch Active Terminal"),run:i=>i.relaunch()}),Sr({id:"workbench.action.terminal.split",title:er.split,precondition:x.or(at.processSupported,at.webExtensionContributedProfile),keybinding:{primary:3098,weight:200,mac:{primary:2141,secondary:[1306]},when:at.focus},icon:M.splitHorizontal,run:async(i,e,t)=>{let o=yi(t)?t:void 0,n=e.get(ge),r=e.get(Pe),s=Kwo(o),l=(await i.service.getInstanceHost(s?.location)).activeInstance;if(!l)return;let c=await eOi(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 Ife(u,i)}}),Sr({id:"workbench.action.terminal.splitActiveTab",title:er.split,f1:!1,keybinding:{primary:3098,mac:{primary:2141,secondary:[1306]},weight:200,when:at.tabsFocus},run:async(i,e)=>{let t=WBe(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)}}}),pjt({id:"workbench.action.terminal.unsplit",title:er.unsplit,precondition:Js.terminalAvailable,run:async(i,e)=>{let t=e.groupService.getGroupForInstance(i);t&&t?.terminalInstances.length>1&&e.groupService.unsplitInstance(i)}}),Sr({id:"workbench.action.terminal.joinActiveTab",title:L(14082,"Join Terminals"),precondition:x.and(Js.terminalAvailable,at.tabsSingularSelection.toNegated()),run:async(i,e)=>{let t=WBe(e);t&&t.length>1&&i.groupService.joinInstances(t)}}),Sr({id:"workbench.action.terminal.join",title:L(14079,"Join Terminals..."),precondition:Js.terminalAvailable,run:async(i,e)=>{let t=e.get(De),o=e.get(Ne),n=e.get(Ge),r=[];if(i.groupService.instances.length<=1){o.warn(d(14080,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=`$(${cX(e,c)}): ${c.title}`,g=[],f=oy(c);f&&g.push(f);let v=z_(c,t.getColorTheme().type);v&&g.push(...v),r.push({terminal:c,label:h,iconClasses:g})}if(r.length===0){o.warn(d(14081,null));return}let l=await n.pick(r,{});l&&i.groupService.joinInstances([l.terminal,i.groupService.activeInstance])}}),Gl({id:"workbench.action.terminal.splitInActiveWorkspace",title:L(14118,"Split Terminal (In Active Workspace)"),run:async(i,e)=>{(await e.service.createTerminal({location:{parentTerminal:i}}))?.target!==2&&await e.groupService.showPanel(!0)}}),Mm({id:"workbench.action.terminal.selectAll",title:L(14111,"Select All"),precondition:Js.terminalAvailable,keybinding:[{primary:0,mac:{primary:2079},weight:200,when:at.focusInAny}],run:i=>i.selectAll()}),Sr({id:"workbench.action.terminal.new",title:L(14086,"Create New Terminal"),precondition:x.or(at.processSupported,at.webExtensionContributedProfile),icon:zpo,keybinding:{primary:3163,mac:{primary:1371},weight:200},run:async(i,e,t)=>{let o=yi(t)?t:void 0,n=e.get(Pe),r=e.get(ge),s=e.get(Et),l=n.getWorkspace().folders;if(o&&Vp(o)&&(o.altKey||o.ctrlKey)){await i.service.createTerminal({location:{splitActiveTerminal:!0}});return}if(i.service.isProcessSupportRegistered){o=!o||Vp(o)?{}:o,Cy(Ki())&&!o.location&&(o.location={viewColumn:bC(s,s.activeGroup)});let c;if(l.length<=1)c=await i.service.createTerminal(o);else{let u=(await Ksn(e))?.cwd;if(!u)return;o.cwd=u,c=await i.service.createTerminal(o)}i.service.setActiveInstance(c),await Ife(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))}Sr({id:"workbench.action.terminal.kill",title:L(14083,"Kill the Active Terminal Instance"),precondition:x.or(Js.terminalAvailable,at.isOpen),icon:GHt,run:async i=>a(i,i.groupService.activeInstance)}),Sr({id:"workbench.action.terminal.killViewOrEditor",title:er.kill,f1:!1,precondition:x.or(Js.terminalAvailable,at.isOpen),run:async i=>a(i,i.service.activeInstance)}),Sr({id:"workbench.action.terminal.killAll",title:L(14084,"Kill All Terminals"),precondition:x.or(Js.terminalAvailable,at.isOpen),icon:M.trash,run:async i=>{let e=[];for(let t of i.service.instances)e.push(i.service.safeDisposeTerminal(t));await Promise.all(e)}}),Sr({id:"workbench.action.terminal.killEditor",title:L(14085,"Kill the Active Terminal in Editor Area"),precondition:Js.terminalAvailable,keybinding:{primary:2101,win:{primary:2110,secondary:[2101]},weight:200,when:x.and(at.focus,at.editorFocus)},run:(i,e)=>e.get(ge).executeCommand(OC)}),Sr({id:"workbench.action.terminal.killActiveTab",title:er.kill,f1:!1,precondition:x.or(Js.terminalAvailable,at.isOpen),keybinding:{primary:20,mac:{primary:2049,secondary:[20]},weight:200,when:at.tabsFocus},run:async(i,e)=>{let t=[];for(let o of WBe(e,!0)??[])t.push(i.service.safeDisposeTerminal(o));await Promise.all(t),i.groupService.focusTabs()}}),Sr({id:"workbench.action.terminal.focusHover",title:er.focusHover,precondition:x.or(Js.terminalAvailable,at.isOpen),keybinding:{primary:Ai(2089,2087),weight:200,when:x.or(at.tabsFocus,at.focus)},run:i=>i.groupService.focusHover()}),Gl({id:"workbench.action.terminal.clear",title:L(14069,"Clear"),precondition:Js.terminalAvailable,keybinding:[{primary:0,mac:{primary:2089},weight:201,when:x.or(x.and(at.focus,$a.negate()),x.and($a,ud,Kd.isEqualTo("terminal")))}],run:i=>i.clearBuffer()}),Sr({id:"workbench.action.terminal.selectDefaultShell",title:L(14112,"Select Default Profile"),run:i=>i.service.showProfileQuickPick("setDefault")}),Sr({id:"workbench.action.terminal.openSettings",title:L(14092,"Configure Terminal Settings"),precondition:Js.terminalAvailable,run:(i,e)=>e.get(Po).openSettings({jsonEditor:!1,query:"@feature:terminal"})}),Gl({id:"workbench.action.terminal.setDimensions",title:L(14117,"Set Fixed Dimensions"),precondition:Js.terminalAvailable_and_opened,run:i=>i.setFixedDimensions()}),pjt({id:"workbench.action.terminal.sizeToContentWidth",title:er.toggleSizeToContentWidth,precondition:Js.terminalAvailable_and_opened,keybinding:{primary:568,weight:200,when:at.focus},run:i=>i.toggleSizeToContentWidth()}),Sr({id:"workbench.action.terminal.switchTerminal",title:L(14119,"Switch Terminal"),precondition:Js.terminalAvailable,run:async(i,e,t)=>{let o=JNi(t);if(!o)return;if(o===jN.text){i.service.refreshActiveGroup();return}if(o===ZNi){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 Hsn(a,i){let e=a.get(Yo),t=[],o=Bsn(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 WBe(a,i,e){let t=a.get(fo),o=a.get(jl),n=[],r=t.lastFocusedList instanceof Noe?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 Usn(a){return!a||a.trim().length===0?{content:d(14061,null),severity:St.Info}:null}function zsn(a){return yi(a)&&"profileName"in a}function Kwo(a){return zsn(a)?{config:a,location:a.location}:a}var XNi;function tOi(a){let i=sDt(a);return XNi?.dispose(),XNi=W(class extends K{constructor(){super({id:"workbench.action.terminal.newWithProfile",title:L(14089,"Create New Terminal (With Profile)"),f1:!0,precondition:x.or(at.processSupported,at.webExtensionContributedProfile),metadata:{description:"workbench.action.terminal.newWithProfile",args:[{name:"args",schema:{type:"object",required:["profileName"],properties:{profileName:{description:d(14090,null),type:"string",enum:i.values,markdownEnumDescriptions:i.markdownDescriptions},location:{description:d(14062,null),type:"string",enum:["view","editor"],enumDescriptions:[d(14064,null),d(14063,null)]}}}}]}})}async run(e,t,o){let n=Uwo(e),r=e.get(Pe),s=e.get(ge),l,c,u,p;if(yi(t)&&t&&Wo(t,{profileName:!0})){let f=function(v){return yi(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 Vp(t)||Jpt(t)||ag(t)?(l=t,c=o?{config:o}:void 0):c=Kwo(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(14091,null)},f=await s.executeCommand(SR,[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 Ife(u,n))}}),XNi}function Ost(a,i){return a.service.getInstanceFromResource(Gwo(i))||a.service.activeInstance}async function Ksn(a,i){let e=a.get(Ge),t=a.get(ot),o=a.get(Pe),n=a.get(Ct),r=a.get(kt),s=a.get(B),l=a.get(sp),c=o.getWorkspace().folders;if(!c.length)return;let u=await Promise.all(c.map(b=>Gsn(b,s,l))),p=$sn(u);if(p.length===1)return p[0];let h=p.map(b=>{let S=b.folder.name,y=b.isOverridden?d(14093,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:js(n,r,b.cwd,2)}}),g={placeHolder:d(14091,null),matchOnDescription:!0,canPickMany:!1},f=i||ve.None;return(await e.pick(h,g,f))?.pair}async function Gsn(a,i,e){let t=i.getValue("terminal.integrated.cwd",{resource:a.uri});if(!Ae(t)||t.length===0)return{folder:a,cwd:a.uri,isAbsolute:!1,isOverridden:!1};let o=await e.resolveAsync(a,t);return Xl(o)||o.startsWith(cS.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 $sn(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 Ife(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 Hwo(a,i,e){let t=e;if((!t||!t?.rename)&&(t=Ost(a,e)),t){let o=await i.get(Ge).input({value:t.title,prompt:d(14095,null)});o&&t.rename(o)}}function Gwo(a){return A.isUri(a)?a:void 0}function JNi(a){return Ae(a)?a:void 0}function $wo(){qsn()}function qsn(){for(let a=0;a<9;a++){let i=a,e=a+1;yt.registerCommandAndKeybindingRule({id:`workbench.action.terminal.focusAtIndex${e}`,weight:200,when:void 0,primary:0,handler:t=>(t.get(jl).setActiveInstanceByIndex(i),t.get(jl).showPanel(!0))})}}var BBe=class extends C{constructor(e){super();this._configurationService=e;this._onConfigChanged=this._register(new E);this._fontMetrics=this._register(new iOi(this,this._configurationService)),this._register(H.runAndSubscribe(this._configurationService.onDidChangeConfiguration,t=>{(!t||t.affectsConfiguration(Ev))&&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(Ev)};e.fontWeight=this._normalizeFontWeight(e.fontWeight,fJi),e.fontWeightBold=this._normalizeFontWeight(e.fontWeightBold,vJi),this._config=e,this._onConfigChanged.fire()}_normalizeFontWeight(e,t){return e==="normal"||e==="bold"?e:oOi(e,JQe,ZQe,t)}};BBe=I([m(0,B)],BBe);var iOi=class extends C{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||Yd.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||Yd.fontFamily||"monospace",s=oOi(this._terminalConfigurationService.config.fontSize,6,100,Yd.fontSize);this._terminalConfigurationService.config.fontFamily||(this.linuxDistro===2&&(r="'DejaVu Sans Mono'"),this.linuxDistro===3&&(r="'Ubuntu Mono'",s=oOi(s+2,6,100,Yd.fontSize))),r+=", monospace",it&&(r+=", AppleBraille");let l=this._terminalConfigurationService.config.letterSpacing?Math.max(Math.floor(this._terminalConfigurationService.config.letterSpacing),gJi):aDt,c=this._terminalConfigurationService.config.lineHeight?Math.max(this._terminalConfigurationService.config.lineHeight,1):lDt;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 oOi(a,i,e,t){if(a==null)return t;let o=Ae(a)?parseInt(a,10):a;return isNaN(o)?t:Kn(o,i,e)}function Qwo(){fe.appendMenuItems([{id:D.MenubarTerminalMenu,item:{group:"1_create",command:{id:"workbench.action.terminal.new",title:d(14169,null)},order:1}},{id:D.MenubarTerminalMenu,item:{group:"1_create",command:{id:"workbench.action.terminal.newInNewWindow",title:d(14168,null),precondition:x.has("terminalIsOpen")},order:2,when:at.processSupported}},{id:D.MenubarTerminalMenu,item:{group:"1_create",command:{id:"workbench.action.terminal.split",title:d(14172,null),precondition:x.has("terminalIsOpen")},order:2,when:at.processSupported}},{id:D.MenubarTerminalMenu,item:{group:"3_run",command:{id:"workbench.action.terminal.runActiveFile",title:d(14170,null)},order:3,when:at.processSupported}},{id:D.MenubarTerminalMenu,item:{group:"3_run",command:{id:"workbench.action.terminal.runSelectedText",title:d(14171,null)},order:4,when:at.processSupported}}]),fe.appendMenuItems([{id:D.TerminalInstanceContext,item:{command:{id:"workbench.action.terminal.killViewOrEditor",title:er.kill.value},group:"7_kill"}},{id:D.TerminalInstanceContext,item:{command:{id:"workbench.action.terminal.copySelection",title:d(14180,null)},group:"3_edit",order:1}},{id:D.TerminalInstanceContext,item:{command:{id:"workbench.action.terminal.copySelectionAsHtml",title:d(14181,null)},group:"3_edit",order:2}},{id:D.TerminalInstanceContext,item:{command:{id:"workbench.action.terminal.paste",title:d(14185,null)},group:"3_edit",order:3}},{id:D.TerminalInstanceContext,item:{command:{id:"workbench.action.terminal.clear",title:d(14178,null)},group:"5_clear"}},{id:D.TerminalInstanceContext,item:{command:{id:"workbench.action.terminal.sizeToContentWidth",title:er.toggleSizeToContentWidth},group:"9_config"}},{id:D.TerminalInstanceContext,item:{command:{id:"workbench.action.terminal.selectAll",title:d(14189,null)},group:"3_edit",order:3}}]),fe.appendMenuItem(D.EditorTabsBarContext,{command:{id:"workbench.action.createTerminalEditorSameGroup",title:er.new},group:"1_zzz_file",order:30,when:at.processSupported}),fe.appendMenuItem(D.EmptyEditorGroupContext,{command:{id:"workbench.action.createTerminalEditorSameGroup",title:er.new},group:"1_zzz_file",order:30,when:at.processSupported}),fe.appendMenuItems([{id:D.TerminalEditorInstanceContext,item:{group:"1_create",command:{id:"workbench.action.terminal.split",title:er.split.value}}},{id:D.TerminalEditorInstanceContext,item:{command:{id:"workbench.action.terminal.new",title:er.new},group:"1_create"}},{id:D.TerminalEditorInstanceContext,item:{command:{id:"workbench.action.terminal.killEditor",title:er.kill.value},group:"7_kill"}},{id:D.TerminalEditorInstanceContext,item:{command:{id:"workbench.action.terminal.copySelection",title:d(14180,null)},group:"3_edit",order:1}},{id:D.TerminalEditorInstanceContext,item:{command:{id:"workbench.action.terminal.copySelectionAsHtml",title:d(14181,null)},group:"3_edit",order:2}},{id:D.TerminalEditorInstanceContext,item:{command:{id:"workbench.action.terminal.paste",title:d(14185,null)},group:"3_edit",order:3}},{id:D.TerminalEditorInstanceContext,item:{command:{id:"workbench.action.terminal.clear",title:d(14178,null)},group:"5_clear"}},{id:D.TerminalEditorInstanceContext,item:{command:{id:"workbench.action.terminal.selectAll",title:d(14189,null)},group:"3_edit",order:3}},{id:D.TerminalEditorInstanceContext,item:{command:{id:"workbench.action.terminal.sizeToContentWidth",title:er.toggleSizeToContentWidth},group:"9_config"}}]),fe.appendMenuItems([{id:D.TerminalTabEmptyAreaContext,item:{command:{id:"workbench.action.terminal.newWithProfile",title:d(14183,null)},group:"1_create"}},{id:D.TerminalTabEmptyAreaContext,item:{command:{id:"workbench.action.terminal.new",title:er.new},group:"1_create"}}]),fe.appendMenuItems([{id:D.TerminalNewDropdownContext,item:{command:{id:"workbench.action.terminal.selectDefaultShell",title:L(14190,"Select Default Profile")},group:"3_configure"}},{id:D.TerminalNewDropdownContext,item:{command:{id:"workbench.action.terminal.openSettings",title:d(14184,null)},group:"3_configure"}},{id:D.TerminalNewDropdownContext,item:{command:{id:"workbench.action.tasks.runTask",title:d(14175,null)},when:Sh,group:"4_tasks",order:1}},{id:D.TerminalNewDropdownContext,item:{command:{id:"workbench.action.tasks.configureTaskRunner",title:d(14174,null)},when:Sh,group:"4_tasks",order:2}}]),fe.appendMenuItems([{id:D.ViewTitle,item:{command:{id:"workbench.action.terminal.switchTerminal",title:L(14195,"Switch Terminal")},group:"navigation",order:0,when:x.and(x.equals("view",dc),x.not("config.terminal.integrated.tabs.enabled"))}},{id:D.ViewTitle,item:{command:{id:"workbench.action.terminal.focus",title:er.focus},alt:{id:"workbench.action.terminal.split",title:er.split.value,icon:M.splitHorizontal},group:"navigation",order:0,when:x.and(x.not(ide.ChatHasHiddenTerminals),x.equals("view",dc),x.has("config.terminal.integrated.tabs.enabled"),x.or(x.and(x.equals("config.terminal.integrated.tabs.showActiveTerminal","singleTerminal"),x.equals("terminalGroupCount",1)),x.and(x.equals("config.terminal.integrated.tabs.showActiveTerminal","singleTerminalOrNarrow"),x.or(x.equals("terminalGroupCount",1),x.has("isTerminalTabsNarrow"))),x.and(x.equals("config.terminal.integrated.tabs.showActiveTerminal","singleGroup"),x.equals("terminalGroupCount",1)),x.equals("config.terminal.integrated.tabs.showActiveTerminal","always")))}},{id:D.ViewTitle,item:{command:{id:"workbench.action.terminal.split",title:er.split,icon:M.splitHorizontal},group:"navigation",order:2,when:at.shouldShowViewInlineActions}},{id:D.ViewTitle,item:{command:{id:"workbench.action.terminal.kill",title:er.kill,icon:M.trash},group:"navigation",order:3,when:at.shouldShowViewInlineActions}},{id:D.ViewTitle,item:{command:{id:"workbench.action.terminal.new",title:er.new,icon:M.plus},alt:{id:"workbench.action.terminal.split",title:er.split.value,icon:M.splitHorizontal},group:"navigation",order:0,when:x.and(x.equals("view",dc),x.or(at.webExtensionContributedProfile,at.processSupported))}},{id:D.ViewTitle,item:{command:{id:"workbench.action.terminal.clear",title:d(14179,null),icon:M.clearAll},group:"navigation",order:6,when:x.equals("view",dc),isHiddenByDefault:!0}},{id:D.ViewTitle,item:{command:{id:"workbench.action.terminal.runActiveFile",title:d(14187,null),icon:M.run},group:"navigation",order:7,when:x.equals("view",dc),isHiddenByDefault:!0}},{id:D.ViewTitle,item:{command:{id:"workbench.action.terminal.runSelectedText",title:d(14188,null),icon:M.selection},group:"navigation",order:8,when:x.equals("view",dc),isHiddenByDefault:!0}},{id:D.ViewTitle,item:{command:{id:"workbench.action.terminal.startVoice",title:d(14191,null)},group:"navigation",order:9,when:x.and(x.equals("view",dc),at.terminalDictationInProgress.toNegated()),isHiddenByDefault:!0}},{id:D.ViewTitle,item:{command:{id:"workbench.action.terminal.stopVoice",title:d(14193,null)},group:"navigation",order:9,when:x.and(x.equals("view",dc),at.terminalDictationInProgress),isHiddenByDefault:!0}}]),fe.appendMenuItems([{id:D.TerminalTabContext,item:{command:{id:"workbench.action.terminal.splitActiveTab",title:er.split.value},group:"1_create",order:1}},{id:D.TerminalTabContext,item:{command:{id:"workbench.action.terminal.moveToEditor",title:er.moveToEditor.value},group:"1_create",order:2}},{id:D.TerminalTabContext,item:{command:{id:"workbench.action.terminal.moveIntoNewWindow",title:er.moveIntoNewWindow.value},group:"1_create",order:2}},{id:D.TerminalTabContext,item:{command:{id:"workbench.action.terminal.renameActiveTab",title:d(14186,null)},group:"3_edit"}},{id:D.TerminalTabContext,item:{command:{id:"workbench.action.terminal.changeIconActiveTab",title:d(14177,null)},group:"3_edit"}},{id:D.TerminalTabContext,item:{command:{id:"workbench.action.terminal.changeColorActiveTab",title:d(14176,null)},group:"3_edit"}},{id:D.TerminalTabContext,item:{command:{id:"workbench.action.terminal.sizeToContentWidth",title:er.toggleSizeToContentWidth},group:"3_edit"}},{id:D.TerminalTabContext,item:{command:{id:"workbench.action.terminal.joinActiveTab",title:d(14182,null)},when:at.tabsSingularSelection.toNegated(),group:"9_config"}},{id:D.TerminalTabContext,item:{command:{id:"workbench.action.terminal.unsplit",title:er.unsplit.value},when:x.and(at.tabsSingularSelection,at.splitTerminalTabFocused),group:"9_config"}},{id:D.TerminalTabContext,item:{command:{id:"workbench.action.terminal.killActiveTab",title:er.kill.value},group:"7_kill"}}]),fe.appendMenuItem(D.EditorTitleContext,{command:{id:"workbench.action.terminal.moveToTerminalPanel",title:er.moveToTerminalPanel},when:Fo.Scheme.isEqualTo(Y.vscodeTerminal),group:"2_files"}),fe.appendMenuItem(D.EditorTitleContext,{command:{id:"workbench.action.terminal.rename",title:er.rename},when:Fo.Scheme.isEqualTo(Y.vscodeTerminal),group:"2_files"}),fe.appendMenuItem(D.EditorTitleContext,{command:{id:"workbench.action.terminal.changeColor",title:er.changeColor},when:Fo.Scheme.isEqualTo(Y.vscodeTerminal),group:"2_files"}),fe.appendMenuItem(D.EditorTitleContext,{command:{id:"workbench.action.terminal.changeIcon",title:er.changeIcon},when:Fo.Scheme.isEqualTo(Y.vscodeTerminal),group:"2_files"}),fe.appendMenuItem(D.EditorTitleContext,{command:{id:"workbench.action.terminal.sizeToContentWidth",title:er.toggleSizeToContentWidth},when:Fo.Scheme.isEqualTo(Y.vscodeTerminal),group:"2_files"});for(let a of[D.EditorTitle,D.CompactWindowEditorTitle])fe.appendMenuItem(a,{command:{id:"workbench.action.createTerminalEditorSameGroup",title:er.new,icon:M.plus},alt:{id:"workbench.action.terminal.split",title:er.split.value,icon:M.splitHorizontal},group:"navigation",order:0,when:Fo.Scheme.isEqualTo(Y.vscodeTerminal)}),fe.appendMenuItem(a,{command:{id:"workbench.action.terminal.clear",title:d(14179,null),icon:M.clearAll},group:"navigation",order:6,when:Fo.Scheme.isEqualTo(Y.vscodeTerminal),isHiddenByDefault:!0}),fe.appendMenuItem(a,{command:{id:"workbench.action.terminal.runActiveFile",title:d(14187,null),icon:M.run},group:"navigation",order:7,when:Fo.Scheme.isEqualTo(Y.vscodeTerminal),isHiddenByDefault:!0}),fe.appendMenuItem(a,{command:{id:"workbench.action.terminal.runSelectedText",title:d(14188,null),icon:M.selection},group:"navigation",order:8,when:Fo.Scheme.isEqualTo(Y.vscodeTerminal),isHiddenByDefault:!0}),fe.appendMenuItem(a,{command:{id:"workbench.action.terminal.startVoice",title:d(14192,null),icon:M.mic},group:"navigation",order:9,when:x.and(Fo.Scheme.isEqualTo(Y.vscodeTerminal),at.terminalDictationInProgress.negate()),isHiddenByDefault:!0}),fe.appendMenuItem(a,{command:{id:"workbench.action.terminal.stopVoice",title:d(14194,null),icon:M.run},group:"navigation",order:10,when:x.and(Fo.Scheme.isEqualTo(Y.vscodeTerminal),TV,at.terminalDictationInProgress),isHiddenByDefault:!0})}function yfe(a,i,e,t,o,n,r,s){let l=s.getValue("terminal.integrated.experimental.aiProfileGrouping");i=i.filter(y=>!y.isAutoDetected);let[c,u]=l?Qsn(i):[[],i],[p,h]=l?Ysn(t):[[],t],g=[],f=[],v=a===2||typeof a=="object"&&Wo(a,{viewColumn:!0})&&a.viewColumn===Un?{viewColumn:vn}:{splitActiveTerminal:!0};a===2&&(a={viewColumn:Un}),g.push(r.add(new st("workbench.action.terminal.new",er.new,void 0,!0,()=>o.createAndFocusTerminal()))),g.push(r.add(new st("workbench.action.terminal.newInNewWindow",er.newInNewWindow.value,void 0,!0,()=>o.createAndFocusTerminal({location:{viewColumn:hg,auxiliary:{compact:!0}}})))),g.push(r.add(new st("workbench.action.terminal.split",er.split.value,void 0,!0,()=>o.createAndFocusTerminal({location:v})))),g.push(new li);for(let y of c)qwo(y,e,a,v,o,g,f,r);for(let y of p)jwo(y,e,a,v,o,g,f,r);(c.length>0||p.length>0)&&(u.length>0||h.length>0)&&g.push(new li);for(let y of u)qwo(y,e,a,v,o,g,f,r);for(let y of h)jwo(y,e,a,v,o,g,f,r);g.length>0&&(g.push(new $l("split.profile",d(14173,null),f)),g.push(new li));let b=n.getActions();return g.push(...li.join(...b.map(y=>y[1]))),{dropdownAction:r.add(new st("refresh profiles",d(14167,null),"codicon-chevron-down",!0)),dropdownMenuActions:g,className:`terminal-tab-actions-${o.resolveLocation(a)}`}}function Qsn(a){let i=[],e=[];for(let t of a)Ywo(t.profileName)?i.push(t):e.push(t);return[i,e]}function Ysn(a){let i=[],e=[];for(let t of a)Xsn(t)?i.push(t):e.push(t);return[i,e]}function Xsn(a){let i=a.extensionIdentifier.toLowerCase();return i==="github.copilot-chat"||i==="anthropic.claude-code"?!0:Ywo(a.title)}function Ywo(a){let i=a.toLowerCase();return i.includes("copilot")||i.includes("claude")}function qwo(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 st("workbench.action.terminal.newWithProfile",l?d(14166,null,p):p,void 0,!0,async()=>{await o.createAndFocusTerminal(c)}))),r.push(s.add(new st("workbench.action.terminal.split",l?d(14166,null,p):p,void 0,!0,async()=>{await o.createAndFocusTerminal(u)})))}function jwo(a,i,e,t,o,n,r,s){let c=a.title===i?d(14166,null,a.title.replace(/[\n\r\t]/g,"")):a.title.replace(/[\n\r\t]/g,"");n.push(s.add(new st("contributed",c,void 0,!0,()=>o.createAndFocusTerminal({config:{extensionIdentifier:a.extensionIdentifier,id:a.id,title:c},location:e})))),r.push(s.add(new st("contributed-split",c,void 0,!0,()=>o.createAndFocusTerminal({config:{extensionIdentifier:a.extensionIdentifier,id:a.id,title:c},location:t}))))}var HBe=class extends pa{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super(Mz,e,t,o,n);this._terminalEditorService=r;this._terminalProfileResolverService=s;this._terminalService=l;this._terminalConfigurationService=c;this._configurationService=u;this._instantiationService=g;this._contextMenuService=f;this._terminalProfileService=v;this._workbenchLayoutService=b;this._editorInput=void 0;this._cancelContextMenu=!1;this._newDropdown=this._register(new me);this._sessionDisposables=this._register(new P);this._disposableStore=this._register(new P);this._dropdownMenu=this._register(h.createMenu(D.TerminalNewDropdownContext,p)),this._instanceMenu=this._register(h.createMenu(D.TerminalInstanceContext,p)),this._register(this._terminalProfileService.onDidChangeAvailableProfiles(S=>this._updateTabActionBar(S)))}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||aQ(this.window,e,this._editorInput?.terminalInstance,this._instanceMenu,this._contextMenuService),e.preventDefault(),e.stopImmediatePropagation(),this._cancelContextMenu=!1)})))}_updateTabActionBar(e){this._disposableStore.clear();let t=yfe(2,e,this._getDefaultProfileName(),this._terminalProfileService.contributedProfiles,this._terminalService,this._dropdownMenu,this._disposableStore,this._configurationService);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 Eo){let o={viewColumn:Un};this._disposableStore.clear();let n=yfe(o,this._terminalProfileService.availableProfiles,this._getDefaultProfileName(),this._terminalProfileService.contributedProfiles,this._terminalService,this._dropdownMenu,this._disposableStore,this._configurationService);return this._newDropdown.value=this._instantiationService.createInstance(dI,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}};HBe=I([m(1,Te),m(2,De),m(3,le),m(4,xv),m(5,Sg),m(6,Yo),m(7,ku),m(8,B),m(9,X),m(10,qt),m(11,F),m(12,ze),m(13,iy),m(14,fi)],HBe);var UBe=class{constructor(i){this._terminalEditorService=i}canSerialize(i){return Xo(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(!Jsn(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}}};UBe=I([m(0,xv)],UBe);function Jsn(a){return yi(a)&&"id"in a&&"pid"in a}var zBe=class extends C{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=at.terminalEditorActive.bindTo(s),this._register(Z(()=>{for(let l of this._instanceDisposables.values())Ue(l)})),this._register(r.onWillShutdown(()=>this._isShuttingDown=!0)),this._register(this._editorService.onDidActiveEditorChange(()=>{let l=this._editorService.activeEditor,c=l instanceof ef?l?.terminalInstance:void 0,u=!!c&&l instanceof ef;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 ef?p.terminalInstance?.instanceId:void 0;return h===void 0?!1:!l.includes(h)});u instanceof ef&&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 ef?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 ef&&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??Un)},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(ef,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&&Ue(n),this._onDidChangeInstances.fire()}getInstanceFromResource(e){return VWe(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}},vn),o}reviveInput(e){let t={...e,findRevivedId:!0},o=this._terminalInstanceService.createInstance({attachPersistentProcess:t},2),n=this._instantiationService.createInstance(ef,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})}};zBe=I([m(0,ee),m(1,Et),m(2,xm),m(3,F),m(4,ao),m(5,X)],zBe);var nOi=class extends C{constructor(e,t){super();this._container=e;this.orientation=t;this._splitViewDisposables=this._register(new P);this._children=[];this._terminalToPane=new Map;this._onDidChange=H.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 vu(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 rOi(e,this.orientation===1?this._height:this._width);o.orientation=this.orientation,Xo(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,Wl.Distribute,t)),this.layout(this._width,this._height),this._onDidChange=H.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,Wl.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)}},rOi=class{constructor(i,e){this.instance=i;this.orthogonalSize=e;this.minimumSize=80;this.maximumSize=Number.MAX_VALUE;this._onDidChange=H.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}},KBe=class extends C{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&&fV(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;Wo(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=>Xo(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&&(Ue(n),this._instanceDisposables.delete(e.instanceId))}moveInstance(e,t,o){if(e=Yl(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(dc);let t=this._terminalLocation===1&&fV(this._panelPosition)?1:0;this._splitPaneContainer=this._instantiationService.createInstance(nOi,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(dc);if(o!==this._panelPosition||n!==this._terminalLocation){let s=n===1&&fV(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 fV(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(Me(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)}};KBe=I([m(2,ku),m(3,xm),m(4,ds),m(5,fi),m(6,Ri),m(7,F)],KBe);var GBe=class extends C{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=at.groupCount.bindTo(this._contextKeyService);this._register(H.runAndSubscribe(this.onDidChangeGroups,()=>s.set(this.groups.length)));let l=at.splitTerminalActive.bindTo(this._contextKeyService);this._register(H.runAndSubscribe(this.onDidFocusInstance,()=>{let c=this.activeInstance;l.set(c?this.instanceIsSplit(c):!1)})),this._register(this.onDidDisposeGroup(c=>this._removeGroup(c))),this._register(H.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(dc);e&&this._viewDescriptorService.getViewContainerModel(e).visibleViewDescriptors.length===1&&(this._viewsService.closeView(dc),at.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(dc)?.terminalTabbedView?.focusTabs()}async focusHover(){if(this.instances.length===0)return;this._viewsService.getActiveViewWithId(dc)?.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(KBe,this._container,e);return this.groups.push(t),t.addDisposable(H.forward(t.onPanelOrientationChanged,this._onDidChangePanelOrientation)),t.addDisposable(H.forward(t.onDidDisposeInstance,this._onDidDisposeInstance)),t.addDisposable(H.forward(t.onDidFocusInstance,this._onDidFocusInstance)),t.addDisposable(H.forward(t.onDidChangeInstanceCapability,this._onDidChangeInstanceCapability)),t.addDisposable(H.forward(t.onInstancesChanged,this._onDidChangeInstances)),t.addDisposable(H.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(dc)??await this._viewsService.openView(dc,e);if(t?.setExpanded(!0),e){await Pi(0);let o=this.activeInstance;o&&(t&&!t.isVisible()&&await this._viewsService.openView(dc,e),await o.focusWhenReady(!0))}this._onDidShow.fire()}getInstanceFromResource(e){return VWe(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=Yl(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=Yl(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(dc);this.groups.forEach((t,o)=>t.setVisible(e&&o===this.activeGroupIndex))}};GBe=I([m(0,X),m(1,F),m(2,Ft),m(3,Ri),m(4,Ge)],GBe);var mjt=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 hjt=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 wfe=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;gjt(e,this._diff.added.values()),gjt(e,this._diff.removed.values()),gjt(e,this._diff.changed.values());let t=d(14055,null);return t+=Jwo(this._collection,i,this._extensionService,e),t}_getActions(){return[{label:d(14056,null),run:()=>this._terminalService.getInstanceFromId(this._terminalId)?.relaunch(),commandId:"workbench.action.terminal.relaunch"}]}getStatus(i){return{id:"relaunch-needed",severity:gt.Warning,icon:M.warning,tooltip:this._getInfo(i),hoverActions:this._getActions()}}};wfe=I([m(3,Yo),m(4,lt)],wfe);var Ooe=class{constructor(i,e,t){this._collection=i;this._commandService=e;this._extensionService=t;this.requiresAction=!1}_getInfo(i){let e=new Set;gjt(e,this._collection.getVariableMap(i).values());let t=d(14054,null);return t+=Jwo(this._collection,i,this._extensionService,e),t}_getActions(i){return[{label:d(14058,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:gt.Info,tooltip:void 0,detailedTooltip:this._getInfo(i),hoverActions:this._getActions(i)}}};Ooe=I([m(1,ge),m(2,lt)],Ooe);function Jwo(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(`
- \`${sOi(s,e)}\``),o.push(`: ${l}`));let c=r.get(s);if(c){let u=l?` (${d(14057,null)})`:"";o.push(`
- \`${sOi(s,e)}${u}\``),o.push(`: ${c}`)}!l&&!c&&o.push(`
- \`${sOi(s,e)}\``)}return o.join("")}function gjt(a,i){for(let e of i)for(let t of e)a.add(t.extensionIdentifier)}function sOi(a,i){return i.extensions.find(e=>e.id===a)?.displayName||a}var ean=new Map([[2,"APPEND"],[3,"PREPEND"],[1,"REPLACE"]]),tan=/^VSCODE_PYTHON_(PWSH|ZSH|BASH|FISH)_ACTIVATE/,ian="ms-python.vscode-python-envs",$Be=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;ri&&(o={},Object.keys(i).forEach(n=>o[n.toLowerCase()]=n));for(let[n,r]of this.getVariableMap(e)){let s=ri&&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_${ean.get(l.type)}`;i[u]=(i[u]?i[u]+":":"")+n+"="+this._encodeColons(c)}}}}}_encodeColons(i){return i.replaceAll(":","\\x3a")}blockPythonActivationVar(i,e){return!!(tan.test(i)&&ian!==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=eCo(r,l);c&&t.set(s,c)}),this.getVariableMap(e).forEach((r,s)=>{let l=i.getVariableMap(e).get(s),c=eCo(r,l);c&&n.set(s,c)}),this.getVariableMap(e).forEach((r,s)=>{let l=i.getVariableMap(e).get(s),c=oan(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=>Zwo(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=>Zwo(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 Zwo(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 eCo(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 oan(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 qBe=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N,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=N;this._terminalService=O;this.processState=1;this.capabilities=this._register(new jC);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=rQ(t,this._workspaceContextService,this._historyService),this.ptyProcessReady=this._createPtyProcessReadyPromise(),this._ackDataBufferer=new aOi(V=>this._process?.acknowledgeDataEvent(V)),this._dataFilter=this._register(this._instantiationService.createInstance(Fst)),this._register(this._dataFilter.onProcessData(V=>{let G={data:Ae(V)?V:V.data};this._onBeforeProcessData.fire(G),G.data&&G.data.length>0&&(Ae(V)||(V.data=G.data),this._onProcessData.fire(Ae(V)?{data:G.data,trackCommit:!1}:V))})),t&&typeof t=="object"?this.remoteAuthority=M7(t):this.remoteAuthority=this._workbenchEnvironmentService.remoteAuthority,o&&(this._extEnvironmentVariableCollection=new $Be(o),this._register(this._environmentVariableService.onDidChangeCollections(V=>this._onEnvironmentVariableCollectionChange(V))),this.environmentVariableInfo=this._instantiationService.createInstance(Ooe,this._extEnvironmentVariableCollection),this._onEnvironmentVariableInfoChange.fire(this.environmentVariableInfo)),this.shellIntegrationNonce=n??_t()}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(14196,null,e,t),severity:gt.Warning})}}dispose(e=!1){this._isDisposed=!0,this._process&&(this._setProcessState(5),this._process.shutdown(e),this._process=null),this._processListeners&&(Ue(this._processListeners),this._processListeners=void 0),super.dispose()}_createPtyProcessReadyPromise(){return new Promise(e=>{let t=H.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=ljt(this._cwdWorkspaceFolder,await this._terminalProfileResolverService.getEnvironment(this.remoteAuthority),this._configurationResolverService);if(this.userHome=this._pathService.resolvedUserHome?.fsPath,this.os=zo,this.remoteAuthority){let u=await this._pathService.userHome();this.userHome=u.path;let p=await this._remoteAgentService.getEnvironment();if(!p)throw new Error(`Failed to get remote environment for remote authority "${this.remoteAuthority}"`);this.userHome=p.userHome.path,this.os=p.os;let h=await this._resolveEnvironment(l,c,e),g=(this._configurationService.getValue("task.reconnection")&&e.reconnectionProperties||!e.isFeatureTerminal)&&this._terminalConfigurationService.config.enablePersistentSessions&&!e.isTransient;if(e.attachPersistentProcess){let f=await l.attachToProcess(e.attachPersistentProcess.id);f?r=f:(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 f={shellIntegration:{enabled:this._configurationService.getValue("terminal.integrated.shellIntegration.enabled"),suggestEnabled:this._configurationService.getValue(ty.SuggestEnabled),nonce:this.shellIntegrationNonce},windowsUseConptyDll:this._terminalConfigurationService.config.windowsUseConptyDll??!1,environmentVariableCollections:this._extEnvironmentVariableCollection?.collections?_mi(this._extEnvironmentVariableCollection.collections):void 0,workspaceFolder:this._cwdWorkspaceFolder,isScreenReaderOptimized:this._accessibilityService.isScreenReaderOptimized()};try{r=await l.createProcess(e,"",t,o,this._terminalConfigurationService.config.unicodeVersion,h,f,g)}catch(v){if(v?.message==="Could not fetch remote environment"){this._logService.trace("Could not fetch remote environment, silently failing");return}throw v}}this._isDisposed||this._setupPtyHostListeners(l)}else{if(e.attachPersistentProcess){let u=e.attachPersistentProcess.findRevivedId?await l.attachToRevivedProcess(e.attachPersistentProcess.id):await l.attachToProcess(e.attachPersistentProcess.id);u?r=u:(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,c)),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 mjt(this._process)),this._dataFilter.newProcess(this._process,n),this._processListeners&&Ue(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;jv(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=rQ(o.cwd,this._workspaceContextService,this._historyService),r=ri?"windows":it?"osx":"linux",s=this._configurationService.getValue(`terminal.integrated.env.${r}`),l;if(o.useShellEnvironment){let u=await e.getShellEnvironment();if(!u)throw new ni("Cannot fetch shell environment to use");l=u}else l=await this._terminalProfileResolverService.getEnvironment(this.remoteAuthority);let c=await cjt(o,s,t,this._productService.version,this._terminalConfigurationService.config.detectLocale,l);return!this._isDisposed&&OGt(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(Ooe,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:zo});let l=this._historyService.getLastActiveWorkspaceRoot(Y.file),c=await Nwo(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(ty.SuggestEnabled),nonce:this.shellIntegrationNonce},windowsUseConptyDll:this._terminalConfigurationService.config.windowsUseConptyDll??!1,environmentVariableCollections:this._extEnvironmentVariableCollection?_mi(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(14197,null);this._onProcessData.fire({data:Pk(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=zo;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 wfe&&(this.environmentVariableInfo=this._instantiationService.createInstance(Ooe,this._extEnvironmentVariableCollection),this._onEnvironmentVariableInfoChange.fire(this.environmentVariableInfo));return}this.environmentVariableInfo=this._instantiationService.createInstance(wfe,t,this._instanceId,e),this._onEnvironmentVariableInfoChange.fire(this.environmentVariableInfo)}async clearBuffer(){this._process?.clearBuffer?.()}};qBe=I([m(4,zs),m(5,F),m(6,Xs),m(7,Pe),m(8,sp),m(9,Vt),m(10,nt),m(11,yo),m(12,wn),m(13,Uz),m(14,ku),m(15,Sg),m(16,B),m(17,xm),m(18,Te),m(19,Ne),m(20,Bi),m(21,Yo)],qBe);var aOi=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 Fst=class extends C{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=It.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&&(It.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 hjt(0,0),o=e.onProcessData(n=>t.handleData(Ae(n)?n:n.data));return[t,o]}_getDataFromRecorder(e){return e.generateReplayEventSync().events.filter(t=>!!t.data).map(t=>t.data).join("")}};Fst=I([m(0,Xs)],Fst);var fjt=class extends C{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 vjt=class a extends C{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 P,t=R(this.domNode,_(".icon-select-box-container"));t.style.margin="10px 15px";let o=R(t,_(".icon-select-input-container"));o.style.paddingBottom="10px",this.inputBox=e.add(new Dc(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 Pa(n,{useShadows:!1,horizontal:2})),R(t,this.scrollableElement.getDomNode()),this.options.showIconInfo&&(this.iconIdElement=this._register(new Oa(R(R(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 P;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=R(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}`),R(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);R(o,_(".icon-no-results",void 0,c)),Jo(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 jBe=new Q("iconSelectBoxFocus",!0),lOi=new Q("iconSelectBoxInputFocus",!0),cOi=new Q("iconSelectBoxInputEmpty",!0),yT=class extends vjt{static getFocusedWidget(){return yT.focusedWidget}constructor(i,e){if(super(i),this.contextKeyService=this._register(e.createScoped(this.domNode)),jBe.bindTo(this.contextKeyService),this.inputFocusContextKey=lOi.bindTo(this.contextKeyService),this.inputEmptyContextKey=cOi.bindTo(this.contextKeyService),this.inputBox){let t=this._register(Vn(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(),yT.focusedWidget=this}};yT=I([m(1,X)],yT);yt.registerCommandAndKeybindingRule({id:"iconSelectBox.focusUp",weight:200,when:jBe,primary:16,handler:()=>{let a=yT.getFocusedWidget();a&&a.focusPreviousRow()}});yt.registerCommandAndKeybindingRule({id:"iconSelectBox.focusDown",weight:200,when:jBe,primary:18,handler:()=>{let a=yT.getFocusedWidget();a&&a.focusNextRow()}});yt.registerCommandAndKeybindingRule({id:"iconSelectBox.focusNext",weight:200,when:x.and(jBe,x.or(cOi,lOi.toNegated())),primary:17,handler:()=>{let a=yT.getFocusedWidget();a&&a.focusNext()}});yt.registerCommandAndKeybindingRule({id:"iconSelectBox.focusPrevious",weight:200,when:x.and(jBe,x.or(cOi,lOi.toNegated())),primary:15,handler:()=>{let a=yT.getFocusedWidget();a&&a.focusPrevious()}});yt.registerCommandAndKeybindingRule({id:"iconSelectBox.selectFocused",weight:200,when:jBe,primary:3,handler:()=>{let a=yT.getFocusedWidget();a&&a.setSelection(a.getFocus()[0])}});var nan=new co(()=>{let a=jy().getIcons(),i=new Set;return a.filter(t=>t.id===R6.blank.id||q.isThemeIcon(t.defaults)||i.has(t.defaults.fontCharacter)?!1:(i.add(t.defaults.fontCharacter),!0))}),QBe=class extends C{constructor(e,t,o){super();this._hoverService=t;this._layoutService=o;this._iconSelectBox=e.createInstance(yT,{icons:nan.value,inputBoxStyles:pl})}async pickIcons(){let e=new ai(486,260);return new Promise(t=>{this._register(this._iconSelectBox.onDidSelect(s=>{t(s),this._iconSelectBox.dispose()})),this._iconSelectBox.clearInput();let o=rh().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()})}};QBe=I([m(0,F),m(1,tt),m(2,nc)],QBe);var Wst=class extends C{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=Me(this._getXterm().raw.element);if(n&&!this._isVisible()){this._resizeXJob.value||(this._resizeXJob.value=jv(n,async()=>{this._resizeXCallback(this._latestX),this._resizeXJob.clear()})),this._resizeYJob.value||(this._resizeYJob.value=jv(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([Nd(100)],Wst.prototype,"_debounceResizeX",1);var bjt,aan=["bash","zsh","pwsh","python"],Yf=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N,O,V,U,G,$,te,pe,de,se){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=N;this._workspaceContextService=O;this._editorService=V;this._workspaceTrustRequestService=U;this._historyService=G;this._telemetryService=$;this._openerService=te;this._commandService=pe;this._accessibilitySignalService=de;this._viewDescriptorService=se;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 P3);this.disableLayout=!1;this._targetRef=new qut(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=_t();if(this._wrapperElement=document.createElement("div"),this._wrapperElement.classList.add("terminal-wrapper"),this._widgetManager=this._register(r.createInstance(uAe)),this._skipTerminalCommands=[],this._isExiting=!1,this._hadFocusOnExit=!1,this._isVisible=!1,this._instanceId=Yf._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=FWe(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 Ve=Ae(this._shellLaunchConfig.cwd)?A.from({scheme:Y.file,path:this._shellLaunchConfig.cwd}):this._shellLaunchConfig.cwd;Ve&&(this._workspaceFolder=this._workspaceContextService.getWorkspaceFolder(Ve)??void 0)}if(!this._workspaceFolder){let Ve=this._historyService.getLastActiveWorkspaceRoot();this._workspaceFolder=Ve?this._workspaceContextService.getWorkspaceFolder(Ve)??void 0:void 0}let Se=this._register(o.createScoped(this._wrapperElement));this._scopedContextKeyService=Se,this._scopedInstantiationService=this._register(r.createChild(new Io([X,Se]))),this._terminalFocusContextKey=at.focus.bindTo(Se),this._terminalHasFixedWidth=at.terminalHasFixedWidth.bindTo(Se),this._terminalHasTextContextKey=at.textSelected.bindTo(this._contextKeyService),this._terminalAltBufferActiveContextKey=at.altBufferActive.bindTo(Se),this._terminalShellIntegrationEnabledContextKey=at.terminalShellIntegrationEnabled.bindTo(Se),this._logService.trace(`terminalInstance#ctor (instanceId: ${this.instanceId})`,this._shellLaunchConfig),this._register(this.capabilities.onDidAddCapability(Ve=>this._logService.debug("terminalInstance added capability",Ve.id))),this._register(this.capabilities.onDidRemoveCapability(Ve=>this._logService.debug("terminalInstance removed capability",Ve.id)));let ke=this._register(new jt);this._register(this.capabilities.onDidAddCapability(Ve=>{ke.get(Ve.id)?.dispose();let Fe=()=>{this._labelComputer?.refreshLabel(this),this._refreshShellIntegrationInfoStatus(this)};switch(Ve.id){case 0:{ke.set(Ve.id,Ve.capability.onDidChangeCwd(Qt=>{this._cwd=Qt,this._setTitle(this.title,3)}));break}case 2:{Ve.capability.promptInputModel.setShellType(this.shellType);let Qt=new P;Qt.add(H.any(Ve.capability.promptInputModel.onDidStartInput,Ve.capability.promptInputModel.onDidChangeInput,Ve.capability.promptInputModel.onDidFinishInput)(Fe)),Qt.add(Ve.capability.onCommandExecuted(async Ze=>{if(!Ze.id&&Ze.command){let Ti=_t();this.xterm?.shellIntegration.setNextCommandId(Ze.command,Ti),await this._processManager.setNextCommandId(Ze.command,Ti)}})),ke.set(Ve.id,Qt);break}case 6:{ke.set(Ve.id,Ve.capability.onPromptTypeChanged(Fe));break}}})),this._register(this.onDidChangeShellType(()=>this._refreshShellIntegrationInfoStatus(this))),this._register(this.capabilities.onDidRemoveCapability(Ve=>{ke.get(Ve.id)?.dispose()})),!this.shellLaunchConfig.executable&&!this._workbenchEnvironmentService.remoteAuthority&&this._terminalProfileResolverService.resolveIcon(this._shellLaunchConfig,zo),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(FBe)),this._initDimensions(),this._processManager=this._createProcessManager(),this._containerReadyBarrier=new f$(100),this._attachBarrier=new f$(1e3),this._xtermReadyPromise=this._createXterm(),this._xtermReadyPromise.then(async()=>{await this._containerReadyBarrier.wait();let Ve;if(!this.shellLaunchConfig.customPtyImplementation&&this._terminalConfigurationService.config.shellIntegration?.enabled&&!this.shellLaunchConfig.executable){Ve=await this._processManager.getBackendOS();let Fe=await this._terminalProfileResolverService.getDefaultProfile({remoteAuthority:this.remoteAuthority,os:Ve});this.shellLaunchConfig.executable=Fe.path,this.shellLaunchConfig.args=Fe.args,this.shellLaunchConfig.icon??=Fe.icon,this.shellLaunchConfig.color??=Fe.color,this.shellLaunchConfig.env??=Fe.env}Ve&&this.shellLaunchConfig.executable&&this.setShellType(can(Ve,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(Ve=>{if(!this.isDisposed)throw Ve}),this._register(this._configurationService.onDidChangeConfiguration(async Ve=>{Ve.affectsConfiguration("accessibility.verbosity.terminal")&&this._setAriaLabel(this.xterm?.raw,this._instanceId,this.title),Ve.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(Qt=>Ve.affectsConfiguration(Qt))&&(this._layoutSettingsChanged=!0,await this._resize()),Ve.affectsConfiguration("terminal.integrated.unicodeVersion")&&this._updateUnicodeVersion(),Ve.affectsConfiguration("editor.accessibilitySupport")&&this.updateAccessibilitySupport(),(Ve.affectsConfiguration("terminal.integrated.tabs.title")||Ve.affectsConfiguration("terminal.integrated.tabs.separator")||Ve.affectsConfiguration("terminal.integrated.tabs.description"))&&this._labelComputer?.refreshLabel(this)})),this._register(this._workspaceContextService.onDidChangeWorkspaceFolders(()=>this._labelComputer?.refreshLabel(this)));let Ee=Me(this._container).setTimeout(()=>{Ee=void 0,this._initialDataEvents=void 0,this._initialDataEventsListener.clear()},1e4);this._register(Z(()=>{Ee&&Me(this._container).clearTimeout(Ee)}));let He=mtt.getTerminalContributions();for(let Ve of He){if(this._contributions.has(Ve.id)){mt(new Error(`Cannot have two terminal contributions with the same id ${Ve.id}`));continue}let Fe;try{Fe=this._register(this._scopedInstantiationService.createInstance(Ve.ctor,{instance:this,processManager:this._processManager,widgetManager:this._widgetManager})),this._contributions.set(Ve.id,Fe)}catch(Qt){mt(Qt)}this._xtermReadyPromise.then(Qt=>{Qt&&Fe.xtermReady?.(Qt)}),this._register(this.onDisposed(()=>{Fe.dispose(),this._contributions.delete(Ve.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 ts(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 er.typeTask;case"Local":return er.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?jy().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=Me(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(Me(this.domElement)),r=HGt(Me(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(){Yf._lastKnownGridDimensions&&(this._cols=Yf._lastKnownGridDimensions.cols,this._rows=Yf._lastKnownGridDimensions.rows)}_fireMaximumDimensionsChanged(){this._onMaximumDimensionsChanged.fire()}_getDimension(e,t){let o=this.xterm?this.xterm.getFont():this._terminalConfigurationService.getFont(Me(this.domElement));if(!o||!o.charWidth||!o.charHeight||!this.xterm?.raw.element)return;let n=Me(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 Yf._lastKnownCanvasDimensions=new ai(Math.min(4096,e-r),t-s+(this._hasScrollBar&&this._horizontalScrollbar?-5:0)),Yf._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(lw.A11yFocusAccessibleBuffer,t);return bjt||(bjt=fn.withAsyncBody(async n=>{let r=(await bg("@xterm/xterm","lib/xterm.js")).Terminal;r.strings.promptLabel=d(14153,null),r.strings.tooMuchOutput=o?d(14154,null,o.getLabel()):d(14155,null),n(r)}),bjt)}async _createXterm(){let e=await Yf.getXtermConstructor(this._keybindingService,this._contextKeyService);if(this.isDisposed)return;let t=this.shellLaunchConfig.executable===void 0||this.shellType===void 0||!aan.includes(this.shellType),o=this._scopedInstantiationService.createInstance(nM,this._resource,e,{cols:this._cols,rows:this._rows,xtermColorProvider:this._scopedInstantiationService.createInstance(Cfe,this._targetRef),capabilities:this.capabilities,shellIntegrationNonce:this._processManager.shellIntegrationNonce,disableShellIntegrationReporting:t},this.onDidExecuteText);this.xterm=o,this._resizeDebouncer=this._register(new Wst(()=>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 fjt(n));if(this._register(r.onLineData(s=>this._onLineData.fire(s))),this._lineDataEventAddon=r,nn(()=>{this._register(o.raw.onBell(()=>{(this._configurationService.getValue("terminal.integrated.enableBell")||this._configurationService.getValue("terminal.integrated.enableVisualBell"))&&this.statusList.add({id:"bell",severity:St.Warning,icon:M.bell,tooltip:d(14137,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})),this._register(this._processManager.onRestoreCommands(s=>this.xterm?.shellIntegration.deserialize(s))),this._register(this._viewDescriptorService.onDidChangeLocation(({views:s})=>{s.some(l=>l.id===dc)&&o.refresh()})),this._register(o.onDidChangeProgress(()=>this._labelComputer?.refreshLabel(this))),this._register(H.runAndSubscribe(o.shellIntegration.onDidChangeSeenSequences,()=>{o.shellIntegration.seenSequences.size>0&&this._refreshShellIntegrationInfoStatus(this)})),!this.capabilities.has(0)){let s=o.raw.onKey(l=>{new Ii(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(14152,null):e.capabilities.has(2)?d(14147,null):e.usedShellIntegrationInjection?d(14148,null):d(14150,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:St.Info,tooltip:`${d(14146,null)}: ${t}`,detailedTooltip:`${d(14146,null)}: ${t}${c}`})}async runCommand(e,t,o){let n=this.capabilities.get(2),r=this._configurationService.getValue("terminal.integrated.shellIntegration.enabled")===!0,s=djt(this._configurationService,r,this.hasRemoteAuthority,this._processManager.processReadyTimestamp);if(!n||n.promptInputModel.state!==1){let l=new P;await Promise.race([new Promise(c=>{l.add(this.capabilities.onDidAddCommandDetectionCapability(u=>{n=u,n.promptInputModel.state===1?c():l.add(n.promptInputModel.onDidStartInput(()=>{c()}))}))}),Pi(s)]),l.dispose()}o&&n&&(this.xterm?.shellIntegration.setNextCommandId(e,o),await this._processManager.setNextCommandId(e,o)),t&&(!n||n.promptInputModel.value.length>0)&&(await this.sendText("",!1),await Pi(100)),await this.sendText(e,t,!t)}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 Ii(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&&this._skipTerminalCommands.some(c=>c===s.commandId)?(n.preventDefault(),!1):this._terminalConfigurationService.config.allowMnemonics&&!it&&n.altKey||GT.getTabFocusMode()&&n.key==="Tab"?!1:n.key==="Tab"&&n.shiftKey?(n.preventDefault(),!0):!(ri&&n.altKey&&n.key==="F4"&&!n.ctrlKey||!og.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 P,o=t.add(this._scopedInstantiationService.createInstance(Vst,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 Om(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})`),Ue(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)}yc&&(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,Owo(e,this.shellLaunchConfig.executable,this.title,this.shellType,this._processManager.backend,this._processManager.os)}async getUriLabelForShell(e){return await this.processReady,Fwo(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(dc),t=!1,o=this._editorService.activeEditor;o&&(t=o instanceof ef),this._terminalHasTextContextKey.set((e||t)&&this.hasSelection())}_createProcessManager(){let e;this.shellLaunchConfig.attachPersistentProcess?.environmentVariableCollections&&(e=veo(this.shellLaunchConfig.attachPersistentProcess.environmentVariableCollections));let t=this._scopedInstantiationService.createInstance(qBe,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(Bst)),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:St.Error,icon:M.debugDisconnect,tooltip:d(14139,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(14165,null)}):this._workspaceContextService.getWorkspace().folders.length===0&&this._cwd&&this._userHome&&Hp(this._cwd)!==Hp(this._userHome)&&this._onProcessExit({message:d(14164,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&&(Wo(o,{message:!0})?this._onProcessExit(o):Wo(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 ni("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=lan(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(Pk(o)),typeof n){case"string":r.raw.write(Pk(n,{excludeLeadingNewLine:!0}));break;case"function":this.exitCode!==void 0&&r.raw.write(Pk(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:St.Error,actions:{primary:[this._scopedInstantiationService.createInstance(VBe)]}}):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:St.Warning,icon:M.warning,tooltip:`${e} `+d(14143,null),hoverActions:[{commandId:"workbench.action.terminal.learnMore",label:d(14149,null),run:()=>{this._openerService.open("https://code.visualstudio.com/docs/editor/integrated-terminal#_shell-integration")}},{commandId:"workbench.action.openSettings",label:d(14151,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=MI(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=Ae(this._shellLaunchConfig.initialText)?this._shellLaunchConfig.initialText:this._shellLaunchConfig.initialText?.text;Ae(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&&(Wo(n,{message:!0})?this._onProcessExit(n):Wo(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(14156,null)})===!0}async _updateProcessCwd(){if(!(this.isDisposed||this.shellLaunchConfig.customPtyImplementation))try{let e=await this._refreshProperty("cwd");if(!Ae(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=cDt.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()),Yf._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(14161,null,t,o)):n.push(d(14160,null,t)),this._accessibilityService.isScreenReaderOptimized()||n.push(d(14158,null));let s=this._keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getLabel();this._configurationService.getValue("accessibility.verbosity.terminal")&&s&&n.push(d(14157,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=Ms.parse(e).name;else{let o=e.indexOf(" ");e.startsWith("/")?e=No(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=Ms.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(14144,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:St.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(14145,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:St.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(Me(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(Me(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 Pa(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",ri))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(14159,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=rQ(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(QBe),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=pDt(n),s=tEe(n),l=[];for(let g of r){let f=oy(g);l.push({label:`$(${M.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(14138,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 Ue(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(Ao(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){aQ(Ki(),e,this,t,this._contextMenuService);return}if(this._terminalConfigurationService.config.rightClickBehavior==="nothing")return e.shiftKey?void 0:{cancelContextMenu:!0}}}};I([Nd(50)],Yf.prototype,"_fireMaximumDimensionsChanged",1),I([Nd(500)],Yf.prototype,"_refreshShellIntegrationInfoStatus",1),I([Nd(1e3)],Yf.prototype,"relaunch",1),I([Nd(2e3)],Yf.prototype,"_updateProcessCwd",1),Yf=I([m(2,X),m(3,ze),m(4,F),m(5,ku),m(6,Sg),m(7,wn),m(8,be),m(9,_e),m(10,Ne),m(11,Po),m(12,Ft),m(13,De),m(14,B),m(15,Xs),m(16,le),m(17,Bi),m(18,nt),m(19,Ge),m(20,Vt),m(21,Pe),m(22,ee),m(23,Vd),m(24,zs),m(25,Te),m(26,Qe),m(27,ge),m(28,tr),m(29,Ri)],Yf);var Vst=class extends C{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(gu(e,Aa.FILES,Aa.RESOURCES,"Terminals",Ll.FILES)){if(this._dropOverlay||(this._dropOverlay=document.createElement("div"),this._dropOverlay.classList.add("terminal-drop-overlay")),gu(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(gu(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=WWe(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(Aa.RESOURCES);n&&(o=A.parse(JSON.parse(n)[0]));let r=e.dataTransfer.getData(Ll.FILES);!o&&r&&(o=A.file(JSON.parse(r)[0])),!o&&e.dataTransfer.files.length>0&&Ix(e.dataTransfer.files[0])&&(o=A.file(Ix(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(dc)===1&&fV(e)?1:0}};Vst=I([m(1,fi),m(2,Ri)],Vst);var Bst=class extends C{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?No(e.workspaceFolder.uri.fsPath):void 0,local:r==="Local"?er.typeLocal:void 0,process:e.processName,sequence:e.sequence,task:r==="Task"?er.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||Y.file,path:e.cwd?iN(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=No(u.cwd))}let f=$gt(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)"}}};Bst=I([m(0,be),m(1,ku),m(2,Pe)],Bst);function lan(a,i,e,t){if(a===void 0||a===0)return{code:a,message:void 0};let o=Xo(a)?a:a.code,n;switch(typeof a){case"number":{let r;i.executable&&(r=i.executable,Ae(i.args)?r+=` ${i.args}`:i.args&&i.args.length&&(r+=i.args.map(s=>` '${s}'`).join())),e===4?r?n=d(14141,null,r,o):n=d(14142,null,o):r?n=d(14162,null,r,o):n=d(14163,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(14140,null,r);break}}return{code:o,message:n}}var Cfe=class{constructor(i,e){this._target=i;this._viewDescriptorService=e}getBackgroundColor(i){if(this._target.object===2)return i.getColor(qo);let e=i.getColor(lX);return e||(this._viewDescriptorService.getViewLocationById(dc)===1?i.getColor(jS):i.getColor(op))}};Cfe=I([m(1,Ri)],Cfe);function can(a,i){let e=No(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 xfe=class extends C{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=at.shellType.bindTo(this._contextKeyService);for(let n of[void 0,o.remoteAuthority]){let{promise:r,resolve:s}=TI();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(Yf,this._terminalShellTypeContextKey,o);return n.target=t,this._onDidCreateInstance.fire(n),n}convertProfileToShellLaunchConfig(e,t){if(e&&Wo(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=oe.as(SV.Backend).getTerminalBackend(e);return t||(await this._backendRegistration.get(e)?.promise,t=oe.as(SV.Backend).getTerminalBackend(e)),t}getRegisteredBackends(){return oe.as(SV.Backend).backends.values()}didRegisterBackend(e){this._backendRegistration.get(e.remoteAuthority)?.resolve(),this._onDidRegisterBackend.fire(e)}};xfe=I([m(0,F),m(1,X),m(2,Vt)],xfe);we(xm,xfe,1);var kfe=class extends C{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(`${Y.vscodeTerminal}:/**`,{id:Mz,label:er.terminal,priority:"exclusive"},{canSupportResource:u=>u.scheme===Y.vscodeTerminal,singlePerResource:!0},{createEditorInput:async({resource:u,options:p})=>{let h=r.getInstanceFromResource(u);if(h)l.getGroupForInstance(h)?.removeInstance(h);else{let v=sG(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:Mz}}}})),this._register(o.registerFormatter({scheme:Y.vscodeTerminal,formatting:{label:"${path}",separator:""}}))}};kfe=I([m(0,ul),m(1,TSi),m(2,Vt),m(3,ot),m(4,ao),m(5,Yo),m(6,xv),m(7,jl),m(8,xm)],kfe);var dan=Tn.registerExtensionPoint(SJi),YBe=ae("terminalContributionsService"),Sjt=class{constructor(){this._terminalProfiles=[];this._terminalCompletionProviders=[];this._onDidChangeTerminalCompletionProviders=new E;this.onDidChangeTerminalCompletionProviders=this._onDidChangeTerminalCompletionProviders.event;dan.setHandler(i=>{this._terminalProfiles=i.map(e=>e.value?.profiles?.filter(t=>uan(t)).map(t=>({...t,extensionIdentifier:e.description.identifier.value}))||[]).flat(),this._terminalCompletionProviders=i.map(e=>Ea(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 uan(a){function i(e){return yi(e)&&"light"in e&&A.isUri(e.light)&&"dark"in e&&A.isUri(e.dark)}return!a.icon||Ae(a.icon)||A.isUri(a.icon)||i(a.icon)}var Efe=class extends C{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=at.webExtensionContributedProfile.bindTo(this._contextKeyService),this._updateWebContextKey(),this._profilesReadyPromise=this._remoteAgentService.getEnvironment().then(()=>(this._profilesReadyBarrier=new f$(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||!Ae(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,man),o=await this._updateContributedProfiles(),n=await this.getPlatformKey(),r=this._configurationService.getValue(`terminal.integrated.automationProfile.${n}`),s=!uo(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,han);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(Gt&&this._contributedProfiles.length>0)}async _refreshPlatformConfig(e){let t=await this._remoteAgentService.getEnvironment();qui({os:t?.os||zo,profiles:e},this._contributedProfiles),this._refreshTerminalActionsDisposable.value=tOi(e)}async getPlatformKey(){let e=await this._remoteAgentService.getEnvironment();return e?e.os===1?"windows":e.os===2?"osx":"linux":ri?"windows":it?"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&&!Wo(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([OM(2e3)],Efe.prototype,"refreshAvailableProfiles",1),Efe=I([m(0,X),m(1,B),m(2,YBe),m(3,lt),m(4,yo),m(5,Vt),m(6,xm)],Efe);function man(a,i){return a.profileName===i.profileName&&XXi(a.args,i.args)&&a.color===i.color&&JXi(a.icon,i.icon)&&a.isAutoDetected===i.isAutoDetected&&a.isDefault===i.isDefault&&a.overrideName===i.overrideName&&a.path===i.path}function han(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 XBe=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(Wo(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(Wo(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(Wo(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 Wo(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(14203,null):d(14202,null),onDidTriggerItemButton:async f=>{if(!await this._isProfileSafe(f.item.profile)||Wo(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(14200,null),value:f.item.profile.profileName,validateInput:async w=>{if(b.includes(w))return d(14204,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(14205,null)}),l.push(...this._sortProfileQuickPickItems(c.map(f=>this._createProfileQuickPickItem(f)),n))),l.push({type:"separator",label:d(14201,null)});let p=[];for(let f of this._terminalProfileService.contributedProfiles){let v;Ae(f.icon)&&(f.icon.startsWith("$(")?v=q.fromString(f.icon):v=q.fromId(f.icon)),(!v||!jy().getIcon(v.id))&&(v=this._terminalProfileResolverService.getDefaultIcon());let b=z_(f,this._themeService.getColorTheme().type,!0),S=oy(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(14206,null)}),l.push(...this._sortProfileQuickPickItems(u.map(f=>this._createProfileQuickPickItem(f)),n)));let h=tEe(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=Wo(i,{profileName:!0})&&i.isUnsafePath,t=Wo(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(St.Warning,d(14207,null,`"${n.join(",")}"`),[{label:d(14208,null),run:()=>o(!0)},{label:d(14198,null),run:()=>o(!1)}]);H.once(r.onDidClose)(()=>{o(!1)})})}_createProfileQuickPickItem(i){let e=[{iconClass:q.asClassName(Kpo),tooltip:d(14199,null)}],o=`$(${(i.icon&&q.isThemeIcon(i.icon)?i.icon:M.terminal).id}) ${i.profileName}`,n=i.isFromPath?No(i.path):i.path,r=oy(i),s=[];if(r&&s.push(r),i.args){if(Ae(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))}};XBe=I([m(0,iy),m(1,Sg),m(2,B),m(3,Ge),m(4,De),m(5,Ne)],XBe);function iCo(a,i,e,t,o){let n=new P,r=n.add(new xI),s=n.add(new jt);function l(p,h){let g=r.add(H.map(o(h),v=>({instance:p,data:v}))),f=s.get(p.instanceId);f||(f=new jt,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 vre(a,i,e,p=>H.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 vre(a,i,e,p=>H.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 Dw=class extends C{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 Go;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(N=>{this._initInstanceListeners(N),this._onDidCreateInstance.fire(N)})),this._register(this._terminalGroupService.onDidChangeActiveInstance(N=>{!N&&!this._isShuttingDown&&this._terminalConfigurationService.config.hideOnLastClosed&&this._terminalGroupService.hidePanel(),N?.shellType?this._terminalShellTypeContextKey.set(N.shellType.toString()):(!N||!N.shellType)&&this._terminalShellTypeContextKey.reset()})),this._handleInstanceContextKeys(),this._terminalShellTypeContextKey=at.shellType.bindTo(this._contextKeyService),this._processSupportContextKey=at.processSupported.bindTo(this._contextKeyService),this._processSupportContextKey.set(!Gt||this._remoteAgentService.getConnection()!==null),this._terminalHasBeenCreated=at.terminalHasBeenCreated.bindTo(this._contextKeyService),this._terminalCountContextKey=at.count.bindTo(this._contextKeyService),this._terminalEditorActive=at.terminalEditorActive.bindTo(this._contextKeyService),this._register(this.onDidChangeActiveInstance(N=>{this._terminalEditorActive.set(!!N?.target&&N.target===2)})),this._register(t.onBeforeShutdown(async N=>N.veto(this._onBeforeShutdown(N.reason),"veto.terminal"))),this._register(t.onWillShutdown(N=>this._onWillShutdown(N))),this._initializePrimaryBackend(),Pi(0).then(()=>this._register(this._instantiationService.createInstance(Hst,It.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=>H.map(e.onData,t=>({instance:e,data:t})))).event}get onAnyInstanceDataInput(){return this._register(this.createOnInstanceEvent(e=>H.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=>H.map(e.onMaximumDimensionsChanged,()=>e,e.store))).event}get onAnyInstancePrimaryStatusChange(){return this._register(this.createOnInstanceEvent(e=>H.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=>H.map(e.onDidChangeShellType,()=>e))).event}get onAnyInstanceAddedCapabilityType(){return this._register(this.createOnInstanceEvent(e=>H.map(e.capabilities.onDidAddCapability,t=>t.id))).event}async showProfileQuickPick(e,t){let n=await this._instantiationService.createInstance(XBe).showAndGetResult(e);if(!n||Ae(n))return;let r=n.keyMods;if(e==="createInstance"){let s=this.getDefaultInstanceHost().activeInstance,l=this._terminalConfigurationService.defaultLocation,c;if(n.config&&Wo(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&&Wo(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(){sn("code/terminal/willGetTerminalBackend"),this._primaryBackend=await this._terminalInstanceService.getBackend(this._environmentService.remoteAuthority),sn("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(FWe(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)}})),sn("code/terminal/willReconnect");let o;t?o=this._reconnectToRemoteTerminals():e?o=this._reconnectToLocalTerminals():o=Promise.resolve(),o.then(async()=>{this._setConnected(),sn("code/terminal/didReconnect"),sn("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=>H.once(r.onProcessReplayComplete)(s)))),sn("code/terminal/didReplay"),sn("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()})),sn("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=>{H.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;sn("code/terminal/willGetTerminalLayoutInfo");let o=await t.getTerminalLayoutInfo();sn("code/terminal/didGetTerminalLayoutInfo"),t.reduceConnectionGraceTime(),sn("code/terminal/willRecreateTerminalGroups"),await this._recreateTerminalGroups(o),sn("code/terminal/didRecreateTerminalGroups"),this._attachProcessLayoutListeners(),this._logService.trace("Reconnected to remote terminals")}async _reconnectToLocalTerminals(){let e=await this._terminalInstanceService.getBackend();if(!e)return;sn("code/terminal/willGetTerminalLayoutInfo");let t=await e.getTerminalLayoutInfo();if(sn("code/terminal/didGetTerminalLayoutInfo"),t&&(t.tabs.length>0||t?.background?.length)){sn("code/terminal/willRecreateTerminalGroups"),this._reconnectedTerminalGroups=this._recreateTerminalGroups(t);let o=await this._reviveBackgroundTerminalInstances(t.background||[]);this._backgroundedTerminalInstances=o.map(n=>({instance:n})),sn("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"||(sn(`code/terminal/willRecreateTerminal/${s.id}-${s.pid}`),o=this.createTerminal({config:{attachPersistentProcess:s},location:o?{parentTerminal:o}:1}),o.then(()=>sn(`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=at.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 Gt?(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(),Pi(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&&!it?!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 VWe(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,hg)}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 P;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(H.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=sG(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(14212,null):t=d(14211,null,o.length);let{confirmed:n}=await this._dialogService.confirm({type:"warning",message:t,primaryButton:d(14213,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(Wo(e,{viewColumn:!0}))return this._terminalEditorService;if(Wo(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===Y.file;this._terminalProfileService.availableProfiles.length===0&&!(e?.config&&Wo(e.config,{customPtyImplementation:!0}))&&!t&&(this._connectionState===0&&sn("code/terminal/willGetProfiles"),await this._terminalProfileService.profilesReady,this._connectionState===0&&sn("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&&Wo(o,{extensionIdentifier:!0})?{}:this._terminalInstanceService.convertProfileToShellLaunchConfig(o||{}),r=e?.skipContributedProfileCheck?void 0:await this._getContributedProfile(n,e),s=typeof e?.location=="object"&&Wo(e.location,{splitActiveTerminal:!0})?e.location.splitActiveTerminal:typeof e?.location=="object"?Wo(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:vn}:{splitActiveTerminal:!0}:h=typeof e?.location=="object"&&Wo(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&&Wo(t.config,{extensionIdentifier:!0})?t.config:this._terminalProfileService.getContributedDefaultProfile(e)}async createDetachedTerminal(e){let t=await Yf.getXtermConstructor(this._keybindingService,this._contextKeyService),o=e.capabilities??new jC,n=this._instantiationService.createInstance(nM,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 pAe(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"&&Wo(o.location,{parentTerminal:!0})&&(r=await o.location.parentTerminal),!r)throw new Error("Cannot split without an active instance");e.cwd=await eOi(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(Wo(e,{parentTerminal:!0})){let t=await e.parentTerminal;return t.target?t.target:1}else{if(Wo(e,{viewColumn:!0}))return 2;if(Wo(e,{splitActiveTerminal:!0}))return this._activeInstance?.target?this._activeInstance?.target:1}return e}async _getSplitParent(e){if(e&&typeof e=="object"&&Wo(e,{parentTerminal:!0}))return e.parentTerminal;if(e&&typeof e=="object"&&Wo(e,{splitActiveTerminal:!0}))return this.activeInstance}_getEditorOptions(e){if(e&&typeof e=="object"&&Wo(e,{viewColumn:!0}))return e.viewColumn===Un&&Cy(Ki())?(e.viewColumn=this._editorGroupsService.activeGroup.id,e):(e.viewColumn=W_(this._editorGroupsService,this._configurationService,e.viewColumn),e)}_evaluateLocalCwd(e){!Ae(e.cwd)&&e.cwd?.scheme===Y.file&&(JL.getValue(this._contextKeyService)?(e.initialText=Pk(d(14210,null,"\x1B[3m","\x1B[23m"),{excludeLeadingNewLine:!0,loudFormatting:!0}),e.type="Local"):this._remoteAgentService.getConnection()&&(e.initialText=Pk(d(14209,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:Un}: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&&Ue(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&&Ue(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 vre(this.instances,this.onDidCreateInstance,this.onDidDisposeInstance,e)}createOnInstanceCapabilityEvent(e,t){return iCo(this.instances,this.onDidCreateInstance,this.onDidDisposeInstance,e,t)}};I([mi],Dw.prototype,"onAnyInstanceData",1),I([mi],Dw.prototype,"onAnyInstanceDataInput",1),I([mi],Dw.prototype,"onAnyInstanceIconChange",1),I([mi],Dw.prototype,"onAnyInstanceMaximumDimensionsChange",1),I([mi],Dw.prototype,"onAnyInstancePrimaryStatusChange",1),I([mi],Dw.prototype,"onAnyInstanceProcessIdReady",1),I([mi],Dw.prototype,"onAnyInstanceSelectionChange",1),I([mi],Dw.prototype,"onAnyInstanceTitleChange",1),I([mi],Dw.prototype,"onAnyInstanceShellTypeChanged",1),I([mi],Dw.prototype,"onAnyInstanceAddedCapabilityType",1),I([Nd(500)],Dw.prototype,"_saveState",1),I([Nd(500)],Dw.prototype,"_updateTitle",1),I([Nd(500)],Dw.prototype,"_updateIcon",1),Dw=I([m(0,X),m(1,ao),m(2,Xs),m(3,ct),m(4,F),m(5,yo),m(6,B),m(7,Vt),m(8,ku),m(9,xv),m(10,jl),m(11,xm),m(12,Et),m(13,iy),m(14,lt),m(15,Ne),m(16,Pe),m(17,ge),m(18,_e),m(19,wC)],Dw);var Hst=class extends Jd{constructor(e,t,o,n,r){super(o);this._terminalService=t;this._themeService=o;this._terminalProfileService=n;this._editorService=r;this._registerListeners(),this._styleElement=hr(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 ef&&this.updateStyles()})),this._register(this._editorService.onDidCloseEditor(()=>{this._editorService.activeEditor instanceof ef&&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&&Wo(s,{light:!0,dark:!0})&&(l=Ip(e.type)?s.dark:s.light);let c=z_(r,e.type);if(l instanceof A&&c&&c.length>1&&(t+=Hs`.monaco-workbench .terminal-tab.${a1(c[0])}::before
					{content: ''; background-image: ${Na(l)};}`),q.isThemeIcon(s)){let p=jy().getIcon(s.id);if(p){let h=o.getIcon(p);h&&(t+=Hs`.monaco-workbench .terminal-tab.codicon-${a1(s.id)}::before
							{content: ${WS(h.fontCharacter)} !important; font-family: ${WS(h.font?.id??"codicon")} !important;}`)}}}let n=e.getColor(_N);n&&(t+=Hs`.monaco-workbench .show-file-icons .file-icon.terminal-tab::before { color: ${n}; }`),t+=NJi(e,!0),this._styleElement.textContent=t}};Hst=I([m(1,Yo),m(2,De),m(3,iy),m(4,ee)],Hst);var Tfe=class extends C{constructor(e,t,o,n){super();this._telemetryService=n;this._register(t.onDidCreateInstance(async r=>{let s=new P;this._store.add(s),await Promise.race([r.processReady.then(()=>Pi(1e4)),H.toPromise(r.onDisposed,s),H.toPromise(e.onWillShutdown,s)]);let l=!1;try{let u=o.getInputFromResource(r.resource).group?.windowId;l=!!(u&&Cy(qv(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 Im(ban(o)),promptType:new Im(e.capabilities.get(6)?.promptType),isCustomPtyImplementation:!!o.customPtyImplementation,isExtensionOwnedTerminal:!!o.isExtensionOwnedTerminal,isLoginShell:(Ae(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,terminalSessionId:e.sessionId})}};Tfe=I([m(0,ao),m(1,Yo),m(2,xv),m(3,Te)],Tfe);var gan=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"]),fan=[{regex:/^(?:pwsh|powershell)-preview$/i,type:"pwsh-preview"},{regex:/^python(?:\d+(?:\.\d+)?)?$/i,type:"python"}],van=[{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 ban(a){if(!a.executable)return"unknown";let e=No(a.executable).replace(/\.[^\.]+$/,"");for(let t of van)if(t.regex.test(a.executable))return t.type;for(let t of fan)if(t.regex.test(e))return t.type;return gan.has(e)?e:"unknown"}var JBe=class extends C{constructor(e,t,o,n,r){super();this._tabContainer=t;this._commandService=o;this._terminalChatService=n;this._terminalService=r;this._entry=R(e,_(".terminal-tabs-chat-entry")),this._entry.tabIndex=0,this._entry.setAttribute("role","button");let s=R(this._entry,_(".terminal-tabs-entry"));R(s,_(".terminal-tabs-chat-entry-icon")).classList.add(...q.asClassNameArray(M.commentDiscussionSparkle)),this._label=R(s,_(".terminal-tabs-chat-entry-label")),this._deleteButton=R(s,_(".terminal-tabs-chat-entry-delete")),this._deleteButton.classList.add(...q.asClassNameArray(M.trashcan)),this._deleteButton.tabIndex=0,this._deleteButton.setAttribute("role","button"),this._deleteButton.setAttribute("aria-label",d(14219,null)),this._deleteButton.setAttribute("title",d(14220,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(14223,null);this._entry.setAttribute("title",t),this._tabContainer.classList.contains("has-text")?this._label.textContent=e===1?d(14222,null,e):d(14221,null,e):this._label.textContent=`${e}`;let n=e===1?d(14218,null):d(14217,null,e);this._entry.setAttribute("aria-label",n)}};JBe=I([m(2,ge),m(3,kv),m(4,Yo)],JBe);var Ust=_;var ZBe=class extends C{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=Ust(".tabs-container");let f=Ust(".tabs-list-container");this._tabListContainer=f,this._tabListElement=Ust(".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(Noe,this._tabListElement)),this._tabListDomElement=this._tabList.getHTMLElement(),this._chatEntry=this._register(this._instantiationService.createInstance(JBe,f,this._tabContainer));let v=Ust(".terminal-outer-container");this._terminalContainer=Ust(".terminal-groups-container"),v.appendChild(this._terminalContainer),this._terminalService.setContainers(e,this._terminalContainer),this._terminalIsTabsNarrowContextKey=at.tabsNarrow.bindTo(h),this._terminalTabsFocusContextKey=at.tabsFocus.bindTo(h),this._terminalTabsMouseContextKey=at.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(H.any(this._terminalGroupService.onDidChangeInstances,this._terminalGroupService.onDidChangeGroups)(()=>{this._refreshShowTabs(),this._updateChatTerminalsEntry()})),this._register(H.any(this._terminalChatService.onDidRegisterTerminalInstanceWithToolSession,this._terminalService.onDidChangeInstances,this._terminalService.onDidDisposeInstance)(()=>{this._refreshShowTabs(),this._updateChatTerminalsEntry()})),this._register(h.onDidChangeContext(b=>{b.affectsSome(new Set([ide.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 vu(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=Me(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:()=>C.None,priority:2},Wl.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:()=>C.None,priority:1},Wl.Distribute,this._tabTreeIndex),this.rerenderTabs()}rerenderTabs(){this._updateHasText(),this._tabList.refresh()}_addSashListener(){let e;this._sashDisposables=[this._splitView.sashes[0].onDidStart(t=>{e=MI(Me(this._splitView.el),()=>{this.rerenderTabs()},100)}),this._splitView.sashes[0].onDidEnd(t=>{e.dispose()})]}_removeSashListener(){this._sashDisposables&&(Ue(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||aQ(Me(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)),aQ(Me(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&&gu(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=WWe(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=sG(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 li,this._configurationService.inspect("terminal.integrated.tabs.location").userValue==="left"?new st("moveRight",d(14216,null),void 0,void 0,async()=>{this._configurationService.updateValue("terminal.integrated.tabs.location","right")}):new st("moveLeft",d(14215,null),void 0,void 0,async()=>{this._configurationService.updateValue("terminal.integrated.tabs.location","left")}),new st("hideTabs",d(14214,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(H.once(this._terminalService.onDidChangeConnectionState)(()=>{sa(e)&&this._focus(),this._store.delete(t)}))}}focusHover(){if(this._shouldShowTabs()){this._tabList.focusHover();return}let e=this._terminalGroupService.activeInstance;e&&this._hoverService.showInstantHover({...Sfe(e,this._storageService),target:this._terminalContainer,trapFocus:!0},!0)}_focus(){this._terminalGroupService.activeInstance?.focusWhenReady()}};ZBe=I([m(1,Yo),m(2,kv),m(3,ku),m(4,jl),m(5,F),m(6,ze),m(7,B),m(8,qt),m(9,le),m(10,X),m(11,tt)],ZBe);var eHe=class extends zr{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 P);this._actionDisposables=this._register(new jt);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=at.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"),hr(this._parentDomElement),this._instantiationService.createInstance(Gst,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(14234,null),run:()=>this.configurationService.updateValue("terminal.integrated.fontFamily","monospace")}];this._notificationService.prompt(St.Warning,d(14233,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(ZBe,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 P,r=n.add(new class extends st{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 Lr(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(zst,e);return this._actionDisposables.set(e.id,o),o}case"workbench.action.terminal.focus":{if(e instanceof Eo){let o=Uc(this._singleTabMenu.getActions({shouldForwardArgs:!0})),n=this._instantiationService.createInstance(Kst,e,o);return this._actionDisposables.set(e.id,n),n}break}case"workbench.action.terminal.new":if(e instanceof Eo){this._disposableStore.clear();let o=yfe(1,this._terminalProfileService.availableProfiles,this._getDefaultProfileName(),this._terminalProfileService.contributedProfiles,this._terminalService,this._dropdownMenu,this._disposableStore,this._configurationService);return this._newDropdown.value=this._instantiationService.createInstance(dI,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=yfe(1,e,this._getDefaultProfileName(),this._terminalProfileService.contributedProfiles,this._terminalService,this._dropdownMenu,this._disposableStore,this._configurationService);this._newDropdown.value?.update(t.dropdownAction,t.dropdownMenuActions),this._disposableStore.add(this._configurationService.onDidChangeConfiguration(o=>{if(o.affectsConfiguration("terminal.integrated.experimental.aiProfileGrouping")){let n=yfe(1,e,this._getDefaultProfileName(),this._terminalProfileService.contributedProfiles,this._terminalService,this._dropdownMenu,this._disposableStore,this._configurationService);this._newDropdown.value?.update(n.dropdownAction,n.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(H.once(this._terminalService.onDidChangeConnectionState)(()=>{e&&sa(e)&&this._terminalGroupService.showPanel(!0),this._store.delete(t)}))}}_hasWelcomeScreen(){return!this._terminalService.isProcessSupportRegistered}shouldShowWelcome(){return this._hasWelcomeScreen()&&this._terminalService.instances.length===0}};eHe=I([m(1,_e),m(2,X),m(3,Ri),m(4,B),m(5,ze),m(6,F),m(7,Yo),m(8,ku),m(9,jl),m(10,De),m(11,tt),m(12,Ne),m(13,_e),m(14,Qe),m(15,qt),m(16,iy),m(17,Sg)],eHe);var zst=class extends h1{constructor(e,t,o,n,r,s){super(null,e,nCo(t,o),o.activeGroupIndex,n,pE,{ariaLabel:d(14236,null),optionsAsChildren:!0,useCustomDrawn:!HS(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=wt(PN)}_updateItems(){let e=nCo(this._terminalService,this._terminalGroupService);this.setOptions(e,this._terminalGroupService.activeGroupIndex)}};zst=I([m(1,Yo),m(2,jl),m(3,_n),m(4,iy),m(5,B)],zst);function nCo(a,i){let e;return a.connectionState===1?e=i.getGroupLabels().map(t=>({text:t})):e=[{text:d(14235,null)}],e.push(jN),e.push({text:ZNi}),e}var Kst=class extends ml{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(e,{draggable:!0,hoverDelegate:g.createInstance($st)},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(H.debounce(H.any(this._terminalService.onAnyInstancePrimaryStatusChange,this._terminalGroupService.onDidChangeActiveInstance,H.map(this._terminalService.onAnyInstanceIconChange,v=>v.instance),this._terminalService.onAnyInstanceTitleChange,this._terminalService.onDidChangeInstanceCapability),(v,b)=>(v||(v=new Set),b&&v.add(b),v),QD)(v=>{for(let b of v)this.updateLabel(b)})),this._register(Z(()=>Ue(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){Fi(t,"");return}t.classList.add("single-terminal-tab");let n="",r=o.statusList.primary;if(r){let c=ujt(r.severity);this._themeService.getColorTheme();let u=this._themeService.getColorTheme().getColor(c);u&&(n=u.toString())}t.style.color=n,Fi(t,...Bn(this._instantiationService.invokeFunction(San,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=oy(o);s&&(this._color=s,t.classList.add(s));let l=z_(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 bfe;this._contextMenuService.showContextMenu({actionRunner:e,getAnchor:()=>this.element,getActions:()=>this._actions,getActionsContext:()=>{let t=this._terminalGroupService.activeInstance;return t?[new sQ(t)]:[]},onHide:()=>e.dispose()})}};Kst=I([m(2,_e),m(3,Ne),m(4,X),m(5,De),m(6,Yo),m(7,ku),m(8,jl),m(9,ze),m(10,ge),m(11,F),m(12,Bi)],Kst);function San(a,i,e,t){if(!i||!i.title)return"";let o=q.isThemeIcon(i.icon)?i.icon.id:a.get(Sg).getDefaultIcon().id,n=`$(${t?.id||o}) ${Ian(i,e)}`,r=i.statusList.primary;return r?.icon?`${n} $(${r.icon.id})`:n}function Ian(a,i){return a?a.description?`${a.title} ${i} ${a.description}`:a.title:""}var Gst=class extends Jd{constructor(e,t,o,n){super(t);this._themeService=t;this._terminalService=o;this._terminalGroupService=n;this._registerListeners(),this._styleElement=hr(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&&Wo(n,{light:!0,dark:!0})&&(r=Ip(e.type)?n.dark:n.light);let s=z_(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: ${Na(r)};}`)}for(let o of this._terminalService.instances){let n=oy(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}};Gst=I([m(1,De),m(2,Yo),m(3,jl)],Gst);var $st=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=Sfe(t,this._storageService);return this._hoverService.showInstantHover({...i,content:o.content,actions:o.actions},e)}onDidHideHover(){this._lastHoverHideTime=Date.now()}};$st=I([m(0,B),m(1,tt),m(2,le),m(3,jl)],$st);we(Xs,MBe,1);we(ku,BBe,1);we(Yo,Dw,1);we(xv,zBe,1);we(sX,PBe,1);we(jl,GBe,1);we(xm,xfe,1);we(iy,Efe,1);pt(kfe.ID,kfe,ut.BlockStartup);pt(ffe.ID,ffe,ut.AfterRestored);pt(Tfe.ID,Tfe,ut.AfterRestored);ZXi();Two(Fft);oe.as(rn.EditorFactory).registerEditorSerializer(ef.ID,UBe);oe.as(rn.EditorPane).registerEditorPane(ys.create(HBe,Mz,er.terminal),[new Mt(ef)]);oe.as(mW.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===Y.vscodeTerminal);e.length&&i.dataTransfer?.setData("Terminals",JSON.stringify(e.map(({resource:t})=>t.toString())))}});var yan=oe.as(on.ViewContainersRegistry).registerViewContainer({id:dc,title:L(14060,"Terminal"),icon:vki,ctorDescriptor:new Mt(Ha,[dc,{mergeViewWithContainerWhenSingleView:!0}]),storageId:dc,hideIfEmpty:!0,order:3,windowVisibility:3},1,{doNotRegisterOpenCommand:!0,isDefault:!0});oe.as(on.ViewsRegistry).registerViews([{id:dc,name:L(14060,"Terminal"),containerIcon:vki,canToggleVisibility:!0,canMoveView:!0,ctorDescriptor:new Mt(eHe),windowVisibility:3,openCommandActionDescriptor:{id:"workbench.action.terminal.toggleTerminal",mnemonicTitle:d(14059,null),keybindings:{primary:2139,mac:{primary:347}},order:3}}],yan);zwo();$wo();Qwo();AJi();var Foe=class extends C{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:$6e(r.collection),descriptionMap:q6e(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:yde(this.collections.get(n).map),description:G6e(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 $Be(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([OM(1e3)],Foe.prototype,"_persistCollectionsEventually",1),I([Nd(1e3)],Foe.prototype,"_notifyCollectionUpdatesEventually",1),Foe=I([m(0,lt),m(1,le)],Foe);we(Uz,Foe,1);we(YBe,Sjt,1);var tHe=class extends C{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")}};tHe=I([m(1,B),m(2,Xs)],tHe);var _fe=class extends C{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(){x.and(ud,x.equals(Kd.key,"terminal-help"))?.evaluate(this._contextKeyService.getContext(null))?this._commandService.executeCommand("workbench.action.terminal.focusAccessibleBuffer"):this._instance.focus(),this.dispose()}provideContent(){let e=[d(14514,null,"workbench.action.terminal.focusAccessibleBuffer"),d(14524,null),d(14523,null,"workbench.action.terminal.openDetectedLink"),d(14521,null,"workbench.action.terminal.newWithProfile"),d(14515,null,"terminal.integrated.focusAfterRun")];return this._configurationService.getValue("terminal.integrated.accessibleViewFocusOnCommandExecution")||e.push(d(14516,null)),this._configurationService.getValue("terminal.integrated.suggest.enabled")&&(e.push(d(14532,null,"workbench.action.terminal.triggerSuggest")),e.push(d(14527,null)),e.push(d(14528,null,"workbench.action.terminal.acceptSelectedSuggestion","workbench.action.terminal.configureSuggestSettings")),e.push(d(14529,null,"workbench.action.terminal.suggestToggleDetails","workbench.action.terminal.suggestToggleDetailsFocus")),e.push(d(14531,null,"workbench.action.terminal.suggestLearnMore")),e.push(d(14530,null,"workbench.action.terminal.configureSuggestSettings"))),this._instance.shellType==="cmd"&&e.push(d(14513,null)),this._hasShellIntegration?(e.push(d(14526,null)),e.push("- "+d(14517,null,"workbench.action.terminal.accessibleBufferGoToNextCommand")),e.push("- "+d(14518,null,"workbench.action.terminal.accessibleBufferGoToPreviousCommand")),e.push("- "+d(14520,null,"editor.action.accessibleViewGoToSymbol")),e.push("- "+d(14525,null,"workbench.action.terminal.runRecentCommand")),e.push("- "+d(14519,null,"workbench.action.terminal.goToRecentDirectory"))):e.push(d(14522,null)),e.join(`
`)}};_fe=I([m(2,ge),m(3,B),m(4,X)],_fe);var iHe=class extends C{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(_w(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}};iHe=I([m(3,B),m(4,Yo)],iHe);var Woe=class extends C{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(H.runAndSubscribe(H.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=H.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([Nd(50)],Woe.prototype,"_sync",1),Woe=I([m(1,Bi),m(2,B),m(3,Xs)],Woe);var Voe=class extends P{constructor(e,t){super();this._ctx=e;this._instantiationService=t}static{this.ID="terminal.textAreaSync"}static get(e){return e.getContribution(Voe.ID)}layout(e){this._addon||(this._addon=this.add(this._instantiationService.createInstance(Woe,this._ctx.instance.capabilities)),e.raw.loadAddon(this._addon),this._addon.activate(e.raw))}};Voe=I([m(1,F)],Voe);up(Voe.ID,Voe);var IH=class extends C{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(dTe.addImplementation(90,"terminal",()=>this._terminalService.activeInstance!==this._ctx.instance?!1:(this.show(),!0),at.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(IH.ID)}xtermReady(e){let t=this._instantiationService.createInstance(Woe,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=H.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 Kd.getValue(this._contextKeyService)==="terminal"}show(){if(!this._xterm)return;this._bufferTracker||(this._bufferTracker=this._register(this._instantiationService.createInstance(tHe,this._xterm))),this._bufferProvider||(this._bufferProvider=this._register(this._instantiationService.createInstance(iHe,this._ctx.instance,this._bufferTracker,()=>this._register(this._instantiationService.createInstance(_fe,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;!ri&&s?(this._accessibleViewService.setPosition(new Ie(r.lineNumber,1),!0),Jo(s)):this._accessibleViewService.setPosition(new Ie(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(_w(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}};IH=I([m(1,tr),m(2,Wd),m(3,B),m(4,X),m(5,F),m(6,Yo)],IH);up(IH.ID,IH);var Ijt=class extends C{constructor(){super(),this._register(Ade.addImplementation(105,"terminal",async i=>{let e=i.get(F),t=i.get(Yo),o=i.get(Wd),n=await t.getActiveOrCreateInstance();await t.revealActiveTerminal();let r=n?.xterm;r&&o.show(e.createInstance(_fe,n,r))},x.or(at.focus,x.and(ud,x.equals(Kd.key,"terminal")))))}};up(Ijt.ID,Ijt);var dOi=class extends K{constructor(){super({id:"workbench.action.terminal.focusAccessibleBuffer",title:L(14510,"Focus Accessible Terminal View"),precondition:x.or(at.processSupported,at.terminalHasBeenCreated),keybinding:[{primary:572,secondary:[2064],linux:{primary:1596,secondary:[2064]},weight:200,when:x.and($a,at.focus)}]})}async run(i,...e){let o=await i.get(Yo).getActiveOrCreateInstance();o?.xterm&&IH.get(o)?.show()}};W(dOi);Sr({id:"workbench.action.terminal.accessibleBufferGoToNextCommand",title:L(14508,"Accessible Buffer Go to Next Command"),precondition:x.or(at.processSupported,at.terminalHasBeenCreated,x.and(ud,x.equals(Kd.key,"terminal"))),keybinding:[{primary:530,when:x.and(x.and(ud,x.equals(Kd.key,"terminal"))),weight:202}],run:async a=>{let i=a.service.activeInstance;i&&IH.get(i)?.navigateToCommand("next")}});Sr({id:"workbench.action.terminal.accessibleBufferGoToPreviousCommand",title:L(14509,"Accessible Buffer Go to Previous Command"),precondition:x.and(x.or(at.processSupported,at.terminalHasBeenCreated),x.and(ud,x.equals(Kd.key,"terminal"))),keybinding:[{primary:528,when:x.and(x.and(ud,x.equals(Kd.key,"terminal"))),weight:202}],run:async a=>{let i=a.service.activeInstance;i&&IH.get(i)?.navigateToCommand("previous")}});Sr({id:"workbench.action.terminal.scrollToBottomAccessibleView",title:L(14511,"Scroll to Accessible View Bottom"),precondition:x.and(x.or(at.processSupported,at.terminalHasBeenCreated),x.and(ud,x.equals(Kd.key,"terminal"))),keybinding:{primary:2061,linux:{primary:1037},when:Kd.isEqualTo("terminal"),weight:200},run:(a,i)=>{let e=i.get(Wd),t=e.getLastPosition();t&&e.setPosition(t,!0)}});Sr({id:"workbench.action.terminal.scrollToTopAccessibleView",title:L(14512,"Scroll to Accessible View Top"),precondition:x.and(x.or(at.processSupported,at.terminalHasBeenCreated),x.and(ud,x.equals(Kd.key,"terminal"))),keybinding:{primary:2062,linux:{primary:1038},when:Kd.isEqualTo("terminal"),weight:200},run:(a,i)=>i.get(Wd)?.setPosition(new Ie(1,1),!0)});var oHe=class extends C{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(Ev);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(Ev);for(let r of Object.keys(n.autoReplies)){let s=n.autoReplies[r];s&&e.installAutoReply(r,s)}}}))}};oHe=I([m(0,B),m(1,xm)],oHe);pt(oHe.ID,oHe,ut.AfterRestored);var aCo=!1,xan=[{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 lCo(a,i){let e=i.getTools(void 0);if(!e||aCo)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 xan){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 aCo=!0,o.join(`  
`)}async function lQ(a,i){let e=new P,t=new Go,o=e.add(new Dt(()=>t.complete(),i));return e.add(a(()=>o.schedule())),o.schedule(),t.p.finally(()=>e.dispose())}function kan(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 cCo(a,i,e,t){await lQ(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=kan(r);if(c.detected)return c}catch{}await lQ(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 qst(a,i,e){let t=new Go,o=a.onData,n=e.add(new Dt(()=>{t.complete()},i)),r=0,s=e.add(new Dt(()=>{if(r===2||r===3){s.cancel();return}r=3,n.schedule()},1e3)),l;return(g=>(g[g.Initial=0]="Initial",g[g.Prompt=1]="Prompt",g[g.Executing=2]="Executing",g[g.PromptAfterExecuting=3]="PromptAfterExecuting"))(l||={}),e.add(o(c=>{let u=c.matchAll(/(?:\x1b\]|\x9d)[16]33;(?<type>[ACD])(?:;.*)?(?:\x1b\\|\x07|\x9c)/g);for(let p of u)p.groups?.type==="A"?r===0?r=1:r===2&&(r=3):(p.groups?.type==="C"||p.groups?.type==="D")&&(r=2);r===3?(s.cancel(),n.schedule()):(n.cancel(),r===0||r===1?s.schedule():s.cancel())})),t.p}function nHe(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()})};r(),t.add(Z(()=>{n.dispose(),i.clear(),e(void 0)})),t.add(i)}function rHe(a,i,e){let t=new Go,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}var sHe=class extends C{constructor(e,t,o,n){super();this._instance=e;this._hasReceivedUserInput=t;this._commandDetection=o;this._logService=n;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 P;try{let r=qst(this._instance,1e3,n),s=Promise.race([H.toPromise(this._commandDetection.onCommandFinished,n).then(b=>(this._log("onDone 1 of 2 via end event, waiting for short idle prompt"),r.then(()=>(this._log("onDone 2 of 2 via short idle prompt"),{type:"success",command:b})))),H.toPromise(t.onCancellationRequested,n).then(()=>{this._log("onDone via cancellation")}),H.toPromise(this._instance.onDisposed,n).then(()=>(this._log("onDone via terminal disposal"),{type:"disposal"})),qst(this._instance,3e3,n).then(()=>{this._log("onDone long idle prompt")})]);this._log("Waiting for xterm");let l=await this._instance.xtermReadyPromise;if(!l)throw new Error("Xterm is not available");let c=rHe(l,n,this._log.bind(this));this._log("Waiting for idle"),await lQ(this._instance.onData,1e3),nHe(l,this._startMarker,b=>this._onDidCreateStartMarker.fire(b),n,this._log.bind(this)),this._hasReceivedUserInput()&&(this._log("Command timed out, sending SIGINT and retrying"),await this._instance.sendText("",!1),await lQ(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}\``),this._instance.sendText(e,!0),this._log("Waiting for done event");let u=await Promise.race([s,c.then(()=>({type:"alternateBuffer"}))]);if(u&&u.type==="disposal")throw new Error("The terminal was closed");if(u&&u.type==="alternateBuffer")return this._log("Detected alternate buffer entry, skipping output capture"),{output:void 0,exitCode:void 0,error:"alternateBuffer",didEnterAltBuffer:!0};let p=u&&u.type==="success"?u.command:void 0;if(p?this._log(`Finished command id=${p.id??"none"} for requested=${o??"none"}`):o&&this._log(`No finished command surfaced for requested=${o}`),this._log("Waiting for idle"),await lQ(this._instance.onData,1e3),t.isCancellationRequested)throw new ho;let h=n.add(l.raw.registerMarker()),g,f=[];if(p){let b=p?.getOutput();b!==void 0&&(this._log("Fetched output via finished command"),g=b)}if(g===void 0)try{g=l.getContentsAsText(this._startMarker.value,h),this._log("Fetched output via markers")}catch{this._log("Failed to fetch output via markers"),f.push("Failed to retrieve command output")}g!==void 0&&g.trim().length===0&&f.push("Command produced no output");let v=p?.exitCode;return Xo(v)&&v>0&&f.push(`Command exited with code ${v}`),{output:g,additionalInformation:f.length>0?f.join(`
`):void 0,exitCode:v}}finally{n.dispose()}}_log(e){this._logService.debug(`RunInTerminalTool#Basic: ${e}`)}};sHe=I([m(3,Xs)],sHe);var aHe=class extends C{constructor(e,t,o){super();this._instance=e;this._hasReceivedUserInput=t;this._logService=o;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 P;try{if(t.isCancellationRequested)throw new ho;this._log("Waiting for xterm");let r=await this._instance.xtermReadyPromise;if(!r)throw new Error("Xterm is not available");let s=rHe(r,n,this._log.bind(this));if(this._log("Waiting for idle"),await lQ(this._instance.onData,1e3),t.isCancellationRequested)throw new ho;nHe(r,this._startMarker,g=>this._onDidCreateStartMarker.fire(g),n,this._log.bind(this)),this._hasReceivedUserInput()&&(this._log("Command timed out, sending SIGINT and retrying"),await this._instance.sendText("",!1),await lQ(this._instance.onData,100)),this._log(`Executing command line \`${e}\``),this._instance.sendText(e,!0),this._log("Waiting for idle with prompt heuristics");let l=await Promise.race([cCo(this._instance.onData,this._instance,1e3,1e4),s.then(()=>"alternateBuffer")]);if(l==="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 c=l;if(this._log(`Prompt detection result: ${c.detected?"detected":"not detected"} - ${c.reason}`),t.isCancellationRequested)throw new ho;let u=n.add(r.raw.registerMarker()),p,h=[];try{p=r.getContentsAsText(this._startMarker.value,u),this._log("Fetched output via markers")}catch{this._log("Failed to fetch output via markers"),h.push("Failed to retrieve command output")}return{output:p,additionalInformation:h.length>0?h.join(`
`):void 0,exitCode:void 0}}finally{n.dispose()}}_log(e){this._logService.debug(`RunInTerminalTool#None: ${e}`)}};aHe=I([m(2,Xs)],aHe);var lHe=class extends C{constructor(e,t,o){super();this._instance=e;this._commandDetection=t;this._logService=o;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 P;try{this._log("Waiting for xterm");let r=await this._instance.xtermReadyPromise;if(!r)throw new Error("Xterm is not available");let s=rHe(r,n,this._log.bind(this)),l=Promise.race([H.toPromise(this._commandDetection.onCommandFinished,n).then(v=>(this._log("onDone via end event"),{type:"success",command:v})),H.toPromise(t.onCancellationRequested,n).then(()=>{this._log("onDone via cancellation")}),H.toPromise(this._instance.onDisposed,n).then(()=>(this._log("onDone via terminal disposal"),{type:"disposal"})),qst(this._instance,1e3,n).then(()=>{this._log("onDone via idle prompt")})]);nHe(r,this._startMarker,v=>this._onDidCreateStartMarker.fire(v),n,this._log.bind(this)),this._log(`Executing command line \`${e}\``),this._instance.runCommand(e,!0,o),this._log("Waiting for done event");let c=await Promise.race([l,s.then(()=>({type:"alternateBuffer"}))]);if(c&&c.type==="disposal")throw new Error("The terminal was closed");if(c&&c.type==="alternateBuffer")return this._log("Detected alternate buffer entry, skipping output capture"),{output:void 0,exitCode:void 0,error:"alternateBuffer",didEnterAltBuffer:!0};let u=c&&c.type==="success"?c.command:void 0;if(t.isCancellationRequested)throw new ho;let p=n.add(r.raw.registerMarker()),h,g=[];if(u){let v=u?.getOutput();v!==void 0&&(this._log("Fetched output via finished command"),h=v)}if(h===void 0)try{h=r.getContentsAsText(this._startMarker.value,p),this._log("Fetched output via markers")}catch{this._log("Failed to fetch output via markers"),g.push("Failed to retrieve command output")}h!==void 0&&h.trim().length===0&&g.push("Command produced no output");let f=u?.exitCode;return Xo(f)&&f>0&&g.push(`Command exited with code ${f}`),{output:h,additionalInformation:g.length>0?g.join(`
`):void 0,exitCode:f}}finally{n.dispose()}}_log(e){this._logService.debug(`RunInTerminalTool#Rich: ${e}`)}};lHe=I([m(2,Xs)],lHe);function bG(a){return!!a&&"sourceText"in a}function uOi(a){return!!a&&"type"in a&&a.type==="npmScript"}function ox(a,i){return i===1?/^(?:powershell|pwsh)(?:-preview)?$/i.test(Ms.basename(a).replace(/\.exe$/i,"")):/^(?:powershell|pwsh)(?:-preview)?$/.test(Lo.basename(a))}function dCo(a){return a.endsWith("System32\\WindowsPowerShell\\v1.0\\powershell.exe")}function cHe(a,i){return i===1?/^zsh(?:\.exe)?$/i.test(Ms.basename(a)):/^zsh$/.test(Lo.basename(a))}function wjt(a,i){return i===1?/^bash(?:\.exe)?$/i.test(Ms.basename(a)):/^bash$/.test(Lo.basename(a))}function Cjt(a,i){return i===1?/^fish(?:\.exe)?$/i.test(Ms.basename(a)):/^fish$/.test(Lo.basename(a))}var yjt=`

[... PREVIOUS OUTPUT TRUNCATED ...]

`;function uCo(a,i){if(a.length<=i)return a;let e=yjt.length;if(e>=i)return yjt.slice(yjt.length-i);let t=i-e,o=a.slice(-t);return yjt+o}function pCo(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(si(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 li),(n.length>0?n[0].split(" ")[0]:"")!==a&&!s.has(a)&&!l.has(a)&&(t.push({label:d(14587,null),data:{type:"newRule",rule:{key:`/^${Yr(a)}$/`,value:{approve:!0,matchCommandLine:!0},scope:"session"}}}),t.push({label:d(14588,null),data:{type:"newRule",rule:{key:`/^${Yr(a)}$/`,value:{approve:!0,matchCommandLine:!0},scope:"workspace"}}}),t.push({label:d(14586,null),data:{type:"newRule",rule:{key:`/^${Yr(a)}$/`,value:{approve:!0,matchCommandLine:!0},scope:"user"}}}))}return t.length>0&&t.push(new li),t.push({label:d(14583,null),tooltip:d(14584,null),data:{type:"sessionApproval"}}),t.push(new li),t.push({label:d(14585,null),data:{type:"configure"}}),t}function pOi(a){return a.filter((i,e,t)=>{if(!bG(i.rule))return!1;let o=i.rule.sourceText;return t.findIndex(n=>bG(n.rule)&&n.rule.sourceText===o)===e})}function xjt(a,i,e){let t=ox(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 mCo=16e3;function jst(a,i){if(!a.xterm||!a.xterm.raw)return"";let e=a.xterm.raw.buffer.active,t=Math.max(i?.line??0,0),o=e.length,n=new Array(o-t);for(let s=t;s<o;s++){let l=e.getLine(s);n[s-t]=l?l.translateToString(!0):""}let r=n.join(`
`);return r.length>mCo&&(r=uCo(r,mCo)),r}var kjt=class{present(i){let e=i.commandLine.forDisplay,t=Ean(e,i.shell,i.os);if(t)return{commandLine:t,language:"javascript",languageDisplayName:"Node.js"}}};function Ean(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 ox(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 Ejt=class{present(i){let e=i.commandLine.forDisplay,t=Tan(e,i.shell,i.os);if(t)return{commandLine:t,language:"python",languageDisplayName:"Python"}}};function Tan(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 ox(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 Tjt=class{present(i){let e=i.commandLine.forDisplay,t=_an(e,i.shell,i.os);if(t)return{commandLine:t,language:"ruby",languageDisplayName:"Ruby"}}};function _an(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?(ox(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 SG=ae("terminalSandboxService"),dHe=class extends C{constructor(e,t,o,n,r,s){super();this._configurationService=e;this._fileService=t;this._environmentService=o;this._logService=n;this._remoteAgentService=r;this._trustedDomainService=s;this._srtPathResolved=!1;this._needsForceUpdateConfigFile=!0;this._remoteEnvDetails=null;this._os=zo;this._defaultWritePaths=["~/.npm"];this._pathJoin=(...e)=>(this._os===1?Ms:Lo).join(...e);this._appRoot=wc(gn.asFileUri("").path);let l=this._environmentService;this._execPath=l.execPath,this._sandboxSettingsId=_t(),this._remoteEnvDetailsPromise=this._remoteAgentService.getEnvironment(),this._register(H.runAndSubscribe(this._configurationService.onDidChangeConfiguration,c=>{(c?.affectsConfiguration("chat.tools.terminal.sandbox.enabled")||c?.affectsConfiguration("chat.tools.terminal.sandbox.network")||c?.affectsConfiguration("chat.tools.terminal.sandbox.linuxFileSystem")||c?.affectsConfiguration("chat.tools.terminal.sandbox.macFileSystem"))&&this.setNeedsForceUpdateConfigFile()})),this._register(this._trustedDomainService.onDidChangeTrustedDomains(()=>{this.setNeedsForceUpdateConfigFile()}))}async isEnabled(){return this._remoteEnvDetails=await this._remoteEnvDetailsPromise,this._os=this._remoteEnvDetails?this._remoteEnvDetails.os:zo,this._os===1?!1:this._configurationService.getValue("chat.tools.terminal.sandbox.enabled")}wrapCommand(e){if(!this._sandboxConfigPath||!this._tempDir)throw new Error("Sandbox config path or temp dir not initialized");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 t=`PATH="$PATH:${wc(this._rgPath)}" TMPDIR="${this._tempDir.path}" "${this._execPath}" "${this._srtPath}" --settings "${this._sandboxConfigPath}" -c ${this._quoteShellArgument(e)}`;return this._remoteEnvDetails?`${t}`:`ELECTRON_RUN_AS_NODE=1 ${t}`}getTempDir(){return this._tempDir}setNeedsForceUpdateConfigFile(){this._needsForceUpdateConfigFile=!0}async getSandboxConfigPath(e=!1){return await this._resolveSrtPath(),(!this._sandboxConfigPath||e||this._needsForceUpdateConfigFile)&&(this._sandboxConfigPath=await this._createSandboxConfig(),this._needsForceUpdateConfigFile=!1),this._sandboxConfigPath}_quoteShellArgument(e){return`'${e.replace(/'/g,"'\\''")}'`}async _resolveSrtPath(){if(this._srtPathResolved)return;this._srtPathResolved=!0;let e=this._remoteEnvDetails||await this._remoteEnvDetailsPromise;e&&(this._appRoot=e.appRoot.path,this._execPath=this._pathJoin(this._appRoot,"node")),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._configurationService.getValue("chat.tools.terminal.sandbox.network")??{},t=this._os===3?this._configurationService.getValue("chat.tools.terminal.sandbox.linuxFileSystem")??{}:{},o=this._os===2?this._configurationService.getValue("chat.tools.terminal.sandbox.macFileSystem")??{}:{},n=A.joinPath(this._tempDir,`vscode-sandbox-settings-${this._sandboxSettingsId}.json`),r=[...this._defaultWritePaths],s=[...new Set([...t.allowWrite??[],...r])],l=[...new Set([...o.allowWrite??[],...r])],c=e.allowedDomains??[];e.allowTrustedDomains&&(c=this._addTrustedDomainsToAllowedDomains(c));let u={network:{allowedDomains:c,deniedDomains:e.deniedDomains??[]},filesystem:{denyRead:this._os===2?o.denyRead:t.denyRead,allowWrite:this._os===2?l:s,denyWrite:this._os===2?o.denyWrite:t.denyWrite}};return this._sandboxConfigPath=n.path,await this._fileService.createFile(n,Je.fromString(JSON.stringify(u,null,"	")),{overwrite:!0}),this._sandboxConfigPath}}async _initTempDir(){if(await this.isEnabled()){this._needsForceUpdateConfigFile=!0;let e=this._remoteEnvDetails||await this._remoteEnvDetailsPromise;if(e)this._tempDir=e.tmpDir;else{let t=this._environmentService;this._tempDir=t.tmpDir}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")}}_addTrustedDomainsToAllowedDomains(e){let t=new Set(e);for(let o of this._trustedDomainService.trustedDomains)try{let n=new URL(o);t.add(n.hostname)}catch{o!=="*"&&t.add(o)}return Array.from(t)}};dHe=I([m(0,B),m(1,be),m(2,Co),m(3,ne),m(4,yo),m(5,_V)],dHe);var uHe=class{constructor(i){this._sandboxService=i}async present(i){if(await this._sandboxService.isEnabled())return{commandLine:i.commandLine.original??i.commandLine.forDisplay,processOtherPresenters:!0}}};uHe=I([m(0,SG)],uHe);var yH=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()),H.toPromise(o.onExit)]);if(!Xo(s)&&yi(s)&&Wo(s,{message:!0}))throw new Error(s.message);let l=this._configurationService.getValue("terminal.integrated.shellIntegration.enabled")===!0,c=djt(this._configurationService,l,o.hasRemoteAuthority,r);if(yH._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 ho;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 Wp(H.toPromise(p.onCommandStarted),2e3)||this._logService.info("ToolTerminalCreator#createTerminal: PromptInputModel state did not change within timeout"))}if(u!=="none")return yH._lastSuccessfulShell=1,n.shellIntegrationQuality=u,n}else this._logService.info(`ToolTerminalCreator#createTerminal: Skipping wait for shell integration - last successful launch type ${yH._lastSuccessfulShell}`);return yH._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=Ae(i)?i:i.path,o={GIT_PAGER:"cat",GIT_MERGE_AUTOEDIT:"no",GIT_EDITOR:":"};this._configurationService.getValue("chat.tools.terminal.preventShellHistory")===!0&&(wjt(t,e)||cHe(t,e)||Cjt(t,e)||ox(t,e))&&(o.VSCODE_PREVENT_SHELL_HISTORY="1");let r={icon:q.fromId(M.chatSparkle.id),hideFromUser:!0,forcePersist:!0,env:o};return Ae(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 P,o=new Go,n=t.add(new me);if(n.value=nn(()=>{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(nn(()=>{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(nn(()=>{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}};yH=I([m(0,B),m(1,Xs),m(2,Yo)],yH);var pHe=class{constructor(i){this._telemetryService=i}logPrepare(i){let e=i.subCommands.map(t=>{let o=t.split(" ")[0],n=o.toLowerCase();if(!Lan.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 Im(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,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})}};pHe=I([m(0,Te)],pHe);var Lan=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 _jt=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 mHe=class extends C{constructor(e){super();this._treeSitterLibraryService=e;this._treeCache=this._register(new mOi);this._commandFileWriteParsers=[new _jt];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 ni("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 Zs("Failed to parse tree");r=c,this._treeCache.set(e,t,r)}let s=await this._treeSitterLibraryService.createQuery(n,o);if(!s)throw new ni("Failed to create tree sitter query");return{tree:r,query:s}}};mHe=I([m(0,F9)],mHe);var mOi=class extends C{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 Ran=[/^(?<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],Man=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"]),Pan=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"]),hHe=class extends C{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 xe(d(14594,null,`\`${n}\``))}:{isAutoApproved:!1}:{isAutoApproved:!1}}_extractScriptName(e){let t=e.trim();for(let o of Ran){let n=t.match(o);if(n?.groups?.scriptName){let{command:r,scriptName:s}=n.groups;if(r.toLowerCase()==="yarn"&&Man.has(s.toLowerCase())||r.toLowerCase()==="pnpm"&&Pan.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 Wx(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}};hHe=I([m(0,B),m(1,be),m(2,dt),m(3,Pe)],hHe);var hOi=/(?!.*)/,Aan=/^[A-Z_][A-Z0-9_]*=/i,gHe=class extends C{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(hHe)),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(Aan.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=ox(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 yi(v)&&Object.prototype.hasOwnProperty.call(v,c)&&VT(v[c],u)},p=t?.default?.value,h=!!(yi(p)&&Object.prototype.hasOwnProperty.call(p,c)&&VT(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 xbe(s)?hOi:s}catch{return hOi}}if(e==="")return hOi;let n;if(e.includes("/")||e.includes("\\")){let r=e.replace(/[/\\]/g,"%%PATH_SEP%%");r=Yr(r),r=r.replace(/%%PATH_SEP%%*/g,"[/\\\\]"),n=`^(?:\\.[/\\\\])?${r}`}else n=Yr(e);return new RegExp(`^${n}\\b`)}};gHe=I([m(0,B),m(1,F),m(2,kv)],gHe);var Oan=["curl","wget"],Fan=["invoke-restmethod","invoke-webrequest","irm","iwr"],fHe=class extends C{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(gHe))}async analyze(e){if(e.chatSessionResource&&this._terminalChatService.hasChatSessionAutoApproval(e.chatSessionResource)){this._log("Session has auto approval enabled, auto approving command");let w=ic("workbench.action.terminal.chat.disableSessionAutoApproval",e.chatSessionResource),k={isTrusted:{enabledCommands:["workbench.action.terminal.chat.disableSessionAutoApproval"]}};return{isAutoApproved:!0,isAutoApproveAllowed:!0,disclaimers:[],autoApproveInfo:new xe(`${d(14598,null)} ([${d(14599,null)}](${w.toString()}))`,k)}}let t=e.commandLine.trimStart(),o;try{o=await this._treeSitterCommandParser.extractSubCommands(e.treeSitterLanguage,t),this._log(`Parsed sub-commands via ${e.treeSitterLanguage} grammar`,o)}catch(w){console.error(w),this._log(`Failed to parse sub-commands via ${e.treeSitterLanguage} grammar`)}let n=!1,r,s;if(!o)return{isAutoApproveAllowed:!1,disclaimers:[]};let l=await Promise.all(o.map(w=>this._commandLineAutoApprover.isCommandAutoApproved(w,e.shell,e.os,e.cwd,e.chatSessionResource))),c=this._commandLineAutoApprover.isCommandLineAutoApproved(t,e.chatSessionResource),u=[...l.map(w=>w.reason),c.reason],p=!1,h,g,f=l.find(w=>w.result==="denied");f?(this._log("Sub-command DENIED auto approval"),p=!0,g=bG(f.rule)?f.rule.isDefaultRule:void 0,h="subCommand"):c.result==="denied"?(this._log("Command line DENIED auto approval"),p=!0,g=bG(c.rule)?c.rule.isDefaultRule:void 0,h="commandLine"):l.every(w=>w.result==="approved")?(this._log("All sub-commands auto-approved"),n=!0,h="subCommand",g=l.every(w=>bG(w.rule)&&w.rule.isDefaultRule)):(this._log("All sub-commands NOT auto-approved"),c.result==="approved"?(this._log("Command line auto-approved"),h="commandLine",n=!0,g=bG(c.rule)?c.rule.isDefaultRule:void 0):this._log("Command line NOT auto-approved"));for(let w of u)this._log(`- ${w}`);let v=this._configurationService.getValue("chat.tools.terminal.enableAutoApprove")===!0,b=this._storageService.getBoolean("chat.tools.terminal.autoApprove.warningAccepted",-1,!1);v&&n?r=this._createAutoApproveInfo(n,p,h,l,c):n=!1,this._telemetry.logPrepare({terminalToolSessionId:e.terminalToolSessionId,subCommands:o,autoApproveAllowed:v?b?"allowed":"needsOptIn":"off",autoApproveResult:n?"approved":p?"denied":"manual",autoApproveReason:h,autoApproveDefault:g});let S=[],y=o.map(w=>w.split(" ")[0].toLowerCase());if(!n&&(y.some(w=>Oan.includes(w))||ox(e.shell,e.os)&&y.some(w=>Fan.includes(w)))&&S.push(d(14605,null)),v&&p){let w=this._createAutoApproveInfo(n,p,h,l,c);w&&S.push(w)}return!n&&v&&(s=pCo(t,o,{subCommandResults:l,commandLineResult:c})),{isAutoApproved:n,isAutoApproveAllowed:!0,disclaimers:S,autoApproveInfo:r,customActions:s}}_createAutoApproveInfo(e,t,o,n,r){let s=p=>Yl(p).filter(h=>bG(h.rule)).map(h=>{let g=h.rule.sourceText.replaceAll("$","\\$");if(h.rule.sourceTarget==="session")return d(14602,null,`\`${g}\``);let f=ic("workbench.action.terminal.chat.openTerminalSettingsLink",h.rule.sourceTarget),v=d(14603,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=ic("workbench.action.terminal.chat.openTerminalSettingsLink","global");return new xe(`${d(14595,null,`[\`chat.tools.global.autoApprove\`](${p.toString()} "${d(14604,null)}")`)}`,l)}if(e)switch(o){case"commandLine":{if(bG(r.rule))return new xe(d(14596,null,s(r)),l);break}case"subCommand":{let p=n.find(g=>uOi(g.rule));if(p&&uOi(p.rule)&&p.rule.npmScriptResult.autoApproveInfo)return p.rule.npmScriptResult.autoApproveInfo;let h=pOi(n);if(h.length===1)return new xe(d(14596,null,s(h)),l);if(h.length>1)return new xe(d(14597,null,s(h)),l);break}}else if(t)switch(o){case"commandLine":{if(r.rule)return new xe(d(14600,null,s(r)),l);break}case"subCommand":{let p=pOi(n.filter(h=>h.result==="denied"));if(p.length===1)return new xe(d(14600,null,s(p)),l);if(p.length>1)return new xe(d(14601,null,s(p)),l);break}}}};fHe=I([m(3,B),m(4,F),m(5,le),m(6,kv)],fHe);var vHe=Symbol("null device"),bHe=class extends C{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===vHe?l:(/^['"].*['"]$/.test(l)&&(l=this._stripSurroundingQuotes(l)),(e.os===1?Ms.isAbsolute(l):Lo.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"?vHe:t:t==="/dev/null"?vHe: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===vHe){this._log("File write to null device allowed",A.isUri(l)?l.toString():l);continue}if(Ae(l)&&!(e.os===1?Ms.isAbsolute(l):Lo.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===vHe)||(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===vHe?"/dev/null":s.toString()}\``).join(", ");o?n.push(d(14607,null,r)):n.push(d(14606,null,r))}return{isAutoApproveAllowed:o,disclaimers:n}}};bHe=I([m(2,B),m(3,ot),m(4,Pe)],bHe);var SHe=class extends C{constructor(e){super();this._sandboxService=e}async analyze(e){return await this._sandboxService.isEnabled()?{isAutoApproveAllowed:!0,forceAutoApproval:!0}:{isAutoApproveAllowed:!0}}};SHe=I([m(0,SG)],SHe);var Dfe=(s=>(s.Initial="Initial",s.Idle="Idle",s.PollingForIdle="PollingForIdle",s.Prompting="Prompting",s.Timeout="Timeout",s.Active="Active",s.Cancelled="Cancelled",s))(Dfe||{});var Boe=class extends C{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,Pi(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=${Dfe[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=${Dfe[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)}`),gOi(t))return this._logService.trace("OutputMonitor: Idle -> non-interactive help pattern detected, stopping"),{shouldContinuePollling:!1,output:t};let o=this._execution.task!==void 0,n=this._execution.isActive?!await this._execution.isActive():!0;if(o&&n&&hCo(t))return this._logService.trace("OutputMonitor: Idle -> VS Code task finish message detected for inactive task, stopping"),{shouldContinuePollling:!1,output:t};if((!o||!n)&&zan(t)){if(this._logService.trace('OutputMonitor: Idle -> generic "press any key" detected'),this._isAutopilotMode())return this._logService.trace('OutputMonitor: Autopilot mode -> auto-replying to "press any key"'),await this._execution.instance.sendText("",!0),{shouldContinuePollling:!0};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 Pi(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 r=await this._determineUserInputOptions(this._execution,e);if(this._logService.trace(`OutputMonitor: Input options result: ${r?`prompt=${this._formatLastLineForLog(r.prompt)}, options=${r.options.length} ${this._formatOptionsForLog(r.options)}, freeForm=${!!r.detectedRequestForFreeFormInput}`:"none"}`),this._userInputtedSinceIdleDetected)return this._logService.trace("OutputMonitor: User input arrived during input-option analysis; continuing polling"),this._cleanupIdleInputListener(),{shouldContinuePollling:!0};if(r?.detectedRequestForFreeFormInput){if(this._userInputtedSinceIdleDetected)return this._logService.trace("OutputMonitor: User input arrived before showing free-form prompt; continuing polling"),this._cleanupIdleInputListener(),{shouldContinuePollling:!0};if((this._configurationService.getValue("chat.tools.terminal.autoReplyToPrompts")||this._isAutopilotMode())&&!this._isSensitivePrompt(r.prompt)){let h=r.suggestedInput??this._extractExplicitInputFromPrompt(r.prompt),g=this._normalizeAutoReplyInput(h);if(g!==void 0)return this._logService.trace("OutputMonitor: Auto-replying to free-form prompt"),await this._execution.instance.sendText(g,!0),this._outputMonitorTelemetryCounters.inputToolAutoAcceptCount++,this._outputMonitorTelemetryCounters.inputToolAutoChars+=g.length,{shouldContinuePollling:!0}}return this._cleanupIdleInputListener(),this._outputMonitorTelemetryCounters.inputToolFreeFormInputShownCount++,this._logService.trace("OutputMonitor: Showing free-form input elicitation"),await this._requestFreeFormTerminalInput(e,this._execution,r)?(this._logService.trace("OutputMonitor: Free-form input received; continuing polling"),await Pi(200),{shouldContinuePollling:!0}):(this._logService.trace("OutputMonitor: Free-form input declined; stopping"),{shouldContinuePollling:!1})}if(r?.options.length){this._logService.trace(`OutputMonitor: Showing option-based input flow (options=${r.options.length})`);let u=await this._selectAndHandleOption(r,e);return this._logService.trace(`OutputMonitor: Suggested option result: ${u?.suggestedOption?"hasSuggestion":"none"} (autoSent=${!!u?.sentToTerminal})`),u?.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,u?.suggestedOption??r.options[0],this._execution,r)?(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 s=await this._pollFn?.(this._execution,e,this._taskService);this._logService.trace(`OutputMonitor: Custom poller result: ${s?"provided":"none"}`);let l=s?.resources,c=this._pollFn?void 0:await this._assessOutputForErrors(this._execution.getOutput(),e);return{resources:l,modelOutputEvalResponse:c,shouldContinuePollling:!1,output:s?.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 Pi(h,o),l+=h,s=Math.min(s*2,r);let g=e.getOutput();if(gOi(g))return this._logService.trace(`OutputMonitor: waitForIdle -> non-interactive help detected (waited=${l}ms)`),this._state="Idle",this._setupIdleInputListener(),this._state;if(Han(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 Tce(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})`),gOi(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 Tce(s);try{let c=l.match(/\{[\s\S]*\}/);if(c){let u=JSON.parse(c[0]);if(yi(u)&&Object.hasOwn(u,"prompt")&&Ae(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=Ae(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(Ae))return{prompt:p.prompt,options:p.options,detectedRequestForFreeFormInput:p.freeFormInput};if(yi(p.options)&&Object.values(p.options).every(Ae)){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}_normalizeAutoReplyInput(e){if(!e)return;let t=e.trim();if(!t)return;let o=t.toLowerCase();return o==="\\r"||o==="\\n"||o==="enter"||o==="return"?"":t}_extractExplicitInputFromPrompt(e){let t=e.trim();if(!t)return;let o=t.match(/\b(?:type|enter|input)\s+["'`]([^"'`]+)["'`]/i);if(o?.[1])return o[1];let n=t.match(/\b(?:type|enter|input)\s+([\w.-]+)\b/i);if(n?.[1])return n[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._languageModelsService.selectLanguageModels({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 Tce(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=Ban(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 xe(d(14627,null)),new xe(d(14629,null,o.prompt)),"",d(14626,null),void 0,()=>(this._showInstance(t.instance.instanceId),r)),c=C.None,u=C.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=Ae(t)?t:t.option,s=Symbol("focusTerminalSelection"),l=C.None,c=C.None,{promise:u,part:p}=this._createElicitationPart(e,o.sessionResource,new xe(d(14624,null)),new xe(d(14625,null,n.prompt,r,Ae(t)?"":t.description?" ("+t.description+")":"")),"",d(14623,null),d(14628,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),Van(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 Eb))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 yge(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._languageModelsService.selectLanguageModels({vendor:"copilot",id:"copilot-fast"});return e.length?e[0]:void 0}};Boe=I([m(5,Wr),m(6,yg),m(7,Si),m(8,At),m(9,B),m(10,Xs),m(11,Yo)],Boe);function Van(a,i){let e=[],t=i.options.filter(n=>n!==(Ae(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 Ban(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 Han(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 gOi(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 Uan=[d(14620,null),d(14630,null),d(14621,null),d(14622,null)];function hCo(a){let i=a.replace(/\s/g,"").toLowerCase();return Uan.some(e=>i.includes(e.replace(/\s/g,"").toLowerCase()))}function zan(a){return hCo(a)?!1:/press a(?:ny)? key/i.test(a)}var Djt=class extends C{rewrite(i){if(!i.cwd)return;let e=xjt(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 IHe=class extends C{constructor(e){super();this._configurationService=e}rewrite(e){if(this._configurationService.getValue("chat.tools.terminal.preventShellHistory")===!0&&(wjt(e.shell,e.os)||cHe(e.shell,e.os)))return{rewritten:` ${e.commandLine}`,reasoning:"Prepended with a space to exclude from shell history"}}};IHe=I([m(0,B)],IHe);var Ljt=class extends C{constructor(e){super();this._treeSitterCommandParser=e}async rewrite(e){if(ox(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 yHe=class extends C{constructor(e){super();this._sandboxService=e}async rewrite(e){return!await this._sandboxService.isEnabled()||!await this._sandboxService.getSandboxConfigPath()?void 0:{rewritten:this._sandboxService.wrapCommand(e.commandLine),reasoning:"Wrapped command for sandbox execution",forDisplay:e.commandLine}}};yHe=I([m(0,SG)],yHe);var wHe=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 imo(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)}};wHe=I([m(0,Xs)],wHe);var CHe=class extends C{constructor(e){super();this._sandboxService=e}async analyze(e){if(!(e.exitCode===void 0||e.exitCode===0)&&await this._sandboxService.isEnabled())return d(14645,null,"chat.tools.terminal.sandbox.linuxFileSystem","chat.tools.terminal.sandbox.macFileSystem","chat.tools.terminal.sandbox.network")}};CHe=I([m(0,SG)],CHe);var fOi="runInTerminal",vCo=["runCommands/runInTerminal"];function Kan(a){let i=dCo(a);return[`This tool allows you to execute ${i?"Windows PowerShell 5.1":"PowerShell"} commands in a persistent terminal session, preserving environment variables, working directory, and other context across multiple commands.`,"","Command Execution:",i?"- 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","","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"].join(`
`)}var vOi=`
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

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`;function Gan(){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.",vOi,"- 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 $an(){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.",vOi,"- 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 qan(){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.",vOi,"- 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 bCo(a){let e=a.get(F).createInstance(xHe),t=await e.getCopilotShell(),o=await e.osBackend,n;return t&&o&&ox(t,o)?n=Kan(t):t&&o&&cHe(t,o)?n=$an():t&&o&&Cjt(t,o)?n=qan():n=Gan(),{id:"run_in_terminal",toolReferenceName:fOi,legacyToolReferenceFullNames:vCo,displayName:d(14643,null),modelDescription:n,userDescription:d(14644,null),source:Rn.Internal,icon:M.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.`},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. 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."}},required:["command","explanation","goal","isBackground","timeout"]}}}var gCo=["\x1B[I","\x1B[O"],fCo=`
`+d(14642,null),eg=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this._chatService=e;this._configurationService=t;this._historyService=o;this._instantiationService=n;this._labelService=r;this._languageModelToolsService=s;this._remoteAgentService=l;this._storageService=c;this._terminalChatService=u;this._logService=p;this._terminalService=h;this._workspaceContextService=g;this._chatWidgetService=f;this._sessionTerminalAssociations=new vt;this._osBackend=this._remoteAgentService.getEnvironment().then(v=>v?.os??zo),this._terminalToolCreator=this._instantiationService.createInstance(yH),this._treeSitterCommandParser=this._register(this._instantiationService.createInstance(mHe)),this._telemetry=this._instantiationService.createInstance(pHe),this._commandArtifactCollector=this._instantiationService.createInstance(wHe),this._profileFetcher=this._instantiationService.createInstance(xHe),this._commandLineRewriters=[this._register(this._instantiationService.createInstance(Djt)),this._register(this._instantiationService.createInstance(Ljt,this._treeSitterCommandParser)),this._register(this._instantiationService.createInstance(IHe)),this._register(this._instantiationService.createInstance(yHe))],this._commandLineAnalyzers=[this._register(this._instantiationService.createInstance(bHe,this._treeSitterCommandParser,(v,b)=>this._logService.info(`RunInTerminalTool#CommandLineFileWriteAnalyzer: ${v}`,b))),this._register(this._instantiationService.createInstance(fHe,this._treeSitterCommandParser,this._telemetry,(v,b)=>this._logService.info(`RunInTerminalTool#CommandLineAutoApproveAnalyzer: ${v}`,b))),this._register(this._instantiationService.createInstance(SHe))],this._commandLinePresenters=[this._instantiationService.createInstance(uHe),new kjt,new Ejt,new Tjt],this._outputAnalyzers=[this._register(this._instantiationService.createInstance(CHe))],this._register(H.runAndSubscribe(this._configurationService.onDidChangeConfiguration,v=>{(!v||v.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(v=>{for(let[b,S]of this._sessionTerminalAssociations.entries())v===S.instance&&this._sessionTerminalAssociations.delete(b)})),this._register(this._chatService.onDidDisposeSession(v=>{for(let b of v.sessionResource)this._cleanupSessionTerminals(b)}))}static{this._activeExecutions=new Map}static getBackgroundOutput(e){let t=eg._activeExecutions.get(e);if(!t)throw new Error("Invalid terminal ID");return t.getOutput()}static getExecution(e){return eg._activeExecutions.get(e)}static removeExecution(e){let t=eg._activeExecutions.get(e);return t?(t.dispose(),eg._activeExecutions.delete(e),!0):!1}async prepareToolInvocation(e,t){let o=e.parameters,n=e.chatSessionResource,r;if(n){let Ze=this._sessionTerminalAssociations.get(n);Ze&&!Ze.isBackground&&(r=Ze.instance)}let[s,l,c]=await Promise.all([this._osBackend,this._profileFetcher.getCopilotShell(),(async()=>{let Ze=await r?.getCwdResource();if(!Ze){let Ti=this._historyService.getLastActiveWorkspaceRoot();Ze=(Ti?this._workspaceContextService.getWorkspaceFolder(Ti)??void 0:void 0)?.uri}return Ze})()]),u=s===1?"pwsh":"sh",p=_t(),h=`tool-${_t()}`,g=o.command,f;for(let Ze of this._commandLineRewriters){let Ti=await Ze.rewrite({commandLine:g,cwd:c,shell:l,os:s});Ti&&(g=Ti.rewritten,f=Ti.forDisplay,this._logService.info(`RunInTerminalTool: Command rewritten by ${Ze.constructor.name}: ${Ti.reasoning}`))}let v={kind:"terminal",terminalToolSessionId:p,terminalCommandId:h,commandLine:{original:o.command,toolEdited:g===o.command?void 0:g,forDisplay:f},cwd:c,language:u,isBackground:o.isBackground},b=lCo(o.command,this._languageModelToolsService);if(b)return v.alternativeRecommendation=b,{confirmationMessages:void 0,presentation:"hidden",toolSpecificData:v};let S=g??o.command,y=()=>{let Ze=this._configurationService.getValue("chat.tools.eligibleForAutoApproval");if(Ze&&typeof Ze=="object"){if(Object.prototype.hasOwnProperty.call(Ze,fOi))return Ze[fOi];for(let Ti of vCo)if(Object.prototype.hasOwnProperty.call(Ze,Ti))return Ze[Ti]}return!0},w=this._configurationService.getValue("chat.tools.terminal.enableAutoApprove")===!0,k=this._storageService.getBoolean("chat.tools.terminal.autoApprove.warningAccepted",-1,!1),T=y()&&w&&k,N={commandLine:S,cwd:c,os:s,shell:l,treeSitterLanguage:ox(l,s)?"powershell":"bash",terminalToolSessionId:p,chatSessionResource:n},O=await Promise.all(this._commandLineAnalyzers.map(Ze=>Ze.analyze(N))),V=O.map(Ze=>Ze.disclaimers).filter(Ze=>!!Ze).flatMap(Ze=>Ze),U;if(V.length>0){let Ze=V.map(bo=>typeof bo=="string"?bo:bo.value),ti=V.some(bo=>typeof bo!="string")?{supportThemeIcons:!0,isTrusted:{enabledCommands:["workbench.action.terminal.chat.openTerminalSettingsLink"]}}:{supportThemeIcons:!0};U=new xe(`$(${M.info.id}) `+Ze.join(" "),ti)}let G=O.every(Ze=>Ze.isAutoApproveAllowed),$=y()&&G?O.map(Ze=>Ze.customActions??[]).flat():void 0,te=No(l,".exe");te==="powershell"&&(te="pwsh");let pe=O.some(Ze=>Ze.isAutoApproved)&&O.every(Ze=>Ze.isAutoApproved!==!1)&&G,de=T&&pe||O.some(Ze=>Ze.forceAutoApproval);(de||w&&O.some(Ze=>Ze.autoApproveInfo))&&(v.autoApproveInfo=O.find(Ze=>Ze.autoApproveInfo)?.autoApproveInfo);let se=(v.commandLine.userEdited??v.commandLine.toolEdited??v.commandLine.original).trimStart(),Se=xjt(se,l,s),ke;if(Se&&c){let Ti=(s===1?Ms.isAbsolute(Se.directory):Lo.isAbsolute(Se.directory))?A.from({scheme:c.scheme,authority:c.authority,path:Se.directory}):A.joinPath(c,Se.directory),ti=this._labelService.getUriLabel(Ti),bo=se.substring(0,se.length-Se.command.length);v.confirmation={commandLine:Se.command,cwdLabel:ti,cdPrefix:bo},ke=o.isBackground?d(14635,null,te,ti):d(14637,null,te,ti)}else v.confirmation={commandLine:se},ke=o.isBackground?d(14634,null,te):d(14633,null,te);let He=Se?.command??se;for(let Ze of this._commandLinePresenters){let Ti=await Ze.present({commandLine:{original:o.command,forDisplay:He},shell:l,os:s});if(Ti){if(v.presentationOverrides={commandLine:Ti.commandLine,language:Ti.language??void 0},Se&&v.confirmation?.cwdLabel?ke=o.isBackground?d(14640,null,Ti.languageDisplayName,te,v.confirmation.cwdLabel):d(14641,null,Ti.languageDisplayName,te,v.confirmation.cwdLabel):ke=o.isBackground?d(14639,null,Ti.languageDisplayName,te):d(14638,null,Ti.languageDisplayName,te),!Ti.processOtherPresenters)break;He=Ti.commandLine}}let Ve=n&&this._isSessionAutoApproveLevel(n);return{confirmationMessages:!de&&!Ve||e.forceConfirmationReason!==void 0?{title:ke,message:new xe(d(14636,null,o.explanation,o.goal)),disclaimer:U,terminalCustomActions:$}:void 0,toolSpecificData:v}}_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&&pz(o.input.currentModeInfo.permissionLevel))return!0;let r=this._chatService.getSession(e)?.getRequests().at(-1);return pz(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}]};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;if(n.isCancellationRequested)throw new ho;let f,v=!l.isBackground&&!this._sessionTerminalAssociations.has(u),b=Date.now(),S=_t(),y=r.terminalToolSessionId,w=new P;this._logService.debug(`RunInTerminalTool: Creating ${l.isBackground?"background":"foreground"} terminal. termId=${S}, chatSessionResource=${u}`);let k=await this._initTerminal(u,S,y,l.isBackground,n);this._handleTerminalVisibility(k,u);let T=Date.now()-b,N=await k.instance.xtermReadyPromise;if(!N)throw new Error("Instance was disposed before xterm.js was ready");let O=k.instance.capabilities.get(2),V=0,U=!1;w.add(N.raw.onData(Ro=>{gCo.includes(Ro)||(V+=Ro.length),U||=Ro===""}));let G="",$=-1,te,pe,de=!1,se=l.isBackground,Se,ke,Ee,He=w.add(new $e(n)),Ve=l.timeout!==void 0?Kn(l.timeout,0,Number.MAX_SAFE_INTEGER):void 0;!l.isBackground&&Ve!==void 0&&Ve>0&&this._configurationService.getValue("chat.tools.terminal.enforceTimeoutFromModel")===!0&&(Se=Pi(Ve),Se.then(()=>{He.token.isCancellationRequested||(de=!0,He.cancel())}));let Fe,Qt=new Promise(Ro=>{Fe=Ro});y&&w.add(this._terminalChatService.onDidContinueInBackground(Ro=>{if(Ro===y){let _o=eg._activeExecutions.get(S);_o&&_o.setBackground(),se=!0,Fe?.()}}));let Ze;try{let Ro=this._instantiationService.createInstance(Qst,u,S,k,O,l.isBackground);k.shellIntegrationQuality==="none"&&(c="$(info) Enable [shell integration](https://code.visualstudio.com/docs/terminal/shell-integration) to improve command detection"),this._logService.debug(`RunInTerminalTool: Using \`${Ro.strategy.type}\` execute strategy for command \`${p}\``),w.add(Ro),eg._activeExecutions.set(S,Ro);let _o=H.toPromise(Ro.strategy.onDidCreateStartMarker);if(w.add(Ro.strategy.onDidCreateStartMarker(sr=>{ke||(ke=w.add(this._instantiationService.createInstance(Boe,{instance:k.instance,sessionResource:u,getOutput:ln=>Ro.getOutput(ln??sr)},void 0,e.context,n,p)))})),Ze=Ro.start(p,He.token,s),l.isBackground){if(this._logService.debug(`RunInTerminalTool: Starting background execution \`${p}\``),await _o,ke&&(await H.toPromise(ke.onDidFinishCommand),Ee=ke.pollingResult),await this._commandArtifactCollector.capture(r,k.instance,s),n.isCancellationRequested)throw new ho;let sr=r.terminalCommandState??{};sr.timestamp=sr.timestamp??b,r.terminalCommandState=sr;let ln=h?`Note: The user manually edited the command to \`${p}\`, and that command is now running in terminal with ID=${S}`:g?`Note: The tool simplified the command to \`${p}\`, and that command is now running in terminal with ID=${S}`:`Command is running in terminal with ID=${S}`;return Ee&&Ee.modelOutputEvalResponse?ln+=`
 The command became idle with output:
${Ee.modelOutputEvalResponse}`:Ee&&(ln+=`
 The command is still running, with output:
${Ee.output}`),{toolMetadata:{exitCode:void 0},content:[{kind:"text",value:ln}]}}else{let sr=await Promise.race([Ze.then(ln=>({type:"completed",result:ln})),Qt.then(()=>({type:"background"}))]);if(sr.type==="background"){this._logService.debug("RunInTerminalTool: Continue in background triggered, returning output collected so far"),f="continueInBackground";let ln=Ro.getOutput();$=ln?IM(ln.trim(),`
`)+1:0,G=ln}else{let ln=sr.result;if(k.receivedUserInput=!1,n.isCancellationRequested)throw new ho;if(ln.didEnterAltBuffer){let en=r.terminalCommandState??{};en.timestamp=en.timestamp??b,r.terminalCommandState=en,c=fCo,$=0,f=ln.error??"alternateBuffer",pe={toolResultMessage:c,toolMetadata:{exitCode:void 0},content:[{kind:"text",value:fCo}]}}else{await this._commandArtifactCollector.capture(r,k.instance,s);{let Ws=r.terminalCommandState??{};Ws.timestamp=Ws.timestamp??b,ln.exitCode!==void 0&&(Ws.exitCode=ln.exitCode,Ws.timestamp!==void 0&&(Ws.duration=Ws.duration??Math.max(0,Date.now()-Ws.timestamp))),r.terminalCommandState=Ws}this._logService.debug(`RunInTerminalTool: Finished \`${Ro.strategy.type}\` execute strategy with exitCode \`${ln.exitCode}\`, result.length \`${ln.output?.length}\`, error \`${ln.error}\``),$=ln.output===void 0?0:IM(ln.output.trim(),`
`)+1,te=ln.exitCode,f=ln.error;let en=[];ln.output!==void 0&&en.push(ln.output),ln.additionalInformation&&en.push(ln.additionalInformation),G=en.join(`

`)}}}}catch(Ro){if(de&&Ro instanceof ho){this._logService.debug("RunInTerminalTool: Timeout reached, returning output collected so far"),f="timeout";let _o=jst(k.instance,void 0);$=_o?IM(_o.trim(),`
`)+1:0,G=_o??""}else{if(this._logService.debug("RunInTerminalTool: Threw exception"),Ro instanceof ho){await this._commandArtifactCollector.capture(r,k.instance,s);let _o=r.terminalCommandState??{};_o.exitCode===void 0&&(_o.exitCode=-1,_o.timestamp=_o.timestamp??b,_o.duration=_o.duration??Math.max(0,Date.now()-_o.timestamp)),r.terminalCommandState=_o}throw eg._activeExecutions.get(S)?.dispose(),eg._activeExecutions.delete(S),k.instance.dispose(),f=Ro instanceof ho?"canceled":"unexpectedException",Ro}}finally{Se?.cancel(),se&&Ze?Ze.catch(_o=>{_o instanceof ho||this._logService.error("RunInTerminalTool: Background execution error",_o)}):(eg._activeExecutions.get(S)?.dispose(),eg._activeExecutions.delete(S)),w.dispose();let Ro=Date.now()-b;this._telemetry.logInvoke(k.instance,{terminalToolSessionId:r.terminalToolSessionId,didUserEditCommand:h,didToolEditCommand:g,isBackground:l.isBackground,shellIntegrationQuality:k.shellIntegrationQuality,error:f,isNewSession:v,outputLineCount:$,exitCode:te,timingExecuteMs:Ro,timingConnectMs:T,inputUserChars:V,inputUserSigint:U,terminalExecutionIdleBeforeTimeout:Ee?.state==="Idle",pollDurationMs:Ee?.pollDurationMs,inputToolManualAcceptCount:ke?.outputMonitorTelemetryCounters?.inputToolManualAcceptCount,inputToolManualRejectCount:ke?.outputMonitorTelemetryCounters?.inputToolManualRejectCount,inputToolManualChars:ke?.outputMonitorTelemetryCounters?.inputToolManualChars,inputToolAutoAcceptCount:ke?.outputMonitorTelemetryCounters?.inputToolAutoAcceptCount,inputToolAutoChars:ke?.outputMonitorTelemetryCounters?.inputToolAutoChars,inputToolManualShownCount:ke?.outputMonitorTelemetryCounters?.inputToolManualShownCount,inputToolFreeFormInputCount:ke?.outputMonitorTelemetryCounters?.inputToolFreeFormInputCount,inputToolFreeFormInputShownCount:ke?.outputMonitorTelemetryCounters?.inputToolFreeFormInputShownCount})}if(pe)return pe;let Ti=[];h?Ti.push(`Note: The user manually edited the command to \`${p}\`, and this is the output of running that command instead:
`):g&&Ti.push(`Note: The tool simplified the command to \`${p}\`, and this is the output of running that command instead:
`),se&&!l.isBackground&&Ti.push(`Note: This terminal execution was moved to the background using the ID ${S}
`);let ti;for(let Ro of this._outputAnalyzers){let _o=await Ro.analyze({exitCode:te,exitResult:G,commandLine:p});if(_o){ti=_o;break}}return ti&&Ti.push(`${ti}
`),Ti.push(G),{toolResultMessage:c,toolMetadata:{exitCode:te},toolResultDetails:te!==void 0&&te!==0?{input:p,output:[{type:"embed",isText:!0,value:G}],isError:!0}:void 0,content:[{kind:"text",value:Ti.join("")}]}}_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._sessionTerminalAssociations.set(e,c),r.isCancellationRequested)throw c.instance.dispose(),new ho;return await this._setupProcessIdAssociation(c,e,t,n),c}_registerInputListener(e){let t=e.instance.onData(o=>{gCo.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=cs.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._sessionTerminalAssociations.set(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),Pi(5e3).then(()=>{throw new Error("Timeout")})]);if(Xo(s)){let l=this._storageService.get("chat.terminalSessions",1,"{}"),c=JSON.parse(l),u=P_(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._sessionTerminalAssociations.get(e);if(t){this._logService.debug(`RunInTerminalTool: Cleaning up terminal for disposed chat session ${e}`),this._sessionTerminalAssociations.delete(e),t.instance.dispose();let o=[];for(let[n,r]of eg._activeExecutions.entries())r.instance===t.instance&&(r.dispose(),o.push(n));for(let n of o)eg._activeExecutions.delete(n)}}};eg=I([m(0,Si),m(1,B),m(2,zs),m(3,F),m(4,ot),m(5,jn),m(6,yo),m(7,le),m(8,kv),m(9,Xs),m(10,Yo),m(11,Pe),m(12,At)],eg);var Qst=class extends C{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 Go,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(aHe,this._toolTerminal.instance,()=>this._toolTerminal.receivedUserInput??!1);case"basic":return this._instantiationService.createInstance(sHe,this._toolTerminal.instance,()=>this._toolTerminal.receivedUserInput??!1,e);case"rich":return this._instantiationService.createInstance(lHe,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 jst(this.instance,e??this._startMarker)}};Qst=I([m(5,F)],Qst);var xHe=class{constructor(i,e,t){this._configurationService=i;this._terminalProfileResolverService=e;this._remoteAgentService=t;this.osBackend=this._remoteAgentService.getEnvironment().then(o=>o?.os??zo)}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 No(t.path)==="cmd.exe"?{...t,path:"C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",profileName:"PowerShell"}:{...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&&Ae(i.path))}};xHe=I([m(0,B),m(1,Sg),m(2,yo)],xHe);var bOi={id:"await_terminal",toolReferenceName:"awaitTerminal",displayName:d(14593,null),modelDescription:"Wait for a background terminal command to complete. Returns the output, exit code, or timeout status.",icon:M.terminal,source:Rn.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"]}},Rjt=class extends C{async prepareToolInvocation(i,e){return{invocationMessage:d(14592,null),pastTenseMessage:d(14591,null)}}async invoke(i,e,t,o){let n=i.parameters,r=eg.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=Pi(l).then(()=>({type:"timeout"})),g=pm(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 pm(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 ho)throw s;return{content:[{kind:"text",value:`Error awaiting terminal ${n.id}: ${s instanceof Error?s.message:String(s)}`}]}}}};var SOi={id:"terminal_last_command",toolReferenceName:"terminalLastCommand",legacyToolReferenceFullNames:["runCommands/terminalLastCommand"],displayName:d(14610,null),modelDescription:"Get the last command run in the active terminal.",source:Rn.Internal,icon:M.terminal},kHe=class extends C{constructor(e){super();this._terminalService=e}async prepareToolInvocation(e,t){return{invocationMessage:d(14609,null),pastTenseMessage:d(14608,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(`
`)}]}}};kHe=I([m(0,Yo)],kHe);var IOi={id:"kill_terminal",toolReferenceName:"killTerminal",displayName:d(14619,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:M.terminal,source:Rn.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"]}},Mjt=class extends C{async prepareToolInvocation(i,e){return{invocationMessage:d(14618,null),pastTenseMessage:d(14617,null)}}async invoke(i,e,t,o){let n=i.parameters,r=eg.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(),eg.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 yOi={id:"get_terminal_output",toolReferenceName:"getTerminalOutput",legacyToolReferenceFullNames:["runCommands/getTerminalOutput"],displayName:d(14613,null),modelDescription:"Get the output of a terminal command previously started with run_in_terminal",icon:M.terminal,source:Rn.Internal,inputSchema:{type:"object",properties:{id:{type:"string",description:"The ID of the terminal to check."}},required:["id"]}},Pjt=class extends C{async prepareToolInvocation(i,e){return{invocationMessage:d(14612,null),pastTenseMessage:d(14611,null)}}async invoke(i,e,t,o){let n=i.parameters;return{content:[{kind:"text",value:`Output of terminal ${n.id}:
${eg.getBackgroundOutput(n.id)}`}]}}};var wOi={id:"terminal_selection",toolReferenceName:"terminalSelection",legacyToolReferenceFullNames:["runCommands/terminalSelection"],displayName:d(14616,null),modelDescription:"Get the current selection in the active terminal.",source:Rn.Internal,icon:M.terminal},EHe=class extends C{constructor(e){super();this._terminalService=e}async prepareToolInvocation(e,t){return{invocationMessage:d(14615,null),pastTenseMessage:d(14614,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."}]}}};EHe=I([m(0,Yo)],EHe);var SCo={id:"vscode_get_terminal_confirmation",displayName:d(14631,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(14632,null),source:Rn.Internal,icon:M.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"]}},Ajt=class extends eg{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 THe(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 COi(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 Ae(i)?i:i.name?.toString()||""}return""}function ICo(a){return a.getKey()??a.getMapKey()}function Lfe(a,i){return!a||!i?!1:ICo(a)===ICo(i)||a.getCommonTaskId?.()===i.getCommonTaskId?.()?!0:a._id===i._id}async function Rfe(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)&&(COi(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}: ${COi(s)}`||v._label===COi(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 _He(a,i,e,t){return a.configurationProperties?.dependsOn?(await Promise.all(a.configurationProperties.dependsOn.map(async n=>{let r=Ae(n.task)?n.task:n.task?._key;if(r)return await Rfe(r,{taskLabel:r},i,e,t)}))).filter(n=>n!==void 0):void 0}async function DHe(a,i,e,t,o,n,r,s,l,c){let u=[];if(n.isCancellationRequested)return u;let p={},h={},g={};for(let S of l??[])p[S.getCommonTaskId()]=S,h[S._id]=S,g[S._label]=S;let f=a.map(S=>S.shellLaunchConfig.name??S.title??"unknown");o.report({message:new xe(`Checking output for ${f.map(S=>`\`${S}\``).join(", ")}`)});let v=a.map(async S=>{let y=i;if(l?.length){let O=S.reconnectionProperties?.data;O?Object.hasOwn(p,O.lastTask)?y=p[O.lastTask]:Object.hasOwn(h,O.id)&&(y=h[O.id]):S.shellLaunchConfig.name&&Object.hasOwn(g,S.shellLaunchConfig.name)?y=g[S.shellLaunchConfig.name]:Object.hasOwn(g,S.title)&&(y=g[S.title])}let w={getOutput:()=>jst(S)??"",task:y,isActive:s?()=>s(y):void 0,instance:S,dependencyTasks:l,sessionResource:t.sessionResource};if(y.configurationProperties.problemMatchers&&y.configurationProperties.problemMatchers.length>0&&c){let V=Date.now();for(;!n.isCancellationRequested&&Date.now()-V<1e3&&!(await c.getBusyTasks()).some(G=>Lfe(G,y));)await Pi(100)}let k=y.configurationProperties.problemMatchers&&y.configurationProperties.problemMatchers.length>0,T=r.add(e.createInstance(Boe,w,k?jan:void 0,t,n,i._label));await Promise.race([H.toPromise(T.onDidFinishCommand),H.toPromise(n.onCancellationRequested)]);let N=T.pollingResult;return{name:S.shellLaunchConfig.name??S.title??"unknown",output:N?.output??"",pollDurationMs:N?.pollDurationMs??0,resources:N?.resources,state:N?.state||"Idle",inputToolManualAcceptCount:T.outputMonitorTelemetryCounters.inputToolManualAcceptCount??0,inputToolManualRejectCount:T.outputMonitorTelemetryCounters.inputToolManualRejectCount??0,inputToolManualChars:T.outputMonitorTelemetryCounters.inputToolManualChars??0,inputToolAutoAcceptCount:T.outputMonitorTelemetryCounters.inputToolAutoAcceptCount??0,inputToolAutoChars:T.outputMonitorTelemetryCounters.inputToolAutoChars??0,inputToolManualShownCount:T.outputMonitorTelemetryCounters.inputToolManualShownCount??0,inputToolFreeFormInputShownCount:T.outputMonitorTelemetryCounters.inputToolFreeFormInputShownCount??0,inputToolFreeFormInputCount:T.outputMonitorTelemetryCounters.inputToolFreeFormInputCount??0}}),b=await Promise.all(v);return u.push(...b),u}async function jan(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 LHe(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 RHe(a,i,e,t,o,n){let r="";if(a?.exitCode)r=d(14678,null,i,a.exitCode);else{r+=`\`${i}\` task `;let s=e.length;if(o)return s?new xe(`Got output for ${r} with \`${s}\` problem${s===1?"":"s"}`):new xe(`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 xe(r)}var MHe=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,Je.fromString(c),{overwrite:!0}),t.report({message:"Created tasks.json file"});else{let O=await this._fileService.readFile(r),V=JSON.parse(O.value.toString());V.tasks.push(l),await this._fileService.writeFile(r,Je.fromString(JSON.stringify(V,null,"	"))),t.report({message:"Updated tasks.json file"})}t.report({message:new xe(d(14648,null))});let u,p=Date.now();for(;Date.now()-p<5e3&&!o.isCancellationRequested&&(u=(await this._tasksService.tasks())?.find(O=>O._label===n.task.label),!u);)await Pi(100);if(!u)return{content:[{kind:"text",value:`Task not found: ${n.task.label}`}],toolResultMessage:new xe(d(14651,null,n.task.label))};t.report({message:new xe(d(14650,null,n.task.label))});let h=await Promise.race([this._tasksService.run(u,void 0,5),Pi(3e3)]),g=h&&typeof h=="object"?h:void 0,f=await _He(u,n.workspaceFolder,this._configurationService,this._tasksService),b=this._tasksService.getTerminalsForTasks(f??u)?.map(O=>this._terminalService.instances.find(V=>V.resource.path===O?.path&&V.resource.scheme===O.scheme)).filter(Boolean);if(!b||b.length===0)return{content:[{kind:"text",value:`Task started but no terminal was found for: ${n.task.label}`}],toolResultMessage:new xe(d(14649,null,n.task.label))};let S=new P,y=await DHe(b,u,this._instantiationService,i.context,t,o,S,O=>this._isTaskActive(O),f,this._tasksService);S.dispose();for(let O of y)this._telemetryService.publicLog2?.("copilotChat.runTaskTool.createAndRunTask",{taskId:n.task.label,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,inputToolFreeFormInputCount:O.inputToolFreeFormInputCount??0,inputToolFreeFormInputShownCount:O.inputToolFreeFormInputShownCount??0});let w=y.map(O=>`Terminal: ${O.name}
Output:
${O.output}`),k=Array.from(new Set(w)).join(`

`),T=LHe(y),N=RHe(g,n.task.label,T,y,void 0,u.configurationProperties.isBackground);return{content:[{kind:"text",value:k}],toolResultMessage:N,toolResultDetails:T}}async _isTaskActive(i){return(await this._tasksService.getBusyTasks())?.some(t=>Lfe(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 xe(d(14657,null,o.label)),pastTenseMessage:new xe(d(14658,null,o.label)),confirmationMessages:void 0}:(await this._tasksService.getActiveTasks()).find(s=>s._label===o.label)?{invocationMessage:new xe(d(14647,null,o.label)),pastTenseMessage:new xe(d(14647,null,o.label)),confirmationMessages:void 0}:{invocationMessage:new xe(d(14654,null,o.label)),pastTenseMessage:new xe(d(14655,null,o.label)),confirmationMessages:{title:d(14646,null),message:new xe(d(14656,null,o.label,o.command,o.args?.length?` and args \`${o.args.join(" ")}\``:""))}}}};MHe=I([m(0,yg),m(1,Te),m(2,Yo),m(3,be),m(4,B),m(5,F)],MHe);var kOi={id:"create_and_run_task",toolReferenceName:"createAndRunTask",legacyToolReferenceFullNames:["runTasks/createAndRunTask"],displayName:d(14652,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(14653,null),source:Rn.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 EOi={id:"get_task_output",toolReferenceName:"getTaskOutput",legacyToolReferenceFullNames:["runTasks/getTaskOutput"],displayName:d(14664,null),modelDescription:"Get the output of a task",source:Rn.Internal,when:kTe,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"]}},PHe=class extends C{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=THe(o.id),r=await Rfe(o.id,n,o.workspaceFolder,this._configurationService,this._tasksService,!0);if(!r)return{invocationMessage:new xe(d(14662,null,o.id))};let s=r._label;return(await this._tasksService.getActiveTasks()).includes(r)?{invocationMessage:new xe(d(14661,null,s))}:{invocationMessage:new xe(d(14660,null,s)),pastTenseMessage:new xe(d(14659,null,s))}}async invoke(e,t,o,n){let r=e.parameters,s=THe(r.id),l=await Rfe(r.id,s,r.workspaceFolder,this._configurationService,this._tasksService,!0);if(!l)return{content:[{kind:"text",value:`Task not found: ${r.id}`}],toolResultMessage:new xe(d(14662,null,r.id))};let c=await _He(l,r.workspaceFolder,this._configurationService,this._tasksService),u=this._tasksService.getTerminalsForTasks(c??l),p=l._label,h=u?.map(w=>this._terminalService.instances.find(k=>k.resource.path===w?.path&&k.resource.scheme===w.scheme)).filter(w=>!!w);if(!h||h.length===0)return{content:[{kind:"text",value:`Terminal not found for task ${p}`}],toolResultMessage:new xe(d(14663,null,p))};let g=new P,f=await DHe(h,l,this._instantiationService,e.context,o,n,g,w=>this._isTaskActive(w),c,this._tasksService);g.dispose();for(let w of f)this._telemetryService.publicLog2?.("copilotChat.getTaskOutputTool.get",{taskId:r.id,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=LHe(f),y=RHe(void 0,p,S,f,!0,l.configurationProperties.isBackground);return{content:[{kind:"text",value:b}],toolResultMessage:y,toolResultDetails:S}}async _isTaskActive(e){return(await this._tasksService.getBusyTasks())?.some(o=>Lfe(o,e))??!1}};PHe=I([m(0,yg),m(1,Yo),m(2,B),m(3,F),m(4,Te)],PHe);var AHe=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=THe(n.id),s=await Rfe(n.id,r,n.workspaceFolder,this._configurationService,this._tasksService,!0);if(!s)return{content:[{kind:"text",value:`Task not found: ${n.id}`}],toolResultMessage:new xe(d(14674,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 xe(d(14672,null,l))};let u=await Promise.race([this._tasksService.run(s,void 0,5),Pi(3e3)]),p=u&&typeof u=="object"?u:void 0,h=await _He(s,n.workspaceFolder,this._configurationService,this._tasksService),g=this._tasksService.getTerminalsForTasks(h??s);if(!g||g.length===0)return{content:[{kind:"text",value:`Task started but no terminal was found for: ${l}`}],toolResultMessage:new xe(d(14667,null,l))};let f=this._terminalService.instances.filter(T=>g.some(N=>N.path===T.resource.path&&N.scheme===T.resource.scheme));if(f.length===0)return{content:[{kind:"text",value:`Task started but no terminal was found for: ${l}`}],toolResultMessage:new xe(d(14667,null,l))};let v=new P,b=await DHe(f,s,this._instantiationService,i.context,t,o,v,T=>this._isTaskActive(T),h,this._tasksService);v.dispose();for(let T of b)this._telemetryService.publicLog2?.("copilotChat.runTaskTool.run",{taskId:n.id,bufferLength:T.output.length??0,pollDurationMs:T.pollDurationMs??0,inputToolManualAcceptCount:T.inputToolManualAcceptCount??0,inputToolManualRejectCount:T.inputToolManualRejectCount??0,inputToolManualChars:T.inputToolManualChars??0,inputToolManualShownCount:T.inputToolManualShownCount??0,inputToolFreeFormInputShownCount:T.inputToolFreeFormInputShownCount??0,inputToolFreeFormInputCount:T.inputToolFreeFormInputCount??0});let S=b.map(T=>`Terminal: ${T.name}
Output:
${T.output}`),y=Array.from(new Set(S)).join(`

`),w=LHe(b),k=RHe(p,l,w,b,void 0,s.configurationProperties.isBackground);return{content:[{kind:"text",value:y}],toolResultMessage:k,toolResultDetails:w}}async _isTaskActive(i){return(await this._tasksService.getBusyTasks())?.some(t=>Lfe(t,i))??!1}async prepareToolInvocation(i,e){let t=i.parameters,o=THe(t.id),n=await Rfe(t.id,o,t.workspaceFolder,this._configurationService,this._tasksService,!0);if(!n)return{invocationMessage:new xe(d(14674,null,t.id))};let r=n._label,s=await this._tasksService.getActiveTasks();return n&&s.includes(n)?{invocationMessage:new xe(d(14671,null))}:await this._isTaskActive(n)?{invocationMessage:new xe(d(14673,null,r)),pastTenseMessage:new xe(d(14675,null,r)),confirmationMessages:void 0}:{invocationMessage:new xe(d(14669,null,r)),pastTenseMessage:new xe(n?.configurationProperties.isBackground?d(14670,null,r):d(14668,null,r)),confirmationMessages:n?{title:d(14666,null),message:d(14665,null,r)}:void 0}}};AHe=I([m(0,yg),m(1,Te),m(2,Yo),m(3,B),m(4,F)],AHe);var TOi={id:"run_task",toolReferenceName:"runTask",legacyToolReferenceFullNames:["runTasks/runTask"],displayName:d(14676,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(14677,null),icon:M.tools,source:Rn.Internal,when:kTe,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"]}};we(SG,dHe,1);var NHe=class extends C{static{this.ID="terminal.shellIntegrationTimeoutMigration"}constructor(i){super();let e=i.getValue("chat.tools.terminal.shellIntegrationTimeout");if(!Xo(e))return;let t=i.getValue("terminal.integrated.shellIntegration.timeout");Xo(t)||i.updateValue("terminal.integrated.shellIntegration.timeout",e)}};NHe=I([m(0,B)],NHe);pt(NHe.ID,NHe,ut.Eventually);var OHe=class extends C{static{this.ID="terminal.outputLocationMigration"}constructor(i){super(),i.getValue("chat.tools.terminal.outputLocation")==="none"&&i.updateValue("chat.tools.terminal.outputLocation","chat")}};OHe=I([m(0,B)],OHe);pt(OHe.ID,OHe,ut.Eventually);var FHe=class extends C{static{this.ID="terminal.chatAgentTools"}constructor(i,e){super();let t=i.createInstance(Ajt);this._register(e.registerTool(SCo,t));let o=i.createInstance(Pjt);this._register(e.registerTool(yOi,o)),this._register(e.executeToolSet.addTool(yOi));let n=i.createInstance(Rjt);this._register(e.registerTool(bOi,n)),this._register(e.executeToolSet.addTool(bOi));let r=i.createInstance(Mjt);this._register(e.registerTool(IOi,r)),this._register(e.executeToolSet.addTool(IOi)),i.invokeFunction(bCo).then(h=>{let g=i.createInstance(eg);this._register(e.registerTool(h,g)),this._register(e.executeToolSet.addTool(h))});let s=i.createInstance(EHe);this._register(e.registerTool(wOi,s));let l=i.createInstance(kHe);this._register(e.registerTool(SOi,l)),this._register(e.readToolSet.addTool(wOi)),this._register(e.readToolSet.addTool(SOi));let c=i.createInstance(AHe);this._register(e.registerTool(TOi,c));let u=i.createInstance(PHe);this._register(e.registerTool(EOi,u));let p=i.createInstance(MHe);this._register(e.registerTool(kOi,p)),this._register(e.executeToolSet.addTool(TOi)),this._register(e.executeToolSet.addTool(kOi)),this._register(e.readToolSet.addTool(EOi))}};FHe=I([m(0,F),m(1,jn)],FHe);pt(FHe.ID,FHe,ut.AfterRestored);Gl({id:"workbench.action.terminal.chat.addTerminalSelection",title:d(14589,null),precondition:x.and(ie.enabled,Js.terminalAvailable),menu:[{id:D.TerminalInstanceContext,group:"0_chat",order:1,when:x.and(ie.enabled,at.textSelected)}],run:async(a,i,e)=>{let t=e.get(At),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(14590,null),fullName:d(14590,null),value:o,icon:M.terminal}),n.focusInput())}});Sr({id:"workbench.action.terminal.showTextureAtlas",title:L(14758,"Show Terminal Texture Atlas"),category:We.Developer,precondition:x.or(at.isOpen),run:async(a,i)=>{let e=i.get(be),t=i.get(Qe),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,Je.wrap(new Uint8Array(await u.arrayBuffer()))),t.open(s))}});Sr({id:"workbench.action.terminal.writeDataToTerminal",title:L(14759,"Write Data to Terminal"),category:We.Developer,run:async(a,i)=>{let e=i.get(Ge),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(14760,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)}});Sr({id:"workbench.action.terminal.recordSession",title:L(14755,"Record Terminal Session"),category:We.Developer,run:async(a,i)=>{let e=i.get(Wi),t=i.get(ge),o=i.get(Tr),n=new P,r=d(14756,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 jo(5e3));n.add(H.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(H.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)}))})}});Sr({id:"workbench.action.terminal.restartPtyHost",title:L(14757,"Restart Pty Host"),category:We.Developer,run:async(a,i)=>{let e=i.get(Xs),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 Hoe=class extends C{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(Hoe.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 jt,n=new P;this._activeDevModeDisposables.value=hn(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,hn(...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&&Ue(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}};Hoe=I([m(1,B)],Hoe);up(Hoe.ID,Hoe);Gl({id:"workbench.action.terminal.showEnvironmentContributions",title:L(14764,"Show Environment Contributions"),run:async(a,i,e,t)=>{let o=a.extEnvironmentVariableCollection;if(o){let n=t,s=e.get(F).createInstance(Uoe),l=e.get(ee),c=new Date().getTime(),u=n?.workspaceFolder?` - ${n.workspaceFolder.name}`:"",p=await s.provideTextContent(A.from({scheme:Uoe.scheme,path:`Environment changes${u}`,fragment:Yan(o,n),query:`environment-collection-${c}`}));p&&await l.openEditor({resource:p.uri})}}});function Yan(a,i){let e=`# ${d(14761,null)}`,t=a.getDescriptionMap(void 0),o=a.getDescriptionMap(i);for(let[n,r]of a.collections){e+=`

## ${d(14762,null,n)}`,e+=`
`;let s=t.get(n);s&&(e+=`
${s}
`);let l=o.get(n);if(l){let c=s?` (${d(14763,null)})`:"";e+=`
${l}${c}
`}for(let c of r.map.values())Xan(c,i)!==!1&&(e+=`
- \`${Jan(c.type,c.value,c.variable)}\``)}return e}function Xan(a,i){return!!(!a.scope||a.scope.workspaceFolder&&i?.workspaceFolder&&a.scope.workspaceFolder.index===i.workspaceFolder.index)}function Jan(a,i,e){switch(a){case 3:return`${e}=${i}\${env:${e}}`;case 2:return`${e}=\${env:${e}}${i}`;default:return`${e}=${i}`}}var Uoe=class{constructor(i,e){this._modelService=e;i.registerTextModelContentProvider(Uoe.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:H.None},i,!1)}};Uoe=I([m(0,Nt),m(1,Ct)],Uoe);var _Oi=d(8302,null),Zan=d(8305,null),eln=d(8304,null),tln=d(8303,null),iln=d(8301,null),Njt=310,oln=73,zoe=class extends Ma{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 G1),this._matchesLimit=e.matchesLimit??Number.MAX_SAFE_INTEGER,this._findInput=this._register(new L1(null,t,{label:_Oi,placeholder:Zan,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:()=>ML(r),inputBoxStyles:pl,toggleStyles:qg},o)),this._updateHistoryDelayer=this._register(new jo(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 KS({label:eln+(e.previousMatchActionId?this._getKeybinding(e.previousMatchActionId):""),icon:k5e,hoverLifecycleOptions:c,onTrigger:()=>{this.find(!0)}},n)),this.nextBtn=this._register(new KS({label:tln+(e.nextMatchActionId?this._getKeybinding(e.nextMatchActionId):""),icon:E5e,hoverLifecycleOptions:c,onTrigger:()=>{this.find(!1)}},n));let u=this._register(new KS({label:iln+(e.closeWidgetActionId?this._getKeybinding(e.closeWidgetActionId):""),icon:lE,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(Vn(this._innerDomNode)),this._register(this._focusTracker.onDidFocus(this._onFocusTrackerFocus.bind(this))),this._register(this._focusTracker.onDidBlur(this._onFocusTrackerBlur.bind(this))),this._findInputFocusTracker=this._register(Vn(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<Njt?Njt:p,this._domNode.style.width=`${p}px`),e?.enableSash){let h=p??Njt,g=h,f=this._register(new pv(this._innerDomNode,this,{orientation:0,size:1}));this._register(f.onDidStart(()=>{g=parseFloat(cU(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(cU(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;Njt+oln+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=id(T5e,r,n)}else o=w7;Or(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=_Oi;if(!this._accessibilityHelpHintAnnounced&&this._configurationService.getValue("accessibility.verbosity.find")&&this._accessibilityService.isScreenReaderOptimized()){let t=this._keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getAriaLabel();t&&(e+=", "+d(8296,null,t),this._accessibilityHelpHintAnnounced=!0,this._labelResetTimeout?.dispose(),this._labelResetTimeout=nn(()=>{this._isVisible&&this._findInput.inputBox.setAriaLabel(_Oi)},1e3))}this._findInput.inputBox.setAriaLabel(e)}_announceSearchResults(e,t){return t?e===w7?t===""?d(8299,null,e):d(8298,null,e,t):d(8300,null,e,t):d(8297,null)}},nln=J("simpleFindWidget.sashBorder",{dark:"#454545",light:"#C8C8C8",hcDark:"#6FC3DF",hcLight:"#0F4A85"},d(8306,null));is((a,i)=>{let e=a.getColor(nln);i.addRule(`.monaco-workbench .simple-find-part .monaco-sash { background-color: ${e}; border-color: ${e} }`)});async function yCo(a,i,e){let t=a.get(B),o=a.get(ct),n=i.split(/\r?\n/);if(n.length===1)return!0;function r(g){return Ae(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(14752,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(14748,null,n.length),detail:u,type:"warning",buttons:[{label:d(14750,null),run:()=>({confirmed:!0,singleLine:!1})},{label:d(14751,null),run:()=>({confirmed:!0,singleLine:!0})}],cancelButton:!0,checkbox:{label:d(14749,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 wT=class extends C{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(wT.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(yCo,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()):og.clipboard.readText?this.paste():this._notificationService.info(`This browser doesn't support the clipboard.readText API needed to trigger a paste, try ${it?"\u2318":"Ctrl"}+V instead.`),it&&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)}};wT=I([m(1,Wi),m(2,B),m(3,F),m(4,Ne),m(5,ku)],wT);up(wT.ID,wT,!1);var Koe=x.or(at.processSupported,at.terminalHasBeenCreated);Gl({id:"workbench.action.terminal.copyLastCommand",title:L(14741,"Copy Last Command"),precondition:Koe,run:async(a,i,e)=>{let t=e.get(Wi),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)}});Gl({id:"workbench.action.terminal.copyLastCommandOutput",title:L(14743,"Copy Last Command Output"),precondition:Koe,run:async(a,i,e)=>{let t=e.get(Wi),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();Ae(r)&&await t.writeText(r)}});Gl({id:"workbench.action.terminal.copyLastCommandAndLastCommandOutput",title:L(14742,"Copy Last Command and Output"),precondition:Koe,run:async(a,i,e)=>{let t=e.get(Wi),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();Ae(r)&&await t.writeText(`${n.command!==""?n.command+`
`:""}${r}`)}});og.clipboard.writeText&&(Mm({id:"workbench.action.terminal.copySelection",title:L(14744,"Copy Selection"),precondition:x.or(at.textSelectedInFocused,x.and(Koe,at.textSelected)),keybinding:[{primary:3105,mac:{primary:2081},weight:200,when:x.or(x.and(at.textSelected,at.focus),at.textSelectedInFocused)}],run:a=>a.copySelection()}),Mm({id:"workbench.action.terminal.copyAndClearSelection",title:L(14740,"Copy and Clear Selection"),precondition:x.or(at.textSelectedInFocused,x.and(Koe,at.textSelected)),keybinding:[{win:{primary:2081},weight:200,when:x.or(x.and(at.textSelected,at.focus),at.textSelectedInFocused)}],run:async a=>{await a.copySelection(),a.clearSelection()}}),Mm({id:"workbench.action.terminal.copySelectionAsHtml",title:L(14745,"Copy Selection as HTML"),f1:!0,category:er.actionCategory,precondition:x.or(at.textSelectedInFocused,x.and(Koe,at.textSelected)),run:a=>a.copySelection(!0)}));og.clipboard.readText&&Gl({id:"workbench.action.terminal.paste",title:L(14746,"Paste into Active Terminal"),precondition:Koe,keybinding:[{primary:2100,win:{primary:2100,secondary:[3124]},linux:{primary:3124},weight:200,when:at.focus}],run:a=>wT.get(a)?.paste()});og.clipboard.readText&&Wn&&Gl({id:"workbench.action.terminal.pasteSelection",title:L(14747,"Paste Selection into Active Terminal"),precondition:Koe,keybinding:[{linux:{primary:1043},weight:200,when:at.focus}],run:a=>wT.get(a)?.pasteSelection()});var rln=419,WHe=class extends zoe{constructor(e,t,o,n,r,s,l,c,u,p,h){super({showCommonFindToggles:!0,checkImeCompletionState:!0,showResultCount:!0,initialWidth:rln,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=at.findInputFocus.bindTo(n),this._findWidgetFocused=at.findFocus.bindTo(n),this._findWidgetVisible=at.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=Me(f),S=new yn(b,v),y=Fgi(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.value=wT.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(H.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(){wT.get(this._instance)?.overrideCopyOnSelection&&(this._overrideCopyOnSelectionDisposable.value=wT.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=H.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}};WHe=I([m(1,Wi),m(2,B),m(3,X),m(4,ze),m(5,_n),m(6,tt),m(7,_e),m(8,De),m(9,ne),m(10,Bi)],WHe);var Ojt=class{constructor(){this.priority=105;this.name="terminal-find";this.type="help";this.when=at.findFocus}getProvider(i){let e=i.get(ge);return new DOi(e)}},DOi=class extends C{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(14780,null)),e.push(d(14775,null)),e.push(""),e.push(d(14801,null)),e.push(d(14800,null)),e.push(""),e.push(d(14787,null)),e.push(d(14786,null)),e.push(""),e.push(d(14785,null)),e.push(d(14784,null)),e.push(d(14781,null)),e.push(d(14782,null)),e.push(d(14783,null)),e.push(""),e.push(d(14779,null)),e.push(d(14776,null)),e.push(d(14777,null)),e.push(d(14778,null)),e.push(""),e.push(d(14788,null)),e.push(""),e.push(d(14790,null)),e.push(d(14789,null)),e.push(d(14792,null)),e.push(""),e.push(d(14791,null)),e.push(""),e.push(d(14795,null)),e.push(d(14793,null)),e.push(d(14796,null)),e.push(d(14794,null)),e.push(""),e.push(d(14798,null,"<keybinding:workbench.action.openSettings>")),e.push(d(14797,null)),e.push(d(14799,null)),e.push(""),e.push(d(14774,null)),e.push(d(14773,null)),e.join(`
`)}};var cf=class extends C{static{this.ID="terminal.find"}static get(i){return i.getContribution(cf.ID)}get findWidget(){return this._findWidget.value}constructor(i,e,t){super(),this._findWidget=new co(()=>{let o=e.createInstance(WHe,i.instance);if(o.focusTracker.onDidFocus(()=>{cf.activeFindWidget=this,i.instance.forceScrollbarVisibility(),dR(i.instance)||t.setActiveInstance(i.instance)}),o.focusTracker.onDidBlur(()=>{cf.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(){cf.activeFindWidget===this&&(cf.activeFindWidget=void 0),super.dispose(),this._findWidget.rawValue?.dispose()}};cf=I([m(1,F),m(2,Yo)],cf);up(cf.ID,cf,!0);Mm({id:"workbench.action.terminal.focusFind",title:L(14767,"Focus Find"),keybinding:{primary:2084,when:x.or(at.findFocus,at.focusInAny),weight:200},precondition:x.or(at.processSupported,at.terminalHasBeenCreated),run:(a,i,e)=>{(cf.activeFindWidget||cf.get(e))?.findWidget.reveal()}});Mm({id:"workbench.action.terminal.hideFind",title:L(14768,"Hide Find"),keybinding:{primary:9,secondary:[1033],when:x.and(at.focusInAny,at.findVisible),weight:200},precondition:x.or(at.processSupported,at.terminalHasBeenCreated),run:(a,i,e)=>{(cf.activeFindWidget||cf.get(e))?.findWidget.hide()}});Mm({id:"workbench.action.terminal.toggleFindRegex",title:L(14771,"Toggle Find Using Regex"),keybinding:{primary:560,mac:{primary:2608},when:at.findVisible,weight:200},precondition:x.or(at.processSupported,at.terminalHasBeenCreated),run:(a,i,e)=>{let o=(cf.activeFindWidget||cf.get(e))?.findWidget.state;o?.change({isRegex:!o.isRegex},!1)}});Mm({id:"workbench.action.terminal.toggleFindWholeWord",title:L(14772,"Toggle Find Using Whole Word"),keybinding:{primary:565,mac:{primary:2613},when:at.findVisible,weight:200},precondition:x.or(at.processSupported,at.terminalHasBeenCreated),run:(a,i,e)=>{let o=(cf.activeFindWidget||cf.get(e))?.findWidget.state;o?.change({wholeWord:!o.wholeWord},!1)}});Mm({id:"workbench.action.terminal.toggleFindCaseSensitive",title:L(14770,"Toggle Find Using Case Sensitive"),keybinding:{primary:545,mac:{primary:2593},when:at.findVisible,weight:200},precondition:x.or(at.processSupported,at.terminalHasBeenCreated),run:(a,i,e)=>{let o=(cf.activeFindWidget||cf.get(e))?.findWidget.state;o?.change({matchCase:!o.matchCase},!1)}});Mm({id:"workbench.action.terminal.findNext",title:L(14765,"Find Next"),keybinding:[{primary:61,mac:{primary:2085,secondary:[61]},when:x.or(at.focusInAny,at.findFocus),weight:200},{primary:1027,when:at.findInputFocus,weight:200}],precondition:x.or(at.processSupported,at.terminalHasBeenCreated),run:(a,i,e)=>{let o=(cf.activeFindWidget||cf.get(e))?.findWidget;o&&(o.show(),o.find(!1))}});Mm({id:"workbench.action.terminal.findPrevious",title:L(14766,"Find Previous"),keybinding:[{primary:1085,mac:{primary:3109,secondary:[1085]},when:x.or(at.focusInAny,at.findFocus),weight:200},{primary:3,when:at.findInputFocus,weight:200}],precondition:x.or(at.processSupported,at.terminalHasBeenCreated),run:(a,i,e)=>{let o=(cf.activeFindWidget||cf.get(e))?.findWidget;o&&(o.show(),o.find(!0))}});Gl({id:"workbench.action.terminal.searchWorkspace",title:L(14769,"Search Workspace"),keybinding:[{primary:3108,when:x.and(at.processSupported,at.focus,at.textSelected),weight:250}],run:(a,i,e)=>_Pi(e,{query:a.selection})});xa.register(new Ojt);var CCo=J("terminalStickyScroll.background",null,d(14892,null)),xCo=J("terminalStickyScrollHover.background",{dark:"#2A2D2E",light:"#F0F0F0",hcDark:"#E48B39",hcLight:"#0f4a85"},d(14894,null));J("terminalStickyScroll.border",{dark:null,light:null,hcDark:"#6fc3df",hcLight:"#0f4a85"},d(14893,null));var dQ=class extends C{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 HWe;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(H.runAndSubscribe(this._xterm.raw.buffer.onBufferChange,f=>{this._setState((f??this._xterm.raw.buffer.active).type==="normal"?1:0)})),this._register(H.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(Ev)&&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=hn(H.any(this._xterm.raw.onScroll,this._xterm.raw.onLineFeed,this._xterm.raw.onCursorMove)(()=>this._refresh()),Vo(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(!_w(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=!_w(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&&kCo(v,":")||n.cursorX===5&&kCo(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&&CS(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(14896,null),n=this._keybindingService.lookupKeybinding("workbench.action.terminal.scrollToPreviousCommand");if(n){let l=n.getLabel();l&&(o+=`
`+d(14895,null,er.scrollToPreviousCommand.value,l))}let r=this._keybindingService.lookupKeybinding("workbench.action.terminal.scrollToNextCommand");if(r){let l=r.getLabel();l&&(o+=`
`+d(14895,null,er.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(Vo(t,"click",()=>{this._xterm&&this._currentStickyCommand&&(this._xterm.markTracker.revealCommand(this._currentStickyCommand),this._instance.focus())})),this._register(Vo(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(),aQ(Me(t),l,this._instance,this._contextMenu,this._contextMenuService)})),this._register(Vo(t,"mouseover",()=>e.options.theme=this._getTheme(!0))),this._register(Vo(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(xCo)?.toString()??this._xtermColorProvider.getBackgroundColor(t)?.toString():t.getColor(CCo)?.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([Nd(100)],dQ.prototype,"_show",1),I([OM(0)],dQ.prototype,"_syncOptions",1),I([OM(0)],dQ.prototype,"_refreshGpuAcceleration",1),dQ=I([m(5,B),m(6,X),m(7,ze),m(8,_e),m(9,qt),m(10,ku),m(11,De)],dQ);function kCo(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 P0=class extends C{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(H.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(P0.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=Yf.getXtermConstructor(this._keybindingService,this._contextKeyService);this._overlay.value=this._instantiationService.createInstance(dQ,this._ctx.instance,this._xterm,this._instantiationService.createInstance(Cfe,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)}};P0=I([m(1,B),m(2,X),m(3,F),m(4,_e)],P0);var VHe=class extends C{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=Le(this,!1);this.requestInProgress=this._requestInProgress;this._focusedContextKey=Ba.focused.bindTo(n),this._visibleContextKey=Ba.visible.bindTo(n),this._requestActiveContextKey=Ba.requestActive.bindTo(n),this._responseContainsCodeBlockContextKey=Ba.responseContainsCodeBlock.bindTo(n),this._responseContainsMulitpleCodeBlocksContextKey=Ba.responseContainsMultipleCodeBlocks.bindTo(n),this._container=document.createElement("div"),this._container.classList.add("terminal-inline-chat"),this._terminalElement.appendChild(this._container),this._inlineChatWidget=l.createInstance(the,{location:"terminal",resolveData:()=>{}},{statusMenuId:{menu:jO,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:IB,chatWidgetViewOptions:{menus:{telemetrySource:"terminal-inline-chat",executeToolbar:D.ChatExecute,inputSideToolbar:QXi},defaultMode:Pl.Ask}}),this._register(this._inlineChatWidget.chatWidget.onDidChangeViewModel(()=>this._saveViewState())),this._register(H.any(this._inlineChatWidget.onDidChangeHeight,this._instance.onDimensionsChanged,this._inlineChatWidget.chatWidget.onDidChangeContentHeight,H.fromObservableLight(this._inlineChatWidget.chatWidget.input.selectedLanguageModel),H.debounce(this._xterm.raw.onCursorMove,()=>{},QD))(()=>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(Vn(this._container)),this._register(this._focusTracker.onDidFocus(()=>this._focusedContextKey.set(!0))),this._register(this._focusTracker.onDidBlur(()=>this._focusedContextKey.set(!1))),this._register(he(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 ai(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(14582,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="",P0.get(this._instance)?.hideUnlock()):(this._terminalElement.style.position="relative",this._terminalElement.style.bottom=`${e}px`,P0.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=xn(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 $e;let n=new P;this._requestActiveContextKey.set(!0);let r=await this._inlineChatWidget.chatWidget.acceptInput(o,{isVoiceInput:t?.isVoiceInput});this._currentRequestId=r?.requestId;let s=new Go;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)xMe(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()}};VHe=I([m(3,X),m(4,Si),m(5,le),m(6,F),m(7,br),m(8,At)],VHe);var sm=class extends C{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(sm.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(VHe,this._ctx.instance.domElement,this._ctx.instance,e));if(this._register(t.focusTracker.onDidFocus(()=>{sm.activeChatController=this,dR(this._ctx.instance)||this._terminalService.setActiveInstance(this._ctx.instance)})),this._register(t.focusTracker.onDidBlur(()=>{sm.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(sln,e),this._terminalChatWidget?.rawValue?.hide()}};sm=I([m(1,LY),m(2,vr),m(3,X),m(4,F),m(5,Yo)],sm);async function sln(a,i){let e=a.get(Si),o=await a.get(At).revealWidget();if(o&&o.viewModel&&i){for(let n of i.getRequests().slice())await e.adoptRequest(o.viewModel.model.sessionResource,n);o.focusResponseItem()}}var Fjt=class{constructor(){this.priority=105;this.name="terminalInlineChat";this.type="view";this.when=Ba.focused}getProvider(i){let e=i.get(Yo),t=i.get(qt),o=[],n=sm.activeChatController?.scopedContextKeyService;if(n){let l=t.getMenuActions(jO,n);for(let c of l)for(let u of c[1])u instanceof Eo&&o.push(u)}let r=e.activeInstance?.getContribution(sm.ID)??void 0;if(!r?.lastResponseContent)return;let s=r.lastResponseContent;return new tp("terminal-chat",{type:"view"},()=>s,()=>{r.focus()},"accessibility.verbosity.inlineChat",void 0,o)}};qe.registerCommandAlias("interactiveEditor.start","inlineChat.start");qe.registerCommandAlias("interactive.acceptChanges",Uco);var DDv=Re("start-inline-chat",M.sparkle,d(10585,null)),LDv=x.and(x.or(Hco,nme),Fco,ue.writable,ue.editorSimpleInput.negate());fe.appendMenuItem(D.InlineChatEditorAffordance,{group:"0_chat",order:1,when:x.and(ue.writable,ue.hasNonEmptySelection,OVt.negate()),command:{id:XZ,title:d(10573,null),shortTitle:d(10574,null),icon:M.sparkle}});var IG=class a extends wl{static{this.category=L(10570,"Inline Chat")}constructor(i){let e=t=>{if(Array.isArray(t))for(let o of t)o.when=x.and(nme,o.when);else t&&(t.when=x.and(nme,t.when))};Array.isArray(i.menu),e(i.menu),super({...i,category:a.category,precondition:x.and(nme,i.precondition)})}runEditorCommand(i,e,...t){let o=i.get(ee),n=i.get(ne),r=_m.get(e);if(!r){let{activeTextEditorControl:s}=o;pn(s)?e=s:Ec(s)&&(e=s.getModifiedEditor()),r=_m.get(e)}if(!r){n.warn("[IE] NO controller found for action",this.desc.id,e.getModel()?.uri);return}if(e instanceof zc&&(e=e.getParentEditor()),!r){for(let s of i.get(Kt).listDiffEditors())(s.getOriginalEditor()===e||s.getModifiedEditor()===e)&&s instanceof MD&&this.runEditorCommand(i,s.getParentEditor(),...t);return}this.runInlineChatCommand(i,r,e,...t)}};Mm({id:"workbench.action.terminal.chat.start",title:L(14577,"Open Inline Chat"),category:L(14578,"Terminal"),keybinding:{primary:2087,when:x.and(at.focusInAny),weight:401},f1:!0,precondition:x.and(ie.enabled,x.or(at.processSupported,at.terminalHasBeenCreated),Ba.hasChatAgent),menu:{id:D.TerminalInstanceContext,group:"0_chat",order:2,when:ie.enabled},run:(a,i,e,t)=>{if(dR(e))return;let o=sm.activeChatController||sm.get(e);if(o){if(t){let n=function(r){return typeof r=="object"&&r!==null&&"query"in r&&Ae(r.query)};t=Ae(t)?{query:t}:t,n(t)&&(o.updateInput(t.query,!1),t.isPartialQuery||o.terminalChatWidget?.acceptInput())}o.terminalChatWidget?.reveal()}}});Mm({id:"workbench.action.terminal.chat.close",title:L(14566,"Close"),category:IG.category,keybinding:{primary:9,when:x.and(x.or(at.focus,Ba.focused),Ba.visible),weight:200},menu:[{id:jO,group:"0_main",order:2}],icon:M.close,f1:!0,precondition:x.and(ie.enabled,Ba.visible),run:(a,i,e)=>{if(dR(e))return;(sm.activeChatController||sm.get(e))?.terminalChatWidget?.clear()}});Mm({id:"workbench.action.terminal.chat.runCommand",title:L(14572,"Run Chat Command"),shortTitle:L(14571,"Run"),category:IG.category,precondition:x.and(ie.enabled,x.or(at.processSupported,at.terminalHasBeenCreated),Ba.requestActive.negate(),Ba.responseContainsCodeBlock,Ba.responseContainsMultipleCodeBlocks.negate()),icon:M.play,keybinding:{when:Ba.requestActive.negate(),weight:200,primary:2051},menu:{id:jO,group:"0_main",order:0,when:x.and(Ba.responseContainsCodeBlock,Ba.responseContainsMultipleCodeBlocks.negate(),Ba.requestActive.negate())},run:(a,i,e)=>{if(dR(e))return;(sm.activeChatController||sm.get(e))?.terminalChatWidget?.acceptCommand(!0)}});Mm({id:"workbench.action.terminal.chat.runFirstCommand",title:L(14574,"Run First Chat Command"),shortTitle:L(14573,"Run First"),category:IG.category,precondition:x.and(ie.enabled,x.or(at.processSupported,at.terminalHasBeenCreated),Ba.requestActive.negate(),Ba.responseContainsMultipleCodeBlocks),icon:M.play,keybinding:{when:Ba.requestActive.negate(),weight:200,primary:2051},menu:{id:jO,group:"0_main",order:0,when:x.and(Ba.responseContainsMultipleCodeBlocks,Ba.requestActive.negate())},run:(a,i,e)=>{if(dR(e))return;(sm.activeChatController||sm.get(e))?.terminalChatWidget?.acceptCommand(!0)}});Mm({id:"workbench.action.terminal.chat.insertCommand",title:L(14568,"Insert Chat Command"),shortTitle:L(14567,"Insert"),category:IG.category,icon:M.insert,precondition:x.and(ie.enabled,x.or(at.processSupported,at.terminalHasBeenCreated),Ba.requestActive.negate(),Ba.responseContainsCodeBlock,Ba.responseContainsMultipleCodeBlocks.negate()),keybinding:{when:Ba.requestActive.negate(),weight:200,primary:515,secondary:[2563]},menu:{id:jO,group:"0_main",order:1,when:x.and(Ba.responseContainsCodeBlock,Ba.responseContainsMultipleCodeBlocks.negate(),Ba.requestActive.negate())},run:(a,i,e)=>{if(dR(e))return;(sm.activeChatController||sm.get(e))?.terminalChatWidget?.acceptCommand(!1)}});Mm({id:"workbench.action.terminal.chat.insertFirstCommand",title:L(14570,"Insert First Chat Command"),shortTitle:L(14569,"Insert First"),category:IG.category,precondition:x.and(ie.enabled,x.or(at.processSupported,at.terminalHasBeenCreated),Ba.requestActive.negate(),Ba.responseContainsMultipleCodeBlocks),keybinding:{when:Ba.requestActive.negate(),weight:200,primary:515,secondary:[2563]},menu:{id:jO,group:"0_main",order:1,when:x.and(Ba.responseContainsMultipleCodeBlocks,Ba.requestActive.negate())},run:(a,i,e)=>{if(dR(e))return;(sm.activeChatController||sm.get(e))?.terminalChatWidget?.acceptCommand(!1)}});Mm({id:"workbench.action.terminal.chat.rerunRequest",title:L(14564,"Rerun Request"),f1:!1,icon:M.refresh,category:IG.category,precondition:x.and(ie.enabled,x.or(at.processSupported,at.terminalHasBeenCreated),Ba.requestActive.negate()),keybinding:{weight:200,primary:2096,when:Ba.focused},menu:{id:jO,group:"0_main",order:5,when:x.and(Ba.inputHasText.toNegated(),Ba.requestActive.negate())},run:async(a,i,e)=>{let t=i.get(Si),o=i.get(At),r=sm.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})}}});Mm({id:"workbench.action.terminal.chat.viewInChat",title:L(14581,"View in Chat"),category:IG.category,precondition:x.and(ie.enabled,x.or(at.processSupported,at.terminalHasBeenCreated),Ba.requestActive.negate()),icon:M.chatSparkle,menu:[{id:jO,group:"zzz",order:1,isHiddenByDefault:!0,when:x.and(Ba.responseContainsCodeBlock,Ba.requestActive.negate())}],run:(a,i,e)=>{if(dR(e))return;(sm.activeChatController||sm.get(e))?.viewInChat()}});W(class extends K{constructor(){super({id:"workbench.action.terminal.chat.viewHiddenChatTerminals",title:L(14580,"View Hidden Chat Terminals"),category:L(14579,"Terminal"),f1:!0,precondition:x.and(Ba.hasHiddenChatTerminals,ie.enabled),menu:[{id:D.ViewTitle,when:x.and(Ba.hasHiddenChatTerminals,x.equals("view",Vr)),group:"terminal",order:0,isHiddenByDefault:!0}]})}async run(i){let e=i.get(Yo),t=i.get(jl),o=i.get(xv),n=i.get(kv),r=i.get(Ge),s=i.get(F),l=i.get(Si),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(14565,"Last: {0}",y).value,f=80,v=[];for(let y of p.values()){let k=`$(${s.invokeFunction(cX,y)}) ${y.title}`,T=y.capabilities.get(2)?.commands.at(-1)?.command,N=n.getChatSessionResourceForInstance(y),O;N&&(O=l.getSession(N)?.title??l.getSessionTitle(N));let V=O,U,G;if(T){let $=T.split(`
`),te=$[0],pe=te.length>f?te.substring(0,f)+"\u2026":te;U=g(pe);let de=te.length>f,se=$.length>1;(de||se)&&(se?G={value:`\`\`\`
${T}
\`\`\``,supportThemeIcons:!0}:G=g(T))}v.push({label:k,description:V,detail:U,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(14575,"Select a chat terminal to show and focus").value,b.items=h,b.canSelectMany=!1,b.title=L(14576,"Chat Terminals").value,b.matchOnDescription=!0,b.matchOnDetail=!0;let S=new P;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()}});yt.registerCommandAndKeybindingRule({id:"workbench.action.terminal.chat.focusMostRecentChatTerminal",weight:200,when:ie.inChatSession,handler:async a=>{let e=a.get(kv).getMostRecentProgressPart();e&&await e.focusTerminal()}});yt.registerCommandAndKeybindingRule({id:"workbench.action.terminal.chat.focusMostRecentChatTerminalOutput",weight:200,when:ie.inChatSession,primary:3629,handler:async a=>{let e=a.get(kv).getMostRecentProgressPart();e&&await e.toggleOutputFromKeyboard()}});fe.appendMenuItem(D.CommandPalette,{command:{id:"workbench.action.terminal.chat.focusMostRecentChatTerminal",title:d(14562,null)},when:ie.inChatSession});fe.appendMenuItem(D.CommandPalette,{command:{id:"workbench.action.terminal.chat.focusMostRecentChatTerminalOutput",title:d(14563,null)},when:ie.inChatSession});qe.registerCommand("workbench.action.terminal.chat.openTerminalSettingsLink",async(a,i)=>{let e=a.get(Po);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}}}});qe.registerCommand("workbench.action.terminal.chat.disableSessionAutoApproval",async(a,i)=>{a.get(kv).setChatSessionAutoApproval(i,!1)});var Wjt=class{constructor(){this.priority=110;this.name="terminalChat";this.when=Ba.focused;this.type="help"}getProvider(i){let t=i.get(Yo).activeInstance;if(!t)return;let o=aln(i);return new tp("terminal-chat",{type:"help"},()=>o,()=>sm.get(t)?.terminalChatWidget?.focus(),"accessibility.verbosity.terminalChat")}};function aln(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(14558,null)),e.push(d(14547,null,s)),e.push(r?d(14552,null,r):d(14553,null)),e.push(t?d(14556,null,t):d(14557,null)),e.push(l?d(14550,null,l):d(14551,null)),e.push(c?d(14548,null,c):d(14549,null)),e.push(o?d(14559,null,o):d(14560,null)),e.push(n?d(14554,null,n):d(14555,null)),e.push(d(14561,null)),e.push(d(14546,null)),e.join(`
`)}var Mfe=class{constructor(i,e){this._store=new P;this._ctxHasProvider=Ba.hasChatAgent.bindTo(e),this._store.add(H.runAndSubscribe(i.onDidChangeAgents,()=>{let t=!!i.getDefaultAgent("terminal");this._ctxHasProvider.set(t)}))}static{this.Id="terminalChat.enabler"}dispose(){this._ctxHasProvider.reset(),this._store.dispose()}};Mfe=I([m(0,br),m(1,X)],Mfe);var BHe=class extends C{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 jt);this._chatSessionListenersByTerminalInstance=this._register(new jt);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 vt;this._sessionAutoApproveRules=new vt;this._hasToolTerminalContext=Ba.hasChatTerminals.bindTo(this._contextKeyService),this._hasHiddenToolTerminalContext=Ba.hasHiddenChatTerminals.bindTo(this._contextKeyService),this._restoreFromStorage(),this._register(this._chatService.onDidDisposeSession(s=>{for(let l of s.sessionResource)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.sessionResource)cs.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())),(Xo(t.shellLaunchConfig?.attachPersistentProcess?.id)||Xo(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)Ae(o)&&Xo(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=Xo(o.persistentProcessId)?o.persistentProcessId:o.shellLaunchConfig.attachPersistentProcess?.id,r=o.shouldPersist||o.shellLaunchConfig.forcePersist;Xo(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)}};BHe=I([m(0,ne),m(1,Yo),m(2,le),m(3,X),m(4,Si)],BHe);up(sm.ID,sm,!1);xa.register(new Fjt);xa.register(new Wjt);pt(Mfe.Id,Mfe,ut.AfterRestored);we(kv,BHe,1);var Goe=class extends C{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(Goe.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(tJi).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=hn(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&&_w(s)?t.markTracker.showCommandGuide(s):t.markTracker.showCommandGuide(void 0)}};Goe=I([m(1,B)],Goe);up(Goe.ID,Goe,!1);var gRv=J("terminalCommandGuide.foreground",{dark:ei(xf,1),light:ei(xf,1),hcDark:cb,hcLight:cb},d(14753,null));var LOi;function Yst(a){return LOi||(LOi=a.get(F).createInstance(HHe,"dirs")),LOi}var ROi;function UHe(a){return ROi||(ROi=a.get(F).createInstance(HHe,"commands")),ROi}var HHe=class extends C{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 il(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 Xo(e)?e:100}_getTimestampStorageKey(){return`terminal.history.timestamp.${this._storageDataKey}`}_getEntriesStorageKey(){return`terminal.history.entries.${this._storageDataKey}`}};HHe=I([m(1,B),m(2,le)],HHe);var Vjt=new Map;async function ECo(a,i){let e=Vjt.get(i);if(e===null)return;if(e!==void 0)return e;let t;switch(i){case"bash":t=await lln(a);break;case"pwsh":t=await uln(a);break;case"zsh":t=await cln(a);break;case"fish":t=await pln(a);break;case"python":t=await dln(a);break;default:return}if(t===void 0){Vjt.set(i,null);return}return Vjt.set(i,t),t}function TCo(){Vjt.clear()}async function lln(a){let i=a.get(be),e=a.get(yo),t=await e.getEnvironment();if(t?.os===1||!t&&ri)return;let o="~/.bash_history",n=t?.userHome?.fsPath??fp.HOME,r=await Xst(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 cln(a){let i=a.get(be),e=a.get(yo),t=await e.getEnvironment();if(t?.os===1||!t&&ri)return;let o="~/.zsh_history",n=t?.userHome?.fsPath??fp.HOME,r=await Xst(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 dln(a){let i=a.get(be),e=a.get(yo),t=await e.getEnvironment(),o="~/.python_history",n=t?.userHome?.fsPath??fp.HOME,r=await Xst(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 uln(a){let i=a.get(be),e=a.get(yo),t,o,n=await e.getEnvironment(),r=n?.os===1||!n&&ri,s;r?(t=fp.APPDATA,o="Microsoft\\Windows\\PowerShell\\PSReadLine\\ConsoleHost_history.txt",s="$APPDATA\\Microsoft\\Windows\\PowerShell\\PSReadLine\\ConsoleHost_history.txt"):(t=n?.userHome?.fsPath??fp.HOME,o=".local/share/powershell/PSReadline/ConsoleHost_history.txt",s=`~/${o}`);let l=await Xst(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 pln(a){let i=a.get(be),e=a.get(yo),t=await e.getEnvironment();if(t?.os===1||!t&&ri)return;let o=fp.XDG_DATA_HOME,n,r,s;o?(s="$XDG_DATA_HOME/fish/fish_history",n=fp.XDG_DATA_HOME,r="fish/fish_history"):(s="~/.local/share/fish/fish_history",n=t?.userHome?.fsPath??fp.HOME,r=".local/share/fish/fish_history");let l=await Xst(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=mln(u[p]).trim();h.length>0&&c.add(h)}return{sourceLabel:s,sourceResource:l.resource,commands:Array.from(c.values())}}function mln(a){return hln(/(^|[^\\])((?:\\\\)*)(\\n)/g,a,`$1$2
`)}function hln(a,i,e){let t,o=i;for(;;)if(t=o,o=o.replace(a,e),o===t)return o}async function Xst(a,i,e,t,o){if(!a)return;let n=o.getConnection(),r=!!n?.remoteAuthority,s=A.from({scheme:r?Y.vscodeRemote:Y.file,authority:r?n.remoteAuthority:void 0,path:A.file(Ld(a,i)).path}),l;try{l=await t.readFile(s)}catch(c){if(c instanceof As&&c.fileOperationResult===1)return;throw c}if(l!==void 0)return{resource:s,content:l.value.toString()}}var LCo=q.asClassName(M.pin),MOi=q.asClassName(M.pinned),RCo=[LCo,MOi];function Bjt(a,i,e,t){let o=e.items,n=_Co(i,e,a,void 0,t),r=new P;return r.add(e.onDidTriggerItemButton(async s=>{s.button.iconClass&&RCo.includes(s.button.iconClass)&&(e.items=o,n=_Co(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 _Co(a,i,e,t,o){let n=[],r;t?r=fln(a,t,e):r=MCo(a,e),r.length&&n.push({type:"separator",label:d(2252,null)});let s=new Set;for(let l of r){let c=i.items.find(u=>gln(u,l));if(c){let u=Jst(c),p={...c};(!o||!s.has(u))&&(s.add(u),DCo(p,!1),n.push(p))}}for(let l of i.items)DCo(l,!0),n.push(l);return n}function Jst(a){return a.type==="separator"?"":a.id||`${a.label}${a.description}${a.detail}`}function DCo(a,i){if(a.type==="separator")return;let e=a.buttons?.filter(t=>t.iconClass&&!RCo.includes(t.iconClass))??[];e.unshift({iconClass:i?LCo:MOi,tooltip:i?d(2250,null):d(2251,null),alwaysVisible:!1}),a.buttons=e}function gln(a,i){return Jst(a)===Jst(i)}function fln(a,i,e){let t=i.buttons?.find(n=>n.iconClass===MOi),o=MCo(a,e);return t?o=o.filter(n=>Jst(n)!==Jst(i)):o.push(i),e.store(a,JSON.stringify(o.map(vln)),1,1),o}function MCo(a,i){let e=i.get(a,1);return e?JSON.parse(e):[]}function vln(a){return{label:a.label,description:a.description,detail:a.detail}}async function Zst(a,i,e,t,o,n){if(!i.xterm)return;let r=a.get(Wd),s=a.get(ee),l=a.get(F),c=a.get(Ge),u=a.get(le),p=a.get(wn),h=`terminal.pinnedRecentCommands.${i.shellType}`,g,f=[],v=new Set,b={iconClass:q.asClassName(jpo),tooltip:d(14808,null)},S={iconClass:q.asClassName(Qpo),tooltip:d(14814,null),alwaysVisible:!1},y=[];if(t==="command"){let pe=function(ke){return ke.replace(/\r?\n/g,"\u23CE").replace(/\s\s\s+/g,"\u22EF")};g=it?d(14810,null):d(14809,null);let G=i.capabilities.get(2),$=G?.commands,te=G?.executingCommand;if(te&&v.add(te),$&&$.length>0)for(let ke=$.length-1;ke>=0;ke--){let Ee=$[ke],He=Ee.command.trim();if(He.length===0||v.has(He))continue;let Ve=NIo(Ee.cwd,i.userHome,i.os===1?"\\":"/");Ee.exitCode&&(Ee.exitCode===-1?Ve+=" failed":Ve+=` exitCode: ${Ee.exitCode}`),Ve=Ve.trim();let Fe=[S],Qt=f.length>0?f[f.length-1]:void 0;if(Qt?.type!=="separator"&&Qt?.label===He){Qt.id=Ee.timestamp.toString(),Qt.description=Ve;continue}f.push({label:pe(He),rawLabel:He,description:Ve,id:Ee.timestamp.toString(),command:Ee,buttons:Ee.hasOutput()?Fe:void 0}),v.add(He)}te&&f.unshift({label:pe(te),rawLabel:te,description:G.cwd}),f.length>0&&f.unshift({type:"separator",buttons:[],label:er.currentSessionCategory});let de=l.invokeFunction(UHe),se=[];for(let[ke,Ee]of de.entries)!v.has(ke)&&Ee.shellType===i.shellType&&(se.unshift({label:pe(ke),rawLabel:ke,buttons:[b]}),v.add(ke));se.length>0&&f.push({type:"separator",buttons:[],label:er.previousSessionCategory},...se);let Se=await l.invokeFunction(ECo,i.shellType);if(Se!==void 0){let ke=[];for(let Ee of Se.commands)v.has(Ee)||ke.unshift({label:pe(Ee),rawLabel:Ee});if(ke.length>0){let Ee={iconClass:q.asClassName(Xpo),tooltip:d(14807,null),alwaysVisible:!1,resource:Se.sourceResource};y.push(Ee),f.push({type:"separator",buttons:[Ee],label:d(14813,null,i.shellType),description:Se.sourceLabel},...ke)}}}else{g=it?d(14812,null):d(14811,null);let G=i.os===1?dx:ar,$=new Mn(se=>G.getComparisonKey(se)),te=i.capabilities.get(0)?.cwds||[];if(te&&te.length>0){for(let se of te){let Se=A.file(se);$.has(Se)||($.add(Se),f.push({label:await i.getUriLabelForShell(Se),rawLabel:se}))}f=f.reverse(),f.unshift({type:"separator",label:er.currentSessionCategory})}let pe=l.invokeFunction(Yst),de=[];for(let[se,Se]of pe.entries)if(Se===null||Se.remoteAuthority===i.remoteAuthority){let ke=Se?.remoteAuthority?await p.fileURI(se):A.file(se);$.has(ke)||($.add(ke),de.unshift({label:await i.getUriLabelForShell(ke),rawLabel:se,buttons:[b]}))}de.length>0&&f.push({type:"separator",label:er.previousSessionCategory},...de)}if(f.length===0)return;let w=new P,k={iconClass:q.asClassName(Ypo),tooltip:d(14806,null),toggle:{checked:o==="fuzzy"},location:3},T=w.add(l.createInstance($oe)),N=w.add(c.createQuickPick({useSeparators:!0})),O=f;N.items=[...O],N.sortByLabel=!1,N.placeholder=g,N.matchOnLabelMode=o||"contiguous",N.buttons=[k],w.add(N.onDidTriggerButton(G=>{G===k&&l.invokeFunction(Zst,i,e,t,k.toggle.checked?"fuzzy":"contiguous",N.value)})),w.add(N.onDidTriggerItemButton(async G=>{if(G.button===b)t==="command"?l.invokeFunction(UHe)?.remove(G.item.label):l.invokeFunction(Yst)?.remove(G.item.rawLabel);else if(G.button===S){let $=G.item.command,te=$?.getOutput();if(te&&$?.command){let pe=await T.provideTextContent(A.from({scheme:$oe.scheme,path:`${$.command}... ${Bs($.timestamp,!0)}`,fragment:te,query:`terminal-output-${$.timestamp}-${i.instanceId}`}));pe&&await s.openEditor({resource:pe.uri})}}await l.invokeFunction(Zst,i,e,t,o,n)})),w.add(N.onDidTriggerSeparatorButton(async G=>{let $=y.find(te=>G.button===te)?.resource;$&&await s.openEditor({resource:$})})),w.add(N.onDidChangeValue(async G=>{G||await l.invokeFunction(Zst,i,e,t,o,G)}));let V=!1;function U(){V=!1,i.xterm?.markTracker.restoreScrollState(),i.xterm?.markTracker.clear()}return w.add(N.onDidChangeActive(async()=>{let G=i.xterm;if(!G)return;let[$]=N.activeItems;if(!$)return;function te(pe){return yi(pe)&&"rawLabel"in pe}if(te($)&&$.command&&$.command.marker){V||(G.markTracker.saveScrollState(),V=!0);let pe=$.command.getPromptRowCount(),de=$.command.getCommandRowCount();G.markTracker.revealRange({start:{x:1,y:$.command.marker.line-(pe-1)+1},end:{x:i.cols,y:$.command.marker.line+(de-1)+1}})}else U()})),w.add(N.onDidAccept(async()=>{let G=N.activeItems[0],$;t==="cwd"?$=`cd ${await i.preparePathForShell(G.rawLabel)}`:$=G.rawLabel,N.hide(),V=!1,i.xterm?.markTracker.clear(),i.scrollToBottom(),i.runCommand($,!N.keyMods.alt),N.keyMods.alt&&i.focus()})),w.add(N.onDidHide(()=>U())),n&&(N.value=n),new Promise(G=>{e.set(!0),w.add(Bjt(u,h,N,!0)),w.add(N.onDidHide(()=>{e.set(!1),r.showLastProvider("terminal"),G(),w.dispose()}))})}var $oe=class extends C{constructor(e,t){super();this._modelService=t;this._register(e.registerTextModelContentProvider($oe.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)}};$oe=I([m(0,Nt),m(1,Ct)],$oe);var yG=class extends C{constructor(e,t,o){super();this._ctx=e;this._instantiationService=o;this._terminalInRunCommandPicker=at.inTerminalRunCommandPicker.bindTo(t);let n=this._register(new jt);this._register(e.instance.capabilities.onDidAddCapability(r=>{switch(n.deleteAndDispose(r.id),r.id){case 0:{let s=new P;s.add(r.capability.onDidChangeCwd(l=>{this._instantiationService.invokeFunction(Yst)?.add(l,{remoteAuthority:e.instance.remoteAuthority})})),n.set(r.id,s);break}case 2:{let s=new P;s.add(r.capability.onCommandFinished(l=>{l.command.trim().length>0&&this._instantiationService.invokeFunction(UHe)?.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(yG.ID)}async runRecent(e,t,o){return this._instantiationService.invokeFunction(Zst,this._ctx.instance,this._terminalInRunCommandPicker,e,t,o)}};yG=I([m(1,X),m(2,F)],yG);up(yG.ID,yG);var POi=x.or(at.processSupported,at.terminalHasBeenCreated);Sr({id:"workbench.action.terminal.clearPreviousSessionHistory",title:L(14803,"Clear Previous Session History"),precondition:POi,run:async(a,i)=>{UHe(i).clear(),TCo()}});Gl({id:"workbench.action.terminal.goToRecentDirectory",title:L(14804,"Go to Recent Directory..."),metadata:{description:L(14802,"Goes to a recent folder")},precondition:POi,keybinding:{primary:2085,when:at.focus,weight:200},menu:[{id:D.ViewTitle,group:"shellIntegration",order:0,when:x.equals("view",dc),isHiddenByDefault:!0},...[D.EditorTitle,D.CompactWindowEditorTitle].map(a=>({id:a,group:"1_shellIntegration",order:0,when:Fo.Scheme.isEqualTo(Y.vscodeTerminal),isHiddenByDefault:!0}))],run:async(a,i)=>{let e=yG.get(a);e&&(await e.runRecent("cwd"),a?.target===2?await i.editorService.revealActiveEditor():await i.groupService.showPanel(!1))}});Sr({id:"workbench.action.terminal.runRecentCommand",title:L(14805,"Run Recent Command..."),precondition:POi,keybinding:[{primary:2096,when:x.and($a,x.or(at.focus,x.and(ud,Kd.isEqualTo("terminal")))),weight:200},{primary:2608,mac:{primary:816},when:x.and(at.focus,$a.negate()),weight:200}],menu:[{id:D.ViewTitle,group:"shellIntegration",order:1,when:x.equals("view",dc),isHiddenByDefault:!0},...[D.EditorTitle,D.CompactWindowEditorTitle].map(a=>({id:a,group:"1_shellIntegration",order:1,when:Fo.Scheme.isEqualTo(Y.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 P,r=await new Promise(s=>{n.add(o.onDidChangeShellType(()=>s(!1))),n.add(o.onDisposed(()=>s(!0)))});if(n.dispose(),r)return}let t=yG.get(e);t&&(await t.runRecent("command"),e?.target===2?await a.editorService.revealActiveEditor():await a.groupService.showPanel(!1))}});var qoe=_,AOi=class extends C{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 P);this._disposables.value=t;let o=this._capabilities.get(2);o?t.add(H.once(o.promptInputModel.onDidStartInput)(()=>this._onDidRequestCreateHint.fire())):this._register(this._capabilities.onDidAddCapability(r=>{if(r.id===2){let s=r.capability;t.add(H.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)}},joe=class extends C{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(joe.ID)}xtermOpen(e){Wo(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(AOi,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 Yf?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(eat,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+"%")}}))}};joe=I([m(1,br),m(2,B),m(3,F),m(4,ku)],joe);up(joe.ID,joe,!1);var eat=class extends C{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 P);this._isVisible=!1;this._ariaLabel="";this._toDispose.add(e.onDidFocus(()=>{this._instance.hasFocus&&this._isVisible&&this._ariaLabel&&this._configurationService.getValue("accessibility.verbosity.terminalChat")&&Or(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=qoe("a",void 0,n);this._toDispose.add(j(s,re.CLICK,o));let l=qoe("span.terminal-initial-hint-prose",void 0),c=qoe("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=qoe("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(14818,null,S),{before:k,after:T}=this._createWrappedHintElements(w,S,t);s.appendChild(k);let N=n.disposables.add(new ah(s,zo));N.set(b),N.element.style.width="min-content",N.element.style.display="inline",N.element.style.cursor="pointer",this._toDispose.add(j(N.element,re.CLICK,t)),s.appendChild(T),s.appendChild(qoe("span.terminal-initial-hint-separator")),e.push(w)}}else{let y=d(14823,null),w=RL(y,{actionHandler:n});s.appendChild(w),e.push(d(14824,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(14825,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 ah(s,zo));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(qoe("span.terminal-initial-hint-separator")),e.push(b)}if(e.length===0)return;let p=d(14819,null),h=RL(p,{actionHandler:r});h.classList.add("detail","terminal-initial-hint-prose");let g=qoe("span.terminal-initial-hint-prose",void 0,d(14822,null));s.appendChild(g),s.appendChild(h);let f=d(14821,null),v=RL(f,{actionHandler:r});return v.classList.add("detail","terminal-initial-hint-compact"),s.appendChild(v),e.push(d(14820,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=qoe(".terminal-initial-hint"),this._domNode.style.paddingLeft="4px",this._domNode.append(t),this._ariaLabel=o.concat(d(14816,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 yn(Ki(),n),getActions:()=>[{id:"workench.action.disableTerminalInitialHint",label:d(14817,null),tooltip:d(14817,null),enabled:!0,class:void 0,run:()=>this._configurationService.updateValue("terminal.integrated.initialHint",!1)}]})}))}return this._domNode}dispose(){this._domNode?.remove(),super.dispose()}};eat=I([m(1,br),m(2,vr),m(3,ge),m(4,B),m(5,ze),m(6,_e),m(7,Te)],eat);function A0(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 Hjt(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 N0(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 PCo(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 Ujt(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 tat(a){return a===1?Ms:Lo}var zjt=class{constructor(i,e,t){this.id=i;this.xterm=e;this._provideLinks=t;this.maxLinkLength=2e3}async detect(i,e,t){let o=N0(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=A0(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 zHe=class extends C{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=Me(e),n=o.document,r=this._hoverListeners.value=new P;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,Hjt(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:it?e.metaKey:e.ctrlKey}};zHe=I([m(12,B)],zHe);var KHe=class extends C{constructor(e,t){super();this._detector=e;this._instantiationService=t;this._activeLinksStore=this._register(new P);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(zHe,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(14835,null);case"LocalFile":return d(14833,null);case"LocalFolderInWorkspace":return d(14831,null);case"LocalFolderOutsideWorkspace":return d(14834,null);case"Url":default:return d(14832,null)}}};KHe=I([m(1,F)],KHe);var bln=new co(()=>NCo(!0)),ACo=new co(()=>NCo(!1));function NCo(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 OCo(a){let i=iat(a)?.suffix;return i?a.substring(0,i.index):a}function FCo(a){let i=a.startsWith("\\\\?\\")?4:0,e=a.indexOf("?",i);return e===-1?a:a.substring(0,e)}function Sln(a){let i,e=[];for(ACo.value.lastIndex=0;(i=ACo.value.exec(a))!==null;){let t=WCo(i);if(t===null)break;e.push(t)}return e}function iat(a){return WCo(bln.value.exec(a))}function WCo(a){let i=a?.groups;return!i||a.length<1?null:{row:Kjt(i.row0||i.row1||i.row2),col:Kjt(i.col0||i.col1||i.col2),rowEnd:Kjt(i.rowEnd0||i.rowEnd1||i.rowEnd2),colEnd:Kjt(i.colEnd0||i.colEnd1||i.colEnd2),suffix:{index:a.index,text:a[0]}}}function Kjt(a){return a===void 0?a:parseInt(a)}var Iln=/(?<path>(?:file:\/\/\/)?[^\s\|<>\[\({][^\s\|<>]*)$/;function Gjt(a,i){let e=wln(a),t=kln(a,i);return yln(e,t),e}function yln(a,i){a.length===0&&a.push(...i);for(let e of i)NOi(a,e,0,a.length)}function NOi(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?NOi(a,i,o+1,t):NOi(a,i,e,o-1)}function wln(a){let i=[],e=Sln(a);for(let t of e){let n=a.substring(0,t.suffix.index).match(Iln);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 Cln="(?:(?:(?:\\.\\.?|\\~|file://)|(?:[^\\0<>\\?\\s!`&*()\\[\\]'\":;\\\\][^\\0<>\\?\\s!`&*()'\":;\\\\]*))?(?:\\/(?:[^\\0<>\\?\\s!`&*()'\":;\\\\])+)+)",OOi="(?:\\\\\\\\\\?\\\\|file:\\/\\/\\/)?[a-zA-Z]:",xln=`(?:(?:(?:${OOi}|\\.\\.?|\\~)|(?:[^\\0<>\\?\\|\\/\\s!\`&*()\\[\\]'":;][^\\0<>\\?\\|\\/\\s!\`&*()'":;]*))?(?:(?:\\\\|\\/)(?:[^\\0<>\\?\\|\\/\\s!\`&*()'":;])+)+)`;function kln(a,i){let e=[],t=new RegExp(i===1?xln:Cln,"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 Eln=[/^ *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>.+))/],uQ=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=N0(this.xterm.buffer.active,e,t,this.xterm.cols);if(n===""||n.length>2e3)return[];let r=-1,s=0,l=this._processManager.os||zo,c=Gjt(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=A0(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=tat(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=Ujt(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,""),N=0;for(;T!==k;)u.suffix||N++,S.push(T),b.set(T,N),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 Eln){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=A0(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=PCo(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=Qoe(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}}}};uQ=I([m(4,Xs),m(5,dt),m(6,Pe)],uQ);function Qoe(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 $He=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:iat(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}})}};$He=I([m(0,ee)],$He);var qHe=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)}};qHe=I([m(0,ge)],qHe);var jHe=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})}};jHe=I([m(0,oi)],jHe);var QHe=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(aS)}async open(i){let e=tat(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=Gjt(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=Ujt(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=tat(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:Y.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}};QHe=I([m(5,be),m(6,F),m(7,Ge),m(8,Jp),m(9,Xs),m(10,Vt),m(11,Pe)],QHe);var YHe=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===Y.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(Qoe(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})}}};YHe=I([m(4,Qe),m(5,B),m(6,be),m(7,dt),m(8,Pe),m(9,Xs)],YHe);var Yoe=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 FOi(this.xterm,e,t),r=S$e.computeLinks(n),s=0;this._logService.trace("terminalUriLinkDetector#detect computedLinks",r);for(let l of r){let c=A0(i,this.xterm.cols,l.range,e),u=l.url?Ae(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!==Y.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=Qoe(g,f.isDirectory,this._uriIdentityService,this._workspaceContextService),b={text:Ae(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+)?$/,"")}};Yoe=I([m(3,Xs),m(4,dt),m(5,Pe)],Yoe);var FOi=class{constructor(i,e,t){this._xterm=i;this._lineStart=e;this._lineEnd=t}getLineCount(){return 1}getLineContent(){return N0(this._xterm.buffer.active,this._lineStart,this._lineEnd,this._xterm.cols)}};var Xoe=class extends C{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=N0(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=A0(e,this.xterm.cols,{startColumn:l.startIndex+1,startLineNumber:1,endColumn:l.endIndex+1,endLineNumber:1},t);if(jd(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(Ev).wordSeparators,t="";for(let o=57520;o<=57535;o++)t+=String.fromCharCode(o);this._separatorRegex=new RegExp(`[${Yr(e)}${t}]`,"g")}};Xoe=I([m(1,B),m(2,nt)],Xoe);var $jt=_,XHe=class extends C{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 WOi(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)}};XHe=I([m(4,tt),m(5,B)],XHe);var WOi=class extends Ma{constructor(e,t){super();this._options=t;this._targetElements=[];this._domNode=$jt("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=$jt("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=$jt("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=$jt("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 Tln=[/^ *(?<link>(?<line>\d+):(?<col>\d+)?)/],_ln=[/^(?<link>@@ .+ \+(?<toFileLine>\d+),(?<toFileCount>\d+) @@)/],Pfe=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=N0(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 Tln){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=N0(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=Qoe(g.uri,g.isDirectory,this._uriIdentityService,this._workspaceContextService),v=A0(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 _ln){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=N0(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=Qoe(g.uri,g.isDirectory,this._uriIdentityService,this._workspaceContextService),v=A0(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}};Pfe=I([m(3,Xs),m(4,dt),m(5,Pe)],Pfe);var JHe=class extends P{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(Ev).enableFileLinks){case"off":case!1:g=!1;break;case"notRemote":g=!this._processInfo.remoteAuthority;break}g&&(this._setupLinkDetector(Pfe.id,this._instantiationService.createInstance(Pfe,this._xterm,this._processInfo,this._linkResolver)),this._setupLinkDetector(uQ.id,this._instantiationService.createInstance(uQ,this._xterm,o,this._processInfo,this._linkResolver))),this._setupLinkDetector(Yoe.id,this._instantiationService.createInstance(Yoe,this._xterm,this._processInfo,this._linkResolver)),this._setupLinkDetector(Xoe.id,this.add(this._instantiationService.createInstance(Xoe,this._xterm)));let v=this._instantiationService.createInstance($He),b=this._instantiationService.createInstance(qHe),S=this._instantiationService.createInstance(jHe);this._openers.set("LocalFile",v),this._openers.set("LocalFolderInWorkspace",b),this._openers.set("LocalFolderOutsideWorkspace",S),this._openers.set("Search",this._instantiationService.createInstance(QHe,o,this._processInfo.initialCwd,v,b,()=>this._processInfo.os||zo)),this._openers.set("Url",this._instantiationService.createInstance(YHe,!!this._processInfo.remoteAuthority,v,b,S)),this._registerStandardLinkProviders();let y,w;this.add(Z(()=>{this._clearLinkProviders(),Ue(this._externalLinkProviders),y?.dispose(),w?.dispose()})),this._xterm.options.linkHandler={allowNonHttpProtocols:!0,activate:async(k,T)=>{if(!this._isLinkActivationModifierDown(k))return;let N=T.indexOf(":");if(N===-1)throw new Error(`Could not find scheme in link "${T}"`);let O=T.substring(0,N);u.config.allowedLinkSchemes.indexOf(O)===-1&&!await new Promise(U=>{l.prompt(St.Warning,d(14840,null,O),[{label:d(14836,null,O),run:()=>{let G=[...u.config.allowedLinkSchemes,O];this._configurationService.updateValue("terminal.integrated.allowedLinkSchemes",G),U(!0)}}],{onCancel:()=>U(!1)})})||this._openers.get("Url")?.open({type:"Url",text:T,bufferRange:null,uri:A.parse(T)})},hover:(k,T,N)=>{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},U={width:this._xterm.cols,height:this._xterm.rows};y=this._showHover({viewportRange:Hjt(N,this._xterm.buffer.active.viewportY),cellDimensions:V,terminalDimensions:U},this._getLinkHoverString(T,T),void 0,G=>this._xterm.options.linkHandler?.activate(k,G,N)),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(KHe,t));return this.add(n.onDidActivateLink(r=>{r.event?.preventDefault(),!(r.event&&!(r.event instanceof tde)&&!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:Ae(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 tde(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(Xoe.id)?.provideLinks(e,o));case"url":return await new Promise(o=>this._standardLinkProviders.get(Yoe.id)?.provideLinks(e,o));case"localFile":return(await new Promise(n=>this._standardLinkProviders.get(uQ.id)?.provideLinks(e,n)))?.filter(n=>n.type==="LocalFile");case"localFolder":return(await new Promise(n=>this._standardLinkProviders.get(uQ.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(XHe,e,t,o,n),l=this._widgetManager.attachWidget(s);return l&&r?.onInvalidated(()=>l.dispose()),l}}setWidgetManager(e){this._widgetManager=e}_clearLinkProviders(){Ue(this._linkProvidersDisposables),this._linkProvidersDisposables.length=0}_registerStandardLinkProviders(){let e=async n=>this.externalProvideLinksCb?.(n),t=`extension-${this._externalLinkProviders.length}`,o=this._setupLinkDetector(t,new zjt(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:it?e.metaKey:e.ctrlKey}_getLinkHoverString(e,t){let o=this._configurationService.getValue("editor"),n="";o.multiCursorModifier==="ctrlCmd"?it?n=d(14842,null):n=d(14841,null):it?n=d(14843,null):n=d(14844,null);let r=d(14838,null);try{this._tunnelService.canTunnel(A.parse(e))&&(r=d(14837,null))}catch{}let s=new xe("",!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(14839,null)),s.appendLink(e,t).appendMarkdown(` (${n})`)}};JHe=I([m(4,B),m(5,F),m(6,Ne),m(7,Te),m(8,ku),m(9,Xs),m(10,ap)],JHe);var qjt=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 ZHe=class extends P{constructor(e,t,o,n){super();this._accessibleViewService=e;this._labelService=o;this._quickInputService=n;this._editorSequencer=new Nm;this._onDidRequestMoreLinks=this.add(new E);this.onDidRequestMoreLinks=this._onDidRequestMoreLinks.event;this._terminalScrollStateSaved=!1;this._editorViewState=this.add(t.createInstance(oK))}async show(e,t){this._instance=e;let o=await Promise.race([t.all,Pi(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(14849,null)}),p.push(...u)),l&&(p.push({type:"separator",label:d(14845,null)}),p.push(...l)),c&&(p.push({type:"separator",label:d(14846,null)}),p.push(...c)),s&&(p.push({type:"separator",label:d(14848,null)}),p.push(...s));let h=this._quickInputService.createQuickPick({useSeparators:!0}),g=new P;g.add(h),h.items=p,h.placeholder=d(14847,null),h.sortByLabel=!1,h.show(),h.activeItems.length>0&&this._previewItem(h.activeItems[0]);let f=!1;return n||g.add(H.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(14849,null)}),T.push(...k)),y&&(T.push({type:"separator",label:d(14845,null)}),T.push(...y)),w&&(T.push({type:"separator",label:d(14846,null)}),T.push(...w)),S&&(T.push({type:"separator",label:d(14848,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(H.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 tde(re.CLICK),S=h.activeItems?.[0];S&&Wo(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(Wo(s,{uri:!0})&&s.uri){if((s.type==="LocalFile"||s.type==="LocalFolderInWorkspace"||s.type==="LocalFolderOutsideWorkspace")&&(l=Ra(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||!Wo(e,{link:!0})||!e.link)return;let t=e.link;this._previewItemInTerminal(t),!(!Wo(t,{uri:!0})||!t.uri)&&t.type==="LocalFile"&&this._previewItemInEditor(t)}_previewItemInEditor(e){let t=e.parsedLink?e.parsedLink.suffix:iat(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))}};ZHe=I([m(0,Wd),m(1,F),m(2,ot),m(3,Ge)],ZHe);var eUe=class{constructor(i){this._fileService=i;this._resolvedLinkCaches=new Map}async resolveLink(i,e,t){t&&t.scheme===Y.file&&i.remoteAuthority&&(t=t.with({scheme:Y.vscodeRemote,authority:i.remoteAuthority}));let o=this._resolvedLinkCaches.get(i.remoteAuthority??"");o||(o=new VOi,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=OCo(e);if(r=FCo(r),r.length===0)return o.set(e,null),null;if(ri&&e.match(/^\/mnt\/[a-z]/i)&&i.backend)r=await i.backend.getWslPath(r,"unix-to-win");else if(!(ri&&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:Y.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("^"+OOi)&&!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??zo)===1?Ms:Lo}};eUe=I([m(0,be)],eUe);var VOi=class{constructor(){this._cache=new Map;this._cacheTilTimeout=0}set(i,e){this._cacheTilTimeout&&It.clearTimeout(this._cacheTilTimeout),this._cacheTilTimeout=It.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}};we(j6e,qjt,1);var wH=class extends P{constructor(e,t,o){super();this._ctx=e;this._instantiationService=t;this._terminalLinkProviderService=o;this._linkResolver=this._instantiationService.createInstance(eUe)}static{this.ID="terminal.link"}static get(e){return e.getContribution(wH.ID)}xtermReady(e){let t=this._linkManager=this.add(this._instantiationService.createInstance(JHe,e.raw,this._ctx.processManager,this._ctx.instance.capabilities,this._linkResolver));if(bJi(this._ctx.processManager)){let o=t.add(H.once(this._ctx.processManager.onProcessReady)(()=>{t.setWidgetManager(this._ctx.widgetManager),this.delete(o)}))}else t.setWidgetManager(this._ctx.widgetManager);if(!dR(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(ZHe)),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)}};wH=I([m(1,F),m(2,j6e)],wH);up(wH.ID,wH,!0);var BOi=er.actionCategory;Gl({id:"workbench.action.terminal.openDetectedLink",title:L(14827,"Open Detected Link..."),f1:!0,category:BOi,precondition:at.terminalHasBeenCreated,keybinding:[{primary:3117,weight:201,when:at.focus},{primary:3109,weight:201,when:x.and(ud,x.equals(Kd.key,"terminal"))}],run:a=>wH.get(a)?.showLinkQuickpick()});Gl({id:"workbench.action.terminal.openUrlLink",title:L(14829,"Open Last URL Link"),metadata:{description:L(14830,"Opens the last detected URL/URI link in the terminal")},f1:!0,category:BOi,precondition:at.terminalHasBeenCreated,run:a=>wH.get(a)?.openRecentLink("url")});Gl({id:"workbench.action.terminal.openFileLink",title:L(14828,"Open Last Local File Link"),f1:!0,category:BOi,precondition:at.terminalHasBeenCreated,run:a=>wH.get(a)?.openRecentLink("localFile")});var jjt=class extends C{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 Sl(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?St.Warning:St.Info,n=this._getOsc99NotificationPriority(e.urgency),r={id:"terminal",label:d(14852,null)},s=e.buttonsPayload.length>0?e.buttonsPayload.split("\u2028"):[],l=this._register(new P),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 st(`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 st("terminal.osc99.dismiss",d(14851,null),void 0,!0,()=>{u.current&&(u.current.closeReason="secondary"),c.current?.close()}))),g.push(l.add(new st("terminal.osc99.disable",d(14850,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 nn(()=>{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 tUe=class extends C{constructor(e,t,o,n){super();this._ctx=e;this._configurationService=t;this._notificationService=o;this._logService=n;this._handler=this._register(new jjt({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)))}};tUe=I([m(1,B),m(2,Ne),m(3,Xs)],tUe);up(tUe.ID,tUe);var Joe=class extends C{constructor(e,t){super();this._configurationService=t;this._listener=this._register(new me)}static{this.ID="terminal.mouseWheelZoom"}static get(e){return e.getContribution(Joe.ID)}xtermOpen(e){this._register(H.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 HOi(e)}_setupMouseWheelZoomListener(e){let t=HU.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 it?(e.metaKey||e.ctrlKey)&&!e.shiftKey&&!e.altKey:e.ctrlKey&&!e.metaKey&&!e.shiftKey&&!e.altKey}};Joe=I([m(1,B)],Joe);up(Joe.ID,Joe,!0);Sr({id:"workbench.action.terminal.fontZoomIn",title:L(15030,"Increase Font Size"),run:async(a,i)=>{let e=i.get(B),t=e.getValue("terminal.integrated.fontSize");if(Xo(t)){let o=HOi(t+1);await e.updateValue("terminal.integrated.fontSize",o)}}});Sr({id:"workbench.action.terminal.fontZoomOut",title:L(15031,"Decrease Font Size"),run:async(a,i)=>{let e=i.get(B),t=e.getValue("terminal.integrated.fontSize");if(Xo(t)){let o=HOi(t-1);await e.updateValue("terminal.integrated.fontSize",o)}}});Sr({id:"workbench.action.terminal.fontZoomReset",title:L(15032,"Reset Font Size"),run:async(a,i)=>{await i.get(B).updateValue("terminal.integrated.fontSize",YNi)}});function HOi(a){return Math.max(6,Math.min(100,a))}up(P0.ID,P0);Sr({id:"workbench.action.terminal.toggleStickyScroll",title:L(14891,"Toggle Sticky Scroll"),toggled:{condition:x.equals("config.terminal.integrated.stickyScroll.enabled",!0),title:d(14890,null),mnemonicTitle:d(14889,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 CH=[],wG=class extends yh{constructor(e,t,o,n,r,s,l){super(wG.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){CH=[],CH.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&&CH.push(p)}}CH.length>0&&CH.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&&CH.push(c)}CH.length>0&&CH.push({type:"separator"});let n=d(14858,null);CH.push({label:`$(plus) ${n}`,ariaLabel:n,accept:()=>this._commandService.executeCommand("workbench.action.terminal.new")});let r=d(14859,null);return CH.push({label:`$(plus) ${r}`,ariaLabel:r,accept:()=>this._commandService.executeCommand("workbench.action.terminal.newWithProfile")}),CH}_createPick(e,t,o,n){let r=this._instantiationService.invokeFunction(cX,e),s=n?n.groupSize>1?`${n.groupIndex+1}.${t+1}`:`${n.groupIndex+1}`:`${t+1}`,l=`$(${r}) ${s}: ${e.title}`,c=[],u=oy(e);u&&c.push(u);let p=z_(e,this._themeService.getColorTheme().type);p&&c.push(...p);let h=Up(o,l,!0);if(h)return{label:l,description:e.description,highlights:{label:h},buttons:[{iconClass:q.asClassName(Upo),tooltip:d(14857,null)},{iconClass:q.asClassName(GHt),tooltip:er.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)}}}};wG=I([m(0,ge),m(1,ee),m(2,F),m(3,xv),m(4,jl),m(5,Yo),m(6,De)],wG);var Dln=oe.as(Tu.Quickaccess),Lln="inTerminalPicker";Dln.registerQuickAccessProvider({ctor:wG,prefix:wG.PREFIX,contextKey:Lln,placeholder:d(14856,null),helpEntries:[{description:d(14855,null),commandId:"workbench.action.quickOpenTerm"}]});var VCo="workbench.action.quickOpenNavigateNextInTerminalPicker";qe.registerCommand({id:VCo,handler:Y_(VCo,!0)});var BCo="workbench.action.quickOpenNavigatePreviousInTerminalPicker";qe.registerCommand({id:BCo,handler:Y_(BCo,!1)});Sr({id:"workbench.action.quickOpenTerm",title:L(14854,"Switch Active Terminal"),precondition:x.or(at.processSupported,at.terminalHasBeenCreated),run:(a,i)=>i.get(Ge).quickAccess.show(wG.PREFIX)});var Rln=["quick-fix","codicon","terminal-command-decoration","xterm-decoration"],iUe=class extends C{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(Pln(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 UOi(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,Aln(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 $e().token)},r=await Mln(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 P;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(...Rln);let u=t.every(h=>h.kind==="explain");u&&s.classList.add("explainOnly"),s.classList.add(...q.asClassNameArray(u?M.sparkle:M.lightBulb)),dAe(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))}};iUe=I([m(3,tr),m(4,nl),m(5,ge),m(6,B),m(7,lt),m(8,ot),m(9,Qe),m(10,Te),m(11,CEe)],iUe);async function Mln(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,YMi(i.buffer.active,e,i.cols,f.outputMatcher),f,new $e().token);else if(f.type==="unresolved"){if(!l)throw new Error("No resolved fix provider");v=await l(f,f.outputMatcher?YMi(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 Yl(v)){let S;if(Wo(b,{type:!0})){switch(b.type){case 0:{let y=b;if(c.has(y.terminalCommand))continue;c.add(y.terminalCommand);let w=d(14861,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===Y.http||y.uri.scheme===Y.https?encodeURI(y.uri.toString(!0)):r.getUriLabel(y.uri),T=d(14862,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 Pln(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 UOi=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 Aln(a,i){let e=[];e.push({kind:"header",group:{kind:gr.QuickFix,title:d(14860,null)}});for(let t of i?a:a.filter(o=>!!o.action))!t.disabled&&t.action&&e.push({kind:"action",item:t,group:{kind:gr.QuickFix,icon:Nln(t),title:t.action.label},disabled:!1,label:t.title});return e}function Nln(a){if(a.kind==="explain")return M.sparkle;switch(a.type){case 1:if(a.action.uri)return a.action.uri.scheme===Y.http||a.action.uri.scheme===Y.https?M.linkExternal:M.goToFile;case 0:return M.run;case 2:return M.debugDisconnect;case 3:return M.lightbulb}}var zOi=/git/,Oln=/and can be fast-forwarded/,zCo=/git\s+push/,Fln=/error: did you mean `--(.+)` \(with two dashes\)\?/,Wln=/(?:(most similar commands? (is|are)))/,Vln=/(?: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})/,Bln=/git push --set-upstream origin (?<branchName>[^\s]+)/,Hln=/remote:\s*(?<link>https:\/\/github\.com\/.+\/.+\/pull\/new\/.+)/,HCo=/Suggestion \[General\]:/,UCo=/Suggestion \[cmd-not-found\]:/;function KCo(){return{id:"Git Similar",type:"internal",commandLineMatcher:zOi,outputMatcher:{lineMatcher:Wln,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 GCo(){return{id:"Git Fast Forward Pull",type:"internal",commandLineMatcher:zOi,outputMatcher:{lineMatcher:Oln,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 $Co(){return{id:"Git Two Dashes",type:"internal",commandLineMatcher:zOi,outputMatcher:{lineMatcher:Fln,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 qCo(a){return{id:"Free Port",type:"internal",commandLineMatcher:/.+/,outputMatcher:{lineMatcher:Vln,anchor:"bottom",offset:0,length:30},commandExitResult:"error",getQuickFixes:i=>{let e=i?.outputMatch?.regexMatch?.groups?.portNumber;if(!e)return;let t=d(14865,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 jCo(){return{id:"Git Push Set Upstream",type:"internal",commandLineMatcher:zCo,outputMatcher:{lineMatcher:Bln,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 QCo(){return{id:"Git Create Pr",type:"internal",commandLineMatcher:zCo,outputMatcher:{lineMatcher:Hln,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(14864,null,i),enabled:!0,type:1,uri:A.parse(i),source:"builtin"}:void 0}}}function YCo(){return{id:"Pwsh General Error",type:"internal",commandLineMatcher:/.+/,outputMatcher:{lineMatcher:HCo,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(HCo)){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 XCo(){return{id:"Unix Command Not Found",type:"internal",commandLineMatcher:/.+/,outputMatcher:{lineMatcher:UCo,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(UCo)){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 Qjt=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=>Uln.setHandler(e=>{i(e.filter(t=>Ea(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))})}},Uln=Tn.registerExtensionPoint({extensionPoint:"terminalQuickFixes",defaultExtensionKind:["workspace"],activationEventsGenerator:function*(a){for(let i of a??[])yield`onTerminalQuickFixRequest:${i.id}`},jsonSchema:{description:d(14866,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(14869,null),type:"string"},commandLineMatcher:{description:d(14868,null),type:"string"},outputMatcher:{markdownDescription:d(14871,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(14867,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(14870,null,'`"fix"`'),enum:["default","explain"],enumDescriptions:["A high confidence quick fix.","An explanation of the problem."]}}}}});we(CEe,Qjt,1);var pQ=class extends P{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(pQ.ID)}get addon(){return this._addon}xtermReady(e){this._addon=this._instantiationService.createInstance(iUe,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[$Co(),GCo(),qCo((o,n)=>this._ctx.instance.freePortKillProcess(o,n)),KCo(),jCo(),QCo(),XCo(),YCo()])this._addon.registerCommandFinishedListener(t)}};pQ=I([m(1,F)],pQ);up(pQ.ID,pQ);Gl({id:"workbench.action.terminal.showQuickFixes",title:L(14863,"Show Terminal Quick Fixes"),precondition:at.focus,keybinding:{primary:2137,weight:200},run:a=>pQ.get(a)?.addon?.showMenu()});var zln=/^\x1b\[[0-9;]*m/,Kln=/^\x1b\[?([0-9]*)(;[35])?O?([DC])/,Gln=/[^a-z0-9]/i;var $ln=/^(\x1b\[(\??25[hl]|\??[0-9;]+n))+/,YOi=a=>a._core,exo=a=>{};var KOi=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`}},qln=(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(Gln.test(n)){if(t)break}else t=!0;i.shift(e)}e<0&&i.shift(1)};var Yjt=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}},GOi=class{constructor(){this.clearAfterTimeout=!1}apply(){return""}rollback(){return""}rollForwards(){return""}matches(){return 1}},Xjt=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)}},jln=a=>a instanceof Xjt&&a.inner instanceof nat,nat=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:rat(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(zln););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}},Jjt=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:rat(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)+rat(YOi(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}},Zjt=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
`)}},$Oi=class extends Zjt{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
`)}},oat=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?rat(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++)qln(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}`)}},qOi=class extends C{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()}},jOi=class extends C{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 Yjt(e),s=this._expected[0].gen,l=()=>{let c=r.eatRe($ln);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+=rat(YOi(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 Xjt(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&&exo(this.terminal),this._physicalCursor=new KOi(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}},txo=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},rat=a=>`\x1B[${txo(a).join(";")}m`,JCo=(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},Qln=(a,i)=>{let e=[0,0,-1,0,0,0],t=0,o=0;do{let n=a[i+o];if(e[o+t]=Xo(n)?n:n[0],!Xo(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},oUe=class oUe{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(txo(YOi(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=Xo(o)?o:o[0];if(this._expectedIncomingStyles){if(JCo(i,t,this._undoArgs)){this._expectedIncomingStyles--,t+=this._undoArgs.length;continue}if(JCo(i,t,this._applyArgs)){this._expectedIncomingStyles--,t+=this._applyArgs.length;continue}}let r=n===38||n===48||n===58?Qln(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=oUe._compileArgs(this._undoArgs))}onUpdate(i){let{applyArgs:e,undoArgs:t}=this._getArgs(i);this._applyArgs=e,this._undoArgs=this._originalUndoArgs=t,this.apply=oUe._compileArgs(this._applyArgs),this.undo=oUe._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=Oe.fromHex(i)}catch{e=new Oe(new Bt(255,0,0,1))}let{r:t,g:o,b:n}=e.rgba;return{applyArgs:[38,2,t,o,n],undoArgs:[39]}}}}};I([Nd(2e3)],oUe.prototype,"debounceStopTracking",1);var QOi=oUe,ZCo=(a=Zui)=>new RegExp(`\\b(${a.map(Yr).join("|")})\\b`,"i");var Afe=class extends C{constructor(e,t,o){super();this._processManager=e;this._configurationService=t;this._telemetryService=o;this._terminalTitle="";this._typeaheadThreshold=this._configurationService.getValue(Ev).localEchoLatencyThreshold,this._excludeProgramRe=ZCo(this._configurationService.getValue(Ev).localEchoExcludePrograms),this._register(Z(()=>this._clearPredictionDebounce?.dispose()))}activate(e){let t=this._typeaheadStyle=this._register(new QOi(this._configurationService.getValue(Ev).localEchoStyle,e)),o=this._timeline=this._register(new jOi(e,this._typeaheadStyle)),n=this.stats=this._register(new qOi(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(Ev)&&(t.onUpdate(this._configurationService.getValue(Ev).localEchoStyle),this._typeaheadThreshold=this._configurationService.getValue(Ev).localEchoLatencyThreshold,this._excludeProgramRe=ZCo(this._configurationService.getValue(Ev).localEchoExcludePrograms),this._reevaluatePredictorState(n,o))})),this._register(this._timeline.onPredictionSucceeded(s=>{this._lastRow?.charState===1&&jln(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=nn(()=>{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 Yjt(e);for(;l.remaining>0;){if(l.eatCharCode(127)){let u=this._timeline.peekEnd();u&&u instanceof nat&&this._timeline.addBoundary(),this._timeline.isShowingPredictions&&exo(this._timeline.terminal),this._timeline.tentativeCursor(o).x<=this._lastRow.startingX?this._timeline.addBoundary(o,new Jjt(this._timeline.terminal)):(this._lastRow.endingX--,this._timeline.addPrediction(o,new Jjt(this._timeline.terminal)));continue}if(l.eatCharCode(32,126)){let u=e[l.index-1],p=new nat(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 $Oi);continue}let c=l.eatRe(Kln);if(c){let u=c[3],p=new oat(u,!!c[2],Number(c[1])||1);u==="D"?r(p):s(p);continue}if(l.eatStr("\x1Bf")){s(new oat("C",!0,1));continue}if(l.eatStr("\x1Bb")){r(new oat("D",!0,1));continue}if(l.eatChar("\r")&&o.cursorY<t.rows-1){this._timeline.addPrediction(o,new Zjt);continue}this._timeline.addBoundary(o,new GOi);break}this._timeline.length===1&&(this._deferClearingPredictions(),this._typeaheadStyle.startTracking())}_onBeforeProcessData(e){this._timeline&&(e.data=this._timeline.beforeServerInput(e.data),this._deferClearingPredictions())}};I([Nd(100)],Afe.prototype,"_reevaluatePredictorState",1),Afe=I([m(1,B),m(2,Te)],Afe);var Zoe=class extends P{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(Zoe.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(Ev).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(Afe,this._ctx.processManager),e.loadAddon(this._addon))}};Zoe=I([m(1,B),m(2,F)],Zoe);up(Zoe.ID,Zoe);var e5t=class extends C{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=nn(()=>{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 t5t=class extends C{constructor(e){super();this._ctx=e;this._overlay=this._register(new me)}static{this.ID="terminal.resizeDimensionsOverlay"}xtermOpen(e){this._ctx.processManager.ptyProcessReady.then(()=>{Pi(1e3).then(()=>{this._store.isDisposed||(this._overlay.value=new e5t(this._ctx.instance.domElement,e))})})}};up(t5t.ID,t5t);function Yln(a){return Ae(a)?a:void 0}var oxo=async(a,i)=>{let e=a.get(Ge),t=a.get(sp),o=a.get(Pe),n=a.get(zs),s=a.get(Yo).activeInstance;if(s){let c=function(g){return yi(g)&&"text"in g}(i)?Yln(i.text):void 0;if(!c){if(c=await e.input({value:"",placeHolder:"Enter sequence to send (supports \\n, \\r, \\xAB)",prompt:d(14874,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?Y.vscodeRemote:Y.file),p=u?o.getWorkspaceFolder(u)??void 0:void 0,h=await t.resolveAsync(p,c);s.sendText(h,!1)}},ixo=L(14872,"Send Sequence");Sr({id:"workbench.action.terminal.sendSequence",title:ixo,f1:!0,metadata:{description:ixo.value,args:[{name:"args",schema:{type:"object",required:["text"],properties:{text:{description:d(14873,null),type:"string"}}}}]},run:(a,i,e)=>oxo(i,e)});function vI(a,i){yt.registerCommandAndKeybindingRule({id:"workbench.action.terminal.sendSequence",weight:200,when:i.when||at.focus,primary:i.primary,mac:i.mac,linux:i.linux,win:i.win,handler:oxo,args:{text:a}})}ri&&vI("",{when:x.and(at.focus,x.equals("terminalShellType","pwsh"),$a.negate()),primary:2100});vI("\x1B[24~a",{when:x.and(at.focus,x.equals("terminalShellType","pwsh"),at.terminalShellIntegrationEnabled,x.equals("config.terminal.integrated.enableWin32InputMode",!0),$a.negate()),primary:2058,mac:{primary:266}});vI("\x1B[24~b",{when:x.and(at.focus,x.equals("terminalShellType","pwsh"),at.terminalShellIntegrationEnabled,x.equals("config.terminal.integrated.enableWin32InputMode",!0),$a.negate()),primary:522});vI("\x1B[24~c",{when:x.and(at.focus,x.equals("terminalShellType","pwsh"),at.terminalShellIntegrationEnabled,x.equals("config.terminal.integrated.enableWin32InputMode",!0),$a.negate()),primary:1027});vI("\x1B[24~d",{when:x.and(at.focus,x.equals("terminalShellType","pwsh"),at.terminalShellIntegrationEnabled,x.equals("config.terminal.integrated.enableWin32InputMode",!0),$a.negate()),mac:{primary:3089}});vI("\x1B[1;2H",{when:x.and(at.focus,x.equals("terminalShellType","pwsh"),x.equals("config.terminal.integrated.enableWin32InputMode",!0)),mac:{primary:3087}});vI("\x1B[1;5A",{when:x.and(at.focus),primary:528});vI("\x1B[1;5B",{when:x.and(at.focus),primary:530});vI("\x1B"+(it?"f":"[1;5C"),{when:x.and(at.focus),primary:529});vI("\x1B"+(it?"b":"[1;5D"),{when:x.and(at.focus),primary:527});vI("",{when:x.and(at.focus,$a),primary:2608,mac:{primary:816}});vI("\x07",{when:at.focus,primary:2597,mac:{primary:805}});Nc&&vI("",{when:x.and(at.focus),primary:289});vI("",{primary:2049,mac:{primary:513}});ri&&vI("\b",{when:x.and(at.focus,x.equals("terminalShellType","cmd")),primary:2049});vI("\x1Bd",{primary:2068,mac:{primary:532}});vI("",{mac:{primary:2049}});vI("",{mac:{primary:2063}});vI("",{mac:{primary:2065}});vI("\0",{primary:3095,mac:{primary:1303}});vI("",{primary:3099,mac:{primary:1307}});function Xln(a){return Ae(a)?a:void 0}var nxo=L(14878,"Send Signal");Sr({id:"workbench.action.terminal.sendSignal",title:nxo,f1:!ri,metadata:{description:nxo.value,args:[{name:"args",schema:{type:"object",required:["signal"],properties:{signal:{description:d(14879,null),type:"string"}}}}]},run:async(a,i,e)=>{let t=i.get(Ge),o=a.service.activeInstance;if(!o)return;function n(s){return yi(s)&&"signal"in s}let r=n(e)?Xln(e.signal):void 0;if(!r){let s=[{label:"SIGINT",description:d(14882,null)},{label:"SIGTERM",description:d(14886,null)},{label:"SIGKILL",description:d(14883,null)},{label:"SIGSTOP",description:d(14885,null)},{label:"SIGCONT",description:d(14880,null)},{label:"SIGHUP",description:d(14881,null)},{label:"SIGQUIT",description:d(14884,null)},{label:"SIGUSR1",description:d(14887,null)},{label:"SIGUSR2",description:d(14888,null)},{type:"separator"},{label:d(14876,null)}],l=await t.pick(s,{placeHolder:d(14877,null)});if(!l)return;if(l.label===d(14876,null)){let c=await t.input({prompt:d(14875,null)});if(!c)return;r=c}else r=l.label}await o.sendSignal(r)}});var sat=class{constructor(i,e){this.leadingLineContent=i;this.characterCountDelta=e}};var i5t=class{constructor(i,e,t){this._items=i;this._lineContext=e;this._rawCompareFn=t;this._refilterKind=1;this._fuzzyScoreOptions={...hq.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?wL:Qbt;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=uv.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=uv.Default;else{let f=l(o,n,g,u.textLabel,u.labelLow,0,this._fuzzyScoreOptions);if(!f&&o!=="")continue;u.score=f||uv.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?r6(i.length-.85,i,(c,u)=>c-u):0}}};function JOi(a){return`simple-suggest-aria-id-${a}`}var nUe=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 P;this.templateId="suggestion"}dispose(){this._onDidToggleDetails.dispose(),this._disposables.dispose()}renderTemplate(i){let e=new P,t=i;t.classList.add("show-file-icons");let o=R(i,_(".icon")),n=R(o,_("span.colorspan")),r=R(i,_(".contents")),s=R(r,_(".main")),l=R(s,_(".icon-label.codicon")),c=R(s,_("span.left")),u=R(s,_("span.right")),p=new Lc(c,{supportHighlights:!0,supportIcons:!0});e.add(p);let h=R(c,_("span.signature-label")),g=R(c,_("span.qualifier-label")),f=R(u,_("span.details-label")),v=()=>{let{fontFamily:S,fontSize:y,lineHeight:w,fontWeight:k,letterSpacing:T}=this._getFontInfo(),N=`${y}px`,O=`${w}px`,V=`${T}px`;t.style.fontSize=N,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=JOi(e),t.colorspan.style.backgroundColor="";let n={labelEscapeNewLines:!0,matches:ua(i.score)};if(o.kindLabel==="File"&&this._themeService.getFileIconTheme().hasFileIcons){t.icon.className="icon hide",t.iconContainer.className="icon hide";let r=js(this._modelService,this._languageService,A.from({scheme:"fake",path:i.textLabel}),0),s=js(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=[js(this._modelService,this._languageService,A.from({scheme:"fake",path:i.textLabel}),1),js(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||M.symbolText)));if(t.iconLabel.setLabel(i.textLabel,void 0,n),typeof o.label=="string")t.parametersLabel.textContent="",t.detailsLabel.textContent=XOi(o.detail||""),t.root.classList.add("string-label");else{let r=XOi(o.label.detail||"");t.parametersLabel.textContent=Zln(r),t.detailsLabel.textContent=XOi(o.label.description||""),t.root.classList.remove("string-label")}bn(t.detailsLabel),t.right.classList.remove("can-expand-details")}disposeTemplate(i){i.disposables.dispose()}};nUe=I([m(2,De),m(3,Ct),m(4,kt)],nUe);function XOi(a){return a.replace(/\r\n|\r|\n/g,"")}var Jln=/^[\s()[\]{}<>"'`~!@#$%^&*+=,.:;?/\\|-]/;function Zln(a){return a?Jln.test(a)?a:` ${a}`:""}function ZOi(a){return!!a&&!!(a.completion.documentation||a.completion.detail&&a.completion.detail!==a.completion.label)}var rxo="suggest-details";var rUe=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 P;this._renderDisposeable=this._disposables.add(new P);this._borderWidth=1;this._size=new ai(330,0);this.domNode=_(".suggest-details"),this.domNode.classList.add("no-docs"),this._body=_(".body"),this._scrollbar=new Pa(this._body,{alwaysConsumeMouseWheel:!0}),R(this.domNode,this._scrollbar.getDomNode()),this._disposables.add(this._scrollbar),this._header=R(this._body,_(".header")),this._close=R(this._header,_("span"+q.asCSSSelector(M.close))),this._close.title=d(17222,null),this._close.role="button",this._close.tabIndex=-1,this._type=R(this._header,_("p.type")),this._docs=R(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(17223,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 xe().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&&(!ZOi(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,bn(this._type),this._type.classList.toggle("auto-wrap",!/\r?\n^\s+/gmi.test(c))}else Rt(this._type),this._type.title="",xo(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 ai(i,e);ai.equals(t,this._size)||(this._size=t,fN(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()}};rUe=I([m(3,F),m(4,Qn)],rUe);var o5t=class{constructor(i,e,t){this.widget=i;this._container=e;this._disposables=new P;this._added=!1;this._resizable=this._disposables.add(new nO),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=Fm(this.getDomNode().ownerDocument.body),o=this.widget.getLayoutInfo(),n=new ai(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,U=new ai(O,t.height-i.top-o.borderHeight-o.verticalPadding),G=U.with(void 0,i.top+i.height-o.borderHeight-o.verticalPadding);return{top:r,left:V,fit:O-e.width,maxSizeTop:U,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),U=new ai(O,t.height-i.top-o.borderHeight-o.verticalPadding),G=U.with(void 0,i.top+i.height-o.borderHeight-o.verticalPadding);return{top:r,left:V,fit:O-e.width,maxSizeTop:U,maxSizeBottom:G,minSize:n.with(Math.min(O,n.width))}})(),c=(function(){let O=i.left,V=-o.borderWidth+i.top+i.height,U=new ai(i.width-o.borderHeight,t.height-i.top-i.height-o.verticalPadding);return{top:V,left:O,fit:U.height-e.height,maxSizeBottom:U,maxSizeTop:U,minSize:n.with(U.width)}})(),u=(function(){let O=Math.max(i.width-o.borderHeight,0),V=i.left,U=Math.max(i.top-o.verticalPadding,0),G=Math.min(e.height,U),$=i.top-o.borderWidth-G,te=new ai(O,Math.max(U,0));return{top:$,left:V,fit:te.height-e.height,maxSizeTop:te,maxSizeBottom:te,minSize:n.with(te.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 N=this._container;if(N){let O=N.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 ecn=_;var $A={HasFocusedSuggestion:new Q("simpleSuggestWidgetHasFocusedSuggestion",!1,d(17217,null)),HasNavigated:new Q("simpleSuggestWidgetHasNavigated",!1,d(17218,null)),FirstSuggestionFocused:new Q("simpleSuggestWidgetFirstSuggestionFocused",!1,d(17216,null)),ExplicitlyInvoked:new Q("simpleSuggestWidgetExplicitlyInvoked",!1,d(17215,null))};var xH=class extends C{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 Nl);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 Pm;this.onDidFocus=this._onDidFocus.event;this._onDidBlurDetails=this._register(new E);this.onDidBlurDetails=this._onDidBlurDetails.event;this.element=this._register(new nO),this.element.domNode.classList.add("workbench-suggest-widget"),this._container.appendChild(this.element.domNode),this._ctxSuggestWidgetHasFocusedSuggestion=$A.HasFocusedSuggestion.bindTo(p),this._ctxSuggestWidgetHasBeenNavigated=$A.HasNavigated.bindTo(p),this._ctxFirstSuggestionFocused=$A.FirstSuggestionFocused.bindTo(p),this._ctxSuggestWidgetExplicitlyInvoked=$A.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:N}=this.element.size;(!g.persistHeight||Math.abs(g.currentSize.height-N)<=k)&&(N=g.persistedSize?.height??w.height),(!g.persistWidth||Math.abs(g.currentSize.width-T)<=k)&&(T=g.persistedSize?.width??w.width),this._persistedSize.store(new ai(T,N))}g=void 0}}));let f=()=>this.element.domNode.classList.toggle("no-icons",!c.getValue("editor.suggest.showIcons"));f();let v=this._instantiationService.createInstance(nUe,this._getFontInfo.bind(this),this._onDidFontConfigurationChange.bind(this));this._register(v),this._listElement=R(this.element.domNode,ecn(".tree")),this._list=this._register(new hc("SuggestWidget",this._listElement,{getHeight:()=>this._getLayoutInfo().itemHeight,getTemplateId:()=>"suggestion"},[v],{alwaysConsumeMouseWheel:!0,useShadows:!1,mouseSupport:!1,multipleSelectionSupport:!1,accessibilityProvider:{getRole:()=>ri?"listitem":"option",getWidgetAriaLabel:()=>d(17219,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(17214,null,y,O,V,w):O?y=d(17213,null,y,O,w):V&&(y=d(17212,null,y,V,w))}else y=d(17211,null,y,w);let{documentation:k,detail:T}=S.completion,N=id("{0}{1}",T||"",k?typeof k=="string"?k:k.value:"");return d(17210,null,y,N)}}})),this._register(this._list.onDidChangeFocus(S=>{S.indexes.length&&S.indexes[0]!==0&&this._ctxSuggestWidgetHasBeenNavigated.set(!0)})),this._messageElement=R(this.element.domNode,_(".message"));let b=this._register(l.createInstance(rUe,this._getFontInfo.bind(this),this._onDidFontConfigurationChange.bind(this),this._getAdvancedExplainModeDetails.bind(this)));this._register(b.onDidClose(()=>this.toggleDetails())),this._details=this._register(new o5t(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(nj,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(nj,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(17220,null)}static{this.NO_SUGGESTIONS_MESSAGE=d(17221,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=JOi(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=xn(async s=>{let l=nn(()=>{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=nn(()=>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=Ah(Me(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(sxo(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&&xo(this._status.element),xo(this._listElement),xo(this._messageElement),xo(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=xH.LOADING_MESSAGE,xo(this._listElement),this._status&&xo(this._status.element),bn(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,Or(xH.LOADING_MESSAGE);break;case 2:this.element.domNode.classList.add("message"),this._messageElement.textContent=xH.NO_SUGGESTIONS_MESSAGE,xo(this._listElement),this._status&&xo(this._status.element),bn(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,Or(xH.NO_SUGGESTIONS_MESSAGE);break;case 3:xo(this._messageElement),this._showListAndStatus(),this._show();break;case 4:xo(this._messageElement),this._showListAndStatus(),this._show();break;case 5:xo(this._messageElement),this._showListAndStatus(),this._details.show(),this._show();break}}_showListAndStatus(){this._status?bn(this._listElement,this._status.element):bn(this._listElement)}_show(){this._status?.show(),bn(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")):(ZOi(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=Ah(Me(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),xo(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=Fm(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=Yn(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 ai(l,o.defaultSize.height),this.element.maxSize=new ai(s,y),this.element.minSize=new ai(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=Kn(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 ai(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(sxo(!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}};xH=I([m(6,F),m(7,B),m(8,le),m(9,X)],xH);function sxo(a){return a?GI({listInactiveFocusOutline:Ad,listInactiveFocusForeground:sai}):GI({listInactiveFocusBackground:aai,listInactiveFocusOutline:qs})}var r5t=class extends i5t{constructor(i,e){super(i,e,tcn)}},tcn=(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=axo(e.fileExtLow)-axo(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=Ae(i.completion.label)?i.completion.label:i.completion.label.label,r=Ae(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&&(!Ae(i.completion.label)&&i.completion.label.description&&!Ae(e.completion.label)&&e.completion.label.description?t=0:!Ae(i.completion.label)&&i.completion.label.description?t=-2:!Ae(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=IM(i.labelLowNormalizedPath,"/")-IM(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||n5t(i.completion.kind)&&!n5t(e.completion.kind))return 1;if(n5t(e.completion.kind)&&!n5t(i.completion.kind))return-1}return i.labelLow.localeCompare(e.labelLow,void 0,{ignorePunctuation:!0})},n5t=a=>a===0||a===1||a===8||a===9,icn=new Map(ri?[["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 axo(a){return icn.get(a)||0}var sUe=class extends C{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:Ae(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":ocn(o,r)?c="AcceptedWithEdit":c="Deleted",this._telemetryService.publicLog2("terminal.suggest.acceptedCompletion",{kind:s,outcome:c,exitCode:t,terminalSessionId:n.sessionId,provider:l})}}};sUe=I([m(2,Te)],sUe);function ocn(a,i){return a.includes(i.substring(0,Math.ceil(i.length/2)))}var ncn=J("terminalSymbolIcon.flagForeground",Bii,d(14955,null)),rcn=J("terminalSymbolIcon.aliasForeground",Uii,d(14949,null)),scn=J("terminalSymbolIcon.optionValueForeground",Q4i,d(14953,null)),acn=J("terminalSymbolIcon.methodForeground",Uii,d(14958,null)),lcn=J("terminalSymbolIcon.argumentForeground",Y4i,d(14950,null)),ccn=J("terminalSymbolIcon.optionForeground",Bii,d(14959,null)),dcn=J("terminalSymbolIcon.inlineSuggestionForeground",null,d(14957,null)),ucn=J("terminalSymbolIcon.fileForeground",_W,d(14954,null)),pcn=J("terminalSymbolIcon.folderForeground",Hii,d(14956,null)),mcn=J("terminalSymbolIcon.commitForeground",_W,d(14952,null)),hcn=J("terminalSymbolIcon.branchForeground",_W,d(14951,null)),gcn=J("terminalSymbolIcon.tagForeground",_W,d(14967,null)),fcn=J("terminalSymbolIcon.stashForeground",_W,d(14963,null)),vcn=J("terminalSymbolIcon.remoteForeground",_W,d(14962,null)),bcn=J("terminalSymbolIcon.pullRequestForeground",_W,d(14961,null)),Scn=J("terminalSymbolIcon.pullRequestDoneForeground",_W,d(14960,null)),Icn=J("terminalSymbolIcon.symbolicLinkFileForeground",_W,d(14964,null)),ycn=J("terminalSymbolIcon.symbolicLinkFolderForeground",Hii,d(14965,null)),wcn=J("terminalSymbolIcon.symbolText",_W,d(14966,null)),lxo=Re("terminal-symbol-flag",M.flag,d(14947,null),ncn),cxo=Re("terminal-symbol-alias",M.symbolMethod,d(14942,null),rcn),dxo=Re("terminal-symbol-option-value",M.symbolEnumMember,d(14971,null),scn),uxo=Re("terminal-symbol-method",M.symbolMethod,d(14969,null),acn),pxo=Re("terminal-symbol-argument",M.symbolVariable,d(14943,null),lcn),mxo=Re("terminal-symbol-option",M.symbolEnum,d(14970,null),ccn),eFi=Re("terminal-symbol-inline-suggestion",M.star,d(14968,null),dcn),hxo=Re("terminal-symbol-file",M.symbolFile,d(14946,null),ucn),gxo=Re("terminal-symbol-folder",M.symbolFolder,d(14948,null),pcn),fxo=Re("terminal-symbol-commit",M.gitCommit,d(14945,null),mcn),vxo=Re("terminal-symbol-branch",M.gitBranch,d(14944,null),hcn),bxo=Re("terminal-symbol-tag",M.tag,d(14979,null),gcn),Sxo=Re("terminal-symbol-stash",M.gitStash,d(14975,null),fcn),Ixo=Re("terminal-symbol-remote",M.remote,d(14974,null),vcn),yxo=Re("terminal-symbol-pull-request",M.gitPullRequest,d(14973,null),bcn),wxo=Re("terminal-symbol-pull-request-done",M.gitPullRequestDone,d(14972,null),Scn),Cxo=Re("terminal-symbol-symbolic-link-file",M.fileSymlinkFile,d(14976,null),Icn),xxo=Re("terminal-symbol-symbolic-link-folder",M.fileSymlinkDirectory,d(14977,null),ycn),kxo=Re("terminal-symbol-symbol-text",M.symbolKey,d(14978,null),wcn);var Exo="terminal.suggest.increasedDiscoverability",Txo="terminal.suggest.increasedDiscoverabilityCount",Ccn=10,xcn=1e4,aUe=class extends C{constructor(e,t,o){super();this._shellType=e;this._storageService=t;this._extensionService=o;this._firstShownTracker=void 0;this._done=this._storageService.getBoolean(Exo,-1,!1),this._count=this._storageService.getNumber(Txo,-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(Txo,this._count,-1,0),e&&!e.classList.contains("increased-discoverability")&&e.classList.add("increased-discoverability"),this._count>=Ccn?this._setDone(e):this._start||(this.resetTimer(),this._start=Date.now(),this._timeout=this._register(new Nl(()=>{this._setDone(e)},xcn))))}_setDone(e){this._done=!0,this._storageService.store(Exo,!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))}};aUe=I([m(1,le),m(2,lt)],aUe);function _xo(a){return a?a==="bash"||a==="zsh"||a==="fish"||a==="pwsh"||a==="gitbash":!1}var CG=class extends C{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,hxo],[1,gxo],[8,Cxo],[9,xxo],[2,uxo],[3,cxo],[4,pxo],[5,mxo],[6,dxo],[7,lxo],[10,fxo],[11,vxo],[12,bxo],[13,Sxo],[14,Ixo],[15,yxo],[16,wxo],[100,eFi],[101,eFi]]);this._kindToKindLabelMap=new Map([[0,d(14927,null)],[1,d(14929,null)],[8,d(14939,null)],[9,d(14940,null)],[2,d(14932,null)],[3,d(14923,null)],[4,d(14924,null)],[5,d(14933,null)],[6,d(14934,null)],[7,d(14928,null)],[10,d(14926,null)],[11,d(14925,null)],[12,d(14941,null)],[13,d(14938,null)],[14,d(14937,null)],[15,d(14935,null)],[16,d(14936,null)],[100,d(14930,null)],[101,d(14931,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 xEe(this._inlineCompletion);this._shouldSyncWhenReady=!1;if(this.shellType=t,this.shellType)this._shellTypeInit=Promise.resolve();else{let p=this._register(new EI),h=this._register(new Nl);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(H.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(sUe,p,this._promptInputModel)),this._promptInputModelSubscriptions.value=hn(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(H.runAndSubscribe(this._configurationService.onDidChangeConfiguration,p=>{if(!p||p.affectsConfiguration("terminal.integrated.suggest.inlineSuggestion")){let h=this._configurationService.getValue(Pz).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||!ts(e.element))return;await this._shellTypeInit;let n=!1;if(this._promptInputModel.value!==""&&this._lastUserDataTimestamp<CG.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=Xui(this._configurationService.getValue(Pz).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=(Ae(S?.label)?S.label:S?.label.label)?.match(/(?<sep>[\\\/])/)?.groups?.sep;w&&(this._pathSeparator=w),this._pathSeparator&&(g=Dxo(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=kxo);let f=new sat(g,this._cursorIndexDelta),v=p.filter(S=>!!S.label).map(S=>new xEe(S,this._pathSeparator));_xo(this.shellType)&&v.push(this._inlineCompletionItem),this._logService.trace("TerminalCompletionService#_collectCompletions create model");let b=new r5t(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 $e;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=(Ae(this._inlineCompletionItem.completion.label)?this._inlineCompletionItem.completion.label:this._inlineCompletionItem.completion.label.label).trim(),o=e.findIndex(n=>Ae(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(Pz),o=Xui(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=Dxo(s,this._pathSeparator));let l=new sat(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(!_xo(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 xEe(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=x7t*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(xH,this._container,this._instantiationService.createInstance(aat),{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=xn(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(rh(),"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(aUe,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}CG.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=Ae(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(Pz).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=Ng(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&&(CG.lastAcceptedCompletionTimestamp=0),this._configurationService.getValue(Pz).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)}};CG=I([m(4,PX),m(5,B),m(6,F),m(7,ku),m(8,Xs)],CG);var aat=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(ai.is(e))return ai.lift(e)}catch{}}store(i){this._storageService.store(this._key,JSON.stringify(i),0,1)}reset(){this._storageService.remove(this._key,0)}};aat=I([m(0,le)],aat);function Dxo(a,i){return i==="/"?a.replaceAll("\\","/"):a.replaceAll("/","\\")}var s5t=class extends C{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 Ie(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?beo(h.kind):2,f=kcn(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 kcn(a,i,e,t,o){let n=Ecn(i);return{label:t,detail:o??"",replacementRange:[a-n.length,a],kind:e??2}}function Ecn(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 lUe=`vscode_lsp_terminal_prompt_tracker= {}
`,Tcn=new Set([{shellType:"python",languageId:"python",extension:"py"}]);function Lxo(a){for(let i of Tcn)if(i.shellType===a)return i}var ene=class extends C{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(ene.scheme,this)),this._capabilitiesStore=e,this._commandDetection=this._capabilitiesStore.get(2),this._registerTerminalCommandFinishedListener(),this._virtualTerminalDocumentUri=o,this._shellType=n}static{this.scheme=Y.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(lUe);else{let n=o.lastIndexOf(lUe),s=(n!==-1?o.substring(0,n):o)+`
`+e+`
`+lUe;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(lUe),s=(n!==-1?o.substring(0,n):o)+lUe+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)}};ene=I([m(4,Nt),m(5,Ct),m(6,kt)],ene);function Rxo(a,i){return A.from({scheme:Y.vscodeTerminal,path:`/terminal${a}.${i}`})}we(PX,kEe,1);var bI=class extends P{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 jt);this._lspModelProvider=new me;this.add(Z(()=>{this._addon?.dispose(),this._lspModelProvider?.value?.dispose(),this._lspModelProvider?.dispose()})),this._terminalSuggestWidgetVisibleContextKey=at.suggestWidgetVisible.bindTo(this._contextKeyService),this.add(this._configurationService.onDidChangeConfiguration(c=>{if(c.affectsConfiguration("terminal.integrated.suggest.enabled")){let u=this._configurationService.getValue(Pz).enabled;u||(this._addon.clear(),this._lspAddons.clearAndDisposeAll());let p=this._ctx.instance.xterm?.raw;p&&u&&this._loadAddons(p)}})),Nfe.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(bI.ID)}get addon(){return this._addon.value}get lspAddons(){return Array.from(this._lspAddons.values())}xtermOpen(e){this._configurationService.getValue(Pz).enabled&&(this._loadAddons(e.raw),this.add(H.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=Lxo(this._ctx.instance.shellType))){this._lspAddons.clearAndDisposeAll();return}let o=Rxo(this._ctx.instance.instanceId,t.extension);this._lspModelProvider.value=this._instantiationService.createInstance(ene,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(s5t,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(CG,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(rxo)||t.hideSuggestWidget(!0)})),this.add(t.onAcceptedCompletion(async n=>{this._ctx.instance.focus(),this._ctx.instance.sendText(n,!1)}));let o=wT.get(this._ctx.instance);if(this.add(o.onWillPaste(()=>t.isPasting=!0)),this.add(o.onDidPaste(()=>{setTimeout(()=>t.isPasting=!1,100)})),!ri){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");Ao(r)&&t.setScreen(r)}async _waitForXtermElement(e){if(e.element)return e.element;if(await Promise.race([H.toPromise(H.filter(this._ctx.instance.onDidChangeVisibility,t=>t)),H.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:Nh(e,"panel")??e}};bI=I([m(1,X),m(2,B),m(3,F),m(4,PX),m(5,Nt),m(6,zt)],bI);up(bI.ID,bI);Sr({id:"workbench.action.terminal.changeSelectionModeNever",title:L(14904,"Selection Mode: None"),tooltip:L(14905,"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:x.and(x.or(at.processSupported,at.terminalHasBeenCreated),at.focus,at.isOpen,at.suggestWidgetVisible,x.equals("config.terminal.integrated.suggest.selectionMode","never")),menu:{id:D.MenubarTerminalSuggestStatusMenu,group:"left",order:1,when:x.and(x.equals("config.terminal.integrated.suggest.selectionMode","never"),x.or(x.equals("config.terminal.integrated.suggest.quickSuggestions",!0),x.equals("config.terminal.integrated.suggest.suggestOnTriggerCharacters",!0)))},run:(a,i)=>{i.get(B).updateValue("terminal.integrated.suggest.selectionMode","partial")}});Sr({id:"workbench.action.terminal.changeSelectionModePartial",title:L(14906,"Selection Mode: Partial (Tab)"),tooltip:L(14907,"Partially select the top suggestion, Tab will accept a suggestion when visible. Activate to change."),f1:!1,precondition:x.and(x.or(at.processSupported,at.terminalHasBeenCreated),at.focus,at.isOpen,at.suggestWidgetVisible,x.equals("config.terminal.integrated.suggest.selectionMode","partial")),menu:{id:D.MenubarTerminalSuggestStatusMenu,group:"left",order:1,when:x.and(x.equals("config.terminal.integrated.suggest.selectionMode","partial"),x.or(x.equals("config.terminal.integrated.suggest.quickSuggestions",!0),x.equals("config.terminal.integrated.suggest.suggestOnTriggerCharacters",!0)))},run:(a,i)=>{i.get(B).updateValue("terminal.integrated.suggest.selectionMode","always")}});Sr({id:"workbench.action.terminal.changeSelectionModeAlways",title:L(14902,"Selection Mode: Always (Tab or Enter)"),tooltip:L(14903,"Always select the top suggestion, Tab or Enter will accept a suggestion when visible. Activate to change."),f1:!1,precondition:x.and(x.or(at.processSupported,at.terminalHasBeenCreated),at.focus,at.isOpen,at.suggestWidgetVisible),menu:{id:D.MenubarTerminalSuggestStatusMenu,group:"left",order:1,when:x.and(x.equals("config.terminal.integrated.suggest.selectionMode","always"),x.or(x.equals("config.terminal.integrated.suggest.quickSuggestions",!0),x.equals("config.terminal.integrated.suggest.suggestOnTriggerCharacters",!0)))},run:(a,i)=>{i.get(B).updateValue("terminal.integrated.suggest.selectionMode","never")}});Sr({id:"workbench.action.terminal.doNotShowSuggestOnType",title:L(14909,"Don't show IntelliSense unless triggered explicitly. This disables the quick suggestions and suggest on trigger characters settings."),f1:!1,precondition:x.and(x.or(at.processSupported,at.terminalHasBeenCreated),at.focus,at.isOpen,at.suggestWidgetVisible),icon:M.eye,menu:{id:D.MenubarTerminalSuggestStatusMenu,group:"right",order:1,when:x.and(x.or(x.equals("config.terminal.integrated.suggest.quickSuggestions.commands","on"),x.equals("config.terminal.integrated.suggest.quickSuggestions.arguments","on")),x.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)}});Sr({id:"workbench.action.terminal.showSuggestOnType",title:L(14918,"Show IntelliSense while typing. This enables the quick suggestions for commands and arguments, and suggest on trigger characters settings."),f1:!1,precondition:x.and(x.or(at.processSupported,at.terminalHasBeenCreated),at.focus,at.isOpen,at.suggestWidgetVisible),icon:M.eyeClosed,menu:{id:D.MenubarTerminalSuggestStatusMenu,group:"right",order:1,when:x.or(x.and(x.equals("config.terminal.integrated.suggest.quickSuggestions.commands","off"),x.equals("config.terminal.integrated.suggest.quickSuggestions.arguments","off")),x.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)}});Sr({id:"workbench.action.terminal.suggestLearnMore",title:L(14912,"Learn More"),f1:!1,precondition:x.and(x.or(at.processSupported,at.terminalHasBeenCreated),at.focus,at.isOpen,at.suggestWidgetVisible),icon:M.question,menu:{id:D.MenubarTerminalSuggestStatusMenu,group:"right",order:2},run:(a,i)=>{i.get(Qe).open("https://aka.ms/vscode-terminal-intellisense")}});Sr({id:"workbench.action.terminal.configureSuggestSettings",title:L(14908,"Configure"),f1:!1,precondition:x.and(x.or(at.processSupported,at.terminalHasBeenCreated),at.focus,at.isOpen,at.suggestWidgetVisible),icon:M.gear,menu:{id:D.MenubarTerminalSuggestStatusMenu,group:"right",order:3},run:(a,i)=>i.get(Po).openSettings({query:Pz})});Gl({id:"workbench.action.terminal.triggerSuggest",title:L(14922,"Trigger Suggest"),f1:!1,keybinding:{primary:2058,mac:{primary:266},weight:201,when:x.and(at.focus,at.suggestWidgetVisible.negate(),x.equals("config.terminal.integrated.suggest.enabled",!0))},run:a=>bI.get(a)?.addon?.requestCompletions(!0)});Gl({id:"workbench.action.terminal.resetSuggestWidgetSize",title:L(14913,"Reset Suggest Widget Size"),run:a=>bI.get(a)?.addon?.resetWidgetSize()});Gl({id:"workbench.action.terminal.selectPrevSuggestion",title:L(14917,"Select the Previous Suggestion"),f1:!1,precondition:x.and(x.or(at.processSupported,at.terminalHasBeenCreated),at.focus,at.isOpen,at.suggestWidgetVisible),keybinding:{primary:16,weight:201,when:x.or($A.HasNavigated,x.equals("config.terminal.integrated.suggest.upArrowNavigatesHistory",!1))},run:a=>bI.get(a)?.addon?.selectPreviousSuggestion()});Gl({id:"workbench.action.terminal.selectPrevPageSuggestion",title:L(14916,"Select the Previous Page Suggestion"),f1:!1,precondition:x.and(x.or(at.processSupported,at.terminalHasBeenCreated),at.focus,at.isOpen,at.suggestWidgetVisible),keybinding:{primary:11,weight:201},run:a=>bI.get(a)?.addon?.selectPreviousPageSuggestion()});Gl({id:"workbench.action.terminal.selectNextSuggestion",title:L(14915,"Select the Next Suggestion"),f1:!1,precondition:x.and(x.or(at.processSupported,at.terminalHasBeenCreated),at.focus,at.isOpen,at.suggestWidgetVisible),keybinding:{primary:18,weight:201},run:a=>bI.get(a)?.addon?.selectNextSuggestion()});Gl({id:"terminalSuggestToggleExplainMode",title:L(14921,"Suggest Toggle Explain Modes"),f1:!1,precondition:x.and(x.or(at.processSupported,at.terminalHasBeenCreated),at.focus,at.isOpen,at.suggestWidgetVisible),keybinding:{weight:201,primary:2138},run:a=>bI.get(a)?.addon?.toggleExplainMode()});Gl({id:"workbench.action.terminal.suggestToggleDetailsFocus",title:L(14920,"Suggest Toggle Suggestion Focus"),f1:!1,precondition:ue.textInputFocus.negate(),keybinding:{weight:200,primary:2570,mac:{primary:778}},run:a=>bI.get(a)?.addon?.toggleSuggestionFocus()});Gl({id:"workbench.action.terminal.suggestToggleDetails",title:L(14919,"Suggest Toggle Details"),f1:!1,precondition:x.and(x.or(at.processSupported,at.terminalHasBeenCreated),at.isOpen,at.focus,at.suggestWidgetVisible,$A.HasFocusedSuggestion),keybinding:{weight:402,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}},run:a=>bI.get(a)?.addon?.toggleSuggestionDetails()});Gl({id:"workbench.action.terminal.selectNextPageSuggestion",title:L(14914,"Select the Next Page Suggestion"),f1:!1,precondition:x.and(x.or(at.processSupported,at.terminalHasBeenCreated),at.focus,at.isOpen,at.suggestWidgetVisible),keybinding:{primary:12,weight:201},run:a=>bI.get(a)?.addon?.selectNextPageSuggestion()});Gl({id:"workbench.action.terminal.acceptSelectedSuggestion",title:L(14900,"Insert"),f1:!1,precondition:x.and(x.or(at.processSupported,at.terminalHasBeenCreated),at.focus,at.isOpen,at.suggestWidgetVisible),keybinding:[{primary:2,weight:202,when:x.and($A.HasFocusedSuggestion)},{primary:3,when:x.and($A.HasFocusedSuggestion,x.or($A.ExplicitlyInvoked,x.notEquals("config.terminal.integrated.suggest.selectionMode","partial"),$A.FirstSuggestionFocused.toNegated(),$A.HasNavigated)),weight:201}],run:a=>bI.get(a)?.addon?.acceptSelectedSuggestion()});Gl({id:"workbench.action.terminal.acceptSelectedSuggestionEnter",title:L(14901,"Accept Selected Suggestion (Enter)"),f1:!1,precondition:x.and(x.or(at.processSupported,at.terminalHasBeenCreated),at.focus,at.isOpen,at.suggestWidgetVisible),keybinding:{primary:3,weight:201,when:x.notEquals("config.terminal.integrated.suggest.runOnEnter","never")},run:async a=>bI.get(a)?.addon?.acceptSelectedSuggestion(void 0,!0)});Gl({id:"workbench.action.terminal.hideSuggestWidget",title:L(14910,"Hide Suggest Widget"),f1:!1,precondition:x.and(x.or(at.processSupported,at.terminalHasBeenCreated),at.focus,at.isOpen,at.suggestWidgetVisible),keybinding:{primary:9,weight:201},run:a=>bI.get(a)?.addon?.hideSuggestWidget(!0)});Gl({id:"workbench.action.terminal.hideSuggestWidgetAndNavigateHistory",title:L(14911,"Hide Suggest Widget and Navigate History"),f1:!1,precondition:x.and(x.or(at.processSupported,at.terminalHasBeenCreated),at.focus,at.isOpen,at.suggestWidgetVisible),keybinding:{primary:16,when:x.and($A.HasNavigated.negate(),x.equals("config.terminal.integrated.suggest.upArrowNavigatesHistory",!0)),weight:202},run:a=>{bI.get(a)?.addon?.hideSuggestWidget(!0),a.sendText("\x1B[A",!1)}});var Nfe=class extends C{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(Nfe))}_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});Jui(e)}};Nfe=I([m(0,PX),m(1,YBe)],Nfe);var cUe=class extends C{static{this.ID="terminalWslRecommendation"}constructor(i,e,t,o,n){if(super(),!ri)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||No(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(St.Info,d(15029,null,r.wsl.friendlyName),[{label:d(15028,null),run:()=>{e.createInstance(sA,u).run()}}],{priority:1,neverShowAgain:{id:"terminalConfigHelper/launchRecommendationsIgnore",scope:2},onCancel:()=>{}})})}};cUe=I([m(0,ls),m(1,F),m(2,Ne),m(3,nt),m(4,Yo)],cUe);pt(cUe.ID,cUe,ut.Eventually);var _cn={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":'"'},O0=class extends C{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 P),this._terminalDictationInProgress=at.terminalDictationInProgress.bindTo(n)}static{this._instance=void 0}static getInstance(e){return O0._instance||(O0._instance=e.createInstance(O0)),O0._instance}async start(){this.stop();let e=this._configurationService.getValue("accessibility.voice.speechTimeout");(!Xo(e)||e<0)&&(e=E9e),this._acceptTranscriptionScheduler=this._disposables.add(new Dt(()=>{this._sendText(),this.stop()},e)),this._cancellationTokenSource=new $e,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),Jo(d(15019,null,this._input))}_updateInput(e){if(e.text){let t=e.text.replaceAll(/[.,?;!]/g,"");for(let o of Object.entries(_cn))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(M.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+"%"})}};O0=I([m(0,EC),m(1,Yo),m(2,B),m(3,X)],O0);var Mxo=L(15025,"Voice");function Pxo(){Gl({id:"workbench.action.terminal.startVoice",title:L(15026,"Start Dictation in Terminal"),category:Mxo,precondition:x.and(TX.toNegated(),Js.terminalAvailable),f1:!0,icon:M.mic,run:async(a,i,e)=>{let t=e.get(X),o=e.get(ge),n=e.get(ct),r=e.get(Os),s=e.get(ls);if(TV.getValue(t)){let b=e.get(F);O0.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(15023,null),g=d(15020,null),p=()=>r.setEnablement([c],13)):(h=d(15024,null),p=()=>o.executeCommand("workbench.extensions.installExtension","ms-vscode.vscode-speech"),g=d(15021,null));let f=d(15022,null);(await n.confirm({message:h,primaryButton:g,type:"info",detail:f})).confirmed&&await p()}}),Gl({id:"workbench.action.terminal.stopVoice",title:L(15027,"Stop Dictation in Terminal"),category:Mxo,precondition:at.terminalDictationInProgress,f1:!0,keybinding:{primary:9,weight:300},run:(a,i,e)=>{let t=e.get(F);O0.getInstance(t).stop(!0)}})}Pxo();var Axo=ae("externalTerminal");var Nxo="openInTerminal",Oxo="openInIntegratedTerminal";function Fxo(a,i){qe.registerCommand({id:a,handler:async(e,t)=>{let o=e.get(B),n=e.get(be),r=e.get(Yo),s=e.get(yo),l=e.get(jl),c;try{c=e.get(Axo)}catch{}let u=e0(t,e.get(fo),e.get(ee),e.get(Et),e.get(za));return n.resolveAll(u.map(p=>({resource:p}))).then(async p=>{let h=o.getValue(),g=s.getConnection()||i==="integrated",f=Uo(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:wc(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===wc(t.path))&&(r.setActiveInstance(y),l.showPanel(!0))}}else c&&Uo(f.map(({stat:v})=>v.isDirectory?v.resource.fsPath:wc(v.resource.fsPath))).forEach(v=>{c.openTerminal(h.terminal.external,v)})})}})}Fxo(Nxo,"external");Fxo(Oxo,"integrated");var lat=class extends C{constructor(e){super();this._configurationService=e;let t=x.and(Fo.Scheme.isEqualTo(Y.file),x.or(x.equals("config.terminal.explorerKind","integrated"),x.equals("config.terminal.explorerKind","both"))),o=x.and(Fo.Scheme.isEqualTo(Y.file),x.or(x.equals("config.terminal.explorerKind","external"),x.equals("config.terminal.explorerKind","both")));this._openInIntegratedTerminalMenuItem={group:"navigation",order:30,command:{id:Oxo,title:d(10122,null)},when:x.or(t,Fo.Scheme.isEqualTo(Y.vscodeRemote))},this._openInTerminalMenuItem={group:"navigation",order:31,command:{id:Nxo,title:d(10121,null)},when:o},fe.appendMenuItem(D.ExplorerContext,this._openInTerminalMenuItem),fe.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(ri&&e.external?.windowsExec){let t=No(e.external.windowsExec);if(t==="wt"||t==="wt.exe")return!0}return!1}_refreshOpenInTerminalMenuItemTitle(){this.isWindows()&&(this._openInTerminalMenuItem.command.title=d(10123,null))}};lat=I([m(0,B)],lat);oe.as(Qi.Workbench).registerWorkbenchContribution(lat,3);var Ofe=class extends C{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 CT("string");this.menuStyle=new CT("string");this.nativeTabs=new CT("boolean");this.nativeFullScreen=new CT("boolean");this.clickThroughInactive=new CT("boolean");this.controlsStyle=new CT("string");this.updateMode=new CT("string");this.workspaceTrustEnabled=new CT("boolean");this.experimentsEnabled=new CT("boolean");this.enablePPEExtensionsGallery=new CT("boolean");this.restrictUNCAccess=new CT("boolean");this.accessibilityVerbosityDebug=new CT("boolean");this.telemetryFeedbackEnabled=new CT("boolean");this.extensionUnificationEnabled=new CT("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&&!Ofe.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();kr&&(o((n.window.titleBarStyle==="native"||n.window.titleBarStyle==="custom")&&this.titleBarStyle.handleChange(n.window?.titleBarStyle)),o(!it&&this.menuStyle.handleChange(n.window?.menuStyle)),o(it&&this.nativeTabs.handleChange(n.window?.nativeTabs)),o(it&&this.nativeFullScreen.handleChange(n.window?.nativeFullScreen)),o(it&&this.clickThroughInactive.handleChange(n.window?.clickThroughInactive)),o(!it&&this.controlsStyle.handleChange(n.window?.controlsStyle)),o(this.updateMode.handleChange(n.update?.mode)),Wn&&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(kr?d(12667,null):d(12668,null),kr?d(12665,null,this.productService.nameLong):d(12666,null,this.productService.nameLong),kr?d(12669,null):d(12671,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()}};Ofe=I([m(0,oi),m(1,B),m(2,aI),m(3,_l),m(4,lI),m(5,nt),m(6,ct)],Ofe);var CT=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}},cat=class extends C{constructor(e,t,o,n){super();this.contextService=e;this.extensionHostRestarter=this._register(new Dt(async()=>{n.extensionTestsLocationURI||n.isSessionsWindow||(n.remoteAuthority?o.reload():kr&&await t.stopExtensionHosts(d(12670,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 Ue(this.onDidChangeWorkspaceFoldersUnbind),this.onDidChangeWorkspaceFoldersUnbind=void 0}onDidChangeWorkspaceFolders(){let e=this.contextService.getWorkspace(),t=e.folders.length>0?e.folders[0].uri:void 0;Xe(this.firstFolderResource,t)||(this.firstFolderResource=t,this.extensionHostRestarter.schedule())}};cat=I([m(0,Pe),m(1,lt),m(2,oi),m(3,Vt)],cat);var Wxo=oe.as(Qi.Workbench);Wxo.registerWorkbenchContribution(Ofe,3);Wxo.registerWorkbenchContribution(cat,3);var dUe=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}},dat=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 uUe=(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))(uUe||{});(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})(uUe||={});var d5t=(e=>(e[e.File=0]="File",e[e.Location=1]="Location",e))(d5t||{});(i=>{function a(e){return e=e.toLowerCase(),e==="file"?0:e==="location"?1:void 0}i.fromString=a})(d5t||={});var uat=(t=>(t[t.allDocuments=0]="allDocuments",t[t.openDocuments=1]="openDocuments",t[t.closedDocuments=2]="closedDocuments",t))(uat||{});(i=>{function a(e){return e=e.toLowerCase(),e==="alldocuments"?0:e==="opendocuments"?1:e==="closeddocuments"?2:void 0}i.fromString=a})(uat||={});function rFi(a){return!!(a&&Ae(a.name))}async function pUe(a,i,e){let t=i.fileLocation,o;if(t===2)o=a;else if(t===1&&i.filePrefix&&Ae(i.filePrefix))o=Ld(i.filePrefix,a);else if(t===3){let n=Xi(i);if(n.fileLocation=1,e){let r=await pUe(a,n),s;try{s=await e.stat(r)}catch{}if(s)return r}return n.fileLocation=2,pUe(a,n)}else if(t===4&&e){let n=e.getProvider(Y.file);if(n&&(o=(await Lcn(a,n,i.filePrefix))?.path),!o){let r=Xi(i);return r.fileLocation=2,pUe(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=th(o),o=o.replace(/\\/g,"/"),o[0]!=="/"&&(o="/"+o),i.uriProvider!==void 0?i.uriProvider(o):A.file(o)}async function Lcn(a,i,e){let t=new Set(Yl(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 Yl(e.include||[])){let r=await o(A.file(n));if(r)return r}}function Vxo(a,i,e){let t=a.pattern;return Array.isArray(t)?new iFi(a,i,e):new tFi(a,i,e)}var Rcn=zo===1?`\r
`:`
`,a5t=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(cn(i[e]))this.fillProperty(i,e,t,o,n);else if(!cn(r)&&r<o.length){let s=o[r];n&&(s=qD(s)),i[e]=i[e]+Rcn+s}}fillProperty(i,e,t,o,n=!1){let r=t[e];if(cn(i[e])&&!cn(r)&&r<o.length){let s=o[r];s!==void 0&&(n&&(s=qD(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 pUe(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=gt.fromValue(t),e===gt.Ignore&&(t==="E"?e=gt.Error:t==="W"?e=gt.Warning:t==="I"?e=gt.Info:mr(t,"hint")?e=gt.Info:mr(t,"note")&&(e=gt.Info)))}return(e===null||e===gt.Ignore)&&(e=this.matcher.severity||gt.Error),cl.fromSeverity(e)}},tFi=class extends a5t{constructor(i,e,t){super(i,e,t),this.pattern=i.pattern}get matchLength(){return 1}handle(i,e=0){c6(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}},iFi=class extends a5t{constructor(i,e,t){super(i,e,t),this.patterns=i.pattern}get matchLength(){return this.patterns.length}handle(i,e=0){c6(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=Xi(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];c6(e.loop===!0&&this.data!==null);let t=this.regexpExec(e.regexp,i);if(!t)return this.data=void 0,null;let o=Xi(this.data),n;return this.fillProblemData(o,e,t)&&(n=this.getMarkerMatch(o)),n||null}},tne;(s=>{let a;(c=>{function l(u){let p=u;return p&&Ae(p.regexp)}c.is=l})(a=s.CheckedProblemPattern||={});let i;(c=>{function l(u){let p=u;return p&&Ae(p.name)}c.is=l})(i=s.NamedProblemPattern||={});let e;(c=>{function l(u){let p=u;return p&&i.is(p)&&Ae(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&&Ae(p.name)&&Array.isArray(p.patterns)&&o.is(p.patterns)}c.is=l})(n=s.NamedMultiLineCheckedProblemPattern||={});function r(l){return Ae(l.name)}s.isNamedProblemMatcher=r})(tne||={});var l5t=class extends dat{constructor(i){super(i)}parse(i){if(tne.NamedMultiLineCheckedProblemPattern.is(i))return this.createNamedMultiLineProblemPattern(i);if(tne.MultiLineCheckedProblemPattern.is(i))return this.createMultiLineProblemPattern(i);if(tne.NamedCheckedProblemPattern.is(i)){let e=this.createSingleProblemPattern(i);return e.name=i.name,e}else return tne.CheckedProblemPattern.is(i)?this.createSingleProblemPattern(i):(this.error(d(13993,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&&!cn(o.loop)&&o.loop&&(o.loop=!1,this.error(d(13988,null))),e.push(o)}return!e||e.length===0?(this.error(d(13989,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=d5t.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=Nu(o,{file:1,message:0},!1):o=Nu(o,{file:1,line:2,character:3,message:0},!1)),o}validateProblemPattern(i){if(!i||i.length===0)return this.error(d(13989,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(13990,null)),e=e||!cn(s.file),t=t||!cn(s.message),o=o||!cn(s.location),n=n||!cn(s.line)}),e&&t?r===1&&!(o||n)?(this.error(d(13991,null)),!1):!0:(this.error(d(13992,null)),!1)}createRegularExpression(i){let e;try{e=new RegExp(i)}catch{this.error(d(13987,null,i))}return e}},c5t=class{constructor(i,e=new dUe){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}},Ffe;(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(14005,null)},kind:{type:"string",description:d(14000,null)},file:{type:"integer",description:d(13999,null)},location:{type:"integer",description:d(14002,null)},line:{type:"integer",description:d(14001,null)},column:{type:"integer",description:d(13996,null)},endLine:{type:"integer",description:d(13998,null)},endColumn:{type:"integer",description:d(13997,null)},severity:{type:"integer",description:d(14006,null)},code:{type:"integer",description:d(13995,null)},message:{type:"integer",description:d(14004,null)},loop:{type:"boolean",description:d(14003,null)}}},c.NamedProblemPattern=Xi(c.ProblemPattern),c.NamedProblemPattern.properties=Xi(c.NamedProblemPattern.properties)||{},c.NamedProblemPattern.properties.name={type:"string",description:d(13957,null)},c.MultiLineProblemPattern={type:"array",items:c.ProblemPattern},c.NamedMultiLineProblemPattern={type:"object",additionalProperties:!1,properties:{name:{type:"string",description:d(13953,null)},patterns:{type:"array",description:d(13954,null),items:c.ProblemPattern}}},c.WatchingPattern={type:"object",additionalProperties:!1,properties:{regexp:{type:"string",description:d(14008,null)},file:{type:"integer",description:d(14007,null)}}},c.PatternType={anyOf:[{type:"string",description:d(13959,null)},c.ProblemPattern,c.MultiLineProblemPattern],description:d(13958,null)},c.ProblemMatcher={type:"object",additionalProperties:!1,properties:{base:{type:"string",description:d(13976,null)},owner:{type:"string",description:d(13978,null)},source:{type:"string",description:d(13980,null)},severity:{type:"string",enum:["error","warning","info"],description:d(13979,null)},applyTo:{type:"string",enum:["allDocuments","openDocuments","closedDocuments"],description:d(13971,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(13977,null)},background:{type:"object",additionalProperties:!1,description:d(13972,null),properties:{activeOnStart:{type:"boolean",description:d(13973,null)},beginsPattern:{oneOf:[{type:"string"},c.WatchingPattern],description:d(13974,null)},endsPattern:{oneOf:[{type:"string"},c.WatchingPattern],description:d(13975,null)}}},watching:{type:"object",additionalProperties:!1,deprecationMessage:d(13984,null),description:d(13981,null),properties:{activeOnStart:{type:"boolean",description:d(13982,null)},beginsPattern:{oneOf:[{type:"string"},c.WatchingPattern],description:d(13983,null)},endsPattern:{oneOf:[{type:"string"},c.WatchingPattern],description:d(13985,null)}}}}},c.LegacyProblemMatcher=Xi(c.ProblemMatcher),c.LegacyProblemMatcher.properties=Xi(c.LegacyProblemMatcher.properties)||{},c.LegacyProblemMatcher.properties.watchedTaskBeginsRegExp={type:"string",deprecationMessage:d(13948,null),description:d(13947,null)},c.LegacyProblemMatcher.properties.watchedTaskEndsRegExp={type:"string",deprecationMessage:d(13950,null),description:d(13949,null)},c.NamedProblemMatcher=Xi(c.ProblemMatcher),c.NamedProblemMatcher.properties=Xi(c.NamedProblemMatcher.properties)||{},c.NamedProblemMatcher.properties.name={type:"string",description:d(13956,null)},c.NamedProblemMatcher.properties.label={type:"string",description:d(13955,null)}))(Ffe||={});var Bxo=Tn.registerExtensionPoint({extensionPoint:"problemPatterns",jsonSchema:{description:d(13986,null),type:"array",items:{anyOf:[Ffe.NamedProblemPattern,Ffe.NamedMultiLineProblemPattern]}}}),oFi=class{constructor(){this.patterns=Object.create(null),this.fillDefaults(),this.readyPromise=new Promise((i,e)=>{Bxo.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 l5t(new c5t(n.collector));for(let l of r){if(tne.NamedMultiLineCheckedProblemPattern.is(l)){let c=s.parse(l);s.problemReporter.status.state<3?this.add(c.name,c.patterns):(n.collector.error(d(13994,null)),n.collector.error(JSON.stringify(l,void 0,4)))}else if(tne.NamedProblemPattern.is(l)){let c=s.parse(l);s.problemReporter.status.state<3?this.add(l.name,c):(n.collector.error(d(13994,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})}},xG=new oFi,mUe=class extends dat{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?cn(e.fileLocation)?(this.error(d(13963,null,JSON.stringify(i,null,4))),!1):!0:(this.error(d(13965,null,JSON.stringify(i,null,4))),!1):(this.error(d(13967,null,JSON.stringify(i,null,4))),!1):(this.error(d(13966,null,JSON.stringify(i,null,4))),!1)}createProblemMatcher(i){let e=null,t=Ae(i.owner)?i.owner:_t(),o=Ae(i.source)?i.source:void 0,n=Ae(i.applyTo)?uat.fromString(i.applyTo):0;n||(n=0);let r,s,l;if(cn(i.fileLocation))r=1,s="${workspaceFolder}";else if(Ae(i.fileLocation))l=uUe.fromString(i.fileLocation),l&&(r=l,l===1||l===3?s="${workspaceFolder}":l===4&&(s={include:["${workspaceFolder}"]}));else if(SS(i.fileLocation)){let p=i.fileLocation;p.length>0&&(l=uUe.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)&&uUe.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?gt.fromValue(i.severity):void 0;if(u===gt.Ignore&&(this.info(d(13970,null,i.severity)),u=gt.Error),Ae(i.base)){let p=i.base;if(p.length>1&&p[0]==="$"){let h=Ab.get(p.substring(1));h&&(e=Xi(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 tne.isNamedProblemMatcher(i)&&(e.name=i.name,e.label=Ae(i.label)?i.label:i.name),e}createProblemPattern(i){if(Ae(i)){let e=i;if(e.length>1&&e[0]==="$"){let t=xG.get(e.substring(1));return t||this.error(d(13962,null,e)),t}else e.length===0?this.error(d(13964,null)):this.error(d(13968,null,e))}else if(i){let e=new l5t(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(Jn(n))return;let r=this.createWatchingPattern(n.beginsPattern),s=this.createWatchingPattern(n.endsPattern);if(r&&s){e.watching={activeOnStart:Da(n.activeOnStart)?n.activeOnStart:!1,beginsPattern:r,endsPattern:s};return}(r||s)&&this.error(d(13969,null))}createWatchingPattern(i){if(Jn(i))return null;let e,t;return Ae(i)?e=this.createRegularExpression(i):(e=this.createRegularExpression(i.regexp),Xo(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(13961,null,i))}return e}},Mcn=Tn.registerExtensionPoint({extensionPoint:"problemMatchers",deps:[Bxo],jsonSchema:{description:d(13960,null),type:"array",items:Ffe.NamedProblemMatcher}}),nFi=class{constructor(){this._onMatchersChanged=new E;this.onMatcherChanged=this._onMatchersChanged.event;this.matchers=Object.create(null),this.fillDefaults(),this.readyPromise=new Promise((i,e)=>{Mcn.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 mUe(new c5t(r.collector));for(let c of s){let u=l.parse(c);u&&rFi(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 xG.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(13952,null),owner:"msCompile",source:"cpp",applyTo:0,fileLocation:2,pattern:xG.get("msCompile")}),this.add({name:"lessCompile",label:d(13951,null),deprecated:!0,owner:"lessCompile",source:"less",applyTo:0,fileLocation:2,pattern:xG.get("lessCompile"),severity:gt.Error}),this.add({name:"gulp-tsc",label:d(13944,null),owner:"typescript",source:"ts",applyTo:2,fileLocation:1,filePrefix:"${workspaceFolder}",pattern:xG.get("gulp-tsc")}),this.add({name:"jshint",label:d(13945,null),owner:"jshint",source:"jshint",applyTo:0,fileLocation:2,pattern:xG.get("jshint")}),this.add({name:"jshint-stylish",label:d(13946,null),owner:"jshint",source:"jshint",applyTo:0,fileLocation:2,pattern:xG.get("jshint-stylish")}),this.add({name:"eslint-compact",label:d(13941,null),owner:"eslint",source:"eslint",applyTo:0,fileLocation:2,filePrefix:"${workspaceFolder}",pattern:xG.get("eslint-compact")}),this.add({name:"eslint-stylish",label:d(13942,null),owner:"eslint",source:"eslint",applyTo:0,fileLocation:2,pattern:xG.get("eslint-stylish")}),this.add({name:"go",label:d(13943,null),owner:"go",source:"go",applyTo:0,fileLocation:1,filePrefix:"${workspaceFolder}",pattern:xG.get("go")})}},Ab=new nFi;var Hxo="task.hasPromptedForAutomaticTasks.v2",pat="task.allowAutomaticTasks",hUe=class extends C{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(H.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(pat);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 H.toPromise(H.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=>{H.toPromise(H.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(gl.toConfigurationTarget(e.kind)){case 6:return je(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(pat)==="on"){this._runTasks(e,s);return}if(o.getBoolean(Hxo,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(St.Info,d(13721,null,r.join(", "),Array.from(s.keys()).join(", ")),[{label:d(13717,null),run:()=>{l(!0),n.updateValue(pat,"on",2)}},{label:d(13718,null),run:()=>{l(!1),n.updateValue(pat,"off",2)}},{label:s.size===1?d(13719,null):d(13720,null),run:async()=>{for(let c of s)await o.open(c[1]);l(!1)}}],{onCancel:()=>l(!1)}),t.store(Hxo,!0,1,1)})}};hUe=I([m(0,yg),m(1,B),m(2,ns),m(3,ne),m(4,le),m(5,Ne),m(6,Qe)],hUe);var gUe=class a extends K{static{this.ID="workbench.action.tasks.manageAutomaticRunning"}static{this.LABEL=d(13724,null)}constructor(){super({id:a.ID,title:a.LABEL,category:MC})}async run(i){let e=i.get(Ge),t=i.get(B),o={label:d(13722,null)},n={label:d(13723,null)},r=await e.pick([o,n],{canPickMany:!1});r&&t.updateValue(pat,r===o?"on":"off",2)}};var Acn={definitions:{showOutputType:{type:"string",enum:["always","silent","never"]},options:{type:"object",description:d(13913,null),properties:{cwd:{type:"string",description:d(13914,null)},env:{type:"object",additionalProperties:{type:"string"},description:d(13915,null)}},additionalProperties:{type:["string","array","object"]}},problemMatcherType:{oneOf:[{type:"string",errorMessage:d(13928,null)},Ffe.LegacyProblemMatcher,{type:"array",items:{anyOf:[{type:"string",errorMessage:d(13928,null)},Ffe.LegacyProblemMatcher]}}]},shellConfiguration:{type:"object",additionalProperties:!1,description:d(13919,null),properties:{executable:{type:"string",description:d(13918,null)},args:{type:"array",description:d(13917,null),items:{type:"string"}}}},commandConfiguration:{type:"object",additionalProperties:!1,properties:{command:{type:"string",description:d(13910,null)},args:{type:"array",description:d(13923,null),items:{type:"string"}},options:{$ref:"#/definitions/options"}}},taskDescription:{type:"object",required:["taskName"],additionalProperties:!1,properties:{taskName:{type:"string",description:d(13933,null)},command:{type:"string",description:d(13910,null)},args:{type:"array",description:d(13923,null),items:{type:"string"}},options:{$ref:"#/definitions/options"},windows:{anyOf:[{$ref:"#/definitions/commandConfiguration",description:d(13937,null)},{properties:{problemMatcher:{$ref:"#/definitions/problemMatcherType",description:d(13929,null)}}}]},osx:{anyOf:[{$ref:"#/definitions/commandConfiguration",description:d(13927,null)},{properties:{problemMatcher:{$ref:"#/definitions/problemMatcherType",description:d(13929,null)}}}]},linux:{anyOf:[{$ref:"#/definitions/commandConfiguration",description:d(13926,null)},{properties:{problemMatcher:{$ref:"#/definitions/problemMatcherType",description:d(13929,null)}}}]},suppressTaskName:{type:"boolean",description:d(13932,null),default:!0},showOutput:{$ref:"#/definitions/showOutputType",description:d(13931,null)},echoCommand:{type:"boolean",description:d(13911,null),default:!0},isWatching:{type:"boolean",deprecationMessage:d(13936,null),description:d(13935,null),default:!0},isBackground:{type:"boolean",description:d(13924,null),default:!0},promptOnClose:{type:"boolean",description:d(13930,null),default:!1},isBuildCommand:{type:"boolean",description:d(13925,null),default:!0},isTestCommand:{type:"boolean",description:d(13934,null),default:!0},problemMatcher:{$ref:"#/definitions/problemMatcherType",description:d(13929,null)}}},taskRunnerConfiguration:{type:"object",required:[],properties:{command:{type:"string",description:d(13910,null)},args:{type:"array",description:d(13908,null),items:{type:"string"}},options:{$ref:"#/definitions/options"},showOutput:{$ref:"#/definitions/showOutputType",description:d(13920,null)},isWatching:{type:"boolean",deprecationMessage:d(13940,null),description:d(13939,null),default:!0},isBackground:{type:"boolean",description:d(13909,null),default:!0},promptOnClose:{type:"boolean",description:d(13916,null),default:!1},echoCommand:{type:"boolean",description:d(13911,null),default:!0},suppressTaskName:{type:"boolean",description:d(13921,null),default:!0},taskSelector:{type:"string",description:d(13938,null)},problemMatcher:{$ref:"#/definitions/problemMatcherType",description:d(13912,null)},tasks:{type:"array",description:d(13922,null),items:{type:"object",$ref:"#/definitions/taskDescription"}}}}}},u5t=Acn;var p5t={oneOf:[{allOf:[{type:"object",required:["version"],properties:{version:{type:"string",enum:["0.1.0"],deprecationMessage:d(13823,null),description:d(13822,null)},_runner:{deprecationMessage:d(13817,null)},runner:{type:"string",enum:["process","terminal"],default:"process",description:d(13820,null)},windows:{$ref:"#/definitions/taskRunnerConfiguration",description:d(13824,null)},osx:{$ref:"#/definitions/taskRunnerConfiguration",description:d(13819,null)},linux:{$ref:"#/definitions/taskRunnerConfiguration",description:d(13818,null)}}},{$ref:"#/definitions/taskRunnerConfiguration"}]}]},aFi={type:"boolean",default:!0,description:d(13821,null)};p5t.definitions=Xi(u5t.definitions);var mQ=p5t.definitions;mQ.commandConfiguration.properties.isShellCommand=Xi(aFi);mQ.taskDescription.properties.isShellCommand=Xi(aFi);mQ.taskRunnerConfiguration.properties.isShellCommand=Xi(aFi);Object.getOwnPropertyNames(mQ).forEach(a=>{let i=a+"1";mQ[i]=mQ[a],delete mQ[a]});function sFi(a){Array.isArray(a)?a.forEach(i=>{typeof i=="object"&&i!==null&&sFi(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")&&sFi(e)}))}sFi(p5t);Ab.onReady().then(()=>{try{let a=Ab.keys().map(i=>"$"+i);mQ.problemMatcherType1.oneOf[0].enum=a,mQ.problemMatcherType1.oneOf[2].items.anyOf[1].enum=a}catch{console.log("Installing problem matcher ids failed")}});var lFi=p5t;function m5t(a){Array.isArray(a)?a.forEach(i=>{typeof i=="object"&&i!==null&&m5t(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")&&m5t(e)}))}var cFi={anyOf:[{type:"boolean",default:!0,description:d(13836,null)},{$ref:"#/definitions/shellConfiguration"}],deprecationMessage:d(13870,null)},Kxo={type:"boolean",description:d(13832,null),default:!0},Gxo={type:"boolean",description:d(13833,null),default:!1},Uxo={type:"object",additionalProperties:!0,properties:{type:{type:"string",description:d(13842,null)}}},$xo={anyOf:[{type:"string",description:d(13843,null)},Uxo,{type:"array",description:d(13841,null),items:{anyOf:[{type:"string"},Uxo]}}],description:d(13840,null)},qxo={type:"string",enum:["parallel","sequence"],enumDescriptions:[d(13845,null),d(13846,null)],default:"parallel",description:d(13844,null)},jxo={type:"string",description:d(13847,null)},Qxo={type:"object",description:d(13857,null),properties:{id:{description:d(13859,null),type:["string","null"],enum:Array.from(k$(),a=>a.id),markdownEnumDescriptions:Array.from(k$(),a=>`$(${a.id})`)},color:{description:d(13858,null),type:["string","null"],enum:["terminal.ansiBlack","terminal.ansiRed","terminal.ansiGreen","terminal.ansiYellow","terminal.ansiBlue","terminal.ansiMagenta","terminal.ansiCyan","terminal.ansiWhite"]}}},h5t={type:"object",default:{echo:!0,reveal:"always",focus:!1,panel:"shared",showReuseMessage:!0,clear:!1},description:d(13874,null),additionalProperties:!1,properties:{echo:{type:"boolean",default:!0,description:d(13877,null)},focus:{type:"boolean",default:!1,description:d(13878,null)},revealProblems:{type:"string",enum:["always","onProblem","never"],enumDescriptions:[d(13887,null),d(13889,null),d(13888,null)],default:"never",description:d(13886,null)},reveal:{type:"string",enum:["always","silent","never"],enumDescriptions:[d(13883,null),d(13885,null),d(13884,null)],default:"always",description:d(13882,null)},panel:{type:"string",enum:["shared","dedicated","new"],default:"shared",description:d(13880,null)},showReuseMessage:{type:"boolean",default:!0,description:d(13890,null)},clear:{type:"boolean",default:!1,description:d(13875,null)},group:{type:"string",description:d(13879,null)},close:{type:"boolean",description:d(13876,null)},preserveTerminalName:{type:"boolean",default:!1,description:d(13881,null)}}},Yxo=Xi(h5t);Yxo.deprecationMessage=d(13904,null);var zxo={type:"string",enum:["build","test","none"],enumDescriptions:[d(13850,null),d(13856,null),d(13855,null)],description:d(13854,null)},dFi={oneOf:[zxo,{type:"object",properties:{kind:zxo,isDefault:{type:["boolean","string"],default:!1,description:d(13853,null)}}}],defaultSnippets:[{body:{kind:"build",isDefault:!0},description:d(13851,null)},{body:{kind:"test",isDefault:!0},description:d(13852,null)}],description:d(13849,null)},Xxo={type:"string",enum:["shell"],default:"process",description:d(13905,null)},Ncn={oneOf:[{oneOf:[{type:"string"},{type:"array",items:{type:"string"},description:d(13830,null)}]},{type:"object",required:["value","quoting"],properties:{value:{oneOf:[{type:"string"},{type:"array",items:{type:"string"},description:d(13830,null)}],description:d(13828,null)},quoting:{type:"string",enum:["escape","strong","weak"],enumDescriptions:[d(13892,null),d(13893,null),d(13894,null)],default:"strong",description:d(13829,null)}}}],description:d(13827,null)},Jxo={type:"array",items:{oneOf:[{type:"string"},{type:"object",required:["value","quoting"],properties:{value:{type:"string",description:d(13825,null)},quoting:{type:"string",enum:["escape","strong","weak"],enumDescriptions:[d(13892,null),d(13893,null),d(13894,null)],default:"strong",description:d(13826,null)}}}]},description:d(13837,null)},Ocn={type:"string",description:d(13872,null)},Zxo={type:"string",enum:["2.0.0"],description:d(13906,null)},eko={type:"string",description:d(13860,null),deprecationMessage:d(13861,null)},tko={type:"object",additionalProperties:!1,properties:{reevaluateOnRerun:{type:"boolean",description:d(13895,null),default:!0},runOn:{type:"string",enum:["default","folderOpen"],description:d(13896,null),default:"default"},instanceLimit:{type:"number",description:d(13862,null),default:1},instancePolicy:{type:"string",enum:["terminateNewest","terminateOldest","prompt","warn","silent"],enumDescriptions:[d(13866,null),d(13867,null),d(13864,null),d(13868,null),d(13865,null)],description:d(13863,null),default:"prompt"}},description:d(13897,null)},uFi=u5t.definitions,iko=Xi(uFi.options),Fcn=iko.properties;Fcn.shell=Xi(uFi.shellConfiguration);var oko={type:"object",additionalProperties:!1,properties:{label:{type:"string",description:d(13900,null)},taskName:{type:"string",description:d(13901,null),deprecationMessage:d(13902,null)},identifier:Xi(eko),group:Xi(dFi),isBackground:{type:"boolean",description:d(13838,null),default:!0},promptOnClose:{type:"boolean",description:d(13891,null),default:!1},presentation:Xi(h5t),icon:Xi(Qxo),hide:Xi(Kxo),inSessions:Xi(Gxo),options:iko,problemMatcher:{$ref:"#/definitions/problemMatcherType",description:d(13873,null)},runOptions:Xi(tko),dependsOn:Xi($xo),dependsOrder:Xi(qxo),detail:Xi(jxo)}},fUe=[];sk.onReady().then(()=>{pFi()});function pFi(){for(let a of sk.all()){if(fUe.find(t=>t.properties?.type?.enum?.find?t.properties?.type.enum.find(o=>o===a.taskType):void 0))continue;let i=Xi(oko),e=i.properties;if(e.type={type:"string",description:d(13831,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]=Xi(o)}m5t(i),fUe.push(i)}}var mat=Xi(oko);mat.properties.customize={type:"string",deprecationMessage:d(13839,null)};mat.required||(mat.required=[]);mat.required.push("customize");fUe.push(mat);var xT=Xi(uFi),g5t=xT.taskDescription;g5t.required=["label"];var SI=g5t.properties;SI.label=Xi(Ocn);SI.command=Xi(Ncn);SI.args=Xi(Jxo);SI.isShellCommand=Xi(cFi);SI.dependsOn=$xo;SI.hide=Xi(Kxo);SI.inSessions=Xi(Gxo);SI.dependsOrder=qxo;SI.identifier=Xi(eko);SI.type=Xi(Xxo);SI.presentation=Xi(h5t);SI.terminal=Yxo;SI.icon=Xi(Qxo);SI.group=Xi(dFi);SI.runOptions=Xi(tko);SI.detail=jxo;SI.taskName.deprecationMessage=d(13902,null);var f5t=Xi(g5t);g5t.default={label:"My Task",type:"shell",command:"echo Hello",problemMatcher:[]};xT.showOutputType.deprecationMessage=d(13898,null);SI.echoCommand.deprecationMessage=d(13848,null);SI.suppressTaskName.deprecationMessage=d(13899,null);SI.isBuildCommand.deprecationMessage=d(13869,null);SI.isTestCommand.deprecationMessage=d(13871,null);f5t.properties.type={type:"string",enum:["process"],default:"process",description:d(13905,null)};f5t.required.push("command");f5t.required.push("type");fUe.push(f5t);fUe.push({$ref:"#/definitions/taskDescription"});var hQ=xT.taskRunnerConfiguration.properties,Wcn=hQ.tasks;Wcn.items={oneOf:fUe};hQ.inputs=LLe.definitions.inputs;xT.commandConfiguration.properties.isShellCommand=Xi(cFi);xT.commandConfiguration.properties.args=Xi(Jxo);xT.options.properties.shell={$ref:"#/definitions/shellConfiguration"};hQ.isShellCommand=Xi(cFi);hQ.type=Xi(Xxo);hQ.group=Xi(dFi);hQ.presentation=Xi(h5t);hQ.suppressTaskName.deprecationMessage=d(13899,null);hQ.taskSelector.deprecationMessage=d(13903,null);var mFi=Xi(xT.taskRunnerConfiguration);delete mFi.properties.tasks;mFi.additionalProperties=!1;xT.osSpecificTaskRunnerConfiguration=mFi;hQ.version=Xi(Zxo);var hFi={oneOf:[{allOf:[{type:"object",required:["version"],properties:{version:Xi(Zxo),windows:{$ref:"#/definitions/osSpecificTaskRunnerConfiguration",description:d(13907,null)},osx:{$ref:"#/definitions/osSpecificTaskRunnerConfiguration",description:d(13835,null)},linux:{$ref:"#/definitions/osSpecificTaskRunnerConfiguration",description:d(13834,null)}}},{$ref:"#/definitions/taskRunnerConfiguration"}]}]};hFi.definitions=xT;function nko(a,i){let e=a[i].properties;e?Object.keys(e).forEach(t=>{nko(e,t)}):z$t(a[i])}Object.getOwnPropertyNames(xT).forEach(a=>{let i=a+"2";xT[i]=xT[a],delete xT[a],nko(xT,i)});m5t(hFi);function gFi(){try{let a=Ab.keys().map(i=>"$"+i);xT.problemMatcherType2.oneOf[0].enum=a,xT.problemMatcherType2.oneOf[2].items.anyOf[0].enum=a}catch{console.log("Installing problem matcher ids failed")}}Ab.onReady().then(()=>{gFi()});var fFi=hFi;var vUe=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.")}},FD=class{constructor(i,e,t){this.severity=i,this.message=e,this.code=t}},Wfe;(t=>(t.shortcut="shortcut",t.command="command",t.reconnect="reconnect"))(Wfe||={});var Vcn={id:"dotnetCore",label:".NET Core",sort:"NET Core",autoDetect:!1,description:d(14041,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(`
`)},Bcn={id:"msbuild",label:"MSBuild",autoDetect:!1,description:d(14044,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(`
`)},Hcn={id:"externalCommand",label:"Others",autoDetect:!1,description:d(14042,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(`
`)},Ucn={id:"maven",label:"maven",sort:"MVN",autoDetect:!1,description:d(14043,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(`
`)},v5t=null;function rko(){return v5t||(v5t=[Vcn,Bcn,Ucn].sort((a,i)=>(a.sort||a.label).localeCompare(i.sort||i.label)),v5t.push(Hcn)),v5t}var sko;(i=>{function a(e){return e!==void 0&&Ae(e.type)}i.is=a})(sko||={});var yFi;(i=>{function a(e){return Ae(e)?e:SS(e)?e.join(" "):Ae(e.value)?e.value:e.value.join(" ")}i.value=a})(yFi||={});var wFi=[];Object.freeze(wFi);function qA(a,i,e){let t=i[e];t!==void 0&&(a[e]=t)}function kG(a,i,e){let t=i[e];a[e]===void 0&&t!==void 0&&(a[e]=t)}function fQ(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 CFi(a,i,e){if(!i||fQ(i,e))return a;if(!a||fQ(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 gat(a,i,e,t=!1){if(!i||fQ(i,e))return a;if(!a||fQ(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 ako(a,i,e,t){if(a&&Object.isFrozen(a))return a;if(a==null||i===void 0||i===null)return i!=null?Xi(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 vFi(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 lko;(i=>{function a(e){return e?e.toLowerCase()==="folderopen"?2:1:1}i.fromString=a})(lko||={});var hat;(o=>{let a=[{property:"reevaluateOnRerun"},{property:"runOn"},{property:"instanceLimit"},{property:"instancePolicy"}];function i(n){return{reevaluateOnRerun:n?n.reevaluateOnRerun:!0,runOn:n?lko.fromString(n.runOn):1,instanceLimit:n?.instanceLimit?Math.max(n.instanceLimit,1):1,instancePolicy:n?cko.fromString(n.instancePolicy):"prompt"}}o.fromConfiguration=i;function e(n,r){return CFi(n,r,a)}o.assignProperties=e;function t(n,r){return gat(n,r,a)}o.fillProperties=t})(hat||={});var cko;(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})(cko||={});var Vfe;(l=>{let a=[{property:"executable"},{property:"args"},{property:"quoting"}];function i(c){let u=c;return u&&(Ae(u.executable)||SS(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=Xi(c.quoting)),p}l.from=e;function t(c){return fQ(c,a,!0)}l.isEmpty=t;function o(c,u){return CFi(c,u,a)}l.assignProperties=o;function n(c,u){return gat(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})(Vfe||={});var gQ;(l=>{let a=[{property:"cwd"},{property:"env"},{property:"shell",type:Vfe}],i={cwd:"${workspaceFolder}"};function e(c,u){let p={};return c.cwd!==void 0&&(Ae(c.cwd)?p.cwd=c.cwd:u.taskLoadIssues.push(d(14011,null,c.cwd))),c.env!==void 0&&(p.env=Xi(c.env)),p.shell=Vfe.from(c.shell,u),t(p)?void 0:p}l.from=e;function t(c){return fQ(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(qA(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=Vfe.assignProperties(c.shell,u.shell),c}l.assignProperties=o;function n(c,u){return gat(c,u,a)}l.fillProperties=n;function r(c,u){return ako(c,i,a,u)}l.fillDefaults=r;function s(c){return vFi(c,a)}l.freeze=s})(gQ||={});var F0;(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,N){let O,V,U,G,$,te,pe,de,se,Se,ke=!1;Da(T.echoCommand)&&(O=T.echoCommand,ke=!0),Ae(T.showOutput)&&(V=Bde.fromString(T.showOutput),ke=!0);let Ee=T.presentation||T.terminal;if(Ee&&(Da(Ee.echo)&&(O=Ee.echo),Ae(Ee.reveal)&&(V=Bde.fromString(Ee.reveal)),Ae(Ee.revealProblems)&&(U=wTe.fromString(Ee.revealProblems)),Da(Ee.focus)&&(G=Ee.focus),Ae(Ee.panel)&&($=CTe.fromString(Ee.panel)),Da(Ee.showReuseMessage)&&(te=Ee.showReuseMessage),Da(Ee.clear)&&(pe=Ee.clear),Ae(Ee.group)&&(de=Ee.group),Da(Ee.close)&&(se=Ee.close),Da(Ee.preserveTerminalName)&&(Se=Ee.preserveTerminalName),ke=!0),!!ke)return{echo:O,reveal:V,revealProblems:U,focus:G,panel:$,showReuseMessage:te,clear:pe,group:de,close:se,preserveTerminalName:Se}}k.from=f;function v(T,N){return CFi(T,N,g)}k.assignProperties=v;function b(T,N){return gat(T,N,g)}k.fillProperties=b;function S(T,N){let O=N.engine===2;return ako(T,{echo:O,reveal:1,revealProblems:1,focus:!1,panel:1,showReuseMessage:!0,clear:!1,preserveTerminalName:!1},g,N)}k.fillDefaults=S;function y(T){return vFi(T,g)}k.freeze=y;function w(T){return fQ(T,g)}k.isEmpty=w})(a=h.PresentationOptions||={});let i;(f=>{function g(v){if(v!=null){if(Ae(v))return v;if(SS(v))return v.join(" ");{let b=yTe.from(v.quoting),S=Ae(v.value)?v.value:SS(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:gQ},{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;Ae(g.type)&&(g.type==="shell"||g.type==="process")&&(b=L5.fromString(g.type)),Da(g.isShellCommand)||Vfe.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(14010,null,y?JSON.stringify(y,void 0,4):"undefined"))}}return g.options!==void 0&&(S.options=gQ.from(g.options,f),S.options&&S.options.shell===void 0&&Vfe.is(g.isShellCommand)&&(S.options.shell=Vfe.from(g.isShellCommand,f),f.engine!==2&&f.taskLoadIssues.push(d(14015,null)))),Ae(g.taskSelector)&&(S.taskSelector=g.taskSelector),Da(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 fQ(g,e)}h.isEmpty=r;function s(g,f,v){return r(f)?g:r(g)?f:(qA(g,f,"name"),qA(g,f,"runtime"),qA(g,f,"taskSelector"),qA(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=gQ.assignProperties(g.options,f.options),g)}h.assignProperties=s;function l(g,f){return gat(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){kG(g,f,"name"),kG(g,f,"taskSelector"),kG(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 kG(g,f,"runtime"),g.presentation=a.fillProperties(g.presentation,f.presentation),g.options=gQ.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=gQ.fillDefaults(g.options,f)),g.args===void 0&&(g.args=wFi),g.suppressTaskName===void 0&&(g.suppressTaskName=f.schemaVersion===2))}h.fillDefaults=u;function p(g){return vFi(g,e)}h.freeze=p})(F0||={});var fat;(n=>{function a(r,s){let l=Object.create(null);return Array.isArray(r)&&r.forEach(c=>{let u=new mUe(s.problemReporter).parse(c);rFi(u)?l[u.name]=u:s.problemReporter.error(d(14014,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(14020,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 Ae(r)?1:Array.isArray(r)?3:cn(r)?0:2}function o(r,s){if(Ae(r)){let l=r;if(l.length>1&&l[0]==="$"){l=l.substring(1);let c=Ab.get(l);if(c)return{value:Xi(c)};let u=s.namedProblemMatchers[l];if(u)return u=Xi(u),delete u.name,{value:u}}return{errors:[d(14012,null,r)]}}else{let l=r;return{value:new mUe(s.problemReporter).parse(l)}}}})(fat||={});var Hfe;(e=>{function a(t){if(t!==void 0){if(Ae(t)&&$m.is(t))return{_id:t,isDefault:!1};if(Ae(t.kind)&&$m.is(t.kind)){let o=t.kind,n=cn(t.isDefault)?!1:t.isDefault;return{_id:o,isDefault:n}}}}e.from=a;function i(t){return Ae(t)?t:t.isDefault?{kind:t._id,isDefault:t.isDefault}:t._id}e.to=i})(Hfe||={});var bFi;(e=>{function a(t,o){switch(o){case 2:return NV;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 Ae(t)?{uri:a(o,n),task:t}:sko.is(t)?{uri:a(o,n),task:OV.createTaskIdentifier(t,o.problemReporter)}:void 0}e.from=i})(bFi||={});var dko;(i=>{function a(e){switch(e){case"sequence":return"sequence";case"parallel":default:return"parallel"}}i.from=a})(dko||={});var xFi;(t=>{let a=[{property:"name"},{property:"identifier"},{property:"group"},{property:"isBackground"},{property:"promptOnClose"},{property:"dependsOn"},{property:"presentation",type:F0.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]=Xi(o[p]));if(Ae(o.taskName)&&(c.name=o.taskName),Ae(o.label)&&n.schemaVersion===2&&(c.name=o.label),Ae(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=Hfe.from(o.group),o.dependsOn!==void 0)if(Array.isArray(o.dependsOn))c.dependsOn=o.dependsOn.reduce((p,h)=>{let g=bFi.from(h,n,s);return g&&p.push(g),p},[]);else{let p=bFi.from(o.dependsOn,n,s);c.dependsOn=p?[p]:void 0}c.dependsOrder=dko.from(o.dependsOrder),r&&(o.presentation!==void 0||o.terminal!==void 0)&&(c.presentation=F0.PresentationOptions.from(o,n)),r&&o.options!==void 0&&(c.options=gQ.from(o.options,n));let u=fat.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 fQ(o,a)}t.isEmpty=e})(xFi||={});var SUe="Workspace",uko;(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(14017,null,JSON.stringify(s,null,4)));return}let f=h?p?.get?.(h)||sk.get(h):void 0;if(!f){let T=d(14019,null,h);l.problemReporter.error(T);return}let v;if(Ae(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)}):Ae(s.type)&&(v=s),v===void 0){l.problemReporter.error(d(14013,null,JSON.stringify(s,void 0,0)));return}let b=OV.createTaskIdentifier(v,l.problemReporter);if(b===void 0){l.problemReporter.error(d(14009,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:gl.User,config:S,label:SUe};break}case 1:{y={kind:gl.WorkspaceFile,config:S,label:SUe};break}default:{y={kind:gl.Workspace,config:S,label:SUe};break}}let w=new tf(`${f.extensionId}.${b._key}`,y,void 0,h,b,hat.fromConfiguration(s.runOptions),{hide:s.hide,inSessions:s.inSessions}),k=xFi.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 N of f.required){let O=w.configures[N];if(O){T=T+": "+O;break}}w._label=T}w.configurationProperties.identifier||(w.configurationProperties.identifier=b._key)}return w}r.from=n})(uko||={});var Bfe;(o=>{function a(n,r,s,l){if(!n)return;let c=n.type;if(c==null&&(c=D5),c!==D5&&c!=="shell"&&c!=="process"){r.problemReporter.error(d(14018,null,JSON.stringify(n,null,4)));return}let u=n.taskName;if(Ae(n.label)&&r.schemaVersion===2&&(u=n.label),!u){r.problemReporter.error(d(14016,null,JSON.stringify(n,null,4)));return}let p;switch(l){case 2:{p={kind:gl.User,config:{index:s,element:n,file:".vscode/tasks.json",workspaceFolder:r.workspaceFolder},label:SUe};break}case 1:{p={kind:gl.WorkspaceFile,config:{index:s,element:n,file:".vscode/tasks.json",workspaceFolder:r.workspaceFolder,workspace:r.workspace},label:SUe};break}default:{p={kind:gl.Workspace,config:{index:s,element:n,file:".vscode/tasks.json",workspaceFolder:r.workspaceFolder},label:SUe};break}}let h=new pd(r.uuidMap.getUUID(u),p,u,D5,void 0,!1,hat.fromConfiguration(n.runOptions),{name:u,identifier:u}),g=xFi.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=$m.Build:b.isTestCommand===!0&&(h.configurationProperties.group=$m.Test))}let v=F0.from(n,r);return v&&(h.command=v),n.command!==void 0&&(v.suppressTaskName=!0),h}o.from=a;function i(n,r){(F0.hasCommand(n.command)||n.configurationProperties.dependsOn===void 0)&&(n.command=F0.fillGlobals(n.command,r.command,n.configurationProperties.name)),n.configurationProperties.problemMatchers===void 0&&r.problemMatcher!==void 0&&(n.configurationProperties.problemMatchers=Xi(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){F0.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=wFi)}o.fillDefaults=e;function t(n,r){let s=new pd(r._id,Object.assign({},r._source,{customizes:n.defines}),r.configurationProperties.name||n._label,D5,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;qA(l,r.configurationProperties,"group"),qA(l,r.configurationProperties,"isBackground"),qA(l,r.configurationProperties,"dependsOn"),qA(l,r.configurationProperties,"problemMatchers"),qA(l,r.configurationProperties,"promptOnClose"),qA(l,r.configurationProperties,"detail"),s.command.presentation=F0.PresentationOptions.assignProperties(s.command.presentation,r.configurationProperties.presentation),s.command.options=gQ.assignProperties(s.command.options,r.configurationProperties.options),s.runOptions=hat.assignProperties(s.runOptions,r.runOptions);let c=n.configurationProperties;return kG(l,c,"group"),kG(l,c,"isBackground"),kG(l,c,"dependsOn"),kG(l,c,"problemMatchers"),kG(l,c,"promptOnClose"),kG(l,c,"detail"),s.command.presentation=F0.PresentationOptions.fillProperties(s.command.presentation,c.presentation),s.command.options=gQ.fillProperties(s.command.options,c.options),s.runOptions=hat.fillProperties(s.runOptions,n.runOptions),n.hasDefinedMatchers===!0&&(s.hasDefinedMatchers=!0),s}o.createCustomTask=t})(Bfe||={});var bUe;(o=>{function a(n){let r=n.type;return n.customize===void 0&&(r==null||r===D5||r==="shell"||r==="process")}let i={shell:Ude,process:xTe};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=Xi(s.taskLoadIssues);for(let S=0;S<n.length;S++){let y=n[S],w=y.type?c?.get?.(y.type)||sk.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=!Ude.evaluate(s.contextKeyService.getContext(null));break}}if(k){s.problemReporter.info(d(14023,null,y.type));continue}if(a(y)){let T=Bfe.from(y,s,S,l);if(T){if(Bfe.fillGlobals(T,r),Bfe.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(14022,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(14021,null,T.configurationProperties.name,JSON.stringify(y,void 0,4)));continue}T.configurationProperties.group===$m.Build&&p.rank<2?(p.task=T,p.rank=2):T.configurationProperties.group===$m.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=uko.from(y,s,S,l,c);T&&(T.addTaskLoadMessages(s.taskLoadIssues),u.configured.push(T))}s.taskLoadIssues=Xi(f)}let v=Ae(p.task?.configurationProperties.group)?p.task?.configurationProperties.group:p.task?.configurationProperties.group?._id,b=Ae(h.task?.configurationProperties.group)?h.task?.configurationProperties.group:h.task?.configurationProperties.group?._id;return v!==$m.Build._id&&p.rank>-1&&p.rank<2&&p.task?p.task.configurationProperties.group=$m.Build:b!==$m.Test._id&&h.rank>-1&&h.rank<2&&h.task&&(h.task.configurationProperties.group=$m.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})(bUe||={});var pko;(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=F0.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=fat.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:(qA(s,l,"promptOnClose"),qA(s,l,"suppressTaskName"),s)}r.assignProperties=t;function o(s,l){s&&(F0.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&&F0.freeze(s.command)}r.freeze=n})(pko||={});var IUe;(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=vat.from(e);if(n===1)return o||1;if(n===2)return 2;throw new Error("Shouldn't happen.")}i.from=a})(IUe||={});var vat;(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})(vat||={});var SFi=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=_t());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 IFi=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=IUe.from(i),n=vat.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=pko.from(i,e);if(this.problemReporter.status.isFatal())return{custom:[],configured:[]};e.namedProblemMatchers=fat.namedFrom(i.declares,e);let n,r;if(i.windows&&e.platform===3?(n=bUe.from(i.windows.tasks,o,e,t).custom,r=i.windows.tasks):i.osx&&e.platform===1?(n=bUe.from(i.osx.tasks,o,e,t).custom,r=i.osx.tasks):i.linux&&e.platform===2&&(n=bUe.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(14024,null,l.join(`
`)))}let s={custom:[],configured:[]};if(i.tasks&&(s=bUe.from(i.tasks,o,e,t)),n&&(s.custom=bUe.assignTasks(s.custom,n)),(!s.custom||s.custom.length===0)&&o.command&&o.command.name){let l=fat.from(i.problemMatcher,e).value??[],c=i.isBackground?!!i.isBackground:i.isWatching?!!i.isWatching:void 0,u=R5.value(o.command.name),p=new pd(e.uuidMap.getUUID(u),Object.assign({},t,"workspace",{config:{index:-1,element:i,workspaceFolder:e.workspaceFolder}}),u,D5,{name:void 0,runtime:void 0,presentation:void 0,suppressTaskName:!0},!1,{reevaluateOnRerun:!0},{name:u,identifier:u,group:$m.Build,isBackground:c,problemMatchers:l}),h=Hfe.from(i.group);h!==void 0?p.configurationProperties.group=h:i.group==="none"&&(p.configurationProperties.group=void 0),Bfe.fillGlobals(p,o),Bfe.fillDefaults(p,e),s.custom=[p]}return s.custom=s.custom||[],s.configured=s.configured||[],s}},$cn=new Map,qcn=new Map;function kFi(a,i,e,t,o,n,r,s=!1){let l=s?qcn:$cn,c=l.get(n);c||(l.set(n,new Map),c=l.get(n));let u=c.get(a.uri.toString());u||(u=new SFi,c.set(a.uri.toString(),u));try{return u.start(),new IFi(a,i,e,o,u).run(t,n,r)}finally{u.finish()}}function yUe(a,i){return Bfe.createCustomTask(a,i)}var bat;(i=>{function a(e){return Object.freeze({kind:e})}i.create=a})(bat||={});var b5t=class extends C{constructor(e,t,o,n,r){super();this.problemMatchers=e;this.markerService=t;this.modelService=o;this.logService=r;this.modelListeners=new P;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=>Vxo(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=TW.makeKeyOptionalMessage(e,!1),l;r.has(s)?(l=r.get(s))!==void 0&&l.message.length<e.message.length&&ri&&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 wUe=class extends b5t{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(bat.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))}},S5t=class extends b5t{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=_t();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=H.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(bat.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(bat.create("backgroundProcessingBegins")),this.cleanMarkerCaches(),this.resetCurrentResource();let l=o.matcher.owner,c=r[o.begin.file];if(c){let u=pUe(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(),this._onDidStateChange.fire(bat.create("backgroundProcessingEnds")),t=!0,this.lines.push(e);let l=o.matcher.owner;this.cleanMarkers(l),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 EG="task_terminal_status",Qcn={id:EG,icon:cE,severity:gt.Info,tooltip:d(13794,null)},Ycn={id:EG,icon:M.check,severity:gt.Info,tooltip:d(13799,null)},Xcn={id:EG,icon:M.check,severity:gt.Info,tooltip:d(13800,null)},Jcn={id:EG,icon:M.error,severity:gt.Error,tooltip:d(13795,null)},Zcn={id:EG,icon:M.error,severity:gt.Error,tooltip:d(13796,null)},edn={id:EG,icon:M.warning,severity:gt.Warning,tooltip:d(13801,null)},tdn={id:EG,icon:M.warning,severity:gt.Warning,tooltip:d(13802,null)},idn={id:EG,icon:M.info,severity:gt.Info,tooltip:d(13797,null)},odn={id:EG,icon:M.info,severity:gt.Info,tooltip:d(13798,null)},CUe=class extends C{constructor(e,t){super();this._accessibilitySignalService=t;this.terminalMap=this._register(new jt);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:EG,severity:gt.Info};t.statusList.add(n);let r=new P;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(13793,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(Ycn);else e.exitCode||t.problemMatcher.maxMarkerSeverity!==void 0&&t.problemMatcher.maxMarkerSeverity===8?(this._accessibilitySignalService.playSignal($o.taskFailed),t.terminal.statusList.add(Jcn)):t.problemMatcher.maxMarkerSeverity===4?(this._accessibilitySignalService.playSignal($o.taskFailed),t.terminal.statusList.add(edn)):t.problemMatcher.maxMarkerSeverity===2&&t.terminal.statusList.add(idn)}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(Xcn)):t.problemMatcher.maxMarkerSeverity===8?(this._accessibilitySignalService.playSignal($o.taskFailed),t.terminal.statusList.add(Zcn)):t.problemMatcher.maxMarkerSeverity===4?t.terminal.statusList.add(tdn):t.problemMatcher.maxMarkerSeverity===2&&t.terminal.statusList.add(odn))}eventActive(e){let t=this.terminalFromEvent(e);t&&(t.taskRunEnded=!1,t.terminal.statusList.remove(t.status),(t.problemMatcher instanceof wUe||t.problemMatcher?.problemMatchers.length>0||e.runType==="singleRun")&&t.terminal.statusList.add(Qcn))}};CUe=I([m(0,yg),m(1,tr)],CUe);function vQ(a,i){return ndn(633,a,i)}function ndn(a,i,e){let t=`\x1B]${a};${i}`;return e&&(t+=`;${e}`),t+="\x07",t}var I5t=class extends C{constructor(){super();this.terminalMarkerMap=new Map;this.terminalDisposables=new jt}addTerminal(e,t){this.terminalMarkerMap.set(e.instanceId,{resources:new Map,markers:new Map});let o=new P;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 Sat="Task",Iat=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)}},ine=class a extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N){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=N;this._isRerun=!1;this._terminalCreationQueue=Promise.resolve();this._hasReconnected=!1;this._terminalTabActions=[{id:$Rt,label:d(13806,null),icon:GRt}];this._taskStartTimes=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 zH,this._sameTaskTerminals=Object.create(null),this._onDidStateChange=this._register(new E),this._taskSystemInfoResolver=T,this._register(this._terminalStatusManager=k.createInstance(CUe)),this._register(this._taskProblemMonitor=k.createInstance(I5t)),this._taskTerminalActive=A9e.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 vQ("P","HasRichCommandDetection=True")+vQ("A")+vQ("P","Task=True")+(e?vQ("P",`Cwd=${typeof e=="string"?e:e.fsPath}`):"")+vQ("B")}getTaskShellIntegrationOutputSequence(e){return(e?vQ("E",`${WIo(e.commandLine)};${e.nonce}`):"")+vQ("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,Wfe.reconnect)}run(e,t,o=Wfe.command){e=e.clone();let n=GE.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 vUe(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 FD?l:l instanceof Error?(this._log(l.message),new FD(gt.Error,l.message,7)):(this._log(l.toString()),new FD(gt.Error,d(13815,null),7))}}getTerminalsForTasks(e){let t=[];for(let o of Yl(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(gt.Warning,d(13814,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(dc)&&o?.instanceId===t.terminal.instanceId}revealTask(e){let t=this._activeTasks[e.getMapKey()];if(!t?.terminal)return!1;let o=this._viewDescriptorService.getViewLocationById(dc)===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===dc&&(this._previousTerminalInstance=this._terminalService.activeInstance??void 0)),this._terminalService.setActiveInstance(t.terminal),(pd.is(e)||bh.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(Gu.terminated(e,c.instanceId,c.exitReason)),s.dispose()}),l=o.onExit(()=>{let c=t.task;try{l.dispose(),this._fireTaskEvent(Gu.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(Gu.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(13804,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(Gu.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(13805,null,Ae(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(bh.is(e)||pd.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,R5.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||(Xl(s)?s:Ld(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(Gu.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"){Ae(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:R5.value(o.command.name)},c&&(g.process.cwd=c),u&&(g.process.path=u)),h=e.resolveVariables(t,g,gl.toConfigurationTarget(o._source.kind)).then(async f=>{if(f){if(this._mergeMaps(r,f.variables),f.variables=new Map(r),s){let v=R5.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,gl.toConfigurationTarget(o._source.kind)).then(async b=>{if(b){if(this._mergeMaps(r,b),b=new Map(r),s){let y;ri?y=await this._resolveAndFindExecutable(e,t,o,c,u):y=await this._configurationResolverService.resolveAsync(t,R5.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 Iat(r,s,u.variables,this._configurationResolverService),r)):(this._fireTaskEvent(Gu.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 Iat(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 Iat(n.getVerifiedTask().workspaceFolder,n.getVerifiedTask().systemInfo,c.variables,this._configurationResolverService),r)):(this._fireTaskEvent(Gu.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 S5t(u,this._markerService,this._modelService,this._fileService,this._logService);u.length>0&&!p.isWatching()&&(this._appendOutput(d(13813,null,e._label)),this._showOutput());let h=new P,g=0,f=e.getMapKey();h.add(p.onDidStateChange(y=>{if(y.kind==="backgroundProcessingBegins")g++,this._busyTasks[f]=e,this._fireTaskEvent(Gu.general("active",e,r?.instanceId));else if(y.kind==="backgroundProcessingEnds"&&(g--,this._busyTasks[f]&&delete this._busyTasks[f],this._fireTaskEvent(Gu.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(Gu.general("problemMatcherFoundErrors",e,r?.instanceId));let w=e.command.presentation.reveal;e.command.presentation.revealProblems===2?this._viewsService.openView(wr.MARKERS_VIEW_ID,!0):w===2&&(this._terminalService.setActiveInstance(r),this._terminalGroupService.showPanel(!1))}else this._fireTaskEvent(Gu.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(Gu.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(Gu.start(e,r.instanceId,o.values));let S;if(u.length&&(S=r.onLineData(y=>{p.processLine(y),v||(v=new jo(3e3)),v.trigger(()=>{p.forceDelivery(),v=void 0})})),l=new Promise((y,w)=>{let k=r.onExit(T=>{let N=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(Gu.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&&(N!==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(Gu.processStarted(e,r.instanceId,r.processId)),b=!0);let U=this._takeTaskDuration(r.instanceId);this._fireTaskEvent(Gu.processEnded(e,r.instanceId,N,U));for(let G=0;G<g;G++)this._fireTaskEvent(Gu.inactive(e,r.instanceId));g=0,this._fireTaskEvent(Gu.general("end",e)),h.dispose(),y({exitCode:N??void 0})})}),t===Wfe.reconnect&&r.xterm){let y=[],w=r.xterm.getBufferReverseIterator(),k=new RegExp(p.beginPatterns.map(N=>N.source).join("|"));for(let N of w)if(y.push(N),k.test(N))break;let T;for(let N=y.length-1;N>=0;N--)p.processLine(y[N]),T||(T=new jo(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(Gu.start(e,r.instanceId,o.values));let u=e.getMapKey();this._busyTasks[u]=e,this._fireTaskEvent(Gu.general("active",e,r.instanceId));let p=await this._resolveMatchers(o,e.configurationProperties.problemMatchers),h=new wUe(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(Gu.general("problemMatcherStarted",e,r?.instanceId)):b.kind==="backgroundProcessingEnds"&&(h.numberOfMatches&&h.maxMarkerSeverity&&h.maxMarkerSeverity>=8?(this._taskErrors[e.getMapKey()]=!0,this._fireTaskEvent(Gu.general("problemMatcherFoundErrors",e,r?.instanceId))):this._fireTaskEvent(Gu.problemMatcherEnded(e,this._taskHasErrors(e),r?.instanceId)))}),f=!1;r.processReady.then(()=>{f||(this._fireTaskEvent(Gu.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(Gu.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 N=e.command.presentation.reveal,O=e.command.presentation.revealProblems;if(r&&O===2&&h.numberOfMatches>0)this._viewsService.openView(wr.MARKERS_VIEW_ID);else if(r&&N===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(Gu.processStarted(e,r.instanceId,r.processId)),f=!0);let U=this._takeTaskDuration(r?.instanceId);this._fireTaskEvent(Gu.processEnded(e,r?.instanceId,k??void 0,U)),this._busyTasks[u]&&delete this._busyTasks[u],this._fireTaskEvent(Gu.inactive(e,r?.instanceId,U)),h.numberOfMatches&&h.maxMarkerSeverity&&h.maxMarkerSeverity>=8?(this._taskErrors[e.getMapKey()]=!0,this._fireTaskEvent(Gu.general("problemMatcherFoundErrors",e,r?.instanceId))):this._fireTaskEvent(Gu.problemMatcherEnded(e,this._taskHasErrors(e),r?.instanceId)),this._fireTaskEvent(Gu.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(wr.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(Gu.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}_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=Sat,b=e.command.name,S;if(r.cwd&&(S=r.cwd,Xl(S)||t&&t.uri.scheme===Y.file&&(S=Ld(t.uri.fsPath,S)),S=g6(S)?S:Og(A.from({scheme:Y.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 de=e.configurationProperties.group?Hfe.to(e.configurationProperties.group):void 0;k=(typeof de=="string"?de:de?.kind)==="test"?q.fromId(M.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,N=e.command.options&&e.command.options.shell;N&&(N.executable&&(N.executable!==p.executable&&(p.args=void 0),p.executable=await this._resolveVariable(o,N.executable),T=!0),N.args&&(p.args=await this._resolveVariables(o,N.args.slice()))),p.args===void 0&&(p.args=[]);let O=Array.isArray(p.args)?p.args.slice(0):[p.args],V=[],U=Lo.basename((await this._pathService.fileURI(p.executable)).path).toLowerCase(),G=this._buildShellCommandLine(n,U,N,s,b,l),$=!1;if(n===3){$=!0;let de=await this._pathService.userHome();if(U==="cmd.exe"&&(r.cwd&&g6(r.cwd)||!r.cwd&&g6(de.fsPath)))return;U==="powershell.exe"||U==="pwsh.exe"?T||V.push("-Command"):U==="bash.exe"||U==="zsh.exe"?($=!1,T||V.push("-c")):U==="wsl.exe"?T||V.push("-e"):U==="nu.exe"?T||V.push("-c"):T||V.push("/d","/c")}else T||(1,V.push("-c"));let te=this._addAllArgument(V,O);te.push(G),p.shellIntegrationNonce=_t();let pe={commandLine:G,nonce:p.shellIntegrationNonce};if(p.args=$?te.join(" "):te,e.command.presentation&&e.command.presentation.echo)if(g&&t){let de=S&&typeof S=="object"&&Object.hasOwn(S,"path")?No(S.path):t.name;p.initialText=this.taskShellIntegrationStartSequence(S)+Pk(d(13811,null,de,G),{excludeLeadingNewLine:!0})+this.getTaskShellIntegrationOutputSequence(pe)}else p.initialText=this.taskShellIntegrationStartSequence(S)+Pk(d(13810,null,G),{excludeLeadingNewLine:!0})+this.getTaskShellIntegrationOutputSequence(pe);else p.initialText={text:this.taskShellIntegrationStartSequence(S)+this.getTaskShellIntegrationOutputSequence(pe),trailingNewLine:!1}}else{let y=e.command.runtime!==3?R5.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=>Ae(k)?k:k.value),waitOnExit:c},e.command.presentation&&e.command.presentation.echo){let k=T=>!T||T.length===0?"":Ae(T)?T:T.join(" ");g&&t?p.initialText=this.taskShellIntegrationStartSequence(S)+Pk(d(13811,null,t.name,`${p.executable} ${k(p.args)}`),{excludeLeadingNewLine:!0})+this.getTaskShellIntegrationOutputSequence(void 0):p.initialText=this.taskShellIntegrationStartSequence(S)+Pk(d(13809,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=Xi(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===Sat).find(o=>gko(o)?.lastTask===e.getCommonTaskId())}async _doCreateTerminal(e,t,o){let n=await this._reconnectToTerminal(e),r=l=>{let c=l.onDisposed(()=>{this._fireTaskEvent(Gu.terminated(e,l.instanceId,l.exitReason)),c.dispose()})};if(n)return(pd.is(e)||bh.is(e))&&e.command.presentation&&(n.waitOnExit=mko(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===Sat);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=gko(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:Pp,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=mko(s,e.configurationProperties),c,u,p;if(e.command.runtime===3)this._currentTask.shellLaunchConfig=p={customPtyImplementation:(T,N,O)=>new RX(T,N,O,this._terminalService),waitOnExit:l,name:this._createTerminalName(e),initialText:e.command.presentation&&e.command.presentation.echo?Pk(d(13808,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 FD(gt.Error,d(13812,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 N of this._idleTaskTerminals.keys()){let O=this._idleTaskTerminals.get(N);if(O&&this._terminals[O]&&this._terminals[O].group===f){T=this._idleTaskTerminals.remove(N);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:Sat,data:{lastTask:e.getCommonTaskId(),group:f,label:e._label,id:e._id}}),b.shellIntegrationNonce&&Ae(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:Sat,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=c$(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 N=w[T];if(N===k)k=void 0;else{if(k!==void 0)continue;if(N===c.escape)T++;else if(N===c.strong||N===c.weak)k=N;else if(N===" ")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(Ae(c.escape))return[w.replace(/ /g,c.escape+" "),!0];{let T=[];for(let V of c.escape.charsToEscape)T.push(`\\${V}`);let N=new RegExp("["+T.join(",")+"]","g"),O=c.escape.escapeChar;return[w.replace(N,V=>O+V),!0]}}return[w,!1]}function h(w){return Ae(w)?u(w)?p(w,2):[w,!1]:p(w.value,w.quoting)}if((!s||s.length===0)&&Ae(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[LT(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&&(pd.is(t)||bh.is(t))){let o;pd.is(t)?o=t._source.config.element:(o=Xi(t.defines),delete o._key,delete o.type),this._collectDefinitionVariables(e,o)}}_collectDefinitionVariables(e,t){if(Ae(t))this._collectVariables(e,t);else if(Array.isArray(t))t.forEach(o=>this._collectDefinitionVariables(e,o));else if(yi(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];Ae(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(Ae(o)?o[0]==="$"?n=Ab.get(o.substring(1)):n=Ab.get(o):n=o,n&&n.filePrefix)if(Ae(n.filePrefix))this._collectVariables(e,n.filePrefix);else for(let r of[...Yl(n.filePrefix.include||[]),...Yl(n.filePrefix.exclude||[])])this._collectVariables(e,r)})}_collectVariables(e,t){let o=Ae(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(Ae(n)?n[0]==="$"?r=Ab.get(n.substring(1)):r=Ab.get(n):r=n,!r){this._appendOutput(d(13816,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=Xi(r);if(c&&s!==void 0&&(u.uriProvider=s.uriProvider),l){let p=u.filePrefix;Ae(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(Ae(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=Ae(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];Ae(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(Rd);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 mko(a,i){return(a.close===void 0||a.close===!1)&&(a.reveal!==3||!i.isBackground||a.close===!1)?a.panel===3?hko(d(13803,null)):a.showReuseMessage?hko(d(13807,null)):!0:!a.close}function hko(a){return i=>`${vQ("D",i.toString())}${a}`}function gko(a){return a.shellLaunchConfig.attachPersistentProcess?.reconnectionProperties?.data}var TFi="task.quickOpen.detail",w5t="task.quickOpen.skip";function _Fi(a){return"uri"in a}var EFi=d(13788,null),y5t=Re("tasks-list-configure",M.gear,d(13777,null)),fko=Re("tasks-remove",M.close,d(13782,null)),adn="runTaskStorageKey",Bv=class extends C{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(TFi)}_guessTaskLabel(e){if(e._label)return e._label;if(tf.is(e)){let t=e.configures.type,o=Xi(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}`:`$(${M.tools.id}) ${o}`:`${o}`}static applyColorStyles(e,t,o){if(e.configurationProperties.icon?.color){let n=o.getColorTheme(),r=tEe(n);return t.iconClasses=[oy(e.configurationProperties.icon.color)],r}}_createTaskEntry(e,t=[]){let o=[{iconClass:q.asClassName(y5t),tooltip:d(13776,null)},...t],n={label:Bv.getTaskLabelWithIcon(e,this._guessTaskLabel(e)),description:this._taskService.getTaskDescription(e),task:e,detail:this._showDetail()?e.configurationProperties.detail:void 0,buttons:o},r=Bv.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(13778,null)}),t.forEach(o=>{e.push({label:`$(folder) ${o}`,task:o,ariaLabel:d(13790,null,o)})}),e.push({label:EFi,task:EFi,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]||tf.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(fko),tooltip:d(13781,null)};this._createEntriesForGroup(this._topLevelEntries,t,d(13780,null),[l])}return o.length>0&&s.length>0&&this._createEntriesForGroup(this._topLevelEntries,s,d(13775,null)),e&&o.length===0&&(this._topLevelEntries.push({type:"separator",label:d(13775,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:St.Warning,message:d(13783,null,e),cancelButton:d(13784,null)});if(t)return await this._configurationService.updateValue(`${e}.autoDetect`,"on"),await new Promise(o=>setTimeout(()=>o(),100)),this.show(d(13789,null),void 0,e)}async show(e,t,o,n){let r=new P,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(fko)){let p=u&&!Ae(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(y5t)){if(this._quickInputService.cancel(),bh.is(u))this._taskService.customize(u,void 0,!0);else if(pd.is(u)||tf.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(w5t))return r.dispose(),this._toTask(c.isSingleConfigured);let u=c.entries;l=await this._doPickerFirstLevel(s,u,r)}do if(Ae(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&&Ae(c.settingType)?(r.dispose(),this.handleSettingOption(c.settingType)):(r.dispose(),c?.task&&!Ae(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(Bjt(this._storageService,adn,e,!0)),(await new Promise(r=>{o.add(H.once(e.onDidAccept)(async()=>{r(e.selectedItems?e.selectedItems[0]:void 0)}))}))?.task}async doPickerSecondLevel(e,t,o,n){if(e.busy=!0,o===EFi){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(...Bv.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(H.once(e.onDidAccept)(async()=>{s(e.selectedItems?e.selectedItems[0]:void 0)}))})}static allSettingEntries(e){let t=[],o=Bv.getSettingEntry(e,"grunt");o&&t.push(o);let n=Bv.getSettingEntry(e,"gulp");n&&t.push(n);let r=Bv.getSettingEntry(e,"jake");return r&&t.push(r),t}static getSettingEntry(e,t){if(e.getValue(`${t}.autoDetect`)==="off")return{label:d(13785,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(13786,null),task:null,alwaysShow:!0})}else o=[{label:d(13787,null,e),task:null,alwaysShow:!0}];let n=Bv.getSettingEntry(this._configurationService,e);return n&&o.push(n),o}async _toTask(e){if(!tf.is(e))return e;let t=await this._taskService.tryResolveTask(e);return t||this._notificationService.error(d(13779,null,e.type)),t}};Bv=I([m(0,yg),m(1,B),m(2,Ge),m(3,Ne),m(4,De),m(5,ct),m(6,le)],Bv);var C5t="task.quickOpen.history",DFi="task.problemMatchers.neverPrompt",cdn="task.quickOpen.showAll",ddn="Task",Ufe;(e=>(e.ID="workbench.action.tasks.configureTaskRunner",e.TEXT=L(13611,"Configure Task")))(Ufe||={});var x5t=class{constructor(i){this._outputChannel=i;this._onDidError=new E;this.onDidError=this._onDidError.event;this._validationStatus=new dUe}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}},bQ=class a{constructor(){this._store=new Map}forEach(i){this._store.forEach(i)}static getKey(i){let e;if(Ae(i))e=i;else{let t=_Fi(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}},Nb=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N,O,V,U,G,$,te,pe,de,se,Se,ke,Ee,He,Ve,Fe,Qt,Ze,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=N;this._notificationService=O;this._contextKeyService=V;this._environmentService=U;this._terminalProfileResolverService=G;this._pathService=$;this._textModelResolverService=te;this._preferencesService=pe;this._viewDescriptorService=de;this._workspaceTrustRequestService=se;this._workspaceTrustManagementService=Se;this._logService=ke;this._themeService=Ee;this._lifecycleService=He;this._instantiationService=Fe;this._chatService=Qt;this._chatAgentService=Ze;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=H.toPromise(this.onDidChangeTaskSystemInfo),this._workspaceTasksPromise=void 0,this._taskSystem=void 0,this._taskSystemListeners=void 0,this._outputChannel=this._outputService.getChannel(Nb.OutputChannelId),this._providers=new Map,this._providerTypes=new Map,this._taskSystemInfos=new Map,this._register(this._contextService.onDidChangeWorkspaceFolders(()=>{let ti=this._computeWorkspaceFolderSetup();return this.executionEngine!==ti[2]&&(this._disposeTaskSystemListeners(),this._taskSystem=void 0),this._updateSetup(ti),this._updateWorkspaceTasks(2)})),this._register(this._configurationService.onDidChangeConfiguration(async ti=>{if(!ti.affectsConfiguration("tasks")||!this._taskSystem&&!this._workspaceTasksPromise)return;(!this._taskSystem||this._taskSystem instanceof ine)&&this._outputChannel.clear(),ti.affectsConfiguration("task.reconnection")&&(this._configurationService.getValue("task.reconnection")||(this._persistentTasks?.clear(),this._storageService.remove(Nb.PersistentTasks_Key,1))),this._setTaskLRUCacheLimit();let bo=await this._updateWorkspaceTasks(3);this._onDidChangeTaskConfig.fire();for(let[Ro,_o]of bo)if(_o.set?.tasks?.length)for(let sr of _o.set.tasks){let ln=sr._id,en=this._taskSystem?.lastTask?.task._id;if(en&&en===ln&&Ro!=="setting"){let Ws=new vUe(sr,this._taskSystem.lastTask.resolver,Wfe.command);this._taskSystem.lastTask=Ws}}})),this._taskRunningState=ITe.bindTo(V),this._tasksAvailableState=kTe.bindTo(V),this._onDidStateChange=this._register(new E),this._registerCommands().then(()=>jRt.bindTo(this._contextKeyService).set(!0)),QRt.bindTo(this._contextKeyService).set(Gt&&!Ve.getConnection()?.remoteAuthority),this._configurationResolverService.contributeVariable("defaultBuildTask",async()=>{let ti=await this._getTasksForGroup($m.Build,!0);if(ti.length>0){let sr=this._getDefaultTasks(ti);if(sr.length===1)return sr[0]._label}ti=await this._getTasksForGroup($m.Build);let bo=this._getDefaultTasks(ti);if(bo.length===1)return bo[0]._label;bo.length&&(ti=bo);let Ro;ti&&ti.length>0&&(Ro=await this._showQuickPick(ti,d(13675,null)));let _o=Ro?Ro.task:void 0;if(_o)return _o._label}),this._register(this._lifecycleService.onBeforeShutdown(ti=>{this._willRestart=ti.reason!==3})),this._register(this.onDidStateChange(async ti=>{switch(this._log(d(13631,null,ti.kind),!0),ti.kind){case"start":this._taskRunStartTimes.set(ti.taskId,Date.now());break;case"processEnded":{let bo=ti,Ro=this._taskRunStartTimes.get(ti.taskId);if(!Ro)break;let _o=bo.durationMs??Date.now()-Ro;_o!==void 0&&this._handleLongRunningTaskCompletion(bo,_o),this._taskRunStartTimes.delete(ti.taskId),this._taskRunSources.delete(ti.taskId);break}case"inactive":{let bo=ti,Ro=this._taskRunStartTimes.get(ti.taskId);if(!Ro)break;let _o=bo.durationMs??Date.now()-Ro;_o!==void 0&&this._handleLongRunningTaskCompletion(bo,_o),this._taskRunStartTimes.delete(ti.taskId),this._taskRunSources.delete(ti.taskId);break}case"terminated":this._taskRunStartTimes.delete(ti.taskId),this._taskRunSources.delete(ti.taskId);break}if(ti.kind!=="changed")if((this._willRestart||ti.kind==="terminated"&&ti.exitReason===3)&&ti.taskId){let bo=ti.__task.getKey();bo&&this.removePersistentTask(bo)}else ti.kind==="start"&&ti.__task&&ti.__task.getWorkspaceFolder()&&this._setPersistentTask(ti.__task)})),this._waitForAllSupportedExecutions=new Promise(ti=>{H.once(this._onDidRegisterAllSupportedExecutions.event)(()=>ti())}),this._terminalService.whenConnected.then(()=>{this._terminalService.instances.filter(bo=>bo.reconnectionProperties?.ownerId===ddn).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(13633,null)}static{this._nextHandle=0}get isReconnected(){return this._tasksReconnected}registerSupportedExecutions(e,t,o){e!==void 0&&Xhi.bindTo(this._contextKeyService).set(e);let n=!!JL.getValue(this._contextKeyService);t!==void 0&&Ude.bindTo(this._contextKeyService).set(t&&!n),o!==void 0&&xTe.bindTo(this._contextKeyService).set(o&&!n),this._workspaceTasksPromise=void 0,this._onDidRegisterSupportedExecutions.fire(),(QRt.getValue(this._contextKeyService)||e&&t&&o)&&this._onDidRegisterAllSupportedExecutions.fire()}_attemptTaskReconnection(){if(this._lifecycleService.startupKind!==3&&(this._log(d(13689,null),!0),this._tasksReconnected=!0,this._storageService.remove(Nb.PersistentTasks_Key,1)),!this._configurationService.getValue("task.reconnection")||this._tasksReconnected){this._log(d(13667,null,this._configurationService.getValue("task.reconnection"),this._tasksReconnected),!0),this._tasksReconnected=!0;return}this._log(d(13684,null),!0),this.getWorkspaceTasks(4).then(async()=>{this._tasksReconnected=await this._reconnectTasks(),this._log(d(13683,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=Me(r.domElement);if(l.document.hasFocus())return;let c=this._formatTaskDuration(t),u=s?d(13627,null,s,c):d(13626,null,c);this._hostService.focus(l,{mode:1});let p=new $e;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(13629,null,o,n):d(13628,null,o):d(13630,null,n)}async _reconnectTasks(){let e=await this.getSavedTasks("persistent");if(!e.length)return this._log(d(13665,null),!0),!0;let t=e.map(o=>o._label).join(", ");this._log(d(13685,null,t),!0);for(let o of e)if(tf.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(){qe.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(13617,null),schema:{anyOf:[{type:"string",description:d(13618,null)},{type:"object",properties:{type:{type:"string",description:d(13620,null)},task:{type:"string",description:d(13619,null)}}}]}}]}}),qe.registerCommand("workbench.action.tasks.reRunTask",async e=>{await this._trust()&&this._reRunTaskCommand()}),qe.registerCommand("workbench.action.tasks.restartTask",async(e,t)=>{await this._trust()&&this._runRestartTaskCommand(t)}),qe.registerCommand(qRt,async e=>{await this._trust()&&this._runRerunAllRunningTasksCommand()}),qe.registerCommand("workbench.action.tasks.terminate",async(e,t)=>{await this._trust()&&this._runTerminateCommand(t)}),qe.registerCommand("workbench.action.tasks.showLog",()=>{this._showOutput(void 0,!0)}),qe.registerCommand("workbench.action.tasks.build",async()=>{await this._trust()&&this._runBuildCommand()}),qe.registerCommand("workbench.action.tasks.test",async()=>{await this._trust()&&this._runTestCommand()}),qe.registerCommand("workbench.action.tasks.configureTaskRunner",async()=>{await this._trust()&&this._runConfigureTasks()}),qe.registerCommand("workbench.action.tasks.configureDefaultBuildTask",async()=>{await this._trust()&&this._runConfigureDefaultBuildTask()}),qe.registerCommand("workbench.action.tasks.configureDefaultTestTask",async()=>{await this._trust()&&this._runConfigureDefaultTestTask()}),qe.registerCommand("workbench.action.tasks.showTasks",async()=>{if(await this._trust())return this.runShowTasks()}),qe.registerCommand("workbench.action.tasks.toggleProblems",()=>this._commandService.executeCommand(wr.TOGGLE_MARKERS_VIEW_ACTION_ID)),qe.registerCommand("workbench.action.tasks.openUserTasks",async()=>{let e=this._getResourceForKind(gl.User);e&&this._openTaskFile(e,gl.User)}),qe.registerCommand("workbench.action.tasks.openWorkspaceFileTasks",async()=>{let e=this._getResourceForKind(gl.WorkspaceFile);e&&this._openTaskFile(e,gl.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(Nb.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 sk.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 Wp(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(!JL.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(13715,null),run:async()=>{this._commandService.executeCommand(qC,{mode:"agent",query:`Fix this task configuration error: ${u}`})}})}}r.push({label:d(13625,null),run:()=>{this._outputService.showChannel(this._outputChannel.id,!0)}}),n&&r.length>1?this._notificationService.prompt(gt.Warning,d(13697,null),r):this._notificationService.prompt(gt.Warning,d(13696,null),r)}}_disposeTaskSystemListeners(){this._taskSystemListeners&&(Ue(this._taskSystemListeners),this._taskSystemListeners=void 0)}registerTaskProvider(e,t){if(!e)return{dispose:()=>{}};let o=Nb._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=Ae(e)?e:_Fi(e)?e.name:e.configuration?Ye(e.configuration):void 0;if(this.ignoredWorkspaceFolders.some(h=>h.name===r))return Promise.reject(new Error(d(13634,null,r)));let s=Ae(t)?t:OV.createTaskIdentifier(t,console);if(s===void 0)return Promise.resolve(void 0);let l=bQ.getKey(e),c=await this._findWorkspaceTasks((h,g)=>{let f=bQ.getKey(g);return f!==l&&f!==NV?!1:h.matches(s,o)});if(c.sort(h=>h._source.kind===gl.Extension?1:-1),c.length>0){let h=c[0];return tf.is(h)?this.tryResolveTask(h):h}let u=await this._getGroupedTasks({type:n}),p=u.get(e);if(p=p.concat(u.get(NV)),!!p)return p=p.filter(h=>h.matches(s,o)).sort(h=>h._source.kind===gl.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(13682,null,e.configures.type));return}try{let r=await t.resolveTask(e);if(r&&r._id===e._id)return yUe(r,e)}catch{}let n=await this.tasks({type:e.type});for(let r of n)if(r._id===e._id)return yUe(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 sk.all())this._isTaskProviderEnabled(t.taskType)&&e.push(t.taskType);return e}createSorter(){return new URt(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(C5t);this._recentlyUsedTasksV1=new il(e);let t=this._storageService.get(Nb.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(bh.is(r)&&(r.defines.type===e.type||r._source.label===e.type))o.push(r);else if(pd.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(C5t);this._recentlyUsedTasks=new il(e);let t=this._storageService.get(Nb.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(13651,null,this._persistentTasks.size),!0),this._persistentTasks;this._persistentTasks=new il(10);let e=this._storageService.get(Nb.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(gl.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(13646,null),!0);function l(p,h,g){h&&!p.has(h)&&p.set(h,[]),h&&(t[h]||h===NV)&&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(13648,null,h,g,f.folder),!0),l(f.isWorkspaceFile?n:o,f.folder,g)}catch(h){this._log(d(13647,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(13649,null,p),!0)):this._log(d(13650,null,p),!0);return s}removeRecentlyUsedTask(e){this._getTasksFromStorage("historical").delete(e)&&this._saveRecentlyUsedTasks()}removePersistentTask(e){this._log(d(13686,null,e),!0),this._getTasksFromStorage("persistent").delete(e)&&this._savePersistentTasks()}_setTaskLRUCacheLimit(){let e=this._configurationService.getValue(C5t);this._recentlyUsedTasks&&(this._recentlyUsedTasks.limit=e)}async _setRecentlyUsedTask(e){let t=e.getKey();if(!GE.is(e)&&t){let o=this._createCustomizableTask(e);if(bh.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(C5t);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(Nb.RecentlyUsedTasks_KeyV2,JSON.stringify(o),1,1)}async _setPersistentTask(e){if(!this._configurationService.getValue("task.reconnection"))return;let t=e.getKey();if(!GE.is(e)&&t){let o=this._createCustomizableTask(e);if(bh.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(13688,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(13623,null,e.join(", ")),!0),this._storageService.store(Nb.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(tf.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($m.Build);return e||this._getGroupedTasksAndExecute()}async _runTest(){let e=await this._findSingleWorkspaceTaskOfGroup($m.Test);return e||this._getGroupedTasksAndExecute(!0)}async _getGroupedTasksAndExecute(e){let t=await this._getGroupedTasks(),o=this._createRunnableTask(t,e?$m.Test:$m.Build);if(!o||!o.task)throw e?this.schemaVersion===1?new FD(gt.Info,d(13668,null),3):new FD(gt.Info,d(13669,null),3):this.schemaVersion===1?new FD(gt.Info,d(13656,null),2):new FD(gt.Info,d(13657,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 FD(gt.Info,d(13635,null),5);let n=this._createResolver(),r;try{if(t&&t.attachProblemMatcher&&this._shouldAttachProblemMatcher(e)&&!GE.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(DFi);return Da(t)?!t:e===void 0?!0:!t[e]}_getTypeForTask(e){let t;return pd.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!==$m.Build||e.configurationProperties.problemMatchers!==void 0&&e.configurationProperties.problemMatchers.length>0?!1:bh.is(e)?!e.hasDefinedMatchers&&!!e.configurationProperties.problemMatchers&&e.configurationProperties.problemMatchers.length===0:pd.is(e)?e._source.config.element.problemMatcher===void 0&&!e.hasDefinedMatchers:!1}async _updateNeverProblemMatcherSetting(e){let t=this._configurationService.getValue(DFi);if(t===!0)return;let o;return t!==!1?o=t:o=Object.create(null),o[e]=!0,this._configurationService.updateValue(DFi,o)}async _attachProblemMatcher(e){let t=[];for(let r of Ab.keys()){let s=Ab.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(13636,null)});let o;pd.is(e)?o=e._source.config.element.type??"":o=e.getDefinition().type,t.unshift({label:d(13637,null),matcher:void 0},{label:d(13639,null),matcher:void 0,never:!0},{label:d(13640,null,o),matcher:void 0,setting:o},{label:d(13638,null),matcher:void 0,learnMore:!0});let n=await this._quickInputService.pick(t,{placeHolder:d(13624,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=Ab.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)$m.from(s.configurationProperties.group)?._id===e._id&&n.push(s)}),n}needsFolderQualification(){return this._contextService.getWorkbenchState()===3}_canCustomize(e){return this.schemaVersion!==2?!1:pd.is(e)?!0:bh.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=rF(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=pd.is(e)||tf.is(e)?e._source.config:void 0;if(o&&o.element)t={...o.element};else if(bh.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&&SS(e.configurationProperties.problemMatchers)&&(t.problemMatcher=e.configurationProperties.problemMatchers),e.configurationProperties.group&&(t.group=Hfe.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(13612,null)),Promise.resolve(void 0);let s=r.config,l=this._createCustomizableTask(e);if(!l)return Promise.resolve(void 0);let c=pd.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(13698,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 gl.User:r=2;break;case gl.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 gl.User:return je(ci(this._preferencesService.userSettingsResource),"tasks.json");case gl.WorkspaceFile:if(this._workspace&&this._workspace.configuration)return this._workspace.configuration;default:return}}_getResourceForTask(e){if(pd.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===gl.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(13615,null)),{task:n[0],resolver:s};if(r.length!==0){if(r.length===1)return{task:r[0],resolver:s};{let l=_t();return{task:new GE(l,{kind:gl.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=tf.is(h)||pd.is(h)?h._source.config.workspaceFolder?.uri:void 0,f=typeof l=="string"?l:l.toString();if(g?.toString()!==f)return!1;if(Ae(c))return h._label===c||h.configurationProperties.identifier===c;{let v=h.getDefinition(!0),b=OV.createTaskIdentifier(c,console);return b&&v?b._key===v._key:!1}});if(u.length===0)return;let p=u[0];return tf.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(Ae(c))return p.label.get(c)||p.identifier.get(c);{let h=OV.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(13707,null),detail:d(13613,null),primaryButton:d(13622,null),cancelButton:d(13621,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=pd.is(e)?e.customizes()?.type:bh.is(e)?e.type:void 0;n=(s&&l&&o===1?await this.getTask(s,l,!1,c):e)??e}await Ab.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 FD(gt.Warning,d(13701,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(13703,null));break;case"prompt":default:this._showQuickPick(this._taskSystem.getActiveTasks().filter(o=>e._id===o._id),d(13654,null),{label:d(13660,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(13706,null,Ae(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(13708,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(bh.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 ine(this._terminalService,this._terminalGroupService,this._outputService,this._paneCompositeService,this._viewsService,this._markerService,this._modelService,this._configurationResolverService,this._contextService,this._environmentService,Nb.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]!==Y.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=sk.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);sk.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{so(b)||(b&&Ae(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++,Wp(y.provideTasks(s).then(k=>{for(let T of k.tasks)if(T.type!==this._providerTypes.get(S)){this._log(d(13716,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 bQ,u=new bQ;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 bQ;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(bh.is(b))if(u){let S=u.byIdentifier[b.defines._key];S?(g.delete(b.defines._key),o.add(s,yUe(b,S))):o.add(s,b)}else if(p){let S=p[b.defines._key];S?(o.add(s,yUe(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 N=await k.resolveTask(S);if(N&&N._id===S._id){o.add(s,yUe(N,S));return}}catch{}}}y?this._log(d(13682,null,S.configures.type)):r||this._log(d(13658,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(pd.is(n)){let r=n.command&&n.command.name;if(r==="gulp"||r==="grunt"||r==="jake"){let s=P9e.create({type:r,task:n.configurationProperties.name});o()[s._key]=n}}return t}async getWorkspaceTasks(e=1){return await this._trust()?(await Wp(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 kq({uri:t,name:Ye(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(NV,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 Ude.getValue(this._contextKeyService)===!0&&xTe.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 Ab.onReady();let n=this._getTaskSystemInfo(e.uri.scheme),r=new x5t(this._outputChannel);this._register(r.onDidError(u=>this._showOutput(t,void 0,u)));let s=kFi(e,void 0,n?n.platform:Pp,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(13702,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(13705,null,t)),this._showOutput(void 0,void 0,d(13705,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,gl.WorkspaceFile),n=this._testParseExternalConfig(o.config,d(13700,null)),r={byIdentifier:Object.create(null)},s=[];return await this._computeTasksForSingleConfig(e,n.config,t,s,r.byIdentifier,1),(n.config?IUe.from(n.config):2)===1?(this._notificationService.warn(d(13711,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,gl.User),n=this._testParseExternalConfig(o.config,d(13699,null)),r={byIdentifier:Object.create(null)},s=[];return await this._computeTasksForSingleConfig(e,n.config,t,s,r.byIdentifier,2),(n.config?IUe.from(n.config):2)===1?(this._notificationService.warn(d(13710,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 x5t(this._outputChannel),p=kFi(e,this._workspace,c?c.platform:Pp,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(13702,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(13653,null,s.uri.fsPath)))}return[e,t,o,n,r]}_computeExecutionEngine(e){let{config:t}=this._getConfiguration(e);return t?IUe.from(t):Hde._default}_computeJsonSchemaVersion(e){let{config:t}=this._getConfiguration(e);return t?vat.from(t):2}_getConfiguration(e,t){let o;if(t!==gl.User&&this._contextService.getWorkbenchState()===1)o=void 0;else{let r=this._configurationService.inspect("tasks",{resource:e.uri});switch(t){case gl.User:{r.userValue!==r.workspaceFolderValue&&(o=Xi(r.userValue));break}case gl.Workspace:o=Xi(r.workspaceFolderValue);break;case gl.WorkspaceFile:{this._contextService.getWorkbenchState()===3&&r.workspaceFolderValue!==r.workspaceValue&&(o=Xi(r.workspaceValue));break}default:o=Xi(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(13704,null)),this._showOutput(void 0,void 0,d(13704,null)),{config:void 0,hasParseErrors:!0}}return{config:o,hasParseErrors:!1}}inTerminal(){return this._taskSystem?this._taskSystem instanceof ine:this._executionEngine===2}configureAction(){let e=this;return new class extends st{constructor(){super(Ufe.ID,Ufe.TEXT.value,void 0,!0,()=>(e._runConfigureTasks(),Promise.resolve(void 0)))}}}_handleError(e){let t=!0;if(e instanceof FD){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?Ufe.TEXT.value:d(13713,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 Ae(e)?this._notificationService.error(e):this._notificationService.error(d(13709,null));t&&this._showOutput(void 0,void 0,Ae(e)?e:void 0)}_showDetail(){return this._configurationService.getValue(TFi)}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(y5t),tooltip:d(13610,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===gl.Workspace||y._source.kind===gl.User?f.push(y):v.push(y))}let S=this.createSorter();r&&c(u,h,d(13616,null)),f=f.sort((y,w)=>S.compare(y,w)),c(u,f,d(13609,null)),v=v.sort((y,w)=>S.compare(y,w)),c(u,v,d(13614,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(Bv);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 Wp(this._createTaskQuickPickEntries(u,n,r,s),200,()=>{});if(p)return p.length===1&&this._configurationService.getValue(w5t)?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(),bh.is(g)?this.customize(g,void 0,!0):pd.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(Nb.RecentlyUsedTasks_Key,1)}_showIgnoredFoldersMessage(){return this.ignoredWorkspaceFolders.length===0||!this.showIgnoreMessage||this._notificationService.prompt(gt.Info,d(13652,null,this.ignoredWorkspaceFolders.map(e=>e.name).join(", ")),[{label:d(13662,null),isSecondary:!0,run:()=>{this._storageService.store(Nb.IgnoreTask010DonotShowAgain_key,!0,1,1),this._showIgnoreMessage=!1}}]),Promise.resolve(void 0)}async _trust(){let e=this._contextKeyService.getContext(Pn());return QRt.getValue(this._contextKeyService)&&!Sh?.evaluate(e)?!1:(await this._workspaceTrustManagementService.workspaceTrustInitialized,this._workspaceTrustManagementService.isWorkspaceTrusted()?!0:await this._workspaceTrustRequestService.requestWorkspaceTrust({message:d(13687,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(NV),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 bQ)};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(bh.is(l)&&l.defines.type===e.type)r.push(l);else if(pd.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(13678,null);this._showIgnoredFoldersMessage().then(()=>{if(this._configurationService.getValue(cdn)){let s;e||(s=this._tasksAndGroupedTasks()),this._showQuickPick(e||s.tasks,r,{label:"$(plus) "+d(13659,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(13659,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){Ab.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=>{tf.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=no.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?Fc(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&&Cp(u.isDefault,s,{ignoreCase:!0}):(t=!1,!1)}),globTasksDetected:t}}}}return{globGroupTasks:[],globTasksDetected:t}}_runBuildCommand(){if(this._tasksReconnected)return this._runTaskGroupCommand($m.Build,{fetching:d(13644,null),select:d(13674,null),notFoundConfigure:d(13655,null)},this._runConfigureDefaultBuildTask,this._build)}_runTestCommand(){return this._runTaskGroupCommand($m.Test,{fetching:d(13645,null),select:d(13681,null),notFoundConfigure:d(13670,null)},this._runConfigureDefaultTestTask,this._runTest)}_runTerminateCommand(e){if(e==="terminateAll"){this._terminateAll();return}let t=o=>{this._showQuickPick(o||this.getActiveTasks(),d(13691,null),{label:d(13664,null),task:void 0},!1,!0,void 0,[{label:d(13693,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(13714,null)):this._notificationService.error(d(13712,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(13690,null),{label:d(13666,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(13661,null));return}let t=e.map(o=>this._restart(o));await Promise.allSettled(t)}_getTaskIdentifier(e){let t;return Ae(e)?t=e:e&&Ae(e.type)&&(t=OV.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 gl.User:l=this._configHasTasks(s.userValue),c=2;break;case gl.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(rko(),{placeHolder:d(13692,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",Ur(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){bh.is(e)?this.customize(e,void 0,!0):pd.is(e)?this.openConfig(e):tf.is(e)}_handleSelection(e){if(e)if(this._isTaskEntry(e))this._configureTask(e.task);else if(this._isSettingEntry(e))this._instantiationService.createInstance(Bv).handleSettingOption(e.settingType);else if(e.folder&&this._contextService.getWorkbenchState()!==1)this._openTaskFile(e.folder.toResource(".vscode/tasks.json"),gl.Workspace);else{let t=this._getResourceForKind(gl.User);t&&this._openTaskFile(t,gl.User)}}getTaskDescription(e){let t;if(e._source.kind===gl.User)t=d(13632,null);else if(e._source.kind===gl.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 bQ);let t=this._contextService.getWorkspace().folders.map(p=>this._fileService.stat(p.toResource(".vscode/tasks.json")).then(h=>h,()=>{})),o=d(13641,null),n=d(13673,null),r=new $e,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:Bv.getTaskLabelWithIcon(S),task:S,description:this.getTaskDescription(S),detail:this._showDetail()?S.configurationProperties.detail:void 0};Bv.applyColorStyles(S,y,this._themeService),g.push(y),bh.is(S)||f++}}let b=f===0;if(b||h.get(NV).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(w5t)){let p=(await l)[0];if(p.task){this._handleSelection(p);return}}let u=l.then(p=>(p.push(...Bv.allSettingEntries(this._configurationService)),p));this._quickInputService.pick(u,{placeHolder:d(13680,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($m.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"&&$m.Build._id,l=s[0])}for(let p of e)if(p===l){let h=d(13642,null,Bv.getTaskLabelWithIcon(p,p.getQualifiedLabel()));o=p,n={label:h,task:p,description:this.getTaskDescription(p),detail:this._showDetail()?p.configurationProperties.detail:void 0},Bv.applyColorStyles(p,n,this._themeService)}else{let h={label:Bv.getTaskLabelWithIcon(p),task:p,description:this.getTaskDescription(p),detail:this._showDetail()?p.configurationProperties.detail:void 0};Bv.applyColorStyles(p,h,this._themeService),t.push(h)}n&&t.unshift(n);let u=new $e().token;this._quickInputService.pick(t,{placeHolder:d(13680,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&&pd.is(h)&&this.openConfig(h),GE.is(h)||this.customize(h,{group:{kind:"build",isDefault:!0}},!0).then(()=>{o&&h!==o&&!GE.is(o)&&this.customize(o,{group:"build"},!1)}))}),this._quickInputService.pick(t,{placeHolder:d(13676,null)}).then(p=>{let h=p&&Object.hasOwn(p,"task")?p.task:void 0;h!=null&&(h===o&&pd.is(h)&&this.openConfig(h),GE.is(h)||this.customize(h,{group:{kind:"build",isDefault:!0}},!0).then(()=>{o&&h!==o&&!GE.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=$m.from(n.configurationProperties.group);if(r&&r.isDefault&&r._id===$m.Test._id){t=n;break}}t&&(o={label:d(13643,null,t.getQualifiedLabel()),task:t,detail:this._showDetail()?t.configurationProperties.detail:void 0}),this._showIgnoredFoldersMessage().then(()=>{this._showQuickPick(e,d(13677,null),void 0,!0,!1,o).then(n=>{let r=n&&Object.hasOwn(n,"task")?n.task:void 0;r&&(r===t&&pd.is(r)&&this.openConfig(r),GE.is(r)||this.customize(r,{group:{kind:"test",isDefault:!0}},!0).then(()=>{t&&r!==t&&!GE.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=>GE.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(13679,null),{label:d(13663,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(!pd.is(e))return;let n={label:e._label},r=new Set(["gulp","jake","grunt"]);Ae(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=L5.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 pd(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(H.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(gt.Warning,t.length===1?d(13694,null):d(13695,null),[{label:t.length===1?d(13671,null):d(13672,null),run:async()=>{for(let o of t)await this._editorService.openEditor({original:{resource:o[0]},modified:{resource:o[1]}})}}])}};Nb=I([m(0,B),m(1,Ns),m(2,Ml),m(3,ds),m(4,Ft),m(5,ge),m(6,ee),m(7,be),m(8,Pe),m(9,Te),m(10,Ho),m(11,Ct),m(12,lt),m(13,Ge),m(14,sp),m(15,Yo),m(16,jl),m(17,le),m(18,Bo),m(19,Qe),m(20,ct),m(21,Ne),m(22,X),m(23,Vt),m(24,Sg),m(25,wn),m(26,Nt),m(27,Po),m(28,Ri),m(29,Vd),m(30,ns),m(31,ne),m(32,De),m(33,ao),m(34,yo),m(35,F),m(36,Si),m(37,br),m(38,oi)],Nb);var SQ=class extends yh{constructor(e,t,o,n,r,s,l,c){super(SQ.PREFIX,{noResultsPick:{label:d(13791,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 Bv(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=Up(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&&!Ae(u)?u.getKey():void 0;return g&&this._taskService.removeRecentlyUsedTask(g),2}else return bh.is(u)?this._taskService.customize(u,void 0,!0):pd.is(u)&&this._taskService.openConfig(u),1},p.accept=async()=>{if(Ae(u)){let h=await n.show(d(13792,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 tf.is(e)?this._taskService.tryResolveTask(e):e}};SQ=I([m(0,lt),m(1,yg),m(2,B),m(3,Ge),m(4,Ne),m(5,ct),m(6,De),m(7,le)],SQ);var MFi=oe.as(Qi.Workbench);MFi.registerWorkbenchContribution(hUe,4);W(gUe);fe.appendMenuItem(D.CommandPalette,{command:{id:gUe.ID,title:gUe.LABEL,category:MC},when:Sh});var yat=class extends C{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}=TI()));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(13726,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(13744,null),text:`$(tools) ${e.length}`,ariaLabel:d(13736,null,e.length),tooltip:d(13740,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:(Ae(e.group)?e.group:e.group?._id)!==$m.Build._id?!0:e.__task.configurationProperties.problemMatchers===void 0||e.__task.configurationProperties.problemMatchers.length===0}};yat=I([m(0,yg),m(1,Tr),m(2,Bo)],yat);MFi.registerWorkbenchContribution(yat,3);fe.appendMenuItem(D.MenubarTerminalMenu,{group:"3_run",command:{id:"workbench.action.tasks.runTask",title:d(13734,null)},order:1,when:Sh});fe.appendMenuItem(D.MenubarTerminalMenu,{group:"3_run",command:{id:"workbench.action.tasks.build",title:d(13729,null)},order:2,when:Sh});fe.appendMenuItem(D.MenubarTerminalMenu,{group:"5_manage",command:{precondition:ITe,id:"workbench.action.tasks.showTasks",title:d(13733,null)},order:1,when:Sh});fe.appendMenuItem(D.MenubarTerminalMenu,{group:"5_manage",command:{precondition:ITe,id:"workbench.action.tasks.restartTask",title:d(13732,null)},order:2,when:Sh});fe.appendMenuItem(D.MenubarTerminalMenu,{group:"5_manage",command:{precondition:ITe,id:"workbench.action.tasks.terminate",title:d(13735,null)},order:3,when:Sh});fe.appendMenuItem(D.MenubarTerminalMenu,{group:"7_configure",command:{id:"workbench.action.tasks.configureTaskRunner",title:d(13731,null)},order:1,when:Sh});fe.appendMenuItem(D.MenubarTerminalMenu,{group:"7_configure",command:{id:"workbench.action.tasks.configureDefaultBuildTask",title:d(13730,null)},order:2,when:Sh});fe.appendMenuItem(D.CommandPalette,{command:{id:"workbench.action.tasks.openWorkspaceFileTasks",title:L(13773,"Open Workspace Tasks"),category:MC},when:x.and(Qa.isEqualTo("workspace"),Sh)});fe.appendMenuItem(D.CommandPalette,{command:{id:Ufe.ID,title:Ufe.TEXT,category:MC},when:Sh});fe.appendMenuItem(D.CommandPalette,{command:{id:"workbench.action.tasks.showLog",title:L(13742,"Show Task Log"),category:MC},when:Sh});fe.appendMenuItem(D.CommandPalette,{command:{id:"workbench.action.tasks.runTask",title:L(13741,"Run Task"),category:MC}});fe.appendMenuItem(D.CommandPalette,{command:{id:"workbench.action.tasks.reRunTask",title:L(13738,"Rerun Last Task"),category:MC},when:Sh});fe.appendMenuItem(D.CommandPalette,{command:{id:"workbench.action.tasks.restartTask",title:L(13739,"Restart Running Task"),category:MC},when:Sh});fe.appendMenuItem(D.CommandPalette,{command:{id:qRt,title:L(13737,"Rerun All Running Tasks"),category:MC},when:Sh});fe.appendMenuItem(D.CommandPalette,{command:{id:"workbench.action.tasks.showTasks",title:L(13743,"Show Running Tasks"),category:MC},when:Sh});fe.appendMenuItem(D.CommandPalette,{command:{id:"workbench.action.tasks.terminate",title:L(13770,"Terminate Task"),category:MC},when:Sh});fe.appendMenuItem(D.CommandPalette,{command:{id:"workbench.action.tasks.build",title:L(13725,"Run Build Task"),category:MC},when:Sh});fe.appendMenuItem(D.CommandPalette,{command:{id:"workbench.action.tasks.test",title:L(13771,"Run Test Task"),category:MC},when:Sh});fe.appendMenuItem(D.CommandPalette,{command:{id:"workbench.action.tasks.configureDefaultBuildTask",title:L(13727,"Configure Default Build Task"),category:MC},when:Sh});fe.appendMenuItem(D.CommandPalette,{command:{id:"workbench.action.tasks.configureDefaultTestTask",title:L(13728,"Configure Default Test Task"),category:MC},when:Sh});fe.appendMenuItem(D.CommandPalette,{command:{id:"workbench.action.tasks.openUserTasks",title:L(13772,"Open User Tasks"),category:MC},when:Sh});var LFi=class extends C{constructor(){super(),this.registerActions()}registerActions(){let i="workbench.action.tasks.openUserTasks",e=d(13766,null);this._register(fe.appendMenuItem(D.GlobalActivity,{command:{id:i,title:e},when:Sh,group:"2_configuration",order:6})),this._register(fe.appendMenuItem(D.MenubarPreferencesMenu,{command:{id:i,title:e},when:Sh,group:"2_configuration",order:6}))}};MFi.registerWorkbenchContribution(LFi,3);yt.registerKeybindingRule({id:"workbench.action.tasks.build",weight:200,when:jRt,primary:3104});var udn=oe.as(sS.OutputChannels);udn.registerChannel({id:Nb.OutputChannelId,label:Nb.OutputChannelLabel,log:!1});var pdn=oe.as(Tu.Quickaccess),mdn="inTasksPicker";pdn.registerQuickAccessProvider({ctor:SQ,prefix:SQ.PREFIX,contextKey:mdn,placeholder:d(13769,null),helpEntries:[{description:d(13768,null),commandCenterOrder:60}]});var PFi={id:aue,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"}]}};PFi.definitions={...lFi.definitions,...fFi.definitions};PFi.oneOf=[...fFi.oneOf||[],...lFi.oneOf||[]];var RFi=oe.as(ea.JSONContribution);RFi.registerSchema(aue,PFi);var k5t=class extends C{static{this.ID="taskRegistryContribution"}constructor(){super(),this._register(Ab.onMatcherChanged(()=>{gFi(),RFi.notifySchemaChanged(aue)})),this._register(sk.onDefinitionsChanged(()=>{pFi(),RFi.notifySchemaChanged(aue)}))}};pt(k5t.ID,k5t,ut.AfterRestored);var hdn=oe.as(ii.Configuration);hdn.registerConfiguration({id:"task",order:100,title:d(13767,null),type:"object",properties:{"task.problemMatchers.neverPrompt":{markdownDescription:d(13750,null),oneOf:[{type:"boolean",markdownDescription:d(13752,null)},{type:"object",patternProperties:{".*":{type:"boolean"}},markdownDescription:d(13751,null),default:{shell:!0}}],default:!1},"task.autoDetect":{markdownDescription:d(13748,null),type:"string",enum:["on","off"],default:"on"},"task.slowProviderWarning":{markdownDescription:d(13762,null),oneOf:[{type:"boolean",markdownDescription:d(13764,null)},{type:"array",items:{type:"string",markdownDescription:d(13763,null)}}],default:!0},"task.quickOpen.history":{markdownDescription:d(13754,null),type:"number",default:30,minimum:0,maximum:30},"task.quickOpen.detail":{markdownDescription:d(13753,null),type:"boolean",default:!0},"task.quickOpen.skip":{type:"boolean",description:d(13756,null),default:!1},"task.quickOpen.showAll":{type:"boolean",description:d(13755,null),default:!1},"task.allowAutomaticTasks":{type:"string",enum:["on","off"],enumDescriptions:[d(13747,null),d(13746,null)],description:d(13745,null),default:"off",scope:1,restricted:!0},"task.reconnection":{type:"boolean",description:d(13757,null),default:!0},"task.saveBeforeRun":{markdownDescription:d(13758,null),type:"string",enum:["always","never","prompt"],enumDescriptions:[d(13759,null),d(13760,null),d(13761,null)],default:"always"},"task.notifyWindowOnTaskCompletion":{type:"integer",markdownDescription:d(13749,null),default:6e4,minimum:-1},"task.verboseLogging":{type:"boolean",description:d(13765,null),default:!1}}});W(class extends K{constructor(){super({id:$Rt,icon:GRt,title:L(13774,"Rerun Task"),precondition:A9e,menu:[{id:D.TerminalInstanceContext,when:A9e}],keybinding:{when:at.focus,primary:3120,mac:{primary:1328},weight:200}})}async run(a,i){let e=a.get(Yo),t=a.get(yg),o=i??e.activeInstance;o&&await t.rerun(o.instanceId)}});var fdn=30*1e3;function NFi(a){switch(a){case 1:return"Management";case 2:return"ExtensionHost";case 3:return"Tunnel"}}function vko(a){let i=new $e;return setTimeout(()=>i.cancel(),a),i.token}function vdn(a,i){if(a.isCancellationRequested||i.isCancellationRequested)return ve.Cancelled;let e=new $e;return a.onCancellationRequested(()=>e.cancel()),i.onCancellationRequested(()=>e.cancel()),e.token}var xUe=class{get didTimeout(){return this._state==="timedout"}constructor(i){this._state="pending",this._disposables=new P,{promise:this.promise,resolve:this._resolvePromise,reject:this._rejectPromise}=TI(),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 bdn(a,i){let e=new xUe(i);return e.registerDisposable(a.onControlMessage(t=>{let o=JSON.parse(t.toString()),n=kko(o);n?e.reject(n):e.resolve(o)})),e.promise}function Sdn(a,i,e,t,o,n,r,s){let l=new xUe(s),c=En.create(!1);return a.info(`Creating a socket (${r})...`),sn(`code/willCreateSocket/${n}`),i.connect(e,t,o,r).then(u=>{l.didTimeout?(sn(`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()):(sn(`code/didCreateSocketOK/${n}`),a.info(`Creating a socket (${r}) was successful after ${c.elapsed()} ms.`),l.resolve(u))},u=>{sn(`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 AFi(a,i){let e=new xUe(i);return a.then(t=>{e.didTimeout||e.resolve(t)},t=>{e.didTimeout||e.reject(t)}),e.promise}async function Idn(a,i,e,t){let o=Eko(a,i);a.logService.trace(`${o} 1/6. invoking socketFactory.connect().`);let n;try{n=await Sdn(a.logService,a.remoteSocketFactoryService,a.connectTo,jD.getServerRootPath(),`reconnectionToken=${a.reconnectionToken}&reconnection=${a.reconnectionProtocol?"true":"false"}`,NFi(i),`renderer-${NFi(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 XDt({socket:n}),s=!0),a.logService.trace(`${o} 3/6. sending AuthRequest control message.`);let l=await AFi(a.signService.createNewMessage(_t()),t),c={type:"auth",auth:a.connectionToken||"00000000000000000000",data:l.data};r.sendControl(Je.fromString(JSON.stringify(c)));try{let u=await bdn(r,vdn(t,vko(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 AFi(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 AFi(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(Je.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&&UFi(r),u}}async function bko(a,i,e,t){let o=Date.now(),n=Eko(a,i),{protocol:r,ownsProtocol:s}=await Idn(a,i,e,t),l=new xUe(t);return l.registerDisposable(r.onControlMessage(c=>{let u=JSON.parse(c.toString()),p=kko(u);p?(a.logService.error(`${n} received error control message when negotiating connection. Error:`),a.logService.error(p),s&&UFi(r),l.reject(p)):(a.reconnectionProtocol?.endAcceptReconnection(),a.logService.trace(`${n} 6/6. handshake finished, connection is up and running after ${kdn(o)}!`),l.resolve({protocol:r,firstMessage:u}))})),l.promise}async function Sko(a,i){let{protocol:e}=await bko(a,1,void 0,i);return{protocol:e}}async function Iko(a,i,e){let{protocol:t,firstMessage:o}=await bko(a,2,i,e),n=o&&o.debugPort;return{protocol:t,debugPort:n}}async function yko(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 wko(a,i,e){return xko(a,async t=>{let{protocol:o}=await Sko(t,ve.None);return new BFi(a,i,e,t.reconnectionToken,o)})}async function Cko(a,i){return xko(a,async e=>{let{protocol:t,debugPort:o}=await Iko(e,i,ve.None);return new HFi(a,i,e.reconnectionToken,t,o)})}async function xko(a,i){for(let t=1;;t++)try{let o=_t(),n=await yko(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),one.triggerPermanentFailure(0,0,ow.isHandled(o)),o}}function ydn(a){return xn(i=>new Promise((e,t)=>{let o=setTimeout(e,a*1e3);i.onCancellationRequested(()=>{clearTimeout(o),e()})}))}var OFi=class{constructor(i,e){this.reconnectionToken=i;this.millisSinceLastIncomingData=e;this.type=0}},FFi=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()}},WFi=class{constructor(i,e,t){this.reconnectionToken=i;this.millisSinceLastIncomingData=e;this.attempt=t;this.type=2}},E5t=class{constructor(i,e,t){this.reconnectionToken=i;this.millisSinceLastIncomingData=e;this.attempt=t;this.type=4}},VFi=class{constructor(i,e,t,o){this.reconnectionToken=i;this.millisSinceLastIncomingData=e;this.attempt=t;this.handled=o;this.type=3}},one=class a extends C{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 E5t(this.reconnectionToken,0,0)),this._register(n.onSocketClose(s=>{let l=wat(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=wat(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=wdn(e,108e5),o=wat(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=wat(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 OFi(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=ydn(s);this._onDidStateChange.fire(new FFi(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 WFi(this.reconnectionToken,this.protocol.getMillisSinceLastIncomingData(),r+1)),this._options.logService.info(`${e} resolving connection...`);let l=await yko(this._options,this.reconnectionToken,this.protocol);this._options.logService.info(`${e} connecting to ${l.connectTo}...`),await this._reconnect(l,vko(fdn)),this._options.logService.info(`${e} reconnected!`),this._onDidStateChange.fire(new E5t(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(ow.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(so(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 ow){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,ow.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 VFi(this.reconnectionToken,e,t,o)),UFi(this.protocol)}_pauseSocketWriting(){this.protocol.pauseSocketWriting()}},BFi=class extends one{constructor(i,e,t,o,n){super(1,i,o,n,!0),this.client=this._register(new YDt(n,{remoteAuthority:e,clientId:t},i.ipcLogger))}async _reconnect(i,e){await Sko(i,e)}},HFi=class extends one{constructor(i,e,t,o,n){super(2,i,t,o,!1),this._startArguments=e,this.debugPort=n}async _reconnect(i,e){await Iko(i,this._startArguments,e)}};function UFi(a){try{a.acceptDisconnect();let i=a.getSocket();a.dispose(),i.dispose()}catch(i){mt(i)}}function kko(a){if(a&&a.type==="error"){let i=new Error(`Connection error: ${a.reason}`);return i.code="VSCODE_CONNECTION_ERROR",i}return null}function wdn(a,i){return typeof a!="number"||!isFinite(a)||a<0?i:a>Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:Math.floor(a)}function Cdn(a,i){for(;a.length<i;)a+=" ";return a}function xdn(a,i){return`[remote-connection][${Cdn(NFi(a),13)}][${i.substr(0,5)}\u2026]`}function wat(a,i,e){return`${xdn(a,i)}[${e?"reconnect":"initial"}]`}function Eko(a,i){return`${wat(i,a.reconnectionToken,!!a.reconnectionProtocol)}[${a.connectTo}]`}function kdn(a){return`${Date.now()-a} ms`}var T5t=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]));throw new Error("Invalid call")}};var _5t=class extends vmt{constructor(e,t,o,n,r){super(t,o,n);this.windowId=e;this.channel=r;this._register(r.listen("onDidChangeLogLevel",e)(s=>{N6(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 HGe({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 zFi(this.channel,e,t,o,this.windowId)}static setLogLevel(e,t,o){return e.call("setLogLevel",[t,o])}},zFi=class extends Zbe{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 D5t=class extends C{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 L5t="remote.defaultExtensionsIfInstalledLocally";var Tko="([a-z0-9A-Z][a-z0-9-A-Z]*)\\.([a-z0-9A-Z][a-z0-9-A-Z]*)$",kUe=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||zo,t={label:"${path}",separator:e===1?"\\":"/",tildify:e!==1,normalizeDriveLetter:e===1,workspaceSuffix:Gt?void 0:Y.vscodeRemote};this.labelService.registerFormatter({scheme:Y.vscodeRemote,formatting:t}),i&&this.labelService.registerFormatter({scheme:Y.vscodeUserData,formatting:t})})}};kUe=I([m(0,ot),m(1,yo)],kUe);var Cat=class extends C{constructor(i,e,t){super();let o=i.getConnection();o&&(o.registerChannel("download",new T5t(e)),o.withChannel("logger",async n=>this._register(new D5t(t,n))))}};Cat=I([m(0,yo),m(1,tF),m(2,ol)],Cat);var EUe=class extends C{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(12816,null),detail:d(12815,null),primaryButton:d(12817,null)})).confirmed)return e.configuration?this.fileDialogService.pickWorkspaceAndOpen({}):this.fileDialogService.pickFolderAndOpen({})}};EUe=I([m(0,be),m(1,ct),m(2,Vt),m(3,Pe),m(4,dn),m(5,yo)],EUe);var Edn=oe.as(Qi.Workbench);pt(kUe.ID,kUe,ut.BlockStartup);Edn.registerWorkbenchContribution(Cat,3);pt(EUe.ID,EUe,ut.BlockStartup);var Tdn=!0;if(Tdn){class a extends K{constructor(){super({id:"workbench.action.triggerReconnect",title:L(12848,"Connection: Trigger Reconnect"),category:We.Developer,f1:!0})}async run(t){one.debugTriggerReconnection()}}class i extends K{constructor(){super({id:"workbench.action.pauseSocketWriting",title:L(12818,"Connection: Pause socket writing"),category:We.Developer,f1:!0})}async run(t){one.debugPauseSocketWriting()}}W(a),W(i)}var _ko={type:"string",enum:["ui","workspace"],enumDescriptions:[d(12849,null),d(12850,null)]};oe.as(ii.Configuration).registerConfiguration({id:"remote",title:d(12819,null),type:"object",properties:{"remote.extensionKind":{type:"object",markdownDescription:d(12828,null),patternProperties:{[Tko]:{oneOf:[{type:"array",items:_ko},_ko],default:["ui"]}},default:{"pub.name":["ui"]}},"remote.restoreForwardedPorts":{type:"boolean",markdownDescription:d(12847,null),default:!0},"remote.autoForwardPorts":{type:"boolean",markdownDescription:d(12821,null,"`#remote.autoForwardPortsSource#`"),default:!0},"remote.autoForwardPortsSource":{type:"string",markdownDescription:d(12822,null,"`#remote.autoForwardPorts#`","`#remote.autoForwardPortsSource#`"),enum:["process","output","hybrid"],enumDescriptions:[d(12825,null),d(12824,null),d(12823,null)],default:"process"},"remote.autoForwardPortsFallback":{type:"number",default:20,markdownDescription:d(12820,null)},"remote.forwardOnOpen":{type:"boolean",description:d(12829,null),default:!0},"remote.portsAttributes":{type:"object",patternProperties:{"(^\\d+(-\\d+)?$)|(.+)":{type:"object",description:d(12843,null),properties:{onAutoForward:{type:"string",enum:["notify","openBrowser","openBrowserOnce","openPreview","silent","ignore"],enumDescriptions:[d(12837,null),d(12839,null),d(12840,null),d(12841,null),d(12846,null),d(12834,null)],description:d(12838,null),default:"notify"},elevateIfNeeded:{type:"boolean",description:d(12833,null),default:!1},label:{type:"string",description:d(12835,null),default:d(12836,null)},requireLocalPort:{type:"boolean",markdownDescription:d(12845,null),default:!1},protocol:{type:"string",enum:["http","https"],description:d(12844,null)}},default:{label:d(12836,null),onAutoForward:"notify"}}},markdownDescription:d(12831,null),defaultSnippets:[{body:{"${1:3000}":{label:"${2:Application}",onAutoForward:"openPreview"}}}],errorMessage:d(12842,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(12837,null),d(12839,null),d(12841,null),d(12846,null),d(12834,null)],description:d(12838,null),default:"notify"},elevateIfNeeded:{type:"boolean",description:d(12833,null),default:!1},label:{type:"string",description:d(12835,null),default:d(12836,null)},requireLocalPort:{type:"boolean",markdownDescription:d(12845,null),default:!1},protocol:{type:"string",enum:["http","https"],description:d(12844,null)}},defaultSnippets:[{body:{onAutoForward:"ignore"}}],markdownDescription:d(12832,null,"`#remote.portsAttributes#`"),additionalProperties:!1},"remote.localPortHost":{type:"string",enum:["localhost","allInterfaces"],default:"localhost",description:d(12830,null)},[L5t]:{type:"array",markdownDescription:d(12827,null),default:to?.remoteDefaultExtensionsIfInstalledLocally||[],items:{type:"string",pattern:Tko,patternErrorMessage:d(12826,null)}}}});var zfe=class extends C{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}))}};zfe=I([m(0,Gd),m(1,ru)],zfe);var Kfe=class extends C{constructor(e,t,o,n,r,s){super();this.openerService=o;let l=t.options?.tunnelProvider?.tunnelFactory;if(l){s.createKey(Kde.key,!0);let c=t.options?.tunnelProvider?.features?.privacyOptions??[];t.options?.tunnelProvider?.features?.public&&c.length===0&&(c=[{id:"private",label:d(12754,null),themeIcon:"lock"},{id:"public",label:d(12755,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}}};Kfe=I([m(0,ap),m(1,ru),m(2,Qe),m(3,Gd),m(4,ne),m(5,X)],Kfe);var Dko=new Q("selectedRemoteInExplorer",""),TUe=class extends C{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 jt);this.selectedRemoteContext=Dko.bindTo(e),this.switchRemoteMenu=D.for("workbench.remote.menu.switchRemoteMenu"),this._register(fe.appendMenuItem(D.ViewContainerTitle,{submenu:this.switchRemoteMenu,title:d(12672,null),group:"navigation",when:x.equals("viewContainer",KV),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=XL(this.workspaceContextService.getWorkspace())?.scheme),e=!0;let r=o?[o.split("+")[0]]:n?[n]:this.storageService.get(B9e,1)?.split(",")??this.storageService.get(B9e,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=SS(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=SS(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:Dko.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()}};TUe=I([m(0,X),m(1,Gd),m(2,Vt),m(3,le),m(4,Pe)],TUe);var Lko=()=>`
<checklist>
	<div class="theme-picker-row">
		<checkbox when-checked="setTheme:${Bd.COLOR_THEME_DARK}" checked-on="config.workbench.colorTheme == '${Bd.COLOR_THEME_DARK}'">
			<img width="200" src="./dark.png"/>
			${ur(d(16165,null))}
		</checkbox>
		<checkbox when-checked="setTheme:${Bd.COLOR_THEME_LIGHT}" checked-on="config.workbench.colorTheme == '${Bd.COLOR_THEME_LIGHT}'">
			<img width="200" src="./light.png"/>
			${ur(d(16168,null))}
		</checkbox>
	</div>
	<div class="theme-picker-row">
		<checkbox when-checked="setTheme:${Bd.COLOR_THEME_HC_DARK}" checked-on="config.workbench.colorTheme == '${Bd.COLOR_THEME_HC_DARK}'">
			<img width="200" src="./dark-hc.png"/>
			${ur(d(16166,null))}
		</checkbox>
		<checkbox when-checked="setTheme:${Bd.COLOR_THEME_HC_LIGHT}" checked-on="config.workbench.colorTheme == '${Bd.COLOR_THEME_HC_LIGHT}'">
			<img width="200" src="./light-hc.png"/>
			${ur(d(16167,null))}
		</checkbox>
	</div>
</checklist>
<checkbox class="theme-picker-link" when-checked="command:workbench.action.selectTheme" checked-on="false">
	${ur(d(16169,null))}
</checkbox>
`;var Rko=()=>`
<checklist>
	<div class="theme-picker-row">
		<checkbox when-checked="setTheme:${Bd.COLOR_THEME_DARK}" checked-on="config.workbench.colorTheme == '${Bd.COLOR_THEME_DARK}'">
			<img width="150" src="./dark.png"/>
			${ur(d(16170,null))}
		</checkbox>
		<checkbox when-checked="setTheme:${Bd.COLOR_THEME_LIGHT}" checked-on="config.workbench.colorTheme == '${Bd.COLOR_THEME_LIGHT}'">
			<img width="150" src="./light.png"/>
			${ur(d(16173,null))}
		</checkbox>
	</div>
	<div class="theme-picker-row">
		<checkbox when-checked="setTheme:${Bd.COLOR_THEME_HC_DARK}" checked-on="config.workbench.colorTheme == '${Bd.COLOR_THEME_HC_DARK}'">
			<img width="150" src="./dark-hc.png"/>
			${ur(d(16171,null))}
		</checkbox>
		<checkbox when-checked="setTheme:${Bd.COLOR_THEME_HC_LIGHT}" checked-on="config.workbench.colorTheme == '${Bd.COLOR_THEME_HC_LIGHT}'">
			<img width="150" src="./light-hc.png"/>
			${ur(d(16172,null))}
		</checkbox>
	</div>
</checklist>
`;var KFi=a=>ic("notebook.setProfile",{profile:a}).toString(),GFi=400,Mko=()=>`
<vertically-centered>
<checklist>
	<checkbox on-checked="${KFi("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="${GFi}" src="./notebookThemes/default.png"/>
		${ur(d(16163,null))}
	</checkbox>
	<checkbox on-checked="${KFi("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="${GFi}" src="./notebookThemes/jupyter.png"/>
		${ur(d(16164,null))}
	</checkbox>
	<checkbox on-checked="${KFi("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="${GFi}" src="./notebookThemes/colab.png"/>
		${ur(d(16162,null))}
	</checkbox>
</checklist>
</vertically-centered>
`;var nne={documentationUrl:to.defaultChatAgent?.documentationUrl??"",manageSettingsUrl:to.defaultChatAgent?.manageSettingsUrl??"",provider:to.defaultChatAgent?.provider??{default:{name:""}},publicCodeMatchesUrl:to.defaultChatAgent?.publicCodeMatchesUrl??"",termsStatementUrl:to.defaultChatAgent?.termsStatementUrl??"",privacyStatementUrl:to.defaultChatAgent?.privacyStatementUrl??""},rQv=d(16145,null,nne.provider.default.name,nne.publicCodeMatchesUrl,nne.manageSettingsUrl),$Fi=class{constructor(){this.providers=new Map}registerProvider(i,e){this.providers.set(i,e)}getProvider(i){return this.providers.get(i)}},P5t=new $Fi;P5t.registerProvider("vs/workbench/contrib/welcomeGettingStarted/common/media/theme_picker",Lko);P5t.registerProvider("vs/workbench/contrib/welcomeGettingStarted/common/media/theme_picker_small",Rko);P5t.registerProvider("vs/workbench/contrib/welcomeGettingStarted/common/media/notebookProfile",Mko);P5t.registerProvider("vs/workbench/contrib/welcomeGettingStarted/common/media/empty",()=>"");var R5t=Re("getting-started-setup",M.zap,d(16030,null)),_dn=Re("getting-started-beginner",M.lightbulb,d(16029,null)),sQv=[{id:"welcome.showNewFileEntries",title:d(16073,null),description:d(16072,null),icon:M.newFile,content:{type:"startEntry",command:"command:welcome.showNewFileEntries"}},{id:"topLevelOpenMac",title:d(16085,null),description:d(16084,null),icon:M.folderOpened,when:"!isWeb && isMac",content:{type:"startEntry",command:"command:workbench.action.files.openFileFolder"}},{id:"topLevelOpenFile",title:d(16081,null),description:d(16080,null),icon:M.goToFile,when:"isWeb || !isMac",content:{type:"startEntry",command:"command:workbench.action.files.openFile"}},{id:"topLevelOpenFolder",title:d(16083,null),description:d(16082,null),icon:M.folderOpened,when:"!isWeb && !isMac",content:{type:"startEntry",command:"command:workbench.action.files.openFolder"}},{id:"topLevelOpenFolderWeb",title:d(16083,null),description:d(16082,null),icon:M.folderOpened,when:"!openFolderWorkspaceSupport && workbenchState == 'workspace'",content:{type:"startEntry",command:"command:workbench.action.files.openFolderViaWorkspace"}},{id:"topLevelGitClone",title:d(16116,null),description:d(16115,null),when:"config.git.enabled && !git.missing",icon:M.sourceControl,content:{type:"startEntry",command:"command:git.clone"}},{id:"topLevelGitOpen",title:d(16118,null),description:d(16117,null),when:"workspacePlatform == 'webworker'",icon:M.sourceControl,content:{type:"startEntry",command:"command:remoteHub.openRepository"}},{id:"topLevelRemoteOpen",title:d(16122,null),description:d(16121,null),when:"!isWeb",icon:M.remote,content:{type:"startEntry",command:"command:workbench.action.remote.showMenu"}},{id:"topLevelOpenTunnel",title:d(16120,null),description:d(16119,null),when:"isWeb && showRemoteStartEntryInWeb",icon:M.remote,content:{type:"startEntry",command:"command:workbench.action.remote.showWebStartEntryActions"}},{id:"topLevelNewWorkspaceChat",title:d(16075,null),description:d(16074,null),icon:M.chatSparkle,when:"!isWeb && !chatSetupHidden",content:{type:"startEntry",command:"command:welcome.newWorkspaceChat"}}],Ic=(a,i)=>`[${a}](${i})`,Ddn=d(16050,null),Pko=d(16048,null,nne.documentationUrl??""),Ldn=d(16049,null,nne.provider.default.name,nne.provider.default.name,nne.termsStatementUrl,nne.privacyStatementUrl),Rdn=Ic(d(16147,null),"command:workbench.action.chat.triggerSetupAnonymousWithoutDialog"),Mdn=Ic(d(16147,null),"command:workbench.action.chat.triggerSetup"),Pdn=Ic(d(16147,null),"command:workbench.action.chat.triggerSetup"),Adn=Ic(d(16146,null),"command:workbench.action.chat.open");function M5t(a,i,e,t){let o=t?`${Pko}
${Ldn}
${i}`:`${Pko}
${i}`;return{id:a,title:Ddn,description:o,when:`${e} && !chatSetupHidden`,media:{type:"svg",altText:"VS Code Copilot multi file edits",path:"multi-file-edits.svg"}}}var qFi=[{id:"Setup",title:d(16101,null),description:d(16098,null),isFeatured:!0,icon:R5t,when:"!isWeb",walkthroughPageTitle:d(16102,null),next:"Beginner",content:{type:"steps",steps:[M5t("CopilotSetupAnonymous",Rdn,"chatAnonymous && !chatSetupInstalled",!0),M5t("CopilotSetupSignedOut",Mdn,"chatEntitlementSignedOut && !chatAnonymous",!1),M5t("CopilotSetupComplete",Adn,"chatSetupInstalled && !chatSetupDisabled && (chatAnonymous || chatPlanPro || chatPlanProPlus || chatPlanBusiness || chatPlanEnterprise || chatPlanFree)",!1),M5t("CopilotSetupSignedIn",Pdn,"!chatEntitlementSignedOut && (!chatSetupInstalled || chatSetupDisabled || chatPlanCanSignUp)",!1),{id:"pickColorTheme",title:d(16087,null),description:d(16086,null,Ic(d(16152,null),"command:workbench.action.selectTheme")),completionEvents:["onSettingChanged:workbench.colorTheme","onCommand:workbench.action.selectTheme"],media:{type:"markdown",path:"theme_picker"}},{id:"videoTutorial",title:d(16126,null),description:d(16125,null,Ic(d(16160,null),"https://aka.ms/vscode-getting-started-video")),media:{type:"svg",altText:"VS Code Settings",path:"learn.svg"}}]}},{id:"SetupWeb",title:d(16107,null),description:d(16106,null),isFeatured:!0,icon:R5t,when:"isWeb",next:"Beginner",walkthroughPageTitle:d(16108,null),content:{type:"steps",steps:[{id:"pickColorThemeWeb",title:d(16087,null),description:d(16086,null,Ic(d(16152,null),"command:workbench.action.selectTheme")),completionEvents:["onSettingChanged:workbench.colorTheme","onCommand:workbench.action.selectTheme"],media:{type:"markdown",path:"theme_picker"}},{id:"menuBarWeb",title:d(16071,null),description:d(16070,null,Ic(d(16156,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(16056,null),description:d(16057,null,Ic(d(16024,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(16059,null),description:d(16058,null,Ic(d(16022,null),"command:workbench.extensions.action.showLanguageExtensions")),when:"workspacePlatform != 'webworker'",media:{type:"svg",altText:"Language extensions",path:"languages.svg"}},{id:"settingsSyncWeb",title:d(16097,null),description:d(16096,null,Ic(d(16027,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(16045,null),description:d(16044,null,Ic(d(16026,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(16099,null),description:d(16100,null,Ic(d(16137,null),"command:workbench.action.addRootFolder"),Ic(d(16139,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(16089,null),description:d(16088,null,Ic(d(16142,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(16104,null),description:d(16103,null),isFeatured:!0,icon:R5t,when:$a.key,next:"Setup",walkthroughPageTitle:d(16105,null),content:{type:"steps",steps:[{id:"accessibilityHelp",title:d(16032,null),description:d(16031,null,Ic(d(16134,null),"command:editor.action.accessibilityHelp")),media:{type:"markdown",path:"empty"}},{id:"accessibleView",title:d(16038,null),description:d(16037,null,Ic(d(16136,null),"command:editor.action.accessibleView")),media:{type:"markdown",path:"empty"}},{id:"verbositySettings",title:d(16124,null),description:d(16123,null,Ic(d(16141,null),"command:workbench.action.openAccessibilitySettings")),media:{type:"markdown",path:"empty"}},{id:"commandPaletteTaskAccessibility",title:d(16047,null),description:d(16046,null,Ic(d(16026,null),"command:workbench.action.showCommands")),media:{type:"markdown",path:"empty"}},{id:"keybindingsAccessibility",title:d(16069,null),description:d(16068,null,Ic(d(16131,null),"command:toSide:workbench.action.openGlobalKeybindings")),media:{type:"markdown",path:"empty"}},{id:"accessibilitySignals",title:d(16036,null),description:d(16035,null,Ic(d(16133,null),"command:signals.sounds.help"),Ic(d(16132,null),"command:accessibility.announcement.help")),media:{type:"markdown",path:"empty"}},{id:"hover",title:d(16063,null),description:d(16062,null,Ic(d(16148,null),"command:editor.action.showHover")),media:{type:"markdown",path:"empty"}},{id:"goToSymbol",title:d(16061,null),description:d(16060,null,Ic(d(16138,null),"command:editor.action.goToSymbol")),media:{type:"markdown",path:"empty"}},{id:"codeFolding",title:d(16043,null),description:d(16042,null,Ic(d(16154,null),"command:editor.toggleFold"),Ic(d(16155,null),"command:editor.toggleFoldRecursively")),media:{type:"markdown",path:"empty"}},{id:"intellisense",title:d(16067,null),description:d(16066,null,Ic(d(16158,null),"command:editor.action.triggerSuggest"),Ic(d(16157,null),"command:editor.action.inlineSuggest.trigger")),media:{type:"markdown",path:"empty"}},{id:"accessibilitySettings",title:d(16034,null),description:d(16033,null,Ic(d(16135,null),"command:workbench.action.openAccessibilitySettings")),media:{type:"markdown",path:"empty"}},{id:"dictation",title:d(16054,null),description:d(16053,null,Ic(d(16153,null),"command:workbench.action.editorDictation.start"),Ic(d(16150,null),"command:workbench.action.terminal.startVoice"),Ic(d(16151,null),"command:workbench.action.terminal.stopVoice")),when:"hasSpeechProvider",media:{type:"markdown",path:"empty"}}]}},{id:"Beginner",isFeatured:!1,title:d(16040,null),icon:_dn,description:d(16039,null),walkthroughPageTitle:d(16041,null),content:{type:"steps",steps:[{id:"settingsAndSync",title:d(16094,null),description:d(16095,null,Ic(d(16159,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(16056,null),description:d(16055,null,Ic(d(16023,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(16114,null),description:d(16113,null,Ic(d(16149,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(16052,null),description:d(16051,null,Ic(d(16143,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(16091,null),description:d(16092,null,Ic(d(16025,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(16091,null),description:d(16093,null,Ic(d(16129,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(16091,null),description:d(16090,null,Ic(d(16140,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(16065,null),description:d(16064,null,Ic(d(16130,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(16112,null),when:"workspaceFolderCount != 0 && workspacePlatform != 'webworker'",description:d(16111,null,Ic(d(16144,null),"command:workbench.action.tasks.runTask")),media:{type:"svg",altText:"Task runner.",path:"runTask.svg"}},{id:"shortcuts",title:d(16110,null),description:d(16109,null,Ic(d(16131,null),"command:toSide:workbench.action.openGlobalKeybindings")),media:{type:"svg",altText:"Interactive shortcuts.",path:"shortcuts.svg"}},{id:"workspaceTrust",title:d(16128,null),description:d(16127,null,Ic(d(16161,null),"https://code.visualstudio.com/docs/editor/workspace-trust"),Ic(d(16028,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(16076,null),description:"",icon:R5t,isFeatured:!1,when:`config.${ft.openGettingStarted} && userHasOpenedNotebook`,walkthroughPageTitle:d(16077,null),content:{type:"steps",steps:[{completionEvents:["onCommand:notebook.setProfile"],id:"notebookProfile",title:d(16079,null),description:d(16078,null),when:"userHasOpenedNotebook",media:{type:"markdown",path:"notebookProfile"}}]}}];var _Ue=d(15978,null),Ako=Tn.registerExtensionPoint({extensionPoint:"walkthroughs",jsonSchema:{description:d(15979,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(15983,null)},title:{type:"string",description:d(16010,null)},icon:{type:"string",description:d(15982,null)},description:{type:"string",description:d(15980,null)},featuredFor:{type:"array",description:d(15981,null),items:{type:"string"}},when:{type:"string",description:d(16011,null)},steps:{type:"array",description:d(15984,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(15997,null)},title:{type:"string",description:d(16008,null)},description:{type:"string",description:d(15994,null,`[${_Ue}](command:myext.command)`,`[${_Ue}](command:toSide:myext.command)`,`[${_Ue}](https://aka.ms)`)},button:{deprecationMessage:d(15985,null,`[${_Ue}](command:myext.command)`,`[${_Ue}](command:toSide:myext.command)`,`[${_Ue}](https://aka.ms)`)},media:{type:"object",description:d(15998,null),oneOf:[{required:["image","altText"],additionalProperties:!1,properties:{path:{deprecationMessage:d(15977,null)},image:{description:d(16004,null),oneOf:[{type:"string"},{type:"object",required:["dark","light","hc","hcLight"],properties:{dark:{description:d(16000,null),type:"string"},light:{description:d(16003,null),type:"string"},hc:{description:d(16001,null),type:"string"},hcLight:{description:d(16002,null),type:"string"}}}]},altText:{type:"string",description:d(15999,null)}}},{required:["svg","altText"],additionalProperties:!1,properties:{svg:{description:d(16005,null),type:"string"},altText:{type:"string",description:d(15999,null)}}},{required:["markdown"],additionalProperties:!1,properties:{path:{deprecationMessage:d(15977,null)},markdown:{description:d(16006,null),type:"string"}}}]},completionEvents:{description:d(15986,null),type:"array",items:{type:"string",defaultSnippets:[{label:"onCommand",description:d(15988,null),body:"onCommand:${1:commandId}"},{label:"onLink",description:d(15990,null),body:"onLink:${2:linkId}"},{label:"onView",description:d(15992,null),body:"onView:${2:viewId}"},{label:"onSettingChanged",description:d(15991,null),body:"onSettingChanged:${2:settingName}"},{label:"onContext",description:d(15989,null),body:"onContext:${2:key}"},{label:"onExtensionInstalled",description:d(15987,null),body:"onExtensionInstalled:${3:extensionId}"},{label:"onStepSelected",description:d(15993,null),body:"onStepSelected"}]}},doneOn:{description:d(15995,null),deprecationMessage:d(15996,null),type:"object",required:["command"],defaultSnippets:[{body:{command:"$1"}}],properties:{command:{description:d(16007,null),type:"string"}}},when:{type:"string",description:d(16009,null)}}}}}}},activationEventsGenerator:function*(a){for(let i of a)i.id&&(yield`onWalkthrough:${i.id}`)}});var Ndn="workbench.editors.gettingStartedInput",A5t=class a extends Us{static{this.ID=Ndn}static{this.RESOURCE=A.from({scheme:Y.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(16015,null,this.walkthroughPageTitle):d(16014,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 Odn=new Q("hasMultipleNewFileEntries",!1),F5t=ae("walkthroughsService"),Fdn="workbench.welcomePage.hiddenCategories",O5t="workbench.welcomePage.walkthroughMetadata",Wdn=d(16016,null),Vdn=1440*60*1e3,jFi=7*Vdn,kat=class extends C{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(O5t,0,"[]"))),this.memento=new Bl("gettingStartedService",this.storageService),this.stepProgress=this.memento.getMemento(0,0),this.initCompletionEventListeners(),Odn.bindTo(this.contextService).set(!1),this.registerWalkthroughs()}registerWalkthroughs(){qFi.forEach(async(e,t)=>{this._registerWalkthrough({...e,icon:{type:"icon",icon:e.icon},order:qFi.length-t,source:Wdn,when:x.deserialize(e.when)??x.true(),steps:e.content.steps.map((o,n)=>({...o,completionEvents:o.completionEvents??[],description:QFi(o.description),category:e.id,order:n,when:x.deserialize(o.when)??x.true(),media:o.media.type==="image"?{type:"image",altText:o.media.altText,path:Bdn(o.media.path)}:o.media.type==="svg"?{type:"svg",altText:o.media.altText,path:Nko(o.media.path).with({query:JSON.stringify({moduleId:"vs/workbench/contrib/welcomeGettingStarted/common/media/"+o.media.path})})}:o.media.type==="markdown"?{type:"markdown",path:Nko(o.media.path).with({query:JSON.stringify({moduleId:"vs/workbench/contrib/welcomeGettingStarted/common/media/"+o.media.path})}),base:gn.asFileUri("vs/workbench/contrib/welcomeGettingStarted/common/media/"),root:gn.asFileUri("vs/workbench/contrib/welcomeGettingStarted/common/media/")}:{type:"video",path:N5t(gn.asFileUri("vs/workbench/contrib/welcomeGettingStarted/common/media/"),o.media.path),altText:o.media.altText,root:gn.asFileUri("vs/workbench/contrib/welcomeGettingStarted/common/media/"),poster:o.media.poster?N5t(gn.asFileUri("vs/workbench/contrib/welcomeGettingStarted/common/media/"),o.media.poster):void 0}}))})}),Ako.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?.[hj]||t?.context?.[Mxt]||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(O5t,JSON.stringify([...this.metadata.entries()]),0,0)}async registerExtensionWalkthroughContributions(e){let t=c=>c.startsWith("https://")?A.parse(c,!0):gn.uriToFileUri(je(e.extensionLocation,c)),o=c=>{let u=p=>p.startsWith("https://")?A.parse(p,!0):gn.uriToBrowserUri(je(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(x.deserialize(g??c.when)??x.true())&&(this.sessionInstalledExtensions.delete(e.identifier.value.toLowerCase()),u<r&&h&&(n=p,r=u));let f=(c.steps??[]).map((y,w)=>{let k=QFi(y.description||""),T=e.identifier.value+"#"+c.id+"#"+y.id,N;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."),N={type:"image",altText:O,path:o(y.media.image)}}else if(y.media.markdown)N={type:"markdown",path:t(y.media.markdown),base:t(wc(y.media.markdown)),root:gn.uriToFileUri(e.extensionLocation)};else if(y.media.svg)N={type:"svg",path:t(y.media.svg),altText:y.media.svg};else if(y.media.video){let O=gn.uriToFileUri(e.extensionLocation);N={type:"video",path:N5t(O,y.media.video),root:gn.uriToFileUri(e.extensionLocation),altText:y.media.altText,poster:y.media.poster?N5t(O,y.media.poster):void 0}}else throw new Error("Unknown walkthrough format detected for "+T);return{description:k,media:N,completionEvents:y.completionEvents?.filter(O=>typeof O=="string")??[],id:T,title:y.title,when:x.deserialize(y.when)??x.true(),category:p,order:w}}),v=!1;if(c.featuredFor){let y=this.workspaceContextService.getWorkspace().folders.map(k=>k.uri),w=new $e;setTimeout(()=>w.cancel(),2e3),v=await this.instantiationService.invokeFunction(k=>KEe(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:gn.uriToBrowserUri(je(e.extensionLocation,b)).toString(!0)}:{icon:DBt,type:"icon"},when:x.deserialize(g??c.when)??x.true()};this._registerWalkthrough(S),this._onDidAddWalkthrough.fire(this.resolveWalkthrough(S))})),this.storageService.store(O5t,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 A5t&&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-jFi,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,(jFi-g)/jFi)}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:QFi(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=si(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=x.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}};kat=I([m(0,le),m(1,ge),m(2,F),m(3,Pe),m(4,X),m(5,_l),m(6,B),m(7,ls),m(8,oi),m(9,Ft),m(10,Te),m(11,kC),m(12,fi),m(13,ee)],kat);var QFi=a=>a.split(`
`).filter(i=>i).map(i=>lS(i)),Nko=a=>a.startsWith("https://")?A.parse(a,!0):gn.asFileUri(`vs/workbench/contrib/welcomeGettingStarted/common/media/${a}`),xat=a=>a.startsWith("https://")?A.parse(a,!0):gn.asBrowserUri(`vs/workbench/contrib/welcomeGettingStarted/common/media/${a}`),Bdn=a=>{if(typeof a=="string"){let i=xat(a);return{hcDark:i,hcLight:i,dark:i,light:i}}else return{hcDark:xat(a.hc),hcLight:xat(a.hcLight??a.light),light:xat(a.light),dark:xat(a.dark)}},N5t=(a,i)=>{let e=t=>t.startsWith("https://")?A.parse(t,!0):SRe(je(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(16017,"Developer"),title:L(16019,"Reset Welcome Page Walkthrough Progress"),f1:!0,metadata:{description:L(16018,"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(F5t),e=a.get(le);e.store(Fdn,JSON.stringify([]),0,0),e.store(O5t,JSON.stringify([]),0,0);let t=new Bl("gettingStartedService",a.get(le)),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()}});we(F5t,kat,1);var YFi=class{getHeight(i){return 22}getTemplateId(i){return"HelpItemTemplate"}},XFi=class{constructor(){this.templateId="HelpItemTemplate"}renderTemplate(i){i.classList.add("remote-help-tree-node-item");let e=R(i,_(".remote-help-tree-node-item-icon"));return{parent:i,icon:e}}renderElement(i,e,t){let o=t.parent;R(o,t.icon),t.icon.classList.add(...i.element.iconClasses);let n=R(o,_(".help-item-label"));n.innerText=i.element.label}disposeTemplate(i){}},JFi=class{hasChildren(i){return i instanceof Tat}getChildren(i){return i instanceof Tat&&i.items?i.items:[]}},Tat=class extends C{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 ZFi(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===nvi)??new e0i(nvi,d(12686,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===rvi)??new W5t(rvi,d(12685,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===svi)??new W5t(svi,d(12687,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===avi)??new t0i(avi,d(12688,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)}},ZFi=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}},_at=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=XL(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(12674,null)});t&&await this.takeAction(t.extensionDescription,t.url)}}else await this.takeAction(this.values[0].extensionDescription,await this.values[0].url)}},e0i=class extends _at{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([Y.http,Y.https].includes(A.parse(t).scheme)){this.openerService.open(t,{allowCommands:!0});return}this.commandService.executeCommand("workbench.action.openWalkthrough",t)}},W5t=class extends _at{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})}},t0i=class extends _at{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])}},Gfe=class extends zr{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(12684,"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(nu,"RemoteHelp",t,new YFi,[new XFi],new JFi,{accessibilityProvider:{getAriaLabel:n=>n.label,getWidgetAriaLabel:()=>d(12689,null)}});let o=this._register(new Tat(this.viewModel,this.openerService,this.quickInputService,this.commandService,this.remoteExplorerService,this.environmentService,this.workspaceContextService,this.walkthroughsService));this.tree.setInput(o),this._register(H.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)}};Gfe=I([m(2,_e),m(3,ze),m(4,X),m(5,B),m(6,F),m(7,Ri),m(8,Qe),m(9,Ge),m(10,ge),m(11,Gd),m(12,Vt),m(13,De),m(14,tt),m(15,Pe),m(16,F5t)],Gfe);var i0i=class{constructor(i){this.id=Gfe.ID;this.name=Gfe.TITLE;this.canToggleVisibility=!0;this.hideByDefault=!1;this.group="help@50";this.order=-10;this.ctorDescriptor=new Mt(Gfe,[i])}},Eat=class extends zJ{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super(KV,p.onDidChangeTargetType,r,e,t,n,s,l,c,u,o,h,g);this.remoteExplorerService=p;this.helpPanelDescriptor=new i0i(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(TUe)),this._register(this.remoteExplorerService.onDidChangeHelpInformation(v=>{this._setHelpInformation(v)})),this._setHelpInformation(this.remoteExplorerService.helpInformation);let f=oe.as(on.ViewsRegistry);this.remoteSwitcher.createOptionItems(f.getViews(this.viewContainer)),this._register(f.onViewsRegistered(v=>{let b=[];for(let S of v)S.viewContainer.id===KV&&b.push(...S.views);b.length>0&&this.remoteSwitcher.createOptionItems(b)})),this._register(f.onViewsDeregistered(v=>{v.viewContainer.id===KV&&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=oe.as(on.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){Ea(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 SS(e.remoteAuthority)?e.remoteAuthority[0]:e.remoteAuthority}setFilter(e){this.remoteExplorerService.targetType=SS(e.remoteAuthority)?e.remoteAuthority:[e.remoteAuthority]}getTitle(){return d(12682,null)}};Eat=I([m(0,fi),m(1,Te),m(2,Pe),m(3,le),m(4,B),m(5,F),m(6,De),m(7,ze),m(8,lt),m(9,Gd),m(10,Ri),m(11,ne)],Eat);oe.as(on.ViewContainersRegistry).registerViewContainer({id:KV,title:L(12683,"Remote Explorer"),ctorDescriptor:new Mt(Eat),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:koo,order:4},0);var DUe=class{constructor(i,e){i.getEnvironment().then(t=>{t&&e.setPerformanceMarks("server",t.marks)})}};DUe=I([m(0,yo),m(1,wC)],DUe);var o0i=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 n0i(this,i)}stopTimer(){this._currentTimer&&(this._currentTimer.dispose(),this._currentTimer=null)}},n0i=class{constructor(i,e){this._parent=i,this._completionTime=e,this._renderInterval=MI(It,()=>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(12678,null,e)):this._parent.report(d(12677,null,e))}},Oko=40*1e3,LUe=class extends C{constructor(e,t,o,n,r,s,l,c){super();this._reloadWindowShown=!1;let u=e.getConnection();if(u){let v=function(N,O,V=null){return h&&(h.dispose(),h=null),N||(N=p?15:20),new o0i(t,N,V,O.map(U=>U.label),(U,G)=>{typeof U<"u"&&O[U]?O[U].callback():N===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(12679,null),callback:()=>{g?.skipWait()}},T={label:d(12680,null),callback:()=>{c.publicLog2("remoteReconnectionReload",{remoteName:$S(l.remoteAuthority),reconnectionToken:S,millisSinceLastIncomingData:Date.now()-y,attempt:w}),n.executeCommand(nJ.ID)}};this._register(u.onDidStateChange(N=>{switch(h?.stopTimer(),f.clear(),N.type){case 0:S=N.reconnectionToken,y=Date.now()-N.millisSinceLastIncomingData,w=0,c.publicLog2("remoteConnectionLost",{remoteName:$S(l.remoteAuthority),reconnectionToken:N.reconnectionToken}),(h||N.millisSinceLastIncomingData>Oko)&&(h||(h=v(null,[k,T])),h.report(d(12673,null)));break;case 1:h&&(g=N,h=v(null,[k,T]),h.startTimer(Date.now()+1e3*N.durationSeconds));break;case 2:S=N.reconnectionToken,y=Date.now()-N.millisSinceLastIncomingData,w=N.attempt,c.publicLog2("remoteReconnectionRunning",{remoteName:$S(l.remoteAuthority),reconnectionToken:N.reconnectionToken,millisSinceLastIncomingData:N.millisSinceLastIncomingData,attempt:N.attempt}),(h||N.millisSinceLastIncomingData>Oko)&&(h=v(null,[T]),h.report(d(12676,null)),f.value=r.onShow(()=>{h&&h.location===20&&(h=v(15,[T],h.lastReport))}));break;case 3:S=N.reconnectionToken,y=Date.now()-N.millisSinceLastIncomingData,w=N.attempt,c.publicLog2("remoteReconnectionPermanentFailure",{remoteName:$S(l.remoteAuthority),reconnectionToken:N.reconnectionToken,millisSinceLastIncomingData:N.millisSinceLastIncomingData,attempt:N.attempt,handled:N.handled}),b(),N.handled?(s.info("Error handled: Not showing a notification for the error."),console.log("Error handled: Not showing a notification for the error.")):this._reloadWindowShown||(this._reloadWindowShown=!0,o.confirm({type:gt.Error,message:d(12675,null),primaryButton:d(12681,null)}).then(O=>{O.confirmed&&n.executeCommand(nJ.ID)}));break;case 4:S=N.reconnectionToken,y=Date.now()-N.millisSinceLastIncomingData,w=N.attempt,c.publicLog2("remoteConnectionGain",{remoteName:$S(l.remoteAuthority),reconnectionToken:N.reconnectionToken,millisSinceLastIncomingData:N.millisSinceLastIncomingData,attempt:N.attempt}),b();break}}))}}};LUe=I([m(0,yo),m(1,Bo),m(2,ct),m(3,ge),m(4,Ge),m(5,ne),m(6,Vt),m(7,Te)],LUe);var tg=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N,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=N;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 Q("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=!Gt}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(12740,"Remote"),t=this;this._register(W(class extends K{constructor(){super({id:tg.REMOTE_ACTIONS_COMMAND_ID,category:e,title:L(12744,"Show Remote Menu"),f1:!0,keybinding:{weight:200,primary:2605}});this.run=()=>t.showRemoteMenu()}})),tg.SHOW_CLOSE_REMOTE_COMMAND_ID&&(this._register(W(class extends K{constructor(){super({id:tg.CLOSE_REMOTE_COMMAND_ID,category:e,title:L(12741,"Close Remote Connection"),f1:!0,precondition:x.or(ub,JL)});this.run=()=>t.hostService.openWindow({forceReuseWindow:!0,remoteAuthority:null})}})),this.remoteAuthority&&fe.appendMenuItem(D.MenubarFileMenu,{group:"6_close",command:{id:tg.CLOSE_REMOTE_COMMAND_ID,title:d(12735,null)},order:3.5})),this.extensionGalleryService.isEnabled()&&this._register(W(class extends K{constructor(){super({id:tg.INSTALL_REMOTE_EXTENSIONS_ID,category:e,title:L(12742,"Install Remote Development Extensions"),f1:!0});this.run=(n,r)=>n.get(zi).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()}));Gt&&this._register(H.any(this._register(new On(It,"online")).event,this._register(new On(It,"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=>Ei.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=>Ei.equals(r.id,o.identifier.id));n>-1&&(this.remoteExtensionMetadata[n].installed=!1)}))}async initializeRemoteMetadata(){if(this.remoteMetadataInitialized)return;let e=LT(Pp);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=>Ei.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=XL(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(),tg.REMOTE_CONNECTION_LATENCY_SCHEDULER_DELAY)),this.measureNetworkConnectionLatencyScheduler.schedule(tg.REMOTE_CONNECTION_LATENCY_SCHEDULER_FIRST_RUN_DELAY))}async measureNetworkConnectionLatency(){if(this.hostService.hasFocus&&this.networkState!=="offline"){let e=await RO.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 (${RO.latency?.current?.toFixed(2)}ms last, ${RO.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:$S(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(oN(t,tg.REMOTE_STATUS_LABEL_MAX_LENGTH),e.tooltip,e.command);return}if(this.remoteAuthority){let t=this.labelService.getHostLabel(Y.vscodeRemote,this.remoteAuthority)||this.remoteAuthority;switch(this.connectionState){case"initializing":this.renderRemoteStatusIndicator(d(12732,null),d(12732,null),void 0,!0);break;case"reconnecting":this.renderRemoteStatusIndicator(`${d(12733,null,oN(t,tg.REMOTE_STATUS_LABEL_MAX_LENGTH))}`,void 0,void 0,!0);break;case"disconnected":this.renderRemoteStatusIndicator(`$(alert) ${d(12731,null,oN(t,tg.REMOTE_STATUS_LABEL_MAX_LENGTH))}`);break;default:{let o=new xe("",{isTrusted:!0,supportThemeIcons:!0}),n=this.labelService.getHostTooltip(Y.vscodeRemote,this.remoteAuthority);n?o.appendMarkdown(n):o.appendText(d(12734,null,t)),this.renderRemoteStatusIndicator(`$(remote) ${oN(t,tg.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 xe("",{isTrusted:!0,supportThemeIcons:!0}),n=this.labelService.getHostTooltip(this.virtualWorkspaceLocation.scheme,this.virtualWorkspaceLocation.authority);n?o.appendMarkdown(n):o.appendText(d(12752,null,t)),(!Gt||this.remoteAuthority)&&(o.appendMarkdown(`

`),o.appendMarkdown(d(12753,null,`command:${yV}`))),this.renderRemoteStatusIndicator(`$(remote) ${oN(t,tg.REMOTE_STATUS_LABEL_MAX_LENGTH)}`,o);return}}this.renderRemoteStatusIndicator(tg.DEFAULT_REMOTE_STATUS_LABEL,d(12738,null))}renderRemoteStatusIndicator(e,t,o,n){let{text:r,tooltip:s,ariaLabel:l}=this.withNetworkStatus(e,t,n),c={name:d(12749,null),kind:this.networkState==="offline"?"offline":r!==tg.DEFAULT_REMOTE_STATUS_LABEL?"remote":void 0,ariaLabel:l,text:r,showProgress:n,tooltip:s,command:o??tg.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=m1(n);function l(){return!o&&e.startsWith(tg.DEFAULT_REMOTE_STATUS_LABEL)?e.replace(tg.DEFAULT_REMOTE_STATUS_LABEL,"$(alert)"):e}switch(this.networkState){case"offline":{let c=d(12737,null);n=l(),r=this.appendTooltipLine(r,c),s=`${s}, ${c}`;break}case"high-latency":n=l(),r=this.appendTooltipLine(r,d(12736,null,RO.latency?.current?.toFixed(2),RO.latency?.average?.toFixed(2)));break}return{text:n,tooltip:r,ariaLabel:s}}appendTooltipLine(e,t){let o;return typeof e=="string"?o=new xe(e,{isTrusted:!0,supportThemeIcons:!0}):o=e??new xe("",{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:{[hj]:!0}})}catch(o){if(!this.lifecycleService.willShutdown){let{confirmed:n}=await this.dialogService.confirm({type:gt.Error,message:d(12751,null,t),detail:o&&!so(o)?In(o):void 0,primaryButton:d(12750,null)});if(n)return this.installExtension(e,t)}throw o}}async runRemoteStartCommand(e,t){await R1i(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_${$S(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 Eo){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(kg),tooltip:d(12745,null)}];g.push({type:"item",id:f.id,label:v,buttons:b})}l.push({type:"separator",label:d(12746,null)}),l.push(...g)}l.push({type:"separator"});let h=l.length;return tg.SHOW_CLOSE_REMOTE_COMMAND_ID&&(this.remoteAuthority?(l.push({type:"item",id:tg.CLOSE_REMOTE_COMMAND_ID,label:d(12729,null)}),this.connectionState==="disconnected"&&l.push({type:"item",id:nJ.ID,label:d(12739,null)})):this.virtualWorkspaceLocation&&l.push({type:"item",id:tg.CLOSE_REMOTE_COMMAND_ID,label:d(12730,null)})),l.length===h&&l.pop(),l},n=new P,r=n.add(this.quickInputService.createQuickPick({useSeparators:!0}));r.placeholder=d(12748,null),r.items=o(),r.sortByLabel=!1,r.canSelectMany=!1,n.add(H.once(r.onDidAccept)((async s=>{let l=r.selectedItems;if(l.length===1){let c=l[0].id,u=this.remoteExtensionMetadata.find(p=>Ei.equals(p.id,c));if(u){r.items=[],r.busy=!0,r.placeholder=d(12747,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(H.once(r.onDidTriggerItemButton)(async s=>{let l=this.remoteExtensionMetadata.find(c=>Ei.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()}};tg=I([m(0,Tr),m(1,ru),m(2,ot),m(3,X),m(4,qt),m(5,Ge),m(6,ge),m(7,lt),m(8,yo),m(9,Mc),m(10,oi),m(11,Pe),m(12,ne),m(13,ta),m(14,Te),m(15,nt),m(16,ls),m(17,zi),m(18,ct),m(19,ao),m(20,Qe),m(21,B)],tg);oe.as(ii.Configuration).registerConfiguration({...Cm,properties:{"workbench.remoteIndicator.showExtensionRecommendations":{type:"boolean",markdownDescription:d(12743,null),default:!0}}});var Fko="remote.unsupportedConnectionChoice",Wko="workbench.banner.remote.unsupportedConnection.dismissed",RUe=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:gt.Warning,message:d(12694,null,this.productService.nameLong),buttons:[{label:d(12690,null),run:()=>1},{label:d(12691,null),run:async()=>(await this.openerService.open("https://aka.ms/vscode-remote/faq/old-linux"),2)}],cancelButton:{run:()=>0},checkbox:{label:d(12692,null)}});if(e===2)return await this._confirmConnection();let o=e===1;return o&&t&&this.storageService.store(`${Fko}.${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(`${Fko}.${this._environmentService.remoteAuthority}`,0);if(e===void 0&&(e=await this._confirmConnection()),e){let t=this.storageService.get(`${Wko}`,0)??"";if(t.slice(0,t.lastIndexOf("."))!==this.productService.version.slice(0,this.productService.version.lastIndexOf("."))){let n=[{label:d(12693,null),href:"https://aka.ms/vscode-remote/faq/old-linux"}];this.bannerService.show({id:"unsupportedGlibcWarning.banner",message:d(12695,null,this.productService.nameLong),actions:n,icon:M.warning,closeLabel:`Do not show again in v${this.productService.version}`,onClose:()=>{this.storageService.store(`${Wko}`,this.productService.version,0,1)}})}}else{this.hostService.openWindow({forceReuseWindow:!0,remoteAuthority:null});return}}this._telemetryService.publicLog2("remoteConnectionSuccess",{web:Gt,connectionTimeMs:await this._remoteAgentService.getConnection()?.getInitialConnectionTimeMs(),remoteName:$S(this._environmentService.remoteAuthority),tunnelName:P8i(this._environmentService.remoteAuthority)}),await this._measureExtHostLatency()}catch(i){this._telemetryService.publicLog2("remoteConnectionFailure",{web:Gt,connectionTimeMs:await this._remoteAgentService.getConnection()?.getInitialConnectionTimeMs(),remoteName:$S(this._environmentService.remoteAuthority),message:i?i.message:""})}}async _measureExtHostLatency(){let i=await RO.measure(this._remoteAgentService);i!==void 0&&this._telemetryService.publicLog2("remoteConnectionLatency",{web:Gt,remoteName:$S(this._environmentService.remoteAuthority),latencyMs:i.current})}};RUe=I([m(0,yo),m(1,Vt),m(2,Te),m(3,jP),m(4,ct),m(5,Qe),m(6,oi),m(7,le),m(8,nt)],RUe);var MUe=oe.as(Qi.Workbench);pt(zfe.ID,zfe,ut.BlockRestore);pt(Kfe.ID,Kfe,ut.BlockRestore);MUe.registerWorkbenchContribution(LUe,4);pt(tg.ID,tg,ut.BlockStartup);MUe.registerWorkbenchContribution(__e,3);MUe.registerWorkbenchContribution(D_e,4);MUe.registerWorkbenchContribution(L_e,4);MUe.registerWorkbenchContribution(DUe,4);MUe.registerWorkbenchContribution(RUe,3);var s0i=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]}},V5t=class a extends xi{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(cB).then(t=>new s0i(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 a0i=class extends V5t{constructor(){super({id:"editor.emmet.action.expandAbbreviation",label:L(9454,"Emmet: Expand Abbreviation"),precondition:ue.writable,actionName:"expand_abbreviation",kbOpts:{primary:2,kbExpr:x.and(ue.editorTextFocus,ue.tabDoesNotMoveFocus,x.has("config.emmet.triggerExpansionOnTab")),weight:100},menuOpts:{menuId:D.MenubarEditMenu,group:"5_insert",title:d(9455,null),order:3}})}};Jt(a0i);var l0i=class extends K{constructor(){super({id:"editor.action.toggleScreenReaderAccessibilityMode",title:L(8161,"Toggle Screen Reader Accessibility Mode"),metadata:{description:L(8162,"Toggles an optimized mode for usage with screen readers, braille devices, and other assistive technologies.")},f1:!0,keybinding:[{primary:2083,weight:210,when:LC},{primary:1595,linux:{primary:1598},weight:210}]})}async run(i){let e=i.get(Bi),t=i.get(B),o=e.isScreenReaderOptimized();t.updateValue("editor.accessibilitySupport",o?"off":"on",2),Jo(o?gc.screenReaderModeDisabled:gc.screenReaderModeEnabled)}};W(l0i);var c0i=class extends K{constructor(){super({id:"editor.action.announceCursorPosition",title:L(8158,"Announce Cursor Position"),f1:!0,metadata:{description:L(8159,"Announce the current cursor position (line and column) via screen reader.")},keybinding:{primary:3621,weight:210,when:x.and(ue.editorTextFocus,$a)}})}async run(i){let t=i.get(Kt).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=al.visibleColumnFromColumn(s,o.column,r)+1;Jo(d(8160,null,o.lineNumber,l))}};W(c0i);var B5t=class extends C{constructor(){super(),this._register(Ade.addImplementation(90,"editor",async i=>{let e=i.get(Kt),t=i.get(Wd),o=i.get(F),n=i.get(ge),r=e.getActiveCodeEditor()||e.getFocusedCodeEditor();r||(await n.executeCommand(ZF),r=e.getActiveCodeEditor()),t.show(o.createInstance(Dat,r))}))}},Dat=class extends C{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(gc.readonlyDiffEditor):t.push(gc.editableDiffEditor):e.get(104)?t.push(gc.readonlyEditor):t.push(gc.editableEditor),this.accessibilityService.isScreenReaderOptimized()&&this._configurationService.getValue("accessibility.windowTitleOptimized")?t.push(gc.defaultWindowTitleIncludesEditorState):t.push(gc.defaultWindowTitleExcludingEditorState),t.push(gc.toolbar);let o=Udn(this._keybindingService,this._contextKeyService,this._editor);o&&t.push(o),t.push(gc.listSignalSounds),t.push(gc.listAlerts),t.push(gc.announceCursorPosition),t.push(gc.focusNotifications);let n=Hdn(this._keybindingService,this._contextKeyService);n&&t.push(n);let r=d0i(this._keybindingService,this._contextKeyService,this._editor);return r&&t.push(r),t.push(gc.suggestActions),t.push(gc.acceptSuggestAction),t.push(gc.toggleSuggestionFocus),e.get(131).enabled&&t.push(gc.stickScroll),e.get(164)?t.push(gc.tabFocusModeOnMsg):t.push(gc.tabFocusModeOffMsg),t.push(gc.codeFolding),t.push(gc.intellisense),t.push(gc.showOrFocusHover),t.push(gc.goToSymbol),t.push(gc.startDebugging),t.push(gc.setBreakpoint),t.push(gc.debugExecuteSelection),t.push(gc.addToWatch),t.join(`
`)}};Dat=I([m(1,_e),m(2,X),m(3,Bi),m(4,B)],Dat);function d0i(a,i,e){if(i.getContext(e.getDomNode()).getValue(vc.activeEditorHasCommentingRange.key))return[OD.intro,OD.addComment,OD.nextCommentThread,OD.previousCommentThread,OD.nextRange,OD.previousRange].join(`
`)}function Hdn(a,i){if(ie.enabled.getValue(i))return[gc.quickChat,gc.startInlineChat].join(`
`)}function Udn(a,i,e){let t=i.getContext(e.getDomNode());if(t.getValue(mI.key))return gc.chatEditorModification+`
`+gc.chatEditActions;if(t.getValue(EB.key))return gc.chatEditorRequestInProgress}var H5t=class{constructor(){this.priority=105;this.name="diff-editor";this.when=eW.create("isInDiffEditor",!0);this.type="help"}getProvider(i){let e=i.get(ee),t=i.get(Kt),o=i.get(_e),n=i.get(X);if(!(e.activeTextEditorControl instanceof Hu))return;let r=t.getActiveCodeEditor()||t.getFocusedCodeEditor();if(!r)return;let s=d(8170,null,"<keybinding:diffEditor.switchSide>"),l=d(8172,null),c=["accessibility.signals.diffLineDeleted","accessibility.signals.diffLineInserted","accessibility.signals.diffLineModified"],u=[d(8168,null),d(8169,null,"<keybinding:"+S1.id+">","<keybinding:"+Pae.id+">"),s,l,d(8171,null,c.join(", "))],p=d0i(o,n,r);return p&&u.push(p),new tp("diffEditor",{type:"help"},()=>u.join(`
`),()=>r.focus(),"accessibility.verbosity.diffEditor")}};var PUe=class extends C{constructor(e,t,o,n){super();this._diffEditor=e;this._instantiationService=t;this._textResourceConfigurationService=o;this._notificationService=n;if(!(this._diffEditor instanceof MD)){let l=ui(this,c=>this._diffEditor.onDidUpdateDiff(c),()=>this._diffEditor.getDiffComputationResult()).map(c=>c&&!c.identical&&c.changes2.length===0);this._register(Ga((c,u)=>{if(l.read(c)){let p=u.add(this._instantiationService.createInstance(mpe,this._diffEditor.getModifiedEditor(),d(8174,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(St.Warning,d(8173,null,this._diffEditor.maxComputationTime),[{label:d(8175,null),run:()=>{this._textResourceConfigurationService.updateValue(this._diffEditor.getModel().modified.uri,"diffEditor.maxComputationTime",0)}}],{})}))}}static{this.ID="editor.contrib.diffEditorHelper"}};PUe=I([m(1,F),m(2,Nn),m(3,Ne)],PUe);Imt(PUe.ID,PUe);oe.as(rp.ConfigurationMigration).registerConfigurationMigrations([{key:"diffEditor.experimental.collapseUnchangedRegions",migrateFn:(a,i)=>[["diffEditor.hideUnchangedRegions.enabled",{value:a}],["diffEditor.experimental.collapseUnchangedRegions",{value:void 0}]]}]);xa.register(new H5t);var AUe=class extends C{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=a3i();for(let t of e)try{let o=this._instantiationService.createInstance(t);typeof o.dispose=="function"&&this._register(o)}catch(o){mt(o)}}};AUe=I([m(0,Kt),m(1,F)],AUe);pt(AUe.ID,AUe,ut.BlockRestore);var u0i=class{constructor(){this.priority=105;this.name="editor-find";this.when=HIt;this.type="help"}getProvider(i){let e=i.get(Kt),t=e.getActiveCodeEditor()||e.getFocusedCodeEditor();if(!t)return;let o=Tf.get(t);if(o)return new p0i(o)}},p0i=class extends C{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(8240,null)),s.push(d(8233,null)),s.push(""),s.push(d(8289,null)),o?(s.push(d(8272,null,o)),n!==void 0&&r!==void 0&&(n===0?s.push(d(8262,null)):s.push(d(8261,null,r,n)))):s.push(d(8264,null));let l=e.replaceString;l?s.push(d(8271,null,l)):s.push(d(8263,null)),s.push(""),s.push(d(8235,null)),s.push(d(8234,null)),s.push(""),s.push(d(8245,null)),s.push(d(8244,null)),s.push(d(8241,null)),s.push(d(8242,null)),s.push(d(8243,null)),s.push(""),s.push(d(8239,null)),s.push(d(8236,null)),s.push(d(8237,null)),s.push(d(8238,null)),s.push(""),s.push(d(8246,null)),s.push(""),s.push(d(8250,null)),s.push(d(8247,null)),s.push(d(8256,null)),s.push(d(8258,null)),s.push(""),s.push(d(8252,null)),s.push(d(8254,null)),s.push(d(8255,null,"<keybinding:editor.action.replaceOne>")),s.push(d(8253,null,"<keybinding:editor.action.replaceAll>")),s.push(""),s.push(d(8249,null)),s.push(d(8248,null,"<keybinding:editor.action.nextMatchFindAction>")),s.push(d(8257,null,"<keybinding:editor.action.previousMatchFindAction>")),s.push(""),s.push(d(8251,null)),s.push(""),s.push(d(8269,null)),s.push(d(8265,null)),s.push(d(8270,null)),s.push(d(8267,null)),s.push(d(8268,null)),s.push(d(8266,null)),s.push(""),s.push(d(8286,null,"<keybinding:workbench.action.openSettings>")),s.push(d(8287,null)),s.push(d(8288,null)),s.push(d(8277,null)),s.push(d(8274,null)),s.push(d(8282,null)),s.push(d(8273,null)),s.push(d(8278,null)),s.push(d(8275,null)),s.push(d(8276,null)),s.push(d(8281,null)),s.push(d(8279,null)),s.push(d(8280,null)),s.push(d(8283,null)),s.push(d(8284,null)),s.push(d(8285,null)),it&&(s.push(""),s.push(d(8260,null)),s.push(d(8259,null))),s.push(""),s.push(d(8232,null)),s.push(d(8231,null))}else s.push(d(8184,null)),s.push(d(8178,null)),s.push(""),s.push(d(8230,null)),o?(s.push(d(8214,null,o)),n!==void 0&&r!==void 0&&(n===0?s.push(d(8202,null)):s.push(d(8201,null,r,n)))):s.push(d(8203,null)),s.push(""),s.push(d(8180,null)),s.push(d(8179,null)),s.push(""),s.push(d(8190,null)),s.push(d(8189,null)),s.push(d(8185,null)),s.push(d(8186,null)),s.push(d(8187,null)),s.push(d(8188,null)),s.push(""),s.push(d(8212,null)),s.push(d(8210,null)),s.push(d(8211,null,"<keybinding:editor.action.nextMatchFindAction>")),s.push(d(8213,null,"<keybinding:editor.action.previousMatchFindAction>")),s.push(d(8209,null)),s.push(""),s.push(d(8183,null)),s.push(d(8181,null)),s.push(d(8182,null)),s.push(""),s.push(d(8191,null)),s.push(""),s.push(d(8195,null)),s.push(d(8192,null)),s.push(d(8197,null)),s.push(""),s.push(d(8194,null)),s.push(d(8193,null,"<keybinding:editor.action.nextMatchFindAction>")),s.push(d(8198,null,"<keybinding:editor.action.previousMatchFindAction>")),s.push(""),s.push(d(8196,null)),s.push(""),s.push(d(8207,null)),s.push(d(8204,null)),s.push(d(8208,null)),s.push(d(8205,null)),s.push(d(8206,null)),s.push(""),s.push(d(8227,null,"<keybinding:workbench.action.openSettings>")),s.push(d(8228,null)),s.push(d(8229,null)),s.push(d(8218,null)),s.push(d(8216,null)),s.push(d(8223,null)),s.push(d(8215,null)),s.push(d(8220,null)),s.push(d(8217,null)),s.push(d(8219,null)),s.push(d(8221,null)),s.push(d(8222,null)),s.push(d(8224,null)),s.push(d(8225,null)),s.push(d(8226,null)),it&&(s.push(""),s.push(d(8200,null)),s.push(d(8199,null))),s.push(""),s.push(d(8177,null)),s.push(d(8176,null));return s.join(`
`)}};xa.register(new u0i);oe.as(rp.ConfigurationMigration).registerConfigurationMigrations(xse.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 m0i=class extends K{constructor(){super({id:"workbench.action.inspectKeyMappings",title:L(8309,"Inspect Key Mappings"),category:We.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(m0i);var h0i=class extends K{constructor(){super({id:"workbench.action.inspectKeyMappingsJSON",title:L(8310,"Inspect Key Mappings (JSON)"),category:We.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(h0i);var NUe=class extends C{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(8311,null,No(e.uri.path));this._notificationService.prompt(St.Info,t,[{label:d(8312,null),run:()=>{this._configurationService.updateValue("editor.largeFileOptimizations",!1).then(()=>{this._notificationService.info(d(8313,null))},o=>{this._notificationService.error(o)})}}],{neverShowAgain:{id:"editor.contrib.largeFileOptimizationsWarner"}})}}};NUe=I([m(1,Ne),m(2,B)],NUe);go(NUe.ID,NUe,1);var IQ=class extends jge{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,vn)}else super.gotoLocation(e,t)}};IQ=I([m(0,ee),m(1,B),m(2,le)],IQ);var U5t=class a extends K{static{this.ID="workbench.action.gotoLine"}constructor(){super({id:a.ID,title:L(8319,"Go to Line/Column..."),f1:!0,keybinding:{weight:200,when:null,primary:2085,mac:{primary:293}}})}async run(i){i.get(Ge).quickAccess.show(IQ.GO_TO_LINE_PREFIX)}};W(U5t);oe.as(Tu.Quickaccess).registerQuickAccessProvider({ctor:IQ,prefix:jge.GO_TO_LINE_PREFIX,placeholder:d(8321,null),helpEntries:[{description:d(8320,null),commandId:U5t.ID}]});var z5t=class a extends K{static{this.ID="workbench.action.gotoOffset"}constructor(){super({id:a.ID,title:L(8322,"Go to Offset..."),f1:!0})}async run(i){i.get(Ge).quickAccess.show(IQ.GO_TO_OFFSET_PREFIX)}};W(z5t);oe.as(Tu.Quickaccess).registerQuickAccessProvider({ctor:IQ,prefix:IQ.GO_TO_OFFSET_PREFIX,placeholder:d(8321,null),helpEntries:[{description:d(8323,null),commandId:z5t.ID}]});Jt(class extends xi{constructor(){super({id:"editor.action.formatChanges",label:L(10559,"Format Modified Lines"),precondition:x.and(ue.writable,ue.hasDocumentSelectionFormattingProvider)})}async run(i,e){let t=i.get(F);if(!e.hasModel())return;let o=await t.invokeFunction(g0i,e.getModel());if(dr(o))return t.invokeFunction(fle,e,o,1,bm.None,ve.None,!0)}});async function g0i(a,i){let e=a.get(OE),t=a.get($s),o=a.get(Nt),n=await yyo(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(!dr(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 Lat=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=K5t(i,this.codeEditorService);if(r&&(o=r.getSelections(),e)){n=o.map(c=>c.getPosition());let l=Qr.get(r)?.getSessionEnclosingRange();if(l)for(let c=l.startLineNumber;c<=l.endLineNumber;c++)n.push(new Ie(c,i.getLineMaxColumn(c)))}let s=b4e(i,n,t);s.length&&i.pushEditOperations(o,s,l=>o)}};Lat=I([m(0,B),m(1,Kt)],Lat);function K5t(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 Rat=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=tv(t)===-1;if(!e||o)return;let n=[An.insert(new Ie(e,i.getLineMaxColumn(e)),i.getEOL())],r=K5t(i,this.codeEditorService);r?r.executeEdits("insertFinalNewLine",n,r.getSelections()):i.pushEditOperations([],n,()=>null)}};Rat=I([m(0,B),m(1,Kt)],Rat);var Mat=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=K5t(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,[An.delete(c)],u=>o),r?.setSelections(o))}};Mat=I([m(0,B),m(1,Kt)],Mat);var Pat=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 bm(p=>{t.report({message:d(8333,null,p.displayName||p.extensionId&&p.extensionId.value||"???",ic("workbench.action.openSettings","editor.formatOnSave").toString())})});if(!this.configurationService.getValue("editor.formatOnSave",r))return;let c=K5t(n,this.codeEditorService)||n,u=this.configurationService.getValue("editor.formatOnSaveMode",r);if(u==="file")await this.instantiationService.invokeFunction(vle,c,2,s,o);else{let p=await this.instantiationService.invokeFunction(g0i,pn(c)?c.getModel():c);p===null&&u==="modificationsIfAvailable"?await this.instantiationService.invokeFunction(vle,c,2,s,o):p&&await this.instantiationService.invokeFunction(fle,c,p,2,s,o,!1)}}};Pat=I([m(0,B),m(1,Kt),m(2,F)],Pat);var Aat=class extends C{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"&&gr.Source.contains(new Is(l))),r=new $e,s=[];for(let l of n)s.push(new Is(l));await this.applyOnSaveActions(e,s,[],bm.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)=>gr.SourceFixAll.contains(g)?gr.SourceFixAll.contains(f)?0:-1:gr.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 Is(g));o.report({message:d(8330,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 Is(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(8332,null,[...this._names].map(l=>`'${l}'`).join(", "),ic("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(8331,null,u.action.title)}),await this.instantiationService.invokeFunction(Nq,u,"onSave",{},r),r.isCancellationRequested)return}catch{}finally{c.dispose()}}}getActionsToRun(e,t,o,n,r){return DL(this.languageFeaturesService.codeActionProvider,e,e.getFullModelRange(),{type:2,triggerAction:"save participants",filter:{include:t,excludes:o,includeSourceActions:!0}},n,r)}};Aat=I([m(0,B),m(1,F),m(2,zt),m(3,oi),m(4,ee),m(5,Kt)],Aat);var Nat=class extends C{constructor(e,t){super();this.instantiationService=e;this.textFileService=t;this.registerSaveParticipants()}registerSaveParticipants(){this._register(this.textFileService.files.addSaveParticipant(this.instantiationService.createInstance(Lat))),this._register(this.textFileService.files.addSaveParticipant(this.instantiationService.createInstance(Aat))),this._register(this.textFileService.files.addSaveParticipant(this.instantiationService.createInstance(Pat))),this._register(this.textFileService.files.addSaveParticipant(this.instantiationService.createInstance(Rat))),this._register(this.textFileService.files.addSaveParticipant(this.instantiationService.createInstance(Mat)))}};Nat=I([m(0,F),m(1,Ho)],Nat);var zdn=oe.as(Qi.Workbench);zdn.registerWorkbenchContribution(Nat,3);var f0i=class a extends K{static{this.ID="editor.action.toggleColumnSelection"}constructor(){super({id:a.ID,title:{...L(8335,"Toggle Column Selection Mode"),mnemonicTitle:d(8334,null)},f1:!0,toggled:x.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(Kt),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 Ie(l.selectionStartLineNumber,l.selectionStartColumn),u=s.coordinatesConverter.convertModelPositionToViewPosition(c),p=new Ie(l.positionLineNumber,l.positionColumn),h=s.coordinatesConverter.convertModelPositionToViewPosition(p);Vg.MoveTo.runCoreEditorCommand(s,{position:c,viewPosition:u});let g=s.cursorConfig.visibleColumnFromColumn(s,h);Vg.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 Ie(l.fromViewLineNumber,c)),p=s.cursorConfig.columnFromVisibleColumn(s,l.toViewLineNumber,l.toViewVisualColumn),h=s.coordinatesConverter.convertViewPositionToModelPosition(new Ie(l.toViewLineNumber,p));n.setSelection(new Yt(u.lineNumber,u.column,h.lineNumber,h.column))}}_getCodeEditor(i){let e=i.getFocusedCodeEditor();return e||i.getActiveCodeEditor()}};W(f0i);var v0i=class a extends K{static{this.ID="editor.action.toggleMinimap"}constructor(){super({id:a.ID,title:{...L(8337,"Toggle Minimap"),mnemonicTitle:d(8336,null)},category:We.View,f1:!0,toggled:x.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(v0i);var b0i=class extends K{constructor(){super({id:"editor.action.toggleOvertypeInsertMode",title:{...L(8343,"Toggle Overtype/Insert Mode"),mnemonicTitle:d(8342,null)},metadata:{description:L(8344,"Toggle between overtype and insert mode")},keybinding:{weight:200,primary:19,mac:{primary:2605}},f1:!0,category:We.View})}async run(i){let t=nW.getInputMode()==="insert"?"overtype":"insert";nW.setInputMode(t)}};W(b0i);var Fat=class a extends K{static{this.ID="workbench.action.toggleMultiCursorModifier"}static{this.multiCursorModifierConfigurationKey="editor.multiCursorModifier"}constructor(){super({id:a.ID,title:L(8341,"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)}},S0i=new Q("multiCursorModifier","altKey"),Oat=class extends C{constructor(e,t){super();this.configurationService=e;this._multiCursorModifier=S0i.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)}};Oat=I([m(0,B),m(1,X)],Oat);oe.as(Qi.Workbench).registerWorkbenchContribution(Oat,3);W(Fat);fe.appendMenuItem(D.MenubarSelectionMenu,{group:"4_config",command:{id:Fat.ID,title:d(8338,null)},when:S0i.isEqualTo("ctrlCmd"),order:1});fe.appendMenuItem(D.MenubarSelectionMenu,{group:"4_config",command:{id:Fat.ID,title:it?d(8339,null):d(8340,null)},when:S0i.isEqualTo("altKey"),order:1});var I0i=class a extends K{static{this.ID="editor.action.toggleRenderControlCharacter"}constructor(){super({id:a.ID,title:{...L(8346,"Toggle Control Characters"),mnemonicTitle:d(8345,null)},category:We.View,f1:!0,toggled:x.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(I0i);var y0i=class a extends K{static{this.ID="editor.action.toggleRenderWhitespace"}constructor(){super({id:a.ID,title:{...L(8348,"Toggle Render Whitespace"),mnemonicTitle:d(8347,null)},category:We.View,f1:!0,toggled:x.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(y0i);var Wat=class extends yE{constructor(i,e,t,o,n,r,s){super(!1,i,e,t,o,n,r,s)}};Wat=I([m(1,X),m(2,Kt),m(3,Ne),m(4,F),m(5,le),m(6,B)],Wat);go(yE.ID,Wat,4);var Qeb=J("markdownAlert.note.foreground",fm,d(10918,null)),Yeb=J("markdownAlert.tip.foreground",Ase,d(10919,null)),Xeb=J("markdownAlert.important.foreground",cgt,d(10917,null)),Jeb=J("markdownAlert.warning.foreground",Bh,d(10920,null)),Zeb=J("markdownAlert.caution.foreground",av,d(10916,null));var w0i=class a extends K{constructor(){super({id:"workbench.action.toggleKeybindingsLog",title:L(10791,"Toggle Keyboard Shortcuts Troubleshooting"),category:We.Developer,f1:!0})}run(i){if(i.get(_e).toggleLogging()&&i.get(ge).executeCommand(iK),a.disposable){a.disposable.dispose(),a.disposable=void 0;return}let t=i.get(nc),o=new P,n=t.activeContainer,r=R(n,_(".focus-troubleshooting-marker"));o.add(Z(()=>r.remove()));let s=hr(void 0,void 0,o);Vh(".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 Gw())c(u,p);o.add(Fg(({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=Yn(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(w0i);var Vko={category:L(13512,"Snippets")},OUe=class extends K{constructor(i){super({...Vko,...i})}},FUe=class extends wl{constructor(i){super({...Vko,...i})}};var Hko;(i=>{function a(e){return!!e&&A.isUri(e.filepath)}i.is=a})(Hko||={});async function Kdn(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:Ye(c.location),filepath:c.location,description:u.size===0?d(13518,null):d(13517,null,[...u].join(", "))};if(o.push(h),!p)continue;let g=d(13516,null,p,t.getUriLabel(c.location,{relative:!0})),f=s.get(Ye(c.location));f&&(h.detail=g,f.snippet.detail=f.detail),s.set(Ye(c.location),{snippet:h,detail:g})}else{let u=Ye(c.location).replace(/\.json$/,"");o.push({label:Ye(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:je(l,`${c}.json`),hint:!0,iconClasses:Y1(c)})}return o.sort((c,u)=>{let p=Am(c.filepath.path),h=Am(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 Bko(a,i,e,t,o,n){function r(c){let u=Am(c)!==".code-snippets"?`${c}.code-snippets`:c;return je(i,u)}await t.createFolder(i);let s=await e.input({placeHolder:d(13521,null),async validateInput(c){if(!c)return d(13513,null);if(!nU(c))return d(13514,null,c);if(await t.exists(r(c)))return d(13515,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 Gdn(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 G5t=class extends OUe{constructor(){super({id:"workbench.action.openSnippets",title:L(13527,"Configure Snippets"),shortTitle:{...L(13529,"Snippets"),mnemonicTitle:d(13520,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(sy),t=i.get(Ge),o=i.get(Qe),n=i.get(kt),r=i.get(mn),s=i.get(Pe),l=i.get(be),c=i.get(Ho),u=i.get(ot),p=await Kdn(e,r,n,u),h=p.existing,g=[{scope:d(13524,null),label:d(13523,null),uri:r.currentProfile.snippetsHome}],f=[];for(let b of s.getWorkspace().folders)f.push({scope:d(13526,null,b.name),label:d(13522,null,b.name),uri:b.toResource(".vscode")});h.length>0?(h.unshift({type:"separator",label:d(13519,null)}),h.push({type:"separator",label:d(13525,null)})):h.push({type:"separator",label:d(13525,null)});let v=await t.pick([].concat(h,g,f,p.future),{placeHolder:d(13528,null),matchOnDescription:!0});if(g.indexOf(v)>=0)return Bko(v.scope,v.uri,t,l,c,o);if(f.indexOf(v)>=0)return Bko(v.scope,v.uri,t,l,c,o);if(Hko.is(v))return v.hint&&await Gdn(v,l,c),o.open(v.filepath)}};var WUe=class a extends OUe{static{this.Id="workbench.action.populateFileFromSnippet"}constructor(){super({id:a.Id,title:L(13530,"Fill File with Snippet"),f1:!0})}async run(i){let e=i.get(sy),t=i.get(Ge),o=i.get(ee),n=i.get(kt),r=ca(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()&&(Qr.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(JA(l.scopes))o.push({langId:"",snippet:l});else for(let c of l.scopes)o.push({langId:c,snippet:l});let n=[],r=Pg(o,(l,c)=>Al(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(13531,null),matchOnDetail:!0}))?.snippet}};async function $5t(a,i,e){let t=a.get(sy),o=a.get(Ge),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(13545,null);break;case 3:f=h.source;break;case 2:f=d(13546,null);break}u.push({type:"separator",label:f})}h.snippetSource===3&&(t.isEnabled(h)?g.buttons=[{iconClass:q.asClassName(M.eyeClosed),tooltip:d(13540,null)}]:(g.description=d(13542,null),g.buttons=[{iconClass:q.asClassName(M.eye),tooltip:d(13541,null)}])),u.push(g),p=h}return u},s=new P,l=s.add(o.createQuickPick({useSeparators:!0}));l.placeholder=d(13544,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(13543,null)),l.show(),await Promise.race([H.toPromise(l.onDidAccept),H.toPromise(l.onDidHide)]);let c=l.selectedItems[0]?.snippet;return s.dispose(),c}var C0i=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)}},q5t=class extends FUe{constructor(){super({id:"editor.action.insertSnippet",title:L(13532,"Insert Snippet"),f1:!0,precondition:ue.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(kt),n=i.get(sy);if(!e.hasModel())return;let r=i.get(Wi),s=i.get(F),l=await new Promise((u,p)=>{let{lineNumber:h,column:g}=e.getPosition(),{snippet:f,name:v,langId:b}=C0i.fromUser(t);if(f)return u(new Dde(!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($5t,S,e.getModel().uri))});if(!l)return;let c;l.needsClipboard&&(c=await r.readText()),e.focus(),Qr.get(e)?.insert(l.codeSnippet,{clipboardText:c}),n.updateUsageTimestamp(l)}};async function x0i(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 $fe=class a extends FUe{static{this.options={id:"editor.action.surroundWithSnippet",title:L(13533,"Surround with Snippet...")}}constructor(){super({...a.options,precondition:x.and(ue.writable,ue.hasNonEmptySelection),f1:!0})}async runEditorCommand(i,e){if(!e.hasModel())return;let t=i.get(F),o=i.get(sy),n=i.get(Wi),r=e.getModel(),s=await x0i(o,r,e.getPosition(),!0);if(!s.length)return;let l=await t.invokeFunction($5t,s,r.uri);if(!l)return;let c;l.needsClipboard&&(c=await n.readText()),e.focus(),Qr.get(e)?.insert(l.codeSnippet,{clipboardText:c}),o.updateUsageTimestamp(l)}};var rne=class{constructor(i){this._snippetService=i}static{this._MAX_CODE_ACTIONS=4}static{this._overflowCommandCodeAction={kind:gr.SurroundWith.value,title:d(13535,null),command:{id:$fe.options.id,title:$fe.options.title.value}}}async provideCodeActions(i,e){if(e.isEmpty())return;let t=Yt.isISelection(e)?e.getPosition():e.getStartPosition(),o=await x0i(this._snippetService,i,t,!1);if(!o.length)return;let n=[];for(let r of o){if(n.length>=rne._MAX_CODE_ACTIONS){n.push(rne._overflowCommandCodeAction);break}n.push({title:d(13534,null,r.name),kind:gr.SurroundWith.value,edit:Uko(i,e,r)})}return{actions:n,dispose(){}}}};rne=I([m(0,sy)],rne);var sne=class{constructor(i){this._snippetService=i;this.providedCodeActionKinds=[gr.SurroundWith.value]}static{this._MAX_CODE_ACTIONS=4}static{this._overflowCommandCodeAction={title:d(13536,null),kind:gr.SurroundWith.value,command:{id:WUe.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>=sne._MAX_CODE_ACTIONS){t.push(sne._overflowCommandCodeAction);break}t.push({title:d(13537,null,o.name),kind:gr.SurroundWith.value,edit:Uko(i,i.getFullModelRange(),o)})}return{actions:t,dispose(){}}}};sne=I([m(0,sy)],sne);function Uko(a,i,e){return{edits:[{versionId:a.getVersionId(),resource:a.uri,textEdit:{range:i,text:e.body,insertAsSnippet:!0}}]}}var VUe=class{constructor(i,e,t){this._store=new P;let o="editor.snippets.codeActions.enabled",n=new P,r=()=>{n.clear(),t.getValue(o)&&(n.add(e.codeActionProvider.register("*",i.createInstance(rne))),n.add(e.codeActionProvider.register("*",i.createInstance(sne))))};r(),this._store.add(t.onDidChangeConfiguration(s=>s.affectsConfiguration(o)&&r())),this._store.add(n)}dispose(){this._store.dispose()}};VUe=I([m(0,F),m(1,zt),m(2,B)],VUe);we(sy,tTe,1);W(q5t);qe.registerCommandAlias("editor.action.showSnippets","editor.action.insertSnippet");W($fe);W(WUe);W(G5t);var $dn=oe.as(Qi.Workbench);$dn.registerWorkbenchContribution(VUe,3);oe.as(ii.Configuration).registerConfiguration({...nC,properties:{"editor.snippets.codeActions.enabled":{description:d(13547,null),type:"boolean",default:!0}}});var zko="vscode://schemas/snippets",Kko={prefix:{description:d(13555,null),type:["string","array"]},isFileTemplate:{description:d(13554,null),type:"boolean"},body:{markdownDescription:d(13549,null),type:["string","array"],items:{type:"string"}},description:{description:d(13551,null),type:["string","array"]},include:{markdownDescription:d(13553,null),type:["string","array"],items:{type:"string"}},exclude:{markdownDescription:d(13552,null),type:["string","array"],items:{type:"string"}}},qdn={id:zko,allowComments:!0,allowTrailingCommas:!0,defaultSnippets:[{label:d(13550,null),body:{"${1:snippetName}":{prefix:"${2:prefix}",body:"${3:snippet}",description:"${4:description}"}}}],type:"object",description:d(13548,null),additionalProperties:{type:"object",required:["body"],properties:Kko,additionalProperties:!1}},Gko="vscode://schemas/global-snippets",jdn={id:Gko,allowComments:!0,allowTrailingCommas:!0,defaultSnippets:[{label:d(13550,null),body:{"${1:snippetName}":{scope:"${2:scope}",prefix:"${3:prefix}",body:"${4:snippet}",description:"${5:description}"}}}],type:"object",description:d(13548,null),additionalProperties:{type:"object",required:["body"],properties:{...Kko,scope:{description:d(13556,null),type:"string"}},additionalProperties:!1}},$ko=oe.as(ea.JSONContribution);$ko.registerSchema(zko,qdn);$ko.registerSchema(Gko,jdn);Jt(class extends xi{constructor(){super({id:"editor.action.formatDocument.none",label:L(10555,"Format Document"),precondition:x.and(ue.writable,ue.hasDocumentFormattingProvider.toNegated()),kbOpts:{kbExpr:ue.editorTextFocus,primary:1572,linux:{primary:3111},weight:100}})}async run(i,e){if(!e.hasModel())return;let t=i.get(ge),o=i.get(zi),n=i.get(Ne),r=i.get(ct),s=i.get(zt),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(10558,null));else{let u=l.getLanguageId(),p=d(10557,null,u),{confirmed:h}=await r.confirm({message:p,primaryButton:d(10556,null)});h&&o.openSearch(`category:formatters ${u}`)}}});var Ob=class extends C{constructor(e,t){super();this._extensionService=e;this._configurationService=t;this._store.add(this._extensionService.onDidChangeExtensions(this._updateConfigValues,this)),this._store.add(Qg.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(),Ob.extensionIds.length=0,Ob.extensionItemLabels.length=0,Ob.extensionDescriptions.length=0,Ob.extensionIds.push(null),Ob.extensionItemLabels.push(d(10534,null)),Ob.extensionDescriptions.push(d(10535,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))Ob.extensionIds.push(n.identifier.value),Ob.extensionItemLabels.push(n.displayName??""),Ob.extensionDescriptions.push(n.description??"");for(let n of t.sort(o))Ob.extensionIds.push(n.identifier.value),Ob.extensionItemLabels.push(n.displayName??""),Ob.extensionDescriptions.push(n.description??"")}_selectFoldingRangeProvider(e,t){let o=this._configurationService.getValue(Ob.configName,{overrideIdentifier:t.getLanguageId()});if(o)return e.filter(n=>n.id===o)}};Ob=I([m(0,lt),m(1,B)],Ob);oe.as(ii.Configuration).registerConfiguration({...nC,properties:{[Ob.configName]:{description:d(10533,null),type:["string","null"],default:null,enum:Ob.extensionIds,enumItemLabels:Ob.extensionItemLabels,markdownEnumDescriptions:Ob.extensionDescriptions}}});oe.as(Qi.Workbench).registerWorkbenchContribution(Ob,3);var Qdn="workbench.action.openSettings",Ydn=d(10809,null),Vat=class extends C{constructor(i,e){super();let o=[new k0i,new E0i].map(s=>new T0i(e,s));o.forEach(s=>this._register(s));let n,r=()=>{let s=i.activeTextEditorControl;if(s===n)return;n=s;let l=ca(s);o.forEach(c=>c.onActiveEditorChanged(l))};this._register(i.onDidActiveEditorChange(r)),r()}};Vat=I([m(0,ee),m(1,kV)],Vat);var k0i=class{constructor(){this.id="decoratorsLimitInfo";this.name=d(10805,null);this.label=d(10811,null);this.source=d(10806,null);this.settingsId="editor.colorDecoratorsLimit"}getLimitReporter(i){return Xy.get(i)?.limitReporter}},E0i=class{constructor(){this.id="foldingLimitInfo";this.name=d(10807,null);this.label=d(10812,null);this.source=d(10808,null);this.settingsId="editor.foldingMaximumRegions"}getLimitReporter(i){return Qg.get(i)?.limitReporter}},T0i=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:gt.Warning,label:this.accessor.label,detail:d(10810,null,i.limited),command:{id:Qdn,arguments:[this.accessor.settingsId],title:Ydn},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}};oe.as(Qi.Workbench).registerWorkbenchContribution(Vat,3);var W0=class{constructor(i,e,t,o){this._editor=i;this._accessibilitySignalService=t;this._instaService=o;this._sessionDispoosables=new P;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(10560,null)),this._ctxIsReading=W0.IsReading.bindTo(e)}static{this.IsReading=new Q("isReadingLineWithInlayHints",!1,{type:"boolean",description:d(10561,null)})}static{this.ID="editor.contrib.InlayHintsAccessibility"}static get(i){return i.getContribution(W0.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 $e;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(Xg,u,{href:cyt(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})),Fi(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=wE.get(this._editor)?.getInlayHintsForLine(i);!e||e.length===0?this._accessibilitySignalService.playSignal($o.noInlayHints):this._read(i,e)}stopInlayHintsReading(){this._reset(),this._editor.focus()}};W0=I([m(1,X),m(2,tr),m(3,F)],W0);W(class extends wl{constructor(){super({id:"inlayHints.startReadingLineWithHint",title:L(10562,"Read Line with Inlay Hints"),precondition:ue.hasInlayHintsProvider,f1:!0})}runEditorCommand(i,e){W0.get(e)?.startInlayHintsReading()}});W(class extends wl{constructor(){super({id:"inlayHints.stopReadingLineWithHint",title:L(10563,"Stop Inlay Hints Reading"),precondition:W0.IsReading,f1:!0,keybinding:{weight:100,primary:9}})}runEditorCommand(i,e){W0.get(e)?.stopInlayHintsReading()}});go(W0.ID,W0,4);var Xdn=Re("theme-selection-manage-extension",M.gear,d(15424,null));var BUe=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 $e,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:[_0i]})}s!==this._marketplaceThemes.length&&(this._marketplaceThemes.sort((h,g)=>h.label.localeCompare(g.label)),this._onDidChange.fire())}}catch(t){so(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 P;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(15442,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(j5t(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(15429,null,this._searchError)}`,id:void 0,alwaysShow:!0}]);let u=l.activeItems[0]?.id,p=u?c.find(h=>j5t(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(15419,null,i.displayName,i.publisherDisplayName),primaryButton:d(15418,null)})).confirmed)return!1;try{return await this.progressService.withProgress({location:15,title:d(15421,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()}};BUe=I([m(2,ta),m(3,ls),m(4,Ge),m(5,ne),m(6,Bo),m(7,zi),m(8,ct)],BUe);var qfe=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(BUe,this.getMarketplaceColorThemes.bind(this),this.options.marketplaceTag),i=[qko(this.options.browseMessage,"marketplace"),...i]):i=[...i,{type:"separator"},qko(this.options.installMessage,"extensions")]);let o,n=(s,l)=>{o&&clearTimeout(o),o=It.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 P;return new Promise((c,u)=>{let p=!1,h=i.findIndex(f=>j5t(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(j5t(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()}};qfe=I([m(3,Ge),m(4,ta),m(5,zi),m(6,Bx),m(7,F)],qfe);var jko="workbench.action.selectTheme";W(class extends K{constructor(){super({id:jko,title:L(15432,"Color Theme"),category:We.Preferences,f1:!0,keybinding:{weight:200,primary:Ai(2089,2098)}})}getTitle(a){switch(a){case"dark":return d(15446,null);case"light":return d(15449,null);case"hcDark":return d(15445,null);case"hcLight":return d(15448,null);default:return d(15447,null)}}async run(a){let i=a.get(Gp),e=a.get(Po),t=i.getPreferredColorScheme(),o={tooltip:t?d(15439,null):d(15438,null),iconClass:q.asClassName(M.colorMode),location:2},n={installMessage:d(15417,null),browseMessage:"$(plus) "+d(15410,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(qfe,n,r,s),u=await i.getColorThemes(),p=i.getColorTheme(),h=Bat(u.filter(b=>b.type==="light"),d(15437,null)),g=Bat(u.filter(b=>b.type==="dark"),d(15435,null)),f=Bat(u.filter(b=>Ug(b.type)),d(15436,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 Qko="workbench.action.selectIconTheme";W(class extends K{constructor(){super({id:Qko,title:L(15430,"File Icon Theme"),category:We.Preferences,f1:!0})}async run(a){let i=a.get(Gp),e={installMessage:d(15420,null),placeholderMessage:d(15440,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(qfe,e,t,o),s=[{type:"separator",label:d(15414,null)},{id:"",theme:XV.noIconTheme,label:d(15427,null),description:d(15426,null)},...Bat(await i.getFileIconThemes())];await r.openQuickPick(s,i.getFileIconTheme())}});var Yko="workbench.action.selectProductIconTheme";W(class extends K{constructor(){super({id:Yko,title:L(15431,"Product Icon Theme"),category:We.Preferences,f1:!0})}async run(a){let i=a.get(Gp),e={installMessage:d(15422,null),browseMessage:"$(plus) "+d(15411,null),placeholderMessage:d(15443,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(qfe,e,t,o),s=[{type:"separator",label:d(15428,null)},{id:zue,theme:JV.defaultTheme,label:d(15413,null)},...Bat(await i.getProductIconThemes())];await r.openQuickPick(s,i.getProductIconTheme())}});qe.registerCommand("workbench.action.previewColorTheme",async function(a,i,e){let t=a.get(Gp),o=Jdn(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 Jdn(a,i){return a.filter(({extensionData:e})=>e&&e.extensionIsBuiltin&&mr(e.extensionPublisher,i.publisher)&&mr(e.extensionName,i.name))}function qko(a,i){return{id:void 0,label:a,alwaysShow:!0,buttons:[_0i],configureItem:i}}function j5t(a){return a.type!=="separator"}function Zdn(a){let i=a.settingsId??void 0,e={id:a.id,theme:a,label:a.label,description:a.description||(a.label===i?void 0:i)};return a.extensionData&&(e.buttons=[_0i]),e}function Bat(a,i){let e=(o,n)=>o.label.localeCompare(n.label),t=a.map(Zdn).sort(e);return t.length>0&&i&&t.unshift({type:"separator",label:i}),t}var _0i={iconClass:q.asClassName(Xdn),tooltip:d(15423,null)};W(class extends K{constructor(){super({id:"workbench.action.generateColorTheme",title:L(15415,"Generate Color Theme From Current Settings"),category:We.Developer,f1:!0})}run(a){let e=a.get(Gp).getColorTheme(),o=oe.as(Tse.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]=Oe.Format.CSS.formatHexA(p,!0):r.push(u)}let s=[];for(let u of r){let p=e.getColor(u);p?n["__"+u]=Oe.Format.CSS.formatHexA(p,!0):s.push(u)}for(let u of s)n["__"+u]=null;let l=JSON.stringify({$schema:Kbi,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 eun="workbench.action.toggleLightDarkThemes";W(class extends K{constructor(){super({id:eun,title:L(15450,"Toggle between Light/Dark Themes"),category:We.Preferences,f1:!0})}async run(a){let i=a.get(Gp),e=a.get(B),t=a.get(Ne),o=a.get(Po);if(e.getValue("window.autoDetectColorScheme")){let l=d(15412,null,"window.autoDetectColorScheme");t.prompt(St.Info,l,[{label:d(15416,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 tun="workbench.action.browseColorThemesInMarketplace";W(class extends K{constructor(){super({id:tun,title:L(15409,"Browse Color Themes in Marketplace"),category:We.Preferences,f1:!0})}async run(a){let i="category:themes",e=a.get(Gp),t=a.get(ta),o=a.get(Bx),n=a.get(zi),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=It.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(BUe,l,i).openQuickPick("",e.getColorTheme(),u).then(void 0,mt)}});var Hat=new D("ThemesSubMenu");fe.appendMenuItem(D.GlobalActivity,{title:d(15434,null),submenu:Hat,group:"2_configuration",order:7});fe.appendMenuItem(D.MenubarPreferencesMenu,{title:d(15425,null),submenu:Hat,group:"2_configuration",order:7});fe.appendMenuItem(Hat,{command:{id:jko,title:d(15433,null)},order:1});fe.appendMenuItem(Hat,{command:{id:Qko,title:d(15441,null)},order:2});fe.appendMenuItem(Hat,{command:{id:Yko,title:d(15444,null)},order:3});var iun=oe.as(ii.Configuration);iun.registerConfiguration({id:"update",order:15,title:d(2683,null),type:"object",properties:{"update.mode":{type:"string",enum:["none","manual","start","default"],default:"default",scope:1,description:d(2684,null),tags:["usesOnlineServices"],enumDescriptions:[d(2679,null),d(2678,null),d(2681,null),d(2672,null)],policy:{name:"UpdateMode",category:"Update",minimumVersion:"1.67",localization:{description:{key:"updateMode",value:d(2684,null)},enumDescriptions:[{key:"none",value:d(2679,null)},{key:"manual",value:d(2678,null)},{key:"start",value:d(2681,null)},{key:"default",value:d(2672,null)}]}}},"update.channel":{type:"string",default:"default",scope:1,description:d(2684,null),deprecationMessage:d(2673,null,"update.mode")},"update.enableWindowsBackgroundUpdates":{type:"boolean",default:!0,scope:1,title:d(2676,null),description:d(2675,null),included:ri&&!Gt},"update.showReleaseNotes":{type:"boolean",default:!0,scope:1,description:d(2680,null),tags:["usesOnlineServices"]},"update.statusBar":{type:"string",enum:["hidden","actionable","detailed"],default:"detailed",scope:1,description:d(2682,null),enumDescriptions:[d(2677,null),d(2671,null),d(2674,null)]}}});var HUe=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`${Y.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(10914,null);{let t=w4(i);return d(10915,null,t.category,t.label)}}restorePreviousSettingMessage(i){let e=w4(i);return d(10911,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=w4(i.key);return this.isAlreadySet(i,e)?e?d(10904,null,t.category,t.label):d(10903,null,t.category,t.label):e?d(10913,null,t.category,t.label):d(10909,null,t.category,t.label)}stringSettingMessage(i,e){let t=w4(i.key);return this.isAlreadySet(i,e)?d(10906,null,t.category,t.label,e):d(10912,null,t.category,t.label,e)}numberSettingMessage(i,e){let t=w4(i.key);return this.isAlreadySet(i,e)?d(10905,null,t.category,t.label,e):d(10910,null,t.category,t.label,e)}renderSetting(i,e){let t=this.settingToUriString(i.key,e),o=d(10907,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!==Y.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(10908,null),label:d(10908,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 Lr(n,n,{label:!0})})}async updateSetting(i,e,t){if(i.scheme===Y.codeSetting)return this._telemetryService.publicLog2("releaseNotesSettingAction",{settingId:i.authority}),this.showContextMenu(i,e,t)}};HUe=I([m(0,B),m(1,ze),m(2,Po),m(3,Te),m(4,Wi)],HUe);var UUe=class extends C{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(kc.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(HUe)}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(15498,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,void 0,{group:Un,preserveFocus:!1});let c=new P;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(15500,null),c=h=>ur(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=SF.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)=>BM(g(S,y))).replace(/kbstyle\(([^\)]+)\)/gi,(S,y)=>BM(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 Kx(await this._requestService.request({url:s},ve.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===Y.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 KL(this._productService,this._environmentService)&&xO(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=_t(),o=await oun(e.text,this._extensionService,this._languageService,this._simpleSettingRenderer),n=kc.getColorMap(),r=n?KN(n):"",s=!!this._configurationService.getValue("update.showReleaseNotes"),l=this.getUpdateAction();return`<!DOCTYPE html>
		<html>
			<head>
				<base href="${SRe(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}">
					${die}
					${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(15499,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('${Y.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(15495,null),commandId:"update.downloadNow"};case"downloaded":return{label:d(15496,null),commandId:"update.install"};case"ready":return{label:d(15497,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")})}};UUe=I([m(0,Co),m(1,_e),m(2,kt),m(3,Qe),m(4,_a),m(5,B),m(6,ee),m(7,Et),m(8,Kt),m(9,V_),m(10,lt),m(11,nt),m(12,F),m(13,zd),m(14,ge)],UUe);async function oun(a,i,e,t){return a=a.toString().replace(/<!--\s*TOC\s*/gi,"").replace(/\s*Navigation End\s*-->/gi,""),uie(a,i,e,{sanitizerConfig:{allowRelativeMediaPaths:!0,allowedLinkProtocols:{override:[Y.http,Y.https,Y.command,Y.codeSetting]},allowedTags:{augment:["nav","svg","path"]},allowedAttributes:{augment:["aria-role","viewBox","fill","xmlns","d"]}},markedExtensions:[{renderer:{html:t.getHtmlRenderer(),codespan:t.getCodeSpanRenderer()}}]})}var WD=new Q("updateState","uninitialized"),Xko=new Q("majorMinorUpdateAvailable",!1),D0i;function Uat(a,i,e){return D0i||(D0i=a.createInstance(UUe)),D0i.show(i,e)}async function nun(a){let i=a.get(Qe),e=a.get(nt);if(e.releaseNotesUrl){let t=A.parse(e.releaseNotesUrl);await i.open(t)}else throw new Error(d(15532,null,e.nameLong))}async function Q5t(a,i){let e=a.get(F);try{await Uat(e,i,!1)}catch(t){try{await e.invokeFunction(nun)}catch(o){throw new Error(`${t.message} and ${o.message}`)}}}function L0i(a,i){fe.appendMenuItem(a,{group:i,command:{id:"update.check",title:d(15501,null)},when:WD.isEqualTo("idle")}),fe.appendMenuItem(a,{group:i,command:{id:"update.checking",title:d(15503,null),precondition:x.false()},when:WD.isEqualTo("checking for updates")}),fe.appendMenuItem(a,{group:i,command:{id:"update.downloadNow",title:d(15505,null)},when:WD.isEqualTo("available for download")}),fe.appendMenuItem(a,{group:i,command:{id:"update.downloading",title:d(15507,null),precondition:x.false()},when:WD.isEqualTo("downloading")}),fe.appendMenuItem(a,{group:i,command:{id:"update.install",title:d(15510,null)},when:WD.isEqualTo("downloaded")}),fe.appendMenuItem(a,{group:i,command:{id:"update.updating",title:d(15508,null),precondition:x.false()},when:WD.isEqualTo("updating")}),fe.appendMenuItem(a,{group:i,order:2,command:{id:"update.restart",title:d(15522,null)},when:WD.isEqualTo("ready")})}function Y5t(a){let i=/([0-9]+)\.([0-9]+)\.([0-9]+)/.exec(a);if(i)return{major:parseInt(i[1]),minor:parseInt(i[2]),patch:parseInt(i[3])}}function Jko(a,i){return a.major<i.major||a.minor<i.minor}var yQ=class{static{this.KEY="releaseNotes/lastVersion"}constructor(i,e,t,o,n,r,s,l){Gt||s.hadLastFocus().then(async c=>{if(!c)return;let u=Y5t(i.get(yQ.KEY,-1,"")),p=Y5t(l.version),h=r.getValue("update.showReleaseNotes"),g=l.releaseNotesUrl;h&&!o.skipReleaseNotes&&g&&u&&p&&Jko(u,p)&&Uat(e,l.version,!1).then(void 0,()=>{t.prompt(gt.Info,d(15516,null,l.nameLong,l.version),[{label:d(15520,null),run:()=>{let f=A.parse(g);n.open(f)}}],{priority:1})}),i.store(yQ.KEY,l.version,-1,1)})}};yQ=I([m(0,le),m(1,F),m(2,Ne),m(3,ru),m(4,Qe),m(5,B),m(6,oi),m(7,nt)],yQ);var zUe=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h){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.badgeDisposable=this._register(new me);this.state=r.state,this.updateStateContextKey=WD.bindTo(this.contextKeyService),this.majorMinorUpdateAvailableContextKey=Xko.bindTo(this.contextKeyService),this._register(r.onStateChange(this.onUpdateStateChange,this)),this.onUpdateStateChange(this.updateService.state);let g=this.productService.commit,f=this.storageService.get("update/lastKnownVersion",-1);g!==f&&(this.storageService.remove("update/lastKnownVersion",-1),this.storageService.remove("update/updateNotificationTime",-1)),this.registerGlobalActivityActions()}async onUpdateStateChange(e){switch(this.updateStateContextKey.set(e.type),e.type){case"disabled":e.reason===5&&this.notificationService.notify({severity:St.Info,message:d(15531,null,this.productService.nameLong),actions:{primary:[pi({id:"",label:d(15512,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=Y5t(this.productService.version),r=Y5t(o);this.majorMinorUpdateAvailableContextKey.set(!!(n&&r&&Jko(n,r)))}this.onUpdateReady(e);break}}let t;e.type==="available for download"||e.type==="downloaded"||e.type==="ready"?t=new qc(1,()=>d(15535,null,this.productService.nameShort)):e.type==="checking for updates"?t=new PC(()=>d(15502,null,this.productService.nameShort)):e.type==="downloading"||e.type==="overwriting"?t=new PC(()=>d(15506,null,this.productService.nameShort)):e.type==="updating"&&(t=new PC(()=>d(15537,null,this.productService.nameShort))),this.badgeDisposable.clear(),t&&(this.badgeDisposable.value=this.activityService.showGlobalActivity({badge:t})),this.state=e}onError(e){/The request timed out|The network connection was lost/i.test(e)||(e=e.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"),this.notificationService.notify({severity:St.Error,message:e,source:d(15530,null)}))}onUpdateNotAvailable(){this.dialogService.info(d(15515,null))}onUpdateAvailable(e){if(!this.shouldShowNotification())return;let t=e.productVersion;t&&this.notificationService.prompt(gt.Info,d(15529,null),[{label:d(15504,null),run:()=>this.updateService.downloadUpdate(!0)},{label:d(15511,null),run:()=>{}},{label:d(15520,null),run:()=>{this.instantiationService.invokeFunction(o=>Q5t(o,t))}}],{priority:1})}onUpdateDownloaded(e){if(it||this.configurationService.getValue("update.enableWindowsBackgroundUpdates")&&this.productService.target==="user"||!this.shouldShowNotification())return;let t=e.productVersion;t&&this.notificationService.prompt(gt.Info,d(15533,null,this.productService.nameLong,t),[{label:d(15509,null),run:()=>this.updateService.applyUpdate()},{label:d(15511,null),run:()=>{}},{label:d(15520,null),run:()=>{this.instantiationService.invokeFunction(o=>Q5t(o,t))}}],{priority:1})}onUpdateReady(e){if(e.overwrite&&this.overwriteNotificationHandle){let t=this.overwriteNotificationHandle;this.overwriteNotificationHandle=void 0,t.progress.done(),t.updateMessage(d(15514,null)),t.updateActions({primary:[pi({id:"update.restartToUpdate",label:d(15523,null),run:()=>this.updateService.quitAndInstall()})]})}else if(ri&&this.productService.target!=="user"||this.shouldShowNotification()){let t=[{label:d(15536,null),run:()=>this.updateService.quitAndInstall()},{label:d(15511,null),run:()=>{}}],o=e.update.productVersion;o&&t.push({label:d(15520,null),run:()=>{this.instantiationService.invokeFunction(n=>Q5t(n,o))}}),this.notificationService.prompt(gt.Info,d(15534,null,this.productService.nameLong),t,{sticky:!0,priority:1})}}onUpdateOverwriting(e){e.explicit&&(this.overwriteNotificationHandle=this.notificationService.notify({severity:St.Info,sticky:!0,message:d(15513,null),source:d(15530,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(){qe.registerCommand("update.check",()=>this.updateService.checkForUpdates(!0)),qe.registerCommand("update.checking",()=>{}),qe.registerCommand("update.downloadNow",()=>this.updateService.downloadUpdate(!0)),qe.registerCommand("update.downloading",()=>{}),qe.registerCommand("update.install",()=>this.updateService.applyUpdate()),qe.registerCommand("update.updating",()=>{}),qe.registerCommand("update.restart",()=>this.updateService.quitAndInstall()),qe.registerCommand("_update.state",()=>this.state),L0i(D.GlobalActivity,"7_update"),this.productService.quality==="stable"&&(qe.registerCommand("update.showUpdateReleaseNotes",()=>{if(this.updateService.state.type!=="ready")return;let e=this.updateService.state.update.productVersion;e&&this.instantiationService.invokeFunction(t=>Q5t(t,e))}),fe.appendMenuItem(D.GlobalActivity,{group:"7_update",order:1,command:{id:"update.showUpdateReleaseNotes",title:d(15526,null)},when:x.and(WD.isEqualTo("ready"),Xko)}))}};zUe=I([m(0,le),m(1,F),m(2,Ne),m(3,ct),m(4,zd),m(5,zl),m(6,X),m(7,nt),m(8,Qe),m(9,B),m(10,oi)],zUe);var KUe=class extends C{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(15527,null):d(15528,null),precondition:ep,menu:{id:D.GlobalActivity,when:ep,group:"7_update"}})}async run(l){let c=l.get(ct),u=l.get(_l),p=l.get(TR),h=l.get(le),g=l.get(lI),f=l.get(aI),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(15519,null),detail:o==="insider"?d(15517,null):d(15518,null),primaryButton:d(15521,null)})).confirmed){let k=[];f.status==="syncing"&&k.push(H.toPromise(H.filter(f.onDidChangeStatus,T=>T!=="syncing"))),r&&y&&k.push(g.synchroniseUserDataSyncStoreType()),await fn.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:St.Info,message:d(15525,null),detail:d(15524,null),buttons:[{label:d(15538,null),run:()=>"insiders"},{label:d(15539,null),run:()=>"stable"}],cancelButton:!0});return c}}))}}};KUe=I([m(0,nt),m(1,ru)],KUe);var TG=class extends C{constructor(e,t,o){super();this.updateService=e;this.defaultAccountService=t;this.storageService=o;this.$i=void 0;this.throttler=this._register(new um);!Gt&&(this.$i=this.storageService.get(TG.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=HDt(e?.entitlementsData?.organization_login_list);if(t===this.$i)return;this.$i=t,await this.updateService.setInternalOrg(this.$i),this.$i?this.storageService.store(TG.STORAGE_KEY,t,-1,1):this.storageService.remove(TG.STORAGE_KEY,-1)}catch{}}};TG=I([m(0,zd),m(1,Um),m(2,le)],TG);var aM=class extends C{constructor(e,t,o,n,r,s){super();this.updateService=e;this.statusbarService=t;this.productService=o;this.commandService=n;this.hoverService=r;this.configurationService=s;this.statusBarEntryAccessor=this._register(new me);!Gt&&(this._register(this.updateService.onStateChange(l=>this.onUpdateStateChange(l))),this._register(this.configurationService.onDidChangeConfiguration(l=>{l.affectsConfiguration("update.statusBar")&&this.onUpdateStateChange(this.updateService.state)})),this.onUpdateStateChange(this.updateService.state))}static{this.NAME=d(15562,null)}onUpdateStateChange(e){this.lastStateType!==e.type&&(this.statusBarEntryAccessor.clear(),this.lastStateType=e.type);let t=this.configurationService.getValue("update.statusBar");if(t==="hidden"){this.statusBarEntryAccessor.clear();return}let o=["available for download","downloaded","ready"];if(t==="actionable"&&!o.includes(e.type)){this.statusBarEntryAccessor.clear();return}switch(e.type){case"uninitialized":case"idle":case"disabled":this.statusBarEntryAccessor.clear();break;case"checking for updates":this.updateStatusBarEntry({name:aM.NAME,text:d(15563,null),ariaLabel:d(15564,null),tooltip:this.getCheckingTooltip(),command:GL});break;case"available for download":this.updateStatusBarEntry({name:aM.NAME,text:d(15592,null),ariaLabel:d(15591,null),tooltip:this.getAvailableTooltip(e.update),command:"update.downloadNow"});break;case"downloading":this.updateStatusBarEntry({name:aM.NAME,text:this.getDownloadingText(e),ariaLabel:d(15574,null),tooltip:this.getDownloadingTooltip(e),command:GL});break;case"downloaded":this.updateStatusBarEntry({name:aM.NAME,text:d(15596,null),ariaLabel:d(15595,null),tooltip:this.getReadyToInstallTooltip(e.update),command:"update.install"});break;case"updating":this.updateStatusBarEntry({name:aM.NAME,text:this.getUpdatingText(e),ariaLabel:this.getUpdatingText(e),tooltip:this.getUpdatingTooltip(e),command:GL});break;case"ready":{this.updateStatusBarEntry({name:aM.NAME,text:d(15588,null),ariaLabel:d(15587,null),tooltip:this.getRestartToUpdateTooltip(e.update),command:"update.restart"});break}case"overwriting":this.updateStatusBarEntry({name:aM.NAME,text:d(15571,null),ariaLabel:d(15570,null),tooltip:this.getOverwritingTooltip(e),command:GL});break}}updateStatusBarEntry(e){this.statusBarEntryAccessor.value?this.statusBarEntryAccessor.value.update(e):this.statusBarEntryAccessor.value=this.statusbarService.addEntry(e,"status.update",0,-Number.MAX_VALUE)}getCheckingTooltip(){return{element:e=>{let t=this.createTooltipDisposableStore(e),o=_(".update-status-tooltip");this.appendHeader(o,d(15565,null),t),this.appendProductInfo(o);let n=R(o,_(".progress-details"));return n.textContent=d(15566,null),o}}}getAvailableTooltip(e){return{element:t=>{let o=this.createTooltipDisposableStore(t),n=_(".update-status-tooltip");return this.appendHeader(n,d(15593,null),o),this.appendProductInfo(n,e),this.appendWhatsIncluded(n),n}}}getDownloadingText({downloadedBytes:e,totalBytes:t}){return e!==void 0&&t!==void 0&&t>0?d(15577,null,zat(e),zat(t),X5t(e,t)??0):d(15578,null)}getDownloadingTooltip(e){return{element:t=>{let o=this.createTooltipDisposableStore(t),n=_(".update-status-tooltip");this.appendHeader(n,d(15575,null),o),this.appendProductInfo(n,e.update);let{downloadedBytes:r,totalBytes:s}=e;if(r!==void 0&&s!==void 0&&s>0){let l=X5t(r,s)??0,c=R(n,_(".progress-container")),u=R(c,_(".progress-bar")),p=R(u,_(".progress-fill"));p.style.width=`${l}%`;let h=R(c,_(".progress-text")),g=R(h,_("span"));g.textContent=`${l}%`;let f=R(h,_("span"));f.textContent=`${zat(r)} / ${zat(s)}`;let v=cun(e);if(v!==void 0&&v>0){let S=R(n,_(".speed-info"));S.textContent=d(15576,null,zat(v))}let b=aun(e);if(b!==void 0&&b>0){let S=R(n,_(".time-remaining"));S.textContent=`~${lun(b)} ${d(15590,null)}`}}else{let l=R(n,_(".progress-details"));l.textContent=d(15573,null)}return n}}}getReadyToInstallTooltip(e){return{element:t=>{let o=this.createTooltipDisposableStore(t),n=_(".update-status-tooltip");return this.appendHeader(n,d(15597,null),o),this.appendProductInfo(n,e),this.appendWhatsIncluded(n),n}}}getRestartToUpdateTooltip(e){return{element:t=>{let o=this.createTooltipDisposableStore(t),n=_(".update-status-tooltip");return this.appendHeader(n,d(15594,null),o),this.appendProductInfo(n,e),this.appendWhatsIncluded(n),n}}}getUpdatingText({currentProgress:e,maxProgress:t}){let o=X5t(e,t);return o!==void 0?d(15580,null,o):d(15581,null)}getUpdatingTooltip(e){return{element:t=>{let o=this.createTooltipDisposableStore(t),n=_(".update-status-tooltip");this.appendHeader(n,d(15582,null),o),this.appendProductInfo(n,e.update);let{currentProgress:r,maxProgress:s}=e,l=X5t(r,s);if(l!==void 0){let c=R(n,_(".progress-container")),u=R(c,_(".progress-bar")),p=R(u,_(".progress-fill"));p.style.width=`${l}%`;let h=R(c,_(".progress-text")),g=R(h,_("span"));g.textContent=`${l}%`}else{let c=R(n,_(".progress-details"));c.textContent=d(15579,null)}return n}}}getOverwritingTooltip(e){return{element:t=>{let o=this.createTooltipDisposableStore(t),n=_(".update-status-tooltip");this.appendHeader(n,d(15572,null),o),this.appendProductInfo(n,e.update);let r=R(n,_(".progress-details"));return r.textContent=d(15569,null),n}}}createTooltipDisposableStore(e){let t=new P;return t.add(e.onCancellationRequested(()=>t.dispose())),t}runCommandAndClose(e,...t){this.commandService.executeCommand(e,...t),this.hoverService.hideHover(!0)}appendHeader(e,t,o){let n=R(e,_(".header")),r=R(n,_(".title"));r.textContent=t,o.add(new ji(n,{hoverDelegate:US})).push([pi({id:"update.openSettings",label:d(15589,null),class:q.asClassName(M.gear),run:()=>this.runCommandAndClose("workbench.action.openSettings","@id:update*")})],{icon:!0,label:!1})}appendProductInfo(e,t){let o=R(e,_(".product-info")),n=R(o,_(".product-logo"));n.setAttribute("role","img"),n.setAttribute("aria-label",this.productService.nameLong);let r=R(o,_(".product-details")),s=R(r,_(".product-name"));s.textContent=this.productService.nameLong;let l=this.productService.version;if(l){let h=R(r,_(".product-version")),g=this.productService.commit?.substring(0,7);h.textContent=g?d(15568,null,l,g):d(15567,null,l)}let c=t?.productVersion;if(c){let h=R(r,_(".product-version")),g=t.version?.substring(0,7);h.textContent=g?d(15584,null,c,g):d(15583,null,c)}let u=t?.timestamp??run(this.productService.date);if(typeof u=="number"&&u>0){let h=R(r,_(".product-release-date"));h.textContent=d(15585,null,sun(u))}let p=c??l;if(p){let h=R(r,_("a.release-notes-link"));h.textContent=d(15586,null),h.href="#",h.addEventListener("click",g=>{g.preventDefault(),this.runCommandAndClose("update.showCurrentReleaseNotes",p)})}}appendWhatsIncluded(e){}};aM=I([m(0,zd),m(1,Tr),m(2,nt),m(3,ge),m(4,tt),m(5,B)],aM);function X5t(a,i){if(!(a===void 0||i===void 0||i<=0))return Math.max(Math.min(Math.round(a/i*100),100),0)}function run(a){if(a===void 0)return;let i=Date.parse(a);return isNaN(i)?void 0:i}function sun(a){return new Date(a).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function aun(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 lun(a){let i=a/3600;if(i>=1){let t=J5t(i);return t==="1"?d(15558,null,t):d(15559,null,t)}let e=Math.floor(a/60);return e>=1?d(15560,null,e):d(15561,null,a)}function zat(a){if(a<1024)return d(15554,null,a);let i=a/1024;if(i<1024)return d(15556,null,J5t(i));let e=i/1024;if(e<1024)return d(15557,null,J5t(e));let t=e/1024;return d(15555,null,J5t(t))}function J5t(a){let i=Math.round(a*10)/10;return i%1===0?i.toString():i.toFixed(1)}function cun(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}var Kat=oe.as(Qi.Workbench);Kat.registerWorkbenchContribution(yQ,3);Kat.registerWorkbenchContribution(zUe,3);Kat.registerWorkbenchContribution(KUe,3);Kat.registerWorkbenchContribution(TG,4);Kat.registerWorkbenchContribution(aM,3);var Z5t=class extends K{static{this.AVAILABLE=!!to.releaseNotesUrl}constructor(){super({id:JFe,title:{...L(15550,"Show Release Notes"),mnemonicTitle:d(15545,null)},category:{value:to.nameShort,original:to.nameShort},f1:!0,menu:[{id:D.MenubarHelpMenu,group:"1_welcome",order:5}]})}async run(i,e){let t=i.get(F),o=i.get(nt),n=i.get(Qe),r=e??o.version;try{await Uat(t,r,!1)}catch{if(o.releaseNotesUrl)await n.open(A.parse(o.releaseNotesUrl));else throw new Error(d(15552,null,o.nameLong))}}},R0i=class extends K{constructor(){super({id:Kbo,title:{...L(15551,"Open Current File as Release Notes"),mnemonicTitle:d(15545,null)},category:L(15542,"Developer"),f1:!0})}async run(i){let e=i.get(F),t=i.get(nt);try{await Uat(e,t.version,!0)}catch{throw new Error(d(15548,null))}}};Z5t.AVAILABLE&&W(Z5t);W(R0i);var M0i=class extends K{constructor(){super({id:"update.checkForUpdate",title:L(15541,"Check for Updates..."),category:{value:to.nameShort,original:to.nameShort},f1:!0,precondition:WD.isEqualTo("idle")})}async run(i){return i.get(zd).checkForUpdates(!0)}},P0i=class extends K{constructor(){super({id:"update.downloadUpdate",title:L(15543,"Download Update"),category:{value:to.nameShort,original:to.nameShort},f1:!0,precondition:WD.isEqualTo("available for download")})}async run(i){await i.get(zd).downloadUpdate(!0)}},A0i=class extends K{constructor(){super({id:"update.installUpdate",title:L(15544,"Install Update"),category:{value:to.nameShort,original:to.nameShort},f1:!0,precondition:WD.isEqualTo("downloaded")})}async run(i){await i.get(zd).applyUpdate()}},N0i=class extends K{constructor(){super({id:"update.restartToUpdate",title:L(15549,"Restart to Update"),category:{value:to.nameShort,original:to.nameShort},f1:!0,precondition:WD.isEqualTo("ready")})}async run(i){await i.get(zd).quitAndInstall()}},e4t=class a extends K{static{this.ID="workbench.action.download"}static{this.AVAILABLE=!!to.downloadUrl}constructor(){super({id:a.ID,title:L(15546,"Download {0}",to.nameLong),precondition:ep,f1:!0,menu:[{id:D.StatusBarWindowIndicatorMenu,when:ep}]})}run(i){let e=i.get(nt),t=i.get(Qe);e.downloadUrl&&t.open(A.parse(e.downloadUrl))}};e4t.AVAILABLE&&W(e4t);W(M0i);W(P0i);W(A0i);W(N0i);if(ri){class a extends K{constructor(){super({id:"_update.applyupdate",title:L(15540,"Apply Update..."),category:We.Developer,f1:!0,precondition:WD.isEqualTo("idle")})}async run(e){let t=e.get(zd),n=await e.get(dn).showOpenDialog({title:d(15547,null),filters:[{name:"Setup",extensions:["exe"]}],canSelectFiles:!0,openLabel:$$(d(15553,null))});!n||!n[0]||await t._applySpecificUpdate(n[0].fsPath)}}W(a)}var dun=.15,O0i="nps/sessionCount",Zko="nps/lastSessionDate",t4t="nps/skipVersion",i4t="nps/isCandidate",Gat=class{constructor(i,e,t,o,n,r){if(!n.npsSurveyUrl||!r.getValue("telemetry.feedback.enabled")||i.get(t4t,-1,""))return;let l=new Date().toDateString(),c=i.get(Zko,-1,new Date(0).toDateString());if(l===c)return;let u=(i.getNumber(O0i,-1,0)||0)+1;if(i.store(Zko,l,-1,0),i.store(O0i,u,-1,0),u<9)return;let p=i.getBoolean(i4t,-1,!1)||Math.random()<dun;if(i.store(i4t,p,-1,0),!p){i.store(t4t,n.version,-1,0);return}e.prompt(St.Info,d(13607,null),[{label:d(13608,null),run:()=>{o.open(A.parse(`${n.npsSurveyUrl}?o=${encodeURIComponent(ZA)}&v=${encodeURIComponent(n.version)}&m=${encodeURIComponent(t.machineId)}`)),i.store(i4t,!1,-1,0),i.store(t4t,n.version,-1,0)}},{label:d(13606,null),run:()=>i.store(O0i,u-3,-1,0)},{label:d(13605,null),run:()=>{i.store(i4t,!1,-1,0),i.store(t4t,n.version,-1,0)}}],{priority:3})}};Gat=I([m(0,le),m(1,Ne),m(2,Te),m(3,Qe),m(4,nt),m(5,B)],Gat);Dr==="en"&&oe.as(Qi.Workbench).registerWorkbenchContribution(Gat,3);var F0i=class extends C{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 wM(T=>{T.forEach(N=>{if(N.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(St.Info,d(13601,null,n.getLanguageName(i.languageId)??i.languageId),[{label:d(13604,null),run:()=>{o.publicLog(`${i.surveyId}.survey/takeShortSurvey`),s.open(A.parse(`${i.surveyUrl}?o=${encodeURIComponent(ZA)}&v=${encodeURIComponent(l.version)}&m=${encodeURIComponent(o.machineId)}`)),e.store(h,!1,-1,0),e.store(p,l.version,-1,0)}},{label:d(13603,null),run:()=>{o.publicLog(`${i.surveyId}.survey/remindMeLater`),e.store(c,y-3,-1,0)}},{label:d(13602,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})}},$at=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 F0i(i,this.storageService,this.notificationService,this.telemetryService,this.languageService,this.textFileService,this.openerService,this.productService)))}};$at=I([m(0,le),m(1,Ne),m(2,Te),m(3,Ho),m(4,Qe),m(5,nt),m(6,kt),m(7,lt)],$at);Dr==="en"&&oe.as(Qi.Workbench).registerWorkbenchContribution($at,3);var W0i={explorer:"workbench.explorer.emptyView",debug:"workbench.debug.welcome",scm:"workbench.scm",testing:"workbench.view.testing"},uun=Object.freeze({type:"array",description:d(16185,null),items:{type:"object",description:d(16186,null),required:["view","contents"],properties:{view:{anyOf:[{type:"string",description:d(16190,null)},{type:"string",description:d(16190,null),enum:Object.keys(W0i)}]},contents:{type:"string",description:d(16187,null)},when:{type:"string",description:d(16191,null)},group:{type:"string",description:d(16189,null)},enablement:{type:"string",description:d(16188,null)}}}}),eEo={extensionPoint:"viewsWelcome",jsonSchema:uun};var pun=oe.as(on.ViewsRegistry),o4t=class extends C{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}=mun(l,s),p=x.deserialize(l.enablement),h=W0i[l.view]??l.view,g=r.get(h);g||(g=new Map,r.set(h,g)),g.set(l,{content:l.contents,when:x.deserialize(l.when),precondition:p,group:c,order:u})}for(let[s,l]of r){let c=pun.registerViewWelcomeContent2(s,l);for(let[u,p]of c)this.viewWelcomeContents.set(u,p)}})}};function mun(a,i){let e,t;if(a.group){if(!Ea(i.description,"contribViewsWelcome"))return i.collector.warn(d(16184,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 hun=Tn.registerExtensionPoint(eEo),qat=class{constructor(i){i.createInstance(o4t,hun)}};qat=I([m(0,F)],qat);oe.as(Qi.Workbench).registerWorkbenchContribution(qat,3);var n4t=d(16174,null),gun=L(16176,"Create");W(class extends K{constructor(){super({id:"welcome.showNewFileEntries",title:L(16183,"New File..."),category:gun,f1:!0,keybinding:{primary:2860,weight:200},menu:{id:D.MenubarFileMenu,group:"1_new",order:2}})}async run(a){return Oi(_G.Instance).run()}});var _G=class extends C{constructor(e,t,o,n,r){super();this.quickInputService=e;this.contextKeyService=t;this.commandService=o;this.keybindingService=n;_G.Instance=this,this._register({dispose(){_G.Instance===this&&(_G.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 Eo&&e.push({commandID:n.item.id,from:n.item.source?.title??n4t,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}=TI(),n=new P,r=this.quickInputService.createQuickPick({useSeparators:!0});r.title=d(16181,null),r.placeholder=d(16180,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===n4t?1:p.from===n4t?-1:u.from.localeCompare(p.from)},l={file:d(16177,null),notebook:d(16182,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(16175,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(16179,null,u),group:"file",from:n4t};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}};_G=I([m(0,Ge),m(1,X),m(2,ge),m(3,_e),m(4,qt)],_G);oe.as(Qi.Workbench).registerWorkbenchContribution(_G,3);fe.appendMenuItem(D.NewFile,{group:"file",command:{id:"workbench.action.files.newUntitledFile",title:d(16178,null)},order:1});var GUe=class{constructor(i,e,t,o){this.item=i;this.locations=e;this.model=t;this.parent=o}static compare(i,e){let t=Al(i.item.uri.toString(),e.item.uri.toString());return t===0&&(t=z.compareRangesUsingStarts(i.item.range,e.item.range)),t}},r4t=class{constructor(i){this.getDirection=i}hasChildren(){return!0}async getChildren(i){if(i instanceof lde)return i.roots.map(o=>new GUe(o,void 0,i,void 0));let{model:e,item:t}=i;return this.getDirection()==="outgoingCalls"?(await e.resolveOutgoingCalls(t,ve.None)).map(o=>new GUe(o.to,o.fromRanges.map(n=>({range:n,uri:t.uri})),e,i)):(await e.resolveIncomingCalls(t,ve.None)).map(o=>new GUe(o.from,o.fromRanges.map(n=>({range:n,uri:o.from.uri})),e,i))}},s4t=class{compare(i,e){return GUe.compare(i,e)}},a4t=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}},V0i=class{constructor(i,e){this.icon=i;this.label=e}},jat=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 Lc(i,{supportHighlights:!0});return new V0i(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(sh.toIcon(o.item.kind))),t.label.setLabel(o.item.name,o.item.detail,{labelEscapeNewLines:!0,matches:ua(n),strikethrough:r})}disposeTemplate(i){i.label.dispose()}},l4t=class{getHeight(i){return 22}getTemplateId(i){return jat.id}},c4t=class{constructor(i){this.getDirection=i}getWidgetAriaLabel(){return d(5269,null)}getAriaLabel(i){return this.getDirection()==="outgoingCalls"?d(5267,null,i.item.name):d(5268,null,i.item.name)}};var d4t=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}}},B0i=class extends nu{},kH=class extends bE{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 P;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(){d4t.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(p_)||Oe.transparent;this.style({arrowColor:t,frameColor:t,headerBackgroundColor:e.getColor(DW)||Oe.transparent,primaryHeadingColor:e.getColor(lO),secondaryHeadingColor:e.getColor(cO)})}_fillHead(e){super._fillHead(e,!0);let t=this._menuService.createMenu(kH.TitleMenu,this._contextKeyService),o=()=>{let n=Vm(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=d4t.retrieve(this._storageService),this._dim=new ai(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 vu(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(zc,n,r,{},this.editor);let s=document.createElement("div");s.classList.add("tree"),o.appendChild(s);let l={sorter:new s4t,accessibilityProvider:new c4t(()=>this._direction),identityProvider:new a4t(()=>this._direction),expandOnlyOnTwistieClick:!0,overrideStyles:{listBackground:x7}};this._tree=this._instantiationService.createInstance(B0i,"CallHierarchyPeek",s,new l4t,[this._instantiationService.createInstance(jat)],this._instantiationService.createInstance(r4t,()=>this._direction),l),this._splitView.addView({onDidChange:H.None,element:n,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:c=>{this._dim.height&&this._editor.layout({height:this._dim.height,width:c})}},Wl.Distribute),this._splitView.addView({onDidChange:H.None,element:s,minimumSize:100,maximumSize:Number.MAX_VALUE,layout:c=>{this._dim.height&&this._tree.layout(this._dim.height,c)}},Wl.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&&ag(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:Ss(dyt),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(5262,null,e.model.root.name):d(5263,null,e.model.root.name);this.setTitle(c)}showLoading(){this._parent.dataset.state="loading",this.setTitle(d(5266,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(5264,null,e.root.name):d(5265,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 ai(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))}};kH=I([m(3,De),m(4,Kq),m(5,ee),m(6,Nt),m(7,le),m(8,qt),m(9,X),m(10,F)],kH);var H0i=new Q("editorHasCallHierarchyProvider",!1,d(5253,null)),Yat=new Q("callHierarchyVisible",!1,d(5251,null)),Qat=new Q("callHierarchyDirection",void 0,{type:"string",description:d(5250,null)});function vun(a){return a==="outgoingCalls"||a==="incomingCalls"?a:"incomingCalls"}var kT=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 P;this._sessionDisposables=new P;this._ctxIsVisible=Yat.bindTo(this._contextKeyService),this._ctxHasProvider=H0i.bindTo(this._contextKeyService),this._ctxDirection=Qat.bindTo(this._contextKeyService),this._dispoables.add(H.any(i.onDidChangeModel,i.onDidChangeModelLanguage,cde.onDidChange)(()=>{this._ctxHasProvider.set(i.hasModel()&&cde.has(i.getModel()))})),this._dispoables.add(this._sessionDisposables)}static{this.Id="callHierarchy"}static get(i){return i.getContribution(kT.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(!cde.has(i))return;let t=new $e,o=lde.create(i,e,t.token),n=vun(this._storageService.get(kT._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(),kT.get(t)?._showCallHierarchyWidget(z.lift(o.root.selectionRange).getStartPosition(),this._widget.direction,Promise.resolve(o),new $e)}_showCallHierarchyWidget(i,e,t,o){this._ctxIsVisible.set(!0),this._ctxDirection.set(e),H.any(this._editor.onDidChangeModel,this._editor.onDidChangeModelLanguage)(this.endCallHierarchy,this,this._sessionDisposables),this._widget=this._instantiationService.createInstance(kH,this._editor,i,e),this._widget.showLoading(),this._sessionDisposables.add(this._widget.onDidClose(()=>{this.endCallHierarchy(),this._storageService.store(kT._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(5255,null)))}).catch(n=>{if(so(n)){this.endCallHierarchy();return}this._widget.showMessage(d(5254,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()}};kT=I([m(1,X),m(2,le),m(3,Kt),m(4,F)],kT);go(kT.Id,kT,0);W(class extends wl{constructor(){super({id:"editor.showCallHierarchy",title:L(5258,"Peek Call Hierarchy"),menu:{id:D.EditorContextPeek,group:"navigation",order:1e3,when:x.and(H0i,Gh.notInPeekEditor,ue.isInEmbeddedEditor.toNegated())},keybinding:{when:ue.editorTextFocus,weight:200,primary:1574},precondition:x.and(H0i,Gh.notInPeekEditor),f1:!0})}async runEditorCommand(i,e){return kT.get(e)?.startCallHierarchyFromEditor()}});W(class extends wl{constructor(){super({id:"editor.showIncomingCalls",title:L(5259,"Show Incoming Calls"),icon:Re("callhierarchy-incoming",M.callIncoming,d(5256,null)),precondition:x.and(Yat,Qat.isEqualTo("outgoingCalls")),keybinding:{weight:200,primary:1574},menu:{id:kH.TitleMenu,when:Qat.isEqualTo("outgoingCalls"),order:1}})}runEditorCommand(a,i){return kT.get(i)?.showIncomingCalls()}});W(class extends wl{constructor(){super({id:"editor.showOutgoingCalls",title:L(5260,"Show Outgoing Calls"),icon:Re("callhierarchy-outgoing",M.callOutgoing,d(5257,null)),precondition:x.and(Yat,Qat.isEqualTo("incomingCalls")),keybinding:{weight:200,primary:1574},menu:{id:kH.TitleMenu,when:Qat.isEqualTo("incomingCalls"),order:1}})}runEditorCommand(a,i){return kT.get(i)?.showOutgoingCalls()}});W(class extends wl{constructor(){super({id:"editor.refocusCallHierarchy",title:L(5261,"Refocus Call Hierarchy"),precondition:Yat,keybinding:{weight:200,primary:1027}})}async runEditorCommand(a,i){return kT.get(i)?.startCallHierarchyFromCallHierarchy()}});W(class extends wl{constructor(){super({id:"editor.closeCallHierarchy",title:d(5252,null),icon:M.close,precondition:Yat,keybinding:{weight:210,primary:9,when:x.not("config.editor.stablePeek")},menu:{id:kH.TitleMenu,order:1e3}})}runEditorCommand(a,i){return kT.get(i)?.endCallHierarchy()}});var $Ue=class{constructor(i,e,t){this.item=i;this.model=e;this.parent=t}static compare(i,e){let t=Al(i.item.uri.toString(),e.item.uri.toString());return t===0&&(t=z.compareRangesUsingStarts(i.item.range,e.item.range)),t}},u4t=class{constructor(i){this.getDirection=i}hasChildren(){return!0}async getChildren(i){if(i instanceof dde)return i.roots.map(o=>new $Ue(o,i,void 0));let{model:e,item:t}=i;return this.getDirection()==="supertypes"?(await e.provideSupertypes(t,ve.None)).map(o=>new $Ue(o,e,i)):(await e.provideSubtypes(t,ve.None)).map(o=>new $Ue(o,e,i))}},p4t=class{compare(i,e){return $Ue.compare(i,e)}},m4t=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}},U0i=class{constructor(i,e){this.icon=i;this.label=e}},Xat=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 Lc(i,{supportHighlights:!0});return new U0i(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(sh.toIcon(o.item.kind))),t.label.setLabel(o.item.name,o.item.detail,{labelEscapeNewLines:!0,matches:ua(n),strikethrough:r})}disposeTemplate(i){i.label.dispose()}},h4t=class{getHeight(i){return 22}getTemplateId(i){return Xat.id}},g4t=class{constructor(i){this.getDirection=i}getWidgetAriaLabel(){return d(15494,null)}getAriaLabel(i){return this.getDirection()==="supertypes"?d(15493,null,i.item.name):d(15492,null,i.item.name)}};var f4t=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}}},z0i=class extends nu{},EH=class extends bE{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 P;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(){f4t.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(p_)||Oe.transparent;this.style({arrowColor:t,frameColor:t,headerBackgroundColor:e.getColor(DW)||Oe.transparent,primaryHeadingColor:e.getColor(lO),secondaryHeadingColor:e.getColor(cO)})}_fillHead(e){super._fillHead(e,!0);let t=this._menuService.createMenu(EH.TitleMenu,this._contextKeyService),o=()=>{let n=Vm(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=f4t.retrieve(this._storageService),this._dim=new ai(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 vu(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(zc,n,r,{},this.editor);let s=document.createElement("div");s.classList.add("tree"),o.appendChild(s);let l={sorter:new p4t,accessibilityProvider:new g4t(()=>this._direction),identityProvider:new m4t(()=>this._direction),expandOnlyOnTwistieClick:!0,overrideStyles:{listBackground:x7}};this._tree=this._instantiationService.createInstance(z0i,"TypeHierarchyPeek",s,new h4t,[this._instantiationService.createInstance(Xat)],this._instantiationService.createInstance(u4t,()=>this._direction),l),this._splitView.addView({onDidChange:H.None,element:n,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:c=>{this._dim.height&&this._editor.layout({height:this._dim.height,width:c})}},Wl.Distribute),this._splitView.addView({onDidChange:H.None,element:s,minimumSize:100,maximumSize:Number.MAX_VALUE,layout:c=>{this._dim.height&&this._tree.layout(this._dim.height,c)}},Wl.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&&ag(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:Ss(dyt),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(15490,null,e.model.root.name):d(15489,null,e.model.root.name);this.setTitle(c)}showLoading(){this._parent.dataset.state="loading",this.setTitle(d(15491,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(15488,null,e.root.name):d(15487,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 ai(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))}};EH=I([m(3,De),m(4,Kq),m(5,ee),m(6,Nt),m(7,le),m(8,qt),m(9,X),m(10,F)],EH);var K0i=new Q("editorHasTypeHierarchyProvider",!1,d(15478,null)),Zat=new Q("typeHierarchyVisible",!1,d(15486,null)),Jat=new Q("typeHierarchyDirection",void 0,{type:"string",description:d(15485,null)});function Sun(a){return a==="subtypes"||a==="supertypes"?a:"subtypes"}var ET=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 P;this._sessionDisposables=new P;this._ctxHasProvider=K0i.bindTo(this._contextKeyService),this._ctxIsVisible=Zat.bindTo(this._contextKeyService),this._ctxDirection=Jat.bindTo(this._contextKeyService),this._disposables.add(H.any(i.onDidChangeModel,i.onDidChangeModelLanguage,ude.onDidChange)(()=>{this._ctxHasProvider.set(i.hasModel()&&ude.has(i.getModel()))})),this._disposables.add(this._sessionDisposables)}static{this.Id="typeHierarchy"}static get(i){return i.getContribution(ET.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(!ude.has(i))return;let t=new $e,o=dde.create(i,e,t.token),n=Sun(this._storageService.get(ET._storageDirectionKey,0,"subtypes"));this._showTypeHierarchyWidget(e,n,o,t)}_showTypeHierarchyWidget(i,e,t,o){this._ctxIsVisible.set(!0),this._ctxDirection.set(e),H.any(this._editor.onDidChangeModel,this._editor.onDidChangeModelLanguage)(this.endTypeHierarchy,this,this._sessionDisposables),this._widget=this._instantiationService.createInstance(EH,this._editor,i,e),this._widget.showLoading(),this._sessionDisposables.add(this._widget.onDidClose(()=>{this.endTypeHierarchy(),this._storageService.store(ET._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(15480,null)))}).catch(n=>{if(so(n)){this.endTypeHierarchy();return}this._widget.showMessage(d(15479,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(),ET.get(t)?._showTypeHierarchyWidget(z.lift(o.root.selectionRange).getStartPosition(),this._widget.direction,Promise.resolve(o),new $e)}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()}};ET=I([m(1,X),m(2,le),m(3,Kt),m(4,F)],ET);go(ET.Id,ET,0);W(class extends wl{constructor(){super({id:"editor.showTypeHierarchy",title:L(15481,"Peek Type Hierarchy"),menu:{id:D.EditorContextPeek,group:"navigation",order:1e3,when:x.and(K0i,Gh.notInPeekEditor)},precondition:x.and(K0i,Gh.notInPeekEditor),f1:!0})}async runEditorCommand(i,e){return ET.get(e)?.startTypeHierarchyFromEditor()}});W(class extends wl{constructor(){super({id:"editor.showSupertypes",title:L(15484,"Show Supertypes"),icon:M.typeHierarchySuper,precondition:x.and(Zat,Jat.isEqualTo("subtypes")),keybinding:{weight:200,primary:1574},menu:{id:EH.TitleMenu,when:Jat.isEqualTo("subtypes"),order:1}})}runEditorCommand(a,i){return ET.get(i)?.showSupertypes()}});W(class extends wl{constructor(){super({id:"editor.showSubtypes",title:L(15483,"Show Subtypes"),icon:M.typeHierarchySub,precondition:x.and(Zat,Jat.isEqualTo("supertypes")),keybinding:{weight:200,primary:1574},menu:{id:EH.TitleMenu,when:Jat.isEqualTo("supertypes"),order:1}})}runEditorCommand(a,i){return ET.get(i)?.showSubtypes()}});W(class extends wl{constructor(){super({id:"editor.refocusTypeHierarchy",title:L(15482,"Refocus Type Hierarchy"),precondition:Zat,keybinding:{weight:200,primary:1027}})}async runEditorCommand(a,i){return ET.get(i)?.startTypeHierarchyFromTypeHierarchy()}});W(class extends wl{constructor(){super({id:"editor.closeTypeHierarchy",title:d(15477,null),icon:M.close,precondition:Zat,keybinding:{weight:210,primary:9,when:x.not("config.editor.stablePeek")},menu:{id:EH.TitleMenu,order:1e3}})}runEditorCommand(a,i){return ET.get(i)?.endTypeHierarchy()}});var v4t=class{getKeyboardNavigationLabel(i){return i instanceof iw?i.label:i.symbol.name}},b4t=class{constructor(i){this._ariaLabel=i}getWidgetAriaLabel(){return this._ariaLabel}getAriaLabel(i){return i instanceof iw?i.label:Oht(i.symbol.name,i.symbol.kind)}},S4t=class{getId(i){return i.id}},qUe=class{constructor(i){this._instantiationService=i}getDragURI(i){let e=fO.get(i)?.uri;if(!e)return null;if(i instanceof _f){let t=Iun(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 _f?t.symbol.name:t.label}onDragStart(i,e){let o=i.elements[0];if(!o||!e.dataTransfer)return;let n=fO.get(o)?.uri;if(!n)return;let r=o instanceof _f?[o]:Array.from(o.children.values());_Ie(r.map(s=>({name:s.symbol.name,fsPath:n.fsPath,range:s.symbol.range,kind:s.symbol.kind})),e),this._instantiationService.invokeFunction(s=>Ig(s,r.map(l=>({resource:n,selection:l.symbol.range})),e))}onDragOver(){return!1}drop(){}dispose(){}};qUe=I([m(0,F)],qUe);function Iun(a,i){return fL(a,i.range)}var elt=class{constructor(i,e){this.labelContainer=i;this.label=e}static{this.id="DocumentSymbolGroupTemplate"}dispose(){this.label.dispose()}},tlt=class{constructor(i,e,t,o){this.container=i;this.iconLabel=e;this.iconClass=t;this.decoration=o}static{this.id="DocumentSymbolTemplate"}},I4t=class{getHeight(i){return 22}getTemplateId(i){return i instanceof iw?elt.id:tlt.id}},y4t=class{constructor(){this.templateId=elt.id}renderTemplate(i){let e=_(".outline-element-label");return i.classList.add("outline-element"),R(i,e),new elt(e,new Oa(e))}renderElement(i,e,t){t.label.set(i.element.label,ua(i.filterData))}disposeTemplate(i){i.dispose()}},jUe=class{constructor(i,e,t,o){this._renderMarker=i;this._configurationService=t;this._themeService=o;this.templateId=tlt.id}renderTemplate(i){i.classList.add("outline-element");let e=new Lc(i,{supportHighlights:!0}),t=_(".outline-element-icon"),o=_(".outline-element-decoration");return i.prepend(t),i.appendChild(o),new tlt(i,e,t,o)}renderElement(i,e,t){let{element:o}=i,n=["nowrap"],r={matches:ua(i.filterData),labelEscapeNewLines:!0,extraClasses:n,title:d(8318,null,o.symbol.name,nXt[o.symbol.kind])};this._configurationService.getValue("outline.icons")&&(t.iconClass.className="",t.iconClass.classList.add("outline-element-icon","inline","codicon-colored",...q.asClassNameArray(sh.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){xo(e.decoration),e.container.style.removeProperty("--outline-element-color");return}let{count:t,topSev:o}=i.marker,n=this._themeService.getColorTheme().getColor(o===8?uL:d9),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?xo(e.decoration):t>0?(bn(e.decoration),e.decoration.classList.remove("bubble"),e.decoration.textContent=t<10?t.toString():"+9",e.decoration.title=t===1?d(8315,null):d(8317,null,t),e.decoration.style.setProperty("--outline-element-color",r)):(bn(e.decoration),e.decoration.classList.add("bubble"),e.decoration.textContent="\uEA71",e.decoration.title=d(8316,null),e.decoration.style.setProperty("--outline-element-color",r))}disposeTemplate(i){i.iconLabel.dispose()}};jUe=I([m(2,B),m(3,De)],jUe);var DG=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=fO.get(i);if(!(i instanceof _f))return!0;let t=DG.kindToConfigName[i.symbol.kind],o=`${this._prefix}.${t}`;return this._textResourceConfigService.getValue(e?.uri,o)}};DG=I([m(1,Nn)],DG);var w4t=class{constructor(){this._collator=Wu.Collator(void 0,{numeric:!0})}compareByPosition(i,e){return i instanceof iw&&e instanceof iw?i.order-e.order:i instanceof _f&&e instanceof _f?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 iw&&e instanceof iw?i.order-e.order:i instanceof _f&&e instanceof _f?i.symbol.kind-e.symbol.kind||this._collator.value.compare(i.symbol.name,e.symbol.name):0}compareByName(i,e){return i instanceof iw&&e instanceof iw?i.order-e.order:i instanceof _f&&e instanceof _f?this._collator.value.compare(i.symbol.name,e.symbol.name)||z.compareRangesUsingStarts(i.symbol.range,e.symbol.range):0}};var ilt=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 _f?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 fO||r instanceof iw&&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 _f))return!1;let e=`breadcrumbs.${DG.kindToConfigName[i.symbol.kind]}`,t;return this._editor&&this._editor.getModel()&&(t=this._editor.getModel().uri),!this._textResourceConfigurationService.getValue(t,e)}};ilt=I([m(1,Nn)],ilt);var olt=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 P;this._onDidChange=this._disposables.add(new E);this.onDidChange=this._onDidChange.event;this._outlineDisposables=new P;this.outlineKind="documentSymbols";this._breadcrumbsDataSource=new ilt(i,c);let p=new I4t,h=[new y4t,u.createInstance(jUe,!0,e)],g={getChildren:y=>y instanceof _f||y instanceof iw?y.children.values():y===this&&this._outlineModel?this._outlineModel.children.values():[]},f=new w4t,v=c.getValue(i.getModel()?.uri,"outline.collapseItems"),b={collapseByDefault:e===2||e===1&&v==="alwaysCollapse",expandOnlyOnTwistieClick:!0,multipleSelectionSupport:!1,identityProvider:new S4t,keyboardNavigationLabelProvider:new v4t,accessibilityProvider:new b4t(d(8314,null)),filter:e===1?u.createInstance(DG,"outline"):e===2?u.createInstance(DG,"breadcrumbs"):void 0,dnd:u.createInstance(qUe)};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 Nl;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||OL.empty(this._outlineModel)}get uri(){return this._outlineModel?.uri}async reveal(i,e,t,o){let n=fO.get(i);!n||!(i instanceof _f)||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 _f))return C.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 $e,o=e.getVersionId(),n=new Nl;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(OL.empty(r)||!this._editor.hasModel()){this._setOutlineModel(r);return}if(i&&this._outlineModel&&e.getLineCount()>=25){let s=OL.size(r),l=e.getValueLength(),c=s/l,u=OL.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 wa(Pi(2e3).then(()=>!0),t.token,!1))return}this._applyMarkersToOutline(r),this._outlineDisposables.add(this._markerDecorationsService.onDidChangeMarker(s=>{Xe(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({})}};olt=I([m(3,zt),m(4,Kt),m(5,f_),m(6,B),m(7,RU),m(8,Nn),m(9,F)],olt);var nlt=class{constructor(i){let e=i.registerOutlineCreator(this);this.dispose=()=>e.dispose()}matches(i){let e=i.getControl();return pn(e)||Ec(e)}async createOutline(i,e,t){let o=i.getControl(),n;if(pn(o)?n=o:Ec(o)&&(n=o.getModifiedEditor()),!n)return;let r=new Np,s=n.invokeWithinContext(l=>l.get(F).createInstance(olt,n,e,r));return await r.wait(),s}};nlt=I([m(0,kR)],nlt);oe.as(Qi.Workbench).registerWorkbenchContribution(nlt,4);var C4t=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 G0i=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)}},QUe=class extends zr{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 P;this._editorControlDisposables=new P;this._editorPaneDisposables=new P;this._outlineViewState=new C4t;this._editorListener=new me;this._treeStates=new il(10);this._editorControlChangePromise=Promise.resolve();this._outlineViewState.restore(this._storageService),this._disposables.add(this._outlineViewState),u.bufferChangeEvents(()=>{this._ctxFollowsCursor=BVt.bindTo(u),this._ctxFilterOnType=HVt.bindTo(u),this._ctxSortMode=IMe.bindTo(u),this._ctxAllCollapsed=VZe.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 fb(t,kx),this._treeContainer=_(".outline-tree"),R(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=H.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 ai(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=no.getOriginalUri(e?.input),o=this._captureViewState();if(this._editorControlDisposables.clear(),!e||!this._outlineService.canCreateOutline(e)||!t)return this._showMessage(d(12193,null));let n;o||(n=new Nl(()=>{this._showMessage(d(12192,null,Ye(t)))},100)),this._progressBar.infinite().show(500);let r=new $e;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 G0i(s.config.comparator,this._outlineViewState.sortBy),c=this._instantiationService.createInstance(pO,"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});edo.bindTo(c.contextKeyService);let u=()=>{if(s.isEmpty)this._showMessage(d(12194,null,Ye(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&&A5e.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 Pi(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}))}};QUe=I([m(1,kR),m(2,F),m(3,Ri),m(4,le),m(5,ee),m(6,B),m(7,_e),m(8,X),m(9,ze),m(10,Qe),m(11,De),m(12,tt)],QUe);W(class extends Fn{constructor(){super({viewId:gy.Id,id:"outline.collapse",title:d(12185,null),f1:!1,icon:M.collapseAll,menu:{id:D.ViewTitle,group:"navigation",when:x.and(x.equals("view",gy.Id),VZe.isEqualTo(!1))}})}runInView(i,e){e.collapseAll()}});W(class extends Fn{constructor(){super({viewId:gy.Id,id:"outline.expand",title:d(12186,null),f1:!1,icon:M.expandAll,menu:{id:D.ViewTitle,group:"navigation",when:x.and(x.equals("view",gy.Id),VZe.isEqualTo(!0))}})}runInView(i,e){e.expandAll()}});W(class extends Fn{constructor(){super({viewId:gy.Id,id:"outline.followCursor",title:d(12188,null),f1:!1,toggled:BVt,menu:{id:D.ViewTitle,group:"config",order:1,when:x.equals("view",gy.Id)}})}runInView(i,e){e.outlineViewState.followCursor=!e.outlineViewState.followCursor}});W(class extends Fn{constructor(){super({viewId:gy.Id,id:"outline.filterOnType",title:d(12187,null),f1:!1,toggled:HVt,menu:{id:D.ViewTitle,group:"config",order:2,when:x.equals("view",gy.Id)}})}runInView(i,e){e.outlineViewState.filterOnType=!e.outlineViewState.filterOnType}});W(class extends Fn{constructor(){super({viewId:gy.Id,id:"outline.sortByPosition",title:d(12191,null),f1:!1,toggled:IMe.isEqualTo(0),menu:{id:D.ViewTitle,group:"sort",order:1,when:x.equals("view",gy.Id)}})}runInView(i,e){e.outlineViewState.sortBy=0}});W(class extends Fn{constructor(){super({viewId:gy.Id,id:"outline.sortByName",title:d(12190,null),f1:!1,toggled:IMe.isEqualTo(1),menu:{id:D.ViewTitle,group:"sort",order:2,when:x.equals("view",gy.Id)}})}runInView(i,e){e.outlineViewState.sortBy=1}});W(class extends Fn{constructor(){super({viewId:gy.Id,id:"outline.sortByKind",title:d(12189,null),f1:!1,toggled:IMe.isEqualTo(2),menu:{id:D.ViewTitle,group:"sort",order:3,when:x.equals("view",gy.Id)}})}runInView(i,e){e.outlineViewState.sortBy=2}});var yun=Re("outline-view-icon",M.symbolClass,d(12184,null));oe.as(on.ViewsRegistry).registerViews([{id:gy.Id,name:L(12175,"Outline"),containerIcon:yun,ctorDescriptor:new Mt(QUe),canToggleVisibility:!0,canMoveView:!0,hideByDefault:!1,collapsed:!0,order:2,weight:30,focusCommand:{id:"outline.focus"}}],Vge);oe.as(ii.Configuration).registerConfiguration({id:"outline",order:117,title:d(12183,null),type:"object",properties:{"outline.icons":{description:d(12181,null),type:"boolean",default:!0},"outline.collapseItems":{description:d(12176,null),type:"string",scope:6,enum:["alwaysCollapse","alwaysExpand"],enumDescriptions:[d(12177,null),d(12178,null)],default:"alwaysExpand"},"outline.problems.enabled":{markdownDescription:d(12182,null,"`#problems.visibility#`"),type:"boolean",default:!0},"outline.problems.colors":{markdownDescription:d(12179,null,"`#problems.visibility#`"),type:"boolean",default:!0},"outline.problems.badges":{markdownDescription:d(12180,null,"`#problems.visibility#`"),type:"boolean",default:!0},"outline.showFiles":{type:"boolean",scope:6,default:!0,markdownDescription:d(12158,null)},"outline.showModules":{type:"boolean",scope:6,default:!0,markdownDescription:d(12163,null)},"outline.showNamespaces":{type:"boolean",default:!0,scope:6,markdownDescription:d(12164,null)},"outline.showPackages":{type:"boolean",default:!0,scope:6,markdownDescription:d(12169,null)},"outline.showClasses":{type:"boolean",default:!0,scope:6,markdownDescription:d(12151,null)},"outline.showMethods":{type:"boolean",default:!0,scope:6,markdownDescription:d(12162,null)},"outline.showProperties":{type:"boolean",default:!0,scope:6,markdownDescription:d(12170,null)},"outline.showFields":{type:"boolean",default:!0,scope:6,markdownDescription:d(12157,null)},"outline.showConstructors":{type:"boolean",default:!0,scope:6,markdownDescription:d(12153,null)},"outline.showEnums":{type:"boolean",default:!0,scope:6,markdownDescription:d(12154,null)},"outline.showInterfaces":{type:"boolean",default:!0,scope:6,markdownDescription:d(12160,null)},"outline.showFunctions":{type:"boolean",default:!0,scope:6,markdownDescription:d(12159,null)},"outline.showVariables":{type:"boolean",default:!0,scope:6,markdownDescription:d(12174,null)},"outline.showConstants":{type:"boolean",default:!0,scope:6,markdownDescription:d(12152,null)},"outline.showStrings":{type:"boolean",default:!0,scope:6,markdownDescription:d(12171,null)},"outline.showNumbers":{type:"boolean",default:!0,scope:6,markdownDescription:d(12166,null)},"outline.showBooleans":{type:"boolean",scope:6,default:!0,markdownDescription:d(12150,null)},"outline.showArrays":{type:"boolean",default:!0,scope:6,markdownDescription:d(12149,null)},"outline.showObjects":{type:"boolean",default:!0,scope:6,markdownDescription:d(12167,null)},"outline.showKeys":{type:"boolean",default:!0,scope:6,markdownDescription:d(12161,null)},"outline.showNull":{type:"boolean",default:!0,scope:6,markdownDescription:d(12165,null)},"outline.showEnumMembers":{type:"boolean",default:!0,scope:6,markdownDescription:d(12155,null)},"outline.showStructs":{type:"boolean",default:!0,scope:6,markdownDescription:d(12172,null)},"outline.showEvents":{type:"boolean",default:!0,scope:6,markdownDescription:d(12156,null)},"outline.showOperators":{type:"boolean",default:!0,scope:6,markdownDescription:d(12168,null)},"outline.showTypeParameters":{type:"boolean",default:!0,scope:6,markdownDescription:d(12173,null)}}});var $0i="editor.detectLanguage",jfe=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 P;this._delayer=new ya(1e3);this._renderDisposables=new P;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=ca(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!==Y.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(10796,null,p),$0i),g={name:d(10794,null),ariaLabel:d(10793,null,l),tooltip:h,command:$0i,text:"$(lightbulb-autofix)"};this._combinedEntry?this._combinedEntry.update(g):this._combinedEntry=this._statusBarService.addEntry(g,jfe._id,1,{location:{id:"status.editor.mode",priority:100.1},alignment:1,compact:!0})}else this._combinedEntry?.dispose(),this._combinedEntry=void 0}}};jfe=I([m(0,eS),m(1,Tr),m(2,B),m(3,ee),m(4,kt),m(5,_e)],jfe);oe.as(Qi.Workbench).registerWorkbenchContribution(jfe,3);W(class extends K{constructor(){super({id:$0i,title:L(10792,"Detect Language from Content"),f1:!0,precondition:x.and(Kl.toNegated(),ue.editorTextFocus),keybinding:{primary:1570,weight:200}})}async run(a){let i=a.get(ee),e=a.get(eS),t=ca(i.activeTextEditorControl),o=a.get(Ne),n=t?.getModel()?.uri;if(n){let r=await e.detectLanguage(n);r?t.getModel()?.setLanguage(r,L8e):o.warn(d(10795,null))}}});var x4t=class{constructor(i,e){this.combined=i;this.dedicated=e}isEqual(i){return $i(this.combined,i.combined)&&$i(this.dedicated,i.dedicated)}},rlt=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}};rlt=I([m(0,le)],rlt);var Qfe=class extends C{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 P;H.once(e.onWillDispose)(()=>t.dispose());let o=this.editorGroupService.getScopedInstantiationService(e);t.add(o.createInstance(TT))}};Qfe=I([m(0,Et)],Qfe);var TT=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 P;this._dedicated=new Set;this._dedicatedEntries=new Map;this._renderDisposables=new P;this._combinedEntryTooltip=document.createElement("div");r.onDidChangeValue(0,TT._keyDedicatedItems,this._disposables)(this._handleStorageChange,this,this._disposables),this._restoreState(),this._interactionCounter=new rlt(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(),Ue(this._dedicatedEntries.values()),this._renderDisposables.dispose()}_handleStorageChange(){this._restoreState(),this._update()}_restoreState(){let i=this._storageService.get(TT._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(TT._keyDedicatedItems,0);else{let i=JSON.stringify(Array.from(this._dedicated.keys()));this._storageService.store(TT._keyDedicatedItems,i,0,0)}}_createViewModel(i){if(!i?.hasModel())return new x4t([],[]);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 x4t(t,o)}_update(){let i=ca(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>=gt.Warning,r=TT._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(TT._accessibilityInformation(f).label),s=s||!v&&f.busy}let c={name:d(10800,null),ariaLabel:d(10799,null,l.join(", next: ")),tooltip:this._combinedEntryTooltip,command:GL,text:s?"$(loading~spin)":r};this._combinedEntry?this._combinedEntry.update(c):this._combinedEntry=this._statusBarService.addEntry(c,TT._id,1,{location:{id:"status.editor.mode",priority:100.1},alignment:0,compact:!0});let u=this._interactionCounter.value>=3,p=Me(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(Ao(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(Ao(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=TT._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)}Ue(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=TT._severityToSingleCodicon(e.severity);R(s,...Bn(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;R(u,...Bn(nEo(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 Xg(h,{label:g.title,title:g.tooltip,href:A.from({scheme:"command",path:g.id,query:g.arguments&&JSON.stringify(g.arguments)}).toString()},{hoverDelegate:US},this._hoverService,this._openerService));let f=new ji(h,{hoverDelegate:US}),v=o?d(10804,null):d(10802,null);f.setAriaLabel(v),n.add(f);let b;return o?b=new st("unpin",v,q.asClassName(M.pinned),!0,()=>{this._dedicated.delete(e.id),this._statusBarService.updateEntryVisibility(e.id,!1),this._update(),this._storeState()}):b=new st("pin",v,q.asClassName(M.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 gt.Error:return"$(bracket-error)";case gt.Warning:return"$(bracket-dot)";default:return"$(bracket)"}}static _severityToSingleCodicon(i){switch(i){case gt.Error:return"$(error)";case gt.Warning:return"$(info)";default:return"$(check)"}}_renderTextPlus(i,e,t){let o=!1;for(let n of lS(e).nodes)if(o||(R(i,_("span.separator")),o=!0),typeof n=="string"){let r=Bn(n);R(i,...r)}else t.add(new Xg(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(10797,null,e,i.detail)}:{label:d(10798,null,e)}}static _asStatusbarEntry(i){let e;i.severity===gt.Warning?e="warning":i.severity===gt.Error&&(e="error");let t=typeof i.label=="string"?i.label:i.label.shortValue;return{name:d(10801,null,i.name),text:nEo(t,i.busy),ariaLabel:TT._accessibilityInformation(i).label,role:i.accessibilityInfo?.role,tooltip:i.command?.tooltip||new xe(i.detail,{isTrusted:!0,supportThemeIcons:!0}),kind:e,command:i.command}}};TT=I([m(0,kV),m(1,Tr),m(2,ee),m(3,tt),m(4,Qe),m(5,le)],TT);var k4t=class extends K{constructor(){super({id:"editor.inlayHints.Reset",title:L(10803,"Reset Language Status Interaction Counter"),category:We.View,f1:!0})}run(i){i.get(le).remove("languageStatus.interactCount",0)}};function nEo(a,i){return s1i([a!==""&&a,i&&"$(loading~spin)"],"\xA0\xA0")}pt(Qfe.Id,Qfe,ut.AfterRestored);W(k4t);var E4t=class extends K{constructor(){super({id:"_signOutOfAccount",title:d(5081,null),f1:!1})}async run(i,{providerId:e,accountLabel:t}){let o=i.get(Cs),n=i.get(OP),r=i.get(Gx),s=i.get(ct);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:gt.Info,message:u.length?d(5079,null,t,u.map(h=>h.extensionName).join(`
`)):d(5080,null,t),primaryButton:d(5078,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 T4t=class extends K{constructor(){super({id:"_manageTrustedExtensionsForAccount",title:L(5059,"Manage Trusted Extensions For Account"),category:L(5055,"Accounts"),f1:!0})}run(i,e){return i.get(F).createInstance(slt).run(e)}},slt=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(5065,null),iconClass:q.asClassName(M.info)};this._managePreferencesButton={tooltip:d(5054,null),iconClass:q.asClassName(M.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(5062,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(5060,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(5063,null)},...r.sort(l).map(c)]}_toQuickPickItem(i){let e=i.lastUsed,t=e?d(5053,null,Bs(e,!0)):d(5061,null),o,n;return i.trusted&&(o=d(5064,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 P,t=e.add(this._quickInputService.createQuickPick({useSeparators:!0}));return t.canSelectMany=!0,t.customButton=!0,t.customLabel=d(5058,null),t.customButtonSecondary=!0,t.title=d(5057,null),t.placeholder=d(5056,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}};slt=I([m(0,lt),m(1,ct),m(2,Ge),m(3,Cs),m(4,RR),m(5,ge),m(6,zi)],slt);var _4t=class extends K{constructor(){super({id:"_manageAccountPreferencesForExtension",title:L(5015,"Manage Extension Account Preferences..."),category:L(5013,"Accounts"),f1:!0,menu:[{id:D.AccountsContext,order:100}]})}run(i,e,t){return i.get(F).createInstance(alt).run(e,t)}},alt=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(5020,null),title:d(5018,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(5017,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(5021,null),title:d(5018,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(5023,null)}))}let l=new P,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(5019,null,t,o),n.title=d(5022,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(5014,null),picked:!0}:{label:o.label,account:o,providerId:e})}_handleNoAccounts(i){return i.validationMessage=d(5016,null),i.buttons=[this._quickInputService.backButton],i.show(),H.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)}}};alt=I([m(0,Cs),m(1,Ge),m(2,ct),m(3,RR),m(4,lt),m(5,ne)],alt);var D4t=class extends K{constructor(){super({id:"_manageAccountPreferencesForMcpServer",title:L(5026,"Manage MCP Server Account Preferences"),category:L(5024,"Accounts"),f1:!1})}run(i,e,t){return i.get(F).createInstance(llt).run(e,t)}},llt=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(5028,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(5031,null),title:d(5029,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(5033,null)}))}let l=new P,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(5030,null,t,o),n.title=d(5032,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(5025,null),picked:!0}:{label:o.label,account:o,providerId:e})}_handleNoAccounts(i){return i.validationMessage=d(5027,null),i.buttons=[this._quickInputService.backButton],i.show(),H.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)}}};llt=I([m(0,Cs),m(1,Ge),m(2,ct),m(3,RR),m(4,es),m(5,ne)],llt);var L4t=class extends K{constructor(){super({id:"_manageTrustedMCPServersForAccount",title:L(5072,"Manage Trusted MCP Servers For Account"),category:L(5068,"Accounts"),f1:!0,precondition:ie.Setup.hidden.negate()})}run(i,e){return i.get(F).createInstance(clt).run(e)}},clt=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(5075,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(5073,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(5076,null)},...n.sort(s).map(this._toQuickPickItem)]}_toQuickPickItem(i){let e=i.lastUsed,t=e?d(5066,null,Bs(e,!0)):d(5074,null),o,n;return i.trusted&&(o=d(5077,null),n=!0),{label:i.name,mcpServer:i,description:t,tooltip:o,disabled:n,buttons:[{tooltip:d(5067,null),iconClass:q.asClassName(M.settingsGear)}],picked:i.allowed===void 0||i.allowed}}_createQuickPick(i){let e=new P,t=e.add(this._quickInputService.createQuickPick({useSeparators:!0}));return t.canSelectMany=!0,t.customButton=!0,t.customLabel=d(5071,null),t.customButtonSecondary=!0,t.title=d(5070,null),t.placeholder=d(5069,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}};clt=I([m(0,es),m(1,ct),m(2,Ge),m(3,Cs),m(4,RR),m(5,ge)],clt);var R4t=class a extends K{static{this.ID="workbench.action.removeDynamicAuthenticationProviders"}constructor(){super({id:a.ID,title:L(5051,"Remove Dynamic Authentication Providers"),category:L(5043,"Authentication"),f1:!0})}async run(i){let e=i.get(Ge),t=i.get(YX),o=i.get(Cs),n=i.get(ct),r=t.getInteractedProviders();if(r.length===0){await n.info(d(5048,null),d(5049,null));return}let s=r.map(h=>({label:h.label,description:d(5044,null,h.clientId),provider:h})),l=await e.pick(s,{placeHolder:d(5052,null),canPickMany:!0});if(!l||l.length===0)return;let c=l.map(h=>h.provider.label).join(", "),u=l.length===1?d(5047,null,c):d(5046,null,l.length,c);if((await n.confirm({message:u,detail:d(5045,null),primaryButton:d(5050,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 M4t=class extends K{constructor(){super({id:"workbench.action.manageAccounts",title:L(5036,"Manage Accounts"),category:L(5034,"Accounts"),f1:!0})}run(i){return i.get(F).createInstance(dlt).run()}},dlt=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(5040,null),e=await this.listAccounts();if(!e.length){await this.quickInputService.pick([{label:d(5039,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(()=>RTe(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 P,s=r.add(this.quickInputService.createQuickPick());s.title=d(5035,null,t),s.placeholder=d(5041,null),s.buttons=[this.quickInputService.backButton];let l=[{label:d(5037,null),action:()=>this.commandService.executeCommand("_manageTrustedExtensionsForAccount",{providerId:e,accountLabel:t})}];o&&l.push({label:d(5038,null),action:()=>this.commandService.executeCommand("_manageTrustedMCPServersForAccount",{providerId:e,accountLabel:t})}),await n()&&l.push({label:d(5042,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()}};dlt=I([m(0,Ge),m(1,Cs),m(2,ge),m(3,LE),m(4,nt)],dlt);var wun=qe.registerCommand("workbench.getCodeExchangeProxyEndpoints",function(a,i){return a.get(ru).options?.codeExchangeProxyEndpoints}),q0i=class extends C{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(5084,null),d(5083,null),d(5085,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:()=>{}}}},Cun=oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:"authentication",label:d(5082,null),access:{canToggle:!1},renderer:new Mt(q0i)}),P4t=class extends C{static{this.ID="workbench.contrib.authentication"}constructor(){super(),this._register(wun),this._register(Cun),this._registerActions()}_registerActions(){this._register(W(M4t)),this._register(W(E4t)),this._register(W(T4t)),this._register(W(_4t)),this._register(W(L4t)),this._register(W(D4t)),this._register(W(R4t))}},YUe=class{constructor(i){this._authenticationUsageService=i;this._initializeExtensionUsageCache()}static{this.ID="workbench.contrib.authenticationUsage"}async _initializeExtensionUsageCache(){await this._authenticationUsageService.initializeExtensionUsageCache()}};YUe=I([m(0,OP)],YUe);pt(P4t.ID,P4t,ut.AfterRestored);pt(YUe.ID,YUe,ut.Eventually);var XUe=class extends eD{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(R(e,_("")));let t=this;this.treeView.message=d(15806,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:Ye(l.remoteResource),strikethrough:l.mergeState==="accepted"&&(l.localChange===3||l.remoteChange===3)},description:Rv(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:Qy(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(15812,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(15811,null),icon:M.cloudDownload,menu:{id:D.ViewItemContext,when:x.and(x.equals("view",QJ),x.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(15810,null),icon:M.cloudUpload,menu:{id:D.ViewItemContext,when:x.and(x.equals("view",QJ),x.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})=>Xe(r,e.localResource))))return;let t=d(15808,null,Ye(e.remoteResource)),o=d(15807,null,Ye(e.remoteResource));await this.editorService.openEditor({input1:{resource:e.remoteResource,label:d(15809,null),description:t},input2:{resource:e.localResource,label:d(15813,null),description:o},base:{resource:e.baseResource},result:{resource:e.previewResource},options:{preserveFocus:!0,revealIfVisible:!0,pinned:!0,override:Ys.id}})}};XUe=I([m(1,ee),m(2,_e),m(3,ze),m(4,B),m(5,X),m(6,Ri),m(7,F),m(8,Qe),m(9,De),m(10,Ne),m(11,tt),m(12,aI),m(13,lI),m(14,_l),m(15,an),m(16,C_e)],XUe);var JUe=class extends C{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=oe.as(on.ViewsRegistry),o=L(15815,"Conflicts"),n={id:QJ,name:o,ctorDescriptor:new Mt(XUe),when:x.and(OFt,jJ),canToggleVisibility:!1,canMoveView:!1,treeView:this.instantiationService.createInstance(pK,QJ,o.value),collapsed:!1,order:100};t.registerViews([n],e)}registerMachinesView(e){let t="workbench.views.sync.machines",o=L(15831,"Synced Machines"),n=this.instantiationService.createInstance(pK,t,o.value),r=this.instantiationService.createInstance(mlt,n);n.showRefreshAction=!0,n.canSelectMany=!0,n.dataProvider=r,this._register(H.any(this.userDataSyncMachinesService.onDidChange,this.userDataSyncService.onDidResetRemote)(()=>n.refresh()));let s=oe.as(on.ViewsRegistry),l={id:t,name:o,ctorDescriptor:new Mt(eD),when:x.and(py.notEqualsTo("uninitialized"),nB.isEqualTo("available"),tpe),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(15838,null),icon:M.edit,menu:{id:D.ViewItemContext,when:x.and(x.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(15842,null),menu:{id:D.ViewItemContext,when:x.and(x.equals("view",t),x.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(15824,"Sync Activity (Remote)"):L(15820,"Sync Activity (Local)"),r=this.instantiationService.createInstance(pK,o,n.value);r.showCollapseAllAction=!0,r.showRefreshAction=!0,r.dataProvider=t?this.instantiationService.createInstance(ult):this.instantiationService.createInstance(j0i),this._register(H.any(this.userDataSyncEnablementService.onDidChangeResourceEnablement,this.userDataSyncEnablementService.onDidChangeEnablement,this.userDataSyncService.onDidResetLocal,this.userDataSyncService.onDidResetRemote)(()=>r.refresh()));let s=oe.as(on.ViewsRegistry),l={id:o,name:n,ctorDescriptor:new Mt(eD),when:x.and(py.notEqualsTo("uninitialized"),nB.isEqualTo("available"),tpe),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(15817,"Sync Activity (Developer)"),n=this.instantiationService.createInstance(plt,void 0),r=this.instantiationService.createInstance(pK,t,o.value);r.showCollapseAllAction=!1,r.showRefreshAction=!1,r.dataProvider=n;let s=oe.as(on.ViewsRegistry),l={id:t,name:o,ctorDescriptor:new Mt(eD),when:tpe,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(15839,null),icon:M.cloudUpload,menu:{id:D.ViewTitle,when:x.equals("view",t),group:"navigation"}})}async run(c){let p=await c.get(dn).showOpenDialog({title:d(15828,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(15841,null),menu:{id:D.ViewItemContext,when:x.and(x.equals("view",e),x.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(15837,null),menu:{id:D.ViewItemContext,when:x.and(x.equals("view",e),x.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(NC,l,c,d(15825,null,d(15819,null,Ye(l)),d(15827,null,Ye(c))),void 0)}})),this._register(W(class extends K{constructor(){super({id:`workbench.actions.sync.${e}.replaceCurrent`,title:d(15840,null),icon:M.discard,menu:{id:D.ViewItemContext,when:x.and(x.equals("view",e),x.regex("viewItem",/sync-resource-.*/i),x.notEquals("viewItem","sync-resource-profiles")),group:"inline"}})}async run(t,o){let n=t.get(ct),r=t.get(aI),{syncResourceHandle:s,syncResource:l}=JSON.parse(o.$treeItemHandle);if((await n.confirm({message:d(15814,null,Rv(l)),type:"info",title:Ch.value})).confirmed)return r.replace({created:s.created,uri:A.revive(s.uri)})}}))}registerTroubleShootView(e){let t="workbench.views.sync.troubleshoot",o=L(15832,"Troubleshoot"),n=this.instantiationService.createInstance(pK,t,o.value),r=this.instantiationService.createInstance(hlt);n.showRefreshAction=!0,n.dataProvider=r;let s=oe.as(on.ViewsRegistry),l={id:t,name:o,ctorDescriptor:new Mt(eD),when:tpe,canToggleVisibility:!0,canMoveView:!1,treeView:n,collapsed:!1,order:500,hideByDefault:!0};s.registerViews([l],e)}};JUe=I([m(1,F),m(2,_l),m(3,XJ),m(4,aI)],JUe);var Yfe=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 Cg||(e=Cg.toUserDataSyncError(e)),e instanceof Cg&&e.code==="IncompatibleRemoteContent"?this.notificationService.notify({severity:St.Error,message:e.message,actions:{primary:[pi({id:"reset",label:d(15826,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=>Ye(c.resource)===Ye(n))?.resource;return{handle:s,collapsibleState:0,resourceUri:n,command:l?{id:NC,title:"",arguments:[l,n,d(15829,null,`${Ye(n)} (${Bs(e.previous.created,!0)})`,`${Ye(n)} (${Bs(e.created,!0)})`),void 0]}:{id:Zh,title:"",arguments:[n,void 0,void 0]},contextValue:`sync-associatedResource-${e.syncResource}`}})}async getSyncResourceHandles(i){let e=[],o=(await Promise.all($ue.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:Rv(n.syncResource)},description:Bs(n.created,!0),tooltip:new Date(n.created).toLocaleString(),themeIcon:X$,syncResourceHandle:n,contextValue:`sync-resource-${n.syncResource}`})}return e}};Yfe=I([m(0,aI),m(1,DDe),m(2,JE),m(3,lI),m(4,Ne),m(5,an)],Yfe);var j0i=class extends Yfe{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}))}},ult=class extends Yfe{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(15816,null):r?.name}}return t}};ult=I([m(0,aI),m(1,DDe),m(2,JE),m(3,XJ),m(4,lI),m(5,Ne),m(6,an)],ult);var plt=class extends Yfe{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(15816,null):r?.name}}return t}getMachines(){return this.machinesPromise===void 0&&(this.machinesPromise=this.userDataSyncResourceProviderService.getLocalSyncedMachines(this.activityDataLocation)),this.machinesPromise}};plt=I([m(1,aI),m(2,DDe),m(3,JE),m(4,lI),m(5,Ne),m(6,an),m(7,be),m(8,dt)],plt);var mlt=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(15821,null),e.map(({id:t,name:o,isCurrent:n,platform:r})=>({handle:t,collapsibleState:0,label:{label:o},description:n?d(15816,null):void 0,themeIcon:r&&Jro(r)?M.globe:M.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(15822,null,i.join(",")));if(!(await this.dialogService.confirm({type:"info",message:t.length>1?d(15835,null):d(15834,null,t[0].name),primaryButton:d(15833,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 P,t=e.add(this.quickInputService.createInputBox());t.placeholder=d(15823,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(15822,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(15836,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)}))})}};mlt=I([m(1,XJ),m(2,Ge),m(3,Ne),m(4,ct),m(5,lI)],mlt);var hlt=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(15830,null)},themeIcon:M.folder},{handle:"LAST_SYNC_STATES",collapsibleState:1,label:{label:d(15818,null)},themeIcon:M.folder}]}async getLastSyncStates(){let i=[];for(let e of $ue){let t=aXe(void 0,e,this.environmentService,this.uriIdentityService.extUri);await this.fileService.exists(t)&&i.push({handle:t.toString(),label:{label:Rv(e)},collapsibleState:0,resourceUri:t,command:{id:Zh,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(15816,null):void 0,command:{id:Zh,title:"",arguments:[t,void 0,void 0]}})}return e}};hlt=I([m(0,be),m(1,lI),m(2,Co),m(3,dt)],hlt);var A4t={id:"workbench.userDataSync.actions.turnOff",title:L(15774,"Turn Off")},N4t={id:PXe,title:L(15736,"Configure...")},rEo="workbench.userDataSync.actions.showConflicts",glt={id:"workbench.userDataSync.actions.syncNow",title:L(15778,"Sync Now"),description(a){if(a.status==="syncing")return d(15781,null);if(a.lastSyncTime)return d(15780,null,Bs(a.lastSyncTime,!0))}},O4t={id:"workbench.userDataSync.actions.settings",title:L(15779,"Show Settings")},F4t={id:"workbench.userDataSync.actions.showSyncedData",title:L(15767,"Show Synced Data")},W4t=new Q("userDataSyncTurningOn",!1),ZUe=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N,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=N;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=W4t.bindTo(n),o.enabled&&(Pro(),this.updateAccountBadge(),this.updateGlobalActivityBadge(),this.onDidChangeConflicts(this.userDataSyncService.conflicts),this._register(H.any(H.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(U=>this.onSynchronizerErrors(U))),this._register(f.onError(U=>this.onAutoSyncError(U))),this.registerActions(),this.registerViews(),v.registerTextModelContentProvider(HC,h.createInstance(flt)),this._register(H.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=Rv(t.syncResource),r=this.notificationService.prompt(St.Warning,d(15739,null,n.toLowerCase()),[{label:d(15755,null),run:()=>{this.acceptLocal(t,t.conflicts[0])}},{label:d(15754,null),run:()=>{this.acceptRemote(t,t.conflicts[0])}},{label:d(15763,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(15730,null,`command:${DF}`))}}async acceptLocal(e,t){try{await this.userDataSyncService.accept(e,t.localResource,void 0,this.userDataSyncEnablementService.isEnabled())}catch{this.notificationService.error(d(15730,null,`command:${DF}`))}}onAutoSyncError(e){switch(e.code){case"SessionExpired":this.notificationService.notify({severity:St.Info,message:d(15762,null),actions:{primary:[pi({id:"turn on sync",label:d(15792,null),run:()=>this.turnOn()})]}});break;case"TurnedOff":this.notificationService.notify({severity:St.Info,message:d(15793,null),actions:{primary:[pi({id:"turn on sync",label:d(15792,null),run:()=>this.turnOn()})]}});break;case"TooLarge":if(e.resource==="keybindings"||e.resource==="settings"||e.resource==="tasks"){this.disableSync(e.resource);let t=Rv(e.resource);this.handleTooLargeError(e.resource,d(15782,null,t.toLowerCase(),t.toLowerCase(),"100kb"),e)}break;case"LocalTooManyProfiles":this.disableSync("profiles"),this.notificationService.error(d(15784,null));break;case"IncompatibleLocalContent":case"Gone":case"UpgradeRequired":{let t=d(15744,null,this.productService.version,this.productService.commit),o=e.operationId?d(15753,null,e.operationId):void 0;this.notificationService.notify({severity:St.Error,message:o?`${t} ${o}`:t});break}case"MethodNotFound":{let t=d(15750,null),o=e.operationId?d(15753,null,e.operationId):void 0;this.notificationService.notify({severity:St.Error,message:o?`${t} ${o}`:t,actions:{primary:[pi({id:"Show Sync Logs",label:d(15766,null),run:()=>this.commandService.executeCommand(DF)}),pi({id:"Report Issue",label:d(15756,null),run:()=>this.workbenchIssueService.openReporter()})]}});break}case"IncompatibleRemoteContent":this.notificationService.notify({severity:St.Error,message:d(15742,null),actions:{primary:[pi({id:"reset",label:d(15757,null),run:()=>this.userDataSyncWorkbenchService.resetSyncedData()}),pi({id:"show synced data",label:d(15768,null),run:()=>this.userDataSyncWorkbenchService.showSyncActivity()})]}});return;case"ServiceChanged":this.notificationService.notify({severity:St.Info,message:this.userDataSyncStoreManagementService.userDataSyncStore?.type==="insiders"?d(15760,null):d(15761,null)});return;case"DefaultServiceChanged":this.userDataSyncEnablementService.isEnabled()?this.notificationService.notify({severity:St.Info,message:d(15796,null)}):this.notificationService.notify({severity:St.Info,message:d(15759,null,this.productService.nameLong),actions:{primary:[pi({id:"turn on sync",label:d(15792,null),run:()=>this.turnOn()})]}});return}}handleTooLargeError(e,t,o){let n=o.operationId?d(15753,null,o.operationId):void 0;this.notificationService.notify({severity:St.Error,message:n?`${t} ${n}`:t,actions:{primary:[pi({id:"open sync file",label:d(15752,null,Rv(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=no.getCanonicalUri(this.editorService.activeEditor,{supportSideBySide:1});if(Xe(n,r))return;let s=Rv(t),l=this.notificationService.notify({severity:St.Error,message:d(15746,null,s.toLowerCase()),actions:{primary:[pi({id:"open sync file",label:d(15752,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 qc(this.getConflictsCount(),()=>d(15748,null,Ch.value)):this.turningOnSync&&(e=new PC(()=>d(15795,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 qc(1,()=>d(15772,null))),e&&(this.accountBadgeDisposable.value=this.activityService.showAccountsActivity({badge:e}))}async turnOn(){try{if(!this.userDataSyncWorkbenchService.authenticationProviders.length)throw new Error(d(15751,null));if(!await this.askToConfigure())return;this.userDataSyncStoreManagementService.userDataSyncStore?.canSwitch&&await this.selectSettingsSyncService(this.userDataSyncStoreManagementService.userDataSyncStore),await this.userDataSyncWorkbenchService.turnOn()}catch(e){if(so(e))return;if(e instanceof Cg){switch(e.code){case"TooLarge":if(e.resource==="keybindings"||e.resource==="settings"||e.resource==="tasks"){this.handleTooLargeError(e.resource,d(15783,null,Rv(e.resource).toLowerCase(),"100kb"),e);return}break;case"IncompatibleLocalContent":case"Gone":case"UpgradeRequired":{let t=d(15745,null,this.productService.version,this.productService.commit),o=e.operationId?d(15753,null,e.operationId):void 0;this.notificationService.notify({severity:St.Error,message:o?`${t} ${o}`:t});return}case"IncompatibleRemoteContent":this.notificationService.notify({severity:St.Error,message:d(15743,null),actions:{primary:[pi({id:"reset",label:d(15757,null),run:()=>this.userDataSyncWorkbenchService.resetSyncedData()}),pi({id:"show synced data",label:d(15768,null),run:()=>this.userDataSyncWorkbenchService.showSyncActivity()})]}});return;case"Unauthorized":case"Forbidden":this.notificationService.error(d(15731,null));return}this.notificationService.error(d(15791,null,`command:${DF}`))}else this.notificationService.error(d(15790,null,Cn(e)))}}async askToConfigure(){return new Promise((e,t)=>{let o=new P,n=this.quickInputService.createQuickPick();o.add(n),n.title=Ch.value,n.ok=!1,n.customButton=!0,n.customLabel=d(15770,null),n.description=d(15735,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(H.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:Rv("settings")},{id:"keybindings",label:Rv("keybindings")},{id:"snippets",label:Rv("snippets")},{id:"tasks",label:Rv("tasks")},{id:"mcp",label:Rv("mcp")},{id:"globalState",label:Rv("globalState")},{id:"extensions",label:Rv("extensions")},{id:"profiles",label:Rv("profiles")},{id:"prompts",label:Rv("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 P,n=this.quickInputService.createQuickPick();o.add(n),n.title=d(15738,null,Ch.value),n.placeholder=d(15737,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(15787,null),detail:d(15788,null),primaryButton:d(15785,null),checkbox:this.userDataSyncWorkbenchService.accountStatus==="available"?{label:d(15789,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(jue)}async selectSettingsSyncService(e){return new Promise((t,o)=>{let n=new P,r=n.add(this.quickInputService.createQuickPick());r.title=d(15776,null,Ch.value),r.description=d(15775,null),r.hideInput=!0,r.ignoreFocusOut=!0;let s=l=>{if(Xe(l,e.defaultUrl))return d(15740,null)};r.items=[{id:"insiders",label:d(15749,null),description:s(e.insidersUrl)},{id:"stable",label:d(15773,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(),Gt&&this.registerDownloadSyncActivityAction()}registerTurnOnSyncAction(){let e=this,t=x.and(py.notEqualsTo("uninitialized"),rD.toNegated(),W4t.negate());this._register(W(class extends K{constructor(){super({id:"workbench.userDataSync.actions.turnOn",title:L(15747,"Backup and Sync Settings..."),category:Ch,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=x.and(py.notEqualsTo("uninitialized"),rD.toNegated(),W4t);this._register(W(class extends K{constructor(){super({id:"workbench.userData.actions.turningOn",title:d(15794,null),precondition:x.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(15732,null),icon:M.stopCircle,menu:{id:D.ViewContainerTitle,when:x.and(W4t,x.equals("viewContainer",rB)),group:"navigation",order:1}})}async run(){return e.userDataSyncWorkbenchService.turnoff(!1)}}))}registerSignInAction(){let e=this,t="workbench.userData.actions.signin",o=x.and(py.notEqualsTo("uninitialized"),rD,nB.isEqualTo("unavailable"));this._register(W(class extends K{constructor(){super({id:"workbench.userData.actions.signin",title:d(15771,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(fe.appendMenuItem(D.AccountsContext,{group:"1_settings",command:{id:t,title:d(15769,null)},when:o}))}getShowConflictsTitle(){return L(15758,"Show Conflicts ({0})",this.getConflictsCount())}registerShowConflictsAction(){this.conflictsActionDisposable.value=void 0;let e=this;this.conflictsActionDisposable.value=W(class extends K{constructor(){super({id:rEo,get title(){return e.getShowConflictsTitle()},category:Ch,f1:!0,precondition:jJ,menu:[{group:"3_configuration",id:D.GlobalActivity,when:jJ,order:2},{group:"3_configuration",id:D.MenubarPreferencesMenu,when:jJ,order:2}]})}async run(){return e.userDataSyncWorkbenchService.showConflicts()}})}registerManageSyncAction(){let e=this,t=x.and(rD,nB.notEqualsTo("unavailable"),py.notEqualsTo("uninitialized"));this._register(W(class extends K{constructor(){super({id:"workbench.userDataSync.actions.manage",title:d(15777,null),toggled:PI.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(Ge),c=n.get(ge),u=new P,p=l.createQuickPick({useSeparators:!0});u.add(p);let h=[];if(e.userDataSyncService.conflicts.length&&(h.push({id:rEo,label:`${Ch.value}: ${e.getShowConflictsTitle().original}`}),h.push({type:"separator"})),h.push({id:N4t.id,label:`${Ch.value}: ${N4t.title.original}`}),h.push({id:O4t.id,label:`${Ch.value}: ${O4t.title.original}`}),h.push({id:F4t.id,label:`${Ch.value}: ${F4t.title.original}`}),h.push({type:"separator"}),h.push({id:glt.id,label:`${Ch.value}: ${glt.title.original}`,description:glt.description(e.userDataSyncService)}),e.userDataSyncEnablementService.canToggleEnablement()){let g=e.userDataSyncWorkbenchService.current;h.push({id:A4t.id,label:`${Ch.value}: ${A4t.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=x.and(nB.isEqualTo("available"),py.notEqualsTo("uninitialized"));this._register(W(class extends K{constructor(){super({id:F4t.id,title:F4t.title,category:Ch,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:glt.id,title:glt.title,category:Ch,menu:{id:D.CommandPalette,when:x.and(rD,nB.isEqualTo("available"),py.notEqualsTo("uninitialized"))}})}run(o){return e.userDataSyncWorkbenchService.syncNow()}}))}registerTurnOffSyncAction(){let e=this;this._register(W(class extends K{constructor(){super({id:A4t.id,title:A4t.title,category:Ch,menu:{id:D.CommandPalette,when:x.and(py.notEqualsTo("uninitialized"),rD)}})}async run(){try{await e.turnOff()}catch(o){so(o)||e.notificationService.error(d(15786,null,`command:${DF}`))}}}))}registerConfigureSyncAction(){let e=this,t=x.and(py.notEqualsTo("uninitialized"),rD);this._register(W(class extends K{constructor(){super({id:N4t.id,title:N4t.title,category:Ch,icon:M.settingsGear,tooltip:d(15734,null),menu:[{id:D.CommandPalette,when:t},{id:D.ViewContainerTitle,when:x.and(rD,x.equals("viewContainer",rB)),group:"navigation",order:2}]})}run(){return e.configureSyncOptions()}}))}registerShowLogAction(){let e=this;this._register(W(class extends K{constructor(){super({id:DF,title:d(15764,null,Ch.value),tooltip:d(15765,null),icon:M.output,menu:[{id:D.CommandPalette,when:x.and(py.notEqualsTo("uninitialized"))},{id:D.ViewContainerTitle,when:x.equals("viewContainer",rB),group:"navigation",order:1}]})}run(){return e.showSyncActivity()}}))}registerShowSettingsAction(){this._register(W(class extends K{constructor(){super({id:O4t.id,title:O4t.title,category:Ch,menu:{id:D.CommandPalette,when:x.and(py.notEqualsTo("uninitialized"))}})}run(t){t.get(Po).openUserSettings({jsonEditor:!1,query:"@tag:sync"})}}))}registerHelpAction(){let e=this;this._register(W(class extends K{constructor(){super({id:"workbench.userDataSync.actions.help",title:Ch,category:We.Help,menu:[{id:D.CommandPalette,when:x.and(py.notEqualsTo("uninitialized"))}]})}run(){return e.openerService.open(A.parse("https://aka.ms/vscode-settings-sync-help"))}})),fe.appendMenuItem(D.ViewContainerTitle,{command:{id:"workbench.userDataSync.actions.help",title:We.Help.value},when:x.equals("viewContainer",rB),group:"1_help"})}registerAcceptMergesAction(){let e=this;this._register(W(class extends K{constructor(){super({id:"workbench.userDataSync.actions.acceptMerges",title:d(15733,null),menu:[{id:D.EditorContent,when:x.and(Z_t,x.regex(tDt.key,new RegExp(`^${HC}:`)))}]})}async run(o,n){let r=o.get(Ho);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=>Xe(s.previewResource,o)));if(n)return n;throw new Error(`Unknown resource: ${o.toString()}`)}}))}registerDownloadSyncActivityAction(){this._register(W(class extends K{constructor(){super(FFt)}async run(t){let o=t.get(lI),n=t.get(Ne);await o.downloadSyncActivity()&&n.info(d(15741,null))}}))}registerViews(){let e=this.registerViewContainer();this.registerDataViews(e)}registerViewContainer(){return oe.as(on.ViewContainersRegistry).registerViewContainer({id:rB,title:Ch,ctorDescriptor:new Mt(Ha,[rB,{mergeViewWithContainerWhenSingleView:!0}]),icon:Kro,hideIfEmpty:!0},0)}registerResetSyncDataAction(){let e=this;this._register(W(class extends K{constructor(){super({id:"workbench.actions.syncData.reset",title:d(15797,null),menu:[{id:D.ViewContainerTitle,when:x.equals("viewContainer",rB),group:"0_configure"}]})}run(){return e.userDataSyncWorkbenchService.resetSyncedData()}}))}registerDataViews(e){this._register(this.instantiationService.createInstance(JUe,e))}};ZUe=I([m(0,_l),m(1,aI),m(2,lI),m(3,X),m(4,zl),m(5,Ne),m(6,ee),m(7,mn),m(8,ct),m(9,Ge),m(10,F),m(11,Ml),m(12,JE),m(13,Nt),m(14,Po),m(15,Te),m(16,nt),m(17,Qe),m(18,Cs),m(19,TR),m(20,oi),m(21,ge),m(22,UC)],ZUe);var flt=class{constructor(i,e,t){this.userDataSyncService=i;this.modelService=e;this.languageService=t}provideTextContent(i){return i.scheme===HC?this.userDataSyncService.resolveContent(i).then(e=>this.modelService.createModel(e||"",this.languageService.createById("jsonc"),i)):null}};flt=I([m(0,aI),m(1,Ct),m(2,kt)],flt);var e1e=class extends C{constructor(e,t,o,n,r){super();this.userDataProfilesService=t;let s=H.filter(H.any(H.map(e.onDidActiveEditorChange,()=>this.getUserDataEditorInputSource(e.activeEditor)),H.map(H.filter(o.onDidChangeViewContainerVisibility,l=>l.id===Yh&&l.visible),l=>l.id)),l=>l!==void 0);Gt?this._register(H.debounce(H.any(H.map(r.onDidChangeFocus,()=>"windowFocus"),H.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 oD)return"settingsEditor";if(e instanceof iD)return"keybindingsEditor";let t=e.resource;if(Xe(t,this.userDataProfilesService.defaultProfile.settingsResource))return"settingsEditor";if(Xe(t,this.userDataProfilesService.defaultProfile.keybindingsResource))return"keybindingsEditor"}};e1e=I([m(0,ee),m(1,an),m(2,Ft),m(3,JE),m(4,oi)],e1e);var vlt=class extends C{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=Gt?d(15798,null,this.productService.nameLong):d(15799,null,this.productService.nameLong);this.notificationService.notify({severity:St.Error,message:t,actions:{primary:[pi({id:"Show Sync Logs",label:d(15805,null),run:()=>this.commandService.executeCommand(DF)}),pi({id:"Restart",label:Gt?d(15801,null):d(15802,null),run:()=>this.hostService.restart()})]}});return}case"RemoteTooManyRequests":{let t=e.operationId?d(15800,null,e.operationId):void 0,o=d(15803,null);this.notificationService.notify({severity:St.Error,message:t?`${o} ${t}`:o,source:e.operationId?d(15804,null,e.operationId):void 0,actions:{primary:[pi({id:"Show Sync Logs",label:d(15805,null),run:()=>this.commandService.executeCommand(DF)})]}});return}}}};vlt=I([m(0,JE),m(1,Ne),m(2,nt),m(3,ge),m(4,oi)],vlt);var Q0i=oe.as(Qi.Workbench);Q0i.registerWorkbenchContribution(ZUe,3);Q0i.registerWorkbenchContribution(e1e,4);Q0i.registerWorkbenchContribution(vlt,4);var xun=/^([^@:]+@)?([^:]+):/,kun=/^([^@:]+@)?([^:]+):(.+)$/,Eun=/^([^@]+@)?([^:]+)(:\d+)?$/,Tun=/([^@:.]+\.[^@:.]+)(:\d+)?$/,lEo=/^\s*url\s*=\s*(.+\S)\s*$/mg,_un=/[^.]/g,cEo=["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 sEo(a){let i=a.match(Tun);return i?i[1]:null}function Dun(a){if(a.indexOf("://")===-1){let i=a.match(xun);return i?sEo(i[2]):null}try{let i=A.parse(a);if(i.authority)return sEo(i.authority)}catch{}return null}function dEo(a,i){let e=new Set,t;for(;t=lEo.exec(a);){let n=Dun(t[1]);n&&e.add(n)}let o=new Set(i);return Array.from(e).map(n=>o.has(n)?n:n.replace(_un,"a"))}function Lun(a){let i=a.match(Eun);return i?i[2]:null}function aEo(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 Run(a,i){if(a.indexOf("://")===-1){let e=a.match(kun);if(e)return aEo(e[2],e[3],i)}try{let e=A.parse(a);if(e.authority)return aEo(Lun(e.authority),e.path,i)}catch{}return null}function uEo(a,i=!1){let e=[],t;for(;t=lEo.exec(a);){let o=Run(t[1],i);o&&e.push(o)}return e}var t1e=ae("workspaceTagsService");async function pEo(a,i=!1,e){return Promise.all(uEo(a,i).map(t=>e(t)))}var blt=Re("settings-view-bar-icon",M.settingsGear,d(17526,null)),mEo=[blt,M.vm,M.server,M.recordKeys,M.deviceMobile,M.watch,M.vr,M.piano,M.ruby,M.code,M.coffee,M.snake,M.project,M.window,M.library,M.extensions,M.terminal,M.terminalDebian,M.terminalLinux,M.terminalUbuntu,M.beaker,M.package,M.cloud,M.book,M.globe,M.database,M.notebook,M.robot,M.game,M.chip,M.music,M.remoteExplorer,M.github,M.azure,M.vscode,M.copilot,M.gift,M.send,M.bookmark,M.briefcase,M.megaphone,M.comment,M.telescope,M.creditCard,M.map,M.deviceCameraVideo,M.unmute,M.law,M.graphLine,M.heart,M.home,M.inbox,M.mortarBoard,M.rocket,M.magnet,M.lock,M.milestone,M.tag,M.pulse,M.radioTower,M.smiley,M.zap,M.squirrel,M.symbolColor,M.mail,M.key,M.pieChart,M.organization,M.preview,M.wand,M.starEmpty,M.lightbulb,M.symbolRuler,M.dashboard,M.calendar,M.shield,M.verified,M.debug,M.flame,M.compass,M.paintcan,M.archive,M.mic,M.jersey];var V4t=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,Je.fromString(e.mcp))}};V4t=I([m(0,mn),m(1,be),m(2,ne)],V4t);var ane=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,Je.fromString(t.mcp))}async getMcpContent(i){try{return(await this.fileService.readFile(i.mcpResource)).value.toString()}catch(e){if(e instanceof As&&e.fileOperationResult===1)return null;throw e}}};ane=I([m(0,be),m(1,ne)],ane);var i1e=class{constructor(i,e,t){this.profile=i;this.uriIdentityService=e;this.instantiationService=t;this.type="mcp";this.handle="mcp";this.label={label:d(17475,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:Zh,title:"",arguments:[this.profile.mcpResource,void 0,void 0]}}]}async hasContent(){return(await this.instantiationService.createInstance(ane).getMcpResourceContent(this.profile)).mcp!==null}async getContent(){return this.instantiationService.createInstance(ane).getContent(this.profile)}isFromDefaultProfile(){return!this.profile.isDefault&&!!this.profile.useDefaultFlags?.mcp}};i1e=I([m(1,dt),m(2,F)],i1e);function X0i(a){return a.resourceType!==void 0}function hEo(a){return a.label!==void 0}var jA=class extends C{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){uo(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(15722,null);return}if(this.shouldValidateName()&&this.name!==this.getInitialName()&&this.userDataProfilesService.profiles.some(e=>e.name===this.name)){this.message=d(15727,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(15721,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?pi({id:"_open",label:d(15724,null),class:q.asClassName(M.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(l4,e).getChildren();break;case"keybindings":o=await this.instantiationService.createInstance(c4,e).getChildren();break;case"snippets":o=await this.instantiationService.createInstance(d4,e).getChildren()??[];break;case"tasks":o=await this.instantiationService.createInstance(u4,e).getChildren();break;case"mcp":o=await this.instantiationService.createInstance(i1e,e).getChildren();break;case"extensions":o=await this.instantiationService.createInstance(p4,e).getChildren();break}return o.map(n=>this.toUserDataProfileResourceChildElement(n))}toUserDataProfileResourceChildElement(e,t,o){return{handle:e.handle,checkbox:e.checkbox,label:e.label?Mr(e.label.label)?e.label.label.value:e.label.label:"",description:Ae(e.description)?e.description:void 0,resource:A.revive(e.resourceUri),icon:e.themeIcon,openAction:pi({id:"_openChild",label:d(15724,null),class:q.asClassName(M.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(Zh,e.resourceUri,[vn],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)===Wje?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||!uo(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})}};jA=I([m(5,UE),m(6,an),m(7,ge),m(8,Pe),m(9,oi),m(10,dt),m(11,be),m(12,Hd),m(13,F)],jA);var am=class extends jA{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(wP)===this.profile.name,this._register(r.onDidChangeConfiguration(b=>{b.affectsConfiguration(wP)&&(this.isNewWindowProfile=this.configurationService.getValue(wP)===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 Mn(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(wP,null):await this.configurationService.updateValue(wP,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(p4,this.profile).getChildren()).map(o=>this.toUserDataProfileResourceChildElement(o,void 0,[{id:"applyToAllProfiles",label:d(15711,null),checked:o.applicationScoped,enabled:!0,class:"",tooltip:"",run:async()=>{let r=(await this.extensionManagementService.getInstalled(void 0,this.profile.extensionsResource)).find(s=>Ot(s.identifier,o.identifier));r&&await this.extensionManagementService.toggleApplicationScope(r,this.profile.extensionsResource)}}])):this.getChildrenFromProfile(this.profile,e)}getInitialName(){return this.profile.name}};am=I([m(3,mn),m(4,B),m(5,UE),m(6,an),m(7,ge),m(8,Pe),m(9,oi),m(10,dt),m(11,be),m(12,Hd),m(13,F)],am);var Y0i="userdataprofiletemplatepreview",Iy=class extends jA{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 vt;this.template=null;this.previewProfileWatchDisposables=this._register(new P);this.name=this.defaultName=this.getNewProfileName(),this._copyFrom=e,this._copyFlags=this.getCopyFlagsFrom(e),this.initialize(),this._register(this.fileService.registerProvider(Y0i,this._register(new Xue))),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){uo(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(ZN(this.copyFrom)){this.defaultName===this.name&&(this.name=this.defaultName=d(15713,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(15729,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=xn(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(ZN(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:Y0i,path:`/root/profiles/${e.name}`}),n=A.from({scheme:Y0i,path:`/root/cache/${e.name}`}),r=Lae(_t(),this.name,o,n);switch(t){case"settings":return e.settings?(await this.instantiationService.createInstance(xF).apply(e.settings,r),this.getChildrenFromProfile(r,t)):[];case"keybindings":return e.keybindings?(await this.instantiationService.createInstance(kF).apply(e.keybindings,r),this.getChildrenFromProfile(r,t)):[];case"snippets":return e.snippets?(await this.instantiationService.createInstance(XP).apply(e.snippets,r),this.getChildrenFromProfile(r,t)):[];case"tasks":return e.tasks?(await this.instantiationService.createInstance(EF).apply(e.tasks,r),this.getChildrenFromProfile(r,t)):[];case"mcp":return e.mcp?(await this.instantiationService.createInstance(ane).apply(e.mcp,r),this.getChildrenFromProfile(r,t)):[];case"extensions":return e.extensions?(await this.instantiationService.createInstance(FDe,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)}}};Iy=I([m(3,PV),m(4,UE),m(5,an),m(6,ge),m(7,Pe),m(8,oi),m(9,dt),m(10,be),m(11,Hd),m(12,F)],Iy);var TH=class extends gg{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 TH.INSTANCE||(TH.INSTANCE=e.createInstance(TH)),TH.INSTANCE}get profiles(){return this._profiles.map(([e])=>e).sort((e,t)=>e instanceof Iy?1:t instanceof Iy||e instanceof am&&e.profile.isDefault?-1:t instanceof am&&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 am&&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 P,o=t.add(new st("userDataProfile.activate",d(15710,null),q.asClassName(M.check),!0,()=>this.userDataProfileManagementService.switchProfile(p.profile))),n=t.add(new st("userDataProfile.copyFromProfile",d(15714,null),q.asClassName(M.copy),!0,()=>this.createNewProfile(p.profile))),r=t.add(new st("userDataProfile.export",d(15719,null),q.asClassName(M.export),!0,()=>this.userDataProfileImportExportService.exportProfile(e))),s=t.add(new st("userDataProfile.delete",d(15716,null),q.asClassName(M.trash),!0,()=>this.removeProfile(p.profile))),l=t.add(new st("userDataProfile.newWindow",d(15725,null),q.asClassName(M.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 li),u.push(s));let p=t.add(this.instantiationService.createInstance(am,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(15723,null),primaryButton:d(15718,null),cancelButton:d(15712,null)})).confirmed)return;this.revert()}if(e instanceof A)try{await this.userDataProfileImportExportService.resolveProfileTemplate(e)}catch(t){this.dialogService.error(Cn(t));return}if(!this.newProfileElement){let t=new P,o=new $e;t.add(Z(()=>o.dispose(!0)));let n=[],r=[],s=t.add(new st("userDataProfile.create",d(15715,null),void 0,!0,()=>this.saveNewProfile(!1,o.token)));n.push(s),Gt&&e instanceof A&&eTe(e)&&n.push(t.add(new st("userDataProfile.createInDesktop",d(15720,null,this.productService.nameLong),void 0,!0,()=>this.openerService.open(e,{openExternal:!0}))));let l=t.add(new st("userDataProfile.cancel",d(15712,null),q.asClassName(M.trash),!0,()=>this.discardNewProfile()));r.push(l);let c=t.add(new st("userDataProfile.preview",d(15726,null),q.asClassName(M.openPreview),!0,()=>this.previewNewProfile(o.token)));r.push(c);let u=t.add(new st("userDataProfile.export",d(15719,null),q.asClassName(M.export),ZN(e),()=>this.exportNewProfile(o.token)));this.newProfileElement=t.add(this.instantiationService.createInstance(Iy,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(15728,null):s.label=d(15715,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=ZN(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,Gt?await this.userDataProfileManagementService.switchProfile(t):await this.openWindow(t))}async exportNewProfile(e){if(!this.newProfileElement||!ZN(this.newProfileElement.copyFrom))return;let t=Lae(_t(),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":ZN(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??ve.None))}else ZN(l)?o=await this.userDataProfileImportExportService.createFromProfile(l,{name:s,useDefaultFlags:c,icon:r,resourceTypeFlags:this.newProfileElement.copyFlags,transient:e},t??ve.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(15717,null,e.name),primaryButton:d(15716,null),cancelButton:d(15712,null)})).confirmed&&await this.userDataProfileManagementService.removeProfile(e)}async openWindow(e){await this.hostService.openWindow({forceProfile:e.name})}};TH=I([m(0,mn),m(1,an),m(2,UE),m(3,PV),m(4,ct),m(5,Te),m(6,oi),m(7,nt),m(8,Qe),m(9,F)],TH);var Mun=Re("profiles-editor-edit-folder",M.edit,d(15662,null)),Pun=Re("profiles-editor-remove-folder",M.close,d(15700,null)),Aun=J("profiles.sashBorder",cb,d(15699,null)),oWi=GI({listActiveSelectionBackground:qo,listActiveSelectionForeground:ko,listFocusAndSelectionBackground:qo,listFocusAndSelectionForeground:ko,listFocusBackground:qo,listFocusForeground:ko,listHoverForeground:ko,listHoverBackground:qo,listHoverOutline:qo,listFocusOutline:qo,listInactiveSelectionBackground:qo,listInactiveSelectionForeground:ko,listInactiveFocusBackground:qo,listInactiveFocusOutline:qo,treeIndentGuidesStroke:void 0,treeInactiveIndentGuidesStroke:void 0,tableOddRowsBackgroundColor:qo}),wQ=class extends pa{constructor(e,t,o,n,r,s,l,c){super(wQ.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=R(e,_(".profiles-editor"));let t=R(this.container,_(".sidebar-view")),o=R(t,_(".sidebar-container")),n=R(this.container,_(".contents-view")),r=R(n,_(".contents-container"));this.profileWidget=this._register(this.instantiationService.createInstance(Ilt,r)),this.splitView=new vu(this.container,{orientation:1,proportionalLayout:!0}),this.renderSidebar(o),this.splitView.addView({onDidChange:H.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:H.None,element:n,minimumSize:550,maximumSize:Number.POSITIVE_INFINITY,layout:(s,l,c)=>{n.style.width=`${s}px`,c&&this.profileWidget?.layout(new ai(s,c))}},Wl.Distribute,void 0,!0),this.registerListeners(),this.updateStyles()}updateStyles(){let e=this.theme.getColor(Aun);this.splitView?.style({separatorBorder:e})}renderSidebar(e){this.renderNewProfileButton(R(e,_(".new-profile-button")));let t=this.instantiationService.createInstance(Slt),o=new J0i;this.profilesList=this._register(this.instantiationService.createInstance(Rl,"ProfilesList",R(e,_(".profiles-list")),o,[t],{multipleSelectionSupport:!1,setRowLineHeight:!1,horizontalScrolling:!1,accessibilityProvider:{getAriaLabel(n){return n?.name??""},getWidgetAriaLabel(){return d(15698,null)}},openOnSingleClick:!0,identityProvider:{getId(n){return n instanceof am?n.profile.id:n.name}},alwaysConsumeMouseWheel:!1}))}renderNewProfileButton(e){let t=this._register(new $I(e,{actions:{getActions:()=>{let o=[];return this.templates.length&&(o.push(new $l("from.template",d(15670,null),this.getCreateFromTemplateActions())),o.push(new li)),o.push(pi({id:"importProfile",label:d(15681,null),run:()=>this.importProfile()})),o}},addPrimaryActionToDropdown:!1,contextMenuProvider:this.contextMenuService,supportIcons:!0,...Ko}));t.label=d(15688,null),this._register(t.onDidClick(o=>this.createNewProfile()))}getCreateFromTemplateActions(){return this.templates.map(e=>pi({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 jA&&this.profileWidget?.render(t)})),this._register(this.profilesList.onContextMenu(e=>{let t=[];e.element||t.push(...this.getTreeContextMenuActions()),e.element instanceof jA&&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(pi({id:"newProfile",label:d(15688,null),run:()=>this.createNewProfile()}));let t=this.getCreateFromTemplateActions();return t.length&&e.push(new $l("from.template",d(15687,null),t)),e.push(new li),e.push(pi({id:"importProfile",label:d(15681,null),run:()=>this.importProfile()})),e}async importProfile(){let e=new P,t=e.add(this.quickInputService.createQuickPick()),o=n=>{let r=[];n&&r.push({label:t.value,description:d(15677,null)}),r.push({label:d(15676,null)}),t.items=r};t.title=d(15680,null),t.placeholder=d(15679,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 am&&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:S9e,title:d(15678,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)])}}};wQ=I([m(1,Te),m(2,De),m(3,le),m(4,Ge),m(5,dn),m(6,ze),m(7,F)],wQ);var J0i=class{getHeight(i){return 22}getTemplateId(){return"profileListElement"}},Slt=class{constructor(i){this.instantiationService=i;this.templateId="profileListElement"}renderTemplate(i){let e=new P,t=new P;i.classList.add("profile-list-item");let o=R(i,_(".profile-list-item-icon")),n=R(i,_(".profile-list-item-label")),r=R(i,_(`span${q.asCSSSelector(M.circleFilled)}`)),s=R(i,_(".profile-list-item-description"));R(s,_(`span${q.asCSSSelector(M.check)}`),_("span",void 0,d(15638,null)));let l=R(i,_(".profile-tree-item-actions-container")),c=e.add(this.instantiationService.createInstance(Ol,l,{hoverDelegate:e.add(Gg()),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 Iy),t.icon.className=q.asClassName(i.icon?q.fromId(i.icon):blt),t.dirty.classList.toggle("hide",!(i instanceof Iy)),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 st&&n.push(r.onDidChange);t.elementDisposables.add(H.any(...n)(r=>{r.enabled!==void 0&&o()}))}disposeElement(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.disposables.dispose(),i.elementDisposables.dispose()}};Slt=I([m(0,F)],Slt);var Ilt=class extends C{constructor(e,t,o){super();this.editorProgressService=t;this.instantiationService=o;this._profileElement=this._register(new me);this.layoutParticipants=[];let n=R(e,_(".profile-header")),r=R(n,_(".profile-title-container"));this.profileTitle=R(r,_(".profile-title")),this.builtInLabel=R(r,_(".profile-built-in-label",void 0,d(15642,null))),this.builtInLabel.classList.add("hide");let s=R(e,_(".profile-body")),l=new Z0i,c=this._register(this.instantiationService.createInstance(Elt)),u=this._register(this.instantiationService.createInstance(Tlt));this.layoutParticipants.push(u),this.copyFromProfileRenderer=this._register(this.instantiationService.createInstance(klt)),this.profileTreeContainer=R(s,_(".profile-tree")),this.profileTree=this._register(this.instantiationService.createInstance(nu,"ProfileEditor-Tree",this.profileTreeContainer,l,[this._register(this.instantiationService.createInstance(wlt)),this._register(this.instantiationService.createInstance(Clt)),this._register(this.instantiationService.createInstance(xlt)),this._register(this.instantiationService.createInstance(iWi)),this.copyFromProfileRenderer,c,u],this.instantiationService.createInstance(eWi),{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(oWi),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=R(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 Iy?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 am&&this._profileElement.value.element.reset(),this.profileTree.setInput(e);let t=new P;this._profileElement.value={element:e,dispose:()=>t.dispose()},this.profileTitle.textContent=e.name,this.builtInLabel.classList.toggle("hide",!(e instanceof am&&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 Mi(this.buttonContainer,{...Ko,secondary:!0}));s.label=r.label,s.enabled=r.enabled,t.add(s.onDidClick(()=>this.editorProgressService.showWhile(r.run()))),t.add(r.onDidChange(l=>{cn(l.enabled)||(s.enabled=r.enabled),cn(l.label)||(s.label=r.label)}))}if(o?.length)for(let r of o){let s=t.add(new Mi(this.buttonContainer,{...Ko}));s.label=r.label,s.enabled=r.enabled,t.add(s.onDidClick(()=>this.editorProgressService.showWhile(r.run()))),t.add(r.onDidChange(l=>{cn(l.enabled)||(s.enabled=r.enabled),cn(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 Iy&&this.profileTree.focusFirst(),this.dimension&&this.layout(this.dimension)}};Ilt=I([m(1,rd),m(2,F)],Ilt);var Z0i=class extends d1{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}}},eWi=class{hasChildren(i){return i instanceof jA}async getChildren(i){if(i instanceof jA){let e=[];return i instanceof Iy?(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 am&&(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[]}},tWi=class{getTemplateId(i){return i.element.resourceType?i.root instanceof Iy?cne.TEMPLATE_ID:lne.TEMPLATE_ID:dne.TEMPLATE_ID}getHeight(i){return 24}},ylt=class{constructor(i){this.editorProgressService=i}hasChildren(i){if(i instanceof jA)return!0;if(i.element.resourceType){if(i.element.resourceType!=="extensions"&&i.element.resourceType!=="snippets")return!1;if(i.root instanceof Iy){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 jA)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[]}};ylt=I([m(0,rd)],ylt);var n1e=class extends C{getResourceTypeTitle(i){switch(i){case"settings":return d(15701,null);case"keybindings":return d(15682,null);case"snippets":return d(15702,null);case"tasks":return d(15703,null);case"mcp":return d(15684,null);case"extensions":return d(15666,null)}return""}disposeElement(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.disposables.dispose()}},CQ=class extends n1e{renderElement({element:i},e,t){t.elementDisposables.clear(),t.element=i}},wlt=class extends CQ{constructor(e,t){super();this.userDataProfilesService=e;this.contextViewService=t;this.templateId="name"}renderTemplate(e){let t=new P,o=t.add(new P),n,r=R(e,_(".profile-row-container"));R(r,_(".profile-label-element",void 0,d(15685,null)));let s=t.add(new Dc(r,this.contextViewService,{inputBoxStyles:c_({inputBorder:ZE}),ariaLabel:d(15697,null),placeholder:d(15697,null),validationOptions:{validation:u=>{if(!u)return{content:d(15686,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(15696,null,u),type:2}:null}}}));t.add(s.onDidChange(u=>{n&&u&&(n.root.name=u)}));let l=t.add(Vn(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 am&&u.root.profile.isDefault;u.root.disabled||p?s.disable():s.enable(),p?s.setTooltip(d(15660,null)):s.setTooltip(d(15697,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}}};wlt=I([m(0,an),m(1,_n)],wlt);var Clt=class extends CQ{constructor(e,t){super();this.instantiationService=e;this.hoverService=t;this.templateId="icon";this.hoverDelegate=Ni("element")}renderTemplate(e){let t=new P,o=t.add(new P),n,r=R(e,_(".profile-row-container"));R(r,_(".profile-label-element",void 0,d(15675,null)));let s=R(r,_(".profile-icon-container")),l=R(s,_(`${q.asCSSSelector(blt)}`,{tabindex:"0",role:"button","aria-label":d(15673,null)})),c=t.add(this.hoverService.setupManagedHover(this.hoverDelegate,l,"")),u=t.add(this.instantiationService.createInstance(yT,{icons:mEo,inputBoxStyles:pl})),p,h=()=>{n?.root instanceof am&&n.root.profile.isDefault||n?.root.disabled||n?.root instanceof am&&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 ai(486,292)),u.focus()))};t.add(j(l,re.CLICK,f=>{$t.stop(f,!0),h()})),t.add(j(l,re.KEY_DOWN,f=>{let v=new Ii(f);(v.equals(3)||v.equals(10))&&($t.stop(v,!0),h())})),t.add(j(u.domNode,re.KEY_DOWN,f=>{let v=new Ii(f);v.equals(9)&&($t.stop(v,!0),p?.dispose(),l.focus())})),t.add(u.onDidSelect(f=>{p?.dispose(),l.focus(),n&&(n.root.icon=f.id)})),R(s,_(".profile-description-element",void 0,d(15674,null)));let g=f=>{f?.root instanceof am&&f.root.profile.isDefault?(s.classList.add("disabled"),c.update(d(15659,null))):(c.update(d(15644,null)),s.classList.remove("disabled")),f.root.icon?l.className=q.asClassName(q.fromId(f.root.icon)):l.className=q.asClassName(q.fromId(blt.id))};return{set element(f){n=f,g(n),o.add(n.root.onDidChange(v=>{v.icon&&g(f)}))},disposables:t,elementDisposables:o}}};Clt=I([m(0,F),m(1,tt)],Clt);var xlt=class extends CQ{constructor(e){super();this.userDataProfileService=e;this.templateId="useForCurrent"}renderTemplate(e){let t=new P,o=t.add(new P),n,r=R(e,_(".profile-row-container"));R(r,_(".profile-label-element",void 0,d(15707,null)));let s=R(r,_(".profile-use-for-current-container")),l=d(15664,null),c=t.add(new hv(l,!1,kf));R(s,c.domNode);let u=R(s,_(".profile-description-element",void 0,l));t.add(c.onChange(()=>{n?.root instanceof am&&n.root.toggleCurrentWindowProfile()})),t.add(j(u,re.CLICK,()=>{n?.root instanceof am&&n.root.toggleCurrentWindowProfile()}));let p=g=>{c.checked=g.root instanceof am&&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}}};xlt=I([m(0,mn)],xlt);var iWi=class extends CQ{constructor(){super(...arguments);this.templateId="useAsDefault"}renderTemplate(e){let t=new P,o=t.add(new P),n,r=R(e,_(".profile-row-container"));R(r,_(".profile-label-element",void 0,d(15708,null)));let s=R(r,_(".profile-use-as-default-container")),l=d(15665,null),c=t.add(new hv(l,!1,kf));R(s,c.domNode);let u=R(s,_(".profile-description-element",void 0,l));t.add(c.onChange(()=>{n?.root instanceof am&&n.root.toggleNewWindowProfile()})),t.add(j(u,re.CLICK,()=>{n?.root instanceof am&&n.root.toggleNewWindowProfile()}));let p=h=>{c.checked=h.root instanceof am&&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}}},klt=class extends CQ{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 P,o=t.add(new P),n,r=R(e,_(".profile-row-container.profile-copy-from-container"));R(r,_(".profile-label-element",void 0,d(15653,null))),R(r,_(".profile-description-element",void 0,d(15649,null)));let s=t.add(this.instantiationService.createInstance(aE,[],0,this.contextViewService,pE,{useCustomDrawn:!0,ariaLabel:d(15652,null)}));s.render(R(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 Iy){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(15663,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} (${Ye(o)})`,id:o.toString(),source:o});if(this.templates.length){t.push({...jN,decoratorRight:d(15671,null)});for(let o of this.templates)t.push({text:o.name,id:o.url,source:A.parse(o.url)})}t.push({...jN,decoratorRight:d(15669,null)});for(let o of this.userDataProfilesService.profiles)o.isTransient||t.push({text:o.name,id:o.id,source:o});return t}};klt=I([m(0,an),m(1,F),m(2,dt),m(3,_n)],klt);var Elt=class extends CQ{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 P,o=t.add(new P),n,r=R(e,_(".profile-row-container"));R(r,_(".profile-label-element",void 0,d(15645,null)));let s=R(r,_(".profile-description-element")),l=R(r,_(".profile-content-tree-header")),c=_(".options-header",void 0,_("span",void 0,d(15694,null)));R(l,_(""),_("",void 0,d(15645,null)),c,_(""));let u=new tWi,p=this.profilesContentTree=t.add(this.instantiationService.createInstance(nu,"ProfileEditor-ContentsTree",R(r,_(".profile-content-tree.file-icon-themable-tree.show-file-icons")),u,[this.instantiationService.createInstance(lne),this.instantiationService.createInstance(cne),this.instantiationService.createInstance(dne)],this.instantiationService.createInstance(ylt),{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(oWi),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 xe;if(f.root instanceof am&&f.root.profile.isDefault)v.appendMarkdown(d(15658,null));else if(v.appendMarkdown(d(15646,null)),f.root instanceof Iy){let b=f.root.getCopyFromName(),S=b===this.userDataProfilesService.defaultProfile.name?d(15648,null,b):b;S&&v.appendMarkdown(d(15651,null,S,b)),v.appendMarkdown(d(15657,null)).appendMarkdown(d(15692,null))}R(s,o.add(nb(v)).element)},g=this;return{set element(f){n=f,h(f),f.root instanceof Iy?l.classList.remove("default-profile"):f.root instanceof am&&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([]))}};Elt=I([m(0,an),m(1,ze),m(2,F)],Elt);var Tlt=class extends CQ{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 P,o=t.add(new P),n,r=R(e,_(".profile-row-container"));R(r,_(".profile-label-element",void 0,d(15667,null)));let s=R(r,_(".profile-description-element")),l=R(r,_(".profile-associations-table")),c=this.workspacesTable=t.add(this.instantiationService.createInstance(rC,"ProfileEditor-AssociationsTable",l,new class{constructor(){this.headerRowHeight=30}getHeight(){return 24}},[{label:"",tooltip:"",weight:1,minimumWidth:30,maximumWidth:30,templateId:B4t.TEMPLATE_ID,project(v){return v}},{label:d(15672,null),tooltip:"",weight:2,templateId:une.TEMPLATE_ID,project(v){return v}},{label:d(15695,null),tooltip:"",weight:7,templateId:pne.TEMPLATE_ID,project(v){return v}},{label:"",tooltip:"",weight:1,minimumWidth:84,maximumWidth:84,templateId:mne.TEMPLATE_ID,project(v){return v}}],[new B4t,this.instantiationService.createInstance(une),this.instantiationService.createInstance(pne),this.instantiationService.createInstance(mne)],{horizontalScrolling:!1,alwaysConsumeMouseWheel:!1,openOnSingleClick:!1,multipleSelectionSupport:!1,accessibilityProvider:{getAriaLabel:v=>{let b=gEo(this.labelService,v.workspace);return b===void 0||b.length===0?d(15704,null,this.labelService.getUriLabel(v.workspace)):d(15706,null,this.labelService.getUriLabel(v.workspace),b)},getWidgetAriaLabel:()=>d(15705,null)},identityProvider:{getId(v){return v.workspace.toString()}}}));this.workspacesTable.style(oWi),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=R(r,_(".profile-workspaces-button-container")),p=t.add(new _x(u)),h=this._register(p.addButton({title:d(15639,null),...Ko}));h.label=d(15639,null),t.add(h.onDidClick(async()=>{let v=await this.fileDialogService.showOpenDialog({canSelectFiles:!1,canSelectFolders:!0,canSelectMany:!0,openLabel:d(15640,null),title:d(15641,null)});v&&n?.root instanceof am&&n.root.updateWorkspaces(v,[])})),t.add(c.onDidOpen(v=>{v?.element&&v.element.profileElement.openWorkspace(v.element.workspace)}));let g=()=>{n?.root instanceof am&&n.root.workspaces?.length?(s.textContent=d(15668,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(15689,null),l.classList.add("hide"))},f=this;return{set element(v){n=v,v.root instanceof am&&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([]))}};Tlt=I([m(0,ot),m(1,dt),m(2,dn),m(3,F)],Tlt);var lne=class extends n1e{constructor(e){super();this.instantiationService=e;this.templateId=lne.TEMPLATE_ID}static{this.TEMPLATE_ID="ExistingProfileResourceTemplate"}renderTemplate(e){let t=new P,o=R(e,_(".profile-tree-item-container.existing-profile-resource-type-container")),n=R(o,_(".profile-resource-type-label")),r=t.add(new g8({items:[]}));R(R(o,_(".profile-resource-options-container")),r.domNode);let s=R(o,_(".profile-resource-actions-container")),l=t.add(this.instantiationService.createInstance(Ol,s,{hoverDelegate:t.add(Gg()),highlightToggledItems:!0}));return{label:n,radio:r,actionBar:l,disposables:t,elementDisposables:t.add(new P)}}renderElement({element:e},t,o){o.elementDisposables.clear();let{element:n,root:r}=e;if(!(r instanceof am))throw new Error("ExistingProfileResourceTreeRenderer can only render existing profile element");if(Ae(n)||!X0i(n))throw new Error("Invalid profile resource element");let s=()=>{o.radio.setItems([{text:d(15655,null),tooltip:d(15656,null,l),isActive:r.getFlag(n.resourceType)},{text:r.name,tooltip:d(15654,null,l,r.name),isActive:!r.getFlag(n.resourceType)}])},l=this.getResourceTypeTitle(n.resourceType);o.label.textContent=l,r instanceof am&&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)}};lne=I([m(0,F)],lne);var cne=class extends n1e{constructor(e,t){super();this.userDataProfilesService=e;this.instantiationService=t;this.templateId=cne.TEMPLATE_ID}static{this.TEMPLATE_ID="NewProfileResourceTemplate"}renderTemplate(e){let t=new P,o=R(e,_(".profile-tree-item-container.new-profile-resource-type-container")),n=R(o,_(".profile-resource-type-label-container")),r=R(n,_("span.profile-resource-type-label")),s=t.add(new g8({items:[]}));R(R(o,_(".profile-resource-options-container")),s.domNode);let l=R(o,_(".profile-resource-actions-container")),c=t.add(this.instantiationService.createInstance(Ol,l,{hoverDelegate:t.add(Gg()),highlightToggledItems:!0}));return{label:r,radio:s,actionBar:c,disposables:t,elementDisposables:t.add(new P)}}renderElement({element:e},t,o){o.elementDisposables.clear();let{element:n,root:r}=e;if(!(r instanceof Iy))throw new Error("NewProfileResourceTreeRenderer can only render new profile element");if(Ae(n)||!X0i(n))throw new Error("Invalid profile resource element");let s=this.getResourceTypeTitle(n.resourceType);o.label.textContent=s;let l=()=>{let u=[{text:d(15655,null),tooltip:d(15656,null,s)},{text:d(15690,null),tooltip:d(15691,null,s)}],p=r.getCopyFromName(),h=p===this.userDataProfilesService.defaultProfile.name?d(15648,null,p):p;r.copyFrom&&h?(o.radio.setItems([{text:h,tooltip:h?d(15650,null,s,h):d(15647,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)}};cne=I([m(0,an),m(1,F)],cne);var dne=class extends n1e{constructor(e){super();this.instantiationService=e;this.templateId=dne.TEMPLATE_ID;this.labels=e.createInstance(Za,AP),this.hoverDelegate=this._register(e.createInstance(mv,"mouse",void 0,{}))}static{this.TEMPLATE_ID="ProfileResourceChildTreeItemTemplate"}renderTemplate(e){let t=new P,o=R(e,_(".profile-tree-item-container.profile-resource-child-container")),n=t.add(new hv("",!1,kf));R(o,n.domNode);let r=t.add(this.labels.create(o,{hoverDelegate:this.hoverDelegate})),s=R(o,_(".profile-resource-actions-container")),l=t.add(this.instantiationService.createInstance(Ol,s,{hoverDelegate:t.add(Gg()),highlightToggledItems:!0}));return{checkbox:n,resourceLabel:r,actionBar:l,disposables:t,elementDisposables:t.add(new P)}}renderElement({element:e},t,o){o.elementDisposables.clear();let{element:n}=e;if(Ae(n)||!hEo(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?Ye(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)}};dne=I([m(0,F)],dne);var B4t=class a{constructor(){this.templateId=a.TEMPLATE_ID}static{this.TEMPLATE_ID="empty"}renderTemplate(i){return{}}renderElement(i,e,t){}disposeTemplate(){}},une=class{constructor(i,e){this.uriIdentityService=i;this.labelService=e;this.templateId=une.TEMPLATE_ID}static{this.TEMPLATE_ID="host"}renderTemplate(i){let e=new P,t=e.add(new P),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=gEo(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()}};une=I([m(0,dt),m(1,ot)],une);var pne=class{constructor(i,e){this.uriIdentityService=i;this.hoverService=e;this.templateId=pne.TEMPLATE_ID;this.hoverDelegate=Ni("mouse")}static{this.TEMPLATE_ID="path"}renderTemplate(i){let e=new P,t=i.appendChild(_(".path")),o=t.appendChild(_("div.path-label")),n=e.add(this.hoverService.setupManagedHover(this.hoverDelegate,o,"")),r=e.add(new P);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===Y.file)return Hp(i.fsPath);if(i.path.startsWith(Lo.sep)){let e=i.path.substring(1);if(f6(e,!0))return Hp(Ms.normalize(e),!0)}return i.path}};pne=I([m(0,dt),m(1,tt)],pne);var o1e=class{constructor(i,e,t,o){this.item=i;this.userDataProfilesService=e;this.id="changeProfile";this.label="Change Profile";this.class=q.asClassName(Mun);this.tooltip=d(15643,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]})}}))}};o1e=I([m(1,an),m(2,dt),m(3,Co)],o1e);var mne=class{constructor(i,e,t,o,n){this.userDataProfilesService=i;this.userDataProfileManagementService=e;this.contextMenuService=t;this.uriIdentityService=o;this.environmentService=n;this.templateId=mne.TEMPLATE_ID}static{this.TEMPLATE_ID="actions"}renderTemplate(i){let e=new P,t=i.appendChild(_(".profile-workspaces-actions-container")),o=e.add(Gg());return{actionBar:e.add(new ji(t,{hoverDelegate:o,actionViewItemProvider:r=>{if(r instanceof o1e)return new wp(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 o1e(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(M.window),enabled:!this.uriIdentityService.extUri.isEqual(i.workspace,i.profileElement.getCurrentWorkspace()),id:"openWorkspace",tooltip:d(15693,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(Pun),enabled:this.userDataProfileManagementService.getDefaultProfileToUse().id!==i.profileElement.profile.id&&!e,id:"deleteTrustedUri",tooltip:d(15661,null),run:()=>i.profileElement.updateWorkspaces([],[i.workspace])}}disposeTemplate(i){i.disposables.dispose()}};mne=I([m(0,an),m(1,UE),m(2,ze),m(3,dt),m(4,Co)],mne);function gEo(a,i){return i.authority?a.getHostLabel(i.scheme,i.authority):d(15683,null)}var QA=class extends Us{constructor(e){super();this.instantiationService=e;this.resource=void 0;this._dirty=!1;this.model=TH.getInstance(this.instantiationService),this._register(this.model.onDidChange(t=>this.dirty=this.model.profiles.some(o=>o instanceof Iy)))}static{this.ID="workbench.input.userDataProfiles"}get dirty(){return this._dirty}set dirty(e){this._dirty!==e&&(this._dirty=e,this._onDidChangeDirty.fire())}get typeId(){return QA.ID}getName(){return d(15709,null)}getIcon(){return pto}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 QA}dispose(){for(let e of this.model.profiles)e instanceof am&&e.reset();super.dispose()}};QA=I([m(0,F)],QA);var H4t=class{canSerialize(i){return!0}serialize(i){return""}deserialize(i){return i.createInstance(QA)}};var nWi=new D("OpenProfile"),U4t=new D("Profiles"),Xfe=class extends C{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=I9e.bindTo(l),this.isCurrentProfileTransientContext=mto.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=x5.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)),Gt&&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(eTe(e)){let t=await this.openProfilesEditor();if(t)return t.createNewProfile(e),!0}return!1}async openProfilesEditor(){return await this.editorService.openEditor(new QA(this.instantiationService),void 0,ym)}registerEditor(){oe.as(rn.EditorPane).registerEditorPane(ys.create(wQ,wQ.ID,d(15634,null)),[new Mt(QA)]),oe.as(rn.EditorFactory).registerEditorSerializer(QA.ID,H4t)}registerDropHandler(){let e=oe.as(mW.DragAndDropContribution),t=this;this._register(e.registerDropHandler(new class{async handleDrop(n,r){let s=r.get(dt),l=r.get(PV),c=r.get(ee),u=r.get(lk),p=r.get(Ne);if(s.extUri.extname(n)===`.${b9e}`){if(!await l.resolveProfileTemplate(n))return p.warn(d(15618,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(15630,null,this.userDataProfileService.currentProfile.name);fe.appendMenuItem(D.GlobalActivity,{get title(){return e()},submenu:U4t,group:"2_configuration",order:1,when:x5}),fe.appendMenuItem(D.MenubarPreferencesMenu,{get title(){return e()},submenu:U4t,group:"2_configuration",order:1,when:x5})}registerOpenProfileSubMenu(){fe.appendMenuItem(D.MenubarFileMenu,{title:d(15621,null),submenu:nWi,group:"1_new",order:4})}registerProfilesActions(){this.profilesDisposable.value=new P;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(15611,"Switch to {0} profile",e.name)},toggled:x.equals(I9e.key,e.id),menu:[{id:U4t,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(15623,"New Window with Profile..."),category:oF,precondition:x5,f1:!0})}async run(t){let o=t.get(Ge),n=t.get(an),r=t.get(oi),s=await o.pick(n.profiles.map(l=>({label:l.name,profile:l})),{title:d(15622,null),placeHolder:d(15628,null),canPickMany:!1});if(s)return r.openWindow({remoteAuthority:null,forceProfile:s.profile.name})}})}registerNewWindowAction(e){let t=new P,o=`workbench.action.openProfile.${e.name.replace("/s+/","_")}`,n=x5;return t.add(W(class extends K{constructor(){super({id:o,title:L(15627,"{0}",e.name),metadata:{description:L(15625,"Open New Window with {0} Profile",e.name)},menu:{id:nWi,group:"0_profiles",when:n}})}run(s){return s.get(oi).openWindow({remoteAuthority:null,forceProfile:e.name})}})),t.add(fe.appendMenuItem(D.CommandPalette,{command:{id:o,category:oF,title:L(15624,"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(15633,"Switch Profile..."),category:oF,f1:!0})}async run(o){let n=o.get(Ge),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(15632,null)});s&&await e.userDataProfileManagementService.switchProfile(s.profile)}})}registerManageProfilesAction(){let e=new P;return e.add(W(class extends K{constructor(){super({id:"workbench.profiles.actions.manageProfiles",title:{...L(15619,"Profiles"),mnemonicTitle:d(15620,null)},menu:[{id:D.GlobalActivity,group:"2_configuration",order:1,when:x5.negate()},{id:D.MenubarPreferencesMenu,group:"2_configuration",order:1,when:x5.negate()},{id:U4t,group:"1_manage",order:1}]})}run(o){let n=o.get(ee),r=o.get(F);return n.openEditor(new QA(r),void 0,ym)}})),e.add(fe.appendMenuItem(D.CommandPalette,{command:{id:"workbench.profiles.actions.manageProfiles",category:We.Preferences,title:L(15626,"Open Profiles (UI)")}})),e}registerExportCurrentProfileAction(){let e=this,t=new P,o="workbench.profiles.actions.exportProfile";return t.add(W(class extends K{constructor(){super({id:o,title:L(15616,"Export Profile..."),category:oF,f1:!0})}async run(){(await e.openProfilesEditor())?.selectProfile(e.userDataProfileService.currentProfile)}})),t.add(fe.appendMenuItem(D.MenubarShare,{command:{id:o,title:L(15617,"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(15631,"Save Current Profile As..."),category:oF,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(15612,"New Profile..."),category:oF,f1:!0,menu:[{id:nWi,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(15614,"Delete Profile..."),category:oF,f1:!0,precondition:x5})}async run(t){let o=t.get(Ge),n=t.get(mn),r=t.get(an),s=t.get(UE),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(15613,null):void 0,profile:p})),{title:d(15615,null),placeHolder:d(15629,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:bhi,category:We.Help,menu:[{id:D.CommandPalette}]})}run(t){return t.get(Qe).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})}};Xfe=I([m(0,mn),m(1,an),m(2,UE),m(3,Te),m(4,Pe),m(5,t1e),m(6,X),m(7,ee),m(8,F),m(9,ao),m(10,nI),m(11,ru)],Xfe);var rWi=class a extends K{static{this.ID="workbench.profiles.actions.createTemporaryProfile"}static{this.TITLE=L(15636,"New Window with Temporary Profile")}constructor(){super({id:a.ID,title:a.TITLE,category:oF,f1:!0})}async run(i){i.get(oi).openWindow({forceTempProfile:!0})}};W(rWi);W(class extends K{constructor(){super({id:"workbench.profiles.actions.cleanupProfiles",title:L(15635,"Cleanup Profiles"),category:We.Developer,f1:!0})}async run(i){return i.get(an).cleanUp()}});W(class extends K{constructor(){super({id:"workbench.profiles.actions.resetWorkspaces",title:L(15637,"Reset Workspace Profiles Associations"),category:We.Developer,f1:!0})}async run(i){return i.get(an).resetWorkspaces()}});pt(Xfe.ID,Xfe,ut.BlockRestore);var xQ=L(9434,"Cloud Changes"),_H=ae("IEditSessionsStorageService"),_lt=ae("IEditSessionsLogService");var fEo=3,r1e="editSessionsSignedIn",vEo=new Q(r1e,!1),z4t="editSessionsPending",bEo=new Q(z4t,!1),sWi="workbench.view.editSessions",K4t="workbench.views.editSessions.data",Jfe=L(9434,"Cloud Changes"),SEo=Re("edit-sessions-view-icon",M.cloudDownload,d(9435,null)),G4t=new Q("editSessionsShowView",!1),s1e="vscode-edit-sessions";function $4t(a,i){switch(a){case 1:return Je.fromString(i);case 2:return Sl(i);default:throw new Error("Upgrade to a newer version to decode this content.")}}function q4t(a){let i=new Ly;return i.update(a),i.digest()}var Dlt="editSessions";var DH=class extends C{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,DH.CACHED_SESSION_STORAGE_KEY,this._store)(()=>this.onDidChangeStorage())),this.registerSignInAction(),this.registerResetAuthenticationAction(),this.signedInContext=vEo.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,lXe(_t()));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=lXe(_t());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 LF(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 RTe(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 Gt&&this.storageService.isNew(-1)&&this.storageService.isNew(1)}async getAccountPreference(e){let t=new P,o=t.add(this.quickInputService.createQuickPick({useSeparators:!0}));return o.ok=!1,o.placeholder=e==="read"?d(9411,null):d(9410,null),o.ignoreFocusOut=!0,o.items=await this.createQuickpickItems(),new Promise((n,r)=>{t.add(o.onDidHide(s=>{r(new ho),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(9419,null)});let t=await this.getAllSessions();e.push(...t),e.push({type:"separator",label:d(9413,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(9417,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(DH.CACHED_SESSION_STORAGE_KEY,-1)}set existingSessionId(e){this.logService.trace(`Saving authentication session preference for ID ${e}.`),e===void 0?this.storageService.remove(DH.CACHED_SESSION_STORAGE_KEY,-1):this.storageService.store(DH.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=x.and(x.equals(z4t,!1),x.equals(r1e,!1));this._register(W(class extends K{constructor(){super({id:t,title:d(9415,null),category:xQ,precondition:o,menu:[{id:D.CommandPalette},{id:D.AccountsContext,group:"2_editSessions",when:o}]})}async run(){return await e.initialize("write",!1)}})),this._register(fe.appendMenuItem(D.AccountsContext,{group:"2_editSessions",command:{id:t,title:d(9416,null)},when:x.and(x.equals(z4t,!0),x.equals(r1e,!1))}))}registerResetAuthenticationAction(){let e=this;this._register(W(class extends K{constructor(){super({id:"workbench.editSessions.actions.resetAuth",title:d(9414,null),category:xQ,precondition:x.equals(r1e,!0),menu:[{id:D.CommandPalette},{id:D.AccountsContext,group:"2_editSessions",when:x.equals(r1e,!0)}]})}async run(){let o=await e.dialogService.confirm({message:d(9418,null),checkbox:{label:d(9412,null)}});o.confirmed&&(o.checkboxChecked&&e.storeClient?.deleteResource("editSessions",null),e.clearAuthenticationPreference())}}))}};DH=I([m(0,be),m(1,le),m(2,Ge),m(3,Cs),m(4,lt),m(5,Co),m(6,_lt),m(7,nt),m(8,X),m(9,ct),m(10,LE)],DH);var a1e=class extends uU{constructor(i,e){super(),this.logger=this._register(i.createLogger(je(e.logsHome,`${Dlt}.log`),{id:Dlt,name:d(9436,null),group:vR}))}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()}};a1e=I([m(0,ol),m(1,Co)],a1e);var aWi="editSessionsCount",Nun=new Q(aWi,0),l1e=class extends C{constructor(e,t){super();this.instantiationService=t;this.registerViews(e)}registerViews(e){let t=K4t,o=this.instantiationService.createInstance(pK,t,Jfe.value);o.showCollapseAllAction=!0,o.showRefreshAction=!0,o.dataProvider=this.instantiationService.createInstance(Llt);let n=oe.as(on.ViewsRegistry);n.registerViews([{id:t,name:Jfe,ctorDescriptor:new Mt(eD),canToggleVisibility:!0,canMoveView:!1,treeView:o,collapsed:!1,when:x.and(G4t),order:100,hideByDefault:!0}],e),n.registerViewWelcomeContent(t,{content:d(9427,null,`[${d(9429,null)}](${ic("workbench.editSessions.actions.store")})`),when:x.equals(aWi,0),order:1}),this._register(W(class extends K{constructor(){super({id:"workbench.editSessions.actions.resume",title:d(9432,null),icon:M.desktopDownload,menu:{id:D.ViewItemContext,when:x.and(x.equals("view",t),x.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(9433,null),icon:M.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(9430,null),icon:M.trash,menu:{id:D.ViewItemContext,when:x.and(x.equals("view",t),x.regex("viewItem",/edit-session/i)),group:"inline"}})}async run(r,s){let l=A.parse(s.$treeItemHandle).path.substring(1),c=r.get(ct),u=r.get(_H);(await c.confirm({message:d(9425,null,l),detail:d(9424,null),type:"warning",title:Jfe.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(9431,null),icon:M.trash,menu:{id:D.ViewTitle,when:x.and(x.equals("view",t),x.greater(aWi,0))}})}async run(r){let s=r.get(ct),l=r.get(_H);(await s.confirm({message:d(9422,null),detail:d(9423,null),type:"warning",title:Jfe.value})).confirmed&&(await l.delete("editSessions",null),await o.refresh())}}))}};l1e=I([m(1,F)],l1e);var Llt=class{constructor(i,e,t,o){this.editSessionsStorageService=i;this.contextKeyService=e;this.workspaceContextService=t;this.fileService=o;this.editSessionsCount=Nun.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:s1e,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?Bs(t.created,!0):`${Bs(t.created,!0)}\xA0\xA0\u2022\xA0\xA0${c}`;e.push({handle:o.toString(),collapsibleState:1,label:{label:s},description:u,themeIcon:M.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:s1e,authority:"remote-session-content",path:`/${e.ref}/${o.name}`}).toString(),collapsibleState:1,label:{label:o.name},themeIcon:M.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:s1e,authority:"remote-session-content",path:`/${t.ref}/${e}/${s.relativeFilePath}`});if(n?.uri){let c=je(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:M.file,command:{id:"vscode.diff",title:d(9421,null),arguments:[c,l,`${No(s.relativeFilePath)} (${d(9426,null)} \u2194 ${d(9420,null)})`,void 0]}}}return{handle:l.toString(),resourceUri:l,collapsibleState:0,label:{label:s.relativeFilePath},themeIcon:M.file,command:{id:Zh,title:d(9428,null),arguments:[l,void 0,void 0]}}})):[]}};Llt=I([m(0,_H),m(1,X),m(2,Pe),m(3,be)],Llt);var Zfe=class{constructor(i){this.editSessionsStorageService=i;this.capabilities=2050;this.onDidChangeCapabilities=H.None;this.onDidChangeFile=H.None}static{this.SCHEMA=s1e}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 $4t(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 C.None}async mkdir(i){}async readdir(i){return[]}async rename(i,e,t){}async delete(i,e){}async writeFile(){throw new jG}};Zfe=I([m(0,_H)],Zfe);var Mlt=ae("IWorkspaceIdentityService"),Rlt=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(La(u,l)){let p=t[c],h=Fc(u,l);if(h)return je(A.parse(p),h)}}return l},s=(l,c=0)=>{if(!l||c>200||l instanceof Je||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}};Rlt=I([m(0,Pe),m(1,Wz)],Rlt);we(Mlt,Rlt,1);var lWi=class{async writeResource(){}async getAllResourceRefs(){return[]}async resolveResourceContent(){return null}},cWi=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){}},c1e=class extends aB{constructor(e,t,o,n,r,s,l,c,u,p,h,g){let f=new lWi,v=new cWi;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 $e,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",yIe(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=zg(o.content);if(!n)return this.logService.info("Skipping initializing workspace state because remote workspace state does not exist."),null;let r=new $e,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=zg(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}};c1e=I([m(4,be),m(5,Co),m(6,Te),m(7,B),m(8,le),m(9,dt),m(10,Mlt),m(11,_H)],c1e);var j4t=class extends sB{};we(_lt,a1e,1);we(_H,DH,1);var Q4t={id:"_workbench.editSessions.actions.continueEditSession",title:L(9371,"Continue Working On..."),precondition:mC.notEqualsTo("0"),f1:!0},Y4t={id:"_workbench.editSessions.actions.continueEditSession.openLocalFolder",title:L(9369,"Open In Local Folder"),category:xQ,precondition:x.and(ep.toNegated(),JL)},wEo={id:"workbench.editSessions.actions.showOutputChannel",title:L(9403,"Show Log"),category:xQ},Plt={id:"workbench.action.continueOn.extensions",title:d(9383,null)};W(class extends K{constructor(){super({...Plt,f1:!1})}async run(a){return a.get(zi).openSearch("@tag:continueOn")}});var dWi=`[${d(9401,null)}](command:${wEo.id})`,d1e={location:10,type:"syncing"},yEo="editSessionId",Fun="workbench.editSessions.continueOn",kQ=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N,O,V,U,G,$,te,pe,de){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=N;this.activityService=O;this.editorService=V;this.remoteAgentService=U;this.extensionService=G;this.requestService=$;this.userDataProfilesService=te;this.uriIdentityService=pe;this.workspaceIdentityService=de;this.continueEditSessionOptions=[];this.accountsMenuBadgeDisposable=this._register(new me);this.registeredCommands=new Set;this.shouldShowViewsContext=G4t.bindTo(this.contextKeyService),this.pendingEditSessionsContext=bEo.bindTo(this.contextKeyService),this.pendingEditSessionsContext.set(!1),this.productService["editSessions.store"]?.url&&(this.editSessionsStorageClient=new j4t(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 c1e(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(Zfe.SCHEMA,new Zfe(this.editSessionsStorageService))),this._register(this.lifecycleService.onWillShutdown(se=>{se.reason!==3&&this.editSessionsStorageService.isSignedIn&&this.configurationService.getValue("workbench.experimental.cloudChanges.autoStore")==="onShutdown"&&!Gt&&se.join(this.autoStoreEditSession(),{id:"autoStoreWorkingChanges",label:d(9361,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(d1e,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(d1e,async t=>await this.resumeEditSession(void 0,!0,void 0,void 0,t));else if(e){let t=this.storageService.getBoolean(kQ.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(d1e,async r=>await this.resumeEditSession(void 0,!0,void 0,void 0,r)),this.storageService.remove(kQ.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(kQ.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(d1e,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 qc(1,()=>d(9365,null));this.accountsMenuBadgeDisposable.value=this.activityService.showAccountsActivity({badge:e})}async autoStoreEditSession(){let e=new $e;await this.progressService.withProgress({location:10,type:"syncing",title:d(9404,null)},async()=>this.storeEditSession(!1,e.token),()=>{e.cancel(),e.dispose()})}registerViews(){let e=oe.as(on.ViewContainersRegistry).registerViewContainer({id:sWi,title:Jfe,ctorDescriptor:new Mt(Ha,[sWi,{mergeViewWithContainerWhenSingleView:!0}]),icon:SEo,hideIfEmpty:!0},0,{doNotRegisterOpenCommand:!0});this._register(this.instantiationService.createInstance(l1e,e))}registerActions(){this.registerContinueEditSessionAction(),this.registerResumeLatestEditSessionAction(),this.registerStoreLatestEditSessionAction(),this.registerContinueInLocalFolderAction(),this.registerShowEditSessionViewAction(),this.registerShowEditSessionOutputChannelAction()}registerShowEditSessionOutputChannelAction(){this._register(W(class extends K{constructor(){super(wEo)}run(t,...o){t.get(Ml).showChannel(Dlt)}}))}registerShowEditSessionViewAction(){let e=this;this._register(W(class extends K{constructor(){super({id:"workbench.editSessions.actions.showEditSessions",title:L(9402,"Show Cloud Changes"),category:xQ,f1:!0})}async run(o){e.shouldShowViewsContext.set(!0),await o.get(Ft).openView(K4t)}}))}registerContinueEditSessionAction(){let e=this;this._register(W(class extends K{constructor(){super(Q4t)}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 $e;try{c=await e.progressService.withProgress({location:15,cancellable:!0,type:"syncing",title:d(9406,null)},async()=>{let p=await e.storeEditSession(!1,u.token);return p!==void 0?e.telemetryService.publicLog2("continueOn.editSessions.store.outcome",{outcome:"storeSucceeded",hashedId:q4t(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+`&${yEo}=${u}&continueOn=1`:`${yEo}=${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 ${Q4t.id}.`)}}))}registerResumeLatestEditSessionAction(){let e=this;this._register(W(class extends K{constructor(){super({id:"workbench.editSessions.actions.resumeLatest",title:L(9400,"Resume Latest Changes from Cloud"),category:xQ,f1:!0})}async run(o,n,r){await e.progressService.withProgress({...d1e,title:dWi},async()=>await e.resumeEditSession(n,void 0,r))}})),this._register(W(class extends K{constructor(){super({id:"workbench.editSessions.actions.resumeFromSerializedPayload",title:L(9396,"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({...d1e,title:dWi},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(9405,"Store Working Changes in Cloud"),category:xQ,f1:!0})}async run(o){let n=new $e;await e.progressService.withProgress({location:15,title:d(9407,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(9366,null)});let l=s?{content:s,ref:""}:await this.editSessionsStorageService.read("editSessions",e);if(!l){e===void 0&&!t?this.notificationService.info(d(9390,null)):e!==void 0&&this.notificationService.warn(d(9391,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:dWi});let c=JSON.parse(l.content);if(e=l.ref,c.version>fEo){this.notificationService.error(d(9367,null,this.productService.nameLong)),this.telemetryService.publicLog2("editSessions.resume.outcome",{hashedId:q4t(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:St.Warning,message:p.length>1?d(9398,null,p.length):d(9397,null,Ye(p[0].uri)),detail:p.length>1?Xw(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,$4t(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:q4t(e),outcome:"resumeSucceeded"})}catch(u){this.logService.error("Failed to resume edit session, reason: ",u.toString()),this.notificationService.error(d(9399,null))}performance.mark("code/didResumeEditSessionFromIdentifier")}async generateChanges(e,t,o=!1,n=!1){let r=[],s=[],l=this.contextService.getWorkspace().folders,c=new $e;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}...`),uo(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(St.Info,d(9388,null),[{label:d(9395,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=je(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([Q0(n),Q0(Qd((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 Mn;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=Fc(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=Qd((await this.fileService.readFile(b)).value);if(n+=w.length,n>this.editSessionsStorageService.SIZE_LIMIT){this.notificationService.error(d(9394,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(9392,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 Em&&(c.code==="TooLarge"?(this.telemetryService.publicLog2("editSessions.upload.failed",{reason:"TooLarge"}),this.notificationService.error(d(9394,null))):(this.telemetryService.publicLog2("editSessions.upload.failed",{reason:"unknown"}),this.notificationService.error(d(9393,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(Fun)==="off")return this.telemetryService.publicLog2("continueOn.editSessions.canStore.outcome",{outcome:"disabledEditSessionsViaSetting"}),!1;if(this.hasEditSession()){let e=new P,t=e.add(this.quickInputService.createQuickPick());t.placeholder=d(9370,null),t.ok=!1,t.ignoreFocusOut=!0;let o={label:d(9408,null)},n={label:d(9409,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 ho),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(){Vun.setHandler(e=>{let t=[];for(let o of e)if(Ea(o.description,"contribEditSessions")&&Array.isArray(o.value))for(let n of o.value){let r=fe.getCommand(n.command);if(!r)return;let s=r.icon,l=typeof r.title=="string"?r.title:r.title.value,c=x.deserialize(n.when);t.push(new Alt(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:`${Q4t.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(Q4t.id,void 0,e)}})),r!==void 0&&fe.appendMenuItem(D.StatusBarRemoteIndicatorMenu,{group:r,command:s,when:s.precondition}))}registerContinueInLocalFolderAction(){let e=this;this._register(W(class extends K{constructor(){super(Y4t)}async run(o){let n=await e.fileDialogService.showOpenDialog({title:d(9372,null),canSelectFolders:!0,canSelectMany:!1,canSelectFiles:!1,availableFileSystems:[Y.file]});return n?.length!==1?void 0:A.from({scheme:e.productService.urlProtocol,authority:Y.file,path:n[0].path})}})),XL(this.contextService.getWorkspace())!==void 0&&kr&&this.generateStandaloneOptionCommand(Y4t.id,d(9387,null),void 0,Y4t.precondition,void 0)}async pickContinueEditSessionDestination(){let e=new P,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(9382,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===Plt.id?this.commandService.executeCommand(Plt.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 ho?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 XL(this.contextService.getWorkspace())!==void 0&&kr&&e.push(new Alt("$(folder) "+d(9381,null),Y4t.id,d(9380,null))),e.sort((o,n)=>o.label.localeCompare(n.label)).concat({type:"separator"},new Alt(Plt.title,Plt.id))}};kQ=I([m(0,_H),m(1,be),m(2,Bo),m(3,Qe),m(4,Te),m(5,$c),m(6,Ne),m(7,ct),m(8,_lt),m(9,Co),m(10,F),m(11,nt),m(12,B),m(13,Pe),m(14,Wz),m(15,Ge),m(16,ge),m(17,X),m(18,dn),m(19,ao),m(20,le),m(21,zl),m(22,ee),m(23,yo),m(24,lt),m(25,_a),m(26,an),m(27,dt),m(28,Mlt)],kQ);var Wun=q.asClassName(M.info),Alt=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:Wun,tooltip:d(9389,null)}])}},Vun=Tn.registerExtensionPoint({extensionPoint:"continueEditSession",jsonSchema:{description:d(9373,null),type:"array",items:{type:"object",properties:{command:{description:d(9374,null),type:"string"},group:{description:d(9376,null),type:"string"},qualifiedName:{description:d(9377,null),type:"string"},description:{description:d(9375,null),type:"string"},remoteGroup:{description:d(9378,null),type:"string"},when:{description:d(9379,null),type:"string"}},required:["command"]}}}),Bun=oe.as(Qi.Workbench);Bun.registerWorkbenchContribution(kQ,3);oe.as(ii.Configuration).registerConfiguration({...Cm,properties:{"workbench.experimental.cloudChanges.autoStore":{enum:["onShutdown","off"],enumDescriptions:[d(9363,null),d(9362,null)],type:"string",tags:["experimental","usesOnlineServices"],default:"off",markdownDescription:d(9364,null)},"workbench.cloudChanges.autoResume":{enum:["onReload","off"],enumDescriptions:[d(9360,null),d(9359,null)],type:"string",tags:["usesOnlineServices"],default:"onReload",markdownDescription:d(9358,null)},"workbench.cloudChanges.continueOn":{enum:["prompt","off"],enumDescriptions:[d(9386,null),d(9385,null)],type:"string",tags:["usesOnlineServices"],default:"prompt",markdownDescription:d(9384,null)},"workbench.experimental.cloudChanges.partialMatches.enabled":{type:"boolean",tags:["experimental","usesOnlineServices"],default:!1,markdownDescription:d(9368,null)}}});var Hun=Tn.registerExtensionPoint({extensionPoint:"remoteCodingAgents",jsonSchema:{description:d(12856,null),type:"array",items:{type:"object",properties:{id:{description:d(12861,null),type:"string"},command:{description:d(12857,null),type:"string"},displayName:{description:d(12859,null),type:"string"},description:{description:d(12858,null),type:"string"},followUpRegex:{description:d(12860,null),type:"string"},when:{description:d(12862,null),type:"string"}},required:["command","displayName"]}}}),Nlt=class extends C{constructor(e){super();this.remoteCodingAgentsService=e;Hun.setHandler(t=>{for(let o of t)if(Ea(o.description,"remoteCodingAgents")&&Array.isArray(o.value))for(let n of o.value){if(!fe.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)}})}};Nlt=I([m(0,vnt)],Nlt);var Uun=oe.as(Qi.Workbench);Uun.registerWorkbenchContribution(Nlt,3);var zun=a=>({type:"string",enum:["always","explicit","never",!0,!1],enumDescriptions:[d(8146,null),d(8151,null),d(8155,null),d(8152,null),d(8156,null)],default:"explicit",description:a}),Kun=a=>({type:["string","boolean"],enum:["explicit","never",!0,!1],enumDescriptions:[d(8149,null),d(8153,null),d(8150,null),d(8154,null)],default:"explicit",description:a}),uWi={oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"array",items:{type:"string"}}],markdownDescription:d(8148,null,"`#files.autoSave#`"),type:["object","array"],additionalProperties:{type:"string",enum:["always","explicit","never",!0,!1]},default:{},scope:6},mWi=Object.freeze({...nC,properties:{"editor.codeActionsOnSave":uWi}}),pWi={oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"array",items:{type:"string"}}],markdownDescription:d(8157,null,"`#files.autoSave#`"),type:"object",additionalProperties:{type:["string","boolean"],enum:["explicit","never",!0,!1]},default:{}},CEo=Object.freeze({...nC,properties:{"notebook.codeActionsOnSave":pWi}}),u1e=class extends C{constructor(e,t){super();this.languageFeatures=t;this._onDidChangeSchemaContributions=this._register(new E);this._allProvidedCodeActionKinds=[];this._register(H.runAndSubscribe(H.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 Is(o));return Array.from(e.values())}updateConfigurationSchema(e){let t={...uWi.properties},o={...pWi.properties};for(let n of e)gr.Source.contains(n)&&!t[n.value]&&(t[n.value]=zun(d(8147,null,n.value)),o[n.value]=Kun(d(8147,null,n.value)));uWi.properties=t,pWi.properties=o,oe.as(ii.Configuration).notifyConfigurationSchemaUpdated(mWi)}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(Swe,t(Is.Empty)),e(ywe,t(gr.Refactor)),e(wwe,t(gr.Source))]}};u1e=I([m(0,_e),m(1,zt)],u1e);oe.as(ii.Configuration).registerConfiguration(mWi);oe.as(ii.Configuration).registerConfiguration(CEo);oe.as(Qi.Workbench).registerWorkbenchContribution(u1e,4);var X4t=new Q("timelineHasProvider",!1),p1e=class extends C{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 jt);this.hasProviderContext=X4t.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(pMt,!0),this._onDidChangeUri.fire(e)}updateHasProviderContext(){this.hasProviderContext.set(this.providers.size!==0)}};p1e=I([m(0,ne),m(1,Ft),m(2,B),m(3,X)],p1e);var kEo=22;function J4t(a){return a instanceof Vlt}function Wlt(a){return!!a&&!a.handle.startsWith("vscode-command:")}function xEo(a,i){return a.relativeTime=Wlt(a)?Bs(a.timestamp):void 0,a.relativeTimeFullWord=Wlt(a)?Bs(a.timestamp,!1,!0):void 0,i===void 0||a.relativeTime!==i?(i=a.relativeTime,a.hideRelativeTime=!1):a.hideRelativeTime=!0,i}var hWi=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}},Vlt=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(15465,null):d(15466,null)}get themeIcon(){}},gWi=new Q("timelineFollowActiveEditor",!0,!0),Gun=new Q("timelineExcludeSources","[]",!0),$un=new Q("timelineFocused",!0),hne=class extends zr{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(Flt,this)),this.followActiveEditorContext=gWi.bindTo(this.contextKeyService),this.timelineExcludeSourcesContext=Gun.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(15460,"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/kEo)+(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=no.getOriginalUri(this.editorService.activeEditor,{supportSideBySide:1});if(this.uriIdentityService.extUri.isEqual(e,this.uri)&&e!==void 0||e?.fsPath===this.uri?.fsPath&&(e?.scheme===Y.file||e?.scheme==="git")&&(this.uri?.scheme===Y.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===Y.vscodeSettings||this.uri?.scheme===Y.webviewPanel||this.uri?.scheme===Y.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 $e,c=this.timelineService.getTimeline(e,t,n,l);if(c===void 0)return l.dispose(),!1;let u=new P;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 hWi(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]=ht.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=xEo(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=xEo(p,c),yield{element:p}}u.nextItem=u.iterator.next()}}this._visibleItemCount=o,o>0&&(e?yield{element:new Vlt(this.pendingRequests.size!==0)}:this.pendingRequests.size!==0&&(yield{element:new Vlt(!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(15463,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(15471,null):this.configurationService.getValue("workbench.localHistory.enabled")&&!this.excludedSources.has("timeline.localHistory")?this.message=d(15467,null):this.excludedSources.size>0?this.message=d(15470,null):this.message=d(15469,null),(!e||e===0)&&(this.message+=" "+d(15468,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=new P,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=R(this.$container,_(".message")),this.$message.classList.add("timeline-subtle"),this.message=d(15463,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(Olt,this.commands,this.viewDescriptorService.getViewLocationById(this.id))),this._register(this.treeRenderer.onDidScrollToEnd(t=>{this.pageOnScroll&&this.loadMore(t)})),this.tree=this.instantiationService.createInstance(mg,"TimelinePane",this.$tree,new bWi,[this.treeRenderer],{identityProvider:new fWi,accessibilityProvider:{getAriaLabel(t){return J4t(t)?t.ariaLabel:t.accessibilityInformation?t.accessibilityInformation.label:d(15462,null,t.relativeTimeFullWord??"",t.label)},getRole(t){return J4t(t)?"treeitem":t.accessibilityInformation&&t.accessibilityInformation.role?t.accessibilityInformation.role:"treeitem"},getWidgetAriaLabel(){return d(15461,null)}},keyboardNavigationLabelProvider:new vWi,multipleSelectionSupport:!1,overrideStyles:this.getLocationBasedColors().listOverrideStyles}),$un.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(Wlt(n)){if(n.command){let r=n.command.arguments??[];(n.command.id===Zh||n.command.id===NC)&&(r=[...r,t]),this.commandService.executeCommand(n.command.id,...r)}}else J4t(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(15464,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 Lr(s,s,{label:!0,keybinding:l.getLabel()})},onHide:s=>{s&&this.tree.domFocus()},getActionsContext:()=>({uri:this.uri,item:o}),actionRunner:new Z4t})}};I([Nd(500)],hne.prototype,"refreshDebounced",1),hne=I([m(1,_e),m(2,ze),m(3,X),m(4,B),m(5,le),m(6,Ri),m(7,F),m(8,ee),m(9,ge),m(10,Bo),m(11,Zz),m(12,Qe),m(13,De),m(14,tt),m(15,ot),m(16,dt),m(17,lt)],hne);var Blt=class{static{this.id="TimelineElementTemplate"}constructor(i,e,t){i.classList.add("custom-view-tree-node-item"),this.icon=R(i,_(".custom-view-tree-node-item-icon")),this.iconLabel=new Lc(i,{supportHighlights:!0,supportIcons:!0,hoverDelegate:t});let o=R(this.iconLabel.element,_(".timeline-timestamp-container"));this.timestamp=R(o,_("span.timeline-timestamp"));let n=R(this.iconLabel.element,_(".actions"));this.actionBar=new ji(n,{actionViewItemProvider:e})}dispose(){this.iconLabel.dispose(),this.actionBar.dispose()}reset(){this.icon.className="",this.icon.style.backgroundImage="",this.actionBar.clear()}},fWi=class{getId(i){return i.handle}},Z4t=class extends as{async runAction(i,{uri:e,item:t}){if(!Wlt(t)){await i.run();return}await i.run({$mid:12,handle:t.handle,source:t.source,uri:e},e,t.source)}},vWi=class{getKeyboardNavigationLabel(i){return i.label}},bWi=class{getHeight(i){return kEo}getTemplateId(i){return Blt.id}},Olt=class extends C{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=Blt.id;this.actionViewItemProvider=Ca.bind(void 0,this.instantiationService),this._hoverDelegate=this.instantiationService.createInstance(mv,this.viewContainerLocation===1?"mouse":"element",{instantHover:this.viewContainerLocation!==1},{position:{hoverPosition:1}})}setUri(e){this.uri=e}renderTemplate(e){return new Blt(e,this.actionViewItemProvider,this._hoverDelegate)}renderElement(e,t,o){o.reset();let{element:n}=e,r=this.themeService.getColorTheme(),s=Ip(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=Na(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?Ae(n.tooltip)?n.tooltip:{markdown:n.tooltip,markdownNotSupportedFallback:qa(n.tooltip)}:void 0;o.iconLabel.setLabel(n.label,n.description,{title:c,matches:ua(e.filterData)}),o.timestamp.textContent=n.relativeTime??"",o.timestamp.ariaLabel=n.relativeTimeFullWord??"",o.timestamp.parentElement.classList.toggle("timeline-timestamp--duplicate",Wlt(n)&&n.hideRelativeTime),o.actionBar.context={uri:this.uri,item:n},o.actionBar.actionRunner=new Z4t,o.actionBar.push(this.commands.getItemActions(n),{icon:!0,label:!1}),J4t(n)&&setTimeout(()=>this._onDidScrollToEnd.fire(n),0)}disposeElement(e,t,o){o.actionBar.actionRunner.dispose()}disposeTemplate(e){e.dispose()}};Olt=I([m(2,F),m(3,De)],Olt);var qun=Re("timeline-refresh",M.refresh,d(15475,null)),jun=Re("timeline-pin",M.pin,d(15474,null)),Qun=Re("timeline-unpin",M.pinned,d(15476,null)),Flt=class extends C{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 P),this._register(W(class extends K{constructor(){super({id:"timeline.refresh",title:L(15459,"Refresh"),icon:qun,category:L(15460,"Timeline"),menu:{id:D.TimelineTitle,group:"navigation",order:99}})}run(s,...l){e.reset()}})),this._register(qe.registerCommand("timeline.toggleFollowActiveEditor",(s,...l)=>e.followActiveEditor=!e.followActiveEditor)),this._register(fe.appendMenuItem(D.TimelineTitle,{command:{id:"timeline.toggleFollowActiveEditor",title:L(15472,"Pin the Current Timeline"),icon:jun,category:L(15460,"Timeline")},group:"navigation",order:98,when:gWi})),this._register(fe.appendMenuItem(D.TimelineTitle,{command:{id:"timeline.toggleFollowActiveEditor",title:L(15473,"Unpin the Current Timeline"),icon:Qun,category:L(15460,"Timeline")},group:"navigation",order:98,when:gWi.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 Ef(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:x.regex("timelineExcludeSources",new RegExp(`\\b${Yr(t.id)}\\b`)).negate()})}run(o,...n){e.delete(t.id)||e.add(t.id),o.get(le).store("timeline.excludeSources",JSON.stringify([...e.keys()]),0,0)}}))}};Flt=I([m(1,Zz),m(2,le),m(3,X),m(4,qt)],Flt);var Yun=Re("timeline-view-icon",M.history,d(15458,null)),Xun=Re("timeline-open",M.history,d(15457,null)),SWi=class{constructor(){this.id=pMt;this.name=hne.TITLE;this.containerIcon=Yun;this.ctorDescriptor=new Mt(hne);this.order=2;this.weight=30;this.collapsed=!0;this.canToggleVisibility=!0;this.hideByDefault=!1;this.canMoveView=!0;this.when=X4t;this.focusCommand={id:"timeline.focus"}}},Jun=oe.as(ii.Configuration);Jun.registerConfiguration({id:"timeline",order:1001,title:d(15455,null),type:"object",properties:{"timeline.pageSize":{type:["number","null"],default:50,markdownDescription:d(15454,null)},"timeline.pageOnScroll":{type:"boolean",default:!0,description:d(15453,null)}}});oe.as(on.ViewsRegistry).registerViews([new SWi],Vge);var Hlt;(t=>{t.ID="files.openTimeline",t.LABEL=d(15451,null);function e(){return(o,n)=>{let r=o.get(Zz);if(A.isUri(n))return r.setUri(n)}}t.handler=e})(Hlt||={});qe.registerCommand(Hlt.ID,Hlt.handler());fe.appendMenuItem(D.ExplorerContext,{group:"4_timeline",order:1,command:{id:Hlt.ID,title:Hlt.LABEL,icon:Xun},when:x.and(lu.toNegated(),Fo.HasResource,X4t)});var Zun=Re("timeline-filter",M.filter,d(15456,null));fe.appendMenuItem(D.TimelineTitle,{submenu:D.TimelineFilterSubMenu,title:d(15452,null),group:"navigation",order:100,icon:Zun});we(Zz,p1e,1);var yy=ae("workingCopyHistoryService"),m1e=20;var lM=class a{constructor(i){this.fileService=i;this.mapSchemeToProvider=new Map;this.onDidChangeCapabilities=H.None;this.onDidChangeFile=H.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 Xe(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(Xe(a.EMPTY_RESOURCE,e))return Je.fromString("").buffer;let t=await this.withProvider(e);if(XT(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 C.None}};var IWi;function e3t(){if(!IWi){let a={year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"numeric"},i=Wu.DateTimeFormat(Dr,a).value;IWi={format:e=>i.format(e)}}return IWi}var yWi="localHistory:item",LH=x.equals("timelineItem",yWi),EEo=Re("localHistory-icon",M.circleOutline,d(10820,null)),TEo=Re("localHistory-restore",M.check,d(10821,null));var CWi=L(10832,"Local History"),t3t=x.has("config.workbench.localHistory.enabled"),xWi=L(10833,"Compare with File");W(class extends K{constructor(){super({id:"workbench.action.localHistory.compareWithFile",title:xWi,menu:{id:D.TimelineItemContext,group:"1_compare",order:1,when:LH}})}async run(a,i){let e=a.get(ge),t=a.get(yy),{entry:o}=await RH(t,i);if(o)return e.executeCommand(NC,...g1e(o,o.workingCopy.resource))}});W(class extends K{constructor(){super({id:"workbench.action.localHistory.compareWithPrevious",title:L(10834,"Compare with Previous"),menu:{id:D.TimelineItemContext,group:"1_compare",order:2,when:LH}})}async run(a,i){let e=a.get(ge),t=a.get(yy),o=a.get(ee),{entry:n,previous:r}=await RH(t,i);if(n)return r?e.executeCommand(NC,...g1e(r,n)):kWi(n,o)}});var wWi,_Eo=new Q("localHistoryItemSelectedForCompare",!1,!0);W(class extends K{constructor(){super({id:"workbench.action.localHistory.selectForCompare",title:L(10844,"Select for Compare"),menu:{id:D.TimelineItemContext,group:"2_compare_with",order:2,when:LH}})}async run(a,i){let e=a.get(yy),t=a.get(X),{entry:o}=await RH(e,i);o&&(wWi=i,_Eo.bindTo(t).set(!0))}});W(class extends K{constructor(){super({id:"workbench.action.localHistory.compareWithSelected",title:L(10835,"Compare with Selected"),menu:{id:D.TimelineItemContext,group:"2_compare_with",order:1,when:x.and(LH,_Eo)}})}async run(a,i){let e=a.get(yy),t=a.get(ge);if(!wWi)return;let o=(await RH(e,wWi)).entry;if(!o)return;let{entry:n}=await RH(e,i);if(n)return t.executeCommand(NC,...g1e(o,n))}});W(class extends K{constructor(){super({id:"workbench.action.localHistory.open",title:L(10839,"Show Contents"),menu:{id:D.TimelineItemContext,group:"3_contents",order:1,when:LH}})}async run(a,i){let e=a.get(yy),t=a.get(ee),{entry:o}=await RH(e,i);if(o)return kWi(o,t)}});var DEo=L(10841,"Restore Contents");W(class extends K{constructor(){super({id:"workbench.action.localHistory.restoreViaEditor",title:DEo,menu:{id:D.EditorTitle,group:"navigation",order:-10,when:Fo.Scheme.isEqualTo(lM.SCHEMA)},icon:TEo})}async run(a,i){let{associatedResource:e,location:t}=lM.fromLocalHistoryFileSystem(i);return LEo(a,{uri:e,handle:Ra(t)})}});W(class extends K{constructor(){super({id:"workbench.action.localHistory.restore",title:DEo,menu:{id:D.TimelineItemContext,group:"3_contents",order:2,when:LH}})}async run(a,i){return LEo(a,i)}});var epn=ph.registerSource("localHistoryRestore.source",d(10848,null));async function LEo(a,i){let e=a.get(be),t=a.get(ct),o=a.get(Wa),n=a.get(yy),r=a.get(ee),{entry:s}=await RH(n,i);if(s){let{confirmed:l}=await t.confirm({type:"warning",message:d(10827,null,Ye(s.workingCopy.resource)),detail:d(10826,null),primaryButton:d(10851,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(10854,null,Ye(s.workingCopy.resource)),In(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:epn},ve.None),await REo(s,r)}}W(class extends K{constructor(){super({id:"workbench.action.localHistory.restoreViaPicker",title:L(10842,"Find Entry to Restore"),f1:!0,category:CWi,precondition:t3t})}async run(a){let i=a.get(yy),e=a.get(Ge),t=a.get(Ct),o=a.get(kt),n=a.get(ot),r=a.get(ee),s=a.get(be),l=a.get(ge),c=a.get(zs),u=new P,p=u.add(e.createQuickPick()),h=new $e;u.add(p.onDidHide(()=>h.dispose(!0))),p.busy=!0,p.show();let g=new Mn(await i.getAll(h.token)),f=new Mn(si(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(10853,null),p.matchOnLabel=!0,p.matchOnDescription=!0,p.items=[...v].map(k=>({resource:k,label:Ra(k),description:n.getUriLabel(ci(k),{relative:!0}),iconClasses:js(t,o,k)})),await H.toPromise(p.onDidAccept),u.dispose();let b=p.selectedItems.at(0)?.resource;if(!b)return;let S=new P,y=S.add(e.createQuickPick());h=new $e,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(10852,null),y.matchOnLabel=!0,y.matchOnDescription=!0,y.items=Array.from(w).reverse().map(k=>({entry:k,label:`$(circle-outline) ${ph.getSourceLabel(k.source)}`,description:h1e(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(NC,...g1e(T.entry,T.entry.workingCopy.resource,{preserveFocus:k.inBackground})):kWi(T.entry,r,{preserveFocus:k.inBackground}):void 0}))}});fe.appendMenuItem(D.TimelineTitle,{command:{id:"workbench.action.localHistory.restoreViaPicker",title:L(10843,"Local History: Find Entry to Restore...")},group:"submenu",order:1,when:t3t});W(class extends K{constructor(){super({id:"workbench.action.localHistory.rename",title:L(10840,"Rename"),menu:{id:D.TimelineItemContext,group:"5_edit",order:1,when:LH}})}async run(a,i){let e=a.get(yy),t=a.get(Ge),{entry:o}=await RH(e,i);if(o){let n=new P,r=n.add(t.createInputBox());r.title=d(10849,null),r.ignoreFocusOut=!0,r.placeholder=d(10850,null),r.value=ph.getSourceLabel(o.source),r.show(),n.add(r.onDidAccept(()=>{r.value&&e.updateEntry(o,{source:r.value},ve.None),n.dispose()}))}}});W(class extends K{constructor(){super({id:"workbench.action.localHistory.delete",title:L(10837,"Delete"),menu:{id:D.TimelineItemContext,group:"5_edit",order:2,when:LH}})}async run(a,i){let e=a.get(yy),t=a.get(ee),o=a.get(ct),{entry:n}=await RH(e,i);if(n){let{confirmed:r}=await o.confirm({type:"warning",message:d(10825,null,n.workingCopy.name,h1e(n.timestamp)),detail:d(10824,null),primaryButton:d(10831,null)});if(!r)return;await e.removeEntry(n,ve.None),await REo(n,t)}}});W(class extends K{constructor(){super({id:"workbench.action.localHistory.deleteAll",title:L(10838,"Delete All"),f1:!0,category:CWi,precondition:t3t})}async run(a){let i=a.get(ct),e=a.get(yy),{confirmed:t}=await i.confirm({type:"warning",message:d(10823,null),detail:d(10822,null),primaryButton:d(10830,null)});t&&await e.removeAll(ve.None)}});W(class extends K{constructor(){super({id:"workbench.action.localHistory.create",title:L(10836,"Create Entry"),f1:!0,category:CWi,precondition:x.and(t3t,fr)})}async run(a){let i=a.get(yy),e=a.get(Ge),t=a.get(ee),o=a.get(ot),n=a.get(wn),r=no.getOriginalUri(t.activeEditor,{supportSideBySide:1});if(r?.scheme!==n.defaultUriScheme&&r?.scheme!==Y.vscodeUserData)return;let s=new P,l=s.add(e.createInputBox());l.title=d(10828,null),l.ignoreFocusOut=!0,l.placeholder=d(10829,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},ve.None)}))}});async function kWi(a,i,e){let t=lM.toLocalHistoryFileSystem({location:a.location,associatedResource:a.workingCopy.resource});await i.openEditor({resource:t,label:d(10847,null,a.workingCopy.name,ph.getSourceLabel(a.source),h1e(a.timestamp)),options:e})}async function REo(a,i){let e=lM.toLocalHistoryFileSystem({location:a.location,associatedResource:a.workingCopy.resource}),t=i.findEditors(e,{supportSideBySide:4});await i.closeEditors(t,{preserveFocus:!0})}function g1e(a,i,e){let t=lM.toLocalHistoryFileSystem({location:a.location,associatedResource:a.workingCopy.resource}),o,n;if(A.isUri(i))n=i,o=d(10845,null,a.workingCopy.name,ph.getSourceLabel(a.source),h1e(a.timestamp),a.workingCopy.name);else{let r=i;n=lM.toLocalHistoryFileSystem({location:r.location,associatedResource:r.workingCopy.resource}),o=d(10846,null,a.workingCopy.name,ph.getSourceLabel(a.source),h1e(a.timestamp),r.workingCopy.name,ph.getSourceLabel(r.source),h1e(r.timestamp))}return[t,n,o,e?[void 0,e]:void 0]}async function RH(a,i){let e=await a.getEntries(i.uri,ve.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 tpn=/\//g;function h1e(a){return`${e3t().format(a).replace(tpn,"-")}`}var LG=class extends C{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(10855,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(lM.SCHEMA,new lM(this.fileService)))}updateTimelineRegistration(){this.configurationService.getValue(LG.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(LG.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===lM.SCHEMA?r=lM.fromLocalHistoryFileSystem(e).associatedResource:e.scheme===this.pathService.defaultUriScheme||e.scheme===Y.vscodeUserData?r=e:this.fileService.hasProvider(e)&&(r=A.from({scheme:this.pathService.defaultUriScheme,authority:this.environmentService.remoteAuthority??H7i(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:ph.getSourceLabel(e.source),tooltip:new xe(`$(history) ${e3t().format(e.timestamp)}

${ph.getSourceLabel(e.source)}${e.sourceDescription?` (${e.sourceDescription})`:""}`,{supportThemeIcons:!0}),source:this.id,timestamp:e.timestamp,themeIcon:EEo,contextValue:yWi,command:{id:NC,title:xWi.value,arguments:g1e(e,e.workingCopy.resource)}}}};LG=I([m(0,Zz),m(1,yy),m(2,wn),m(3,be),m(4,Vt),m(5,B),m(6,Pe)],LG);pt(LG.ID,LG,ut.BlockRestore);var TWi=Re("workspace-trust-banner",M.shield,d(16285,null)),ipn=Re("workspace-trust-editor-check",M.check,d(16268,null)),opn=Re("workspace-trust-editor-cross",M.x,d(16325,null)),npn=Re("workspace-trust-editor-folder-picker",M.folder,d(16273,null)),rpn=Re("workspace-trust-editor-edit-folder",M.edit,d(16271,null)),spn=Re("workspace-trust-editor-remove-folder",M.close,d(16282,null)),Ult=class extends C{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(rC,"WorkspaceTrust",c,new zlt,[{label:d(16274,null),tooltip:"",weight:1,templateId:vne.TEMPLATE_ID,project(g){return g}},{label:d(16280,null),tooltip:"",weight:8,templateId:fne.TEMPLATE_ID,project(g){return g}},{label:"",tooltip:"",weight:1,minimumWidth:75,maximumWidth:75,templateId:gne.TEMPLATE_ID,project(g){return g}}],[this.instantiationService.createInstance(vne),this.instantiationService.createInstance(fne,this),this.instantiationService.createInstance(gne,this,this.currentWorkspaceUri)],{horizontalScrolling:!1,alwaysConsumeMouseWheel:!1,openOnSingleClick:!1,multipleSelectionSupport:!1,accessibilityProvider:{getAriaLabel:g=>{let f=i3t(this.labelService,g);return f===void 0||f.length===0?d(16292,null,this.labelService.getUriLabel(g.uri)):d(16296,null,this.labelService.getUriLabel(g.uri),f)},getWidgetAriaLabel:()=>d(16293,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 _x(u)),h=this._register(p.addButton({title:d(16267,null),...Ko}));h.label=d(16267,null),this._register(h.onDidClick(async()=>{let g=await this.fileDialogService.showOpenDialog({canSelectFiles:!1,canSelectFolders:!0,canSelectMany:!1,defaultUri:this.currentWorkspaceUri,openLabel:d(16311,null),title:d(16284,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===Y.file)return-1;if(s.uri.scheme===Y.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*zlt.ROW_HEIGHT+zlt.HEADER_ROW_HEIGHT,void 0)}updateTable(){let e=this.trustedUriEntries;this.container.classList.toggle("empty",e.length===0),this.descriptionElement.innerText=e.length?d(16294,null):d(16279,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(Lo.sep).filter(n=>n.length);if(o.length===0&&e.startsWith(Lo.sep))return{type:2,content:d(16286,null,i3t(this.labelService,t))};if(o.length===1)return{type:2,content:d(16309,null,o[0],i3t(this.labelService,t))};if(o.length>2)return{type:3,content:d(16275,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===Y.file||e.uri.scheme===this.currentWorkspaceUri.scheme&&this.uriService.extUri.isEqualAuthority(this.currentWorkspaceUri.authority,e.uri.authority)&&!gce(e.uri))&&t){let n=await this.fileDialogService.showOpenDialog({canSelectFiles:!1,canSelectFolders:!0,canSelectMany:!1,defaultUri:e.uri,openLabel:d(16311,null),title:d(16284,null)});n?this.acceptEdit(e,n[0]):this.rejectEdit(e)}else this.selectTrustedUriEntry(e),this._onEdit.fire(e)}};Ult=I([m(1,F),m(2,Pe),m(3,ns),m(4,dt),m(5,ot),m(6,dn)],Ult);var zlt=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}},gne=class{constructor(i,e,t){this.table=i;this.currentWorkspaceUri=e;this.uriService=t;this.templateId=gne.TEMPLATE_ID}static{this.TEMPLATE_ID="actions"}renderTemplate(i){let e=i.appendChild(_(".actions"));return{actionBar:new ji(e)}}renderElement(i,e,t){t.actionBar.clear();let o=i.uri.scheme===Y.file||i.uri.scheme===this.currentWorkspaceUri.scheme&&this.uriService.extUri.isEqualAuthority(this.currentWorkspaceUri.authority,i.uri.authority)&&!gce(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(rpn),enabled:!0,id:"editTrustedUri",tooltip:d(16272,null),run:()=>{this.table.edit(i,!1)}}}createPickerAction(i){return{label:"",class:q.asClassName(npn),enabled:!0,id:"pickerTrustedUri",tooltip:d(16281,null),run:()=>{this.table.edit(i,!0)}}}createDeleteAction(i){return{label:"",class:q.asClassName(spn),enabled:!0,id:"deleteTrustedUri",tooltip:d(16269,null),run:async()=>{await this.table.delete(i)}}}disposeTemplate(i){i.actionBar.dispose()}};gne=I([m(2,dt)],gne);var fne=class{constructor(i,e){this.table=i;this.contextViewService=e;this.templateId=fne.TEMPLATE_ID}static{this.TEMPLATE_ID="path"}renderTemplate(i){let e=i.appendChild(_(".path")),t=e.appendChild(_("div.path-label")),o=new Dc(e,this.contextViewService,{validationOptions:{validation:s=>this.table.validateUri(s,this.currentItem)},inputBoxStyles:pl}),n=new P,r=n.add(new P);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=>{$t.stop(l)}));let o=()=>{t.element.classList.remove("input-mode"),t.element.parentElement.style.paddingLeft="5px"},n=()=>{o();let l=t.pathInput.value,c=f6(l)?i.uri.with({path:Lo.sep+p$(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(Vo(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===Y.file)return Hp(i.fsPath);if(i.path.startsWith(Lo.sep)){let e=i.path.substring(1);if(f6(e,!0))return Hp(Ms.normalize(e),!0)}return i.path}};fne=I([m(1,_n)],fne);function i3t(a,i){return i.uri.authority?a.getHostLabel(i.uri.scheme,i.uri.authority):d(16277,null)}var vne=class{constructor(i){this.labelService=i;this.templateId=vne.TEMPLATE_ID}static{this.TEMPLATE_ID="host"}renderTemplate(i){let e=new P,t=e.add(new P),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=i3t(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()}};vne=I([m(0,ot)],vne);var RG=class extends pa{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(RG.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 P);this.layoutParticipants=[]}static{this.ID="workbench.editor.workspaceTrust"}createEditor(e){this.rootElement=R(e,_(".workspace-trust-editor",{tabindex:"0"})),this.createHeaderElement(this.rootElement);let t=_(".workspace-trust-editor-body");this.bodyScrollBar=this._register(new Pa(t,{horizontal:2,vertical:1})),R(this.rootElement,this.bodyScrollBar.getDomNode()),this.createAffectedFeaturesElement(t),this.createConfigurationElement(t),this.rootElement.style.setProperty("--workspace-trust-selected-color",wt(MS)),this.rootElement.style.setProperty("--workspace-trust-unselected-color",wt(H$)),this.rootElement.style.setProperty("--workspace-trust-check-color",wt(gRe)),this.rootElement.style.setProperty("--workspace-trust-x-color",wt(av)),this._register(j(this.rootElement,re.KEY_DOWN,o=>{let n=new Ii(o);if(n.equals(16)||n.equals(18)){let r=[this.headerContainer,this.trustedContainer,this.untrustedContainer,this.configurationContainer],l=r.findIndex(c=>ts(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(16303,null);switch(this.workspaceService.getWorkbenchState()){case 1:return d(16299,null);case 2:return d(16298,null);case 3:return d(16300,null)}}return d(16317,null)}getHeaderTitleIconClassNames(e){return q.asClassNameArray(TWi)}getFeaturesHeaderText(e){let t="",o="";switch(this.workspaceService.getWorkbenchState()){case 1:{t=e?d(16304,null):d(16321,null),o=e?d(16305,null):d(16320,null);break}case 2:{t=e?d(16291,null):d(16321,null),o=e?d(16295,null):d(16316,null);break}case 3:{t=e?d(16306,null):d(16321,null),o=e?d(16307,null):d(16323,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=R(this.headerDescription,_("div"));t.innerText=e?d(16289,null):d(16313,null,this.productService.nameShort);let o=R(this.headerDescription,_("div")),n=d(16324,null,"command:workbench.trust.configure");for(let c of lS(n).nodes)typeof c=="string"?R(o,document.createTextNode(c)):this.rerenderDisposables.add(this.instantiationService.createInstance(Xg,o,{...c,tabIndex:-1},{}));this.headerContainer.className=this.getHeaderContainerClass(e),this.rootElement.setAttribute("aria-label",`${d(16283,null)}:  ${this.headerContainer.innerText}`);let r=this.configurationService.restrictedSettings,s=oe.as(ii.Configuration),l=r.default.filter(c=>{let u=s.getConfigurationProperties()[c];if(u.scope&&(AC.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=LO(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}Yle(o,n).some(l=>this.extensionManifestPropertiesService.getExtensionUntrustedWorkspaceSupportType(l.manifest)===!1)&&e.add(n.identifier.id)}return e.size}createHeaderElement(e){this.headerContainer=R(e,_(".workspace-trust-header",{tabIndex:"0"})),this.headerTitleContainer=R(this.headerContainer,_(".workspace-trust-title")),this.headerTitleIcon=R(this.headerTitleContainer,_(".workspace-trust-title-icon")),this.headerTitleText=R(this.headerTitleContainer,_(".workspace-trust-title-text")),this.headerDescription=R(this.headerContainer,_(".workspace-trust-description"))}createConfigurationElement(e){this.configurationContainer=R(e,_(".workspace-trust-settings",{tabIndex:"0"}));let t=R(this.configurationContainer,_(".workspace-trusted-folders-title"));t.innerText=d(16293,null),this.workspaceTrustedUrisTable=this._register(this.instantiationService.createInstance(Ult,this.configurationContainer))}createAffectedFeaturesElement(e){this.affectedFeaturesContainer=R(e,_(".workspace-trust-features")),this.trustedContainer=R(this.affectedFeaturesContainer,_(".workspace-trust-limitations.trusted",{tabIndex:"0"})),this.untrustedContainer=R(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(16302,null),d(16288,null),d(16290,null)]:[d(16302,null),d(16288,null),d(16301,null),d(16290,null)];this.renderLimitationsListElement(this.trustedContainer,r,q.asClassNameArray(ipn));let[s,l]=this.getFeaturesHeaderText(!1);this.renderLimitationsHeaderElement(this.untrustedContainer,s,l);let c=this.workspaceService.getWorkbenchState()===1?[d(16319,null),d(16312,null),EWi(d(16314,null,t,`command:${yV}`))]:[d(16319,null),d(16312,null),EWi(e?d(16318,null,e,"command:settings.filterUntrusted"):d(16278,null)),EWi(d(16314,null,t,`command:${yV}`))];this.renderLimitationsListElement(this.untrustedContainer,c,q.asClassNameArray(opn)),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=R(e,_(".workspace-trust-buttons-row")),r=R(n,_(".workspace-trust-buttons")),s=this.rerenderDisposables.add(new _x(r));for(let{action:l,keybinding:c}of t){let u=s.addButtonWithDescription(Ko);u.label=l.label,u.enabled=o!==void 0?o:l.enabled,u.description=c.getLabel(),u.element.ariaLabel=l.label+", "+d(16276,null,c.getAriaLabel()),this.rerenderDisposables.add(u.onDidClick(p=>{p&&$t.stop(p,!0),l.run()}))}}addTrustButtonToElement(e){let o=[{action:this.rerenderDisposables.add(new st("workspace.trust.button.action.grant",d(16287,null),void 0,!0,async()=>{await this.workspaceTrustManagementService.setWorkspaceTrust(!0)})),keybinding:this.keybindingService.resolveUserBinding(it?"Cmd+Enter":"Ctrl+Enter")[0]}];if(this.workspaceTrustManagementService.canSetParentFolderTrust()){let n=VS(this.workspaceService.getWorkspace()),r=Ye(ci(n.uri)),s=R(e,_(".trust-message-box"));s.innerText=d(16308,null,r);let l=this.rerenderDisposables.add(new st("workspace.trust.button.action.grantParent",d(16310,null),void 0,!0,async()=>{await this.workspaceTrustManagementService.setParentFolderTrust(!0)}));o.push({action:l,keybinding:this.keybindingService.resolveUserBinding(it?"Cmd+Shift+Enter":"Ctrl+Shift+Enter")[0]})}this.createButtonRow(e,o)}addDontTrustButtonToElement(e){this.createButtonRow(e,[{action:this.rerenderDisposables.add(new st("workspace.trust.button.action.deny",d(16270,null),void 0,!0,async()=>{await this.workspaceTrustManagementService.setWorkspaceTrust(!1)})),keybinding:this.keybindingService.resolveUserBinding(it?"Cmd+Enter":"Ctrl+Enter")[0]}])}addTrustedTextToElement(e){if(this.workspaceService.getWorkbenchState()===1)return;let t=R(e,_(".workspace-trust-untrusted-description"));this.workspaceTrustManagementService.isWorkspaceTrustForced()?t.innerText=d(16297,null):t.innerText=this.workspaceService.getWorkbenchState()===3?d(16322,null):d(16315,null)}renderLimitationsHeaderElement(e,t,o){let n=R(e,_(".workspace-trust-limitations-header")),r=R(n,_(".workspace-trust-limitations-title")),s=R(r,_(".workspace-trust-limitations-title-text")),l=R(n,_(".workspace-trust-limitations-subtitle"));s.innerText=t,l.innerText=o}renderLimitationsListElement(e,t,o){let n=R(e,_(".workspace-trust-limitations-list-container")),r=R(n,_("ul"));for(let s of t){let l=R(r,_("li")),c=R(l,_(".list-item-icon")),u=R(l,_(".list-item-text"));c.classList.add(...o);let p=lS(s);for(let h of p.nodes)typeof h=="string"?R(u,document.createTextNode(h)):this.rerenderDisposables.add(this.instantiationService.createInstance(Xg,u,{...h,tabIndex:-1},{}))}}layout(e){this.isVisible()&&(this.workspaceTrustedUrisTable.layout(),this.layoutParticipants.forEach(t=>{t.layout()}),this.bodyScrollBar.scanDomNode())}};I([Nd(100)],RG.prototype,"render",1),RG=I([m(1,Te),m(2,De),m(3,le),m(4,Pe),m(5,zi),m(6,xp),m(7,F),m(8,ns),m(9,Lv),m(10,Os),m(11,nt),m(12,_e)],RG);function EWi(a){let i=/(.*)\[(.+)\]\s*\((.+)\)(.*)/;return a.replace(i,"$1[$2]($3)$4")}var apn=Re("workspace-trust-editor-label-icon",M.shield,d(17636,null)),eve=class a extends Us{constructor(){super(...arguments);this.resource=A.from({scheme:Y.vscodeWorkspaceTrust,path:"workspaceTrustEditor"})}static{this.ID="workbench.input.workspaceTrust"}get capabilities(){return 10}get typeId(){return a.ID}matches(e){return super.matches(e)||e instanceof a}getName(){return d(17635,null)}getIcon(){return apn}};var MEo="workbench.banner.restrictedMode",PEo="workspace.trust.startupPrompt.shown",AEo="workbench.banner.restrictedMode.dismissed",Klt=class extends C{constructor(i,e,t){super(),this._ctxWorkspaceTrustEnabled=hG.IsEnabled.bindTo(i),this._ctxWorkspaceTrustEnabled.set(e.isWorkspaceTrustEnabled()),this._ctxWorkspaceTrustState=hG.IsTrusted.bindTo(i),this._ctxWorkspaceTrustState.set(t.isWorkspaceTrusted()),this._register(t.onDidChangeTrust(o=>this._ctxWorkspaceTrustState.set(o)))}};Klt=I([m(0,X),m(1,BL),m(2,ns)],Klt);oe.as(Qi.Workbench).registerWorkbenchContribution(Klt,3);var f1e=class extends C{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!$g(VS(this.workspaceContextService.getWorkspace()))}registerListeners(){this._register(this.workspaceTrustRequestService.onDidInitiateOpenFilesTrustRequest(async()=>{await this.workspaceTrustManagementService.workspaceResolved;let e=[this.workspaceContextService.getWorkbenchState()!==1?d(16223,null):d(16220,null),d(16219,null)];await this.dialogService.prompt({type:St.Info,message:this.workspaceContextService.getWorkbenchState()!==1?d(16224,null):d(16221,null),buttons:[{label:d(16218,null),run:({checkboxChecked:t})=>this.workspaceTrustRequestService.completeOpenFilesTrustRequest(1,!!t)},{label:d(16216,null),run:({checkboxChecked:t})=>this.workspaceTrustRequestService.completeOpenFilesTrustRequest(2,!!t)}],cancelButton:{run:()=>this.workspaceTrustRequestService.completeOpenFilesTrustRequest(3)},checkbox:{label:d(16222,null),checked:!1},custom:{icon:M.shield,markdownDetails:e.map(t=>({markdown:new xe(t)}))}})})),this._register(this.workspaceTrustRequestService.onDidInitiateResourcesTrustRequest(async e=>{await this.workspaceTrustManagementService.workspaceResolved;let t=[e?.message??d(16225,null),d(16226,null),`\`${this.labelService.getUriLabel(e.uri)}\``];await this.dialogService.prompt({type:St.Info,message:d(16227,null),buttons:[{label:d(16246,null),run:()=>this.workspaceTrustRequestService.completeResourcesTrustRequest(e.uri,1)}],cancelButton:{run:()=>this.workspaceTrustRequestService.completeResourcesTrustRequest(e.uri,3)},custom:{icon:M.shield,markdownDetails:t.map(o=>({markdown:new xe(o)}))}})})),this._register(this.workspaceTrustRequestService.onDidInitiateWorkspaceTrustRequest(async e=>{await this.workspaceTrustManagementService.workspaceResolved;let t=this.useWorkspaceLanguage?d(16265,null):d(16209,null),o=d(16213,null),n=e?.message??o,r=e?.buttons??[{label:this.useWorkspaceLanguage?d(16211,null):d(16210,null),type:"ContinueWithTrust"},{label:d(16215,null),type:"Manage"}];r.some(l=>l.type==="Cancel")||r.push({label:d(16202,null),type:"Cancel"});let{result:s}=await this.dialogService.prompt({type:St.Info,message:t,custom:{icon:M.shield,markdownDetails:[{markdown:new xe(n)},{markdown:new xe(d(16212,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(gG);break;case"Cancel":this.workspaceTrustRequestService.cancelWorkspaceTrustRequest();break}}))}};f1e=I([m(0,ct),m(1,ge),m(2,ot),m(3,Pe),m(4,ns),m(5,Vd)],f1e);var Glt=class extends C{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:St.Info,message:d(16201,null),detail:d(16200,null),cancelButton:d(16217,null),custom:{icon:M.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(16265,null):d(16209,null)),l,c=VS(this.workspaceContextService.getWorkspace()),u=$g(c),p=Eq(c);if(!r&&this.workspaceTrustManagementService.canSetParentFolderTrust()){let h=Ye(ci(c.uri));l=d(16203,null,h)}this.doShowModal(s,{label:o??d(16245,null),sublabel:u?d(16244,null):d(16247,null)},{label:n??d(16206,null),sublabel:u?d(16205,null):d(16207,null)},[u?d(16208,null,this.productService.nameShort):d(16264,null,this.productService.nameShort),t??d(16236,null),p?"":`\`${this.labelService.getWorkspaceLabel(c,{verbose:2})}\``],l)}))}updateWorkbenchIndicators(e){let t=this.getBannerItem(!e);this.updateStatusbarEntry(e),t&&(e?this.bannerService.hide(MEo):this.bannerService.show(t))}async doShowModal(e,t,o,n,r){await this.dialogService.prompt({type:St.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:M.shield,markdownDetails:n.map(s=>({markdown:new xe(s)}))}}),this.storageService.store(PEo,!0,1,1)}async showModalOnStart(){if(this.workspaceTrustManagementService.isWorkspaceTrusted()){this.updateWorkbenchIndicators(!0);return}if(this.workspaceTrustManagementService.canSetWorkspaceTrust()){if(LO(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(PEo,1,!1)){this.updateWorkbenchIndicators(!1);return}this.workspaceTrustRequestService.requestWorkspaceTrustOnStartup()}}get startupPromptSetting(){return this.configurationService.getValue(Bdi)}get useWorkspaceLanguage(){return!$g(VS(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(AEo,1,!1);if(this.bannerSetting==="never"||this.bannerSetting==="untilDismissed"&&t)return;let o=[{label:d(16232,null),href:"command:"+gG},{label:d(16231,null),href:"https://aka.ms/vscode-workspace-trust"}];return{id:MEo,icon:TWi,ariaLabel:this.getBannerItemAriaLabels(),message:this.getBannerItemMessages(),actions:o,onClose:()=>{e&&this.storageService.store(AEo,!0,1,1)}}}getBannerItemAriaLabels(){switch(this.workspaceContextService.getWorkbenchState()){case 1:return d(16229,null);case 2:return d(16228,null);case 3:return d(16230,null)}}getBannerItemMessages(){switch(this.workspaceContextService.getWorkbenchState()){case 1:return d(16234,null);case 2:return d(16233,null);case 3:return d(16235,null)}}get bannerSetting(){let e=this.configurationService.getValue(Hdi);return e!=="always"&&Gt&&!this.remoteAgentService.getConnection()?.remoteAuthority?"never":e}getRestrictedModeStatusbarEntry(){let e="",t;switch(this.workspaceContextService.getWorkbenchState()){case 1:{e=d(16238,null),t={value:d(16241,null,`command:${yV}`,`command:${gG}`),isTrusted:!0,supportThemeIcons:!0};break}case 2:{e=d(16237,null),t={value:d(16240,null,`command:${yV}`,`command:${gG}`),isTrusted:!0,supportThemeIcons:!0};break}case 3:{e=d(16239,null),t={value:d(16242,null,`command:${yV}`,`command:${gG}`),isTrusted:!0,supportThemeIcons:!0};break}}return{name:d(16243,null),text:`$(shield) ${d(16248,null)}`,ariaLabel:e,tooltip:t,command:gG,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})}}};Glt=I([m(0,ct),m(1,Pe),m(2,BL),m(3,ns),m(4,B),m(5,Tr),m(6,le),m(7,Vd),m(8,jP),m(9,ot),m(10,oi),m(11,nt),m(12,yo),m(13,Co),m(14,be)],Glt);pt(f1e.ID,f1e,ut.BlockRestore);oe.as(Qi.Workbench).registerWorkbenchContribution(Glt,3);var _Wi=class{canSerialize(i){return!0}serialize(i){return""}deserialize(i){return i.createInstance(eve)}};oe.as(rn.EditorFactory).registerEditorSerializer(eve.ID,_Wi);oe.as(rn.EditorPane).registerEditorPane(ys.create(RG,RG.ID,d(16266,null)),[new Mt(eve)]);var lpn="workbench.trust.configure",NEo=L(16263,"Workspaces");W(class extends K{constructor(){super({id:lpn,title:L(16204,"Configure Workspace Trust Settings"),precondition:x.and(hG.IsEnabled,x.equals(`config.${tQe}`,!0)),category:NEo,f1:!0})}run(a){a.get(Po).openUserSettings({jsonEditor:!1,query:`@tag:${S4}`})}});W(class extends K{constructor(){super({id:gG,title:L(16214,"Manage Workspace Trust"),precondition:x.and(hG.IsEnabled,x.equals(`config.${tQe}`,!0)),category:NEo,f1:!0})}run(a){let i=a.get(ee),t=a.get(F).createInstance(eve);i.openEditor(t,{pinned:!0},ym)}});oe.as(ii.Configuration).registerConfiguration({...WQe,properties:{[tQe]:{type:"boolean",default:!0,description:d(16253,null),tags:[S4],scope:1},[Bdi]:{type:"string",default:"once",description:d(16256,null),tags:[S4],scope:1,enum:["always","once","never"],enumDescriptions:[d(16255,null),d(16258,null),d(16257,null)]},[Hdi]:{type:"string",default:"untilDismissed",description:d(16250,null),tags:[S4],scope:1,enum:["always","untilDismissed","never"],enumDescriptions:[d(16249,null),d(16252,null),d(16251,null)]},[eQe]:{type:"string",default:"prompt",markdownDescription:d(16259,null,UTt),tags:[S4],scope:1,enum:["prompt","open","newWindow"],enumDescriptions:[d(16262,null),d(16261,null),d(16260,null)]},[UTt]:{type:"boolean",default:!0,markdownDescription:d(16254,null,eQe),tags:[S4],scope:1}}});var $lt=class extends C{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=iN(o),r=0;for(;wc(n)!==n&&r<100;)n=wc(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})}}}};$lt=I([m(0,Vt),m(1,Te),m(2,Pe),m(3,BL),m(4,ns)],$lt);oe.as(Qi.Workbench).registerWorkbenchContribution($lt,3);var qlt=class extends C{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||LO(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(o7);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(St.Info,d(16329,null,n,"https://go.microsoft.com/fwlink/?linkid=2025315"),[{label:d(16331,null),run:()=>this.hostService.openWindow([{workspaceUri:je(e,n)}])}],{neverShowAgain:o,priority:this.storageService.isNew(1)?1:2})}else t.length>1&&this.notificationService.prompt(St.Info,d(16330,null,"https://go.microsoft.com/fwlink/?linkid=2025315"),[{label:d(16334,null),run:()=>{this.quickInputService.pick(t.map(n=>({label:n})),{placeHolder:d(16333,null)}).then(n=>{n&&this.hostService.openWindow([{workspaceUri:je(e,n.label)}])})}}],{neverShowAgain:o,priority:this.storageService.isNew(1)?1:2})}};qlt=I([m(0,Pe),m(1,Ne),m(2,be),m(3,Ge),m(4,oi),m(5,le)],qlt);oe.as(Qi.Workbench).registerWorkbenchContribution(qlt,4);W(class extends K{constructor(){super({id:"workbench.action.openWorkspaceFromEditor",title:L(16332,"Open Workspace"),f1:!1,menu:{id:D.EditorContent,when:x.and(Fo.Extension.isEqualTo(Wje),fr.isEqualTo(mF),$Et.toNegated())}})}async run(a,i){let e=a.get(oi),t=a.get(Pe),o=a.get(Ne);if(t.getWorkbenchState()===3){let n=t.getWorkspace().configuration;if(n&&Xe(n,i)){o.info(d(16328,null));return}}return e.openWindow([{workspaceUri:i}])}});var v1e=class extends C{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(10819,null)});if(!t)return;let o=await this._quickInputService.input({placeHolder:d(10817,null),prompt:d(10818,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(10816,null):t<0||t>100?d(10815,null):null}};v1e=I([m(1,Ge)],v1e);var o3t=class extends K{constructor(){super({id:"list.resizeColumn",title:{value:d(10814,null),original:"Resize Column"},category:{value:d(10813,null),original:"List"},precondition:rc,f1:!0})}async run(i){let e=i.get(fo),t=i.get(F),o=e.lastFocusedList;o instanceof dO&&await t.createInstance(v1e,o).show()}};var b1e=class{static{this.ID="workbench.contrib.listContext"}constructor(i){i.createKey("listSupportsTypeNavigation",!0),i.createKey("listSupportsKeyboardNavigation",!0)}};b1e=I([m(0,X)],b1e);pt(b1e.ID,b1e,ut.BlockStartup);W(o3t);var S1e=class extends C{constructor(e,t){super();this.accessibilitySignalService=t;let o=ui(this,t.onSoundEnabledChanged($o.onDebugBreak),()=>t.isSoundEnabled($o.onDebugBreak));this._register(Ga((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)})}};S1e=I([m(0,Li),m(1,tr)],S1e);var n3t=class a extends K{static{this.ID="signals.sounds.help"}constructor(){super({id:a.ID,title:L(5009,"Help: List Signal Sounds"),f1:!0,metadata:{description:d(5005,null)}})}async run(i){let e=i.get(tr),t=i.get(Ge),o=i.get(B),n=i.get(Bi),r=i.get(Po),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(M.settingsGear),tooltip:d(5011,null),alwaysVisible:!0}]:[]})).sort((p,h)=>p.label.localeCompare(h.label)),c=new P,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=OEo(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,Aji)})),c.add(u.onDidHide(()=>c.dispose())),u.placeholder=d(5010,null),u.canSelectMany=!0,await u.show()}};function OEo(a,i){return i?a?"never":"off":a?"never":"auto"}var r3t=class a extends K{static{this.ID="accessibility.announcement.help"}constructor(){super({id:a.ID,title:L(5003,"Help: List Signal Announcements"),f1:!0,metadata:{description:d(5004,null)}})}async run(i){let e=i.get(tr),t=i.get(Ge),o=i.get(B),n=i.get(Bi),r=i.get(Po),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(M.settingsGear),tooltip:d(5008,null),alwaysVisible:!0}]:[]})).sort((h,g)=>h.label.localeCompare(g.label)),c=new P,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=OEo(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(5006,null):d(5007,null),u.canSelectMany=!0,await u.show()}};var I1e=class extends C{constructor(e,t,o){super();this._editorService=e;this._instantiationService=t;this._accessibilitySignalService=o;this._textProperties=[this._instantiationService.createInstance(y1e,$o.errorAtPosition,$o.errorOnLine,8),this._instantiationService.createInstance(y1e,$o.warningAtPosition,$o.warningOnLine,4),this._instantiationService.createInstance(DWi),this._instantiationService.createInstance(jlt)],this._someAccessibilitySignalIsEnabled=Ce(this,n=>this._textProperties.flatMap(r=>[r.lineSignal,r.positionSignal]).filter(mo).some(r=>Pre(this,this._accessibilitySignalService.getEnabledState(r,!1)).read(n))),this._activeEditorObservable=ui(this,this._editorService.onDidActiveEditorChange,n=>{let r=this._editorService.activeTextEditorControl,s=Ec(r)?r.getOriginalEditor():pn(r)?r:void 0;return s&&s.hasModel()?{editor:s,model:s.getModel()}:void 0}),this._register(Ga((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 P),l=this._textProperties.map(u=>({source:u.createSource(e,t),property:u})),c=H9t(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(nn(()=>{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(he(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}))}}))}};I1e=I([m(0,ee),m(1,F),m(2,tr)],I1e);var w1e=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)}},y1e=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=Nr("onMarkerChanged",this.markerService.onMarkerChanged);return new w1e({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))})}};y1e=I([m(3,Ns)],y1e);var DWi=class{constructor(){this.lineSignal=$o.foldedArea}createSource(i,e){let t=Qg.get(i);if(!t)return w1e.notPresent;let o=EGe(t.getFoldingModel()??Promise.resolve(void 0));return new w1e({isPresentOnLine(n,r){let l=o.read(r).value?.getRegionAtLine(n);return l?l.isCollapsed&&l.startLineNumber===n:!1}})}},jlt=class{constructor(i){this.debugService=i;this.lineSignal=$o.break}createSource(i,e){let t=Nr("onDidChangeBreakpoints",this.debugService.getModel().onDidChangeBreakpoints),o=this.debugService;return new w1e({isPresentOnLine(n,r){return t.read(r),o.getModel().getBreakpoints({uri:e.uri,lineNumber:n}).length>0}})}};jlt=I([m(0,Li)],jlt);we(tr,xye,1);pt("EditorTextPropertySignalsContribution",v6i(()=>I1e),ut.AfterRestored);pt("AccessibilitySignalLineDebuggerContribution",S1e,ut.AfterRestored);W(n3t);W(r3t);var Qlt=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})}};Qlt=I([m(0,B),m(1,zi),m(2,Te)],Qlt);oe.as(Qi.Workbench).registerWorkbenchContribution(Qlt,3);var C1e=class extends C{constructor(e){super();this._styleElementDisposables=void 0;this._register(Z(()=>this._removeStyleElement())),this._register(H.runAndSubscribe(e.onDidChangeConfiguration,t=>{if(t&&!t.affectsConfiguration("accessibility.dimUnfocused.enabled")&&!t.affectsConfiguration("accessibility.dimUnfocused.opacity"))return;let o="";if(cpn(e.getValue("accessibility.dimUnfocused.enabled"),!1)){let r=Kn(dpn(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 P,this._styleElement=hr(void 0,void 0,this._styleElementDisposables),this._styleElement.className="accessibilityUnfocusedViewOpacity"),this._styleElement}_removeStyleElement(){this._styleElementDisposables?.dispose(),this._styleElementDisposables=void 0,this._styleElement=void 0}};C1e=I([m(0,B)],C1e);function cpn(a,i){return typeof a=="boolean"?a:i}function dpn(a,i){return typeof a=="number"?a:i}var tve=class extends C{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(qe.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(gt.Info,d(4960,null,"editor.accessibilitySupport"),[{label:d(4959,null),run:()=>{this.configurationService.updateValue("editor.accessibilitySupport","on",2)}},{label:d(4958,null),run:()=>{this.configurationService.updateValue("editor.accessibilitySupport","off",2)}},{label:d(4957,null),run:()=>{this.openerService.open("https://code.visualstudio.com/docs/editor/accessibility#_screen-readers")}}],{sticky:!0,priority:3}),H.once(this.screenReaderNotification.onDidClose)(()=>this.screenReaderNotification=null)}updateScreenReaderModeElement(e){if(e){if(!this.screenReaderModeElement.value){let t=d(4956,null);this.screenReaderModeElement.value=this.statusbarService.addEntry({name:d(4961,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())}};tve=I([m(0,B),m(1,Ne),m(2,Bi),m(3,Tr),m(4,Qe)],tve);var ive=class extends C{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"}};ive=I([m(0,tr),m(1,Wa)],ive);var ove=class extends C{constructor(e,t,o){super();this._editorService=e;this._accessibilityService=t;this._configurationService=o;this._register(H.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(()=>{Ec(this._editorService.activeTextEditorControl)&&this._accessibilityService.alert(d(5012,null))})))}};ove=I([m(0,ee),m(1,Bi),m(2,B)],ove);var nve=class extends C{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"}};nve=I([m(0,tr),m(1,EC)],nve);function FEo(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 xe(i);return n.isTrusted=!0,{content:n,configureKeybindingItems:e.length?e:void 0,configuredKeybindingItems:t.length?t:void 0}}var Ylt=class extends C{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=LC.bindTo(this._contextKeyService),this._accessibleViewIsShown=ud.bindTo(this._contextKeyService),this._accessibleViewSupportsNavigation=Mde.bindTo(this._contextKeyService),this._accessibleViewVerbosityEnabled=w9e.bindTo(this._contextKeyService),this._accessibleViewGoToSymbolSupported=C9e.bindTo(this._contextKeyService),this._accessibleViewCurrentProviderId=Kd.bindTo(this._contextKeyService),this._accessibleViewInCodeBlock=lTe.bindTo(this._contextKeyService),this._accessibleViewContainsCodeBlocks=Pde.bindTo(this._contextKeyService),this._onLastLine=wRt.bindTo(this._contextKeyService),this._hasUnassignedKeybindings=x9e.bindTo(this._contextKeyService),this._hasAssignedKeybindings=k9e.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:aa.getEditorContributions().filter(N=>N.id!==Zu.ID&&N.id!==aZ.ID&&N.id!==QW.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={...Kf(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(jr,this._container,T,S)),this._register(this._accessibilityService.onDidChangeScreenReaderOptimized(()=>{this._currentProvider&&this._accessiblityHelpIsShown.get()&&this.show(this._currentProvider)})),this._register(this._configurationService.onDidChangeConfiguration(N=>{_Ct(this._currentProvider)&&N.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)),N.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 N=this._editorWidget.getPosition()?.lineNumber;if(this._codeBlocks&&N!==void 0){let O=this._codeBlocks.find(V=>V.startLine<=N&&V.endLine>=N)!==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 Ie(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*.62,600)/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 tp&&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 Y7&&this._storageService.store(`${qGe}${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?_Ct(this._currentProvider)?this._configurationService.getValue(this._currentProvider.verbositySettingKey)===!0:this._storageService.getBoolean(`${qGe}${this._currentProvider.id}`,-1,!1):!1}goToSymbol(){this._currentProvider&&(this._isInQuickPick=!0,this._instantiationService.createInstance(Xlt,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=Yc.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 P),r=n.add(this._quickInputService.createQuickPick());r.items=o,r.title=d(4984,null),r.placeholder=d(4987,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(4988,null,n.type,r),ariaLabel:d(4989,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(){_Ct(this._currentProvider)&&(this._configurationService.updateValue(this._currentProvider?.verbositySettingKey,!1),Jo(d(4978,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:Y.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=FEo(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(4975,null):d(4974,null));let y=e.options.type==="help"?d(4962,null):d(4964,null);if(this._title.textContent=y,b&&e.options.type==="view"?y=d(4965,null,b):b&&(y=d(4963,null,b)),ri&&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(),N=T!==void 0&&T>0?new Ie(T,1):void 0;N&&(this._editorWidget.setPosition(N),this._editorWidget.revealLine(N.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(!Me(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 P;return h.add(this._editorWidget.onKeyDown(g=>{if(g.keyCode===3)this._commandService.executeCommand("editor.action.openLink");else if(g.keyCode===9||upn(g.browserEvent,this._keybindingService,this._configurationService))p(g);else if(g.keyCode===38&&e.options.readMoreUrl){let f=e.options.readMoreUrl;Jo(gc.openingDocs),this._openerService.open(A.parse(f)),g.preventDefault(),g.stopPropagation()}e instanceof tp&&e.onKeyDown?.(g)})),h.add(j(this._toolbar.getElement(),re.KEY_DOWN,g=>{new Ii(g).equals(9)&&p(g)})),h.add(this._editorWidget.onDidBlurEditorWidget(()=>{sa(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(4966,null):d(4970,null));let o=this._register(this._menuService.createMenu(D.AccessibleView,this._contextKeyService)),n=Vm(o.getActions({}));if(e){for(let r of e)r.class=r.class||q.asClassName(M.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*.4,o=Math.min(t,this._editorWidget.getContentHeight()),n=Math.min(e.width*.62,600);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 tp&&!!this._currentProvider.getSymbols?.():!1}_updateLastProvider(){let e=this._currentProvider;return e?e instanceof tp?new tp(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 Y7(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 tp?t=new tp(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 Y7(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(4990,null),r=this._getChatHints(),s=d(4983,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(4981,null,"<keybinding:workbench.action.chat.insertCodeBlock>"),d(4982,null,"<keybinding:workbench.action.chat.insertIntoNewFile>"),d(4986,null,"<keybinding:workbench.action.chat.runInTerminal>")].join(`
`)}_navigationHint(){return d(4967,null,"<keybinding:editor.action.accessibleViewNext>","<keybinding:editor.action.accessibleViewPrevious>")}_disableVerbosityHint(e){return e.options.type==="help"&&this._verbosityEnabled()?d(4971,null,"<keybinding:editor.action.accessibleViewDisableHint>"):""}_goToSymbolHint(e){if(e)return d(4980,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(4976,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(4977,null,t)}_screenReaderModeHint(e){let t=this._accessibilityService.isScreenReaderOptimized(),o="",n=it?gc.changeConfigToOnMac:gc.changeConfigToOnWinLinux;return t&&e.id==="editor"?(o=gc.auto_on,o+=`
`):t||(o=gc.auto_off+`
`+n,o+=`
`),o}_exitDialogHint(e){return this._verbosityEnabled()&&!e.options.position?d(4979,null):""}_readMoreHint(e){return e.options.readMoreUrl?d(4985,null,"<keybinding:editor.action.accessibilityHelpOpenHelpLink>"):""}};Ylt=I([m(0,Qe),m(1,F),m(2,B),m(3,Ct),m(4,_n),m(5,X),m(6,Bi),m(7,_e),m(8,nc),m(9,qt),m(10,ge),m(11,LY),m(12,le),m(13,Ge),m(14,tr)],Ylt);var x1e=class extends C{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(Ylt))),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(4972,null,t):o=d(4973,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 Ie(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)}};x1e=I([m(0,F),m(1,B),m(2,_e)],x1e);var Xlt=class{constructor(i,e){this._accessibleView=i;this._quickInputService=e}show(i){let e=new P,t=e.add(this._quickInputService.createQuickPick());t.placeholder=d(4968,null),t.title=d(4969,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()}))}}};Xlt=I([m(1,Ge)],Xlt);function upn(a,i,e){if(!e.getValue("accessibility.accessibleView.closeOnKeyPress"))return!1;let t=new Ii(a),n=i.softDispatch(t,t.target).kind===1;return i.inChordMode||n?!1:ppn(a)&&!a.ctrlKey&&!a.altKey&&!a.metaKey&&!a.shiftKey}function ppn(a){return!!a.code.match(/^(Key[A-Z]|Digit[0-9]|Equal|Comma|Period|Slash|Quote|Backquote|Backslash|Minus|Semicolon|Space|Enter)$/)}var s3t=class extends C{constructor(){super(),this._register(Ade.addImplementation(115,"accessible-view-help",i=>(i.get(Wd).showAccessibleViewHelp(),!0),ud))}},a3t=class extends C{constructor(){super(),xa.getImplementations().forEach(i=>{let e=t=>{let o=i.getProvider(t);if(!o)return!1;try{return t.get(Wd).show(o),!0}catch{return o.dispose(),!1}};i.type==="view"?this._register(dTe.addImplementation(i.priority,i.name,e,i.when)):this._register(Ade.addImplementation(i.priority,i.name,e,i.when))})}};var rve=class extends C{constructor(e){super();this._viewHelpDialogMap=this._register(new jt);this._register(oe.as(on.ViewsRegistry).onViewsRegistered(t=>{for(let o of t)for(let n of o.views)n.accessibilityHelpContent&&this._viewHelpDialogMap.set(n.id,WEo(e,n))})),this._register(oe.as(on.ViewsRegistry).onViewsDeregistered(t=>{for(let o of t.views)o.accessibilityHelpContent&&this._viewHelpDialogMap.get(o.id)?.dispose()}))}static{this.ID="extensionAccessibilityHelpDialogContribution"}};rve=I([m(0,_e)],rve);function WEo(a,i){let e=new P,t=i.accessibilityHelpContent?.value;if(!t)throw new Error("No content provided for the accessibility help dialog");return e.add(xa.register({priority:95,name:i.id,type:"help",when:Vl.isEqualTo(i.id),getProvider:o=>{let n=o.get(Ft);return new Y7(i.id,{type:"help"},()=>t,()=>n.openView(i.id,!0))}})),e.add(a.onDidUpdateKeybindings(()=>{e.clear(),e.add(WEo(a,i))})),e}fto();we(Wd,x1e,1);we(C_e,w_e,1);var l3t=oe.as(Qi.Workbench);l3t.registerWorkbenchContribution(B5t,4);l3t.registerWorkbenchContribution(C1e,3);l3t.registerWorkbenchContribution(s3t,4);l3t.registerWorkbenchContribution(a3t,4);pt(tve.ID,tve,ut.BlockRestore);pt(rve.ID,rve,ut.BlockRestore);pt(ive.ID,ive,ut.AfterRestored);pt(nve.ID,nve,ut.AfterRestored);pt(ove.ID,ove,ut.AfterRestored);pt(Rde.ID,Rde,ut.AfterRestored);var EQ=class extends C{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(),EQ.ID,1,-Number.MAX_VALUE)):this.statusBarEntry.clear()}getStatusBarEntry(){return{name:d(11602,null),text:"$(radio-tower)",ariaLabel:d(11603,null),tooltip:d(11605,null),command:{id:"workbench.action.configureMeteredConnection",title:d(11604,null)},showInAllWindows:!0}}};EQ=I([m(0,eJ),m(1,Tr)],EQ);var mpn=oe.as(ii.Configuration);mpn.registerConfiguration({id:"network",order:14,title:d(2200,null),type:"object",properties:{"network.meteredConnection":{type:"string",enum:["auto","on","off"],enumDescriptions:[d(2197,null),d(2199,null),d(2198,null)],default:"auto",scope:1,description:d(2196,null),tags:["usesOnlineServices"]}}});pt(EQ.ID,EQ,ut.AfterRestored);W(class VEo extends K{static{this.ID="workbench.action.configureMeteredConnection"}constructor(){super({id:VEo.ID,title:L(11594,"Configure Metered Connection"),f1:!0})}async run(i){let e=i.get(Ge),t=i.get(B),o=t.getValue(KTe),n=[{value:"auto",label:d(11595,null),description:d(11596,null),picked:o==="auto"},{value:"on",label:d(11599,null),description:d(11600,null),picked:o==="on"},{value:"off",label:d(11597,null),description:d(11598,null),picked:o==="off"}],r=await e.pick(n,{placeHolder:d(11601,null),activeItem:n.find(s=>s.picked)});r&&await t.updateValue(KTe,r.value)}});var c3t=new Q("shareProviderCount",0,d(13508,null)),k1e=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=c3t.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=>jW(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(13511,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)}};k1e=I([m(0,X),m(1,ot),m(2,Ge),m(3,Kt),m(4,Te)],k1e);W(class extends GB{constructor(){super("workbench.experimental.share.enabled",d(13509,null),d(13510,null),3,x.and(aV.toNegated(),x.has("config.window.commandCenter"),x.and(c3t.notEqualsTo(0),mC.notEqualsTo(0))))}});var hpn=[D.EditorContextShare,D.SCMResourceContextShare,D.OpenEditorsContextShare,D.EditorTitleContextShare,D.MenubarShare,D.ExplorerContextShare],TQ=class extends C{constructor(e,t){super();this.shareService=e;this.configurationService=t;this.configurationService.getValue(TQ.SHARE_ENABLED_SETTING)&&this.registerActions(),this._register(this.configurationService.onDidChangeConfiguration(o=>{if(o.affectsConfiguration(TQ.SHARE_ENABLED_SETTING)){let n=this.configurationService.getValue(TQ.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 P),this._disposables.add(W(class LWi extends K{static{this.ID="workbench.action.share"}static{this.LABEL=L(13505,"Share...")}constructor(){super({id:LWi.ID,title:LWi.LABEL,f1:!0,icon:M.linkExternal,precondition:x.and(c3t.notEqualsTo(0),mC.notEqualsTo(0)),keybinding:{weight:200,primary:2609},menu:[{id:D.CommandCenter,order:3}]})}async run(o,...n){let r=o.get(OTe),s=o.get(ee)?.activeEditor,l=(s&&no.getOriginalUri(s,{supportSideBySide:1}))??o.get(Pe).getWorkspace().folders[0].uri,c=o.get(Wi),u=o.get(ct),p=o.get(Qe),h=o.get(Bo),g=o.get(Kt).getActiveCodeEditor()?.getSelection()??void 0,f=await h.withProgress({location:10,detail:d(13503,null)},async()=>r.provideShare({resourceUri:l,selection:g},ve.None));if(f){let v=f.toString(),b=typeof f=="string";await c.writeText(v),u.prompt({type:St.Info,message:b?d(13507,null):d(13506,null),custom:{icon:M.check,markdownDetails:[{markdown:new xe(`<div aria-label='${v}'>${v}</div>`,{supportHtml:!0}),classes:[b?"share-dialog-input-text":"share-dialog-input-link"]}]},cancelButton:d(13501,null),buttons:b?[]:[{label:d(13504,null),run:()=>{p.open(f,{openExternal:!0})}}]})}}}));let e=this.shareService.getShareActions();for(let t of hpn)for(let o of e)this._disposables.add(fe.appendMenuItem(t,o))}};TQ=I([m(0,OTe),m(1,B)],TQ);we(OTe,k1e,1);var gpn=oe.as(Qi.Workbench);gpn.registerWorkbenchContribution(TQ,4);oe.as(ii.Configuration).registerConfiguration({...Cm,properties:{"workbench.experimental.share.enabled":{type:"boolean",default:!1,tags:["experimental"],markdownDescription:d(13502,null,"`#window.commandCenter#`","`true`"),restricted:!1}}});var sve=class extends C{constructor(e,t){super();this.editorService=e;this.statusbarService=t;this.paneInitialScrollTop=new Map;this.syncScrollDispoasbles=this._register(new P);this.paneDisposables=this._register(new P);this.statusBarEntry=this._register(new me);this.isActive=!1;this._reentrancyBarrier=new oX;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())REt(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(!REt(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||!REt(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 of){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(13143,null),o=d(13142,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(13145,"Toggle Locked Scrolling Across Editors"),mnemonicTitle:d(13141,null)},category:We.View,f1:!0,metadata:{description:d(13144,null)}})}run(){e.toggle()}})),this._register(W(class extends K{constructor(){super({id:"workbench.action.holdLockedScrolling",title:{...L(13139,"Hold Locked Scrolling Across Editors"),mnemonicTitle:d(13140,null)},category:We.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()}};sve=I([m(0,ee),m(1,Tr)],sve);pt(sve.ID,sve,ut.Eventually);var ave=class extends C{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=Ce(this,n=>{let r=this._activeEditor.read(n);if(!r||!pn(r))return;let l=Rc.get(r)?.model.read(n);if(l)return{model:l,status:kM(l.status,300)}}),this._register(Ga((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(10663,null),loading:!0},ghostText:{shortLabel:"$(lightbulb)",label:"$(copilot) "+d(10661,null),loading:!1},inlineEdit:{shortLabel:"$(lightbulb-sparkle)",label:"$(copilot) "+d(10662,null),loading:!1},noSuggestion:{shortLabel:"$(circle-slash)",label:"$(copilot) "+d(10666,null),loading:!1}};r.add(this._languageStatusService.addStatus({accessibilityInfo:void 0,busy:u[c].loading,command:void 0,detail:d(10665,null),id:"inlineSuggestions",label:{value:u[c].label,shortValue:u[c].shortLabel},name:d(10664,null),selector:{pattern:l.model.textModel.uri.fsPath},severity:gt.Info,source:"inlineSuggestions"}))}))}static{this.hot=s1(this)}static{this.Id="vs.contrib.inlineCompletionLanguageStatusBarContribution"}static{this.languageStatusBarDisposables=new Set}};ave=I([m(0,kV),m(1,ee),m(2,vr)],ave);pt(ave.Id,bwt(ave.hot),ut.Eventually);var E1e=class extends C{constructor(e){super();this._languageFeaturesService=e;let t=oe.as(ea.JSONContribution),o=ui(this,this._languageFeaturesService.inlineCompletionsProvider.onDidChange,()=>this._languageFeaturesService.inlineCompletionsProvider.allNoModel());this._register(he(n=>{let r=o.read(n);t.registerSchema(Lai,{enum:mUi(r.flatMap(s=>Rai(s)))},n.store)}))}static{this.Id="vs.contrib.InlineCompletionSchemaContribution"}};E1e=I([m(0,zt)],E1e);pt(E1e.Id,E1e,ut.Eventually);var lve=class{constructor(i){this._preferencesService=i;ou.setConfigureDefaultAction(pi({id:"workbench.action.configurePreferredPasteAction",label:d(9353,null),run:()=>this.configurePreferredPasteAction()})),lh.setConfigureDefaultAction(pi({id:"workbench.action.configurePreferredDropAction",label:d(9352,null),run:()=>this.configurePreferredDropAction()}))}static{this.ID="workbench.contrib.dropOrPasteInto"}configurePreferredPasteAction(){return this._preferencesService.openUserSettings({jsonEditor:!0,revealSetting:{key:o5e,edit:!0}})}configurePreferredDropAction(){return this._preferencesService.openUserSettings({jsonEditor:!0,revealSetting:{key:s4e,edit:!0}})}};lve=I([m(0,Po)],lve);var RWi=[],fpn={type:"array",scope:6,description:d(9355,null),default:[],items:{description:d(9354,null),anyOf:[{type:"string"},{enum:RWi}]}},MWi=[],vpn={type:"array",scope:6,description:d(9357,null),default:[],items:{description:d(9356,null),anyOf:[{type:"string"},{enum:MWi}]}},PWi=Object.freeze({...nC,properties:{[o5e]:vpn,[s4e]:fpn}}),cve=class extends C{constructor(e,t){super();this.languageFeatures=t;this._onDidChangeSchemaContributions=this._register(new E);this._allProvidedDropKinds=[];this._allProvidedPasteKinds=[];this._register(H.runAndSubscribe(H.debounce(H.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(){MWi.length=0;for(let e of this._allProvidedPasteKinds)MWi.push(e.value);RWi.length=0;for(let e of this._allProvidedDropKinds)RWi.push(e.value);oe.as(ii.Configuration).notifyConfigurationSchemaUpdated(PWi)}getKeybindingSchemaAdditions(){return[{if:{required:["command"],properties:{command:{const:nri}}},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"}]}}}}]}}}}]}};cve=I([m(0,_e),m(1,zt)],cve);pt(lve.ID,lve,ut.Eventually);pt(cve.ID,cve,ut.Eventually);oe.as(ii.Configuration).registerConfiguration(PWi);function AWi(a,i,e){return a.reduce((t,o)=>{let n=e(o);return t[n]=(t[n]||0)+i(o),t},{})}function BEo(a,i,e){let t=Le("mapped",a.get());return e.add(_s(a,(o,n,r)=>{Ui(s=>{for(let l of r)t.set(o,s,i(l))})})),t}function HEo(a,i){return new Fp(e=>{if(!i.isDisposed)return i.add(_s(a,(t,o,n)=>{e.emitOne({value:t,prevValue:o,change:n})})),new Promise(t=>{i.add(Z(()=>{t(void 0)}))})})}var d3t=class extends C{constructor(e){super();this._originalDoc=e;let t=this.value=Le(this,e.value.get());this._register(_s(this._originalDoc.value,(o,n,r)=>{let s=OI.compose(r.map(l=>{let c=new NWi(l.reason);return l.mapData(()=>c)}));t.set(o,void 0,{edit:s})}))}waitForQueue(){return Promise.resolve()}},NWi=class{constructor(i){this.editSource=i;this.key=this.editSource.toKey(1),this.source=_Q.create(this.editSource)}join(i){if(this.editSource===i.editSource)return this}toEditSourceData(){return new OWi(this.key,this.source,this.editSource)}},OWi=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}},_Q=class{static{this._cache=new kI({getCacheKey:i=>i.toString()},i=>i)}static create(i){let e=i.metadata;switch(e.source){case"reloadFromDisk":return this._cache.get(new WWi);case"inlineCompletionPartialAccept":case"inlineCompletionAccept":{let t="type"in e?e.type:void 0;return"$nes"in e&&e.$nes?this._cache.get(new u3t("nes",e.$extensionId??"",e.$providerId??"",t)):this._cache.get(new u3t("completion",e.$extensionId??"",e.$providerId??"",t))}case"snippet":return this._cache.get(new m3t("suggest"));case"unknown":return e.name?e.name==="formatEditsCommand"?this._cache.get(new m3t("format")):this._cache.get(new Zlt):this._cache.get(new Zlt);case"Chat.applyEdits":return this._cache.get(new p3t("sidebar"));case"inlineChat.applyEdits":return this._cache.get(new p3t("inline"));case"cursor":return this._cache.get(new FWi);default:return this._cache.get(new Zlt)}}},u3t=class extends _Q{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"}},p3t=class extends _Q{constructor(e){super();this.kind=e;this.category="ai";this.feature="chat"}toString(){return`${this.category}/${this.feature}/${this.kind}`}getColor(){return"#00ff0066"}},m3t=class extends _Q{constructor(e){super();this.feature=e;this.category="ide"}toString(){return`${this.category}/${this.feature}`}getColor(){return this.feature==="format"?"#0000ff33":"#80808033"}},FWi=class extends _Q{constructor(){super();this.category="user"}toString(){return this.category}getColor(){return"#d3d3d333"}},WWi=class extends _Q{constructor(){super();this.category="external"}toString(){return this.category}getColor(){return"#009ab254"}},Zlt=class extends _Q{constructor(){super();this.category="unknown"}toString(){return this.category}getColor(){return"#ff000033"}},T1e=class extends C{constructor(e,t){super();this._originalDoc=e;this._instantiationService=t;this._runStore=this._register(new P);this._runQueue=Promise.resolve();this._diffService=this._instantiationService.createInstance(Jlt),this.value=this._value=Le(this,e.value.get()),this._restart()}async _restart(){this._runStore.clear();let e=HEo(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 Ept(e);for(;;){let o=await t.peek();if(o===I6)return;if(UEo(o)){let n=o,r=n,s=OI.empty;do{t.readBufferedOrThrow(),r=o,s=s.compose(OI.compose(o.change.map(c=>c.edit)));let l=await t.peekTimeout(1e3);if(!l)break;o=l}while(o!==I6&&UEo(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=OI.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()}};T1e=I([m(1,F)],T1e);var Jlt=class{constructor(i){this._editorWorkerService=i}async computeDiff(i,e){return await this._editorWorkerService.computeStringEditFromDiff(i,e,{maxComputationTimeMs:500},"advanced")}};Jlt=I([m(0,$s)],Jlt);function UEo(a){return a.change.every(i=>i.edit.replacements.every(e=>e.data.source.category==="ai"&&e.data.source.feature==="chat"))}var h3t=class extends C{constructor(e){super();this._originalDoc=e;let t=this.value=Le(this,e.value.get()),o=this._originalDoc.value.get().value;this._register(_s(this._originalDoc.value,(n,r,s)=>{let c=OI.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 dve(a,i){return{value:BEo(a.value,t=>({edit:t.edit.mapData(o=>o.data.toEditSourceData())}),i),waitForQueue:()=>a.waitForQueue()}}var _1e=class extends C{constructor(e,t){super();this._workspace=e;this._instantiationService=t;let o=this._instantiationService.createInstance(ect);this._states=$v(this,this._workspace.documents,(n,r)=>{let s=Ce(c=>o.isVisible(n.uri,c));return vf(this,(c,u)=>u||s.read(c)).map(c=>c?r.add(this._instantiationService.createInstance(tct,n,s)):void 0)}),this.documents=this._states.map((n,r)=>n.map(s=>s.read(r)).filter(mo)),this.documents.recomputeInitiallyAndOnChange(this._store)}};_1e=I([m(1,F)],_1e);var ect=class{constructor(i){this._editorGroupsService=i;let e=Nr(this,this._editorGroupsService.onDidAddGroup),t=Nr(this,this._editorGroupsService.onDidRemoveGroup),o=Ce(this,n=>(e.read(n),t.read(n),this._editorGroupsService.groups));this.visibleUris=$v(this,o,n=>ui(this,n.onDidModelChange,()=>n.editors).map(s=>s.map(l=>no.getCanonicalUri(l)))).map((n,r)=>{let s=new Map;for(let l of n)for(let c of l.read(r))mo(c)&&s.set(c.toString(),c);return s})}isVisible(i,e){return this.visibleUris.read(e).has(i.toString())}};ect=I([m(0,Et)],ect);var tct=class extends C{constructor(e,t,o){super();this.document=e;this.isVisible=t;this._instantiationService=o;let n=this._store.add(new d3t(e));n=this._store.add(this._instantiationService.createInstance(T1e,n)),n=this._store.add(new h3t(n)),this.documentWithAnnotations=n}};tct=I([m(2,F)],tct);var g3t=class{constructor(i,e){this._valueBeforeTrackedEdit=i;this._trackedEdit=e.removeCommonSuffixPrefix(i.getValue()),this._updatedTrackedEdit=this._trackedEdit.mapData(()=>new f3t(!0))}getOriginalCharacterCount(){return ky(this._trackedEdit.replacements,i=>i.getNewLength())}handleEdits(i){let e=i.mapData(o=>new f3t(!1)),t=this._updatedTrackedEdit.compose(e);this._updatedTrackedEdit=t}getAcceptedRestrainedCharactersCount(){return ky(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=rq.fromStringEdit(i,this._valueBeforeTrackedEdit),t=ky(e.replacements,n=>n.lineRange.length),o=ky(e.getNewLineRanges(),n=>n.length);return{deletedLineCounts:t,insertedLineCounts:o}}getValues(){return{arc:this.getAcceptedRestrainedCharactersCount(),...this.getLineCountInfo()}}},f3t=class{constructor(i){this.isTrackedEdit=i}join(i){if(this.isTrackedEdit===i.isTrackedEdit)return this}};var uve=class extends C{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 g3t(this._documentValueBeforeTrackedEdit,this._trackedEdit),this._store.add(_s(this._document.value,(u,p,h)=>{let g=USe.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 Nl(()=>{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})}};uve=I([m(7,Te)],uve);var bne=ae("randomService"),v3t=class{generateUuid(){return _t()}generatePrefixedUuid(i){return`${i}-${this.generateUuid()}`}};var D1e=class extends C{constructor(e,t,o){super();this._instantiationService=o;this._register(_s(e.value,(n,r,s)=>{let l=OI.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=dve(e,this._store),p=this._store.add(this._instantiationService.createInstance(uve,[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,...q1(VW(c.$extensionId))})},()=>{this._store.delete(p)}))}))}};D1e=I([m(2,F)],D1e);var L1e=class extends C{constructor(e,t){super();this._aiEditTelemetryService=t;this._register(_s(e.value,(o,n,r)=>{let s=OI.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 CU(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:zy.fromEdit(s,n)})}))}};L1e=I([m(1,rS)],L1e);var R1e=class extends C{constructor(e,t,o,n){super();this._instantiationService=o;this._randomService=n;this._register(_s(e.value,(r,s,l)=>{let c=OI.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=dve(e,this._store),f=this._store.add(this._instantiationService.createInstance(uve,[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,...q1(VW(p.props.$extensionId))})},()=>{this._store.delete(f)}))}))}};R1e=I([m(2,F),m(3,bne)],R1e);var Sne=class extends C{constructor(e,t){super();this._doc=e;this.data=t;this._edits=OI.empty;this._pendingExternalEdits=OI.empty;this._update=Wc(this);this._representativePerKey=new Map;this._sumAddedCharactersPerKey=new Map;this._register(_s(this._doc.value,(o,n,r)=>{let s=OI.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=OI.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 VWi(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()}))}}},VWi=class{constructor(i,e,t,o,n){this.originalRange=i;this.range=e;this.sourceKey=t;this.source=o;this.sourceRepresentative=n}};var M1e=class{constructor(i){this._scmService=i;this._repos=new ppt(i=>new BWi(i));this._reposChangedSignal=Nr(this,H.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)}};M1e=I([m(0,$c)],M1e);var BWi=class{constructor(i){this._repo=i;this.headBranchNameObs=Ce(i=>this._repo.provider.historyProvider.read(i)?.historyItemRef.read(i)?.name);this.headCommitHashObs=Ce(i=>this._repo.provider.historyProvider.read(i)?.historyItemRef.read(i)?.revision)}async isIgnored(i){return!1}};var P1e=class extends C{constructor(e,t,o){super();this._statsEnabled=e;this._annotatedDocuments=t;this._instantiationService=o;let n=this._instantiationService.createInstance(M1e);this._states=$v(this,this._annotatedDocuments.documents,(r,s)=>[r.document,s.add(this._instantiationService.createInstance(ict,r,n,this._statsEnabled))]),this.docsState=this._states.map(r=>new Map(r)),this.docsState.recomputeInitiallyAndOnChange(this._store)}};P1e=I([m(2,F)],P1e);var ict=class extends C{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=Ce(this,f=>this._scm.getRepo(e.document.uri,f));let c=dve(e.documentWithAnnotations,this._store),u=Wc("resetSignal"),p="closed";this.longtermTracker=Ce(f=>{if(!this._statsEnabled.read(f))return;u.read(f);let v=f.store.add(new Sne(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 EI).cancelAndSet(()=>{p="10hours",u.trigger(void 0),p="closed"},600*60*1e3),this._store.add(he(f=>{let v=this._repo.read(f);v&&(f.store.add(_s(v.headCommitHashObs,()=>{p="hashChange",u.trigger(void 0),p="closed"})),f.store.add(_s(v.headBranchNameObs,()=>{p="branchChange",u.trigger(void 0),p="closed"})))})),this._store.add(this._instantiationService.createInstance(D1e,e.documentWithAnnotations,this._repo)),this._store.add(this._instantiationService.createInstance(R1e,e.documentWithAnnotations,this._repo)),this._store.add(this._instantiationService.createInstance(L1e,e.documentWithAnnotations));let h=Wc("resetSignal");this.windowedTracker=Ce(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 Sne(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=Ce(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 Sne(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=AWi(s,f=>f.range.length,f=>f.sourceKey),h=Object.entries(p).filter(([f,v])=>v!==void 0);h.sort(pre(tl(([f,v])=>v,qd))),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,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=AWi(e,r=>r.range.length,r=>t(r.source)),n=ky(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)}}};ict=I([m(3,F),m(4,Te),m(5,bne),m(6,l0t)],ict);var b3t="telemetry.editStats.details.enabled",S3t="telemetry.editStats.showDecorations",I3t="telemetry.editStats.showStatusBar";var A1e=class extends C{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=bpn(pr(S3t,!1,this._configurationService)),this._editSourceTrackingShowStatusBar=pr(I3t,!1,this._configurationService);let c=pr(b3t,!1,this._configurationService),u=ui(this._extensionService.onDidChangeExtensions,()=>this._extensionService.extensions),p=Ce(y=>new Set(u.read(y).map(w=>w.id?.toLowerCase())));function h(y,w){let k=y.toLowerCase();return Ce(T=>p.read(T).has(k))}let g=h("GitHub.copilot",this._extensionService),f=h("GitHub.copilot-chat",this._extensionService),v=Ce(y=>c.read(y)||!!g.read(y)||!!f.read(y)),b=this._instantiationService.createChild(new Io([Te,this._instantiationService.createInstance(vO)])),S=this._register(b.createInstance(P1e,v,this._annotatedDocuments));this._register(he(y=>{if(!this._editSourceTrackingShowDecorations.read(y))return;let w=ui(this,this._editorService.onDidVisibleEditorsChange,()=>this._editorService.visibleTextEditorControls);$v(this,w,(k,T)=>{if(k instanceof jr){let N=os(k),O=new p9(k),V=new kI(U=>T.add(O.createClassNameRef({backgroundColor:U.getColor()})).className);T.add(N.setDecorations(Ce(U=>{let G=N.model.read(U)?.uri;if(!G)return[];let $=this._workspace.getDocument(G);if(!$)return[];let te=S.docsState.read(U).get($);return te?(te.longtermTracker.read(U)?.getTrackedRanges(U)??[]).map(de=>({range:$.value.read(void 0).getTransformer().getRange(de.range),options:{description:"editSourceTracking",inlineClassName:V.get(de.source)}})):[]})))}}).recomputeInitiallyAndOnChange(y.store)})),this._register(he(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=Ce(N=>{let O=S.docsState.read(N),V=0;for(let U of O.values()){let G=U.longtermTracker.read(N);if(!G)continue;let $=U.getTelemetryData(G.getTrackedRanges(N));V+=$.totalModifiedCharactersInFinalState}return V}),T=Ce(N=>{let O=S.docsState.read(N),V=[],U=[];for(let[pe,de]of O){let se=de.longtermTracker.read(N);if(!se)continue;let Se=se.getTrackedRanges(N),ke=de.getTelemetryData(Se);if(ke.totalModifiedCharactersInFinalState===0)continue;U.push(...Se.map(He=>He.source));let Ee=Object.fromEntries(Object.entries(ke).filter(([He,Ve])=>typeof Ve!="number"||Ve!==0));V.push([`### ${pe.uri.fsPath}`,"```json",JSON.stringify(Ee,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(U),te=new xe(G+`

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

`+$+`

Toggle decorations: [Click here](command:`+this._toggleDecorations+")"),te.isTrusted={enabledCommands:[this._toggleDecorations]},te.supportHtml=!0,te});y.store.add(he(N=>{w.update({name:"editTelemetry",text:`$(edit) ${k.read(N)} chars inserted`,ariaLabel:`Edit Source Tracking: ${k.read(N)} modified characters`,tooltip:T.read(N),command:this._showStateInMarkdownDoc})})),y.store.add(qe.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(" ")}};A1e=I([m(2,B),m(3,F),m(4,Tr),m(5,ee),m(6,lt)],A1e);function bpn(a){let i=Le("overrideObs",void 0);return y$(i,e=>i.read(e)??a.read(e),(e,t)=>{i.set(e,t)})}var y3t=class{constructor(){this._version=0;this.onDidOpenDocumentChange=Hbe({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=Ce(i=>{let e=Le("lastActiveDocument",void 0);return i.store.add(he(t=>{let o=this.documents.read(t);for(let n of o)t.store.add(_s(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())}},w3t=class a extends Qc{constructor(e,t){super(e);this.reason=t}static replace(e,t,o=_c.unknown({})){return new a([new Hc(e,t)],o)}};var N1e=class extends y3t{constructor(e){super();this._textModelService=e;this._store=new P;let t=Nr(this,this._textModelService.onModelAdded),o=Nr(this,this._textModelService.onModelRemoved),n=Ce(this,s=>(t.read(s),o.read(s),this._textModelService.getModels())),r=$v(this,n,(s,l)=>{if(!s.isTooLargeForSyncing())return l.add(new HWi(s))}).recomputeInitiallyAndOnChange(this._store).map(s=>s.filter(mo));this._documents=r}get documents(){return this._documents}dispose(){this._store.dispose()}};N1e=I([m(0,Ct)],N1e);var HWi=class extends C{constructor(e){super();this.textModel=e;this._value=Le(this,new _S(this.textModel.getValue())),this._version=Le(this,this.textModel.getVersionId()),this._languageId=Le(this,this.textModel.getLanguageId()),this._register(this.textModel.onDidChangeContent(t=>{Ui(o=>{let n=O9(t.changes);t.detailedReasons.length!==1&&mt(new Error(`Unexpected number of detailed reasons: ${t.detailedReasons.length}`));let r=new w3t(n.replacements,t.detailedReasons[0]);this._value.set(new _S(this.textModel.getValue()),o,r),this._version.set(this.textModel.getVersionId(),o)})})),this._register(this.textModel.onDidChangeLanguage(t=>{Ui(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 C3t="telemetry.editStats.enabled",O1e="editor.aiStats.enabled";function Spn(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 zEo(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",wt(JSe)),v.setAttribute("font-size","11px"),v.textContent=d(9437,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",wt(lgt)),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",wt(lgt)),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",wt(JSe)),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",wt(lgt)),y.setAttribute("stroke-width","0.5px"),y.setAttribute("stroke-dasharray","2,2"),u.appendChild(y)}}e==="days"?g():f();function g(){let v=Spn(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((U,G)=>{let $=k+G*(S+y),te=U.aiRate*s,pe=s-te,de=document.createElementNS("http://www.w3.org/2000/svg","rect");de.setAttribute("x",`${$}`),de.setAttribute("y",`${pe}`),de.setAttribute("width",`${S}`),de.setAttribute("height",`${Math.max(1,te)}`),de.setAttribute("fill",wt(B$e)),de.setAttribute("rx","2"),u.appendChild(de);let se=G===0,Se=G===b-1,ke=G%V===0;if(se||Se||ke&&b>2){if(!se&&!Se){let He=G*(S+y),Ve=(b-1-G)*(S+y);if(He<T||Ve<T)return}let Ee=document.createElementNS("http://www.w3.org/2000/svg","text");Ee.setAttribute("x",`${$+S/2}`),Ee.setAttribute("y",`${s+12}`),Ee.setAttribute("text-anchor","middle"),Ee.setAttribute("fill",wt(JSe)),Ee.setAttribute("font-size","8px"),Ee.textContent=U.displayDate,u.appendChild(Ee)}})}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((U,G)=>{let $=U.aiCharacters+U.typedCharacters,te=$>0?U.aiCharacters/$:0,pe=w+G*(b+S),de=te*s,se=s-de,Se=document.createElementNS("http://www.w3.org/2000/svg","rect");Se.setAttribute("x",`${pe}`),Se.setAttribute("y",`${se}`),Se.setAttribute("width",`${b}`),Se.setAttribute("height",`${Math.max(1,de)}`),Se.setAttribute("fill",wt(B$e)),Se.setAttribute("rx","1"),u.appendChild(Se)});let k=40;if(v===0)return;let T=i[0],N=w,O=new Date(T.startTime),V=document.createElementNS("http://www.w3.org/2000/svg","text");if(V.setAttribute("x",`${N+b/2}`),V.setAttribute("y",`${s+12}`),V.setAttribute("text-anchor","start"),V.setAttribute("fill",wt(JSe)),V.setAttribute("font-size","8px"),V.textContent=O.toLocaleDateString(void 0,{month:"short",day:"numeric"}),u.appendChild(V),v>1&&y>=k){let U=i[v-1],G=w+(v-1)*(b+S),$=new Date(U.startTime),te=document.createElementNS("http://www.w3.org/2000/svg","text");te.setAttribute("x",`${G+b/2}`),te.setAttribute("y",`${s+12}`),te.setAttribute("text-anchor","end"),te.setAttribute("fill",wt(JSe)),te.setAttribute("font-size","8px"),te.textContent=$.toLocaleDateString(void 0,{month:"short",day:"numeric"}),u.appendChild(te)}}return l}var F1e=class extends C{constructor(e,t,o,n){super();this._aiStatsFeature=e;this._statusbarService=t;this._commandService=o;this._telemetryService=n;this._register(he(r=>{let s=this._createStatusBar().keepUpdated(r.store),l=this._register(new P);r.store.add(this._statusbarService.addEntry({name:d(9442,null),ariaLabel:d(9443,null),text:"",tooltip:{element:async c=>(this._sendHoverTelemetry(),l.clear(),Ipn({data:this._aiStatsFeature,onOpenSettings:()=>wpn({ids:[O1e]}).run(this._commandService)}).keepUpdated(l).element),markdownNotSupportedFallback:void 0},content:s.element},"aiStatsStatusBar",1,100))}))}static{this.hot=s1(this)}_sendHoverTelemetry(){this._telemetryService.publicLog2("aiStatsStatusBar.hover",{aiRate:this._aiStatsFeature.aiRate.get()})}_createStatusBar(){return Mo.div({style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",marginLeft:"3px",marginRight:"3px"}},[Mo.div({class:"ai-stats-status-bar",style:{display:"flex",flexDirection:"column",width:50,height:6,borderRadius:6,borderWidth:"1px",borderStyle:"solid"}},[Mo.div({style:{flex:1,display:"flex",overflow:"hidden",borderRadius:6,border:"1px solid transparent"}},[Mo.div({style:{width:this._aiStatsFeature.aiRate.map(e=>`${e*100}%`),backgroundColor:"currentColor"}})])])])}};F1e=I([m(1,Tr),m(2,ge),m(3,Te)],F1e);function Ipn(a){let i=Le("chartViewMode","days"),e=a.data.aiRate.map(o=>`${Math.round(o*100)}%`),t=(o,n,r)=>Ce(s=>{let c=i.read(s)===o;return Mo.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},[Mo.div({class:q.asClassName(r),style:{fontSize:"14px"}})])});return Mo.div({class:"ai-stats-status-bar"},[Mo.div({class:"header",style:{minWidth:"280px"}},[Mo.div({style:{flex:1}},[d(9439,null)]),Mo.div({style:{marginLeft:"auto"}},a.onOpenSettings?ypn([{action:{id:"aiStats.statusBar.settings",label:"",enabled:!0,run:a.onOpenSettings,class:q.asClassName(M.gear),tooltip:d(9438,null)},options:{icon:!0,label:!1,hoverDelegate:US}}]):[])]),Mo.div({style:{display:"flex"}},[Mo.div({style:{flex:1,paddingRight:"4px"}},[d(9444,null,e.get())])]),Mo.div({style:{flex:1,paddingRight:"4px"}},[d(9445,null,a.data.acceptedInlineSuggestionsToday.get())]),Mo.div({style:{marginTop:"8px",borderTop:"1px solid var(--vscode-widget-border)",paddingTop:"8px"}},[Mo.div({class:"header",style:{display:"flex",alignItems:"center",marginBottom:"4px"}},[Mo.div({style:{flex:1}},[i.map(o=>o==="days"?d(9440,null):d(9441,null))]),Mo.div({class:"chart-view-toggle",style:{marginLeft:"auto",display:"flex",gap:"2px"}},[t("days",d(9446,null),M.calendar),t("sessions",d(9447,null),M.listFlat)])]),Ce(o=>{let n=a.data.sessions.read(o),r=i.read(o);return Mo.div({ref:s=>{let l=zEo({sessions:n,viewMode:r});s.appendChild(l)}})})])])}function ypn(a,i){return Ce(e=>Mo.div({class:[],style:{},ref:t=>{let o=e.store.add(new ji(t,i));for(let{action:n,options:r}of a)o.push(n,r)}}))}var UWi=class{constructor(i,e=[]){this.commandId=i;this.args=e}run(i){i.executeCommand(this.commandId,...this.args)}};function wpn(a={}){return new UWi("workbench.action.openSettings",[{query:a.ids?a.ids.map(i=>`@id:${i}`).join(" "):void 0}])}var W1e=class extends C{constructor(e,t,o){super();this._storageService=t;this._instantiationService=o;this._dataVersion=Le(this,0);this.aiRate=this._dataVersion.map(()=>{let e=this._data.getValue();return e?Cpn(e.sessions,o=>{let n=o.typedCharacters+o.aiCharacters;return n===0?0:o.aiCharacters/n}):0});this.sessionCount=Ce(this,e=>{this._dataVersion.read(e);let t=this._data.getValue();return t?t.sessions.length:0});this.sessions=Ce(this,e=>{this._dataVersion.read(e);let t=this._data.getValue();return t?t.sessions:[]});this.acceptedInlineSuggestionsToday=Ce(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 ky(n,r=>r.acceptedInlineSuggestions??0)});let n=kpn(this._storageService,"aiStats",1,0);this._data=xpn(n,1/60,this._store),this.aiRate.recomputeInitiallyAndOnChange(this._store),this._register(he(l=>{l.store.add(this._instantiationService.createInstance(F1e.hot.read(l),this))}));let r=[];$v(this,e.documents,(l,c)=>{c.add(_s(l.documentWithAnnotations.value,(u,p,h)=>{let g=OI.compose(h.map(v=>v.edit)),f=new co(()=>this._getDataAndSession());for(let v of g.replacements)Zqi(v.data.editSource)?f.value.currentSession.aiCharacters+=v.newText.length:eji(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}}};W1e=I([m(1,le),m(2,F)],W1e);function Cpn(a,i){return a.length===0?0:ky(a,i)/a.length}function xpn(a,i,e){let t=new Pbe,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 Pi(5e3)})},getValue(){return n>0?o:a.getValue()}}}function kpn(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 x3t=class extends C{constructor(e){super();this._trackers=new vt;this._documentsByUri=new vt;this._register(he(t=>{let o=e.documents.read(t),n=new vt;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(qe.registerCommand("_aiEdits.hasAiContributions",(t,o,n)=>this._hasAiContributions(o,n))),this._register(qe.registerCommand("_aiEdits.clearAiContributions",(t,o)=>{this._clearAiContributions(o)})),this._register(qe.registerCommand("_aiEdits.clearAllAiContributions",()=>{this._clearAiContributions()}))}dispose(){for(let[,e]of this._trackers)e.trackerStore.dispose();super.dispose()}_createTrackerEntry(e){let t=new P,o=dve(e.documentWithAnnotations,t),n=t.add(new Sne(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 V1e=class extends C{constructor(i,e,t,o){super();let n=Ce(u=>u.store.add(i.createInstance(N1e))),r=Ce(u=>u.store.add(i.createInstance(_1e,n.read(u)))),s=pr(C3t,!0,e);this._register(he(u=>{!s.read(u)||!eKi(t,3)||u.store.add(i.createInstance(A1e,n.read(u),r.read(u)))}));let l=pr(O1e,!0,e);this._register(he(u=>{let p=l.read(u),h=o.sentimentObs.read(u).hidden;!p||h||u.store.add(i.createInstance(W1e,r.read(u)))}));let c=pr("git.addAICoAuthor","off",e);this._register(he(u=>{c.read(u)!=="off"&&u.store.add(i.createInstance(x3t,r.read(u)))}))}};V1e=I([m(0,F),m(1,B),m(2,Te),m(3,vr)],V1e);var B1e=class{constructor(i,e){this.instantiationService=i;this._randomService=e;this._telemetryService=this.instantiationService.createInstance(vO)}createSuggestionId(i){let e=yZt.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:new Im(i.modelId),applyCodeBlockSuggestionId:i.applyCodeBlockSuggestionId,...q1(VW(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:new Im(i.modelId),applyCodeBlockSuggestionId:i.applyCodeBlockSuggestionId,acceptanceMethod:i.acceptanceMethod,...q1(VW(i.source?.extensionId))})}};B1e=I([m(0,F),m(1,bne)],B1e);pt("EditTelemetryContribution",V1e,ut.AfterRestored);var Epn=oe.as(ii.Configuration);Epn.registerConfiguration({id:"task",order:100,title:d(9449,null),type:"object",properties:{[C3t]:{markdownDescription:d(9451,null),type:"boolean",default:!0,tags:["experimental"]},[O1e]:{markdownDescription:d(9448,null),type:"boolean",default:!1,tags:["experimental"],experiment:{mode:"auto"}},[b3t]:{markdownDescription:d(9450,null),type:"boolean",default:!1,tags:["experimental"],experiment:{mode:"auto"}},[I3t]:{markdownDescription:d(9453,null),type:"boolean",default:!1,tags:["experimental"]},[S3t]:{markdownDescription:d(9452,null),type:"boolean",default:!1,tags:["experimental"]}}});we(rS,B1e,1);we(bne,v3t,1);var H1e=class extends C{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(JF,o),!0}catch{}return!1}};H1e=I([m(0,Qe),m(1,ge),m(2,be),m(3,Pe)],H1e);pt(H1e.ID,H1e,ut.Eventually);we(uy,uLe,1);we(zp,pLe,1);we(MK,dLe,1);we(nz,CK,1);we(Hz,pw,1);we(_n,d0t,1);we(fo,Eyt,1);we(RU,nLe,1);we(Ns,u0t,1);we(X,rLe,1);we(Nn,aLe,1);we(tF,lLe,1);we(Qe,cLe,1);we(Ay,IDt,1);we(PK,mLe,1);we(MR,hLe,1);var U1e=globalThis.vscode,el=U1e.ipcRenderer,KEo=U1e.ipcMessagePort,GEo=U1e.webFrame,cM=U1e.process,A4b=U1e.context,N4b=U1e.webUtils;var oct=8,nct=-8;function MG(a,i){a=Math.min(Math.max(a,nct),oct);let e=[];i===1?e.push(Ki()):i===2?e.push(...Array.from(Gw()).map(({window:t})=>t)):e.push(i);for(let t of e)Tpn(t)?.webFrame?.setZoomLevel(a),$Ui(L4i(a),t),GUi(a,t)}function Tpn(a){if(a===It)return{ipcRenderer:el,webFrame:GEo};{let i=a;if(i?.vscode?.ipcRenderer&&i?.vscode?.webFrame)return i.vscode}}var z1e=ae("integrityService");var ps=Co,_h=class extends Su{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 je(this.logsHome,`window${this.configuration.windowId}`)}get logFile(){return je(this.windowLogsPath,"renderer.log")}get extHostLogsPath(){return je(this.windowLogsPath,"exthost")}get webviewExternalEndpoint(){return`${Y.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}};I([mi],_h.prototype,"mainPid",1),I([mi],_h.prototype,"machineId",1),I([mi],_h.prototype,"sqmId",1),I([mi],_h.prototype,"devDeviceId",1),I([mi],_h.prototype,"isPortable",1),I([mi],_h.prototype,"remoteAuthority",1),I([mi],_h.prototype,"expectsResolverExtension",1),I([mi],_h.prototype,"execPath",1),I([mi],_h.prototype,"backupPath",1),I([mi],_h.prototype,"window",1),I([mi],_h.prototype,"windowLogsPath",1),I([mi],_h.prototype,"logFile",1),I([mi],_h.prototype,"extHostLogsPath",1),I([mi],_h.prototype,"webviewExternalEndpoint",1),I([mi],_h.prototype,"skipReleaseNotes",1),I([mi],_h.prototype,"skipWelcome",1),I([mi],_h.prototype,"logExtensionHostCommunication",1),I([mi],_h.prototype,"enableSmokeTestDriver",1),I([mi],_h.prototype,"extensionEnabledProposedApi",1),I([mi],_h.prototype,"os",1),I([mi],_h.prototype,"filesToOpenOrCreate",1),I([mi],_h.prototype,"filesToDiff",1),I([mi],_h.prototype,"filesToMerge",1),I([mi],_h.prototype,"filesToWait",1),I([mi],_h.prototype,"isSessionsWindow",1);var Lu=ae("mainProcessService");var k3t=class{constructor(i,e,t,o){let n=t.getChannel(i);return _pn(e)?o.createInstance(new Mt(e.channelClientCtor,[n])):dd.toService(n,e?.proxyOptions)}};function _pn(a){return!!a?.channelClientCtor}var rct=class extends k3t{constructor(i,e,t,o){super(i,e,t,o)}};rct=I([m(2,Lu),m(3,F)],rct);function nx(a,i,e){we(a,new Mt(rct,[i,e],!0))}var Fb=ae("sharedProcessService"),sct=class extends k3t{constructor(i,e,t,o){super(i,e,t,o)}};sct=I([m(2,Fb),m(3,F)],sct);function Hv(a,i,e){we(a,new Mt(sct,[i,e],!0))}var zWi=class{constructor(i){this.port=i;this.onMessage=H.fromDOMEventEmitter(this.port,"message",e=>e.data?Je.wrap(e.data):Je.alloc(0)),i.start()}send(i){this.port.postMessage(i.buffer)}disconnect(){this.port.close()}},Ine=class extends wX{constructor(i,e){let t=new zWi(i);super(t,e),this.protocol=t}dispose(){this.protocol.disconnect(),super.dispose()}};async function DQ(a,i,e=_t()){KEo.acquire(i,e),typeof a=="string"&&el.send(a,e);let t=H.fromDOMEventEmitter(It,"message",n=>({nonce:n.data,port:n.ports[0],source:n.source})),{port:o}=await H.toPromise(H.once(H.filter(t,n=>n.nonce===e&&n.source===It)));return o}var $Eo="utilityProcessWorker";var E3t=ae("utilityProcessWorkerWorkbenchService"),K1e=class extends C{constructor(e,t,o){super();this.windowId=e;this.logService=t;this.mainProcessService=o;this._utilityProcessWorkerService=void 0;this.restoredBarrier=new Np}get utilityProcessWorkerService(){if(!this._utilityProcessWorkerService){let e=this.mainProcessService.getChannel($Eo);this._utilityProcessWorkerService=dd.toService(e)}return this._utilityProcessWorkerService}async createWorker(e){this.logService.trace("Renderer->UtilityProcess#createWorker"),await Promise.race([this.restoredBarrier.wait(),Pi(2e3)]);let t=_t(),o="vscode:createUtilityProcessWorkerMessageChannelResult",n=DQ(void 0,o,t),r=this.utilityProcessWorkerService.createWorker({process:e,reply:{windowId:this.windowId,channel:o,nonce:t}}),s=new P;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 Ine(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()}};K1e=I([m(1,ne),m(2,Lu)],K1e);var PG=class extends tD{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N,O,V,U,G,$,te,pe,de,se,Se,ke,Ee,He,Ve,Fe,Qt,Ze){super(It,void 0,Qt,b,Ze,N);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=U;this.remoteAuthorityResolverService=G;this.dialogService=$;this.storageService=te;this.logService=pe;this.instantiationService=de;this.sharedProcessService=se;this.progressService=Se;this.labelService=ke;this.bannerService=Ee;this.uriIdentityService=He;this.preferencesService=Ve;this.utilityProcessWorkerWorkbenchService=Fe;this.customTitleContextMenuDisposable=this._register(new P);this.addRemoveFoldersScheduler=this._register(new Dt(()=>this.doAddRemoveFolders(),100));this.pendingFoldersToAdd=[];this.pendingFoldersToRemove=[];this.isDocumentedEdited=!1;this.touchBarDisposables=this._register(new P);this.mapWindowIdToZoomStatusEntry=new Map;this.configuredWindowZoomLevel=this.resolveConfiguredWindowZoomLevel(),this.registerListeners(),this.create()}registerListeners(){this._register(j(It,re.RESIZE,()=>this.layoutService.layout())),this._register(this.editorService.onDidActiveEditorChange(()=>this.updateTouchbarMenu()));for(let t of[re.DRAG_OVER,re.DROP])this._register(j(It.document.body,t,o=>{$t.stop(o)}));el.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=no.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)}}),el.on("vscode:runKeybinding",(t,...o)=>{let n=o[0],r=Pn();r&&this.keybindingService.dispatchByUserSettingsLabel(n.userSettingsLabel,r)}),el.on("vscode:reportSharedProcessCrash",(t,...o)=>{this.notificationService.prompt(St.Error,d(16467,null),[{label:d(16464,null),run:()=>this.nativeHostService.relaunch()}],{priority:3})}),el.on("vscode:openFiles",(t,...o)=>{this.onOpenFiles(o[0])}),el.on("vscode:addRemoveFolders",(t,...o)=>this.onAddRemoveFoldersRequest(o[0])),el.on("vscode:showInfoMessage",(t,...o)=>this.notificationService.info(o[0])),el.on("vscode:showResolveShellEnvError",(t,...o)=>{let n=o[0];this.notificationService.prompt(St.Error,n,[{label:d(16464,null),run:()=>this.nativeHostService.relaunch()},{label:d(16453,null),run:()=>this.preferencesService.openUserSettings({query:"application.shellEnvironmentResolutionTimeout"})},{label:d(16456,null),run:()=>this.openerService.open("https://go.microsoft.com/fwlink/?linkid=2149667")}])}),el.on("vscode:showCredentialsError",(t,...o)=>{let n=o[0];this.notificationService.prompt(St.Error,d(16455,null,n),[{label:d(16484,null),run:()=>this.openerService.open("https://go.microsoft.com/fwlink/?linkid=2190713")}])}),el.on("vscode:showTranslatedBuildWarning",()=>{this.notificationService.prompt(St.Warning,d(16466,null,this.productService.nameLong),[{label:d(16454,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})}),el.on("vscode:showArgvParseWarning",()=>{this.notificationService.prompt(St.Warning,d(16468,null),[{label:d(16469,null),run:()=>this.editorService.openEditor({resource:this.nativeEnvironmentService.argvResource})}],{priority:3})}),el.on("vscode:enterFullScreen",()=>s$(!0,It)),el.on("vscode:leaveFullScreen",()=>s$(!1,It)),el.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(16460,null),primaryButton:d(16457,null),inputs:[{placeholder:d(16485,null),value:n.username},{placeholder:d(16459,null),type:"password",value:n.password}],detail:d(16461,null,`${n.authInfo.host}:${n.authInfo.port}`),checkbox:{label:d(16462,null),checked:s}});if(!l.confirmed||!l.values)el.send(n.replyChannel);else{l.checkboxChecked?this.storageService.store(r,!0,-1,1):this.storageService.remove(r,-1);let[c,u]=l.values;el.send(n.replyChannel,{username:c,password:u,remember:!!l.checkboxChecked})}}),el.on("vscode:accessibilitySupportChanged",(t,...o)=>{let n=o[0];this.accessibilityService.setAccessibilitySupport(n?2:1)}),el.on("vscode:configureAllowedUNCHost",async(t,...o)=>{let n=o[0];if(!ri)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 Ule(i5.ID).ready,this.configurationService.updateValue("security.allowedUNCHosts",[...r.values()],2))}),el.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(tpt(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(H.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,si(e.paths.map(t=>t.fileUri))),it){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(H.any(H.map(H.filter(this.nativeHostService.onDidMaximizeWindow,t=>!!E6(t)),t=>({maximized:!0,windowId:t})),H.map(H.filter(this.nativeHostService.onDidUnmaximizeWindow,t=>!!E6(t)),t=>({maximized:!1,windowId:t})))(t=>this.layoutService.updateWindowMaximizedState(qv(t.windowId).window,t.maximized))),this.layoutService.updateWindowMaximizedState(It,this.nativeEnvironmentService.window.maximized??!1),this._register(this.layoutService.onDidChangePanelPosition(t=>this.onDidChangePanelPosition(RXi(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 P;H.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=no.getOriginalUri(e.activeEditor,{supportSideBySide:1,filterByScheme:Y.file});this.nativeHostService.setRepresentedFilename(o?.fsPath??"",{targetWindowId:t}),t===It.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"&&bf.getInstance().isModifierPressed;if(n)return e((async()=>{let r=t;t===1&&!it&&await this.nativeHostService.getWindowCount()===1&&(r=2);let s=!0;return n&&(s=await this.instantiationService.invokeFunction(l=>PG.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)},()=>H.toPromise(H.any(this.lifecycleService.onWillShutdown,this.lifecycleService.onShutdownVeto,this.dialogService.onWillShowDialog)))}onBeforeShutdownError({error:e,reason:t}){this.dialogService.error(this.toShutdownLabel(t,!0),d(16471,null,In(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(16486,null,r.map(s=>`- ${s.label}`).join(`
`)):void 0},()=>H.toPromise(this.lifecycleService.onDidShutdown),()=>{t()})},1200);n.schedule(),H.once(this.lifecycleService.onDidShutdown)(()=>n.dispose())}toShutdownLabel(e,t){if(t)switch(e){case 1:return d(16470,null);case 2:return d(16473,null);case 3:return d(16474,null);case 4:return d(16472,null)}switch(e){case 1:return d(16479,null);case 2:return d(16481,null);case 3:return d(16482,null);case 4:return d(16480,null)}}toForceShutdownLabel(e){switch(e){case 1:return d(16475,null);case 2:return d(16477,null);case 3:return d(16478,null);case 4:return d(16476,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?owe.WIDTH_WITH_VERTICAL_PANEL:owe.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||eO(this.configurationService))return;let t=e.split(Lo.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(Lo.sep)),l;n?l=this.labelService.getUriBasenameLabel(s):l=this.labelService.getUriBasenameLabel(ci(s));let c=`workbench.action.revealPathInFinder${o}`;this.customTitleContextMenuDisposable.add(qe.registerCommand(c,()=>this.nativeHostService.showItemInFolder(s.fsPath))),this.customTitleContextMenuDisposable.add(fe.appendMenuItem(D.TitleBarTitleContext,{command:{id:c,title:l||Lo.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&&fOt(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&&!ri&&this.notificationService.warn(d(16465,null,this.productService.nameShort))})(),this.environmentService.isBuilt&&!this.environmentService.extensionDevelopmentLocationURI?.length){let t;it?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(16452,null,this.labelService.getUriLabel(t)),icon:M.warning});break}}if(it){let t=this.nativeEnvironmentService.os.release.split(".")[0],o=new Map([["20","macOS Big Sur"]]);if(o.has(t)){let n=d(16458,null,this.productService.nameLong,o.get(t));this.notificationService.prompt(St.Warning,n,[{label:d(16456,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=cM.shellEnv();this.progressService.withProgress({title:d(16463,null),location:10,delay:1600,buttons:[d(16456,null)]},()=>e,()=>this.openerService.open("https://go.microsoft.com/fwlink/?linkid=2149667"))}async resolveExternalUri(e,t){let o;if(t?.allowTunneling){let n=DTe(e),r=Ato(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===Y.file&&await this.nativeHostService.showItemInFolder(o.fsPath)}return!0}}),this.openerService.registerExternalUriResolver({resolveExternalUri:async(e,t)=>this.resolveExternalUri(e,t)})}updateTouchbarMenu(){if(!it)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=Vm(this.touchBarMenu.getActions()),s=[],l=[];if(!t){for(let c of r)if(c instanceof Eo){if(n.indexOf(c.item.id)>=0)continue;l.push(c.item)}else c instanceof li&&(l.length&&s.push(l),l=[]);l.length&&s.push(l)}uo(this.lastInstalledTouchedBar,s)||(this.lastInstalledTouchedBar=s,this.nativeHostService.updateTouchBar(s))}updateWindowBorder(){if(!ri)return;let e=this.themeService.getColorTheme(),t=e.getColor(xEt)?.toString(),o=e.getColor(kEt)?.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=si(await V7i(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),si(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=>CXi(o,t)),await this.fileService.del(e)}async openResources(e,t,o){let n=[];if(o&&QS(e[0])&&QS(e[1])&&QS(e[2])&&QS(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&&QS(e[0])&&QS(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===It.vscodeWindowId){let t=RT(It),o;this.configuredWindowZoomLevel!==t&&(o=t),el.invoke("vscode:notifyZoomLevel",o)}}createWindowZoomStatusEntry(e){let t=new P;H.once(e.onWillDispose)(()=>t.dispose());let o=this.editorGroupService.getScopedInstantiationService(e);this.mapWindowIdToZoomStatusEntry.set(e.windowId,t.add(o.createInstance(act))),t.add(Z(()=>this.mapWindowIdToZoomStatusEntry.delete(e.windowId))),this.updateWindowZoomStatusEntry(e.windowId)}updateWindowZoomStatusEntry(e){let t=qv(e),o=this.mapWindowIdToZoomStatusEntry.get(e);if(o&&t){let n=RT(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 Gw())if(RT(t)!==this.configuredWindowZoomLevel){e=!0;break}e&&MG(this.configuredWindowZoomLevel,2);for(let[t]of this.mapWindowIdToZoomStatusEntry)this.updateWindowZoomStatusEntry(t)}dispose(){super.dispose();for(let[,e]of this.mapWindowIdToZoomStatusEntry)e.dispose()}};PG=I([m(0,ee),m(1,Et),m(2,B),m(3,qP),m(4,Gp),m(5,Ne),m(6,ge),m(7,_e),m(8,Te),m(9,Of),m(10,be),m(11,qt),m(12,ao),m(13,z1e),m(14,ps),m(15,Bi),m(16,Pe),m(17,Qe),m(18,To),m(19,ap),m(20,fi),m(21,Wa),m(22,lr),m(23,nt),m(24,Mc),m(25,ct),m(26,le),m(27,ne),m(28,F),m(29,Fb),m(30,Bo),m(31,ot),m(32,jP),m(33,dt),m(34,Po),m(35,E3t),m(36,oi),m(37,ze)],PG);var act=class extends C{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 P;this.disposable.value=t;let o=_(".zoom-status"),n=_(".zoom-status-left");o.appendChild(n);let r=t.add(new st("workbench.action.zoomOut",d(16489,null),q.asClassName(M.remove),!0,()=>this.commandService.executeCommand(r.id))),s=t.add(new st("workbench.action.zoomIn",d(16487,null),q.asClassName(M.plus),!0,()=>this.commandService.executeCommand(s.id))),l=t.add(new st("workbench.action.zoomReset",d(16490,null),void 0,!0,()=>this.commandService.executeCommand(l.id)));l.tooltip=this.keybindingService.appendKeybinding(l.label,l.id);let c=t.add(new st("workbench.action.openSettings",d(16491,null),q.asClassName(M.settingsGear),!0,()=>this.commandService.executeCommand(c.id,"window.zoom"))),u=t.add(new st("zoomLabel",void 0,void 0,!1));this.zoomLevelLabel=u,t.add(Z(()=>this.zoomLevelLabel=void 0));let p=t.add(new ji(n,{hoverDelegate:US}));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 ji(h,{hoverDelegate:US}));g.push(l,{icon:!1,label:!0}),g.push(c,{icon:!0,label:!1,keybinding:this.keybindingService.lookupKeybinding(c.id)?.getLabel()});let f=d(16483,null);t.add(this.statusbarService.addEntry({name:f,text:e,tooltip:o,ariaLabel:f,command:GL,kind:"prominent"},"status.windowZoom",1,102))}updateZoomLevelLabel(e){if(this.zoomLevelLabel){let t=qv(e,!0).window,o=Math.round(yS(t)*100),n=RT(t);this.zoomLevelLabel.label=`${n}`,this.zoomLevelLabel.tooltip=d(16488,null,n,o)}}};act=I([m(0,Tr),m(1,ge),m(2,_e)],act);var T3t=class extends Rae{constructor(e,t,o,n){super();this.remoteService=o;this.environmentService=n;this.profileStorageDisposables=this._register(new P);this.workspaceStorageDisposables=this._register(new P);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 NDe(this.remoteService.getChannel("storage"))),t=this._register(new XN(e));return this._register(t.onDidChangeStorage(o=>this.emitDidChangeValue(-1,o))),t}createProfileStorage(e){this.profileStorageDisposables.clear(),this.profileStorageProfile=e;let t;if(iwe(e))t=this.applicationStorage;else{let o=this.profileStorageDisposables.add(new ODe(this.remoteService.getChannel("storage"),e));t=this.profileStorageDisposables.add(new XN(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 bFt(this.remoteService.getChannel("storage"),e));t=this.workspaceStorageDisposables.add(new XN(o)),this.workspaceStorageDisposables.add(t.onDidChangeStorage(n=>this.emitDidChangeValue(1,n)))}return t}async doInitialize(){await fn.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:Y.file}).fsPath;case 0:return this.profileStorageProfile?.globalStorageHome.with({scheme:Y.file}).fsPath;default:return this.workspaceStorageId?`${je(this.environmentService.workspaceStorageHome,this.workspaceStorageId,"state.vscdb").with({scheme:Y.file}).fsPath}`:void 0}}async close(){this.stopFlushWhenIdle(),this.emitWillSaveState(1),await fn.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 ZN(e)?this.profileStorageProfile.id===e.id:this.workspaceStorageId===e.id}};var _3t=class extends T3t{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 KWi={request:"vscode:createSharedProcessChannelConnection",response:"vscode:createSharedProcessChannelConnectionResult"},GWi={request:"vscode:createSharedProcessRawConnection",response:"vscode:createSharedProcessRawConnectionResult"};var G1e=class extends C{constructor(e,t){super();this.windowId=e;this.logService=t;this.restoredBarrier=new Np;this.withSharedProcessConnection=this.connect()}async connect(){this.logService.trace("Renderer->SharedProcess#connect"),await Promise.race([this.restoredBarrier.wait(),Pi(2e3)]),sn("code/willConnectSharedProcess"),this.logService.trace("Renderer->SharedProcess#connect: before acquirePort");let e=await DQ(KWi.request,KWi.response);return sn("code/didConnectSharedProcess"),this.logService.trace("Renderer->SharedProcess#connect: connection established"),this._register(new Ine(e,`window:${this.windowId}`))}notifyRestored(){this.restoredBarrier.isOpen()||this.restoredBarrier.open()}getChannel(e){return CX(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 DQ(GWi.request,GWi.response);return this.logService.trace("Renderer->SharedProcess#createRawConnection: connection established"),e}};G1e=I([m(1,ne)],G1e);var $1e=class extends C{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,jD.setServerRootPath(e,void 0)}resolveAuthority(e){return this._resolveAuthorityRequests.has(e)||this._resolveAuthorityRequests.set(e,new Go),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 Go;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?jD.set(e.authority,e.connectTo.host,e.connectTo.port):jD.setDelegate(this.remoteResourceLoader.getResourceUriProvider()),e.connectionToken&&jD.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(Zs.fromError(t))}_setAuthorityConnectionToken(e,t){this._connectionTokens.set(e,t),jD.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))})}};$1e=I([m(0,nt)],$1e);var AG=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),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:Xn(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 Lpn="signService",yne=ae(Lpn);var q1e=class extends C{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 $Wi(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 AG.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)=>AG.getExtensionHostExitInfo(t,o.remoteAuthority,e),null)}getDiagnosticInfo(e){return this._withChannel(t=>AG.getDiagnosticInfo(t,e),void 0)}updateTelemetryLevel(e){return this._withTelemetryChannel(t=>AG.updateTelemetryLevel(t,e),void 0)}logTelemetry(e,t){return this._withTelemetryChannel(o=>AG.logTelemetry(o,e,t),void 0)}flushTelemetry(){return this._withTelemetryChannel(e=>AG.flushTelemetry(e),void 0)}getRoundTripTime(){return this._withTelemetryChannel(async e=>{let t=Date.now();return await AG.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)}};q1e=I([m(0,Fz),m(1,mn),m(2,Vt),m(3,nt),m(4,Mc),m(5,yne),m(6,ne)],q1e);var $Wi=class extends C{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 CX(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 wko(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 j1e=class extends q1e{constructor(i,e,t,o,n,r,s){super(i,e,t,o,n,r,s)}};j1e=I([m(0,Fz),m(1,mn),m(2,Vt),m(3,nt),m(4,Mc),m(5,yne),m(6,ne)],j1e);var Q1e=class{constructor(i,e,t,o,n,r,s){this._remoteAgentService=i;this._remoteAuthorityResolverService=r;this._remoteAgentService.getRawEnvironment().then(void 0,l=>{if(!ow.isHandled(l)){let c=[{label:d(17200,null),run:()=>n.openDevTools()}],u=this._getTroubleshootingURL();u&&c.push({label:d(17201,null),run:()=>s.open(u,{openExternal:!0})}),e.prompt(St.Error,d(17199,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"})}};Q1e=I([m(0,yo),m(1,Ne),m(2,Vt),m(3,Te),m(4,To),m(5,Mc),m(6,Qe)],Q1e);pt(Q1e.ID,Q1e,ut.BlockRestore);async function qEo(a,i,e,t,o,n){let r;try{await Rpn(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 Rpn(a,i,e,t,o,n){qWi(n);let r=await a.open(i,{create:!1});try{qWi(n);let s=0,l=0,c=o&&typeof o.length=="number"?o.length:void 0,u=Je.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=Je.alloc(Math.min(o.bufferSize,typeof c=="number"?c:o.bufferSize)),h=0);while(l>0&&(typeof c!="number"||c>0)&&qWi(n)&&Mpn(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 Q$(s)}finally{await a.close(r)}}function qWi(a){if(a.isCancellationRequested)throw CI();return!0}function Mpn(a,i){if(typeof i?.limits?.size=="number"&&a>i.limits.size)throw Jr(d(2089,null),"EntryTooLarge");return!0}var wne=class extends C{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 sU)}registerProvider(e,t){if(this.provider.has(e))throw new Error(`A filesystem provider for the scheme '${e}' is already registered.`);sn(`code/registerFilesystem/${e}`);let o=new P;return this.provider.set(e,t),this._onDidChangeFileSystemProviderRegistrations.fire({added:!0,scheme:e,provider:t}),o.add(t.onDidChangeFile(n=>{let r=new FN(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),Ue(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 fn.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 ht.map(this.provider,([e,t])=>({scheme:e,capabilities:t.capabilities}))}async withProvider(e){if(!wpt(e))throw new As(d(2078,null,this.resourceForError(e)),8);await this.activateProvider(e.scheme);let t=this.provider.get(e.scheme);if(!t){let o=new Zs;throw o.message=d(2080,null,e.toString()),o}return t}async withReadProvider(e){let t=await this.withProvider(e);if(j$(t)||XT(t)||Qgt(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(j$(t)||XT(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 Gse(o)==="EntryNotFound"?new As(d(2075,null,this.resourceForError(e)),1):Q$(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=Yu.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:fJt({mtime:o.mtime,size:o.size}),children:void 0};if(c.isDirectory&&s(c,n)){try{let u=await e.readdir(t),p=await fn.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=si(p)}catch(u){this.logService.trace(u),c.children=[]}return c}return c}async resolveAll(e){return fn.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(R$i(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 As(d(2071,null,this.resourceForError(e)),3,t)}async createFile(e,t=Je.fromString(""),o){await this.doValidateCreateFile(e,o);let n=await this.writeFile(e,t);return this._onDidRunOperation.fire(new ON(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(hJt(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)),!j$(n)||XT(n)&&c instanceof Je||XT(n)&&hJt(n)&&s?.atomic?await this.doWriteUnbuffered(n,e,s,c):await this.doWriteBuffered(n,e,s,c instanceof Je?Nbe(c):c),this._onDidRunOperation.fire(new ON(e,4))}catch(l){throw new As(d(2070,null,this.resourceForError(e),Q$(l).toString()),hu(l),s)}return this.resolve(e,{resolveMetadata:!0})}async peekBufferForWriting(e,t){let o;if(XT(e)&&!(t instanceof Je))if(y6(t)){let n=await Dpt(t,3);n.ended?o=Je.concat(n.buffer):o=n}else o=A1i(t,n=>Je.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(2088,null,this.resourceForError(t)));if(n?.append&&!L$i(e))throw new As(d(2067,null,this.resourceForError(t)),6);if(!!n?.atomic){if(!(e.capabilities&32768))throw new Error(d(2086,null,this.resourceForError(t)));if(!(e.capabilities&2))throw new Error(d(2087,null,this.resourceForError(t)));if(r)throw new Error(d(2085,null,this.resourceForError(t)))}let l;try{l=await e.stat(t)}catch{return Object.create(null)}if((l.type&2)!==0)throw new As(d(2073,null,this.resourceForError(t)),0,n);this.throwIfFileIsReadonly(t,l);let c;if(typeof n?.mtime=="number"&&typeof n.etag=="string"&&n.etag!==gL&&typeof l.mtime=="number"&&typeof l.size=="number"&&n.mtime<l.mtime&&n.etag!==fJt({mtime:n.mtime,size:l.size})){if(c=await this.peekBufferForWriting(e,o),c instanceof Je&&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 As(d(2074,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 Kv(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 $e(n),s=o;Ygt(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!==gL&&await l,s?.atomic&&Ygt(e)||!(j$(e)||Qgt(e))||XT(e)&&s?.preferUnbuffered?c=this.readFileUnbuffered(e,t,s):Qgt(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 w6(c),this.restoreReadError(u,t,s)}}restoreReadError(e,t,o){let n=d(2068,null,this.resourceForError(t),Q$(e).toString());return e instanceof UU?new UU(n,e.stat,o):e instanceof WN?new WN(n,e.fileOperationResult,e.size,e.options):new As(n,hu(e),o)}readFileStreamed(e,t,o,n=Object.create(null)){let r=e.readFileStream(t,n,o);return S9t(r,{data:s=>s instanceof Je?s:Je.wrap(s),error:s=>this.restoreReadError(s,t,n)},s=>Je.concat(s))}readFileBuffered(e,t,o,n=Object.create(null)){let r=Obe();return qEo(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=_I(r=>Je.concat(r));return(async()=>{try{let r;o?.atomic&&Ygt(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(Je.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 As(d(2072,null,this.resourceForError(e)),0,t);if(typeof t?.etag=="string"&&t.etag!==gL&&t.etag===o.etag)throw new UU(d(2076,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 WN(d(2077,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 ON(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 ON(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&&tqe(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(j$(e)&&j$(o))return this.doPipeBuffered(e,t,o,n);if(j$(e)&&XT(o))return this.doPipeBufferedToUnbuffered(e,t,o,n);if(XT(e)&&j$(o))return this.doPipeUnbufferedToBuffered(e,t,o,n);if(XT(e)&&XT(o))return this.doPipeUnbuffered(e,t,o,n)}async doCopyFolder(e,t,o,n){await o.mkdir(n),Array.isArray(t.children)&&await fn.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(2081,null,this.resourceForError(t),this.resourceForError(n)));if(!l&&u.isEqualOrParent(n,t))throw new Error(d(2082,null,this.resourceForError(t),this.resourceForError(n)))}let c=await this.exists(n);if(c&&!l){if(!s)throw new As(d(2083,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(2084,null,this.resourceForError(t),this.resourceForError(n)))}}return{exists:c,isSameResourceWithDifferentPathCase:l}}getExtUri(e){let t=this.isPathCaseSensitive(e);return{providerExtUri:t?ar:dx,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 ON(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(2079,null,this.resourceForError(t)));break}catch(r){if(Gse(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(Gse(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(2066,null,this.resourceForError(e)));let r=t?.atomic;if(r&&!(o.capabilities&65536))throw new Error(d(2062,null,this.resourceForError(e)));if(n&&r)throw new Error(d(2065,null,this.resourceForError(e)));let s;try{s=await o.stat(e)}catch{}if(s)this.throwIfFileIsReadonly(e,s);else throw new As(d(2064,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(2063,null,this.resourceForError(e)))}return o}async del(e,t){let o=await this.doValidateDelete(e,t),n=t;if(M$i(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 ON(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&&jgt(o)?o.cloneFile(e,t):(await this.mkdirp(n,this.getExtUri(n).providerExtUri.dirname(t)),o===n&&tqe(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:wne.WATCHER_CORRELATION_IDS++})}watch(e,t={recursive:!1,excludes:[]}){let o=new P,n=!1,r=()=>{n=!0};o.add(Z(()=>r())),(async()=>{try{let l=await this.doWatch(e,t);n?Ue(l):r=()=>Ue(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=Ir([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&&(Ue(r.disposable),this.activeWatchers.delete(n)))})}dispose(){super.dispose();for(let[,e]of this.activeWatchers)Ue(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{y6(n)||_pt(n)?await this.doWriteStreamBufferedQueued(e,r,n):await this.doWriteReadableBufferedQueued(e,r,n)}catch(s){throw Q$(s)}finally{await e.close(r)}},this.getExtUri(e).providerExtUri)}async doWriteStreamBufferedQueued(e,t,o){let n=0,r;if(_pt(o)){if(o.buffer.length>0){let s=Je.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)=>{j0(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 Je?r=n:y6(n)?r=await Kv(n):_pt(n)?r=await K1i(n):r=Mpt(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=Je.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 Q$(l)}finally{await fn.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,Je.wrap(s),s.byteLength,0,0)}catch(s){throw Q$(s)}finally{await o.close(r)}}async doPipeBufferedToUnbuffered(e,t,o,n){let r=await Kv(this.readFileBuffered(e,t,ve.None));await this.doWriteUnbuffered(o,n,void 0,r)}throwIfFileSystemIsReadonly(e,t){if(e.capabilities&2048)throw new As(d(2069,null,this.resourceForError(t)),6);return e}throwIfFileIsReadonly(e,t){if((t.permissions??0)&1)throw new As(d(2069,null,this.resourceForError(e)),6)}resourceForError(e){return e.scheme===Y.file?e.fsPath:e.toString(!0)}};wne=I([m(0,ne)],wne);function jEo(a){return a.recursive===!0}var jWi=class a extends C{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 P;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 D3t=class extends jWi{constructor(i,e,t){super(i,e,t,{type:"universal",restartOnError:!0})}};function lct(a){return a.map(i=>({type:i.type,resource:A.revive(i.resource),cId:i.cId}))}var QEo="localFilesystem",Y1e=class extends C{constructor(e,t){super();this.channel=e;this.extraCapabilities=t;this.onDidChangeCapabilities=H.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=_t();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=_I(s=>Je.concat(s.map(l=>Je.wrap(l))).buffer),r=new P;return r.add(this.channel.listen("readFileStream",[e,t])(s=>{if(s instanceof Je)n.write(s.buffer);else{if(s==="end")n.end();else{let l;if(s instanceof Error)l=s;else{let c=s;l=Jr(c.message??In(c),c.code??"Unknown")}n.error(l),n.end()}r.dispose()}})),r.add(o.onCancellationRequested(()=>{n.error(CI()),n.end(),r.dispose()})),n}writeFile(e,t,o){return this.channel.call("writeFile",[e,Je.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,Je.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(lct(t))}else{let t=e;this._onDidWatchError.fire(t)}}))}watch(e,t){let o=_t();return this.channel.call("watch",[this.sessionId,o,e,t]),Z(()=>this.channel.call("unwatch",[this.sessionId,o]))}};var Ppn="remoteFilesystem",L3t=class a extends Y1e{static register(i,e,t){let o=i.getConnection();if(!o)return C.None;let n=new P,r=(async()=>{try{let s=await i.getRawEnvironment();s?e.registerProvider(Y.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.",Cn(s))}})();return n.add(e.onWillActivateFileSystemProvider(s=>{s.scheme===Y.vscodeRemote&&s.join(r)})),n}constructor(i,e){super(e.getChannel(Ppn),{pathCaseSensitive:i.os===3})}};var R3t=class a{constructor(i){this.uri=i;this.time=a._clock++}static{this._clock=0}touch(){return this.time=a._clock++,this}},pve=class{constructor(i){this._fileService=i;this._dispooables=new P;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(H.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 Ere(t),this._canonicalUris=new Map}dispose(){this._dispooables.dispose(),this._canonicalUris.clear()}asCanonicalUri(i){this._fileService.hasProvider(i)&&(i=_re(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 R3t(i)),this._checkTrim(),i)}_checkTrim(){if(this._canonicalUris.size<this._limit)return;R3t._clock=1;let i=[...this._canonicalUris.values()].map(t=>t.time),e=r6(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}};pve=I([m(0,be)],pve);we(dt,pve,1);var M3t=ae("nativeKeyboardLayoutService"),X1e=class extends C{constructor(e){super();this._onDidChangeKeyboardLayout=this._register(new E);this.onDidChangeKeyboardLayout=this._onDidChangeKeyboardLayout.event;this._keyboardLayoutService=dd.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(),!Apn(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}};X1e=I([m(0,Lu)],X1e);function Apn(a,i){return zo===1?Kno(a,i):Gno(a,i)}var P3t=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 A3t=class a extends wX{static createProtocol(){let i=H.fromNodeEventEmitter(el,"vscode:message",(e,t)=>Je.wrap(t));return el.send("vscode:hello"),new P3t(el,i)}constructor(i){let e=a.createProtocol();super(e,i),this.protocol=e}dispose(){this.protocol.disconnect(),super.dispose()}};var N3t=class extends C{constructor(i){super(),this.mainProcessConnection=this._register(new A3t(`window:${i}`))}getChannel(i){return this.mainProcessConnection.getChannel(i)}registerChannel(i,e){this.mainProcessConnection.registerChannel(i,e)}};var Cne=class extends C{constructor(i,e=[]){super(),this.logger=new fmt([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 O3t=class extends Cne{constructor(i,e){let t=new P,o=t.add(i.createLogger(e.logFile,{id:eue,name:vR.name,group:vR})),n;e.isExtensionDevelopment&&e.extensionTestsLocationURI?n=i.createConsoleMainLogger():n=new gmt(o.getLevel()),super(o,[n]),this._register(t)}};var F3t=class extends C{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=Zm(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(jEo(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(lct(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=Zm(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(lct(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 th(e.fsPath)}toWatchPath(e){let t=this.toFilePath(e);return I1i(t)}};var W3t=class extends D3t{constructor(e,t,o,n){super(e,t,o);this.utilityProcessWorkerWorkbenchService=n;this.init()}createWatcher(e){return dd.toService(CX((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 V3t=class extends F3t{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 Y1e(e.getChannel(QEo),{pathCaseSensitive:Wn,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 W3t(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 Cne(this.loggerService.createLogger("fileWatcher",{name:d(17038,null)}))),this._watcherLogService}logWatcherMessage(e){this.watcherLogService[e.type](e.message),e.type!=="trace"&&e.type!=="debug"&&super.logWatcherMessage(e)}};var B3t=class extends C{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=Yu.forUris(()=>!(this.capabilities&1024)),this.atomicReadWriteResources=new Mn(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(tqe(this.fileSystemProvider))return this.fileSystemProvider.copy(this.toFileSystemResource(e),this.toFileSystemResource(t),o);throw new Error("copy not supported")}cloneFile(e,t){if(jgt(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 H3t=class extends iJ{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 U3t=class extends C{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(uo(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 fn.settled(o)}};var QWi=class extends C{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 ow(u.reason||`WebSocket close with status code ${u.code}`,"TemporarilyNotAvailable",u)):c(new ow("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){vEe.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()}},Npn=new class{create(a,i){return new QWi(a,i)}},YWi=class{traceSocketEvent(i,e){typeof this.socket.traceSocketEvent=="function"?this.socket.traceSocketEvent(i,e):vEe.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(Je.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 C.None}write(i){this.socket.send(i.buffer)}end(){this.socket.close()}drain(){return Promise.resolve()}},z3t=class{constructor(i){this._webSocketFactory=i||Npn}supports(i){return!0}connect({host:i,port:e},t,o,n){return new Promise((r,s)=>{let l=/^https:/.test(It.location.href)?"wss":"ws",c=this._webSocketFactory.create(`${l}://${/:/.test(i)&&!/\[/.test(i)?`[${i}]`:i}:${e}${t}?${o}&skipWebSocketFrames=false`,n),u=new P;u.add(c.onError(s)),u.add(c.onOpen(()=>{u.dispose(),r(new YWi(c,n))}))})}};var YEo="request",XEo="remoteResourceHandler";var J1e=class extends C{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===YEo)return this.doRequest(A.revive(l[0]));throw new Error(`Call not found: ${s}`)}};t.registerChannel(XEo,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=Qd(Je.fromString(n.message));return n instanceof As&&n.fileOperationResult===1?{statusCode:404,body:r}:{statusCode:500,body:r}}let o=e.path&&RKi(e.path);return{statusCode:200,body:Qd(t.value),mimeType:o}}getResourceUriProvider(){return e=>e.with({scheme:Y.vscodeManagedRemoteResource,authority:`window:${this.windowId}`,query:new URLSearchParams({authority:e.authority,scheme:e.scheme}).toString()})}};J1e=I([m(1,Lu),m(2,be)],J1e);var Z1e=class extends iJ{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)}};Z1e=I([m(0,ne),m(1,Um)],Z1e);var eze=class extends iJ{constructor(e,t){super();this.policyServices=e;this.logService=t;this.updatePolicies(),this._register(H.any(...this.policyServices.map(o=>o.onDidChange))(o=>{this.updatePolicies(),this._onDidChange.fire(o)}))}async updatePolicyDefinitions(e){return await this._updatePolicyDefinitions(e),ht.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)}};eze=I([m(1,ne)],eze);is((a,i)=>{let e=DO(a);i.addRule(`.monaco-workbench { background-color: ${e}; }`);let t=a.getColor(tgt);if(t&&i.addRule(`.monaco-workbench ::selection { background-color: ${t}; }`),Gt){let o=a.getColor(Mxe);if(o){let n="monaco-workbench-meta-theme-color",r=It.document.getElementById(n);r||(r=Ypt(),r.name="theme-color",r.id=n),r.content=o.toString()}}Vb&&i.addRule(`
			body.web {
				touch-action: none;
			}
			.monaco-workbench .monaco-editor .view-lines {
				user-select: text;
				-webkit-user-select: text;
			}
		`),Nc&&bbe()&&i.addRule(`body { background-color: ${e}; }`)});var tze=class extends C{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;Cyt.bindTo(this.contextKeyService),Jae.bindTo(this.contextKeyService),Zy.bindTo(this.contextKeyService),ep.bindTo(this.contextKeyService),Mx.bindTo(this.contextKeyService),xyt.bindTo(this.contextKeyService),t8i.bindTo(this.contextKeyService),ub.bindTo(this.contextKeyService).set($S(this.environmentService.remoteAuthority)||""),this.virtualWorkspaceContext=JL.bindTo(this.contextKeyService),this.temporaryWorkspaceContext=$Et.bindTo(this.contextKeyService),this.isSessionsWindowContext=$p.bindTo(this.contextKeyService),this.isSessionsWindowContext.set(this.environmentService.isSessionsWindow),this.updateWorkspaceContextKeys(),qEt.bindTo(this.contextKeyService).set(Sx.supported(It));let p=!this.environmentService.isBuilt||this.environmentService.isExtensionDevelopment;Gq.bindTo(this.contextKeyService).set(p),Qzi(Gq.key,p),RW.bindTo(this.contextKeyService).set(this.productService.quality||""),Z7i.bindTo(this.contextKeyService).set(r.embedderIdentifier),this.inAutomationContext=jEt.bindTo(this.contextKeyService),this.inAutomationContext.set(!!this.environmentService.enableSmokeTestDriver),this.activeEditorGroupEmpty=Ice.bindTo(this.contextKeyService),this.activeEditorGroupIndex=tYi.bindTo(this.contextKeyService),this.activeEditorGroupLast=iYi.bindTo(this.contextKeyService),this.activeEditorGroupLocked=ME.bindTo(this.contextKeyService),this.multipleEditorGroupsContext=iS.bindTo(this.contextKeyService),this.editorsVisibleContext=wce.bindTo(this.contextKeyService),this.dirtyWorkingCopiesContext=R8e.bindTo(this.contextKeyService),this.dirtyWorkingCopiesContext.set(this.workingCopyService.hasDirty),this.workbenchStateContext=Qa.bindTo(this.contextKeyService),this.updateWorkbenchStateContextKey(),this.workspaceFolderCountContext=mC.bindTo(this.contextKeyService),this.updateWorkspaceFolderCountContextKey(),this.openFolderWorkspaceSupportContext=PO.bindTo(this.contextKeyService),this.openFolderWorkspaceSupportContext.set(kr||typeof this.environmentService.remoteAuthority=="string"),this.emptyWorkspaceSupportContext=xY.bindTo(this.contextKeyService),this.emptyWorkspaceSupportContext.set(kr||typeof this.environmentService.remoteAuthority=="string"),this.enterMultiRootWorkspaceSupportContext=T_.bindTo(this.contextKeyService),this.enterMultiRootWorkspaceSupportContext.set(kr||typeof this.environmentService.remoteAuthority=="string"),this.splitEditorsVerticallyContext=Cce.bindTo(this.contextKeyService),this.updateSplitEditorsVerticallyContext(),this.isMainWindowFullscreenContext=lP.bindTo(this.contextKeyService),this.isAuxiliaryWindowFocusedContext=sw.bindTo(this.contextKeyService),this.inZenModeContext=gC.bindTo(this.contextKeyService),this.isMainEditorCenteredLayoutContext=P8e.bindTo(this.contextKeyService),this.mainEditorAreaVisibleContext=iTt.bindTo(this.contextKeyService),this.editorTabsVisibleContext=dz.bindTo(this.contextKeyService),this.sideBarVisibleContext=cP.bindTo(this.contextKeyService),this.sideBarVisibleContext.set(this.layoutService.isVisible("workbench.parts.sidebar")),this.titleAreaVisibleContext=xce.bindTo(this.contextKeyService),this.titleBarStyleContext=EY.bindTo(this.contextKeyService),this.updateTitleBarContextKeys(),this.panelPositionContext=TY.bindTo(this.contextKeyService),this.panelPositionContext.set(KO(this.layoutService.getPanelPosition())),this.panelVisibleContext=_Y.bindTo(this.contextKeyService),this.panelVisibleContext.set(this.layoutService.isVisible("workbench.parts.panel")),this.panelMaximizedContext=oTt.bindTo(this.contextKeyService),this.panelMaximizedContext.set(this.layoutService.isPanelMaximized()),this.panelAlignmentContext=cV.bindTo(this.contextKeyService),this.panelAlignmentContext.set(this.layoutService.getPanelAlignment()),this.auxiliaryBarVisibleContext=D_.bindTo(this.contextKeyService),this.auxiliaryBarVisibleContext.set(this.layoutService.isVisible("workbench.parts.auxiliarybar")),this.auxiliaryBarMaximizedContext=tke.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(Bk(e=>{e===It.vscodeWindowId&&this.isMainWindowFullscreenContext.set(wS(It))})),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",It)),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=pC(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",It)),this.titleBarStyleContext.set(v1(this.configurationService))}updateWorkspaceContextKeys(){this.virtualWorkspaceContext.set(MEt(this.contextService.getWorkspace())||""),this.temporaryWorkspaceContext.set(xx(this.contextService.getWorkspace()))}};tze=I([m(0,X),m(1,Pe),m(2,B),m(3,Vt),m(4,nt),m(5,Et),m(6,ee),m(7,fi),m(8,Wa)],tze);var K3t="notifications.showList",mve="notifications.hideList",JEo="notifications.toggleList",XWi="notifications.hideToasts",ZEo="notifications.focusToasts",Opn="notifications.focusNextToast",Fpn="notifications.focusPreviousToast",Wpn="notifications.focusFirstToast",Vpn="notifications.focusLastToast",G3t="notification.collapse",$3t="notification.expand",eTo="notification.acceptPrimaryAction",Bpn="notification.toggle",q3t="notification.clear",cct="notifications.clearAll",dct="notifications.toggleDoNotDisturbMode",uct="notifications.toggleDoNotDisturbModeBySource";function xne(a,i){if(GMt(i))return i;let e=a.lastFocusedList;if(e instanceof Rl){let t=e.getFocusedElements()[0];if(GMt(t)||e.isDOMFocused()&&(t=e.element(0)),GMt(t))return t}}function tTo(a,i,e){yt.registerCommandAndKeybindingRule({id:K3t,weight:200,primary:Ai(2089,3116),handler:()=>{i.hide(),a.show()}}),yt.registerCommandAndKeybindingRule({id:mve,weight:250,when:N8e,primary:9,handler:()=>a.hide()}),qe.registerCommand(JEo,()=>{a.isVisible?a.hide():(i.hide(),a.show())}),yt.registerCommandAndKeybindingRule({id:q3t,weight:200,when:__,primary:20,mac:{primary:2049},handler:(o,n)=>{let r=o.get(tr),s=xne(o.get(fo),n);s&&!s.hasProgress&&(s.close(),r.playSignal($o.clear))}}),yt.registerCommandAndKeybindingRule({id:$3t,weight:200,when:__,primary:17,handler:(o,n)=>{xne(o.get(fo),n)?.expand()}}),yt.registerCommandAndKeybindingRule({id:eTo,weight:201,when:x.or(__,lV),primary:3103,handler:o=>{let n=o.get(F).createInstance(LQ),r=xne(o.get(fo))||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())}}),yt.registerCommandAndKeybindingRule({id:G3t,weight:200,when:__,primary:15,handler:(o,n)=>{xne(o.get(fo),n)?.collapse()}}),yt.registerCommandAndKeybindingRule({id:Bpn,weight:200,when:__,primary:10,secondary:[3],handler:o=>{xne(o.get(fo))?.toggle()}}),qe.registerCommand(XWi,o=>{i.hide()}),yt.registerKeybindingRule({id:XWi,weight:150,when:lV,primary:9}),yt.registerKeybindingRule({id:XWi,weight:300,when:x.and(lV,__),primary:9}),qe.registerCommand(ZEo,()=>i.focus()),yt.registerCommandAndKeybindingRule({id:Opn,weight:200,when:x.and(__,lV),primary:18,handler:()=>{i.focusNext()}}),yt.registerCommandAndKeybindingRule({id:Fpn,weight:200,when:x.and(__,lV),primary:16,handler:()=>{i.focusPrevious()}}),yt.registerCommandAndKeybindingRule({id:Wpn,weight:200,when:x.and(__,lV),primary:11,secondary:[14],handler:()=>{i.focusFirst()}}),yt.registerCommandAndKeybindingRule({id:Vpn,weight:200,when:x.and(__,lV),primary:12,secondary:[13],handler:()=>{i.focusLast()}}),qe.registerCommand(cct,()=>a.clearAll()),qe.registerCommand(dct,o=>{let n=o.get(Ne);n.setFilter(n.getFilter()===1?0:1)}),qe.registerCommand(uct,o=>{let n=o.get(Ne),r=o.get(Ge),s=n.getFilters().sort((u,p)=>u.label.localeCompare(p.label)),l=new P,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(4103,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(4099,"Notifications");fe.appendMenuItem(D.CommandPalette,{command:{id:K3t,title:L(4104,"Show Notifications"),category:t}}),fe.appendMenuItem(D.CommandPalette,{command:{id:mve,title:L(4098,"Hide Notifications"),category:t},when:N8e}),fe.appendMenuItem(D.CommandPalette,{command:{id:cct,title:L(4096,"Clear All Notifications"),category:t}}),fe.appendMenuItem(D.CommandPalette,{command:{id:eTo,title:L(4095,"Accept Notification Primary Action"),category:t}}),fe.appendMenuItem(D.CommandPalette,{command:{id:dct,title:L(4105,"Toggle Do Not Disturb Mode"),category:t}}),fe.appendMenuItem(D.CommandPalette,{command:{id:uct,title:L(4106,"Toggle Do Not Disturb Mode By Source..."),category:t}}),fe.appendMenuItem(D.CommandPalette,{command:{id:ZEo,title:L(4097,"Focus Notification Toast"),category:t},when:lV}),fe.appendMenuItem(D.TitleBar,{command:{id:JEo,title:d(4107,null),icon:M.bell},group:"navigation",order:1e4,when:x.and(x.equals("config.workbench.notifications.position","top-right"),x.equals("config.workbench.notifications.showInTitleBar",!0))})}W(class extends K{constructor(){super({id:"workbench.action.setNotificationsPosition.bottomRight",title:L(4101,"Bottom Right"),toggled:x.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(4100,"Bottom Left"),toggled:x.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(4102,"Top Right"),toggled:x.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 LQ=class extends as{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)}}};LQ=I([m(0,Te),m(1,Ne)],LQ);var j3t=class{constructor(){this.priority=90;this.name="notifications";this.when=__;this.type="view"}getProvider(i){let e=i.get(Wd),t=i.get(fo),o=i.get(ge),n=i.get(tr);function r(){let s=xne(t);if(!s)return;o.executeCommand("notifications.showList");let l,c=t.lastFocusedList;if(c instanceof Rl&&(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=xne(t),f=g?.message.original.toString();if(!(!g||!f))return x9(g.source?d(4062,null,f,g.source):f,g.severity)}let h=p();if(h)return s.onDidClose(()=>e.next()),new tp("notification",{type:"view"},()=>h,()=>u(),"accessibility.verbosity.notification",void 0,Hpn(s,n),()=>{if(c)return u(),c.focusNext(),p()},()=>{if(c)return u(),c.focusPrevious(),p()})}return r()}};function Hpn(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(M.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(M.gear)),e&&e.push({id:"clearNotification",label:d(4061,null),tooltip:d(4061,null),run:()=>{a.close(),i.playSignal($o.clear)},enabled:!0,class:q.asClassName(M.clearAll)}),e}var Upn=Re("notifications-clear",M.close,d(4064,null)),zpn=Re("notifications-clear-all",M.clearAll,d(4063,null)),JWi=Re("notifications-hide",M.chevronDown,d(4079,null)),iTo=Re("notifications-hide-up",M.chevronUp,d(4081,null)),oTo=Re("notifications-expand",M.chevronUp,d(4077,null)),Kpn=Re("notifications-expand-down",M.chevronDown,d(4076,null)),nTo=Re("notifications-collapse",M.chevronDown,d(4067,null)),Gpn=Re("notifications-collapse-up",M.chevronUp,d(4069,null)),$pn=Re("notifications-configure",M.gear,d(4071,null)),rTo=Re("notifications-do-not-disturb",M.bellSlash,d(4075,null)),qpn=Re("notifications-position",M.arrowSwap,d(4082,null));function sTo(a){return a==="top-right"?Kpn:oTo}function aTo(a){return a==="top-right"?Gpn:nTo}var kne=class extends st{constructor(e,t,o){super(e,t,q.asClassName(Upn));this.commandService=o}static{this.ID=q3t}static{this.LABEL=d(4065,null)}async run(e){this.commandService.executeCommand(q3t,e)}};kne=I([m(2,ge)],kne);var Ene=class extends st{constructor(e,t,o){super(e,t,q.asClassName(zpn));this.commandService=o}static{this.ID=cct}static{this.LABEL=d(4066,null)}async run(){this.commandService.executeCommand(cct)}};Ene=I([m(2,ge)],Ene);var hve=class extends st{constructor(e,t,o){super(e,t,q.asClassName(rTo));this.commandService=o}static{this.ID=dct}static{this.LABEL=d(4083,null)}async run(){this.commandService.executeCommand(dct)}};hve=I([m(2,ge)],hve);var gve=class extends st{constructor(e,t,o){super(e,t);this.commandService=o}static{this.ID=uct}static{this.LABEL=d(4084,null)}async run(){this.commandService.executeCommand(uct)}};gve=I([m(2,ge)],gve);var fve=class extends st{static{this.ID="workbench.action.configureDoNotDisturbMode"}static{this.LABEL=d(4070,null)}constructor(i,e){super(i,e,q.asClassName(rTo))}},vve=class extends st{static{this.ID="workbench.action.configureNotificationsPosition"}static{this.LABEL=d(4073,null)}constructor(i,e){super(i,e,q.asClassName(qpn))}},Tne=class extends st{constructor(e,t,o){super(e,t,q.asClassName(JWi));this.commandService=o}static{this.ID=mve}static{this.LABEL=d(4080,null)}async run(){this.commandService.executeCommand(mve)}};Tne=I([m(2,ge)],Tne);var _ne=class extends st{constructor(e,t,o){super(e,t,q.asClassName(oTo));this.commandService=o}static{this.ID=$3t}static{this.LABEL=d(4078,null)}async run(e){this.commandService.executeCommand($3t,e)}};_ne=I([m(2,ge)],_ne);var Dne=class extends st{constructor(e,t,o){super(e,t,q.asClassName(nTo));this.commandService=o}static{this.ID=G3t}static{this.LABEL=d(4068,null)}async run(e){this.commandService.executeCommand(G3t,e)}};Dne=I([m(2,ge)],Dne);var bve=class extends st{constructor(e,t,o){super(e,t,q.asClassName($pn));this.notification=o}static{this.ID="workbench.action.configureNotification"}static{this.LABEL=d(4072,null)}},Lne=class extends st{constructor(e,t,o){super(e,t);this.clipboardService=o}static{this.ID="workbench.action.copyNotificationMessage"}static{this.LABEL=d(4074,null)}run(e){return this.clipboardService.writeText(e.message.raw)}};Lne=I([m(2,Wi)],Lne);var Q3t=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||dr(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++,dr(i.actions?.secondary)&&e++,this.offsetHelper.style.width=`${450-(40+e*30-Math.max(e-1,0)*4)}px`;let t=Y3t.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 qTe)return RQ.TEMPLATE_ID;throw new Error("unknown element type: "+i)}},Y3t=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(4129,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=>{Zpt(h)&&$t.stop(h,!0),e.callback(o.href)},l=e.toDispose.add(new On(r,re.CLICK)).event,c=e.toDispose.add(new On(r,re.KEY_DOWN)).event,u=H.chain(c,h=>h.filter(g=>{let f=new Ii(g);return f.equals(10)||f.equals(3)}));e.toDispose.add(ws.addTarget(r));let p=e.toDispose.add(new On(r,Gn.Tap)).event;H.any(l,p,u)(s,null,e.toDispose)}t.appendChild(r)}return t}},RQ=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 RQ.TEMPLATE_ID}renderTemplate(i){let e=Object.create(null);e.toDispose=new P,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 ji(o,{ariaLabel:d(4130,null),actionViewItemProvider:(n,r)=>{if(n instanceof bve)return e.toDispose.add(new wp(n,{getActions(){let s=[],l={id:n.notification.sourceId,label:n.notification.source};if(C9(l)){let c=t.notificationService.getFilter(l)===1;s.push(pi({id:l.id,label:c?d(4133,null,l.label):d(4132,null,l.label),run:()=>t.notificationService.setFilter({...l,filter:c?0:1})})),n.notification.actions?.secondary?.length&&s.push(new li)}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 fb(i,kx),e.toDispose.add(e.progress),e.renderer=this.instantiationService.createInstance(Lw,e,this.actionRunner),e.toDispose.add(e.renderer),e}renderElement(i,e,t){t.renderer.setInput(i)}disposeTemplate(i){Ue(i.toDispose)}};RQ=I([m(1,ze),m(2,F),m(3,Ne)],RQ);var Lw=class extends C{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 P);Lw.closeNotificationAction||(Lw.closeNotificationAction=n.createInstance(kne,kne.ID,kne.LABEL),Lw.expandNotificationAction=n.createInstance(_ne,_ne.ID,_ne.LABEL),Lw.collapseNotificationAction=n.createInstance(Dne,Dne.ID,Dne.LABEL),Lw.updateExpandCollapseIcons(c)),this._register(c.onDidChangeConfiguration(u=>{u.affectsConfiguration("workbench.notifications.position")&&Lw.updateExpandCollapseIcons(c)}))}static updateExpandCollapseIcons(e){if(!Lw.expandNotificationAction)return;let t=WP(e);Lw.expandNotificationAction.class=q.asClassName(sTo(t)),Lw.collapseNotificationAction.class=q.asClassName(aTo(t))}static{this.SEVERITIES=[St.Info,St.Warning,St.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&&$t.stop(r,!0)})),this.inputDisposables.add(j(this.template.container,re.AUXCLICK,r=>{!e.hasProgress&&r.button===1&&($t.stop(r,!0),e.close())})),this.renderSeverity(e);let t=this.inputDisposables.add(this.hoverService.setupManagedHover(Ni("mouse"),this.template.message,"")),o=this.renderMessage(e,t);this.renderSecondaryActions(e,o);let n=this.inputDisposables.add(this.hoverService.setupManagedHover(Ni("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){Lw.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(Y3t.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(dr(e.actions?.secondary)){let r=this.instantiationService.createInstance(bve,bve.ID,bve.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?Lw.collapseNotificationAction:Lw.expandNotificationAction),e.hasProgress||o.push(Lw.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(4131,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&&dr(t)){let o=this,n=this.inputDisposables.add(new class extends as{async runAction(s){o.actionRunner.run(s,e),(!(s instanceof Jde)||!s.keepOpen)&&e.close()}}),r=this.inputDisposables.add(new _x(this.template.buttonsContainer));for(let s=0;s<t.length;s++){let l=t[s],c={title:!0,secondary:s>0,...Ko},u=l instanceof Jde?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&&$t.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 St.Warning:return M.warning;case St.Error:return M.error}return M.info}getKeybindingLabel(e){let t=this.keybindingService.lookupKeybinding(e.id);return t?t.getLabel():null}};Lw=I([m(2,Qe),m(3,F),m(4,_e),m(5,ze),m(6,tt),m(7,B)],Lw);var Rne=class extends C{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(LQ)),t=this.instantiationService.createInstance(RQ,e),o=this.listDelegate=new Q3t(this.listContainer),n=this.options,r=this.list=this._register(this.instantiationService.createInstance(Rl,"NotificationsList",this.listContainer,o,[t],{...n,setRowLineHeight:!1,horizontalScrolling:!1,overrideStyles:{listBackground:gY},accessibilityProvider:this.instantiationService.createInstance(pct,n)})),s=this._register(this.instantiationService.createInstance(Lne,Lne.ID,Lne.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(Vn(r.getHTMLElement()));this._register(l.onDidBlur(()=>{Me(this.listContainer).document.hasFocus()&&r.setFocus([])})),__.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]=_y(this.list,this.listContainer),s=ts(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]=_y(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?ts(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()}};Rne=I([m(2,F),m(3,ze)],Rne);var pct=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(4108,null,t):d(4109,null)),i.source?x9(e?d(4114,null,i.message.raw,i.source,e):d(4113,null,i.message.raw,i.source),i.severity):x9(e?d(4111,null,i.message.raw,e):d(4110,null,i.message.raw),i.severity)}getWidgetAriaLabel(){return this._options.widgetAriaLabel??d(4112,null)}getRole(){return"dialog"}};pct=I([m(1,_e),m(2,B)],pct);var MH=class extends Jd{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=N8e.bindTo(s),this.registerListeners()}static{this.MAX_DIMENSIONS=new ai(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(ai.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=WP(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=WP(this.configurationService);this.hideAction.class=q.asClassName(e==="top-right"?iTo:JWi)}updateTopOffset(){if(!this.notificationsCenterContainer)return;if(WP(this.configurationService)==="top-right"){let t=7;this.layoutService.isVisible("workbench.parts.titlebar",It)&&(t+=swe),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=Oi(this.notificationsList);o.show(),o.focusFirst();return}this.notificationsCenterContainer||this.create(),this.updateTitle();let[e,t]=_y(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]=_y(this.notificationsCenterTitle,this.clearAllAction);this.model.notifications.length===0?(e.textContent=d(4091,null),t.enabled=!1):(e.textContent=d(4089,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(LQ)),o=this,n=this._register(new ji(e,{ariaLabel:d(4092,null),actionRunner:t,actionViewItemProvider:(s,l)=>s.id===vve.ID?this._register(this.instantiationService.createInstance(wp,s,{getActions:()=>li.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===fve.ID?this._register(this.instantiationService.createInstance(wp,s,{getActions(){let c=[pi({id:hve.ID,label:o.notificationService.getFilter()===0?d(4094,null):d(4093,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,MH.MAX_NOTIFICATION_SOURCES))c.length===1&&c.push(new li),c.push(pi({id:`${hve.ID}.${p.id}`,label:p.label,checked:p.filter!==1,run:()=>o.notificationService.setFilter({...p,filter:p.filter===1?0:1})}));return u.length>MH.MAX_NOTIFICATION_SOURCES&&(c.push(new li),c.push(o._register(o.instantiationService.createInstance(gve,gve.ID,d(4088,null))))),c}},this.contextMenuService,{...l,actionRunner:t,classNames:s.class,keybindingProvider:c=>this.keybindingService.lookupKeybinding(c.id)})):Ca(this.instantiationService,s,l)}));this.clearAllAction=this._register(this.instantiationService.createInstance(Ene,Ene.ID,Ene.LABEL)),n.push(this.clearAllAction,{icon:!0,label:!1,keybinding:this.getKeybindingLabel(this.clearAllAction)}),this.configureDoNotDisturbAction=this._register(this.instantiationService.createInstance(fve,fve.ID,fve.LABEL)),n.push(this.configureDoNotDisturbAction,{icon:!0,label:!1});let r=this._register(this.instantiationService.createInstance(vve,vve.ID,vve.LABEL));n.push(r,{icon:!0,label:!1}),this.hideAction=this._register(this.instantiationService.createInstance(Tne,Tne.ID,Tne.LABEL)),this.updateHideActionIcon(),n.push(this.hideAction,{icon:!0,label:!1,keybinding:this.getKeybindingLabel(this.hideAction)}),this.notificationsList=this.instantiationService.createInstance(Rne,this.notificationsCenterContainer,{widgetAriaLabel:d(4090,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]=_y(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=ts(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=ts(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(x7i);this.notificationsCenterContainer.style.border=e?`1px solid ${e}`:"";let t=this.getColor(E7i);this.notificationsCenterHeader.style.color=t??"";let o=this.getColor(idi);this.notificationsCenterHeader.style.background=o??""}}layout(e){if(this.workbenchDimensions=e,this._isVisible&&this.notificationsCenterContainer){let t=MH.MAX_DIMENSIONS.width,o=MH.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",It)&&(r-=22),this.layoutService.isVisible("workbench.parts.titlebar",It)&&(r-=22),r-=24),this.updateTopOffset(),Oi(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)}};MH=I([m(2,De),m(3,F),m(4,fi),m(5,X),m(6,Et),m(7,_e),m(8,Ne),m(9,tr),m(10,ze),m(11,B),m(12,qt)],MH);var X3t=class extends C{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===St.Error&&(e.item.message.original instanceof Error?console.error(e.item.message.original):console.error(In(e.item.message.linkedText.toString(),!0))))}triggerAriaAlert(e){if(e.priority===2)return;let t=e.onDidChangeContent(o=>{o.kind===1&&this.doTriggerAriaAlert(e)});H.once(e.onDidClose)(()=>t.dispose()),this.doTriggerAriaAlert(e)}doTriggerAriaAlert(e){let t;e.severity===St.Error?t=d(4085,null,e.message.linkedText.toString()):e.severity===St.Warning?t=d(4087,null,e.message.linkedText.toString()):t=d(4086,null,e.message.linkedText.toString()),Jo(t)}};var ize=class extends C{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(4125,null),text:`${e>0||this.newNotificationsCount>0?"$(bell-dot)":"$(bell)"}`,ariaLabel:d(4125,null),command:this.isNotificationsCenterVisible?mve:K3t,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(4122,null),tooltip:d(4123,null)}),WP(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(WP(this.configurationService)){case"bottom-left":return 0;case"top-right":case"bottom-right":default:return 1}}getTooltip(e){return this.isNotificationsCenterVisible?d(4115,null):this.model.notifications.length===0?d(4126,null):e===0?this.newNotificationsCount===0?d(4116,null):this.newNotificationsCount===1?d(4120,null):d(4118,null,this.newNotificationsCount):this.newNotificationsCount===0?d(4117,null,e):this.newNotificationsCount===1?d(4121,null,e):d(4119,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&&(Ue(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&&Ue(this.currentStatusMessage[1]);let r,s=setTimeout(()=>{r=this.statusbarService.addEntry({name:d(4124,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]}};ize=I([m(1,Tr),m(2,Ne),m(3,B)],ize);var V0=class extends Jd{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 Cpt(V0.SPAM_PROTECTION.interval);this.notificationsToastsVisibleContextKey=lV.bindTo(l),this.registerListeners()}static{this.MAX_WIDTH=450}static{this.MAX_NOTIFICATIONS=3}static{this.PURGE_TIMEOUT={[St.Info]:1e4,[St.Warning]:12e3,[St.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(ai.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!==St.Error&&o.priority!==3&&this.removeToast(o)}))}updateNotificationPosition(){if(!this.notificationsToastsContainer)return;let e=WP(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(WP(this.configurationService)==="top-right"){let t=3;this.layoutService.isVisible("workbench.parts.titlebar",It)&&(t+=swe),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=Pn();if(Ao(o)&&Oh(o)&&this.isElementInNotificationQuarter(o))return}if(this.addedToastsIntervalCounter.increment()>V0.SPAM_PROTECTION.limit)return;let t=new P;this.mapNotificationToDisposable.set(e,t),t.add($r(Me(this.container),()=>this.doAddToast(e,t)))}isElementInNotificationQuarter(e){let t=WP(this.configurationService),o=Yn(e),n=Fm(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(Rne,s,{verticalScrollMode:2,widgetAriaLabel:e.source?x9(d(4128,null,e.message.raw,e.source),e.severity):x9(d(4127,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}})),H.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))},V0.PURGE_TIMEOUT[e.severity])};c(),n.add(Z(()=>clearTimeout(s)))}removeToast(e){let t=!1,o=this.mapNotificationToToast.get(e);o&&(ts(o.container)&&(t=!(this.focusNext()||this.focusPrevious())),this.mapNotificationToToast.delete(e));let n=this.mapNotificationToDisposable.get(e);n&&(Ue(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=>Ue(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?ts(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(gY);e.style.background=t||"";let o=this.getColor(k7i);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=V0.MAX_WIDTH,t=e,o;return this.workbenchDimensions&&(t=this.workbenchDimensions.width,t-=16,o=this.workbenchDimensions.height,this.layoutService.isVisible("workbench.parts.statusbar",It)&&(o-=22),this.layoutService.isVisible("workbench.parts.titlebar",It)&&(o-=22),o-=24),new ai(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===V0.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=Oi(this.notificationsToastsContainer);t?o.appendChild(e.container):e.container.remove(),e.item.updateVisibility(t)}isToastInDOM(e){return!!e.container.parentElement}};V0=I([m(2,F),m(3,fi),m(4,De),m(5,Et),m(6,X),m(7,ao),m(8,oi),m(9,Vt),m(10,B)],V0);var MQ=class{constructor(i,e){this._configurationService=i;this._languageService=e}static{this._ttpTokenizer=Kg("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=Fr);let r=await bW(this._languageService,e,n),s=MQ._ttpTokenizer?MQ._ttpTokenizer.createHTML(r)??r:r,l=document.createElement("span");l.innerHTML=s;let c=l.querySelector(".monaco-tokenized-source");return Ao(c)?(Pd(c,this.getFontInfo(o)),l):document.createElement("span")}getFontInfo(i){return i?i.getOption(59):LS({fontFamily:this._configurationService.getValue("editor").fontFamily},1)}};MQ=I([m(0,B),m(1,kt)],MQ);var eVi=J("sessionsSidebar.background",op,d(2769,null)),Mne=J("sessionsSidebar.border",{dark:Oe.fromHex("#808080").transparent(.35),light:Oe.fromHex("#808080").transparent(.35),hcDark:gi,hcLight:gi},d(2770,null)),lTo=J("sessionsSidebarHeader.background",op,d(2771,null)),cTo=J("sessionsSidebarHeader.foreground",nP,d(2772,null)),dTo=J("chatBarTitle.background",op,d(2767,null)),uTo=J("chatBarTitle.foreground",nP,d(2768,null)),unS=J("agentFeedbackInputWidget.border",{dark:ei(_N,.8),light:ei(_N,.8),hcDark:gi,hcLight:gi},d(2766,null)),pnS=J("sessionsUpdateButton.downloadingBackground",ei(MS,.4),d(2774,null)),mnS=J("sessionsUpdateButton.downloadedBackground",ei(MS,.7),d(2773,null));var va={ChatBarTitle:new D("ChatBarTitle"),CommandCenter:new D("SessionsCommandCenter"),CommandCenterCenter:new D("SessionsCommandCenterCenter"),TitleBarContext:new D("SessionsTitleBarContext"),TitleBarLeftLayout:new D("SessionsTitleBarLeftLayout"),TitleBarSessionTitle:new D("SessionsTitleBarSessionTitle"),TitleBarSessionMenu:new D("SessionsTitleBarSessionMenu"),TitleBarRightLayout:new D("SessionsTitleBarRightLayout"),PanelTitle:new D("SessionsPanelTitle"),SidebarTitle:new D("SessionsSidebarTitle"),AuxiliaryBarTitle:new D("SessionsAuxiliaryBarTitle"),AuxiliaryBarTitleLeft:new D("SessionsAuxiliaryBarTitleLeft"),SidebarFooter:new D("SessionsSidebarFooter"),SidebarCustomizations:new D("SessionsSidebarCustomizations"),AgentFeedbackEditorContent:new D("AgentFeedbackEditorContent")};var Pne=class extends cy{constructor(e,t,o,n,r,s,l,c,u,p){super(e,{hasTitle:!1},s,l,c);this.contextMenuService=o;this.configurationService=n;this.instantiationService=r;this.contextKeyService=u;this.hostService=p;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.isInactive=!1;this.titleBarStyle=v1(this.configurationService),this.registerListeners(sg(t))}get minimumHeight(){let e=Gt&&dGe(),t=swe;return e&&(t=Math.max(t,jUi(Me(this.element))?.height??0)),t/(this.preventZoom?yS(Me(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()))}onBlur(){this.isInactive=!0,this.updateStyles()}onFocus(){this.isInactive=!1,this.updateStyles()}updateProperties(e){}registerVariables(e){}updateOptions(e){}createContentArea(e){if(this.element=e,this.rootContainer=R(e,_(".titlebar-container.sessions-titlebar-container.has-center")),Sf(this.rootContainer,_("div.titlebar-drag-region")),this.leftContent=R(this.rootContainer,_(".titlebar-left")),this.centerContent=R(this.rootContainer,_(".titlebar-center")),this.rightContent=R(this.rootContainer,_(".titlebar-right")),!eO(this.configurationService,this.titleBarStyle)){let l=it?"left":"right";if(it&&kr&&Wu.Locale(AUi).value.textInfo?.direction==="rtl"&&(l="right"),it&&kr&&l==="left"){let c=R(this.leftContent,_("div.window-controls-container"));c.style.width="70px",c.style.flexShrink="0";let u=()=>{c.style.display=wS(It)?"none":""};u(),this._register(Bk(p=>{p===sg(It)&&u()}))}else Uje(this.configurationService)==="hidden"||(this.windowControlsContainer=R(l==="left"?this.leftContent:this.rightContent,_("div.window-controls-container")),Gt&&R(l==="left"?this.rightContent:this.leftContent,_("div.window-controls-container")),dGe()&&this.windowControlsContainer.classList.add("wco-enabled"))}let t=R(this.leftContent,_("div.left-toolbar-container"));this._register(this.instantiationService.createInstance(Ln,t,va.TitleBarLeftLayout,{contextMenu:va.TitleBarContext,telemetrySource:"titlePart.left",hiddenItemStrategy:-1,toolbarOptions:{primaryGroup:()=>!0}}));let o=R(this.centerContent,_("div.window-title")),n=R(o,_("div.command-center"));this._register(this.instantiationService.createInstance(Ln,n,va.CommandCenter,{contextMenu:va.TitleBarContext,hiddenItemStrategy:-1,telemetrySource:"commandCenter",toolbarOptions:{primaryGroup:()=>!0}}));let r=Sf(this.rightContent,_("div.titlebar-actions-container.titlebar-layout-actions-container"));this._register(this.instantiationService.createInstance(Ln,r,va.TitleBarRightLayout,{contextMenu:va.TitleBarContext,telemetrySource:"titlePart.right",toolbarOptions:{primaryGroup:()=>!0}}));let s=Sf(this.rightContent,_("div.titlebar-actions-container.titlebar-session-actions-container"));return this._register(this.instantiationService.createInstance(Ln,s,va.TitleBarSessionMenu,{contextMenu:va.TitleBarContext,hiddenItemStrategy:-1,telemetrySource:"titlePart.sessionActions",toolbarOptions:{primaryGroup:()=>!0}})),this._register(j(this.rootContainer,re.CONTEXT_MENU,l=>{$t.stop(l),this.onContextMenu(l)})),this.updateStyles(),this.element}updateStyles(){if(super.updateStyles(),this.element){this.element.classList.toggle("inactive",this.isInactive);let e=this.getColor(dTo,(o,n)=>o.isOpaque()?o:o.makeOpaque(DO(n)))||"";this.element.style.backgroundColor=e,e&&Oe.fromHex(e).isLighter()?this.element.classList.add("light"):this.element.classList.remove("light");let t=this.getColor(uTo);this.element.style.color=t||""}}onContextMenu(e){let t=new yn(Me(this.element),e);this.contextMenuService.showContextMenu({getAnchor:()=>t,menuId:va.TitleBarContext,contextKeyService:this.contextKeyService,domForShadowRoot:it&&kr?t.target:void 0})}get hasZoomableElements(){return!0}get preventZoom(){return yS(Me(this.element))<1||!this.hasZoomableElements}layout(e,t){this.updateLayout(),super.layoutContents(e,t)}updateLayout(){if(!rwe(this.configurationService,this.titleBarStyle))return;let e=yS(Me(this.element));this.element.style.setProperty("--zoom-factor",e.toString()),this.rootContainer.classList.toggle("counter-zoom",this.preventZoom)}focus(){this.element.querySelector('[tabindex]:not([tabindex="-1"])')?.focus()}toJSON(){return{type:"workbench.parts.titlebar"}}dispose(){this._onWillDispose.fire(),super.dispose()}};Pne=I([m(2,ze),m(3,B),m(4,F),m(5,De),m(6,le),m(7,fi),m(8,X),m(9,oi)],Pne);var mct=class extends Pne{constructor(i,e,t,o,n,r,s,l){super("workbench.parts.titlebar",It,i,e,t,o,n,r,s,l)}};mct=I([m(0,ze),m(1,B),m(2,F),m(3,De),m(4,le),m(5,fi),m(6,X),m(7,oi)],mct);var Sve=class extends Pne{constructor(e,t,o,n,r,s,l,c,u,p){let h=Sve.COUNTER++;super(`workbench.parts.auxiliaryTitle.${h}`,Me(e),o,n,r,s,l,c,u,p);this.container=e;this.mainTitlebar=t}static{this.COUNTER=1}get height(){return this.minimumHeight}get preventZoom(){return yS(Me(this.element))<1||!this.mainTitlebar.hasZoomableElements}};Sve=I([m(2,ze),m(3,B),m(4,F),m(5,De),m(6,le),m(7,fi),m(8,X),m(9,oi)],Sve);var Ane=class extends TJ{constructor(e,t,o){super("workbench.agentSessionsTitleService",o,t);this.instantiationService=e;this.mainPart=this._register(this.createMainTitlebarPart()),this.onMenubarVisibilityChange=this.mainPart.onMenubarVisibilityChange,this._register(this.registerPart(this.mainPart))}createMainTitlebarPart(){return this.instantiationService.createInstance(mct)}createAuxiliaryTitlebarPart(e,t,o){let n=_(".part.titlebar",{role:"none"});n.style.position="relative",e.insertBefore(n,e.firstChild);let r=new P,s=this.doCreateAuxiliaryTitlebarPart(n,t,o);return r.add(this.registerPart(s)),r.add(H.runAndSubscribe(s.onDidChange,()=>n.style.height=`${s.height}px`)),s.create(n),H.once(s.onWillDispose)(()=>r.dispose()),s}doCreateAuxiliaryTitlebarPart(e,t,o){return o.createInstance(Sve,e,this.mainPart)}updateProperties(e){for(let t of this.parts)t.updateProperties(e)}registerVariables(e){for(let t of this.parts)t.registerVariables(e)}};Ane=I([m(0,F),m(1,le),m(2,De)],Ane);var J3t=class extends C{constructor(e,t,o,n){super();this.parent=e;this.options=t;this.serviceCollection=o;this.logService=n;this._onWillShutdown=this._register(new E);this.onWillShutdown=this._onWillShutdown.event;this._onDidShutdown=this._register(new E);this.onDidShutdown=this._onDidShutdown.event;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.parts=new Map;this.partVisibility={sidebar:!0,auxiliaryBar:!1,editor:!1,panel:!1,chatBar:!0};this.mainWindowFullscreen=!1;this.maximized=new Set;this.restoredPromise=new Go;this.whenRestored=this.restoredPromise.p;this.restored=!1;this.openedDefaultEditors=!1;this.previousUnexpectedError={message:void 0,time:0};sn("code/willStartWorkbench"),this.registerErrorHandler(n)}get activeContainer(){return this.getContainerFromDocument(rh())}get containers(){let e=[];for(let{window:t}of Gw())e.push(this.getContainerFromDocument(t.document));return e}getContainerFromDocument(e){return e===this.mainContainer.ownerDocument?this.mainContainer:e.body.getElementsByClassName("monaco-workbench")[0]}get mainContainerDimension(){return this._mainContainerDimension}get activeContainerDimension(){return this.getContainerDimension(this.activeContainer)}getContainerDimension(e){return e===this.mainContainer?this.mainContainerDimension:Fm(e)}get mainContainerOffset(){return this.computeContainerOffset()}get activeContainerOffset(){return this.computeContainerOffset()}computeContainerOffset(){let e=0,t=0;return this.isVisible("workbench.parts.titlebar",It)&&(e=this.getPart("workbench.parts.titlebar").maximumHeight,t=e),{top:e,quickPickTop:t}}registerErrorHandler(e){yc||(Error.stackTraceLimit=100),It.addEventListener("unhandledrejection",t=>{mt(t.reason),t.preventDefault()}),iUi(t=>this.handleUnexpectedError(t,e))}handleUnexpectedError(e,t){let o=In(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(HUi(175));let e=this.initServices(this.serviceCollection);return e.invokeFunction(t=>{let o=t.get(ao),n=t.get(le),r=t.get(B),s=t.get(oi),l=t.get(tt),c=t.get(ct),u=t.get(Ne);t.get(Qn).setDefaultCodeBlockRenderer(e.createInstance(MQ)),Nji((h,g)=>e.createInstance(mv,h,{instantHover:g},{})),K5i(l),this.initLayout(t),oe.as(Qi.Workbench).start(t),oe.as(rn.EditorFactory).start(t),this._register(e.createInstance(tze)),this.registerListeners(o,n,r,s,c),this.renderWorkbench(e,u,n,r),this.createWorkbenchLayout(),this.createWorkbenchManagement(e),this.layout(),this.restore(o)}),e}catch(e){throw mt(e),e}}initServices(e){e.set(fi,this),e.set(qP,new Mt(Ane,[]));let t=LKi();for(let[n,r]of t)e.set(n,r);let o=new qLe(e,!0);return o.invokeFunction(n=>{let r=n.get(ao);r.phase=2}),o}registerListeners(e,t,o,n,r){this._register(o.onDidChangeConfiguration(s=>this.updateFontAliasing(s,o))),kr?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(!it||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)&&Fy.restoreFontInfo(It,n)}catch{}Fy.readFontInfo(It,LS(t.getValue("editor"),Xd.getInstance(It).value))}storeFontInfo(e){let t=Fy.serializeFontInfo(It);t&&e.store("editorFontInfo",JSON.stringify(t),-1,1)}renderWorkbench(e,t,o,n){zzi(this.mainContainer),Keo((l,c)=>e.createInstance(Jte,l,c));let s=si(["monaco-workbench","agent-sessions-workbench",ri?"windows":Wn?"linux":"mac",Gt?"web":void 0,eU?"chromium":yc?"firefox":Vb?"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}of[{id:"workbench.parts.titlebar",role:"none",classes:["titlebar"]},{id:"workbench.parts.sidebar",role:"none",classes:["sidebar","left"]},{id:"workbench.parts.auxiliarybar",role:"none",classes:["auxiliarybar","basepanel","right"]},{id:"workbench.parts.chatbar",role:"main",classes:["chatbar","basepanel","right"]},{id:"workbench.parts.panel",role:"none",classes:["panel","basepanel",KO(this.getPanelPosition())]}]){let p=this.createPartContainer(l,c,u);sn(`code/willCreatePart/${l}`),this.getPart(l).create(p),sn(`code/didCreatePart/${l}`)}this.createHiddenEditorPart(),this.createNotificationsHandlers(e,t),this.parent.appendChild(this.mainContainer)}createNotificationsHandlers(e,t){let o=this._register(e.createInstance(MH,this.mainContainer,t.model)),n=this._register(e.createInstance(V0,this.mainContainer,t.model));this._register(e.createInstance(X3t,t.model));let r=this._register(e.createInstance(ize,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)})),tTo(o,n,t.model),xa.register(new j3t),this.registerNotifications({onDidChangeNotificationsVisibility:H.map(H.any(n.onDidChangeVisibility,o.onDidChangeVisibility),()=>n.isVisible||o.isVisible)})}createPartContainer(e,t,o){let n=document.createElement("div");return n.classList.add("part",...o),n.id=e,n.setAttribute("role",t),n}createHiddenEditorPart(){let e=document.createElement("div");e.classList.add("part","editor"),e.id="workbench.parts.editor",e.setAttribute("role","main"),e.style.display="none",sn("code/willCreatePart/workbench.parts.editor"),this.getPart("workbench.parts.editor").create(e,{restorePreviousState:!1}),sn("code/didCreatePart/workbench.parts.editor"),this.mainContainer.appendChild(e)}restore(e){sn("code/didStartWorkbench"),performance.measure("perf: workbench create & restore","code/didLoadWorkbenchMain","code/didStartWorkbench"),this.restoreParts(),e.phase=3,this.setRestored(),this._register(new Dt(()=>{this._register(jv(It,()=>e.phase=4,2500))},2500)).schedule()}restoreParts(){let e=[{location:0,visible:this.partVisibility.sidebar},{location:1,visible:this.partVisibility.panel},{location:2,visible:this.partVisibility.auxiliaryBar},{location:3,visible:this.partVisibility.chatBar}];for(let{location:t,visible:o}of e)if(o){let n=this.viewDescriptorService.getDefaultViewContainer(t);n&&this.paneCompositeService.openPaneComposite(n.id,t)}}initLayout(e){this.editorGroupService=e.get(Et),this.editorService=e.get(ee),this.paneCompositeService=e.get(ds),this.viewDescriptorService=e.get(Ri),e.get(qP),this.registerLayoutListeners(),this._register(this.editorService.onWillOpenEditor(()=>{this.partVisibility.editor||this.setEditorHidden(!1)})),this._register(this.editorService.onDidCloseEditor(()=>{this.partVisibility.editor&&this.areAllGroupsEmpty()&&this.setEditorHidden(!0)})),this._mainContainerDimension=Fm(this.parent,new ai(800,600))}areAllGroupsEmpty(){for(let e of this.editorGroupService.groups)if(!e.isEmpty)return!1;return!0}registerLayoutListeners(){this._register(Bk(e=>{e===sg(It)&&(this.mainWindowFullscreen=wS(It),this.updateFullscreenClass(),this.layout())}))}updateFullscreenClass(){this.mainWindowFullscreen?this.mainContainer.classList.add("fullscreen"):this.mainContainer.classList.remove("fullscreen")}createWorkbenchLayout(){let e=this.getPart("workbench.parts.titlebar"),t=this.getPart("workbench.parts.editor"),o=this.getPart("workbench.parts.panel"),n=this.getPart("workbench.parts.auxiliarybar"),r=this.getPart("workbench.parts.sidebar"),s=this.getPart("workbench.parts.chatbar");this.titleBarPartView=e,this.sideBarPartView=r,this.panelPartView=o,this.auxiliaryBarPartView=n,this.chatBarPartView=s;let l={"workbench.parts.titlebar":this.titleBarPartView,"workbench.parts.panel":this.panelPartView,"workbench.parts.sidebar":this.sideBarPartView,"workbench.parts.auxiliarybar":this.auxiliaryBarPartView,"workbench.parts.chatbar":this.chatBarPartView},c=({type:p})=>l[p],u=O5.deserialize(this.createGridDescriptor(),{fromJSON:c},{proportionalLayout:!1});this.mainContainer.prepend(u.element),this.mainContainer.setAttribute("role","application"),this.workbenchGrid=u,this.workbenchGrid.edgeSnapping=this.mainWindowFullscreen;for(let p of[e,o,r,n,s])this._register(p.onDidVisibilityChange(h=>{p===r?this.setSideBarHidden(!h):p===o?this.setPanelHidden(!h):p===n?this.setAuxiliaryBarHidden(!h):p===s&&this.setChatBarHidden(!h),this._onDidChangePartVisibility.fire({partId:p.getId(),visible:h}),this.handleContainerDidLayout(this.mainContainer,this._mainContainerDimension)}));this._register(t.onDidVisibilityChange(p=>{this.setEditorHidden(!p),this._onDidChangePartVisibility.fire({partId:t.getId(),visible:p}),this.handleContainerDidLayout(this.mainContainer,this._mainContainerDimension)}))}createWorkbenchManagement(e){}createGridDescriptor(){let{width:e,height:t}=this._mainContainerDimension,o=300,n=300,r=300,s=this.titleBarPartView?.minimumHeight??30,l=Math.max(0,e-o),c=Math.max(0,l-n),p=t-s-r,h={type:"leaf",data:{type:"workbench.parts.titlebar"},size:s,visible:!0},g={type:"leaf",data:{type:"workbench.parts.sidebar"},size:o,visible:this.partVisibility.sidebar},f={type:"leaf",data:{type:"workbench.parts.auxiliarybar"},size:n,visible:this.partVisibility.auxiliaryBar},v={type:"leaf",data:{type:"workbench.parts.chatbar"},size:c,visible:this.partVisibility.chatBar},b={type:"leaf",data:{type:"workbench.parts.panel"},size:r,visible:this.partVisibility.panel};return{root:{type:"branch",size:t,data:[g,{type:"branch",data:[h,{type:"branch",data:[v,f],size:p},b],size:l}]},orientation:1,width:e,height:t}}layout(){this._mainContainerDimension=Fm(this.mainWindowFullscreen?It.document.body:this.parent),this.logService.trace(`Workbench#layout, height: ${this._mainContainerDimension.height}, width: ${this._mainContainerDimension.width}`),fN(this.mainContainer,this._mainContainerDimension.width,this._mainContainerDimension.height),this.workbenchGrid.layout(this._mainContainerDimension.width,this._mainContainerDimension.height),this.handleContainerDidLayout(this.mainContainer,this._mainContainerDimension)}handleContainerDidLayout(e,t){this._onDidLayoutContainer.fire({container:e,dimension:t}),e===this.mainContainer&&this._onDidLayoutMainContainer.fire(t),e===this.activeContainer&&this._onDidLayoutActiveContainer.fire(t)}getLayoutClasses(){return si([this.partVisibility.sidebar?void 0:"nosidebar",this.partVisibility.editor?void 0:"nomaineditorarea",this.partVisibility.panel?void 0:"nopanel",this.partVisibility.auxiliaryBar?void 0:"noauxiliarybar",this.partVisibility.chatBar?void 0:"nochatbar","nostatusbar",this.mainWindowFullscreen?"fullscreen":void 0])}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}hasFocus(e){let t=this.getContainer(It,e);if(!t)return!1;let o=Pn();return o?kzi(o,t):!1}focusPart(e,t=It){switch(e){case"workbench.parts.editor":this.editorGroupService.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.chatbar":this.paneCompositeService.getActivePaneComposite(3)?.focus();break;default:this.getContainer(t,e)?.focus()}}focus(){this.focusPart("workbench.parts.chatbar")}getContainer(e,t){if(typeof t>"u")return this.getContainerFromDocument(e.document);if(e===It)return this.parts.get(t)?.getContainer();if(t==="workbench.parts.editor"){let o=this.getContainerFromDocument(e.document),n=this.editorGroupService.getPart(o);if(n instanceof cy)return n.getContainer()}}whenContainerStylesLoaded(e){}isActivityBarHidden(){return!0}isVisible(e,t){switch(e){case"workbench.parts.titlebar":return!0;case"workbench.parts.sidebar":return this.partVisibility.sidebar;case"workbench.parts.auxiliarybar":return this.partVisibility.auxiliaryBar;case"workbench.parts.editor":return this.partVisibility.editor;case"workbench.parts.panel":return this.partVisibility.panel;case"workbench.parts.chatbar":return this.partVisibility.chatBar;case"workbench.parts.activitybar":case"workbench.parts.statusbar":case"workbench.parts.banner":default:return!1}}setPartHidden(e,t){switch(t){case"workbench.parts.sidebar":this.setSideBarHidden(e);break;case"workbench.parts.auxiliarybar":this.setAuxiliaryBarHidden(e);break;case"workbench.parts.editor":this.setEditorHidden(e);break;case"workbench.parts.panel":this.setPanelHidden(e);break;case"workbench.parts.chatbar":this.setChatBarHidden(e);break}}setSideBarHidden(e){if(this.partVisibility.sidebar!==!e&&(this.partVisibility.sidebar=!e,this.mainContainer.classList.toggle("nosidebar",e),this.workbenchGrid.setViewVisible(this.sideBarPartView,!e),e&&this.paneCompositeService.getActivePaneComposite(0)&&this.paneCompositeService.hideActivePaneComposite(0),!e&&!this.paneCompositeService.getActivePaneComposite(0))){let t=this.paneCompositeService.getLastActivePaneCompositeId(0)??this.viewDescriptorService.getDefaultViewContainer(0)?.id;t&&this.paneCompositeService.openPaneComposite(t,0)}}setAuxiliaryBarHidden(e){if(this.partVisibility.auxiliaryBar!==!e&&(this.partVisibility.auxiliaryBar=!e,this.mainContainer.classList.toggle("noauxiliarybar",e),this.workbenchGrid.setViewVisible(this.auxiliaryBarPartView,!e),e&&this.paneCompositeService.getActivePaneComposite(2)&&this.paneCompositeService.hideActivePaneComposite(2),!e&&!this.paneCompositeService.getActivePaneComposite(2))){let t=this.paneCompositeService.getLastActivePaneCompositeId(2)??this.viewDescriptorService.getDefaultViewContainer(2)?.id;t&&this.paneCompositeService.openPaneComposite(t,2)}}setEditorHidden(e){this.partVisibility.editor!==!e&&(this.partVisibility.editor=!e,this.mainContainer.classList.toggle("nomaineditorarea",e))}setPanelHidden(e){if(this.partVisibility.panel!==!e&&(e&&this.workbenchGrid.hasMaximizedView()&&this.workbenchGrid.exitMaximizedView(),this.partVisibility.panel=!e,this.mainContainer.classList.toggle("nopanel",e),this.workbenchGrid.setViewVisible(this.panelPartView,!e),e&&this.paneCompositeService.getActivePaneComposite(1)&&this.paneCompositeService.hideActivePaneComposite(1),!e&&!this.paneCompositeService.getActivePaneComposite(1))){let t=this.paneCompositeService.getLastActivePaneCompositeId(1)??this.viewDescriptorService.getDefaultViewContainer(1)?.id;t&&this.paneCompositeService.openPaneComposite(t,1)}}setChatBarHidden(e){if(this.partVisibility.chatBar!==!e&&(this.partVisibility.chatBar=!e,this.mainContainer.classList.toggle("nochatbar",e),this.workbenchGrid.setViewVisible(this.chatBarPartView,!e),e&&this.paneCompositeService.getActivePaneComposite(3)&&this.paneCompositeService.hideActivePaneComposite(3),!e&&!this.paneCompositeService.getActivePaneComposite(3))){let t=this.paneCompositeService.getLastActivePaneCompositeId(3)??this.viewDescriptorService.getDefaultViewContainer(3)?.id;t&&this.paneCompositeService.openPaneComposite(t,3)}}getSideBarPosition(){return 0}getPanelPosition(){return 2}setPanelPosition(e){}getPanelAlignment(){return"justify"}setPanelAlignment(e){}getSize(e){let t=this.getPartView(e);return t?this.workbenchGrid.getViewSize(t):{width:0,height:0}}setSize(e,t){let o=this.getPartView(e);o&&this.workbenchGrid.resizeView(o,t)}resizePart(e,t,o){let n=this.getPartView(e);if(!n)return;let r=this.workbenchGrid.getViewSize(n);this.workbenchGrid.resizeView(n,{width:r.width+t,height:r.height+o})}getPartView(e){switch(e){case"workbench.parts.titlebar":return this.titleBarPartView;case"workbench.parts.sidebar":return this.sideBarPartView;case"workbench.parts.auxiliarybar":return this.auxiliaryBarPartView;case"workbench.parts.editor":return;case"workbench.parts.panel":return this.panelPartView;case"workbench.parts.chatbar":return this.chatBarPartView;default:return}}getMaximumEditorDimensions(e){let t=this.partVisibility.sidebar?this.workbenchGrid.getViewSize(this.sideBarPartView).width:0,o=this.partVisibility.auxiliaryBar?this.workbenchGrid.getViewSize(this.auxiliaryBarPartView).width:0,n=this.partVisibility.panel?this.workbenchGrid.getViewSize(this.panelPartView).height:0,r=this.workbenchGrid.getViewSize(this.titleBarPartView).height;return new ai(this._mainContainerDimension.width-t-o,this._mainContainerDimension.height-r-n)}toggleMaximizedPanel(){this.workbenchGrid&&(this.isPanelMaximized()?this.workbenchGrid.exitMaximizedView():this.workbenchGrid.maximizeView(this.panelPartView,[this.titleBarPartView,this.sideBarPartView]))}isPanelMaximized(){return this.workbenchGrid?this.workbenchGrid.isViewMaximized(this.panelPartView):!1}toggleMaximizedAuxiliaryBar(){}setAuxiliaryBarMaximized(e){return!1}isAuxiliaryBarMaximized(){return!1}toggleZenMode(){}toggleMenuBar(){}isMainEditorLayoutCentered(){return!1}centerMainEditorLayout(e){}hasMainWindowBorder(){return!1}getMainWindowBorderRadius(){}isWindowMaximized(e){return this.maximized.has(sg(e))}updateWindowMaximizedState(e,t){let o=sg(e);t?(this.maximized.add(o),e===It&&this.mainContainer.classList.add("maximized")):(this.maximized.delete(o),e===It&&this.mainContainer.classList.remove("maximized")),this._onDidChangeWindowMaximized.fire({windowId:o,maximized:t})}getVisibleNeighborPart(e,t){if(!this.workbenchGrid)return;let o=this.getPartView(e);if(!o)return;let n=this.workbenchGrid.getNeighborViews(o,t,!1);if(n.length===0)return;let r=n[0];if(r===this.titleBarPartView)return"workbench.parts.titlebar";if(r===this.sideBarPartView)return"workbench.parts.sidebar";if(r===this.auxiliaryBarPartView)return"workbench.parts.auxiliarybar";if(r===this.panelPartView)return"workbench.parts.panel";if(r===this.chatBarPartView)return"workbench.parts.chatbar"}isRestored(){return this.restored}setRestored(){this.restored=!0,this.restoredPromise.complete()}registerNotifications(e){this._register(e.onDidChangeNotificationsVisibility(t=>this._onDidChangeNotificationsVisibility.fire(t)))}};var oze=/\(&([^\s&])\)|(^|[^&])&([^\s&])/,Ive=/(&amp;)?(&amp;)([^\s&])/g;var mTo={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},PQ=class a extends ji{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,...it||Wn?[10]:[]],keyDown:!0}});this.menuStyles=n;this.menuElement=r,this.actionsList.tabIndex=0,this.initializeOrUpdateStyleSheet(e,n),this._register(ws.addTarget(r)),this._register(j(r,re.KEY_DOWN,u=>{new Ii(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&&($t.stop(u,!0),h.length===1&&(h[0]instanceof hct&&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)}})),Wn&&this._register(j(r,re.KEY_DOWN,u=>{let p=new Ii(u);p.equals(14)||p.equals(11)?(this.focusedItem=this.viewItems.length-1,this.focusNext(),$t.stop(u,!0)):(p.equals(13)||p.equals(12))&&(this.focusedItem=0,this.focusPrevious(),$t.stop(u,!0))})),this._register(j(this.domNode,re.MOUSE_OUT,u=>{let p=u.relatedTarget;gs(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||!gs(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(ws.addTarget(this.actionsList)),this._register(j(this.actionsList,Gn.Tap,u=>{let p=u.initialTarget;if(!(!p||!gs(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 Pa(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,Gn.Change,u=>{$t.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=Me(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 li&&(p===t.length-1||p===0||t[p-1]instanceof li))),this.push(t,{icon:!0,label:!0,isMenu:!0}),e.appendChild(this.scrollableElement.getDomNode()),this.scrollableElement.scanDomNode(),this.viewItems.filter(u=>!(u instanceof Z3t)).forEach((u,p,h)=>{u.updatePositionInSet(p+1,h.length)})}initializeOrUpdateStyleSheet(e,t){this.styleSheet||(x$(e)?this.styleSheet=hr(e):(a.globalStyleSheet||(a.globalStyleSheet=hr()),this.styleSheet=a.globalStyleSheet)),this.styleSheet.textContent=tVi(t,x$(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 hct)super.focus(e),t.open(!0);else if(t instanceof gct)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 li)return new Z3t(t.context,e,{icon:!0},this.menuStyles);if(e instanceof $l){let n=new hct(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 gct(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}}},gct=class extends oc{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=oze.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($t.stop(r,!0),yc){if(new yn(Me(this.element),r).rightButton)return;this.onClick(r)}else setTimeout(()=>{this.onClick(r)},0)})),this._register(j(this.element,re.CONTEXT_MENU,r=>{$t.stop(r,!0)})))},100),this._register(this.runOnceToEnableMouseUp)}render(e){super.render(e),this.element&&(this.container=e,this.item=R(this.element,_("a.action-menu-item")),this._action.id===li.ID?this.item.setAttribute("role","presentation"):(this.item.setAttribute("role","menuitem"),this.mnemonic&&this.item.setAttribute("aria-keyshortcuts",`${this.mnemonic}`)),this.check=R(this.item,_("span.menu-item-check"+q.asCSSSelector(M.menuSelection))),this.check.setAttribute("role","none"),this.label=R(this.item,_("span.action-label")),this.options.label&&this.options.keybinding&&(R(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=fu(this.action.label);if(e){let t=e8t(e);this.options.enableMnemonics||(e=t),this.label.setAttribute("aria-label",t.replace(/&&/g,"&"));let o=oze.exec(e);if(o){e=ur(e),Ive.lastIndex=0;let n=Ive.exec(e);for(;n&&n[1];)n=Ive.exec(e);let r=s=>s.replace(/&amp;&amp;/g,"&amp;");n?this.label.append(Hw(r(e.substr(0,n.index))," "),_("u",{"aria-hidden":"true"},n[3]),ih(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??"")}},hct=class extends gct{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 P);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&&!gs(Pn(),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=R(this.item,_("span.submenu-indicator"+q.asCSSSelector(M.menuSubmenu))),this.submenuIndicator.setAttribute("aria-hidden","true")),this._register(j(this.element,re.KEY_UP,t=>{let o=new Ii(t);(o.equals(17)||o.equals(3))&&($t.stop(t,!0),this.createSubmenu(!0))})),this._register(j(this.element,re.KEY_DOWN,t=>{let o=new Ii(t);Pn()===this.item&&(o.equals(17)||o.equals(3))&&$t.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&&!gs(Pn(),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){$t.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=wae(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=wae(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=R(this.element,_("div.monaco-submenu")),this.submenuContainer.classList.add("menubar-menu-items-holder","context-view");let t=Me(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 PQ(this.submenuContainer,this.submenuActions.length?this.submenuActions:[new smt],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=Me(this.element),{top:c,left:u}=this.calculateSubmenuMenuLayout(new ai(l.innerWidth,l.innerHeight),ai.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 Ii(p).equals(15)&&($t.stop(p,!0),this.parentData.parent.focus(),this.cleanupExistingSubmenu(!0))})),this.submenuDisposables.add(j(this.submenuContainer,re.KEY_DOWN,p=>{new Ii(p).equals(15)&&$t.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)}},Z3t=class extends Lr{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 e8t(a){let i=oze,e=i.exec(a);if(!e)return a;let t=!e[1];return a.replace(i,t?"$2$3":"").trim()}function pTo(a){let i=amt()[a.id];return`.codicon-${a.id}:before { content: '\\${i.toString(16)}'; }`}function tVi(a,i){let e=`
.monaco-menu {
	font-size: 13px;
	border-radius: var(--vscode-cornerRadius-large);
	min-width: 160px;
}

${pTo(M.menuSelection)}
${pTo(M.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){e+=`
			/* 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 t=a.scrollbarShadow;t&&(e+=`
				.monaco-scrollable-element > .shadow.top {
					box-shadow: ${t} 0 6px 6px -6px inset;
				}

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

				.monaco-scrollable-element > .shadow.top.left {
					box-shadow: ${t} 6px 6px 6px -6px inset;
				}
			`);let o=a.scrollbarSliderBackground;o&&(e+=`
				.monaco-scrollable-element > .scrollbar > .slider {
					background: ${o};
				}
			`);let n=a.scrollbarSliderHoverBackground;n&&(e+=`
				.monaco-scrollable-element > .scrollbar > .slider:hover {
					background: ${n};
				}
			`);let r=a.scrollbarSliderActiveBackground;r&&(e+=`
				.monaco-scrollable-element > .scrollbar > .slider.active {
					background: ${r};
				}
			`)}return e}var nze=_;var t8t=class a extends C{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 P);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 as),this._register(this.actionRunner.onWillRun(()=>{this.setUnfocusedState()})),this._register(bf.getInstance().event(this.onModifierKeyToggled,this)),this._register(j(this.container,re.KEY_DOWN,r=>{let s=new Ii(r),l=!0,c=r.key?r.key.toLocaleLowerCase():"",u=it&&!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=Me(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){Yl(e).forEach(o=>{let n=this.menus.length,r=e8t(o.label),s=oze.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=nze("div.menubar-menu-button",{role:"menuitem",tabindex:-1,"aria-label":r,"aria-haspopup":!0}),c=nze("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 Ii(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(ws.addTarget(l)),this._register(j(l,Gn.Tap,u=>{this.isOpen&&this.focusedMenu&&this.focusedMenu.holder&&gs(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 yn(Me(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=nze("div.menubar-menu-button",{role:"menuitem",tabindex:this.isCompact?0:-1,"aria-label":e,"aria-haspopup":!0}),o=nze("div.menubar-menu-title.toolbar-toggle-more"+q.asCSSSelector(M.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 Ii(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(ws.addTarget(t)),this._register(j(t,Gn.Tap,n=>{this.isOpen&&this.focusedMenu&&this.focusedMenu.holder&&gs(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 yn(Me(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(),Ue(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 $l(`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 li),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 $l(`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=e8t(o);if(this.options.enableMnemonics){let s=ur(o);Ive.lastIndex=0;let l=Ive.exec(s);for(;l&&l[1];)l=Ive.exec(s);let c=u=>u.replace(/&amp;&amp;/g,"&amp;");l?(e.textContent="",e.append(Hw(c(s.substr(0,l.index))," "),nze("mnemonic",{"aria-hidden":"true"},l[3]),ih(c(s.substr(l.index+l[0].length))," "))):e.textContent=c(s).trim()}else e.textContent=n.replace(/&&/g,"&");let r=oze.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=$r(Me(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"&&wS(It)?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 it?!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&&Bb.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=nze("div.menubar-menu-items-holder",{title:""});n.buttonElement.classList.add("open");let s=n.titleElement.getBoundingClientRect(),l=_6(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=Me(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 PQ(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}}};fe.appendMenuItem(D.MenubarMainMenu,{submenu:D.MenubarFileMenu,title:{value:"File",original:"File",mnemonicTitle:d(4208,null)},order:1});fe.appendMenuItem(D.MenubarMainMenu,{submenu:D.MenubarEditMenu,title:{value:"Edit",original:"Edit",mnemonicTitle:d(4206,null)},order:2});fe.appendMenuItem(D.MenubarMainMenu,{submenu:D.MenubarSelectionMenu,title:{value:"Selection",original:"Selection",mnemonicTitle:d(4212,null)},order:3});fe.appendMenuItem(D.MenubarMainMenu,{submenu:D.MenubarViewMenu,title:{value:"View",original:"View",mnemonicTitle:d(4214,null)},order:4});fe.appendMenuItem(D.MenubarMainMenu,{submenu:D.MenubarGoMenu,title:{value:"Go",original:"Go",mnemonicTitle:d(4209,null)},order:5});fe.appendMenuItem(D.MenubarMainMenu,{submenu:D.MenubarTerminalMenu,title:{value:"Terminal",original:"Terminal",mnemonicTitle:d(4213,null)},order:7});fe.appendMenuItem(D.MenubarMainMenu,{submenu:D.MenubarHelpMenu,title:{value:"Help",original:"Help",mnemonicTitle:d(4210,null)},order:8});fe.appendMenuItem(D.MenubarMainMenu,{submenu:D.MenubarPreferencesMenu,title:{value:"Preferences",original:"Preferences",mnemonicTitle:d(4211,null)},when:Mx,order:9});var fct=class a extends C{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 P),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 Cc&&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 li)}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 li)}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 it&&kr?!1:Hje(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;Ode(e)?(o=e.folderUri,t=e.label||this.labelService.getWorkspaceLabel(o,{verbose:2}),n="openRecentFolder",r={folderUri:o}):L9e(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=pi({id:n,label:eqe(t),run:c=>{let u=c&&(!it&&(c.ctrlKey||c.shiftKey)||it&&(c.metaKey||c.altKey));return this.hostService.openWindow([r],{forceNewWindow:!!u,remoteAuthority:s||null})}});return Object.assign(l,{uri:o,remoteAuthority:s})}notifyUserOfCustomMenubarAccessibility(){if(Gt||it)return;let e=this.storageService.getBoolean("menubar/accessibleMenubarNotified",-1,!1),t=!Mae(this.configurationService);if(e||t||!this.accessibilityService.isScreenReaderOptimized())return;let o=d(4207,null);this.notificationService.prompt(St.Info,o,[{label:d(4203,null),run:()=>this.preferencesService.openUserSettings({query:"window.menuStyle"})}]),this.storageService.store("menubar/accessibleMenubarNotified",!0,-1,0)}},i8t;function Ypn(){return i8t||(i8t=new E,W(class extends K{constructor(){super({id:"workbench.actions.menubar.focus",title:L(4202,"Focus Application Menu"),keybinding:{primary:580,weight:200,when:ep},f1:!0})}async run(){i8t?.fire()}})),i8t}var o8t=class extends fct{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 P);this.updateActionsDisposables=this._register(new P);this._onVisibilityChange=this._register(new E),this._onFocusStateChange=this._register(new E),this.actionRunner=this._register(new as),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 pi({id:"update.check",label:d(4198,null),enabled:!0,run:()=>this.updateService.checkForUpdates(!0)});case"checking for updates":return pi({id:"update.checking",label:d(4199,null),enabled:!1,run:()=>{}});case"available for download":return pi({id:"update.downloadNow",label:d(4200,null),enabled:!0,run:()=>this.updateService.downloadUpdate(!0)});case"downloading":case"overwriting":return pi({id:"update.downloading",label:d(4201,null),enabled:!1,run:()=>{}});case"downloaded":return it?null:pi({id:"update.install",label:d(4205,null),enabled:!0,run:()=>this.updateService.applyUpdate()});case"updating":return pi({id:"update.updating",label:d(4204,null),enabled:!1,run:()=>{}});case"ready":return pi({id:"update.restart",label:d(4215,null),enabled:!0,run:()=>this.updateService.quitAndInstall()});default:return null}}get currentMenubarVisibility(){return Hje(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 F5.ID:t.push(...this.getOpenRecentActions());break;case"workbench.action.showAboutDialog":if(!it&&!Gt){let o=this.getUpdateAction();o&&(o.label=G$(o.label),t.push(o),t.push(new li))}break;default:break}}get currentEnableMenuBarMnemonics(){let e=this.configurationService.getValue("window.enableMenuBarMnemonics");return typeof e!="boolean"&&(e=!0),e&&(!Gt||wS(It))}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 Uc(e.getActions({shouldForwardArgs:!0}))}setupCustomMenubar(e){if(!this.container)return;e?(this.menubar&&this.reinstallDisposables.clear(),this.menubar=this.reinstallDisposables.add(new t8t(this.container,this.getMenuBarOptions(),PSt)),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 li)n.push(l);else if(l instanceof Cc||l instanceof Eo){let c=typeof l.item.title=="string"?l.item.title:l.item.title.mnemonicTitle??l.item.title.value;if(l instanceof Cc){let u=[];t(l.actions,u,r,s),u.length>0&&n.push(new $l(l.id,G$(c),u))}else{Jye(l.item.toggled)&&(c=l.item.toggled.mnemonicTitle??l.item.toggled.title??c);let u=s.add(new st(l.id,G$(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 P);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:G$(this.topLevelTitles[o])})}})),n===this.menus.File){let l=this.reinstallDisposables.add(new P);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:G$(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:G$(this.topLevelTitles[o])}):this.menubar.updateMenu({actions:r,label:G$(this.topLevelTitles[o])}))}}getWebNavigationActions(){if(!Gt)return[];let e=[];for(let t of this.webNavigationMenu.getActions()){let[,o]=t;for(let n of o)if(n instanceof Eo){let r=typeof n.item.title=="string"?n.item.title:n.item.title.mnemonicTitle??n.item.title.value;e.push(pi({id:n.id,label:G$(r),class:n.class,enabled:n.enabled,run:async s=>{this.commandService.executeCommand(n.id,s)}}))}e.push(new li)}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:()=>Gt?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(It,re.RESIZE,()=>{this.menubar&&!(Nc&&og.pointerEvents)&&this.menubar.blur()})),Gt&&(this._register(Bk(e=>{e===It.vscodeWindowId&&this.updateMenubar()})),this._register(this.webNavigationMenu.onDidChange(()=>this.updateMenubar())),this._register(Ypn().event(()=>this.menubar?.toggleFocus())))}get onVisibilityChange(){return this._onVisibilityChange.event}get onFocusStateChange(){return this._onFocusStateChange.event}getMenubarItemsDimensions(){return this.menubar?new ai(this.menubar.getWidth(),this.menubar.getHeight()):new ai(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()}};o8t=I([m(0,qt),m(1,Ff),m(2,X),m(3,_e),m(4,B),m(5,ot),m(6,zd),m(7,le),m(8,Ne),m(9,Po),m(10,Vt),m(11,Bi),m(12,Te),m(13,oi),m(14,ge)],o8t);var n8t=ae("menubarService");var rze=class extends fct{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=Uc(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 li)t.items.push({id:"vscode.menubar.separator"});else if(n instanceof Eo||n instanceof Cc){let r=typeof n.item.title=="string"?n.item.title:n.item.title.mnemonicTitle??n.item.title.value;if(n instanceof Cc){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===F5.ID){let l=this.getOpenRecentActions().map(this.transformOpenRecentAction);t.items.push(...l)}let s={id:n.id,label:r};Jye(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 li?{id:"vscode.menubar.separator"}:{id:e.id,uri:e.uri,remoteAuthority:e.remoteAuthority,enabled:e.enabled,label:e.label}}getAdditionalKeybindings(){let e={};if(it){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}}};rze=I([m(0,qt),m(1,Ff),m(2,X),m(3,_e),m(4,B),m(5,ot),m(6,zd),m(7,le),m(8,Ne),m(9,Po),m(10,ps),m(11,Bi),m(12,n8t),m(13,oi),m(14,To),m(15,ge)],rze);function vct(a){return Object.isFrozen(a)?a:lKi(a)}var lm=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 AQ("",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?t$e(this.contents,i):this.contents}inspect(i,e){let t=this;return{get value(){return vct(t.rawConfiguration.getValue(i))},get override(){return e?vct(t.rawConfiguration.getOverrideValue(i,e)):void 0},get merged(){return vct(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?vct(o):void 0}}}getOverrideValue(i,e){let t=this.getContentsForOverrideIdentifer(e);return t?i?t$e(t,i):t:void 0}getKeysForOverrideIdentifier(i){let e=[];for(let t of this.overrides)t.identifiers.includes(i)&&e.push(...t.keys);return Uo(e)}getAllOverrideIdentifiers(){let i=[];for(let e of this.overrides)i.push(...e.identifiers);return Uo(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=Xi(this.contents),t=Xi(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=Uo(l.keys)):t.push(Xi(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 Uo([...Object.keys(this.contents),...Object.keys(e)])){let n=this.contents[o],r=e[o];r&&(typeof n=="object"&&typeof r=="object"?(n=Xi(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&&yi(i[t])&&yi(e[t])){this.mergeContents(i[t],e[t]);continue}i[t]=Xi(e[t])}}getContentsForOverrideIdentifer(i){let e=null,t=null,o=n=>{n&&(t?this.mergeContents(t,n):t=Xi(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),TKi(this.contents,i),lg.test(i)&&this.overrides.splice(this.overrides.findIndex(t=>$i(t.identifiers,yU(i))),1))}updateValue(i,e,t){if(DYt(this.contents,i,e,o=>this.logService.error(o)),t=t||this.keys.indexOf(i)===-1,t&&this.keys.push(i),lg.test(i)){let o=this.contents[i],n=yU(i),r={identifiers:n,keys:Object.keys(o),contents:hSe(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)}}},AQ=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||lm.createEmptyModel(this.logService)}get restrictedConfigurations(){return this._restrictedConfigurations}get errors(){return this._parseErrors}parse(i,e){if(!Jn(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 lm(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{Wx(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=oe.as(ii.Configuration),o=t.getConfigurationProperties(),n=t.getExcludedConfigurationProperties(),r=this.filter(i,o,n,!0,e);i=r.raw;let s=hSe(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(lg.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(lg.test(o)){let n={},r=i[o];for(let s in r)n[s]=r[s];t.push({identifiers:yU(o),keys:Object.keys(n),contents:hSe(n,e)})}return t}},r8t=class extends C{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 AQ(this.userSettingsResource.toString(),r),this._register(this.fileService.watch(o.dirname(this.userSettingsResource))),this._register(this.fileService.watch(this.userSettingsResource)),this._register(H.any(H.filter(this.fileService.onDidFilesChange,s=>s.contains(this.userSettingsResource)),H.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 lm.createEmptyModel(this.logService)}}reparse(e){return e&&(this.parseOptions=e),this.parser.reparse(this.parseOptions),this.parser.configurationModel}getRestrictedSettings(){return this.parser.restrictedConfigurations}},iVi=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 vct(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)}},bct=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 vt;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=lm.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 iVi(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}=Nne(this._defaultConfiguration,i);e=[...o,...n,...r]}for(let o of e)for(let n of yU(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=>!uo(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}=Nne(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}=Nne(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}=Nne(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}=Nne(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}=Nne(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}=Nne(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}=Nne(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 lm(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 vt);return new a(t,o,n,r,s,l,c,lm.createEmptyModel(e),new vt,e)}static parseConfigurationModel(i,e){return new lm(i.contents,i.keys,i.overrides,i.raw,e)}};var Sct=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=bct.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!uo(s,l)}return!0}};function Nne(a,i){let{added:e,removed:t,updated:o}=hTo(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=hTo({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 hTo(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=t$e(i.contents,n),s=t$e(a.contents,n);uo(r,s)||o.push(n)}}return{added:e,removed:t,updated:o}}var sze=class extends C{constructor(e){super();this.logService=e;this._onDidChangeConfiguration=this._register(new E);this.onDidChangeConfiguration=this._onDidChangeConfiguration.event;this._configurationModel=lm.createEmptyModel(e)}get configurationModel(){return this._configurationModel}async initialize(){return this.resetConfigurationModel(),this._register(oe.as(ii.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,oe.as(ii.Configuration).getConfigurationProperties()),this._onDidChangeConfiguration.fire({defaults:this.configurationModel,properties:e})}getConfigurationDefaultOverrides(){return{}}resetConfigurationModel(){this._configurationModel=lm.createEmptyModel(this.logService);let e=oe.as(ii.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,Xi(s.default)):this._configurationModel.removeValue(n)}}},Ict=class{constructor(){this.onDidChangeConfiguration=H.None;this.configurationModel=lm.createEmptyModel(new bmt)}async initialize(){return this.configurationModel}},yve=class extends C{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=lm.createEmptyModel(this.logService),this.configurationRegistry=oe.as(ii.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 mf(t)||await this.policyService.updatePolicyDefinitions(t),o}onDidChangePolicies(e){this.logService.trace("PolicyConfiguration#onDidChangePolicies",e);let t=this.configurationRegistry.getPolicyConfigurations(),o=si(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(Ae(p)&&c.type!=="string")try{p=this.parse(p)}catch(h){this.logService.error(`Error parsing policy value ${u}:`,Cn(h));continue}(s?p!==void 0:!uo(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=lm.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&&(Wx(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=>Cn(u.error)).join(`
`));return t}};yve=I([m(1,XTe),m(2,ne)],yve);var yct=class extends AQ{constructor(e,t,o){super(e,o);this.scope=t}doParseRaw(e,t){let o=hSe(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:[]}}},aze=class extends bct{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:uo(this.getValue(p,{overrideIdentifier:c}),e.getValue(p,{overrideIdentifier:c}))?this._workspace&&this._workspace.folders.some(h=>!uo(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=Uo([...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 oVi=class a extends sze{constructor(e,t,o,n){super(n);this.configurationCache=t;this.configurationRegistry=oe.as(ii.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!mf(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=yi(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(!lg.test(n)&&r!==void 0){let s=e[n];yi(s)&&yi(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{}}};var wct=class extends C{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 r8t(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 lze}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([qE,this.tasksResource]),this.mcpResource&&o.push([Dv,this.mcpResource]);let n=new lze(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()}},lze=class extends C{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(hn(...this.allResources.map(c=>hn(this.fileService.watch(s.extUri.dirname(c)),this.fileService.watch(c))))),this._folderSettingsModelParser=new AQ(e,l),this._folderSettingsParseOptions=n,this._standAloneConfigurations=[],this._cache=lm.createEmptyModel(this.logService),this._register(H.debounce(H.any(H.filter(this.fileService.onDidFilesChange,c=>this.handleFileChangesEvent(c)),H.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()}': ${Cn(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 yct(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),uo(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))))}};var nVi=class{constructor(i,e,t,o,n){this.configurationCache=o;this.logService=n;this.onDidChange=H.None;this.key={type:"folder",key:Ir(je(i,e).toString()).toString(16)},this._folderSettingsModelParser=new AQ("CachedFolderConfiguration",n),this._folderSettingsParseOptions=t,this._standAloneConfigurations=[],this.configurationModel=lm.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===m7e)this._folderSettingsModelParser.parse(e[t],this._folderSettingsParseOptions);else{let o=new yct(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[m7e]=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[]}},Cct=class extends C{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?sJ:a_e,this.configurationFolder=l.extUri.joinPath(t.uri,o),this.cachedFolderConfiguration=new nVi(t.uri,o,{scopes:this.scopes,skipRestricted:this.isUntrusted()},u,c),e&&this.configurationCache.needsCaching(t.uri)?(this.folderConfiguration=this.cachedFolderConfiguration,N$i(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,`${m7e}.json`),r=[qE,rK,Dv].map(s=>[s,t.extUri.joinPath(this.configurationFolder,`${s}.json`)]);return new lze(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 lze){let[e,t]=await this.folderConfiguration.resolveContents();this.cachedFolderConfiguration.updateConfiguration(e,t)}}addRelated(e){this._register(e)}};var s8t=class extends Zs{constructor(e,t){super(e);this.code=t}};var xct=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 Op}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 s8t(d(16709,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?An.replace(n,i.content):An.insert(t,i.content);return e.pushEditOperations([new Yt(t.lineNumber,t.column,t.lineNumber,t.column)],[s],()=>[]),!0}return!1}getEdits({value:i,jsonPath:e},t,o){return e.length?Sb(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===qE?d(16713,null):e.workspaceStandAloneConfigurationKey===rK?d(16711,null):e.workspaceStandAloneConfigurationKey===Dv?d(16712,null):null;t?this.notificationService.prompt(St.Error,i.message,[{label:t,run:()=>this.openFile(e.resource)}]):this.notificationService.prompt(St.Error,i.message,[{label:d(16710,null),run:()=>this.openSettings(e)}])}onConfigurationFileDirtyError(i,e,t){let o=e.workspaceStandAloneConfigurationKey===qE?d(16713,null):e.workspaceStandAloneConfigurationKey===rK?d(16711,null):null;o?this.notificationService.prompt(St.Error,i.message,[{label:d(16715,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(St.Error,i.message,[{label:d(16715,null),run:()=>this.writeConfiguration(e.target,{key:e.key,value:e.value},{handleDirtyFile:"save",scopes:t})},{label:d(16710,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 s8t(o,i)}toErrorMessage(i,e,t){switch(i){case 12:return d(16701,null,t.key);case 0:return d(16707,null,this.stringifyTarget(e),t.key);case 1:return d(16693,null,t.key);case 2:return d(16694,null,t.key);case 3:return d(16685,null,t.key);case 4:return d(16692,null,t.key);case 5:return d(16695,null,t.key);case 6:return d(16686,null);case 7:return d(16690,null,t.key);case 8:return d(16700,null,this.stringifyTarget(e));case 11:{if(t.workspaceStandAloneConfigurationKey===qE)return d(16691,null);if(t.workspaceStandAloneConfigurationKey===rK)return d(16687,null);if(t.workspaceStandAloneConfigurationKey===Dv)return d(16688,null);switch(e){case 1:return d(16682,null);case 2:return d(16689,null);case 3:return d(16684,null);case 4:{let o="<<unknown>>";if(t.resource){let n=this.contextService.getWorkspaceFolder(t.resource);n&&(o=n.name)}return d(16683,null,o)}default:return""}}case 9:{if(t.workspaceStandAloneConfigurationKey===qE)return d(16704,null);if(t.workspaceStandAloneConfigurationKey===rK)return d(16696,null);if(t.workspaceStandAloneConfigurationKey===Dv)return d(16698,null);switch(e){case 1:return d(16676,null);case 2:return d(16702,null);case 3:return d(16678,null);case 4:{let o="<<unknown>>";if(t.resource){let n=this.contextService.getWorkspaceFolder(t.resource);n&&(o=n.name)}return d(16677,null,o)}default:return""}}case 10:if(t.workspaceStandAloneConfigurationKey===qE)return d(16705,null);if(t.workspaceStandAloneConfigurationKey===rK)return d(16697,null);if(t.workspaceStandAloneConfigurationKey===Dv)return d(16699,null);switch(e){case 1:return d(16679,null);case 2:return d(16703,null);case 3:return d(16681,null);case 4:return d(16680,null)}case 13:return d(16706,null,this.stringifyTarget(e))}}stringifyTarget(i){switch(i){case 1:return d(16716,null);case 2:return d(16714,null);case 3:return d(16717,null);case 4:return d(16708,null);default:return""}}defaultResourceValue(i){let e=this.uriIdentityService.extUri.basename(i);return e.substr(0,e.length-this.uriIdentityService.extUri.extname(i).length)===qE?Fio:"{}"}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 Ur(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=oe.as(ii.Configuration).getConfigurationProperties()[e.key]?.scope;if(!e.workspaceStandAloneConfigurationKey&&this.configurationService.keys().default.indexOf(e.key)<0&&!lg.test(e.key)&&e.value!==void 0)throw this.toConfigurationEditingError(0,i,e);if(e.workspaceStandAloneConfigurationKey&&e.workspaceStandAloneConfigurationKey!==qE&&e.workspaceStandAloneConfigurationKey!==Dv&&(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&&!lg.test(e.key)){if(r&&AC.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&&!lg.test(e.key)&&r!==void 0&&!sJ.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?mPt:X_,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=oe.as(ii.Configuration).getConfigurationProperties()[o]?.scope,s=t.overrideIdentifiers?.length?[n$e(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,uPt,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===qE?this.userDataProfileService.currentProfile.tasksResource:e===Dv?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}};xct=I([m(1,Lv),m(2,Pe),m(3,mn),m(4,an),m(5,be),m(6,Nt),m(7,Ho),m(8,Ne),m(9,Po),m(10,ee),m(11,dt),m(12,lr)],xct);var kct=class extends C{constructor(e,t,o,n,r){super();this.workspaceContextService=e;this.environmentService=t;this.workspaceTrustManagementService=o;n.whenInstalledExtensionsRegistered().then(()=>{this.registerConfigurationSchemas();let s=oe.as(ii.Configuration),l=this._register(new jo(50));this._register(H.any(s.onDidUpdateConfiguration,s.onDidSchemaChange,o.onDidChangeTrust)(()=>l.trigger(()=>this.registerConfigurationSchemas(),r.phase===4?void 0:2500)))})}registerConfigurationSchemas(){let e={properties:Qw.properties,patternProperties:Qw.patternProperties,additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0},t=this.environmentService.remoteAuthority?{properties:Object.assign({},vSe.properties,IU.properties,CN.properties),patternProperties:Qw.patternProperties,additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0}:e,o={properties:Object.assign({},rse.properties,SU.properties,IU.properties,CN.properties),patternProperties:Qw.patternProperties,additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0},n={properties:Object.assign({},bSe.properties,rse.properties,SU.properties,IU.properties,CN.properties),patternProperties:Qw.patternProperties,additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0},r={properties:Object.assign({},this.checkAndFilterPropertiesRequiringTrust(SU.properties),this.checkAndFilterPropertiesRequiringTrust(IU.properties),this.checkAndFilterPropertiesRequiringTrust(CN.properties)),patternProperties:Qw.patternProperties,additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0},s={properties:Object.keys(Qw.properties).reduce((u,p)=>(u[p]=Object.assign({deprecationMessage:void 0},Qw.properties[p]),u),{}),patternProperties:Object.keys(Qw.patternProperties).reduce((u,p)=>(u[p]=Object.assign({deprecationMessage:void 0},Qw.patternProperties[p]),u),{}),additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0},l=3===this.workspaceContextService.getWorkbenchState()?{properties:Object.assign({},this.checkAndFilterPropertiesRequiringTrust(SU.properties),this.checkAndFilterPropertiesRequiringTrust(CN.properties)),patternProperties:Qw.patternProperties,additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0}:r,c={type:"object",description:d(16674,null),properties:Object.assign({},this.filterDefaultOverridableProperties(SU.properties),this.filterDefaultOverridableProperties(IU.properties),this.filterDefaultOverridableProperties(CN.properties)),patternProperties:{[bU]:{type:"object",default:{},$ref:L$}},additionalProperties:!1};this.registerSchemas({defaultSettingsSchema:s,userSettingsSchema:t,profileSettingsSchema:o,machineSettingsSchema:n,workspaceSettingsSchema:r,folderSettingsSchema:l,configDefaultsSchema:c})}registerSchemas(e){let t=oe.as(ea.JSONContribution);t.registerSchema(Rio,e.defaultSettingsSchema),t.registerSchema(Mio,e.userSettingsSchema),t.registerSchema(Pio,e.profileSettingsSchema),t.registerSchema(Aio,e.machineSettingsSchema),t.registerSchema(pPt,e.workspaceSettingsSchema),t.registerSchema(Nio,e.folderSettingsSchema),t.registerSchema(Gmt,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}};kct=I([m(0,Pe),m(1,Vt),m(2,ns),m(3,lt),m(4,ao)],kct);var cze=class extends C{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=oe.as(ii.Configuration);this.throttler=this._register(new um);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=>NYt(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}`);!cn(u)&&!uo(u,l.default)&&(o[s]=u)}catch{}}}Object.keys(o).length&&this.configurationRegistry.registerDefaultConfigurations([{overrides:o}])}};cze=I([m(0,kC),m(1,lt),m(2,B),m(3,ne)],cze);var Xpn=oe.as(Qi.Workbench);Xpn.registerWorkbenchContribution(kct,3);pt(cze.ID,cze,ut.BlockRestore);var Jpn=oe.as(ii.Configuration);Jpn.registerConfiguration({...Cm,properties:{[IR]:{type:"array",description:d(16675,null),default:[],scope:1,additionalProperties:!0,uniqueItems:!0}}});var a8t=class extends C{constructor(e,t,o,n,r,s){super();this.workspaceService=t;this.uriIdentityService=o;this.fileService=n;this.logService=s;this.cachedFolderConfigs=this._register(new jt(new vt));this._onDidChangeConfiguration=this._register(new E);this.onDidChangeConfiguration=this._onDidChangeConfiguration.event;this.onDidChangeRestrictedSettings=H.None;this.restrictedSettings={default:[]};this.configurationRegistry=oe.as(ii.Configuration);this.settingsResource=e.currentProfile.settingsResource,this.defaultConfiguration=this._register(new sze(s)),this.policyConfiguration=r instanceof l7e?new Ict:this._register(new yve(this.defaultConfiguration,r,s)),this.userConfiguration=this._register(new wct(e.currentProfile.settingsResource,e.currentProfile.tasksResource,e.currentProfile.mcpResource,{},n,o,s)),this.configurationEditing=new rVi(n,this),this._configuration=new aze(lm.createEmptyModel(s),lm.createEmptyModel(s),lm.createEmptyModel(s),lm.createEmptyModel(s),lm.createEmptyModel(s),lm.createEmptyModel(s),new vt,lm.createEmptyModel(s),new vt,this.workspaceService.getWorkspace(),this.logService),this._register(this.defaultConfiguration.onDidChangeConfiguration(({defaults:l,properties:c})=>this.onDefaultConfigurationChanged(l,c))),this._register(this.policyConfiguration.onDidChangeConfiguration(l=>this.onPolicyConfigurationChanged(l))),this._register(this.userConfiguration.onDidChangeConfiguration(l=>this.onUserConfigurationChanged(l))),this._register(this.workspaceService.onWillChangeWorkspaceFolders(l=>l.join(this.loadFolderConfigurations(l.changes.added)))),this._register(this.workspaceService.onDidChangeWorkspaceFolders(l=>this.onWorkspaceFoldersChanged(l)))}async initialize(){let[e,t,o]=await Promise.all([this.defaultConfiguration.initialize(),this.policyConfiguration.initialize(),this.userConfiguration.initialize()]),n=this.workspaceService.getWorkspace();this._configuration=new aze(e,t,lm.createEmptyModel(this.logService),o,lm.createEmptyModel(this.logService),lm.createEmptyModel(this.logService),new vt,lm.createEmptyModel(this.logService),new vt,n,this.logService),await this.loadFolderConfigurations(n.folders)}getConfigurationData(){return this._configuration.toData()}getValue(e,t){let o=typeof e=="string"?e:void 0,n=ZGe(e)?e:ZGe(t)?t:void 0;return this._configuration.getValue(o,n)}async updateValue(e,t,o,n,r){let s=_Yt(o)?o:ZGe(o)?{resource:o.resource,overrideIdentifiers:o.overrideIdentifier?[o.overrideIdentifier]:void 0}:void 0,l=s?n:o;s?.overrideIdentifiers&&(s.overrideIdentifiers=Uo(s.overrideIdentifiers),s.overrideIdentifiers=s.overrideIdentifiers.length?s.overrideIdentifiers:void 0);let c=this.inspect(e,{resource:s?.resource,overrideIdentifier:s?.overrideIdentifiers?s.overrideIdentifiers[0]:void 0});if(c.policyValue!==void 0)throw new Error(`Unable to write ${e} because it is configured in system policy.`);if(uo(t,c.defaultValue)&&(t=void 0),s?.overrideIdentifiers?.length&&s.overrideIdentifiers.length>1){let h=s.overrideIdentifiers.sort(),g=this._configuration.localUserConfiguration.overrides.find(f=>$i([...f.identifiers].sort(),h));g&&(s.overrideIdentifiers=g.identifiers)}let u=s?.overrideIdentifiers?.length?[n$e(s.overrideIdentifiers),e]:[e],p=this.getSettingsResource(l,s?.resource??void 0);await this.configurationEditing.write(p,u,t),await this.reloadConfiguration()}getSettingsResource(e,t){if((e===6||e===5)&&t){let o=this.workspaceService.getWorkspaceFolder(t);if(o)return this.uriIdentityService.extUri.joinPath(o.uri,uPt)}return this.settingsResource}inspect(e,t){return this._configuration.inspect(e,t)}keys(){return this._configuration.keys()}async reloadConfiguration(e){let t=await this.userConfiguration.initialize(),o=this._configuration.toData(),n=this._configuration.compareAndUpdateLocalUserConfiguration(t);for(let r of this.workspaceService.getWorkspace().folders){let s=this.cachedFolderConfigs.get(r.uri);if(s){let l=await s.loadConfiguration(),c=this._configuration.compareAndUpdateFolderConfiguration(r.uri,l);n.keys.push(...c.keys),n.overrides.push(...c.overrides)}}this.triggerConfigurationChange(n,o,2)}hasCachedConfigurationDefaultsOverrides(){return!1}async whenRemoteConfigurationLoaded(){}isSettingAppliedForAllProfiles(e){let t=this.configurationRegistry.getConfigurationProperties()[e]?.scope;if(t&&AC.includes(t))return!0;let o=this.getValue(IR)??[];return Array.isArray(o)&&o.includes(e)}onDefaultConfigurationChanged(e,t){let o=this._configuration.toData(),n=this._configuration.compareAndUpdateDefaultConfiguration(e,t);this._configuration.updateLocalUserConfiguration(this.userConfiguration.reparse());for(let r of this.workspaceService.getWorkspace().folders){let s=this.cachedFolderConfigs.get(r.uri);s&&this._configuration.updateFolderConfiguration(r.uri,s.reparse())}this.triggerConfigurationChange(n,o,7)}onPolicyConfigurationChanged(e){let t=this._configuration.toData(),o=this._configuration.compareAndUpdatePolicyConfiguration(e);this.triggerConfigurationChange(o,t,7)}onUserConfigurationChanged(e){let t=this._configuration.toData(),o=this._configuration.compareAndUpdateLocalUserConfiguration(e);this.triggerConfigurationChange(o,t,2)}onWorkspaceFoldersChanged(e){let t=this._configuration.toData(),o=[],n=[];for(let r of e.removed){let s=this._configuration.compareAndDeleteFolderConfiguration(r.uri);o.push(...s.keys),n.push(...s.overrides),this.cachedFolderConfigs.deleteAndDispose(r.uri)}(o.length||n.length)&&this.triggerConfigurationChange({keys:o,overrides:n},t,6)}onWorkspaceFolderConfigurationChanged(e){let t=this.cachedFolderConfigs.get(e.uri);t&&t.loadConfiguration().then(o=>{let n=this._configuration.toData(),r=this._configuration.compareAndUpdateFolderConfiguration(e.uri,o);this.triggerConfigurationChange(r,n,6)},mt)}async loadFolderConfigurations(e){for(let t of e){let o=this.cachedFolderConfigs.get(t.uri);o||(o=new Cct(!1,t,sue,3,!0,this.fileService,this.uriIdentityService,this.logService,{needsCaching:()=>!1,read:async()=>"",write:async()=>{},remove:async()=>{}}),o.addRelated(o.onDidChange(()=>this.onWorkspaceFolderConfigurationChanged(t))),this.cachedFolderConfigs.set(t.uri,o));let n=await o.loadConfiguration();this._configuration.updateFolderConfiguration(t.uri,n)}}triggerConfigurationChange(e,t,o){if(e.keys.length){let n=this.workspaceService.getWorkspace(),r=new Sct(e,{data:t,workspace:n},this._configuration,n,this.logService);r.source=o,this._onDidChangeConfiguration.fire(r)}}},rVi=class{constructor(i,e){this.fileService=i;this.configurationService=e;this.queue=new Op}write(i,e,t){return this.queue.queue(()=>this.doWriteConfiguration(i,e,t))}async doWriteConfiguration(i,e,t){let o;try{o=(await this.fileService.readFile(i)).value.toString()}catch(s){if(s.fileOperationResult===1)o="{}";else throw s}let n=[];if(Ur(o,n,{allowTrailingComma:!0,allowEmptyContent:!0}),n.length>0)throw new Error("Unable to write into the settings file. Please open the file to correct errors/warnings in the file and try again.");let r=this.getEdits(o,e,t);o=Nde(o,r),await this.fileService.writeFile(i,Je.fromString(o))}getEdits(i,e,t){let{tabSize:o,insertSpaces:n,eol:r}=this.formattingOptions;return e.length?Sb(i,e,t,{tabSize:o,insertSpaces:n,eol:r}):[{content:JSON.stringify(t,null,n?" ".repeat(o):"	"),length:i.length,offset:0}]}get formattingOptions(){if(!this._formattingOptions){let i=zo===3||zo===2?`
`:`\r
`,e=this.configurationService.getValue("files.eol",{overrideIdentifier:"jsonc"});e&&typeof e=="string"&&e!=="auto"&&(i=e),this._formattingOptions={eol:i,insertSpaces:!!this.configurationService.getValue("editor.insertSpaces",{overrideIdentifier:"jsonc"}),tabSize:this.configurationService.getValue("editor.tabSize",{overrideIdentifier:"jsonc"})}}return this._formattingOptions}};function l8t(a){return{id:Zpn(a),configPath:a}}function Zpn(a){return Ir(a.toString()).toString(16)}var c8t=class extends C{constructor(e,t){super();this.uriIdentityService=t;this.onDidChangeWorkbenchState=H.None;this.onDidChangeWorkspaceName=H.None;this.onDidEnterWorkspace=H.None;this._onWillChangeWorkspaceFolders=new E;this.onWillChangeWorkspaceFolders=this._onWillChangeWorkspaceFolders.event;this._onDidChangeWorkspaceFolders=this._register(new E);this.onDidChangeWorkspaceFolders=this._onDidChangeWorkspaceFolders.event;this._updateFoldersQueue=this._register(new Op);this.workspace=new twe(e.id,[],!1,e.configPath,o=>t.extUri.ignorePathCasing(o))}getCompleteWorkspace(){return Promise.resolve(this.workspace)}getWorkspace(){return this.workspace}getWorkbenchState(){return 3}setConfigurationService(e){this._configurationService=e}hasWorkspaceData(){return this._configurationService?.getValue("sessions.workspace.sendWorkspaceDataToExtHost")===!0}getWorkspaceFolder(e){return this.workspace.getFolder(e)}isInsideWorkspace(e){return!!this.getWorkspaceFolder(e)}isCurrentWorkspace(e){return!1}addFolders(e){return this.doUpdateFolders(e,[])}removeFolders(e){return this.doUpdateFolders([],e)}async updateFolders(e,t,o){let n=this.workspace.folders,r=[];typeof t=="number"&&(r=n.slice(e,e+t).map(l=>l.uri));let s=[];return Array.isArray(o)&&(s=o.map(l=>({uri:Rbe(l.uri),name:l.name}))),this.doUpdateFolders(s,r,e)}async enterWorkspace(e){}async createAndEnterWorkspace(e,t){}async saveAndEnterWorkspace(e){}async copyWorkspaceSettings(e){}async pickNewWorkspacePath(){}doUpdateFolders(e,t,o){return this._updateFoldersQueue.queue(()=>this._doUpdateFolders(e,t,o))}async _doUpdateFolders(e,t,o){if(e.length===0&&t.length===0)return;let n=this.workspace.folders,r=n.filter(v=>!t.some(b=>this.uriIdentityService.extUri.isEqual(v.uri,b))),s=e.filter(v=>!r.some(b=>this.uriIdentityService.extUri.isEqual(b.uri,v.uri))).map(v=>new kq({uri:v.uri,name:v.name||this.uriIdentityService.extUri.basenameOrAuthority(v.uri),index:0},{uri:v.uri.toString()}));s.length>0&&(typeof o=="number"&&o>=0&&o<r.length?r=[...r.slice(0,o),...s,...r.slice(o)]:r=[...r,...s]),r=r.map((v,b)=>new kq({uri:v.uri,name:v.name,index:b},v.raw));let l=r.filter(v=>!n.some(b=>this.uriIdentityService.extUri.isEqual(b.uri,v.uri))),c=n.filter(v=>!r.some(b=>this.uriIdentityService.extUri.isEqual(b.uri,v.uri))),p={added:l,removed:c,changed:[]};if(l.length===0&&c.length===0)return;let h=[];this._onWillChangeWorkspaceFolders.fire({changes:p,fromCache:!1,join(v){h.push(v)}}),await Promise.allSettled(h);let g=l8t(this.workspace.configuration),f=new twe(g.id,r,!1,g.configPath,v=>this.uriIdentityService.extUri.ignorePathCasing(v));this.workspace.update(f),this._onDidChangeWorkspaceFolders.fire(p)}};var sVi=class extends C{constructor(e){super();this.configuration=e;this.init()}init(){this.reviveUris(),s$(!!this.configuration.fullscreen,It)}reviveUris(){let e=I4i(this.configuration.workspace);(TL(e)||$g(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(),Mzi(It)]);this.applyWindowZoomLevel(e.configurationService);let t=new J3t(It.document.body,{extraClasses:this.getExtraClasses()},e.serviceCollection,e.logService);this.registerListeners(t,e.storageService);let o=t.startup();this._register(o.createInstance(PG)),(it||Mae(e.configurationService))&&this._register(o.createInstance(rze))}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}MG(t,It)}getExtraClasses(){return it&&NUi(this.configuration.os.release)?["macos-tahoe"]:[]}registerListeners(e,t){this._register(e.onWillShutdown(o=>o.join(t.close(),{id:"join.closeStorage",label:d(2977,null)}))),this._register(e.onDidShutdown(()=>this.dispose()))}async initServices(){let e=new Io,t=this._register(new N3t(this.configuration.windowId));e.set(Lu,t);let o={_serviceBrand:void 0,...to};e.set(nt,o);let n=new _h(this.configuration,o);e.set(ps,n);let r=this.configuration.loggers.map(pe=>({...pe,resource:A.revive(pe.resource)})),s=new _5t(this.configuration.windowId,this.configuration.logLevel,n.windowLogsPath,r,t.getChannel("logger"));e.set(ol,s);let l=this._register(new O3t(s,n));e.set(ne,l),Zf&&l.info("workbench#open()"),l.getLevel()===1&&l.trace("workbench#open(): with configuration",pU({...this.configuration,nls:void 0}));let c=this._register(new gLe(o));e.set(Um,c);let u,p=new Z1e(l,c);if(this.configuration.policiesData){let pe=new H3t(this.configuration.policiesData,t.getChannel("policy"));u=new eze([pe,p],l)}else u=p;e.set(XTe,u);let h=new G1e(this.configuration.windowId,l);e.set(Fb,h);let g=new K1e(this.configuration.windowId,l,t);e.set(E3t,g);let f=dd.toService(t.getChannel("sign"));e.set(yne,f);let v=this._register(new wne(l));e.set(be,v);let b=new $1e(o,new J1e(n.window.id,t,v));e.set(Mc,b);let S=this._register(new V3t(t,g,l,s));v.registerProvider(Y.file,S);let y=new pve(v);e.set(dt,y);let w=new HDe(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 U3t(Qy(this.configuration.profiles.profile,w.profilesHome.scheme));e.set(mn,k),v.registerProvider(Y.vscodeUserData,this._register(new B3t(Y.file,S,Y.vscodeUserData,w,y,l)));let T=new ZDt;T.register(0,new z3t(null)),e.set(Fz,T);let N=this._register(new j1e(T,k,n,o,b,f,l));e.set(yo,N),this._register(L3t.register(N,v,l));let O=l8t(y.extUri.joinPath(y.extUri.dirname(w.profilesHome),"agent-sessions.code-workspace")),[{configurationService:V,workspaceContextService:U},G]=await Promise.all([this.createWorkspaceAndConfigurationService(O,k,y,v,l,u).then(pe=>(e.set(Lv,pe.configurationService),e.set(Pe,pe.workspaceContextService),e.set(Of,pe.workspaceContextService),pe)),this.createStorageService(O,n,k,w,t).then(pe=>(e.set(le,pe),pe)),this.createKeyboardLayoutService(t).then(pe=>(e.set(M3t,pe),pe))]),$=new Ske(V,n);e.set(BL,$);let te=new Ike(V,b,G,y,n,U,$,v);return e.set(ns,te),{serviceCollection:e,logService:l,storageService:G,configurationService:V}}async createWorkspaceAndConfigurationService(e,t,o,n,r,s){let l=new c8t(e,o),c=new a8t(t,l,o,n,s,r);try{await c.initialize()}catch(u){mt(u)}return l.setConfigurationService(c),{configurationService:c,workspaceContextService:l}}async createStorageService(e,t,o,n,r){let s=new _3t(e,o,n,r,t);try{return await s.initialize(),s}catch(l){return mt(l),s}}async createKeyboardLayoutService(e){let t=new X1e(e);try{return await t.initialize(),t}catch(o){return mt(o),t}}};function emn(a){return new sVi(a).open()}var d8t=class extends K{constructor(){super({id:"workbench.action.toggleDevTools",title:L(16345,"Toggle Developer Tools"),category:We.Developer,f1:!0,keybinding:{weight:250,when:Gq,primary:3111,mac:{primary:2599}},menu:{id:D.MenubarHelpMenu,group:"5_tools",order:1}})}async run(i){return i.get(To).toggleDevTools({targetWindowId:Ki().vscodeWindowId})}},u8t=class extends K{constructor(){super({id:"workbench.action.configureRuntimeArguments",title:L(16335,"Configure Runtime Arguments"),category:We.Preferences,f1:!0})}async run(i){let e=i.get(ee),t=i.get(Vt);await e.openEditor({resource:t.argvResource,options:{pinned:!0}})}},p8t=class extends K{constructor(){super({id:"workbench.action.reloadWindowWithExtensionsDisabled",title:L(16336,"Reload with Extensions Disabled"),category:We.Developer,f1:!0})}async run(i){return i.get(To).reload({disableExtensions:!0})}},m8t=class extends K{constructor(){super({id:"workbench.action.revealUserDataFolder",title:L(16337,"Reveal User Data Folder"),category:We.Developer,f1:!0})}async run(i){let e=i.get(To),t=i.get(ps);return e.showItemInFolder(A.file(t.userDataPath).fsPath)}},h8t=class extends K{constructor(){super({id:"workbench.action.showGPUInfo",title:L(16339,"Show GPU Info"),category:We.Developer,f1:!0})}run(i){i.get(To).openGPUInfoWindow()}},g8t=class extends K{constructor(){super({id:"workbench.action.showContentTracing",title:L(16338,"Show Content Tracing"),category:We.Developer,f1:!0})}run(i){i.get(To).openContentTracingWindow()}},f8t=class a extends K{static{this.ID="workbench.action.stopTracing"}constructor(){super({id:a.ID,title:L(16340,"Stop Tracing"),category:We.Developer,f1:!0})}async run(i){let e=i.get(iC),t=i.get(ct),o=i.get(To),n=i.get(Bo);if(!e.args.trace){let{confirmed:r}=await t.confirm({message:d(16343,null),primaryButton:d(16341,null)});if(r)return o.relaunch({addArgs:["--trace"]})}await n.withProgress({location:20,title:d(16344,null),cancellable:!1,detail:d(16342,null)},()=>o.stopTracing())}};var Ect=class a extends K{static{this.ID="workbench.action.closeWindow"}constructor(){super({id:a.ID,title:{...L(16354,"Close Window"),mnemonicTitle:d(16358,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(To).closeWindow({targetWindowId:Ki().vscodeWindowId})}},v8t=class a extends K{static{this.ID="workbench.action.closeOtherWindows"}constructor(){super({id:a.ID,title:L(16353,"Close Other Windows"),f1:!0})}async run(i){let e=i.get(To),t=Ki().vscodeWindowId,o=await e.getWindows({includeAuxiliaryWindows:!1});for(let n of o)n.id!==t&&e.closeWindow({targetWindowId:n.id})}},Tct=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>oct||n<nct||(o===2&&await t.updateValue(a.ZOOM_LEVEL_SETTING_KEY,n),MG(n,o))}},b8t=class extends Tct{constructor(){super({id:"workbench.action.zoomIn",title:{...L(16368,"Zoom In"),mnemonicTitle:d(16359,null)},category:We.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,RT(Ki())+1)}},S8t=class extends Tct{constructor(){super({id:"workbench.action.zoomOut",title:{...L(16369,"Zoom Out"),mnemonicTitle:d(16360,null)},category:We.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,RT(Ki())-1)}},I8t=class extends Tct{constructor(){super({id:"workbench.action.zoomReset",title:{...L(16370,"Reset Zoom"),mnemonicTitle:d(16361,null)},category:We.View,f1:!0,keybinding:{weight:200,primary:2146},menu:{id:D.MenubarAppearanceMenu,group:"5_zoom",order:3}})}run(i){return super.setZoomLevel(i,!0)}},y8t=class extends K{constructor(){super(...arguments);this.closeWindowAction={iconClass:q.asClassName(M.removeClose),tooltip:d(16351,null)};this.closeDirtyWindowAction={iconClass:"dirty-window "+q.asClassName(M.closeDirty),tooltip:d(16351,null),alwaysVisible:!0};this.closeActiveWindowAction={iconClass:"active-window "+q.asClassName(M.windowActive),tooltip:d(16352,null),alwaysVisible:!0}}async run(e){let t=e.get(Ge),o=e.get(_e),n=e.get(Ct),r=e.get(kt),s=e.get(To),l=Ki().vscodeWindowId,c=await s.getWindows({includeAuxiliaryWindows:!0}),u=new Set,p=new Map;for(let v of c)if(T4i(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(16367,null):void 0});let S=v.filename?A.file(v.filename):$g(v.workspace)?v.workspace.uri:TL(v.workspace)?v.workspace.configPath:void 0,y=v.filename?0:$g(v.workspace)?1:TL(v.workspace)?2:0,w={windowId:v.id,label:v.title,ariaLabel:v.dirty?d(16366,null,v.title):v.title,iconClasses:js(n,r,S,y),description:l===v.id?d(16355,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:js(n,r,k.filename?A.file(k.filename):void 0,0),description:l===k.id?d(16355,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(16364,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})}},w8t=class extends y8t{constructor(){super({id:"workbench.action.switchWindow",title:L(16363,"Switch Window..."),f1:!0,keybinding:{weight:200,primary:0,mac:{primary:309}}})}isQuickNavigate(){return!1}},C8t=class extends y8t{constructor(){super({id:"workbench.action.quickSwitchWindow",title:L(16362,"Quick Switch Window..."),f1:!1})}isQuickNavigate(){return!0}};function dze(a){return it?a.get(B).getValue("window.nativeTabs")===!0:!1}var gTo=function(a){if(dze(a))return a.get(To).newWindowTab()},fTo=function(a){if(dze(a))return a.get(To).showPreviousWindowTab()},vTo=function(a){if(dze(a))return a.get(To).showNextWindowTab()},bTo=function(a){if(dze(a))return a.get(To).moveWindowTabToNewWindow()},STo=function(a){if(dze(a))return a.get(To).mergeAllWindowTabs()},ITo=function(a){if(dze(a))return a.get(To).toggleWindowTabsBar()},x8t=class a extends K{static{this.ID="workbench.action.toggleWindowAlwaysOnTop"}constructor(){super({id:a.ID,title:L(16365,"Toggle Window Always on Top"),f1:!0,precondition:sw})}async run(i){let e=i.get(To),t=Ki();if(Cy(t.window))return e.toggleWindowAlwaysOnTop({targetWindowId:Ki().vscodeWindowId})}},k8t=class a extends K{static{this.ID="workbench.action.enableWindowAlwaysOnTop"}constructor(){super({id:a.ID,title:d(16357,null),icon:M.pin,menu:{id:D.LayoutControlMenu,when:x.and(vce.toNegated(),Xc),order:1}})}async run(i){let e=i.get(To),t=Ki();if(Cy(t.window))return e.setWindowAlwaysOnTop(!0,{targetWindowId:t.vscodeWindowId})}},E8t=class a extends K{static{this.ID="workbench.action.disableWindowAlwaysOnTop"}constructor(){super({id:a.ID,title:d(16356,null),icon:M.pinned,menu:{id:D.LayoutControlMenu,when:x.and(vce,Xc),order:1}})}async run(i){let e=i.get(To),t=Ki();if(Cy(t.window))return e.setWindowAlwaysOnTop(!1,{targetWindowId:t.vscodeWindowId})}};var yTo=L(16347,"Shell Command"),T8t=class extends K{constructor(){super({id:"workbench.action.installCommandLine",title:L(16346,"Install '{0}' command in PATH",to.applicationName),category:yTo,f1:!0})}async run(i){let e=i.get(To),t=i.get(ct),o=i.get(nt);try{await e.installShellCommand(),t.info(d(16349,null,o.applicationName))}catch(n){if(so(n))return;t.error(In(n))}}},_8t=class extends K{constructor(){super({id:"workbench.action.uninstallCommandLine",title:L(16350,"Uninstall '{0}' command from PATH",to.applicationName),category:yTo,f1:!0})}async run(i){let e=i.get(To),t=i.get(ct),o=i.get(nt);try{await e.uninstallShellCommand(),t.info(d(16348,null,o.applicationName))}catch(n){if(so(n))return;t.error(In(n))}}};(function(){if(W(b8t),W(S8t),W(I8t),W(w8t),W(C8t),W(Ect),W(v8t),W(x8t),W(k8t),W(E8t),it&&yt.registerKeybindingRule({id:Ect.ID,weight:200,when:x.and(wce.toNegated(),oYi),primary:2101}),it&&(W(T8t),W(_8t)),yt.registerCommandAndKeybindingRule({id:"workbench.action.quit",weight:200,async handler(i){let e=i.get(To),o=i.get(B).getValue("window.confirmBeforeClose");(o==="always"||o==="keyboardOnly"&&bf.getInstance().isModifierPressed)&&!await PG.confirmOnShutdown(i,2)||e.quit()},when:void 0,mac:{primary:2095},linux:{primary:2095}}),it)for(let i of[{handler:gTo,id:"workbench.action.newWindowTab",title:L(16397,"New Window Tab")},{handler:fTo,id:"workbench.action.showPreviousWindowTab",title:L(16405,"Show Previous Window Tab")},{handler:vTo,id:"workbench.action.showNextWindowTab",title:L(16404,"Show Next Window Tab")},{handler:bTo,id:"workbench.action.moveWindowTabToNewWindow",title:L(16396,"Move Window Tab to New Window")},{handler:STo,id:"workbench.action.mergeAllWindowTabs",title:L(16394,"Merge All Windows")},{handler:ITo,id:"workbench.action.toggleWindowTabsBar",title:L(16409,"Toggle Window Tabs Bar")}])qe.registerCommand(i.id,i.handler),fe.appendMenuItem(D.CommandPalette,{command:i,when:x.equals("config.window.nativeTabs",!0)});W(p8t),W(u8t),W(d8t),W(m8t),W(h8t),W(g8t),W(f8t)})();(function(){fe.appendMenuItem(D.MenubarFileMenu,{group:"z_Exit",command:{id:"workbench.action.quit",title:d(16395,null)},order:1,when:Cyt.toNegated()})})();(function(){let i=oe.as(ii.Configuration);i.registerConfiguration({...W_t,properties:{"application.shellEnvironmentResolutionTimeout":{type:"number",default:10,minimum:1,maximum:120,included:!ri,scope:1,markdownDescription:d(16371,null)}}}),i.registerConfiguration({id:"window",order:8,title:d(16446,null),type:"object",properties:{"window.confirmSaveUntitledWorkspace":{type:"boolean",default:!0,description:d(16389,null)},"window.openWithoutArgumentsInNewWindow":{type:"string",enum:["on","off"],enumDescriptions:[d(16440,null),d(16439,null)],default:it?"off":"on",scope:1,markdownDescription:d(16399,null)},"window.restoreWindows":{type:"string",enum:["preserve","all","folders","one","none"],enumDescriptions:[d(16445,null),d(16441,null),d(16442,null),d(16444,null),d(16443,null)],default:"all",scope:1,description:d(16401,null)},"window.restoreFullscreen":{type:"boolean",default:!1,scope:1,description:d(16400,null)},"window.zoomLevel":{type:"number",default:0,minimum:nct,maximum:oct,markdownDescription:d(16447,null,"`#window.zoomPerWindow#`"),ignoreSync:!0,tags:["accessibility"]},"window.zoomPerWindow":{type:"boolean",default:!0,markdownDescription:d(16448,null,"`#window.zoomLevel#`"),tags:["accessibility"]},"window.newWindowDimensions":{type:"string",enum:["default","inherit","offset","maximized","fullscreen"],enumDescriptions:[d(16434,null),d(16436,null),d(16438,null),d(16437,null),d(16435,null)],default:"default",scope:1,description:d(16398,null)},"window.closeWhenEmpty":{type:"boolean",default:!1,description:d(16388,null)},"window.doubleClickIconToClose":{type:"boolean",default:!1,scope:1,markdownDescription:d(16423,null,"`#window.titleBarStyle#`")},"window.titleBarStyle":{type:"string",enum:["native","custom"],default:"custom",scope:1,description:d(16408,null)},"window.controlsStyle":{type:"string",enum:["native","custom","hidden"],default:"native",included:!it,scope:1,description:d(16390,null)},"window.customTitleBarVisibility":{type:"string",enum:["auto","windowed","never"],markdownEnumDescriptions:[d(16420,null),d(16422,null),d(16421,null,"`#window.titleBarStyle#`")],default:"auto",scope:1,markdownDescription:d(16419,null,"`#window.titleBarStyle#`")},"window.menuStyle":{type:"string",enum:["custom","native","inherit"],markdownEnumDescriptions:it?[d(16426,null),d(16431,null),d(16428,null,"`#window.titleBarStyle#`")]:[d(16425,null),d(16430,null,"`#window.titleBarStyle#`","`custom`"),d(16427,null,"`#window.titleBarStyle#`")],default:to.quality!=="stable"?"inherit":it?"native":"inherit",scope:1,markdownDescription:it?d(16429,null,"`#window.titleBarStyle#`"):d(16424,null,"`#window.titleBarStyle#`")},"window.dialogStyle":{type:"string",enum:["native","custom"],default:"native",scope:1,description:d(16391,null)},"window.nativeTabs":{type:"boolean",default:!1,scope:1,description:d(16433,null),included:it},"window.nativeFullScreen":{type:"boolean",default:!0,description:d(16432,null),scope:1,included:it},"window.clickThroughInactive":{type:"boolean",default:!0,scope:1,description:d(16418,null),included:it},"window.border":{type:"string",default:"default",markdownDescription:(()=>{let e=d(16415,null);return e+=`
- `+[d(16413,null,"`default`"),d(16417,null,"`system`"),d(16414,null,"`off`"),d(16412,null,"`<color>`")].join(`
- `),e+=`

`+d(16416,null,"`#workbench.colorCustomizations#`","`#window.titleBarStyle#`","`native`"),e})(),included:ri}}}),i.registerConfiguration({id:"telemetry",order:110,title:d(16407,null),type:"object",properties:{"telemetry.enableCrashReporter":{type:"boolean",description:d(16406,null),default:!0,tags:["usesOnlineServices","telemetry"],markdownDeprecationMessage:d(16392,null,`\`#${bN}#\``)}}}),i.registerConfiguration({id:"keyboard",order:15,type:"object",title:d(16393,null),properties:{"keyboard.touchbar.enabled":{type:"boolean",default:!0,description:d(16410,null),included:it},"keyboard.touchbar.ignored":{type:"array",items:{type:"string"},default:[],markdownDescription:d(16411,null),included:it}}}),i.registerConfiguration({...WQe,properties:{"security.promptForLocalFileProtocolHandling":{type:"boolean",default:!0,markdownDescription:d(16402,null),scope:1},"security.promptForRemoteFileProtocolHandling":{type:"boolean",default:!0,markdownDescription:d(16403,null),scope:1}}})})();(function(){let i="vscode://schemas/argv",e=oe.as(ea.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(16382,null)},"disable-lcd-text":{type:"boolean",description:d(16375,null)},"proxy-bypass-list":{type:"string",description:d(16385,null)},"disable-hardware-acceleration":{type:"boolean",description:d(16374,null)},"force-color-profile":{type:"string",markdownDescription:d(16380,null)},"enable-crash-reporter":{type:"boolean",markdownDescription:d(16376,null)},"crash-reporter-id":{type:"string",markdownDescription:d(16372,null)},"enable-proposed-api":{type:"array",description:d(16378,null),items:{type:"string"}},"log-level":{type:["string","array"],description:d(16383,null)},"disable-chromium-sandbox":{type:"boolean",description:d(16373,null)},"use-inmemory-secretstorage":{type:"boolean",description:d(16387,null)},"remote-debugging-port":{type:"string",description:d(16386,null)},"js-flags":{type:"string",description:d(16381,null)}}};Wn&&(t.properties["force-renderer-accessibility"]={type:"boolean",description:d(16379,null)},t.properties["password-store"]={type:"string",description:d(16384,null)}),ri&&(t.properties["enable-rdp-display-tracking"]={type:"boolean",description:d(16377,null)}),e.registerSchema(i,t)})();var One=class extends CIe{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(gt.Info,e,[d(3567,null),d(3568,null)],t,1);n===0&&this.clipboardService.writeText(o)}async doShow(e,t,o,n,r,s,l,c,u){let p=new P,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)=>zM(this.openerService,y,w.isTrusted,!0))}));v.appendChild(S.element),S.element.classList.add(...b.classes||[])})}:void 0,g=new PJ(this.layoutService.activeContainer,t,o,mDe({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,One.ALLOWABLE_COMMANDS));p.add(g),u&&p.add(u.onCancellationRequested(()=>p.dispose()));let f=await g.show();return p.dispose(),f}};One=I([m(0,ne),m(1,nc),m(2,_e),m(3,F),m(4,Wi),m(5,Qe),m(6,Qn),m(7,oi)],One);var uze=class extends CIe{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(16450,null),d(16451,null)],targetWindowId:Ki().vscodeWindowId});n===0&&this.clipboardService.writeText(o)}};uze=I([m(0,ne),m(1,To),m(2,Wi)],uze);function wTo(a,i){let e=a.version;a.target?e=`${e} (${a.target} setup)`:a.darwinUniversalAssetId&&(e=`${e} (Universal)`);let t=r=>d(1870,null,e,a.commit||"Unknown",a.date?`${a.date}${r?" ("+Bs(new Date(a.date),!0)+")":""}`:"Unknown",cM.versions.electron,cM.versions["microsoft-build"],cM.versions.chrome,cM.versions.node,cM.versions.v8,`${i.type} ${i.arch} ${i.release}${rbe?" snap":""}`),o=t(!0),n=t(!1);return{title:a.nameLong,details:o,detailsToCopy:n}}var pze=class extends C{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(One)),this.nativeImpl=new co(()=>new uze(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=wTo(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}};pze=I([m(0,B),m(1,ct),m(2,ne),m(3,F),m(4,nt),m(5,Wi),m(6,To),m(7,Vt)],pze);pt(pze.ID,pze,ut.BlockStartup);var mze=class extends C{constructor(e,t){super();this.logService=e;this.progressService=t;this.saveParticipants=new Vs}addSaveParticipant(e){let t=this.saveParticipants.push(e);return Z(()=>t())}async participate(e,t,o,n){let r=new $e(n);e.textEditorModel?.pushStackElement(),o.report({message:d(17241,null)});let s=!1;if(await this.progressService.withProgress({priority:3,location:15,cancellable:d(17242,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 wa(p,r.token)}catch(p){so(p)?r.token.isCancellationRequested||(r.cancel(),s=!0):this.logService.error(p)}}},()=>{r.cancel()}),e.textEditorModel?.pushStackElement(),r.dispose(),s)throw new ho}dispose(){this.saveParticipants.clear(),super.dispose()}};mze=I([m(0,ne),m(1,Bo)],mze);var hze=class extends C{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 vt;this.mapResourceToModelListeners=new vt;this.mapResourceToDisposeListener=new vt;this.mapResourceToPendingModelResolvers=new vt;this.modelResolveQueue=this._register(new sU);this.saveErrorHandler=(()=>{let e=this.notificationService;return{onSaveError(t,o){e.error(d(17240,null,o.name,In(t,!1)))}}})();this.mapCorrelationIdToModelsToRestore=new Map;this.saveParticipants=this._register(this.instantiationService.createInstance(mze)),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=je(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 fn.settled(t.map(async o=>{let n=this.uriIdentityService.asCanonicalUri(o.target),r=await this.resolve(n,{reload:{async:!1},contents:o.snapshot?i_(o.snapshot):void 0,encoding:o.encoding});o.language?.id&&o.language.id!==Fr&&(o.language.explicit?r.setLanguageId(o.language.id):r.getLanguageId()===Fr&&ms(n)!==s$e&&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(bF,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 P;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&&(Ue(o),this.mapResourceToDisposeListener.delete(e));let n=this.mapResourceToModelListeners.get(e);n&&(Ue(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 H.toPromise(e.onDidChangeDirty),this.canDispose(e)):!0}dispose(){super.dispose(),this.mapResourceToModel.clear(),this.mapResourceToPendingModelResolvers.clear(),Ue(this.mapResourceToDisposeListener.values()),this.mapResourceToDisposeListener.clear(),Ue(this.mapResourceToModelListeners.values()),this.mapResourceToModelListeners.clear()}};hze=I([m(0,F),m(1,be),m(2,Ne),m(3,kp),m(4,dt)],hze);var NQ=class extends C{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(hze)),this.untitled=t,this.provideDecorations()}static{this.TEXTFILE_SAVE_CREATE_SOURCE=ph.registerSource("textFileCreate.source",d(17234,null))}static{this.TEXTFILE_SAVE_REPLACE_SOURCE=ph.registerSource("textFileOverwrite.source",d(17236,null))}provideDecorations(){let e=this._register(new class extends C{constructor(o){super();this.files=o;this.label=d(17235,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:uL,letter:M.lockSmall,strikethrough:!0,tooltip:d(17232,null)};if(r)return{letter:M.lockSmall,tooltip:d(17231,null)};if(s)return{color:uL,strikethrough:!0,tooltip:d(17227,null)}}}(this.files));this._register(this.decorationsService.registerDecorationsProvider(e))}get encoding(){return this._encoding||(this._encoding=this._register(this.instantiationService.createInstance(_ct))),this._encoding}async read(e,t){let[o,n]=await this.doRead(e,{...t,preferUnbuffered:!0});return{...o,encoding:n.detected.encoding||mb,value:await w6(n.stream,r=>r.join(""))}}async readStream(e,t){let[o,n]=await this.doRead(e,t);return{...o,encoding:n.detected.encoding||mb,value:await W9(n.stream)}}async doRead(e,t){let o=new $e,n;if(t?.preferUnbuffered){let r=await this.fileService.readFile(e,t,o.token);n={...r,value:WT(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 v_t(d(17228,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,ve.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===mb&&!r)return typeof t>"u"?void 0:mXi(t);t=t||"";let s=typeof t=="string"?Tke(t):t;return AXi(s,n,{addBOM:r})}async getDecodedStream(e,t,o){return(await this.doGetDecodedStream(e,t,o)).stream}doGetDecodedStream(e,t,o){return PXi(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===Y.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===Y.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 Xe(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}}],ve.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!==Y.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===Y.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 B_&&e.hasAssociatedFilePath&&l&&this.uriIdentityService.extUri.isEqual(o,Og(e.resource,this.environmentService.remoteAuthority,this.pathService.defaultUriScheme))?u=await this.confirmOverwrite(o):u=!0,!u)return!1;let p;e instanceof rw?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,i_(p.createSnapshot()));let g=p.getLanguageId(),f=h.getLanguageId();g!==Fr&&f===Fr&&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?NQ.TEXTFILE_SAVE_REPLACE_SOURCE:NQ.TEXTFILE_SAVE_CREATE_SOURCE}),c.save({...n,from:t})}async confirmOverwrite(e){let{confirmed:t}=await this.dialogService.confirm({type:"warning",message:d(17226,null,Ye(e)),detail:d(17230,null,Ye(e),Ye(ci(e))),primaryButton:d(17233,null)});return t}async confirmMakeWriteable(e){let{confirmed:t}=await this.dialogService.confirm({type:"warning",message:d(17224,null,Ye(e)),detail:d(17225,null),primaryButton:d(17229,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===Y.untitled){let r=this.untitled.get(e);if(r){if(r.hasAssociatedFilePath)return Og(e,t,this.pathService.defaultUriScheme);let s;await this.pathService.hasValidBasename(je(o,r.name),r.name)?s=r.name:s=Ye(e);let l=r.getLanguageId();l&&l!==Fr?n=this.suggestFilename(l,s):n=s}}return n||(n=Ye(e)),je(o,n)}suggestFilename(e,t){if(!this.languageService.getLanguageName(e))return t;let n=Am(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===Y.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===Y.untitled?this.untitled.get(e):this.files.get(e);return t?t.isDirty():!1}};NQ=I([m(0,be),m(1,H_),m(2,ao),m(3,F),m(4,Ct),m(5,Vt),m(6,ct),m(7,dn),m(8,Nn),m(9,lr),m(10,Kt),m(11,wn),m(12,kp),m(13,dt),m(14,kt),m(15,ne),m(16,aF),m(17,Cv)],NQ);var _ct=class extends C{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:mb}),e.push({extension:JN,encoding:mb}),e.push({parent:this.environmentService.untitledWorkspacesHome,encoding:mb}),this.contextService.getWorkspace().folders.forEach(t=>{e.push({parent:je(t.uri,".vscode"),encoding:mb})}),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===n5||o===r5||o===vV}}async getPreferredReadEncoding(e,t,o){let n;t?.encoding?o===vV&&t.encoding===mb?n=vV:n=t.encoding:typeof o=="string"?n=o:this.textResourceConfigurationService.getValue(e,"files.encoding")===vV&&(n=mb);let r=await this.getValidatedEncodingForResource(e,n);return{encoding:r,hasBOM:r===n5||r===r5||r===vV}}getUnvalidatedEncodingForResource(e,t){let o,n=this.getEncodingOverride(e);return n?o=n:t?o=t:o=this.textResourceConfigurationService.getValue(e,"files.encoding"),o||mb}async getValidatedEncodingForResource(e,t){let o=this.getUnvalidatedEncodingForResource(e,t);return o!==mb&&!await NXi(o)&&(o=mb),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&&ms(e)===`.${t.extension}`)return t.encoding}}};_ct=I([m(0,Nn),m(1,Vt),m(2,Pe),m(3,dt)],_ct);var Dct=class extends NQ{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(17243,null)})))}async onWillShutdown(){let i;for(;(i=this.files.models.filter(e=>e.hasState(2))).length>0;)await fn.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}};Dct=I([m(0,be),m(1,H_),m(2,ao),m(3,F),m(4,Ct),m(5,ps),m(6,ct),m(7,dn),m(8,Nn),m(9,lr),m(10,Kt),m(11,wn),m(12,kp),m(13,dt),m(14,kt),m(15,aF),m(16,ne),m(17,Cv)],Dct);we(Ho,Dct,0);var fze;(t=>{t.ID="workbench.action.files.openLocalFile",t.LABEL=d(16773,null);function e(){return o=>o.get(dn).pickFileAndOpen({forceNewWindow:!1,availableFileSystems:[Y.file]})}t.handler=e})(fze||={});var vze;(t=>{t.ID="workbench.action.files.saveLocalFile",t.LABEL=d(16793,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:[Y.file],reason:1}):Promise.resolve(void 0)}}t.handler=e})(vze||={});var bze;(t=>{t.ID="workbench.action.files.openLocalFolder",t.LABEL=d(16775,null);function e(){return o=>o.get(dn).pickFolderAndOpen({forceNewWindow:!1,availableFileSystems:[Y.file]})}t.handler=e})(bze||={});var Sze;(t=>{t.ID="workbench.action.files.openLocalFileFolder",t.LABEL=d(16774,null);function e(){return o=>o.get(dn).pickFileFolderAndOpen({forceNewWindow:!1,availableFileSystems:[Y.file]})}t.handler=e})(Sze||={});var Ize=new Q("remoteFileDialogVisible",!1),gze=class extends C{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.onBusyChangeEmitter=this._register(new E);this._showDotFiles=!0;this.remoteAuthority=this.environmentService.remoteAuthority,this.contextKey=Ize.bindTo(f),this.scheme=this.pathService.defaultUriScheme,this.getShowDotFiles();let S=this._register(new P);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.userHome=await this.getUserHome(),this.trueHome=await this.getUserHome(!0);let t=this.getOptions(e);return t?(this.options=t,this.pickResource()):Promise.resolve(void 0)}async showSaveDialog(e){this.scheme=this.getScheme(e.availableFileSystems,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(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?Ye(e.defaultUri):void 0),o||(o=this.userHome,n&&(o=je(o,n))),this.scheme!==Y.file&&!this.fileService.hasProvider(o)){this.notificationService.info(d(16781,null,o.toString()));return}let r=Xi(e);return r.defaultUri=o,r}remoteUriFrom(e,t){e.startsWith("\\\\")||(e=e.replace(/\\/g,"/"));let o=this.scheme===Y.file?A.file(e):A.from({scheme:this.scheme,path:e,query:t?.query,fragment:t?.fragment}),n=o.scheme===Y.file?void 0:this.remoteAuthority??t?.authority;return Og(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:Y.file}async getRemoteAgentEnvironment(){return this.remoteAgentEnvironment===void 0&&(this.remoteAgentEnvironment=await this.remoteAgentService.getEnvironment()),this.remoteAgentEnvironment}getUserHome(e=!1){return e?this.pathService.userHome({preferLocal:this.scheme===Y.file}):this.fileDialogService.preferredHome(this.scheme)}async pickResource(e=!1){this.allowFolderSelection=!!this.options.canSelectFolders,this.allowFileSelection=!!this.options.canSelectFiles,this.separator=this.labelService.getSeparator(this.scheme,this.remoteAuthority),this.hidden=!1,this.isWindows=await this.checkIsWindowsOS();let t=this.options.defaultUri?this.options.defaultUri:this.workspaceContextService.getWorkspace().folders[0].uri,o,n=ms(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=Ye(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(16782,null),this.filePickBox.ok=!0,this.filePickBox.okLabel=typeof this.options.openLabel=="string"?this.options.openLabel:this.options.openLabel?.withoutMnemonic,this.scheme!==Y.file&&this.options&&this.options.availableFileSystems&&this.options.availableFileSystems.length>1&&this.options.availableFileSystems.indexOf(Y.file)>-1){this.filePickBox.customButton=!0,this.filePickBox.customLabel=d(16780,null),this.filePickBox.customButtonSecondary=!0;let h;e?h=vze:h=this.allowFileSelection?this.allowFolderSelection?Sze:fze:bze;let g=this.keybindingService.lookupKeybinding(h.ID);if(g){let f=g.getLabel();f&&(this.filePickBox.customHover=id("{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&&(h=h$(h,this.separator),h=Rbe(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?h[0]:void 0)})}));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();mr(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(!mr(e,this.constructFullUserPath())&&(!this.isBadSubpath(e)||this.canTildaEscapeHatch(e))){this.filePickBox.validationMessage=void 0;let t=this.filePickBoxValue(),o=3;dx.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(M.eye):q.asClassName(M.eyeClosed),tooltip:this._showDotFiles?d(16778,null):d(16783,null),alwaysVisible:!0}]}isBadSubpath(e){return this.badPath&&e.length>this.badPath.length&&mr(e.substring(0,this.badPath.length),this.badPath)}isValueChangeFromUser(){return!mr(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 mr(this.filePickBox.value.substr(0,this.userEnteredPathSegment.length),this.userEnteredPathSegment)?mr(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(mr(this.filePickBox.value,t))return this.currentFolder;let o=this.remoteUriFrom(t,this.currentFolder),n=Fc(o,e),r=this.filePickBox.value.length>1&&t.length>1?mr(this.filePickBox.value.substr(0,2),t.substr(0,2)):!1;if(n&&r){let s=je(this.currentFolder,n),l=Ye(e);return(l==="."||l==="..")&&(s=this.remoteUriFrom(this.pathAppend(s,l),this.currentFolder)),Tre(e)?h$(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);Uk(o,this.filePickBox.value)&&mr(t.label,Ye(t.uri))?(this.filePickBox.valueSelection=[this.pathFromUri(this.currentFolder).length,this.filePickBox.value.length],this.insertText(o,this.basenameWithTrailingSlash(t.uri))):t.label===".."&&Uk(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(;!Xe(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]==="~"?je(t,e.substring(1)):this.canTildaEscapeHatch(e)?t:this.remoteUriFrom(e)}tryAddTrailingSeparatorToDirectory(e,t){return t.isDirectory&&!this.endsWithSlash(e.path)?h$(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=dx.isEqual(this.currentFolder,t),r=dx.isEqual(this.currentFolder,ci(t)),s=dx.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&&Ye(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(16776,null),this.badPath=e,4;{let u=ci(t),p=Rbe(h$(this.currentFolder)),h=Rbe(h$(u));if(!dx.isEqual(p,h)&&(!/^[a-zA-Z]:$/.test(this.filePickBox.value)||!mr(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,Ye(t))?1:0}}}}}return this.badPath=void 0,3}tryUpdateTrailing(e){let t=ms(e);this.trailing&&t&&(this.trailing=Ye(e))}setActiveItems(e){e=this.pathFromUri(this.tildaReplace(e));let t=this.remoteUriFrom(e),o=Ye(t),n=this.constructFullUserPath();if(mr(n,e.substring(0,n.length))||mr(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&&rh().execCommand("insertText",!1,""),!1):!n&&r.length>=t.length&&mr(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&&!mr(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()?(rh().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&&!Tre(e)){let o=!1,n=ms(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=je(ci(e),Ye(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 P,n=o.add(this.quickInputService.createQuickPick());n.title=t,n.ignoreFocusOut=!0,n.ok=!0,n.customButton=!0,n.customLabel=d(16777,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(16779,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(16788,null),Promise.resolve(!1);if(t){let n=d(16786,null,Ye(e));return this.yesNoPrompt(e,n)}else if(nU(Ye(e),this.isWindows))if(o)if(o.isDirectory){if(o.readonly)return this.filePickBox.validationMessage=d(16791,null),Promise.resolve(!1)}else return this.filePickBox.validationMessage=d(16790,null),Promise.resolve(!1);else{let n=d(16785,null,Ye(ci(e)));return this.yesNoPrompt(e,n)}else return this.filePickBox.validationMessage=d(16784,null),Promise.resolve(!1)}else if(t){if(e.path==="/"&&this.isWindows)return this.filePickBox.validationMessage=d(16792,null),Promise.resolve(!1);if(t.isDirectory&&!this.allowFolderSelection)return this.filePickBox.validationMessage=d(16787,null),Promise.resolve(!1);if(!t.isDirectory&&!this.allowFileSelection)return this.filePickBox.validationMessage=d(16789,null),Promise.resolve(!1)}else return this.filePickBox.validationMessage=d(16790,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=xn(async c=>{let u;try{u=await this.fileService.resolve(e),u.isDirectory||(o=Ye(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:h$(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,!mr(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=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(je(e,t))}async checkIsWindowsOS(){let e=ri,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){let t=this.currentFolder.with({scheme:Y.file,authority:""}),o=ci(t);if(!Xe(t,o)){let n=ci(e);if(await this.fileService.exists(n))return{label:"..",uri:h$(n,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=je(t,e.name);if(e.isDirectory){let r=Ye(n);return n=h$(n,this.separator),{label:r,uri:n,isFolder:!0,iconClasses:js(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:js(this.modelService,this.languageService,n||void 0)}}};gze=I([m(0,be),m(1,Ge),m(2,ot),m(3,Pe),m(4,Ne),m(5,dn),m(6,Ct),m(7,kt),m(8,Vt),m(9,yo),m(10,wn),m(11,_e),m(12,X),m(13,Bi),m(14,le)],gze);var yze=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===Y.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?Xl(o):(await this.pathService.path).isAbsolute(o)){let s=e?th(o):(await this.pathService.path).normalize(o),l=Og(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&&Vje(t,this.environmentService)&&!xx(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(16769,null);i.length===1?e=d(16770,null,typeof i[0]=="string"?i[0]:Ye(i[0])):(e=d(16771,null,i.length),t=Xw(i)+`
`+t);let{result:o}=await this.dialogService.prompt({type:gt.Warning,message:e,detail:t,buttons:[{label:i.length>1?d(16767,null):d(16766,null),run:()=>0},{label:d(16759,null),run:()=>1}],cancelButton:{run:()=>2}});return o}addFileSchemaIfNeeded(i,e){return i===Y.untitled?[Y.file]:i!==Y.file?[i,Y.file]:[i]}async pickFileFolderAndOpenSimplified(i,e,t){let o=d(16763,null),n=this.addFileSchemaIfNeeded(i),r=await this.pickResource({canSelectFiles:!0,canSelectFolders:!0,canSelectMany:!1,defaultUri:e.defaultUri,title:o,availableFileSystems:n});if(r){let s=await this.fileService.stat(r),l=s.isDirectory?{folderUri:r}:{fileUri:r};!nwe(l)&&D4i(l)&&this.addFileToRecentlyOpened(l.fileUri),s.isDirectory||e.forceNewWindow||t?await this.hostService.openWindow([l],{forceNewWindow:e.forceNewWindow,remoteAuthority:e.remoteAuthority}):await this.editorService.openEditors([{resource:r,options:{source:1,pinned:!0}}],void 0,{validateTrust:!0})}}async pickFileAndOpenSimplified(i,e,t){let o=d(16762,null),n=this.addFileSchemaIfNeeded(i),r=await this.pickResource({canSelectFiles:!0,canSelectFolders:!1,canSelectMany:!1,defaultUri:e.defaultUri,title:o,availableFileSystems:n});r&&(this.addFileToRecentlyOpened(r),e.forceNewWindow||t?await this.hostService.openWindow([{fileUri:r}],{forceNewWindow:e.forceNewWindow,remoteAuthority:e.remoteAuthority}):await this.editorService.openEditors([{resource:r,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(16764,null),o=this.addFileSchemaIfNeeded(i,!0),n=await this.pickResource({canSelectFiles:!1,canSelectFolders:!0,canSelectMany:!1,defaultUri:e.defaultUri,title:t,availableFileSystems:o});if(n)return this.hostService.openWindow([{folderUri:n}],{forceNewWindow:e.forceNewWindow,remoteAuthority:e.remoteAuthority})}async pickWorkspaceAndOpenSimplified(i,e){let t=d(16765,null),o=[{name:d(16760,null),extensions:[JN]}],n=this.addFileSchemaIfNeeded(i,!0),r=await this.pickResource({canSelectFiles:!0,canSelectFolders:!1,canSelectMany:!1,defaultUri:e.defaultUri,title:t,filters:o,availableFileSystems:n});if(r)return this.hostService.openWindow([{workspaceUri:r}],{forceNewWindow:e.forceNewWindow,remoteAuthority:e.remoteAuthority})}async pickFileToSaveSimplified(i,e){e.availableFileSystems||(e.availableFileSystems=this.addFileSchemaIfNeeded(i)),e.title=d(16772,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){e.availableFileSystems||(e.availableFileSystems=this.addFileSchemaIfNeeded(i,e.canSelectFolders));let t=await this.pickResource(e);return t?[t]:void 0}getSimpleFileDialog(){return this.instantiationService.createInstance(gze)}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(!Xe(t,t.with({path:"/"}))&&La(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=[Y.file];return this.environmentService.remoteAuthority&&e.unshift(Y.vscodeRemote),e}getPickFileToSaveDialogOptions(i,e){let t={defaultUri:i,title:d(16768,null),availableFileSystems:e},o=i?ms(i):void 0,n,r=this.languageService.getSortedRegisteredLanguageNames(),s=si(r.map(({languageName:l,languageId:c})=>{let u=this.languageService.getExtensions(c);if(!u.length)return null;let p={name:l,extensions:Uo(u).slice(0,10).map(g=>qD(g,"."))},h=o||s$e;if(!n&&u.includes(h)){n=p;let g=qD(h,".");return p.extensions.includes(g)||p.extensions.unshift(g),null}return p}));return!n&&o&&(n={name:qD(o,".").toUpperCase(),extensions:[qD(o,".")]}),t.filters=si([{name:d(16758,null),extensions:["*"]},n,...s,{name:d(16761,null),extensions:[""]}]),t}};yze=I([m(0,oi),m(1,Pe),m(2,zs),m(3,Vt),m(4,F),m(5,B),m(6,be),m(7,Qe),m(8,ct),m(9,kt),m(10,Ff),m(11,ot),m(12,wn),m(13,ge),m(14,ee),m(15,Kt),m(16,ne),m(17,yo)],yze);var Lct=class extends yze{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!==Y.file&&e!==Y.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}};Lct=I([m(0,oi),m(1,Pe),m(2,zs),m(3,Vt),m(4,F),m(5,B),m(6,be),m(7,Qe),m(8,To),m(9,ct),m(10,kt),m(11,Ff),m(12,ot),m(13,wn),m(14,ge),m(15,ee),m(16,Kt),m(17,ne),m(18,yo)],Lct);we(dn,Lct,1);var Rct=class{constructor(i,e){return dd.toService(i.getChannel("workspaces"),{context:e.windowId})}};Rct=I([m(0,Lu),m(1,To)],Rct);we(Ff,Rct,1);nx(n8t,"menubar");var D8t=class{constructor(i){this.channel=i;this.disposables=new P;this._onStateChange=this.disposables.add(new E);this.onStateChange=this._onStateChange.event;this._state=HJi.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()}};nx(zd,"update",{channelClientCtor:D8t});var L8t=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 aVi=class extends C{constructor(){super(...arguments);this.handlers=new Set}open(e,t){let o=[...this.handlers.values()];return Lre(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))}},wze=class extends aVi{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})}};wze=I([m(0,nt)],wze);var Mct=class extends wze{constructor(e,t,o,n,r){super(n);this.nativeHostService=o;this.logService=r;this.urlService=dd.toService(e.getChannel("url")),e.registerChannel("urlHandler",new L8t(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 jd(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}};Mct=I([m(0,Lu),m(1,Qe),m(2,To),m(3,nt),m(4,ne)],Mct);we(nI,Mct,0);function R8t(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);FT(o)&&e.push(o.then(n=>{n&&(t=!0)},n=>{i(n),t=!0}))}return fn.settled(e).then(()=>t)}var NG=class extends C{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(NG.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(NG.LAST_SHUTDOWN_REASON_KEY,1);this.storageService.remove(NG.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,sn(`code/LifecyclePhase/${N6i(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 Np,this.phaseWhen.set(e,t)),await t.wait()}};NG=I([m(0,ne),m(1,le)],NG);var Fne=class extends NG{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;el.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(),el.send(n.cancelChannel,e)):(this.logService.trace("[lifecycle] onBeforeUnload continues without veto"),this.shutdownReason=n.reason,el.send(n.okChannel,e))}),el.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(),el.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=nn(()=>{t.warn(`[lifecycle] onBeforeShutdown is taking a long time, pending operations: ${Array.from(n).join(", ")}`)},Fne.BEFORE_SHUTDOWN_WARNING_DELAY);try{let c=await R8t(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: ${In(e)})`),this._onBeforeShutdownError.fire({reason:t,error:e})}async handleWillShutdown(e){this._willShutdown=!0;let t=[],o=[],n=new Set,r=new $e;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=nn(()=>{this.logService.warn(`[lifecycle] onWillShutdown is taking a long time, pending operations: ${Array.from(n).map(l=>l.id).join(", ")}`)},Fne.WILL_SHUTDOWN_WARNING_DELAY);try{await wa(fn.settled(t),r.token)}catch(l){this.logService.error(`[lifecycle]: Error during will-shutdown phase in default joiners (error: ${In(l)})`)}try{await wa(fn.settled(o.map(l=>l())),r.token)}catch(l){this.logService.error(`[lifecycle]: Error during will-shutdown phase in last joiners (error: ${In(l)})`)}s.dispose()}shutdown(){return this.nativeHostService.closeWindow()}};Fne=I([m(0,To),m(1,le),m(2,ne)],Fne);we(ao,Fne,0);var Cze=class{constructor(i,e){this.windowId=i;return dd.toService(e.getChannel("nativeHost"),{context:i,properties:(()=>{let t=new Map;return t.set("windowId",i),t})()})}};Cze=I([m(1,Lu)],Cze);async function CTo(a,i,e){let t=await imn(i.title,{detail:i.body,sticky:!i.silent});if(!t)return{supported:!1,clicked:!1};let o=new P;a.onDidCreateToast(t);let n=new $e(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}))),H.once(t.onClick)(()=>s({supported:!0,clicked:!0})),H.once(t.onClose)(()=>s({supported:!0,clicked:!1})),H.once(t.onError)(()=>s({supported:!1,clicked:!1}))})}async function imn(a,i){if(await Notification.requestPermission()!=="granted")return;let t=new P,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 Pct=class extends Cze{constructor(i,e){super(i.window.id,e)}};Pct=I([m(0,ps),m(1,Lu)],Pct);var xze=class extends C{constructor(e,t,o){super();this.nativeHostService=e;this.labelService=t;this.environmentService=o;this._nativeWindowHandleCache=new Map;this.activeBrowserToasts=this._register(new ibe);this.onDidChangeFocus=H.latch(H.any(H.map(H.filter(this.nativeHostService.onDidFocusMainOrAuxiliaryWindow,n=>E6(n),this._store),()=>this.hasFocus,this._store),H.map(H.filter(this.nativeHostService.onDidBlurMainOrAuxiliaryWindow,n=>E6(n),this._store),()=>this.hasFocus,this._store),H.map(this.onDidChangeActiveWindow,()=>this.hasFocus,this._store)),void 0,this._store),this.onDidChangeFullScreen=H.filter(this.nativeHostService.onDidChangeWindowFullScreen,n=>E6(n.windowId),this._store),this.registerListeners()}registerListeners(){this._register(this.onDidChangeFocus(e=>{e&&this.clearToasts()}))}get hasFocus(){return rh().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(H.filter(this.nativeHostService.onDidFocusMainOrAuxiliaryWindow,t=>E6(t),this._store)(t=>e.fire(t))),this._register(Fg(({window:t,disposables:o})=>{o.add(MI(t,()=>{let n=t.document.hasFocus();return n&&e.fire(t.vscodeWindowId),n},100,20))})),H.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 _4i(e)?this.labelService.getWorkspaceLabel(e.folderUri,{verbose:2}):nwe(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:Cy(e)?e.vscodeWindowId:void 0})}async moveTop(e){if(!(Kbe()<=1))return this.nativeHostService.moveWindowTop(Cy(e)?{targetWindowId:e.vscodeWindowId}:void 0)}async setWindowDimmed(e,t){return this.nativeHostService.updateWindowControls({dimmed:t,targetWindowId:sg(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:sg(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=_t(),n=t.onCancellationRequested(()=>this.nativeHostService.clearToast(o));try{let r=await this.nativeHostService.showToast({...e,id:o});return r.supported?r:await CTo({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([mi],xze.prototype,"onDidChangeActiveWindow",1),xze=I([m(0,To),m(1,ot),m(2,Vt)],xze);we(oi,xze,1);we(To,Pct,1);var kze=class extends Pne{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,t,o,n,r,s,l,c,u,p);this.nativeHostService=h;this.handleWindowsAlwaysOnTop(t.vscodeWindowId,u)}async handleWindowsAlwaysOnTop(e,t){let o=vce.bindTo(t);this._register(this.nativeHostService.onDidChangeWindowAlwaysOnTop(({windowId:n,alwaysOnTop:r})=>{n===e&&o.set(r)})),o.set(await this.nativeHostService.isWindowAlwaysOnTop({targetWindowId:e}))}updateStyles(){super.updateStyles(),this.element&&aii(this.configurationService)&&(!this.cachedWindowControlStyles||this.cachedWindowControlStyles.bgColor!==this.element.style.backgroundColor||this.cachedWindowControlStyles.fgColor!==this.element.style.color)&&(this.cachedWindowControlStyles={bgColor:this.element.style.backgroundColor,fgColor:this.element.style.color},this.nativeHostService.updateWindowControls({targetWindowId:sg(Me(this.element)),backgroundColor:this.element.style.backgroundColor,foregroundColor:this.element.style.color}))}layout(e,t){if(super.layout(e,t),aii(this.configurationService)){let o=Math.round(t*yS(Me(this.element)));o!==this.cachedWindowControlHeight&&(this.cachedWindowControlHeight=o,this.nativeHostService.updateWindowControls({targetWindowId:sg(Me(this.element)),height:o}))}}};kze=I([m(2,ze),m(3,B),m(4,F),m(5,De),m(6,le),m(7,fi),m(8,X),m(9,oi),m(10,To)],kze);var Act=class extends kze{constructor(i,e,t,o,n,r,s,l,c){super("workbench.parts.titlebar",It,i,e,t,o,n,r,s,l,c)}};Act=I([m(0,ze),m(1,B),m(2,F),m(3,De),m(4,le),m(5,fi),m(6,X),m(7,oi),m(8,To)],Act);var wve=class extends kze{constructor(e,t,o,n,r,s,l,c,u,p,h){let g=wve.COUNTER++;super(`workbench.parts.auxiliaryTitle.${g}`,Me(e),o,n,r,s,l,c,u,p,h);this.container=e;this.mainTitlebar=t}static{this.COUNTER=1}get height(){return this.minimumHeight}get preventZoom(){return yS(Me(this.element))<1||!this.mainTitlebar.hasZoomableElements}};wve=I([m(2,ze),m(3,B),m(4,F),m(5,De),m(6,le),m(7,fi),m(8,X),m(9,oi),m(10,To)],wve);var M8t=class extends Ane{createMainTitlebarPart(){return this.instantiationService.createInstance(Act)}doCreateAuxiliaryTitlebarPart(i,e,t){return t.createInstance(wve,i,this.mainPart)}};we(qP,M8t,0);var xTo="meteredConnection";var Nct=class extends BMt{constructor(i,e){super(i,Rgi()),this._channel=e.getChannel(xTo);let t=navigator.connection;if(t){let o=()=>this.setIsBrowserConnectionMetered(Rgi());t.addEventListener("change",o),this._register(Z(()=>t.removeEventListener("change",o)))}}onChangeBrowserConnection(){super.onChangeBrowserConnection(),this._channel.call("SetIsBrowserConnectionMetered",this.isBrowserConnectionMetered)}};Nct=I([m(0,B),m(1,Lu)],Nct);we(eJ,Nct,1);async function kTo(a,i,e){if(i.isCancellationRequested)throw CI();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:omn(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:nmn(s)},stream:WT(Je.wrap(new Uint8Array(await s.arrayBuffer())))}}catch(r){throw e&&!e()?new iXe:r?.name==="AbortError"?CI():r?.name==="TimeoutError"?new Error(`Fetch timeout: ${a.timeout}ms`):r}finally{o.dispose()}}function omn(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 nmn(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 Oct=class extends HEt{constructor(e,t,o){let n=o.createLogger("network",{name:d(17202,null),group:vR}),r=new Cne(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,()=>kTo(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()}};Oct=I([m(0,To),m(1,B),m(2,ol)],Oct);we(_a,Oct,1);var OQ=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 it?this.nativeHostService.readClipboardFindText():""}async writeFindText(i){if(it)return this.nativeHostService.writeClipboardFindText(i)}async writeResources(i){if(i.length)return this.nativeHostService.writeClipboardBuffer(OQ.FILE_FORMAT,this.resourcesToBuffer(i))}async readResources(){return this.bufferToResources(await this.nativeHostService.readClipboardBuffer(OQ.FILE_FORMAT))}async hasResources(){return this.nativeHostService.hasClipboard(OQ.FILE_FORMAT)}resourcesToBuffer(i){return Je.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[]}}};OQ=I([m(0,To),m(1,ne)],OQ);we(Wi,OQ,1);var ETo="vscode:contextmenu",TTo="vscode:onCloseContextMenu";var rmn=0;function _To(a,i,e){let t=[],o=rmn++,n=`vscode:onContextMenu${o}`,r=(s,...l)=>{let c=l[0],u=l[1];t[c].click?.(u)};el.once(n,r),el.once(TTo,(s,...l)=>{l[0]===o&&(el.removeListener(n,r),e?.())}),el.send(ETo,o,a.map(s=>DTo(s,t)),n,i)}function DTo(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=>DTo(t,i))),e}var P8t=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=Pn();let t,o=Ao(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 P,l=i.actionRunner||s.add(new as);l.onWillRun(u=>this.onActionRun(u,!i.skipTelemetry),this,s),l.onDidRun(this.onDidActionRun,this,s),t=new PQ(n,e,{actionViewItemProvider:i.getActionViewItem,context:i.getActionsContext?i.getActionsContext():null,actionRunner:l,getKeyBinding:i.getKeyBinding?i.getKeyBinding:u=>this.keybindingService.lookupKeybinding(u.id)},PSt),t.onDidCancel(()=>this.contextViewService.hideContextView(!0),null,s),t.onDidBlur(()=>this.contextViewService.hideContextView(!0),null,s);let c=Me(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 yn(c,u),h=p.target;if(!p.rightButton){for(;h;){if(h===n)return;h=h.parentElement}this.contextViewService.hideContextView(!0)}})),hn(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&&(Pn()===this.lastContainer||gs(Pn(),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&&!so(i.error)&&this.notificationService.error(i.error)}};var Eze=class extends C{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 P8t(this.contextViewService,this.telemetryService,this.notificationService,this.keybindingService)),this._contextMenuHandler}configure(e){this.contextMenuHandler.configure(e)}showContextMenu(e){e=A8t.transform(e,this.menuService,this.contextKeyService),this.contextMenuHandler.showContextMenu({...e,onHide:t=>{e.onHide?.(t),this._onDidHideContextMenu.fire()}}),bf.getInstance().resetKeyStatus(),this._onDidShowContextMenu.fire()}};Eze=I([m(0,Te),m(1,Ne),m(2,_n),m(3,_e),m(4,qt),m(5,X)],Eze);var A8t;(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=Uc(u)}return t.getActions?li.join(t.getActions(),c):c}}}e.transform=i})(A8t||={});var Fct=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 Wct(i,e,t,r,s):new Eze(e,i,n,t,r,s)}let c=HS(o);this.impl=l(c),it&&(this.listener=o.onDidChangeConfiguration(u=>{if(!u.affectsConfiguration("window.menuStyle"))return;let p=HS(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)}};Fct=I([m(0,Ne),m(1,Te),m(2,_e),m(3,B),m(4,_n),m(5,qt),m(6,X)],Fct);var Wct=class extends C{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=A8t.transform(e,this.menuService,this.contextKeyService);let t=e.getActions();if(t.length){let o=wd(()=>{e.onHide?.(!1),bf.getInstance().resetKeyStatus(),this._onDidHideContextMenu.fire()}),n=this.createMenu(e,t,o),r=e.getAnchor(),s,l,c=yS(Ao(r)?Me(r):Ki());if(Ao(r)){let u=r.getBoundingClientRect(),p={left:u.left,top:u.top,width:u.width,height:u.height},h=Me(r),g=h.innerWidth,f=h.innerHeight,v=u.left<0||u.top<0||u.right>g||u.bottom>f;c*=_6(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),it||Me(r).screen.height-l<t.length*(ri?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),it&&(l+=4/c)}else Nti(r)&&(s=r.x,l=r.y);typeof s=="number"&&(s=Math.floor(s*c)),typeof l=="number"&&(l=Math.floor(l*c)),_To(n,{x:s,y:l,positioningItem:e.autoSelectFirstItem?0:void 0},()=>o()),this._onDidShowContextMenu.fire()}}createMenu(e,t,o,n=new Set){return si(t.map(r=>this.createMenuItem(e,r,o,n)))}createMenuItem(e,t,o,n){if(t instanceof li)return{type:"separator"};if(t instanceof $l){if(n.has(t.id)){console.warn(`Found submenu cycle: ${t.id}`);return}return{label:eqe(fu(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:eqe(fu(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)}}};Wct=I([m(0,Ne),m(1,Te),m(2,_e),m(3,qt),m(4,X)],Wct);we(ze,Fct,1);var N8t=class{constructor(i,e,t,o){this._contributedVariables=new Map;this.resolvableVariables=new Set(Tto);this._context=i,this._labelService=e,this._userHomePromise=t,o&&(this._envVariablesPromise=o.then(n=>this.prepareEnv(n)))}prepareEnv(i){if(ri){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=cS.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=cS.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 Bf(p,d(16743,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 Bf(p,d(16744,null,i.id,No(h)))},u=p=>{if(s){let h=this._context.getFolderUri(s);if(h)return h;throw new Bf(p,d(16741,null,p,s))}if(e)return e;throw this._context.getWorkspaceFolderCount()>1?new Bf(p,d(16749,null,p)):new Bf(p,d(16748,null,p))};switch(r){case"env":if(s){if(n.env){let p=n.env[ri?s.toLowerCase():s];if(Ae(p))return p}return""}throw new Bf("env",d(16754,null,i.id));case"config":if(s){let p=this._context.getConfigurationValue(e,s);if(Jn(p))throw new Bf("config",d(16751,null,i.id,s));if(yi(p))throw new Bf("config",d(16750,null,i.id,s));return p}throw new Bf("config",d(16753,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 Bf("extensionInstallFolder",d(16752,null,i.id,s));return this.fsPath(p.extensionLocation)}throw new Bf("extensionInstallFolder",d(16755,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 fre();let p=u("cwd");return p?Hp(this.fsPath(p)):void 0}case"workspaceRootFolderName":case"workspaceFolderBasename":{let p=u("workspaceFolderBasename");return p?Hp(No(this.fsPath(p))):void 0}case"userHome":if(n.userHome)return n.userHome;throw new Bf("userHome",d(16747,null,i.id));case"lineNumber":{let p=this._context.getLineNumber();if(p)return p;throw new Bf("lineNumber",d(16745,null,i.id))}case"columnNumber":{let p=this._context.getColumnNumber();if(p)return p;throw new Error(d(16742,null,i.id))}case"selectedText":{let p=this._context.getSelectedText();if(p)return p;throw new Bf("selectedText",d(16746,null,i.id))}case"file":return l("file");case"fileWorkspaceFolder":return c("fileWorkspaceFolder");case"fileWorkspaceFolderBasename":return No(c("fileWorkspaceFolderBasename"));case"relativeFile":return e||s?SM(this.fsPath(u("relativeFile")),l("relativeFile")):l("relativeFile");case"relativeFileDirname":{let p=wc(l("relativeFileDirname"));if(e||s){let h=SM(this.fsPath(u("relativeFileDirname")),p);return h.length===0?".":h}return p}case"fileDirname":return wc(l("fileDirname"));case"fileExtname":return Am(l("fileExtname"));case"fileBasename":return No(l("fileBasename"));case"fileBasenameNoExtension":{let p=No(l("fileBasenameNoExtension"));return p.slice(0,p.length-Am(p).length)}case"fileDirnameBasename":return No(wc(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 Rd;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 Bf(i,d(16756,null,e))}return e}};var LTo="configResolveInputLru",smn=5,O8t=class extends N8t{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=no.getOriginalUri(o.activeEditor,{supportSideBySide:1,filterByScheme:[Y.file,Y.vscodeUserData,this.pathService.defaultUriScheme]});if(g)return this.labelService.getUriLabel(g,{noPrefix:!0})},getWorkspaceFolderPathForFile:()=>{let g=no.getOriginalUri(o.activeEditor,{supportSideBySide:1,filterByScheme:[Y.file,Y.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(Ec(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 Op;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=cS.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=cS.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(!Jn(p)){if(typeof p!="string")throw new Bf("command",d(16719,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(ht.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(LTo,1),t=new il(smn);try{e&&t.fromJSON(JSON.parse(e))}catch{}return t}storeInputLru(e){this.storageService.store(LTo,JSON.stringify(e.toJSON()),1,1)}async showUserInput(e,t,o,n){if(!o)throw new Bf("input",d(16723,null,t,"inputs"));let r=o.filter(s=>s.id===t).pop();if(r){let s=p=>{throw new Bf("input",d(16722,null,t,r.type,p))},l=this.readInputLru(),c=`${e}.${t}`,u=l.get(c);switch(r.type){case"promptString":{Ae(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(Ae(r.description)||s("description"),Array.isArray(r.options))for(let g of r.options)!Ae(g)&&!Ae(g.value)&&s("value");else s("options");let p=new Array;for(let g of r.options){let f=Ae(g)?g:g.value,v=Ae(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(16721,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 Ae(r.command)||s("command"),this.userInputAccessQueue.queue(()=>this.commandService.executeCommand(r.command,r.args)).then(p=>{if(typeof p=="string"||Jn(p))return{value:p,input:r};throw new Bf("input",d(16720,null,t,r.command))});default:throw new Bf("input",d(16725,null,t))}}throw new Bf("input",d(16724,null,t))}};var Cve=ae("shellEnvironmentService"),lVi=class{getShellEnv(){return cM.shellEnv()}};we(Cve,lVi,1);var Vct=class extends O8t{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)}};Vct=I([m(0,ee),m(1,ps),m(2,B),m(3,ge),m(4,Pe),m(5,Ge),m(6,ot),m(7,Cve),m(8,wn),m(9,lt),m(10,le)],Vct);we(sp,Vct,1);var Tze=class extends C{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=It.matchMedia("(prefers-reduced-motion: reduce)");this._systemMotionReduced=r.matches,this._configMotionReduced=this._configurationService.getValue("workbench.reduceMotion");let s=It.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){Jo(e)}status(e){Or(e)}};Tze=I([m(0,X),m(1,nc),m(2,B)],Tze);var Bct=class extends Tze{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(!ri)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)}};Bct=I([m(0,ps),m(1,X),m(2,B),m(3,nc),m(4,Te),m(5,To)],Bct);we(Bi,Bct,1);var _ze=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)}};_ze=I([m(0,zf),m(1,Bi),m(2,ps)],_ze);Wn&&pt(_ze.ID,_ze,ut.BlockRestore);var F8t=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 W8t=class a extends vZ{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 vp.toString(i)}_getLabel(i){return i.isDuplicateModifierCase()?"":this._keyCodeToUILabel(i.keyCode)}_getAriaLabel(i){return i.isDuplicateModifierCase()?"":vp.toString(i.keyCode)}_getElectronAccelerator(i){return vp.toElectronAccelerator(i.keyCode)}_getUserSettingsLabel(i){if(i.isDuplicateModifierCase())return"";let e=vp.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+=vp.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=Dy[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 Hb)return i;let e=this._scanCodeToKeyCode(i.scanCode);return e===0?null:new Hb(i.ctrlKey,i.shiftKey,i.altKey,i.metaKey,e)}static resolveKeybinding(i,e){let t=fDe(i.chords.map(o=>this._toKeyCodeChord(o)));return t.length>0?[new a(t,e)]:[]}};var Dze=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 Hb(e,i.shiftKey,t,i.metaKey,i.keyCode);return this.resolveKeybinding(new tU([o]))[0]}resolveKeybinding(i){return W8t.resolveKeybinding(i,this._OS)}};var Hct=[],V8t=class extends vZ{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||Dy[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}},xve=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+":""}${Bb.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=zct.getCharCode(this.getProducedCharCode(i));return e===0?" --- ":e>=768&&e<=879?"U+"+e.toString(16):"  "+String.fromCharCode(e)+"  "}},Uct=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+":""}${vp.toString(this.keyCode)}`}},cVi=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 xve(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 Uct(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 xve(!1,!1,!1,i)),t=this.lookupScanCodeCombo(new xve(!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}},zct=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 cVi,this._scanCodeToLabel=[],this._scanCodeToDispatch=[];let n=(u,p,h,g,f,v,b,S)=>{this._scanCodeKeyCodeMapper.registerIfUnknown(new xve(!!u,!!p,!!h,g),new Uct(!!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=Dy[u];p!==-1&&(r(0,0,0,u,p),this._scanCodeToLabel[u]=vp.toString(p),p===0||tN(p)?this._scanCodeToDispatch[u]=null:this._scanCodeToDispatch[u]=`[${Bb.toString(u)}]`)}let s={};{let u=[];for(let h in e)if(e.hasOwnProperty(h)){let g=Bb.toEnum(h);if(g===0||Dy[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[Bb.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=Bb.toEnum(u);if(p===0||Dy[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]=`[${Bb.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(Dy[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 xve(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:Bb.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 N=0,O=T.length;N<O;N++){let V=T[N],U,G=this._scanCodeKeyCodeMapper.lookupKeyCodeCombo(V);if(G.length===1)U="";else{let te=-1;for(let pe=0;pe<G.length;pe++)if(G[pe].equals(u)){te=pe+1;break}U=String(te)}let $=V.toString();N===0?i.push(`| ${this._leftPad(h,30)} | ${g} | ${this._leftPad($,25)} | ${this._leftPad(U,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(U,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 KD(i.ctrlKey,i.shiftKey,i.altKey,i.metaKey,46)];let e=this._scanCodeKeyCodeMapper.lookupKeyCodeCombo(new Uct(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 KD(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=Dy[i.scanCode];if(e!==-1)return vp.toUserSettingsUS(e).toLowerCase();let t=this._scanCodeKeyCodeMapper.guessStableKeyCode(i.scanCode);if(t!==-1){let o=this.keyCodeChordToScanCodeChord(new Hb(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 vp.toUserSettingsUS(t).toLowerCase()}return this._scanCodeToDispatch[i.scanCode]}getElectronAcceleratorLabelForScanCodeChord(i){if(!i)return null;let e=Dy[i.scanCode];if(e!==-1)return vp.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?vp.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 V8t(this,this._OS,c)):this._generateResolvedKeybindings(i,e+1,c,o)}}resolveKeyboardEvent(i){let e=Bb.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=Sbe[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=Sbe[t];s!==-1&&(e=s)}let o=i.ctrlKey||this._mapAltGrToCtrlAlt&&i.altGraphKey,n=i.altKey||this._mapAltGrToCtrlAlt&&i.altGraphKey,r=new KD(o,i.shiftKey,n,i.metaKey,e);return new V8t(this,this._OS,[r])}_resolveChord(i){return i?i instanceof KD?[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<Hct.length?Hct[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=Hct.length;o<i;o++)Hct[o]=null;Hct[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 RTo(a){let i=a.getValue("keyboard"),e=i?.dispatch==="keyCode"?1:0,t=!!i?.mapAltGrToCtrlAlt;return{dispatch:e,mapAltGrToCtrlAlt:t}}var amn=oe.as(ii.Configuration),lmn={id:"keyboard",order:15,type:"object",title:d(2107,null),properties:{"keyboard.dispatch":{scope:1,type:"string",enum:["code","keyCode"],default:"code",markdownDescription:d(2106,null),included:zo===2||zo===3},"keyboard.mapAltGrToCtrlAlt":{scope:1,type:"boolean",default:!1,markdownDescription:d(2108,null),included:zo===1}}};amn.registerConfiguration(lmn);var Kct=class extends C{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=RTo(this._configurationService);return e.dispatch===1?new Dze(e.mapAltGrToCtrlAlt,zo):(this._keyboardMapper||(this._keyboardMapper=new F8t(cmn(this.getCurrentKeyboardLayout(),this.getRawKeyboardMapping(),e.mapAltGrToCtrlAlt))),this._keyboardMapper)}validateCurrentKeyboardMapping(e){}};Kct=I([m(0,M3t),m(1,B)],Kct);function cmn(a,i,e){let t=dmn(a);return zo===1?new uWt(t,i,e):!i||Object.keys(i).length===0?new Dze(e,zo):zo===2&&a.id==="com.apple.keylayout.DVORAK-QWERTYCMD"?new Dze(e,zo):new zct(t,i,e,zo)}function dmn(a){if(!a)return!1;if(zo===3){let i=a;return i.layout.split(/,/g)[i.group]==="us"}return zo===2?a.id==="com.apple.keylayout.US":zo===1?a.name==="00000409":!1}we(WOt,Kct,1);var Gct=class extends yY{constructor(i,e,t){super(e.userHome,i,e,t)}};Gct=I([m(0,yo),m(1,ps),m(2,Pe)],Gct);we(wn,Gct,1);var Wne=class extends C{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(Wne.STORAGE_KEY,-1);if(t)try{let o=JSON.parse(t);if(yi(o)&&Da(o.highContrast)&&Da(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(Wne.STORAGE_KEY,JSON.stringify({highContrast:e,dark:t}),-1,1),this._onDidChangeColorScheme.fire())}};Wne=I([m(0,To),m(1,ps),m(2,le),m(3,ao)],Wne);we(jOt,Wne,1);var kve=class extends Error{constructor(e,t){super(e);this.code=t}},Vne=ae("IExtensionsProfileScannerService"),Lze=class extends C{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 vt}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])=>Ot(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=>Ot(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])=>Ot({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=>Ot(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(hu(s)!==1)throw s;if(this.uriIdentityService.extUri.isEqual(e,this.userDataProfilesService.defaultProfile.extensionsResource)&&(r=await this.migrateFromOldDefaultProfileExtensionsLocation()),!r&&o?.bailOutWhenFileNotFound)throw new kve(Cn(s),"ERROR_PROFILE_NOT_FOUND")}if(r){Array.isArray(r)||this.throwInvalidConentError(e);let s=!1;for(let l of r){MTo(l)||this.throwInvalidConentError(e);let c;if(Ae(l.relativeLocation)&&l.relativeLocation)c=this.resolveExtensionLocation(l.relativeLocation);else if(Ae(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)}cn(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,Je.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,Je.fromString(JSON.stringify(s)))}return n})}throwInvalidConentError(e){throw new kve(`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(hu(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=>MTo(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,Je.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(hu(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){hu(r)!==1&&this.logService.error(r)}try{await this.fileService.del(t)}catch(r){hu(r)!==1&&this.logService.error(r)}return n})()),this._migrationPromise}getResourceAccessQueue(e){let t=this.resourcesAccessQueueMap.get(e);return t||(t=new Op,this.resourcesAccessQueueMap.set(e,t)),t}};Lze=I([m(1,be),m(2,an),m(3,dt),m(4,ne)],Lze);function MTo(a){let i=a;return yi(i)&&H6i(i.identifier)&&(umn(i.location)||Ae(i.location)&&!!i.location)&&(cn(i.relativeLocation)||Ae(i.relativeLocation))&&!!i.version&&Ae(i.version)}function umn(a){if(!a)return!1;let i=a;return typeof i?.path=="string"&&typeof i?.scheme=="string"}var PTo;(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})(PTo||={});var FQ=ae("IExtensionsScannerService"),$ct=class extends C{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(Mze,n)),this.userExtensionsCachedScanner=this._register(this.instantiationService.createInstance(Mze,n)),this.extensionsScanner=this._register(this.instantiationService.createInstance(Rze)),this._register(this.systemExtensionsCachedScanner.onDidChangeCache(()=>this._onDidChangeCache.fire(0))),this._register(this.userExtensionsCachedScanner.onDidChangeCache(()=>this._onDidChangeCache.fire(1)))}getTargetPlatform(){return this._targetPlatformPromise||(this._targetPlatformPromise=Xxt(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 kve&&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===Y.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=>Ot(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=je(e,"package.json"),n=(await this.fileService.readFile(o)).value.toString(),r=JSON.parse(n);r.__metadata={...r.__metadata,...t},await this.fileService.writeFile(je(e,"package.json"),Je.fromString(JSON.stringify(r,null,"	")))}async initializeDefaultProfileExtensions(){try{await this.extensionsProfileScannerService.scanProfileExtensions(this.userDataProfilesService.defaultProfile.extensionsResource,{bailOutWhenFileNotFound:!0})}catch(e){if(e instanceof kve&&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,Je.fromString(JSON.stringify([])))}catch(t){hu(t)!==1&&this.logService.warn("Failed to create default profile extensions manifest in extensions installation folder.",this.userExtensionsLocation.toString(),Cn(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=No(n.location.fsPath),l=No(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&&iR(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(HTt(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 Fd;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(th(Ld(gn.asFileUri("").fsPath,"..",".build","builtInExtensions")));for(let c of o){let u=n[c.name]||"marketplace";switch(u){case"disabled":break;case"marketplace":r.push(je(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),si(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??Dr),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 Eve(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}}};$ct=I([m(4,an),m(5,Vne),m(6,be),m(7,ne),m(8,Co),m(9,nt),m(10,dt),m(11,F)],$ct);var Eve=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 Xe(i.location,e.location)&&i.mtime===e.mtime&&Xe(i.applicationExtensionslocation,e.applicationExtensionslocation)&&i.applicationExtensionslocationMtime===e.applicationExtensionslocationMtime&&i.profile===e.profile&&uo(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&&PTo.equals(i.translations,e.translations)}},Rze=class extends C{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&&Ye(n.resource).indexOf(".")===0)return null;let r=new Eve(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 si(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 Eve(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 si(r)}async scanOneOrMultipleExtensions(e){try{if(await this.fileService.exists(je(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}:`,Cn(t)),[]}}async scanExtension(e,t){let o=[],n=!0,r;try{r=await this.scanExtensionManifest(e.location)}catch(g){if(t){o.push([gt.Error,Cn(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=fwt);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=Df(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,Eve.createNlsConfiguration(e))}catch(g){this.logService.warn("Failed to translate manifest",Cn(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=V8i([...r.enabledApiProposals])),h}validate(e,t){let o=e.isValid,n=this.environmentService.isBuilt&&this.extensionsEnabledWithApiProposalVersion.includes(e.identifier.id.toLowerCase()),r=kro(t.productVersion,t.productDate,t.location,e.manifest,e.isBuiltin,n);for(let[s,l]of r)s===gt.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=je(e,"package.json"),o;try{o=(await this.fileService.readFile(t)).value.toString()}catch(r){throw hu(r)!==1&&this.logService.error(this.formatMessage(e,d(2014,null,t.path,r.message))),r}let n;try{n=JSON.parse(o)}catch(r){let s=[];Ur(o,s);for(let l of s)this.logService.error(this.formatMessage(e,d(2016,null,t.path,l.offset,l.length,EO(l.error))));throw r}if(Vx(n)!=="object"){let r=this.formatMessage(e,d(2017,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(2018,null,n.default?.path,EO(c.error))))}),t;if(Vx(n)!=="object")return this.logService.error(this.formatMessage(e,d(2015,null,n.default?.path))),t;let l=n.values||Object.create(null);return RDe(this.logService,t,l,s)}catch{}return t}async getLocalizedMessages(e,t,o){let n=je(e,"package.nls.json"),r=(u,p)=>{p.forEach(h=>{this.logService.error(this.formatMessage(e,d(2018,null,u?.path,EO(h.error))))})},s=u=>{this.logService.error(this.formatMessage(e,d(2015,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=Ur(p,h);return h.length>0?(r(u,h),{values:void 0,default:n}):Vx(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=Ur(h,g);return g.length>0?(r(p.localized,g),{values:void 0,default:p.original}):Vx(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 Ur(o,t)}catch{}}findMessageBundles(e,t){return new Promise((o,n)=>{let r=s=>{let l=je(e,`package.nls.${s}.json`);this.fileService.exists(l).then(c=>{c&&o({localized:l,original:je(e,"package.nls.json")});let u=s.lastIndexOf("-");u===-1?o({localized:je(e,"package.nls.json"),original:null}):(s=s.substring(0,u),r(s))})};if(t.devMode||t.pseudo||!t.language)return o({localized:je(e,"package.nls.json"),original:null});r(t.language)})}formatMessage(e,t){return`[${e.path}]: ${t}`}};Rze=I([m(0,Vne),m(1,dt),m(2,be),m(3,nt),m(4,Co),m(5,ne)],Rze);var Mze=class extends Rze{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&&Eve.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:Xn(o.input)}}catch(t){hu(t)!==1&&this.logService.debug("Error while reading the extension cache file:",e.path,Cn(t))}return null}async writeExtensionCache(e,t){try{await this.fileService.writeFile(e,Je.fromString(JSON.stringify(t)))}catch(o){this.logService.debug("Error while writing the extension cache file:",e.path,Cn(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(!uo(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?O8i:N8i)}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}};Mze=I([m(1,an),m(2,Vne),m(3,dt),m(4,be),m(5,nt),m(6,Co),m(7,ne)],Mze);function H8t(a,i){let e=Jb(a.manifest.publisher,a.manifest.name);return{id:e,identifier:new Ei(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 B8t=class extends $ct{constructor(i,e,t,o,n,r,s,l,c,u,p,h){super(i,e,je(t,".vscode-oss-dev","extensions","control.json"),o,n,r,s,l,c,u,p,h),this.translationsPromise=(async()=>{if(H6t)try{let g=await this.fileService.readFile(A.file(H6t));return JSON.parse(g.value.toString())}catch{}return Object.create(null)})()}getTranslations(i){return this.translationsPromise}};var WQ=class extends C{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 xe(d(1950,null,t.value));if(!await this.isExtensionPlatformCompatible(e)){let o=Gt?"https://aka.ms/vscode-web-extensions-guide":"https://aka.ms/vscode-platform-specific-extensions";return new xe(`${d(1943,null,e.displayName??e.identifier.id,this.productService.nameLong,D3e(await this.getTargetPlatform()))} [${d(1945,null)}](${o})`)}return!0}async isExtensionPlatformCompatible(e){let t=await this.getTargetPlatform();return e.allTargetPlatforms.some(o=>zle(o,e.allTargetPlatforms,t))}};WQ=I([m(0,nt),m(1,zp)],WQ);var U8t=class extends WQ{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 n=(await this.installGalleryExtensions([{extension:e,options:t}])).find(({identifier:r})=>Ot(r,e.identifier));if(n?.local)return n?.local;throw n?.error?n.error:new ch(`Unknown error while installing extension ${e.identifier.id}`,"Unknown")}catch(o){throw qct(o)}}async installGalleryExtensions(e){if(!this.galleryService.isEnabled())throw new ch(d(1947,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(Xq(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=>Ot(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",Cn(t)),t}}async installExtensions(e){let t=new Map,o=new Map,n=[],r=(c,u)=>`${Qxt.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(H.toPromise(H.filter(this.onDidInstallExtensions,y=>y.some(w=>Ot(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=>Ot(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=`${Df(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||Xq(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,[Mxt]:!0}};for(let{gallery:v,manifest:b}of Uo(g,({gallery:S})=>S.identifier.id)){let S=h.find(y=>Ot(y.identifier,v.identifier));S&&S.isApplicationScoped===!!f.isApplicationScoped||s(b,v,f,u)}}catch(p){if(A.isUri(u.source))dr(u.manifest.extensionDependencies)&&this.logService.warn("Cannot install dependencies of extension:",u.identifier.id,p.message),dr(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,Cn(v))}}f=await p.run(),await this.joinAllSettled(this.participants.map(v=>v.postInstall(f,p.source,p.options,ve.None)),"PostInstall")}catch(v){let b=qct(v);throw A.isUri(p.source)||dVi(this.telemetryService,p.operation===3?"extensionGallery:update":"extensionGallery:install",{extensionData:Qle(p.source),error:b,source:p.options.context?.[YW]}),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,Cn(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;dVi(this.telemetryService,v?"extensionGallery:update":"extensionGallery:install",{extensionData:Qle(p.source),verificationStatus:p.verificationStatus,duration:new Date().getTime()-g,durationSinceUpdate:b,source:p.options.context?.[YW]})}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,Cn(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 vt;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=>Ot(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(qct(l.reason,t));if(!n.length)return o;if(n.length===1)throw n[0];let s=new ch("","Unknown");for(let l of n)s=new ch(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=>Ot(v.identifier,{id:f}))):[],g=[...h];if(p.extensionPack){let f=r.find(v=>Ot(v.identifier,u));for(let v of p.extensionPack)f&&f.manifest.extensionPack&&f.manifest.extensionPack.some(b=>Ot({id:b},{id:v}))||g.every(b=>!Ot({id:b},{id:v}))&&g.push(v)}if(g.length){let f=g.filter(v=>s.every(b=>!Ot(b,{id:v})));if(f.length){let v=await this.galleryService.getExtensions(f.map(b=>({id:b,preRelease:o})),ve.None);for(let b of v){if(s.find(w=>Ot(w,b.identifier)))continue;let S=h.some(w=>Ot({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,Cn(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(Jxt(e.identifier,s.malicious))throw new ch(d(1946,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},ve.None))[0],!r)throw new ch(d(1952,null,e.identifier.id,l.extension.id),"Deprecated")}else{if(await this.canInstall(e)!==!0){let u=await this.getTargetPlatform();throw new ch(d(1943,null,e.identifier.id,this.productService.nameLong,D3e(u)),"IncompatibleTargetPlatform")}if(r=await this.getCompatibleVersion(e,t,o,n),!r){let u=[];throw s4(e.properties.enabledApiProposals??[],u)?!o&&e.hasPreReleaseVersion&&e.properties.isPreReleaseVersion&&(await this.galleryService.getExtensions([e.identifier],ve.None))[0]?new ch(d(1953,null,e.displayName??e.identifier.id),"ReleaseVersionNotFound"):new ch(d(1951,null,e.identifier.id,this.productService.nameLong,this.productService.version),"Incompatible"):new ch(d(1944,null,e.displayName??e.identifier.id,u[0]),"IncompatibleApi")}}this.logService.info("Getting Manifest...",r.identifier.id);let c=await this.galleryService.getManifest(r,ve.None);if(c===null)throw new ch(`Missing manifest for extension ${r.identifier.id}`,"Invalid");if(c.version!==r.version)throw new ch(`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},ve.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},ve.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)&&Ot(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()),dVi(this.telemetryService,"extensionGallery:uninstall",{extensionData:Yxt(h),error:f}),this._onDidUninstallExtension.fire({identifier:h.identifier,error:f?.code,profileLocation:g.profileLocation,applicationScoped:h.isApplicationScoped})},r=[],s=[],l=[],c=[],u=new vt,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=>Ot(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,Cn(f))}}if(await h.run(),await this.joinAllSettled(this.participants.map(f=>f.postUninstall(h.extension,h.options,ve.None))),h.extension.identifier.uuid&&!Gt)try{await this.galleryService.reportStatistic(h.extension.manifest.publisher,h.extension.manifest.name,h.extension.manifest.version,"uninstall")}catch{}}catch(f){let v=qct(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=qct(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=>Ot(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(1954,null,o.manifest.displayName||o.manifest.name,t[0].manifest.displayName||t[0].manifest.name):t.length===2?d(1956,null,o.manifest.displayName||o.manifest.name,t[0].manifest.displayName||t[0].manifest.name,t[1].manifest.displayName||t[1].manifest.name):d(1948,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(1955,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(1957,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(1949,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(Ot(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=>Ot({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=>Ot({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",Cn(e)),{malicious:[],deprecated:{},search:[]}}}};U8t=I([m(0,ta),m(1,Te),m(2,dt),m(3,ne),m(4,nt),m(5,zp),m(6,an)],U8t);function qct(a,i){if(a instanceof ch)return a;let e;return a instanceof xE?e=new ch(a.message,a.code==="DownloadFailedWriting"?"DownloadFailedWriting":"Gallery"):e=new ch(a.message,so(a)?"Cancelled":i??"Internal"),e.stack=a.stack,e}function dVi(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 z8t="extensions.trustedPublishers";function pmn(a){return a.type==="gallery"}var Pze=class extends WQ{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(VQ)),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 xI);this._register(k.add(this._onInstallExtension.event)),this.onInstallExtension=k.event;let T=this._register(new xI);this._register(T.add(this._onDidInstallExtensions.event)),this.onDidInstallExtensions=T.event;let N=this._register(new xI);this._register(N.add(this._onDidProfileAwareInstallExtensions.event)),this.onProfileAwareDidInstallExtensions=N.event;let O=this._register(new xI);this._register(O.add(this._onUninstallExtension.event)),this.onUninstallExtension=O.event;let V=this._register(new xI);this._register(V.add(this._onDidUninstallExtension.event)),this.onDidUninstallExtension=V.event;let U=this._register(new xI);this._register(U.add(this._onDidProfileAwareUninstallExtension.event)),this.onProfileAwareDidUninstallExtension=U.event;let G=this._register(new xI);this.onDidUpdateExtensionMetadata=G.event;let $=this._register(new xI);this.onProfileAwareDidUpdateExtensionMetadata=$.event;let te=this._register(new xI);this.onDidChangeProfile=te.event;for(let pe of this.servers)this._register(k.add(H.map(pe.extensionManagementService.onInstallExtension,de=>({...de,server:pe})))),this._register(T.add(pe.extensionManagementService.onDidInstallExtensions)),this._register(N.add(pe.extensionManagementService.onProfileAwareDidInstallExtensions)),this._register(O.add(H.map(pe.extensionManagementService.onUninstallExtension,de=>({...de,server:pe})))),this._register(V.add(H.map(pe.extensionManagementService.onDidUninstallExtension,de=>({...de,server:pe})))),this._register(U.add(H.map(pe.extensionManagementService.onProfileAwareDidUninstallExtension,de=>({...de,server:pe})))),this._register(G.add(pe.extensionManagementService.onDidUpdateExtensionMetadata)),this._register($.add(pe.extensionManagementService.onProfileAwareDidUpdateExtensionMetadata)),this._register(te.add(H.map(pe.extensionManagementService.onDidChangeProfile,de=>({...de,server:pe}))));this._register(this.onProfileAwareDidInstallExtensions(pe=>{let de=new Map;for(let se of pe)se.local&&se.source&&!A.isUri(se.source)&&!this.isPublisherTrusted(se.source)&&de.set(se.source.publisher,{publisher:se.source.publisher,publisherDisplayName:se.source.publisherDisplayName});de.size&&this.trustPublishers(...de.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&&NL(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&&Ot(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=>Ot({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(16877,null,e.manifest.displayName||e.manifest.name,t[0].manifest.displayName||t[0].manifest.name):t.length===2?d(16881,null,e.manifest.displayName||e.manifest.name,t[0].manifest.displayName||t[0].manifest.name,t[1].manifest.displayName||t[1].manifest.name):d(16873,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 fn.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 NL(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===Y.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===Y.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===Y.file&&this.extensionManagementServerService.localExtensionManagementServer?this.extensionManagementServerService.localExtensionManagementServer.extensionManagementService.getManifest(e):e.scheme===Y.file&&this.extensionManagementServerService.remoteExtensionManagementServer?this.extensionManagementServerService.remoteExtensionManagementServer.extensionManagementService.getManifest(e):e.scheme===Y.vscodeRemote&&this.extensionManagementServerService.remoteExtensionManagementServer?this.extensionManagementServerService.remoteExtensionManagementServer.extensionManagementService.getManifest(e):Promise.reject("No Servers")}async canInstall(e){return pmn(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,ve.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 xe().appendText(d(16845,null,e.displayName||e.name)):new xe().appendText(d(16866,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 xe().appendText(d(16845,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 NL(t.manifest)?r.push(...this.servers.filter(s=>s!==this.extensionManagementServerService.webExtensionManagementServer)):r.push(n),o={...o||{},isApplicationScoped:t.isApplicationScoped},fn.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,ve.None);if(!s)throw new Error(d(16867,null,r.displayName||r.name));return s}));return e.some(r=>r.options?.context?.[UL]!==!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,ve.None);if(!l)throw new Error(d(16867,null,r.displayName||r.name));s?.context?.[YW]!=="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,ve.None);if(!n)throw new Error(d(16867,null,e.displayName||e.name));if(t?.context?.[UL]!==!0&&await this.checkForTrustedPublishers([{extension:e,manifest:n,checkForPackAndDependencies:!t?.donotIncludePackAndDependencies}]),t?.context?.[YW]!=="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||cn(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),fn.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`,Cn(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,ve.None);return t?this.getInstallableExtensionManagementServers(t):Promise.reject(d(16867,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()}`,Cn(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(16846,null,e.displayName||e.name,r.label));throw s.name="Unsupported",s}return o}async getExtensionManagementServersToInstall(e,t){let o=[];if(NL(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(16845,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:gt.Info,message:e.length===1?d(16859,null):d(16860,null),detail:e.length===1?d(16862,null,e[0].displayName):d(16861,null),buttons:[{label:d(16856,null),run:()=>!1},{label:d(16857,null),run:()=>!0}],cancelButton:{run:()=>{throw new ho}}});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,ve.None);if(!n)throw new Error(d(16867,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=[...Uo(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(16880,null):d(16879,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(16863,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 ho}},h=({publisherDisplayName:b,publisherLink:S})=>S?`[${b}](${S})`:b,g="https://aka.ms/vscode-verify-publisher",f=s.length===1?d(16848,null,s[0].publisherDisplayName):s.length===2?d(16849,null,s[0].publisherDisplayName,s[1].publisherDisplayName):d(16847,null,s[0].publisherDisplayName,s.length-1),v=new xe("",{supportThemeIcons:!0,isTrusted:!0});if(t.length===1){let b=t[0],S=o[0];if(r.length){v.appendMarkdown(d(16850,null,`[${b.displayName}](${b.detailsLink})`,h(b))),v.appendMarkdown("&nbsp;");let y=ic("extension.open",b.identifier.id,S.extensionPack?.length?"extensionPack":"dependencies").toString();r.length===1?v.appendMarkdown(d(16878,null,y,h(r[0]))):v.appendMarkdown(d(16870,null,y,r.slice(0,r.length-1).map(w=>h(w)).join(", "),h(r[r.length-1]))),v.appendMarkdown("&nbsp;"),v.appendMarkdown(d(16855,null))}else v.appendMarkdown(d(16868,null,`[${b.displayName}](${b.detailsLink})`,h(b)))}else v.appendMarkdown(d(16872,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(16884,null,h(b),`[$(link-external) ${A.parse(b.publisherDomain.link).authority}](${b.publisherDomain.link})`);v.appendMarkdown(`$(${XF.id})&nbsp;${S}`)}l.length&&(v.appendText(`
`),l.length===1?v.appendMarkdown(`$(${M.unverified.id})&nbsp;${d(16883,null,h(l[0]),g)}`):v.appendMarkdown(`$(${M.unverified.id})&nbsp;${d(16882,null,l.slice(0,l.length-1).map(b=>h(b)).join(", "),h(l[l.length-1]),g)}`))}else v.appendText(`
`),v.appendMarkdown(`$(${M.unverified.id})&nbsp;${d(16844,null,g)}`);v.appendText(`
`),s.length>1?v.appendMarkdown(d(16871,null,this.productService.nameLong)):v.appendMarkdown(d(16869,null,this.productService.nameLong)),await this.dialogService.prompt({message:f,type:gt.Warning,buttons:[u,p],cancelButton:{run:()=>{throw this.telemetryService.publicLog2("extensions:trustPublisher",{action:"cancel",extensionId:t.map(b=>b.identifier.id).join(",")}),new ho}},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,ve.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(dr(r.properties.dependencies))for(let s of r.properties.dependencies)t.has(s.toLowerCase())||e.push(s);if(dr(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(16851,null),type:"ContinueWithTrust"}),t||o.push({label:d(16852,null),type:"ContinueWithoutTrust"}),o.push({label:d(16853,null),type:"Manage"}),await this.workspaceTrustRequestService.requestWorkspaceTrust({message:d(16854,null),buttons:o})===void 0)throw new ho}}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})),ve.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 ch("Not supported in Web","Unsupported")}let n=d(16885,null,this.productService.nameLong),r=this.extensionManifestPropertiesService.getExtensionVirtualWorkspaceSupportType(t),s=hle(t.capabilities?.virtualWorkspaces),l=r==="limited"||!!s;if(!o.length&&!l)return;let c=d(16864,null,e.displayName||e.identifier.id,n),u,p=[],h,g={label:d(16858,null),run:()=>{}},f={label:d(16876,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(16875,null)}`,p=[g,f]):l?(u=c,h=s||void 0,p=[g]):(u=d(16874,null,e.displayName||e.identifier.id,n),p=[g,f]),await this.dialogService.prompt({type:gt.Info,message:u,detail:h,buttons:p,cancelButton:{run:()=>{throw new ho}}})}getTargetPlatform(){return this._targetPlatformPromise||(this._targetPlatformPromise=Xxt(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(z8t,JSON.stringify(t),-1,0)}untrustPublishers(...e){let t=this.getTrustedPublishersFromStorage();for(let o of e)delete t[o.toLowerCase()];this.storageService.store(z8t,JSON.stringify(t),-1,0)}getTrustedPublishersFromStorage(){let e=this.storageService.getObject(z8t,-1,{});return Array.isArray(e)?(this.storageService.remove(z8t,-1),Object.create(null)):Object.keys(e).reduce((t,o)=>(t[o.toLowerCase()]=e[o],t),Object.create(null))}};Pze=I([m(0,Gc),m(1,ta),m(2,mn),m(3,an),m(4,B),m(5,nt),m(6,tF),m(7,_l),m(8,ct),m(9,Vd),m(10,xp),m(11,be),m(12,ne),m(13,F),m(14,FQ),m(15,zp),m(16,le),m(17,Te)],Pze);var VQ=class extends C{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 P);this._register(H.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=>Ot(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=>Ot(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(VQ.WORKSPACE_EXTENSIONS_KEY,1,"[]"));if(Array.isArray(e))for(let o of t)Ae(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: ${Cn(t)}`)}return e}saveWorkspaceExtensions(){let e=this.extensions.map(t=>t.location);this.workspaceService.getWorkbenchState()===2?this.storageService.store(VQ.WORKSPACE_EXTENSIONS_KEY,JSON.stringify(si(e.map(t=>this.uriIdentityService.extUri.relativePath(this.workspaceService.getWorkspace().folders[0].uri,t)))),1,1):this.storageService.store(VQ.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([gt.Error,d(16865,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}}};VQ=I([m(0,be),m(1,ne),m(2,Pe),m(3,FQ),m(4,le),m(5,dt),m(6,Te)],VQ);var jct=class extends Pze{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===Y.vscodeRemote&&t===this.extensionManagementServerService.localExtensionManagementServer){let n=je(this.environmentService.tmpDir,_t());await this.downloadService.download(e,n),e=n}return super.installVSIXInServer(e,t,o)}};jct=I([m(0,ps),m(1,Gc),m(2,ta),m(3,mn),m(4,an),m(5,B),m(6,nt),m(7,tF),m(8,_l),m(9,ct),m(10,Vd),m(11,xp),m(12,be),m(13,ne),m(14,F),m(15,FQ),m(16,zp),m(17,le),m(18,Te)],jct);we(Hd,jct,1);var uVi=["v0.1","v0"],Aze=class extends C{constructor(e,t,o){super();this.productService=e;this.requestService=t;this.logService=o;this.onDidChangeMcpGalleryManifest=H.None;this.onDidChangeMcpGalleryManifestStatus=H.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,uVi[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 uVi)if(await this.checkVersion(e,t))return t;return uVi[0]}async checkVersion(e,t){try{let o=await this.requestService.request({type:"GET",url:`${e}/${t}/servers?limit=1`},ve.None);if(aP(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}};Aze=I([m(0,nt),m(1,_a),m(2,ne)],Aze);var Nze=class extends Aze{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(b4)||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.info("MCP Registry configured:",this.mcpGalleryManifest.url):this.logService.info("No MCP Registry configured"),this.currentStatus=this.mcpGalleryManifest?"available":"unavailable",this._onDidChangeMcpGalleryManifest.fire(this.mcpGalleryManifest),this._onDidChangeMcpGalleryManifestStatus.fire(this.currentStatus))}};Nze=I([m(0,nt),m(1,yo),m(2,_a),m(3,ne),m(4,B)],Nze);var Qct=class extends Nze{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])))})}};Qct=I([m(0,nt),m(1,yo),m(2,_a),m(3,ne),m(4,Fb),m(5,B)],Qct);we(wV,Qct,0);var Yct=class extends sOe{constructor(i,e,t,o,n,r,s,l,c,u){let p=new Fte(u.getChannel("mcpManagement"),i,e);super(p,i,e,t,o,n,r,s,l,c),this._register(p)}};Yct=I([m(0,MR),m(1,ne),m(2,mn),m(3,dt),m(4,Pe),m(5,yo),m(6,an),m(7,ZP),m(8,F),m(9,Fb)],Yct);we(n8,Yct,1);nx(Qxe,"encryption");var Xct=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)?Sl(e).buffer:new TextEncoder().encode(i)}convertUint8ArrayToString(i){try{return new TextDecoder().decode(i)}catch{return""}}isValidBase64(i){try{return Sl(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=je(e,s),c=Je.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)}};we(H0e,Xct,1);we(H0e,Xct,1);var Oze=class{constructor(i,e){this.windowId=i;return dd.toService(e.getChannel("browserElements"),{context:i,properties:(()=>{let t=new Map;return t.set("windowId",i),t})()})}};Oze=I([m(1,Lu)],Oze);var Jct=class extends Oze{constructor(i,e){super(i.window.id,e)}};Jct=I([m(0,ps),m(1,Lu)],Jct);var mmn=0,ATo=0,Zct=class{constructor(i){this.simpleBrowser=i}async getConsoleLogs(i){return await this.simpleBrowser.getConsoleLogs(i)}async startConsoleSession(i,e){let t=ATo++,o=`vscode:cancelConsoleSession${t}`,n=i.onCancellationRequested(()=>{el.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=ATo++,o=`vscode:cancelCurrentSession${t}`,n=i.onCancellationRequested(()=>{el.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=mmn++,n=`vscode:cancelElementSelection${o}`,r=e.onCancellationRequested(()=>{el.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()}}};Zct=I([m(0,LDi)],Zct);we(Khe,Zct,1);we(LDi,Jct,1);var edt=class extends Yxe{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=wd(()=>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(17207,null),run:()=>this._openerService.open("https://go.microsoft.com/fwlink/?linkid=2239490"),keepOpen:!0};e.push(t);let o=d(17204,null);if(!Wn){this._notificationService.prompt(gt.Error,o,e);return}let n=await this._encryptionService.getKeyStorageProvider();if(n==="basic_text"){let r=d(17209,null),s={label:d(17208,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}Y7i(n)?o=d(17205,null):Q7i(n)&&(o=d(17206,null)),this._notificationService.prompt(gt.Error,o,e)}};edt=I([m(0,Ne),m(1,ct),m(2,Qe),m(3,zf),m(4,iC),m(5,le),m(6,Qxe),m(7,ne)],edt);we(LE,edt,1);Hv(_j,"languagePacks");var K8t=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 NTo(a,i,e,t,o,n,r,s,l,c){let{commit:u,version:p,date:h}=i??{},g=e9i(e,t,l.arch,u,p,o,n,r,s,h),f=a.get(tKi,-1),v=a.get(iKi,-1);return g["common.version.shell"]=l.versions?.electron,g["common.version.renderer"]=l.versions?.chrome,g["common.firstSessionDate"]=f,g["common.lastSessionDate"]=v||"",g["common.isNewSession"]=v?"0":"1",g["common.remoteAuthority"]=jxt(c,i),g["common.cli"]=!!l.env.VSCODE_CLI,g}var BQ=class{constructor(i,e,t){this._configurationService=e;this._productService=t;this._experimentProperties={};this._pendingEvents=[];this._isExperimentPropertySet=!1;this._disposables=new P;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(Yr(o),"gi")),o.indexOf("\\")>=0&&this._cleanupPatterns.push(new RegExp(Yr(o.replace(/\\/g,"/")),"gi"));this._updateTelemetryLevel(),this._disposables.add(this._configurationService.onDidChangeConfiguration(o=>{(o.affectsConfiguration(bN)||o.affectsConfiguration(zre)||o.affectsConfiguration(hmt))&&this._updateTelemetryLevel()})),i.waitForExperimentProperties?this._flushTimeout=setTimeout(()=>this._flushPendingEvents(),BQ.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=xO(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<BQ.MAX_BUFFER_SIZE&&this._pendingEvents.push({eventName:i,eventLevel:e,data:t});return}this._doLog(i,e,t)}}_doLog(i,e,t){t=Nu(t,this._experimentProperties),t=r9i(t,this._cleanupPatterns),t=Nu(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)}};BQ=I([m(1,B),m(2,nt)],BQ);function hmn(){let a=d(2299,null,to.nameLong),i=to.privacyStatementUrl?d(2285,null,"https://aka.ms/vscode-telemetry",to.privacyStatementUrl):d(2286,null,"https://aka.ms/vscode-telemetry"),e=Gt?"":d(2291,null),t=d(2284,null),o=d(2289,null),n=d(2300,null),r=d(2298,null),s=`
|       | ${t} | ${o} | ${n} |
|:------|:-------------:|:---------------:|:----------:|
| all   |       \u2713       |        \u2713        |     \u2713      |
| error |       \u2713       |        \u2713        |     -      |
| crash |       \u2713       |        -        |     -      |
| off   |       -       |        -        |     -      |
`,l=d(2294,null);return`
${a} ${i} ${e}

&nbsp;

${r}
${s}

&nbsp;

${l}
`}var gmn=oe.as(ii.Configuration);gmn.registerConfiguration({id:oKi,order:1,type:"object",title:d(2301,null),properties:{[bN]:{type:"string",enum:["all","error","crash","off"],enumDescriptions:[d(2293,null),d(2295,null),d(2292,null),d(2296,null)],markdownDescription:hmn(),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(2297,null)},enumDescriptions:[{key:"telemetry.telemetryLevel.default",value:d(2293,null)},{key:"telemetry.telemetryLevel.error",value:d(2295,null)},{key:"telemetry.telemetryLevel.crash",value:d(2292,null)},{key:"telemetry.telemetryLevel.off",value:d(2296,null)}]}}},"telemetry.feedback.enabled":{type:"boolean",default:!0,description:d(2290,null),policy:{name:"EnableFeedback",category:"Telemetry",minimumVersion:"1.99",localization:{description:{key:"telemetry.feedback.enabled",value:d(2290,null)}}}},[zre]:{type:"boolean",markdownDescription:to.privacyStatementUrl?d(2288,null,to.nameLong,to.privacyStatementUrl):d(2287,null,to.nameLong),default:!0,restricted:!0,markdownDeprecationMessage:d(2283,null,`\`#${bN}#\``),scope:1,tags:["usesOnlineServices","telemetry"]}}});var tdt=class extends C{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){if(super(),KL(e,i)){let r=o9i(e,n),s=t.getChannel("telemetryAppender"),l={appenders:[new K8t(s)],commonProperties:NTo(o,e,i.os.release,i.os.hostname,i.machineId,i.sqmId,i.devDeviceId,r,cM,i.remoteAuthority),piiPaths:n9i(i),sendErrorTelemetry:!0,waitForExperimentProperties:UDt(n,e,i)};this.impl=this._register(new BQ(l,n,e))}else this.impl=i9i;this.sendErrorTelemetry=this.impl.sendErrorTelemetry}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)}};tdt=I([m(0,ps),m(1,nt),m(2,Fb),m(3,le),m(4,B)],tdt);we(Te,tdt,1);var G8t=ae("extensionHostStarter"),OTo="extensionHostStarter";nx(G8t,OTo);var idt=class extends okt{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},ve.None);return await Kx(n)||""}return(await this._fileService.readFile(e)).value.toString()}};idt=I([m(0,be),m(1,le),m(2,nt),m(3,Co),m(4,B),m(5,vv),m(6,_a),m(7,ne)],idt);we(Bx,idt,1);var fmn="workbench.view.extensions",odt=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"});xk(i.value)}catch{return this.notificationService.notify({severity:St.Error,message:d(17124,null),actions:{primary:[pi({id:"openArgv",label:d(17126,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===IS.value()||!t&&IS.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(fmn,0))?.getViewPaneContainer()).search(`@id:${i.extensionId}`);return}await this.progressService.withProgress({location:15,title:d(17125,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),IS.isDefaultVariant()||await this.showRestartDialog("English")}catch(i){this.notificationService.error(i)}}async showRestartDialog(i){let{confirmed:e}=await this.dialogService.confirm({message:d(17129,null,this.productService.nameLong,i),detail:d(17128,null,i,this.productService.nameLong),primaryButton:d(17127,null)});return e}};odt=I([m(0,zf),m(1,Co),m(2,Ne),m(3,_j),m(4,ds),m(5,ls),m(6,Bo),m(7,Ho),m(8,ee),m(9,ct),m(10,oi),m(11,nt)],odt);var ndt=class{constructor(i){this.languagePackService=i}async getExtensionIdProvidingCurrentLocale(){let i=IS.value();return i===QH?void 0:(await this.languagePackService.getInstalledLanguages()).find(o=>o.id===i)?.extensionId}};ndt=I([m(0,_j)],ndt);we(oB,odt,1);we(EFt,ndt,1);var rdt=class extends B8t{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)}};rdt=I([m(0,mn),m(1,an),m(2,Vne),m(3,be),m(4,ne),m(5,iC),m(6,nt),m(7,dt),m(8,F)],rdt);we(FQ,rdt,1);function OG(a,i){i=i||xFt;let e=a.manifest;return{...kFt({...a,manifest:void 0},i),manifest:e}}var $8t=class extends WQ{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?OG(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:OG(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=>OG(o,null))}installFromLocation(e,t){return Promise.resolve(this.channel.call("installFromLocation",[e,t])).then(o=>OG(o,null))}async installExtensionsFromProfile(e,t,o){return(await this.channel.call("installExtensionsFromProfile",[e,t,o])).map(r=>OG(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=>OG(o,null))}async installGalleryExtensions(e){return(await this.channel.call("installGalleryExtensions",[e])).map(o=>({...o,local:o.local?OG(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,Dr])).then(n=>n.map(r=>OG(r,null)))}updateMetadata(e,t,o){return Promise.resolve(this.channel.call("updateMetadata",[e,t,o])).then(n=>OG(n,null))}resetPinnedStateForAllUserExtensions(e){return this.channel.call("resetPinnedStateForAllUserExtensions",[e])}toggleApplicationScope(e,t){return this.channel.call("toggleApplicationScope",[e,t]).then(o=>OG(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 Fze=class extends $8t{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=>Ei.equals(l.identifier.id,c))&&!r.some(c=>Ei.equals(c.identifier.id,l.identifier.id))&&s.push(l.identifier);s.length&&await this.installExtensionsFromProfile(s,e,t)}return cre(n,r,(s,l)=>Al(`${Ei.toKey(s.identifier.id)}@${s.manifest.version}`,`${Ei.toKey(l.identifier.id)}@${l.manifest.version}`))}async getProfileLocation(e){return e??this.userDataProfileService.currentProfile.extensionsResource}};var Wze=class extends Fze{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)}};Wze=I([m(1,nt),m(2,zp),m(3,mn),m(4,an),m(5,ZP),m(6,dt)],Wze);var Vze=class extends Wze{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(cn(t.donotVerifySignature)){let n=this.configurationService.getValue(nxe);t.donotVerifySignature=Da(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,[V6i]: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.`,In(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,ve.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=>Ot(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},ve.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 s4(e.properties.enabledApiProposals??[],r)?!t&&e.properties.isPreReleaseVersion&&(await this.galleryService.getExtensions([e.identifier],ve.None))[0]?new ch(d(16895,null,e.identifier.id),"ReleaseVersionNotFound"):new ch(d(16894,null,e.identifier.id,this.productService.nameLong,this.productService.version),"Incompatible"):new ch(d(16893,null,e.displayName??e.identifier.id,r[0]),"IncompatibleApi")}return n}async installUIDependenciesAndPackedExtensions(e){let t=await this.getAllUIDependenciesAndPackedExtensions(e.manifest,ve.None),o=await this.localExtensionManagementServer.extensionManagementService.getInstalled(),n=t.filter(r=>o.every(s=>!Ot(s.identifier,r.identifier)));n.length&&(this.logService.info(`Installing UI dependencies and packed extensions of '${e.identifier.id}' locally`),await fn.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(dr(c.extensionDependencies))for(let u of c.extensionDependencies)t.has(u.toLowerCase())||e.push(u);if(dr(c.extensionPack))for(let u of c.extensionPack)t.has(u.toLowerCase())||e.push(u)}return this.getDependenciesAndPackedExtensionsRecursively(e,t,o,n)}};Vze=I([m(2,nt),m(3,mn),m(4,an),m(5,ZP),m(6,dt),m(7,ne),m(8,ta),m(9,B),m(10,zp),m(11,be),m(12,xp)],Vze);var Bze=class extends Fze{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===Y.file)return{location:e,async cleanup(){}};this.logService.trace("Downloading extension from",e.toString());let t=je(this.nativeEnvironmentService.extensionsDownloadLocation,_t());return await this.downloadService.download(e,t),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=>lCe(s.manifest,this.nativeEnvironmentService.remoteAuthority));r&&(o||(o=[]),o.push(new Ei(r.identifier.id)))}return super.switchExtensionsProfile(e,t,o)}};Bze=I([m(1,nt),m(2,zp),m(3,mn),m(4,dt),m(5,be),m(6,tF),m(7,ps),m(8,ne)],Bze);var sdt=class extends C{constructor(e,t,o,n){super();this.remoteExtensionManagementServer=null;this.webExtensionManagementServer=null;let r=this._register(n.createInstance(Bze,e.getChannel("extensions")));this.localExtensionManagementServer={extensionManagementService:r,id:"local",label:d(16891,null)};let s=t.getConnection();if(s){let l=n.createInstance(Vze,s.getChannel("extensions"),this.localExtensionManagementServer);this.remoteExtensionManagementServer={id:"remote",extensionManagementService:l,get label(){return o.getHostLabel(Y.vscodeRemote,s.remoteAuthority)||d(16892,null)}}}}getExtensionManagementServer(e){if(e.location.scheme===Y.file)return this.localExtensionManagementServer;if(this.remoteExtensionManagementServer&&e.location.scheme===Y.vscodeRemote)return this.remoteExtensionManagementServer;throw new Error(`Invalid Extension ${e.location}`)}getExtensionInstallLocation(e){return this.getExtensionManagementServer(e)===this.remoteExtensionManagementServer?2:1}};sdt=I([m(0,Fb),m(1,yo),m(2,ot),m(3,F)],sdt);we(Gc,sdt,1);var Hze=class extends C{constructor(e){super();this.productService=e;this.onDidChangeExtensionGalleryManifest=H.None;this.onDidChangeExtensionGalleryManifestStatus=H.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}}}}};Hze=I([m(0,nt)],Hze);var adt=class extends Hze{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=JOt(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(A3e);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(A3e)&&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(16889,null,this.productService.nameLong),primaryButton:d(16890,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},ve.None),r=await hh(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}}};adt=I([m(0,nt),m(1,Co),m(2,be),m(3,Te),m(4,le),m(5,yo),m(6,Fb),m(7,B),m(8,_a),m(9,Um),m(10,ne),m(11,ct),m(12,oi)],adt);we(vv,adt,0);var Uze=class extends C{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(je(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}};Uze=I([m(0,be),m(1,nt)],Uze);var ldt=class extends Uze{constructor(i,e,t){super(i,e),this.channel=t.getChannel("extensionTipsService")}getConfigBasedTips(i){return i.scheme===Y.file?this.channel.call("getConfigBasedTips",[i]):super.getConfigBasedTips(i)}getImportantExecutableBasedTips(){return this.channel.call("getImportantExecutableBasedTips")}getOtherExecutableBasedTips(){return this.channel.call("getOtherExecutableBasedTips")}};ldt=I([m(0,be),m(1,nt),m(2,Fb)],ldt);we(oxe,ldt,1);var zze=class extends C{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 Cg.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:Cg.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 pVi(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:Qy(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))}};zze=I([m(1,an)],zze);var pVi=class extends C{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 q8t=class extends C{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 Kze=class extends ipe{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}}};Kze=I([m(1,nt),m(2,B),m(3,le)],Kze);Hv(aI,"userDataSync",{channelClientCtor:zze});Hv(DDe,"IUserDataSyncResourceProviderService");Hv(XJ,"userDataSyncMachines");Hv(LDe,"userDataSyncAccount",{channelClientCtor:q8t});Hv(TR,"userDataSyncStoreManagement",{channelClientCtor:Kze});var cdt=class{get onError(){return H.map(this.channel.listen("onError"),i=>Cg.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])}};cdt=I([m(0,Fb)],cdt);we(JE,cdt,1);var udt=class extends nEe{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 vmn(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 cM.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"]}};udt=I([m(0,To),m(1,ps),m(2,ao),m(3,Pe),m(4,lt),m(5,zd),m(6,ds),m(7,ee),m(8,Bi),m(9,Te),m(10,fi),m(11,nt),m(12,le)],udt);we(wC,udt,1);var FTo="perf/lastRunningCommit",ddt;function vmn(a,i,e){return typeof ddt!="boolean"&&(!e.window.isCodeCaching||!a.commit?ddt=!1:i.get(FTo,-1)===a.commit?ddt=!0:(i.store(FTo,a.commit,-1,1),ddt=!1)),ddt}var j8t=ae("checksumService");var mVi=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)}},Bne=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 mVi(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=gn.asFileUri(i);try{let o=await this.checksumService.checksum(t);return Bne._createChecksumPair(t,o,e)}catch{return Bne._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(17058,null,this.productService.nameShort);i?this.notificationService.prompt(gt.Warning,e,[{label:d(17057,null),run:()=>this.openerService.open(A.parse(i))},{label:d(17056,null),isSecondary:!0,run:()=>this.storage.set({dontShowPrompt:!0,commit:this.productService.commit})}],{sticky:!0,priority:3}):this.notificationService.notify({severity:gt.Warning,message:e,sticky:!0,priority:3})}};Bne=I([m(0,Ne),m(1,le),m(2,ao),m(3,Qe),m(4,nt),m(5,j8t),m(6,ne)],Bne);we(z1e,Bne,1);var hVi=class a{constructor(i,e){this.backupRoot=i;this.fileService=e;this.cache=new vt}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 fn.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:Xi(t)})}update(i,e){let t=this.cache.get(i);t&&(t.meta=Xi(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&&!uo(t,o.meta))}get(){return Array.from(this.cache.keys())}remove(i){this.cache.delete(i)}clear(){this.cache.clear()}},Gze=class extends C{constructor(e,t,o){super();this.fileService=t;this.logService=o;this.impl=this._register(this.initialize(e))}initialize(e){return e?new VD(e,this.fileService,this.logService):new Q8t}reinitialize(e){this.impl instanceof VD&&(e?this.impl.initialize(e):this.impl=new Q8t)}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()}};Gze=I([m(1,be),m(2,ne)],Gze);var VD=class extends C{constructor(e,t,o){super();this.backupWorkspaceHome=e;this.fileService=t;this.logService=o;this.ioOperationQueues=this._register(new sU);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 hVi.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>=VD.PREAMBLE_MAX_LENGTH&&(c=this.createPreamble(e));let u=Je.fromString(c),p;y6(t)?p=w9t(u,t):t?p=G1i(u,t):p=Je.concat([u,Je.fromString("")]),await this.fileService.writeFile(l,p),s.add(l,o,n)})}createPreamble(e,t){return`${e.resource.toString()}${VD.PREAMBLE_META_SEPARATOR}${JSON.stringify({...t,typeId:e.typeId})}${VD.PREAMBLE_END_MARKER}`}async discardBackups(e){let t=await this.ready,o=e?.except;if(Array.isArray(o)&&o.length>0){let n=new vt;for(let r of o)n.set(this.toBackupResource(r),!0);await fn.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 si(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,VD.PREAMBLE_END_MARKER,VD.PREAMBLE_MAX_LENGTH);if(!n)return;let r=n.indexOf(VD.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??CP,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 Dpt(r.value,1),l=Je.concat(s.buffer),c=l.buffer.indexOf(VD.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(VD.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=WT(g):f=w9t(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,mf(o)&&(o=void 0))}catch{}return{typeId:t,meta:o}}toBackupResource(e){return je(this.backupWorkspaceHome,e.resource.scheme,WTo(e))}joinBackups(){return this.ioOperationQueues.whenDrained()}};VD=I([m(1,be),m(2,ne)],VD);var Q8t=class extends C{constructor(){super(...arguments);this.backups=new vt}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 Je?t:t?y6(t)?await Kv(t):Mpt(t):Je.fromString(""),meta:n})}async resolve(e){let t=this.toBackupResource(e),o=this.backups.get(t);if(o)return{value:WT(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 vt;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:Y.inMemory,path:WTo(e)})}async joinBackups(){}};function WTo(a){let i;if(a.typeId.length>0){let e=VTo(a.typeId);a.resource.path?i=je(a.resource,e):i=a.resource.with({path:e})}else i=a.resource;return bmn(i)}function bmn(a){let i=a.scheme===Y.file||a.scheme===Y.untitled?a.fsPath:a.toString();return VTo(i)}function VTo(a){return Ir(a).toString(16)}var Y8t=class a extends C{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 $e,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 $e;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 fn.settled([...t].map(async r=>{if(!this.editorService.isVisible(r))return r.resolve()}));for(let r of n)this.unrestoredBackups.delete(r)}};var Tve=class extends Y8t{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(17622,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(17623,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===AS.ON_EXIT_AND_WINDOW_CLOSE?t:it||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===AS.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(17621,null),l=r.length?`${Xw(r.map(u=>u.name))}
${s}`:s,{result:c}=await this.dialogService.prompt({type:"error",message:e,detail:l,buttons:[{label:d(17625,null),run:()=>!0},{label:this.toForceShutdownLabel(n),run:()=>!1}]});return c??!0}toForceShutdownLabel(e){switch(e){case 1:case 4:return d(17628,null);case 2:return d(17629,null);case 3:return d(17630,null)}}async backupBeforeShutdown(e){let t=[],o;return await this.withProgressAndCancellation(async n=>{try{await fn.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(17620,null),d(17619,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 fn.settled(e.map(r=>r.isModified()?r.save(o):Promise.resolve(!0)))},d(17627,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 fn.settled(e.map(o=>o.isModified()?o.revert(t):Promise.resolve()))},d(17626,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 fn.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(17624,null))}withProgressAndCancellation(e,t,o,n=20){let r=new $e;return this.progressService.withProgress({location:n,cancellable:!0,delay:800,title:t,detail:o},()=>wa(e(r.token),r.token),()=>r.dispose(!0))}};Tve=I([m(0,Gm),m(1,lr),m(2,Wa),m(3,ao),m(4,dn),m(5,ct),m(6,Pe),m(7,To),m(8,ne),m(9,Co),m(10,Bo),m(11,Vf),m(12,ee)],Tve);var pdt=class extends Gze{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(17618,null)})))}};pdt=I([m(0,ps),m(1,be),m(2,ne),m(3,ao)],pdt);we(Gm,pdt,0);pt(Tve.ID,Tve,ut.BlockStartup);Hv(j8t,"checksum");var mdt=ae("sharedProcessTunnelService"),BTo="sharedProcessTunnel";Hv(mdt,BTo);var hdt=class extends C{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)}};hdt=I([m(7,mdt),m(8,Mc)],hdt);var gdt=class extends TTe{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 Nto(e,this.defaultTunnelHost,zo,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(Pto(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(hdt,l,e,t,o,u.tunnelLocalPort,u.localAddress,()=>{this._activeSharedProcessTunnels.delete(l)})}canTunnel(e){return super.canTunnel(e)&&!!this._environmentService.remoteAuthority}};gdt=I([m(0,ne),m(1,Vt),m(2,mdt),m(3,F),m(4,ao),m(5,ps),m(6,B)],gdt);we(ap,gdt,1);Hv(eLe,"diagnostics");var X8t=ae("IV8InspectProfilingService"),$ze;(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&&(Xl(n.callFrame.url)||/^\w[\w\d+.-]*:\/\/\/?/.test(n.callFrame.url))&&(n.callFrame.url=Ld(o,No(n.callFrame.url)));return t}e.rewriteAbsolutePaths=i})($ze||={});Hv(X8t,"v8InspectProfiling");Hv(mmt,"customEndpointTelemetry");var J8t=ae("IRemoteTunnelService"),HTo={active:!1},Smn;(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"}))(Smn||={});var Z8t="remote.tunnels.access",UTo=Z8t+".hostNameOverride",zTo=Z8t+".preventSleep",eQt="remoteTunnelService",KTo=d(2255,null);Hv(J8t,"remoteTunnel");var fdt=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===Y.file}async writeFileElevated(i,e,t){if(!await this.workspaceTrustRequestService.requestWorkspaceTrust({message:ri?d(17041,null,this.labelService.getUriLabel(i)):d(17040,null,this.labelService.getUriLabel(i))}))throw new Error(d(17039,null));let n=A.file(Lbe(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})}};fdt=I([m(0,To),m(1,be),m(2,ps),m(3,Vd),m(4,ot)],fdt);we(aF,fdt,1);var qze=class extends C{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&&(kmi(r)||DLt(r),o(r)),Emi(r)&&this.logService.debug("SearchService#search",r.message)};return this.doSearch(e,t,n)}async getAIName(){return await this.getSearchProvider(3).get(Y.file)?.getAIName()}textSearchSplitSyncAsync(e,t,o,n,r){let s=this.getOpenEditorResults(e);return o&&si([...s.results.values()]).filter(u=>!(n&&n.has(u.resource))).forEach(o),{syncResults:{results:si([...s.results.values()]),limitHit:s.limitHit??!1,messages:[]},asyncResults:(async()=>{let u=await r??new Mn,p=h=>{kmi(h)?!s.results.has(h.resource)&&!u.has(h.resource)&&o&&o(h):o&&o(h),Emi(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 ho);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=si(u),u.length?{limitHit:u[0]&&u[0].limitHit,stats:u[0].stats,messages:si(u.flatMap(p=>p.messages)).filter(cUi(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?pm(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 Go;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=En.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!==Y.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=geo(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(!q1i(5/100))return;let r=e.folderQueries.every(c=>c.folder.scheme===Y.file),s=e.folderQueries.every(c=>c.folder.scheme!==Y.file),l=r?Y.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 vt(n=>this.uriIdentityService.extUri.getComparisonKey(n)),o=!1;if(e.type===2){let n=new vt;for(let s of this.editorService.editors){let l=no.getCanonicalUri(s,{supportSideBySide:1}),c=no.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()===Vz&&!(e.includePattern&&e.includePattern["**/*.code-search"])||c.scheme!==Y.untitled&&!this.fileService.hasProvider(c)||c.scheme==="git"||!this.matches(c,e))return;let u=(Xo(e.maxResults)?e.maxResults:y5)+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 ELt(c);t.set(c,h);let g=zUt(p,s,e.previewOptions);h.results=pNe(g,s,e)}else t.set(c,null)})}return{results:t,limitHit:o}}matches(e,t){return Sde(t,e.fsPath)}async clearCache(e){let t=Array.from(this.fileSearchProviders.values()).map(o=>o&&o.clearCache(e));await Promise.all(t)}};qze=I([m(0,Ct),m(1,ee),m(2,Te),m(3,ne),m(4,lt),m(5,be),m(6,dt)],qze);we(Jp,qze,1);var B0=class extends C{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 OT(m1e));this.resourceExcludeMatcher=this._register(new v$(()=>this._register(new YS(t=>this.configurationService.getValue(B0.SETTINGS.EXCLUDES,{resource:t}),t=>t.affectsConfiguration(B0.SETTINGS.EXCLUDES),this.contextService,this.configurationService))));this.pendingAddHistoryEntryOperations=new vt(e=>this.uriIdentityService.extUri.getComparisonKey(e));this.workingCopyContentVersion=new vt(e=>this.uriIdentityService.extUri.getComparisonKey(e));this.historyEntryContentVersion=new vt(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=ph.registerSource("undoRedo.source",d(17617,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 $e;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 B0.UNDO_REDO_SAVE_SOURCE}shouldTrackHistoryFromSaveEvent(e){return xto(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!==Y.vscodeUserData&&e.scheme!==Y.inMemory)return!1;let o=1024*this.configurationService.getValue(B0.SETTINGS.SIZE_LIMIT,{resource:e});return t.size>o||this.configurationService.getValue(B0.SETTINGS.ENABLED,{resource:e})===!1?!1:!this.resourceExcludeMatcher.value.matches(e)}};B0=I([m(0,Wa),m(1,yy),m(2,dt),m(3,wn),m(4,B),m(5,Cl),m(6,Pe),m(7,be)],B0);var tQt=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 OT(1);this.setWorkingCopy(i)}static{this.ENTRIES_FILE="entries.json"}static{this.FILE_SAVED_SOURCE=ph.registerSource("default.source",d(17613,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}${Yr(ms(i))}`),this.historyEntriesFolder=this.toHistoryEntriesFolder(this.historyHome,i),this.historyEntriesListingFile=je(this.historyEntriesFolder,a.ENTRIES_FILE),this.entries=[],this.whenResolved=void 0}toHistoryEntriesFolder(i,e){return je(i,Ir(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=Oi(this.workingCopyResource),r=Oi(this.workingCopyName),s=Oi(this.historyEntriesFolder),l=`${Lbe(void 0,void 0,4)}${ms(n)}`,c=je(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=Oi(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=Oi(this.workingCopyResource),e=Oi(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(Oi(this.workingCopyResource)),r=Oi(this.historyEntriesFolder),s=Oi(i.historyEntriesFolder);try{for(let p of this.entries)await this.fileService.move(p.location,je(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=Uo([...this.entries,...i.entries],p=>p.id).sort((p,h)=>p.timestamp-h.timestamp),c=Oi(i.workingCopyResource);this.setWorkingCopy(c);let u=Oi(i.workingCopyName);for(let p of l)this.entries.push({id:p.id,location:je(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=Oi(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=Oi(this.workingCopyResource),e=Oi(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,Je.fromString(JSON.stringify(t)))}async readEntriesFile(){let i=Oi(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=Oi(this.historyEntriesFolder),e=Oi(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=>!Xe(o.resource,this.historyEntriesListingFile)&&e.test(o.name))}isFileNotFound(i){return i instanceof As&&i.fileOperationResult===1}traceError(i){this.logService.trace("[Working Copy History Service]",i)}},Hne=class extends C{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 Go;this.models=new vt(e=>this.uriIdentityService.extUri.getComparisonKey(e));this.resolveLocalHistoryHome()}static{this.FILE_MOVED_SOURCE=ph.registerSource("moved.source",d(17615,null))}static{this.FILE_RENAMED_SOURCE=ph.registerSource("renamed.source",d(17616,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 OT(m1e),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=Dbe(s.path,e.path);c=je(t,s.path.substr(p+e.path.length+1))}let u;this.uriIdentityService.extUri.isEqual(ci(s),ci(c))?u=Hne.FILE_RENAMED_SOURCE:u=Hne.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,ve.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 vt;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 OT(m1e),s=[];for(let l of n.children)s.push(r.queue(async()=>{if(!e.isCancellationRequested)try{let c=JSON.parse((await this.fileService.readFile(je(l.resource,tQt.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 tQt(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}};Hne=I([m(0,be),m(1,yo),m(2,Vt),m(3,dt),m(4,ot),m(5,ne),m(6,B)],Hne);var Une=class extends Hne{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 $e);this.storeAllScheduler=this._register(new Dt(()=>this.storeAll(this.storeAllCts.token),Une.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(H.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(17614,null)})}onDidChangeModels(){this.storeAllScheduler.isScheduled()||this.storeAllScheduler.schedule()}async storeAll(e){let t=new OT(m1e),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)}};Une=I([m(0,be),m(1,yo),m(2,Vt),m(3,dt),m(4,ot),m(5,ao),m(6,ne),m(7,B)],Une);oe.as(Qi.Workbench).registerWorkbenchContribution(B0,3);we(yy,Une,1);var gVi="sync.enable",jze=class extends C{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(gVi,-1,!1)}canToggleEnablement(){return this.userDataSyncStoreManagementService.userDataSyncStore!==void 0&&this.environmentService.sync===void 0}setEnablement(e){e&&!this.canToggleEnablement()||this.storageService.store(gVi,e,-1,1)}isResourceEnabled(e,t){let o=this.storageService.getBoolean(que(e),-1);return t=t??e!=="prompts",o??t}isResourceEnablementConfigured(e){return this.storageService.getBoolean(que(e),-1)!==void 0}setResourceEnablement(e,t){if(this.isResourceEnabled(e)!==t){let o=que(e);this.storeResourceEnablement(o,t)}}getResourceSyncStateVersion(e){}storeResourceEnablement(e,t){this.storageService.store(e,t,-1,Gt?0:1)}onDidStorageChange(e){if(gVi===e.key){this._onDidChangeEnablement.fire(this.isEnabled());return}let t=$ue.filter(o=>que(o)===e.key)[0];if(t){this._onDidChangeResourceEnablement.fire([t,this.isResourceEnabled(t)]);return}}};jze=I([m(0,le),m(1,Co),m(2,TR)],jze);var fVi=class extends jze{get workbenchEnvironmentService(){return this.environmentService}getResourceSyncStateVersion(i){return i==="extensions"?this.workbenchEnvironmentService.options?.settingsSyncOptions?.extensionsSyncStateVersion:void 0}};we(_l,fVi,1);function iQt(a){let i=Je.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 HQ(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 Qze=class extends C{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=je(this._environmentService.extHostLogsPath,"webWorker")}async _getWebWorkerExtensionHostIframeSrc(){let e=new URLSearchParams;this._environmentService.debugExtensionHost&&this._environmentService.debugRenderer&&e.set("debugged","1"),kre.addSearchParam(e,!0,!0);let t=`?${e.toString()}`,o="vs/workbench/services/extensions/worker/webWorkerExtensionHostIframe.html";if(Gt){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=_t(),this._storageService.store(c,u,1,1));let p=await lpt(It.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",It.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 gx({esmModuleLocation:gn.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=_t();o.setAttribute("src",`${e}&vscodeWebWorkerExtHostId=${n}`);let r=new Np,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(It,"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(ymn),fileRoot:globalThis._VSCODE_FILE_ROOT,nls:{messages:Y2e(),language:are()}}},"*");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(Je.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 H.toPromise(H.filter(e.onMessage,t=>HQ(t,1))),this._isTerminating)throw CI();if(e.send(Je.fromString(JSON.stringify(await this._createExtHostInitData()))),this._isTerminating)throw CI();if(await H.toPromise(H.filter(e.onMessage,t=>HQ(t,0))),this._isTerminating)throw CI();return e}dispose(){this._isTerminating||(this._isTerminating=!0,this._protocol?.send(iQt(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&&!IS.isDefaultVariant()&&(n=A.joinPath(A.parse(o),this._productService.commit,this._productService.version,IS.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??(Gt?"web":"desktop"),appUriScheme:this._productService.urlProtocol,appLanguage:Dr,isExtensionTelemetryLoggingOnly:lxe(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:Gt?2:1}}};Qze=I([m(3,Te),m(4,Pe),m(5,ot),m(6,ne),m(7,ol),m(8,ru),m(9,an),m(10,nt),m(11,nc),m(12,le),m(13,Ay),m(14,aD)],Qze);var ymn=new gx({label:"extensionHostWorkerMain",esmModuleLocation:()=>gn.asBrowserUri("vs/workbench/api/worker/extensionHostWorkerMain.js"),esmModuleLocationBundler:()=>new URL("../../../api/worker/extensionHostWorkerMain.ts?esm",import.meta.url)});var vVi=class{constructor(i,e){this.versionId=i;this.removedDueToLooping=e}},bVi=class a extends C{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(wmn),this._extensionsMap=new Fd,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=qTo(this._extensionDescriptions,t),this._extensionDescriptions=this._extensionDescriptions.concat(e);let o=a._findLoopingExtensions(this._extensionDescriptions);return this._extensionDescriptions=qTo(this._extensionDescriptions,o.map(n=>n.identifier)),this._initialize(),this._versionId++,this._onDidChange.fire(void 0),new vVi(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 Fd;for(let l of e)if(o.set(l.identifier,l),l.extensionDependencies)for(let c of l.extensionDependencies)t.addArc(Ei.toKey(l.identifier),Ei.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 SVi(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)}},SVi=class{constructor(i,e){this.versionId=i;this.extensions=e}},nQt=class{constructor(i){this._lock=new wVi;this._actual=new bVi(i,[])}async acquireLock(i){let e=await this._lock.acquire(i);return new IVi(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)}},IVi=class extends C{constructor(e,t){super();this._registry=e;this._isDisposed=!1;this._register(t)}isAcquiredFor(e){return!this._isDisposed&&this._registry===e}},yVi=class{constructor(i){this.name=i;let e=TI();this.promise=e.promise,this._resolve=e.resolve}resolve(i){this._resolve(i)}},wVi=class{constructor(){this._pendingCustomers=[];this._isLocked=!1}async acquire(i){let e=new yVi(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 wmn(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=Lo.basename(a.extensionLocation.path),n=Lo.basename(i.extensionLocation.path);return o<n?-1:o>n?1:0}function qTo(a,i){let e=new QI(i);return a.filter(t=>!e.has(t.identifier))}var vdt=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)}},rQt=class extends vdt{constructor(){super(),this._hasErr=!0,this._err=new ho}};function CVi(a,i){try{return JSON.stringify(a,i)}catch{return"null"}}var kVi="$$ref$$",Cmn={[kVi]:-1};function jTo(a,i=null,e=!1){let t=[];return{jsonString:(e?CVi:JSON.stringify)(a,(n,r)=>{if(typeof r>"u")return Cmn;if(typeof r=="object"){if(r instanceof Je){let s=t.push(r)-1;return{[kVi]:s}}if(i)return i(n,r)}return r}),referencedBuffers:t}}function JTo(a,i,e){return JSON.parse(a,(t,o)=>{if(o){let n=o[kVi];if(typeof n=="number")return i[n];if(e&&o.$mid===1)return e.transformIncoming(o)}return o})}function QTo(a,i){return JSON.stringify(a,i)}function xmn(a){return a?(i,e)=>e&&e.$mid===1?a.transformOutgoing(e):e:null}var kmn=()=>{},Emn=Symbol.for("rpcProtocol"),Tmn=Symbol.for("rpcProxy"),YTo,XTo,sQt=class a extends(XTo=C,YTo=Emn,XTo){constructor(e,t=null,o=null){super();this[YTo]=!0;this._onDidChangeResponsiveState=this._register(new E);this.onDidChangeResponsiveState=this._onDidChangeResponsiveState.event;this._protocol=e,this._logger=t,this._uriTransformer=o,this._uriReplacer=xmn(this._uriTransformer),this._isDisposed=!1,this._locals=[],this._proxies=[];for(let n=0,r=I8e.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(CI())}),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?epe(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===Tmn?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=Xf.read(e,0),n=o.readUInt8(),r=o.readUInt32();switch(n){case 1:case 2:{let{rpcId:s,method:l,args:c}=dM.deserializeRequestJSONArgs(o);this._uriTransformer&&(c=epe(c,this._uriTransformer)),this._receiveRequest(t,r,s,l,c,n===2);break}case 3:case 4:{let{rpcId:s,method:l,args:c}=dM.deserializeRequestMixedArgs(o);this._uriTransformer&&(c=epe(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=dM.deserializeReplyOKJSON(o);this._uriTransformer&&(s=epe(s,this._uriTransformer)),this._receiveReply(t,r,s);break}case 10:{let s=dM.deserializeReplyOKJSONWithBuffers(o,this._uriTransformer);this._receiveReply(t,r,s);break}case 8:{let s=dM.deserializeReplyOKVSBuffer(o);this._receiveReply(t,r,s);break}case 11:{let s=dM.deserializeReplyErrError(o);this._uriTransformer&&(s=epe(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 ${y8e(o)}.${n}(`,r);let l=String(t),c,u;if(s){let h=new $e;r.push(h.token),c=this._invokeHandler(o,n,r),u=()=>h.cancel()}else c=this._invokeHandler(o,n,r),u=kmn;this._cancelInvokedHandlers[l]=u;let p=dM.serializeAcknowledged(t);this._logger?.logOutgoing(p.byteLength,t,1,"ack"),this._protocol.send(p),c.then(h=>{delete this._cancelInvokedHandlers[l];let g=dM.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=dM.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 "+y8e(e));let r=n[t];if(typeof r!="function")throw new Error("Unknown method "+t+" on actor "+y8e(e));return r.apply(n,o)}_remoteCall(e,t,o){if(this._isDisposed)return new rQt;let n=null;if(o.length>0&&ve.isCancellationToken(o[o.length-1])&&(n=o.pop()),n&&n.isCancellationRequested)return Promise.reject(CI());let r=dM.serializeRequestArguments(o,this._uriReplacer),s=++this._lastMessageId,l=String(s),c=new vdt,u=new P;n&&u.add(n.onCancellationRequested(()=>{let h=dM.serializeCancel(s);this._logger?.logOutgoing(h.byteLength,s,0,"cancel"),this._protocol.send(h)})),this._pendingRPCReplies[l]=new xVi(c,u),this._onWillSendRequest(s);let p=dM.serializeRequest(s,e,t,r,!!n);return this._logger?.logOutgoing(p.byteLength,s,0,`request: ${y8e(e)}.${t}(`,o),this._protocol.send(p),c}},xVi=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()}},Xf=class a{static alloc(i,e,t){let o=new a(Je.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 qh(JTo(r,s,null));break}case 4:e[t]=void 0;break}return e}};var dM=class{static _useMixedArgSerialization(i){for(let e=0,t=i.length;e<t;e++)if(i[e]instanceof Je||i[e]instanceof qh||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 Je)t[o]={type:2,value:r};else if(typeof r>"u")t[o]={type:4};else if(r instanceof qh){let{jsonString:s,referencedBuffers:l}=jTo(r.value,e);t[o]={type:3,value:Je.fromString(s),buffers:l}}else t[o]={type:1,value:Je.fromString(QTo(r,e))}}return{type:1,args:t}}return{type:0,args:QTo(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=Je.fromString(t),s=Je.fromString(o),l=0;l+=Xf.sizeUInt8(),l+=Xf.sizeShortString(r),l+=Xf.sizeLongString(s);let c=Xf.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=Je.fromString(t),s=0;s+=Xf.sizeUInt8(),s+=Xf.sizeShortString(r),s+=Xf.sizeMixedArray(o);let l=Xf.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 Xf.alloc(5,i,0).buffer}static serializeCancel(i){return Xf.alloc(6,i,0).buffer}static serializeReplyOK(i,e,t){if(typeof e>"u")return this._serializeReplyOKEmpty(i);if(e instanceof Je)return this._serializeReplyOKVSBuffer(i,e);if(e instanceof qh){let{jsonString:o,referencedBuffers:n}=jTo(e.value,t,!0);return this._serializeReplyOKJSONWithBuffers(i,o,n)}else return this._serializeReplyOKJSON(i,CVi(e,t))}static _serializeReplyOKEmpty(i){return Xf.alloc(7,i,0).buffer}static _serializeReplyOKVSBuffer(i,e){let t=0;t+=Xf.sizeVSBuffer(e);let o=Xf.alloc(8,i,t);return o.writeVSBuffer(e),o.buffer}static deserializeReplyOKVSBuffer(i){return i.readVSBuffer()}static _serializeReplyOKJSON(i,e){let t=Je.fromString(e),o=0;o+=Xf.sizeLongString(t);let n=Xf.alloc(9,i,o);return n.writeLongString(t),n.buffer}static _serializeReplyOKJSONWithBuffers(i,e,t){let o=Je.fromString(e),n=0;n+=Xf.sizeUInt32,n+=Xf.sizeLongString(o);for(let s of t)n+=Xf.sizeVSBuffer(s);let r=Xf.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 qh(JTo(o,n,e))}static serializeReplyErr(i,e){let t=e?CVi(QG(e),null):void 0;if(typeof t!="string")return this._serializeReplyErrEmpty(i);let o=Je.fromString(t),n=0;n+=Xf.sizeLongString(o);let r=Xf.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 Xf.alloc(12,i,0).buffer}};var _mn=!1,Dmn=!0,PH=class extends C{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:kP(this.kind)};this._telemetryService.publicLog2("extensionHostStartup",c),this._proxy=this._extensionHost.start().then(u=>{let p={time:Date.now(),action:"success",kind:kP(this.kind)};return this._telemetryService.publicLog2("extensionHostStartup",p),this._createExtensionHostCustomers(this.kind,u)},u=>{this._logService.error(`Error received from starting extension host (kind: ${kP(this.kind)})`),this._logService.error(u);let p={time:Date.now(),action:"error",kind:kP(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(Mmn({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 TVi(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=En.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=Je.alloc(10485760),n=Math.ceil(Math.random()*256);for(let s=0;s<o.byteLength;s++)o.writeUInt8(s,n);let r=En.create();return await e.test_up(o),r.stop(),PH._convert(10485760,r.elapsed())}async _measureDown(e){let o=En.create();return await e.test_down(10485760),o.stop(),PH._convert(10485760,o.elapsed())}_createExtensionHostCustomers(e,t){let o=null;_mn||this._environmentService.logExtensionHostCommunication?o=new EVi(e):Yze.isEnabled()&&(o=new Yze(this._telemetryService)),this._rpcProtocol=new sQt(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=TEt.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=TEt.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=En.create(!1),n=()=>`[${kP(this._extensionHost.runningLocation.kind)}${this._extensionHost.runningLocation.affinity}][resolveAuthority(${sz(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 EI;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)}};PH=I([m(3,F),m(4,Vt),m(5,Te),m(6,ne)],PH);function TVi(a,i){return i?`${kP(a)} pid: ${i}`:`${kP(a)}`}var Lmn=[["#2977B1","#FC802D","#34A13A","#D3282F","#9366BA"],["#8B564C","#E177C0","#7F7F7F","#BBBE3D","#2EBECD"]];function ZTo(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 Rmn(a){return Array.isArray(a)?a.map(ZTo):ZTo(a)}var EVi=class{constructor(i){this._kind=i;this._totalIncoming=0;this._totalOutgoing=0}_log(i,e,t,o,n,r,s){s=Rmn(s);let l=Lmn[n],c=Dmn?l[o%l.length]:"#000000",u=[`%c[${kP(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)}},Yze=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}))}};Yze=I([m(0,Te)],Yze);var bdt=[];function Mmn(a){return bdt.push(a),{dispose:()=>{for(let i=0;i<bdt.length;i++)if(bdt[i]===a){bdt.splice(i,1);return}}}}function Pmn(){return bdt.slice(0)}W(class aQt extends K{constructor(){super({id:"editor.action.measureExtHostLatency",title:L(16921,"Measure Extension Host Latency"),category:We.Developer,f1:!0})}async run(i){let e=i.get(ee),t=await Promise.all(Pmn().map(o=>o.measure()));e.openEditor({resource:void 0,contents:t.map(aQt._print).join(`

`),options:{pinned:!0}})}static _print(i){return i?`${i.remoteAuthority?`Authority: ${i.remoteAuthority}
`:""}Roundtrip latency: ${i.latency.toFixed(3)}ms
Up: ${aQt._printSpeed(i.up)}
Down: ${aQt._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 Xze=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 Fd;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 Sdt(i,this._runningLocation,t=>e.equals(t))}filterByExtensionHostKind(i,e){return Sdt(i,this._runningLocation,t=>t.kind===e)}filterByExtensionHostManager(i,e){return Sdt(i,this._runningLocation,t=>e.representsRunningLocation(t))}_computeAffinity(i,e,t){let o=new Fd;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 Fd,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(!Ea(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 Fd;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=BJi(e,t,f=>this.readExtensionKinds(f),(f,v,b,S,y)=>this._extensionHostKindPicker.pickExtensionHostKind(f,v,b,S,y)),r=new Fd;for(let f of e)r.set(f.identifier,f);for(let f of t)r.set(f.identifier,f);let s=new Fd,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 Cie);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 wie(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 Z2(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 Fd;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===Y.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 Cie),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 wie(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 Z2(s))}}};Xze=I([m(2,Vt),m(3,B),m(4,ne),m(5,xp)],Xze);function Sdt(a,i,e){return a.filter(t=>{let o=i.get(t.identifier);return o&&e(o)})}function t_o(a,i,e){return a.filter(t=>{let o=i.get(t);return o&&e(o)})}var Jze=class extends C{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 Np,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 TVi(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(PH,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)}};Jze=I([m(3,F),m(4,ne)],Jze);var _Vi=Object.hasOwnProperty,Amn=Promise.resolve(void 0),Kne=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N){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=N;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 MVi;this._registry=new nQt(this._activationEventReader);this._installedExtensionsReady=new Np;this._extensionStatus=new Fd;this._allRequestedActivateEvents=new Set;this._pendingRemoteActivationEvents=new Set;this._remoteCrashTracker=new xdt;this._deltaExtensionsQueue=[];this._inHandleDeltaExtensions=!1;this._extensionHostManagers=this._register(new DVi);this._resolveAuthorityAttempt=0;this._initializePromise=null;this._hasLocalProcess=e.hasLocalProcess,this._allowRemoteExtensionsInLocalWebWorker=e.allowRemoteExtensionsInLocalWebWorker,this._register(this._fileService.onWillActivateFileSystemProvider(O=>{O.scheme!==Y.vscodeRemote&&O.join(this.activateByEvent(`onFileSystem:${O.scheme}`))})),this._runningLocations=new Xze(this._registry,this._extensionHostKindPicker,this._environmentService,this._configurationService,this._logService,this._extensionManifestPropertiesService),this._register(this._extensionEnablementService.onEnablementChanged(O=>{let V=[],U=[];for(let G of O)this._safeInvokeIsEnabled(G)?V.push(G):U.push(G);Zf&&this._logService.info(`AbstractExtensionService.onEnablementChanged fired for ${O.map(G=>G.identifier.id).join(", ")}`),this._handleDeltaExtensions(new zne(V,U))})),this._register(this._extensionManagementService.onDidChangeProfile(({added:O,removed:V})=>{(O.length||V.length)&&(Zf&&this._logService.info("AbstractExtensionService.onDidChangeProfile fired"),this._handleDeltaExtensions(new zne(O,V)))})),this._register(this._extensionManagementService.onDidEnableExtensions(O=>{O.length&&(Zf&&this._logService.info("AbstractExtensionService.onDidEnableExtensions fired"),this._handleDeltaExtensions(new zne(O,[])))})),this._register(this._extensionManagementService.onDidInstallExtensions(O=>{let V=[],U=[];for(let{local:G,operation:$}of O)G&&G.isValid&&$!==4&&this._safeInvokeIsEnabled(G)&&(V.push(G),$===3&&U.push(G.identifier.id));V.length&&(Zf&&this._logService.info(`AbstractExtensionService.onDidInstallExtensions fired for ${V.map(G=>G.identifier.id).join(", ")}`),this._handleDeltaExtensions(new zne(V,U)))})),this._register(this._extensionManagementService.onDidUninstallExtension(O=>{O.error||(Zf&&this._logService.info(`AbstractExtensionService.onDidUninstallExtension fired for ${O.identifier.id}`),this._handleDeltaExtensions(new zne([],[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(16911,null),order:2}):O.join(this._doStopExtensionHosts(),{id:"join.stopExtensionHosts",label:d(16920,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){Zf&&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=kO(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:St.Error,message:d(16917,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=t_o(n,r,u=>e.representsRunningLocation(u)),c=gj.createActivationEventsMap(o);if(Zf){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=>Ei.equals(e.identifier,c.identifier)))return!1;let n=this._runningLocations.readExtensionKinds(e),r=e.extensionLocation.scheme===Y.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=>KEe(g,u,p,h))},c=await Oeo(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(){sn("code/willLoadExtensions"),this._startExtensionHostsIfNecessary(!0,[]);let e=await this._registry.acquireLock("_initialize");try{await this._resolveAndProcessExtensions(e),this._startOnDemandExtensionHosts()}finally{e.dispose()}this._releaseBarrier(),sn("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 ydt&&(t=Idt(this._logService,this._extensionEnablementService,this._extensionsProposedApi,h.extensions,!1),this._registry.deltaExtensions(e,t,[]),this._doHandleExtensionPoints(t,!0)),h instanceof wdt&&(o=Idt(this._logService,this._extensionEnablementService,this._extensionsProposedApi,h.extensions,!1)),h instanceof Cdt&&(n=Idt(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)Nmn(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=>Ei.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=>Ei.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:St.Error,message:d(16917,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(16916,null,this._environmentService.extensionTestsLocationURI.toString());console.error(o),this._notificationService.error(o);return}let t;try{t=await e.extensionTestsExecute(),Zf&&this._logService.info(`Extension host test runner exit code: ${t}`)}catch(o){Zf&&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(La(e,o.extensionLocation)){t=this._runningLocations.getRunningLocation(o.identifier);break}return t===null&&(e.scheme===Y.vscodeRemote?t=new Cie:t=new wie(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(ow.isNoResolverFound(n)||ow.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=sz(e),o=En.create(!1);this._logService.info(`Invoking resolveAuthority(${t})...`);try{sn(`code/willResolveAuthority/${t}`);let n=await this._resolveAuthority(e);return sn(`code/didResolveAuthorityOK/${t}`),this._logService.info(`resolveAuthority(${t}) returned '${n.authority.connectTo}' after ${o.elapsed()} ms`),n}catch(n){throw sn(`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 ow(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(16914,null,l,In(c)))})}});let r=await R8t(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:St.Warning,message:d(16915,null),detail:s.length===1?s[0]:s.join(`
 -`),primaryButton:d(16918,null)});if(l)return!0}return!r}_startExtensionHostsIfNecessary(e,t){let o=[];for(let n=0;n<=this._runningLocations.maxLocalProcessAffinity;n++)o.push(new wie(n));for(let n=0;n<=this._runningLocations.maxLocalWebWorkerAffinity;n++)o.push(new Z2(n));o.push(new Cie);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 P;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(Jze,e,t,o):this._instantiationService.createInstance(PH,e,t,o)}_onExtensionHostCrashOrExit(e,t,o){if(!VO(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(16912,null),{hideAfter:5e3}),this._startExtensionHostsIfNecessary(!1,Array.from(this._allRequestedActivateEvents.keys()))):this._notificationService.prompt(St.Error,d(16913,null),[{label:d(16919,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 zne(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):Amn):(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&&_Vi.call(n.contributes,e.name)&&o.push(new ekt(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(mo)}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)_Vi.call(l.contributes,c)&&(o[c]=!0);let n=l=>this._handleExtensionPointMessage(l),r=this._registry.getAllExtensionDescriptions(),s=Tn.getExtensionPoints();sn(t?"code/willHandleResolverExtensionPoints":"code/willHandleExtensionPoints");for(let l of s)o[l.name]&&(!t||l.canHandleResolver)&&(sn(`code/willHandleExtensionPoint/${l.name}`),Kne._handleExtensionPoint(l,r,n),sn(`code/didHandleExtensionPoint/${l.name}`));sn(t?"code/didHandleResolverExtensionPoints":"code/didHandleExtensionPoints")}_getOrCreateExtensionStatus(e){return this._extensionStatus.has(e)||this._extensionStatus.set(e,new RVi(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===St.Error?(o&&o.isUnderDevelopment&&this._notificationService.notify({severity:St.Error,message:n}),this._logService.error(n)):e.type===St.Warning?(o&&o.isUnderDevelopment&&this._notificationService.notify({severity:St.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&&_Vi.call(r.contributes,e.name)&&n.push({description:r,value:r.contributes[e.name],collector:new Nxt(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 Zxt(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])}};Kne=I([m(4,F),m(5,Ne),m(6,Vt),m(7,Te),m(8,Os),m(9,be),m(10,nt),m(11,Hd),m(12,Pe),m(13,B),m(14,xp),m(15,ne),m(16,yo),m(17,_K),m(18,ao),m(19,Mc),m(20,ct)],Kne);var DVi=class extends C{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 LVi(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)}},LVi=class{constructor(i,e){this.extensionHost=i;this.disposableStore=e}dispose(){this.disposableStore.dispose(),this.extensionHost.dispose()}},ydt=class{constructor(i){this.extensions=i}},wdt=class{constructor(i){this.extensions=i}},Cdt=class{constructor(i){this.extensions=i}},zne=class{constructor(i,e){this.toAdd=i;this.toRemove=e}};function i_o(a){return!!a.activationEvents?.some(i=>i.startsWith("onResolveRemoteAuthority:"))}function Idt(a,i,e,t,o){return e.updateEnabledApiProposals(t),o_o(a,i,t,o)}function o_o(a,i,e,t){let o=[],n=[],r=[];for(let l of e)l.isUnderDevelopment?o.push(l):(n.push(l),r.push(kE(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]):Zf&&a.info(`filterEnabledExtensions: extension '${n[l].identifier.value}' is disabled`);return o}function n_o(a,i,e,t){return o_o(a,i,[e],t).includes(e)}function Nmn(a,i){for(let e of a)if(Ei.equals(e.identifier,i))return!0;return!1}var RVi=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}},xdt=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}},MVi=class{readActivationEvents(i){return gj.readActivationEvents(i)}},PVi=class extends C{constructor(){super(...arguments);this.type="markdown"}shouldRender(e){return!!e.activationEvents}render(e){let t=e.activationEvents||[],o=new xe;if(t.length)for(let n of t)o.appendMarkdown(`- \`${n}\`
`);return{data:o,dispose:()=>{}}}};oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:"activationEvents",label:d(16910,null),access:{canToggle:!1},renderer:new Mt(PVi)});var Zze=class{constructor(i,e,t){this._logService=i;this._environmentService=e;if(this._envEnabledExtensions=new Set((e.extensionEnabledProposedApi??[]).map(o=>Ei.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=Ei.toKey(o),s=n.filter(l=>rz[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=Ei.toKey(i.identifier);if(dr(i.enabledApiProposals)&&(i.enabledApiProposals=i.enabledApiProposals.filter(t=>{let o=!!rz[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&&dr(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=[])}};Zze=I([m(0,ne),m(1,Vt),m(2,nt)],Zze);var AVi=class extends C{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 xe;if(t.length)for(let n of t)o.appendMarkdown(`- \`${n}\`
`);return{data:o,dispose:()=>{}}}};oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:"enabledApiProposals",label:d(16922,null),access:{canToggle:!1},renderer:new Mt(AVi)});var eKe=class extends C{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=VO(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:Dr,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===Y.file&&(r=!1),r||(o.break=!1),Cko(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(HQ(b,1)){this._createExtHostInitData(p).then(S=>{l.send(Je.fromString(JSON.stringify(S)))});return}if(HQ(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:lxe(this._productService,this._environmentService),appLanguage:Dr,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:Gt?2:1}}getInspectPort(){}enableInspectPort(){return Promise.resolve(!1)}async disconnect(){this._protocol&&!this._hasDisconnected&&(this._protocol.send(iQt(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)}};eKe=I([m(2,Fz),m(3,Pe),m(4,Vt),m(5,Te),m(6,ne),m(7,ol),m(8,ot),m(9,Mc),m(10,SD),m(11,nt),m(12,yne),m(13,aD)],eKe);function r_o(a,i,e,t,o){let n=new Fd;return a.forEach(r=>{let s=n.get(r.identifier);s&&o.warn(d(17012,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(BTt(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(17012,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(17013,null,s.extensionLocation.fsPath,r.extensionLocation.fsPath)),n.set(r.identifier,r)}),t.forEach(r=>{o.info(d(17011,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 tKe=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=Dr,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:",Cn(e[0].reason)));let n=[];e[1].status==="fulfilled"?n=e[1].value:(t=!0,this._logService.error("Error scanning user extensions:",Cn(e[1].reason)));let r=[];e[2].status==="fulfilled"?r=e[2].value:(t=!0,this._logService.error("Error scanning workspace extensions:",Cn(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(gt.Warning,f.length===1?d(17016,null,f[0].location.fsPath,f[0].validations[0][1]):d(17015,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=>H8t(g,!1)),c=n.map(g=>H8t(g,!1)),u=r.map(g=>kO(g,!1)),p=s.map(g=>H8t(g,!0)),h=r_o(l,c,u,p,this._logService);if(!t){let g=this._extensionsScannerService.onDidChangeCache(()=>{g.dispose(),this._notificationService.prompt(gt.Error,d(17014,null),[{label:d(17017,null),run:()=>this._hostService.reload()}])});Pi(5e3).then(()=>g.dispose())}return h}catch(i){return this._logService.error("Error scanning installed extensions:"),this._logService.error(i),[]}}};tKe=I([m(0,Ne),m(1,oi),m(2,FQ),m(3,mn),m(4,Hd),m(5,Vt),m(6,ne)],tKe);var NVi=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}},OVi=class a{constructor(){this.type=2}static{this.ENV_KEY="VSCODE_EXTHOST_WILL_SEND_SOCKET"}serialize(i){i[a.ENV_KEY]="1"}},kdt=class a{constructor(){this.type=3}static{this.ENV_KEY="VSCODE_WILL_SEND_MESSAGE_PORT"}serialize(i){i[a.ENV_KEY]="1"}};function Omn(a){delete a[NVi.ENV_KEY],delete a[OVi.ENV_KEY],delete a[kdt.ENV_KEY]}function s_o(a,i){Omn(i),a.serialize(i)}var FVi=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)}kill(){return this._extensionHostStarter.kill(this._id)}},iKe=class extends C{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=VO(this._environmentService);this._isExtensionDevHost=T.isExtensionDevHost,this._isExtensionDevDebug=T.isExtensionDevDebug,this._isExtensionDevDebugBrk=T.isExtensionDevDebugBrk,this._isExtensionDevTestFromCli=T.isExtensionDevTestFromCli,this._terminating=!1,this._inspectListener=null,this._extensionHostProcess=null,this._messageProtocol=null,this._register(this._lifecycleService.onWillShutdown(N=>this._onWillShutdown(N))),this._register(this._extensionHostDebugService.onClose(N=>{this._isExtensionDevHost&&this._environmentService.debugExtensionHost.debugId===N.sessionId&&this._nativeHostService.closeWindow()})),this._register(this._extensionHostDebugService.onReload(N=>{this._isExtensionDevHost&&this._environmentService.debugExtensionHost.debugId===N.sessionId&&this._hostService.reload()}))}dispose(){this._terminating||(this._terminating=!0,super.dispose(),this._messageProtocol=null)}start(){if(this._terminating)throw new ho;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 FVi(e.id,this._extensionHostStarter);let n=Nu(o,{VSCODE_ESM_ENTRYPOINT:"vs/workbench/api/node/extensionHostProcess",VSCODE_HANDLES_UNCAUGHT_ERRORS:!0});this._environmentService.debugExtensionHost.env&&Nu(n,this._environmentService.debugExtensionHost.env),Lwo(n),this._isExtensionDevHost&&delete n.VSCODE_CODE_CACHE_PATH;let r={responseWindowId:this._nativeHostService.windowId,responseChannel:"vscode:startExtensionHostMessagePortResult",responseNonce:_t(),env:n,detached:!!ri,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=H.any(H.map(l.event,f=>({data:`%c${f}`,format:[""]})),H.map(c.event,f=>({data:`%c${f}`,format:["color: red"]}))),p=H.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/inspector.html?experiments=true&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(17019,null):d(17018,null);this._notificationService.prompt(St.Warning,f,[{label:d(17021,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){s_o(new kdt,t.env);let o=DQ(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 S5;c.onmessage=(p=>{p.data&&u.fire(Je.wrap(p.data))}),c.start(),n({onMessage:u.event,send:p=>c.postMessage(p.buffer)})});let l=En.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();Zf&&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(HQ(c,1)){s(),this._createExtHostInitData().then(u=>{r(),e.send(Je.fromString(JSON.stringify(u)))});return}if(HQ(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.embedderIdentifier||"desktop",appUriScheme:this._productService.urlProtocol,isExtensionTelemetryLoggingOnly:lxe(this._productService,this._environmentService),isPortable:this._environmentService.isPortable,appLanguage:Dr,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?_q(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?Qd(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([H.toPromise(this._onDidSetInspectPort.event),Pi(1e3)]),!!this._inspectListener)}getInspectPort(){return this._inspectListener??void 0}_onWillShutdown(e){this._isExtensionDevHost&&!this._isExtensionDevTestFromCli&&!this._isExtensionDevDebug&&this._environmentService.debugExtensionHost.debugId&&(this._extensionHostDebugService.terminateSession(this._environmentService.debugExtensionHost.debugId),e.join(Pi(100),{id:"join.extensionDevelopment",label:d(17020,null)}))}};iKe=I([m(3,Pe),m(4,Ne),m(5,To),m(6,ao),m(7,ps),m(8,an),m(9,Te),m(10,ne),m(11,ol),m(12,ot),m(13,SD),m(14,oi),m(15,nt),m(16,Cve),m(17,G8t),m(18,aD)],iKe);var Edt=class extends Kne{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N,O){let V=e.createInstance(Zze),U=e.createInstance(tKe),G=new Tdt(V,U,()=>this._getExtensionRegistrySnapshotWhenReady(),e,o,r,p,f,S,g);super({hasLocalProcess:!0,allowRemoteExtensionsInLocalWebWorker:!1},V,G,new _ve(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=N;this._localCrashTracker=new xdt;this._extensionScanner=U,b.when(2).then(()=>{jv(It,()=>{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(St.Error,d(17027,null),[{label:d(17032,null),run:()=>{this._instantiationService.invokeFunction(s=>{s.get(oi).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(17025,null),{hideAfter:5e3}),this.startExtensionHosts();else{let s=[];this._environmentService.isBuilt?s.push({label:d(17037,null),run:()=>{this._instantiationService.invokeFunction(l=>{l.get(ge).executeCommand("extension.bisect.start")})}}):s.push({label:d(17022,null),run:()=>this._nativeHostService.openDevTools()}),s.push({label:d(17034,null),run:()=>this.startExtensionHosts()}),this._environmentService.isBuilt&&s.push({label:d(17031,null),run:()=>{this._instantiationService.invokeFunction(l=>{l.get(Qe).open("https://aka.ms/vscode-extension-bisect")})}}),this._notificationService.prompt(St.Error,d(17026,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}=A8i(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 ${sz(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!==Y.vscodeRemote||p.authority!==t)return p;sn(`code/willGetCanonicalURI/${sz(t)}`),Zf&&this._logService.info(`Invoking getCanonicalURI for authority ${sz(t)}...`);try{return this._getCanonicalURI(t,p)}finally{sn(`code/didGetCanonicalURI/${sz(t)}`),Zf&&this._logService.info(`getCanonicalURI returned for authority ${sz(t)}.`)}}),Zf&&this._logService.info("Starting to wait on IWorkspaceTrustManagementService.workspaceResolved..."),await this._workspaceTrustManagementService.workspaceResolved,Zf&&this._logService.info("Finished waiting on IWorkspaceTrustManagementService.workspaceResolved.");let s=(await this._scanAllLocalExtensions()).filter(p=>i_o(p));s.length&&e.emitOne(new ydt(s));let l;try{l=await this._resolveAuthorityInitial(t)}catch(p){return ow.isNoResolverFound(p)?p.isHandled=await this._handleNoResolverFound(t):ow.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:St.Error,message:d(17028,null)}),this._startLocalExtensionHost(e);let u=o.useHostProxy;this._register(this._configurationService.onDidChangeConfiguration(p=>{p.affectsConfiguration("http.useLocalProxyConfiguration")&&fdi(this._configurationService.getValue("http.useLocalProxyConfiguration"),u)})),fdi(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 Cdt(t)),e.emitOne(new wdt(await this._scanAllLocalExtensions()))}async _onExtensionHostExit(e){await this._doStopExtensionHosts(),this._remoteAgentService.getConnection()?.dispose(),VO(this._environmentService).isExtensionDevTestFromCli?(Zf&&this._logService.info(`Asking native host service to exit with code ${e}.`),this._nativeHostService.exit(e)):this._nativeHostService.closeWindow()}async _handleNoResolverFound(e){let t=$S(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(!n_o(this._logService,this._extensionEnablementService,s,!1)){let l=d(17024,null,o.friendlyName);this._notificationService.prompt(St.Info,l,[{label:d(17023,null),run:async()=>{await this._extensionEnablementService.setEnablement([kE(s)],12),await this._hostService.reload()}}],{sticky:!0,priority:3})}}else{let l=d(17030,null,o.friendlyName);this._notificationService.prompt(St.Info,l,[{label:d(17029,null),run:async()=>{let[c]=await this._extensionGalleryService.getExtensions([{id:n}],ve.None);c?(await this._extensionManagementService.installFromGallery(c),await this._hostService.reload()):this._notificationService.error(d(17033,null))}}],{sticky:!0,priority:3})}return!0}};Edt=I([m(0,F),m(1,Ne),m(2,Vt),m(3,Te),m(4,Os),m(5,be),m(6,nt),m(7,Hd),m(8,Pe),m(9,B),m(10,xp),m(11,ne),m(12,yo),m(13,_K),m(14,ao),m(15,Mc),m(16,To),m(17,oi),m(18,Gd),m(19,ta),m(20,ns),m(21,ct)],Edt);var Tdt=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=a_o(n,s)}createExtensionHost(i,e,t){switch(e.kind){case 1:{let o=t?2:1;return this._instantiationService.createInstance(iKe,e,o,this._createLocalProcessExtensionHostDataProvider(i,t,e))}case 2:{if(this._webWorkerExtHostEnablement!==0){let o=this._webWorkerExtHostEnablement===2?3:2;return this._instantiationService.createInstance(Qze,e,o,this._createWebWorkerExtensionHostDataProvider(i,e))}return null}case 3:{let o=this._remoteAgentService.getConnection();return o?this._instantiationService.createInstance(eKe,e,this._createRemoteExtensionHostDataProvider(i,o.remoteAuthority)):null}}}_createLocalProcessExtensionHostDataProvider(i,e,t){return{getInitData:async()=>{if(e){let o=await this._extensionScanner.scannedExtensions;Zf&&this._logService.info(`NativeExtensionHostFactory._createLocalProcessExtensionHostDataProvider.scannedExtensions: ${o.map(c=>c.identifier.value).join(",")}`);let n=Idt(this._logService,this._extensionEnablementService,this._extensionsProposedApi,o,!0);Zf&&this._logService.info(`NativeExtensionHostFactory._createLocalProcessExtensionHostDataProvider.localExtensions: ${n.map(c=>c.identifier.value).join(",")}`);let r=i.computeRunningLocation(n,[],!1),s=Sdt(n,r,c=>t.equals(c)),l=new Xle(0,n,s.map(c=>c.identifier));return Zf&&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 Xle(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 Xle(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 Xle(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}}}}};Tdt=I([m(3,F),m(4,Vt),m(5,Os),m(6,B),m(7,yo),m(8,Mc),m(9,ne)],Tdt);function a_o(a,i){if(a.isExtensionDevelopment&&a.extensionDevelopmentKind?.some(e=>e==="web"))return 1;{let e=i.getValue(ikt);return e===!0?1:e==="auto"?2:0}}var _ve=class{constructor(i,e,t){this._logService=t;this._hasRemoteExtHost=!!i.remoteAuthority;let o=a_o(i,e);this._hasWebWorkerExtHost=o!==0}pickExtensionHostKind(i,e,t,o,n){let r=_ve.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: ${VJi(n)} => ${kP(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}};_ve=I([m(0,Vt),m(1,B),m(2,ne)],_ve);var WVi=class extends K{constructor(){super({id:"workbench.action.restartExtensionHost",title:L(17035,"Restart Extension Host"),category:We.Developer,f1:!0})}async run(i){let e=i.get(lt);await e.stopExtensionHosts(d(17036,null))&&e.startExtensionHosts()}};W(WVi);we(lt,Edt,0);var _dt=class extends SFt{constructor(i,e,t,o){super(!1,i,e,t,o)}};_dt=I([m(0,Lu),m(1,an),m(2,le),m(3,ne)],_dt);we(TF,_dt,1);var Dve=class extends Tue{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;it||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})&&s$(!0,this.window)}async handleVetoBeforeClose(e,t){this.preventUnload(e),await this.dialogService.error(t,d(16659,null))}async confirmBeforeClose(e){if(this.skipUnloadConfirmation)return;this.preventUnload(e),await this.instantiationService.invokeFunction(o=>Dve.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=wS(this.window);return{...e,bounds:e.bounds,mode:this.maximized?0:t?2:1,alwaysOnTop:this.alwaysOnTop}}};Dve=I([m(3,B),m(4,To),m(5,F),m(6,oi),m(7,Vt),m(8,ct),m(9,ze),m(10,fi)],Dve);var Ddt=class extends Z5{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){sn("code/auxiliaryWindow/willResolveWindowId");let t=await e.vscode.ipcRenderer.invoke("vscode:registerAuxiliaryWindow",this.nativeHostService.windowId);return sn("code/auxiliaryWindow/didResolveWindowId"),Ey(typeof t=="number"),t}createContainer(e,t,o){let n;return typeof o?.zoomLevel=="number"?n=o.zoomLevel:n=RT(Ki()),MG(n,e),super.createContainer(e,t)}createAuxiliaryWindow(e,t,o){return new Dve(e,t,o,this.configurationService,this.nativeHostService,this.instantiationService,this.hostService,this.environmentService,this.dialogService,this.contextMenuService,this.layoutService)}};Ddt=I([m(0,fi),m(1,B),m(2,To),m(3,ct),m(4,F),m(5,Te),m(6,oi),m(7,Vt),m(8,ze)],Ddt);we($P,Ddt,1);var Ldt=class extends Lze{constructor(i,e,t,o,n){super(A.file(i.extensionsPath),e,t,o,n)}};Ldt=I([m(0,iC),m(1,be),m(2,an),m(3,dt),m(4,ne)],Ldt);we(Vne,Ldt,1);nx(wMe,"webContentExtractor");Hv(t2,"sharedWebContentExtractor");var df=ae("playwrightService");var Rdt=class{constructor(i,e){return i.call("__initialize",It.vscodeWindowId).catch(t=>{e.error("Failed to initialize Playwright service",t)}),dd.toService(i)}};Rdt=I([m(1,ne)],Rdt);Hv(df,"playwright",{channelClientCtor:Rdt});var Gne=ae("processService");nx(Gne,"process");var Mdt=class extends C{constructor(e){super();this.nativeHostService=e;this.onDidSuspend=e.onDidSuspendOS,this.onDidResume=H.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)}};Mdt=I([m(0,To)],Mdt);we(XLt,Mdt,1);var FG=class extends st{constructor(e,t,o,n){super(e,t);this.environmentService=o;this.nativeHostService=n}static{this.ID="workbench.action.openLogsFolder"}static{this.TITLE=L(10902,"Open Logs Folder")}run(){return this.nativeHostService.showItemInFolder(je(this.environmentService.logsHome,"main.log").with({scheme:Y.file}).fsPath)}};FG=I([m(2,ps),m(3,To)],FG);var WG=class extends st{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(10901,"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:Y.file}).fsPath)}};WG=I([m(2,ps),m(3,be),m(4,To)],WG);W(class extends K{constructor(){super({id:FG.ID,title:FG.TITLE,category:We.Developer,f1:!0})}run(a){return a.get(F).createInstance(FG,FG.ID,FG.TITLE.value).run()}});W(class extends K{constructor(){super({id:WG.ID,title:WG.TITLE,category:We.Developer,f1:!0})}run(a){return a.get(F).createInstance(WG,WG.ID,WG.TITLE.value).run()}});var lQt={showLanguagePackExtensions:d(10884,null),searchMarketplace:d(10883,null),installAndRestartMessage:d(10882,null),installAndRestart:d(10881,null)};var cQt=class a extends K{static{this.ID="workbench.action.configureLocale"}constructor(){super({id:a.ID,title:L(10874,"Configure Display Language"),menu:{id:D.CommandPalette},metadata:{description:L(10875,"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(_j),t=i.get(Ge),o=i.get(oB),n=i.get(zi),r=await e.getInstalledLanguages(),s=new P,l=s.add(t.createQuickPick({useSeparators:!0}));if(l.matchOnDescription=!0,l.placeholder=d(10872,null),r?.length){let u=[{type:"separator",label:d(10876,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(10871,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(10877,null),iconClass:"codicon-info"}]);return i}},dQt=class a extends K{static{this.ID="workbench.action.clearLocalePreference"}static{this.LABEL=L(10873,"Clear Display Language Preference")}constructor(){super({id:a.ID,title:a.LABEL,menu:{id:D.CommandPalette}})}async run(i){await i.get(oB).clearLocalePreference()}};var uQt=class extends C{constructor(){super(),W(cQt),W(dQt),Tn.registerExtensionPoint({extensionPoint:"localizations",defaultExtensionKind:["ui","workspace"],jsonSchema:{description:d(10863,null),type:"array",default:[],items:{type:"object",required:["languageId","translations"],defaultSnippets:[{body:{languageId:"",languageName:"",localizedLanguageName:"",translations:[{id:"vscode",path:""}]}}],properties:{languageId:{description:d(10864,null),type:"string"},languageName:{description:d(10865,null),type:"string"},localizedLanguageName:{description:d(10866,null),type:"string"},translations:{description:d(10867,null),type:"array",default:[{id:"vscode",path:""}],items:{type:"object",required:["id","path"],properties:{id:{type:"string",description:d(10868,null),pattern:"^((vscode)|([a-z0-9A-Z][a-z0-9A-Z-]*)\\.([a-z0-9A-Z][a-z0-9A-Z-]*))$",patternErrorMessage:d(10869,null)},path:{type:"string",description:d(10870,null)}},defaultSnippets:[{body:{id:"",path:""}}]}}}}}})}},VVi=class extends C{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(10859,null),d(10861,null),d(10862,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:()=>{}}}};oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:"localizations",label:d(10860,null),access:{canToggle:!1},renderer:new Mt(VVi)});var $ne=class extends uQt{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||Dr===o.languageId)return;let{languageId:n,languageName:r}=o;this.notificationService.prompt(gt.Info,d(10880,null,this.productService.nameLong,r||n),[{label:d(10878,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(Dr)||this.localeService.setLocale({id:"en",label:"English"})}async checkAndInstall(){let e=Dr,t=abe??"",o=JSON.parse(this.storageService.get($ne.LANGUAGEPACK_SUGGESTION_IGNORE_STORAGE_KEY,-1,"[]"));if(!this.galleryService.isEnabled()||!e||!t||IS.isDefaultVariant()||t.startsWith(e)||o.includes(t)||await this.isLocaleInstalled(t))return;let r=t,s=await this.galleryService.query({text:`tag:lp-${t}`},ve.None);if(s.total===0&&(t=t.split("-")[0],s=await this.galleryService.query({text:`tag:lp-${t}`},ve.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,ve.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(lQt).forEach(O=>{!v[O]||S?y[O]=lQt[O].replace("{0}",()=>g):y[O]=`${v[O].replace("{0}",()=>f)} (${lQt[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)}},N=y[b];this.notificationService.prompt(gt.Info,N,[l?T:k,{label:d(10879,null),isSecondary:!0,run:()=>{o.push(r),this.storageService.store($ne.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())))}};$ne=I([m(0,Ne),m(1,oB),m(2,nt),m(3,le),m(4,ls),m(5,ta),m(6,zi),m(7,Te)],$ne);var Wmn=oe.as(Qi.Workbench);Wmn.registerWorkbenchContribution($ne,4);function BVi(a,i,e){if(a.length)Tpt(a.map(t=>async()=>{(t.scheme===Y.file||t.scheme===Y.vscodeUserData)&&i.showItemInFolder(t.with({scheme:Y.file}).fsPath)}));else if(e.getWorkspace().folders.length){let t=e.getWorkspace().folders[0].uri;t.scheme===Y.file&&i.showItemInFolder(t.fsPath)}}var pQt="revealFileInOS",HVi=ri?L(10532,"Reveal in File Explorer"):it?L(10531,"Reveal in Finder"):L(10530,"Open Containing Folder"),oKe=x.or(Fo.Scheme.isEqualTo(Y.file),Fo.Scheme.isEqualTo(Y.vscodeUserData));yt.registerCommandAndKeybindingRule({id:pQt,weight:200,when:ue.focus.toNegated(),primary:2608,win:{primary:1584},handler:(a,i)=>{let e=e0(i,a.get(fo),a.get(ee),a.get(Et),a.get(za));BVi(e,a.get(To),a.get(Pe))}});var Vmn="workbench.action.files.revealActiveFileInWindows";yt.registerCommandAndKeybindingRule({weight:200,when:void 0,primary:Ai(2089,48),id:Vmn,handler:a=>{let e=a.get(ee).activeEditor,t=no.getOriginalUri(e,{filterByScheme:Y.file,supportSideBySide:1});BVi(t?[t]:[],a.get(To),a.get(Pe))}});Het(pQt,HVi.value,oKe,"2_files",!1,0);var mQt={id:pQt,title:HVi.value};fe.appendMenuItem(D.OpenEditorsContext,{group:"navigation",order:20,command:mQt,when:oKe});fe.appendMenuItem(D.OpenEditorsContextShare,{title:d(10529,null),submenu:D.MenubarShare,group:"share",order:3});fe.appendMenuItem(D.ExplorerContext,{group:"navigation",order:20,command:mQt,when:oKe});var Bmn=L(10528,"File");HR({id:pQt,title:HVi,category:Bmn},oKe);fe.appendMenuItem(D.ChatAttachmentsContext,{group:"navigation",order:20,command:mQt,when:oKe});fe.appendMenuItem(D.ChatInlineResourceAnchorContext,{group:"navigation",order:20,command:mQt,when:oKe});var Pdt=class extends C{constructor(e){super();this._delayer=this._register(new ya(2e3));this._register(e.onDidChangeDisplay(()=>{this._delayer.trigger(()=>(Fy.clearAllFontInfos(),Promise.resolve()))}))}};Pdt=I([m(0,To)],Pdt);oe.as(Qi.Workbench).registerWorkbenchContribution(Pdt,4);if(it){let a=function(i){return()=>{Ki().document.execCommand(i)}};yt.registerCommandAndKeybindingRule({id:"execCut",primary:2102,handler:a("cut"),weight:0,when:void 0}),yt.registerCommandAndKeybindingRule({id:"execCopy",primary:2081,handler:a("copy"),weight:0,when:void 0}),yt.registerCommandAndKeybindingRule({id:"execPaste",primary:2100,handler:a("paste"),weight:0,when:void 0})}var Lve=class extends C{static{this.SELECTION_LENGTH_LIMIT=65536}constructor(i,e){if(super(),Wn){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>Lve.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()}};Lve=I([m(1,Wi)],Lve);var nKe=class extends C{static{this.ID="workbench.contrib.linuxSelectionClipboardPastePreventer"}constructor(i){super(),this._register(H.runAndSubscribe(Fg,({window:e,disposables:t})=>{t.add(j(e.document,"mouseup",o=>{o.button===1&&(i.getValue("editor").selectionClipboard||o.preventDefault())}))},{window:It,disposables:this._store}))}};nKe=I([m(0,B)],nKe);var UVi=class extends xi{constructor(){super({id:"editor.action.selectionClipboardPaste",label:L(8418,"Paste Selection Clipboard"),precondition:ue.writable})}async run(i,e,t){let n=await i.get(Wi).readText("selection");e.trigger("keyboard","paste",{text:n,pasteOnNewLine:!1,multicursorText:null})}};go(ly,Lve,0);Wn&&(pt(nKe.ID,nKe,ut.BlockRestore),Jt(UVi));var Adt=class extends C{constructor(i,e){super(),this._register(e.onDidResumeOS(()=>{i.listCodeEditors().forEach(t=>t.render(!0))}))}};Adt=I([m(0,Kt),m(1,To)],Adt);oe.as(Qi.Workbench).registerWorkbenchContribution(Adt,4);var zVi=class a extends K{static{this.resource=A.parse("inmemory:///tm-log.txt")}constructor(){super({id:"editor.action.startDebugTextMate",title:L(8419,"Start TextMate Syntax Grammar Logging"),category:We.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(f4),t=i.get(Ct),o=i.get(ee),n=i.get(Kt),r=i.get(oi),s=i.get(ps),l=i.get(ol),c=i.get(be),u=je(s.tmpDir,`vcode-tm-log-${_t()}.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(zVi);var hQt=class extends C{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.")}},gQt=class extends C{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])}};nx(SD,hQt.ChannelName,{channelClientCtor:gQt});var fQt=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 vQt(){return 1025+Math.floor(64510*Math.random())}var UQ=class extends st{constructor(e,t){super(UQ._id,UQ._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(10080,null)}async run(){await this.issueService.openReporter({extensionId:this.extension.identifier.value})}};UQ=I([m(1,UC)],UQ);var bQt=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}},rKe=class extends st{constructor(e,t,o){super("report.slow",d(10114,null),"extension-action report-issue");this.extension=e;this.profile=t;this._instantiationService=o;this.enabled=!!bQt.fromExtension(e)}async run(){let e=await this._instantiationService.invokeFunction(KVi,this.extension,this.profile);e&&await e.run()}};rKe=I([m(2,F)],rKe);async function KVi(a,i,e){let t=bQt.fromExtension(i);if(!t)return;let o=a.get(_a),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},ve.None)}catch{return}let l=await E_(s);if(!l)return;let c=JSON.parse(l);if(!(!c||typeof c.total_count!="number"))return c.total_count===0?n.createInstance(Ndt,i,t,e):n.createInstance(Odt,i,t,e)}var Ndt=class extends st{constructor(e,t,o,n,r,s,l,c,u){super("report.slow",d(10113,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=$ze.rewriteAbsolutePaths(this.profile.data,"pii_removed"),t=je(this._environmentService.tmpDir,`${this.extension.identifier.value}-unresponsive.cpuprofile.txt`);await this._fileService.writeFile(t,Je.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(10112,null),d(10110,null,t.fsPath))}};Ndt=I([m(3,ct),m(4,Qe),m(5,nt),m(6,To),m(7,ps),m(8,be)],Ndt);var Odt=class extends st{constructor(e,t,o,n,r,s,l){super("show.slow",d(10115,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=$ze.rewriteAbsolutePaths(this.profile.data,"pii_removed"),t=je(this._environmentService.tmpDir,`${this.extension.identifier.value}-unresponsive.cpuprofile.txt`);await this._fileService.writeFile(t,Je.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(10112,null),d(10111,null,t.fsPath))}};Odt=I([m(3,ct),m(4,Qe),m(5,ps),m(6,be)],Odt);var zQ=ae("extensionHostProfileService"),sKe=new Q("profileSessionState","none"),Fdt=new Q("extensionHostProfileRecorded",!1),GVi=(o=>(o[o.None=0]="None",o[o.Starting=1]="Starting",o[o.Running=2]="Running",o[o.Stopping=3]="Stopping",o))(GVi||{}),YA=class extends xie{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=Fdt.bindTo(n),this._profileSessionState=sKe.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(GVi[w].toLowerCase())}))}_getProfileInfo(){return this._profileInfo}_getUnresponsiveProfile(e){return this._extensionHostProfileService.getUnresponsiveProfile(e)}_createSlowExtensionAction(e){return e.unresponsiveProfile?this._instantiationService.createInstance(rKe,e.description,e.unresponsiveProfile):null}_createReportExtensionIssueAction(e){return e.marketplaceInfo?this._instantiationService.createInstance(UQ,e.description):null}};YA=I([m(1,Te),m(2,De),m(3,X),m(4,zi),m(5,lt),m(6,Ne),m(7,ze),m(8,F),m(9,le),m(10,ot),m(11,Vt),m(12,Wi),m(13,zQ),m(14,YI),m(15,tt),m(16,qt)],YA);var SQt=class a extends K{static{this.ID="workbench.extensions.action.extensionHostProfile"}static{this.LABEL=d(10116,null)}constructor(){super({id:a.ID,title:{value:a.LABEL,original:"Start Extension Host Profile"},precondition:sKe.isEqualTo("none"),icon:M.circleFilled,menu:[{id:D.EditorTitle,when:x.and(fr.isEqualTo(YA.ID),sKe.notEqualsTo("running")),group:"navigation"},{id:D.ExtensionEditorContextMenu,when:sKe.notEqualsTo("running"),group:"profiling"}]})}run(i){return i.get(zQ).startProfiling(),Promise.resolve()}},IQt=class a extends K{static{this.ID="workbench.extensions.action.stopExtensionHostProfile"}static{this.LABEL=d(10120,null)}constructor(){super({id:a.ID,title:{value:a.LABEL,original:"Stop Extension Host Profile"},icon:M.debugStop,menu:[{id:D.EditorTitle,when:x.and(fr.isEqualTo(YA.ID),sKe.isEqualTo("running")),group:"navigation"},{id:D.ExtensionEditorContextMenu,when:sKe.isEqualTo("running"),group:"profiling"}]})}run(i){return i.get(zQ).stopProfiling(),Promise.resolve()}},yQt=class a extends K{static{this.LABEL=d(10117,null)}static{this.ID="workbench.extensions.action.openExtensionHostProfile"}constructor(){super({id:a.ID,title:{value:a.LABEL,original:"Open Extension Host Profile"},precondition:Fdt,icon:M.graph,menu:[{id:D.EditorTitle,when:x.and(fr.isEqualTo(YA.ID)),group:"navigation"},{id:D.ExtensionEditorContextMenu,when:Fdt,group:"profiling"}]})}async run(i){let e=i.get(zQ),t=i.get(ge),o=i.get(ee);e.lastProfileSavedTo||await t.executeCommand(Wdt.ID),e.lastProfileSavedTo&&await o.openEditor({resource:e.lastProfileSavedTo,options:{revealIfOpened:!0,override:"jsProfileVisualizer.cpuprofile.table"}},vn)}},Wdt=class a extends K{static{this.LABEL=d(10118,null)}static{this.ID="workbench.extensions.action.saveExtensionHostProfile"}constructor(){super({id:a.ID,title:{value:a.LABEL,original:"Save Extension Host Profile"},precondition:Fdt,icon:M.saveAll,menu:[{id:D.EditorTitle,when:x.and(fr.isEqualTo(YA.ID)),group:"navigation"},{id:D.ExtensionEditorContextMenu,when:Fdt,group:"profiling"}]})}run(i){let e=i.get(Vt),t=i.get(zQ),o=i.get(be),n=i.get(dn);return this._asyncRun(e,t,o,n)}async _asyncRun(i,e,t,o){let n=await o.showSaveDialog({title:d(10119,null),availableFileSystems:[Y.file],defaultUri:je(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=$ze.rewriteAbsolutePaths(s,"piiRemoved"),l=l+".txt");let c=A.file(l);return e.lastProfileSavedTo=c,t.writeFile(c,Je.fromString(JSON.stringify(r?r.data:{},null,"	")))}};async function c_o(a,i,e,t){let o=await a.getInspectPorts(1,!1);if(o.length===0){(await e.confirm({message:d(10094,null),detail:d(10095,null,t.nameLong),primaryButton:d(10096,null)})).confirmed&&await i.relaunch({addArgs:[`--inspect-extensions=${vQt()}`]});return}return o.length>1&&console.warn("There are multiple extension hosts available for debugging. Picking the first one..."),o[0].port}async function d_o(a,i){let e=await a.attachToCurrentWindowRenderer(i);return e.success?e.port:void 0}var wQt=class extends K{constructor(){super({id:"workbench.extensions.action.devtoolsExtensionHost",title:L(10093,"Debug Extension Host In Dev Tools"),category:We.Developer,f1:!0,icon:M.debugStart})}async run(i){let e=i.get(lt),t=i.get(To),o=i.get(Ge),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(10097,null),matchOnDetail:!0});if(s){let l=s.portInfo;t.openDevToolsWindow(l.devtoolsUrl)}}},CQt=class extends K{constructor(){super({id:"workbench.extensions.action.debugExtensionHost",title:L(10086,"Debug Extension Host In New Window"),category:We.Developer,f1:!0,icon:M.debugStart,menu:{id:D.EditorTitle,when:fr.isEqualTo(YA.ID),group:"navigation"}})}async run(i){let e=i.get(lt),t=i.get(To),o=i.get(ct),n=i.get(nt),r=i.get(F),s=i.get(oi),l=await c_o(e,t,o,n);if(l===void 0)return;r.createInstance(qne).storeDebugOnNewWindow(l),s.openWindow()}},xQt=class extends K{constructor(){super({id:"workbench.action.debugRenderer",title:L(10090,"Debug Renderer In New Window"),category:We.Developer,f1:!0})}async run(i){let e=i.get(SD),t=i.get(ps),o=i.get(F),n=i.get(oi),r=await d_o(e,t.window.id);if(r===void 0)return;o.createInstance(qne).storeRendererDebugOnNewWindow(r),n.openWindow({remoteAuthority:null})}},kQt=class extends K{constructor(){super({id:"workbench.action.debugExtensionHostAndRenderer",title:L(10089,"Debug Extension Host and Renderer In New Window"),category:We.Developer,f1:!0})}async run(i){let e=i.get(lt),t=i.get(To),o=i.get(ct),n=i.get(nt),r=i.get(SD),s=i.get(ps),l=i.get(F),c=i.get(oi),[u,p]=await Promise.all([c_o(e,t,o,n),d_o(r,s.window.id)]);if(u===void 0||p===void 0)return;let h=l.createInstance(qne);h.storeDebugOnNewWindow(u),h.storeRendererDebugOnNewWindow(p),c.openWindow({remoteAuthority:null})}},qne=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}};qne=I([m(0,le)],qne);var l_o={trace:!0,resolveSourceMapLocations:null,eagerSources:!0,timeouts:{sourceMapMinPause:3e4,sourceMapCumulativePause:3e5}},aKe=class extends C{constructor(e,t,o){super();this._debugService=e;this._instantiationService=t;let n=this._instantiationService.createInstance(qne),r=n.getAndDeleteDebugPortIfSet(),s=n.getAndDeleteRendererDebugPortIfSet(),l=[];r!==void 0&&l.push(o.withProgress({location:15,title:d(10088,null)},async()=>{await this._debugService.startDebugging(void 0,{type:"node",name:d(10087,null),request:"attach",port:r,...l_o})})),s!==void 0&&l.push(o.withProgress({location:15,title:d(10092,null)},async()=>{await this._debugService.startDebugging(void 0,{type:"chrome",name:d(10091,null),request:"attach",port:s,...l_o})})),Promise.all(l)}};aKe=I([m(0,Li),m(1,F),m(2,Bo)],aKe);var jne=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:wd(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=Yu.forUris();for(let f of e)f.extensionLocation.scheme===Y.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}}}};jne=I([m(2,lt),m(3,X8t)],jne);var lKe=class extends C{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 Fd;this._state=0;this.profilingStatusBarIndicatorLabelUpdater=this._register(new me);this._profile=null,this._profileSession=null,this._setState(0),qe.registerCommand("workbench.action.extensionHostProfiler.stop",()=>{this.stopProfiling(),this._editorService.openEditor(w0.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(10104,null),text:d(10098,null),showProgress:!0,ariaLabel:d(10098,null),tooltip:d(10103,null),command:"workbench.action.extensionHostProfiler.stop"},o=Date.now(),n=MI(It,()=>{this.profilingStatusBarIndicator?.update({...t,text:d(10099,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(10100,null),detail:d(10101,null,this._productService.nameLong),primaryButton:d(10102,null)}).then(t=>{t.confirmed&&this._nativeHostService.relaunch({addArgs:[`--inspect-extensions=${vQt()}`]})}):(e.length>1&&console.warn("There are multiple extension hosts available for profiling. Picking the first one..."),this._setState(1),this._instantiationService.createInstance(jne,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)}};lKe=I([m(0,lt),m(1,ee),m(2,F),m(3,To),m(4,ct),m(5,Tr),m(6,nt)],lKe);var EQt=class extends K{constructor(){super({id:"workbench.extensions.action.openExtensionsFolder",title:L(10107,"Open Extensions Folder"),category:We.Developer,f1:!0})}async run(i){let e=i.get(To),t=i.get(be),o=i.get(ps),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===Y.file)return e.showItemInFolder(s.fsPath)}},TQt=class extends K{constructor(){super({id:"_workbench.extensions.action.cleanUpExtensionsFolder",title:L(10106,"Cleanup Extensions Folder"),category:We.Developer,f1:!0})}async run(i){return i.get(ls).cleanUp()}};function u_o(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 $Vi(a);t?i6.onUnexpectedError(s):e.error(s)}var $Vi=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 Bdt=ae("IProfileAnalysisWorkerService"),Vdt=class{constructor(i,e,t){this._telemetryService=i;this._logService=e;this._webWorkerService=t}async _withWorker(i){let e=this._webWorkerService.createWorkerClient(new gx({esmModuleLocation:gn.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)u_o({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))}};Vdt=I([m(0,Te),m(1,ne),m(2,Ay)],Vdt);we(Bdt,Vdt,1);var cKe=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 QI;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 $e;this._session=t;let o;try{o=await this._instantiationService.createInstance(jne,e.host,e.port).start()}catch{this._session=void 0;return}this._logService.info("UNRESPONSIVE extension host: starting to profile NOW");try{await Pi(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=Yu.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===Y.file).map(h=>[h.extensionLocation,Ei.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=_t(),u=je(this._environmentServie.tmpDir,`exthost-${Math.random().toString(16).slice(2,8)}.cpuprofile`);if(await this._fileService.writeFile(u,Je.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:Ei.toKey(l.identifier)}),this._extensionProfileService.setUnresponsiveProfile(l.identifier,i),!(s>=95&&r>=5e6))return;let p=await this._instantiationService.invokeFunction(KVi,l,i);p&&(this._blame.has(l.identifier)||this._blame.size>=3||(this._blame.add(l.identifier),this._notificationService.prompt(St.Warning,d(10109,null,l.displayName||l.name),[{label:d(10108,null),run:()=>this._editorService.openEditor(w0.instance,{pinned:!0})},p],{priority:2})))}};cKe=I([m(0,lt),m(1,zQ),m(2,Te),m(3,ne),m(4,Ne),m(5,ee),m(6,F),m(7,ps),m(8,Bdt),m(9,B),m(10,be),m(11,wC)],cKe);function Udt(a,i,e,t,o,n){let r=[],s=[],l=[];if(!i){let V=a.filter(({identifier:U})=>o.every(G=>G.toLowerCase()!==U.id.toLowerCase()));return{local:{added:r,removed:s,updated:l},remote:V.length>0?{added:V,updated:[],removed:[],all:V}:null}}a=a.map(qVi),i=i.map(qVi),e=e?e.map(qVi):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 U=V.identifier.uuid||c.get(V.identifier.id.toLowerCase());return U?`uuid:${U}`:`id:${V.identifier.id.toLowerCase()}`},h=(V,U)=>(V.set(p(U),U),V),g=a.reduce(h,new Map),f=i.reduce(h,new Map),v=i.reduce((V,U)=>h(V,Xi(U)),new Map),b=e?e.reduce(h,new Map):null,S=t.reduce(h,new Map),y=o.reduce((V,U)=>{let G=c.get(U.toLowerCase());return V.add(G?`uuid:${G}`:`id:${U.toLowerCase()}`)},new Set),w=n?n.reduce((V,{id:U,uuid:G})=>(G=G??c.get(U.toLowerCase()),V.add(G?`uuid:${G}`:`id:${U.toLowerCase()}`)),new Set):null,k=_Qt(g,f,y,!1);if(k.added.size>0||k.removed.size>0||k.updated.size>0){let V=_Qt(b,g,y,!1),U=_Qt(b,f,y,!0),G=($,te,pe,de)=>{let se,Se,ke;return te.installed?(se=de.pinned,ke=de.preRelease,se&&(Se=de.version)):(se=pe.pinned,ke=pe.preRelease,se&&(Se=pe.version)),se===void 0&&(se=te.pinned,se&&(Se=te.version)),ke===void 0&&(ke=te.preRelease),{...de,installed:te.installed||pe.installed,pinned:se,preRelease:ke,version:Se??(pe.version&&(!te.installed||iR(pe.version,te.version))?pe.version:te.version),state:Hmn(te,pe,b?.get($))}};for(let $ of U.removed.values()){let te=g.get($);if(!te)continue;let pe=Oi(b?.get($)),de=w&&!w.has($)&&pe.installed;te.installed&&de?s.push(te.identifier):v.set($,te)}for(let $ of U.added.values()){let te=Oi(f.get($)),pe=g.get($);if(pe){if(k.updated.has($)){let de=G($,pe,te,te);p_o(pe,te,!1,!1)||l.push(Hdt(de,$)),v.set($,de)}}else te.installed&&r.push(Hdt(te,$))}for(let $ of U.updated.values()){let te=Oi(f.get($)),pe=Oi(b?.get($)),de=g.get($);if(de)if(w&&!w.has($)&&pe.installed&&de.installed&&!te.installed)s.push(de.identifier);else{let Se=G($,de,te,te);l.push(Hdt(Se,$)),v.set($,Se)}else te.installed&&r.push(Hdt(te,$))}for(let $ of V.added.values())U.added.has($)||v.set($,Oi(g.get($)));for(let $ of V.updated.values()){if(U.removed.has($)||U.updated.has($))continue;let te=Oi(g.get($)),pe=Oi(f.get($));v.set($,G($,te,pe,te))}for(let $ of V.removed.values())U.updated.has($)||U.removed.has($)||S.has($)||Oi(f.get($)).installed&&w&&(w.has($)||!Oi(b?.get($)).installed||v.delete($))}let T=[],N=_Qt(f,v,new Set,!0),O=N.added.size>0||N.updated.size>0||N.removed.size>0;return O&&v.forEach((V,U)=>T.push(Hdt(V,U))),{local:{added:r,removed:s,updated:l},remote:O?{added:[...N.added].map(V=>v.get(V)),updated:[...N.updated].map(V=>v.get(V)),removed:[...N.removed].map(V=>f.get(V)),all:T}:null}}function _Qt(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||!p_o(u,p,t,!0))&&l.add(c)}return{added:r,removed:s,updated:l}}function p_o(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)||!Umn(a.state,i.state)||e&&a.version!==i.version)}function Hmn(a,i,e){let t=a.state,o=i.state,n=e?.state;if(!i.version||t&&iR(a.version,i.version))return t;if(o&&iR(i.version,a.version)||!t)return o;if(!o)return t;let r=Xi(t),s=n?jVi(n,o):{added:Object.keys(o).reduce((c,u)=>(c.add(u),c),new Set),removed:new Set,updated:new Set},l=n?jVi(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 jVi(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];uo(l,c)||r.add(s)}return{added:o,removed:n,updated:r}}function Umn(a={},i={}){let{added:e,removed:t,updated:o}=jVi(a,i);return e.size===0&&t.size===0&&o.size===0}function qVi(a){return{...a,disabled:!!a.disabled,installed:!!a.installed}}function Hdt(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 LQt(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=>!Ot(n.identifier,o.identifier))&&(o.installed=!0)}return e}function zmn(a,i){return a.sort((e,t)=>!e.identifier.uuid&&t.identifier.uuid?-1:e.identifier.uuid&&!t.identifier.uuid?1:Al(e.identifier.id,t.identifier.id)),i?rF(a,{}):JSON.stringify(a)}var DQt=class extends aB{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:HC,authority:"base"});this.localResource=this.previewResource.with({scheme:HC,authority:"local"});this.remoteResource=this.previewResource.with({scheme:HC,authority:"remote"});this.acceptedResource=this.previewResource.with({scheme:HC,authority:"accepted"});this.localExtensionsProvider=this.instantiationService.createInstance(zdt),this._register(H.any(H.filter(this.extensionManagementService.onDidInstallExtensions,(w=>w.some(({local:k})=>!!k))),H.filter(this.extensionManagementService.onDidUninstallExtension,(w=>!w.error)),H.filter(S.onDidChange,w=>w.valueChanges.some(({profile:k,changes:T})=>this.syncResource.profile.id===k.id&&T.some(N=>N.key===nY))),v.onDidChangeExtensionStorageToSync)(()=>this.triggerLocalChange()))}async generateSyncPreview(e,t){let o=e.syncData?await LQt(e.syncData,this.extensionManagementService):null,n=t?.skippedExtensions??[],r=t?.builtinExtensions??null,s=t?.syncData?await LQt(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}=Udt(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 LQt(e.syncData,this.extensionManagementService):null,{localExtensions:o,ignoredExtensions:n}=await this.localExtensionsProvider.getLocalExtensions(this.syncResource.profile),{remote:r}=Udt(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=Udt(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=Udt(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 zmn(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}};DQt=I([m(2,Co),m(3,be),m(4,le),m(5,CF),m(6,VJ),m(7,ls),m(8,MK),m(9,uy),m(10,B),m(11,_l),m(12,Te),m(13,Hz),m(14,dt),m(15,TF),m(16,F)],DQt);var zdt=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&&!Xq(p)&&(v.isApplicationScoped=f),s.some(b=>Ot(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(`${QDe("extensions",i)}: Error while parsing extension state`,Cn(b))}return v})}),ignoredExtensions:t}}async updateLocalExtensions(i,e,t,o,n){let r=QDe("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 fn.settled([...i,...t].map(async b=>{let S=p.find(k=>Ot(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=>Ot(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}],ve.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=>Ot(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:{[hj]:!0,[YW]:"settingsSync",[UL]:!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=>Ot(v,S)));await fn.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 ch&&["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=>Ot(v,f.identifier))||g.push(f);for(let f of u)g.some(v=>Ot(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 P,n=o.add(this.instantiationService.createChild(new Io([le,t]))),r=o.add(n.createInstance(CK)),s=o.add(n.createInstance(pw));try{return await e(r,s)}finally{o.dispose()}})}};zdt=I([m(0,ls),m(1,TF),m(2,ta),m(3,MK),m(4,F),m(5,uy)],zdt);var dKe=class extends YJ{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 LQt(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=>Ot(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}}};dKe=I([m(0,ls),m(1,MK),m(2,be),m(3,an),m(4,Co),m(5,ne),m(6,le),m(7,dt)],dKe);var uKe=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(L5t);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=>Ot(n.identifier,{id:r}))).filter(n=>!t.some(r=>Ot(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})),ve.None),t=[];for(let{id:o,installOptions:n}of i){let r=e.find(s=>Ot(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)))}};uKe=I([m(0,yo),m(1,_K),m(2,ta),m(3,Gc),m(4,zi),m(5,ne),m(6,B)],uKe);var pKe=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=`${rii}.${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(sB,this.userDataSyncStoreManagementService.userDataSyncStore.url);l.setAuthToken(s.accessToken,n.options.authenticationSession.providerId);let c=await l.readResource("extensions",null),u=new Io;u.set(ls,t.extensionManagementService),await this.instantiationService.createChild(u).createInstance(Kdt).initialize(c)}};pKe=I([m(0,Gc),m(1,le),m(2,yo),m(3,TR),m(4,F),m(5,ne),m(6,Cs),m(7,Mc),m(8,_l)],pKe);var Kdt=class extends dKe{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},ve.None);s.length&&await Promise.allSettled(s.map(async l=>{let c=await this.extensionGalleryService.getManifest(l,ve.None);if(c&&this.extensionManifestPropertiesService.canExecuteOnWorkspace(c)){let u=t.find(p=>Ot(p.identifier,p.identifier));await this.extensionManagementService.installFromGallery(l,{installPreReleaseVersion:u?.preRelease,donotIncludePackAndDependencies:!0,context:{[UL]:!0}})}}))}};Kdt=I([m(0,ls),m(1,MK),m(2,be),m(3,an),m(4,Co),m(5,ne),m(6,dt),m(7,ta),m(8,le),m(9,xp)],Kdt);we(zQ,lKe,1);oe.as(rn.EditorPane).registerEditorPane(ys.create(YA,YA.ID,d(10105,null)),[new Mt(w0)]);var QVi=class{canSerialize(i){return!0}serialize(i){return""}deserialize(i){return w0.instance}};oe.as(rn.EditorFactory).registerEditorSerializer(w0.ID,QVi);var Gdt=class extends C{constructor(i,e){super(),e.registerChannel("extensionRecommendationNotification",new fQt(i)),this._register(W(EQt)),this._register(W(TQt))}};Gdt=I([m(0,yie),m(1,Fb)],Gdt);var $dt=oe.as(Qi.Workbench);$dt.registerWorkbenchContribution(Gdt,3);$dt.registerWorkbenchContribution(cKe,4);$dt.registerWorkbenchContribution(pKe,3);$dt.registerWorkbenchContribution(uKe,3);$dt.registerWorkbenchContribution(aKe,3);W(CQt);W(xQt);W(kQt);W(SQt);W(IQt);W(Wdt);W(yQt);W(wQt);var KQ=class extends yh{constructor(e,t,o,n,r){super(KQ.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(10732,null),l=Up(e,r,!0),c=Up(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(10731,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(M.info),tooltip:d(10730,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=Up(e,r,!0);if(c)return{label:r,highlights:{label:c},buttons:n,trigger:s,accept:l}}};KQ=I([m(0,qt),m(1,X),m(2,ge),m(3,lt),m(4,nt)],KQ);var RQt=ae("ITroubleshootIssueService");var mKe=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{}}},VG=class extends C{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(10778,null),detail:d(10764,null,this.productService.nameLong),primaryButton:d(10771,null),custom:!0})).confirmed)return;let t=this.userDataProfileService.currentProfile;await this.userDataProfileImportExportService.createTroubleshootProfile(),this.state=new mKe(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 mKe(2,this.state.profile);return}let e=await this.askToReproduceIssue(d(10772,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 mKe(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(10766,null));e==="stop"&&await this.stop(),e==="good"&&await this.askToReportIssue(d(10770,null)),e==="bad"&&await this.askToReportIssue(d(10769,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(10768,null),run:()=>t("good")},r={label:d(10776,null),run:()=>t("bad")},s={label:d(10775,null),run:()=>t("stop")};this.notificationHandle=this.notificationService.prompt(St.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:St.Info,message:d(10778,null),detail:d(10780,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(10778,null),primaryButton:d(10765,null,this.productService.nameLong),cancelButton:d(10773,null),detail:d(10761,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(10778,null),buttons:[{label:d(10767,null),run:()=>"good"},{label:d(10763,null),run:()=>"bad"}],cancelButton:{label:d(10774,null),run:()=>"stop"},detail:d(10762,null,this.productService.nameLong),custom:{disableCloseAction:!0}})).result}get state(){if(this._state===void 0){let e=this.storageService.get(VG.storageKey,0);this._state=mKe.fromJSON(e)}return this._state||void 0}set state(e){this._state=e??null,this.updateState(e)}updateState(e){e?this.storageService.store(VG.storageKey,JSON.stringify(e),0,1):this.storageService.remove(VG.storageKey,0)}};VG=I([m(0,mn),m(1,an),m(2,UE),m(3,PV),m(4,ct),m(5,a4),m(6,Ne),m(7,ls),m(8,Os),m(9,UC),m(10,nt),m(11,oi),m(12,le),m(13,Qe)],VG);var GQ=class extends C{constructor(e,t,o){super();this.contextKeyService=e;this.troubleshootIssueService=t;this.updateContext(),t.isActive()&&t.resume(),this._register(o.onDidChangeValue(0,VG.storageKey,this._store)(()=>{this.updateContext()}))}static{this.ctxIsTroubleshootActive=new Q("isIssueTroubleshootActive",!1)}updateContext(){GQ.ctxIsTroubleshootActive.bindTo(this.contextKeyService).set(this.troubleshootIssueService.isActive())}};GQ=I([m(0,X),m(1,RQt),m(2,le)],GQ);oe.as(Qi.Workbench).registerWorkbenchContribution(GQ,3);W(class extends K{constructor(){super({id:"workbench.action.troubleshootIssue.start",title:L(10779,"Troubleshoot Issue..."),category:We.Help,f1:!0,precondition:x.and(GQ.ctxIsTroubleshootActive.negate(),ub.isEqualTo(""),ep.negate())})}run(i){return i.get(RQt).start()}});W(class extends K{constructor(){super({id:"workbench.action.troubleshootIssue.stop",title:L(10777,"Stop Troubleshoot Issue"),category:We.Help,f1:!0,precondition:GQ.ctxIsTroubleshootActive})}async run(a){return a.get(RQt).stop()}});we(RQt,VG,1);var YVi="workbench.action.openIssueReporter",Kmn="vscode.openIssueReporter",m_o={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"}}}]}}]},hKe=class extends C{constructor(i,e){if(super(),!e.getValue("telemetry.feedback.enabled")){this._register(qe.registerCommand({id:"workbench.action.openIssueReporter",handler:function(o){o.get(Ne).info("Feedback is disabled.")}}));return}if(!i.reportIssueUrl)return;this._register(qe.registerCommand({id:YVi,handler:function(o,n){let r=typeof n=="string"?{extensionId:n}:Array.isArray(n)?{extensionId:n[0]}:n??{};return o.get(UC).openReporter(r)},metadata:m_o})),this._register(qe.registerCommand({id:Kmn,handler:function(o,n){let r=typeof n=="string"?{extensionId:n}:Array.isArray(n)?{extensionId:n[0]}:n??{};return o.get(UC).openReporter(r)},metadata:m_o}));let t={id:YVi,title:L(10782,"Report Issue..."),category:We.Help};this._register(fe.appendMenuItem(D.CommandPalette,{command:t})),this._register(fe.appendMenuItem(D.MenubarHelpMenu,{group:"3_feedback",command:{id:YVi,title:d(10781,null)},order:3}))}};hKe=I([m(0,nt),m(1,B)],hKe);var Rve=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:Gmn(r),zoomLevel:RT(It),enabledExtensions:e,experiments:t?.join(`
`),restrictedMode:!this.workspaceTrustManagementService.isWorkspaceTrusted(),isUnsupported:n,githubAccessToken:o},i);return this.issueFormService.openReporter(s)}};Rve=I([m(0,UK),m(1,De),m(2,ls),m(3,Os),m(4,ns),m(5,kC),m(6,Cs),m(7,z1e)],Rve);function Gmn(a){return{backgroundColor:Ok(a,op),color:Ok(a,ko),textLinkColor:Ok(a,WI),textLinkActiveForeground:Ok(a,igt),inputBackground:Ok(a,Gb),inputForeground:Ok(a,pL),inputBorder:Ok(a,Vy),inputActiveBorder:Ok(a,cW),inputErrorBorder:Ok(a,Nse),inputErrorBackground:Ok(a,ggt),inputErrorForeground:Ok(a,fgt),buttonBackground:Ok(a,MS),buttonForeground:Ok(a,YT),buttonHoverBackground:Ok(a,B$),sliderActiveColor:Ok(a,NU),sliderBackgroundColor:Ok(a,op),sliderHoverColor:Ok(a,AU)}}function Ok(a,i){let e=a.getColor(i);return e?e.toString():void 0}we(UC,Rve,1);var h_o=ur(d(10755,null)),g_o=ur(d(10754,null)),f_o=ur(d(10756,null)),v_o=ur(d(10753,null)),b_o=ur(d(10751,null)),S_o=ur(d(10752,null)),I_o=ur(d(10733,null)),$mn=d(10750,null),y_o=()=>`
<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">${ur(d(10735,null))}</div>

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

	<div class="section">
		<div class="input-group">
			<label class="inline-label" for="issue-type">${ur(d(10749,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">${ur(d(10746,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">${ur(d(10745,null))}</div>
			<div id="problem-source-help-text" class="instructions hidden">${ur(d(10740,null)).replace("{0}",()=>`<span tabIndex=0 role="button" id="disableExtensions" class="workbenchCommand">${ur(d(10739,null))}</span>`)}
			</div>

			<div id="extension-selection">
				<label class="inline-label" for="extension-selector">${ur(d(10734,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">${ur(d(10744,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">
					${ur(d(10743,null))}
				</div>
			</div>
		</div>

		<div id="issue-title-container" class="input-group">
			<label class="inline-label" for="issue-title">${ur(d(10747,null))} <span class="required-input">*</span></label>
			<input id="issue-title" type="text" class="inline-form-control" placeholder="${ur(d(10748,null))}" required>
			<div id="issue-title-empty-error" class="validation-error hidden" role="alert">${ur(d(10758,null))}</div>
			<div id="issue-title-length-validation-error" class="validation-error hidden" role="alert">${ur(d(10759,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="${ur(d(10738,null))}" required></textarea>
		</div>
		<div id="description-empty-error" class="validation-error hidden" role="alert">${ur(d(10736,null))}</div>
		<div id="description-short-error" class="validation-error hidden" role="alert">${ur(d(10737,null))}</div>
	</div>

	<div class="system-info" id="block-container">
		<div class="block block-extension-data">
			<input class="send-extension-data" aria-label="${S_o}" type="checkbox" id="includeExtensionData" checked/>
			<label class="extension-caption" id="extension-caption" for="includeExtensionData">
				${S_o}
				<span id="ext-loading" hidden></span>
				<span class="ext-parens" hidden>(</span><a href="#" class="showInfo" id="extension-id">${ur(d(10757,null))}</a><span class="ext-parens" hidden>)</span>
				<a id="extension-data-download">${ur(d(10741,null))}</a>
			</label>
			<pre class="block-info" id="extension-data" placeholder="${ur(d(10742,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="${h_o}" type="checkbox" id="includeSystemInfo" checked/>
			<label class="caption" for="includeSystemInfo">
				${h_o}
				(<a href="#" class="showInfo">${ur(d(10757,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="${g_o}" type="checkbox" id="includeProcessInfo" checked/>
			<label class="caption" for="includeProcessInfo">
				${g_o}
				(<a href="#" class="showInfo">${ur(d(10757,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="${f_o}" type="checkbox" id="includeWorkspaceInfo" checked/>
			<label class="caption" for="includeWorkspaceInfo">
				${f_o}
				(<a href="#" class="showInfo">${ur(d(10757,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="${v_o}" type="checkbox" id="includeExtensions" checked/>
			<label class="caption" for="includeExtensions">
				${v_o}
				(<a href="#" class="showInfo">${ur(d(10757,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="${b_o}" type="checkbox" id="includeExperiments" checked/>
			<label class="caption" for="includeExperiments">
				${b_o}
				(<a href="#" class="showInfo">${ur(d(10757,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="${I_o}" type="checkbox" id="includeAcknowledgement"/>
			<label class="caption" for="includeAcknowledgement">
				${I_o}
			</label>
		</div>
	</div>

</div>`;function XVi(a){return a.endsWith(".git")&&(a=a.substr(0,a.length-4)),a=ih(a,"/"),a.endsWith("/new")&&(a=ih(a,"/new")),a.endsWith("/issues")&&(a=ih(a,"/issues")),a}var MQt=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,It.addEventListener("message",async t=>{t.data&&t.data.sendChannel==="vscode:triggerIssueData"&&It.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=>RF(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=>{RF(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 w_o=7500,qmn=6e4;var BG=class extends C{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 jo(300);this.nonGitHubIssueUrl=!1;this.needsUpdate=!1;this.acknowledged=!1;let v=t.extensionId?t.enabledExtensions.find(U=>U.id.toLocaleLowerCase()===t.extensionId?.toLocaleLowerCase()):void 0;this.issueReporterModel=new MQt({...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}${rbe?" snap":""}`},extensionsDisabled:!!this.disableExtensions,fileOnExtension:t.extensionId?!v?.isBuiltin:void 0,selectedExtension:v}),this._register(this.authenticationService.onDidChangeSessions(async()=>{let U=!!this.data.githubAccessToken,G="";try{G=(await this.authenticationService.getSessions("github")).filter(de=>de.scopes.includes("repo"))[0]?.accessToken}catch{}this.data.githubAccessToken=G,U!==!!G&&this.updateButtonStates()}));let b=t.issueSource==="marketplace",S=t.issueSource==="vscode";this.issueReporterModel.update({fileOnMarketplace:b,fileOnProduct:S}),this.createAction=this._register(new st("issueReporter.create",d(10692,null),void 0,!0,async()=>{this.delayedSubmit.trigger(async()=>{this.createIssue(!0)})})),this.previewAction=this._register(new st("issueReporter.preview",d(10712,null),void 0,!0,async()=>{this.delayedSubmit.trigger(async()=>{this.createIssue(!1)})})),this.privateAction=this._register(new st("issueReporter.privateCreate",d(10714,null),void 0,!0,async()=>{this.delayedSubmit.trigger(async()=>{this.createIssue(!0,!0)})}));let y=t.issueTitle;if(y){let U=this.getElementById("issue-title");U&&(U.value=y)}let w=t.issueBody;if(w){let U=this.getElementById("description");U&&(U.value=w,this.issueReporterModel.update({issueDescription:w}))}this.window.document.documentElement.lang!=="en"&&cm(this.getElementById("english"));let k=hr();k.id="codiconStyles";let T=this._register(YOt(this.themeService));function N(){k.textContent=T.getCSS()}let O=new Dt(N,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=ur(d(10704,null))}updatePublicGithubButton(e){if(!this.getElementById("issue-reporter"))return;this.publicGithubButton&&this.publicGithubButton.dispose(),!this.acknowledged&&this.needsUpdate?(this.publicGithubButton=this._register(new Mi(e,fwe)),this.publicGithubButton.label=d(10688,null),this.publicGithubButton.enabled=!1):this.data.githubAccessToken&&this.isPreviewEnabled()?(this.publicGithubButton=this._register(new $I(e,{contextMenuProvider:this.contextMenuService,actions:[this.previewAction],addPrimaryActionToDropdown:!1,...fwe})),this._register(this.publicGithubButton.onDidClick(()=>{this.createAction.run()})),this.publicGithubButton.label=d(10694,null),this.publicGithubButton.enabled=!0):this.data.githubAccessToken&&!this.isPreviewEnabled()?(this.publicGithubButton=this._register(new Mi(e,fwe)),this._register(this.publicGithubButton.onDidClick(()=>{this.createAction.run()})),this.publicGithubButton.label=d(10694,null),this.publicGithubButton.enabled=!0):(this.publicGithubButton=this._register(new Mi(e,fwe)),this._register(this.publicGithubButton.onDidClick(()=>{this.previewAction.run()})),this.publicGithubButton.label=d(10713,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"),Wb(t))}updateInternalGithubButton(e){this.getElementById("issue-reporter")&&(this.internalGithubButton&&this.internalGithubButton.dispose(),this.data.githubAccessToken&&this.data.privateUri&&(this.internalGithubButton=this._register(new Mi(e,fwe)),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(10693,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)):(Wb(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}=wI(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();Fi(n,this.makeOption("",d(10716,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(M.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(M.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(10703,null)):(Wb(l),r.textContent=d(10718,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 Wb(n);let r=this.getElementById("issue-title");o==="vscode"?r.placeholder=d(10724,null):o==="extension"?r.placeholder=d(10699,null):o==="marketplace"?r.placeholder=d(10706,null):r.placeholder=d(10721,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>w_o?cm(n):Wb(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=it?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()}it&&o&&t.key==="a"&&t.target&&(Wre(t.target)||L6(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(10719,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(Qo(s.state==="open"?M.issueOpened:M.issueClosed));let h=_("span.issue-state.label");h.textContent=s.state==="open"?d(10707,null):d(10691,null),c.title=s.state==="open"?d(10707,null):d(10691,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()},ur(r)),t=this.getElementById("issue-type"),{issueType:o}=this.issueReporterModel.getData();Fi(t,e(0,d(10690,null)),e(2,d(10700,null)),e(1,d(10710,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(10717,null),!0)),e.append(this.makeOption("vscode",d(10723,null),!1)),e.append(this.makeOption("extension",d(10698,null),!1)),this.product.reportMarketplaceIssueUrl&&e.append(this.makeOption("marketplace",d(10705,null),!1)),t!==2&&e.append(this.makeOption("unknown",d(10722,null),!1)),l!==-1&&l<e.options.length?e.selectedIndex=l:(e.selectedIndex=0,Wb(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");Wb(r),Wb(s),Wb(l),Wb(c),Wb(u),Wb(p),Wb(b),Wb(k),Wb(h),Wb(S),cm(g),cm(y),cm(w),t&&cm(b);let T=this.issueReporterModel.getData().extensionData;if(T&&T.length>qmn){cm(S);let N=new Date,O=N.toISOString().split("T")[0],V=N.toTimeString().split(" ")[0].replace(/:/g,"-"),U=`extensionData_${O}_${V}.md`,G=async()=>{let $=await this.fileDialogService.showSaveDialog({title:d(10715,null),availableFileSystems:[Y.file],defaultUri:je(await this.fileDialogService.defaultFilePath(Y.file),U)});$&&await this.fileService.writeFile($,Je.fromString(T))};S.addEventListener("click",G),this._register({dispose:()=>S.removeEventListener("click",G)})}if(n&&this.nonGitHubIssueUrl){Wb(y),Wb(w),Fi(f,d(10702,null)),Fi(v,d(10697,null,n.displayName)),this.publicGithubButton.label=d(10708,null);return}if(t&&n?.data){let N=n?.data;k.innerText=N.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)),Fi(f,d(10720,null)+" ",_("span.required-input",void 0,"*")),Fi(v,d(10689,null))):e===1?(o||(cm(r),cm(s),cm(l),cm(c),cm(p)),t?cm(b):o||cm(u),Fi(f,d(10720,null)+" ",_("span.required-input",void 0,"*")),Fi(v,d(10711,null))):e===2&&(Fi(f,d(10695,null)+" ",_("span.required-input",void 0,"*")),Fi(v,d(10701,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>w_o)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 ho;return e+`&body=${encodeURIComponent(d(10709,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=XVi(t):o&&o.match(/^https?:\/\/github\.com\/([^\/]*)\/([^\/]*)$/)?e=XVi(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(Wb(e),Wb(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");Wb(t),Array.from(this.window.document.querySelectorAll(".ext-parens")).forEach(r=>Wb(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");Wb(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&&Fi(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){Fi(o,d(10696,null));return}let n=t?`
(${t} theme extensions excluded)`:"";if(e=e||[],!e.length){o.innerText="Extensions: none"+n;return}Fi(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([Nd(300)],BG.prototype,"searchGitHub",1),I([Nd(300)],BG.prototype,"searchDuplicates",1),BG=I([m(6,UK),m(7,De),m(8,be),m(9,dn),m(10,ze),m(11,Cs),m(12,Qe)],BG);function Wb(a){a?.classList.add("hidden")}function cm(a){a?.classList.remove("hidden")}var gKe=class extends BG{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(10760,null)),this.updateButtonStates(),this.setSourceOptions(),this.render()})}};gKe=I([m(5,UK),m(6,De),m(7,be),m(8,dn),m(9,ze),m(10,Cs),m(11,Qe)],gKe);var fKe=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 QI;this.arch="";this.release="";this.type=""}async openReporter(i){this.hasToReload(i)||(await this.openAuxIssueReporter(i),this.issueReporterWindow&&this.instantiationService.createInstance(gKe,!1,i,{type:this.type,arch:this.arch,release:this.release},to,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 P,n=o.add(await this.auxiliaryWindowService.open({mode:1,bounds:t,nativeTitlebar:!0,disableFullscreen:!0})),r=ri?"windows":Wn?"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(),!PQ.globalStyleSheet){let l=hr(n.window.document.head);l.textContent=tVi(mTo,!1)}let s=document.createElement("div");s.classList.add("monaco-workbench"),n.window.document.body.appendChild(s),Iq(s,y_o(),{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 Ei(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:gt.Warning,message:d(10726,null),buttons:[{label:d(10729,null),run:()=>{this.closeReporter(),this.issueReporterWindow=null}},{label:d(10725,null),run:()=>{}}]})}async showClipboardDialog(){let i=!1;return await this.dialogService.prompt({type:gt.Warning,message:d(10727,null),buttons:[{label:d(10728,null),run:()=>{i=!0}},{label:d(10725,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}};fKe=I([m(0,F),m(1,$P),m(2,qt),m(3,X),m(4,ne),m(5,ct),m(6,oi)],fKe);var jmn=7500,C_o=65500,vKe=class extends BG{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(),MG(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(10790,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(10789,null)),this.updateButtonStates(),this.setSourceOptions(),this.render()})}async submitToGitHub(e,t,o){if(t.length>C_o){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(10788,null),availableFileSystems:[Y.file],defaultUri:je(await this.fileDialogService.defaultFilePath(Y.file),g)});f&&await this.fileService.writeFile(f,Je.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>jmn||r.length>C_o)&&(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 ho;return await this.nativeHostService.writeClipboardText(t),e+`&body=${encodeURIComponent(d(10787,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)));Fi(t,n),o.remoteData.forEach(r=>{if(t.appendChild(_("hr")),RF(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(10786,null))}};vKe=I([m(5,To),m(6,UK),m(7,Gne),m(8,De),m(9,be),m(10,dn),m(11,zd),m(12,X),m(13,ze),m(14,Cs),m(15,Qe)],vKe);var bKe=class extends fKe{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 P}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(vKe,!!this.environmentService.disableExtensions,e,{type:this.type,arch:this.arch,release:this.release},to,this.issueReporterWindow)).render():this.store.dispose()}};bKe=I([m(0,F),m(1,$P),m(2,ne),m(3,ct),m(4,qt),m(5,X),m(6,oi),m(7,To),m(8,iC)],bKe);we(UC,Rve,1);we(UK,bKe,1);var qdt=class extends hKe{constructor(i,e){if(super(i,e),!e.getValue("telemetry.feedback.enabled"))return;i.reportIssueUrl&&this._register(W(ZVi));let t,o=()=>{t=oe.as(Tu.Quickaccess).registerQuickAccessProvider({ctor:KQ,prefix:KQ.PREFIX,contextKey:"inReportIssuePicker",placeholder:d(10785,null),helpEntries:[{description:d(10783,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()}};qdt=I([m(0,nt),m(1,B)],qdt);oe.as(Qi.Workbench).registerWorkbenchContribution(qdt,3);var ZVi=class a extends K{static{this.ID="workbench.action.reportPerformanceIssueUsingReporter"}constructor(){super({id:a.ID,title:L(10784,"Report Performance Issue..."),category:We.Help,f1:!0})}async run(i){return i.get(UC).openReporter({issueType:1})}};qe.registerCommand("_issues.getSystemStatus",a=>a.get(Gne).getSystemStatus());var x_o=/\s--inspect(?:-brk|port)?=(?<port>\d+)?/,Qmn=/\s--inspect-port=(?<port>\d+)/;function PQt(a){let i=a;return!!i?.name&&!!i?.rootProcess}function aBi(a){return!!a?.processRoots}function Qne(a){return typeof a?.pid=="number"}var eBi=class{getHeight(){return 22}getTemplateId(i){return Qne(i)?"process":PQt(i)?"machine":RF(i)?"error":aBi(i)?"header":""}},tBi=class{hasChildren(i){return RF(i)?!1:Qne(i)?!!i.children?.length:!0}getChildren(i){return Qne(i)?i.children??[]:RF(i)?[]:aBi(i)?i.processRoots.length>1?i.processRoots:i.processRoots.length>0?[i.processRoots[0].rootProcess]:[]:PQt(i)?[i.rootProcess]:i.processes?[i.processes]:[]}};function AQt(a,i){let e=R(a,_(".row"));i&&e.classList.add(i);let t=R(e,_(".cell.name")),o=R(e,_(".cell.cpu")),n=R(e,_(".cell.memory")),r=R(e,_(".cell.pid"));return{name:t,cpu:o,memory:n,pid:r}}var iBi=class{constructor(){this.templateId="header"}renderTemplate(i){return i.previousElementSibling?.classList.add("force-no-twistie"),AQt(i,"header")}renderElement(i,e,t){t.name.textContent=d(12628,null),t.cpu.textContent=d(12625,null),t.pid.textContent=d(12629,null),t.memory.textContent=d(12627,null)}disposeTemplate(i){}},oBi=class{constructor(){this.templateId="machine"}renderTemplate(i){return AQt(i)}renderElement(i,e,t){t.name.textContent=i.element.name}disposeTemplate(i){}},nBi=class{constructor(){this.templateId="error"}renderTemplate(i){return AQt(i)}renderElement(i,e,t){t.name.textContent=i.element.errorMessage}disposeTemplate(i){}},jdt=class extends C{constructor(e,t){super();this.content="";this.hover=this._register(t.setupManagedHover(Ni("mouse"),e,this.content))}update(e){this.content!==e&&(this.content=e,this.hover.update(e))}};jdt=I([m(1,tt)],jdt);var Qdt=class{constructor(i,e){this.model=i;this.hoverService=e;this.templateId="process"}renderTemplate(i){let e=AQt(i);return{name:e.name,cpu:e.cpu,memory:e.memory,pid:e.pid,hover:new jdt(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/ll.MB).toFixed(0),t.pid.textContent=n,t.pid.parentElement.id=`pid-${n}`,t.hover?.update(o.cmd)}disposeTemplate(i){i.hover?.dispose()}};Qdt=I([m(1,tt)],Qdt);var rBi=class{getWidgetAriaLabel(){return d(12626,null)}getAriaLabel(i){return Qne(i)||PQt(i)?i.name:RF(i)?i.hostName:null}},sBi=class{getId(i){return Qne(i)?i.pid.toString():RF(i)?i.hostName:aBi(i)?"processes":PQt(i)?i.name:"header"}},Mve=class extends C{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 jo(1e3));this.model=new Ydt(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(Qdt,this.model),new iBi,new oBi,new nBi];this.tree=this._register(this.instantiationService.createInstance(pO,"processExplorer",e,new eBi,t,new tBi,{accessibilityProvider:new rBi,identityProvider:new sBi,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 Ii(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(!Qne(t.element))return;let o=t.element,n=Number(o.pid),r=[];typeof this.killProcess=="function"&&(r.push(pi({id:"killProcess",label:d(12624,null),run:()=>this.killProcess?.(n,"SIGTERM")})),r.push(pi({id:"forceKillProcess",label:d(12623,null),run:()=>this.killProcess?.(n,"SIGKILL")})),r.push(new li)),r.push(pi({id:"copy",label:d(12620,null),run:()=>{let s=this.getSelectedPids();s?.includes(n)||(s.length=0,s.push(n));let l=s?.map(c=>Ore(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(pi({id:"copyAll",label:d(12621,null),run:()=>{let s=Ore(e).getElementById("process-explorer");s&&this.clipboardService.writeText(s.innerText)}})),this.isDebuggable(o.cmd)&&(r.push(new li),r.push(pi({id:"debug",label:d(12622,null),run:()=>this.attachTo(o)}))),this.contextMenuService.showContextMenu({getAnchor:()=>t.anchor,getActions:()=>r})}isDebuggable(e){if(Gt)return!1;let t=x_o.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=x_o.exec(e.cmd);o?t.port=Number(o.groups.port):t.processId=String(e.pid),o=Qmn.exec(e.cmd),o&&(t.port=Number(o.groups.port)),this.commandService.executeCommand("debug.startFromConfig",t)}getSelectedPids(){return si(this.tree?.getSelection()?.map(e=>{if(Qne(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)}};Mve=I([m(0,F),m(1,nt),m(2,ze),m(3,ge),m(4,Wi)],Mve);var Ydt=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)=>{Qne(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}};Ydt=I([m(0,nt)],Ydt);var SKe=class extends Mve{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(Y.vscodeRemote,e.remoteAuthority),n=await this.remoteAgentService.getDiagnosticInfo({includeProcesses:!0});return n&&(RF(n)?t.push({name:n.hostName,rootProcess:n}):n.processes&&t.push({name:o,rootProcess:n.processes})),{pidToNames:[],processes:t}}};SKe=I([m(1,F),m(2,nt),m(3,ze),m(4,ge),m(5,Wi),m(6,yo),m(7,ot)],SKe);var Yne=class extends pa{constructor(e,t,o,n,r){super(Yne.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(SKe,e))}focus(){this.processExplorerControl?.focus()}layout(e){this.processExplorerControl?.layout(e)}};Yne=I([m(1,Te),m(2,De),m(3,le),m(4,F)],Yne);var IKe=class extends Mve{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()}};IKe=I([m(1,F),m(2,nt),m(3,ze),m(4,To),m(5,ge),m(6,Gne),m(7,Wi)],IKe);var Pve=class extends Yne{constructor(i,e,t,o,n){super(i,e,t,o,n)}createEditor(i){this.processExplorerControl=this._register(this.instantiationService.createInstance(IKe,i))}};Pve=I([m(1,Te),m(2,De),m(3,le),m(4,F)],Pve);oe.as(rn.EditorPane).registerEditorPane(ys.create(Pve,Pve.ID,d(12632,null)),[new Mt(M0)]);var Xdt=class{constructor(i,e){el.on("vscode:getDiagnosticInfo",(t,...o)=>{let n=o[0],r=i.getConnection();if(r){let s=e.getHostLabel(Y.vscodeRemote,r.remoteAuthority);i.getDiagnosticInfo(n.args).then(l=>{l&&(l.hostName=s,RO.latency?.high&&(l.latency={average:RO.latency.average,current:RO.latency.current})),el.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 `;el.send(n.replyChannel,{hostName:s,errorMessage:c})})}else el.send(n.replyChannel)})}};Xdt=I([m(0,yo),m(1,ot)],Xdt);var Jdt=class extends C{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)}}))}};Jdt=I([m(0,yo),m(1,Mc),m(2,lt)],Jdt);var yKe=class extends C{constructor(e,t){super();this.remoteAgentService=e;this.configurationService=t;this.updateRemoteTelemetryEnablement(),this._register(t.onDidChangeConfiguration(o=>{o.affectsConfiguration(bN)&&this.updateRemoteTelemetryEnablement()}))}static{this.ID="workbench.contrib.remoteTelemetryEnablementUpdater"}updateRemoteTelemetryEnablement(){return this.remoteAgentService.updateTelemetryLevel(xO(this.configurationService))}};yKe=I([m(0,yo),m(1,B)],yKe);var wKe=class extends C{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")})}};wKe=I([m(0,ps),m(1,Mc),m(2,B),m(3,ge),m(4,Pe)],wKe);var CKe=class extends C{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 Q(n,!!s,d(12855,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))})})}};CKe=I([m(0,X),m(1,To),m(2,le),m(3,ao)],CKe);var k_o=oe.as(Qi.Workbench);k_o.registerWorkbenchContribution(Xdt,4);k_o.registerWorkbenchContribution(Jdt,4);pt(yKe.ID,yKe,ut.BlockRestore);pt(wKe.ID,wKe,ut.BlockRestore);ri&&pt(CKe.ID,CKe,ut.BlockRestore);oe.as(ii.Configuration).registerConfiguration({id:"remote",title:d(12851,null),type:"object",properties:{"remote.downloadExtensionsLocally":{type:"boolean",markdownDescription:d(12854,null),default:!1}}});it?yt.registerCommandAndKeybindingRule({id:Sze.ID,weight:200,primary:2093,when:Ize,metadata:{description:Sze.LABEL,args:[]},handler:Sze.handler()}):(yt.registerCommandAndKeybindingRule({id:fze.ID,weight:200,primary:2093,when:Ize,metadata:{description:fze.LABEL,args:[]},handler:fze.handler()}),yt.registerCommandAndKeybindingRule({id:bze.ID,weight:200,primary:Ai(2089,2093),when:Ize,metadata:{description:bze.LABEL,args:[]},handler:bze.handler()}));yt.registerCommandAndKeybindingRule({id:vze.ID,weight:200,primary:3121,when:Ize,metadata:{description:vze.LABEL,args:[]},handler:vze.handler()});W(class extends K{constructor(){super({id:"workbench.remote.action.closeUnusedPorts",title:d(12852,null),category:d(12853,null),menu:[{id:D.CommandPalette}],precondition:x.and(x.notEquals(`config.${q_}`,QX),ub)})}async run(a){let i=a.get(Gd),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 E_o(){Sr({id:"workbench.action.terminal.newLocal",title:L(14507,"Create New Integrated Terminal (Local)"),run:async(a,i)=>{let e=i.get(zs),t=i.get(Mc),o=i.get(iC),n;try{let s=e.getLastActiveWorkspaceRoot(Y.vscodeRemote);if(s){let l=await t.getCanonicalURI(s);l.scheme===Y.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 xKe=class extends C{constructor(e,t,o,n){super();this._fileService=e;this._terminalService=t;el.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&&E_o()}_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=MI(Ki(),async()=>{if(!o){o=!0;let r=await this._fileService.exists(e);o=!1,r||(n.dispose(),t(void 0))}},1e3)})}};xKe=I([m(0,be),m(1,Yo),m(2,yo),m(3,To)],xKe);var T_o="Generated",kKe=class extends C{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=jy();this._remoteAgentService.getConnection()?this._remoteAgentService.getEnvironment().then(u=>this._primaryBackendOs=u?.os||zo):this._primaryBackendOs=zo,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}))||M.terminal}async resolveShellLaunchConfig(e,t){let o;e.executable?o=await this._resolveProfile({path:e.executable,args:e.args,profileName:T_o,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||Ae(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(Ae(e))return q.fromId(e);if(q.isThemeIcon(e))return e;if(A.isUri(e)||oh(e))return A.revive(e);if((A.isUri(e.light)||oh(e.light))&&(A.isUri(e.dark)||oh(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=Xi(t);return o.icon=M.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===zo){let r=this._terminalProfileService.availableProfiles.find(s=>c$(s.path).name===c$(t).name);if(r)return e.allowAutomationShell&&(r=Xi(r),r.icon=M.tools),r}let o;e.os===2&&c$(t).name.match(/(zsh|bash)/)?o=["--login"]:o=[];let n=this._guessProfileIcon(t);return{profileName:T_o,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)||M.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=Ld(l,"Sysnative").replace(/\//g,"\\").toLowerCase();e.path&&e.path.toLowerCase().indexOf(c)===0&&(e.path=Ld(l,"System32",e.path.substr(c.length+1)))}e.path&&(e.path=e.path.replace(/\//g,"\\"))}let n=this._historyService.getLastActiveWorkspaceRoot(t.remoteAuthority?Y.vscodeRemote:Y.file),r=n?this._workspaceContextService.getWorkspaceFolder(n)??void 0:void 0;return e.path=await this._resolveVariables(e.path,o,r),e.args&&(Ae(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(c$(e).name){case"bash":return M.terminalBash;case"pwsh":case"powershell":return M.terminalPowershell;case"tmux":return M.terminalTmux;case"cmd":return M.terminalCmd;default:return}}_isValidAutomationProfile(e,t){return e==null||typeof e!="object"?!1:!!("path"in e&&Ae(e.path))}};I([Nd(200)],kKe.prototype,"_refreshDefaultProfileName",1);var NQt=class extends kKe{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?fp:u.getEnvironment()}},e,i,t,o,r,s,l)}};NQt=I([m(0,sp),m(1,B),m(2,zs),m(3,Xs),m(4,xm),m(5,iy),m(6,Pe),m(7,yo)],NQt);var EKe=class extends kKe{constructor(i,e,t,o,n,r,s,l){super({getDefaultSystemShell:async(c,u)=>{let p=await l.getBackend(c);if(!p)throw new Zs(`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 Zs(`Cannot get environment when there is no backend for remote authority '${c}'`);return u.getEnvironment()}},e,i,t,o,r,n,s)}};EKe=I([m(0,sp),m(1,B),m(2,zs),m(3,Xs),m(4,Pe),m(5,iy),m(6,yo),m(7,xm)],EKe);var Zdt=class extends NBe{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 Nve=class{static{this.ID="workbench.contrib.localTerminalBackend"}constructor(i,e){let t=i.createInstance(Ave);oe.as(SV.Backend).registerTerminalBackend(t),e.didRegisterBackend(t)}};Nve=I([m(0,F),m(1,xm)],Nve);var Ave=class extends ABe{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 Go;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 Go;this._directProxyClientEventually=e;let t=dd.toService(CX(this._directProxyClientEventually.p.then(o=>o.getChannel("ptyHostWindow"))));this._directProxy=t,this._directProxyDisposables.clear(),this._remoteAgentService.getConnection()?.remoteAuthority||await this._lifecycleService.when(3),sn("code/terminal/willConnectPtyHost"),this._logService.trace("Renderer->PtyHost#connect: before acquirePort"),DQ("vscode:createPtyHostMessageChannel","vscode:createPtyHostMessageChannelResult").then(o=>{sn("code/terminal/didConnectPtyHost"),this._logService.trace("Renderer->PtyHost#connect: connection established");let n=new P;this._directProxyDisposables.value=n;let r=n.add(new Ine(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 Zdt(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 Zdt(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 En;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&&ajt(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=ljt(s,await this._terminalProfileResolverService.getEnvironment(this.remoteAuthority),this._configurationResolverService);sn("code/terminal/willGetReviveEnvironments"),await Promise.all(n.map(u=>new Promise(p=>{this._resolveEnvironmentForRevive(l,u.shellLaunchConfig).then(h=>{u.processLaunchConfig.env=h,p()})}))),sn("code/terminal/didGetReviveEnvironments"),sn("code/terminal/willReviveTerminalProcesses"),await this._proxy.reviveTerminalProcesses(e,n,Intl.DateTimeFormat().resolvedOptions().locale),sn("code/terminal/didReviveTerminalProcesses"),this._storageService.remove("terminal.integrated.bufferState",1);let c=this._storageService.get("terminal.integrated.layoutInfo",1);c&&(sn("code/terminal/willSetTerminalLayoutInfo"),await this._proxy.setTerminalLayoutInfo(JSON.parse(c)),sn("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=ri?"windows":it?"osx":"linux",n=this._configurationService.getValue(`terminal.integrated.env.${o}`),r=await(t.useShellEnvironment?this.getShellEnvironment():this.getEnvironment()),s=await cjt(t,n,e,this._productService.version,this._configurationService.getValue("terminal.integrated.detectLocale"),r);if(OGt(t)){let l=rQ(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([mi],Ave.prototype,"getEnvironment",1),I([mi],Ave.prototype,"getShellEnvironment",1),Ave=I([m(0,Pe),m(1,ao),m(2,Xs),m(3,rDt),m(4,ot),m(5,Cve),m(6,le),m(7,sp),m(8,B),m(9,nt),m(10,zs),m(11,Sg),m(12,Uz),m(13,zs),m(14,To),m(15,Tr),m(16,yo),m(17,ps)],Ave);nx(rDt,"localPty");we(Sg,EKe,1);var Xmn=oe.as(Qi.Workbench);pt(Nve.ID,Nve,ut.BlockStartup);Xmn.registerWorkbenchContribution(xKe,3);var OQt=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}: ${Oe.Format.CSS.formatHexA(e,!0).toUpperCase()}`}explainTokenColor(i,e){let t=this._findMatchingThemeRule(i);if(!t){let n=Oe.fromHex(this._defaultColor);if(!e.equals(n))throw new Error(`[${this._theme.label}]: Unexpected color ${Oe.Format.CSS.formatHexA(e)} for ${i}. Expected default ${Oe.Format.CSS.formatHexA(n)}`);return this._generateExplanation("default",e)}let o=Oe.fromHex(t.settings.foreground);if(!e.equals(o))throw new Error(`[${this._theme.label}]: Unexpected color ${Oe.Format.CSS.formatHexA(e)} for ${i}. Expected ${Oe.Format.CSS.formatHexA(o)} coming in from ${t.rawSelector}`);return this._generateExplanation(t.rawSelector,e)}_findMatchingThemeRule(i){return this._cache[i]||(this._cache[i]=CHt(this._theme,i.split(" "))),this._cache[i]}},eut=class{constructor(i,e,t,o){this.languageService=i;this.themeService=e;this.textMateService=t;this.modelService=o}_themedTokenize(i,e){let t=kc.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=Qu.getForeground(f);n[r++]={text:b,color:t[S]}}o=u.ruleStack}return n}_themedTokenizeTreeSitter(i,e){let t=kc.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=HOt(n,c,this.languageService.languageIdCodec.encodeLanguageId(e),!1),p=Qu.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 OQt(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 OQt(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 gf(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=mc(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:H.None},i)).tokenization.tokens.get();if(!(n instanceof i1))return[];let r=n.tree,s=n.tokenizationImpl,l=r.get()??await gf(r),c=s.get()??await gf(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}};eut=I([m(0,kt),m(1,Gp),m(2,f4),m(3,Ct)],eut);async function __o(a,i,e=!1){let t=o=>{let n=a.get(be),r=Ye(o),s=a.get(F).createInstance(eut);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?no.getCanonicalUri(o.activeEditor,{filterByScheme:Y.file}):null;n?t(n).then(r=>{console.log(r)}):console.log("No file editor active")}}qe.registerCommand("_workbench.captureSyntaxTokens",function(a,i){return __o(a,i)});qe.registerCommand("_workbench.captureTreeSitterSyntaxTokens",function(a,i){return i||(i=a.get(ee).activeEditor?.resource),__o(a,i,!0)});var Jmn=oe.as(ii.Configuration);Jmn.registerConfiguration({properties:{"window.systemColorTheme":{type:"string",enum:["default","auto","light","dark"],enumDescriptions:[d(17467,null),d(17465,null),d(17468,null),d(17466,null)],markdownDescription:d(17464,null,YP("workbench.colorTheme"),YP("window.autoDetectColorScheme")),default:"default",included:!Wn,scope:1,tags:[n4]}}});var TKe=class extends C{static{this.ID="workbench.contrib.userDataSyncServices"}constructor(i,e){super(),e.registerChannel("userDataSyncUtil",dd.fromService(i,this._store))}};TKe=I([m(0,BJ),m(1,Fb)],TKe);pt(TKe.ID,TKe,ut.BlockStartup);W(class extends K{constructor(){super({id:"workbench.userData.actions.openSyncBackupsFolder",title:L(15846,"Open Local Backups Folder"),category:Ch,menu:{id:D.CommandPalette,when:py.notEqualsTo("uninitialized")}})}async run(i){let e=i.get(Co).userDataSyncHome,t=i.get(To),o=i.get(be),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:Y.file}).fsPath)}else n.info(d(15844,null))}});W(class extends K{constructor(){super(FFt)}async run(i){let e=i.get(lI),t=i.get(Ne),o=i.get(To),n=await e.downloadSyncActivity();n&&t.prompt(St.Info,d(15843,null),[{label:d(15845,null),run:()=>o.showItemInFolder(n.fsPath)}])}});async function D_o(a,i=!1){return pEo(a,i,Q0)}var Xne=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(!ri)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=>dEo(r.value,cEo),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 Xne.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)}};Xne=I([m(0,be),m(1,Pe),m(2,Te),m(3,_a),m(4,Ho),m(5,t1e),m(6,eLe),m(7,nt),m(8,To)],Xne);var L_o=/group\s*:\s*[\'\"](.*?)[\'\"]\s*,\s*name\s*:\s*[\'\"](.*?)[\'\"]\s*,\s*version\s*:\s*[\'\"](.*?)[\'\"]/g,R_o=/[\'\"]([^\'\"\s]*?)\:([^\'\"\s]*?)\:([^\'\"\s]*?)[\'\"]/g,M_o=/<dependencies>([\s\S]*?)<\/dependencies>/g,P_o=/<dependency>([\s\S]*?)<\/dependency>/g,A_o=/<groupId>([\s\S]*?)<\/groupId>/,N_o=/<artifactId>([\s\S]*?)<\/artifactId>/,O_o=[{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 Zmn=["@azure","@azure/ai","@azure/core","@azure/cosmos","@azure/event","@azure/identity","@azure/keyvault","@azure/search","@azure/storage"],ehn=["@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"],thn=["azure-ai","azure-cognitiveservices","azure-core","azure-cosmos","azure-event","azure-identity","azure-keyvault","azure-mgmt","azure-ml","azure-search","azure-storage"],ihn=["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"],ohn=["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/"],tut=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 Q0(n.scheme===Y.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=>D_o(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(se=>se.success?se.stat.children||[]:[])).map(se=>se.name),h=p.reduce((se,Se)=>se.add(Se.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 N(se,Se,ke,Ee){return h.has(se)?l.map(He=>{let Ve=He.with({path:`${He.path!=="/"?He.path:""}/${se}`});return Se.exists(Ve).then(Fe=>{if(Fe)return ke.read(Ve,{acceptTextOnly:!0}).then(Ee)},Fe=>{})}):[]}function O(se){ihn.indexOf(se)>-1&&(i["workspace.py."+se]=!0);for(let Se of thn)se.startsWith(Se)&&(i["workspace.py."+Se]=!0);i["workspace.py.any-azure"]||(i["workspace.py.any-azure"]=/azure/i.test(se))}let V=N("requirements.txt",this.fileService,this.textFileService,se=>{let Se=mc(se.value);for(let ke of Se){let Ee=ke.split("=="),He=ke.split(">="),Ve=(Ee.length===2?Ee[0]:He[0]).trim();O(Ve)}}),U=N("pipfile",this.fileService,this.textFileService,se=>{let Se=mc(se.value);Se=Se.slice(Se.indexOf("[packages]")+1);for(let ke of Se){if(ke.trim().indexOf("[")>-1)break;if(ke.indexOf("=")===-1)continue;let Ee=ke.split("=")[0].trim();O(Ee)}}),G=N("package.json",this.fileService,this.textFileService,se=>{try{let Se=JSON.parse(se.value),ke=Object.keys(Se.dependencies||{}).concat(Object.keys(Se.devDependencies||{}));for(let Ee of ke)if(Ee.startsWith("react-native"))i["workspace.reactNative"]=!0;else if(Ee==="tns-core-modules"||Ee==="@nativescript/core")i["workspace.nativescript"]=!0;else if(ehn.indexOf(Ee)>-1)i["workspace.npm."+Ee]=!0;else for(let He of Zmn)Ee.startsWith(He)&&(i["workspace.npm."+He]=!0)}catch{}}),$=N("go.mod",this.fileService,this.textFileService,se=>{try{let Se=mc(se.value),ke=!1;for(let Ee=0;Ee<Se.length;Ee++){let He=Se[Ee].trim();if(He.startsWith("require (")){if(ke)break;ke=!0;continue}if(He.startsWith(")"))break;if(ke&&He!==""){let Ve=He.split(" ")[0].trim();for(let Fe of ohn)Ve.startsWith(Fe)&&(i["workspace.go.mod."+Ve]=!0)}}}catch{}}),te=N("pom.xml",this.fileService,this.textFileService,se=>{try{let Se;for(;Se=M_o.exec(se.value);){let ke;for(;ke=P_o.exec(Se[1]);){let Ee=A_o.exec(ke[1]),He=N_o.exec(ke[1]);Ee&&He&&this.tagJavaDependency(Ee[1],He[1],"workspace.pom.",i)}}}catch{}}),pe=N("build.gradle",this.fileService,this.textFileService,se=>{try{this.processGradleDependencies(se.value,L_o,i),this.processGradleDependencies(se.value,R_o,i)}catch{}}),de=l.map(se=>{let Se=A.joinPath(se,"/app/src/main/AndroidManifest.xml");return this.fileService.exists(Se).then(ke=>{ke&&(i["workspace.java.android"]=!0)},ke=>{})});return Promise.all([...G,...V,...U,...te,...pe,...de,...$]).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 O_o)if(n.predicate(i,e)){o[t+n.tag]=!0;return}}searchArray(i,e){return i.some(t=>t.search(e)>-1)||void 0}};tut=I([m(0,be),m(1,Pe),m(2,Vt),m(3,Ho)],tut);we(t1e,tut,1);oe.as(Qi.Workbench).registerWorkbenchContribution(Xne,4);var _Ke=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=Ye(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(12272,null),detail:d(12270,null,s),primaryButton:d(12275,null),cancelButton:d(12273,null)}).then(l=>{l.confirmed?Promise.all([this._nativeHostService.showItemInFolder(r[0].fsPath),this._createPerfIssue(r.map(c=>Ye(c)))]).then(()=>this._dialogService.confirm({type:"info",message:d(12276,null),detail:d(12271,null,this._productService.nameLong),primaryButton:d(12274,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=oA.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)}`))}};_Ke=I([m(0,ct),m(1,ps),m(2,Nt),m(3,Wi),m(4,ao),m(5,lt),m(6,Qe),m(7,To),m(8,nt),m(9,be),m(10,ot)],_Ke);var Ove=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 Dxt(this._lifecycleService.startupKind);if(!this._workspaceTrustService.isWorkspaceTrusted())return"Workspace not trusted";let i=this._paneCompositeService.getActivePaneComposite(0);if(!i||i.getId()!==Hf)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"}};Ove=I([m(0,ee),m(1,ds),m(2,ao),m(3,zd),m(4,ns)],Ove);var FQt=class extends Ove{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}`)}};FQt=I([m(0,ee),m(1,ds),m(2,ao),m(3,zd),m(4,ns),m(5,wC),m(6,ne),m(7,ru),m(8,Te),m(9,nt)],FQt);var WQt=class{constructor(i){for(let e of performance.getEntriesByType("resource"))try{let t=new URL(e.name),o=Lo.basename(t.pathname);i.publicLog2("startup.resource.perf",{hosthash:`H${Ir(t.host).toString(16)}`,name:o,duration:e.duration})}catch{}}};WQt=I([m(0,Te)],WQt);var DKe=class extends Ove{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(),Pi(15e3)]);let r=await this._timerService.perfBaseline,s=await this._resolveStartupHeapStatistics();if(s&&this._telemetryLogHeapStatistics(s),t){let l=si([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(Je.fromString(t)),await this._fileService.writeFile(e,Je.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)`}};DKe=I([m(0,be),m(1,wC),m(2,To),m(3,ee),m(4,ds),m(5,Te),m(6,ao),m(7,zd),m(8,ps),m(9,nt),m(10,ns)],DKe);var LKe=class{constructor(i,e,t,o,n,r,s){this._environmentService=i;this._fileService=e;this._logService=t;VO(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=_t();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}Pi(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=je(this._environmentService.tmpDir,`renderer-${Math.random().toString(16).slice(2,8)}.cpuprofile.json`);await this._fileService.writeFile(t,Je.fromString(JSON.stringify(i))),this._logService.info(`[perf] stored profile to DISK '${t}'`,e)}};LKe=I([m(0,ps),m(1,be),m(2,ne),m(3,To),m(4,wC),m(5,B),m(6,Bdt)],LKe);oe.as(Qi.Workbench).registerWorkbenchContribution(LKe,4);oe.as(Qi.Workbench).registerWorkbenchContribution(_Ke,3);oe.as(Qi.Workbench).registerWorkbenchContribution(DKe,4);oe.as(ii.Configuration).registerConfiguration({...W_t,properties:{"application.experimental.rendererProfiling":{type:"boolean",default:!1,tags:["experimental"],markdownDescription:d(12269,null),experiment:{mode:"startup"}}}});var iut=class extends Nb{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N,O,V,U,G,$,te,pe,de,se,Se,ke,Ee,He,Ve,Fe,Qt,Ze,Ti){super(i,e,t,o,n,r,s,l,c,u,p,g,f,v,b,S,y,w,k,T,N,O,V,U,G,$,te,pe,de,se,Se,ke,Ee,h,Ve,He,Qt,Ze,Ti),this._register(h.onBeforeShutdown(ti=>ti.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||J8e("0.1.0",e)&&t===1||J8e("2.0.0",e)&&t===2}beforeShutdown(){if(!this._taskSystem||!this._taskSystem.isActiveSync()||this._taskSystem instanceof ine)return!1;let i;return this._taskSystem.canAutoTerminate()?i=Promise.resolve({confirmed:!0}):i=this._dialogService.confirm({message:d(14047,null),primaryButton:d(14048,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(14046,null),primaryButton:d(14045,null),type:"info"}).then(r=>!r.confirmed):!0},t=>!0):!0)}};iut=I([m(0,B),m(1,Ns),m(2,Ml),m(3,ds),m(4,Ft),m(5,ge),m(6,ee),m(7,be),m(8,Pe),m(9,Te),m(10,Ho),m(11,ao),m(12,Ct),m(13,lt),m(14,Ge),m(15,sp),m(16,Yo),m(17,jl),m(18,le),m(19,Bo),m(20,Qe),m(21,ct),m(22,Ne),m(23,X),m(24,Vt),m(25,Sg),m(26,wn),m(27,Nt),m(28,Po),m(29,Ri),m(30,Vd),m(31,ns),m(32,ne),m(33,De),m(34,F),m(35,yo),m(36,tr),m(37,Si),m(38,br),m(39,oi)],iut);we(yg,iut,1);var VQt=ae("externalTerminal");nx(VQt,"externalTerminal");var F_o="workbench.action.terminal.openNativeConsole";yt.registerCommandAndKeybindingRule({id:F_o,primary:3105,when:at.notFocus,weight:200,handler:async a=>{let i=a.get(zs),e=a.get(VQt),t=a.get(B),o=a.get(Mc),n=a.get(Pe),r=a.get(Ge),s=a.get(ot),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(10126,null)});if(!g)return;u=c[h.indexOf(g)].uri}else u=i.getLastActiveWorkspaceRoot();if(u?.scheme===Y.file){e.openTerminal(l,u.fsPath);return}try{if(u?.scheme===Y.vscodeRemote){let h=await o.getCanonicalURI(u);if(h.scheme===Y.file){e.openTerminal(l,h.fsPath);return}}}catch{}let p=i.getLastActiveFile(Y.file);if(p?.scheme===Y.file){e.openTerminal(l,wc(p.fsPath));return}try{if(p?.scheme===Y.vscodeRemote){let h=await o.getCanonicalURI(p);if(h.scheme===Y.file){e.openTerminal(l,h.fsPath);return}}}catch{}e.openTerminal(l,void 0)}});fe.appendMenuItem(D.CommandPalette,{command:{id:F_o,title:L(10125,"Open New External Terminal")}});var out=class{constructor(i){this._externalTerminalService=i;this._updateConfiguration()}async _updateConfiguration(){let i=await this._externalTerminalService.getDefaultTerminalForPlatforms(),e=oe.as(ii.Configuration),t={type:"string",enum:["integrated","external","both"],enumDescriptions:[d(10133,null),d(10132,null),d(10131,null)],default:"integrated"};e.registerConfiguration({id:"externalTerminal",order:100,title:d(10134,null),type:"object",properties:{"terminal.explorerKind":{...t,description:d(10124,null)},"terminal.sourceControlRepositoriesKind":{...t,description:d(10127,null)},"terminal.external.windowsExec":{type:"string",description:d(10130,null),default:i.windows,scope:1},"terminal.external.osxExec":{type:"string",description:d(10129,null),default:i.osx,scope:1},"terminal.external.linuxExec":{type:"string",description:d(10128,null),default:i.linux,scope:1}}})}};out=I([m(0,VQt)],out);var nhn=oe.as(Qi.Workbench);nhn.registerWorkbenchContribution(out,3);var BQt=class extends K{constructor(){super({id:"workbench.action.webview.openDeveloperTools",title:L(15883,"Open Webview Developer Tools"),category:We.Developer,metadata:{description:d(15882,null)},f1:!0})}async run(i){let e=i.get(To);Ki().document.querySelectorAll("iframe.webview.ready").length&&(console.info(d(15881,null)),e.openDevTools())}};var RKe=class extends C{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||Yd.fontFamily,o=e.fontWeight||Yd.fontWeight,n=e.fontSize||Yd.fontSize,r=new mx().validate(e.fontLigatures),s=this._configurationService.getValue("accessibility.underlineLinks"),l=this._themeService.getColorTheme(),c=GSe().getColors().reduce((f,v)=>{let b=l.getColor(v.id);return b&&(f["vscode-"+v.id.replace(".","-")]=b.toString()),f},{}),u=XYe(),p=u.getSizes().reduce((f,v)=>{let b=u.resolveDefaultSize(v.id,l);return b&&(f["vscode-"+v.id.replace(/\./g,"-")]=QYe(b)),f},{}),h={"vscode-font-family":HN,"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=HQt.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()}};RKe=I([m(0,Gp),m(1,B)],RKe);var HQt=(o=>(o.light="vscode-light",o.dark="vscode-dark",o.highContrast="vscode-high-contrast",o.highContrastLight="vscode-high-contrast-light",o))(HQt||{});(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})(HQt||={});var UQt=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=DTe(t);if(o){for(let n of this._getMappings())if(n.webviewPort===o.port){let r=this._getExtensionLocation();if(r&&r.scheme===Y.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 shn=new Map([[".svg","image/svg+xml"],[".txt",Zn.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 W_o(a){let i=Am(a.fsPath).toLowerCase();return shn.get(i)||i$e(a.fsPath)||Zn.unknown}var $Q;(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})($Q||={});async function V_o(a,i,e,t,o,n){let r=ahn(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}`),$Q.AccessDenied;let s=W_o(a);try{let l=await t.readFileStream(r,{etag:i.ifNoneMatch},n);return o.trace(`Webview.loadLocalResource - Loaded. requestUri=${a}, resourceToLoad=${r}`),new $Q.StreamSuccess(l.value,l.etag,l.mtime,s)}catch(l){return l instanceof As&&l.fileOperationResult===2?(o.trace(`Webview.loadLocalResource - not modified. requestUri=${a}, resourceToLoad=${r}`),new $Q.NotModified(s,l.options?.mtime)):(o.error(`Webview.loadLocalResource - Error using fileReader. requestUri=${a}, resourceToLoad=${r}`),$Q.Failed)}}function ahn(a,i,e){let t=a.with({query:""});for(let o of i)if(lhn(o,t,e))return chn(a)}function lhn(a,i,e){return e.extUri.isEqual(a,i,!0)?!1:a.scheme===Y.file&&g6(a.fsPath)?i.scheme===Y.file&&g6(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 chn(a){return a.scheme===Y.vscodeRemote?A.from({scheme:Y.vscodeRemote,authority:a.authority,path:"/vscode-resource",query:JSON.stringify({requestResourcePath:a.path})}):a}var MKe=class extends zoe{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=bz.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(){}};MKe=I([m(1,_n),m(2,X),m(3,tt),m(4,_e),m(5,B),m(6,Bi)],MKe);var zQt;(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}})(zQt||={});var dhn="webviewId",Jne=class extends C{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=_t();this._windowId=void 0;this._expectedServiceWorkerVersion=4;this._state=new zQt.Initializing([]);this._resourceLoadingCts=this._register(new $e);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=Le("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 UQt(()=>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(15850,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),[dhn,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=nco(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(H.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(MKe,this)))}get window(){return typeof this._windowId=="number"?qv(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}=TI();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 yc||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":owi,parentOrigin:n.origin};this._options.disableServiceWorker&&(r.disableServiceWorker="true"),this._environmentService.remoteAuthority&&(r.remoteAuthority=this._environmentService.remoteAuthority),o.purpose&&(r.purpose=o.purpose),kre.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=lpt(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=zQt.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 zQt.Initializing([]),this._messagePort=void 0,this.mountTo(this.element.parentElement,Me(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`),UYi(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:Gpe,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 V_o(t,{ifNoneMatch:o,roots:this._content.options.localResourceRoots||[]},this._uriIdentityService,this._fileService,this._logService,this._resourceLoadingCts.token);switch(n.type){case $Q.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 $Q.Type.NotModified:return this._send("did-load-resource",{id:e,status:304,path:t.path,mime:n.mimeType,mtime:n.mtime});case $Q.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 Kv(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)}};Jne=I([m(2,B),m(3,ze),m(4,Ne),m(5,Vt),m(6,be),m(7,ne),m(8,Mc),m(9,ap),m(10,F),m(11,Bi),m(12,dt)],Jne);var PKe=class extends C{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 P);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=Le("WebviewIntrinsicContentSize",void 0);this.providedViewType=e.providedViewType,this.origin=e.origin??_t(),this._title=e.title,this._extension=e.extension,this._options=e.options,this._contentOptions=e.contentOptions}get window(){return qv(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 Bg(e),this._container.setVisibility("hidden");let t=this._editorGroupsService.activeModalEditorPart?.modalElement,o;Ao(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=OTt.bindTo(r),this._findWidgetVisible.set(!!s),this._findWidgetEnabled?.reset(),this._findWidgetEnabled=FTt.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}=uhn(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(he(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)}};PKe=I([m(1,fi),m(2,wm),m(3,X),m(4,Et)],PKe);function uhn(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 AKe=class extends C{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(RKe)}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(Jne,e,this._webviewThemeDataProvider);return this.registerNewWebview(t),t}createWebviewOverlay(e){let t=this._instantiationService.createInstance(PKe,e);return this.registerNewWebview(t),t}registerNewWebview(e){this._webviews.add(e);let t=new P;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)}))}};AKe=I([m(0,F)],AKe);var KQt=class{constructor(i,e,t){this._nativeHostService=t;this._isUsingNativeTitleBars=eO(i),this._webviewMainService=dd.toService(e.getChannel("webview"))}didFocus(){this.setIgnoreMenuShortcuts(!0)}didBlur(){this.setIgnoreMenuShortcuts(!1)}get _shouldToggleMenuShortcutsEnablement(){return it||this._isUsingNativeTitleBars}setIgnoreMenuShortcuts(i){this._shouldToggleMenuShortcutsEnablement&&this._webviewMainService.setIgnoreMenuShortcuts({windowId:this._nativeHostService.windowId},i)}};var NKe=class extends Jne{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 jo(200));this._webviewKeyboardHandler=new KQt(u,p,g),this._webviewMainService=dd.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`${Y.vscodeWebview}://${e}`}streamToBuffer(e){return w6(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()}};NKe=I([m(2,ze),m(3,ap),m(4,be),m(5,Vt),m(6,Mc),m(7,ne),m(8,B),m(9,Lu),m(10,Ne),m(11,To),m(12,F),m(13,Bi),m(14,dt)],NKe);var GQt=class extends AKe{createWebviewElement(i){let e=this._instantiationService.createInstance(NKe,i,this._webviewThemeDataProvider);return this.registerNewWebview(e),e}};we(wm,GQt,1);W(BQt);var Rw;(n=>{n.scheme=Y.vscodeBrowser;function i(r,s){let l=s??_t();return A.from({scheme:n.scheme,path:`/${l}`,query:r?`url=${encodeURIComponent(r)}`:void 0})}n.forUrl=i;function e(r){if(r.scheme!==n.scheme)return;let s=r.path.startsWith("/")?r.path.substring(1):r.path;if(!s)return;let l=r.query?new URLSearchParams(r.query).get("url")??"":"";return{id:s,url:l}}n.parse=e;function t(r){return e(r)?.id}n.getId=t;function o(r){return e(r)?.url}n.getUrl=o})(Rw||={});var B_o="browserView";var H_o=[{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"}],mmI=ae("browserOverlayManager"),$Qt=class extends C{constructor(e){super();this.targetWindow=e;this._onDidChangeOverlayState=this._register(new d6({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 H_o)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 H_o){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=Yn(e);if(!this._observerIsConnected)return t;this._overlayRectangles.set(e,t)}return this._overlayRectangles.get(e)}getOverlappingOverlays(e){let t=Yn(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 FKe=new Q("browserFindWidgetVisible",!1,d(5114,null)),nut=new Q("browserFindWidgetFocused",!1,d(5113,null)),OKe=class extends zoe{constructor(e,t,o,n,r,s,l){super({showCommonFindToggles:!0,checkImeCompletionState:!0,showResultCount:!0,enableSash:!0,initialWidth:350,previousMatchActionId:"workbench.action.browser.findPrevious",nextMatchActionId:"workbench.action.browser.findNext",closeWidgetActionId:"workbench.action.browser.hideFind"},t,o,n,r,s,l);this.container=e;this._modelDisposables=this._register(new P);this._hasFoundMatch=!1;this._findWidgetVisible=FKe.bindTo(o),this._findWidgetFocused=nut.bindTo(o),e.appendChild(this.getDomNode())}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.container.classList.toggle("find-visible",!0),this.focusFindBox(),this.inputValue&&!t&&this._onInputChanged()}hide(){super.hide(!1),this._findWidgetVisible.reset(),this.container.classList.toggle("find-visible",!1),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(){}};OKe=I([m(1,_n),m(2,X),m(3,tt),m(4,_e),m(5,B),m(6,Bi)],OKe);function AH(a,i){a.publicLog2("integratedBrowser.open",{source:i})}var cBi=new Q("browserCanGoBack",!1,d(5092,null)),dBi=new Q("browserCanGoForward",!1,d(5093,null)),qQt=new Q("browserFocused",!0,d(5095,null)),WKe=new Q("browserStorageScope","",d(5105,null)),Fve=new Q("browserHasUrl",!1,d(5099,null)),VKe=new Q("browserHasError",!1,d(5098,null)),uBi=new Q("browserDevToolsOpen",!1,d(5094,null)),jQt=new Q("browserElementSelectionActive",!1,d(5096,null));var pBi=x.and(ie.enabled,x.has("config.chat.agent.enabled"),x.has("config.workbench.browser.enableChatTools"));function U_o(a){let i=new Set(pBi.keys());return H.filter(a.onDidChangeContext,e=>e.affectsSome(i))}var phn=HTMLElement.prototype.focus,lBi=class extends C{constructor(i,e,t,o,n){super();let r=this._register(t.createInstance(mv,"element",void 0,{position:{hoverPosition:3}})),s=_(".browser-nav-toolbar"),l=t.createChild(new Io([X,o])),c=this._register(l.createInstance(Ln,s,D.BrowserNavigationToolbar,{hoverDelegate:r,highlightToggledItems:!0,toolbarOptions:{primaryGroup:()=>!0,useSeparatorsInPrimaryActions:!0},menuOptions:{shouldForwardArgs:!0}})),u=_(".browser-url-container");this._urlInput=_("input.browser-url-input"),this._urlInput.type="text",this._urlInput.placeholder=d(5107,null),this._shareButtonContainer=_(".browser-share-toggle-container"),this._shareButton=this._register(new Mi(this._shareButtonContainer,{supportIcons:!0,title:d(5103,null),small:!0,hoverDelegate:r})),this._shareButton.element.classList.add("browser-share-toggle"),this._shareButton.label="$(agent)",u.appendChild(this._urlInput),u.appendChild(this._shareButtonContainer);let p=_(".browser-actions-toolbar"),h=this._register(l.createInstance(Ln,p,D.BrowserActionsToolbar,{hoverDelegate:r,highlightToggledItems:!0,toolbarOptions:{primaryGroup:f=>f.startsWith("actions"),useSeparatorsInPrimaryActions:!0},menuOptions:{shouldForwardArgs:!0}}));c.context=i,h.context=i,e.appendChild(s),e.appendChild(u),e.appendChild(p),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(this._shareButton.onDidClick(()=>{i.toggleShareWithAgent()}));let g=()=>{this._shareButtonContainer.style.display=o.contextMatchesRules(pBi)?"":"none"};g(),this._register(U_o(o)(()=>{g()}))}setShared(i){this._shareButton.checked=i,this._shareButton.label=i?d(5104,null)+" $(agent)":"$(agent)",this._shareButton.setTitle(i?d(5106,null):d(5103,null))}updateFromNavigationEvent(i){this._urlInput.value=i.url}focusUrlInput(){this._urlInput.select(),this._urlInput.focus()}clear(){this._urlInput.value=""}},_g=class extends pa{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super(_g.ID,e,t,o,n);this.keybindingService=r;this.logService=s;this.instantiationService=l;this.contextKeyService=c;this.editorService=u;this.browserElementsService=p;this.chatWidgetService=h;this.configurationService=g;this._overlayVisible=!1;this._editorVisible=!1;this._inputDisposables=this._register(new P)}static{this.ID="workbench.editor.browser"}createEditor(e){let t=this._register(this.contextKeyService.createScoped(e));this.overlayManager=this._register(new $Qt(this.window)),this._canGoBackContext=cBi.bindTo(t),this._canGoForwardContext=dBi.bindTo(t),this._storageScopeContext=WKe.bindTo(t),this._hasUrlContext=Fve.bindTo(t),this._hasErrorContext=VKe.bindTo(t),this._devToolsOpenContext=uBi.bindTo(t),this._elementSelectionActiveContext=jQt.bindTo(t),qQt.bindTo(t);let o=_(".browser-root");e.appendChild(o);let n=_(".browser-toolbar");this._navigationBar=this._register(new lBi(this,n,this.instantiationService,t,this.configurationService)),o.appendChild(n),this._findWidgetContainer=_(".browser-find-widget-wrapper"),o.appendChild(this._findWidgetContainer),this._findWidget=new co(()=>{let c=this.instantiationService.createInstance(OKe,this._findWidgetContainer);return this._model&&c.setModel(this._model),c}),this._register(Z(()=>this._findWidget.rawValue?.dispose())),this._browserContainerWrapper=_(".browser-container-wrapper"),this._browserContainerWrapper.style.setProperty("--zoom-factor",String(yS(this.window))),o.appendChild(this._browserContainerWrapper),this._browserContainer=_(".browser-container"),this._browserContainer.tabIndex=0,this._browserContainerWrapper.appendChild(this._browserContainer);let r=_(".browser-placeholder-contents");this._browserContainer.appendChild(r),this._placeholderScreenshot=_(".browser-placeholder-screenshot"),r.appendChild(this._placeholderScreenshot),this._overlayPauseContainer=_(".browser-overlay-paused");let s=_(".browser-overlay-paused-message");this._overlayPauseHeading=_(".browser-overlay-paused-heading"),this._overlayPauseDetail=_(".browser-overlay-paused-detail"),s.appendChild(this._overlayPauseHeading),s.appendChild(this._overlayPauseDetail),this._overlayPauseContainer.appendChild(s),r.appendChild(this._overlayPauseContainer),this._errorContainer=_(".browser-error-container"),this._errorContainer.style.display="none",r.appendChild(this._errorContainer),this._welcomeContainer=this.createWelcomeContainer(),r.appendChild(this._welcomeContainer),this._register(j(this._browserContainer,re.FOCUS,c=>{c.relatedTarget&&this._model&&this.shouldShowView&&this._model.focus()})),this._register(yzi(()=>({hasFocus:this._model?.focused??!1,window:this._model?.focused?this.window:void 0})));let l=new this.window.ResizeObserver(()=>this.layoutBrowserContainer());l.observe(this._browserContainer),this._register(Z(()=>l.disconnect()))}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();this._model=r,!(n.isCancellationRequested||this.input!==e)&&(this._storageScopeContext.set(this._model.storageScope),this._devToolsOpenContext.set(this._model.isDevToolsOpen),this._updateSharingState(!0),this._findWidget.rawValue?.setModel(this._model),this._inputDisposables.add(e.onWillDispose(()=>{this._model=void 0})),this._inputDisposables.add(this._model.onDidChangeSharedWithAgent(()=>{this._updateSharingState(!1)})),this._inputDisposables.add(U_o(this.contextKeyService)(()=>{this._updateSharingState(!1)})),this.updateNavigationState({url:this._model.url,title:this._model.title,canGoBack:this._model.canGoBack,canGoForward:this._model.canGoForward}),this.setBackgroundImage(this._model.screenshot),t?.preserveFocus||setTimeout(()=>{this._model===r&&(this._model.url?this._browserContainer.focus():this.focusUrlInput())},0),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),s.url?this.startConsoleSession():this.stopConsoleSession()})),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.onDidChangeDevToolsState(s=>{this._devToolsOpenContext.set(s.isDevToolsOpen)})),this._inputDisposables.add(this._model.onDidRequestNewPage(({resource:s,location:l,position:c})=>{AH(this.telemetryService,(()=>{switch(l){case"background":return"browserLinkBackground";case"foreground":return"browserLinkForeground";case"newWindow":return"browserLinkNewWindow"}})());let u=l==="newWindow"?hg:this.group;this.editorService.openEditor({resource:A.from(s),options:{pinned:!0,inactive:l==="background",auxiliary:{bounds:c,compact:!0}}},u)})),this._inputDisposables.add(this.overlayManager.onDidChangeOverlayState(()=>{this.checkOverlays()})),this._inputDisposables.add(tpt(s=>{s===this.window.vscodeWindowId&&(this._browserContainerWrapper.style.setProperty("--zoom-factor",String(yS(this.window))),this.layoutBrowserContainer())})),this.updateErrorDisplay(),this.layoutBrowserContainer(),this.updateVisibility(),this.doScreenshot(),this._model.url&&this.startConsoleSession())}setEditorVisible(e){this._editorVisible=e,this.updateVisibility()}ensureBrowserFocus(){phn.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._model.focus()):(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(5102,null),this._overlayPauseDetail.textContent=d(5101,null)):(this._overlayPauseHeading.textContent="",this._overlayPauseDetail.textContent="")}updateErrorDisplay(){if(!this._model)return;let e=this._model.error;if(this._hasErrorContext.set(!!e),e){for(;this._errorContainer.firstChild;)this._errorContainer.removeChild(this._errorContainer.firstChild);let t=_(".browser-error-content"),o=_(".browser-error-title");o.textContent=d(5100,null);let n=_(".browser-error-detail"),r=_("span");r.textContent=`${e.errorDescription} (${e.errorCode})`,n.appendChild(r);let s=_(".browser-error-detail"),l=_("strong");l.textContent=d(5097,null);let c=_("code");c.textContent=e.url,s.appendChild(l),s.appendChild(document.createTextNode(" ")),s.appendChild(c),t.appendChild(o),t.appendChild(n),t.appendChild(s),this._errorContainer.appendChild(t),this.setBackgroundImage(void 0)}else this.setBackgroundImage(this._model.screenshot);this.updateVisibility()}getUrl(){return this._model?.url}_updateSharingState(e){let o=this.contextKeyService.contextMatchesRules(pBi)&&!!this._model&&this._model.sharedWithAgent;this._browserContainer.classList.toggle("animate",!e),this._browserContainer.classList.toggle("shared",o),this._navigationBar.setShared(o)}toggleShareWithAgent(){this._model&&this._model.setSharedWithAgent(!this._model.sharedWithAgent)}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()}async showFind(){let e=(await this._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)}async addElementToChat(){if(this._elementSelectionCts){this._elementSelectionCts.dispose(!0),this._elementSelectionCts=void 0,this._elementSelectionActiveContext.set(!1);return}let e=new $e;this._elementSelectionCts=e,this._elementSelectionActiveContext.set(!0),this.telemetryService.publicLog2("integratedBrowser.addElementToChat.start",{});try{if(!this.input?.resource)throw new Error("No resource URI found");this.ensureBrowserFocus();let o={browserViewId:Rw.getId(this.input.resource)};await this.browserElementsService.startDebugSession(e.token,o);let{width:n,height:r}=this._browserContainer.getBoundingClientRect(),s=await this.browserElementsService.getElementData({x:0,y:0,width:n,height:r},e.token,o);if(!s)throw new Error("Element data not found");let l=s.bounds,c=[],u=dKt(s.outerHTML),p=this.configurationService.getValue("chat.sendElementsToChat.attachCSS"),h=this.createElementContextValue(s,u,p);c.push({id:"element-"+Date.now(),name:u,fullName:u,value:h,modelDescription:p?"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(M.layout.id),ancestors:s.ancestors,attributes:s.attributes,computedStyles:p?s.computedStyles:void 0,dimensions:s.dimensions,innerText:s.innerText});let g=this.configurationService.getValue("chat.sendElementsToChat.attachImages");if(g&&this._model){let v=await this._model.captureScreenshot({quality:90,rect:l});c.push({id:"element-screenshot-"+Date.now(),name:"Element Screenshot",fullName:"Element Screenshot",kind:"image",value:v.buffer})}(await this.chatWidgetService.revealWidget()??this.chatWidgetService.lastFocusedWidget)?.attachmentModel?.addContext(...c),this.telemetryService.publicLog2("integratedBrowser.addElementToChat.added",{attachCss:p,attachImages:g})}catch(t){e.token.isCancellationRequested||this.logService.error("BrowserEditor.addElementToChat: Failed to select element",t)}finally{e.dispose(),this._elementSelectionCts===e&&(this._elementSelectionCts=void 0,this._elementSelectionActiveContext.set(!1))}}async addConsoleLogsToChat(){let e=this.input?.resource;if(!e)return;let t={browserViewId:Rw.getId(e)};try{let o=await this.browserElementsService.getConsoleLogs(t);if(!o)return;let n=[];n.push({id:"console-logs-"+Date.now(),name:d(5111,null),fullName:d(5111,null),value:o,modelDescription:"Console logs captured from Integrated Browser.",kind:"element",icon:q.fromId(M.terminal.id)}),(await this.chatWidgetService.revealWidget()??this.chatWidgetService.lastFocusedWidget)?.attachmentModel?.addContext(...n)}catch(o){this.logService.error("BrowserEditor.addConsoleLogsToChat: Failed to get console logs",o)}}startConsoleSession(){if(this._consoleSessionCts)return;let e=this.input?.resource;if(!e||!this._model?.url)return;let t=new $e;this._consoleSessionCts=t;let o={browserViewId:Rw.getId(e)};this.browserElementsService.startConsoleSession(t.token,o).catch(n=>{t.token.isCancellationRequested||this.logService.error("BrowserEditor: Failed to start console session",n)})}stopConsoleSession(){this._consoleSessionCts&&(this._consoleSessionCts.dispose(!0),this._consoleSessionCts=void 0)}createElementContextValue(e,t,o){let n=[];n.push("Attached Element Context from Integrated Browser"),n.push(`Element: ${t}`);let r=this.formatElementPath(e.ancestors);r&&n.push(`HTML Path:
${r}`);let s=this.formatElementMap(e.attributes);if(s&&n.push(`Attributes:
${s}`),o){let c=this.formatElementMap(e.computedStyles);c&&n.push(`Computed Styles:
${c}`)}if(e.dimensions){let{top:c,left:u,width:p,height:h}=e.dimensions;n.push(`Dimensions:
- top: ${Math.round(c)}px
- left: ${Math.round(u)}px
- width: ${Math.round(p)}px
- height: ${Math.round(h)}px`)}let l=e.innerText?.trim();return l&&n.push(`Inner Text:
\`\`\`text
${l}
\`\`\``),n.push(`Outer HTML:
\`\`\`html
${e.outerHTML}
\`\`\``),o&&n.push(`Full Computed CSS:
\`\`\`css
${e.computedStyle}
\`\`\``),n.join(`

`)}formatElementPath(e){if(!(!e||e.length===0))return e.map(t=>{let o=t.classNames?.length?`.${t.classNames.join(".")}`:"",n=t.id?`#${t.id}`:"";return`${t.tagName}${n}${o}`}).join(" > ")}formatElementMap(e){if(!e||Object.keys(e).length===0)return;let t=new Map(Object.entries(e)),o=[],n=this.createBoxShorthand(t,"margin");n&&o.push(`- margin: ${n}`);let r=this.createBoxShorthand(t,"padding");r&&o.push(`- padding: ${r}`);for(let[s,l]of Array.from(t.entries()).sort(([c],[u])=>c.localeCompare(u)))o.push(`- ${s}: ${l}`);return o.join(`
`)}createBoxShorthand(e,t){let o=`${t}-top`,n=`${t}-right`,r=`${t}-bottom`,s=`${t}-left`,l=e.get(o),c=e.get(n),u=e.get(r),p=e.get(s);if(!(l===void 0||c===void 0||u===void 0||p===void 0))return e.delete(o),e.delete(n),e.delete(r),e.delete(s),`${l} ${c} ${u} ${p}`}updateNavigationState(e){this._navigationBar.updateFromNavigationEvent(e),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(Qo(M.globe)),t.appendChild(o);let n=_(".browser-welcome-title");n.textContent=d(5110,null),t.appendChild(n);let r=_(".browser-welcome-subtitle"),s=this.contextKeyService.getContextKeyValue(ie.enabled.key);return r.textContent=s?d(5109,null):d(5108,null),t.appendChild(r),e.appendChild(t),e}setBackgroundImage(e){if(e){let t=`data:image/jpeg;base64,${Qd(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)}forwardCurrentEvent(){return this._currentKeyDownEvent&&this._model?(this._model.dispatchKeyEvent(this._currentKeyDownEvent),!0):!1}async handleKeyEventFromBrowserView(e){this._currentKeyDownEvent=e;try{let t=new KeyboardEvent("keydown",e),o=new Ii(t);this.keybindingService.dispatchEvent(o,this._browserContainer)||this.forwardCurrentEvent()}catch(t){this.logService.error("BrowserEditor.handleKeyEventFromBrowserView: Error dispatching key event",t)}finally{this._currentKeyDownEvent=void 0}}layout(e,t){this._findWidget.rawValue?.layout(e.width)}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:yS(this.window),cornerRadius:parseFloat(t)})}}clearInput(){this._inputDisposables.clear(),this._elementSelectionCts&&(this._elementSelectionCts.dispose(!0),this._elementSelectionCts=void 0),this.stopConsoleSession(),this.cancelScheduledScreenshot(),this._findWidget.rawValue?.setModel(void 0),this._findWidget.rawValue?.hide(),this._model?.setVisible(!1),this._model=void 0,this._canGoBackContext.reset(),this._canGoForwardContext.reset(),this._hasUrlContext.reset(),this._hasErrorContext.reset(),this._storageScopeContext.reset(),this._devToolsOpenContext.reset(),this._elementSelectionActiveContext.reset(),this._navigationBar.clear(),this.setBackgroundImage(void 0),super.clearInput()}};_g=I([m(1,Te),m(2,De),m(3,le),m(4,_e),m(5,ne),m(6,F),m(7,X),m(8,ee),m(9,Khe),m(10,At),m(11,B)],_g);var jQ=ae("browserViewWorkbenchService"),qQ=class extends C{constructor(e,t,o,n,r,s,l,c,u){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._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._storageScope="ephemeral";this._sharedWithAgent=!1;this._zoomFactor=1;this._onDidChangeSharedWithAgent=this._register(new E);this.onDidChangeSharedWithAgent=this._onDidChangeSharedWithAgent.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 storageScope(){return this._storageScope}get sharedWithAgent(){return this._sharedWithAgent}get zoomFactor(){return this._zoomFactor}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._storageScope=s.storageScope,this._sharedWithAgent=await this.playwrightService.isPageTracked(this.id),this._zoomFactor=s.zoomFactor,this._register(this.onDidNavigate(l=>{URL.parse(l.url)?.host!==URL.parse(this._url)?.host&&(this._favicon=void 0),this._url=l.url,this._title=l.title,this._canGoBack=l.canGoBack,this._canGoForward=l.canGoForward})),this._register(this.onDidChangeLoadingState(l=>{this._loading=l.loading,this._error=l.error})),this._register(this.onDidChangeDevToolsState(l=>{this._isDevToolsOpen=l.isDevToolsOpen})),this._register(this.onDidChangeTitle(l=>{this._title=l.title})),this._register(this.onDidChangeFavicon(l=>{this._favicon=l.favicon})),this._register(this.onDidChangeFocus(({focused:l})=>{this._focused=l})),this._register(this.onDidChangeVisibility(({visible:l})=>{this._visible=l})),this._register(this.playwrightService.onDidChangeTrackedPages(l=>{this._setSharedWithAgent(l.includes(this.id))}))}async layout(e){return this._zoomFactor=e.zoomFactor,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?.rect||(this._screenshot=t),t}async dispatchKeyEvent(e){return this.browserViewService.dispatchKeyEvent(this.id,e)}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)}static{this.SHARE_DONT_ASK_KEY="browserView.shareWithAgent.dontAskAgain"}async setSharedWithAgent(e){if(e){if(this.storageService.getBoolean(qQ.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(5091,null),message:d(5090,null),detail:d(5088,null),primaryButton:d(5086,null),cancelButton:d(5087,null),checkbox:{label:d(5089,null),checked:!1}});if(o.confirmed&&o.checkboxChecked&&this.storageService.store(qQ.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)}else await this.playwrightService.stopTrackingPage(this.id)}_setSharedWithAgent(e){e!==this._sharedWithAgent&&(this._sharedWithAgent=e,this._onDidChangeSharedWithAgent.fire(e))}logNavigationTelemetry(e,t){let o;try{o=t9e(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()}};qQ=I([m(2,Pe),m(3,ns),m(4,Te),m(5,B),m(6,df),m(7,ct),m(8,le)],qQ);var mhn=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>
`,hhn=30,wy=class extends Us{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.DEFAULT_LABEL=d(5112,null)}get id(){return this._id}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 wy.ID}get editorId(){return _g.ID}get capabilities(){return 1026}get resource(){if(this._resourceBeforeDisposal)return this._resourceBeforeDisposal;let e=this._model?.url??this._initialData.url??"";return Rw.forUrl(e,this._id)}getIcon(){if(this._model){if(this._model.loading){let e=this.themeService.getColorTheme().getColor(ZW);return A.parse("data:image/svg+xml;utf8,"+encodeURIComponent(mhn(e?.toString())))}return this._model.favicon?A.parse(this._model.favicon):M.globe}return this._initialData.favicon?A.parse(this._initialData.favicon):M.globe}getName(){return oN(this.getTitle(),hhn)}getTitle(){if(this._model&&this._model.url)return this._model.title?this._model.title:A.parse(this._model.url).authority||wy.DEFAULT_LABEL;if(this._initialData.title)return this._initialData.title;let e=this._initialData.url??"";return A.parse(e).authority||wy.DEFAULT_LABEL}getDescription(){return this._model?this._model.url:this._initialData.url}canReopen(){return!0}matches(e){if(super.matches(e))return!0;if(e instanceof wy)return this._id===e._id;if(Wo(e,{resource:!0})&&e.resource?.scheme===Rw.scheme){let t=Rw.parse(e.resource);if(t)return this._id===t.id}return!1}copy(){AH(this.telemetryService,"copyToNewWindow");let e=this._model?.url??this._initialData.url;return this.instantiationService.createInstance(wy,{id:_t(),url:e,title:this._model?.title??this._initialData.title,favicon:this._model?.favicon??this._initialData.favicon})}toUntyped(){return{resource:this.resource,options:{override:wy.ID}}}dispose(){this._model&&(this._resourceBeforeDisposal=this.resource,this._model.dispose(),this._model=void 0),super.dispose()}serialize(){return{id:this._id,url:this._model?this._model.url:this._initialData.url,title:this._model?this._model.title:this._initialData.title,favicon:this._model?this._model.favicon:this._initialData.favicon}}};wy=I([m(1,De),m(2,jQ),m(3,ao),m(4,F),m(5,Te)],wy);var QQt=class{canSerialize(i){return i instanceof wy}serialize(i){if(this.canSerialize(i))return JSON.stringify(i.serialize())}deserialize(i,e){try{let t=JSON.parse(e);return i.createInstance(wy,t)}catch{return}}};var BKe=class{constructor(i,e,t){this.instantiationService=e;this.workspaceContextService=t;this._models=new Map;let o=i.getChannel(B_o);this._browserViewService=dd.toService(o)}async getOrCreateBrowserViewModel(i){return this._getBrowserViewModel(i,!0)}async getBrowserViewModel(i){return this._getBrowserViewModel(i,!1)}async clearGlobalStorage(){return this._browserViewService.clearGlobalStorage()}async clearWorkspaceStorage(){let i=this.workspaceContextService.getWorkspace().id;return this._browserViewService.clearWorkspaceStorage(i)}async _getBrowserViewModel(i,e){let t=this._models.get(i);if(t)return t;t=this.instantiationService.createInstance(qQ,i,this._browserViewService),this._models.set(i,t);try{await t.initialize(e)}catch(o){throw this._models.delete(i),o}return H.once(t.onWillDispose)(()=>{this._models.delete(i)}),t}};BKe=I([m(0,Lu),m(1,F),m(2,Pe)],BKe);var uM=x.equals("activeEditor",_g.ID),Mw=L(5141,"Browser"),ghn="1_tabs",K_o="2_page",RBi="3_settings",mBi=class extends K{constructor(){super({id:"workbench.action.browser.open",title:L(5135,"Open Integrated Browser"),category:Mw,f1:!0})}async run(i,e){let t=i.get(ee),o=i.get(Te),n=typeof e=="string"?{url:e}:e??{},r=Rw.forUrl(n.url),s=n.openToSide?vn:Un;AH(o,n.url?"commandWithUrl":"commandWithoutUrl");let l=await t.openEditor({resource:r},s);n.openToSide&&l?.group&&l.group.lock(!0)}},hBi=class extends K{constructor(){super({id:"workbench.action.browser.newTab",title:L(5134,"New Tab"),category:Mw,f1:!0,precondition:uM,menu:{id:D.BrowserActionsToolbar,group:ghn,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=Rw.forUrl(void 0);AH(o,"newTabCommand"),await t.openEditor({resource:n})}},gBi=class a extends K{static{this.ID="workbench.action.browser.goBack"}constructor(){super({id:a.ID,title:L(5130,"Go Back"),category:Mw,icon:M.arrowLeft,f1:!0,precondition:x.and(uM,cBi),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 _g&&await e.goBack()}},fBi=class a extends K{static{this.ID="workbench.action.browser.goForward"}constructor(){super({id:a.ID,title:L(5131,"Go Forward"),category:Mw,icon:M.arrowRight,f1:!0,precondition:x.and(uM,dBi),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 _g&&await e.goForward()}},vBi=class a extends K{static{this.ID="workbench.action.browser.reload"}constructor(){super({id:a.ID,title:L(5138,"Reload"),category:Mw,icon:M.refresh,f1:!0,precondition:uM,menu:{id:D.BrowserNavigationToolbar,group:"navigation",order:3,alt:{id:YQt.ID,title:L(5132,"Hard Reload"),icon:M.refresh}},keybinding:{when:qQt,weight:275,primary:2096,secondary:[63],mac:{primary:2096,secondary:[]}}})}async run(i,e=i.get(ee).activeEditorPane){e instanceof _g&&await e.reload()}},YQt=class a extends K{static{this.ID="workbench.action.browser.hardReload"}constructor(){super({id:a.ID,title:L(5132,"Hard Reload"),category:Mw,icon:M.refresh,f1:!0,precondition:uM,keybinding:{when:qQt,weight:275,primary:3120,secondary:[2111],mac:{primary:3120,secondary:[]}}})}async run(i,e=i.get(ee).activeEditorPane){e instanceof _g&&await e.reload(!0)}},bBi=class a extends K{static{this.ID="workbench.action.browser.focusUrlInput"}constructor(){super({id:a.ID,title:L(5129,"Focus URL Input"),category:Mw,f1:!0,precondition:uM,keybinding:{weight:200,primary:2090}})}async run(i,e=i.get(ee).activeEditorPane){e instanceof _g&&await e.focusUrlInput()}},SBi=class a extends K{static{this.ID="workbench.action.browser.addElementToChat"}constructor(){let i=x.and(ie.enabled,x.equals("config.chat.sendElementsToChat.enabled",!0));super({id:a.ID,title:L(5123,"Add Element to Chat"),category:Mw,icon:M.inspect,f1:!0,precondition:x.and(uM,Fve,VKe.negate(),i),toggled:jQt,menu:{id:D.BrowserActionsToolbar,group:"actions",order:1,when:i},keybinding:[{weight:250,primary:3105},{when:jQt,weight:200,primary:9}]})}async run(i,e=i.get(ee).activeEditorPane){e instanceof _g&&await e.addElementToChat()}},IBi=class a extends K{static{this.ID="workbench.action.browser.addConsoleLogsToChat"}constructor(){let i=x.and(ie.enabled,x.equals("config.chat.sendElementsToChat.enabled",!0));super({id:a.ID,title:L(5122,"Add Console Logs to Chat"),category:Mw,icon:M.output,f1:!0,precondition:x.and(uM,Fve,VKe.negate(),i),menu:{id:D.BrowserActionsToolbar,group:"actions",order:2,when:i}})}async run(i,e=i.get(ee).activeEditorPane){e instanceof _g&&await e.addConsoleLogsToChat()}},yBi=class a extends K{static{this.ID="workbench.action.browser.toggleDevTools"}constructor(){super({id:a.ID,title:L(5140,"Toggle Developer Tools"),category:Mw,icon:M.terminal,f1:!0,precondition:x.and(uM,Fve,VKe.negate()),toggled:x.equals(uBi.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 _g&&await e.toggleDevTools()}},wBi=class a extends K{static{this.ID="workbench.action.browser.openExternal"}constructor(){super({id:a.ID,title:L(5136,"Open in External Browser"),category:Mw,icon:M.linkExternal,f1:!0,precondition:x.and(uM,Fve),menu:{id:D.BrowserActionsToolbar,group:K_o,order:10}})}async run(i,e=i.get(ee).activeEditorPane){if(e instanceof _g){let t=e.getUrl();t&&await i.get(Qe).open(t,{openExternal:!0,allowContributedOpeners:!1})}}},CBi=class a extends K{static{this.ID="workbench.action.browser.clearGlobalStorage"}constructor(){super({id:a.ID,title:L(5125,"Clear Storage (Global)"),category:Mw,icon:M.clearAll,f1:!0,menu:{id:D.BrowserActionsToolbar,group:RBi,order:1,when:x.equals(WKe.key,"global")}})}async run(i){await i.get(jQ).clearGlobalStorage()}},xBi=class a extends K{static{this.ID="workbench.action.browser.clearWorkspaceStorage"}constructor(){super({id:a.ID,title:L(5126,"Clear Storage (Workspace)"),category:Mw,icon:M.clearAll,f1:!0,menu:{id:D.BrowserActionsToolbar,group:RBi,order:1,when:x.equals(WKe.key,"workspace")}})}async run(i){await i.get(jQ).clearWorkspaceStorage()}},kBi=class a extends K{static{this.ID="workbench.action.browser.clearEphemeralStorage"}constructor(){super({id:a.ID,title:L(5124,"Clear Storage (Ephemeral)"),category:Mw,icon:M.clearAll,f1:!0,precondition:x.equals(WKe.key,"ephemeral"),menu:{id:D.BrowserActionsToolbar,group:"3_settings",order:1,when:x.equals(WKe.key,"ephemeral")}})}async run(i,e=i.get(ee).activeEditorPane){e instanceof _g&&await e.clearStorage()}},EBi=class a extends K{static{this.ID="workbench.action.browser.openSettings"}constructor(){super({id:a.ID,title:L(5137,"Open Browser Settings"),category:Mw,icon:M.settingsGear,f1:!1,menu:{id:D.BrowserActionsToolbar,group:RBi,order:2}})}async run(i){await i.get(Po).openSettings({query:"@id:workbench.browser.*,chat.sendElementsToChat.*"})}},TBi=class a extends K{static{this.ID="workbench.action.browser.showFind"}constructor(){super({id:a.ID,title:L(5139,"Find in Page"),category:Mw,f1:!0,precondition:x.and(uM,Fve,VKe.negate()),menu:{id:D.BrowserActionsToolbar,group:K_o,order:1},keybinding:{weight:100,primary:2084}})}run(i,e=i.get(ee).activeEditorPane){e instanceof _g&&e.showFind()}},_Bi=class a extends K{static{this.ID="workbench.action.browser.hideFind"}constructor(){super({id:a.ID,title:L(5133,"Close Find Widget"),category:Mw,f1:!1,precondition:x.and(uM,FKe),keybinding:{weight:105,primary:9}})}run(i){let e=i.get(ee).activeEditorPane;e instanceof _g&&e.hideFind()}},DBi=class a extends K{static{this.ID="workbench.action.browser.findNext"}constructor(){super({id:a.ID,title:L(5127,"Find Next"),category:Mw,f1:!1,precondition:uM,keybinding:[{when:nut,weight:100,primary:3},{when:FKe,weight:100,primary:61,mac:{primary:2085}}]})}run(i){let e=i.get(ee).activeEditorPane;e instanceof _g&&e.findNext()}},LBi=class a extends K{static{this.ID="workbench.action.browser.findPrevious"}constructor(){super({id:a.ID,title:L(5128,"Find Previous"),category:Mw,f1:!1,precondition:uM,keybinding:[{when:nut,weight:100,primary:1027},{when:FKe,weight:100,primary:1085,mac:{primary:3109}}]})}run(i){let e=i.get(ee).activeEditorPane;e instanceof _g&&e.findPrevious()}};W(mBi);W(hBi);W(gBi);W(fBi);W(vBi);W(YQt);W(bBi);W(SBi);W(IBi);W(yBi);W(wBi);W(CBi);W(xBi);W(kBi);W(EBi);W(TBi);W(_Bi);W(DBi);W(LBi);async function G_o(a,i,e,...t){return a.invokeFunctionRaw(i,e.toString(),...t)}async function Fk(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 cu(o instanceof Error?o.message:String(o))}}function cu(a){return{content:[{kind:"text",value:a}],toolResultError:a}}var Pw="open_browser_page",rut={id:Pw,toolReferenceName:"openBrowserPage",displayName:d(5176,null),userDescription:d(5177,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:M.openInProduct,source:Rn.Internal,inputSchema:{type:"object",properties:{url:{type:"string",description:"The full URL to open in the browser."}},required:["url"]}},HKe=class{constructor(i){this.playwrightService=i}async prepareToolInvocation(i,e){let t=i.parameters;return{invocationMessage:d(5174,null,t.url??"about:blank"),pastTenseMessage:d(5175,null,t.url??"about:blank"),confirmationMessages:{title:d(5173,null),message:d(5172,null,t.url??"about:blank"),allowAutoConfirm:!0}}}async invoke(i,e,t,o){let n=i.parameters;if(!n.url)return cu('The "url" parameter is required.');if(!URL.parse(n.url))return cu("You must provide a complete, valid URL.");let{pageId:r,summary:s}=await this.playwrightService.openPage(n.url);return{content:[{kind:"text",value:`Page ID: ${r}
${s}`}]}}};HKe=I([m(0,df)],HKe);var MBi={id:"click_element",toolReferenceName:"clickElement",displayName:d(5146,null),userDescription:d(5147,null),modelDescription:"Click on an element in a browser page.",icon:M.cursor,source:Rn.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"]}},UKe=class{constructor(i){this.playwrightService=i}async prepareToolInvocation(i,e){return{invocationMessage:d(5144,null),pastTenseMessage:d(5145,null)}}async invoke(i,e,t,o){let n=i.parameters;if(!n.pageId)return cu(`No page ID provided. Use '${Pw}' first.`);let r=n.selector;if(n.ref&&(r=`aria-ref=${n.ref}`),!r)return cu('Either a "selector" or "ref" parameter is required.');let s=n.button??"left";return n.dblClick?Fk(this.playwrightService,n.pageId,(l,c,u)=>l.locator(c).dblclick({button:u}),r,s):Fk(this.playwrightService,n.pageId,(l,c,u)=>l.locator(c).click({button:u}),r,s)}};UKe=I([m(0,df)],UKe);var PBi={id:"drag_element",toolReferenceName:"dragElement",displayName:d(5150,null),userDescription:d(5151,null),modelDescription:"Drag an element over another element in a browser page.",icon:M.move,source:Rn.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"]}},zKe=class{constructor(i){this.playwrightService=i}async prepareToolInvocation(i,e){return{invocationMessage:d(5148,null),pastTenseMessage:d(5149,null)}}async invoke(i,e,t,o){let n=i.parameters;if(!n.pageId)return cu(`No page ID provided. Use '${Pw}' first.`);let r=n.fromSelector;if(n.fromRef&&(r=`aria-ref=${n.fromRef}`),!r)return cu('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?Fk(this.playwrightService,n.pageId,(l,c,u)=>l.dragAndDrop(c,u),r,s):cu('Either a "toSelector" or "toRef" parameter is required for the target element.')}};zKe=I([m(0,df)],zKe);var ABi={id:"handle_dialog",toolReferenceName:"handleDialog",displayName:d(5154,null),userDescription:d(5155,null),modelDescription:"Respond to a pending modal (alert, confirm, prompt) or file chooser dialog on a browser page.",icon:M.comment,source:Rn.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"]}},KKe=class{constructor(i){this.playwrightService=i}async prepareToolInvocation(i,e){return{invocationMessage:d(5152,null),pastTenseMessage:d(5153,null)}}async invoke(i,e,t,o){let n=i.parameters;if(!n.pageId)return cu(`No page ID provided. Use '${Pw}' first.`);if(n.selectFiles!==void 0&&(n.acceptModal!==void 0||n.promptText!==void 0))return cu("Invalid parameters. 'selectFiles' cannot be used with 'acceptModal' or 'promptText'.");if(!Array.isArray(n.selectFiles)&&(n.acceptModal===void 0||n.acceptModal===null))return cu("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 cu(r instanceof Error?r.message:String(r))}}};KKe=I([m(0,df)],KKe);var NBi={id:"hover_element",toolReferenceName:"hoverElement",displayName:d(5158,null),userDescription:d(5159,null),modelDescription:"Hover over an element in a browser page. Provide either a Playwright selector or an element reference.",icon:M.cursor,source:Rn.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"]}},GKe=class{constructor(i){this.playwrightService=i}async prepareToolInvocation(i,e){return{invocationMessage:d(5156,null),pastTenseMessage:d(5157,null)}}async invoke(i,e,t,o){let n=i.parameters;if(!n.pageId)return cu(`No page ID provided. Use '${Pw}' first.`);let r=n.selector;return n.ref&&(r=`aria-ref=${n.ref}`),r?Fk(this.playwrightService,n.pageId,(s,l)=>s.locator(l).hover(),r):cu('Either a "selector" or "ref" parameter is required.')}};GKe=I([m(0,df)],GKe);var OBi={id:"navigate_page",toolReferenceName:"navigatePage",displayName:d(5170,null),userDescription:d(5171,null),modelDescription:"Navigate a browser page by URL, history, or reload.",icon:M.arrowRight,source:Rn.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"]}},$Ke=class{constructor(i){this.playwrightService=i}async prepareToolInvocation(i,e){let t=i.parameters;switch(t.type){case"reload":return{invocationMessage:d(5168,null),pastTenseMessage:d(5169,null)};case"back":return{invocationMessage:d(5160,null),pastTenseMessage:d(5161,null)};case"forward":return{invocationMessage:d(5162,null),pastTenseMessage:d(5163,null)};default:return{invocationMessage:d(5166,null,t.url),pastTenseMessage:d(5167,null,t.url),confirmationMessages:{title:d(5165,null),message:d(5164,null,t.url),allowAutoConfirm:!0}}}}async invoke(i,e,t,o){let n=i.parameters;if(!n.pageId)return cu(`No page ID provided. Use '${Pw}' first.`);switch(n.type){case"reload":return Fk(this.playwrightService,n.pageId,r=>r.reload({waitUntil:"domcontentloaded"}));case"back":return Fk(this.playwrightService,n.pageId,r=>r.goBack({waitUntil:"domcontentloaded"}));case"forward":return Fk(this.playwrightService,n.pageId,r=>r.goForward({waitUntil:"domcontentloaded"}));default:return n.url?Fk(this.playwrightService,n.pageId,(r,s)=>r.goto(s,{waitUntil:"domcontentloaded"}),n.url):cu('The "url" parameter is required when type is "url".')}}};$Ke=I([m(0,df)],$Ke);var FBi={...rut,modelDescription:"Open a new browser page in the integrated browser at the given URL."},qKe=class{constructor(i,e){this.telemetryService=i;this.editorService=e}async prepareToolInvocation(i,e){let t=i.parameters;return{invocationMessage:d(5180,null,t.url??"about:blank"),pastTenseMessage:d(5181,null,t.url??"about:blank"),confirmationMessages:{title:d(5179,null),message:d(5178,null,t.url??"about:blank"),allowAutoConfirm:!0}}}async invoke(i,e,t,o){let n=i.parameters;if(!n.url)return cu('The "url" parameter is required.');if(!URL.parse(n.url))return cu("You must provide a complete, valid URL.");AH(this.telemetryService,"chatTool");let r=Rw.forUrl(n.url);return await this.editorService.openEditor({resource:r,options:{pinned:!0}}),{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."}]}}};qKe=I([m(0,Te),m(1,ee)],qKe);var sut={id:"read_page",toolReferenceName:"readPage",displayName:d(5184,null),userDescription:d(5185,null),modelDescription:"Get a snapshot of the current browser page state. This is better than screenshot.",icon:M.fileText,source:Rn.Internal,inputSchema:{type:"object",properties:{pageId:{type:"string",description:"The browser page ID to read, acquired from context or the open tool."}},required:["pageId"]}},jKe=class{constructor(i){this.playwrightService=i}async prepareToolInvocation(i,e){let t=`[browser page](${Rw.forUrl("",i.parameters.pageId).toString()})`;return{invocationMessage:new xe(d(5182,null,t)),pastTenseMessage:new xe(d(5183,null,t))}}async invoke(i,e,t,o){let n=i.parameters;if(!n.pageId)return cu(`No page ID provided. Use '${Pw}' first.`);let r=await this.playwrightService.getSummary(n.pageId);return r?{content:[{kind:"text",value:r}]}:cu("No page summary available.")}};jKe=I([m(0,df)],jKe);var WBi={id:"run_playwright_code",toolReferenceName:"runPlaywrightCode",displayName:d(5191,null),userDescription:d(5192,null),modelDescription:"Run a Playwright code snippet to control a browser page. Only use this if other browser tools are insufficient.",icon:M.terminal,source:Rn.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"]}},QKe=class{constructor(i){this.playwrightService=i}async prepareToolInvocation(i,e){let o=i.parameters.code??"";return{invocationMessage:new xe(d(5188,null)),pastTenseMessage:new xe(d(5190,null)),confirmationMessages:{title:d(5187,null),message:new xe(`\`\`\`javascript
${o.trim()}
\`\`\``),disclaimer:d(5186,null),allowAutoConfirm:!0}}}async invoke(i,e,t,o){let n=i.parameters;if(!n.pageId)return cu(`No page ID provided. Use '${Pw}' first.`);if(!n.code)return cu('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 cu(`Code execution failed: ${u}`)}let s=JSON.stringify(r.result||null),l;return r.result&&(l=new xe,l.appendMarkdown(d(5189,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(),output:r.result?[{type:"embed",isText:!0,value:JSON.stringify(r.result,null,2)}]:[],isError:!1}}}};QKe=I([m(0,df)],QKe);var VBi={id:"screenshot_page",toolReferenceName:"screenshotPage",displayName:d(5195,null),userDescription:d(5196,null),modelDescription:`Capture a screenshot of the current browser page. You can't perform actions based on the screenshot; use ${sut.id} for actions.`,icon:M.deviceCamera,source:Rn.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"]}},YKe=class{constructor(i,e){this.browserViewWorkbenchService=i;this.playwrightService=e}async prepareToolInvocation(i,e){return{invocationMessage:d(5193,null),pastTenseMessage:d(5194,null)}}async invoke(i,e,t,o){let n=i.parameters;if(!n.pageId)return cu(`No page ID provided. Use '${Pw}' first.`);let r=n.selector;n.ref&&(r=`aria-ref=${n.ref}`);let s=await this.browserViewWorkbenchService.getBrowserViewModel(n.pageId),l=r&&await G_o(this.playwrightService,n.pageId,async(p,h,g)=>{let f=p.locator(h);return g&&await f.scrollIntoViewIfNeeded(),f.boundingBox()},r,n.scrollIntoViewIfNeeded)||void 0,c=s.zoomFactor;return l&&(l.x*=c,l.y*=c,l.width*=c,l.height*=c),{content:[{kind:"data",value:{mimeType:"image/jpeg",data:await s.captureScreenshot({rect:l})}}]}}};YKe=I([m(0,jQ),m(1,df)],YKe);var BBi={id:"type_in_page",toolReferenceName:"typeInPage",displayName:d(5201,null),userDescription:d(5202,null),modelDescription:"Type text or press keys in a browser page.",icon:M.symbolText,source:Rn.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"]}},XKe=class{constructor(i){this.playwrightService=i}async prepareToolInvocation(i,e){let t=i.parameters;return t.key?{invocationMessage:d(5197,null,t.key),pastTenseMessage:d(5198,null,t.key)}:{invocationMessage:d(5199,null),pastTenseMessage:d(5200,null)}}async invoke(i,e,t,o){let n=i.parameters;if(!n.pageId)return cu(`No page ID provided. Use '${Pw}' first.`);let r=n.selector;return n.ref&&(r=`aria-ref=${n.ref}`),!n.text&&!n.key?cu('Either a "text" or "key" parameter is required.'):n.key?r?Fk(this.playwrightService,n.pageId,(s,l,c)=>s.locator(l).press(c),r,n.key):Fk(this.playwrightService,n.pageId,(s,l)=>s.keyboard.press(l),n.key):r?Fk(this.playwrightService,n.pageId,(s,l,c)=>s.locator(l).fill(c),r,n.text):Fk(this.playwrightService,n.pageId,(s,l)=>s.keyboard.type(l),n.text)}};XKe=I([m(0,df)],XKe);var HG=class extends C{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 P);this._trackedIds=new Set;this._browserToolSet=this._register(this.toolsService.createToolSet(Rn.Internal,"browser","browser",{icon:M.globe,description:d(5143,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(FBi,this.instantiationService.createInstance(qKe))),this._toolsStore.add(this._browserToolSet.addTool(FBi)),this.chatContextService.updateWorkspaceContextItems(HG.CONTEXT_ID,[]);return}this._toolsStore.add(this.toolsService.registerTool(rut,this.instantiationService.createInstance(HKe))),this._toolsStore.add(this.toolsService.registerTool(sut,this.instantiationService.createInstance(jKe))),this._toolsStore.add(this.toolsService.registerTool(VBi,this.instantiationService.createInstance(YKe))),this._toolsStore.add(this.toolsService.registerTool(OBi,this.instantiationService.createInstance($Ke))),this._toolsStore.add(this.toolsService.registerTool(MBi,this.instantiationService.createInstance(UKe))),this._toolsStore.add(this.toolsService.registerTool(PBi,this.instantiationService.createInstance(zKe))),this._toolsStore.add(this.toolsService.registerTool(NBi,this.instantiationService.createInstance(GKe))),this._toolsStore.add(this.toolsService.registerTool(BBi,this.instantiationService.createInstance(XKe))),this._toolsStore.add(this.toolsService.registerTool(WBi,this.instantiationService.createInstance(QKe))),this._toolsStore.add(this.toolsService.registerTool(ABi,this.instantiationService.createInstance(KKe))),this._toolsStore.add(this._browserToolSet.addTool(rut)),this._toolsStore.add(this._browserToolSet.addTool(sut)),this._toolsStore.add(this._browserToolSet.addTool(VBi)),this._toolsStore.add(this._browserToolSet.addTool(OBi)),this._toolsStore.add(this._browserToolSet.addTool(MBi)),this._toolsStore.add(this._browserToolSet.addTool(PBi)),this._toolsStore.add(this._browserToolSet.addTool(NBi)),this._toolsStore.add(this._browserToolSet.addTool(BBi)),this._toolsStore.add(this._browserToolSet.addTool(WBi)),this._toolsStore.add(this._browserToolSet.addTool(ABi)),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 wy&&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(HG.CONTEXT_ID,[]);return}this.chatContextService.updateWorkspaceContextItems(HG.CONTEXT_ID,[{handle:0,label:d(5142,null),modelDescription:"The following browser pages are currently available and can be interacted with using the browser tools:",value:e.join(`
`)}])}};HG=I([m(0,F),m(1,jn),m(2,B),m(3,df),m(4,Q_),m(5,ee)],HG);pt(HG.ID,HG,ut.AfterRestored);oe.as(rn.EditorPane).registerEditorPane(ys.create(_g,_g.ID,d(5119,null)),[new Mt(wy)]);oe.as(rn.EditorFactory).registerEditorSerializer(wy.ID,QQt);var JKe=class{static{this.ID="workbench.contrib.browserEditorResolver"}constructor(i,e){i.registerEditor(`${Y.vscodeBrowser}:/**`,{id:wy.ID,label:d(5119,null),priority:"exclusive"},{canSupportResource:t=>t.scheme===Y.vscodeBrowser,singlePerResource:!0},{createEditorInput:({resource:t,options:o})=>{let n=Rw.parse(t);if(!n)throw new Error(`Invalid browser view resource: ${t.toString()}`);let r=e.createInstance(wy,{id:n.id,url:n.url});return r.resolve(),{editor:r,options:{...o,pinned:!!n.url}}}})}};JKe=I([m(0,ul),m(1,F)],JKe);pt(JKe.ID,JKe,ut.BlockStartup);var ZKe=class extends C{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:"||!t9e(r.host))return!1}catch{return!1}AH(this.telemetryService,"localhostLinkOpener");let n=Rw.forUrl(e);return await this.editorService.openEditor({resource:n,options:{pinned:!0}}),!0}};ZKe=I([m(0,Qe),m(1,B),m(2,ee),m(3,Te)],ZKe);pt(ZKe.ID,ZKe,ut.BlockStartup);we(jQ,BKe,1);oe.as(ii.Configuration).registerConfiguration({...Cm,properties:{"workbench.browser.openLocalhostLinks":{type:"boolean",default:!1,markdownDescription:d(5121,null)},"workbench.browser.enableChatTools":{type:"boolean",default:!1,experiment:{mode:"startup"},tags:["experimental"],markdownDescription:d(5120,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(5120,null)}}}},"workbench.browser.dataStorage":{type:"string",enum:["global","workspace","ephemeral"],markdownEnumDescriptions:[d(5117,null),d(5118,null),d(5116,null)],restricted:!0,default:"global",markdownDescription:d(5115,null),scope:4,order:100}}});var XQt=ae("ISplashStorageService");var QQ=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 P;H.once(e.onDidLayoutMainContainer)(()=>{this._removePartsSplash(),sn("code/didRemovePartsSplash")},void 0,this._disposables);let l=this._disposables.add(new me),c=()=>{l.value=jv(It,()=>this._savePartsSplash(),2500)};s.when(3).then(()=>{H.any(H.filter(Bk,u=>u===It.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:J$(i.type),colorInfo:{foreground:i.getColor(ko)?.toString(),background:Oe.Format.CSS.formatHex(i.getColor(qo)||DO(i)),editorBackground:i.getColor(qo)?.toString(),titleBarBackground:i.getColor(Mxe)?.toString(),titleBarBorder:i.getColor(w7i)?.toString(),activityBarBackground:i.getColor(t7i)?.toString(),activityBarBorder:i.getColor(i7i)?.toString(),sideBarBackground:i.getColor(op)?.toString(),sideBarBorder:i.getColor(hEt)?.toString(),statusBarBackground:i.getColor(bEt)?.toString(),statusBarBorder:i.getColor(dce)?.toString(),statusBarNoFolderBackground:i.getColor(SEt)?.toString(),windowBorder:i.getColor(xEt)?.toString()??i.getColor(kEt)?.toString()},layoutInfo:this._shouldSaveLayoutInfo()?{sideBarSide:this._layoutService.getSideBarPosition()===1?"right":"left",editorPartMinWidth:FE.width,titleBarHeight:this._layoutService.isVisible("workbench.parts.titlebar",It)?nh(Oi(this._layoutService.getContainer(It,"workbench.parts.titlebar"))):0,activityBarWidth:this._layoutService.isVisible("workbench.parts.activitybar")?yl(Oi(this._layoutService.getContainer(It,"workbench.parts.activitybar"))):0,sideBarWidth:this._layoutService.isVisible("workbench.parts.sidebar")?yl(Oi(this._layoutService.getContainer(It,"workbench.parts.sidebar"))):0,auxiliaryBarWidth:this._layoutService.isAuxiliaryBarMaximized()?Number.MAX_SAFE_INTEGER:this._layoutService.isVisible("workbench.parts.auxiliarybar")?yl(Oi(this._layoutService.getContainer(It,"workbench.parts.auxiliarybar"))):0,statusBarHeight:this._layoutService.isVisible("workbench.parts.statusbar",It)?nh(Oi(this._layoutService.getContainer(It,"workbench.parts.statusbar"))):0,windowBorder:this._layoutService.hasMainWindowBorder(),windowBorderRadius:this._layoutService.getMainWindowBorderRadius()}:void 0})}_shouldSaveLayoutInfo(){return!wS(It)&&!this._environmentService.isExtensionDevelopment&&!this._didChangeTitleBarStyle}_removePartsSplash(){let i=It.document.getElementById(QQ._splashElementId);i&&(i.style.display="none"),It.document.head.getElementsByClassName("initialShellColors")[0]?.remove()}};QQ=I([m(0,De),m(1,fi),m(2,Vt),m(3,B),m(4,XQt),m(5,Et),m(6,ao)],QQ);var aut=class{constructor(i){this.saveWindowSplash=i.saveWindowSplash.bind(i)}};aut=I([m(0,To)],aut);we(XQt,aut,1);pt(QQ.ID,QQ,ut.BlockStartup);W(class extends K{constructor(){super({id:"workbench.action.localHistory.revealInOS",title:ri?L(10858,"Reveal in File Explorer"):it?L(10857,"Reveal in Finder"):L(10856,"Open Containing Folder"),menu:{id:D.TimelineItemContext,group:"4_reveal",order:1,when:x.and(LH,Fo.Scheme.isEqualTo(Y.file))}})}async run(a,i){let e=a.get(yy),t=a.get(To),{entry:o}=await RH(e,i);o&&await t.showItemInFolder(o.location.with({scheme:Y.file}).fsPath)}});var $_o=L(11592,"Merge Editor (Dev)"),lut=class extends K{constructor(){super({id:"merge.dev.openContentsJson",category:$_o,title:L(11591,"Open Merge Editor State from JSON"),icon:M.layoutCentered,f1:!0})}async run(i,e){let t=i.get(Ge),o=i.get(Wi),n=i.get(ee),r=i.get(kt),s=i.get(iC),l=i.get(be);e||(e={});let c;if(e.data)c=e.data;else{let k=await t.input({prompt:d(11593,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,Lbe()),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,Je.fromString(T))}let y=await fhn(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 fhn(a,i){return i?i==="initial":(await a.pick([{label:"result",result:!1},{label:"initial result",result:!0}],{canPickMany:!1}))?.result}var HBi=class extends K{constructor(i){super(i)}run(i){let{activeEditorPane:e}=i.get(ee);if(e instanceof Vv){let t=e.viewModel.get();if(!t)return;this.runWithViewModel(t,i)}}},JQt=class extends HBi{constructor(){super({id:"merge.dev.openSelectionInTemporaryMergeEditor",category:$_o,title:L(11590,"Open Selection In Temporary Merge Editor"),icon:M.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 lut().run(e,{data:{base:o,input1:n,input2:r,result:s,languageId:i.resultCodeEditorView.editor.getModel().getLanguageId()}})}};W(lut);W(JQt);var Zne=L(12887,"Remote Tunnels"),NH="remoteTunnelConnection",vhn=new Q(NH,"disconnected"),UBi="remoteTunnelServiceUsed",q_o="remoteTunnelServicePromptedPreview",j_o="remoteTunnelExtensionRecommended",Q_o="remoteTunnelHasUsed",bhn=240*1e3,Shn=2;var UG;(r=>(r.turnOn=d(12886,null),r.turnOff=d(12885,null),r.showLog=d(12884,null),r.configure=d(12879,null),r.copyToClipboard=d(12880,null),r.learnMore=d(12881,null)))(UG||={});var cut=class extends C{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(je(u.logsHome,`${eQt}.log`),{id:eQt,name:KTo})),this.connectionStateContext=vhn.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(j_o,-1)||await this.extensionService.getExtension(e.extensionId))return!1;let n=this.storageService.get(UBi,-1);if(!n)return!1;let r;try{let l=JSON.parse(n);if(!yi(l))return!1;let{hostName:c,timeStamp:u}=l;if(!Ae(c)||!Xo(u)||new Date().getTime()>u+bhn)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:St.Info,priority:1,message:d(12878,null,n,e.friendlyName),actions:{primary:[pi({id:"showExtension",label:d(12866,null),run:()=>this.commandService.executeCommand("workbench.extensions.action.showExtensionsWithIds",[e.extensionId])}),pi({id:"doNotShowAgain",label:d(12865,null),run:()=>{this.storageService.store(j_o,!0,-1,0)}})]}}),!0):!1};if(await t()){let n=this._register(new P);n.add(this.storageService.onDidChangeValue(-1,UBi,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}:HTo);if(s?.dispose(),c.type==="connected"){this.connectionInfo=c.info,this.connectionStateContext.set("connected");return}};this.storageService.getBoolean(Q_o,-1,!1)?await this.progressService.withProgress({location:10,title:d(12868,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(Q_o,!0,-1,1);let t=!1;for(let o=0;o<Shn;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(12896,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:St.Warning,message:d(12888,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 P,o=t.add(this.quickInputService.createQuickPick({useSeparators:!0}));return o.ok=!1,o.placeholder=d(12863,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(12895,null)}),t.push(...e),t.push({type:"separator",label:d(12875,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(12894,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:UG.turnOn,category:Zne,precondition:x.equals(NH,"disconnected"),menu:[{id:D.CommandPalette},{id:D.AccountsContext,group:"2_remoteTunnel",when:x.equals(NH,"disconnected")}]})}async run(t){let o=t.get(Ne),n=t.get(Wi),r=t.get(ge),s=t.get(le),l=t.get(ct),c=t.get(Ge),u=t.get(nt);if(!s.getBoolean(q_o,-1,!1)){let{confirmed:b}=await l.confirm({message:d(12902,null),primaryButton:d(12867,null)});if(!b)return;s.store(q_o,!0,-1,0)}let h=new P,g=c.createQuickPick();g.placeholder=d(12897,null),g.items=[{service:!1,label:d(12900,null),description:d(12901,null,u.nameShort)},{service:!0,label:d(12898,null),description:d(12899,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:St.Info,message:d(12877,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:[pi({id:"copyToClipboard",label:d(12864,null),run:()=>n.writeText(b.toString(!0))}),pi({id:"showExtension",label:d(12866,null),run:()=>r.executeCommand("workbench.extensions.action.showExtensionsWithIds",[S.extensionId])})]}});let w={hostName:v.tunnelName,timeStamp:new Date().getTime()};s.store(UBi,JSON.stringify(w),-1,0)}else o.notify({severity:St.Info,message:d(12876,null)}),await r.executeCommand("workbench.remoteTunnel.actions.showLog")}})),this._register(W(class extends K{constructor(){super({id:"workbench.remoteTunnel.actions.manage",title:d(12883,null),category:Zne,menu:[{id:D.AccountsContext,group:"2_remoteTunnel",when:x.equals(NH,"connected")}]})}async run(){e.showManageOptions()}})),this._register(W(class extends K{constructor(){super({id:"workbench.remoteTunnel.actions.connecting",title:d(12882,null),category:Zne,menu:[{id:D.AccountsContext,group:"2_remoteTunnel",when:x.equals(NH,"connecting")}]})}async run(){e.showManageOptions()}})),this._register(W(class extends K{constructor(){super({id:"workbench.remoteTunnel.actions.turnOff",title:UG.turnOff,category:Zne,precondition:x.notEquals(NH,"disconnected"),menu:[{id:D.CommandPalette,when:x.notEquals(NH,"")}]})}async run(){let t=e.connectionInfo?.isAttached?d(12890,null):d(12889,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:UG.showLog,category:Zne,menu:[{id:D.CommandPalette,when:x.notEquals(NH,"")}]})}async run(t){t.get(Ml).showChannel(eQt)}})),this._register(W(class extends K{constructor(){super({id:"workbench.remoteTunnel.actions.configure",title:UG.configure,category:Zne,menu:[{id:D.CommandPalette,when:x.notEquals(NH,"")}]})}async run(t){t.get(Po).openSettings({query:Z8t})}})),this._register(W(class extends K{constructor(){super({id:"workbench.remoteTunnel.actions.copyToClipboard",title:UG.copyToClipboard,category:Zne,precondition:x.equals(NH,"connected"),menu:[{id:D.CommandPalette,when:x.equals(NH,"connected")}]})}async run(t){let o=t.get(Wi);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:UG.learnMore,category:Zne,menu:[]})}async run(t){await t.get(Qe).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&&!_q(t.configuration,this.environmentService)&&(n=t.configuration);let r=A.parse(e.link);return n?.scheme===Y.file?je(r,n.path):je(r,this.environmentService.userHome.path)}async showManageOptions(){let e=await this.remoteTunnelService.getMode();return new Promise((t,o)=>{let n=new P,r=this.quickInputService.createQuickPick({useSeparators:!0});r.placeholder=d(12869,null),n.add(r);let s=[];s.push({id:"workbench.remoteTunnel.actions.learnMore",label:UG.learnMore}),this.connectionInfo?(r.title=this.connectionInfo.isAttached?d(12871,null,this.connectionInfo.tunnelName):d(12873,null,this.connectionInfo.tunnelName),s.push({id:"workbench.remoteTunnel.actions.copyToClipboard",label:UG.copyToClipboard,description:this.connectionInfo.domain})):r.title=d(12872,null),s.push({id:"workbench.remoteTunnel.actions.showLog",label:d(12870,null)}),s.push({type:"separator"}),s.push({id:"workbench.remoteTunnel.actions.configure",label:d(12874,null),description:this.connectionInfo?.tunnelName}),s.push({id:"workbench.remoteTunnel.actions.turnOff",label:UG.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()})}};cut=I([m(0,Cs),m(1,ct),m(2,lt),m(3,X),m(4,nt),m(5,le),m(6,ol),m(7,Ge),m(8,iC),m(9,J8t),m(10,ge),m(11,Pe),m(12,Bo),m(13,Ne)],cut);var Ihn=oe.as(Qi.Workbench);Ihn.registerWorkbenchContribution(cut,3);oe.as(ii.Configuration).registerConfiguration({type:"object",properties:{[UTo]:{description:d(12891,null),type:"string",scope:1,ignoreSync:!0,pattern:"^(\\w[\\w-]*)?$",patternErrorMessage:d(12892,null),maxLength:20,default:""},[zTo]:{description:d(12893,null),type:"boolean",scope:1,default:!1}}});function Y_o(){W(zBi)}var zBi=class a extends K{static{this.ID="workbench.action.chat.openStorageFolder"}constructor(){super({id:a.ID,title:L(8089,"Open Chat Storage Folder"),icon:M.attach,category:We.Developer,f1:!0,precondition:ie.enabled})}async run(i,...e){let t=i.get(Si),o=i.get(To),n=t.getChatStorageFolder();o.showItemInFolder(n.fsPath)}};function X_o(){W(class extends K{constructor(){super({id:"workbench.action.chat.exportAsZip",category:vi,title:L(8090,"Export Chat as Zip..."),precondition:x.and(ie.enabled,xs.Entitlement.internal),f1:!0})}async run(i){let e=i.get(At),t=i.get(dn),o=i.get(Si),n=i.get(To),r=i.get(Ne),s=i.get($c),l=i.get(be),c=e.lastFocusedWidget;if(!c||!c.viewModel)return;let u=je(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 ZLi(s,l);v&&g.push({path:"chat.repo.end.json",contents:JSON.stringify(v,void 0,2)}),!h.repoData&&!v&&r.notify({severity:St.Warning,message:d(8092,null)})}else{let v=await ZLi(s,l);v?g.push({path:"chat.repo.begin.json",contents:JSON.stringify(v,void 0,2)}):r.notify({severity:St.Warning,message:d(8092,null)})}try{await n.createZipFile(p,g)}catch(v){r.notify({severity:St.Error,message:d(8091,null,v instanceof Error?v.message:String(v))})}}})}var yhn=["view","inline","quick","editor"],ere=x.and(ie.enabled,TV),KBi=x.or(Y4,ie.inChatInput),J_o=new Q("scopedVoiceChatGettingReady",!1,{type:"boolean",description:d(8098,null)}),Z_o=new Q("scopedVoiceChatInProgress",void 0,{type:"string",description:d(8099,null)}),ZQt=x.or(...yhn.map(a=>Z_o.isEqualTo(a)));var e6t=class a{static async create(i,e){let t=i.get(At),o=i.get(M_),n=i.get(fi),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=ca(r.activeTextEditorControl);if(s){let l=_m.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=J_o.bindTo(i),o=Z_o.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)}}},pM=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 pM.instance||(pM.instance=i.createInstance(pM)),pM.instance}async start(i,e){this.stop(),mM.getInstance(this.instantiationService).stop();let t=!1,o=++this.voiceChatSessionIds,n=this.currentVoiceChatSession={id:o,controller:i,hasRecognizedInput:!1,disposables:new P,setTimeoutDisabled:p=>{t=p},accept:()=>this.accept(o),stop:()=>this.stop(o,i.context)},r=new $e;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");(!Xo(c)||c<0)&&(c=E9e);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(8096,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,mM.getInstance(this.instantiationService).start(this.instantiationService.invokeFunction(r=>r6t.create(r,n,t)))}}};pM=I([m(0,A1t),m(1,B),m(2,F),m(3,Bi)],pM);var eDo=500;async function tDo(a,i,e,t){let o=i.get(F),r=i.get(_e).enableKeybindingHoldMode(a),s=await e6t.create(i,e);if(!s)return;let l=await pM.getInstance(o).start(s,t),c=!1,u=nn(()=>{c=!0,l?.setTimeoutDisabled(!0)},eDo);await r,u.dispose(),c&&l.accept()}var dut=class extends K{constructor(e,t){super(e);this.target=t}run(e,t){return tDo(this.desc.id,e,this.target,t)}},uut=class a extends dut{static{this.ID="workbench.action.chat.voiceChatInChatView"}constructor(){super({id:a.ID,title:L(8114,"Voice Chat in Chat View"),category:vi,precondition:ere,f1:!0},"view")}},t6t=class a extends K{static{this.ID="workbench.action.chat.holdToVoiceChatInChatView"}constructor(){super({id:a.ID,title:L(8106,"Hold to Voice Chat in Chat View"),keybinding:{weight:200,when:x.and(ere,ie.requestInProgress.negate(),KBi?.negate(),ue.focus.negate(),rr.negate(),Ci.SearchViewFocusedKey.negate(),lD.negate()),primary:2087}})}async run(i,e){let t=i.get(F),o=i.get(_e),n=i.get(At),r=o.enableKeybindingHoldMode(a.ID),s,l=nn(async()=>{let c=await e6t.create(i,"view");c&&(s=await pM.getInstance(t).start(c,e),s.setTimeoutDisabled(!0))},eDo);(await n.revealWidget())?.focusInput(),await r,l.dispose(),s&&s.accept()}},e2e=class a extends dut{static{this.ID="workbench.action.chat.inlineVoiceChat"}constructor(){super({id:a.ID,title:L(8107,"Inline Voice Chat"),category:vi,precondition:x.and(ere,fr),f1:!0},"inline")}},put=class a extends dut{static{this.ID="workbench.action.chat.quickVoiceChat"}constructor(){super({id:a.ID,title:L(8108,"Quick Voice Chat"),category:vi,precondition:ere,f1:!0},"quick")}},GBi=a=>[{id:D.ChatExecute,when:x.and(ie.location.isEqualTo("panel"),a),group:"navigation",order:3},{id:D.ChatExecute,when:x.and(ie.location.isEqualTo("panel").negate(),a),group:"navigation",order:2}],i6t=class a extends K{static{this.ID="workbench.action.chat.startVoiceChat"}constructor(){super({id:a.ID,title:L(8110,"Start Voice Chat"),category:vi,f1:!0,keybinding:{weight:200,when:x.and(KBi,ue.focus.negate(),rr.negate()),primary:2087},icon:M.mic,precondition:x.and(ere,J_o.negate(),TX.negate()),menu:GBi(x.and(TV,YQ.negate(),ZQt?.negate()))})}async run(i,e){let t=e?.widget;return t&&t.focusInput(),tDo(this.desc.id,i,"focused",e)}},o6t=class a extends K{static{this.ID="workbench.action.chat.stopListening"}constructor(){super({id:a.ID,title:L(8111,"Stop Listening"),category:vi,f1:!0,keybinding:{weight:300,primary:9,when:ZQt},icon:cE,precondition:N1t,menu:GBi(ZQt)})}async run(i){pM.getInstance(i.get(F)).stop()}},n6t=class a extends K{static{this.ID="workbench.action.chat.stopListeningAndSubmit"}constructor(){super({id:a.ID,title:L(8112,"Stop Listening and Submit"),category:vi,f1:!0,keybinding:{weight:200,when:x.and(KBi,ZQt),primary:2087},precondition:N1t})}run(i){pM.getInstance(i.get(F)).accept()}},YQ=new Q("scopedChatSynthesisInProgress",!1,{type:"boolean",description:d(8097,null)}),r6t=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(At),o=i.get(X),n=t.getWidgetBySessionResource(e.session.sessionResource);return n?.location==="editor"&&(n=t.lastFocusedWidget),{onDidHideChat:n?.onDidHide??H.None,contextKeyService:n?.scopedContextKeyService??o,response:e}}},mM=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 mM.instance||(mM.instance=i.createInstance(mM)),mM.instance}async start(i){this.stop(),pM.getInstance(this.instantiationService).stop();let e=this.activeSession=new $e,t=new P;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=YQ.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 wa(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 wa(H.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=khn(n,e);o=r.chunk,e=r.offset}return o&&t.ignoreCodeBlocks&&(o=this.filterCodeBlocks(o,t)),{chunk:o&&qa({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}};mM=I([m(0,EC),m(1,B),m(2,F)],mM);var whn=[".","!","?",":"],Chn=`
`,xhn=" ";function khn(a,i){let e;for(let t=a.length-1;t>=i;t--){let o=a[t],n=a[t+1];if(whn.includes(o)&&n===xhn||Chn===o){e=a.substring(i,t+1).trim(),i=t+1;break}}return{chunk:e,offset:i}}var s6t=class extends K{constructor(){super({id:"workbench.action.chat.readChatResponseAloud",title:L(8109,"Read Aloud"),icon:M.unmute,precondition:ere,menu:[{id:D.ChatMessageFooter,when:x.and(ere,ie.isResponse,YQ.negate(),ie.responseIsFiltered.negate()),group:"navigation",order:-10},{id:IB,when:x.and(ere,ie.isResponse,YQ.negate(),ie.responseIsFiltered.negate()),group:"navigation",order:-10}]})}run(i,...e){let t=i.get(F),o=i.get(At),n;if(e.length>0){let s=e[0];Vi(s)&&(n=s)}else{let s=o.lastFocusedWidget;if(s){let l=s.getFocus();if(l instanceof i3)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(Vi(h)){n=h;break}}}}}}if(!n)return;let r=r6t.create(i,"focused",n.model);mM.getInstance(t).start(r)}},a6t=class a extends K{static{this.ID="workbench.action.speech.stopReadAloud"}constructor(){super({id:a.ID,icon:xje,title:L(8115,"Stop Reading Aloud"),f1:!0,category:vi,precondition:SLt,keybinding:{weight:300,primary:9,when:YQ},menu:GBi(YQ)})}async run(i){mM.getInstance(i.get(F)).stop()}},l6t=class a extends K{static{this.ID="workbench.action.chat.stopReadChatItemAloud"}constructor(){super({id:a.ID,icon:M.mute,title:L(8113,"Stop Reading Aloud"),precondition:YQ,keybinding:{weight:300,primary:9},menu:[{id:D.ChatMessageFooter,when:x.and(YQ,ie.isResponse,ie.responseIsFiltered.negate()),group:"navigation",order:-10},{id:IB,when:x.and(YQ,ie.isResponse,ie.responseIsFiltered.negate()),group:"navigation",order:-10}]})}async run(i,...e){mM.getInstance(i.get(F)).stop()}};function iDo(a,i,e){if(!i.hasSpeechProvider||!e.getDefaultAgent("panel"))return!1;let t=a.getValue(Lce);return typeof t=="string"&&t!==Wk.SETTINGS_VALUE.OFF}var Wk=class extends C{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(XA)),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(H.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(Lce)&&this.handleKeywordActivation()}))}updateConfiguration(){if(!this.speechService.hasSpeechProvider||!this.chatAgentService.getDefaultAgent("panel"))return;oe.as(ii.Configuration).registerConfiguration({...CRt,properties:{[Lce]:{type:"string",enum:[Wk.SETTINGS_VALUE.OFF,Wk.SETTINGS_VALUE.VIEW_CHAT,Wk.SETTINGS_VALUE.QUICK_CHAT,Wk.SETTINGS_VALUE.INLINE_CHAT,Wk.SETTINGS_VALUE.CHAT_IN_CONTEXT],enumDescriptions:[d(8104,null),d(8102,null),d(8105,null),d(8103,null),d(8101,null)],description:d(8100,null),default:"off",tags:["accessibility"]}}})}handleKeywordActivation(){let e=iDo(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 $e,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(Lce)){case Wk.SETTINGS_VALUE.INLINE_CHAT:return e2e.ID;case Wk.SETTINGS_VALUE.QUICK_CHAT:return put.ID;case Wk.SETTINGS_VALUE.CHAT_IN_CONTEXT:if(ca(this.editorService.activeTextEditorControl)?.hasWidgetFocus())return e2e.ID;default:return uut.ID}}disableKeywordActivation(){this.activeSession?.dispose(!0),this.activeSession=void 0}dispose(){this.activeSession?.dispose(),super.dispose()}};Wk=I([m(0,EC),m(1,B),m(2,ge),m(3,F),m(4,ee),m(5,oi),m(6,br)],Wk);var XA=class extends C{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(qe.registerCommand(XA.STATUS_COMMAND,()=>this.commandService.executeCommand("workbench.action.openSettings",Lce))),this.registerListeners(),this.updateStatusEntry()}static{this.STATUS_NAME=d(8095,null)}static{this.STATUS_COMMAND="keywordActivation.status.command"}static{this.STATUS_ACTIVE=d(8093,null)}static{this.STATUS_INACTIVE=d(8094,null)}registerListeners(){this._register(this.speechService.onDidStartKeywordRecognition(()=>this.updateStatusEntry())),this._register(this.speechService.onDidEndKeywordRecognition(()=>this.updateStatusEntry())),this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration(Lce)&&this.updateStatusEntry()}))}updateStatusEntry(){iDo(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:XA.STATUS_NAME,text:this.speechService.hasActiveKeywordRecognition?"$(mic-filled)":"$(mic)",tooltip:this.speechService.hasActiveKeywordRecognition?XA.STATUS_ACTIVE:XA.STATUS_INACTIVE,ariaLabel:this.speechService.hasActiveKeywordRecognition?XA.STATUS_ACTIVE:XA.STATUS_INACTIVE,command:XA.STATUS_COMMAND,kind:"prominent",showInAllWindows:!0}}updateStatusLabel(){this.entry.value?.update(this.getStatusEntryProperties())}};XA=I([m(0,EC),m(1,Tr),m(2,ge),m(3,B),m(4,br)],XA);is((a,i)=>{let e,t;Ug(a.type)?(e=a.getColor(gi),t=a.getColor(gi)):(e=a.getColor(fY)??a.getColor(Ad),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 Ehn=PB({key:"chat.externalPath.workspaceAllowlist",defaultValue:[],toStorage:a=>JSON.stringify(a),fromStorage:a=>{let i=JSON.parse(a);return Array.isArray(i)?i:[]}}),c6t=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 vt;this._gitRootCache=new vt;o&&(this._workspaceAllowlist=Ehn(1,1,o))}dispose(){this._workspaceAllowlist?.dispose()}_getWorkspaceFolders(){if(!this._workspaceAllowlist)return new Mn;let i=new Mn;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(m$.isEqualOrParent(t,n))return{type:4};if(i.chatSessionResource){let n=this._sessionFolderAllowlist.get(i.chatSessionResource);if(n){for(let r of n)if(m$.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(7998,null),detail:d(7999,null),select:async()=>{let s=this._sessionFolderAllowlist.get(n);return s||(s=new Mn,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(8000,null),detail:d(8001,null,u.fsPath),select:async()=>{let p=c.get(n);return p||(p=new Mn,c.set(n,p)),p.add(u),!0}}):r.push({label:d(8000,null),detail:d(8002,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 Mn,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(8004,null),checked:!0,onDidChangeChecked:n=>{n?(e.add(o),this._setWorkspaceFolders(e)):(e.delete(o),this._setWorkspaceFolders(e))}});let t=new Mn;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(8003,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(7996,null),description:d(7997,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 oDo(a){let i=e9e(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 $Bi(a,i){let e=i;return e.startsWith("https://")?e=e.substring(8):e.startsWith("http://")&&(e=e.substring(7)),e.replace(/\/+$/,"")}function nDo(a,i,e){let t=e9e(a),o=A.parse(t);for(let[n,r]of Object.entries(i))if(LEe(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 Thn={iconClass:q.asClassName(M.trash),tooltip:d(8011,null)},t2e=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 nDo(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 vt(r.map(l=>[l,oDo(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=$Bi(l,p);n.push({label:e?d(8008,null,h):d(8009,null,h),select:async()=>(await this._approvePattern(p,e,!e),!0)})}n.push({label:d(8013,null),select:async()=>await this._showMoreOptions(i,[{uri:l,patterns:c}],e)})}else n.push({label:d(8015,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 P,r=n.add(this._quickInputService.createQuickTree());r.ignoreFocusOut=!0,r.sortByLabel=!1,r.placeholder=d(8020,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:$Bi(p,g),pattern:g,checked:v&&b?!0:!v&&!b?!1:"mixed",collapsed:!0,children:[{label:d(8005,null),pattern:g,approvalType:"request",checked:v},{label:d(8006,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(8007,null):d(8012,null);else{let l=[];o.approveRequest&&l.push(d(8018,null)),o.approveResponse&&l.push(d(8019,null)),r=l.length>0?d(8010,null,l.join(", ")):d(8016,null)}let s={label:n,description:r,buttons:[Thn],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(8014,null),description:d(8017,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")||{}}};t2e=I([m(1,B),m(2,Ge),m(3,Po)],t2e);var rDo={id:lot,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:Rn.Internal,canRequestPostApproval:!0,canRequestPreApproval:!0,inputSchema:{type:"object",properties:{urls:{type:"array",items:{type:"string"},description:d(8133,null)}},required:["urls"]}},i2e=class{constructor(i,e,t,o){this._readerModeService=i;this._fileService=e;this._trustedDomainService=t;this._chatService=o}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(8126,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}}}):zke({buffer:w.value,bytesRead:w.value.byteLength}).seemsBinary?p.push(d(8117,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[S,y]of o.entries())try{await this._fileService.stat(y),r.push(y)}catch{s.push(S)}let l=[...Array.from(n),...s],c=new Mn([...t.values(),...r]),u=l.length?l.length>1?new xe(d(8127,null,c.size,l.map(S=>`- ${S}`).join(`
`))):new xe(d(8128,null,l[0])):new xe,p=new xe;if(c.size>1)u.appendMarkdown(d(8129,null,c.size)),p.appendMarkdown(d(8123,null,c.size));else if(c.size===1){let S=ht.first(c).toString(!0);S.length>400||r.length===1?(u.appendMarkdown(d(8131,null,S)),p.appendMarkdown(d(8125,null,S))):(u.appendMarkdown(d(8130,null,S)),p.appendMarkdown(d(8124,null,S)))}let h;if(i.chatSessionResource){let y=this._chatService.getSession(i.chatSessionResource)?.getRequests().map(k=>k.message.text.toLowerCase()),w=!1;for(let k of c){let T=k.toString(!0).toLowerCase().replace(/\/$/,"");y?.some(N=>N.includes(T))&&(c.delete(k),w=!0)}w&&c.size===0&&(h=d(8132,null))}let g={invocationMessage:p,pastTenseMessage:u},f=ht.every(c,S=>this._trustedDomainService.isValid(S)),v,b;return c.size&&!f&&(c.size===1?(v=d(8120,null),b=new xe(ht.first(c).toString(!0),{supportThemeIcons:!0})):(v=d(8119,null),b=new xe([...c].map(S=>`- ${S.toString(!0)}`).join(`
`),{supportThemeIcons:!0}))),g.confirmationMessages={title:v,message:b,confirmResults:c.size>0,allowAutoConfirm:!0,disclaimer:new xe("$(info) "+d(8118,null),{supportThemeIcons:!0}),confirmationNotNeededReason:h},g}_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(8121,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 ${lot} again to get its contents.`};case"error":return{kind:"text",title:n,value:`An error occurred retrieving the fetch result: ${t.value.error}`};default:Hr(t.value)}else throw new Error("unreachable")}else return{kind:"text",title:n,value:d(8122,null)}})}_getSupportedImageMimeType(i){switch(Am(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}}};i2e=I([m(0,wMe),m(1,be),m(2,_V),m(3,Si)],i2e);var Wve=class extends C{static{this.ID="chat.nativeBuiltinTools"}constructor(i,e,t,o,n,r,s){super();let l=e.createInstance(i2e);this._register(i.registerTool(rDo,l)),this._register(t.registerConfirmationContribution(lot,e.createInstance(t2e,u=>u.urls)));let c=new c6t(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(m$.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))}};Wve=I([m(0,jn),m(1,F),m(2,gD),m(3,be),m(4,le),m(5,dn),m(6,ot)],Wve);var d6t=class extends K{constructor(){super({id:"workbench.action.openSessionsWindow",title:L(8116,"Open Sessions Window"),category:vi,precondition:x.and(RW.notEqualsTo("stable"),xs.Setup.hidden.negate(),$p.negate()),f1:!0})}async run(i){await i.get(To).openSessionsWindow()}};var o2e=class extends C{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(){el.on("vscode:handleChatRequest",(e,...t)=>{let o=t[0];this.logService.trace("vscode:handleChatRequest",o),this.prompt(o)}),el.on("vscode:openChatSession",(e,...t)=>{let o=t[0];this.logService.trace("vscode:openChatSession",o);let n=A.parse(o);this.chatWidgetService.openSession(n,$x)})}async prompt(e){if(!Array.isArray(e?._)||!await this.workspaceTrustRequestService.requestWorkspaceTrust({message:d(8139,null)}))return;let o={query:e._.length>0?e._.join(" "):"",mode:e.mode??"agent",attachFiles:e["add-file"]?.map(n=>A.file(iN(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(im),await this.commandService.executeCommand(qC,o)}};o2e=I([m(0,ps),m(1,ge),m(2,Vd),m(3,ne),m(4,fi),m(5,X),m(6,At)],o2e);var n2e=class extends C{static{this.ID="workbench.contrib.chatSuspendThrottlingHandler"}constructor(i,e){super(),this._register(he(t=>{let o=e.requestInProgressObs.read(t);i.setBackgroundThrottling(!o)}))}};n2e=I([m(0,To),m(1,Si)],n2e);var r2e=class extends C{constructor(e,t,o,n,r,s,l){super();this.agentSessionsService=t;this.dialogService=o;this.widgetService=n;this.contextKeyService=r;this.environmentService=l;this._register(e.onBeforeShutdown(c=>{c.veto(this.shouldVetoShutdown(c.reason),"veto.chat")})),this._register(s.onWillStop(c=>{c.veto(this.hasNonCloudSessionInProgress(),d(8136,null))}))}static{this.ID="workbench.contrib.chatLifecycleHandler"}hasNonCloudSessionInProgress(){return this.agentSessionsService.model.sessions.some(e=>L_(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(8138,null),o=d(8137,null);break;case 4:t=d(8135,null),o=d(8134,null);break;case 3:t=d(8145,null),o=d(8144,null);break;default:t=it?d(8143,null):d(8141,null),o=it?d(8142,null):d(8140,null);break}return!(await this.dialogService.confirm({message:t,detail:o})).confirmed}};r2e=I([m(0,ao),m(1,ia),m(2,ct),m(3,At),m(4,X),m(5,lt),m(6,ps)],r2e);W(d6t);W(i6t);W(uut);W(t6t);W(put);W(e2e);W(o6t);W(n6t);W(s6t);W(l6t);W(a6t);Y_o();X_o();pt(Wk.ID,Wk,ut.AfterRestored);pt(Wve.ID,Wve,ut.AfterRestored);pt(o2e.ID,o2e,ut.BlockRestore);pt(n2e.ID,n2e,ut.AfterRestored);pt(r2e.ID,r2e,ut.AfterRestored);function u6t(a,i){for(let e of a)if(Xe(e.modifiedURI,i)||Xe(e.originalURI,i))return!0;return!1}function p6t(a,i){if(!(a.changes instanceof Array))return!1;for(let e of a.changes)if(ike(e)){if(Xe(e.uri,i)||e.originalUri&&Xe(e.originalUri,i)||e.modifiedUri&&Xe(e.modifiedUri,i))return!0}else if(Xe(e.modifiedUri,i)||e.originalUri&&Xe(e.originalUri,i))return!0;return!1}var Aw=ae("agentFeedbackService"),s2e=class extends C{constructor(e,t,o,n,r){super();this._chatEditingService=e;this._agentSessionsService=t;this._editorService=o;this._chatWidgetService=n;this._commandService=r;this._onDidChangeFeedback=this._store.add(new E);this.onDidChangeFeedback=this._onDidChangeFeedback.event;this._onDidChangeNavigation=this._store.add(new E);this.onDidChangeNavigation=this._onDidChangeNavigation.event;this._feedbackBySession=new Map;this._sessionUpdatedOrder=new Map;this._sessionUpdatedSequence=0;this._navigationAnchorBySession=new Map}addFeedback(e,t,o,n){let r=e.toString(),s=this._feedbackBySession.get(r);s||(s=[],this._feedbackBySession.set(r,s));let l={id:_t(),text:n,resourceUri:t,range:o,sessionResource:e},c=t.toString();if(!s.some(p=>p.resourceUri.toString()===c))s.push(l);else{let p=s.length;for(let h=0;h<s.length;h++){if(s[h].resourceUri.toString()===c&&s[h].range.startLineNumber>o.startLineNumber){p=h;break}s[h].resourceUri.toString()===c&&(p=h+1)}s.splice(p,0,l)}return this._sessionUpdatedOrder.set(r,++this._sessionUpdatedSequence),this._onDidChangeNavigation.fire(e),this._onDidChangeFeedback.fire({sessionResource:e,feedbackItems:s}),l}removeFeedback(e,t){let o=e.toString(),n=this._feedbackBySession.get(o);if(!n)return;let r=n.findIndex(s=>s.id===t);r>=0&&(n.splice(r,1),this._navigationAnchorBySession.get(o)===t&&(this._navigationAnchorBySession.delete(o),this._onDidChangeNavigation.fire(e)),n.length>0?this._sessionUpdatedOrder.set(o,++this._sessionUpdatedSequence):this._sessionUpdatedOrder.delete(o),this._onDidChangeFeedback.fire({sessionResource:e,feedbackItems:n}))}getFeedback(e){return this._feedbackBySession.get(e.toString())??[]}getMostRecentSessionForResource(e){let t,o=-1;for(let[,n]of this._feedbackBySession){if(!n.length)continue;let r=n[0].sessionResource;if(!this._sessionContainsResource(r,e,n))continue;let s=this._sessionUpdatedOrder.get(r.toString())??0;s>o&&(t=r,o=s)}return t}_sessionContainsResource(e,t,o){if(o.some(n=>Xe(n.resourceUri,t)))return!0;for(let n of this._chatEditingService.editingSessionsObs.get())if(Xe(n.chatSessionResource,e)&&u6t(n.entries.get(),t))return!0;for(let n of this._agentSessionsService.model.sessions)if(Xe(n.resource,e)&&p6t(n,t))return!0;return!1}async revealFeedback(e,t){let o=e.toString(),r=this._feedbackBySession.get(o)?.find(s=>s.id===t);r&&(await this._editorService.openEditor({resource:r.resourceUri,options:{preserveFocus:!1,revealIfVisible:!0}}),setTimeout(()=>{this._navigationAnchorBySession.set(o,t),this._onDidChangeNavigation.fire(e)},50))}getNextFeedback(e,t){let o=e.toString(),n=this._feedbackBySession.get(o);if(!n?.length){this._navigationAnchorBySession.delete(o);return}let r=this._navigationAnchorBySession.get(o),s=r?n.findIndex(u=>u.id===r):-1;s<0&&!t&&(s=0);let l=t?(s+1)%n.length:(s-1+n.length)%n.length,c=n[l];return this._navigationAnchorBySession.set(o,c.id),this._onDidChangeNavigation.fire(e),c}getNavigationBearing(e){let t=e.toString(),o=this._feedbackBySession.get(t)??[],n=this._navigationAnchorBySession.get(t);return{activeIdx:n?o.findIndex(s=>s.id===n):-1,totalCount:o.length}}clearFeedback(e){let t=e.toString();this._feedbackBySession.delete(t),this._sessionUpdatedOrder.delete(t),this._navigationAnchorBySession.delete(t),this._onDidChangeNavigation.fire(e),this._onDidChangeFeedback.fire({sessionResource:e,feedbackItems:[]})}async addFeedbackAndSubmit(e,t,o,n){this.addFeedback(e,t,o,n);let r=this._chatWidgetService.getWidgetBySessionResource(e);if(r){let s="agentFeedback:"+e.toString(),l=()=>r.attachmentModel.attachments.some(c=>c.id===s);l()||await H.toPromise(H.filter(r.attachmentModel.onDidChange,()=>l()))}else await new Promise(s=>setTimeout(s,100));await this._commandService.executeCommand("agentFeedbackEditor.action.submit")}};s2e=I([m(0,dl),m(1,ia),m(2,ee),m(3,At),m(4,ge)],s2e);function tre(a,i,e){for(let t of i.editingSessionsObs.get())if(u6t(t.entries.get(),a))return t.chatSessionResource;for(let t of e.model.sessions)if(p6t(t,a))return t.resource}function mut(a){let i=[],e=no.getOriginalUri(a,{supportSideBySide:3});return e?A.isUri(e)?(i.push(e),i):(e.secondary&&i.push(e.secondary),e.primary&&i.push(e.primary),i):i}var qBi=class a{constructor(i){this._editor=i;this.allowEditorOverflow=!1;this._position=null;this._lineHeight=0;this._onDidTriggerAdd=new E;this.onDidTriggerAdd=this._onDidTriggerAdd.event;this._onDidTriggerAddAndSubmit=new E;this.onDidTriggerAddAndSubmit=this._onDidTriggerAddAndSubmit.event;this._isShowingAlt=!1;this._domNode=document.createElement("div"),this._domNode.classList.add("agent-feedback-input-widget"),this._domNode.style.display="none",this._inputElement=document.createElement("textarea"),this._inputElement.rows=1,this._inputElement.placeholder=d(2814,null),this._domNode.appendChild(this._inputElement),this._measureElement=document.createElement("span"),this._measureElement.classList.add("agent-feedback-input-measure"),this._domNode.appendChild(this._measureElement);let e=document.createElement("div");e.classList.add("agent-feedback-input-actions"),this._domNode.appendChild(e),this._addAction=new st("agentFeedback.add",d(2812,null),q.asClassName(M.plus),!1,()=>(this._onDidTriggerAdd.fire(),Promise.resolve())),this._addAndSubmitAction=new st("agentFeedback.addAndSubmit",d(2813,null),q.asClassName(M.send),!1,()=>(this._onDidTriggerAddAndSubmit.fire(),Promise.resolve())),this._actionBar=new ji(e),this._actionBar.push(this._addAction,{icon:!0,label:!1,keybinding:d(2816,null)}),bf.getInstance().event(o=>{this._updateActionForAlt(o.altKey)}),this._editor.applyFontInfo(this._inputElement),this._editor.applyFontInfo(this._measureElement),this._lineHeight=22,this._inputElement.style.lineHeight=`${this._lineHeight}px`}static{this._ID="agentFeedback.inputWidget"}static{this._MIN_WIDTH=150}static{this._MAX_WIDTH=400}_updateActionForAlt(i){i&&!this._isShowingAlt?(this._isShowingAlt=!0,this._actionBar.clear(),this._actionBar.push(this._addAndSubmitAction,{icon:!0,label:!1,keybinding:d(2815,null)})):!i&&this._isShowingAlt&&(this._isShowingAlt=!1,this._actionBar.clear(),this._actionBar.push(this._addAction,{icon:!0,label:!1,keybinding:d(2816,null)}))}getId(){return a._ID}getDomNode(){return this._domNode}getPosition(){return this._position}get inputElement(){return this._inputElement}setPosition(i){this._position=i,this._editor.layoutOverlayWidget(this)}show(){this._domNode.style.display=""}hide(){this._domNode.style.display="none"}clearInput(){this._inputElement.value="",this._updateActionEnabled(),this._autoSize()}autoSize(){this._autoSize()}updateActionEnabled(){this._updateActionEnabled()}_updateActionEnabled(){let i=this._inputElement.value.trim().length>0;this._addAction.enabled=i,this._addAndSubmitAction.enabled=i}_autoSize(){let i=this._inputElement.value||this._inputElement.placeholder;this._measureElement.textContent=i;let e=this._measureElement.scrollWidth,t=Math.max(a._MIN_WIDTH,Math.min(e+10,a._MAX_WIDTH));this._inputElement.style.width=`${t}px`,this._inputElement.style.height="auto";let o=Math.max(this._inputElement.scrollHeight,this._lineHeight);this._inputElement.style.height=`${o}px`}dispose(){this._actionBar.dispose(),this._addAction.dispose(),this._addAndSubmitAction.dispose(),this._onDidTriggerAdd.dispose(),this._onDidTriggerAddAndSubmit.dispose()}},a2e=class extends C{constructor(e,t,o,n){super();this._editor=e;this._agentFeedbackService=t;this._chatEditingService=o;this._agentSessionsService=n;this._visible=!1;this._mouseDown=!1;this._widgetListeners=this._store.add(new P);this._store.add(this._editor.onDidChangeCursorSelection(()=>this._onSelectionChanged())),this._store.add(this._editor.onDidChangeModel(()=>this._onModelChanged())),this._store.add(this._editor.onDidScrollChange(()=>{this._visible&&this._updatePosition()})),this._store.add(this._editor.onMouseDown(r=>{this._isWidgetTarget(r.event.target)||(this._mouseDown=!0,this._hide())})),this._store.add(this._editor.onMouseUp(r=>{this._mouseDown=!1,!this._isWidgetTarget(r.event.target)&&this._onSelectionChanged()})),this._store.add(this._editor.onDidBlurEditorWidget(()=>{this._visible&&Me(this._editor.getDomNode()).setTimeout(()=>{this._visible&&(this._isWidgetTarget(Me(this._editor.getDomNode()).document.activeElement)||this._hide())},0)})),this._store.add(this._editor.onDidFocusEditorText(()=>this._onSelectionChanged()))}static{this.ID="agentFeedback.editorInputContribution"}_isWidgetTarget(e){return!!this._widget&&!!e&&this._widget.getDomNode().contains(e)}_ensureWidget(){return this._widget||(this._widget=new qBi(this._editor),this._store.add(this._widget.onDidTriggerAdd(()=>this._addFeedback())),this._store.add(this._widget.onDidTriggerAddAndSubmit(()=>this._addFeedbackAndSubmit())),this._editor.addOverlayWidget(this._widget)),this._widget}_onModelChanged(){this._hide(),this._sessionResource=void 0}_onSelectionChanged(){if(this._mouseDown||!this._editor.hasTextFocus())return;let e=this._editor.getSelection();if(!e||e.isEmpty()){this._hide();return}let t=this._editor.getModel();if(!t){this._hide();return}let o=tre(t.uri,this._chatEditingService,this._agentSessionsService);if(!o){this._hide();return}this._sessionResource=o,this._show()}_show(){let e=this._ensureWidget();this._visible||(this._visible=!0,this._registerWidgetListeners(e)),e.clearInput(),e.show(),this._updatePosition()}_hide(){this._visible&&(this._visible=!1,this._widgetListeners.clear(),this._widget&&(this._widget.hide(),this._widget.setPosition(null),this._widget.clearInput()))}_registerWidgetListeners(e){this._widgetListeners.clear();let t=this._editor.getDomNode();t&&this._widgetListeners.add(Vo(t,"keydown",o=>{if(this._visible&&this._editor.hasTextFocus()&&!(o.keyCode===5||o.keyCode===4||o.keyCode===6||o.keyCode===57)){if(o.keyCode===9){this._hide(),this._editor.focus();return}if((o.ctrlKey||o.metaKey)&&o.keyCode===39){o.preventDefault(),o.stopPropagation(),e.inputElement.focus();return}o.ctrlKey||o.altKey||o.metaKey||this._editor.getOption(104)&&Me(e.inputElement).document.activeElement!==e.inputElement&&e.inputElement.focus()}})),this._widgetListeners.add(Vo(e.inputElement,"keydown",o=>{if(o.keyCode===9){o.preventDefault(),o.stopPropagation(),this._hide(),this._editor.focus();return}if(o.keyCode===3&&o.altKey){o.preventDefault(),o.stopPropagation(),this._addFeedbackAndSubmit();return}if(o.keyCode===3){o.preventDefault(),o.stopPropagation(),this._addFeedback();return}})),this._widgetListeners.add(Vo(e.inputElement,"keypress",o=>{o.stopPropagation()})),this._widgetListeners.add(Vo(e.inputElement,"input",()=>{e.autoSize(),e.updateActionEnabled(),this._updatePosition()})),this._widgetListeners.add(Vo(e.inputElement,"blur",()=>{Me(e.inputElement).setTimeout(()=>{this._visible&&(this._editor.hasWidgetFocus()||this._hide())},0)}))}focusInput(){this._visible&&this._widget&&this._widget.inputElement.focus()}_addFeedback(){if(!this._widget)return!1;let e=this._widget.inputElement.value.trim();if(!e)return!1;let t=this._editor.getSelection(),o=this._editor.getModel();return!t||!o||!this._sessionResource?!1:(this._agentFeedbackService.addFeedback(this._sessionResource,o.uri,t,e),this._hide(),this._editor.focus(),!0)}_addFeedbackAndSubmit(){if(!this._widget)return;let e=this._widget.inputElement.value.trim();if(!e)return;let t=this._editor.getSelection(),o=this._editor.getModel();if(!t||!o||!this._sessionResource)return;let n=this._sessionResource;this._hide(),this._editor.focus(),this._agentFeedbackService.addFeedbackAndSubmit(n,o.uri,t,e)}_updatePosition(){if(!this._widget||!this._visible)return;let e=this._editor.getSelection();if(!e||e.isEmpty()){this._hide();return}let t=e.getDirection()===0?e.getEndPosition():e.getStartPosition(),o=this._editor.getScrolledVisiblePosition(t);if(!o){this._widget.setPosition(null);return}let n=this._editor.getOption(75),r=this._editor.getLayoutInfo(),s=this._widget.getDomNode(),l=s.offsetHeight||30,c=s.offsetWidth||150,u;e.getDirection()===0?(u=o.top+n,u+l>r.height&&(u=o.top-l)):(u=o.top-l,u<0&&(u=o.top+n)),u=Math.max(0,Math.min(u,r.height-l));let p=Math.max(0,Math.min(o.left,r.width-c));this._widget.setPosition({preference:{top:u,left:p}})}dispose(){this._widget&&(this._editor.removeOverlayWidget(this._widget),this._widget.dispose(),this._widget=void 0),super.dispose()}};a2e=I([m(1,Aw),m(2,dl),m(3,ia)],a2e);go(a2e.ID,a2e,3);function _hn(a,i=5){if(a.length===0)return[];let e=[...a].sort((n,r)=>n.range.startLineNumber-r.range.startLineNumber),t=[],o=[e[0]];for(let n=1;n<e.length;n++){let r=o[0],s=e[n];s.range.startLineNumber-r.range.startLineNumber<=i?o.push(s):(t.push(o),o=[s])}return o.length>0&&t.push(o),t}var jBi=class a extends C{constructor(e,t,o,n){super();this._editor=e;this._feedbackItems=t;this._agentFeedbackService=o;this._sessionResource=n;this._id=`agent-feedback-widget-${a._idPool++}`;this._itemElements=new Map;this._position=null;this._isExpanded=!1;this._disposed=!1;this._startLineNumber=1;this._eventStore=this._register(new P);this._rangeHighlightDecoration=this._editor.createDecorationsCollection(),this._domNode=_("div.agent-feedback-widget"),this._domNode.classList.add("collapsed"),this._headerNode=_("div.agent-feedback-widget-header"),this._titleNode=_("span.agent-feedback-widget-title"),this._updateTitle(),this._headerNode.appendChild(this._titleNode),this._headerNode.appendChild(_("span.agent-feedback-widget-spacer")),this._toggleButton=_("div.agent-feedback-widget-toggle"),this._updateToggleButton(),this._headerNode.appendChild(this._toggleButton),this._dismissButton=_("div.agent-feedback-widget-dismiss"),this._dismissButton.appendChild(Qo(M.close)),this._dismissButton.title=d(2820,null),this._headerNode.appendChild(this._dismissButton),this._domNode.appendChild(this._headerNode),this._bodyNode=_("div.agent-feedback-widget-body"),this._bodyNode.classList.add("collapsed"),this._buildFeedbackItems(),this._domNode.appendChild(this._bodyNode);let r=_("div.agent-feedback-widget-arrow");this._domNode.appendChild(r),this._setupEventHandlers(),this._domNode.classList.add("visible"),this._editor.addOverlayWidget(this)}static{this._idPool=0}_setupEventHandlers(){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.collapse():this.expand()}_dismiss(){for(let o of this._feedbackItems)this._agentFeedbackService.removeFeedback(this._sessionResource,o.id);this._domNode.classList.add("fadeOut");let e=()=>{this.dispose()},t=setTimeout(e,150);this._domNode.addEventListener("animationend",()=>{clearTimeout(t),e()},{once:!0})}_updateTitle(){let e=this._feedbackItems.length;e===1?this._titleNode.textContent=d(2825,null):this._titleNode.textContent=d(2824,null,e)}_updateToggleButton(){Rt(this._toggleButton),this._isExpanded?(this._toggleButton.appendChild(Qo(M.chevronUp)),this._toggleButton.title=d(2819,null)):(this._toggleButton.appendChild(Qo(M.chevronDown)),this._toggleButton.title=d(2821,null))}_buildFeedbackItems(){Rt(this._bodyNode),this._itemElements.clear();for(let e of this._feedbackItems){let t=_("div.agent-feedback-widget-item");this._itemElements.set(e.id,t);let o=_("span.agent-feedback-widget-line-info");e.range.startLineNumber===e.range.endLineNumber?o.textContent=d(2822,null,e.range.startLineNumber):o.textContent=d(2823,null,e.range.startLineNumber,e.range.endLineNumber),t.appendChild(o);let n=_("span.agent-feedback-widget-text");n.textContent=e.text,t.appendChild(n),this._eventStore.add(j(t,"mouseenter",()=>{this._highlightRange(e)})),this._eventStore.add(j(t,"mouseleave",()=>{this._rangeHighlightDecoration.clear()})),this._bodyNode.appendChild(t)}}expand(){this._isExpanded=!0,this._domNode.classList.remove("collapsed"),this._bodyNode.classList.remove("collapsed"),this._updateToggleButton(),this._editor.layoutOverlayWidget(this)}collapse(){this._isExpanded=!1,this._domNode.classList.add("collapsed"),this._bodyNode.classList.add("collapsed"),this._updateToggleButton(),this.clearFocus(),this._editor.layoutOverlayWidget(this)}focusFeedback(e){for(let n of this._itemElements.values())n.classList.remove("focused");let t=this._feedbackItems.find(n=>n.id===e);if(!t)return;this._itemElements.get(e)?.classList.add("focused"),this._highlightRange(t)}clearFocus(){for(let e of this._itemElements.values())e.classList.remove("focused");this._rangeHighlightDecoration.clear()}_highlightRange(e){let t=e.range.endLineNumber,o=new z(e.range.startLineNumber,1,t,this._editor.getModel()?.getLineMaxColumn(t)??1);this._rangeHighlightDecoration.set([{range:o,options:{description:"agent-feedback-range-highlight",className:"rangeHighlight",isWholeLine:!0,linesDecorationsClassName:"agent-feedback-widget-range-glyph"}},{range:o,options:{description:"agent-feedback-range-highlight-overview",overviewRuler:{color:Ss(y9),position:7}}}])}containsFeedback(e){return this._feedbackItems.some(t=>t.id===e)}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=yl(this._domNode)||280,c=this._domNode.offsetHeight||0,u=this._editor.getTopForLineNumber(e)-t,p=this._editor.getScrollHeight(),h=Math.min(Math.max(0,u),Math.max(0,p-c));this._position={stackOrdinal:2,preference:{top:h-s,left:o+n-(2*r+l)}},this._editor.layoutOverlayWidget(this)}toggle(e){this._domNode.classList.toggle("visible",e),e&&this._feedbackItems.length>0&&this.layout(this._feedbackItems[0].range.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())}},l2e=class extends C{constructor(e,t,o,n){super();this._editor=e;this._agentFeedbackService=t;this._chatEditingService=o;this._agentSessionsService=n;this._widgets=[];this._store.add(this._agentFeedbackService.onDidChangeFeedback(r=>{this._sessionResource&&r.sessionResource.toString()===this._sessionResource.toString()&&this._rebuildWidgets()})),this._store.add(this._agentFeedbackService.onDidChangeNavigation(r=>{this._sessionResource&&r.toString()===this._sessionResource.toString()&&this._handleNavigation()})),this._store.add(this._editor.onDidChangeModel(()=>{this._resolveSession(),this._rebuildWidgets()})),this._store.add(H.any(this._editor.onDidScrollChange,this._editor.onDidLayoutChange)(()=>{for(let r of this._widgets)r.relayout()})),this._resolveSession(),this._rebuildWidgets()}static{this.ID="agentFeedback.editorWidgetContribution"}_resolveSession(){let e=this._editor.getModel();if(!e){this._sessionResource=void 0;return}this._sessionResource=tre(e.uri,this._chatEditingService,this._agentSessionsService)}_rebuildWidgets(){if(this._clearWidgets(),!this._sessionResource)return;let e=this._editor.getModel();if(!e)return;let o=this._agentFeedbackService.getFeedback(this._sessionResource).filter(r=>r.resourceUri.toString()===e.uri.toString());if(o.length===0)return;let n=_hn(o,5);for(let r of n){let s=new jBi(this._editor,r,this._agentFeedbackService,this._sessionResource);this._widgets.push(s),s.layout(r[0].range.startLineNumber)}}_handleNavigation(){if(!this._sessionResource)return;let e=this._agentFeedbackService.getNavigationBearing(this._sessionResource);if(e.activeIdx<0)return;let o=this._agentFeedbackService.getFeedback(this._sessionResource)[e.activeIdx];if(!o)return;for(let r of this._widgets)r.containsFeedback(o.id)?(r.expand(),r.focusFeedback(o.id)):r.collapse();let n=new z(o.range.startLineNumber,1,o.range.endLineNumber,1);this._editor.revealRangeInCenterIfOutsideViewport(n,0)}_clearWidgets(){for(let e of this._widgets)e.dispose();this._widgets.length=0}dispose(){this._clearWidgets(),super.dispose()}};l2e=I([m(1,Aw),m(2,dl),m(3,ia)],l2e);go(l2e.ID,l2e,3);var Dhn=J("editorOverviewRuler.agentFeedbackForeground",w9,d(2829,null)),c2e=class extends C{constructor(e,t,o,n){super();this._editor=e;this._agentFeedbackService=t;this._chatEditingService=o;this._agentSessionsService=n;this._decorations=this._editor.createDecorationsCollection(),this._store.add(this._agentFeedbackService.onDidChangeFeedback(()=>this._updateDecorations())),this._store.add(this._editor.onDidChangeModel(()=>{this._resolveSession(),this._updateDecorations()})),this._resolveSession(),this._updateDecorations()}static{this.ID="agentFeedback.overviewRulerContribution"}_resolveSession(){let e=this._editor.getModel();if(!e){this._sessionResource=void 0;return}this._sessionResource=tre(e.uri,this._chatEditingService,this._agentSessionsService)}_updateDecorations(){if(!this._sessionResource){this._decorations.clear();return}let e=this._editor.getModel();if(!e){this._decorations.clear();return}let t=this._agentFeedbackService.getFeedback(this._sessionResource),o=e.uri.toString();this._decorations.set(t.filter(n=>n.resourceUri.toString()===o).map(n=>({range:n.range,options:{description:"agent-feedback-overview-ruler",overviewRuler:{color:Ss(Dhn),position:2}}})))}dispose(){this._decorations.clear(),super.dispose()}};c2e=I([m(1,Aw),m(2,dl),m(3,ia)],c2e);go(c2e.ID,c2e,3);var Lhn="agentFeedback:",Vve=class extends C{constructor(e,t,o){super();this._agentFeedbackService=e;this._chatWidgetService=t;this._textModelService=o;this._widgetListeners=this._store.add(new jt);this._snippetCache=new Map;this._store.add(this._agentFeedbackService.onDidChangeFeedback(n=>{this._updateAttachment(n.sessionResource),this._ensureAcceptListener(n.sessionResource)}))}static{this.ID="workbench.contrib.agentFeedbackAttachment"}async _updateAttachment(e){let t=this._chatWidgetService.getWidgetBySessionResource(e);if(!t)return;let o=this._agentFeedbackService.getFeedback(e),n=Lhn+e.toString();if(o.length===0){t.attachmentModel.delete(n),this._snippetCache.clear();return}let r=await this._buildFeedbackValue(o),s={kind:"agentFeedback",id:n,name:o.length===1?d(2802,null):d(2801,null,o.length),icon:M.comment,sessionResource:e,feedbackItems:o.map(l=>({id:l.id,text:l.text,resourceUri:l.resourceUri,range:l.range,codeSelection:this._snippetCache.get(l.id)})),value:r};t.attachmentModel.delete(n),t.attachmentModel.addContext(s)}async _buildFeedbackValue(e){let t=new Set(e.map(r=>r.id));for(let r of this._snippetCache.keys())t.has(r)||this._snippetCache.delete(r);let o=e.filter(r=>!this._snippetCache.has(r.id));o.length>0&&await Promise.all(o.map(async r=>{let s=await this._getCodeSnippet(r.resourceUri,r.range);this._snippetCache.set(r.id,s)}));let n=["The following comments were made on the code changes:"];for(let r of e){let s=this._snippetCache.get(r.id),l=Ye(r.resourceUri),c=r.range.startLineNumber===r.range.endLineNumber?`${r.range.startLineNumber}`:`${r.range.startLineNumber}-${r.range.endLineNumber}`,u=`[${l}:${c}]`;s&&(u+=`
\`\`\`
${s}
\`\`\``),u+=`
Comment: ${r.text}`,n.push(u)}return n.join(`

`)}async _getCodeSnippet(e,t){try{let o=await this._textModelService.createModelReference(e);try{return o.object.textEditorModel.getValueInRange(t)}finally{o.dispose()}}catch{return}}_ensureAcceptListener(e){let t=e.toString();if(this._widgetListeners.has(t))return;let o=this._chatWidgetService.getWidgetBySessionResource(e);o&&this._widgetListeners.set(t,o.onDidSubmitAgent(()=>{this._agentFeedbackService.clearFeedback(e),this._widgetListeners.deleteAndDispose(t)}))}};Vve=I([m(0,Aw),m(1,At),m(2,Nt)],Vve);var u2e=_;function QBi(a){return a.type==="file"}var YBi=class{getHeight(i){return 22}getTemplateId(i){return QBi(i)?m6t.TEMPLATE_ID:h6t.TEMPLATE_ID}},m6t=class a{constructor(i,e,t){this._labels=i;this._agentFeedbackService=e;this._sessionResource=t;this.templateId=a.TEMPLATE_ID}static{this.TEMPLATE_ID="feedbackFile"}renderTemplate(i){let e=new P,t=e.add(this._labels.create(i,{supportHighlights:!0,supportIcons:!0})),o=u2e("div.agent-feedback-hover-action-bar");t.element.appendChild(o);let n=e.add(new ji(o));return{label:t,actionBar:n,templateDisposables:e}}renderElement(i,e,t){let o=i.element;t.label.element.style.display="flex";let n=No(o.uri.path);if(t.label.setResource({resource:o.uri,name:n},{fileKind:0}),t.actionBar.clear(),this._agentFeedbackService){let r=this._agentFeedbackService,s=this._sessionResource;t.actionBar.push(new st("agentFeedback.removeFileComments",d(2827,null),q.asClassName(M.close),!0,()=>{for(let l of o.items)r.removeFeedback(s,l.id)}),{icon:!0,label:!1})}}disposeTemplate(i){i.templateDisposables.dispose()}},h6t=class a{constructor(i,e,t,o){this._agentFeedbackService=i;this._sessionResource=e;this._hoverService=t;this._languageService=o;this.templateId=a.TEMPLATE_ID}static{this.TEMPLATE_ID="feedbackComment"}renderTemplate(i){let e=new P,t=R(i,u2e("div.agent-feedback-hover-comment-row")),o=R(t,u2e("div.agent-feedback-hover-comment-text")),n=R(t,u2e("div.agent-feedback-hover-action-bar")),r=e.add(new ji(n)),s=e.add(new me),l={textElement:o,row:t,actionBar:r,templateDisposables:e,hoverDisposable:s,element:void 0};if(this._agentFeedbackService){let c=this._agentFeedbackService,u=this._sessionResource;e.add(j(t,re.CLICK,p=>{let h=l.element;h&&(p.preventDefault(),p.stopPropagation(),c.revealFeedback(u,h.id))}))}return l}renderElement(i,e,t){let o=i.element;if(t.textElement.textContent=o.text,t.element=o,this._agentFeedbackService||(t.hoverDisposable.value=this._hoverService.setupDelayedHover(t.row,()=>this._buildCommentHover(o),{groupId:"agent-feedback-comment"})),t.actionBar.clear(),this._agentFeedbackService){let n=this._agentFeedbackService,r=this._sessionResource;t.actionBar.push(new st("agentFeedback.removeComment",d(2826,null),q.asClassName(M.close),!0,()=>{n.removeFeedback(r,o.id)}),{icon:!0,label:!1})}}disposeTemplate(i){i.templateDisposables.dispose()}_buildCommentHover(i){let e=new xe("",{isTrusted:!0,supportThemeIcons:!0});if(e.appendText(i.text),i.codeSelection){let t=this._languageService.guessLanguageIdByFilepathOrFirstLine(i.resourceUri);e.appendMarkdown(`

`),e.appendCodeblock(t??"",i.codeSelection)}return{content:e,style:1,position:{hoverPosition:1}}}},d2e=class extends C{constructor(e,t,o,n,r,s,l){super();this._element=e;this._attachment=t;this._canDelete=o;this._hoverService=n;this._instantiationService=r;this._agentFeedbackService=s;this._languageService=l;this._store.add(this._hoverService.setupDelayedHover(this._element,()=>this._store.add(this._buildHoverContent()),{groupId:"chat-attachments"})),this._store.add(j(this._element,re.CLICK,c=>{c.preventDefault(),c.stopPropagation(),this._showHoverNow()}))}_showHoverNow(){let e=this._buildHoverContent();this._register(e),this._hoverService.showInstantHover({...e,target:this._element})}_buildHoverContent(){let e=new P,t=u2e("div.agent-feedback-hover"),o=R(t,u2e(".results.show-file-icons.file-icon-themable-tree.agent-feedback-hover-tree")),n=e.add(this._instantiationService.createInstance(Za,AP)),{children:r,commentElements:s}=this._buildTreeData(),l=e.add(this._instantiationService.createInstance(mg,"AgentFeedbackHoverTree",o,new YBi,[new m6t(n,this._canDelete?this._agentFeedbackService:void 0,this._attachment.sessionResource),new h6t(this._canDelete?this._agentFeedbackService:void 0,this._attachment.sessionResource,this._hoverService,this._languageService)],{defaultIndent:0,alwaysConsumeMouseWheel:!1,accessibilityProvider:{getAriaLabel:g=>QBi(g)?No(g.uri.path):g.text,getWidgetAriaLabel:()=>d(2828,null)},identityProvider:{getId:g=>QBi(g)?`file:${g.uri.toString()}`:`comment:${g.id}`},overrideStyles:{listFocusBackground:void 0,listInactiveFocusBackground:void 0,listActiveSelectionBackground:void 0,listFocusAndSelectionBackground:void 0,listInactiveSelectionBackground:void 0,listBackground:qT,listFocusForeground:void 0,treeStickyScrollBackground:qT}}));l.setChildren(null,r);let c=22,u=8,p=s.length+r.length,h=Math.min(p*c,u*c);return l.layout(h,200),o.style.height=`${h}px`,{content:t,style:1,position:{hoverPosition:3},trapFocus:!0,appearance:{compact:!0},additionalClasses:["agent-feedback-hover-container"],dispose:()=>e.dispose()}}_buildTreeData(){let e=new Map;for(let n of this._attachment.feedbackItems){let r=n.resourceUri.toString(),s=e.get(r);s||(s={uri:n.resourceUri,comments:[]},e.set(r,s)),s.comments.push({type:"comment",id:n.id,text:n.text,resourceUri:n.resourceUri,codeSelection:n.codeSelection})}let t=[],o=[];for(let[,n]of e){let r={type:"file",uri:n.uri,items:n.comments};o.push(...n.comments),t.push({element:r,collapsible:!0,collapsed:!1,children:n.comments.map(s=>({element:s,collapsible:!1}))})}return{children:t,commentElements:o}}};d2e=I([m(3,tt),m(4,F),m(5,Aw),m(6,kt)],d2e);var p2e=class extends C{constructor(e,t,o,n){super();this._attachment=e;this._instantiationService=n;this._onDidDelete=this._store.add(new E);this.onDidDelete=this._onDidDelete.event;this._onDidOpen=this._store.add(new E);this.onDidOpen=this._onDidOpen.event;this.element=R(o,_(".chat-attached-context-attachment.agent-feedback-attachment")),this.element.tabIndex=0,this.element.role="button";let r=_("span");r.classList.add(...q.asClassNameArray(M.comment));let s=_("div.chat-attached-context-pill",{},r);this.element.appendChild(s);let l=_("span.chat-attached-context-custom-text",{},this._attachment.name);if(this.element.appendChild(l),t.supportsDeletion&&!!0){let u=R(this.element,_(".chat-attached-context-clear-button")),p=_("span");p.classList.add(...q.asClassNameArray(M.close)),u.appendChild(p),u.title=d(2804,null),this._store.add(j(u,re.CLICK,h=>{h.preventDefault(),h.stopPropagation(),this._onDidDelete.fire(h)})),t.shouldFocusClearButton&&u.focus()}this.element.ariaLabel=d(2803,null,this._attachment.name),this._store.add(this._instantiationService.createInstance(d2e,this.element,this._attachment,t.supportsDeletion))}};p2e=I([m(3,F)],p2e);var ZBi="agentFeedbackEditor.action.submit",eHi="agentFeedbackEditor.action.navigatePrevious",tHi="agentFeedbackEditor.action.navigateNext",Rhn="agentFeedbackEditor.action.clearAll",iHi="agentFeedbackEditor.navigation.bearings",hut=class extends K{constructor(i){super({category:vi,...i})}async run(i){let e=i.get(ee),t=i.get(Aw),n=mut(e.activeEditorPane?.input).map(r=>t.getMostRecentSessionForResource(r)).find(r=>!!r);if(n)return this.runWithSession(i,n)}},XBi=class extends hut{constructor(){super({id:ZBi,title:L(2809,"Submit Feedback"),shortTitle:L(2810,"Submit"),icon:M.send,precondition:ie.enabled,menu:{id:va.AgentFeedbackEditorContent,group:"a_submit",order:0,when:ie.enabled}})}async runWithSession(i,e){let t=i.get(At),o=i.get(Aw),n=i.get(ee),r=t.getWidgetBySessionResource(e);if(!r)return;let s=[];for(let{editor:l,groupId:c}of n.getEditors(1))mut(l).some(h=>Xe(o.getMostRecentSessionForResource(h),e))&&s.push({editor:l,groupId:c});s.length&&await n.closeEditors(s),await r.acceptInput("Act on the provided feedback")}},g6t=class extends hut{constructor(e){super({id:e?tHi:eHi,title:e?L(2807,"Go to Next Feedback Comment"):L(2808,"Go to Previous Feedback Comment"),icon:e?M.arrowDown:M.arrowUp,f1:!0,precondition:ie.enabled,menu:{id:va.AgentFeedbackEditorContent,group:"navigate",order:e?2:1,when:ie.enabled}});this._next=e}runWithSession(e,t){let o=e.get(Aw),n=e.get(ee),r=o.getNextFeedback(t,this._next);r&&n.openEditor({resource:r.resourceUri,options:{preserveFocus:!1,revealIfVisible:!0}})}},JBi=class extends hut{constructor(){super({id:Rhn,title:L(2805,"Clear"),tooltip:L(2806,"Clear All Feedback"),icon:M.clearAll,f1:!0,precondition:x.and(ie.enabled),menu:{id:va.AgentFeedbackEditorContent,group:"a_submit",order:1,when:ie.enabled}})}runWithSession(i,e){i.get(Aw).clearFeedback(e)}};function sDo(){W(XBi),W(class extends g6t{constructor(){super(!1)}}),W(class extends g6t{constructor(){super(!0)}}),W(JBi),fe.appendMenuItem(va.AgentFeedbackEditorContent,{command:{id:iHi,title:d(2811,null),precondition:x.false()},group:"navigate",order:-1,when:ie.enabled})}var oHi=class extends Lr{constructor(e,t,o,n=[ZBi]){let r=e.id===eHi||e.id===tHi;super(void 0,e,{...t,icon:r,label:!r,keybindingNotRenderedWithLabel:!0});this._keybindingService=o;this._primaryActionIds=n}render(e){super.render(e),this._primaryActionIds.includes(this._action.id)&&this.element?.classList.add("primary")}getTooltip(){let e=super.getTooltip();return!e||this.options.keybinding?e:this._keybindingService.appendKeybinding(e,this._action.id)}},gut=class extends C{constructor(e,t){super();this._instaService=e;this._keybindingService=t;this._showStore=this._store.add(new P);this._navigationBearings=Le(this,{activeIdx:-1,totalCount:0});this._domNode=document.createElement("div"),this._domNode.classList.add("agent-feedback-editor-overlay-widget"),this._toolbarNode=document.createElement("div"),this._toolbarNode.classList.add("agent-feedback-editor-overlay-toolbar")}getDomNode(){return this._domNode}show(e){this._showStore.clear(),this._navigationBearings.set(e,void 0),this._domNode.contains(this._toolbarNode)||this._domNode.appendChild(this._toolbarNode),this._showStore.add(this._instaService.createInstance(Ln,this._toolbarNode,va.AgentFeedbackEditorContent,{telemetrySource:"agentFeedback.overlayToolbar",hiddenItemStrategy:0,toolbarOptions:{primaryGroup:()=>!0,useSeparatorsInPrimaryActions:!0},menuOptions:{renderShortTitle:!0},actionViewItemProvider:(t,o)=>{if(t.id===iHi){let n=this;return new class extends Lr{constructor(){super(void 0,t,{...o,icon:!1,label:!0,keybindingNotRenderedWithLabel:!0})}render(r){super.render(r),r.classList.add("label-item"),this._store.add(he(s=>{So(this.label);let{activeIdx:l,totalCount:c}=n._navigationBearings.read(s);if(c>0){let u=l===-1?1:l+1;this.label.innerText=d(2817,null,u,c)}else this.label.innerText=d(2818,null)}))}}}return new oHi(t,o,this._keybindingService)}})),this._showStore.add(Z(()=>this._toolbarNode.remove()))}hide(){this._showStore.clear(),this._navigationBearings.set({activeIdx:-1,totalCount:0},void 0),this._toolbarNode.remove()}};gut=I([m(0,F),m(1,_e)],gut);var fut=class{constructor(i,e,t,o,n,r){this._store=new P;this._domNode=document.createElement("div");this._domNode.classList.add("agent-feedback-editor-overlay"),this._domNode.style.position="absolute",this._domNode.style.bottom="24px",this._domNode.style.right="24px",this._domNode.style.zIndex="100";let s=this._store.add(n.createInstance(gut));this._domNode.appendChild(s.getDomNode()),this._store.add(Z(()=>this._domNode.remove()));let l=()=>{i.contains(this._domNode)||i.appendChild(this._domNode)},c=()=>{i.contains(this._domNode)&&(s.hide(),this._domNode.remove())},u=Nr(this,H.any(e.onDidActiveEditorChange,e.onDidModelChange,t.onDidChangeFeedback,t.onDidChangeNavigation));this._store.add(he(p=>{u.read(p);let h=mut(e.activeEditorPane?.input),g;for(let f of h){let v=tre(f,r,o);if(v&&t.getFeedback(v).length>0){g=t.getNavigationBearing(v);break}}if(!g){c();return}s.show(g),l()}))}dispose(){this._store.dispose()}};fut=I([m(2,Aw),m(3,ia),m(4,F),m(5,dl)],fut);var Bve=class{constructor(i,e){this._store=new P;let t=ui(this,H.any(i.onDidAddGroup,i.onDidRemoveGroup),()=>i.groups),o=this._store.add(new jt);this._store.add(he(n=>{let r=t.read(n),s=new Set(o.keys());for(let l of r)if(l instanceof Uf&&(s.delete(l),!o.has(l))){let c=e.createChild(new Io([X,l.scopedContextKeyService])),u=c.createInstance(fut,l.element,l);o.set(l,hn(u,c))}for(let l of s)o.deleteAndDispose(l)}))}static{this.ID="chat.agentFeedback.editorOverlay"}dispose(){this._store.dispose()}};Bve=I([m(0,Et),m(1,F)],Bve);pt(Bve.ID,Bve,ut.AfterRestored);pt(Vve.ID,Vve,ut.AfterRestored);sDo();we(Aw,s2e,1);var m2e=class{static{this.ID="workbench.contrib.agentFeedbackAttachmentWidgetFactory"}constructor(i,e){i.registerFactory("agentFeedback",(t,o,n)=>e.createInstance(p2e,t,o,n))}};m2e=I([m(0,Aee),m(1,F)],m2e);pt(m2e.ID,m2e,ut.AfterRestored);var vut=class{constructor(i,e,t,o){this.jsonEditingService=i;this.environmentService=e;this.fileService=t;this.storageService=o;this.migrateToGnomeLibsecret()}async migrateToGnomeLibsecret(){if(!(!Wn||this.storageService.getBoolean("encryption.migratedToGnomeLibsecret",-1,!1)))try{let i=await this.fileService.readFile(this.environmentService.argvResource),e=xk(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)}}};vut=I([m(0,zf),m(1,Co),m(2,be),m(3,le)],vut);oe.as(Qi.Workbench).registerWorkbenchContribution(vut,4);var Mhn=3600*1e3,aDo="emergencyAlert.banner",h2e=class extends C{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 EI).cancelAndSet(()=>this.fetchAlerts(r),Mhn,It)}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},ve.None);if(t.res.statusCode!==200)throw new Error(`Failed to fetch emergency alerts: HTTP ${t.res.statusCode}`);let o=await hh(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===ZA)&&(!r.arch||r.arch===ube));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:aDo,icon:M.warning,message:n.message,actions:n.actions}))}dismissAlert(){this.currentAlertMessage!==void 0&&(this.currentAlertMessage=void 0,this.currentAlertActions=void 0,this.bannerService.hide(aDo))}};h2e=I([m(0,jP),m(1,_a),m(2,nt),m(3,ne)],h2e);pt(h2e.ID,h2e,ut.Eventually);var g2e=class extends Zee{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 Pi(50)}getDebugPort(){return this._nativeHostService.findFreePort(5e3,10,5e3,2048)}};g2e=I([m(0,Li),m(1,ge),m(2,To)],g2e);var f2e=class extends Mie{constructor(e,t,o,n,r,s,l){super(null,o,n,r,s,l);this.mainProcess=e;this.logService=t}start(){dd.toService(this.mainProcess.getChannel(f2t)).load().then(t=>this.setDetails(t),t=>{this.logService.warn("Error getting main process MCP environment",t),this.setDetails(void 0)})}};f2e=I([m(0,Lu),m(1,ne),m(2,ot),m(3,be),m(4,F),m(5,md),m(6,B)],f2e);var v2e=class{constructor(i,e,t){this._remoteAgentService=e;this._logService=t;this._localPlatformService=dd.toService(i.getChannel(ynt))}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=A.revive(i.address);return this._logService.info(`[McpGateway][Workbench] Local gateway created: ${e}`),{address:e,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(ynt,async e=>{let t=dd.toService(e),o=await t.createGateway(void 0),n=A.revive(o.address);return this._logService.info(`[McpGateway][Workbench] Remote gateway created: ${n}`),{address:n,dispose:()=>{this._logService.info(`[McpGateway][Workbench] Disposing remote gateway: ${o.gatewayId}`),t.disposeGateway(o.gatewayId)}}})}};v2e=I([m(0,Lu),m(1,yo),m(2,ne)],v2e);var b2e=class{constructor(i,e,t){i.registerChannel(C2t,new Q0e(e,t))}};b2e=I([m(0,Lu),m(1,es),m(2,ne)],b2e);iG.register(new Mt(f2e));we(oAe,g2e,1);we(WTe,v2e,1);pt("mcpGatewayToolBrokerLocal",b2e,ut.AfterRestored);var XQ=class extends C{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=Ld(this.nativeEnvironmentService.appRoot,XQ.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(`[${XQ.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=oe.as(ii.Configuration),n={...o.getExcludedConfigurationProperties(),...o.getConfigurationProperties()},r={categories:Object.values(iz).map(c=>({key:c,name:W6i[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),Je.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)}}};XQ=I([m(0,iC),m(1,lt),m(2,be),m(3,Lv),m(4,To),m(5,Bo),m(6,ne)],XQ);pt(XQ.ID,XQ,ut.Eventually);var f6t=class extends cy{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(Gg()),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=fq.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 jEe(Oi(this.progressBar),this._register(new class extends QEe{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 Io([rd,s]))),c=n.instantiate(l),u=new P;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),bn(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&&!so(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(3563,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(yq(o),yq(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(),xo(t)),this.progressBar?.stop().hide(),this.toolBar&&this.collectCompositeActions()(),this.onDidCompositeClose.fire(e),e}createTitleArea(e){if(!this.options.hasTitle)return;let t=R(e,_(".composite"));t.classList.add("title"),this.titleLabel=this.createTitleLabel(t);let o=R(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(3565,null),telemetrySource:this.nameForTelemetry,hoverDelegate:this.toolbarHoverDelegate,trailingSeparator:this.trailingSeparator})),this.collectCompositeActions()(),t}createTitleLabel(e){let t=R(e,_(".title-label")),o=R(t,_("h2"));this.titleLabelElement=o;let n=this._register(this.hoverService.setupManagedHover(Ni("mouse"),o,"")),r=this;return{updateTitle:(s,l,c)=>{(!this.activeComposite||this.activeComposite.getId()===s)&&(o.textContent=l,n.update(c?d(3564,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):Ca(this.instantiationService,e,t)}actionsContextProvider(){return this.activeComposite?this.activeComposite.getActionsContext():null}createContentArea(e){let t=R(e,_(".content"));return this.progressBar=this._register(new fb(t,kx)),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=ai.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(),Ue(t.disposable),this.instantiatedCompositeItems.delete(e)),!0}dispose(){this.mapCompositeToCompositeContainer.clear(),this.mapActionsBindingToComposite.clear(),this.instantiatedCompositeItems.forEach(e=>{e.composite.dispose(),Ue(e.disposable)}),this.instantiatedCompositeItems.clear(),super.dispose()}};var v6t=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}},nHi=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&&gs(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);E5(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}}},S2e=class extends Ma{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 rHi(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 ji(t,{actionViewItemProvider:(n,r)=>{if(n instanceof X7e)return this.compositeOverflowActionViewItem.value;let s=this.model.findItem(n.id);return s&&this.instantiationService.createInstance(U_e,{...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(3553,null),ariaRole:"tablist",preventLoopNavigation:this.options.preventLoopNavigation,triggerKeys:{keyDown:!0}})),this._register(j(e,re.CONTEXT_MENU,n=>this.showContextMenu(Me(e),n))),this._register(ws.addTarget(e)),this._register(j(e,Gn.Contextmenu,n=>this.showContextMenu(Me(e),n)));let o=new nHi(e,t,this.model,this.options.dndHandler,this.options.orientation);return this._register(KE.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(X7e,()=>{this.compositeOverflowActionViewItem.value?.showMenu()}),this.compositeOverflowActionViewItem.value=this.instantiationService.createInstance(H_e,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){$t.stop(t,!0);let o=new yn(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 pi({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}};S2e=I([m(2,F),m(3,ze),m(4,Ri)],S2e);var rHi=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,Jn(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(Jn(o))if(Jn(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 I2e=class extends C{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 jt);this.compositeActions=new Map;this.hasExtensionsRegistered=!1;this._cachedViewContainers=void 0;this.dndHandler=new v6t(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(S2e,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 li],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 $l("moveToMenu",d(4135,null),s)),n!==r)t.push(pi({id:"resetLocationAction",label:d(4137,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(pi({id:"resetLocationAction",label:d(4137,null),run:()=>{this.viewDescriptorService.moveViewsToContainer([c],u,void 0,"resetLocationAction"),this.viewService.openViewContainer(o.id,!0)}}))}}return t}createMoveAction(e,t,o){return pi({id:`moveViewContainerTo${t}`,label:t===1?d(4136,null):t===0?d(4138,null):d(4134,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(ire,this.toCompositeBarActionItemFrom(n),this.part,this.paneCompositePart)),pinnedAction:this._register(new J7e(this.toCompositeBarActionItemFrom(n),this.compositeBar)),badgeAction:this._register(new Z7e(this.toCompositeBarActionItemFrom(n),this.compositeBar))}}else{let n=this.cachedViewContainers.filter(r=>r.id===e)[0];t={activityAction:this._register(this.instantiationService.createInstance(sHi,this.toCompositeBarActionItem(e,n?.name??e,n?.icon,void 0),this.part,this.paneCompositePart)),pinnedAction:this._register(new b6t(e,this.compositeBar)),badgeAction:this._register(new aHi(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 P;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 b6t&&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=Na(o),c=new Ly;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"],Vh(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=Ae(e)?this.getViewContainer(e):e,n=Ae(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&&kr)){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(x.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 ai(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)}};I2e=I([m(4,F),m(5,le),m(6,lt),m(7,Ri),m(8,Ft),m(9,X),m(10,Vt),m(11,fi)],I2e);var ire=class extends Iue{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=>{!Ae(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(Vp(e)&&e.button===2)return;let t=Date.now();if(t>this.lastRun&&t-this.lastRun<ire.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()}};ire=I([m(3,fi),m(4,B),m(5,zl)],ire);var sHi=class extends ire{},b6t=class extends J7e{constructor(i,e){super({id:i,name:i,classNames:void 0},e)}setActivity(i){this.label=i.name}},aHi=class extends Z7e{constructor(i,e){super({id:i,name:i,classNames:void 0},e)}setCompositeBarActionItem(i){this.label=i.name}};var hM=class extends f6t{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N,O,V,U,G){super(v,b,S,y,w,k,T,N,oe.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=U;this.menuService=G;this.onDidPaneCompositeClose=this.onDidCompositeClose.event;this.headerFooterCompositeBarDispoables=this._register(new P);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 H.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(Vn(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(4140,null),this.emptyPaneMessageElement.appendChild(t),e.appendChild(this.emptyPaneMessageElement);let o=n=>{let r=!this.getActiveComposite()||!n,s=n&&this.theme.getColor(_E)?.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(KE.INSTANCE.registerTarget(this.element,{onDragOver:n=>{if($t.stop(n.eventData,!0),this.paneCompositeBar.value){let r=this.paneCompositeBar.value.dndHandler.onDragEnter(n.dragAndDropData,void 0,n.eventData);E5(n.eventData.dataTransfer,"move",r)}},onDragEnter:n=>{if($t.stop(n.eventData,!0),this.paneCompositeBar.value){let r=this.paneCompositeBar.value.dndHandler.onDragEnter(n.dragAndDropData,void 0,n.eventData);o(r)}},onDragLeave:n=>{$t.stop(n.eventData,!0),o(!1)},onDragEnd:n=>{$t.stop(n.eventData,!0),o(!1)},onDrop:n=>{if($t.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 yn(Me(t),n))})),this._register(ws.addTarget(t)),this._register(j(t,Gn.Contextmenu,n=>{this.onTitleAreaContextMenu(new yn(Me(t),n))})),this.globalLeftActionsMenuId){let n=t.appendChild(_(".global-actions-left"));this.globalLeftToolBar=this._register(this.instantiationService.createInstance(Ln,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(Ln,o,this.globalActionsMenuId,{actionViewItemProvider:(n,r)=>this.actionViewItemProvider(n,r),orientation:0,getKeyBinding:n=>this.keybindingService.lookupKeybinding(n.id),anchorAlignmentProvider:()=>this.getTitleAreaDropDownAnchorAlignment(),toggleMenuTitle:d(4139,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(KE.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=Sf(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 yn(Me(e),t))})),this.headerFooterCompositeBarDispoables.add(ws.addTarget(e)),this.headerFooterCompositeBarDispoables.add(j(e,Gn.Contextmenu,t=>{this.onCompositeBarAreaContextMenu(new yn(Me(e),t))})),e}removeFooterHeaderArea(e){this.headerFooterCompositeBarContainer=void 0,this.headerFooterCompositeBarDispoables.clear(),e?this.removeHeaderArea():this.removeFooterArea()}createCompositeBar(){return this.instantiationService.createInstance(I2e,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 Go,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 ai(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(hM.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 P,o=t.add(this.contextKeyService.createScoped(this.element));o.createKey("viewContainer",e.viewContainer.id);let n=this.menuService.getMenuActions(T5,o,{shouldForwardArgs:!0,renderShortTitle:!0}),r=hl(n,()=>!0).primary;return t.dispose(),r.length>1&&r.some(s=>s.enabled)?new $l("views",d(4141,null),r):void 0}}};hM=I([m(13,Ne),m(14,le),m(15,ze),m(16,fi),m(17,_e),m(18,tt),m(19,F),m(20,De),m(21,Ri),m(22,X),m(23,lt),m(24,qt)],hM);var OH=class extends hM{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super("workbench.parts.panel",{hasTitle:!0,trailingSeparator:!0},OH.activePanelSettingsKey,aYi.bindTo(p),kce.bindTo(p),"panel","panel",void 0,o7i,1,yR.Panels,va.PanelTitle,void 0,e,t,o,n,r,s,l,c,u,p,h,g);this.configurationService=f;this.minimumWidth=300;this.maximumWidth=Number.POSITIVE_INFINITY;this.minimumHeight=77;this.maximumHeight=Number.POSITIVE_INFINITY;this._register(this.configurationService.onDidChangeConfiguration(v=>{v.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.agentsession.panelpart.activepanelid"}static{this.MARGIN_BOTTOM=8}static{this.MARGIN_LEFT=8}static{this.MARGIN_RIGHT=8}updateStyles(){super.updateStyles();let e=Oi(this.getContainer());e.style.setProperty("--part-background",this.getColor(jS)||""),e.style.setProperty("--part-border-color",this.getColor(Mne)||this.getColor(gi)||"transparent"),e.style.backgroundColor="transparent",e.style.borderTopColor="",e.style.borderTopStyle="",e.style.borderTopWidth=""}getCompositeBarOptions(){return{partContainerClass:"panel",pinnedViewContainersKey:"workbench.agentsession.panel.pinnedPanels",placeholderViewContainersKey:"workbench.agentsession.panel.placeholderPanels",viewContainersWorkspaceStateKey:"workbench.agentsession.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(jS),inactiveBackgroundColor:e.getColor(jS),activeBorderBottomColor:e.getColor(Axe),activeForegroundColor:e.getColor(eV),inactiveForegroundColor:e.getColor(Pxe),badgeBackground:e.getColor(n7i),badgeForeground:e.getColor(r7i),dragAndDropBorder:e.getColor(Nxe)})}}fillExtraContextMenuActions(e){}layout(e,t,o,n){this.layoutService.isVisible("workbench.parts.panel")&&(super.layout(e-OH.MARGIN_LEFT-OH.MARGIN_RIGHT,t-OH.MARGIN_BOTTOM,o,n),cy.prototype.layout.call(this,e,t,o,n))}shouldShowCompositeBar(){return!0}getCompositeBarPosition(){return 1}toJSON(){return{type:"workbench.parts.panel"}}};OH=I([m(0,Ne),m(1,le),m(2,ze),m(3,fi),m(4,_e),m(5,tt),m(6,F),m(7,De),m(8,Ri),m(9,X),m(10,lt),m(11,qt),m(12,B)],OH);var gM=class extends hM{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(Mne)||this.getColor(gi)?1:0},gM.activeViewletSettingsKey,nYi.bindTo(p),sV.bindTo(p),"sideBar","viewlet",g7i,Oxe,0,yR.Viewlets,va.SidebarTitle,va.TitleBarLeftLayout,e,t,o,n,r,s,l,c,u,p,h,g);this.configurationService=f;this.minimumWidth=170;this.maximumWidth=Number.POSITIVE_INFINITY;this.minimumHeight=0;this.maximumHeight=Number.POSITIVE_INFINITY;this.priority=1}static{this.activeViewletSettingsKey="workbench.agentsession.sidebar.activeviewletid"}static{this.pinnedViewContainersKey="workbench.agentsession.pinnedViewlets2"}static{this.placeholderViewContainersKey="workbench.agentsession.placeholderViewlets"}static{this.viewContainersWorkspaceStateKey="workbench.agentsession.viewletsWorkspaceState"}static{this.MARGIN_TOP=0}static{this.MARGIN_BOTTOM=0}static{this.MARGIN_LEFT=0}static{this.FOOTER_ITEM_HEIGHT=26}static{this.FOOTER_ITEM_GAP=4}static{this.FOOTER_VERTICAL_PADDING=6}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)}create(e){super.create(e),this.createFooter(e)}createTitleArea(e){let t=super.createTitleArea(e);if(this.sideBarTitleArea=t,t&&Sf(t,_("div.titlebar-drag-region")),t&&it&&kr&&!eO(this.configurationService,v1(this.configurationService))){let o=_("div.window-controls-container");o.style.width="70px",o.style.height="100%",o.style.flexShrink="0",o.style.order="-1",Sf(t,o);let n=()=>{o.style.display=wS(It)?"none":""};n(),this._register(Bk(r=>{r===sg(It)&&n()}))}return t}createFooter(e){let t=R(e,_(".sidebar-footer.sidebar-action-list"));this.footerContainer=t,this.footerToolbar=this._register(this.instantiationService.createInstance(Ln,t,va.SidebarFooter,{hiddenItemStrategy:-1,toolbarOptions:{primaryGroup:()=>!0},telemetrySource:"sidebarFooter"})),this._register(this.footerToolbar.onDidChangeMenuItems(()=>{if(this.previousLayoutDimensions){let{width:o,height:n,top:r,left:s}=this.previousLayoutDimensions;this.layout(o,n,r,s)}}))}getFooterHeight(){let e=this.footerToolbar?.getItemsLength()??0;return e===0?0:gM.FOOTER_VERTICAL_PADDING*2+e*gM.FOOTER_ITEM_HEIGHT+(e-1)*gM.FOOTER_ITEM_GAP}updateFooterVisibility(){let e=this.footerContainer;e&&(e.style.display=this.getFooterHeight()>0?"":"none")}updateStyles(){super.updateStyles();let e=Oi(this.getContainer());e.style.backgroundColor=this.getColor(op)||"",e.style.color=this.getColor(nP)||"",e.style.outlineColor=this.getColor(Tj)??"";let t=this.getColor(Mne)||this.getColor(gi)||"";e.style.borderRightWidth=t?"1px":"",e.style.borderRightStyle=t?"solid":"",e.style.borderRightColor=t,this.sideBarTitleArea&&(this.sideBarTitleArea.style.backgroundColor=this.getColor(lTo)||"",this.sideBarTitleArea.style.color=this.getColor(cTo)||"")}layout(e,t,o,n){if(this.previousLayoutDimensions={width:e,height:t,top:o,left:n},!this.layoutService.isVisible("workbench.parts.sidebar"))return;this.updateFooterVisibility();let r=Math.min(t,this.getFooterHeight());super.layout(e,t-r,o,n),cy.prototype.layout.call(this,e,t,o,n)}getTitleAreaDropDownAnchorAlignment(){return this.layoutService.getSideBarPosition()===0?0:1}createTitleLabel(e){return{updateTitle:()=>{},updateStyles:()=>{}}}getCompositeBarOptions(){return{partContainerClass:"sidebar",pinnedViewContainersKey:gM.pinnedViewContainersKey,placeholderViewContainersKey:gM.placeholderViewContainersKey,viewContainersWorkspaceStateKey:gM.viewContainersWorkspaceStateKey,icon:!1,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 li),e.push(t))}},compositeSize:0,iconSize:16,overflowActionSize:30,colors:e=>({activeBackgroundColor:e.getColor(op),inactiveBackgroundColor:e.getColor(op),activeBorderBottomColor:e.getColor(IEt),activeForegroundColor:e.getColor(xj),inactiveForegroundColor:e.getColor(yEt),badgeBackground:e.getColor(kj),badgeForeground:e.getColor(Ej),dragAndDropBorder:e.getColor(wEt)}),compact:!0}}shouldShowCompositeBar(){return!1}getCompositeBarPosition(){return 1}async focusActivityBar(){this.shouldShowCompositeBar()&&this.focusCompositeBar()}toJSON(){return{type:"workbench.parts.sidebar"}}};gM=I([m(0,Ne),m(1,le),m(2,ze),m(3,fi),m(4,_e),m(5,tt),m(6,F),m(7,De),m(8,Ri),m(9,X),m(10,lt),m(11,qt),m(12,B)],gM);var _T=class extends hM{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super("workbench.parts.auxiliarybar",{hasTitle:!0,trailingSeparator:!1,borderWidth:()=>this.getColor(Mne)||this.getColor(gi)?1:0},_T.activeViewSettingsKey,rYi.bindTo(p),sYi.bindTo(p),"auxiliarybar","auxiliarybar",void 0,Oxe,2,yR.Auxiliary,va.AuxiliaryBarTitle,va.AuxiliaryBarTitleLeft,e,t,o,n,r,s,l,c,u,p,h,g);this._runScriptDropdown=this._register(new me);this._runScriptMenu=this._register(new me);this._runScriptMenuListener=this._register(new me);this.minimumWidth=170;this.maximumWidth=Number.POSITIVE_INFINITY;this.minimumHeight=0;this.maximumHeight=Number.POSITIVE_INFINITY;this.priority=1}static{this.activeViewSettingsKey="workbench.agentsession.auxiliarybar.activepanelid"}static{this.pinnedViewsKey="workbench.agentsession.auxiliarybar.pinnedPanels"}static{this.placeholderViewContainersKey="workbench.agentsession.auxiliarybar.placeholderPanels"}static{this.viewContainersWorkspaceStateKey="workbench.agentsession.auxiliarybar.viewContainersWorkspaceState"}static{this.MARGIN_TOP=8}static{this.MARGIN_BOTTOM=8}static{this.MARGIN_RIGHT=8}static{this.RUN_SCRIPT_ACTION_ID="workbench.action.agentSessions.runScript"}static{this.RUN_SCRIPT_DROPDOWN_MENU_ID=D.for("AgentSessionsRunScriptDropdown")}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)}updateStyles(){super.updateStyles();let e=Oi(this.getContainer());e.style.setProperty("--part-background",this.getColor(op)||""),e.style.setProperty("--part-border-color",this.getColor(Mne)||this.getColor(gi)||"transparent"),e.style.backgroundColor="transparent",e.style.color=this.getColor(nP)||"",e.style.borderLeftColor="",e.style.borderRightColor="",e.style.borderLeftStyle="",e.style.borderRightStyle="",e.style.borderLeftWidth="",e.style.borderRightWidth=""}getCompositeBarOptions(){let e=this;return{partContainerClass:"auxiliarybar",pinnedViewContainersKey:_T.pinnedViewsKey,placeholderViewContainersKey:_T.placeholderViewContainersKey,viewContainersWorkspaceStateKey:_T.viewContainersWorkspaceStateKey,icon:!1,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(op),inactiveBackgroundColor:t.getColor(op),get activeBorderBottomColor(){return e.getCompositeBarPosition()===1?t.getColor(Axe):t.getColor(IEt)},get activeForegroundColor(){return e.getCompositeBarPosition()===1?t.getColor(eV):t.getColor(xj)},get inactiveForegroundColor(){return e.getCompositeBarPosition()===1?t.getColor(Pxe):t.getColor(yEt)},badgeBackground:t.getColor(kj),badgeForeground:t.getColor(Ej),get dragAndDropBorder(){return e.getCompositeBarPosition()===1?t.getColor(Nxe):t.getColor(wEt)}}),compact:!0}}actionViewItemProvider(e,t){if(e.id===_T.RUN_SCRIPT_ACTION_ID&&e instanceof Eo){this._runScriptMenu.value||(this._runScriptMenu.value=this.menuService.createMenu(_T.RUN_SCRIPT_DROPDOWN_MENU_ID,this.contextKeyService),this._runScriptMenuListener.value=this._runScriptMenu.value.onDidChange(()=>this._updateRunScriptDropdown()));let o=this._getRunScriptDropdownActions(),n={id:"runScriptDropdown",label:"",tooltip:"",class:void 0,enabled:!0,run:()=>{}};return this._runScriptDropdown.value=this.instantiationService.createInstance(dI,e,n,o,"",{hoverDelegate:t.hoverDelegate,getKeyBinding:r=>this.keybindingService.lookupKeybinding(r.id,this.contextKeyService)}),this._runScriptDropdown.value}return super.actionViewItemProvider(e,t)}_getRunScriptDropdownActions(){return this._runScriptMenu.value?Uc(this._runScriptMenu.value.getActions({shouldForwardArgs:!0})):[]}_updateRunScriptDropdown(){if(this._runScriptDropdown.value){let e=this._getRunScriptDropdownActions(),t={id:"runScriptDropdown",label:"",tooltip:"",class:void 0,enabled:!0,run:()=>{}};this._runScriptDropdown.value.update(t,e)}}fillExtraContextMenuActions(e){}shouldShowCompositeBar(){return!0}getCompositeBarPosition(){return 1}layout(e,t,o,n){this.layoutService.isVisible("workbench.parts.auxiliarybar")&&(super.layout(e-_T.MARGIN_RIGHT,t-_T.MARGIN_TOP-_T.MARGIN_BOTTOM,o,n),cy.prototype.layout.call(this,e,t,o,n))}toJSON(){return{type:"workbench.parts.auxiliarybar"}}};_T=I([m(0,Ne),m(1,le),m(2,ze),m(3,fi),m(4,_e),m(5,tt),m(6,F),m(7,De),m(8,Ri),m(9,X),m(10,lt),m(11,qt)],_T);var lDo=new Q("activeChatBar","",d(2762,null)),cDo=new Q("chatBarFocus",!1,d(2763,null)),wAI=new Q("chatBarVisible",!1,d(2764,null)),fM=new Q("sessionsWelcomeVisible",!1,d(2765,null));var FH=class extends hM{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super("workbench.parts.chatbar",{hasTitle:!1,trailingSeparator:!0,borderWidth:()=>0},FH.activeViewSettingsKey,lDo.bindTo(p),cDo.bindTo(p),"chatbar","chatbar",void 0,Oxe,3,yR.ChatBar,va.ChatBarTitle,void 0,e,t,o,n,r,s,l,c,u,p,h,g);this.minimumWidth=300;this.maximumWidth=Number.POSITIVE_INFINITY;this.minimumHeight=0;this.maximumHeight=Number.POSITIVE_INFINITY;this.priority=2}static{this.activeViewSettingsKey="workbench.chatbar.activepanelid"}static{this.pinnedViewsKey="workbench.chatbar.pinnedPanels"}static{this.placeholderViewContainersKey="workbench.chatbar.placeholderPanels"}static{this.viewContainersWorkspaceStateKey="workbench.chatbar.viewContainersWorkspaceState"}get preferredHeight(){return this.layoutService.mainContainerDimension.height*.4}updateStyles(){super.updateStyles();let e=Oi(this.getContainer());e.style.backgroundColor=this.getColor(op)||"",e.style.color=this.getColor(nP)||""}getCompositeBarOptions(){return{partContainerClass:"chatbar",pinnedViewContainersKey:FH.pinnedViewsKey,placeholderViewContainersKey:FH.placeholderViewContainersKey,viewContainersWorkspaceStateKey:FH.viewContainersWorkspaceStateKey,icon:!1,orientation:0,recomputeSizes:!0,activityHoverOptions:{position:()=>2},fillExtraContextMenuActions:()=>{},compositeSize:0,iconSize:16,overflowActionSize:30,colors:e=>({activeBackgroundColor:e.getColor(op),inactiveBackgroundColor:e.getColor(op),activeBorderBottomColor:e.getColor(Axe),activeForegroundColor:e.getColor(eV),inactiveForegroundColor:e.getColor(Pxe),badgeBackground:e.getColor(kj),badgeForeground:e.getColor(Ej),dragAndDropBorder:e.getColor(Nxe)}),compact:!0}}shouldShowCompositeBar(){return!1}getCompositeBarPosition(){return 1}toJSON(){return{type:"workbench.parts.chatbar"}}};FH=I([m(0,Ne),m(1,le),m(2,ze),m(3,fi),m(4,_e),m(5,tt),m(6,F),m(7,De),m(8,Ri),m(9,X),m(10,lt),m(11,qt)],FH);var but=class extends C{constructor(e){super();this._onDidPaneCompositeOpen=this._register(new E);this.onDidPaneCompositeOpen=this._onDidPaneCompositeOpen.event;this._onDidPaneCompositeClose=this._register(new E);this.onDidPaneCompositeClose=this._onDidPaneCompositeClose.event;this.paneCompositeParts=new Map;this.registerPart(1,e.createInstance(OH)),this.registerPart(0,e.createInstance(gM)),this.registerPart(2,e.createInstance(_T)),this.registerPart(3,e.createInstance(FH))}registerPart(e,t){this.paneCompositeParts.set(e,t),this._register(t.onDidPaneCompositeOpen(o=>this._onDidPaneCompositeOpen.fire({composite:o,viewContainerLocation:e}))),this._register(t.onDidPaneCompositeClose(o=>this._onDidPaneCompositeClose.fire({composite:o,viewContainerLocation:e})))}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 Oi(this.paneCompositeParts.get(e))}};but=I([m(0,F)],but);we(ds,but,1);var Phn=Re("agent-panel-left",M.layoutSidebarLeft,d(2745,null)),Ahn=Re("agent-panel-left-off",M.layoutSidebarLeftOff,d(2746,null)),Nhn=Re("agent-panel-right",M.layoutSidebarRight,d(2747,null)),Ohn=Re("agent-panel-right-off",M.layoutSidebarRightOff,d(2748,null)),Fhn=Re("agent-panel-close",M.close,d(2740,null)),cHi=class a extends K{static{this.ID="workbench.action.agentToggleSidebarVisibility"}static{this.LABEL=d(2742,null)}constructor(){super({id:a.ID,title:L(2759,"Toggle Primary Side Bar Visibility"),icon:Ahn,toggled:{condition:cP,icon:Phn,title:d(2749,null),mnemonicTitle:d(2750,null)},metadata:{description:d(2744,null)},category:We.View,f1:!0,keybinding:{weight:200,primary:2080},menu:[{id:va.TitleBarLeftLayout,group:"navigation",order:0,when:x.and(Xc.toNegated(),fM.toNegated())},{id:va.TitleBarContext,group:"navigation",order:0,when:Xc.toNegated()}]})}run(i){let e=i.get(fi),t=e.isVisible("workbench.parts.sidebar");e.setPartHidden(t,"workbench.parts.sidebar");let o=t?d(2755,null):d(2756,null);Jo(o)}},dHi=class a extends K{static{this.ID="workbench.action.agentToggleSecondarySidebarVisibility"}static{this.LABEL=d(2741,null)}constructor(){super({id:a.ID,title:L(2758,"Toggle Secondary Side Bar Visibility"),icon:Ohn,toggled:{condition:D_,icon:Nhn,title:d(2751,null),mnemonicTitle:d(2752,null)},metadata:{description:d(2743,null)},category:We.View,f1:!0,menu:[{id:va.TitleBarRightLayout,group:"navigation",order:10,when:x.and(Xc.toNegated(),fM.toNegated())},{id:va.TitleBarContext,order:1,when:Xc.toNegated()}]})}run(i){let e=i.get(fi),t=e.isVisible("workbench.parts.auxiliarybar");e.setPartHidden(t,"workbench.parts.auxiliarybar");let o=t?d(2753,null):d(2754,null);Jo(o)}},uHi=class a extends K{static{this.ID="workbench.action.agentTogglePanelVisibility"}constructor(){super({id:a.ID,title:L(2757,"Toggle Panel Visibility"),category:We.View,f1:!0,icon:Fhn,menu:[{id:va.PanelTitle,group:"navigation",order:2,when:Xc.toNegated()}]})}run(i){let e=i.get(fi);e.setPartHidden(e.isVisible("workbench.parts.panel"),"workbench.parts.panel")}};W(cHi);W(dHi);W(uHi);fe.appendMenuItem(va.TitleBarRightLayout,{command:{id:"workbench.action.toggleWindowAlwaysOnTop",title:d(2760,null),icon:M.pin,toggled:{condition:vce,icon:M.pinned}},when:Xc,group:"navigation",order:0});var S6t=class{constructor(i,e,t){this.updateService=i;this.productService=e;this.hoverService=t}attachTo(i){return this.hoverService.setupDelayedHover(i,()=>({content:this.createHoverContent(),position:{hoverPosition:1},appearance:{showPointer:!0}}),{groupId:"sessions-account-update"})}createHoverContent(i=this.updateService.state){let e=this.getUpdateFromState(i),t=this.productService.version??d(2795,null),o=e?.productVersion??e?.version??d(2795,null),n=this.productService.commit,r=e?.version,s=this.getUpdateProgressPercent(i),l=document.createElement("div");l.classList.add("sessions-update-hover");let c=document.createElement("div");if(c.classList.add("sessions-update-hover-header"),c.textContent=this.getUpdateHeaderLabel(i.type),l.appendChild(c),s!==void 0){let f=document.createElement("div");f.classList.add("sessions-update-hover-progress-track");let v=document.createElement("div");v.classList.add("sessions-update-hover-progress-fill"),v.style.width=`${s}%`,f.appendChild(v),l.appendChild(f)}let u=document.createElement("div");u.classList.add("sessions-update-hover-grid");let p=this.productService.date?new Date(this.productService.date):void 0,h=p?this.formatCompactAge(p.getTime()):void 0,g=e?.timestamp?this.formatCompactAge(e.timestamp):void 0;return this.appendGridRow(u,d(2796,null),t,h,n),this.appendGridRow(u,d(2797,null),o,g,r),l.appendChild(u),l}appendGridRow(i,e,t,o,n){let r=document.createElement("span");r.classList.add("sessions-update-hover-label"),r.textContent=e,i.appendChild(r);let s=document.createElement("span");s.classList.add("sessions-update-hover-version"),s.textContent=t,i.appendChild(s);let l=document.createElement("span");l.classList.add("sessions-update-hover-age"),l.textContent=o??"",i.appendChild(l);let c=document.createElement("span");c.classList.add("sessions-update-hover-commit"),c.textContent=n?n.substring(0,7):"",i.appendChild(c)}formatCompactAge(i){let e=Math.round((Date.now()-i)/1e3);if(e<60)return d(2790,null);let t=Math.round(e/60);if(t<60)return d(2788,null,t);let o=Math.round(e/3600);if(o<24)return d(2787,null,o);let n=Math.round(e/86400);if(n<7)return d(2786,null,n);let r=Math.round(n/7);if(r<5)return d(2791,null,r);let s=Math.round(n/30);return d(2789,null,s)}getUpdateFromState(i){switch(i.type){case"available for download":case"downloaded":case"ready":case"overwriting":case"updating":return i.update;case"downloading":return i.update;default:return}}getUpdateProgressPercent(i){switch(i.type){case"downloading":{let e=i;return e.downloadedBytes!==void 0&&e.totalBytes&&e.totalBytes>0?Math.min(100,Math.round(e.downloadedBytes/e.totalBytes*100)):0}case"updating":{let e=i;return e.currentProgress!==void 0&&e.maxProgress&&e.maxProgress>0?Math.min(100,Math.round(e.currentProgress/e.maxProgress*100)):0}case"downloaded":case"ready":return 100;case"available for download":case"overwriting":return 0;default:return}}getUpdateHeaderLabel(i){let e=this.productService.nameShort;switch(i){case"ready":return d(2798,null,e);case"available for download":return d(2792,null,e);case"downloading":case"overwriting":return d(2793,null,e);case"downloaded":return d(2794,null,e);case"updating":return d(2800,null,e);default:return d(2799,null,e)}}};var Iut=new D("SessionsAccountMenu");W(class extends K{constructor(){super({id:"workbench.action.agenticSignIn",title:L(2780,"Sign In"),menu:{id:Iut,when:x.notEquals("defaultAccountStatus","available"),group:"1_account",order:1}})}async run(a){await a.get(Um).signIn()}});W(class extends K{constructor(){super({id:"workbench.action.agenticSignOut",title:L(2782,"Sign Out"),menu:{id:Iut,when:x.equals("defaultAccountStatus","available"),group:"1_account",order:1}})}async run(a){await a.get(Um).signOut()}});fe.appendMenuItem(Iut,{command:{id:"workbench.action.openSettings",title:d(2779,null)},group:"2_settings",order:1});L0i(Iut,"3_updates");var Sut=class extends Lr{constructor(e,t,o,n,r,s,l,c,u){super(void 0,e,{...t,icon:!1,label:!1});this.defaultAccountService=o;this.updateService=n;this.contextMenuService=r;this.menuService=s;this.contextKeyService=l;this.hoverService=c;this.productService=u;this.viewItemDisposables=this._register(new P);this.updateHoverWidget=new S6t(this.updateService,this.productService,this.hoverService)}getTooltip(){}render(e){super.render(e),e.classList.add("account-widget","sidebar-action");let t=R(e,_(".account-widget-account"));this.accountButton=this.viewItemDisposables.add(new Mi(t,{...Ko,secondary:!0,title:!1,supportIcons:!0,buttonSecondaryBackground:"transparent",buttonSecondaryHoverBackground:void 0,buttonSecondaryForeground:void 0,buttonSecondaryBorder:void 0})),this.accountButton.element.classList.add("account-widget-account-button","sidebar-action-button");let o=R(e,_(".account-widget-update"));this.updateButton=this.viewItemDisposables.add(new Mi(o,{...Ko,secondary:!0,title:!1,supportIcons:!0,buttonSecondaryBackground:"transparent",buttonSecondaryHoverBackground:void 0,buttonSecondaryForeground:void 0,buttonSecondaryBorder:void 0})),this.updateButton.element.classList.add("account-widget-update-button","sidebar-action-button"),this.viewItemDisposables.add(this.updateHoverWidget.attachTo(this.updateButton.element)),this.updateAccountButton(),this.viewItemDisposables.add(this.defaultAccountService.onDidChangeDefaultAccount(()=>this.updateAccountButton())),this.updateUpdateButton(),this.viewItemDisposables.add(this.updateService.onStateChange(()=>this.updateUpdateButton())),this.viewItemDisposables.add(this.accountButton.onDidClick(n=>{n?.preventDefault(),n?.stopPropagation(),this.showAccountMenu(this.accountButton.element)})),this.viewItemDisposables.add(this.updateButton.onDidClick(()=>this.update()))}showAccountMenu(e){let t=this.menuService.createMenu(Iut,this.contextKeyService),o=[];Dq(t.getActions(),o),t.dispose(),this.contextMenuService.showContextMenu({getAnchor:()=>e,getActions:()=>o})}async updateAccountButton(){if(!this.accountButton)return;this.accountButton.label=`$(${M.loading.id}~spin) ${d(2777,null)}`,this.accountButton.enabled=!1;let e=await this.defaultAccountService.getDefaultAccount();this.accountButton.enabled=!0,this.accountButton.label=e?`$(${M.account.id}) ${e.accountName} (${e.authenticationProvider.name})`:`$(${M.account.id}) ${d(2781,null)}`}updateUpdateButton(){if(!this.updateButton)return;let e=this.updateService.state;if(this.shouldHideUpdateButton(e.type)){this.clearUpdateButtonStyling(),this.updateButton.element.classList.add("hidden");return}if(this.updateButton.element.classList.remove("hidden"),this.updateButton.element.style.backgroundImage="",this.updateButton.enabled=e.type==="ready",this.updateButton.label=this.getUpdateProgressMessage(e.type),e.type==="ready"){this.updateButton.element.classList.add("account-widget-update-button-ready");return}this.updateButton.element.classList.remove("account-widget-update-button-ready")}shouldHideUpdateButton(e){return e==="uninitialized"||e==="idle"||e==="disabled"||e==="checking for updates"}clearUpdateButtonStyling(){this.updateButton&&(this.updateButton.element.style.backgroundImage="",this.updateButton.element.classList.remove("account-widget-update-button-ready"))}getUpdateProgressMessage(e){switch(e){case"ready":return d(2783,null);case"available for download":case"downloading":case"overwriting":return d(2775,null);case"downloaded":return d(2776,null);case"updating":return d(2785,null);default:return d(2784,null)}}async update(){await this.updateService.quitAndInstall()}onClick(){}};Sut=I([m(2,Um),m(3,zd),m(4,ze),m(5,qt),m(6,X),m(7,tt),m(8,nt)],Sut);var y2e=class extends C{static{this.ID="workbench.contrib.sessionsWidget"}constructor(i,e){super();let t="sessions.action.accountWidget";this._register(i.register(va.SidebarFooter,t,(o,n)=>e.createInstance(Sut,o,n),void 0)),this._register(W(class extends K{constructor(){super({id:t,title:L(2778,"Sessions Account"),menu:{id:va.SidebarFooter,group:"navigation",order:1}})}async run(){}}))}};y2e=I([m(0,Yy),m(1,F)],y2e);pt(y2e.ID,y2e,ut.AfterRestored);var gOI=L(2830,"Chat Customization"),yut=new D("aiCustomization.item"),fOI=new D("aiCustomization.new");var Whn=new Q("aiCustomization.isEmpty",!0),vHi=new Q("aiCustomizationItemType",""),w2e=Symbol("root"),pHi=class{getHeight(i){return 22}getTemplateId(i){switch(i.type){case"category":case"link":return"category";case"group":return"group";case"file":return"file"}}},mHi=class{constructor(){this.templateId="category"}renderTemplate(i){let e=R(i,_(".ai-customization-category")),t=R(e,_(".icon")),o=R(e,_(".label"));return{container:e,icon:t,label:o}}renderElement(i,e,t){t.icon.className="icon",t.icon.classList.add(...q.asClassNameArray(i.element.icon)),t.label.textContent=i.element.label}disposeTemplate(i){}},hHi=class{constructor(){this.templateId="group"}renderTemplate(i){let e=R(i,_(".ai-customization-group-header")),t=R(e,_(".label"));return{container:e,label:t}}renderElement(i,e,t){t.label.textContent=i.element.label}disposeTemplate(i){}},gHi=class{constructor(){this.templateId="file"}renderTemplate(i){let e=R(i,_(".ai-customization-tree-item")),t=R(e,_(".icon")),o=R(e,_(".name"));return{container:e,icon:t,name:o}}renderElement(i,e,t){let o=i.element,n;switch(o.promptType){case"agent":n=G2;break;case"skill":n=S8;break;case"instructions":n=I8;break;case"prompt":default:n=y8;break}t.icon.className="icon",t.icon.classList.add(...q.asClassNameArray(n)),t.name.textContent=o.name;let r=o.description?`${o.name} - ${o.description}`:o.name;t.container.title=r}disposeTemplate(i){}},fHi=class{constructor(i,e,t){this.promptsService=i;this.logService=e;this.onItemCountChanged=t;this.cache=new Map;this.totalItemCount=0}clearCache(){this.cache.clear(),this.totalItemCount=0}hasChildren(i){return i===w2e?!0:i.type==="link"?!1:i.type==="category"||i.type==="group"}async getChildren(i){try{return i===w2e?this.getTypeCategories():i.type==="category"?this.getStorageGroups(i.promptType):i.type==="group"?this.getFilesForStorageAndType(i.storage,i.promptType):[]}catch(e){return this.logService.error("[AICustomization] Error fetching tree children:",e),[]}}getTypeCategories(){return[{type:"category",id:"category-agents",label:d(2836,null),promptType:"agent",icon:G2},{type:"category",id:"category-skills",label:d(2843,null),promptType:"skill",icon:S8},{type:"category",id:"category-instructions",label:d(2839,null),promptType:"instructions",icon:I8},{type:"category",id:"category-prompts",label:d(2842,null),promptType:"prompt",icon:y8},{type:"link",id:"link-mcp-servers",label:d(2840,null),icon:vKt,section:kn.McpServers}]}async getStorageGroups(i){let e=[],t=this.cache.get(i);if(t||(t={},this.cache.set(i,t)),i==="skill"){if(!t.skills){let u=await this.promptsService.findAgentSkills(ve.None);t.skills=u||[],this.totalItemCount+=t.skills.length,this.onItemCountChanged(this.totalItemCount)}let s=t.skills.filter(u=>u.storage==="local"),l=t.skills.filter(u=>u.storage==="user"),c=t.skills.filter(u=>u.storage==="extension");return s.length>0&&e.push(this.createGroupItem(i,"local",s.length)),l.length>0&&e.push(this.createGroupItem(i,"user",l.length)),c.length>0&&e.push(this.createGroupItem(i,"extension",c.length)),e}if(!t.files){let s=await this.promptsService.listPromptFiles(i,ve.None),l=s.filter(h=>h.storage==="local"),c=s.filter(h=>h.storage==="user"),u=s.filter(h=>h.storage==="extension");t.files=new Map([["local",l],["user",c],["extension",u]]);let p=s.length;this.totalItemCount+=p,this.onItemCountChanged(this.totalItemCount)}let o=t.files.get("local")||[],n=t.files.get("user")||[],r=t.files.get("extension")||[];return o.length>0&&e.push(this.createGroupItem(i,"local",o.length)),n.length>0&&e.push(this.createGroupItem(i,"user",n.length)),r.length>0&&e.push(this.createGroupItem(i,"extension",r.length)),e}createGroupItem(i,e,t){let o={local:d(2845,null,t),user:d(2844,null,t),extension:d(2837,null,t),plugin:d(2841,null,t)},n={local:xFe,user:kFe,extension:EFe,plugin:I0},r={local:"workspace",user:"user",extension:"extensions",plugin:"plugins"};return{type:"group",id:`group-${i}-${r[e]}`,label:o[e],storage:e,promptType:i,icon:n[e]}}async getFilesForStorageAndType(i,e){let t=this.cache.get(e);return e==="skill"?(t?.skills||[]).filter(s=>s.storage===i).map(s=>{let l=s.name||Ye(ci(s.uri))||Ye(s.uri);return{type:"file",id:s.uri.toString(),uri:s.uri,name:l,description:s.description,storage:s.storage,promptType:e}}):[...t?.files?.get(i)||[]].map(n=>({type:"file",id:n.uri.toString(),uri:n.uri,name:n.name||Ye(n.uri),description:n.description,storage:n.storage,promptType:e}))}},I6t=class extends zr{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);this.promptsService=h;this.editorService=g;this.menuService=f;this.logService=v;this.workspaceContextService=b;this.workspaceService=S;this.treeDisposables=this._register(new P);this.isEmptyContextKey=Whn.bindTo(r),this.itemTypeContextKey=vHi.bindTo(r),this._register(this.promptsService.onDidChangeCustomAgents(()=>this.refresh())),this._register(this.promptsService.onDidChangeSlashCommands(()=>this.refresh())),this._register(this.workspaceContextService.onDidChangeWorkspaceFolders(()=>this.refresh())),this._register(he(y=>{this.workspaceService.activeProjectRoot.read(y),this.refresh()}))}static{this.ID="aiCustomization.view"}renderBody(e){super.renderBody(e),e.classList.add("ai-customization-view"),this.treeContainer=R(e,_(".tree-container")),this.createTree()}createTree(){this.treeContainer&&(this.dataSource=new fHi(this.promptsService,this.logService,e=>this.isEmptyContextKey.set(e===0)),this.tree=this.treeDisposables.add(this.instantiationService.createInstance(nu,"AICustomization",this.treeContainer,new pHi,[new mHi,new hHi,new gHi],this.dataSource,{identityProvider:{getId:e=>e.id},accessibilityProvider:{getAriaLabel:e=>e.type==="category"||e.type==="link"||e.type==="group"?e.label:e.description?d(2838,null,e.name,e.description):e.name,getWidgetAriaLabel:()=>d(2835,null)},keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:e=>e.type==="file"?e.name:e.label}})),this.treeDisposables.add(this.tree.onDidOpen(async e=>{if(e.element&&e.element.type==="file")this.editorService.openEditor({resource:e.element.uri});else if(e.element&&e.element.type==="link"){let t=ZB.getOrCreate(),o=await this.editorService.openEditor(t,{pinned:!0},ym);o instanceof MA&&o.selectSectionById(e.element.section)}})),this.treeDisposables.add(this.tree.onContextMenu(e=>this.onContextMenu(e))),this.tree.setInput(w2e).then(()=>this.autoExpandCategories()))}async autoExpandCategories(){if(!this.tree)return;let e=this.tree.getNode(w2e);for(let t of e.children)t.element!==w2e&&await this.tree.expand(t.element)}layoutBody(e,t){super.layoutBody(e,t),this.tree?.layout(e,t)}refresh(){this.dataSource?.clearCache(),this.isEmptyContextKey.set(!0),this.tree?.setInput(w2e).then(()=>this.autoExpandCategories())}collapseAll(){this.tree?.collapseAll()}expandAll(){this.tree?.expandAll()}onContextMenu(e){if(!e.element||e.element.type!=="file")return;let t=e.element;this.itemTypeContextKey.set(t.promptType);let o={uri:t.uri.toString(),name:t.name,promptType:t.promptType},n=this.menuService.getMenuActions(yut,this.contextKeyService,{arg:o,shouldForwardArgs:!0}),{secondary:r}=Ef(n,"inline");r.length>0&&this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>r,getActionsContext:()=>o,onHide:()=>{this.itemTypeContextKey.reset()}})}};I6t=I([m(1,_e),m(2,ze),m(3,B),m(4,X),m(5,Ri),m(6,F),m(7,Qe),m(8,De),m(9,tt),m(10,nr),m(11,ee),m(12,qt),m(13,ne),m(14,Pe),m(15,lf)],I6t);function dDo(a){return A.isUri(a)?a:typeof a=="string"?A.parse(a):A.isUri(a.uri)?a.uri:A.parse(a.uri)}var uDo="aiCustomization.openFile";W(class extends K{constructor(){super({id:uDo,title:L(2831,"Open"),icon:M.goToFile})}async run(a,i){await a.get(ee).openEditor({resource:dDo(i)})}});var pDo="aiCustomization.runPrompt";W(class extends K{constructor(){super({id:pDo,title:L(2833,"Run Prompt"),icon:M.play})}async run(a,i){await a.get(ge).executeCommand("workbench.action.chat.run.prompt.current",dDo(i))}});fe.appendMenuItem(yut,{command:{id:uDo,title:d(2832,null)},group:"1_open",order:1});fe.appendMenuItem(yut,{command:{id:pDo,title:d(2834,null),icon:M.play},group:"2_run",order:1,when:x.equals(vHi.key,"prompt")});var mDo="repository",Vhn="branch",Bhn="isolation",C2e=class extends C{constructor(e,t,o,n){super();this.resource=e;this.chatSessionsService=o;this.logService=n;this._isolationMode="worktree";this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this.target="copilotcli";this.selectedOptions=new Map;t&&(this._repoUri=t,this.setOption(mDo,t.fsPath))}get repoUri(){return this._repoUri}get isolationMode(){return this._isolationMode}get branch(){return this._branch}get modelId(){return this._modelId}get query(){return this._query}get attachedContext(){return this._attachedContext}get disabled(){return!this._repoUri||this._isolationMode==="worktree"&&!this._branch}setRepoUri(e){this._repoUri=e,this._isolationMode="workspace",this._branch=void 0,this._onDidChange.fire("repoUri"),this._onDidChange.fire("disabled"),this.setOption(mDo,e.fsPath)}setIsolationMode(e){this._isolationMode!==e&&(this._isolationMode=e,this._onDidChange.fire("isolationMode"),this._onDidChange.fire("disabled"),this.setOption(Bhn,e))}setBranch(e){this._branch!==e&&(this._branch=e,this._onDidChange.fire("branch"),this._onDidChange.fire("disabled"),this.setOption(Vhn,e??""))}setModelId(e){this._modelId=e}setQuery(e){this._query=e}setAttachedContext(e){this._attachedContext=e}setOption(e,t){typeof t=="string"?this.selectedOptions.set(e,{id:t,name:t}):this.selectedOptions.set(e,t),this.chatSessionsService.notifySessionOptionsChange(this.resource,[{optionId:e,value:t}]).catch(o=>this.logService.error(`Failed to notify session option ${e} change:`,o))}};C2e=I([m(2,Ls),m(3,ne)],C2e);var ore=class extends C{constructor(e,t,o,n,r){super();this.resource=e;this.target=t;this.chatSessionsService=o;this.contextKeyService=n;this.logService=r;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._onDidChangeOptionGroups=this._register(new E);this.onDidChangeOptionGroups=this._onDidChangeOptionGroups.event;this.selectedOptions=new Map;this._whenClauseKeys=new Set;this._updateWhenClauseKeys(),this._register(this.chatSessionsService.onDidChangeOptionGroups(()=>{this._updateWhenClauseKeys(),this._onDidChangeOptionGroups.fire(),this._onDidChange.fire("options")})),this._register(this.contextKeyService.onDidChangeContext(s=>{this._whenClauseKeys.size>0&&s.affectsSome(this._whenClauseKeys)&&this._onDidChangeOptionGroups.fire()}))}get repoUri(){return this._repoUri}get isolationMode(){return"worktree"}get branch(){}get modelId(){return this._modelId}get query(){return this._query}get attachedContext(){return this._attachedContext}get disabled(){return!this._repoUri&&!this.selectedOptions.has("repositories")}setRepoUri(e){this._repoUri=e,this._onDidChange.fire("repoUri"),this._onDidChange.fire("disabled");let t=e.path.substring(1);this.setOption("repositories",{id:t,name:t})}setIsolationMode(e){}setBranch(e){}setModelId(e){this._modelId=e}setQuery(e){this._query=e}setAttachedContext(e){this._attachedContext=e}setOption(e,t){typeof t!="string"&&this.selectedOptions.set(e,t),this._onDidChange.fire("options"),this._onDidChange.fire("disabled"),this.chatSessionsService.notifySessionOptionsChange(this.resource,[{optionId:e,value:t}]).catch(o=>this.logService.error(`Failed to notify extension of ${e} change:`,o))}getModelOptionGroup(){let e=this._getOptionGroups();if(!e)return;let t=e.find(o=>hDo(o));if(t)return{group:t,value:this._getValueForGroup(t)}}getOtherOptionGroups(){let e=this._getOptionGroups();return e?e.filter(t=>!hDo(t)&&!Hhn(t)&&this._isOptionGroupVisible(t)).map(t=>({group:t,value:this._getValueForGroup(t)})):[]}getOptionValue(e){return this.selectedOptions.get(e)}setOptionValue(e,t){this.setOption(e,t)}_getOptionGroups(){return this.chatSessionsService.getOptionGroupsForSessionType(this.target)}_isOptionGroupVisible(e){if(!e.when)return!0;let t=x.deserialize(e.when);return!t||this.contextKeyService.contextMatchesRules(t)}_updateWhenClauseKeys(){this._whenClauseKeys.clear();let e=this._getOptionGroups();if(e){for(let t of e)if(t.when){let o=x.deserialize(t.when);if(o)for(let n of o.keys())this._whenClauseKeys.add(n)}}}_getValueForGroup(e){let t=this.selectedOptions.get(e.id);if(t)return t;let o=this.chatSessionsService.getSessionOption(this.resource,e.id);if(o&&typeof o!="string")return o;if(typeof o=="string"){let n=e.items.find(r=>r.id===o.trim());if(n)return n}return e.items.find(n=>n.default===!0)??e.items[0]}};ore=I([m(2,Ls),m(3,X),m(4,ne)],ore);function hDo(a){if(a.id==="models")return!0;let i=a.name.toLowerCase();return i==="model"||i==="models"}function Hhn(a){return a.id==="repositories"}var WH="github-remote-file";function gDo(a){if(a.scheme!==WH)return;let i=a.path.split("/").filter(Boolean);if(i.length>=3){let[,e,t]=i,o=decodeURIComponent(e),n=decodeURIComponent(t);return n==="HEAD"?o:`${o} (${n})`}}var JQ=class extends C{constructor(e,t,o){super();this.requestService=e;this.authenticationService=t;this.logService=o;this._onDidChangeCapabilities=this._register(new E);this.onDidChangeCapabilities=this._onDidChangeCapabilities.event;this.capabilities=3074;this._onDidChangeFile=this._register(new E);this.onDidChangeFile=this._onDidChangeFile.event;this.treeCache=new Map;this.notFoundCache=new Map;this.pendingFetches=new Map}static{this.CACHE_TTL_MS=300*1e3}static{this.NOT_FOUND_CACHE_TTL_MS=60*1e3}parseUri(e){let t=e.path.split("/").filter(Boolean);if(t.length<3)throw Jr("Invalid github-remote-file URI: expected /{owner}/{repo}/{ref}/...","EntryNotFound");let o=decodeURIComponent(t[0]),n=decodeURIComponent(t[1]),r=decodeURIComponent(t[2]),s=t.slice(3).map(decodeURIComponent).join("/");return{owner:o,repo:n,ref:r,path:s}}getCacheKey(e,t,o){return`${e}/${t}/${o}`}async getAuthToken(){return(await this.authenticationService.getSessions("github",["repo"],{silent:!0})??await this.authenticationService.getSessions("github",["repo"],{createIfNone:!0}))[0].accessToken??""}fetchTree(e,t,o){let n=this.getCacheKey(e,t,o),r=this.treeCache.get(n);if(r&&Date.now()-r.fetchedAt<JQ.CACHE_TTL_MS)return Promise.resolve(r);let s=this.notFoundCache.get(n);if(s!==void 0&&Date.now()-s<JQ.NOT_FOUND_CACHE_TTL_MS)return Promise.reject(Jr(`Tree not found for ${e}/${t}@${o}`,"EntryNotFound"));let l=this.pendingFetches.get(n);if(l)return l;let c=this.doFetchTree(e,t,o,n).finally(()=>{this.pendingFetches.delete(n)});return this.pendingFetches.set(n,c),c}async doFetchTree(e,t,o,n){this.logService.info(`[SessionRepoFS] Fetching tree for ${e}/${t}@${o}`);let r=await this.getAuthToken(),s=`https://api.github.com/repos/${encodeURIComponent(e)}/${encodeURIComponent(t)}/git/trees/${encodeURIComponent(o)}?recursive=1`,l=await this.requestService.request({type:"GET",url:s,headers:{Authorization:`token ${r}`,Accept:"application/vnd.github.v3+json","User-Agent":"VSCode-SessionRepoFS"}},ve.None);if(l.res.statusCode===404)throw this.notFoundCache.set(n,Date.now()),Jr(`Tree not found for ${e}/${t}@${o}`,"EntryNotFound");let c=await hh(l);if(!c)throw Jr(`Failed to fetch tree for ${e}/${t}@${o}`,"Unavailable");let u=new Map;u.set("",{type:2,size:0,sha:c.sha});let p=new Set;for(let g of c.tree){let f=g.type==="tree"?2:1;u.set(g.path,{type:f,size:g.size??0,sha:g.sha}),f===2&&p.add(g.path);let v=g.path.split("/");for(let b=1;b<v.length;b++){let S=v.slice(0,b).join("/");p.has(S)||(p.add(S),u.has(S)||u.set(S,{type:2,size:0,sha:""}))}}let h={entries:u,fetchedAt:Date.now()};return this.treeCache.set(n,h),h}async stat(e){let{owner:t,repo:o,ref:n,path:r}=this.parseUri(e),l=(await this.fetchTree(t,o,n)).entries.get(r);if(!l)throw Jr("File not found","EntryNotFound");return{type:l.type,ctime:0,mtime:0,size:l.size}}async readdir(e){let{owner:t,repo:o,ref:n,path:r}=this.parseUri(e),s=await this.fetchTree(t,o,n),l=r?r+"/":"",c=[];for(let[u,p]of s.entries){if(!u.startsWith(l))continue;let h=u.slice(l.length);h&&!h.includes("/")&&c.push([h,p.type])}return c}async readFile(e){let{owner:t,repo:o,ref:n,path:r}=this.parseUri(e),l=(await this.fetchTree(t,o,n)).entries.get(r);if(!l||l.type===2)throw Jr("File not found","EntryNotFound");let c=await this.getAuthToken(),u=`https://api.github.com/repos/${encodeURIComponent(t)}/${encodeURIComponent(o)}/git/blobs/${encodeURIComponent(l.sha)}`,p=await this.requestService.request({type:"GET",url:u,headers:{Authorization:`token ${c}`,Accept:"application/vnd.github.v3+json","User-Agent":"VSCode-SessionRepoFS"}},ve.None),h=await hh(p);if(!h)throw Jr(`Failed to read file ${r}`,"Unavailable");if(h.encoding==="base64"){let g=atob(h.content.replace(/\n/g,"")),f=new Uint8Array(g.length);for(let v=0;v<g.length;v++)f[v]=g.charCodeAt(v);return f}return new TextEncoder().encode(h.content)}watch(){return C.None}async writeFile(e,t,o){throw Jr("Operation not supported","NoPermissions")}async mkdir(e){throw Jr("Operation not supported","NoPermissions")}async delete(e,t){throw Jr("Operation not supported","NoPermissions")}async rename(e,t,o){throw Jr("Operation not supported","NoPermissions")}invalidateCache(e,t,o){let n=this.getCacheKey(e,t,o);this.treeCache.delete(n),this.notFoundCache.delete(n)}dispose(){this.treeCache.clear(),this.notFoundCache.clear(),this.pendingFetches.clear(),super.dispose()}};JQ=I([m(0,_a),m(1,Cs),m(2,ne)],JQ);var Hve=new Q("isNewChatSession",!0),Uve=new Q("isActiveSessionBackgroundProvider",!1,d(2953,null)),fDo="agentSessions.lastSelectedSession",Uhn="repository",du=ae("sessionsManagementService"),x2e=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.storageService=e;this.uriIdentityService=t;this.agentSessionsService=o;this.chatSessionsService=n;this.chatWidgetService=r;this.chatService=s;this.instantiationService=l;this.logService=c;this.commandService=p;this.languageModelsService=h;this._activeSession=Le(this,void 0);this.activeSession=this._activeSession;this._newActiveSessionDisposables=this._register(new P);this._newSession=this._register(new me);this.isNewChatSessionContext=Hve.bindTo(u),this._isBackgroundProvider=Uve.bindTo(u),this.lastSelectedSession=this.loadLastSelectedSession(),this._register(this.storageService.onWillSaveState(()=>this.saveLastSelectedSession())),this._register(this.agentSessionsService.model.onDidChangeSessions(()=>this.refreshActiveSessionFromModel())),this._register(this.agentSessionsService.model.onDidChangeSessionArchivedState(g=>{if(g.isArchived()){let f=this._activeSession.get();f&&f.resource.toString()===g.resource.toString()&&this.openNewSessionView()}}))}refreshActiveSessionFromModel(){let e=this._activeSession.get();if(!e)return;let t=this.agentSessionsService.model.getSession(e.resource);if(!t){if(e.isUntitled){let n=this.chatWidgetService.getWidgetsByLocations("panel")[0]?.viewModel?.sessionResource,r=n?this.agentSessionsService.model.getSession(n):void 0;r&&this.setActiveSession(r)}else this.showNextSession();return}this.setActiveSession(t)}showNextSession(){let e=this.agentSessionsService.model.sessions.filter(t=>!t.isArchived()).sort((t,o)=>(o.timing.lastRequestEnded??o.timing.created)-(t.timing.lastRequestEnded??t.timing.created));e.length>0?(this.setActiveSession(e[0]),this.instantiationService.invokeFunction(UB,e[0])):this.openNewSessionView()}getRepositoryFromMetadata(e){let t=e.metadata;if(!t)return[void 0,void 0];if(e.providerType==="copilot-cloud-agent"){let c=typeof t.branch=="string"?t.branch:"HEAD";return[A.from({scheme:WH,authority:"github",path:`/${t.owner}/${t.name}/${encodeURIComponent(c)}`}),void 0]}let o=t?.workingDirectoryPath;if(o)return[A.file(o),void 0];let n=t?.repositoryPath,r=typeof n=="string"?A.file(n):void 0,s=t?.worktreePath,l=typeof s=="string"?A.file(s):void 0;return[A.isUri(r)?r:void 0,A.isUri(l)?l:void 0]}getRepositoryFromSessionOption(e){let t=this.chatSessionsService.getSessionOption(e,Uhn);if(!t)return;let o=typeof t=="string"?t:t.id;if(o)try{return A.parse(o)}catch{return}}getActiveSession(){return this._activeSession.get()}async openSession(e,t){this.isNewChatSessionContext.set(!1);let o=this.agentSessionsService.model.getSession(e);o?await this.openExistingSession(o,t):this._newSession.value&&this.uriIdentityService.extUri.isEqual(e,this._newSession.value.resource)&&await this.openNewSession(this._newSession.value)}async createNewSessionForTarget(e,t,o){this.isNewChatSessionContext.get()||this.isNewChatSessionContext.set(!0);let n;return e==="copilotcli"?n=this.instantiationService.createInstance(C2e,t,o):n=this.instantiationService.createInstance(ore,t,e),this._newSession.value=n,this.setActiveSession(n),n}async openExistingSession(e,t){this.setActiveSession(e),await this.instantiationService.invokeFunction(UB,e,t)}async openNewSession(e){this.setActiveSession(e);let t=e.resource;if(!(await this.chatWidgetService.openSession(t,$x))?.viewModel){this.logService.warn(`[ActiveSessionService] Failed to open session: ${t.toString()}`);return}let n=this.getRepositoryFromSessionOption(t);this.logService.info(`[ActiveSessionService] Active session changed (new): ${t.toString()}, repository: ${n?.toString()??"none"}`)}async sendRequestForNewSession(e,t){let o=this._newSession.value;if(!o){this.logService.error(`[SessionsManagementService] No new session found for resource: ${e.toString()}`);return}if(!this.uriIdentityService.extUri.isEqual(e,o.resource)){this.logService.error(`[SessionsManagementService] Session resource mismatch. Expected: ${o.resource.toString()}, received: ${e.toString()}`);return}let n=o.query;if(!n){this.logService.error("[SessionsManagementService] No query set on session");return}let r=this.chatSessionsService.getChatSessionContribution(o.target),s={location:"panel",userSelectedModelId:o.modelId,modeInfo:{kind:"agent",isBuiltin:!0,modeInstructions:void 0,modeId:"agent",applyCodeBlockSuggestionId:void 0},agentIdSilent:r?.type,attachedContext:o.attachedContext};await this.chatSessionsService.getOrCreateChatSession(o.resource,ve.None),await this.doSendRequestForNewSession(o,n,s,o.selectedOptions,t?.openNewSessionView),this._newSession.value=void 0}async doSendRequestForNewSession(e,t,o,n,r){await this.openSession(e.resource),r&&this.openNewSessionView();let s=this.chatService.acquireExistingSession(e.resource);if(s){let p=s.object;if(e.modelId){let h=this.languageModelsService.lookupLanguageModel(e.modelId);h&&p.inputModel.setState({selectedModel:{identifier:e.modelId,metadata:h}})}if(n&&n.size>0){let h=p.contributedChatSession;if(h){let g=[...n.entries()].map(([f,v])=>({optionId:f,value:v}));p.setContributedChatSession({...h,initialSessionOptions:g})}}s.dispose()}let l=new Set(this.agentSessionsService.model.sessions.map(p=>p.resource.toString())),c=await this.chatService.sendRequest(e.resource,t,o);if(c.kind==="rejected"){this.logService.error(`[ActiveSessionService] sendRequest rejected: ${c.reason}`);return}let u=this.agentSessionsService.model.sessions.find(p=>!l.has(p.resource.toString()));if(!u){let p;u=await Promise.race([new Promise(h=>{p=this.agentSessionsService.model.onDidChangeSessions(()=>{let g=this.agentSessionsService.model.sessions.find(f=>!l.has(f.resource.toString()));g&&h(g)})}),new Promise(h=>setTimeout(()=>h(void 0),3e4))]),p?.dispose()}u&&!r&&this.setActiveSession(u)}openNewSessionView(){this.isNewChatSessionContext.get()||(this.setActiveSession(void 0),this.isNewChatSessionContext.set(!0))}setActiveSession(e){let t;if(e)if(gR(e)){this.lastSelectedSession=e.resource;let[o,n]=this.getRepositoryFromMetadata(e);t={isUntitled:this.chatService.getSession(e.resource)?.contributedChatSession?.isUntitled??!0,label:e.label,resource:e.resource,repository:o,worktree:n,providerType:e.providerType}}else t={isUntitled:!0,label:void 0,resource:e.resource,repository:e.repoUri,worktree:void 0,providerType:e.target},this._newActiveSessionDisposables.clear(),this._newActiveSessionDisposables.add(e.onDidChange(o=>{o==="repoUri"&&this.doSetActiveSession({isUntitled:!0,label:void 0,resource:e.resource,repository:e.repoUri,worktree:void 0,providerType:e.target})}));this.doSetActiveSession(t)}doSetActiveSession(e){this.equalsSessionItem(this._activeSession.get(),e)||(e?(this.logService.info(`[ActiveSessionService] Active session changed: ${e.resource.toString()}`),this.logService.trace(`[ActiveSessionService] Active session details: ${JSON.stringify(e)}`)):this.logService.trace("[ActiveSessionService] Active session cleared"),this._isBackgroundProvider.set(e?.providerType==="copilotcli"),this._activeSession.set(e,void 0))}equalsSessionItem(e,t){return e===t?!0:!e||!t?!1:e.label===t.label&&e.resource.toString()===t.resource.toString()&&e.repository?.toString()===t.repository?.toString()&&e.worktree?.toString()===t.worktree?.toString()&&e.providerType===t.providerType}async commitWorktreeFiles(e,t){let o=e.worktree;if(!o)throw new Error("Cannot commit worktree files: active session has no associated worktree");for(let n of t)await this.commandService.executeCommand("github.copilot.cli.sessions.commitToWorktree",{worktreeUri:o,fileUri:n});await this.agentSessionsService.model.resolve("copilotcli")}loadLastSelectedSession(){let e=this.storageService.get(fDo,1);if(e)try{return A.parse(e)}catch{return}}saveLastSelectedSession(){this.lastSelectedSession&&this.storageService.store(fDo,this.lastSelectedSession.toString(),1,1)}};x2e=I([m(0,le),m(1,dt),m(2,ia),m(3,Ls),m(4,At),m(5,Si),m(6,F),m(7,ne),m(8,X),m(9,ge),m(10,Wr)],x2e);var zhn="workbench.action.chat.branchChatSession",y6t=class a extends K{static{this.ID=zhn}constructor(){super({id:a.ID,title:L(2866,"Branch Chat"),tooltip:L(2867,"Branch to new session"),icon:M.reply,f1:!1,precondition:x.and(ie.enabled,ie.requestInProgress.negate()),menu:[{id:D.ChatMessageCheckpoint,group:"navigation",order:3,when:x.and(ie.isRequest,ie.lockedToCodingAgent.negate())}]})}async run(i,...e){let t=e[0],o=i.get(At),n=i.get(Si);if(!t||!Rr(t)&&!Vi(t))return;let r=o.getWidgetBySessionResource(t.sessionResource);if(!r||!r.viewModel)return;let s=r.viewModel.model;if(!s)return;let l=Rr(t)?t.id:t.requestId,c=Xn(structuredClone(s.toJSON()));c.sessionId=_t(),delete c.customTitle;let u=c.requests.findIndex(h=>h.requestId===l);if(u===-1)return;c.requests=c.requests.slice(0,u);for(let h of c.requests)delete h.shouldBeRemovedOnSend,delete h.isHidden;if(c.requests.length===0)return;let p=n.loadSessionFromData(c);await o.openSession(p.object.sessionResource,$x)}};var zve=Object.freeze({Sessions:L(2761,"Sessions")});var w6t=ae("sessionsConfigurationService"),zG=class extends C{constructor(e,t,o,n,r,s){super();this._fileService=e;this._jsonEditingService=t;this._preferencesService=o;this._terminalService=n;this._sessionsManagementService=r;this._storageService=s;this._sessionTasks=Le(this,[]);this._fileWatcher=this._register(new me);this._taskTerminals=new Map;this._lastRunTaskObservables=new Map;this._lastRunTaskLabels=this._loadLastRunTaskLabels()}static{this._LAST_RUN_TASK_LABELS_KEY="agentSessions.lastRunTaskLabels"}static{this._SUPPORTED_TASK_TYPES=new Set(["shell","npm"])}getSessionTasks(e){let t=e.worktree??e.repository;return t&&this._ensureFileWatch(t),Xe(this._lastRefreshedFolder,t)||(this._lastRefreshedFolder=t,this._refreshSessionTasks(t)),this._sessionTasks}async getNonSessionTasks(e){return(await this._readAllTasks(e)).filter(o=>!o.inSessions)}async addTaskToSessions(e,t,o){let n=this._getTasksJsonUri(t,o);if(!n)return;let l=((await this._readTasksJson(n)).tasks??[]).findIndex(c=>c.label===e.label);l!==-1&&(await this._jsonEditingService.write(n,[{path:["tasks",l,"inSessions"],value:!0}],!0),o==="workspace"&&await this._commitTasksFile(t))}async createAndAddTask(e,t,o){let n=this._getTasksJsonUri(t,o);if(!n)return;let r=await this._readTasksJson(n),s=r.tasks??[],l={label:e,type:"shell",command:e,inSessions:!0};return await this._jsonEditingService.write(n,[{path:["version"],value:r.version??"2.0.0"},{path:["tasks"],value:[...s,l]}],!0),o==="workspace"&&await this._commitTasksFile(t),l}async runTask(e,t){let o=this._resolveCommand(e);if(!o)return;let n=t.worktree??t.repository;if(!n)return;let r=`${n.toString()}${o}`,s=this._getExistingTerminalInstance(r);if(s||(s=await this._terminalService.createTerminal({location:1,config:{name:e.label},cwd:n}),this._taskTerminals.set(r,s.instanceId)),await s.sendText(o,!0),this._terminalService.setActiveInstance(s),await this._terminalService.revealActiveTerminal(),t.repository){let l=t.repository.toString();this._lastRunTaskLabels.set(l,e.label),this._saveLastRunTaskLabels();let c=this._lastRunTaskObservables.get(l);c&&Ui(u=>c.set(e.label,u))}}getLastRunTaskLabel(e){if(!e)return Le("lastRunTaskLabel",void 0);let t=e.toString(),o=this._lastRunTaskObservables.get(t);return o||(o=Le("lastRunTaskLabel",this._lastRunTaskLabels.get(t)),this._lastRunTaskObservables.set(t,o)),o}_getExistingTerminalInstance(e){let t=this._taskTerminals.get(e);if(t===void 0)return;let o=this._terminalService.instances.find(n=>n.instanceId===t);if(!o||o.hasChildProcesses){this._taskTerminals.delete(e);return}return o}_getTasksJsonUri(e,t){if(t==="workspace"){let o=e.worktree??e.repository;return o?je(o,".vscode","tasks.json"):void 0}return je(ci(this._preferencesService.userSettingsResource),"tasks.json")}async _readTasksJson(e){try{let t=await this._fileService.readFile(e);return xk(t.value.toString())}catch{return{}}}async _readAllTasks(e){let t=[],o=this._getTasksJsonUri(e,"workspace");if(o){let r=await this._readTasksJson(o);r.tasks&&t.push(...r.tasks.filter(s=>this._isSupportedTask(s)))}let n=this._getTasksJsonUri(e,"user");if(n){let r=await this._readTasksJson(n);r.tasks&&t.push(...r.tasks.filter(s=>this._isSupportedTask(s)))}return t}_isSupportedTask(e){return!!e.type&&zG._SUPPORTED_TASK_TYPES.has(e.type)}_resolveCommand(e){if(e.type==="npm"){if(!e.script)return;let r=e.path?`npm --prefix ${e.path} run ${e.script}`:`npm run ${e.script}`;return this._appendArgs(r,e.args)}let t,o;ri&&e.windows?.command?(t=e.windows.command,o=e.windows.args):it&&e.osx?.command?(t=e.osx.command,o=e.osx.args):!ri&&!it&&e.linux?.command?(t=e.linux.command,o=e.linux.args):t=e.command;let n=o??e.args;return this._appendArgs(t,n)}_appendArgs(e,t){if(!e)return;if(!t||t.length===0)return e;let o=t.map(n=>yFi.value(n)).join(" ");return`${e} ${o}`}_ensureFileWatch(e){let t=je(e,".vscode","tasks.json");if(this._watchedResource&&this._watchedResource.toString()===t.toString())return;this._watchedResource=t;let o=new P;o.add(this._fileService.watch(t)),o.add(this._fileService.onDidFilesChange(n=>{n.affects(t)&&this._refreshSessionTasks(e)})),this._fileWatcher.value=o}async _refreshSessionTasks(e){if(!e){Ui(c=>this._sessionTasks.set([],c));return}let t=je(e,".vscode","tasks.json"),n=((await this._readTasksJson(t)).tasks??[]).filter(c=>c.inSessions&&this._isSupportedTask(c)),r=je(ci(this._preferencesService.userSettingsResource),"tasks.json"),l=((await this._readTasksJson(r)).tasks??[]).filter(c=>c.inSessions&&this._isSupportedTask(c));Ui(c=>this._sessionTasks.set([...n,...l],c))}async _commitTasksFile(e){let t=e.worktree;if(!t)return;let o=je(t,".vscode","tasks.json");await this._sessionsManagementService.commitWorktreeFiles(e,[o])}_loadLastRunTaskLabels(){let e=this._storageService.get(zG._LAST_RUN_TASK_LABELS_KEY,-1);if(e)try{return new Map(Object.entries(JSON.parse(e)))}catch{}return new Map}_saveLastRunTaskLabels(){this._storageService.store(zG._LAST_RUN_TASK_LABELS_KEY,JSON.stringify(Object.fromEntries(this._lastRunTaskLabels)),-1,0)}};zG=I([m(0,be),m(1,zf),m(2,Po),m(3,Yo),m(4,du),m(5,le)],zG);var bHi=D.for("AgentSessionsRunScriptDropdown"),Khn="workbench.action.agentSessions.runScript",SHi="workbench.action.agentSessions.runScriptPrimary",Ghn="workbench.action.agentSessions.configureDefaultRunAction";function C6t(a){return a.label&&a.label.length>0?a.label:a.script&&a.script.length>0?a.script:a.command&&a.command.length>0?a.command:a.task&&a.task.toString().length>0?a.task.toString():""}var Kve=class extends C{constructor(e,t,o,n){super();this._activeSessionService=e;this._keybindingService=t;this._quickInputService=o;this._sessionsConfigService=n;this._activeRunState=hs({owner:this,equalsFn:(r,s)=>r===s?!0:!r||!s?!1:r.session===s.session&&r.lastRunTaskLabel===s.lastRunTaskLabel&&$i(r.tasks,s.tasks,(l,c)=>l.label===c.label&&l.command===c.command)},r=>{let s=this._activeSessionService.activeSession.read(r);if(!s)return;let l=this._sessionsConfigService.getSessionTasks(s).read(r),c=this._sessionsConfigService.getLastRunTaskLabel(s.repository).read(r);return{session:s,tasks:l,lastRunTaskLabel:c}}).recomputeInitiallyAndOnChange(this._store),this._registerActions()}static{this.ID="workbench.contrib.agentSessions.runScript"}_registerActions(){let e=this;this._register(W(class extends K{constructor(){super({id:SHi,title:{value:d(2914,null),original:"Run Primary Script"},icon:M.play,category:zve.Sessions,f1:!0})}async run(){let t=e._activeRunState.get();if(!t)return;let{tasks:o,session:n,lastRunTaskLabel:r}=t;if(o.length===0){let c=await e._showConfigureQuickPick(n);c&&await e._sessionsConfigService.runTask(c,n);return}let s=r!==void 0?o.findIndex(c=>c.label===r):-1,l=o[s>=0?s:0];await e._sessionsConfigService.runTask(l,n)}})),this._register(he(t=>{let o=this._activeRunState.read(t);if(!o)return;let{tasks:n,session:r,lastRunTaskLabel:s}=o,l=r.worktree??r.repository?x.true():x.false(),c=s!==void 0?n.findIndex(u=>u.label===s):-1;if(n.length>0)for(let u=0;u<n.length;u++){let p=n[u],h=`${Khn}.${u}`,g=u===(c>=0?c:0);t.store.add(W(class extends K{constructor(){super({id:h,title:C6t(p),tooltip:g?d(2913,null,C6t(p),e._keybindingService.lookupKeybinding(SHi)?.getLabel()??""):d(2912,null,C6t(p)),icon:M.play,category:zve.Sessions,menu:[{id:bHi,group:"0_scripts",order:u===c?-1:u}]})}async run(){await e._sessionsConfigService.runTask(p,r)}}))}t.store.add(W(class extends K{constructor(){super({id:Ghn,title:L(2902,"Add Run Action..."),category:zve.Sessions,icon:M.play,precondition:l,menu:[{id:bHi,group:n.length===0?"navigation":"1_configure",order:0}]})}async run(){let u=await e._showConfigureQuickPick(r);u&&await e._sessionsConfigService.runTask(u,r)}}))}))}async _showConfigureQuickPick(e){let t=await this._sessionsConfigService.getNonSessionTasks(e);if(t.length===0)return this._showCustomCommandInput(e);let o=[];if(o.push({type:"separator",label:d(2903,null)}),o.push({label:d(2906,null),description:d(2907,null)}),t.length>0){o.push({type:"separator",label:d(2908,null)});for(let s of t)o.push({label:C6t(s),description:s.command,task:s,source:"workspace"})}let n=await this._quickInputService.pick(o,{placeHolder:d(2909,null)});if(!n)return;let r=n;return r.task?(await this._sessionsConfigService.addTaskToSessions(r.task,e,r.source??"workspace"),r.task):this._showCustomCommandInput(e)}async _showCustomCommandInput(e){let t=await this._quickInputService.input({placeHolder:d(2904,null),prompt:d(2905,null)});if(!t)return;let o=await this._pickStorageTarget(e);if(o)return this._sessionsConfigService.createAndAddTask(t,e,o)}async _pickStorageTarget(e){let t=!!e.worktree,o=!!e.repository,n=[{target:"user",label:d(2916,null),description:d(2917,null)},t?{target:"workspace",label:d(2922,null),description:d(2923,null)}:o?{target:"workspace",label:d(2920,null),description:d(2918,null)}:{target:"workspace",label:d(2921,null),description:d(2919,null),disabled:!0,italic:!0}];return new Promise(r=>{let s=this._quickInputService.createQuickPick({useSeparators:!0});s.placeholder=d(2910,null),s.items=n,s.onDidAccept(()=>{let l=s.activeItems[0];l&&(l.target!=="workspace"||t)&&(r(l.target),s.dispose())}),s.onDidHide(()=>{r(void 0),s.dispose()}),s.show()})}};Kve=I([m(0,du),m(1,_e),m(2,Ge),m(3,w6t)],Kve);fe.appendMenuItem(va.TitleBarSessionMenu,{submenu:bHi,isSplitButton:!0,title:L(2911,"Run"),icon:M.play,group:"navigation",order:8,when:x.and(Xc.toNegated(),fM.toNegated(),Uve)});var IHi=class extends K{constructor(){super({id:"workbench.action.agentSessions.runScript.notAvailable",title:L(2911,"Run"),tooltip:d(2915,null),icon:M.play,precondition:x.false(),menu:[{id:va.TitleBarSessionMenu,group:"navigation",order:8,when:x.and(Xc.toNegated(),fM.toNegated(),Uve.toNegated())}]})}run(){}};W(IHi);yt.registerKeybindingRule({id:SHi,primary:63,weight:300,when:Xc.toNegated()});var yHi=class{constructor(){this.onWillStartSession=H.None;this.onDidChangeSessions=H.None}dispose(){}createSession(i){throw new Error("Inline chat sessions are not supported in the sessions window")}getSessionByTextModel(i){}getSessionBySessionUri(i){}};we(Ik,yHi,1);var x6t=class extends Ute{createPromptFilesLocator(){return this.instantiationService.createInstance(wut)}getCopilotRoot(){if(!this._copilotRoot){let i=this.instantiationService.invokeFunction(e=>e.get(wn));this._copilotRoot=je(i.userHome({preferLocal:!0}),".copilot")}return this._copilotRoot}async getSourceFolders(i){let e=await super.getSourceFolders(i),t=this.getCopilotRoot();return e.map(o=>{if(o.storage==="user"){let n=$hn(i);return n?{...o,uri:je(t,n)}:o}return o})}},wut=class extends Hte{constructor(e,t,o,n,r,s,l,c,u){super(e,t,o,n,r,s,l,c);this.customizationWorkspaceService=u}getWorkspaceFolders(){let e=this.getActiveWorkspaceFolder();return e?[e]:[]}getWorkspaceFolder(e){let t=this.getActiveWorkspaceFolder();if(t)return La(e,t.uri)?t:void 0}onDidChangeWorkspaceFolders(){return H.fromObservableLight(this.customizationWorkspaceService.activeProjectRoot)}async getHookSourceFolders(){let e=await super.getHookSourceFolders();if(e.length>0)return e;let t=this.getActiveWorkspaceFolder();return t?[je(t.uri,ldo)]:[]}getActiveWorkspaceFolder(){let e=this.customizationWorkspaceService.getActiveProjectRoot();if(e)return{uri:e,name:Ye(e),index:0,toResource:t=>je(e,t)}}};wut=I([m(0,be),m(1,B),m(2,Pe),m(3,Vt),m(4,Jp),m(5,mn),m(6,ne),m(7,wn),m(8,lf)],wut);function $hn(a){switch(a){case"instructions":return"instructions";case"skill":return"skills";case"agent":return"agents";default:return}}var ZQ=class{constructor(i,e,t,o,n,r,s,l){this.sessionsService=i;this.instantiationService=e;this.promptsService=t;this.commandService=n;this.logService=r;this.fileService=s;this.notificationService=l;this.managementSections=[kn.Agents,kn.Skills,kn.Instructions,kn.Prompts,kn.Hooks,kn.McpServers,kn.Plugins];this.isSessionsWindow=!0;let c=o.userHome({preferLocal:!0});this._cliUserRoots=[je(c,".copilot"),je(c,".claude"),je(c,".agents")],this._cliUserFilter={sources:["local","user","plugin"],includedUserFileRoots:this._cliUserRoots},this._overrideRoot=Le(this,void 0),this.activeProjectRoot=Ce(u=>{let p=this._overrideRoot.read(u);if(p)return p;let h=this.sessionsService.activeSession.read(u);return h?.worktree??h?.repository}),this.hasOverrideProjectRoot=Ce(u=>this._overrideRoot.read(u)!==void 0)}getActiveProjectRoot(){let i=this._overrideRoot.get();if(i)return i;let e=this.sessionsService.getActiveSession();return e?.worktree??e?.repository}setOverrideProjectRoot(i){this._overrideRoot.set(i,void 0)}clearOverrideProjectRoot(){this._overrideRoot.set(void 0,void 0)}static{this._hooksFilter={sources:["local","plugin"]}}static{this._allUserRootsFilter={sources:["local","user","plugin"]}}getStorageSourceFilter(i){return i==="hook"?ZQ._hooksFilter:i==="prompt"?ZQ._allUserRootsFilter:this._cliUserFilter}async commitFiles(i,e){let t=this.sessionsService.getActiveSession();if(t?.repository)for(let o of e)await this.commitFileToRepos(o,t.repository,t.worktree)}async deleteFiles(i,e){let t=this.sessionsService.getActiveSession();if(t?.repository)for(let o of e)await this.commitDeletionToRepos(o,t.repository,t.worktree)}getRelativePath(i,e,t){if(t){let o=Fc(t,i);if(o)return o}return Fc(e,i)}async commitFileToRepos(i,e,t){let o=this.getRelativePath(i,e,t);if(!o)return;let n=A.joinPath(e,o);try{if(n.toString()!==i.toString()){let r=await this.fileService.readFile(i);await this.fileService.writeFile(n,r.value)}await this.commandService.executeCommand("github.copilot.cli.sessions.commitToRepository",{repositoryUri:e,fileUri:n})}catch(r){this.logService.error("[SessionsAICustomizationWorkspaceService] Failed to commit to repository:",r),t&&this.notificationService.notify({severity:St.Warning,message:d(2864,null)})}if(t){let r=A.joinPath(t,o);try{if(r.toString()!==i.toString()){let s=await this.fileService.readFile(i);await this.fileService.writeFile(r,s.value)}await this.commandService.executeCommand("github.copilot.cli.sessions.commitToWorktree",{worktreeUri:t,fileUri:r})}catch(s){this.logService.error("[SessionsAICustomizationWorkspaceService] Failed to commit to worktree:",s)}}}async commitDeletionToRepos(i,e,t){let o=this.getRelativePath(i,e,t);if(!o)return;let n=A.joinPath(e,o);try{await this.fileService.exists(n)&&await this.fileService.del(n,{useTrash:!0,recursive:!0}),await this.commandService.executeCommand("github.copilot.cli.sessions.commitToRepository",{repositoryUri:e,fileUri:n})}catch(r){this.logService.error("[SessionsAICustomizationWorkspaceService] Failed to commit deletion to repository:",r),t&&this.notificationService.notify({severity:St.Warning,message:d(2865,null)})}if(t){let r=A.joinPath(t,o);try{await this.commandService.executeCommand("github.copilot.cli.sessions.commitToWorktree",{worktreeUri:t,fileUri:r})}catch(s){this.logService.error("[SessionsAICustomizationWorkspaceService] Failed to commit deletion to worktree:",s)}}}async generateCustomization(i){await this.instantiationService.createInstance(PFe).createWithAI(i)}async getFilteredPromptSlashCommands(i){return(await this.promptsService.getPromptSlashCommands(i)).filter(t=>{let o=this.getStorageSourceFilter(t.promptPath.type);return qB([t.promptPath],o).length>0})}};ZQ=I([m(0,du),m(1,F),m(2,nr),m(3,wn),m(4,ge),m(5,ne),m(6,be),m(7,Ne)],ZQ);var k2e=class extends C{constructor(e,t,o,n,r,s,l,c,u){super();this.quickInputService=e;this.textModelService=t;this.fileService=o;this.clipboardService=n;this.fileDialogService=r;this.labelService=s;this.searchService=l;this.configurationService=c;this.openerService=u;this._attachedContext=[];this._renderDisposables=this._register(new P);this._onDidChangeContext=this._register(new E);this.onDidChangeContext=this._onDidChangeContext.event}get attachments(){return this._attachedContext}setAttachments(e){this._attachedContext.length=0,this._attachedContext.push(...e),this._updateRendering(),this._onDidChangeContext.fire()}renderAttachedContext(e){this._container=e,this._updateRendering()}_updateRendering(){if(this._container){if(this._renderDisposables.clear(),Rt(this._container),this._attachedContext.length===0){this._container.style.display="none";return}this._container.style.display="";for(let e of this._attachedContext){let t=R(this._container,_(".sessions-chat-attachment-pill"));t.tabIndex=0,t.role="button";let o=e.kind==="image"?M.fileMedia:e.kind==="directory"?M.folder:M.file;R(t,Qo(o)),R(t,_("span.sessions-chat-attachment-name",void 0,e.name));let n=A.isUri(e.value)?e.value:nv(e.value)?e.value.uri:void 0;n&&(t.style.cursor="pointer",this._renderDisposables.add(qMe(t,async()=>{await this.openerService.open(n,{fromUserGesture:!0})})));let r=R(t,_(".sessions-chat-attachment-remove"));r.title=d(2890,null),r.tabIndex=-1,R(r,Qo(M.close)),this._renderDisposables.add(j(r,re.CLICK,s=>{s.stopPropagation(),this._removeAttachment(e.id)}))}}}registerDropTarget(e){let t=R(e,_(".sessions-chat-dnd-overlay")),o,n=l=>gu(l,Aa.FILES,Ll.EDITORS,Ll.FILES,Aa.RESOURCES,Aa.INTERNAL_URI_LIST),r=()=>{if(t.classList.add("visible"),!o){let l=d(2885,null),u=Bn(`$(${M.attach.id}) ${l}`).map(p=>typeof p=="string"?_("span.overlay-text",void 0,p):p);o=_("span.attach-context-overlay-text",void 0,...u),t.appendChild(o)}},s=()=>{t.classList.remove("visible"),o?.remove(),o=void 0};this._register(new Om(e,{onDragOver:l=>{n(l)&&(l.preventDefault(),l.stopPropagation(),l.dataTransfer&&(l.dataTransfer.dropEffect="copy"),r())},onDragLeave:()=>{s()},onDrop:async l=>{l.preventDefault(),l.stopPropagation(),s();let c=iqe(l);if(c.length>0){for(let p of c)p.resource&&await this._attachFileUri(p.resource,Ye(p.resource));return}let u=l.dataTransfer?.items;if(u){for(let p of Array.from(u))if(p.kind==="file"){let h=p.getAsFile();if(!h)continue;let g=Ix(h);if(!g)continue;let f=A.file(g);await this._attachFileUri(f,h.name)}}}}))}registerPasteHandler(e){let t=["image/png","image/jpeg","image/jpg","image/bmp","image/gif","image/tiff"];this._register(j(e,re.PASTE,async o=>{let n=o.clipboardData?.items;if(!n)return;let r;for(let p of Array.from(n)){if(!p.type.startsWith("image/")||!t.includes(p.type))continue;let h=p.getAsFile();if(h){r=h;break}}if(!r)return;o.preventDefault(),o.stopPropagation();let s=await r.arrayBuffer(),l=new Uint8Array(s);if(!jZe(l))return;let c=await k_(l,r.type),u=this._getUniqueImageName();this._addAttachments({id:await eee(c),name:u,fullName:u,value:c,kind:"image"})},!0))}showPicker(e){let t=this.quickInputService.createQuickPick({useSeparators:!0}),o=new P;t.placeholder=d(2886,null),t.matchOnDescription=!0,t.sortByLabel=!1;let n=[{label:d(2887,null),iconClass:q.asClassName(M.file),id:"sessions.filesAndFolders"},{label:d(2888,null),iconClass:q.asClassName(M.fileMedia),id:"sessions.imageFromClipboard"}];if(t.items=n,t.show(),e){let r,s,l=c=>{r?.dispose(!0),r=new $e;let u=r.token;t.busy=!0,this._collectFilePicks(e,c,u).then(p=>{u.isCancellationRequested||(t.busy=!1,p.length>0?t.items=[...n,{type:"separator",label:Ye(e)},...p]:t.items=n)})};l(),o.add(t.onDidChangeValue(c=>{s&&clearTimeout(s),s=setTimeout(()=>l(c||void 0),200)})),o.add({dispose:()=>{r?.dispose(!0),s&&clearTimeout(s)}})}o.add(t.onDidAccept(async()=>{let[r]=t.selectedItems;if(!r){t.hide();return}t.hide(),r.id==="sessions.filesAndFolders"?await this._handleFileDialog():r.id==="sessions.imageFromClipboard"?await this._handleClipboardImage():r.id&&await this._attachFileUri(A.parse(r.id),r.label)})),o.add(t.onDidHide(()=>{t.dispose(),o.dispose()}))}async _collectFilePicks(e,t,o){return e.scheme===Y.file||e.scheme===Y.vscodeRemote?this._collectFilePicksViaSearch(e,200,t,o):this._collectFilePicksViaFileService(e,200,t)}async _collectFilePicksViaSearch(e,t,o,n){let r=MP(this.configurationService.getValue({resource:e}));try{return(await this.searchService.fileSearch({folderQueries:[{folder:e,disregardIgnoreFiles:!1}],type:1,filePattern:o||"",excludePattern:r,sortByScore:!0,maxResults:t},n)).results.map(l=>({label:Ye(l.resource),description:this.labelService.getUriLabel(l.resource,{relative:!0}),iconClass:q.asClassName(M.file),id:l.resource.toString()}))}catch{return[]}}async _collectFilePicksViaFileService(e,t,o){let n=[],r=o?.toLowerCase(),s=10,l=async(c,u)=>{if(!(n.length>=t||u>s))try{let p=await this.fileService.resolve(c);if(!p.children)return;let h=p.children.slice().sort((g,f)=>g.isDirectory!==f.isDirectory?g.isDirectory?-1:1:g.name.localeCompare(f.name));for(let g of h){if(n.length>=t)break;if(g.isDirectory)await l(g.resource,u+1);else{if(r&&!g.name.toLowerCase().includes(r))continue;n.push({label:g.name,description:this.labelService.getUriLabel(g.resource,{relative:!0}),iconClass:q.asClassName(M.file),id:g.resource.toString()})}}}catch{}};return await l(e,0),n}async _handleFileDialog(){let e=await this.fileDialogService.showOpenDialog({canSelectFiles:!0,canSelectFolders:!0,canSelectMany:!0,title:d(2891,null)});if(e)for(let t of e)await this._attachFileUri(t,Ye(t))}async _attachFileUri(e,t){let o;try{o=await this.fileService.stat(e)}catch{return}if(o.isDirectory){this._addAttachments({kind:"directory",id:e.toString(),value:e,name:t});return}if(/\.(png|jpg|jpeg|bmp|gif|tiff)$/i.test(e.path)){let n=await this.fileService.readFile(e),r=await k_(n.value.buffer);this._addAttachments({id:e.toString(),name:t,fullName:t,value:r,kind:"image",references:[{reference:e,kind:"reference"}]})}else{let n=0;try{(await this.textModelService.createModelReference(e)).dispose()}catch{n=2}this._addAttachments({kind:"file",id:e.toString(),value:e,name:t,omittedState:n})}}async _handleClipboardImage(){let e=await this.clipboardService.readImage();if(!jZe(e))return;let t=this._getUniqueImageName();this._addAttachments({id:await eee(e),name:t,fullName:t,value:e,kind:"image"})}_getUniqueImageName(){let e=d(2889,null),t=e;for(let o=2;this._attachedContext.some(n=>n.name===t);o++)t=`${e} ${o}`;return t}_addAttachments(...e){for(let t of e)this._attachedContext.some(o=>o.id===t.id)||this._attachedContext.push(t);this._updateRendering(),this._onDidChangeContext.fire()}_removeAttachment(e){let t=this._attachedContext.findIndex(o=>o.id===e);t>=0&&(this._attachedContext.splice(t,1),this._updateRendering(),this._onDidChangeContext.fire())}clear(){this._attachedContext.length=0,this._updateRendering(),this._onDidChangeContext.fire()}};k2e=I([m(0,Ge),m(1,Nt),m(2,be),m(3,Wi),m(4,dn),m(5,ot),m(6,Jp),m(7,B),m(8,Qe)],k2e);var wHi="agentSessions.lastPickedFolder",k6t="agentSessions.recentlyPickedFolders",qhn=10,jhn=10,E2e=class extends C{constructor(e,t,o,n,r){super();this.actionWidgetService=e;this.storageService=t;this.workspaceContextService=o;this.fileDialogService=n;this.commandService=r;this._onDidSelectFolder=this._register(new E);this.onDidSelectFolder=this._onDidSelectFolder.event;this._recentlyPickedFolders=[];this._renderDisposables=this._register(new P);let s=this.storageService.get(wHi,0);if(s)try{this._selectedFolderUri=A.parse(s)}catch{}try{let l=this.storageService.get(k6t,0);l&&(this._recentlyPickedFolders=JSON.parse(l).map(c=>A.parse(c)))}catch{}}get selectedFolderUri(){return this._selectedFolderUri}render(e){this._renderDisposables.clear();let t=R(e,_(".sessions-chat-picker-slot"));this._renderDisposables.add({dispose:()=>t.remove()});let o=R(t,_("a.action-label"));return o.tabIndex=0,o.role="button",this._triggerElement=o,this._updateTriggerLabel(o),this._renderDisposables.add(j(o,re.CLICK,n=>{$t.stop(n,!0),this.showPicker()})),this._renderDisposables.add(j(o,re.KEY_DOWN,n=>{(n.key==="Enter"||n.key===" ")&&($t.stop(n,!0),this.showPicker())})),t}showPicker(){if(!this._triggerElement||this.actionWidgetService.isVisible)return;let e=this._selectedFolderUri??this.workspaceContextService.getWorkspace().folders[0]?.uri,t=this._buildItems(e),o=t.filter(l=>l.kind==="action").length>jhn,n=this._triggerElement,r={onSelect:l=>{this.actionWidgetService.hide(),l.uri.scheme==="command"&&l.uri.path==="browse"?this._browseForFolder():l.uri.scheme==="command"&&l.uri.path==="clone"?this._cloneRepository():this._selectFolder(l.uri)},onHide:()=>{n.focus()}},s=o?{showFilter:!0,filterPlaceholder:d(2879,null)}:void 0;this.actionWidgetService.show("folderPicker",!1,t,r,this._triggerElement,void 0,[],{getAriaLabel:l=>l.label??"",getWidgetAriaLabel:()=>d(2878,null)},s)}setSelectedFolder(e){this._selectFolder(e)}clearSelection(){this._selectedFolderUri=void 0,this._updateTriggerLabel(this._triggerElement)}_selectFolder(e){this._selectedFolderUri=e,this._addToRecentlyPickedFolders(e),this.storageService.store(wHi,e.toString(),0,1),this._updateTriggerLabel(this._triggerElement),this._onDidSelectFolder.fire(e)}async _browseForFolder(){try{let e=await this.fileDialogService.showOpenDialog({canSelectFiles:!1,canSelectFolders:!0,canSelectMany:!1,title:d(2881,null)});e?.[0]&&this._selectFolder(e[0])}catch{}}async _cloneRepository(){try{let e=await this.commandService.executeCommand("git.clone",void 0,void 0,{postCloneAction:"none"});e&&this._selectFolder(A.file(e))}catch{}}_addToRecentlyPickedFolders(e){this._recentlyPickedFolders=[e,...this._recentlyPickedFolders.filter(t=>!Xe(t,e))].slice(0,qhn),this.storageService.store(k6t,JSON.stringify(this._recentlyPickedFolders.map(t=>t.toString())),0,1)}_buildItems(e){let t=new Set,o=[],n=[];e&&(t.add(e.toString()),n.push({uri:e,label:Ye(e)}));for(let r of this._recentlyPickedFolders){let s=r.toString();t.has(s)||(t.add(s),n.push({uri:r,label:Ye(r)}))}n.sort((r,s)=>m$.compare(r.uri,s.uri));for(let r of n){let s=e&&Xe(r.uri,e);o.push({kind:"action",label:r.label,group:{title:"",icon:M.folder},item:{uri:r.uri,label:r.label,checked:s||!1},...s?{}:{onRemove:()=>this._removeFolder(r.uri)}})}return o.length>0&&o.push({kind:"separator",label:""}),o.push({kind:"action",label:d(2876,null),group:{title:"",icon:M.search},item:{uri:A.from({scheme:"command",path:"browse"}),label:d(2876,null)}}),o.push({kind:"action",label:d(2877,null),group:{title:"",icon:M.repoClone},item:{uri:A.from({scheme:"command",path:"clone"}),label:d(2877,null)}}),o}removeFromRecents(e){this._recentlyPickedFolders=this._recentlyPickedFolders.filter(t=>!Xe(t,e)),this.storageService.store(k6t,JSON.stringify(this._recentlyPickedFolders.map(t=>t.toString())),0,1),this._selectedFolderUri&&Xe(this._selectedFolderUri,e)&&(this._selectedFolderUri=void 0,this.storageService.remove(wHi,0),this._updateTriggerLabel(this._triggerElement))}_removeFolder(e){this._recentlyPickedFolders=this._recentlyPickedFolders.filter(t=>!Xe(t,e)),this.storageService.store(k6t,JSON.stringify(this._recentlyPickedFolders.map(t=>t.toString())),0,1)}_updateTriggerLabel(e){if(!e)return;Rt(e);let t=this._selectedFolderUri??this.workspaceContextService.getWorkspace().folders[0]?.uri,o=t?Ye(t):d(2880,null);R(e,Qo(M.folder));let n=R(e,_("span.sessions-chat-dropdown-label"));n.textContent=o,R(e,Qo(M.chevronDown))}};E2e=I([m(0,nl),m(1,le),m(2,Pe),m(3,dn),m(4,ge)],E2e);var E6t=class extends C{constructor(e,t){super();this._onDidChangeTarget=this._register(new E);this.onDidChangeTarget=this._onDidChangeTarget.event;this._renderDisposables=this._register(new P);this._allowedTargets=e,this._selectedTarget=e.includes(t)?t:e[0]}get selectedTarget(){return this._selectedTarget}render(e){this._container=e,this._renderRadio()}updateAllowedTargets(e){e.length!==0&&(this._allowedTargets=e,e.includes(this._selectedTarget)||(this._selectedTarget=e[0],this._onDidChangeTarget.fire(this._selectedTarget)),this._container&&this._renderRadio())}_renderRadio(){if(!this._container||(this._renderDisposables.clear(),Rt(this._container),this._allowedTargets.length===0))return;let e=["copilotcli","copilot-cloud-agent"].filter(n=>this._allowedTargets.includes(n)),t=e.indexOf(this._selectedTarget),o=new g8({items:e.map(n=>({text:Qhn(n),isActive:n===this._selectedTarget}))});this._renderDisposables.add(o),this._container.appendChild(o.domNode),t>=0&&o.setActiveItem(t),this._renderDisposables.add(o.onDidSelect(n=>{let r=e[n];this._selectedTarget!==r&&(this._selectedTarget=r,this._onDidChangeTarget.fire(r))}))}};function Qhn(a){switch(a){case"local":case"copilotcli":return d(2925,null);case"copilot-cloud-agent":return d(2924,null);case"claude-code":return"Claude";case"openai-codex":return"Codex";case"copilot-growth":return"Growth"}}var T2e=class extends C{constructor(e){super();this.actionWidgetService=e;this._isolationMode="worktree";this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._renderDisposables=this._register(new P)}get isolationMode(){return this._isolationMode}setNewSession(e){this._newSession=e}setRepository(e){if(this._repository=e,e){let t=this._preferredIsolationMode;this._preferredIsolationMode=void 0,this._setMode(t??"worktree")}else this._isolationMode==="worktree"&&this._setMode("workspace");this._updateTriggerLabel()}render(e){this._renderDisposables.clear();let t=R(e,_(".sessions-chat-picker-slot"));this._slotElement=t,this._renderDisposables.add({dispose:()=>t.remove()});let o=R(t,_("a.action-label"));o.tabIndex=0,o.role="button",this._triggerElement=o,this._updateTriggerLabel(),this._renderDisposables.add(j(o,re.CLICK,n=>{$t.stop(n,!0),this._showPicker()})),this._renderDisposables.add(j(o,re.KEY_DOWN,n=>{(n.key==="Enter"||n.key===" ")&&($t.stop(n,!0),this._showPicker())}))}setPreferredIsolationMode(e){this._preferredIsolationMode=e}setIsolationMode(e){this._setMode(e)}setVisible(e){this._slotElement&&(this._slotElement.style.display=e?"":"none")}_showPicker(){if(!this._triggerElement||this.actionWidgetService.isVisible||!this._repository)return;let e=[{kind:"action",label:d(2926,null),group:{title:"",icon:M.folder},item:"workspace"},{kind:"action",label:d(2927,null),group:{title:"",icon:M.worktree},item:"worktree"}],t=this._triggerElement,o={onSelect:n=>{this.actionWidgetService.hide(),this._setMode(n)},onHide:()=>{t.focus()}};this.actionWidgetService.show("isolationModePicker",!1,e,o,this._triggerElement,void 0,[],{getAriaLabel:n=>n.label??"",getWidgetAriaLabel:()=>d(2928,null)})}_setMode(e){this._isolationMode!==e&&(this._isolationMode=e,this._newSession?.setIsolationMode(e),this._onDidChange.fire(e),this._updateTriggerLabel())}_updateTriggerLabel(){if(!this._triggerElement)return;Rt(this._triggerElement);let e=!this._repository,t=this._isolationMode==="worktree"?M.worktree:M.folder,o=this._isolationMode==="worktree"?d(2927,null):d(2926,null);R(this._triggerElement,Qo(t));let n=R(this._triggerElement,_("span.sessions-chat-dropdown-label"));n.textContent=o,R(this._triggerElement,Qo(M.chevronDown)),this._slotElement?.classList.toggle("disabled",e)}};T2e=I([m(0,nl)],T2e);var Yhn="copilot-worktree-",Xhn=10,_2e=class extends C{constructor(e){super();this.actionWidgetService=e;this._branches=[];this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._onDidChangeLoading=this._register(new E);this.onDidChangeLoading=this._onDidChangeLoading.event;this._renderDisposables=this._register(new P)}get selectedBranch(){return this._selectedBranch}setPreferredBranch(e){this._preferredBranch=e}setNewSession(e){this._newSession=e}async setRepository(e){if(this._branches=[],this._selectedBranch=void 0,!e){this._newSession?.setBranch(void 0),this._setLoading(!1),this._updateTriggerLabel();return}this._setLoading(!0);try{let t=await e.getRefs({pattern:"refs/heads"});this._branches=t.map(r=>r.name).filter(r=>!!r).filter(r=>!r.includes(Yhn));let o=this._preferredBranch;this._preferredBranch=void 0;let n=(o?this._branches.find(r=>r===o):void 0)??this._branches.find(r=>r===e.state.get().HEAD?.name)??this._branches.find(r=>r==="main")??this._branches.find(r=>r==="master")??this._branches[0];n&&this._selectBranch(n)}finally{this._setLoading(!1),this._updateTriggerLabel()}}render(e){this._renderDisposables.clear();let t=R(e,_(".sessions-chat-picker-slot"));this._slotElement=t,this._renderDisposables.add({dispose:()=>t.remove()});let o=R(t,_("a.action-label"));o.tabIndex=0,o.role="button",this._triggerElement=o,this._updateTriggerLabel(),this._renderDisposables.add(j(o,re.CLICK,n=>{$t.stop(n,!0),this.showPicker()})),this._renderDisposables.add(j(o,re.KEY_DOWN,n=>{(n.key==="Enter"||n.key===" ")&&($t.stop(n,!0),this.showPicker())}))}setVisible(e){this._slotElement&&(this._slotElement.style.display=e?"":"none")}showPicker(){if(!this._triggerElement||this.actionWidgetService.isVisible||this._branches.length===0)return;let e=this._buildItems(),t=this._triggerElement,o={onSelect:r=>{this.actionWidgetService.hide(),this._selectBranch(r.name)},onHide:()=>{t.focus()}},n=e.filter(r=>r.kind==="action").length;this.actionWidgetService.show("branchPicker",!1,e,o,this._triggerElement,void 0,[],{getAriaLabel:r=>r.label??"",getWidgetAriaLabel:()=>d(2868,null)},n>Xhn?{showFilter:!0,filterPlaceholder:d(2869,null)}:void 0)}_buildItems(){return this._branches.map(e=>({kind:"action",label:e,group:{title:"",icon:M.gitBranch},item:{name:e}}))}_selectBranch(e){this._selectedBranch!==e&&(this._selectedBranch=e,this._newSession?.setBranch(e),this._onDidChange.fire(e),this._updateTriggerLabel())}_updateTriggerLabel(){if(!this._triggerElement)return;Rt(this._triggerElement);let e=this._branches.length===0,t=this._selectedBranch??d(2870,null);R(this._triggerElement,Qo(M.gitBranch));let o=R(this._triggerElement,_("span.sessions-chat-dropdown-label"));o.textContent=t,R(this._triggerElement,Qo(M.chevronDown)),this._slotElement?.classList.toggle("disabled",e)}_setLoading(e){this._onDidChangeLoading.fire(e)}};_2e=I([m(0,nl)],_2e);var Jhn="git.sync",D2e=class extends C{constructor(e){super();this.commandService=e;this._visible=!0;this._syncing=!1;this._renderDisposables=this._register(new P);this._stateDisposables=this._register(new P)}setRepository(e){this._stateDisposables.clear(),this._repository=e,e?this._stateDisposables.add(he(t=>{e.state.read(t),this._update()})):this._update()}setBranch(e){this._selectedBranch=e,this._update()}render(e){this._renderDisposables.clear();let t=R(e,_(".sessions-chat-picker-slot.sessions-chat-sync-indicator"));this._slotElement=t,this._renderDisposables.add({dispose:()=>t.remove()});let o=R(t,_("a.action-label"));o.tabIndex=0,o.role="button",this._buttonElement=o,this._renderDisposables.add(j(o,re.CLICK,n=>{$t.stop(n,!0),this._executeSyncCommand()})),this._renderDisposables.add(j(o,re.KEY_DOWN,n=>{(n.key==="Enter"||n.key===" ")&&($t.stop(n,!0),this._executeSyncCommand())})),this._update()}setVisible(e){this._visible=e,this._update()}async _executeSyncCommand(){if(!this._syncing){this._syncing=!0,this._update();try{await this.commandService.executeCommand(Jhn,this._repository?.rootUri)}finally{this._syncing=!1,this._update()}}}_getAheadBehind(){if(!this._repository)return;let e=this._repository.state.get().HEAD;if(!e?.upstream||e.name!==this._selectedBranch)return;let t=e.ahead??0,o=e.behind??0;if(!(t===0&&o===0))return{ahead:t,behind:o}}_update(){if(!this._slotElement||!this._buttonElement)return;let e=this._getAheadBehind();if(!e&&!this._syncing||!this._visible){this._slotElement.style.display="none";return}if(this._slotElement.style.display="",Rt(this._buttonElement),R(this._buttonElement,Qo(this._syncing?q.modify(M.sync,"spin"):M.sync)),e){let t=[];e.behind>0&&t.push(`${e.behind}\u2193`),e.ahead>0&&t.push(`${e.ahead}\u2191`);let o=R(this._buttonElement,_("span.sessions-chat-dropdown-label"));o.textContent=t.join("\xA0")}this._buttonElement.title=d(2934,null,e?.behind??0,e?.ahead??0)}};D2e=I([m(0,ge)],D2e);var Zhn="github.copilot.chat.cloudSessions.openRepository",vDo="agentSessions.lastPickedRepo",CHi="agentSessions.recentlyPickedRepos",egn=10,tgn=10,L2e=class extends C{constructor(e,t,o){super();this.actionWidgetService=e;this.storageService=t;this.commandService=o;this._onDidSelectRepo=this._register(new E);this.onDidSelectRepo=this._onDidSelectRepo.event;this._renderDisposables=this._register(new P);this._browseGeneration=0;this._recentlyPickedRepos=[];try{let n=this.storageService.get(vDo,0);n&&(this._selectedRepo=JSON.parse(n))}catch{}try{let n=this.storageService.get(CHi,0);n&&(this._recentlyPickedRepos=JSON.parse(n))}catch{}}get selectedRepo(){return this._selectedRepo?.id}setNewSession(e){this._newSession=e,this._browseGeneration++,e&&this._selectedRepo&&this._setRepo(this._selectedRepo)}render(e){this._renderDisposables.clear();let t=R(e,_(".sessions-chat-picker-slot"));this._renderDisposables.add({dispose:()=>t.remove()});let o=R(t,_("a.action-label"));return o.tabIndex=0,o.role="button",this._triggerElement=o,this._updateTriggerLabel(),this._renderDisposables.add(j(o,re.CLICK,n=>{$t.stop(n,!0),this.showPicker()})),this._renderDisposables.add(j(o,re.KEY_DOWN,n=>{(n.key==="Enter"||n.key===" ")&&($t.stop(n,!0),this.showPicker())})),t}showPicker(){if(!this._triggerElement||this.actionWidgetService.isVisible)return;let e=this._buildItems(),t=e.filter(r=>r.kind==="action").length>tgn,o=this._triggerElement,n={onSelect:r=>{this.actionWidgetService.hide(),r.id==="browse"?this._browseForRepo():this._selectRepo(r)},onHide:()=>{o.focus()}};this.actionWidgetService.show("repoPicker",!1,e,n,this._triggerElement,void 0,[],{getAriaLabel:r=>r.label??"",getWidgetAriaLabel:()=>d(2900,null)},t?{showFilter:!0,filterPlaceholder:d(2901,null)}:void 0)}setSelectedRepo(e){this._selectRepo({id:e,name:e})}clearSelection(){this._selectedRepo=void 0,this._updateTriggerLabel()}_selectRepo(e){this._selectedRepo=e,this._addToRecentlyPicked(e),this.storageService.store(vDo,JSON.stringify(e),0,1),this._updateTriggerLabel(),this._setRepo(e),this._onDidSelectRepo.fire(e.id)}async _browseForRepo(){let e=this._browseGeneration;try{let t=await this.commandService.executeCommand(Zhn);t&&e===this._browseGeneration&&this._selectRepo({id:t,name:t})}catch{}}_addToRecentlyPicked(e){this._recentlyPickedRepos=[{id:e.id,name:e.name},...this._recentlyPickedRepos.filter(t=>t.id!==e.id)].slice(0,egn),this.storageService.store(CHi,JSON.stringify(this._recentlyPickedRepos),0,1)}_buildItems(){let e=new Set,t=[];this._selectedRepo&&(e.add(this._selectedRepo.id),t.push({kind:"action",label:this._selectedRepo.name,group:{title:"",icon:M.repo},item:this._selectedRepo}));let o=this._recentlyPickedRepos.filter(n=>!e.has(n.id));o.sort((n,r)=>n.name.localeCompare(r.name));for(let n of o)e.add(n.id),t.push({kind:"action",label:n.name,group:{title:"",icon:M.repo},item:n,onRemove:()=>this._removeRepo(n.id)});return t.length>0&&t.push({kind:"separator",label:""}),t.push({kind:"action",label:d(2898,null),group:{title:"",icon:M.search},item:{id:"browse",name:d(2898,null)}}),t}_removeRepo(e){this._recentlyPickedRepos=this._recentlyPickedRepos.filter(t=>t.id!==e),this.storageService.store(CHi,JSON.stringify(this._recentlyPickedRepos),0,1),this.actionWidgetService.hide(),this.showPicker()}_updateTriggerLabel(){if(!this._triggerElement)return;Rt(this._triggerElement);let e=this._selectedRepo?.name??d(2899,null);R(this._triggerElement,Qo(M.repo));let t=R(this._triggerElement,_("span.sessions-chat-dropdown-label"));t.textContent=e,R(this._triggerElement,Qo(M.chevronDown))}_setRepo(e){this._newSession?.setRepoUri(A.parse(`${WH}://github/${e.id}/HEAD`))}};L2e=I([m(0,nl),m(1,le),m(2,ge)],L2e);var ign=10,R2e=class extends C{constructor(e){super();this.actionWidgetService=e;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._renderDisposables=this._register(new P);this._sessionDisposables=this._register(new P);this._models=[]}get selectedModel(){return this._selectedModel}setSession(e){this._session=e,this._sessionDisposables.clear(),this._loadModels(e),this._selectedModel&&(e.setModelId(this._selectedModel.id),e.setOptionValue("models",{id:this._selectedModel.id,name:this._selectedModel.name})),this._sessionDisposables.add(e.onDidChangeOptionGroups(()=>{this._loadModels(e)}))}render(e){this._renderDisposables.clear();let t=R(e,_(".sessions-chat-picker-slot"));this._slotElement=t,this._renderDisposables.add({dispose:()=>t.remove()});let o=R(t,_("a.action-label"));return o.tabIndex=0,o.role="button",this._triggerElement=o,this._updateTriggerLabel(),this._renderDisposables.add(j(o,re.CLICK,n=>{$t.stop(n,!0),this._showPicker()})),this._renderDisposables.add(j(o,re.KEY_DOWN,n=>{(n.key==="Enter"||n.key===" ")&&($t.stop(n,!0),this._showPicker())})),t}setVisible(e){this._slotElement&&(this._slotElement.style.display=e?"":"none")}_loadModels(e){let t=e.getModelOptionGroup();if(t?.group.items.length){if(this._models=t.group.items.map(o=>({id:o.id,name:o.name,description:o.description})),!this._selectedModel||!this._models.some(o=>o.id===this._selectedModel.id)){let o=t.value;this._selectedModel=o?{id:o.id,name:o.name,description:o.description}:this._models[0]}}else this._models=[];this._updateTriggerLabel()}_showPicker(){if(!this._triggerElement||this.actionWidgetService.isVisible||this._models.length===0)return;let e=this._buildItems(),t=e.filter(r=>r.kind==="action").length>ign,o=this._triggerElement,n={onSelect:r=>{this.actionWidgetService.hide(),this._selectModel(r)},onHide:()=>{o.focus()}};this.actionWidgetService.show("remoteModelPicker",!1,e,n,this._triggerElement,void 0,[],{getAriaLabel:r=>r.label??"",getWidgetAriaLabel:()=>d(2882,null)},t?{showFilter:!0,filterPlaceholder:d(2884,null)}:void 0)}_buildItems(){return this._models.map(e=>({kind:"action",label:e.name,group:{title:"",icon:this._selectedModel?.id===e.id?M.check:M.blank},item:e}))}_selectModel(e){this._selectedModel=e,this._updateTriggerLabel(),this._session&&(this._session.setModelId(e.id),this._session.setOptionValue("models",{id:e.id,name:e.name})),this._onDidChange.fire({id:e.id,name:e.name,description:e.description})}_updateTriggerLabel(){if(!this._triggerElement)return;Rt(this._triggerElement);let e=this._selectedModel?.name??d(2883,null),t=R(this._triggerElement,_("span.sessions-chat-dropdown-label"));t.textContent=e,R(this._triggerElement,Qo(M.chevronDown)),this._slotElement?.classList.toggle("disabled",this._models.length===0)}};R2e=I([m(0,nl)],R2e);var bDo="sessions.chat.executeSlashCommand";qe.registerCommand(bDo,(a,i,e)=>{i.tryExecuteSlashCommand(e),i.clearInput()});var rx=class extends C{constructor(e,t,o,n,r,s,l){super();this._editor=e;this.commandService=t;this.codeEditorService=o;this.languageFeaturesService=n;this.themeService=r;this.aiCustomizationWorkspaceService=s;this.promptsService=l;this._slashCommands=[];this._cachedPromptCommands=[];this._registerSlashCommands(),this._registerCompletions(),this._registerDecorations(),this._refreshPromptCommands(),this._register(this.promptsService.onDidChangeSlashCommands(()=>this._refreshPromptCommands()))}static{this._slashDecoType="sessions-slash-command"}static{this._slashPlaceholderDecoType="sessions-slash-placeholder"}static{this._slashDecosRegistered=!1}clearInput(){this._editor.getModel()?.setValue("")}_refreshPromptCommands(){this.aiCustomizationWorkspaceService.getFilteredPromptSlashCommands(ve.None).then(e=>{this._cachedPromptCommands=e,this._updateDecorations()},()=>{})}tryExecuteSlashCommand(e){let t=e.match(/^\/([\w\p{L}\d_\-\.:]+)\s*(.*)/su);if(!t)return!1;let o=t[1],n=this._slashCommands.find(r=>r.command===o);return n?(n.execute(t[2]?.trim()??""),!0):!1}tryExpandPromptSlashCommand(e){let t=e.match(/^\/([\w\p{L}\d_\-\.:]+)\s*(.*)/su);if(!t)return;let o=t[1],n=this._cachedPromptCommands.find(u=>u.name===o);if(!n)return;let r=t[2]?.trim()??"",s=n.promptPath.uri,c=`Use the ${n.promptPath.type==="skill"?"skill":"prompt file"} located at [${n.name}](${s.toString()}).`;return r?`${c} ${r}`:c}_registerSlashCommands(){let e=t=>()=>this.commandService.executeCommand(IKt.OpenEditor,t);this._slashCommands.push({command:"agents",detail:d(2929,null),sortText:"z3_agents",executeImmediately:!0,execute:e(kn.Agents)}),this._slashCommands.push({command:"skills",detail:d(2933,null),sortText:"z3_skills",executeImmediately:!0,execute:e(kn.Skills)}),this._slashCommands.push({command:"instructions",detail:d(2931,null),sortText:"z3_instructions",executeImmediately:!0,execute:e(kn.Instructions)}),this._slashCommands.push({command:"prompts",detail:d(2932,null),sortText:"z3_prompts",executeImmediately:!0,execute:e(kn.Prompts)}),this._slashCommands.push({command:"hooks",detail:d(2930,null),sortText:"z3_hooks",executeImmediately:!0,execute:e(kn.Hooks)})}_registerDecorations(){rx._slashDecosRegistered||(rx._slashDecosRegistered=!0,this.codeEditorService.registerDecorationType("sessions-chat",rx._slashDecoType,{color:If(y3),backgroundColor:If(I3),borderRadius:"3px"}),this.codeEditorService.registerDecorationType("sessions-chat",rx._slashPlaceholderDecoType,{})),this._register(this._editor.onDidChangeModelContent(()=>this._updateDecorations())),this._updateDecorations()}_updateDecorations(){let e=this._editor.getModel(),t=e?.getValue()??"",o=t.match(/^\/([\w\p{L}\d_\-\.:]+)\s?/u);if(!o){this._editor.setDecorationsByType("sessions-chat",rx._slashDecoType,[]),this._editor.setDecorationsByType("sessions-chat",rx._slashPlaceholderDecoType,[]);return}let n=o[1],r=this._slashCommands.find(h=>h.command===n),s=this._cachedPromptCommands.find(h=>h.name===n);if(!r&&!s){this._editor.setDecorationsByType("sessions-chat",rx._slashDecoType,[]),this._editor.setDecorationsByType("sessions-chat",rx._slashPlaceholderDecoType,[]);return}let c=[{range:{startLineNumber:1,startColumn:1,endLineNumber:1,endColumn:o[0].trimEnd().length+1}}];this._editor.setDecorationsByType("sessions-chat",rx._slashDecoType,c);let u=t.slice(o[0].length).trim(),p=r?.detail??s?.description;if(!u&&p){let g=[{range:{startLineNumber:1,startColumn:o[0].length+1,endLineNumber:1,endColumn:e.getLineMaxColumn(1)},renderOptions:{after:{contentText:p,color:this._getPlaceholderColor()}}}];this._editor.setDecorationsByType("sessions-chat",rx._slashPlaceholderDecoType,g)}else this._editor.setDecorationsByType("sessions-chat",rx._slashPlaceholderDecoType,[])}_getPlaceholderColor(){return this.themeService.getColorTheme().getColor(u9)?.toString()}_registerCompletions(){let e=this._editor.getModel()?.uri;e&&(this._register(this.languageFeaturesService.completionProvider.register({scheme:e.scheme,hasAccessToAllModels:!0},{_debugDisplayName:"sessionsSlashCommands",triggerCharacters:["/"],provideCompletionItems:(t,o,n,r)=>{let s=this._computeCompletionRanges(t,o,/\/\w*/g);return!s||t.getValueInRange(new z(1,1,s.replace.startLineNumber,s.replace.startColumn)).trim()!==""?null:{suggestions:this._slashCommands.map((c,u)=>{let p=`/${c.command}`;return{label:p,insertText:c.executeImmediately?"":`${p} `,detail:c.detail,range:s,sortText:c.sortText??"a".repeat(u+1),kind:18,command:c.executeImmediately?{id:bDo,title:p,arguments:[this,p]}:void 0}})}}})),this._register(this.languageFeaturesService.completionProvider.register({scheme:e.scheme,hasAccessToAllModels:!0},{_debugDisplayName:"sessionsPromptSlashCommands",triggerCharacters:["/"],provideCompletionItems:async(t,o,n,r)=>{let s=this._computeCompletionRanges(t,o,/\/[\p{L}0-9_.:-]*/gu);if(!s||t.getValueInRange(new z(1,1,s.replace.startLineNumber,s.replace.startColumn)).trim()!=="")return null;let u=(await this.aiCustomizationWorkspaceService.getFilteredPromptSlashCommands(r)).filter(p=>p.parsedPromptFile?.header?.userInvocable!==!1);return u.length===0?null:{suggestions:u.map((p,h)=>{let g=`/${p.name}`;return{label:{label:g,description:p.description},insertText:`${g} `,documentation:p.description,range:s,sortText:"b".repeat(h+1),kind:18}})}}})))}_computeCompletionRanges(e,t,o){let n=My(t.column,o,e.getLineContent(t.lineNumber),0);if(!n&&e.getWordUntilPosition(t).word||!n&&t.column>1&&e.getValueInRange(new z(t.lineNumber,t.column-1,t.lineNumber,t.column))!==" ")return;let r,s;return n?(r=new z(t.lineNumber,n.startColumn,t.lineNumber,t.column),s=new z(t.lineNumber,n.startColumn,t.lineNumber,n.endColumn)):r=s=z.fromPositions(t),{insert:r,replace:s}}};rx=I([m(1,ge),m(2,Kt),m(3,zt),m(4,De),m(5,lf),m(6,nr)],rx);var xHi="sessions.draftState",SDo=50,ogn=200,Cut=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this.instantiationService=t;this.modelService=o;this.configurationService=n;this.languageModelsService=r;this.contextKeyService=s;this.logService=l;this.hoverService=c;this.sessionsManagementService=u;this.gitService=p;this.storageService=h;this.workspaceTrustRequestService=g;this._onDidFocus=this._register(new E);this.onDidFocus=this._onDidFocus.event;this._onDidBlur=this._register(new E);this.onDidBlur=this._onDidBlur.event;this._currentLanguageModel=Le("currentLanguageModel",void 0);this._modelPickerDisposable=this._register(new me);this._newSession=this._register(new me);this._newSessionListener=this._register(new me);this._sending=!1;this._altKeyDown=!1;this._openRepositoryCts=this._register(new me);this._repositoryLoading=!1;this._branchLoading=!1;this._loadingDelayDisposable=this._register(new me);this._toolbarPickerWidgets=new Map;this._toolbarPickerDisposables=this._register(new P);this._optionEmitters=new Map;this._optionContextKeys=new Map;this._draftState={inputText:"",attachments:[],mode:{id:"agent",kind:"agent"},selectedModel:void 0,selections:[],contrib:{}};this._history=this._register(this.instantiationService.createInstance(dee,"panel")),this._contextAttachments=this._register(this.instantiationService.createInstance(k2e)),this._folderPicker=this._register(this.instantiationService.createInstance(E2e)),this._repoPicker=this._register(this.instantiationService.createInstance(L2e)),this._cloudModelPicker=this._register(this.instantiationService.createInstance(R2e)),this._targetPicker=this._register(new E6t(e.allowedTargets,this._resolveDefaultTarget(e))),this._isolationModePicker=this._register(this.instantiationService.createInstance(T2e)),this._branchPicker=this._register(this.instantiationService.createInstance(_2e)),this._syncIndicator=this._register(this.instantiationService.createInstance(D2e)),this._options=e,this._register(this._targetPicker.onDidChangeTarget(f=>{this._createNewSession();let v=f==="copilotcli";this._isolationModePicker.setVisible(v),this._branchPicker.setVisible(v),this._syncIndicator.setVisible(v),this._updateDraftState(),this._focusEditor()})),this._register(this._branchPicker.onDidChangeLoading(f=>{this._branchLoading=f,this._updateInputLoadingState()})),this._register(this._branchPicker.onDidChange(f=>{this._syncIndicator.setBranch(f),this._updateDraftState(),this._focusEditor()})),this._register(this._folderPicker.onDidSelectFolder(async f=>{await this._requestFolderTrust(f)&&this._newSession.value?.setRepoUri(f),this._updateDraftState(),this._focusEditor()})),this._register(this._isolationModePicker.onDidChange(f=>{this._branchPicker.setVisible(f==="worktree"),this._syncIndicator.setVisible(f==="worktree"),this._updateDraftState(),this._focusEditor()})),this._register(this._repoPicker.onDidSelectRepo(()=>{this._updateDraftState()})),this._register(this.languageModelsService.onDidChangeLanguageModels(()=>{this._initDefaultModel()})),this._register(this._contextAttachments.onDidChangeContext(()=>{this._updateDraftState(),this._focusEditor()})),this._register(he(f=>{this._currentLanguageModel.read(f),this._updateDraftState()}))}get element(){return this._editorContainer}render(e){let t=R(e,_(".sessions-chat-widget")),o=R(e,_(".sessions-chat-editor-overflow.monaco-editor"));this._register({dispose:()=>o.remove()});let n=R(t,_(".chat-full-welcome")),r=R(n,_(".chat-full-welcome-header"));R(r,_(".chat-full-welcome-letterpress")),this._pickersContainer=R(n,_(".chat-full-welcome-pickers-container")),this._inputSlot=R(n,_(".chat-full-welcome-inputSlot"));let s=_(".sessions-chat-input-area");this._contextAttachments.registerDropTarget(t),this._contextAttachments.registerPasteHandler(s);let l=R(s,_(".sessions-chat-attach-row")),c=R(l,_(".sessions-chat-attached-context"));this._contextAttachments.renderAttachedContext(c),this._createEditor(s,o),this._createBottomToolbar(s),this._inputSlot.appendChild(s);let u=R(n,_(".chat-full-welcome-local-mode"));this._isolationModePicker.render(u),R(u,_(".sessions-chat-local-mode-spacer"));let p=R(u,_(".sessions-chat-local-mode-right"));this._branchPicker.render(p),this._syncIndicator.render(p);let h=this._targetPicker.selectedTarget==="copilotcli",g=this._isolationModePicker.isolationMode==="worktree";this._isolationModePicker.setVisible(h),this._branchPicker.setVisible(h&&g),this._syncIndicator.setVisible(h&&g),this._renderOptionGroupPickers(),this._initDefaultModel(),this._restoreState(),this._createNewSession(),n.classList.add("revealed"),this._register(j(this._inputSlot,"animationend",()=>{this._editor?.layout()},{once:!0}))}async _createNewSession(){let e=this._targetPicker.selectedTarget,t=this._folderPicker.selectedFolderUri;e==="copilotcli"&&t&&(await this._requestFolderTrust(t)||(t=void 0));let o=vRi({type:e,position:this._options.sessionPosition??"sidebar",displayName:""});try{let n=await this.sessionsManagementService.createNewSessionForTarget(e,o,t);this._setNewSession(n)}catch(n){this.logService.error("Failed to create new session:",n)}}_setNewSession(e){this._newSession.value=e,this._targetPicker.selectedTarget==="copilotcli"?(this._isolationModePicker.setNewSession(e),this._branchPicker.setNewSession(e),this._repoPicker.setNewSession(void 0)):(this._isolationModePicker.setNewSession(void 0),this._branchPicker.setNewSession(void 0),this._repoPicker.setNewSession(e));let o=this._currentLanguageModel.get();o&&e.setModelId(o.identifier),e.repoUri&&this._openRepository(e.repoUri);let n=new P;n.add(e.onDidChange(r=>{r==="repoUri"&&e.repoUri&&this._openRepository(e.repoUri),r==="isolationMode"&&this._branchPicker.setVisible(e.isolationMode==="worktree"),r==="disabled"&&this._updateSendButtonState()})),e instanceof ore?(this._renderRemoteSessionPickers(e,!0),n.add(e.onDidChangeOptionGroups(()=>{this._renderRemoteSessionPickers(e)}))):this._renderLocalSessionPickers(),this._newSessionListener.value=n,this._updateSendButtonState()}_openRepository(e){this._openRepositoryCts.value?.cancel();let t=this._openRepositoryCts.value=new $e;this._repositoryLoading=!0,this._updateInputLoadingState(),this._branchPicker.setRepository(void 0),this._isolationModePicker.setRepository(void 0),this._syncIndicator.setRepository(void 0),this.gitService.openRepository(e).then(o=>{t.token.isCancellationRequested||(this._repositoryLoading=!1,this._updateInputLoadingState(),this._isolationModePicker.setRepository(o),this._branchPicker.setRepository(o),this._syncIndicator.setRepository(o))}).catch(o=>{t.token.isCancellationRequested||(this.logService.warn(`Failed to open repository at ${e.toString()}`,Cn(o)),this._repositoryLoading=!1,this._updateInputLoadingState(),this._isolationModePicker.setRepository(void 0),this._branchPicker.setRepository(void 0),this._syncIndicator.setRepository(void 0))})}_updateInputLoadingState(){if(this._repositoryLoading||this._branchLoading||this._sending){if(!this._loadingDelayDisposable.value){let t=setTimeout(()=>{this._loadingDelayDisposable.clear(),(this._repositoryLoading||this._branchLoading||this._sending)&&this._loadingSpinner?.classList.add("visible")},500);this._loadingDelayDisposable.value=Z(()=>clearTimeout(t))}}else this._loadingDelayDisposable.clear(),this._loadingSpinner?.classList.remove("visible")}_createEditor(e,t){let o=this._editorContainer=R(e,_(".sessions-chat-editor"));o.style.height=`${SDo}px`;let n=this._register(this.contextKeyService.createScoped(e)),{historyNavigationBackwardsEnablement:r,historyNavigationForwardsEnablement:s}=this._register(qM(n,this));this._historyNavigationBackwardsEnablement=r,this._historyNavigationForwardsEnablement=s;let l=this._register(this.instantiationService.createChild(new Io([X,n]))),c=A.from({scheme:"sessions-chat",path:`input-${Date.now()}`}),u=this._register(this.modelService.createModel("",null,c,!0)),p={...Kf(this.configurationService),readOnly:!1,ariaLabel:d(2893,null),placeholder:d(2894,null),fontFamily:"system-ui, -apple-system, sans-serif",fontSize:13,lineHeight:20,padding:{top:8,bottom:2},wrappingStrategy:"advanced",stickyScroll:{enabled:!1},renderWhitespace:"none",overflowWidgetsDomNode:t,suggest:{showIcons:!1,showSnippets:!1,showWords:!0,showStatusBar:!1,insertMode:"insert"}},h={isSimpleWidget:!0,contributions:aa.getSomeEditorContributions([Hm.ID,El.ID,Qr.ID])};this._editor=this._register(l.createInstance(jr,o,p,h)),this._editor.setModel(u),El.get(this._editor)?.forceRenderingAbove(),this._register(this._editor.onDidFocusEditorWidget(()=>this._onDidFocus.fire())),this._register(this._editor.onDidBlurEditorWidget(()=>this._onDidBlur.fire())),this._register(this._editor.onKeyDown(v=>{if(v.keyCode===3&&!v.shiftKey&&!v.ctrlKey&&!v.altKey){if(this._editor.contextKeyService.getContextKeyValue("suggestWidgetVisible"))return;v.preventDefault(),v.stopPropagation(),this._send()}v.keyCode===3&&!v.shiftKey&&!v.ctrlKey&&v.altKey&&(v.preventDefault(),v.stopPropagation(),this._send({openNewAfterSend:!0}))}));let g=()=>{let v=this._editor.getModel(),b=this._editor.getPosition();!v||!b||(this._historyNavigationBackwardsEnablement.set(b.lineNumber===1&&b.column===1),this._historyNavigationForwardsEnablement.set(b.lineNumber===v.getLineCount()&&b.column===v.getLineMaxColumn(b.lineNumber)))};this._register(this._editor.onDidChangeCursorPosition(()=>g())),g();let f=-1;this._register(this._editor.onDidContentSizeChange(v=>{if(!v.contentHeightChanged)return;let b=this._editor.getContentHeight(),S=Math.min(ogn,Math.max(SDo,b));S!==f&&(f=S,this._editorContainer.style.height=`${S}px`,this._editor.layout())})),this._slashCommandHandler=this._register(this.instantiationService.createInstance(rx,this._editor)),this._register(this._editor.onDidChangeModelContent(()=>{this._updateDraftState(),this._updateSendButtonState()}))}_focusEditor(){this._editor?.focus()}_createAttachButton(e){let t=R(e,_(".sessions-chat-attach-button"));t.tabIndex=0,t.role="button",t.title=d(2892,null),t.ariaLabel=d(2892,null),R(t,Qo(M.add)),this._register(j(t,re.CLICK,()=>{this._contextAttachments.showPicker(this._getContextFolderUri())}))}_getContextFolderUri(){if(this._targetPicker.selectedTarget==="copilotcli")return this._folderPicker.selectedFolderUri;let t=this._repoPicker.selectedRepo;if(t&&t.includes("/"))return A.from({scheme:WH,authority:"github",path:`/${t}/HEAD`})}_createBottomToolbar(e){let t=R(e,_(".sessions-chat-toolbar"));this._createAttachButton(t),this._localModelPickerContainer=R(t,_(".sessions-chat-model-picker")),this._createLocalModelPicker(this._localModelPickerContainer),this._cloudModelPicker.render(t),this._cloudModelPicker.setVisible(!1),this._toolbarPickersContainer=R(t,_(".sessions-chat-toolbar-pickers")),R(t,_(".sessions-chat-toolbar-spacer")),this._loadingSpinner=R(t,_(".sessions-chat-loading-spinner")),this._register(this.hoverService.setupManagedHover(Ni("mouse"),this._loadingSpinner,d(2895,null)));let o=R(t,_(".sessions-chat-send-button")),n=this._sendButton=this._register(new Mi(o,{secondary:!0,title:d(2896,null),ariaLabel:d(2896,null)}));n.icon=M.send,this._register(n.onDidClick(()=>this._send({openNewAfterSend:this._altKeyDown}))),this._register(j(Me(e),re.KEY_DOWN,r=>{r.key==="Alt"&&(this._altKeyDown=!0,n.icon=M.runAbove)})),this._register(j(Me(e),re.KEY_UP,r=>{r.key==="Alt"&&(this._altKeyDown=!1,n.icon=M.send)})),this._updateSendButtonState()}_createLocalModelPicker(e){let t={currentModel:this._currentLanguageModel,setModel:s=>{this._currentLanguageModel.set(s,void 0),this._newSession.value?.setModelId(s.identifier),this._focusEditor()},getModels:()=>this._getAvailableModels(),canManageModels:()=>!1},o={hideChevrons:Le("hideChevrons",!1),hoverPosition:{hoverPosition:3}},n={id:"sessions.modelPicker",label:"",enabled:!0,class:void 0,tooltip:"",run:()=>{}},r=this.instantiationService.createInstance(rte,n,t,o);this._modelPickerDisposable.value=r,r.render(e)}_initDefaultModel(){let e=this._getAvailableModels(),o=this._getDraftState()?.selectedModel?.identifier??this._history.values.at(-1)?.selectedModel?.identifier,n=(o?e.find(r=>r.identifier===o):void 0)??e[0];this._currentLanguageModel.set(n,void 0)}_getAvailableModels(){return this.languageModelsService.getLanguageModelIds().map(e=>{let t=this.languageModelsService.lookupLanguageModel(e);return t?{metadata:t,identifier:e}:void 0}).filter(e=>!!e&&e.metadata.targetChatSessionType==="copilotcli")}_renderOptionGroupPickers(){if(!this._pickersContainer)return;this._clearAllPickers(),Rt(this._pickersContainer);let e=R(this._pickersContainer,_(".chat-full-welcome-pickers")),t=R(e,_(".sessions-chat-pickers-left-half")),o=R(t,_(".sessions-chat-dropdown-wrapper"));this._targetPicker.render(o);let n=R(e,_(".sessions-chat-pickers-right-half"));this._extensionPickersLeftContainer=R(n,_(".sessions-chat-pickers-left-separator")),this._extensionPickersLeftContainer.style.display="none",this._repoPickerContainer=R(n,_(".sessions-chat-extension-pickers-right")),this._repoPickerContainer.style.display="none",this._repoPicker.render(this._repoPickerContainer),this._folderPickerContainer=this._folderPicker.render(n),this._folderPickerContainer.style.display="none"}_renderLocalSessionPickers(){this._clearAllPickers(),this._folderPickerContainer&&(this._folderPickerContainer.style.display=""),this._extensionPickersLeftContainer&&(this._extensionPickersLeftContainer.style.display="block"),this._localModelPickerContainer&&(this._localModelPickerContainer.style.display=""),this._cloudModelPicker.setVisible(!1)}_renderRemoteSessionPickers(e,t){this._repoPickerContainer&&(this._folderPickerContainer&&(this._folderPickerContainer.style.display="none"),this._localModelPickerContainer&&(this._localModelPickerContainer.style.display="none"),this._cloudModelPicker.setSession(e),this._cloudModelPicker.setVisible(!0),this._extensionPickersLeftContainer&&(this._extensionPickersLeftContainer.style.display="block"),this._repoPickerContainer.style.display="",this._renderToolbarPickers(e,t))}_renderToolbarPickers(e,t){if(!this._toolbarPickersContainer)return;let n=e.getOtherOptionGroups().filter(r=>{let s=r.group;return s.items.length>0||(s.commands||[]).length>0||!!s.searchable});if(n.length===0){this._clearToolbarPickers();return}if(!(!t&&n.length===this._toolbarPickerWidgets.size&&n.every(s=>this._toolbarPickerWidgets.has(s.group.id)))){this._clearToolbarPickers();for(let r of n)this._renderToolbarPickerWidget(r,e)}}_renderToolbarPickerWidget(e,t){let{group:o,value:n}=e;n&&this._updateOptionContextKey(o.id,n.id);let r={group:o,item:n},s=this._getOrCreateOptionEmitter(o.id),l={getCurrentOption:()=>t.getOptionValue(o.id)??n,onDidChangeOption:s.event,setOption:h=>{this._updateOptionContextKey(o.id,h.id),s.fire(h),t.setOptionValue(o.id,h),this._focusEditor()},getOptionGroup:()=>{let h=t.getModelOptionGroup();return h?.group.id===o.id?h.group:t.getOtherOptionGroups().find(g=>g.group.id===o.id)?.group},getSessionResource:()=>t.resource},c=pi({id:o.id,label:o.name,run:()=>{}}),u=this.instantiationService.createInstance(o.searchable?f2:g2,c,r,l);this._toolbarPickerDisposables.add(u),this._toolbarPickerWidgets.set(o.id,u);let p=R(this._toolbarPickersContainer,_(".sessions-chat-picker-slot"));u.render(p)}_updateOptionContextKey(e,t){let o=this._optionContextKeys.get(e);o||(o=new Q(`chatSessionOption.${e}`,"").bindTo(this.contextKeyService),this._optionContextKeys.set(e,o)),o.set(t.trim())}_getOrCreateOptionEmitter(e){let t=this._optionEmitters.get(e);return t||(t=new E,this._optionEmitters.set(e,t),this._toolbarPickerDisposables.add(t)),t}_clearToolbarPickers(){this._toolbarPickerDisposables.clear(),this._toolbarPickerWidgets.clear(),this._optionEmitters.clear(),this._toolbarPickersContainer&&Rt(this._toolbarPickersContainer)}_clearAllPickers(){this._clearToolbarPickers(),this._folderPickerContainer&&(this._folderPickerContainer.style.display="none"),this._repoPickerContainer&&(this._repoPickerContainer.style.display="none"),this._extensionPickersLeftContainer&&(this._extensionPickersLeftContainer.style.display="none")}showPreviousValue(){this._history.isAtStart()||((this._draftState?.inputText||this._draftState?.attachments.length)&&this._history.overlay(this._draftState),this._navigateHistory(!0))}showNextValue(){this._history.isAtEnd()||((this._draftState?.inputText||this._draftState?.attachments.length)&&this._history.overlay(this._draftState),this._navigateHistory(!1))}_updateDraftState(){let e=[...this._contextAttachments.attachments];this._draftState={inputText:this._editor?.getModel()?.getValue()??"",attachments:e,mode:{id:"agent",kind:"agent"},selectedModel:this._currentLanguageModel.get(),selections:this._editor?.getSelections()??[],contrib:{},target:this._targetPicker.selectedTarget,isolationMode:this._isolationModePicker.isolationMode,branch:this._branchPicker.selectedBranch,folderUri:this._folderPicker.selectedFolderUri?.toString(),repo:this._repoPicker.selectedRepo}}_navigateHistory(e){let t=e?this._history.previous():this._history.next(),o=t?.inputText??"";if(t&&(this._editor?.getModel()?.setValue(o),this._contextAttachments.setAttachments(t.attachments)),Or(o),e)this._editor.setPosition({lineNumber:1,column:1});else{let n=this._editor.getModel();if(n){let r=n.getLineCount();this._editor.setPosition({lineNumber:r,column:n.getLineMaxColumn(r)})}}}_updateSendButtonState(){if(!this._sendButton)return;let e=!!this._editor?.getModel()?.getValue().trim();this._sendButton.enabled=!this._sending&&e&&!(this._newSession.value?.disabled??!0)}async _send(e){let t=this._editor.getModel()?.getValue().trim(),o=this._newSession.value;if(!t||!o||this._sending)return;if(o.disabled){this._hasRequiredRepoOrFolderSelection(o.target)||this._openRepoOrFolderPicker(o.target);return}if(this._slashCommandHandler?.tryExecuteSlashCommand(t)){this._editor.getModel()?.setValue("");return}let n=this._slashCommandHandler?.tryExpandPromptSlashCommand(t);n&&(t=n),o.setQuery(t),o.setAttachedContext(this._contextAttachments.attachments.length>0?[...this._contextAttachments.attachments]:void 0),this._draftState&&this._history.append(this._draftState),this._clearDraftState(),this._sending=!0,this._editor.updateOptions({readOnly:!0}),this._updateSendButtonState(),this._updateInputLoadingState();try{await this.sessionsManagementService.sendRequestForNewSession(o.resource,e?.openNewAfterSend?{openNewSessionView:!0}:void 0),this._newSessionListener.clear(),this._contextAttachments.clear()}catch(r){this.logService.error("Failed to send request:",r)}this._sending=!1,this._editor.updateOptions({readOnly:!1}),this._updateSendButtonState(),this._updateInputLoadingState()}_hasRequiredRepoOrFolderSelection(e){return e==="local"||e==="copilotcli"?!!this._folderPicker.selectedFolderUri:!!this._repoPicker.selectedRepo}_openRepoOrFolderPicker(e){e==="local"||e==="copilotcli"?this._folderPicker.showPicker():this._repoPicker.showPicker()}async _requestFolderTrust(e){let t=await this.workspaceTrustRequestService.requestResourcesTrust({uri:e,message:d(2897,null)});if(!t){this._folderPicker.removeFromRecents(e);let o=this._newSession.value?.repoUri;o?this._folderPicker.setSelectedFolder(o):this._folderPicker.clearSelection()}return!!t}_resolveDefaultTarget(e){let t=this._getDraftState();return t?.target&&e.allowedTargets.includes(t.target)?t.target:e.defaultTarget}_restoreState(){let e=this._getDraftState();if(e){if(this._editor?.getModel()?.setValue(e.inputText),e.attachments?.length&&this._contextAttachments.setAttachments(e.attachments.map(uV.fromExport)),e.selectedModel){let o=this._getAvailableModels().find(n=>n.identifier===e.selectedModel?.identifier);o&&this._currentLanguageModel.set(o,void 0)}if(e.isolationMode&&(this._isolationModePicker.setPreferredIsolationMode(e.isolationMode),this._isolationModePicker.setIsolationMode(e.isolationMode)),e.branch&&this._branchPicker.setPreferredBranch(e.branch),e.folderUri)try{this._folderPicker.setSelectedFolder(A.parse(e.folderUri))}catch{}e.repo&&this._repoPicker.setSelectedRepo(e.repo)}}_getDraftState(){let e=this.storageService.get(xHi,1);if(e)try{return JSON.parse(e)}catch{return}}_clearDraftState(){this._draftState=void 0,this.storageService.remove(xHi,1)}saveState(){if(this._draftState){let e={...this._draftState,attachments:this._draftState.attachments.map(uV.toExport)};this.storageService.store(xHi,JSON.stringify(e),1,1)}}layout(e,t){this._editor?.layout()}focusInput(){this._editor?.focus()}updateAllowedTargets(e){this._targetPicker.updateAllowedTargets(e)}};Cut=I([m(1,F),m(2,Ct),m(3,B),m(4,Wr),m(5,X),m(6,ne),m(7,tt),m(8,du),m(9,tJ),m(10,le),m(11,Vd)],Cut);var IDo="workbench.view.sessions.chat",M2e=class extends zr{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,t,o,n,r,s,l,c,u,p);this.workspaceContextService=h}renderBody(e){super.renderBody(e),this._widget=this._register(this.instantiationService.createInstance(Cut,{allowedTargets:this.computeAllowedTargets(),defaultTarget:"copilotcli"})),this._widget.render(e),this._widget.focusInput(),this._register(this.workspaceContextService.onDidChangeWorkspaceFolders(()=>{this._widget?.updateAllowedTargets(this.computeAllowedTargets())}))}computeAllowedTargets(){return["copilotcli","copilot-cloud-agent"]}layoutBody(e,t){super.layoutBody(e,t),this._widget?.layout(e,t)}focus(){super.focus(),this._widget?.focusInput()}setVisible(e){super.setVisible(e),e&&this._widget?.focusInput()}saveState(){this._widget?.saveState()}dispose(){this._widget?.saveState(),super.dispose()}};M2e=I([m(1,_e),m(2,ze),m(3,B),m(4,X),m(5,Ri),m(6,F),m(7,Qe),m(8,De),m(9,tt),m(10,Pe)],M2e);var kHi=class a extends K{static{this.ID="chat.openSessionWorktreeInVSCode"}constructor(){super({id:a.ID,title:L(2874,"Open in VS Code"),icon:M.vscodeInsiders,precondition:Uve,menu:[{id:va.TitleBarSessionMenu,group:"navigation",order:10,when:x.and(Xc.toNegated(),fM.toNegated(),Uve)}]})}async run(i){let e=i.get(Qe),t=i.get(nt),n=i.get(du).activeSession.get();if(!n)return;let r=n.providerType==="copilotcli"?n?.worktree??n?.repository:void 0;if(!r)return;let s=t.quality==="stable"?"vscode":t.quality==="exploration"?"vscode-exploration":"vscode-insiders",l=new URLSearchParams;l.set("windowId","_blank"),l.set("session",n.resource.toString()),await e.open(A.from({scheme:s,authority:Y.file,path:r.path,query:l.toString()}),{openExternal:!0})}};W(kHi);var EHi=class extends K{constructor(){super({id:"workbench.action.sessions.newChat",title:L(2871,"New Chat"),category:vi,keybinding:{weight:202,primary:2092,secondary:[2090],mac:{primary:2092,secondary:[298]}}})}run(i){i.get(du).openNewSessionView()}};W(EHi);var ngn=Re("chat-view-icon",M.chatSparkle,d(2873,null)),T6t=class{static{this.ID="sessions.registerChatViewContainer"}constructor(){let i=oe.as(on.ViewContainersRegistry),e=oe.as(on.ViewsRegistry),t=i.get(eR);if(t){let o=e.getView(Vr);o&&e.deregisterViews([o],t),i.deregisterViewContainer(t)}t=i.registerViewContainer({id:eR,title:L(2872,"Chat"),icon:ngn,ctorDescriptor:new Mt(Ha,[eR,{mergeViewWithContainerWhenSingleView:!0}]),storageId:eR,hideIfEmpty:!0,order:1,windowVisibility:2},3,{isDefault:!0,doNotRegisterOpenCommand:!0}),e.registerViews([{id:Vr,containerIcon:t.icon,containerTitle:t.title.value,singleViewPaneContainerTitle:t.title.value,name:L(2872,"Chat"),canToggleVisibility:!1,canMoveView:!1,ctorDescriptor:new Mt(XC),when:Hve.negate(),windowVisibility:2},{id:IDo,containerIcon:t.icon,containerTitle:t.title.value,singleViewPaneContainerTitle:t.title.value,name:L(2875,"New Session"),canToggleVisibility:!1,canMoveView:!1,ctorDescriptor:new Mt(M2e),when:Hve,windowVisibility:2}],t)}};W(y6t);pt(T6t.ID,T6t,ut.BlockStartup);pt(Kve.ID,Kve,ut.AfterRestored);we(nr,x6t,1);we(w6t,zG,1);we(lf,ZQ,1);var yDo=[{section:kn.Agents,type:"agent"},{section:kn.Skills,type:"skill"},{section:kn.Instructions,type:"instructions"},{section:kn.Prompts,type:"prompt"},{section:kn.Hooks,type:"hook"}],P2e=class extends C{constructor(e,t,o,n,r){super();this._promptsService=t;this._workspaceService=o;this._workspaceContextService=n;this._mcpService=r;this._snapshotDirty=!1;this._logger=this._register(e.createLogger("customizationsDebug",{name:"Customizations Debug"})),this._register(this._promptsService.onDidChangeCustomAgents(()=>this._logSnapshot())),this._register(this._promptsService.onDidChangeSlashCommands(()=>this._logSnapshot())),this._register(this._workspaceContextService.onDidChangeWorkspaceFolders(()=>this._logSnapshot())),this._register(he(s=>{this._workspaceService.activeProjectRoot.read(s),this._logSnapshot()})),this._register(he(s=>{this._mcpService.servers.read(s),this._logSnapshot()}))}static{this.ID="sessions.customizationsDebugLog"}_logSnapshot(){if(this._pendingSnapshot){this._snapshotDirty=!0;return}this._pendingSnapshot=this._doLogSnapshot().finally(()=>{this._pendingSnapshot=void 0,this._snapshotDirty&&(this._snapshotDirty=!1,this._logSnapshot())})}async _doLogSnapshot(){let e=this._workspaceService.getActiveProjectRoot()?.fsPath??"(none)";this._logger.info(""),this._logger.info("=== Customizations Snapshot ==="),this._logger.info(`  Root: ${e}`),this._logger.info(`  Sections: ${this._workspaceService.managementSections.join(", ")}`),this._logger.info(""),this._logger.info(`  ${"Section".padEnd(16)} ${"Local".padStart(6)} ${"User".padStart(6)} ${"Ext".padStart(6)} ${"Total".padStart(7)}`),this._logger.info(`  ${"--------".padEnd(16)} ${"-----".padStart(6)} ${"----".padStart(6)} ${"---".padStart(6)} ${"-----".padStart(7)}`);for(let{section:t,type:o}of yDo){let n=this._workspaceService.getStorageSourceFilter(o);await this._logSectionRow(t,o,n)}this._logger.info("");for(let{section:t,type:o}of yDo){let n=this._workspaceService.getStorageSourceFilter(o);await this._logSectionDetails(t,o,n)}this._logMcpServers()}_logMcpServers(){let e=this._mcpService.servers.get();this._logger.info(`  -- MCP Servers (${e.length}) --`),e.length===0&&this._logger.info("     (none registered)");for(let t of e){let n=t.connectionState.get()?.state??"unknown";this._logger.info(`     ${t.definition.label} [${n}] id=${t.definition.id}`)}this._logger.info("")}async _logSectionRow(e,t,o){try{let[n,r,s]=await Promise.all([this._promptsService.listPromptFilesForStorage(t,"local",ve.None),this._promptsService.listPromptFilesForStorage(t,"user",ve.None),this._promptsService.listPromptFilesForStorage(t,"extension",ve.None)]),l=[...n,...r,...s],c=qB(l,o),u=c.filter(g=>g.storage==="local").length,p=c.filter(g=>g.storage==="user").length,h=c.filter(g=>g.storage==="extension").length;this._logger.info(`  ${e.padEnd(16)} ${String(u).padStart(6)} ${String(p).padStart(6)} ${String(h).padStart(6)} ${String(c.length).padStart(7)}`)}catch{this._logger.info(`  ${e.padEnd(16)}  (error)`)}}async _logSectionDetails(e,t,o){try{let n=await this._promptsService.getSourceFolders(t);if(n.length>0){this._logger.info(`  -- ${e} --`),this._logger.info("     Search paths:");for(let p of n)this._logger.info(`       [${p.storage}] ${p.uri.fsPath}`)}let[r,s,l]=await Promise.all([this._promptsService.listPromptFilesForStorage(t,"local",ve.None),this._promptsService.listPromptFilesForStorage(t,"user",ve.None),this._promptsService.listPromptFilesForStorage(t,"extension",ve.None)]),c=[...r,...s,...l],u=qB(c,o);if(u.length>0){n.length===0&&this._logger.info(`  -- ${e} --`),this._logger.info(`     Filter: sources=[${o.sources.join(", ")}]${o.includedUserFileRoots?`, roots=[${o.includedUserFileRoots.map(p=>p.fsPath).join(", ")}]`:""}`),this._logger.info(`     Found ${u.length} item(s):`);for(let p of u)this._logger.info(`       [${p.storage}] ${p.uri.fsPath}`)}(n.length>0||u.length>0)&&this._logger.info("")}catch{}}};P2e=I([m(0,ol),m(1,nr),m(2,lf),m(3,Pe),m(4,es)],P2e);pt(P2e.ID,P2e,ut.AfterRestored);var xut=class extends oc{constructor(e,t,o,n,r,s,l,c,u,p,h){super(void 0,e,t);this.instantiationService=o;this.hoverService=n;this.activeSessionService=r;this.chatService=s;this.agentSessionsService=l;this.contextMenuService=c;this.menuService=u;this.contextKeyService=p;this.chatSessionsService=h;this._dynamicDisposables=this._register(new P);this._modelChangeListener=this._register(new me);this._isRendering=!1;this._register(he(g=>{let f=this.activeSessionService.activeSession.read(g);this._trackModelTitleChanges(f?.resource),this._lastRenderState=void 0,this._render()})),this._register(this.agentSessionsService.model.onDidChangeSessions(()=>{this._lastRenderState=void 0,this._render()}))}render(e){super.render(e),this._container=e,e.classList.add("agent-sessions-titlebar-container"),this._render()}setFocusable(e){}onClick(){}_render(){if(this._container&&!this._isRendering){this._isRendering=!0;try{let e=this._getActiveSessionLabel(),t=this._getActiveSessionIcon(),o=this._getRepositoryLabel(),n=this._getChangesSummary(),r=`${t?.id??""}|${e}|${o??""}|${n?.insertions??""}|${n?.deletions??""}`;if(this._lastRenderState===r)return;this._lastRenderState=r,Fi(this._container),this._dynamicDisposables.clear(),this._container.setAttribute("role","button"),this._container.setAttribute("aria-label",d(2956,null)),this._container.tabIndex=0;let s=_("span.agent-sessions-titlebar-pill"),l=_("span.agent-sessions-titlebar-center");if(t){let u=_("span.agent-sessions-titlebar-icon"+q.asCSSSelector(t));l.appendChild(u)}let c=_("span.agent-sessions-titlebar-label");if(c.textContent=e,l.appendChild(c),o){let u=_("span.agent-sessions-titlebar-separator");u.textContent="\xB7",l.appendChild(u);let p=_("span.agent-sessions-titlebar-repo");p.textContent=o,l.appendChild(p)}if(n){let u=_("span.agent-sessions-titlebar-separator");u.textContent="\xB7",l.appendChild(u);let p=_("span.agent-sessions-titlebar-changes"),h=_("span.agent-sessions-titlebar-changes-added");h.textContent=`+${n.insertions}`,p.appendChild(h);let g=_("span.agent-sessions-titlebar-changes-removed");g.textContent=`-${n.deletions}`,p.appendChild(g),l.appendChild(p)}s.appendChild(l),this._dynamicDisposables.add(j(s,re.MOUSE_DOWN,u=>{u.preventDefault(),u.stopPropagation()})),this._dynamicDisposables.add(j(s,re.CLICK,u=>{u.preventDefault(),u.stopPropagation(),this._showSessionsPicker()})),this._dynamicDisposables.add(j(s,re.CONTEXT_MENU,u=>{u.preventDefault(),u.stopPropagation(),this._showContextMenu(u)})),this._container.appendChild(s),this._dynamicDisposables.add(this.hoverService.setupManagedHover(Ni("mouse"),s,e)),this._dynamicDisposables.add(j(this._container,re.KEY_DOWN,u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),u.stopPropagation(),this._showSessionsPicker())}))}finally{this._isRendering=!1}}}_trackModelTitleChanges(e){if(this._modelChangeListener.clear(),!e)return;let t=this.chatService.getSession(e);t&&(this._modelChangeListener.value=t.onDidChange(o=>{(o.kind==="setCustomTitle"||o.kind==="addRequest")&&(this._lastRenderState=void 0,this._render())}))}_getActiveSessionLabel(){let e=this.activeSessionService.getActiveSession(),t=e?.label;if(t)return t;if(e){let o=this.chatService.getSession(e.resource);if(o?.title)return o.title}return d(2954,null)}_getActiveSessionIcon(){let e=this.activeSessionService.getActiveSession();if(!e)return;let t=this.agentSessionsService.getSession(e.resource);if(t)return t.providerType==="copilotcli"?typeof t.metadata?.worktreePath=="string"?M.worktree:M.folder:t.icon;let o=Rf(e.resource);if(o!==void 0)return A_(o)}_getRepositoryLabel(){let e=this.activeSessionService.getActiveSession();if(!e)return;let t=e.repository;if(t)return Ye(t)}_showContextMenu(e){let t=this.activeSessionService.getActiveSession();if(!t)return;let o=this.agentSessionsService.getSession(t.resource);if(!o)return;this.chatSessionsService.activateChatSessionItemProvider(o.providerType);let n=[[ie.isArchivedAgentSession.key,o.isArchived()],[ie.isReadAgentSession.key,o.isRead()],[ie.agentSessionType.key,o.providerType]],r=this.menuService.createMenu(D.AgentSessionsContext,this.contextKeyService.createOverlay(n)),s={session:o,sessions:[o],$mid:25};this.contextMenuService.showContextMenu({getActions:()=>li.join(...r.getActions({arg:s,shouldForwardArgs:!0}).map(([,l])=>l)),getAnchor:()=>new yn(Ki(),e),getActionsContext:()=>s}),r.dispose()}_getChangesSummary(){let e=this.activeSessionService.getActiveSession();if(!e)return;let o=this.agentSessionsService.getSession(e.resource)?.changes;if(!(!o||!FV(o)))return JX(o)}_showSessionsPicker(){this.instantiationService.createInstance(P2,void 0,{overrideSessionOpen:(t,o)=>this.activeSessionService.openSession(t.resource,o)}).pickAgentSession()}};xut=I([m(2,F),m(3,tt),m(4,du),m(5,Si),m(6,ia),m(7,ze),m(8,qt),m(9,X),m(10,Ls)],xut);var Gve=class extends C{static{this.ID="workbench.contrib.agentSessionsTitleBar"}constructor(i,e){super(),this._register(fe.appendMenuItem(va.CommandCenter,{submenu:va.TitleBarSessionTitle,title:d(2955,null),order:101,when:x.and(Xc.negate(),fM.negate())})),this._register(fe.appendMenuItem(va.TitleBarSessionTitle,{command:{id:N2.id,title:d(2957,null)},group:"a_sessions",order:1,when:Xc.negate()})),this._register(i.register(va.CommandCenter,va.TitleBarSessionTitle,(t,o)=>{if(t instanceof Cc)return e.createInstance(xut,t,o)},void 0))}};Gve=I([m(0,Yy),m(1,F)],Gve);var rgn={local:"workspace",user:"user",extension:"extension"};function THi(a,i){let e=0;for(let t of i.sources){let o=rgn[t];o&&(e+=a[o])}return e}async function _Hi(a,i,e,t,o,n){let r=[];if(i==="agent"){let l=await a.getCustomAgents(ve.None);for(let c of l)r.push({storage:c.source.storage,uri:c.uri})}else if(i==="skill"){let l=await a.findAgentSkills(ve.None);for(let c of l??[])r.push({storage:c.storage,uri:c.uri})}else if(i==="prompt"){let l=await a.getPromptSlashCommands(ve.None);for(let c of l)c.promptPath.type!=="skill"&&r.push({storage:c.promptPath.storage,uri:c.promptPath.uri})}else if(i==="instructions"){let l=await a.listPromptFiles(i,ve.None);for(let h of l)r.push({storage:h.storage,uri:h.uri});let c=await a.listAgentInstructions(ve.None,void 0),u=t.getWorkspace().folders.map(h=>h.uri),p=o.getActiveProjectRoot();p&&u.push(p);for(let h of c){let g=u.some(f=>La(h.uri,f));r.push({storage:g?"local":"user",uri:h.uri})}}else if(i==="hook"&&n){let l=await a.listPromptFiles("hook",ve.None),c=o.getActiveProjectRoot();for(let u of l)try{let p=await n.readFile(u.uri),h=xk(p.value.toString()),{hooks:g}=r8(u.uri,h,c,"");if(g.size>0)for(let[,f]of g)for(let v=0;v<f.hooks.length;v++)r.push({storage:u.storage,uri:u.uri});else r.push({storage:u.storage,uri:u.uri})}catch{r.push({storage:u.storage,uri:u.uri})}}else{let l=await a.listPromptFiles(i,ve.None);for(let c of l)r.push({storage:c.storage,uri:c.uri})}let s=qB(r,e);return{workspace:s.filter(l=>l.storage==="local").length,user:s.filter(l=>l.storage==="user").length,extension:s.filter(l=>l.storage==="extension").length}}async function wDo(a,i,e,t,o){let n=["agent","skill","instructions","prompt","hook"],r=await Promise.all(n.map(l=>{let c=e.getStorageSourceFilter(l);return _Hi(a,l,c,t,e).then(u=>THi(u,c))})),s=o?.allPlugins.get().length??0;return r.reduce((l,c)=>l+c,0)+i.servers.get().length+s}var $ve=_,CDo="agentSessions.customizationsCollapsed",A2e=class extends C{constructor(e,t,o,n,r,s,l,c,u){super();this.instantiationService=o;this.storageService=n;this.promptsService=r;this.mcpService=s;this.workspaceContextService=l;this.workspaceService=c;this.agentPluginService=u;this._render(e,t)}_render(e,t){let o=this.storageService.getBoolean(CDo,0,!1),n=R(e,$ve(".ai-customization-toolbar"));o&&n.classList.add("collapsed");let r=R(n,$ve(".ai-customization-header"));r.classList.toggle("collapsed",o);let s=R(r,$ve(".customization-link-button-container")),l=this._register(new Mi(s,{...Ko,secondary:!0,title:!1,supportIcons:!0,buttonSecondaryBackground:"transparent",buttonSecondaryHoverBackground:void 0,buttonSecondaryForeground:void 0,buttonSecondaryBorder:void 0}));l.element.classList.add("customization-link-button","sidebar-action-button"),l.element.setAttribute("aria-expanded",String(!o)),l.label=d(2942,null);let c=R(l.element,$ve("span.customization-link-counts")),u=R(c,$ve(".ai-customization-chevron")),p=R(c,$ve("span.ai-customization-header-total.hidden"));u.classList.add(...q.asClassNameArray(o?M.chevronRight:M.chevronDown));let h=R(n,$ve(".ai-customization-toolbar-content.sidebar-action-list"));this._register(this.instantiationService.createInstance(Ln,h,va.SidebarCustomizations,{hiddenItemStrategy:-1,toolbarOptions:{primaryGroup:()=>!0},telemetrySource:"sidebarCustomizations"}));let g=0,f=async()=>{let S=++g,y=await wDo(this.promptsService,this.mcpService,this.workspaceService,this.workspaceContextService,this.agentPluginService);S===g&&(p.classList.toggle("hidden",y===0),p.textContent=`${y}`)};this._register(this.promptsService.onDidChangeCustomAgents(()=>f())),this._register(this.promptsService.onDidChangeSlashCommands(()=>f())),this._register(this.workspaceContextService.onDidChangeWorkspaceFolders(()=>f())),this._register(he(S=>{this.mcpService.servers.read(S),f()})),this._register(he(S=>{this.workspaceService.activeProjectRoot.read(S),f()})),f();let v=this._register(new me),b=()=>{let S=n.classList.toggle("collapsed");r.classList.toggle("collapsed",S),this.storageService.store(CDo,S,0,0),l.element.setAttribute("aria-expanded",String(!S)),u.classList.remove(...q.asClassNameArray(M.chevronRight),...q.asClassNameArray(M.chevronDown)),u.classList.add(...q.asClassNameArray(S?M.chevronRight:M.chevronDown)),v.value=j(h,"transitionend",()=>{v.clear(),t?.onDidToggleCollapse?.()})};this._register(l.onDidClick(()=>b()))}};A2e=I([m(2,F),m(3,le),m(4,nr),m(5,es),m(6,Pe),m(7,lf),m(8,Db)],A2e);var N2e=_,F2e="agentic.workbench.view.sessionsView",xDo=new D("AgentSessionsViewFilterSubMenu"),O2e=class extends zr{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(e,t,o,n,r,s,l,c,u,p);this.layoutService=h;this.activeSessionService=g;this.hostService=f}renderBody(e){super.renderBody(e),this.viewPaneContainer=e,this.viewPaneContainer.classList.add("agent-sessions-viewpane"),this.createControls(e)}getLocationBasedColors(){let e=super.getLocationBasedColors();return{...e,background:eVi,listOverrideStyles:{...e.listOverrideStyles,listBackground:eVi}}}createControls(e){let t=R(e,N2e(".agent-sessions-container")),o=this._register(this.instantiationService.createInstance(f0,{filterMenuId:xDo,groupResults:()=>"date",allowedProviders:["copilotcli","copilot-cloud-agent"],providerLabelOverrides:new Map([["copilotcli",d(2958,null)]])})),n=R(t,N2e(".agent-sessions-section")),r=R(n,N2e(".agent-sessions-content")),s=R(r,N2e(".agent-sessions-new-button-container")),l=this._register(new Mi(s,{...Ko,secondary:!0}));l.label=d(2962,null),this._register(l.onDidClick(()=>this.activeSessionService.openNewSessionView()));let c=this.keybindingService.lookupKeybinding(im);if(c){let p=R(l.element,N2e("span.new-session-keybinding-hint"));p.textContent=c.getLabel()??""}this.sessionsControlContainer=R(r,N2e(".agent-sessions-control-container"));let u=this.sessionsControl=this._register(this.instantiationService.createInstance(fie,this.sessionsControlContainer,{source:"agentSessionsViewPane",filter:o,overrideStyles:this.getLocationBasedColors().listOverrideStyles,disableHover:!0,showIsolationIcon:!0,enableApprovalRow:!0,getHoverPosition:()=>this.getSessionHoverPosition(),trackActiveEditorSession:()=>!0,collapseOlderSections:()=>!0,overrideSessionOpen:(p,h)=>this.activeSessionService.openSession(p,h)}));this._register(this.onDidChangeBodyVisibility(p=>u.setVisible(p))),this._register(this.hostService.onDidChangeFocus(p=>{p&&u.refresh()})),this._register(u.onDidUpdate(()=>{u.hasFocusOrSelection()||this.restoreLastSelectedSession()})),this._register(he(p=>{let h=this.activeSessionService.activeSession.read(p);h&&u.reveal(h.resource)||u.clearFocus()})),this._register(this.instantiationService.createInstance(A2e,t,{onDidToggleCollapse:()=>{if(this.viewPaneContainer){let{offsetHeight:p,offsetWidth:h}=this.viewPaneContainer;this.layoutBody(p,h)}}}))}restoreLastSelectedSession(){let e=this.activeSessionService.getActiveSession();e&&this.sessionsControl&&this.sessionsControl.reveal(e.resource)}getSessionHoverPosition(){let e=this.viewDescriptorService.getViewLocationById(this.id),t=this.layoutService.getSideBarPosition();return{0:t===0?1:0,2:t===0?0:1,3:1,1:3}[e??2]}layoutBody(e,t){super.layoutBody(e,t),!(!this.sessionsControl||!this.sessionsControlContainer)&&this.sessionsControl.layout(this.sessionsControlContainer.offsetHeight,t)}focus(){super.focus(),this.sessionsControl?.focus()}refresh(){this.sessionsControl?.refresh()}openFind(){this.sessionsControl?.openFind()}};O2e=I([m(1,_e),m(2,ze),m(3,B),m(4,X),m(5,Ri),m(6,F),m(7,Qe),m(8,De),m(9,tt),m(10,fi),m(11,du),m(12,oi)],O2e);yt.registerKeybindingRule({id:im,weight:201,primary:2092});var kDo="agentSession.close";W(class extends K{constructor(){super({id:kDo,title:L(2959,"Close Session"),f1:!0,precondition:x.and(Hve.negate(),wce.negate()),category:zve.Sessions})}async run(i){await i.get(du).openNewSessionView()}});yt.registerKeybindingRule({id:kDo,weight:201,when:x.and(Hve.negate(),wce.negate()),primary:2101,win:{primary:2110,secondary:[2101]}});fe.appendMenuItem(D.ViewTitle,{submenu:xDo,title:L(2960,"Filter Sessions"),group:"navigation",order:3,icon:M.filter,when:x.equals("view",F2e)});W(class extends K{constructor(){super({id:"sessionsView.refresh",title:L(2963,"Refresh Sessions"),icon:M.refresh,f1:!0,category:zve.Sessions})}run(i){return i.get(Ft).getViewWithId(F2e)?.sessionsControl?.refresh()}});W(class extends K{constructor(){super({id:"sessionsView.find",title:L(2961,"Find Session"),icon:M.search,menu:[{id:D.ViewTitle,group:"navigation",order:2,when:x.equals("view",F2e)}]})}run(i){return i.get(Ft).getViewWithId(F2e)?.sessionsControl?.openFind()}});var EDo=Re("chat-sessions-icon",M.commentDiscussionSparkle,d(2952,null)),_6t=L(2951,"Sessions"),DHi="agentic.workbench.view.sessionsContainer",sgn=oe.as(on.ViewContainersRegistry).registerViewContainer({id:DHi,title:_6t,icon:EDo,ctorDescriptor:new Mt(Ha,[DHi,{mergeViewWithContainerWhenSingleView:!0}]),storageId:DHi,hideIfEmpty:!0,order:6,windowVisibility:2},0,{isDefault:!0}),agn={id:F2e,containerIcon:EDo,containerTitle:_6t.value,singleViewPaneContainerTitle:_6t.value,name:_6t,canToggleVisibility:!1,canMoveView:!1,ctorDescriptor:new Mt(O2e),windowVisibility:2};oe.as(on.ViewsRegistry).registerViews([agn],sgn);pt(Gve.ID,Gve,ut.AfterRestored);we(du,x2e,1);var lgn=[{id:"sessions.customization.agents",label:d(2943,null),icon:G2,section:kn.Agents,promptType:"agent"},{id:"sessions.customization.skills",label:d(2950,null),icon:S8,section:kn.Skills,promptType:"skill"},{id:"sessions.customization.instructions",label:d(2946,null),icon:I8,section:kn.Instructions,promptType:"instructions"},{id:"sessions.customization.prompts",label:d(2949,null),icon:y8,section:kn.Prompts,promptType:"prompt"},{id:"sessions.customization.hooks",label:d(2945,null),icon:CFe,section:kn.Hooks,promptType:"hook"},{id:"sessions.customization.mcpServers",label:d(2947,null),icon:vKt,section:kn.McpServers,isMcp:!0},{id:"sessions.customization.plugins",label:d(2948,null),icon:I0,section:kn.Plugins,isPlugins:!0}],kut=class extends Lr{constructor(e,t,o,n,r,s,l,c,u,p,h){super(void 0,e,{...t,icon:!1,label:!1});this._config=o;this._promptsService=n;this._languageModelsService=r;this._mcpService=s;this._workspaceContextService=l;this._activeSessionService=c;this._workspaceService=u;this._fileService=p;this._agentPluginService=h;this._updateCountsRequestId=0;this._viewItemDisposables=this._register(new P)}getTooltip(){}render(e){super.render(e),e.classList.add("customization-link-widget","sidebar-action");let t=R(e,_(".customization-link-button-container"));this._button=this._viewItemDisposables.add(new Mi(t,{...Ko,secondary:!0,title:!1,supportIcons:!0,buttonSecondaryBackground:"transparent",buttonSecondaryHoverBackground:void 0,buttonSecondaryForeground:void 0,buttonSecondaryBorder:void 0})),this._button.element.classList.add("customization-link-button","sidebar-action-button"),this._button.label=`$(${this._config.icon.id}) ${this._config.label}`,this._viewItemDisposables.add(this._button.onDidClick(()=>{this._action.run()})),this._countContainer=R(this._button.element,_("span.customization-link-counts")),this._viewItemDisposables.add(this._promptsService.onDidChangeCustomAgents(()=>this._updateCounts())),this._viewItemDisposables.add(this._promptsService.onDidChangeSlashCommands(()=>this._updateCounts())),this._viewItemDisposables.add(this._languageModelsService.onDidChangeLanguageModels(()=>this._updateCounts())),this._viewItemDisposables.add(he(o=>{this._mcpService.servers.read(o),this._updateCounts()})),this._viewItemDisposables.add(he(o=>{this._agentPluginService.allPlugins.read(o),this._updateCounts()})),this._viewItemDisposables.add(this._workspaceContextService.onDidChangeWorkspaceFolders(()=>this._updateCounts())),this._viewItemDisposables.add(he(o=>{this._activeSessionService.activeSession.read(o),this._updateCounts()})),this._updateCounts()}async _updateCounts(){if(!this._countContainer)return;let e=++this._updateCountsRequestId;if(this._config.promptType){let t=this._config.promptType,o=this._workspaceService.getStorageSourceFilter(t),n=await _Hi(this._promptsService,t,o,this._workspaceContextService,this._workspaceService,this._fileService);if(e!==this._updateCountsRequestId)return;let r=THi(n,o);this._renderTotalCount(this._countContainer,r)}else if(this._config.isMcp){let t=this._mcpService.servers.get().length;this._renderTotalCount(this._countContainer,t)}else if(this._config.isPlugins){let t=this._agentPluginService.allPlugins.get().length;this._renderTotalCount(this._countContainer,t)}}_renderTotalCount(e,t){if(e.textContent="",e.classList.toggle("hidden",t===0),t>0){let o=R(e,_("span.source-count-badge")),n=R(o,_("span.source-count-num"));n.textContent=`${t}`}}};kut=I([m(3,nr),m(4,Wr),m(5,es),m(6,Pe),m(7,du),m(8,lf),m(9,be),m(10,Db)],kut);var W2e=class extends C{static{this.ID="workbench.contrib.sessionsCustomizationsToolbar"}constructor(i,e){super();for(let[t,o]of lgn.entries())this._register(i.register(va.SidebarCustomizations,o.id,(n,r)=>e.createInstance(kut,n,r,o),void 0)),this._register(W(class extends K{constructor(){super({id:o.id,title:L(2944,"{0}",o.label),menu:{id:va.SidebarCustomizations,group:"navigation",order:t+1}})}async run(n){let r=n.get(ee),s=ZB.getOrCreate(),l=await r.openEditor(s,{pinned:!0},ym);l instanceof MA&&l.selectSectionById(o.section)}}))}};W2e=I([m(0,Yy),m(1,F)],W2e);pt(W2e.ID,W2e,ut.AfterRestored);var VH=_,PHi="workbench.view.agentSessions.changesContainer",BH="workbench.view.agentSessions.changes";var AHi=new Q("changesViewMode","list");function H2e(a){return a.type==="file"}function cgn(a){if(a.length===0)return[];let i={name:"",uri:A.file("/"),children:new Map,files:[]};for(let t of a){let o=wc(t.uri.path),n=o,r="";if(t.uri.scheme===WH){let u=o.split("/").filter(Boolean);u.length>=3?(r="/"+u.slice(0,3).join("/"),n="/"+u.slice(3).join("/")):(r="/"+u.join("/"),n="/")}let s=n.split("/").filter(Boolean),l=i,c=r;for(let u of s)c+="/"+u,l.children.has(u)||l.children.set(u,{name:u,uri:t.uri.with({path:c}),children:new Map,files:[]}),l=l.children.get(u);l.files.push(t)}function e(t){let o=[];for(let[,n]of t.children){let r={type:"folder",uri:n.uri,name:n.name},s=e(n);o.push({element:r,children:s,collapsible:!0,collapsed:!1})}for(let n of t.files)o.push({element:n,collapsible:!1});return o}return e(i)}var V2e=class extends zr{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);this.chatEditingService=h;this.editorService=g;this.activityService=f;this.agentSessionsService=v;this.sessionManagementService=b;this.labelService=S;this.storageService=y;this.renderDisposables=this._register(new P);this.currentBodyHeight=0;this.currentBodyWidth=0;this.badgeDisposable=this._register(new me);let k=this.storageService.get("changesView.viewMode",1)==="tree"?"tree":"list";this.viewModeObs=Le(this,k),this.viewModeContextKey=AHi.bindTo(r),this.viewModeContextKey.set(k),this.activeSession=hs({equalsFn:(N,O)=>Xe(N?.resource,O?.resource)},N=>{let O=this.sessionManagementService.activeSession.read(N);if(O?.resource)return{resource:O.resource,sessionType:fg(O.resource)}}).recomputeInitiallyAndOnChange(this._store),this.activeSessionFileCountObs=this.createActiveSessionFileCountObservable(),this.activeSessionHasChangesObs=this.activeSessionFileCountObs.map(N=>N>0).recomputeInitiallyAndOnChange(this._store),this.registerBadgeTracking();let T=this.scopedContextKeyService.createKey(ie.agentSessionType.key,"");this._register(he(N=>{let O=this.activeSession.read(N);T.set(O?.sessionType??"")}))}get viewMode(){return this.viewModeObs.get()}set viewMode(e){this.viewModeObs.get()!==e&&(this.viewModeObs.set(e,void 0),this.viewModeContextKey.set(e),this.storageService.store("changesView.viewMode",e,1,0))}get activeSessionHasChanges(){return this.activeSessionHasChangesObs}registerBadgeTracking(){this._register(he(e=>{let t=this.activeSessionFileCountObs.read(e);this.updateBadge(t)}))}createActiveSessionFileCountObservable(){let e=this.activeSession.map(n=>n?.resource),t=ui(this,this.agentSessionsService.model.onDidChangeSessions,()=>({})),o=Ce(n=>{let r=e.read(n);if(t.read(n),!r)return ht.empty();let s=this.agentSessionsService.getSession(r);return s?.changes instanceof Array?s.changes:ht.empty()});return Ce(n=>{let r=this.activeSession.read(n);if(!r)return 0;let s=r.sessionType==="copilotcli",l=0;if(!s){let h=this.chatEditingService.editingSessionsObs.read(n).find(g=>Xe(g.chatSessionResource,r.resource));l=h?h.entries.read(n).length:0}let u=[...o.read(n)].length;return l+u}).recomputeInitiallyAndOnChange(this._store)}updateBadge(e){if(e>0){let t=e===1?d(2856,null):d(2854,null,e);this.badgeDisposable.value=this.activityService.showViewActivity(BH,{badge:new qc(e,()=>t)})}else this.badgeDisposable.clear()}renderBody(e){super.renderBody(e),this.bodyContainer=R(e,VH(".changes-view-body")),this.welcomeContainer=R(this.bodyContainer,VH(".changes-welcome")),R(this.welcomeContainer,VH(".changes-welcome-icon")).classList.add(...q.asClassNameArray(M.diffMultiple));let o=R(this.welcomeContainer,VH(".changes-welcome-message"));o.textContent=d(2855,null),this.actionsContainer=R(this.bodyContainer,VH(".chat-editing-session-actions.outside-card")),this.contentContainer=R(this.bodyContainer,VH(".chat-editing-session-container.show-file-icons")),this._register(DB(this.contentContainer,this.themeService));let n=()=>{this.contentContainer.classList.toggle("has-file-icons",this.themeService.getFileIconTheme().hasFileIcons)};n(),this._register(this.themeService.onDidFileIconThemeChange(n)),this.overviewContainer=R(this.contentContainer,VH(".chat-editing-session-overview")),this.summaryContainer=R(this.overviewContainer,VH(".changes-summary")),this.listContainer=R(this.contentContainer,VH(".chat-editing-session-list")),this._register(this.onDidChangeBodyVisibility(r=>{r?this.onVisible():this.renderDisposables.clear()})),this.isBodyVisible()&&this.onVisible()}onVisible(){this.renderDisposables.clear();let e=this.activeSession.map(u=>u?.resource),t=Ce(u=>{let p=this.activeSession.read(u);return p?this.chatEditingService.editingSessionsObs.read(u).find(g=>Xe(g.chatSessionResource,p.resource)):void 0}),o=Ce(u=>{if(this.activeSession.read(u)?.sessionType==="copilotcli")return[];let h=t.read(u);if(!h)return[];let g=h.entries.read(u),f=[];for(let v of g){let b=v.isDeletion??!1,S=v.linesAdded?.read(u)??0,y=v.linesRemoved?.read(u)??0;f.push({type:"file",uri:v.modifiedURI,originalUri:v.originalURI,state:v.state.read(u),isDeletion:b,changeType:b?"deleted":"modified",linesAdded:S,linesRemoved:y})}return f}),n=ui(this.renderDisposables,this.agentSessionsService.model.onDidChangeSessions,()=>({})),r=Ce(u=>{let p=e.read(u);if(n.read(u),!p)return ht.empty();let h=this.agentSessionsService.getSession(p);return h?.changes instanceof Array?h.changes:ht.empty()}),s=Ce(u=>[...r.read(u)].map(p=>{let h=p.modifiedUri===void 0,g=p.originalUri===void 0;return{type:"file",uri:ike(p)?p.modifiedUri??p.uri:p.modifiedUri,originalUri:p.originalUri,state:1,isDeletion:h,changeType:h?"deleted":g?"added":"modified",linesAdded:p.insertions,linesRemoved:p.deletions}})),l=Ce(u=>{let p=o.read(u),h=s.read(u);return[...p,...h]}),c=Ce(u=>{let p=o.read(u),h=s.read(u),g=l.read(u),f=0,v=0;for(let y of g)f+=y.linesAdded,v+=y.linesRemoved;let b=g.length,S=p.length===0&&h.length>0;return{files:b,added:f,removed:v,isSessionMenu:S}});if(this.actionsContainer){Rt(this.actionsContainer);let u=this.renderDisposables.add(this.contextKeyService.createScoped(this.actionsContainer)),p=this.renderDisposables.add(this.instantiationService.createChild(new Io([X,u]))),h=u.createKey(ie.agentSessionType.key,"");this.renderDisposables.add(he(f=>{let v=this.activeSession.read(f);h.set(v?.sessionType??"")})),this.renderDisposables.add(tc(Zx,u,f=>{let v=t.read(f);return v?v.entries.read(f).some(S=>S.state.read(f)===0):!1})),this.renderDisposables.add(tc(zce,u,f=>{let v=t.read(f);return v?v.entries.read(f).length>0:!1})),this.renderDisposables.add(tc(ie.hasAgentSessionChanges,u,f=>{let{files:v}=c.read(f);return v>0}));let g=u.createKey("sessions.hasOpenPullRequest",!1);this.renderDisposables.add(he(f=>{let v=e.read(f);if(n.read(f),v){let b=this.agentSessionsService.getSession(v)?.metadata;g.set(!!b?.pullRequestUrl)}else g.set(!1)})),this.renderDisposables.add(he(f=>{let{isSessionMenu:v,added:b,removed:S}=c.read(f),y=e.read(f);n.read(f);let w=v?D.ChatEditingSessionChangesToolbar:D.ChatEditingWidgetToolbar;f.store.add(p.createInstance(QF,this.actionsContainer,w,{telemetrySource:"changesView",disableWhileRunning:v,menuOptions:v&&y?{args:[y,this.agentSessionsService.getSession(y)?.metadata]}:{shouldForwardArgs:!0},buttonConfigProvider:k=>{if(k.id==="chatEditing.viewChanges"||k.id==="chatEditing.viewPreviousEdits"||k.id==="chatEditing.viewAllSessionChanges"||k.id==="chat.openSessionWorktreeInVSCode")return{showIcon:!0,showLabel:!0,isSecondary:!0,customClass:"working-set-diff-stats",customLabel:new xe(`<span class="working-set-lines-added">+${b}</span>&nbsp;<span class="working-set-lines-removed">-${S}</span>`,{supportHtml:!0})};if(k.id==="chatEditing.synchronizeChanges")return{showIcon:!0,showLabel:!0,isSecondary:!0}}}))}))}if(this.renderDisposables.add(he(u=>{let{files:p}=c.read(u),h=p>0;mm(h,this.contentContainer),mm(h,this.actionsContainer),mm(!h,this.welcomeContainer)})),this.summaryContainer){Rt(this.summaryContainer);let u=_(".working-set-lines-added"),p=_(".working-set-lines-removed");this.summaryContainer.appendChild(u),this.summaryContainer.appendChild(p),this.renderDisposables.add(he(h=>{let{added:g,removed:f}=c.read(h);u.textContent=`+${g}`,p.textContent=`-${f}`}))}if(!this.tree&&this.listContainer){let u=this._register(this.instantiationService.createInstance(Za,{onDidChangeVisibility:this.onDidChangeBodyVisibility}));this.tree=this.instantiationService.createInstance(PL,"ChangesViewTree",this.listContainer,new LHi,[this.instantiationService.createInstance(nre,u,D.ChatEditingWidgetModifiedFilesToolbar)],{alwaysConsumeMouseWheel:!1,accessibilityProvider:{getAriaLabel:p=>H2e(p)?No(p.uri.path):p.name,getWidgetAriaLabel:()=>d(2857,null)},dnd:{getDragURI:p=>p.uri.toString(),getDragLabel:p=>{let h=p.map(g=>g.uri);return h.length===1?this.labelService.getUriLabel(h[0],{relative:!0}):`${h.length}`},dispose:()=>{},onDragOver:()=>!1,drop:()=>{},onDragStart:(p,h)=>{try{let f=p.getData().filter(H2e).map(v=>v.uri);this.instantiationService.invokeFunction(v=>Ig(v,f,h))}catch{}}},identityProvider:{getId:p=>p.uri.toString()},compressionEnabled:!0,twistieAdditionalCssClass:p=>this.viewMode==="list"?"force-no-twistie":void 0})}if(this.tree){let u=this.tree;this.renderDisposables.add(u.onDidChangeContentHeight(()=>this.layoutTree()));let p=(h,g,f)=>{let{uri:v,originalUri:b,isDeletion:S}=h,y=g.indexOf(h),w={total:g.length,current:y,navigate:T=>{let N=g[T];N&&p(N,g,!1)}},k=f?vn:ym;if(S&&b){this.editorService.openEditor({resource:b,options:{modal:{navigation:w}}},k);return}if(b){this.editorService.openEditor({original:{resource:b},modified:{resource:v},options:{modal:{navigation:w}}},k);return}this.editorService.openEditor({resource:v,options:{modal:{navigation:w}}},k)};this.renderDisposables.add(u.onDidOpen(h=>{if(!h.element||!H2e(h.element))return;let g=l.get();p(h.element,g,h.sideBySide)}))}this.renderDisposables.add(he(u=>{let p=l.read(u),h=this.viewModeObs.read(u);if(this.tree){if(this.listContainer?.classList.toggle("list-mode",h==="list"),h==="tree"){let g=cgn(p);this.tree.setChildren(null,g)}else{let g=p.map(f=>({element:f,collapsible:!1}));this.tree.setChildren(null,g)}this.layoutTree()}}))}layoutTree(){if(!this.tree||!this.listContainer)return;let e=this.currentBodyHeight;if(e<=0)return;let t=16,o=this.actionsContainer?.offsetHeight??0,n=o>0?8:0,r=this.overviewContainer?.offsetHeight??0,c=t+o+n+r+8+2,u=Math.max(0,e-c),p=this.tree.contentHeight,h=Math.min(u,p);this.tree.layout(h,this.currentBodyWidth),this.tree.getHTMLElement().style.height=`${h}px`}layoutBody(e,t){super.layoutBody(e,t),this.currentBodyHeight=e,this.currentBodyWidth=t,this.layoutTree()}focus(){super.focus(),this.tree?.domFocus()}dispose(){this.tree?.dispose(),this.tree=void 0,super.dispose()}};V2e=I([m(1,_e),m(2,ze),m(3,B),m(4,X),m(5,Ri),m(6,F),m(7,Qe),m(8,De),m(9,tt),m(10,dl),m(11,ee),m(12,zl),m(13,ia),m(14,du),m(15,ot),m(16,le)],V2e);var B2e=class extends Ha{constructor(i,e,t,o,n,r,s,l,c,u,p){super(PHi,{mergeViewWithContainerWhenSingleView:!0},t,s,i,o,e,l,n,r,c,u,p)}create(i){super.create(i),i.classList.add("changes-viewlet")}};B2e=I([m(0,fi),m(1,Te),m(2,F),m(3,ze),m(4,De),m(5,le),m(6,B),m(7,lt),m(8,Pe),m(9,Ri),m(10,ne)],B2e);var LHi=class{getHeight(i){return 22}getTemplateId(i){return nre.TEMPLATE_ID}},nre=class{constructor(i,e,t,o,n){this.labels=i;this.menuId=e;this.instantiationService=t;this.contextKeyService=o;this.labelService=n;this.templateId=nre.TEMPLATE_ID}static{this.TEMPLATE_ID="changesTreeRenderer"}renderTemplate(i){let e=new P,t=e.add(this.labels.create(i,{supportHighlights:!0,supportIcons:!0})),o=VH(".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=_(".changes-decoration-badge");t.element.appendChild(s);let l,c;if(this.menuId){let u=VH(".chat-collapsible-list-action-bar");c=e.add(this.contextKeyService.createScoped(u));let p=e.add(this.instantiationService.createChild(new Io([X,c])));l=e.add(p.createInstance(Ln,u,this.menuId,{menuOptions:{shouldForwardArgs:!0,arg:void 0}})),t.element.appendChild(u)}return{templateDisposables:e,label:t,toolbar:l,contextKeyService:c,decorationBadge:s,addedSpan:n,removedSpan:r,lineCountsContainer:o}}renderElement(i,e,t){let o=i.element;t.label.element.style.display="flex",H2e(o)?this.renderFileElement(o,t):this.renderFolderElement(o,t)}renderCompressedElements(i,e,t){let o=i.element,n=o.elements[o.elements.length-1];if(t.label.element.style.display="flex",H2e(n))this.renderFileElement(n,t);else{let r=o.elements.map(s=>H2e(s)?No(s.uri.path):s.name);t.label.setResource({resource:n.uri,name:r},{fileKind:1,separator:this.labelService.getSeparator(n.uri.scheme)}),t.decorationBadge.style.display="none",t.lineCountsContainer.style.display="none",t.toolbar&&(t.toolbar.context=void 0),t.contextKeyService&&sR.bindTo(t.contextKeyService).set(void 0)}}renderFileElement(i,e){e.label.setFile(i.uri,{fileKind:0,fileDecorations:void 0,strikethrough:i.changeType==="deleted",hidePath:!0}),e.lineCountsContainer.style.display="",e.decorationBadge.style.display="";let t=e.decorationBadge;switch(t.className="changes-decoration-badge",i.changeType){case"added":t.textContent="A",t.classList.add("added");break;case"deleted":t.textContent="D",t.classList.add("deleted");break;default:t.textContent="M",t.classList.add("modified");break}e.addedSpan.textContent=`+${i.linesAdded}`,e.removedSpan.textContent=`-${i.linesRemoved}`,e.label.element.querySelector(".monaco-icon-name-container")?.classList.add("modified"),e.toolbar&&(e.toolbar.context=i.uri),e.contextKeyService&&sR.bindTo(e.contextKeyService).set(i.state)}renderFolderElement(i,e){e.label.setFile(i.uri,{fileKind:1}),e.decorationBadge.style.display="none",e.lineCountsContainer.style.display="none",e.toolbar&&(e.toolbar.context=void 0),e.contextKeyService&&sR.bindTo(e.contextKeyService).set(void 0)}disposeTemplate(i){i.templateDisposables.dispose()}};nre=I([m(2,F),m(3,X),m(4,ot)],nre);var RHi=class extends Fn{constructor(){super({id:"workbench.changesView.action.setListViewMode",title:d(2858,null),viewId:BH,f1:!1,icon:M.listTree,toggled:AHi.isEqualTo("list"),menu:{id:D.ViewTitle,when:x.equals("view",BH),group:"1_viewmode",order:1}})}async runInView(i,e){e.viewMode="list"}},MHi=class extends Fn{constructor(){super({id:"workbench.changesView.action.setTreeViewMode",title:d(2859,null),viewId:BH,f1:!1,icon:M.listFlat,toggled:AHi.isEqualTo("tree"),menu:{id:D.ViewTitle,when:x.equals("view",BH),group:"1_viewmode",order:2}})}async runInView(i,e){e.viewMode="tree"}};W(RHi);W(MHi);var TDo=new Q("activeSessionHasChanges",!1,d(2863,null));var _Do={id:"workbench.action.agentSessions.openChangesView",title:L(2862,"Changes"),icon:M.diffMultiple,f1:!1},NHi=class extends K{static{this.ID=_Do.id}constructor(){super(_Do)}async run(i){await i.get(Ft).openView(BH,!0)}};W(NHi);var U2e=class extends C{static{this.ID="workbench.contrib.changesViewActions"}constructor(i,e,t){super();let o=ui(this,t.model.onDidChangeSessions,()=>{});this._register(tc(TDo,i,n=>{e.activeSession.read(n),o.read(n);let r=e.getActiveSession();if(!r)return!1;let s=t.getSession(r.resource);return!!s?.changes&&FV(s.changes)}))}};U2e=I([m(0,X),m(1,du),m(2,ia)],U2e);pt(U2e.ID,U2e,ut.AfterRestored);var qve=class extends C{constructor(e,t,o,n,r,s){super();this.layoutService=e;this.sessionManagementService=t;this.chatEditingService=o;this.agentSessionsService=n;this.chatService=r;this.viewsService=s;this.pendingTurnStateByResource=new vt;let l=hs({equalsFn:Xe},c=>this.sessionManagementService.activeSession.map(u=>u?.resource).read(c)).recomputeInitiallyAndOnChange(this._store);this._register(this.chatService.onDidSubmitRequest(({chatSessionResource:c})=>{this.pendingTurnStateByResource.set(c,{hadChangesBeforeSend:this.hasSessionChanges(c),submittedAt:Date.now()})})),this._register(he(c=>{let u=l.read(c);if(!u)return;let p=this.pendingTurnStateByResource.get(u);if(!p)return;let h=this.agentSessionsService.getSession(u);if(!(!!h?.timing.lastRequestEnded&&h.timing.lastRequestEnded>=p.submittedAt))return;let f=this.hasSessionChanges(u,c);!p.hadChangesBeforeSend&&f&&this.layoutService.setPartHidden(!1,"workbench.parts.auxiliarybar"),this.pendingTurnStateByResource.delete(u)})),this._register(he(c=>{let u=l.read(c);if(!u){this.syncAuxiliaryBarVisibility(!1);return}let p=this.hasSessionChanges(u,c);this.syncAuxiliaryBarVisibility(p)}))}static{this.ID="workbench.contrib.toggleChangesView"}hasSessionChanges(e,t){let o=fg(e)==="copilotcli",n=0;if(!o){let c=this.chatEditingService.editingSessionsObs.read(t).find(u=>Xe(u.chatSessionResource,e));n=c?c.entries.read(t).length:0}let r=this.agentSessionsService.getSession(e),s=r?.changes instanceof Array?r.changes.length:0;return n+s>0}syncAuxiliaryBarVisibility(e){e?this.viewsService.openView(BH,!1):this.layoutService.setPartHidden(!0,"workbench.parts.auxiliarybar")}};qve=I([m(0,fi),m(1,du),m(2,dl),m(3,ia),m(4,Si),m(5,Ft)],qve);var DDo=Re("changes-view-icon",M.gitCompare,L(2861,"View icon for the Changes view.").value),dgn=oe.as(on.ViewContainersRegistry),ugn=dgn.registerViewContainer({id:PHi,title:L(2860,"Changes"),ctorDescriptor:new Mt(B2e),icon:DDo,order:10,hideIfEmpty:!0,windowVisibility:2},2,{doNotRegisterOpenCommand:!0,isDefault:!0}),pgn=oe.as(on.ViewsRegistry);pgn.registerViews([{id:BH,name:L(2860,"Changes"),containerIcon:DDo,ctorDescriptor:new Mt(V2e),canToggleVisibility:!0,canMoveView:!0,weight:100,order:1,windowVisibility:2}],ugn);pt(qve.ID,qve,ut.BlockRestore);var OHi="workbench.sessions.auxiliaryBar.filesContainer",FHi="sessions.files.explorer",LDo=Re("sessions-files-view-icon",M.files,L(2937,"View icon of the files view in the sessions window.").value),D6t=class{static{this.ID="sessions.registerFilesView"}constructor(){let i=oe.as(on.ViewContainersRegistry),e=oe.as(on.ViewsRegistry),t=i.registerViewContainer({id:OHi,title:L(2936,"Files"),icon:LDo,order:11,ctorDescriptor:new Mt(Ha,[OHi,{mergeViewWithContainerWhenSingleView:!0}]),storageId:OHi,hideIfEmpty:!0,windowVisibility:2},2,{doNotRegisterOpenCommand:!0});e.registerViews([{id:FHi,name:L(2936,"Files"),containerIcon:LDo,ctorDescriptor:new Mt(zR),canToggleVisibility:!0,canMoveView:!1,when:mC.notEqualsTo("0"),windowVisibility:2}],t)}};pt(D6t.ID,D6t,ut.AfterRestored);W(class extends K{constructor(){super({id:"sessions.files.action.collapseExplorerFolders",title:L(2935,"Collapse Folders in Explorer"),icon:M.collapseAll,menu:{id:D.ViewTitle,group:"navigation",when:x.equals("view",FHi)}})}run(a){let e=a.get(Ft).getViewWithId(FHi);e!==null&&e.collapseAll()}});var RDo=new Q("agentSessionHasGitSyncChanges",!1,{type:"boolean",description:d(2938,null)}),z2e=class extends C{constructor(e,t,o){super();this.contextKeyService=e;this.sessionManagementService=t;this.gitService=o;this._syncActionDisposable=this._register(new me);this._gitRepoDisposables=this._register(new P);this._isSyncing=Le(this,!1);let n=RDo.bindTo(this.contextKeyService);this._register(he(r=>{let s=this.sessionManagementService.activeSession.read(r);this._gitRepoDisposables.clear();let l=s?this.sessionManagementService.getActiveSession()?.worktree:void 0;if(!l){this._syncActionDisposable.clear(),n.set(!1);return}let c=this._gitRepoDisposables.add(new P);this.gitService.openRepository(l).then(u=>{if(!c.isDisposed){if(!u){this._syncActionDisposable.clear(),n.set(!1);return}c.add(he(p=>{let h=u.state.read(p),g=this._isSyncing.read(p),f=h.HEAD;if(!f?.upstream){this._syncActionDisposable.clear(),n.set(!1);return}let v=f.ahead??0,b=f.behind??0,S=v>0||b>0;n.set(S),this._syncActionDisposable.clear(),this._syncActionDisposable.value=mgn(b,v,g,y=>{this._isSyncing.set(y,void 0)})}))}})}))}static{this.ID="sessions.contrib.gitSync"}};z2e=I([m(0,X),m(1,du),m(2,tJ)],z2e);function mgn(a,i,e,t){if(a===0&&i===0)return C.None;let o="";a>0&&(o+=`${a}\u2193 `),i>0&&(o+=`${i}\u2191`);let n=e?q.modify(M.sync,"spin"):M.sync;class r extends K{static{this.ID="chatEditing.synchronizeChanges"}constructor(){super({id:r.ID,title:o,tooltip:d(2939,null,a,i),icon:n,category:vi,menu:[{id:D.ChatEditingSessionChangesToolbar,group:"navigation",order:5,when:RDo}]})}async run(l){let c=l.get(ge),p=l.get(du).getActiveSession()?.worktree;t(!0);try{await c.executeCommand("git.sync",p)}finally{t(!1)}}}return W(r)}pt(z2e.ID,z2e,ut.AfterRestored);var WHi=new Q("agentSessionHasWorktreeAndRepository",!1,{type:"boolean",description:d(2846,null)}),K2e=class extends C{static{this.ID="sessions.contrib.applyChangesToParentRepo"}constructor(i,e){super();let t=WHi.bindTo(i);this._register(he(o=>{let n=e.activeSession.read(o),r=!!n?.worktree&&!!n?.repository;t.set(r)}))}};K2e=I([m(0,X),m(1,du)],K2e);var VHi=class a extends K{static{this.ID="chatEditing.applyChangesToParentRepo"}constructor(){super({id:a.ID,title:L(2852,"Apply Changes to Parent Repository"),icon:M.desktopDownload,category:vi,precondition:x.and($p,WHi),menu:[{id:D.ChatEditingSessionApplySubmenu,group:"navigation",order:2,when:x.and(x.false(),$p,WHi)}]})}async run(i){let e=i.get(du),t=i.get(ge),o=i.get(Ne),n=i.get(ne),r=i.get(Qe),s=i.get(nt),l=e.getActiveSession();if(!l?.worktree||!l?.repository)return;let c=l.worktree,u=l.repository,p=pi({id:"applyChangesToParentRepo.openFolder",label:d(2853,null),run:()=>{let h=s.quality==="stable"?"vscode":s.quality==="exploration"?"vscode-exploration":"vscode-insiders",g=new URLSearchParams;g.set("windowId","_blank"),g.set("session",l.resource.toString()),r.open(A.from({scheme:h,authority:Y.file,path:u.path,query:g.toString()}),{openExternal:!0})}});try{let h=await t.executeCommand("_git.revParseAbbrevRef",c.fsPath);if(!h){o.notify({severity:St.Warning,message:d(2850,null)});return}let g=await t.executeCommand("_git.mergeBranch",u.fsPath,h);g?o.notify({severity:St.Info,message:typeof g=="string"&&g.startsWith("Already up to date")?d(2847,null):d(2851,null),actions:{primary:[p]}}):n.warn("[ApplyChangesToParentRepo] No result from merge command")}catch(h){n.error("[ApplyChangesToParentRepo] Failed to apply changes",h),o.notify({severity:St.Warning,message:d(2849,null),actions:{primary:[p]}})}}};W(VHi);pt(K2e.ID,K2e,ut.AfterRestored);fe.appendMenuItem(D.ChatEditingSessionChangesToolbar,{submenu:D.ChatEditingSessionApplySubmenu,title:L(2848,"Apply Actions"),group:"navigation",order:1,when:x.and($p,ie.hasAgentSessionChanges)});var G2e=class extends C{static{this.ID="workbench.contrib.githubFileSystemProvider"}constructor(i,e){super();let t=this._register(e.createInstance(JQ));this._register(i.registerProvider(WH,t))}};G2e=I([m(0,be),m(1,F)],G2e);pt(G2e.ID,G2e,ut.AfterRestored);oe.as(ii.Configuration).registerDefaultConfigurations([{overrides:{"chat.experimentalSessionsWindowOverride":!0,"chat.agent.maxRequests":1e3,"chat.customizationsMenu.userStoragePath":"~/.copilot","chat.viewSessions.enabled":!1,"chat.implicitContext.suggestedContext":!1,"chat.implicitContext.enabled":{panel:"never"},"chat.tools.terminal.enableAutoApprove":!0,"github.copilot.chat.githubMcpServer.enabled":!0,"breadcrumbs.enabled":!1,"diffEditor.hideUnchangedRegions.enabled":!0,"extensions.ignoreRecommendations":!0,"files.autoSave":"afterDelay","git.autofetch":!0,"git.branchRandomName.enable":!0,"git.detectWorktrees":!1,"git.showProgress":!1,"github.copilot.chat.claudeCode.enabled":!0,"github.copilot.chat.cli.branchSupport.enabled":!0,"github.copilot.chat.languageContext.typescript.enabled":!0,"github.copilot.chat.cli.mcp.enabled":!0,"inlineChat.affordance":"editor","inlineChat.renderMode":"hover","terminal.integrated.initialHint":!1,"workbench.editor.doubleClickTabToToggleEditorGroupSizes":"maximize","workbench.editor.restoreEditors":!1,"workbench.startupEditor":"none","workbench.tips.enabled":!1,"workbench.layoutControl.type":"toggles","workbench.editor.useModal":"all","workbench.panel.showLabels":!1,"workbench.colorTheme":"Experimental Dark","search.quickOpen.includeHistory":!1,"window.menuStyle":"custom","window.dialogStyle":"custom"},donotCache:!0,preventExperimentOverride:!0,source:"sessionsDefaults"}]);function MDo(a){if(a?.providerType==="copilotcli")return a.worktree??a.repository}var rre=class extends C{constructor(e,t,o,n,r){super();this._sessionsManagementService=e;this._terminalService=t;this._agentSessionsService=o;this._logService=n;this._pathService=r;this._pathToInstanceIds=new Map;this._isCreatingTerminal=!1;this._register(he(s=>{let l=this._sessionsManagementService.activeSession.read(s);this._onActiveSessionChanged(l)})),this._register(this._agentSessionsService.model.onDidChangeSessionArchivedState(s=>{if(s.isArchived()){let l=s.metadata?.worktreePath;l&&this._closeTerminalsForPath(A.file(l).fsPath)}})),this._register(this._terminalService.onDidDisposeInstance(s=>{for(let[l,c]of this._pathToInstanceIds)c.delete(s.instanceId)&&c.size===0&&this._pathToInstanceIds.delete(l)})),this._register(this._terminalService.onDidCreateInstance(s=>{this._isCreatingTerminal||this._activeKey===void 0||this._pathToInstanceIds.get(this._activeKey)?.has(s.instanceId)||this._tryAdoptTerminal(s)}))}static{this.ID="workbench.contrib.sessionsTerminal"}async ensureTerminal(e,t){let o=e.fsPath.toLowerCase(),n=this._pathToInstanceIds.get(o),r=n?n.values().next().value:void 0,s=r!==void 0?this._terminalService.getInstanceFromId(r):void 0;if(s)await this._terminalService.showBackgroundTerminal(s),this._terminalService.setActiveInstance(s);else{this._isCreatingTerminal=!0;try{let l=await this._terminalService.createTerminal({config:{cwd:e}});this._addInstanceToPath(o,l.instanceId),this._terminalService.setActiveInstance(l),this._logService.trace(`[SessionsTerminal] Created terminal ${l.instanceId} for ${e.fsPath}`)}finally{this._isCreatingTerminal=!1}}t&&await this._terminalService.focusActiveInstance()}async _onActiveSessionChanged(e){if(!e)return;let o=MDo(e)??await this._pathService.userHome(),n=o.fsPath.toLowerCase();this._activeKey!==n&&(this._activeKey=n,await this.ensureTerminal(o,!1),this._activeKey===n&&this._updateTerminalVisibility(n))}_addInstanceToPath(e,t){let o=this._pathToInstanceIds.get(e);o||(o=new Set,this._pathToInstanceIds.set(e,o)),o.add(t)}async _tryAdoptTerminal(e){let t;try{t=await e.getInitialCwd()}catch{return}if(e.isDisposed)return;let o=this._activeKey;if(!o||this._pathToInstanceIds.get(o)?.has(e.instanceId))return;let r=this._sessionsManagementService.activeSession.get();t&&this._isRelatedToSession(t,r,o)?(this._addInstanceToPath(o,e.instanceId),this._logService.trace(`[SessionsTerminal] Adopted terminal ${e.instanceId} with cwd ${t}`)):this._terminalService.moveToBackground(e)}_isRelatedToSession(e,t,o){return rU(e,o,!0)?!0:t?.providerType==="copilotcli"&&t.repository?rU(e,t.repository.fsPath,!0):!1}_updateTerminalVisibility(e){let t=this._pathToInstanceIds.get(e);for(let o of[...this._terminalService.foregroundInstances])t?.has(o.instanceId)||this._terminalService.moveToBackground(o);if(t)for(let o of t){let n=this._terminalService.getInstanceFromId(o);n&&!this._terminalService.foregroundInstances.includes(n)&&this._terminalService.showBackgroundTerminal(n,!0)}}_closeTerminalsForPath(e){let t=e.toLowerCase(),o=this._pathToInstanceIds.get(t);if(o){for(let n of o){let r=this._terminalService.getInstanceFromId(n);r&&(this._terminalService.safeDisposeTerminal(r),this._logService.trace(`[SessionsTerminal] Closed archived terminal ${n}`))}this._pathToInstanceIds.delete(t)}}async dumpTracking(){let e=new Set;console.log("[SessionsTerminal] === Tracked Terminals ===");for(let[t,o]of this._pathToInstanceIds)for(let n of o){e.add(n);let r=this._terminalService.getInstanceFromId(n),s="<unknown>";if(r)try{s=await r.getInitialCwd()}catch{}console.log(`  ${n} - ${s} - ${t}`)}console.log("[SessionsTerminal] === Untracked Terminals ===");for(let t of this._terminalService.instances)if(!e.has(t.instanceId)){let o="<unknown>";try{o=await t.getInitialCwd()}catch{}console.log(`  ${t.instanceId} - ${o}`)}}};rre=I([m(0,du),m(1,Yo),m(2,ia),m(3,ne),m(4,wn)],rre);pt(rre.ID,rre,ut.AfterRestored);var BHi=class extends K{constructor(){super({id:"agentSession.openInTerminal",title:L(2965,"Open Terminal"),icon:M.terminal,menu:[{id:va.TitleBarSessionMenu,group:"navigation",order:9,when:x.and(Xc.toNegated(),fM.toNegated())}]})}async run(i){let e=Ule(rre.ID),t=i.get(du),o=i.get(wn),n=t.activeSession.get(),r=MDo(n)??await o.userHome();await e.ensureTerminal(r,!0)}};W(BHi);var HHi=class extends K{constructor(){super({id:"agentSession.dumpTerminalTracking",title:L(2964,"Dump Terminal Tracking"),f1:!0})}async run(){await Ule(rre.ID).dumpTracking()}};W(HHi);var UHi="workbench.sessions.panel.logsContainer",PDo=Re("sessions-logs-view-icon",M.output,d(2941,null)),$2e=class{static{this.ID="sessions.registerLogsViewContainer"}constructor(i){let e=oe.as(on.ViewContainersRegistry),t=oe.as(on.ViewsRegistry),o=e.get(Ul);if(o){let r=t.getView(Ul);r&&t.deregisterViews([r],o),e.deregisterViewContainer(o)}let n=e.registerViewContainer({id:UHi,title:L(2940,"Logs"),icon:PDo,order:2,ctorDescriptor:new Mt(Ha,[UHi,{mergeViewWithContainerWhenSingleView:!0}]),storageId:UHi,hideIfEmpty:!0,windowVisibility:2},1,{doNotRegisterOpenCommand:!0});t.registerViews([{id:Ul,name:L(2940,"Logs"),containerIcon:PDo,ctorDescriptor:new Mt(Aoe),canToggleVisibility:!0,canMoveView:!1,windowVisibility:2}],n)}};$2e=I([m(0,X)],$2e);pt($2e.ID,$2e,ut.BlockStartup);var jve=class extends C{constructor(e,t,o,n,r){super();this.sessionManagementService=e;this.uriIdentityService=t;this.workspaceContextService=o;this.workspaceEditingService=n;this.workspaceTrustManagementService=r;this.queue=this._register(new Op);this._register(he(s=>{let l=this.sessionManagementService.activeSession.read(s);this.queue.queue(()=>this.updateWorkspaceFoldersForSession(l))}))}static{this.ID="workbench.contrib.workspaceFolderManagement"}async updateWorkspaceFoldersForSession(e){await this.manageTrustWorkspaceForSession(e);let t=this.getActiveSessionFolderData(e),o=this.workspaceContextService.getWorkspace().folders[0]?.uri;if(!t){o&&await this.workspaceEditingService.removeFolders([o],!0);return}if(!o){await this.workspaceEditingService.addFolders([t],!0);return}this.uriIdentityService.extUri.isEqual(o,t.uri)||await this.workspaceEditingService.updateFolders(0,1,[t],!0)}getActiveSessionFolderData(e){if(e){if(e.worktree)return{uri:e.worktree,name:e.repository?`${this.uriIdentityService.extUri.basename(e.repository)} (${this.uriIdentityService.extUri.basename(e.worktree)})`:this.uriIdentityService.extUri.basename(e.worktree)};if(e.repository){if(e.providerType==="copilotcli")return{uri:e.repository};if(e.providerType==="copilot-cloud-agent")return{uri:e.repository,name:gDo(e.repository)}}}}async manageTrustWorkspaceForSession(e){e?.providerType==="copilotcli"&&(!e.repository||!e.worktree||this.isUriTrusted(e.worktree)||await this.workspaceTrustManagementService.setUrisTrust([e.worktree],!0))}isUriTrusted(e){return this.workspaceTrustManagementService.getTrustedUris().some(t=>this.uriIdentityService.extUri.isEqual(t,e))}};jve=I([m(0,du),m(1,dt),m(2,Pe),m(3,Of),m(4,ns)],jve);pt(jve.ID,jve,ut.AfterRestored);var zHi="workbench.agentsession.welcomeComplete",Eut=class extends C{constructor(e,t,o,n,r){super();this.chatEntitlementService=t;this.commandService=o;this.extensionService=n;this.logService=r;this.overlay=R(e,_(".sessions-welcome-overlay")),this.overlay.setAttribute("role","dialog"),this.overlay.setAttribute("aria-modal","true"),this.overlay.setAttribute("aria-label",d(2974,null)),this._register(Z(()=>this.overlay.remove()));let s=R(this.overlay,_(".sessions-welcome-card")),l=R(s,_(".sessions-welcome-header"));R(l,_("span.sessions-welcome-icon")).appendChild(Qo(M.agent)),R(l,_("h2",void 0,d(2976,null))),R(l,_("p.sessions-welcome-subtitle",void 0,d(2975,null)));let u=R(s,_(".sessions-welcome-action-area")),p=this._register(new Mi(u,{...Ko}));p.label=d(2967,null);let h=R(u,_(".sessions-welcome-spinner"));h.style.display="none";let g=R(u,_("p.sessions-welcome-error"));g.style.display="none",this._register(p.onDidClick(()=>this._runSetup(p,h,g))),p.focus()}async _runSetup(e,t,o){e.enabled=!1,o.style.display="none",t.textContent="",t.appendChild(Qo(M.loading)),R(t,_("span",void 0,d(2969,null))),t.style.display="";try{await this.commandService.executeCommand(n3,{dialogIcon:M.agent,dialogTitle:this.chatEntitlementService.anonymous?d(2972,null):d(2971,null),dialogHideSkip:!0})?(t.textContent="",t.appendChild(Qo(M.loading)),R(t,_("span",void 0,d(2968,null))),this.logService.info("[sessions welcome] Restarting extension host after setup completion"),await this.extensionService.stopExtensionHosts(d(2973,null))&&await this.extensionService.startExtensionHosts()):(e.enabled=!0,t.style.display="none")}catch(n){this.logService.error("[sessions welcome] Setup failed:",n),o.textContent=d(2970,null),o.style.display="",e.enabled=!0,t.style.display="none"}}dismiss(){this.overlay.classList.add("sessions-welcome-overlay-dismissed");let e=setTimeout(()=>this.dispose(),200);this._register(Z(()=>clearTimeout(e)))}};Eut=I([m(1,vr),m(2,ge),m(3,lt),m(4,ne)],Eut);var q2e=class extends C{constructor(e,t,o,n,r,s){super();this.chatEntitlementService=e;this.layoutService=t;this.instantiationService=o;this.productService=n;this.storageService=r;this.contextKeyService=s;this.overlayRef=this._register(new me);this.watcherRef=this._register(new me);if(!this.productService.defaultChatAgent?.chatExtensionId)return;!this.storageService.getBoolean(zHi,-1,!1)?this.showOverlay():this.showOverlayIfNeeded()}static{this.ID="workbench.contrib.sessionsWelcome"}showOverlayIfNeeded(){this._needsChatSetup()?this.showOverlay():this.watchForRegressions()}watchForRegressions(){let e=!this._needsChatSetup();this.watcherRef.value=he(t=>{this.chatEntitlementService.sentimentObs.read(t),this.chatEntitlementService.entitlementObs.read(t);let o=this._needsChatSetup();e&&o&&this.showOverlay(),e=!o})}_needsChatSetup(){let{sentiment:e,entitlement:t}=this.chatEntitlementService;return!!(!e?.installed||e?.disabled||t===3||t===1&&!this.chatEntitlementService.anonymous)}showOverlay(){if(this.overlayRef.value)return;this.watcherRef.clear(),this.overlayRef.value=new P;let e=fM.bindTo(this.contextKeyService);e.set(!0),this.overlayRef.value.add(Z(()=>e.reset()));let t=this.overlayRef.value.add(this.instantiationService.createInstance(Eut,this.layoutService.mainContainer));this.overlayRef.value.add(he(o=>{this.chatEntitlementService.sentimentObs.read(o),this.chatEntitlementService.entitlementObs.read(o),this._needsChatSetup()||(this.storageService.store(zHi,!0,-1,1),t.dismiss(),this.overlayRef.clear(),this.watchForRegressions())}))}};q2e=I([m(0,vr),m(1,fi),m(2,F),m(3,nt),m(4,le),m(5,X)],q2e);pt(q2e.ID,q2e,ut.BlockRestore);W(class extends K{constructor(){super({id:"workbench.action.resetSessionsWelcome",title:L(2966,"Reset Sessions Welcome"),category:We.Developer,f1:!0})}run(a){a.get(le).remove(zHi,-1)}});we(r4,new Mt(QOt,[[]],!0));export{emn 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 */
//# sourceMappingURL=https://main.vscode-cdn.net/sourcemaps/ce099c1ed25d9eb3076c11e4a280f3eb52b4fbeb/core/vs\sessions\sessions.desktop.main.js.map

Youez - 2016 - github.com/yon3zu
LinuXploit